コード例 #1
0
ファイル: post.php プロジェクト: jamesvillarrubia/uniken-web
 public function set_head_meta_tags()
 {
     if (!empty($this->head_meta_tags)) {
         // only set header tags once
         return;
     }
     $screen_id = SucomUtil::get_screen_id();
     if ($this->p->debug->enabled) {
         $this->p->debug->mark();
         $this->p->util->log_is_functions();
         $this->p->debug->log('screen id = ' . $screen_id);
     }
     // check for post/page/media editing lists
     if (strpos($screen_id, 'edit-') !== false || $screen_id === 'upload') {
         return;
     }
     if (($obj = $this->p->util->get_post_object()) === false || empty($obj->post_type)) {
         return;
     }
     $post_id = empty($obj->ID) ? 0 : $obj->ID;
     if (isset($obj->post_status) && $obj->post_status !== 'auto-draft') {
         $post_type = get_post_type_object($obj->post_type);
         $add_metabox = empty($this->p->options['plugin_add_to_' . $post_type->name]) ? false : true;
         if (apply_filters($this->p->cf['lca'] . '_add_metabox_post', $add_metabox, $post_id, $post_type->name) === true) {
             // hook used by woocommerce module to load front-end libraries and start a session
             do_action($this->p->cf['lca'] . '_admin_post_header', $post_id, $post_type->name);
             // read_cache is false to generate notices etc.
             $this->head_meta_tags = $this->p->head->get_header_array($post_id, false);
             $this->head_info = $this->p->head->extract_head_info($this->head_meta_tags);
             if ($obj->post_status == 'publish') {
                 if (empty($this->head_info['og:image'])) {
                     $this->p->notice->err('An Open Graph image meta tag could not be generated for this webpage. Facebook and other social websites require at least one Open Graph image meta tag to render their shared content correctly.');
                 }
                 // check for duplicates once the post has been published and we have a functioning permalink
                 if (!empty($this->p->options['plugin_check_head'])) {
                     $this->check_post_header($post_id, $obj);
                 }
             }
         }
     }
 }
コード例 #2
0
 public function set_head_meta_tags()
 {
     if (!empty($this->head_meta_tags)) {
         // only set header tags once
         return;
     }
     if ($this->p->debug->enabled) {
         $this->p->debug->mark();
     }
     $screen_id = SucomUtil::get_screen_id();
     if ($this->p->debug->enabled) {
         $this->p->debug->log('screen id = ' . $screen_id);
     }
     switch ($screen_id) {
         case 'edit-' . $this->tax_slug:
             $add_metabox = empty($this->p->options['plugin_add_to_taxonomy']) ? false : true;
             if (apply_filters($this->p->cf['lca'] . '_add_metabox_taxonomy', $add_metabox, $this->term_id, $screen_id) === true) {
                 do_action($this->p->cf['lca'] . '_admin_taxonomy_header', $this->term_id, $screen_id);
                 // use_post is false since this isn't a post
                 // read_cache is false to generate notices etc.
                 $this->head_meta_tags = $this->p->head->get_header_array(false);
                 $this->head_info = $this->p->head->extract_head_info($this->head_meta_tags);
                 if (empty($this->head_info['og:image'])) {
                     $this->p->notice->err('An Open Graph image meta tag could not be generated for this webpage. Facebook and other social websites require at least one Open Graph image meta tag to render their shared content correctly.');
                 }
             }
             break;
     }
 }
コード例 #3
0
ファイル: user.php プロジェクト: sonvq/passioninvestment
 public function show_metaboxes($user)
 {
     if (!current_user_can('edit_user', $user->ID)) {
         return;
     }
     $is_suffix = ' ' . ($this->p->check->aop($this->p->cf['lca'], true, $this->p->is_avail['aop']) ? _x('Pro', 'package type', 'wpsso') : _x('Free', 'package type', 'wpsso'));
     $screen_id = SucomUtil::get_screen_id();
     $page_name = $screen_id === 'profile' ? __('Your Profile') : __('Edit User');
     echo '<h3>' . $this->p->cf['plugin'][$this->p->cf['lca']]['short'] . $is_suffix . ' &ndash; ' . $page_name . '</h3>';
     echo '<div id="poststuff">';
     do_meta_boxes('user', 'normal', $user);
     echo '</div>';
 }
コード例 #4
0
ファイル: meta.php プロジェクト: jamesvillarrubia/uniken-web
 protected function get_mod_column_content($value, $column_name, $id, $mod = '')
 {
     // optimize performance and return immediately if this is not our column
     if (strpos($column_name, $this->p->cf['lca'] . '_') !== 0) {
         return $value;
     }
     // when adding a new category, $screen_id may be false
     $screen_id = SucomUtil::get_screen_id();
     if (!empty($screen_id)) {
         $hidden = get_user_option('manage' . $screen_id . 'columnshidden');
         if (is_array($hidden) && in_array($column_name, $hidden)) {
             return 'Reload to View';
         }
     }
     switch ($column_name) {
         case $this->p->cf['lca'] . '_og_image':
         case $this->p->cf['lca'] . '_og_desc':
             $use_cache = true;
             break;
         default:
             $use_cache = false;
             break;
     }
     if ($use_cache === true && $this->p->is_avail['cache']['transient']) {
         $lang = SucomUtil::get_locale();
         $cache_salt = __METHOD__ . '(mod:' . $mod . '_lang:' . $lang . '_id:' . $id . '_column:' . $column_name . ')';
         $cache_id = $this->p->cf['lca'] . '_' . md5($cache_salt);
         $value = get_transient($cache_id);
         if ($value !== false) {
             return $value;
         }
     }
     switch ($column_name) {
         case $this->p->cf['lca'] . '_og_image':
             // set custom image dimensions for this post/term/user id
             $this->p->util->add_plugin_image_sizes($id, array(), true, $mod);
             break;
     }
     $value = apply_filters($column_name . '_' . $mod . '_column_content', $value, $column_name, $id);
     if ($use_cache === true && $this->p->is_avail['cache']['transient']) {
         set_transient($cache_id, $value, $this->p->options['plugin_object_cache_exp']);
     }
     return $value;
 }
