get_col( "SELECT blog_id FROM $wpdb->blogs" ); foreach ( $blog_ids as $blog_id ) { if($blog_id == $current_blog_id){ //current site } else { //other site active check switch_to_blog( $blog_id ); if ( is_plugin_active( plugin_basename( __FILE__ ))) $act = true; } } switch_to_blog( $current_blog_id ); } } if($act === false){ flush_rewrite_rules(); //options data 'rewrite_rules' clear for remake. if ( file_exists( WPMU_PLUGIN_DIR . "/plf-filter.php" )) { @unlink( WPMU_PLUGIN_DIR . '/plf-filter.php' ); } } } register_deactivation_hook( __FILE__, 'plugin_load_filter_deactivation' ); //uninstall function plugin_load_filter_uninstall() { if ( !is_multisite()) { delete_option('plf_queryvars'); delete_option('plf_option' ); delete_option('plf_addon_options'); } else { global $wpdb; $current_blog_id = get_current_blog_id(); $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); foreach ( $blog_ids as $blog_id ) { switch_to_blog( $blog_id ); delete_option('plf_queryvars'); delete_option('plf_option' ); delete_option('plf_addon_options'); } switch_to_blog( $current_blog_id ); } if ( file_exists( WPMU_PLUGIN_DIR . "/plf-filter.php" )) { @unlink( WPMU_PLUGIN_DIR . '/plf-filter.php' ); } } register_uninstall_hook(__FILE__, 'plugin_load_filter_uninstall'); } $Plf_setting = new Plf_setting(); class Plf_setting { static $plugins_inf = ''; //active plugin/module infomation static $filter = array(); //filter option data private $tab_num = 0; /*************************************************************************** * Style Sheet **************************************************************************/ function plf_css() { ?> $a_plugin ) { if(is_plugin_inactive( $plugin_key )){ unset(self::$plugins_inf[$plugin_key]); } } if(class_exists('Plf_filter')){ if ( is_multisite() ) add_filter('pre_site_option_active_sitewide_plugins', array('Plf_filter', 'active_sitewide_plugins')); add_filter('pre_option_active_plugins', array('Plf_filter', 'active_plugins')); } //jetpack active module if(method_exists('Jetpack', 'get_module')){ if(class_exists('Plf_filter')){ remove_filter('pre_option_jetpack_active_modules', array('Plf_filter', 'active_jetmodules')); } $modules = Jetpack::get_active_modules(); $modules = array_diff( $modules, array( 'vaultpress' ) ); foreach ( $modules as $key => $module_name ) { if(!empty($module_name)){ $module = Jetpack::get_module( $module_name ); if(!empty($module)) self::$plugins_inf['jetpack_module/' . $module_name] = $module; } } if(class_exists('Plf_filter')){ add_filter('pre_option_jetpack_active_modules', array('Plf_filter', 'active_jetmodules')); } } //celtispack active module if(method_exists('Celtispack', 'get_module')){ if(class_exists('Plf_filter')){ remove_filter('pre_option_celtispack_active_modules', array('Plf_filter', 'active_celtismodules')); } $modules = Celtispack::get_active_modules(); foreach ( $modules as $key => $module_name ) { if(!empty($module_name)){ self::$plugins_inf['celtispack_module/' . $module_name] = Celtispack::get_module( $module_name ); } } if(class_exists('Plf_filter')){ add_filter('pre_option_celtispack_active_modules', array('Plf_filter', 'active_celtismodules')); } } if ( empty( self::$plugins_inf ) ) return; } add_action('admin_menu', array(&$this, 'plf_option_menu')); } static function get_plugins_inf() { $inf = (!empty(self::$plugins_inf))? self::$plugins_inf : false; return $inf; } //Plugins sub menu add public function plf_option_menu() { if(current_user_can( 'activate_plugins' )){ $page = add_menu_page( 'Plugin Load FIlter Settings', esc_html__('Plugin Load Filter', 'plf'), 'manage_options', 'plugin_load_filter_admin_manage_page', array(&$this, 'plf_option_page'), 'dashicons-filter', '65.1'); add_submenu_page( 'plugin_load_filter_admin_manage_page', 'Plugin Load FIlter Settings', esc_html__('General Settings', 'plf'), 'manage_options', 'plugin_load_filter_admin_manage_page', array(&$this, 'plf_option_page') ); add_action( 'admin_print_scripts-'.$page, array(&$this, 'plf_scripts') ); add_action( 'admin_print_scripts-'.$page, array(&$this, 'deploy_mu_plugins')); } } //Plugin Load Filter setting page script function plf_scripts() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-widget' ); wp_enqueue_script( 'jquery-ui-tabs' ); add_action( 'admin_head', array(&$this, 'plf_css' )); add_action( 'admin_head', array(&$this, 'jquery_tab_css' )); add_action( 'admin_footer', array(&$this, 'activetab_script' )); add_action( 'admin_notices', array('Plf_setting', 'plf_notice')); } //plf-filter.php mu-plugins module set public function deploy_mu_plugins() { if(wp_mkdir_p( WPMU_PLUGIN_DIR )){ if ( !file_exists( WPMU_PLUGIN_DIR . "/plf-filter.php" )) { @copy(__DIR__ . '/mu-plugins/plf-filter.php', WPMU_PLUGIN_DIR . '/plf-filter.php'); } else { require_once(ABSPATH . 'wp-admin/includes/plugin.php'); $dp = get_plugin_data( WPMU_PLUGIN_DIR . "/plf-filter.php", false, false ); $sp = get_plugin_data( __DIR__ . '/mu-plugins/plf-filter.php', false, false ); if(version_compare( $dp['Version'], $sp['Version'], '!=')){ @copy(__DIR__ . '/mu-plugins/plf-filter.php', WPMU_PLUGIN_DIR . '/plf-filter.php'); } } } } //Notice Message display static function plf_notice() { $notice = get_transient('plf_notice'); if(!empty($notice)){ echo '

Plugin Load Filter : ' . $notice . '

'; delete_transient('plf_notice'); } } //plugin filter option action request (add, update, delete) function action_posts() { if (current_user_can( 'activate_plugins' )) { if( isset($_POST['edit_regist_filter']) ) { if(isset($_POST['plfregist'])){ check_admin_referer('plugin_load_filter'); //url filter $groupkeys = (method_exists('Plf_filter', 'get_active_group'))? Plf_filter::get_active_group() : array(); if(!empty($groupkeys) && isset($_POST['plfurlkey'])){ $urlkeys = array_keys($_POST['plfurlkey']); foreach( $groupkeys as $item){ if(empty( $_POST['plfurlkey'][$item])){ self::$filter['plfurlkey'][$item]['plugins'] = ''; } else { $plugins = array(); foreach ( $_POST['plfurlkey'][$item] as $p_key => $val ) { if($val == '1') $plugins[] = $p_key; } $option["plugins"] = implode(",", $plugins); self::$filter['plfurlkey'][$item] = $option; } } } //page type filter foreach( array('_admin', '_pagefilter') as $item){ $plugins = array(); foreach ( $_POST['plfregist'] as $p_key => $val ) { if($val == $item) $plugins[$p_key] = $val; } if($item == '_pagefilter'){ //If all modules is specified filter, in some cases you want to deactivate plugin itself. $jbase = $cbase = ''; $jall = $call = true; foreach ( $_POST['plfregist'] as $p_key => $val ) { if(strpos($p_key, 'jetpack/') !== false) $jbase = $p_key; else if(strpos($p_key, 'celtispack/') !== false) $cbase = $p_key; else if(strpos($p_key, 'jetpack_module/') !== false){ if($val != '_pagefilter' && $val != '_admin'){ $jall = false; } } else if(strpos($p_key, 'celtispack_module/') !== false){ if($val != '_pagefilter' && $val != '_admin') $call = false; } } if(!empty($jbase) && $jall === false) unset($plugins[$jbase]); if(!empty($cbase) && $call === false) unset($plugins[$cbase]); } $option["plugins"] = implode(",", array_keys($plugins)); self::$filter[$item] = $option; } //exclude option if(isset($_POST['plf_option']['exclude'])){ $exclude = array(); foreach ( $_POST['plf_option']['exclude'] as $ft => $v ) { if(!empty($v)) $exclude[$ft] = true; } self::$filter['exclude'] = $exclude; } else { self::$filter['exclude'] = array(); } //admin bar (filtered stat) self::$filter['admin_bar'] = (isset($_POST['plf_option']['admin_bar']))? 1 : 0; //Language option self::$filter['language'] = (isset($_POST['plf_option']['language']))? 1 : 0; //Ajax acceleration plugin filter (for plugin developers) self::$filter['ajax_accelfilter'] = (isset($_POST['plf_option']['ajax_accelfilter']))? 1 : 0; update_option('plf_option', self::$filter ); } header('Location: ' . admin_url('plugins.php?page=plugin_load_filter_admin_manage_page')); exit; } elseif( isset($_POST['clear_regist_filter']) ) { check_admin_referer('plugin_load_filter'); if(!empty(self::$filter['plfurlkey'])){ foreach (self::$filter['plfurlkey'] as $key => $val) { unset(self::$filter['plfurlkey'][$key]); } } foreach( array('_admin', '_pagefilter') as $item){ self::$filter[$item] = array(); } self::$filter['exclude'] = array(); //old data unset if(isset(self::$filter['urlkey'])){ unset(self::$filter['urlkey']); } if(isset(self::$filter['urlkeylist'])){ unset(self::$filter['urlkeylist']); } self::$filter['admin_bar'] = 0; self::$filter['language'] = 0; self::$filter['ajax_accelfilter'] = 0; update_option('plf_option', self::$filter ); header('Location: ' . admin_url('plugins.php?page=plugin_load_filter_admin_manage_page')); exit; } else if(isset($_POST['edit_activate_page_filter']) ) { if(isset($_POST['plfactive'])){ check_admin_referer('plugin_load_filter'); self::$filter['group'] = array(); $group = array_keys($_POST['plfactive']); foreach( $group as $item){ $plugins = array(); foreach ( $_POST['plfactive'][$item] as $p_key => $val ) { if($val == '1') $plugins[] = $p_key; } $option["plugins"] = implode(",", $plugins); self::$filter['group'][$item] = $option; } update_option('plf_option', self::$filter ); } header('Location: ' . admin_url('plugins.php?page=plugin_load_filter_admin_manage_page&action=tab_1')); exit; } elseif( isset($_POST['clear_activate_page_filter']) ) { check_admin_referer('plugin_load_filter'); self::$filter['group'] = array(); update_option('plf_option', self::$filter ); header('Location: ' . admin_url('plugins.php?page=plugin_load_filter_admin_manage_page&action=tab_1')); exit; } if(!empty($_GET['action']) && $_GET['action']=='tab_1') { $this->tab_num = 1; } } } //Plugin or Module key to name // $type : list/smart/tree static function pluginkey_to_name( $infkey, $type='list') { $name = ''; if(strpos($infkey, 'jetpack_module/') !== false){ if(!empty(self::$plugins_inf[$infkey]['name'])){ $m_mark = ($type !== 'list')? '-' : 'Jetpack-'; if($type === 'smart') { if(empty(self::$filter['_pagefilter']['plugins']) || strpos(self::$filter['_pagefilter']['plugins'], 'jetpack/') === false) $name = $m_mark . self::$plugins_inf[$infkey]['name']; } else { $name = $m_mark . self::$plugins_inf[$infkey]['name']; } } } elseif(strpos($infkey, 'celtispack_module/') !== false){ if(!empty(self::$plugins_inf[$infkey]['Name'])){ $m_mark = ($type !== 'list')? '-' : 'Celtispack-'; if($type === 'smart') { if(empty(self::$filter['_pagefilter']['plugins']) || strpos(self::$filter['_pagefilter']['plugins'], 'celtispack/') === false) $name = $m_mark . self::$plugins_inf[$infkey]['Name']; } else { $name = $m_mark . self::$plugins_inf[$infkey]['Name']; } } } else { if(!empty(self::$plugins_inf[$infkey]['Name'])) $name = self::$plugins_inf[$infkey]['Name']; } return($name); } //Checkbox static function checkbox($name, $value, $label = '') { return ""; } static function altcheckbox($name, $value, $label = '') { //return ""; return ""; } //dropdown list static function dropdown($name, $items, $selected, $args = null) { $defaults = array( 'id' => $name, 'none' => false, 'class' => null, 'multiple' => false, 'select_attr' => "" ); if (!is_array($items)) return; if (empty($items)) $items = array(); // Items is in key => value format. If value is itself an array, use only the 1st column foreach ($items as $key => &$value) { if (is_array($value)) $value = array_shift($value); } extract(wp_parse_args($args, $defaults)); // If 'none' arg provided, prepend a blank entry if ($none) { if ($none === true) $none = ' '; $items = array('' => $none) + $items; // Note that array_merge() won't work because it renumbers indexes! } if (!$id) $id = $name; $name = ($name) ? "name='$name'" : ""; $id = ($id) ? "id='$id'" : ""; $class = ($class) ? "class='$class'" : ""; $multiple = ($multiple) ? "multiple='multiple'" : ""; $html = ""; return $html; } //安全な文字列から指定タグのみデコード(既存の翻訳ファイルへ影響せずにエスケープするために使用) //<strong>Type</strong> -> Type static function decode_safe_tag( $tag, $safe_str ) { $safe_str = preg_replace_callback( "|<($tag.*)>(.*)</($tag)>|im", function($matches){ $tag_attrs = str_replace( '"', '"', $matches[1]); return '<' . $tag_attrs . '>' . $matches[2] . ''; }, $safe_str); return $safe_str; } public function plfregist_item($key, $chklist, $filter) { $p_name = self::pluginkey_to_name($key); $opt_name = "plfregist[$key]"; ?> ' . self::altcheckbox("plfurlkey[$urlkey][$key]", $checked, '') . ''; } $radio = ''; if(!empty($filter['_admin']['plugins']) && false !== strpos($filter['_admin']['plugins'], $key)) $radio = '_admin'; else if(!empty($filter['_pagefilter']['plugins']) && false !== strpos($filter['_pagefilter']['plugins'], $key)) $radio = '_pagefilter'; ?>
0) { ?> 0) { foreach ( $groupkeys as $v) { $_flt = (method_exists('Plf_filter', 'get_slug_filter'))? Plf_filter::get_slug_filter( $v ) : array(); $hint = ''; foreach ($_flt as $_v) { $hint .= '[' . $_v['slug'] . '] ' . $_v['summary'] . PHP_EOL; if((int)$_v['targetpage'] === 1) { $post_type = (!empty($_v['post_type']))? $_v['post_type'] : ''; $taxonomy = ''; if(!empty($_v['taxonomies']) && !empty($_v['term'])){ $taxonomy = " : {$_v['taxonomies']}({$_v['term']})"; } if(!empty($post_type)){ $hint .= 'Singular (' . $post_type . ')' . $taxonomy . PHP_EOL; } else { $hint .= 'Singular ' . $taxonomy . PHP_EOL; } } elseif((int)$_v['targetpage'] === 2) { if(!empty($_v['ajax_action'])){ $hint .= 'Ajax request (' . $_v['ajax_action'] . ')' . PHP_EOL; } else { $hint .= 'Ajax request' . PHP_EOL; } } $hint .= 'url filter : '; $urlkey = (!empty($_v['url_path']))? array_filter( array_map("trim", explode(PHP_EOL, $_v['url_path']))) : array(); if(!empty($urlkey)){ foreach ($urlkey as $key) { $hint .= $key . ' '; } } $urlkey = (!empty($_v['url_q_and']))? array_filter( array_map("trim", explode(PHP_EOL, $_v['url_q_and']))) : array(); if(!empty($urlkey)){ foreach ($urlkey as $key) { $hint .= ' AND ' . $key; } } $urlkey = (!empty($filter['url_q_not']))? array_filter( array_map("trim", explode(PHP_EOL, $filter['url_q_not']))) : array(); if(!empty($urlkey)){ foreach ($urlkey as $key) { $hint .= ' NOT ' . $key; } } $hint .= PHP_EOL . PHP_EOL; } echo ""; } } ?> $val ) { $name = self::pluginkey_to_name($p_key); if(!empty($name)) $plist[$p_key] = ''; } $jlist = $clist = array(); foreach ( $plist as $p_key => $val ) { if(strpos($p_key, 'jetpack_module/') !== false){ $jlist[$p_key] = $plist[$p_key]; unset($plist[$p_key]); } else if(strpos($p_key, 'celtispack_module/') !== false){ $clist[$p_key] = $plist[$p_key]; unset($plist[$p_key]); } } //Addon URL filter group key $chklist = array(); if($urlnum > 0) { foreach ( $groupkeys as $key) { $chklist[] = $key; } } foreach ( $plist as $p_key => $val ) { $modules = array(); if(strpos($p_key, 'jetpack/') !== false) $modules = $jlist; else if(strpos($p_key, 'celtispack/') !== false) $modules = $clist; else $this->plfregist_item($p_key, $chklist, $filter); if(!empty($modules)){ echo ""; foreach ( $modules as $m_key => $val) { $this->plfregist_item($m_key, $chklist, $filter); } } } ?>
{$v}

