• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP hocwp_array_has_value函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中hocwp_array_has_value函数的典型用法代码示例。如果您正苦于以下问题:PHP hocwp_array_has_value函数的具体用法?PHP hocwp_array_has_value怎么用?PHP hocwp_array_has_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了hocwp_array_has_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
    }
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:34,代码来源:meta.php


示例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);
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:35,代码来源:class-hocwp-widget-social.php


示例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();
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:27,代码来源:class-hocwp-widget-link.php


示例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);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:setting-theme-home.php


示例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);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:setting-theme-setting.php


示例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);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:setting-utilities.php


示例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);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:setting-optimize.php


示例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);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:setting-reading.php


示例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);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:setting-theme-custom.php


示例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);
    }
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:13,代码来源:back-end.php


示例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();
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:13,代码来源:video.php


示例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;
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:24,代码来源:class-hocwp-widget-subscribe.php


示例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 
    }
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:41,代码来源:option.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();
    }
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:18,代码来源:term-meta.php


示例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);
    }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:65,代码来源:class-hocwp-widget-top-commenter.php


示例16: hocwp_setup_theme_save_post_meta_hook

function hocwp_setup_theme_save_post_meta_hook($post_id)
{
    if (!hocwp_can_save_post($post_id)) {
        return $post_id;
    }
    $post = get_post($post_id);
    $post_type = $post->post_type;
    global $hocwp_metas;
    if (hocwp_array_has_value($hocwp_metas)) {
        foreach ($hocwp_metas as $meta) {
            if ('post' == $meta->get_type()) {
                $post_types = $meta->get_post_types();
                $fields = $meta->get_fields();
                foreach ($fields as $field) {
                    $meta->save_post_meta_helper($post_id, $field);
                }
                $fields = $meta->get_custom_fields();
                if (is_array($fields)) {
                    foreach ($fields as $field) {
                        $meta->save_post_meta_helper($post_id, $field);
                    }
                }
            }
        }
    }
    $value = isset($_POST['featured']) ? 1 : 0;
    update_post_meta($post_id, 'featured', $value);
    $value = isset($_POST['active']) ? 1 : 0;
    update_post_meta($post_id, 'active', $value);
    if ('hocwp_subscriber' == $post->post_type) {
        update_post_meta($post_id, 'subscriber_verified', $value);
    }
    switch ($post_type) {
        case 'hocwp_sidebar':
            if (isset($_POST['sidebar_id'])) {
                update_post_meta($post_id, 'sidebar_id', hocwp_sanitize_id($_POST['sidebar_id']));
            }
            if (isset($_POST['sidebar_name'])) {
                update_post_meta($post_id, 'sidebar_name', sanitize_text_field($_POST['sidebar_name']));
            }
            if (isset($_POST['sidebar_description'])) {
                update_post_meta($post_id, 'sidebar_description', sanitize_text_field($_POST['sidebar_description']));
            }
            if (isset($_POST['sidebar_tag'])) {
                update_post_meta($post_id, 'sidebar_tag', sanitize_text_field($_POST['sidebar_tag']));
            }
            break;
        case 'hocwp_slider':
            if (isset($_POST['slider_items'])) {
                update_post_meta($post_id, 'slider_items', $_POST['slider_items']);
            }
            if (isset($_POST['position'])) {
                update_post_meta($post_id, 'position', $_POST['position']);
            }
            $fit_width = hocwp_get_method_value('fit_width');
            update_post_meta($post_id, 'fit_width', $fit_width);
            if (isset($_POST['height'])) {
                update_post_meta($post_id, 'height', $_POST['height']);
            }
            break;
        case 'hocwp_ads':
            if (isset($_POST['position'])) {
                update_post_meta($post_id, 'position', $_POST['position']);
            }
            if (isset($_POST['expire'])) {
                update_post_meta($post_id, 'expire', strtotime($_POST['expire']));
            }
            if (isset($_POST['code'])) {
                update_post_meta($post_id, 'code', $_POST['code']);
            }
            $image = hocwp_get_method_value('image');
            update_post_meta($post_id, 'image', $image);
            $url = hocwp_get_method_value('url');
            update_post_meta($post_id, 'url', $url);
            break;
        case 'hocwp_subscriber':
            if (isset($_POST['subscriber_name'])) {
                update_post_meta($post_id, 'subscriber_name', sanitize_text_field($_POST['subscriber_name']));
            }
            if (isset($_POST['subscriber_phone'])) {
                update_post_meta($post_id, 'subscriber_phone', sanitize_text_field($_POST['subscriber_phone']));
            }
            break;
        case 'coupon':
            if (isset($_POST['expired_date'])) {
                update_post_meta($post_id, 'expired_date', strtotime($_POST['expired_date']));
            }
            break;
        case 'product':
            $args = array('posts_per_page' => -1, 'post_type' => 'hocwp_product_tab');
            $query = hocwp_query($args);
            if ($query->have_posts()) {
                foreach ($query->posts as $product) {
                    $field_name = hocwp_sanitize_id($product->post_name);
                    if (isset($_POST[$field_name])) {
                        update_post_meta($post_id, $field_name, $_POST[$field_name]);
                    }
                }
            }
            break;
//.........这里部分代码省略.........
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:101,代码来源:meta.php


示例17: form

 public function form($instance)
 {
     $this->instance = $instance;
     $title = hocwp_get_value_by_key($instance, 'title');
     $post_type = $this->get_post_type_from_instance($instance);
     $number = hocwp_get_value_by_key($instance, 'number', hocwp_get_value_by_key($this->args, 'number'));
     $by = hocwp_get_value_by_key($instance, 'by', hocwp_get_value_by_key($this->args, 'by'));
     $category = hocwp_get_value_by_key($instance, 'category', json_encode(hocwp_get_value_by_key($this->args, 'category')));
     $category = hocwp_json_string_to_array($category);
     $thumbnail_size = hocwp_get_value_by_key($instance, 'thumbnail_size', hocwp_get_value_by_key($this->args, 'thumbnail_size'));
     $full_width_post = hocwp_get_value_by_key($instance, 'full_width_post', hocwp_get_value_by_key($this->args, 'full_width_post'));
     $title_length = hocwp_get_value_by_key($instance, 'title_length', hocwp_get_value_by_key($this->args, 'title_length'));
     $excerpt_length = hocwp_get_value_by_key($instance, 'excerpt_length', hocwp_get_value_by_key($this->args, 'excerpt_length'));
     $hide_thumbnail = hocwp_get_value_by_key($instance, 'hide_thumbnail', hocwp_get_value_by_key($this->args, 'hide_thumbnail'));
     $widget_title_link_category = hocwp_get_value_by_key($instance, 'widget_title_link_category', hocwp_get_value_by_key($this->args, 'widget_title_link_category'));
     $category_as_widget_title = hocwp_get_value_by_key($instance, 'category_as_widget_title', hocwp_get_value_by_key($this->args, 'category_as_widget_title'));
     hocwp_field_widget_before($this->admin_args['class']);
     hocwp_widget_field_title($this->get_field_id('title'), $this->get_field_name('title'), $title);
     $lists = get_post_types(array('_builtin' => false, 'public' => true), 'objects');
     if (!array_key_exists('post', $lists)) {
         $lists[] = get_post_type_object('post');
     }
     $all_option = '';
     foreach ($lists as $lvalue) {
         $selected = '';
         if (!hocwp_array_has_value($post_type)) {
             $post_type[] = array('value' => 'post');
         }
         foreach ($post_type as $ptvalue) {
             $ptype = isset($ptvalue['value']) ? $ptvalue['value'] : '';
             if ($lvalue->name == $ptype) {
                 $selected = $lvalue->name;
                 break;
             }
         }
         $all_option .= hocwp_field_get_option(array('value' => $lvalue->name, 'text' => $lvalue->labels->singular_name, 'selected' => $selected));
     }
     $args = array('id' => $this->get_field_id('post_type'), 'name' => $this->get_field_name('post_type'), 'all_option' => $all_option, 'value' => $post_type, 'label' => __('Post type:', 'hocwp-theme'), 'placeholder' => __('Choose post types', 'hocwp-theme'), 'multiple' => true);
     hocwp_widget_field('hocwp_field_select_chosen', $args);
     $args = array('id' => $this->get_field_id('number'), 'name' => $this->get_field_name('number'), 'value' => $number, 'label' => __('Number posts:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_number', $args);
     $lists = $this->args['bys'];
     $all_option = '';
     foreach ($lists as $lkey => $lvalue) {
         $all_option .= hocwp_field_get_option(array('value' => $lkey, 'text' => $lvalue, 'selected' => $by));
     }
     $args = array('id' => $this->get_field_id('by'), 'name' => $this->get_field_name('by'), 'value' => $by, 'all_option' => $all_option, 'label' => __('Get by:', 'hocwp-theme'), 'class' => 'get-by');
     hocwp_widget_field('hocwp_field_select', $args);
     $all_option = '';
     $taxonomies = hocwp_get_hierarchical_taxonomies();
     foreach ($taxonomies as $tkey => $tax) {
         $lists = hocwp_get_hierarchical_terms(array($tkey));
         if (hocwp_array_has_value($lists)) {
             $all_option .= '<optgroup label="' . $tax->labels->singular_name . '">';
             foreach ($lists as $lvalue) {
                 $selected = '';
                 if (hocwp_array_has_value($category)) {
                     foreach ($category as $cvalue) {
                         $term_id = isset($cvalue['value']) ? $cvalue['value'] : 0;
                         if ($lvalue->term_id == $term_id) {
                             $selected = $lvalue->term_id;
                             break;
                         }
                     }
                 }
                 $all_option .= hocwp_field_get_option(array('value' => $lvalue->term_id, 'text' => $lvalue->name, 'selected' => $selected, 'attributes' => array('data-taxonomy' => $tkey)));
             }
             $all_option .= '</optgroup>';
         }
     }
     $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 terms', 'hocwp-theme'), 'multiple' => true, 'class' => 'select-category');
     if ('category' != $by) {
         $args['hidden'] = true;
     }
     hocwp_widget_field('hocwp_field_select_chosen', $args);
     $args = array('id_width' => $this->get_field_id('thumbnail_size_width'), 'name_width' => $this->get_field_name('thumbnail_size_width'), 'id_height' => $this->get_field_id('thumbnail_size_height'), 'name_height' => $this->get_field_name('thumbnail_size_height'), 'value' => $thumbnail_size, 'label' => __('Thumbnail size:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_size', $args);
     $lists = $this->args['full_width_posts'];
     $all_option = '';
     foreach ($lists as $lkey => $lvalue) {
         $all_option .= hocwp_field_get_option(array('value' => $lkey, 'text' => $lvalue, 'selected' => $full_width_post));
     }
     $args = array('id' => $this->get_field_id('full_width_post'), 'name' => $this->get_field_name('full_width_post'), 'value' => $full_width_post, 'all_option' => $all_option, 'label' => __('Full width posts:', 'hocwp-theme'), 'class' => 'full-width-post');
     hocwp_widget_field('hocwp_field_select', $args);
     $args = array('id' => $this->get_field_id('title_length'), 'name' => $this->get_field_name('title_length'), 'value' => $title_length, 'label' => __('Title length:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_number', $args);
     $args = array('id' => $this->get_field_id('excerpt_length'), 'name' => $this->get_field_name('excerpt_length'), 'value' => $excerpt_length, 'label' => __('Excerpt length:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_number', $args);
     $slider = hocwp_get_value_by_key($instance, 'slider', hocwp_get_value_by_key($this->args, 'slider'));
     $args = array('id' => $this->get_field_id('slider'), 'name' => $this->get_field_name('slider'), 'value' => $slider, 'label' => __('Display post as slider?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('hide_thumbnail'), 'name' => $this->get_field_name('hide_thumbnail'), 'value' => $hide_thumbnail, 'label' => __('Hide post thumbnail?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('widget_title_link_category'), 'name' => $this->get_field_name('widget_title_link_category'), 'value' => $widget_title_link_category, 'label' => __('Link widget title with category?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('category_as_widget_title'), 'name' => $this->get_field_name('category_as_widget_title'), 'value' => $category_as_widget_title, 'label' => __('Display category name as widget title?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     hocwp_field_widget_after();
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:99,代码来源:class-hocwp-widget-post.php


示例18: form

 public function form($instance)
 {
     $this->instance = $instance;
     $title = hocwp_get_value_by_key($instance, 'title');
     $taxonomy = $this->get_taxonomy_from_instance($instance);
     $number = hocwp_get_value_by_key($instance, 'number', hocwp_get_value_by_key($this->args, 'number'));
     $thumbnail_size = hocwp_get_value_by_key($instance, 'thumbnail_size', hocwp_get_value_by_key($this->args, 'thumbnail_size'));
     $full_width_item = hocwp_get_value_by_key($instance, 'full_width_item', hocwp_get_value_by_key($this->args, 'full_width_item'));
     $count_format = hocwp_get_value_by_key($instance, 'count_format', hocwp_get_value_by_key($this->args, 'count_format'));
     $show_count = hocwp_get_value_by_key($instance, 'show_count', hocwp_get_value_by_key($this->args, 'show_count'));
     $hide_thumbnail = hocwp_get_value_by_key($instance, 'hide_thumbnail', hocwp_get_value_by_key($this->args, 'hide_thumbnail'));
     $only_thumbnail = hocwp_get_value_by_key($instance, 'only_thumbnail', hocwp_get_value_by_key($this->args, 'only_thumbnail'));
     $order = hocwp_get_value_by_key($instance, 'order', hocwp_get_value_by_key($this->args, 'order'));
     $orderby = hocwp_get_value_by_key($instance, 'orderby', hocwp_get_value_by_key($this->args, 'orderby'));
     $different_name = (bool) hocwp_get_value_by_key($instance, 'different_name', hocwp_get_value_by_key($this->args, 'different_name'));
     $in_current_post = (bool) hocwp_get_value_by_key($instance, 'in_current_post', hocwp_get_value_by_key($this->args, 'in_current_post'));
     $hide_empty = hocwp_get_value_by_key($instance, 'hide_empty', hocwp_get_value_by_key($this->args, 'hide_empty'));
     $only_parent = hocwp_get_value_by_key($instance, 'only_parent', hocwp_get_value_by_key($this->args, 'only_parent'));
     $child_of_current = hocwp_get_value_by_key($instance, 'child_of_current', hocwp_get_value_by_key($this->args, 'child_of_current'));
     $child_of_parent = hocwp_get_value_by_key($instance, 'child_of_parent', hocwp_get_value_by_key($this->args, 'child_of_parent'));
     $parent_as_title = hocwp_get_value_by_key($instance, 'parent_as_title', hocwp_get_value_by_key($this->args, 'parent_as_title'));
     hocwp_field_widget_before($this->admin_args['class']);
     hocwp_widget_field_title($this->get_field_id('title'), $this->get_field_name('title'), $title);
     $lists = get_taxonomies(array('_builtin' => false, 'public' => true), 'objects');
     if (!array_key_exists('post_tag', $lists)) {
         array_unshift($lists, get_taxonomy('post_tag'));
     }
     if (!array_key_exists('category', $lists)) {
         array_unshift($lists, get_taxonomy('category'));
     }
     $all_option = '';
     foreach ($lists as $lvalue) {
         $selected = '';
         if (!hocwp_array_has_value($taxonomy)) {
             $taxonomy[] = array('value' => 'category');
         }
         foreach ($taxonomy as $ptvalue) {
             $ptype = isset($ptvalue['value']) ? $ptvalue['value'] : '';
             if ($lvalue->name == $ptype) {
                 $selected = $lvalue->name;
                 break;
             }
         }
         $all_option .= hocwp_field_get_option(array('value' => $lvalue->name, 'text' => $lvalue->labels->singular_name, 'selected' => $selected));
     }
     $args = array('id' => $this->get_field_id('taxonomy'), 'name' => $this->get_field_name('taxonomy'), 'all_option' => $all_option, 'value' => $taxonomy, 'label' => __('Taxonomy:', 'hocwp-theme'), 'placeholder' => __('Choose taxonomy', 'hocwp-theme'), 'multiple' => true);
     hocwp_widget_field('hocwp_field_select_chosen', $args);
     $args = array('id' => $this->get_field_id('number'), 'name' => $this->get_field_name('number'), 'value' => $number, 'label' => __('Number items:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_number', $args);
     $lists = $this->args['orderbys'];
     $all_option = '';
     foreach ($lists as $lkey => $lvalue) {
         $all_option .= hocwp_field_get_option(array('value' => $lkey, 'text' => $lvalue, 'selected' => $orderby));
     }
     $args = array('id' => $this->get_field_id('orderby'), 'name' => $this->get_field_name('orderby'), 'value' => $orderby, 'all_option' => $all_option, 'label' => __('Order by:', 'hocwp-theme'), 'class' => 'orderby');
     hocwp_widget_field('hocwp_field_select', $args);
     $lists = $this->args['orders'];
     $all_option = '';
     foreach ($lists as $lkey => $lvalue) {
         $all_option .= hocwp_field_get_option(array('value' => strtolower($lvalue), 'text' => strtoupper($lvalue), 'selected' => $order));
     }
     $args = array('id' => $this->get_field_id('order'), 'name' => $this->get_field_name('order'), 'value' => $order, 'all_option' => $all_option, 'label' => __('Order:', 'hocwp-theme'), 'class' => 'order');
     hocwp_widget_field('hocwp_field_select', $args);
     $args = array('id_width' => $this->get_field_id('thumbnail_size_width'), 'name_width' => $this->get_field_name('thumbnail_size_width'), 'id_height' => $this->get_field_id('thumbnail_size_height'), 'name_height' => $this->get_field_name('thumbnail_size_height'), 'value' => $thumbnail_size, 'label' => __('Thumbnail size:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_size', $args);
     $lists = $this->args['full_width_items'];
     $all_option = '';
     foreach ($lists as $lkey => $lvalue) {
         $all_option .= hocwp_field_get_option(array('value' => $lkey, 'text' => $lvalue, 'selected' => $full_width_item));
     }
     $args = array('id' => $this->get_field_id('full_width_item'), 'name' => $this->get_field_name('full_width_item'), 'value' => $full_width_item, 'all_option' => $all_option, 'label' => __('Full width items:', 'hocwp-theme'), 'class' => 'full-width-item');
     hocwp_widget_field('hocwp_field_select', $args);
     $args = array('id' => $this->get_field_id('count_format'), 'name' => $this->get_field_name('count_format'), 'value' => $count_format, 'label' => __('Count format:', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input', $args);
     $args = array('id' => $this->get_field_id('hide_thumbnail'), 'name' => $this->get_field_name('hide_thumbnail'), 'value' => $hide_thumbnail, 'label' => __('Hide term thumbnail?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('show_count'), 'name' => $this->get_field_name('show_count'), 'value' => $show_count, 'label' => __('Show count?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('only_thumbnail'), 'name' => $this->get_field_name('only_thumbnail'), 'value' => $only_thumbnail, 'label' => __('Only thumbnail?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('different_name'), 'name' => $this->get_field_name('different_name'), 'value' => $different_name, 'label' => __('Use different term name?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('in_current_post'), 'name' => $this->get_field_name('in_current_post'), 'value' => $in_current_post, 'label' => __('Get term in current post?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('only_parent'), 'name' => $this->get_field_name('only_parent'), 'value' => $only_parent, 'label' => __('Show terms have no parent only?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('child_of_current'), 'name' => $this->get_field_name('child_of_current'), 'value' => $child_of_current, 'label' => __('Get all childs of current term?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('child_of_parent'), 'name' => $this->get_field_name('child_of_parent'), 'value' => $child_of_parent, 'label' => __('Get all childs of parent if current term has no child?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('parent_as_title'), 'name' => $this->get_field_name('parent_as_title'), 'value' => $parent_as_title, 'label' => __('Display parent term as widget title?', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     $args = array('id' => $this->get_field_id('hide_empty'), 'name' => $this->get_field_name('hide_empty'), 'value' => $hide_empty, 'label' => __('Hide term if it doesn\'t have post.', 'hocwp-theme'));
     hocwp_widget_field('hocwp_field_input_checkbox', $args);
     hocwp_field_widget_after();
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:96,代码来源:class-hocwp-widget-term.php


示例19: hocwp_change_nav_menu_css_class

function hocwp_change_nav_menu_css_class($terms, $classes, $item)
{
    if (hocwp_array_has_value($terms)) {
        foreach ($terms as $term) {
            if ($term->term_id == $item->object_id) {
                $classes[] = 'current-menu-item';
                break;
            }
        }
    }
    return $classes;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:12,代码来源:utils.php


示例20: default_field_callback

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP hocwp_get_value_by_key函数代码示例发布时间:2022-05-15
下一篇:
PHP hmmpm函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap