Giter VIP home page Giter VIP logo

iframely-wordpress's People

Contributors

garmoncheg avatar iparamonau avatar yellowby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iframely-wordpress's Issues

Options page

In order to implement all changes we need for this release, we also need an options page for it. Here it is. The text in (brackets) is explanations. Everything else is actual copy of the page.

Iframely Options

Iframely will take URLs you place in editor on a separate line and will try to detect responsive embed codes for it. If successful, Iframely will put embed HTML code in your post. You can also use Iframely with [iframely http://url.com] shortcode.

  • Enter Iframely API Key: [ ]

  • [(checkbox)] Only use Iframely with [iframely] shortcode

    • It will block Iframely from intercepting all URLs in your editor that may be covered by embeds plugins you have installed, e.g. a Jetpack.

    [Submit]

[iframely] shortcode

We need to create the shortcode for Iframely in a format [iframely http://url.com].

It should work as default [embed]shortcode, with one twist:

  • If url is not to iframe.ly domain and there is now API Key configured, convert the shortcode to message "Please, enter your API key in Iframely options or manually shorten URL at iframe.ly"

Exclude some URLs if options tell us to do so

If options suggest that plugin should only be used to detect iframe.ly URLs on separate line, we need to follow the instructions.

In this case, we only add Iframely oembed endpoint for iframe.ly domain.

Also, we still need to make sure that all URLs are sent to our endpoint through [iframely] shortcode

The `install_plugins` capability requirements break the plugin on Multisite with file write restriction environments

Hi,

I noticed in these lines:

add_submenu_page('settings.php', __('Iframely', 'iframely'), __('Iframely', 'iframely'), 'install_plugins', 'iframely', [self::class, 'render']);

if (!current_user_can('install_plugins')) {

you used the install_plugins capability for Multisite WP instances to check if the user has permission for certain actions.

If the wp_is_file_mod_allowed returns false (the file modification is not allowed through constant DISALLOW_FILE_MODS or file_mod_allowed filter), the plugin's settings page will not show up on such instances and there will be no way to save API key.

We are building a site on WP VIP hosting which has these restrictions, and we cannot use this plugin without a workaround.

Is it possible to change these capabilities to manage_options or add a filter to customize them?

For the context, the WP core checks if the files are writable and returns false for the install_plugins capability check here:
https://github.com/WordPress/WordPress/blob/master/wp-includes/capabilities.php#L615-L627

The 'install_plugins' capability check prevents from saving settigns on multisite instances when file editing is disabled

Hi,

Thanks for fixing the issue in #41, but there is one more place where the install_plugins capability is used for multisite instances, could you also change the capability to manage_network_options here:

https://github.com/itteco/iframely-wordpress/blob/eb9998405bbe024f508c94b7002b4b4d0cb18011/app/UI/Settings.php#L71C1-L71C1

This prevents from saving the settings on save there is not enough permissions screen.

Thanks,
Piotr

New API Endpoint

We have a new (hosted) API Endpoint for Iframely.

http://iframe.ly/oembed?url={YOUR URL}&api_key={YOUR KEY}&origin=hashtag

See the API Spec here.
Of course, you can change the order of GET parameters to easier configure endpoint in WP. For example, put static api_key and origin first, followed by url that will be changing.

  • If api_key is configured in Options - use it here. Otherwise, omit the api_key all together
  • origin field is the name of blog's domain that WP should have in its settings.

The plugin does not work on WP 6.3.2 and 6.4.1

Hi,

I have tested the latest version of your WordPress plugin on WP 6.3.2 and 6.41 and it does not seem to work.

  • In 6.3.2 observed the following issues:

    • The Iframely options in the block uncheck themselves randomly:
    Opera.-.Edit.Post.VOX-228.VIP.Go.WordPress.-.Opera.-.29.November.2023.mp4
    • When you check Iframley option and save the post, then reload the post the embed block causes parsing error:
      image
      The console reports:
    blocks.min.js?ver=b5d3b99262dfb659bd26:10 Block validation: Block validation failed for `core/embed` (Object).
    
    Content generated by `save` function:
    
    <figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube"><div class="wp-block- 
    embed__wrapper">
    https://www.youtube.com/watch?v=84wL7JOar8wu0026iframely=eyJjbGlja190b19wbGF5Ijp0cnVlfQ%3D%3D
    </div></figure>
    
    Content retrieved from post body:
    
    <figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube"><div class="wp-block- embed__wrapper">
    https://www.youtube.com/watch?v=84wL7JOar8w&iframely=eyJjbGlja190b19wbGF5Ijp0cnVlfQ%3D%3D
    </div></figure>
    
  • In 6.4.1 the embed block crashes once you enter the URL:

Opera.-.Edit.Post.Hello.world.Holistic.Fish.WordPress.-.Opera.-.29.November.2023.mp4

The console reports the following error:

TypeError: Cannot read properties of null (reading 'innerHTML')
    at c.updateEmptyPlaceholder (index.js?ver=1.0.2:1:1175)
    at c.componentDidMount (index.js?ver=1.0.2:1:1690)
    at Jr (react-dom.min.js?ver=18.2.0:10:80714)
    at Zr (react-dom.min.js?ver=18.2.0:10:80489)
    at Gr (react-dom.min.js?ver=18.2.0:10:80023)
    at react-dom.min.js?ver=18.2.0:10:91526
    at xl (react-dom.min.js?ver=18.2.0:10:92039)
    at fl (react-dom.min.js?ver=18.2.0:10:85808)
    at Nn (react-dom.min.js?ver=18.2.0:10:32474)
    at react-dom.min.js?ver=18.2.0:10:83226

This leads to this line in the current version of the plugin https://github.com/itteco/iframely-wordpress/blob/main/src/js/components/IframelyOptions.js#L16C1-L16C1 which does not check if the element exists (the placeholder element is null sometimes).

Could you look into these errors?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.