[ ]

Normal - Exclude plugin from Page Type filter', 'plf')); ?>
Admin Type - If you only use plugins for Admin pages.', 'plf')); ?>
Page Type - If you want to activate or deactivate plugins for each Page Type and Single page.', 'plf')); ?>

' . self::checkbox("plf_option[admin_bar]", $checked, esc_html__('Add a link to admin bar for displaying the plugins filtered status', 'plf') ) . ''; ?>

Exclude Post Format Type - Choose Post Format Type you are not using. To exclude from Page Type item subject.', 'plf')); ?>

'; $pformat = array('image', 'gallery', 'video', 'audio', 'aside', 'status', 'quote', 'link', 'chat' ); foreach ( $pformat as $type ) { $checked = (!empty(self::$filter['exclude'][$type]))? self::$filter['exclude'][$type] : false; $label = "$type"; $html .= self::checkbox("plf_option[exclude][$type]", $checked, $label); } $html .= '
'; echo $html; ?>

[ ]

' . self::checkbox("plf_option[ajax_accelfilter]", $checked, esc_html__('Ajax acceleration filter', 'plf') ) . '
'; ?>

[ ]

' . self::checkbox("plf_option[language]", $checked, esc_html__('Language switching per post', 'plf') ) . ''; ?>

Plugin Load Filter Addon

