Esempio n. 1
0
 public static function controller()
 {
     if (is_admin()) {
         if (!WPGlobus_WP::is_doing_ajax()) {
             if ('off' == WPGLobus::Config()->toggle) {
                 return;
             }
             /** @see \WPGlobus::__construct */
             WPGlobus::O()->vendors_scripts['WPSEO'] = true;
             if (WPGlobus_WP::is_pagenow('edit.php')) {
                 /**
                  * To translate Yoast columns on edit.php page
                  */
                 add_filter('esc_html', array('WPGlobus_WPSEO', 'filter__wpseo_columns'), 0);
             }
             add_action('admin_print_scripts', array('WPGlobus_WPSEO', 'action__admin_print_scripts'));
             add_action('wpseo_tab_content', array('WPGlobus_WPSEO', 'action__wpseo_tab_content'), 11);
             /**
              * Filter for @see wpseo_linkdex_results
              * @scope admin
              * @since 1.2.2		 
              */
             add_filter('wpseo_linkdex_results', array('WPGlobus_WPSEO', 'filter__wpseo_linkdex_results'), 10, 3);
         }
     } else {
         /**
          * Filter SEO title and meta description on front only, when the page header HTML tags are generated.
          * AJAX is probably not required (waiting for a case).
          */
         add_filter('wpseo_title', array('WPGlobus_Filters', 'filter__text'), 0);
         //add_filter( 'wpseo_metadesc', array( 'WPGlobus_Filters', 'filter__text' ), 0 );
         /**
          * Filter for @see wpseo_title
          * @scope front
          * @since 1.1.1		 
          */
         //			add_filter( 'wpseo_title', array( 'WPGlobus_WPSEO', 'filter__title' ), 0 );
         /**
          * Filter for @see wpseo_description
          * @scope front
          * @since 1.1.1		 
          */
         add_filter('wpseo_metadesc', array('WPGlobus_WPSEO', 'wpseo_metadesc'), 0);
     }
 }
 /**
  * Enqueue js for YoastSEO support
  * @since 1.4.0
  */
 public static function action__admin_print_scripts()
 {
     if ('off' == WPGLobus::Config()->toggle) {
         return;
     }
     global $pagenow;
     $enabled_pages = array('post.php', 'post-new.php', 'edit-tags.php');
     if (WPGlobus_WP::is_pagenow($enabled_pages)) {
         WPGlobus::O()->vendors_scripts['WPSEO'] = true;
         $yoastseo_plus_access = sprintf(__('Please see %s to get access to page analysis with YoastSEO.', ''), '<a href="http://www.wpglobus.com/product/wpglobus-plus/#yoastseo" target="_blank">WPGlobus Plus</a>');
         $i18n = array('yoastseo_plus_access' => $yoastseo_plus_access);
         $handle = 'wpglobus-yoastseo';
         /** @noinspection PhpInternalEntityUsedInspection */
         // $src_version = version_compare( WPSEO_VERSION, '3.1', '>=' ) ? '31' : '30';
         $src_version = '30';
         $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/' . $handle . '-' . $src_version . WPGlobus::SCRIPT_SUFFIX() . '.js';
         wp_enqueue_script($handle, $src, array('jquery', 'underscore'), WPGLOBUS_VERSION, true);
         wp_localize_script($handle, 'WPGlobusVendor', array('version' => WPGLOBUS_VERSION, 'vendor' => WPGlobus::O()->vendors_scripts, 'pagenow' => $pagenow, 'i18n' => $i18n));
     }
 }