本文整理汇总了PHP中WPSEO_Meta::get_meta_field_defs方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Meta::get_meta_field_defs方法的具体用法?PHP WPSEO_Meta::get_meta_field_defs怎么用?PHP WPSEO_Meta::get_meta_field_defs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Meta
的用法示例。
在下文中一共展示了WPSEO_Meta::get_meta_field_defs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanitize_duration
/**
* Sanitize the video duration post meta
*
* @static
*
* @param mixed $clean Potentially pre-cleaned version of the new meta value
* @param mixed $meta_value The new value
* @param string $field_def The field definition for the current meta field
*
* @return string Cleaned value
*/
public static function sanitize_duration($clean, $meta_value, $field_def)
{
$field_def = WPSEO_Meta::get_meta_field_defs('video');
$field_def = $field_def['videositemap-duration'];
$clean = $field_def['default_value'];
$int = WPSEO_Video_Wrappers::yoast_wpseo_video_validate_int($meta_value);
if ($int !== false && $int > 0) {
$clean = strval($int);
}
return $clean;
}
示例2: get_meta_boxes
/**
* Defines the meta box inputs
*
* @since 0.1
* @deprecated 1.6.0
* @deprecated use WPSEO_Meta::get_meta_field_defs()
* @see WPSEO_Meta::get_meta_field_defs()
*
* @param string $post_type The current post type
*
* @return array Meta box inputs
*/
public function get_meta_boxes($post_type = 'post')
{
_deprecated_function(__METHOD__, 'Video SEO 1.6.0', 'WPSEO_Meta::get_meta_field_defs()');
return WPSEO_Meta::get_meta_field_defs('video', $post_type);
}
示例3: map_to_dropdown
function map_to_dropdown()
{
global $wpdb;
$dont_allow = array('_wp_attachment_image_alt', '_wp_attachment_metadata', '_wp_attached_file', '_edit_lock', '_edit_last', '_wp_page_template');
$html = '
<li data-post-type="all" class="live_filter">
<input type="text" class="live_filter" placeholder="' . esc_attr($this->__('Search... ')) . '" />
</li>';
$field_groups = array();
$supports_custom = array();
$yoast_field_type_array = array('text', 'textarea', 'select', 'upload', 'radio', 'multiselect');
$yoast = false;
if (function_exists('wpseo_admin_init')) {
$this->_initialize_yoast();
$yoast = true;
}
$yoast_prefix = '_yoast_wpseo_';
$yoast_fields = array();
foreach ($this->post_types as $name => $title) {
$supports = get_all_post_type_supports($name);
if (isset($supports['custom-fields'])) {
$supports_custom[] = $name;
}
if ($name == 'attachment') {
$html .= '
<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Title')) . '">
<a href="#" data-value="post_title">' . $this->__('Title') . '</a>
</li>
<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Caption')) . '">
<a href="#" data-value="post_excerpt">' . $this->__('Caption') . '</a>
</li>
<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Description')) . '">
<a href="#" data-value="post_content">' . $this->__('Description') . '</a>
</li>
<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Alt Text')) . '">
<a href="#" data-value="_wp_attachment_image_alt">' . $this->__('Alt Text') . '</a>
</li>';
} else {
$labels = array('title' => sprintf($this->__('%s Title'), $title), 'editor' => sprintf($this->__('%s Content'), $title), 'excerpt' => sprintf($this->__('%s Excerpt'), $title), 'thumbnail' => $this->__('Featured Image'), 'tags' => $this->__('Tags'), 'cats' => $this->__('Category'), 'author' => $this->__('Author'));
$fields = array('editor' => 'post_content', 'title' => 'post_title', 'excerpt' => 'post_excerpt', 'thumbnail' => 'gc_featured_image_', 'author' => 'post_author');
foreach ($fields as $type => $fieldname) {
if (isset($supports[$type])) {
$html .= '
<li data-post-type="|' . $name . '|" data-search="' . esc_attr($labels[$type]) . '">
<a href="#" data-value="' . $fieldname . '">' . esc_html($labels[$type]) . '</a>
</li>';
}
}
if (count($this->taxonomies[$name]) > 0) {
$html .= '
<li data-post-type="|' . $name . '|" data-search="' . esc_attr($labels['cats']) . '">
<a href="#" data-value="gc_post_cat_">' . esc_html($labels['cats']) . '</a>
</li>';
}
if (isset($this->allows_tags[$name])) {
$html .= '
<li data-post-type="|' . $name . '|" data-search="' . esc_attr($labels['tags']) . '">
<a href="#" data-value="gc_post_tags_">' . esc_html($labels['tags']) . '</a>
</li>';
}
}
if ($this->has_acf) {
$acf = $this->_acf_get_field_groups(array('post_type' => $name));
foreach ($acf as $post_id) {
if (!isset($field_groups[$post_id])) {
$field_groups[$post_id] = array('types' => array(), 'posts' => array());
}
$field_groups[$post_id]['types'][] = $name;
$field_groups[$post_id]['posts'][] = 0;
}
foreach ($this->page_ids[$name] as $page_id) {
$acf = $this->_acf_get_field_groups(array('post_id' => $page_id));
foreach ($acf as $post_id) {
if (!isset($field_groups[$post_id])) {
$field_groups[$post_id] = array('posts' => array());
} elseif (!isset($field_groups[$post_id]['posts'])) {
$field_groups[$post_id]['posts'] = array();
}
$field_groups[$post_id]['posts'][] = $page_id;
}
}
}
if ($yoast) {
$meta_boxes = array_merge(WPSEO_Meta::get_meta_field_defs('general', $name), WPSEO_Meta::get_meta_field_defs('advanced'), apply_filters('wpseo_save_metaboxes', array()));
foreach ($meta_boxes as $field_name => $meta_box) {
if (in_array($meta_box['type'], $yoast_field_type_array)) {
$yoast_fields[$yoast_prefix . $field_name] = true;
$html .= '
<li data-post-type="|' . $name . '|" data-search="' . esc_attr($meta_box['title']) . '">
<a href="#" data-value="' . $yoast_prefix . esc_attr($field_name) . '">' . esc_html($meta_box['title']) . '</a>
</li>';
}
}
}
}
foreach ($field_groups as $id => $options) {
$options['posts'] = array_unique($options['posts']);
if ($this->acf_pro) {
$fields = acf_get_fields($id);
} else {
//.........这里部分代码省略.........