Realtime Image Optimizer

$p_name"; foreach($devlist as $devtype){ $checked = (empty($filter['group'][$devtype]['plugins']) || false === strpos($filter['group'][$devtype]['plugins'], $p_key))? false : true; echo '' . self::altcheckbox("plfactive[$devtype][$p_key]", $checked, '') . ''; } foreach($chklist as $pgtype){ $checked = (empty($filter['group'][$pgtype]['plugins']) || false === strpos($filter['group'][$pgtype]['plugins'], $p_key))? false : true; echo '' . self::altcheckbox("plfactive[$pgtype][$p_key]", $checked, '') . ''; } echo ""; } } public function plfactive_table($plugins, $select_cvplugins, $filter) { if(empty($select_cvplugins)) return; ?>
$v) { if(!empty($v)){ $exclude[] = $type; } } } foreach ( $pformat as $type) { if(!in_array($type, $exclude)){ $title = esc_html__('Post : ', 'plf') . $type; $icon = ($type === "link")? "dashicons-admin-links" : "dashicons-format-$type"; echo ''; } } if(function_exists('is_embed')){ $title = esc_html__('WordPress Embed Content Card (API)', 'plf'); echo ""; } $post_types = get_post_types( array('public' => true, '_builtin' => false) ); foreach ( $post_types as $post_type ) { if(!empty($post_type)){ $title = esc_html__('Custom Post : ', 'plf') . $post_type; echo ""; } } ?> $p_data ) { $p_name = self::pluginkey_to_name($p_key); if(empty($p_name)) continue; if(strpos($p_key, 'jetpack_module/') !== false) $jmodules[] = $p_key; else if(strpos($p_key, 'celtispack_module/') !== false) $cmodules[] = $p_key; else $nplugins[] = $p_key; } $chklist = array('home', 'archive', 'search', 'attachment', 'page', 'post'); foreach ( $pformat as $type) { if(!in_array($type, $exclude)){ $chklist[] = "post-$type"; } } if(function_exists('is_embed')){ $chklist[] = 'content-card'; } $post_types = get_post_types( array('public' => true, '_builtin' => false) ); foreach ( $post_types as $post_type ) { $chklist[] = $post_type; } foreach ( $nplugins as $p_key ) { if(strpos($p_key, 'jetpack/') !== false){ foreach ( $jmodules as $p_key ) { $this->_plfactive_checkbox_row($p_key, $select_cvplugins, $chklist, $filter); } } else if(strpos($p_key, 'celtispack/') !== false){ foreach ( $cmodules as $p_key ) { $this->_plfactive_checkbox_row($p_key, $select_cvplugins, $chklist, $filter); } } else { $this->_plfactive_checkbox_row($p_key, $select_cvplugins, $chklist, $filter); } } ?>

