/** * Initialize the class and set its properties. * * @since 1.0.0 * @var string $plugin_slug The name of the plugin. * @var string $version The version of this plugin. */ public function __construct($plugin_slug, $version) { $this->plugin_slug = $plugin_slug; $this->version = $version; $arve_shared = new Advanced_Responsive_Video_Embedder_Shared(); $this->options = $arve_shared->get_options(); $this->regex_list = $arve_shared->get_regex_list(); }
/** * Register the JavaScript for the dashboard. * * @since 1.0.0 */ public function enqueue_scripts() { if ($this->admin_page_has_post_editor()) { $regex_list = Advanced_Responsive_Video_Embedder_Shared::get_regex_list(); wp_enqueue_script($this->plugin_slug, plugin_dir_url(__FILE__) . 'advanced-responsive-video-embedder-admin.js', array('jquery'), $this->version, true); foreach ($regex_list as $provider => $regex) { if ($provider != 'ign') { $regex = str_replace(array('https?://(?:www\\.)?', 'http://'), '', $regex); } $regex_list[$provider] = $regex; } wp_localize_script($this->plugin_slug, 'arve_regex_list', $regex_list); } }
/** * * @since 3.0.0 * */ public function create_url_handlers() { $regex_list = Advanced_Responsive_Video_Embedder_Shared::get_regex_list(); foreach ($regex_list as $provider => $regex) { wp_embed_register_handler('arve_' . $provider, '#' . $regex . '#i', array($this, 'url_embed_' . $provider)); } }