protected function add_actions() { add_filter('user_contactmethods', array(&$this, 'add_contact_methods'), 20, 2); if (is_admin()) { /** * Hook a minimum number of admin actions to maximize performance. * The user_id argument is always present when we're editing a user, * but missing when viewing our own profile page. */ // common to the show profile and user editing pages add_action('admin_init', array(&$this, 'add_metaboxes')); // load_meta_page() priorities: 100 post, 200 user, 300 taxonomy add_action('admin_head', array(&$this, 'load_meta_page'), 200); add_action('show_user_profile', array(&$this, 'show_metaboxes'), 20); // your profile if (!empty($this->p->options['plugin_columns_user'])) { add_filter('manage_users_columns', array($this, 'add_column_headings'), 10, 1); add_filter('manage_users_custom_column', array($this, 'get_user_column_content'), 10, 3); $this->p->util->add_plugin_filters($this, array('og_image_user_column_content' => 4, 'og_desc_user_column_content' => 4)); } // exit here if not a user page, or showing the profile page $user_id = SucomUtil::get_req_val('user_id'); if (empty($user_id)) { return; } // hooks for user and profile editing add_action('edit_user_profile', array(&$this, 'show_metaboxes'), 20); add_action('edit_user_profile_update', array(&$this, 'sanitize_contact_methods'), 5); add_action('edit_user_profile_update', array(&$this, 'save_options'), WPSSO_META_SAVE_PRIORITY); add_action('edit_user_profile_update', array(&$this, 'clear_cache'), WPSSO_META_CACHE_PRIORITY); add_action('personal_options_update', array(&$this, 'sanitize_contact_methods'), 5); add_action('personal_options_update', array(&$this, 'save_options'), WPSSO_META_SAVE_PRIORITY); add_action('personal_options_update', array(&$this, 'clear_cache'), WPSSO_META_CACHE_PRIORITY); } }
protected function add_actions() { if (is_admin()) { /** * Hook a minimum number of admin actions to maximize performance. * The taxonomy and tag_ID arguments are always present when we're * editing a category and/or tag page, so return immediately if * they're not present. */ if (($this->tax_slug = SucomUtil::get_req_val('taxonomy')) === '') { return; } $this->tax_obj = get_taxonomy($this->tax_slug); if (!$this->tax_obj->public) { return; } if (!empty($this->p->options['plugin_columns_taxonomy'])) { add_filter('manage_edit-' . $this->tax_slug . '_columns', array($this, 'add_column_headings'), 10, 1); add_filter('manage_' . $this->tax_slug . '_custom_column', array($this, 'get_taxonomy_column_content'), 10, 3); $this->p->util->add_plugin_filters($this, array('og_image_taxonomy_column_content' => 4, 'og_desc_taxonomy_column_content' => 4)); } if (($this->term_id = SucomUtil::get_req_val('tag_ID')) === '') { return; } if ($this->p->debug->enabled) { $this->p->debug->log('tax_slug/term_id values: ' . $this->tax_slug . '/' . $this->term_id); } /** * Available term and taxonomy actions: * * do_action( "create_term", $term_id, $tt_id, $taxonomy ); * do_action( "created_term", $term_id, $tt_id, $taxonomy ); * do_action( "edited_term", $term_id, $tt_id, $taxonomy ); * do_action( 'delete_term', $term_id, $tt_id, $taxonomy, $deleted_term ); * do_action( "create_$taxonomy", $term_id, $tt_id ); * do_action( "created_$taxonomy", $term_id, $tt_id ); * do_action( "edited_$taxonomy", $term_id, $tt_id ); * do_action( "delete_$taxonomy", $term_id, $tt_id, $deleted_term ); */ add_action('admin_init', array(&$this, 'add_metaboxes')); // load_meta_page() priorities: 100 post, 200 user, 300 taxonomy add_action('current_screen', array(&$this, 'load_meta_page'), 300, 1); add_action($this->tax_slug . '_edit_form', array(&$this, 'show_metaboxes'), 100, 1); add_action('created_' . $this->tax_slug, array(&$this, 'save_options'), NGFB_META_SAVE_PRIORITY, 2); add_action('created_' . $this->tax_slug, array(&$this, 'clear_cache'), NGFB_META_CACHE_PRIORITY, 2); add_action('edited_' . $this->tax_slug, array(&$this, 'save_options'), NGFB_META_SAVE_PRIORITY, 2); add_action('edited_' . $this->tax_slug, array(&$this, 'clear_cache'), NGFB_META_CACHE_PRIORITY, 2); add_action('delete_' . $this->tax_slug, array(&$this, 'delete_options'), NGFB_META_SAVE_PRIORITY, 2); add_action('delete_' . $this->tax_slug, array(&$this, 'clear_cache'), NGFB_META_CACHE_PRIORITY, 2); } }
public static function is_product_tag() { if (isset(self::$is['product_tag'])) { return self::$is['product_tag']; } $ret = false; if (function_exists('is_product_tag') && is_product_tag()) { $ret = true; } elseif (is_admin()) { if (SucomUtil::get_req_val('taxonomy') === 'product_tag' && SucomUtil::get_req_val('post_type') === 'product') { $ret = true; } } return self::$is['product_tag'] = apply_filters('sucom_is_product_tag', $ret); }