Desktop

Mobile

Home

Archive

Search

Attach

Page

Post

' . $type .'
Embed Content$post_type

ID) ) { add_meta_box( 'pluginfilterdiv', esc_html__( 'Plugin Load Filter', 'plf' ), array(&$this, 'plf_meta_box'), null, 'side' ); //add_action( 'admin_head', array(&$this, 'plf_css' )); add_action( 'admin_footer', array(&$this, 'plf_meta_script' )); } } //Plugin pagefilter Selected Checkbox (plugin and modules list) // $p_key // $select_cvplugins : csv string : pagefilter selected plugins // $checked_arcvplugins : array csv string : ['desktop']=desktop enable plugins, ['mobile']=mobile enable plugins function _pagefilter_plugins_checklist( $p_key, $select_cvplugins, $checked_arcvplugins ) { $html = ''; $selplugins = array_map("trim", explode(',', $select_cvplugins)); $device['desktop'] = $checked_arcvplugins['desktop']; $device['mobile'] = $checked_arcvplugins['mobile']; $devlist = array('desktop','mobile'); if(in_array( $p_key, $selplugins )){ $p_name = self::pluginkey_to_name($p_key); $html .= "$p_name"; foreach($devlist as $devtype){ $checked = (empty($device[$devtype]) || false === strpos($device[$devtype], $p_key))? false : true; $html .= "" . self::altcheckbox("plf_option[$devtype][$p_key]", $checked, '') . ''; } $html .= ""; } return $html; } //Plugin pagefilter Selected Checkbox (plugin and modules list) // $plugins : array : all active plugins // $select_cvplugins : csv string : pagefilter selected plugins // $checked_arcvplugins : array csv string : ['desktop']=desktop enable plugins, ['mobile']=mobile enable plugins function pagefilter_plugins_checklist( $plugins, $select_cvplugins, $checked_arcvplugins ) { if(empty($select_cvplugins)) return esc_html__('Page Filter is not registered', 'plf'); $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $nplugins = $jmodules = $cmodules = array(); foreach ( $plugins as $p_key => $p_data ) { $p_name = self::pluginkey_to_name($p_key); if(empty($p_name)) continue; if(strpos($p_key, 'jetpack_module/') !== false) $jmodules[] = $p_key; else if(strpos($p_key, 'celtispack_module/') !== false) $cmodules[] = $p_key; else $nplugins[] = $p_key; } foreach ( $nplugins as $p_key ) { if(strpos($p_key, 'jetpack/') !== false){ foreach ( $jmodules as $p_key ) { $html .= $this->_pagefilter_plugins_checklist( $p_key, $select_cvplugins, $checked_arcvplugins ); } } else if(strpos($p_key, 'celtispack/') !== false){ foreach ( $cmodules as $p_key ) { $html .= $this->_pagefilter_plugins_checklist( $p_key, $select_cvplugins, $checked_arcvplugins ); } } else { $html .= $this->_pagefilter_plugins_checklist( $p_key, $select_cvplugins, $checked_arcvplugins ); } } $html .= ''; $html .= '
'. esc_html__('Plugins') . '
Desktop

Mobile
'; return $html; } //get_locale に加えたフィルターフックを外してサイトのロケールを取得 static function get_site_locale(){ global $locale; if(class_exists('Plf_filter')){ remove_filter( 'locale', array('Plf_filter', 'post_locale') ); $locale = null; $site_locale = get_locale(); add_filter( 'locale', array('Plf_filter', 'post_locale') ); } else { $locale = null; $site_locale = get_locale(); } return $site_locale; } function plf_meta_box( $post, $box ) { if(is_object($post)){ $myfilter = get_post_meta( $post->ID, '_plugin_load_filter', true ); //ver2.2.0 for compatibility, set 'plugins' data to 'desktop' and 'mobile' if(is_array($myfilter) && !empty($myfilter['plugins'])){ $myfilter['desktop'] = $myfilter['plugins']; $myfilter['mobile'] = $myfilter['plugins']; unset($myfilter['plugins']); } $default = array( 'filter' => 'default', 'desktop' => '', 'mobile' => ''); $option = (!empty($myfilter) && is_array($myfilter))? $myfilter : $default; $option = wp_parse_args( $option, $default); $pgfilter = (!empty(self::$filter['_pagefilter']['plugins']))? self::$filter['_pagefilter']['plugins'] : array(); $ajax_nonce = wp_create_nonce( 'plugin_load_filter-' . $post->ID ); $this->plf_css(); ?>

pagefilter_plugins_checklist( self::$plugins_inf, $pgfilter, $option ); ?>
ID, '_locale', true ); if(empty($c_locale)){ $c_locale = $site_locale; } if ( ! in_array( $c_locale, $languages ) ) { $c_locale = ''; } $o_post_id = get_post_meta( $post->ID, '_original_post_id', true ); $o_post_id = (is_numeric($o_post_id))? $o_post_id : ''; $locale_mode = ''; } echo '

