本文整理汇总了PHP中hocwp_get_value_by_key函数的典型用法代码示例。如果您正苦于以下问题:PHP hocwp_get_value_by_key函数的具体用法?PHP hocwp_get_value_by_key怎么用?PHP hocwp_get_value_by_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hocwp_get_value_by_key函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
public function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = strip_tags(hocwp_get_value_by_key($new_instance, 'title'));
$instance['category'] = hocwp_get_value_by_key($new_instance, 'category', json_encode($this->args['category']));
return $instance;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:7,代码来源:class-hocwp-widget-link.php
示例2: hocwp_force_admin_english
function hocwp_force_admin_english()
{
$args = hocwp_option_utilities();
$force_admin_english = (bool) hocwp_get_value_by_key($args, 'force_admin_english');
$force_admin_english = apply_filters('hocwp_force_admin_english', $force_admin_english);
return $force_admin_english;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:7,代码来源:setting-utilities.php
示例3: update
public function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = strip_tags(hocwp_get_value_by_key($new_instance, 'title'));
$instance['order'] = hocwp_get_value_by_key($new_instance, 'order', hocwp_get_value_by_key($this->args, 'order'));
$instance['description'] = hocwp_get_value_by_key($new_instance, 'description');
return $instance;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:8,代码来源:class-hocwp-widget-social.php
示例4: 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
示例5: 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
示例6: update
public function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = strip_tags(hocwp_get_value_by_key($new_instance, 'title'));
$instance['banner_image'] = hocwp_get_value_by_key($new_instance, 'banner_image');
$instance['banner_url'] = hocwp_get_value_by_key($new_instance, 'banner_url');
$instance['nofollow'] = hocwp_checkbox_post_data_value($new_instance, 'nofollow');
return $instance;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:9,代码来源:class-hocwp-widget-banner.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_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
示例9: hocwp_setup_enable_session
function hocwp_setup_enable_session()
{
$options = get_option('hocwp_user_login');
$use_captcha = hocwp_get_value_by_key($options, 'use_captcha');
$options = get_option('hocwp_discussion');
$comment_captcha = hocwp_get_value_by_key($options, 'captcha');
if ((bool) $use_captcha || (bool) $comment_captcha) {
add_filter('hocwp_use_session', '__return_true');
}
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:10,代码来源:setup.php
示例10: get_taxonomy_base
public function get_taxonomy_base($taxonomy = null)
{
if (empty($taxonomy)) {
$taxonomy = $this->taxonomy;
}
$base_slug = '';
if (taxonomy_exists($taxonomy)) {
$taxonomy = get_taxonomy($taxonomy);
$base_slug = hocwp_get_value_by_key($taxonomy->rewrite, 'slug');
}
return $base_slug;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:12,代码来源:class-hocwp-remove-term-base.php
示例11: hocwp_plugin_load_custom_css
function hocwp_plugin_load_custom_css()
{
$option = get_option('hocwp_plugin_custom_css');
$css = hocwp_get_value_by_key($option, 'code');
if (!empty($css)) {
$css = hocwp_minify_css($css);
$style = new HOCWP_HTML('style');
$style->set_attribute('type', 'text/css');
$style->set_text($css);
$style->output();
}
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:12,代码来源:plugin-functions.php
示例12: 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
示例13: hocwp_theme_meta_box_sidebar_information
function hocwp_theme_meta_box_sidebar_information($post_type, $post)
{
if (!hocwp_is_post($post)) {
return;
}
global $pagenow;
if ('hocwp_sidebar' == $post_type) {
$readonly = false;
$post_id = 0;
if ('post.php' == $pagenow) {
$post_id = hocwp_get_value_by_key($_REQUEST, 'post');
$default = (bool) get_post_meta($post_id, 'sidebar_default');
if ($default) {
$readonly = true;
}
}
$post_id = $post->ID;
$meta = new HOCWP_Meta('post');
$meta->set_id('hocwp_sidebar_information');
$meta->set_title(__('Sidebar Information', 'hocwp-theme'));
$meta->add_post_type('hocwp_sidebar');
$field_args = array('id' => 'sidebar_id', 'label' => __('Sidebar ID:', 'hocwp-theme'));
if ($readonly) {
$field_args['readonly'] = true;
}
$meta->add_field($field_args);
$field_args = array('id' => 'sidebar_name', 'label' => __('Sidebar name:', 'hocwp-theme'));
if ($readonly) {
$field_args['readonly'] = true;
}
$meta->add_field($field_args);
$field_args = array('id' => 'sidebar_description', 'label' => __('Sidebar description:', 'hocwp-theme'));
if ($readonly) {
$field_args['readonly'] = true;
}
$meta->add_field($field_args);
$field_args = array('id' => 'sidebar_tag', 'label' => __('Sidebar tag:', 'hocwp-theme'));
if ($readonly) {
$field_args['readonly'] = true;
}
$meta->add_field($field_args);
$meta->init();
}
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:44,代码来源:meta.php
示例14: hocwp_register_string_language
function hocwp_register_string_language($args = array())
{
if (!did_action('init')) {
_doing_it_wrong(__FUNCTION__, __('Please call this function in <strong>hocwp_register_string_translation</strong> hook.', 'hocwp-theme'), HOCWP_VERSION);
return;
}
if (!is_array($args)) {
$args = array('string' => $args);
}
$name = hocwp_get_value_by_key($args, 'name');
$string = hocwp_get_value_by_key($args, 'string');
$context = hocwp_get_value_by_key($args, 'context', 'HocWP');
$multiline = hocwp_get_value_by_key($args, 'multiline');
$key = md5($string);
$active_strings = hocwp_get_active_registered_string_language();
$active_strings[$key]['name'] = $name;
$active_strings[$key]['string'] = $string;
$active_strings[$key]['context'] = $context;
$active_strings[$key]['multiline'] = $multiline;
global $hocwp_active_registered_string_translations;
$hocwp_active_registered_string_translations = $active_strings;
$transient_name = hocwp_build_transient_name('hocwp_string_translation_registered_%s', $args);
if (false === get_transient($transient_name)) {
$strings = hocwp_get_registered_string_language();
$strings[$key]['name'] = $name;
$strings[$key]['string'] = $string;
$strings[$key]['context'] = $context;
$strings[$key]['multiline'] = $multiline;
update_option('hocwp_string_translations', $strings);
$mo = new HOCWP_MO();
$translation = '';
$object = $mo->get_object($string);
if (is_a($object, 'WP_Post')) {
$translation = $object->post_content;
}
$post_id = $mo->export_to_db($string, $translation);
if (hocwp_id_number_valid($post_id)) {
set_transient($transient_name, $post_id, WEEK_IN_SECONDS);
}
}
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:41,代码来源:language.php
示例15: hocwp_get_mailer
function hocwp_get_mailer()
{
$data = hocwp_get_smtp_mail_data();
$mailer = hocwp_get_value_by_key($data, 'mailer');
return apply_filters('hocwp_mailer', $mailer);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:6,代码来源:mail.php
示例16: update
public function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = strip_tags(hocwp_get_value_by_key($new_instance, 'title'));
$instance['page_name'] = hocwp_get_value_by_key($new_instance, 'page_name');
$instance['href'] = hocwp_get_value_by_key($new_instance, 'href');
$instance['width'] = hocwp_get_value_by_key($new_instance, 'width', $this->args['width']);
$instance['height'] = hocwp_get_value_by_key($new_instance, 'height', $this->args['height']);
$instance['button_text'] = hocwp_get_value_by_key($new_instance, 'button_text', $this->args['button_text']);
$instance['position'] = hocwp_get_value_by_key($new_instance, 'position', $this->args['position']);
$instance['hide_cover'] = hocwp_checkbox_post_data_value($new_instance, 'hide_cover');
$instance['show_facepile'] = hocwp_checkbox_post_data_value($new_instance, 'show_facepile');
$instance['hide_cta'] = hocwp_checkbox_post_data_value($new_instance, 'hide_cta');
$instance['small_header'] = hocwp_checkbox_post_data_value($new_instance, 'small_header');
$instance['adapt_container_width'] = hocwp_checkbox_post_data_value($new_instance, 'adapt_container_width');
$instance['fixed'] = hocwp_checkbox_post_data_value($new_instance, 'fixed');
$instance['only_link'] = hocwp_checkbox_post_data_value($new_instance, 'only_link');
return $instance;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:19,代码来源:class-hocwp-widget-facebook-messenger.php
示例17: hocwp_shortcode_support_form_callback
function hocwp_shortcode_support_form_callback($atts = array(), $content = null)
{
$defaults = array('style' => '', 'name' => 'full_name,email,phone,message', 'label' => array(__('Full name', 'hocwp-theme'), __('Email', 'hocwp-theme'), __('Phone', 'hocwp-theme'), __('Message', 'hocwp-theme')), 'type' => 'text,email,text,textarea', 'placehoder' => '', 'captcha' => false, 'admin_email' => hocwp_get_admin_email());
$attributes = shortcode_atts($defaults, $atts);
$name = hocwp_get_value_by_key($attributes, 'name');
$names = explode(',', $name);
if (hocwp_array_has_value($names)) {
$show_form = true;
$label = hocwp_get_value_by_key($attributes, 'label');
if (!is_array($label)) {
$label = explode(',', $label);
$label = array_map('trim', $label);
}
$type = hocwp_get_value_by_key($attributes, 'type');
$type = explode(',', $type);
$type = array_map('trim', $type);
$placeholder = hocwp_get_value_by_key($attributes, 'placeholder');
if (!empty($placeholder)) {
$placeholder = explode(',', $placeholder);
$placeholder = array_map('trim', $placeholder);
}
$captcha = hocwp_get_value_by_key($attributes, 'captcha');
$names = array_map('trim', $names);
$html = hocwp_shortcode_before('support-form', $attributes);
if (isset($_POST['submit'])) {
if (hocwp_check_nonce('hocwp_support_form')) {
if (hocwp_check_captcha()) {
$body = '';
foreach ($names as $index => $name) {
if (empty($name)) {
continue;
}
if ('name' == $name) {
$name = 'full_name';
}
$field_type = isset($type[$index]) ? $type[$index] : 'text';
$field_label = isset($label[$index]) ? $label[$index] : '';
$field_placeholder = isset($placeholder[$index]) ? $placeholder[$index] : '';
$row = isset($_POST[$name]) ? $_POST[$name] : '';
if (!empty($field_label)) {
$last_char = hocwp_get_last_char($field_label);
if (':' != $last_char) {
$field_label .= ':';
}
$row = $field_label . ' ' . $row;
}
if (!empty($row)) {
$body .= wpautop($row);
}
}
if (empty($body)) {
$html .= hocwp_build_message(__('You must fill all required fields.', 'hocwp-theme'), 'danger');
} else {
$full_name = __('Guest', 'hocwp-theme');
if (isset($_POST['full_name'])) {
$full_name = $_POST['full_name'];
}
$subject = sprintf(__('[%1$s] Contact message from %2$s', 'hocwp-theme'), get_bloginfo('name'), $full_name);
$admin_email = hocwp_get_value_by_key($attributes, 'admin_email');
if (!is_email($admin_email)) {
$admin_email = hocwp_get_admin_email();
}
$sent = hocwp_send_html_mail($admin_email, $subject, $body);
if ($sent) {
$show_form = false;
$html .= hocwp_build_message(__('Your message has been sent, we will reply to you as soon as possible.', 'hocwp-theme'), 'success');
} else {
$html .= hocwp_build_message(__('There was an error occurred, please try again or contact administrators.', 'hocwp-theme'), 'danger');
}
}
} else {
$html .= hocwp_build_message(__('Captcha code is not valid.', 'hocwp-theme'), 'danger');
}
}
}
if ($show_form) {
ob_start();
?>
<form class="hocwp-support-form" action="" method="post">
<?php
foreach ($names as $index => $name) {
if (empty($name)) {
continue;
}
if ('name' == $name) {
$name = 'full_name';
}
$field_type = isset($type[$index]) ? $type[$index] : 'text';
$field_label = isset($label[$index]) ? $label[$index] : '';
$field_placeholder = isset($placeholder[$index]) ? $placeholder[$index] : '';
?>
<div class="form-group form-row">
<div class="row">
<div class="col-sm-2">
<label for="<?php
echo esc_attr($name);
?>
"><?php
echo $field_label;
?>
//.........这里部分代码省略.........
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:101,代码来源:shortcode.php
示例18: hocwp_slider_html
function hocwp_slider_html($args = array())
{
if (!is_array($args)) {
$position = $args;
} else {
$position = hocwp_get_value_by_key($args, 'position');
}
$slider = hocwp_get_slider_by_position($position);
if (hocwp_is_post($slider)) {
$items = hocwp_get_post_meta('slider_items', $slider->ID);
$order = hocwp_get_value_by_key($items, 'order');
if (!empty($order)) {
$order = explode(',', $order);
$items = hocwp_get_value_by_key($items, 'items');
$slider_class = 'hocwp-slider';
$thumbs = (bool) hocwp_get_value_by_key($args, 'thumbs', false);
if ($thumbs) {
hocwp_add_string_with_space_before($slider_class, 'thumbs-paging');
}
hocwp_add_string_with_space_before($slider_class, hocwp_sanitize_html_class($position));
$custom_arrow = hocwp_get_value_by_key($args, 'custom_arrow');
if ($custom_arrow) {
$slider_class = hocwp_add_more_class($slider_class, 'custom-arrow');
}
$fit_width = hocwp_get_post_meta('fit_width', $slider->ID);
$fit_width = hocwp_int_to_bool($fit_width);
$height = hocwp_get_post_meta('height', $slider->ID);
if (!hocwp_is_positive_number($height)) {
$height = 350;
}
$atts = array('data-height="' . $height . '"');
if ($fit_width) {
$atts[] = 'data-fit-width="1"';
}
$atts = implode(' ', $atts);
if (!empty($atts)) {
$atts = ' ' . $atts;
$atts = rtrim($atts);
}
echo '<div class="' . $slider_class . '">';
echo '<ul class="list-unstyled list-items slickslide list-inline"' . $atts . '>';
$list_paging = '';
$lazyload = hocwp_get_value_by_key($args, 'lazyload');
foreach ($order as $item_id) {
$item = hocwp_get_value_by_key($items, $item_id);
if (hocwp_array_has_value($item)) {
$title = hocwp_get_value_by_key($item, 'title');
$link = hocwp_get_value_by_key($item, 'link');
$description = hocwp_get_value_by_key($item, 'description');
$image_url = hocwp_get_value_by_key($item, 'image_url');
$image_id = hocwp_get_value_by_key($item, 'image_id');
$image_url = hocwp_return_media_url($image_url, $image_id);
$img = new HOCWP_HTML('img');
$img->set_image_src($image_url);
$img->add_class('slider-image');
$li = new HOCWP_HTML('li');
$li->set_text($img);
$li->add_class('slider-item');
if ($lazyload) {
$li->add_class('lazyload');
$img->set_attribute('data-original', $image_url);
$img->set_image_src(hocwp_get_image_url('transparent.gif'));
}
$list_paging .= $li->build();
if (!empty($link)) {
$a = new HOCWP_HTML('a');
$a->set_href($link);
$a->set_text($img);
$li->set_text($a);
} else {
$li->set_text($img);
}
$li->output();
}
}
echo '</ul>';
if ($thumbs) {
echo '<div class="thumbs-paging slick-thumbs">';
echo '<ul class="list-unstyled list-paging">';
echo $list_paging;
echo '</ul>';
echo '</div>';
}
echo '</div>';
}
}
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:87,代码来源:slider.php
示例19: hocwp_twitter_follow_button
function hocwp_twitter_follow_button($args = array())
{
$username = hocwp_get_value_by_key($args, 'username');
if (empty($username)) {
$username = hocwp_get_value_by_key($args, 'account');
}
$permalink = hocwp_get_value_by_key($args, 'permalink');
if (empty($permalink)) {
$permalink = $username;
}
if (!empty($permalink) && !hocwp_is_url($permalink)) {
$permalink = 'https://twitter.com/' . $permalink;
}
if (empty($permalink)) {
$permalink = hocwp_get_option_by_name('hocwp_option_social', 'twitter_site');
}
if (empty($permalink)) {
return;
}
$show_screen_name = hocwp_get_value_by_key($args, 'show_screen_name');
$show_count = hocwp_get_value_by_key($args, 'show_count');
$show_count = hocwp_bool_to_string($show_count);
if (empty($username)) {
$username = hocwp_get_last_part_in_url($permalink);
}
if (!empty($username)) {
$first_char = hocwp_get_first_char($username);
if ('@' != $first_char) {
$username = '@' . $username;
}
}
$text = __('Follow', 'hocwp-theme');
if ($show_screen_name) {
$username = $text . ' ' . $username;
} else {
$username = $text;
}
$username = trim($username);
$size = hocwp_get_value_by_key($args, 'size');
$show_screen_name = hocwp_bool_to_string($show_screen_name);
?>
<a data-show-screen-name="<?php
echo $show_screen_name;
?>
" data-size="<?php
echo $size;
?>
"
href="<?php
echo esc_url($permalink);
?>
" class="twitter-follow-button"
data-show-count="<?php
echo $show_count;
?>
"><?php
echo $username;
?>
</a>
<script type="text/javascript">
window.twttr = (function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function (f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
</script>
<?php
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:79,代码来源:utils.php
示例20: 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
注:本文中的hocwp_get_value_by_key函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论