コード例 #5
0
ファイル: post.php プロジェクト: sonvq/passioninvestment
 public function load_meta_page()
 {
     // all meta modules set this property, so use it to optimize code execution
     if (!empty(WpssoMeta::$head_meta_tags)) {
         return;
     }
     $screen_id = SucomUtil::get_screen_id();
     if ($this->p->debug->enabled) {
         $this->p->debug->mark();
         $this->p->debug->log('screen_id: ' . $screen_id);
         $this->p->util->log_is_functions();
     }
     // check for list type pages
     if (strpos($screen_id, 'edit-') !== false || $screen_id === 'upload') {
         return;
     }
     // make sure we have at least a post type and post status
     if (($obj = $this->p->util->get_post_object()) === false || empty($obj->post_type) || empty($obj->post_status)) {
         return;
     }
     $post_id = empty($obj->ID) ? 0 : $obj->ID;
     if ($obj->post_status !== 'auto-draft') {
         $post_type = get_post_type_object($obj->post_type);
         $add_metabox = empty($this->p->options['plugin_add_to_' . $post_type->name]) ? false : true;
         if (apply_filters($this->p->cf['lca'] . '_add_metabox_post', $add_metabox, $post_id, $post_type->name) === true) {
             // hook used by woocommerce module to load front-end libraries and start a session
             do_action($this->p->cf['lca'] . '_admin_post_header', $post_id, $post_type->name);
             // read_cache is false to generate notices etc.
             WpssoMeta::$head_meta_tags = $this->p->head->get_header_array($post_id, false);
             WpssoMeta::$head_meta_info = $this->p->head->extract_head_info(WpssoMeta::$head_meta_tags);
             if ($obj->post_status === 'publish') {
                 // check for missing open graph image and issue warning
                 if (empty(WpssoMeta::$head_meta_info['og:image'])) {
                     $this->p->notice->err($this->p->msgs->get('notice-missing-og-image'));
                 }
                 // check duplicates only when the post is available publicly and we have a valid permalink
                 if (!empty($this->p->options['plugin_check_head'])) {
                     $this->check_post_header($post_id, $obj);
                 }
             }
         }
     }
     $lca = $this->p->cf['lca'];
     $action_query = $lca . '-action';
     if (!empty($_GET[$action_query])) {
         $action_name = SucomUtil::sanitize_hookname($_GET[$action_query]);
         if (empty($_GET[WPSSO_NONCE])) {
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('nonce token validation query field missing');
             }
         } elseif (!wp_verify_nonce($_GET[WPSSO_NONCE], WpssoAdmin::get_nonce())) {
             $this->p->notice->err(__('Nonce token validation failed for action \\"' . $action_name . '\\".', 'wpsso'));
         } else {
             $_SERVER['REQUEST_URI'] = remove_query_arg(array($action_query, WPSSO_NONCE));
             switch ($action_name) {
                 default:
                     do_action($lca . '_load_meta_page_post_' . $action_name, $post_id, $obj);
                     break;
             }
         }
     }
 }
コード例 #6
0
ファイル: taxonomy.php プロジェクト: sonvq/passioninvestment
 public function load_meta_page()
 {
     // all meta modules set this property, so use it to optimize code execution
     if (!empty(WpssoMeta::$head_meta_tags)) {
         return;
     }
     $screen_id = SucomUtil::get_screen_id();
     if ($this->p->debug->enabled) {
         $this->p->debug->mark();
         $this->p->debug->log('screen_id: ' . $screen_id);
     }
     if ($screen_id !== 'edit-' . $this->tax_slug) {
         return;
     }
     $add_metabox = empty($this->p->options['plugin_add_to_taxonomy']) ? false : true;
     if (apply_filters($this->p->cf['lca'] . '_add_metabox_taxonomy', $add_metabox, $this->term_id, $screen_id) === true) {
         do_action($this->p->cf['lca'] . '_admin_taxonomy_header', $this->term_id, $screen_id);
         // use_post is false since this isn't a post
         // read_cache is false to generate notices etc.
         WpssoMeta::$head_meta_tags = $this->p->head->get_header_array(false);
         WpssoMeta::$head_meta_info = $this->p->head->extract_head_info(WpssoMeta::$head_meta_tags);
         if (empty(WpssoMeta::$head_meta_info['og:image'])) {
             // check for missing open graph image and issue warning
             $this->p->notice->err($this->p->msgs->get('notice-missing-og-image'));
         }
     }
     $lca = $this->p->cf['lca'];
     $action_query = $lca . '-action';
     if (!empty($_GET[$action_query])) {
         $action_name = SucomUtil::sanitize_hookname($_GET[$action_query]);
         if (empty($_GET[WPSSO_NONCE])) {
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('nonce token validation query field missing');
             }
         } elseif (!wp_verify_nonce($_GET[WPSSO_NONCE], WpssoAdmin::get_nonce())) {
             $this->p->notice->err(__('Nonce token validation failed for action \\"' . $action_name . '\\".', 'wpsso'));
         } else {
             $_SERVER['REQUEST_URI'] = remove_query_arg(array($action_query, WPSSO_NONCE));
             switch ($action_name) {
                 default:
                     do_action($lca . '_load_meta_page_taxonomy_' . $action_name, $this->term_id);
                     break;
             }
         }
     }
 }