本文整理汇总了PHP中SucomUtil::get_pub_lang方法的典型用法代码示例。如果您正苦于以下问题:PHP SucomUtil::get_pub_lang方法的具体用法?PHP SucomUtil::get_pub_lang怎么用?PHP SucomUtil::get_pub_lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SucomUtil
的用法示例。
在下文中一共展示了SucomUtil::get_pub_lang方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_rows
protected function get_rows($metabox, $key)
{
$rows = array();
switch ($metabox . '-' . $key) {
case 'essential-general':
$rows[] = '<td></td><td class="subsection top"><h4>' . _x('Site Information', 'metabox title', 'nextgen-facebook') . '</h4></td>';
$rows[] = $this->p->util->get_th(_x('Default Article Topic', 'option label', 'nextgen-facebook'), null, 'og_art_section') . '<td>' . $this->form->get_select('og_art_section', $this->p->util->get_topics()) . '</td>';
$rows[] = $this->p->util->get_th(_x('Site Name', 'option label', 'nextgen-facebook'), null, 'og_site_name', array('is_locale' => true)) . '<td>' . $this->form->get_input(SucomUtil::get_locale_key('og_site_name'), null, null, null, get_bloginfo('name', 'display')) . '</td>';
$rows[] = $this->p->util->get_th(_x('Site Description', 'option label', 'nextgen-facebook'), null, 'og_site_description', array('is_locale' => true)) . '<td>' . $this->form->get_textarea(SucomUtil::get_locale_key('og_site_description'), null, null, null, get_bloginfo('description', 'display')) . '</td>';
$rows[] = '<td></td><td class="subsection"><h4>' . _x('Facebook / Open Graph', 'metabox title', 'nextgen-facebook') . '</h4></td>';
$rows[] = $this->p->util->get_th(_x('Facebook Business Page URL', 'option label', 'nextgen-facebook'), null, 'fb_publisher_url') . '<td>' . $this->form->get_input('fb_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th(_x('Facebook Application ID', 'option label', 'nextgen-facebook'), null, 'fb_app_id') . '<td>' . $this->form->get_input('fb_app_id') . '</td>';
$rows[] = $this->p->util->get_th(_x('or Facebook Admin Username(s)', 'option label', 'nextgen-facebook'), null, 'fb_admins') . '<td>' . $this->form->get_input('fb_admins') . '</td>';
$rows[] = $this->p->util->get_th(_x('Default Content Language', 'option label', 'nextgen-facebook'), null, 'fb_lang') . '<td>' . $this->form->get_select('fb_lang', SucomUtil::get_pub_lang('facebook')) . '</td>';
$rows[] = $this->p->util->get_th(_x('Default / Fallback Image ID', 'option label', 'nextgen-facebook'), null, 'og_def_img_id') . '<td>' . $this->form->get_image_upload_input('og_def_img') . '</td>';
$rows[] = $this->p->util->get_th(_x('or Default / Fallback Image URL', 'option label', 'nextgen-facebook'), null, 'og_def_img_url') . '<td>' . $this->form->get_image_url_input('og_def_img') . '</td>';
$rows[] = $this->p->util->get_th(_x('Open Graph Image Dimensions', 'option label', 'nextgen-facebook'), null, 'og_img_dimensions') . '<td>' . $this->form->get_image_dimensions_input('og_img', false, false) . '</td>';
$rows[] = '<td></td><td class="subsection"><h4>' . _x('Google / Schema', 'metabox title', 'nextgen-facebook') . '</h4></td>';
$rows[] = $this->p->util->get_th(_x('Google+ Business Page URL', 'option label', 'nextgen-facebook'), null, 'google_publisher_url') . '<td>' . $this->form->get_input('seo_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th(_x('Website / Business Logo URL', 'option label', 'nextgen-facebook'), null, 'google_schema_logo_url') . '<td>' . $this->form->get_input('schema_logo_url', 'wide') . '</td>';
$rows[] = '<td></td><td class="subsection"><h4>' . _x('Pinterest', 'metabox title', 'nextgen-facebook') . '</h4></td>';
$rows[] = $this->p->util->get_th(_x('Pinterest Company Page URL', 'option label', 'nextgen-facebook'), null, 'rp_publisher_url') . '<td>' . $this->form->get_input('rp_publisher_url', 'wide') . '</td>';
if (!SucomUtil::get_const('NGFB_RICH_PIN_DISABLE')) {
$rows[] = $this->p->util->get_th(_x('Rich Pin Image Dimensions', 'option label', 'nextgen-facebook'), null, 'rp_img_dimensions') . '<td>' . $this->form->get_image_dimensions_input('rp_img') . '</td>';
}
$rows[] = '<td></td><td class="subsection"><h4>' . _x('Twitter', 'metabox title', 'nextgen-facebook') . '</h4></td>';
$rows[] = $this->p->util->get_th(_x('Twitter Business @username', 'option label', 'nextgen-facebook'), null, 'tc_site') . '<td>' . $this->form->get_input('tc_site') . '</td>';
break;
case 'essential-advanced':
$rows['plugin_preserve'] = $this->p->util->get_th(_x('Preserve Settings on Uninstall', 'option label', 'nextgen-facebook'), null, 'plugin_preserve') . '<td>' . $this->form->get_checkbox('plugin_preserve') . '</td>';
$rows['plugin_debug'] = $this->p->util->get_th(_x('Add Hidden Debug Messages', 'option label', 'nextgen-facebook'), null, 'plugin_debug') . '<td>' . (defined('NGFB_HTML_DEBUG') && NGFB_HTML_DEBUG ? $this->form->get_no_checkbox('plugin_debug') . ' NGFB_HTML_DEBUG constant enabled' : $this->form->get_checkbox('plugin_debug')) . '</td>';
break;
}
return $rows;
}
示例2: get_html
public function get_html($atts = array(), &$opts = array())
{
if ($this->p->debug->enabled) {
$this->p->debug->mark();
}
if (empty($opts)) {
$opts =& $this->p->options;
}
global $post;
$prot = empty($_SERVER['HTTPS']) ? 'http:' : 'https:';
$use_post = isset($atts['use_post']) ? $atts['use_post'] : true;
$src_id = $this->p->util->get_source_id('twitter', $atts);
$atts['add_page'] = isset($atts['add_page']) ? $atts['add_page'] : true;
// get_sharing_url argument
$long_url = empty($atts['url']) ? $this->p->util->get_sharing_url($use_post, $atts['add_page'], $src_id) : apply_filters($this->p->cf['lca'] . '_sharing_url', $atts['url'], $use_post, $atts['add_page'], $src_id);
$short_url = apply_filters($this->p->cf['lca'] . '_shorten_url', $long_url, $opts['plugin_shortener']);
if (!array_key_exists('lang', $atts)) {
$atts['lang'] = empty($opts['twitter_lang']) ? 'en' : $opts['twitter_lang'];
}
$atts['lang'] = apply_filters($this->p->cf['lca'] . '_lang', $atts['lang'], SucomUtil::get_pub_lang('twitter'));
if (array_key_exists('tweet', $atts)) {
$atts['caption'] = $atts['tweet'];
}
if (!array_key_exists('caption', $atts)) {
if (empty($atts['caption'])) {
$caption_len = $this->p->util->get_tweet_max_len($long_url, 'twitter', $short_url);
$atts['caption'] = $this->p->webpage->get_caption($opts['twitter_caption'], $caption_len, $use_post, true, true, true, 'twitter_desc', $src_id);
}
}
if (!array_key_exists('via', $atts)) {
if (!empty($opts['twitter_via']) && $this->p->check->aop('ngfb')) {
$atts['via'] = preg_replace('/^@/', '', $opts['tc_site']);
} else {
$atts['via'] = '';
}
}
if (!array_key_exists('related', $atts)) {
if (!empty($opts['twitter_rel_author']) && !empty($post) && $use_post === true && $this->p->check->aop('ngfb')) {
$atts['related'] = preg_replace('/^@/', '', get_the_author_meta($opts['plugin_cm_twitter_name'], $post->author));
} else {
$atts['related'] = '';
}
}
// hashtags are included in the caption instead
if (!array_key_exists('hashtags', $atts)) {
$atts['hashtags'] = '';
}
if (!array_key_exists('dnt', $atts)) {
$atts['dnt'] = $opts['twitter_dnt'] ? 'true' : 'false';
}
$html = '<!-- Twitter Button --><div ' . $this->p->sharing->get_css('twitter', $atts) . '>';
$html .= '<a href="' . $prot . '//twitter.com/share" class="twitter-share-button" data-lang="' . $atts['lang'] . '" ';
$html .= 'data-url="' . $short_url . '" data-counturl="' . $long_url . '" data-text="' . $atts['caption'] . '" ';
$html .= 'data-via="' . $atts['via'] . '" data-related="' . $atts['related'] . '" data-hashtags="' . $atts['hashtags'] . '" ';
$html .= 'data-count="' . $opts['twitter_count'] . '" data-size="' . $opts['twitter_size'] . '" data-dnt="' . $atts['dnt'] . '"></a></div>';
if ($this->p->debug->enabled) {
$this->p->debug->log('returning html (' . strlen($html) . ' chars)');
}
return $html . "\n";
}
示例3: get_rows
protected function get_rows($metabox, $key)
{
$rows = array();
$rows[] = $this->p->util->get_th('Show Button in', 'short') . '<td>' . $this->show_on_checkboxes('gp') . '</td>';
$rows[] = $this->p->util->get_th('Preferred Order', 'short') . '<td>' . $this->form->get_select('gp_order', range(1, count($this->p->admin->submenu['sharing']->website)), 'short') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('JavaScript in', 'short') . '<td>' . $this->form->get_select('gp_script_loc', $this->p->cf['form']['script_locations']) . '</td>';
$rows[] = $this->p->util->get_th('Default Language', 'short') . '<td>' . $this->form->get_select('gp_lang', SucomUtil::get_pub_lang('gplus')) . '</td>';
$rows[] = $this->p->util->get_th('Button Type', 'short') . '<td>' . $this->form->get_select('gp_action', array('plusone' => 'G +1', 'share' => 'G+ Share')) . '</td>';
$rows[] = $this->p->util->get_th('Button Size', 'short') . '<td>' . $this->form->get_select('gp_size', array('small' => 'Small [ 15px ]', 'medium' => 'Medium [ 20px ]', 'standard' => 'Standard [ 24px ]', 'tall' => 'Tall [ 60px ]')) . '</td>';
$rows[] = $this->p->util->get_th('Annotation', 'short') . '<td>' . $this->form->get_select('gp_annotation', array('none' => '', 'inline' => 'Inline', 'bubble' => 'Bubble', 'vertical-bubble' => 'Vertical Bubble')) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Expand to', 'short') . '<td>' . $this->form->get_select('gp_expandto', array('none' => '', 'top' => 'Top', 'bottom' => 'Bottom', 'left' => 'Left', 'right' => 'Right', 'top,left' => 'Top Left', 'top,right' => 'Top Right', 'bottom,left' => 'Bottom Left', 'bottom,right' => 'Bottom Right')) . '</td>';
return $rows;
}
示例4: get_rows
protected function get_rows($metabox, $key)
{
$rows = array();
$this->form->user_ids = $this->p->addons['util']['user']->get_display_names();
$this->form->author_contact_fields = $this->p->addons['util']['user']->get_contact_fields();
switch ($metabox . '-' . $key) {
case 'og-general':
$rows[] = $this->p->util->th('Default Article Topic', 'highlight', 'og_art_section') . '<td>' . $this->form->get_select('og_art_section', $this->p->util->get_topics()) . '</td>';
$rows[] = $this->p->util->th('Site Name', null, 'og_site_name', array('is_locale' => true)) . '<td>' . $this->form->get_input(SucomUtil::get_locale_key('og_site_name'), null, null, null, get_bloginfo('name', 'display')) . '</td>';
$rows[] = $this->p->util->th('Site Description', 'highlight', 'og_site_description', array('is_locale' => true)) . '<td>' . $this->form->get_textarea(SucomUtil::get_locale_key('og_site_description'), null, null, null, get_bloginfo('description', 'display')) . '</td>';
break;
case 'og-content':
$rows[] = $this->p->util->th('Title Separator', null, 'og_title_sep') . '<td>' . $this->form->get_input('og_title_sep', 'short') . '</td>';
break;
case 'og-images':
$img_id_pre = array('wp' => 'Media Library');
if ($this->p->is_avail['media']['ngg'] == true) {
$img_id_pre['ngg'] = 'NextGEN Gallery';
}
$rows[] = $this->p->util->th('Max Images to Include', null, 'og_img_max') . '<td>' . $this->form->get_select('og_img_max', range(0, $this->p->cf['form']['max_media_items']), 'short', null, true) . '</td>';
$rows[] = $this->p->util->th('Open Graph Image Dimensions', 'highlight', 'og_img_dimensions') . '<td>Width ' . $this->form->get_input('og_img_width', 'short') . ' x ' . 'Height ' . $this->form->get_input('og_img_height', 'short') . ' ' . 'Crop ' . $this->form->get_checkbox('og_img_crop') . '</td>';
$rows[] = $this->p->util->th('Default Image ID', 'highlight', 'og_def_img_id') . '<td>' . $this->form->get_input('og_def_img_id', 'short') . ' in ' . $this->form->get_select('og_def_img_id_pre', $img_id_pre) . '</td>';
$rows[] = $this->p->util->th('Default Image URL', null, 'og_def_img_url') . '<td>' . (empty($this->p->options['og_def_img_id']) ? $this->form->get_input('og_def_img_url', 'wide') : $this->form->get_no_input('og_def_img_url', 'wide')) . '</td>';
break;
case 'og-videos':
$rows[] = $this->p->util->th('Max Videos to Include', null, 'og_vid_max') . '<td>' . $this->form->get_select('og_vid_max', range(0, $this->p->cf['form']['max_media_items']), 'short', null, true) . '</td>';
break;
case 'og-author':
$rows[] = $this->p->util->th('Article Publisher Page URL', 'highlight', 'og_publisher_url') . '<td>' . $this->form->get_input('og_publisher_url', 'wide') . '</td>';
break;
case 'pub-facebook':
$rows[] = $this->p->util->th('Facebook Admin(s)', 'highlight', 'fb_admins') . '<td>' . $this->form->get_input('fb_admins') . '</td>';
$rows[] = $this->p->util->th('Facebook Application ID', null, 'fb_app_id') . '<td>' . $this->form->get_input('fb_app_id') . '</td>';
$rows[] = $this->p->util->th('Default Language', null, 'fb_lang') . '<td>' . $this->form->get_select('fb_lang', SucomUtil::get_pub_lang('facebook')) . '</td>';
break;
case 'pub-google':
$rows[] = $this->p->util->th('Publisher Link URL', 'highlight', 'google_publisher_url') . '<td>' . $this->form->get_input('link_publisher_url', 'wide') . '</td>';
break;
case 'pub-pinterest':
$rows[] = '<td colspan="2" style="padding-bottom:10px;">' . $this->p->msgs->get('info-pub-pinterest') . '</td>';
$rows[] = $this->p->util->th('Rich Pin Image Dimensions', 'highlight', 'rp_img_dimensions') . '<td>Width ' . $this->form->get_input('rp_img_width', 'short') . ' x ' . 'Height ' . $this->form->get_input('rp_img_height', 'short') . ' ' . 'Crop ' . $this->form->get_checkbox('rp_img_crop') . '</td>';
break;
}
return $rows;
}
示例5: get_array
public function get_array(&$og = array(), $use_post = false, $obj = false)
{
if (!is_object($obj)) {
$obj = $this->p->util->get_post_object($use_post);
}
$post_id = empty($obj->ID) || empty($obj->post_type) || !is_singular() && $use_post === false ? 0 : $obj->ID;
$post_type = '';
$video_previews = 0;
$og_max = $this->p->util->get_max_nums($post_id, 'post');
// post_id 0 returns the plugin settings
$og = apply_filters($this->p->cf['lca'] . '_og_seed', $og, $use_post, $obj);
if (!empty($og) && $this->p->debug->enabled) {
$this->p->debug->log($this->p->cf['lca'] . '_og_seed filter returned:');
$this->p->debug->log($og);
}
if (!isset($og['fb:admins']) && !empty($this->p->options['fb_admins'])) {
foreach (explode(',', $this->p->options['fb_admins']) as $fb_admin) {
$og['fb:admins'][] = trim($fb_admin);
}
}
if (!isset($og['fb:app_id'])) {
$og['fb:app_id'] = $this->p->options['fb_app_id'];
}
if (!isset($og['og:url'])) {
$og['og:url'] = $this->p->util->get_sharing_url($use_post, true, $this->p->util->get_source_id('opengraph'));
}
// define the type after the url
if (!isset($og['og:type'])) {
// singular posts / pages are articles by default
// check the post_type for a match with a known open graph type
if (is_singular() || $use_post !== false) {
if (!empty($obj->post_type)) {
$post_type = $obj->post_type;
}
if (isset($this->p->cf['head']['og_type_ns'][$post_type])) {
$og['og:type'] = $post_type;
} else {
$og['og:type'] = 'article';
}
// check for default author info on indexes and searches
} elseif ($this->p->util->force_default_author($use_post, 'og') && !empty($this->p->options['og_def_author_id'])) {
$og['og:type'] = 'article';
if (!isset($og['article:author'])) {
$og['article:author'] = $this->p->mods['util']['user']->get_article_author($this->p->options['og_def_author_id']);
}
// default for everything else is 'website'
} else {
$og['og:type'] = 'website';
}
$og['og:type'] = apply_filters($this->p->cf['lca'] . '_og_type', $og['og:type'], $use_post);
}
if (!isset($og['og:locale'])) {
// get the current or configured language for og:locale
$lang = empty($this->p->options['fb_lang']) ? SucomUtil::get_locale($post_id) : $this->p->options['fb_lang'];
$lang = apply_filters($this->p->cf['lca'] . '_lang', $lang, SucomUtil::get_pub_lang('facebook'), $post_id);
$og['og:locale'] = $lang;
}
if (!isset($og['og:site_name'])) {
$og['og:site_name'] = $this->get_site_name($post_id);
}
if (!isset($og['og:title'])) {
$og['og:title'] = $this->p->webpage->get_title($this->p->options['og_title_len'], '...', $use_post);
}
if (!isset($og['og:description'])) {
$og['og:description'] = $this->p->webpage->get_description($this->p->options['og_desc_len'], '...', $use_post);
}
// if the page is an article, then define the other article meta tags
if (isset($og['og:type']) && $og['og:type'] == 'article') {
if (!isset($og['article:author'])) {
if (is_singular() || $use_post !== false) {
if (!empty($obj->post_author)) {
$og['article:author'] = $this->p->mods['util']['user']->get_article_author($obj->post_author);
} elseif (!empty($this->p->options['og_def_author_id'])) {
$og['article:author'] = $this->p->mods['util']['user']->get_article_author($this->p->options['og_def_author_id']);
}
}
}
if (!isset($og['article:publisher'])) {
$og['article:publisher'] = $this->p->options['fb_publisher_url'];
}
if (!isset($og['article:tag'])) {
$og['article:tag'] = $this->p->webpage->get_tags($post_id);
}
if (!isset($og['article:section'])) {
$og['article:section'] = $this->p->webpage->get_section($post_id);
}
if (!isset($og['article:published_time'])) {
$og['article:published_time'] = trim(get_the_date('c'));
}
if (!isset($og['article:modified_time'])) {
$og['article:modified_time'] = trim(get_the_modified_date('c'));
}
}
// get all videos
// call before getting all images to find / use preview images
if (!isset($og['og:video'])) {
if (empty($og_max['og_vid_max'])) {
if ($this->p->debug->enabled) {
$this->p->debug->log('videos disabled: maximum videos = 0');
}
//.........这里部分代码省略.........
示例6: get_script
public function get_script($pos = 'id')
{
if ($this->p->debug->enabled) {
$this->p->debug->mark();
}
$prot = empty($_SERVER['HTTPS']) ? 'http:' : 'https:';
$app_id = empty($this->p->options['fb_app_id']) ? '' : $this->p->options['fb_app_id'];
$lang = empty($this->p->options['fb_lang']) ? 'en_US' : $this->p->options['fb_lang'];
$lang = apply_filters($this->p->cf['lca'] . '_lang', $lang, SucomUtil::get_pub_lang('facebook'));
// do not use get_cache_file_url() since the facebook javascript does not work when hosted locally
$js_url = apply_filters($this->p->cf['lca'] . '_js_url_facebook', $prot . '//connect.facebook.net/' . $lang . '/sdk.js#xfbml=1&version=v2.3&appId=' . $app_id, $pos);
$html = '<script type="text/javascript" id="fb-script-' . $pos . '">' . $this->p->cf['lca'] . '_insert_js( "fb-script-' . $pos . '", "' . $js_url . '" );</script>' . "\n";
return $html;
}
示例7: get_array
public function get_array(&$og = array(), $use_post = false)
{
$obj = $this->p->util->get_post_object($use_post);
$post_id = empty($obj->ID) || empty($obj->post_type) ? 0 : $obj->ID;
$post_type = '';
$has_video_image = false;
$og_max = $this->p->util->get_max_nums($post_id);
$og = apply_filters($this->p->cf['lca'] . '_og_seed', $og, $use_post);
if (!isset($og['fb:admins'])) {
$og['fb:admins'] = $this->p->options['fb_admins'];
}
if (!isset($og['fb:app_id'])) {
$og['fb:app_id'] = $this->p->options['fb_app_id'];
}
if (!isset($og['og:locale'])) {
// get the current or configured language for og:locale
$lang = empty($this->p->options['fb_lang']) ? SucomUtil::get_locale($post_id) : $this->p->options['fb_lang'];
$lang = apply_filters($this->p->cf['lca'] . '_lang', $lang, SucomUtil::get_pub_lang('facebook'), $post_id);
$og['og:locale'] = $lang;
}
if (!isset($og['og:site_name'])) {
// pass options array to allow fallback if locale option does not exist
$key = SucomUtil::get_locale_key('og_site_name', $this->p->options, $post_id);
if (!empty($this->p->options[$key])) {
$og['og:site_name'] = $this->p->options[$key];
} else {
$og['og:site_name'] = get_bloginfo('name', 'display');
}
}
if (!isset($og['og:url'])) {
$og['og:url'] = $this->p->util->get_sharing_url($use_post, true, $this->p->util->get_source_id('opengraph'));
}
if (!isset($og['og:title'])) {
$og['og:title'] = $this->p->webpage->get_title($this->p->options['og_title_len'], '...', $use_post);
}
if (!isset($og['og:description'])) {
$og['og:description'] = $this->p->webpage->get_description($this->p->options['og_desc_len'], '...', $use_post);
}
if (!isset($og['og:type'])) {
// singular posts / pages are articles by default
// check post_type for exceptions (like product pages)
if (is_singular() || $use_post !== false) {
if (!empty($obj->post_type)) {
$post_type = $obj->post_type;
}
switch ($post_type) {
case 'article':
case 'book':
case 'music.song':
case 'music.album':
case 'music.playlist':
case 'music.radio_station':
case 'product':
case 'profile':
case 'video.episode':
case 'video.movie':
case 'video.other':
case 'video.tv_show':
case 'website':
$og['og:type'] = $post_type;
break;
default:
$og['og:type'] = 'article';
break;
}
// check for default author info on indexes and searches
} elseif (!(is_singular() || $use_post !== false) && !is_search() && !empty($this->p->options['og_def_author_on_index']) && !empty($this->p->options['og_def_author_id']) || is_search() && !empty($this->p->options['og_def_author_on_search']) && !empty($this->p->options['og_def_author_id'])) {
$og['og:type'] = 'article';
if (!isset($og['article:author'])) {
$og['article:author'] = $this->p->addons['util']['user']->get_article_author($this->p->options['og_def_author_id']);
}
// default for everything else is 'website'
} else {
$og['og:type'] = 'website';
}
$og['og:type'] = apply_filters($this->p->cf['lca'] . '_og_type', $og['og:type'], $use_post);
}
// if the page is an article, then define the other article meta tags
if (isset($og['og:type']) && $og['og:type'] == 'article') {
if (!isset($og['article:author'])) {
if (is_singular() || $use_post !== false) {
if (!empty($obj->post_author)) {
$og['article:author'] = $this->p->addons['util']['user']->get_article_author($obj->post_author);
} elseif (!empty($this->p->options['og_def_author_id'])) {
$og['article:author'] = $this->p->addons['util']['user']->get_article_author($this->p->options['og_def_author_id']);
}
}
}
if (!isset($og['article:publisher'])) {
$og['article:publisher'] = $this->p->options['og_publisher_url'];
}
if (!isset($og['article:tag'])) {
$og['article:tag'] = $this->p->webpage->get_tags($post_id);
}
if (!isset($og['article:section'])) {
$og['article:section'] = $this->p->webpage->get_section($post_id);
}
if (!isset($og['article:published_time'])) {
$og['article:published_time'] = trim(get_the_date('c'));
}
//.........这里部分代码省略.........
示例8: get_js
public function get_js($pos = 'id')
{
$this->p->debug->mark();
$prot = empty($_SERVER['HTTPS']) ? 'http:' : 'https:';
$lang = empty($this->p->options['fb_lang']) ? 'en_US' : $this->p->options['fb_lang'];
$lang = apply_filters($this->p->cf['lca'] . '_lang', $lang, SucomUtil::get_pub_lang('facebook'));
$app_id = empty($this->p->options['fb_app_id']) ? '' : $this->p->options['fb_app_id'];
$js_url = $this->p->util->get_cache_url($prot . '//connect.facebook.net/' . $lang . '/all.js#xfbml=1&appId=' . $app_id);
$html = '<script type="text/javascript" id="fb-script-' . $pos . '">' . $this->p->cf['lca'] . '_insert_js( "fb-script-' . $pos . '", "' . $js_url . '" );</script>';
return $html;
}
示例9: get_array
public function get_array($use_post = false, $obj = false, &$og = array())
{
if ($this->p->debug->enabled) {
$this->p->debug->mark();
}
if (!is_object($obj)) {
$obj = $this->p->util->get_post_object($use_post);
}
$post_id = empty($obj->ID) || empty($obj->post_type) || !SucomUtil::is_post_page($use_post) ? 0 : $obj->ID;
// counter for video previews found
$video_previews = 0;
// post_id 0 returns the default plugin settings
$og_max = $this->p->util->get_max_nums($post_id, 'post');
$og = apply_filters($this->p->cf['lca'] . '_og_seed', $og, $use_post, $obj);
if (!empty($og) && $this->p->debug->enabled) {
$this->p->debug->log($this->p->cf['lca'] . '_og_seed filter returned:');
$this->p->debug->log($og);
}
if (!isset($og['fb:admins']) && !empty($this->p->options['fb_admins'])) {
foreach (explode(',', $this->p->options['fb_admins']) as $fb_admin) {
$og['fb:admins'][] = trim($fb_admin);
}
}
if (!isset($og['fb:app_id'])) {
$og['fb:app_id'] = $this->p->options['fb_app_id'];
}
if (!isset($og['og:url'])) {
$og['og:url'] = $this->p->util->get_sharing_url($use_post, true, $this->p->util->get_source_id('opengraph'));
}
// define the type after the url
if (!isset($og['og:type'])) {
// singular posts / pages are articles by default
// check the post_type for a match with a known open graph type
if (SucomUtil::is_post_page($use_post)) {
if (!empty($obj->post_type) && isset($this->p->cf['head']['og_type_ns'][$obj->post_type])) {
$og['og:type'] = $obj->post_type;
} else {
$og['og:type'] = 'article';
}
// check for default author info on indexes and searches
} elseif ($this->p->util->force_default_author($use_post, 'og') && !empty($this->p->options['og_def_author_id'])) {
$og['og:type'] = 'article';
// meta tag not defined or value is null
if (!isset($og['article:author'])) {
$og['article:author'] = $this->p->mods['util']['user']->get_article_author($this->p->options['og_def_author_id']);
}
// default for everything else is 'website'
} else {
$og['og:type'] = 'website';
}
$og['og:type'] = apply_filters($this->p->cf['lca'] . '_og_type', $og['og:type'], $use_post);
// pre-define basic open graph meta tags for this type
if (isset($this->p->cf['head']['og_type_mt'][$og['og:type']])) {
foreach ($this->p->cf['head']['og_type_mt'][$og['og:type']] as $mt_name) {
if (!isset($og[$mt_name])) {
$og[$mt_name] = null;
if ($this->p->debug->enabled) {
$this->p->debug->log($og['og:type'] . ' pre-defined mt: ' . $mt_name);
}
}
}
}
}
if (!isset($og['og:locale'])) {
// get the current or configured language for og:locale
$lang = empty($this->p->options['fb_lang']) ? SucomUtil::get_locale($post_id) : $this->p->options['fb_lang'];
$lang = apply_filters($this->p->cf['lca'] . '_lang', $lang, SucomUtil::get_pub_lang('facebook'), $post_id);
$og['og:locale'] = $lang;
}
if (!isset($og['og:site_name'])) {
$og['og:site_name'] = $this->get_site_name($post_id);
}
if (!isset($og['og:title'])) {
$og['og:title'] = $this->p->webpage->get_title($this->p->options['og_title_len'], '...', $use_post);
}
if (!isset($og['og:description'])) {
$og['og:description'] = $this->p->webpage->get_description($this->p->options['og_desc_len'], '...', $use_post);
}
// if the page is an article, then define the other article meta tags
if (isset($og['og:type']) && $og['og:type'] == 'article') {
// meta tag not defined or value is null
if (!isset($og['article:author'])) {
if (SucomUtil::is_post_page($use_post)) {
if (!empty($obj->post_author)) {
$og['article:author'] = $this->p->mods['util']['user']->get_article_author($obj->post_author);
} elseif (!empty($this->p->options['og_def_author_id'])) {
$og['article:author'] = $this->p->mods['util']['user']->get_article_author($this->p->options['og_def_author_id']);
}
}
}
// meta tag not defined or value is null
if (!isset($og['article:publisher'])) {
$og['article:publisher'] = $this->p->options['fb_publisher_url'];
}
// meta tag not defined or value is null
if (!isset($og['article:tag'])) {
$og['article:tag'] = $this->p->webpage->get_tags($post_id);
}
// meta tag not defined or value is null
if (!isset($og['article:section'])) {
//.........这里部分代码省略.........
示例10: get_js_loader
public function get_js_loader($pos = 'id')
{
$lang = empty($this->p->options['gp_lang']) ? 'en-US' : $this->p->options['gp_lang'];
$lang = apply_filters($this->p->cf['lca'] . '_lang', $lang, SucomUtil::get_pub_lang('gplus'));
return '<script type="text/javascript" id="ngfb-header-script">
window.___gcfg = { lang: "' . $lang . '" };
function ' . $this->p->cf['lca'] . '_insert_js( script_id, url, async ) {
if ( document.getElementById( script_id + "-js" ) ) return;
var async = typeof async !== "undefined" ? async : true;
var script_pos = document.getElementById( script_id );
var js = document.createElement( "script" );
js.id = script_id + "-js";
js.async = async;
js.type = "text/javascript";
js.language = "JavaScript";
js.src = url;
script_pos.parentNode.insertBefore( js, script_pos );
};</script>' . "\n";
}
示例11: get_rows
protected function get_rows($metabox, $key)
{
$rows = array();
$this->form->user_ids = $this->p->mods['util']['user']->get_display_names();
$this->form->author_contact_fields = $this->p->mods['util']['user']->get_contact_fields();
switch ($metabox . '-' . $key) {
case 'og-general':
$rows[] = $this->p->util->get_th('Default Article Topic', 'highlight', 'og_art_section') . '<td>' . $this->form->get_select('og_art_section', $this->p->util->get_topics()) . '</td>';
$rows[] = $this->p->util->get_th('Site Name', null, 'og_site_name', array('is_locale' => true)) . '<td>' . $this->form->get_input(SucomUtil::get_locale_key('og_site_name'), null, null, null, get_bloginfo('name', 'display')) . '</td>';
$rows[] = $this->p->util->get_th('Site Description', 'highlight', 'og_site_description', array('is_locale' => true)) . '<td>' . $this->form->get_textarea(SucomUtil::get_locale_key('og_site_description'), null, null, null, get_bloginfo('description', 'display')) . '</td>';
break;
case 'og-content':
$rows[] = $this->p->util->get_th('Title Separator', null, 'og_title_sep') . '<td>' . $this->form->get_input('og_title_sep', 'short') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Title Length', null, 'og_title_len') . '<td>' . $this->form->get_input('og_title_len', 'short') . ' characters or less</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Description Length', null, 'og_desc_len') . '<td>' . $this->form->get_input('og_desc_len', 'short') . ' characters or less</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Content Starts at 1st Paragraph', null, 'og_desc_strip') . '<td>' . $this->form->get_checkbox('og_desc_strip') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Use Image Alt if Content is Empty', null, 'og_desc_alt') . '<td>' . $this->form->get_checkbox('og_desc_alt') . '</td>';
$rows[] = $this->p->util->get_th('Add Hashtags to Descriptions', null, 'og_desc_hashtags') . '<td>' . $this->form->get_select('og_desc_hashtags', range(0, $this->p->cf['form']['max_hashtags']), 'short', null, true) . ' tag names</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Add Page Title in Tags', null, 'og_page_title_tag') . '<td>' . $this->form->get_checkbox('og_page_title_tag') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Add Page Ancestor Tags', null, 'og_page_parent_tags') . '<td>' . $this->form->get_checkbox('og_page_parent_tags') . '</td>';
break;
case 'og-author':
$rows[] = $this->p->util->get_th('Author Profile URL Field', null, 'og_author_field') . '<td>' . $this->form->get_select('og_author_field', $this->form->author_contact_fields) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Fallback to Author Index URL', null, 'og_author_fallback') . '<td>' . $this->form->get_checkbox('og_author_fallback') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Default Author when Missing', null, 'og_def_author_id') . '<td>' . $this->form->get_select('og_def_author_id', $this->form->user_ids, null, null, true) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Force Default Author on Indexes', null, 'og_def_author_on_index') . '<td>' . $this->form->get_checkbox('og_def_author_on_index') . ' defines index / archive webpages as articles</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Default Author on Search Results', null, 'og_def_author_on_search') . '<td>' . $this->form->get_checkbox('og_def_author_on_search') . ' defines search webpages as articles</td>';
break;
case 'og-images':
$rows[] = $this->p->util->get_th('Max Images to Include', null, 'og_img_max') . '<td>' . $this->form->get_select('og_img_max', range(0, $this->p->cf['form']['max_media_items']), 'short', null, true) . (empty($this->form->options['og_vid_prev_img']) ? '' : ' <em>video preview images are enabled</em> and (when available) are included first') . '</td>';
$rows[] = $this->p->util->get_th('Open Graph Image Dimensions', 'highlight', 'og_img_dimensions') . '<td>' . $this->form->get_image_dimensions_input('og_img', false, false) . '</td>';
$rows[] = $this->p->util->get_th('Default / Fallback Image ID', 'highlight', 'og_def_img_id') . '<td>' . $this->form->get_image_upload_input('og_def_img') . '</td>';
$rows[] = $this->p->util->get_th('or Default / Fallback Image URL', null, 'og_def_img_url') . '<td>' . $this->form->get_image_url_input('og_def_img') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Force Default Image on Indexes', null, 'og_def_img_on_index') . '<td>' . $this->form->get_checkbox('og_def_img_on_index') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Force Default Image on Author Index', null, 'og_def_img_on_author') . '<td>' . $this->form->get_checkbox('og_def_img_on_author') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Force Default Image on Search Results', null, 'og_def_img_on_search') . '<td>' . $this->form->get_checkbox('og_def_img_on_search') . '</td>';
if ($this->p->is_avail['media']['ngg'] === true) {
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Add Tags from NGG Featured Image', null, 'og_ngg_tags') . '<td>' . $this->form->get_checkbox('og_ngg_tags') . '</td>';
}
break;
case 'og-videos':
break;
case 'pub-facebook':
$rows[] = $this->p->util->get_th('Facebook Business Page URL', 'highlight', 'fb_publisher_url') . '<td>' . $this->form->get_input('fb_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th('Facebook Admin Username(s)', 'highlight', 'fb_admins') . '<td>' . $this->form->get_input('fb_admins') . '</td>';
$rows[] = $this->p->util->get_th('Facebook Application ID', null, 'fb_app_id') . '<td>' . $this->form->get_input('fb_app_id') . '</td>';
$rows[] = $this->p->util->get_th('Default Language', null, 'fb_lang') . '<td>' . $this->form->get_select('fb_lang', SucomUtil::get_pub_lang('facebook')) . '</td>';
$rows[] = $this->p->util->get_th('Author Name Format', 'highlight', 'google_author_name') . '<td>' . $this->form->get_select('seo_author_name', $this->p->cf['form']['user_name_fields']) . '</td>';
break;
case 'pub-google':
$rows[] = $this->p->util->get_th('Google+ Business Page URL', 'highlight', 'google_publisher_url') . '<td>' . $this->form->get_input('seo_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th('Schema Website / Business Logo URL', null, 'google_schema_logo_url') . '<td>' . $this->form->get_input('schema_logo_url', 'wide') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Schema Meta Description Length', null, 'google_schema_desc_len') . '<td>' . $this->form->get_input('schema_desc_len', 'short') . ' characters or less</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Search / SEO Description Length', null, 'google_seo_desc_len') . '<td>' . $this->form->get_input('seo_desc_len', 'short') . ' characters or less</td>';
$rows[] = $this->p->util->get_th('Author Link URL Field', null, 'google_author_field') . '<td>' . $this->form->get_select('seo_author_field', $this->form->author_contact_fields) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Default Author when Missing', null, 'google_def_author_id') . '<td>' . $this->form->get_select('seo_def_author_id', $this->form->user_ids, null, null, true) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Force Default Author on Indexes', null, 'google_def_author_on_index') . '<td>' . $this->form->get_checkbox('seo_def_author_on_index') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Default Author on Search Results', null, 'google_def_author_on_search') . '<td>' . $this->form->get_checkbox('seo_def_author_on_search') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Add Schema Website JSON-LD', null, 'google_schema_website_json') . '<td>' . $this->form->get_checkbox('schema_website_json') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Add Schema Publisher JSON-LD', null, 'google_schema_publisher_json') . '<td>' . $this->form->get_checkbox('schema_publisher_json') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Add Schema Author JSON-LD', null, 'google_schema_author_json') . '<td>' . $this->form->get_checkbox('schema_author_json') . '</td>';
break;
case 'pub-pinterest':
$rows[] = '<td colspan="2" style="padding-bottom:10px;">' . $this->p->msgs->get('info-pub-pinterest') . '</td>';
$rows[] = $this->p->util->get_th('Pinterest Company Page URL', null, 'rp_publisher_url') . '<td>' . $this->form->get_input('rp_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th('Rich Pin Image Dimensions', 'highlight', 'rp_img_dimensions') . '<td>' . $this->form->get_image_dimensions_input('rp_img') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Author Name Format', null, 'rp_author_name') . '<td>' . $this->form->get_select('rp_author_name', $this->p->cf['form']['user_name_fields']) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th('Website Verification ID', null, 'rp_dom_verify') . '<td>' . $this->form->get_input('rp_dom_verify', 'api_key') . '</td>';
break;
case 'pub-twitter':
$rows[] = $this->p->util->get_th('Twitter Business @username', 'highlight', 'tc_site') . '<td>' . $this->form->get_input('tc_site') . '</td>';
break;
case 'pub-other':
$rows[] = $this->p->util->get_th('Instagram Business URL', null, 'instgram_publisher_url') . '<td>' . $this->form->get_input('instgram_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th('LinkedIn Company Page URL', null, 'linkedin_publisher_url') . '<td>' . $this->form->get_input('linkedin_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th('MySpace Business (Brand) URL', null, 'myspace_publisher_url') . '<td>' . $this->form->get_input('myspace_publisher_url', 'wide') . '</td>';
break;
}
return $rows;
}
示例12: get_rows
protected function get_rows($metabox, $key)
{
$rows = array();
$this->form->user_ids = $this->p->mods['util']['user']->get_display_names();
$this->form->author_contact_fields = $this->p->mods['util']['user']->get_contact_fields();
switch ($metabox . '-' . $key) {
case 'og-general':
$rows[] = $this->p->util->get_th(_x('Default Article Topic', 'option label', 'wpsso'), 'highlight', 'og_art_section') . '<td>' . $this->form->get_select('og_art_section', $this->p->util->get_topics()) . '</td>';
$rows[] = $this->p->util->get_th(_x('Site Name', 'option label', 'wpsso'), null, 'og_site_name', array('is_locale' => true)) . '<td>' . $this->form->get_input(SucomUtil::get_locale_key('og_site_name'), null, null, null, get_bloginfo('name', 'display')) . '</td>';
$rows[] = $this->p->util->get_th(_x('Site Description', 'option label', 'wpsso'), 'highlight', 'og_site_description', array('is_locale' => true)) . '<td>' . $this->form->get_textarea(SucomUtil::get_locale_key('og_site_description'), null, null, null, get_bloginfo('description', 'display')) . '</td>';
break;
case 'og-content':
$rows[] = $this->p->util->get_th(_x('Title Separator', 'option label', 'wpsso'), null, 'og_title_sep') . '<td>' . $this->form->get_input('og_title_sep', 'short') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Maximum Title Length', 'option label', 'wpsso'), null, 'og_title_len') . '<td>' . $this->form->get_input('og_title_len', 'short') . ' ' . _x('characters or less', 'option comment', 'wpsso') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Maximum Description Length', 'option label', 'wpsso'), null, 'og_desc_len') . '<td>' . $this->form->get_input('og_desc_len', 'short') . ' ' . _x('characters or less', 'option comment', 'wpsso') . '</td>';
$rows[] = $this->p->util->get_th(_x('Add Hashtags to Descriptions', 'option label', 'wpsso'), null, 'og_desc_hashtags') . '<td>' . $this->form->get_select('og_desc_hashtags', range(0, $this->p->cf['form']['max_hashtags']), 'short', null, true) . ' ' . _x('tag names', 'option comment') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Add Page Title in Tags / Hashtags', 'option label', 'wpsso'), null, 'og_page_title_tag') . '<td>' . $this->form->get_checkbox('og_page_title_tag') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Add Parent Page Tags / Hashtags', 'option label', 'wpsso'), null, 'og_page_parent_tags') . '<td>' . $this->form->get_checkbox('og_page_parent_tags') . '</td>';
break;
case 'og-author':
$rows[] = $this->p->util->get_th(_x('Author Profile URL Field', 'option label', 'wpsso'), null, 'og_author_field') . '<td>' . $this->form->get_select('og_author_field', $this->form->author_contact_fields) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Fallback to Author\'s Archive Page', 'option label', 'wpsso'), null, 'og_author_fallback') . '<td>' . $this->form->get_checkbox('og_author_fallback') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Default Author when Missing', 'option label', 'wpsso'), null, 'og_def_author_id') . '<td>' . $this->form->get_select('og_def_author_id', $this->form->user_ids, null, null, true) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Default Author on Indexes', 'option label', 'wpsso'), null, 'og_def_author_on_index') . '<td>' . $this->form->get_checkbox('og_def_author_on_index') . ' defines index / archive webpages as articles</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Default Author on Search Results', 'option label', 'wpsso'), null, 'og_def_author_on_search') . '<td>' . $this->form->get_checkbox('og_def_author_on_search') . ' defines search webpages as articles</td>';
break;
case 'og-images':
$rows[] = $this->p->util->get_th(_x('Maximum Images to Include', 'option label', 'wpsso'), null, 'og_img_max') . '<td>' . $this->form->get_select('og_img_max', range(0, $this->p->cf['form']['max_media_items']), 'short', null, true) . (empty($this->form->options['og_vid_prev_img']) ? '' : ' ' . _x('<em>video preview images are enabled</em> and will be included first', 'option comment', 'wpsso')) . '</td>';
$rows[] = $this->p->util->get_th(_x('Open Graph Image Dimensions', 'option label', 'wpsso'), 'highlight', 'og_img_dimensions') . '<td>' . $this->form->get_image_dimensions_input('og_img', false, false) . '</td>';
$rows[] = $this->p->util->get_th(_x('Default / Fallback Image ID', 'option label', 'wpsso'), 'highlight', 'og_def_img_id') . '<td>' . $this->form->get_image_upload_input('og_def_img') . '</td>';
$rows[] = $this->p->util->get_th(_x('or Default / Fallback Image URL', 'option label', 'wpsso'), null, 'og_def_img_url') . '<td>' . $this->form->get_image_url_input('og_def_img') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Default Image on Indexes', 'option label', 'wpsso'), null, 'og_def_img_on_index') . '<td>' . $this->form->get_checkbox('og_def_img_on_index') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Default Image on Search Results', 'option label', 'wpsso'), null, 'og_def_img_on_search') . '<td>' . $this->form->get_checkbox('og_def_img_on_search') . '</td>';
if ($this->p->is_avail['media']['ngg'] === true) {
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Add Tags from NGG Featured Image', 'option label', 'wpsso'), null, 'og_ngg_tags') . '<td>' . $this->form->get_checkbox('og_ngg_tags') . '</td>';
}
break;
case 'og-videos':
break;
case 'pub-facebook':
$rows[] = $this->p->util->get_th(_x('Facebook Business Page URL', 'option label', 'wpsso'), 'highlight', 'fb_publisher_url') . '<td>' . $this->form->get_input('fb_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th(_x('Facebook Admin Username(s)', 'option label', 'wpsso'), 'highlight', 'fb_admins') . '<td>' . $this->form->get_input('fb_admins') . '</td>';
$rows[] = $this->p->util->get_th(_x('Facebook Application ID', 'option label', 'wpsso'), null, 'fb_app_id') . '<td>' . $this->form->get_input('fb_app_id') . '</td>';
$rows[] = $this->p->util->get_th(_x('Default Language', 'option label', 'wpsso'), null, 'fb_lang') . '<td>' . $this->form->get_select('fb_lang', SucomUtil::get_pub_lang('facebook')) . '</td>';
$rows[] = $this->p->util->get_th(_x('Author Name Format', 'option label', 'wpsso'), 'highlight', 'google_author_name') . '<td>' . $this->form->get_select('seo_author_name', $this->p->cf['form']['user_name_fields']) . '</td>';
break;
case 'pub-google':
$rows[] = $this->p->util->get_th(_x('Google+ Business Page URL', 'option label', 'wpsso'), 'highlight', 'google_publisher_url') . '<td>' . $this->form->get_input('seo_publisher_url', 'wide') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Search / SEO Description Length', 'option label', 'wpsso'), null, 'google_seo_desc_len') . '<td>' . $this->form->get_input('seo_desc_len', 'short') . ' ' . _x('characters or less', 'option comment', 'wpsso') . '</td>';
$rows[] = $this->p->util->get_th(_x('Author Link URL Field', 'option label', 'wpsso'), null, 'google_author_field') . '<td>' . $this->form->get_select('seo_author_field', $this->form->author_contact_fields) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Default Author when Missing', 'option label', 'wpsso'), null, 'google_def_author_id') . '<td>' . $this->form->get_select('seo_def_author_id', $this->form->user_ids, null, null, true) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Default Author on Indexes', 'option label', 'wpsso'), null, 'google_def_author_on_index') . '<td>' . $this->form->get_checkbox('seo_def_author_on_index') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Default Author on Search Results', 'option label', 'wpsso'), null, 'google_def_author_on_search') . '<td>' . $this->form->get_checkbox('seo_def_author_on_search') . '</td>';
$rows[] = '<td colspan="2" class="subsection"><h4>' . _x('Google Structured Data / Schema Markup', 'metabox title', 'wpsso') . '</h4></td>';
$rows[] = $this->p->util->get_th(_x('Website / Business Logo URL', 'option label', 'wpsso'), null, 'google_schema_logo_url') . '<td>' . $this->form->get_input('schema_logo_url', 'wide') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Maximum Description Length', 'option label', 'wpsso'), null, 'google_schema_desc_len') . '<td>' . $this->form->get_input('schema_desc_len', 'short') . ' ' . _x('characters or less', 'option comment', 'wpsso') . '</td>';
$schema_select = '';
$schema_types = apply_filters($this->p->cf['lca'] . '_schema_post_types', $this->p->cf['head']['schema_type']);
foreach ($this->p->util->get_post_types() as $post_type) {
$schema_select .= '<p>' . $this->form->get_select('schema_type_for_' . $post_type->name, $schema_types) . ' for ' . $post_type->label . ' ' . (empty($post_type->description) ? '' : '(' . $post_type->description . ')') . '</p>' . "\n";
}
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Schema Item Type by Post Type', 'option label', 'wpsso'), null, 'google_schema_post_type') . '<td>' . $schema_select . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Use Meta Property Container(s)', 'option label', 'wpsso'), null, 'google_schema_add_noscript') . '<td>' . $this->form->get_checkbox('schema_add_noscript') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Include Website JSON-LD', 'option label', 'wpsso'), null, 'google_schema_website_json') . '<td>' . $this->form->get_checkbox('schema_website_json') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Include Publisher JSON-LD', 'option label', 'wpsso'), null, 'google_schema_publisher_json') . '<td>' . $this->form->get_checkbox('schema_publisher_json') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Include Author JSON-LD', 'option label', 'wpsso'), null, 'google_schema_author_json') . '<td>' . $this->form->get_checkbox('schema_author_json') . '</td>';
break;
case 'pub-pinterest':
$rows[] = '<td colspan="2" style="padding-bottom:10px;">' . $this->p->msgs->get('info-pub-pinterest') . '</td>';
$rows[] = $this->p->util->get_th(_x('Pinterest Company Page URL', 'option label', 'wpsso'), null, 'rp_publisher_url') . '<td>' . $this->form->get_input('rp_publisher_url', 'wide') . '</td>';
if (!SucomUtil::get_const('WPSSO_RICH_PIN_DISABLE')) {
$rows[] = $this->p->util->get_th(_x('Rich Pin Image Dimensions', 'option label', 'wpsso'), 'highlight', 'rp_img_dimensions') . '<td>' . $this->form->get_image_dimensions_input('rp_img') . '</td>';
}
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Author Name Format', 'option label', 'wpsso'), null, 'rp_author_name') . '<td>' . $this->form->get_select('rp_author_name', $this->p->cf['form']['user_name_fields']) . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Pinterest Website Verification ID', 'option label', 'wpsso'), null, 'rp_dom_verify') . '<td>' . $this->form->get_input('rp_dom_verify', 'api_key') . '</td>';
break;
case 'pub-twitter':
$rows[] = '<td colspan="2" style="padding-bottom:10px;">' . $this->p->msgs->get('info-pub-twitter') . '</td>';
$rows[] = $this->p->util->get_th(_x('Twitter Business @username', 'option label', 'wpsso'), 'highlight', 'tc_site') . '<td>' . $this->form->get_input('tc_site') . '</td>';
$rows[] = '<tr class="hide_in_basic">' . $this->p->util->get_th(_x('Maximum Description Length', 'option label', 'wpsso'), null, 'tc_desc_len') . '<td>' . $this->form->get_input('tc_desc_len', 'short') . ' ' . _x('characters or less', 'option comment', 'wpsso') . '</td>';
$rows[] = $this->p->util->get_th(_x('<em>Summary</em> Card Image Dimensions', 'option label', 'wpsso'), null, 'tc_sum_dimensions') . '<td>' . $this->form->get_image_dimensions_input('tc_sum', false, false) . '</td>';
$rows[] = $this->p->util->get_th(_x('<em>Large Image</em> Card Image Dimensions', 'option label', 'wpsso'), null, 'tc_lrgimg_dimensions') . '<td>' . $this->form->get_image_dimensions_input('tc_lrgimg', false, false) . '</td>';
break;
case 'pub-other':
$rows[] = $this->p->util->get_th(_x('Instagram Business URL', 'option label', 'wpsso'), null, 'instgram_publisher_url') . '<td>' . $this->form->get_input('instgram_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th(_x('LinkedIn Company Page URL', 'option label', 'wpsso'), null, 'linkedin_publisher_url') . '<td>' . $this->form->get_input('linkedin_publisher_url', 'wide') . '</td>';
$rows[] = $this->p->util->get_th(_x('MySpace Business (Brand) URL', 'option label', 'wpsso'), null, 'myspace_publisher_url') . '<td>' . $this->form->get_input('myspace_publisher_url', 'wide') . '</td>';
break;
}
return $rows;
}
示例13: get_rows
protected function get_rows($metabox, $key)
{
$rows = array();
$user_ids = array();
foreach (get_users() as $user) {
$user_ids[$user->ID] = $user->display_name;
}
$user_ids[0] = 'none';
switch ($metabox . '-' . $key) {
case 'og-webpage':
$rows[] = $this->p->util->th('Article Topic', 'highlight', 'og_art_section') . '<td>' . $this->form->get_select('og_art_section', $this->p->util->get_topics()) . '</td>';
$rows[] = $this->p->util->th('Site Name', null, 'og_site_name', array('is_locale' => true)) . '<td>' . $this->form->get_input(SucomUtil::get_locale_key('og_site_name'), null, null, null, get_bloginfo('name', 'display')) . '</td>';
$rows[] = $this->p->util->th('Site Description', 'highlight', 'og_site_description', array('is_locale' => true)) . '<td>' . $this->form->get_textarea(SucomUtil::get_locale_key('og_site_description'), null, null, null, get_bloginfo('description', 'display')) . '</td>';
$rows[] = $this->p->util->th('Title Separator', null, 'og_title_sep') . '<td>' . $this->form->get_input('og_title_sep', 'short') . '</td>';
$rows[] = $this->p->util->th('Title Length', null, 'og_title_len') . '<td>' . $this->form->get_input('og_title_len', 'short') . ' characters or less</td>';
$rows[] = $this->p->util->th('Description Length', null, 'og_desc_len') . '<td>' . $this->form->get_input('og_desc_len', 'short') . ' characters or less</td>';
$rows[] = $this->p->util->th('Add Page Title in Tags', null, 'og_page_title_tag') . '<td>' . $this->form->get_checkbox('og_page_title_tag') . '</td>';
$rows[] = $this->p->util->th('Add Page Ancestor Tags', null, 'og_page_parent_tags') . '<td>' . $this->form->get_checkbox('og_page_parent_tags') . '</td>';
$rows[] = $this->p->util->th('Number of Hashtags to Include', null, 'og_desc_hashtags') . '<td>' . $this->form->get_select('og_desc_hashtags', range(0, $this->p->cf['form']['max_desc_hashtags']), 'short', null, true) . ' tag names</td>';
$rows[] = $this->p->util->th('Content Begins at First Paragraph', null, 'og_desc_strip') . '<td>' . $this->form->get_checkbox('og_desc_strip') . '</td>';
break;
case 'og-images':
$img_id_pre = array('wp' => 'Media Library');
if ($this->p->is_avail['media']['ngg'] == true) {
$img_id_pre['ngg'] = 'NextGEN Gallery';
}
$rows[] = $this->p->util->th('Image Dimensions', 'highlight', 'og_img_dimensions') . '<td>Width ' . $this->form->get_input('og_img_width', 'short') . ' x ' . 'Height ' . $this->form->get_input('og_img_height', 'short') . ' ' . 'Crop ' . $this->form->get_checkbox('og_img_crop') . '</td>';
$rows[] = $this->p->util->th('Default Image ID', 'highlight', 'og_def_img_id') . '<td>' . $this->form->get_input('og_def_img_id', 'short') . ' in the ' . $this->form->get_select('og_def_img_id_pre', $img_id_pre) . '</td>';
$rows[] = $this->p->util->th('Default Image URL', null, 'og_def_img_url') . '<td>' . (empty($this->p->options['og_def_img_id']) ? $this->form->get_input('og_def_img_url', 'wide') : $this->form->get_fake_input('og_def_img_url', 'wide')) . '</td>';
$rows[] = $this->p->util->th('Use Default Image on Indexes', null, 'og_def_img_on_index') . '<td>' . $this->form->get_checkbox('og_def_img_on_index') . '</td>';
$rows[] = $this->p->util->th('Use Default Image on Search Results', null, 'og_def_img_on_search') . '<td>' . $this->form->get_checkbox('og_def_img_on_search') . '</td>';
if ($this->p->is_avail['media']['ngg'] === true) {
$rows[] = $this->p->util->th('Add Tags from NGG Featured Image', null, 'og_ngg_tags') . (isset($this->p->addons['media']['ngg']) ? '<td>' . $this->form->get_checkbox('og_ngg_tags') . '</td>' : '<td class="blank">' . $this->form->get_fake_checkbox('og_ngg_tags') . '</td>');
} else {
$rows[] = $this->form->get_hidden('og_ngg_tags');
}
$rows[] = $this->p->util->th('Maximum Images', null, 'og_img_max') . '<td>' . $this->form->get_select('og_img_max', range(0, $this->p->cf['form']['max_media_items']), 'short', null, true) . '</td>';
break;
case 'og-videos':
$rows[] = $this->p->util->th('Default Video URL', null, 'og_def_vid_url') . '<td>' . $this->form->get_input('og_def_vid_url', 'wide') . '</td>';
$rows[] = $this->p->util->th('Use Default Video on Indexes', null, 'og_def_vid_on_index') . '<td>' . $this->form->get_checkbox('og_def_vid_on_index') . '</td>';
$rows[] = $this->p->util->th('Use Default Video on Search Results', null, 'og_def_vid_on_search') . '<td>' . $this->form->get_checkbox('og_def_vid_on_search') . '</td>';
$rows[] = $this->p->util->th('Maximum Videos', null, 'og_vid_max') . '<td>' . $this->form->get_select('og_vid_max', range(0, $this->p->cf['form']['max_media_items']), 'short', null, true) . '</td>';
$rows[] = $this->p->util->th('Use HTTPS for Video APIs', null, 'og_vid_https') . '<td>' . $this->form->get_checkbox('og_vid_https') . '</td>';
break;
case 'og-author':
$rows[] = $this->p->util->th('Author Profile URL', null, 'og_author_field') . '<td>' . $this->form->get_select('og_author_field', $this->author_contact_fields()) . '</td>';
$rows[] = $this->p->util->th('Fallback to Author Index URL', null, 'og_author_fallback') . '<td>' . $this->form->get_checkbox('og_author_fallback') . '</td>';
$rows[] = $this->p->util->th('Default Author when Missing', null, 'og_def_author_id') . '<td>' . $this->form->get_select('og_def_author_id', $user_ids, null, null, true) . '</td>';
$rows[] = $this->p->util->th('Use Default Author on Indexes', null, 'og_def_author_on_index') . '<td>' . $this->form->get_checkbox('og_def_author_on_index') . ' defines index webpages as articles</td>';
$rows[] = $this->p->util->th('Default Author on Search Results', null, 'og_def_author_on_search') . '<td>' . $this->form->get_checkbox('og_def_author_on_search') . ' defines search webpages as articles</td>';
$rows[] = $this->p->util->th('Article Publisher Page URL', 'highlight', 'og_publisher_url') . '<td>' . $this->form->get_input('og_publisher_url', 'wide') . '</td>';
break;
case 'pub-facebook':
$rows[] = $this->p->util->th('Facebook Admin(s)', 'highlight', 'fb_admins') . '<td>' . $this->form->get_input('fb_admins') . '</td>';
$rows[] = $this->p->util->th('Facebook Application ID', null, 'fb_app_id') . '<td>' . $this->form->get_input('fb_app_id') . '</td>';
$rows[] = $this->p->util->th('Default Language', null, 'fb_lang') . '<td>' . $this->form->get_select('fb_lang', SucomUtil::get_pub_lang('facebook')) . '</td>';
break;
case 'pub-google':
$rows[] = $this->p->util->th('Description Length', null, 'google_desc_len') . '<td>' . $this->form->get_input('seo_desc_len', 'short') . ' characters or less</td>';
$rows[] = $this->p->util->th('Author Name Format', null, 'google_author_name') . '<td>' . $this->form->get_select('seo_author_name', $this->author_name_fields()) . '</td>';
$rows[] = $this->p->util->th('Author Link URL', null, 'google_author_field') . '<td>' . $this->form->get_select('link_author_field', $this->author_contact_fields()) . '</td>';
$rows[] = $this->p->util->th('Default Author when Missing', null, 'google_def_author_id') . '<td>' . $this->form->get_select('seo_def_author_id', $user_ids, null, null, true) . '</td>';
$rows[] = $this->p->util->th('Use Default Author on Indexes', null, 'google_def_author_on_index') . '<td>' . $this->form->get_checkbox('seo_def_author_on_index') . '</td>';
$rows[] = $this->p->util->th('Default Author on Search Results', null, 'google_def_author_on_search') . '<td>' . $this->form->get_checkbox('seo_def_author_on_search') . '</td>';
$rows[] = $this->p->util->th('Publisher Link URL', 'highlight', 'google_publisher_url') . '<td>' . $this->form->get_input('link_publisher_url', 'wide') . '</td>';
break;
case 'pub-pinterest':
$rows[] = '<td colspan="2" style="padding-bottom:10px;">' . $this->p->msgs->get('pub-pinterest-info') . '</td>';
$rows[] = $this->p->util->th('Author Name Format', null, 'rp_author_name') . '<td>' . $this->form->get_select('rp_author_name', $this->author_name_fields()) . '</td>';
break;
}
return $rows;
}