Exemple #1
0
/**
 * Fix for getting the columns loaded by WordPress SEO Yoast
 *
 * The added columns from WordPress SEO by Yoast weren't available on
 * the admin columns settings page. The reason was that class-metabox.php was prevented
 * from loading. This fix will also load this class when admin columns is loaded.
 *
 * @since 1.4.6
 */
function cpac_pre_load_wordpress_seo_class_metabox()
{
    if (!defined('WPSEO_PATH')) {
        return;
    }
    if (!cac_is_doing_ajax() && !cac_is_setting_screen()) {
        return;
    }
    // Yoast SEO version > 3.0
    if (file_exists(WPSEO_PATH . 'admin/class-meta-columns.php')) {
        require_once WPSEO_PATH . 'admin/class-meta-columns.php';
        if (class_exists('WPSEO_Meta_Columns', false)) {
            $metabox = new WPSEO_Meta_Columns();
            if (method_exists($metabox, 'setup_hooks')) {
                $metabox->setup_hooks();
            }
        }
    }
    // Yoast SEO version < 3.0
    if (file_exists(WPSEO_PATH . 'admin/class-meta-box.php')) {
        require_once WPSEO_PATH . 'admin/class-meta-box.php';
        if (class_exists('WPSEO_Meta_Columns', false)) {
            new WPSEO_Metabox();
        }
    }
}
 /**
  * @see CPAC_Type::get_default_columns()
  */
 public function get_default_columns()
 {
     if (!function_exists('_get_list_table')) {
         return array();
     }
     // You can use this filter to add third_party columns by hooking into this.
     do_action("cac/columns/default/storage_key={$this->key}");
     // get columns
     $table = _get_list_table('WP_Users_List_Table', array('screen' => 'users'));
     $columns = (array) $table->get_columns();
     if (cac_is_setting_screen()) {
         $columns = array_merge(get_column_headers('users'), $columns);
     }
     return $columns;
 }
 /**
  * Whether the current screen is the Admin Columns settings screen
  *
  * @since 2.2
  *
  * @param strong $tab Specifies a tab screen (optional)
  *
  * @return bool True if the current screen is the settings screen, false otherwise
  */
 public function is_settings_screen($tab = '')
 {
     return cac_is_setting_screen($tab);
 }