本文整理汇总了PHP中hocwp_array_has_value函数的典型用法代码示例。如果您正苦于以下问题:PHP hocwp_array_has_value函数的具体用法?PHP hocwp_array_has_value怎么用?PHP hocwp_array_has_value使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hocwp_array_has_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hocwp_meta_box_side_image
function hocwp_meta_box_side_image($args = array())
{
global $pagenow;
if ('post-new.php' == $pagenow || 'post.php' == $pagenow) {
$id = hocwp_get_value_by_key($args, 'id', 'secondary_image_box');
$title = hocwp_get_value_by_key($args, 'title', __('Secondary Image', 'hocwp-theme'));
$post_types = hocwp_get_value_by_key($args, 'post_type');
if ('all' == $post_types) {
$post_types = array();
$types = get_post_types(array('public' => true), 'objects');
hocwp_exclude_special_post_types($types);
foreach ($types as $key => $object_type) {
$post_types[] = $key;
}
}
$post_types = hocwp_sanitize_array($post_types);
$field_id = hocwp_get_value_by_key($args, 'field_id', 'secondary_image');
$post_types = apply_filters('hocwp_post_type_user_large_thumbnail', $post_types);
if (!hocwp_array_has_value($post_types)) {
return;
}
$meta = new HOCWP_Meta('post');
$meta->set_post_types($post_types);
$meta->set_id($id);
$meta->set_title($title);
$meta->set_context('side');
$meta->set_priority('low');
$field_args = array('id' => $field_id, 'field_callback' => 'hocwp_field_media_upload_simple');
$field_name = hocwp_get_value_by_key($args, 'field_name', $field_id);
$field_args['name'] = $field_name;
$meta->add_field($field_args);
$meta->init();
}
}
示例2: widget
public function widget($args, $instance)
{
$this->instance = $instance;
$order = hocwp_get_value_by_key($instance, 'order', hocwp_get_value_by_key($this->args, 'order'));
$orders = explode(',', $order);
$orders = array_map('trim', $orders);
$orders = hocwp_sanitize_array($orders);
$option_names = $this->args['option_names'];
$options = hocwp_get_option('option_social');
$icons = $this->args['icons'];
$description = hocwp_get_value_by_key($instance, 'description');
hocwp_widget_before($args, $instance);
ob_start();
if (!empty($description)) {
echo hocwp_wrap_tag(wpautop($description), 'div', 'description');
}
if (hocwp_array_has_value($orders)) {
foreach ($orders as $social) {
$option_name = hocwp_get_value_by_key($option_names, $social);
$item = hocwp_get_value_by_key($options, $option_name);
if (!empty($item)) {
$icon = '<i class="fa ' . $icons[$social] . '"></i>';
$a = new HOCWP_HTML('a');
$a->set_href($item);
$a->set_class('social-item link-' . $social);
$a->set_text($icon);
$a->output();
}
}
}
$widget_html = ob_get_clean();
$widget_html = apply_filters('hocwp_widget_social_html', $widget_html, $args, $instance, $this);
echo $widget_html;
hocwp_widget_after($args, $instance);
}
示例3: form
public function form($instance)
{
$this->instance = $instance;
$title = isset($instance['title']) ? $instance['title'] : '';
$category = $this->get_category_from_instance($instance);
hocwp_field_widget_before($this->admin_args['class']);
hocwp_widget_field_title($this->get_field_id('title'), $this->get_field_name('title'), $title);
$all_option = '';
$lists = hocwp_get_terms('link_category');
foreach ($lists as $lvalue) {
$selected = '';
if (!hocwp_array_has_value($category)) {
$category[] = array('value' => '');
}
foreach ($category as $ptvalue) {
$ptype = isset($ptvalue['value']) ? $ptvalue['value'] : '';
if ($lvalue->term_id == $ptype) {
$selected = $lvalue->term_id;
break;
}
}
$all_option .= hocwp_field_get_option(array('value' => $lvalue->term_id, 'text' => $lvalue->name, 'selected' => $selected));
}
$args = array('id' => $this->get_field_id('category'), 'name' => $this->get_field_name('category'), 'all_option' => $all_option, 'value' => $category, 'label' => __('Category:', 'hocwp-theme'), 'placeholder' => __('Choose category', 'hocwp-theme'), 'multiple' => true);
hocwp_widget_field('hocwp_field_select_chosen', $args);
hocwp_field_widget_after();
}
示例4: hocwp_option_home_setting_defaults
function hocwp_option_home_setting_defaults()
{
$alls = hocwp_option_defaults();
$defaults = hocwp_get_value_by_key($alls, 'home_setting');
if (!hocwp_array_has_value($defaults)) {
$defaults = array('recent_posts' => 1, 'posts_per_page' => hocwp_get_posts_per_page(), 'pagination' => 1);
}
return apply_filters('hocwp_option_home_setting_defaults', $defaults);
}
示例5: hocwp_option_theme_setting_defaults
function hocwp_option_theme_setting_defaults()
{
$alls = hocwp_option_defaults();
$defaults = hocwp_get_value_by_key($alls, 'theme_setting');
if (!hocwp_array_has_value($defaults)) {
$defaults = array('language' => 'vi');
}
return apply_filters('hocwp_option_theme_setting_defaults', $defaults);
}
示例6: hocwp_option_utilities_defaults
function hocwp_option_utilities_defaults()
{
$alls = hocwp_option_defaults();
$defaults = hocwp_get_value_by_key($alls, 'utilities');
if (!hocwp_array_has_value($defaults)) {
$defaults = array('link_manager' => 0, 'dashboard_widget' => 1, 'force_admin_english' => 1);
}
return apply_filters('hocwp_option_utilities_defaults', $defaults);
}
示例7: hocwp_option_optimize_defaults
function hocwp_option_optimize_defaults()
{
$alls = hocwp_option_defaults();
$defaults = hocwp_get_value_by_key($alls, 'optimize');
if (!hocwp_array_has_value($defaults)) {
$defaults = array('use_jquery_cdn' => 1, 'use_bootstrap_cdn' => 1, 'use_fontawesome_cdn' => 1, 'use_superfish_cdn' => 1);
}
return apply_filters('hocwp_option_optimize_defaults', $defaults);
}
示例8: hocwp_option_reading_defaults
function hocwp_option_reading_defaults()
{
$alls = hocwp_option_defaults();
$defaults = hocwp_get_value_by_key($alls, 'reading');
if (!hocwp_array_has_value($defaults)) {
$defaults = array('statistics' => 0, 'trending' => 0, 'search_tracking' => 0, 'enlarge_thumbnail' => 0, 'excerpt_length' => 75, 'post_statistics' => 0, 'sticky_widget' => 0, 'redirect_404' => 0, 'breadcrumb_label' => '', 'disable_post_title_breadcrumb' => 0, 'link_last_item_breadcrumb' => 0, 'go_to_top' => 0, 'go_to_top_on_left' => 0, 'scroll_top_icon' => '', 'content_none_title' => '', 'thumbnail_image_sizes' => array(), 'products_per_page' => hocwp_get_product_posts_per_page());
}
return apply_filters('hocwp_option_reading_defaults', $defaults);
}
示例9: hocwp_option_theme_custom_defaults
function hocwp_option_theme_custom_defaults()
{
$alls = hocwp_option_defaults();
$defaults = hocwp_get_value_by_key($alls, 'theme_custom');
if (!hocwp_array_has_value($defaults)) {
$defaults = array('background_lazyload' => 0);
}
return apply_filters('hocwp_option_theme_custom_defaults', $defaults);
}
示例10: hocwp_plugin_upgrader_process_complete
function hocwp_plugin_upgrader_process_complete($upgrader, $options)
{
$plugins = hocwp_get_value_by_key($options, 'plugins');
if (!hocwp_array_has_value($plugins)) {
return;
}
foreach ($plugins as $plugin) {
$slug = hocwp_get_plugin_slug_from_file_path($plugin);
$transient_name = 'hocwp_plugins_api_' . $slug . '_plugin_information';
$transient_name = hocwp_sanitize_id($transient_name);
delete_transient($transient_name);
}
}
示例11: hocwp_video_source_meta_box
function hocwp_video_source_meta_box($post_types = array())
{
if (!hocwp_array_has_value($post_types)) {
$post_types[] = 'post';
}
$meta = new HOCWP_Meta('post');
$meta->set_post_types($post_types);
$meta->set_title(__('Video Source Information', 'hocwp-theme'));
$meta->set_id('hocwp_theme_video_source_information');
$meta->add_field(array('field_args' => array('id' => 'video_url', 'label' => 'Video URL:')));
$meta->add_field(array('field_args' => array('id' => 'video_code', 'label' => 'Video code:'), 'field_callback' => 'hocwp_field_textarea'));
$meta->init();
}
示例12: update
public function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = strip_tags(hocwp_get_value_by_key($new_instance, 'title'));
$instance['fields'] = $this->get_value_fields($new_instance);
$all_fields = explode(',', $instance['fields']);
foreach ($all_fields as $field_name) {
$field = hocwp_get_value_by_key($this->args['fields'], $field_name);
if (hocwp_array_has_value($field)) {
foreach ($field as $key => $data) {
$real_name = 'subscribe_' . $field_name . '_' . $key;
$instance[$real_name] = $this->get_value_field($new_instance, $field_name, $key);
}
}
}
$instance['button_text'] = hocwp_get_value_by_key($new_instance, 'button_text', hocwp_get_value_by_key($this->args, 'button_text'));
$instance['description'] = hocwp_get_value_by_key($new_instance, 'description', hocwp_get_value_by_key($this->args, 'description'));
$instance['desc_position'] = hocwp_get_value_by_key($new_instance, 'desc_position', $this->args['desc_position']);
$instance['captcha'] = hocwp_checkbox_post_data_value($new_instance, 'captcha');
$instance['captcha_label'] = hocwp_get_value_by_key($new_instance, 'captcha_label', hocwp_get_value_by_key($this->args, 'captcha_label'));
$instance['captcha_placeholder'] = hocwp_get_value_by_key($new_instance, 'captcha_placeholder', hocwp_get_value_by_key($this->args, 'captcha_placeholder'));
$instance['register'] = hocwp_checkbox_post_data_value($new_instance, 'register');
return $instance;
}
示例13: hocwp_theme_option_sidebar_tab
function hocwp_theme_option_sidebar_tab()
{
global $hocwp_tos_tabs;
if (hocwp_array_has_value($hocwp_tos_tabs)) {
$current_page = hocwp_get_current_admin_page();
?>
<ul class="list-tabs">
<?php
foreach ($hocwp_tos_tabs as $key => $value) {
?>
<?php
$admin_url = admin_url('admin.php');
$admin_url = add_query_arg(array('page' => $key), $admin_url);
$item_class = hocwp_sanitize_html_class($key);
if ($key == $current_page) {
hocwp_add_string_with_space_before($item_class, 'active');
$admin_url = 'javascript:;';
}
$text = hocwp_get_value_by_key($value, 'text');
if (empty($text)) {
continue;
}
?>
<li class="<?php
echo $item_class;
?>
"><a
href="<?php
echo $admin_url;
?>
"><span><?php
echo $text;
?>
</span></a></li>
<?php
}
?>
</ul>
<?php
}
}
示例14: hocwp_term_meta_different_name_field
function hocwp_term_meta_different_name_field($taxonomies = array())
{
global $pagenow;
if ('edit-tags.php' == $pagenow || 'term.php' == $pagenow) {
if (!hocwp_array_has_value($taxonomies)) {
$taxonomies = get_taxonomies(array('public' => true));
}
$taxonomies = apply_filters('hocwp_term_different_name_field_taxonomies', $taxonomies);
hocwp_exclude_special_taxonomies($taxonomies);
if (!hocwp_array_has_value($taxonomies)) {
$taxonomies = array('category');
}
$meta = new HOCWP_Meta('term');
$meta->set_taxonomies($taxonomies);
$meta->add_field(array('id' => 'different_name', 'label' => __('Different Name', 'hocwp-theme')));
$meta->init();
}
}
示例15: widget
public function widget($args, $instance)
{
$this->instance = $instance;
$number = hocwp_get_value_by_key($instance, 'number', hocwp_get_value_by_key($this->args, 'number'));
$time = hocwp_get_value_by_key($instance, 'time', hocwp_get_value_by_key($this->args, 'time'));
$exclude_users = hocwp_get_value_by_key($instance, 'exclude_users');
$exclude_users = hocwp_json_string_to_array($exclude_users);
$show_count = hocwp_get_value_by_key($instance, 'show_count', hocwp_get_value_by_key($this->args, 'show_count'));
$link_author_name = hocwp_get_value_by_key($instance, 'link_author_name', hocwp_get_value_by_key($this->args, 'link_author_name'));
$none_text = hocwp_get_value_by_key($instance, 'none_text', hocwp_get_value_by_key($this->args, 'none_text'));
hocwp_widget_before($args, $instance);
$condition = '';
if (hocwp_array_has_value($exclude_users)) {
$not_in = array();
foreach ($exclude_users as $data) {
$uid = hocwp_get_value_by_key($data, 'value');
if (hocwp_id_number_valid($uid)) {
$not_in[] = $uid;
}
}
if (hocwp_array_has_value($not_in)) {
$condition = 'AND user_id NOT IN (' . implode(', ', $not_in) . ')';
}
}
$commenters = hocwp_get_top_commenters($number, $time, $condition);
ob_start();
if (!hocwp_array_has_value($commenters)) {
echo wpautop($none_text);
} else {
?>
<ol class="list-commenters">
<?php
foreach ($commenters as $commenter) {
$url = $commenter->comment_author_url;
$author = $commenter->comment_author;
$count = absint($commenter->comments_count);
$email = $commenter->comment_author_email;
$user_id = 0;
if (!empty($commenter->user_id)) {
$user_id = $commenter->user_id;
}
if ((bool) $show_count) {
$author .= " ({$count})";
}
if (empty($url) || 'http://' == $url || !(bool) $link_author_name) {
$url = $author;
} else {
$url = "<a href='{$url}' rel='external nofollow' class='url'>{$author}</a>";
}
?>
<li class="commenter"><?php
echo $url;
?>
</li>
<?php
}
?>
</ol>
<?php
}
$widget_html = ob_get_clean();
$widget_html = apply_filters('hocwp_widget_top_commenter_html', $widget_html, $args, $instance, $this);
echo $widget_html;
hocwp_widget_after($args, $instance);
}