'. esc_html__('Save') .'

'; ?>
>

'plf_locale', 'id' => 'plf_locale', 'selected' => $c_locale, 'languages' => $languages, 'show_available_translations' => false, ) ); ?>

ID; global $wpdb; $ids = $wpdb->get_row($wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_original_post_id' AND meta_value = %d", $id ), ARRAY_N); if(is_array($ids)){ if(!in_array((string)$id, $ids)){ $ids[] = (string)$id; } if(count($ids) > 1){ foreach ($ids as $v) { if( $post->ID != $v){ $l = get_post_meta( $v, '_locale', true ); if(empty($l)){ $l = $site_locale; } $url = get_edit_post_link( $v ); if(!empty($url)){ echo '

' . esc_html__('Edit Post') . " ($l) " . '

'; } } } } } ?>
'. esc_html__('Save') .'

'; ?>
pagefilter_plugins_checklist( self::$plugins_inf, $pgfilter, $option ); wp_send_json_success($html); } wp_die( 0 ); } //alternate hreflang meta tag static function altenate_hreflang() { if ( is_singular() ) { global $post, $wpdb; $pid = $post->ID; $oid = get_post_meta( $pid, '_original_post_id', true ); $oid = (is_numeric($oid))? $oid : $pid; $ids = $wpdb->get_row($wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_original_post_id' AND meta_value = %d", $oid ), ARRAY_N); if(is_array($ids)){ if(!in_array((string)$oid, $ids)){ $ids[] = (string)$oid; } if(count($ids) > 1){ $site_locale = self::get_site_locale(); foreach ($ids as $id) { $l = get_post_meta( $id, '_locale', true ); if(empty($l)){ $l = $site_locale; } $url = get_permalink( $id ); echo '' . PHP_EOL; } } } } } /*************************************************************************** * Javascript **************************************************************************/ function activetab_script() { ?>