本文整理汇总了PHP中theme_get_array_value函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_get_array_value函数的具体用法?PHP theme_get_array_value怎么用?PHP theme_get_array_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme_get_array_value函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: theme_widget_extra_control
function theme_widget_extra_control()
{
global $wp_registered_widget_controls, $theme_widgets_style, $theme_widget_meta_options;
$_theme_widget_meta_options = $theme_widget_meta_options;
$params = func_get_args();
$widget_id = $params[count($params) - 1];
$widget_controls = theme_get_array_value($wp_registered_widget_controls, $widget_id, array());
if (isset($widget_controls['callback_redirect'])) {
$callback = $widget_controls['callback_redirect'];
if (is_callable($callback)) {
call_user_func_array($callback, $params);
}
}
if (!preg_match('/^(.*[^-])-([0-9]+)$/', $widget_id, $matches) || !isset($matches[1]) || !isset($matches[2])) {
return false;
}
$id = $matches[1] . '-' . $params[0]['number'];
?>
<h3 style="margin-bottom:3px;"><?php
_e('Theme Options', THEME_NS);
?>
</h3>
<?php
theme_print_meta_box($id, $_theme_widget_meta_options);
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:26,代码来源:widgets.php
示例2: theme_widget_extra_control
function theme_widget_extra_control()
{
global $wp_registered_widget_controls, $theme_widgets_style;
$params = func_get_args();
$id = $params[count($params) - 1];
$id_disp = 'widget-style';
$val = theme_get_widget_style($id);
$widget_controls = theme_get_array_value($wp_registered_widget_controls, $id, array());
if (isset($widget_controls['callback_redirect'])) {
$callback = $widget_controls['callback_redirect'];
if (is_callable($callback)) {
call_user_func_array($callback, $params);
}
}
?>
<h3 style="margin-bottom:3px;"><?php
_e('Theme Options', THEME_NS);
?>
</h3>
<p>
<label for="<?php
echo $id_disp;
?>
"><?php
echo __('Appearance', THEME_NS) . ':';
?>
</label><br />
<select class="widefat" id="<?php
echo $id_disp;
?>
" name="<?php
echo $id_disp;
?>
">
<?php
foreach ($theme_widgets_style as $key => $option) {
$selected = $val == $key ? ' selected="selected"' : '';
echo '<option' . $selected . ' value="' . $key . '">' . $option . '</option>';
}
?>
</select>
</p>
<?php
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:45,代码来源:widgets.php
示例3: theme_get_excerpt
function theme_get_excerpt($args = array())
{
global $post;
$more_tag = theme_get_array_value($args, 'more_tag', __('Continue reading <span class="meta-nav">→</span>', THEME_NS));
$auto = theme_get_array_value($args, 'auto', theme_get_option('theme_metadata_excerpt_auto'));
$all_words = theme_get_array_value($args, 'all_words', theme_get_option('theme_metadata_excerpt_words'));
$min_remainder = theme_get_array_value($args, 'min_remainder', theme_get_option('theme_metadata_excerpt_min_remainder'));
$allowed_tags = theme_get_array_value($args, 'allowed_tags', theme_get_option('theme_metadata_excerpt_use_tag_filter') ? explode(',', str_replace(' ', '', theme_get_option('theme_metadata_excerpt_allowed_tags'))) : null);
$perma_link = get_permalink($post->ID);
$more_token = '%%theme_more%%';
$show_more_tag = false;
$tag_disbalance = false;
if (function_exists('post_password_required') && post_password_required($post)) {
return get_the_excerpt();
}
if ($auto && has_excerpt($post->ID)) {
$excerpt = get_the_excerpt();
$show_more_tag = mb_strlen($post->post_content) > 0;
} else {
$excerpt = get_the_content($more_token);
// hack for badly written plugins
ob_start();
echo apply_filters('get_the_excerpt', $excerpt);
$excerpt = ob_get_clean();
ob_start();
echo apply_filters('the_excerpt', $excerpt);
$excerpt = ob_get_clean();
if (theme_is_empty_html($excerpt)) {
return $excerpt;
}
if ($allowed_tags !== null) {
$allowed_tags = '<' . implode('><', $allowed_tags) . '>';
$excerpt = strip_tags($excerpt, $allowed_tags);
}
$excerpt = strip_shortcodes($excerpt);
if (strpos($excerpt, $more_token) !== false) {
$excerpt = str_replace($more_token, $more_tag, $excerpt);
} elseif ($auto && is_numeric($all_words)) {
$token = "%theme_tag_token%";
$content_parts = explode($token, str_replace(array('<', '>'), array($token . '<', '>' . $token), $excerpt));
$content = array();
$word_count = 0;
foreach ($content_parts as $part) {
if (strpos($part, '<') !== false || strpos($part, '>') !== false) {
$content[] = array('type' => 'tag', 'content' => $part);
} else {
$all_chunks = preg_split('/([\\s])/u', $part, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($all_chunks as $chunk) {
if ('' != trim($chunk)) {
$content[] = array('type' => 'word', 'content' => $chunk);
$word_count += 1;
} elseif ($chunk != '') {
$content[] = array('type' => 'space', 'content' => $chunk);
}
}
}
}
if ($all_words < $word_count && $all_words + $min_remainder <= $word_count) {
$show_more_tag = true;
$tag_disbalance = true;
$current_count = 0;
$excerpt = '';
foreach ($content as $node) {
if ($node['type'] == 'word') {
$current_count++;
}
$excerpt .= $node['content'];
if ($current_count == $all_words) {
break;
}
}
$excerpt .= '…';
// ...
}
}
}
if ($show_more_tag) {
$excerpt = $excerpt . ' <a class="more-link" href="' . $perma_link . '">' . $more_tag . '</a>';
}
if ($tag_disbalance) {
$excerpt = force_balance_tags($excerpt);
}
return $excerpt;
}
开发者ID:bexandy,项目名称:ninacleaning,代码行数:84,代码来源:functions.php
示例4: theme_dependent_widget_field_scripts
function theme_dependent_widget_field_scripts()
{
global $theme_widget_meta_options;
?>
<script>
function makeDependentField(masters, slave) {
var $ = jQuery, master_value;
var context = $('script').last().parents('form');
masters = parseMastersOption(masters);
$('form').each(function(){
switchDependentField.call($(this).children()[0]);
});
$('body').ajaxComplete(function() {
$('form').each(function(){
switchDependentField.call($(this).children()[0]);
});
});
function switchDependentField() {
var context = $(this).parents('form');
var slave_element = $('#' + slave, context).parents('p.meta-options');
for (var i = 0; i < masters.length; i++) {
var master = $(masters[i].element, context);
if (!(masters[i].values && $.inArray(master.val(), masters[i].values) !== -1 || master.attr('checked'))) {
slave_element.hide();
return;
}
}
slave_element.show();
}
function parseMastersOption(masters) {
masters = $.map(masters.split(';'), function (el) {
el = el.split(':');
el[0] = '#' + el[0];
$(el[0]).live('click', switchDependentField);
if (el[1]) {
el[1] = el[1].split(',');
}
return {element: el[0], values: el[1]};
});
return masters;
}
}
</script>
<?php
echo "<script>" . PHP_EOL;
echo "jQuery(function() {" . PHP_EOL;
foreach ($theme_widget_meta_options as $op) {
$id = theme_get_array_value($op, 'id');
$depend = theme_get_array_value($op, 'depend');
if ($depend) {
echo "makeDependentField('{$depend}', '{$id}');" . PHP_EOL;
}
}
echo "});" . PHP_EOL;
echo "</script>" . PHP_EOL;
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:56,代码来源:admins.php
示例5: get_start
function get_start($level)
{
$class = theme_get_array_value($this->attr, 'class', '');
/*jordi-ini: crear menu collapse amb bootstrap */
$toggle_collapse = strstr($class, 'parent_menu') ? 'onclick="return false;" data-toggle="collapse" data-target=".menu-item-' . $this->id . ' > ul"' : '';
/*jordi-fi*/
$class = 'menu-item-' . $this->id . (strlen($class) > 0 ? ' ' : '') . $class;
$this->attr['class'] = $this->active ? 'active' : null;
$title = strip_tags(apply_filters('the_title', $this->title, $this->id));
if (theme_get_option('theme_menu_trim_title')) {
$title = theme_trim_long_str($title, theme_get_option($level == 0 ? 'theme_menu_trim_len' : 'theme_submenu_trim_len'));
}
return str_repeat("\t", $level + 1) . '<li' . theme_prepare_attr(array('class' => $class)) . '>' . '<a' . theme_prepare_attr($this->attr) . $toggle_collapse . '>' . $title . '</a>' . "\n";
}
开发者ID:JordiCruells,项目名称:mwt,代码行数:14,代码来源:navigation.php
示例6: theme_print_widget
function theme_print_widget($widget)
{
if (!is_array($widget)) {
return false;
}
$widget_name = theme_get_array_value($widget, 'name', '');
if ($widget_name) {
echo theme_get_widget_meta_option($widget_name, 'theme_widget_styling');
theme_wrapper(theme_get_array_value($widget, 'style', 'block'), $widget);
} else {
echo $widget['content'];
}
return true;
}
开发者ID:Wickwood-LLC,项目名称:trlf-artisteer,代码行数:14,代码来源:sidebars.php
示例7: do_shortcode
</div>
<?php
}
}
if ($needLayout) {
?>
</div>
</div>
<?php
}
}
?>
<div class="cleantheme-footer-text">
<?php
global $theme_default_options;
echo do_shortcode(theme_get_option('theme_override_default_footer_content') ? theme_get_option('theme_footer_content') : theme_get_array_value($theme_default_options, 'theme_footer_content'));
} else {
?>
<div class="cleantheme-footer-text">
<p>Copyright © 2011, Clean Restaurant. All Rights Reserved.</p>
<?php
}
?>
<p class="cleantheme-page-footer">
<span id="cleantheme-footnote-links">Powered by <a href="http://wordpress.org/" target="_blank">WordPress</a> and WordPress Theme created by Vuthy.</span>
<span id="cleantheme-licence-links">Images by Flickr/winkyintheuk</span>
</p>
</div>
开发者ID:epiii,项目名称:Clean-Wordpress-theme,代码行数:31,代码来源:sidebar-footer.php
示例8: theme_get_pages
function theme_get_pages($pages)
{
if (is_admin()) {
return $pages;
}
$excluded_option = get_option('theme_show_in_menu');
if (!$excluded_option || !is_array($excluded_option)) {
return $pages;
}
$excluded_ids = array();
foreach ($excluded_option as $id => $show) {
if (!$show) {
$excluded_ids[] = $id;
}
}
$excluded_parent_ids = array();
foreach ($pages as $page) {
$title = theme_get_meta_option($page->ID, 'theme_title_in_menu');
if ($title) {
$page->post_title = $title;
}
if (in_array($page->ID, $excluded_ids)) {
$excluded_parent_ids[$page->ID] = $page->post_parent;
}
}
$length = count($pages);
for ($i = 0; $i < $length; $i++) {
$page =& $pages[$i];
if (in_array($page->post_parent, $excluded_ids)) {
$page->post_parent = theme_get_array_value($excluded_parent_ids, $page->post_parent, $page->post_parent);
}
if (in_array($page->ID, $excluded_ids)) {
unset($pages[$i]);
}
}
if (!is_array($pages)) {
$pages = (array) $pages;
}
$pages = array_values($pages);
return $pages;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:41,代码来源:navigation.php
示例9: get_start
function get_start($level)
{
$class = theme_get_array_value($this->attr, 'class', '');
$class = 'menu-item-' . $this->id . (strlen($class) > 0 ? ' ' : '') . $class;
$this->attr['class'] = $this->active ? 'active' : null;
$title = apply_filters('the_title', $this->title, $this->id);
if (theme_get_option('theme_menu_trim_title')) {
$title = theme_trim_long_str(strip_tags($title), theme_get_option($level == 0 ? 'theme_menu_trim_len' : 'theme_submenu_trim_len'));
}
return str_repeat("\t", $level + 1) . '<li' . theme_prepare_attr(array('class' => $class)) . '>' . '<a' . theme_prepare_attr($this->attr) . '>' . $title . '</a>' . "\n";
}
开发者ID:spadwen,项目名称:shop.bentleigh-discount-lolly.com.au,代码行数:11,代码来源:navigation.php
示例10: theme_save_post
function theme_save_post($post_id)
{
global $theme_post_meta_options, $theme_page_meta_options;
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if (!isset($_POST['theme_meta_noncename']) || !wp_verify_nonce($_POST['theme_meta_noncename'], 'theme_meta_options')) {
return $post_id;
}
// verify if this is an auto save routine. If it is our form has not been submitted, so we dont want
// to do anything
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
$meta_options = null;
//posts
if ('page' == $_POST['post_type']) {
// Check permissions
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
$meta_options = $theme_page_meta_options;
}
if ('post' == $_POST['post_type']) {
$meta_options = $theme_post_meta_options;
}
if (!$meta_options) {
return $post_id;
}
// OK, we're authenticated: we need to find and save the data
foreach ($meta_options as $value) {
$id = theme_get_array_value($value, 'id');
$val = stripslashes(theme_get_array_value($_REQUEST, $id));
$type = theme_get_array_value($value, 'type');
$necessary = theme_get_array_value($value, 'necessary');
if ($necessary && !current_user_can($necessary)) {
continue;
}
switch ($type) {
case 'checkbox':
$val = $val ? 1 : 0;
break;
case 'numeric':
$val = (int) $val;
break;
}
theme_set_meta_option($post_id, $id, $val);
}
return $post_id;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:49,代码来源:admins.php
示例11: theme_widget_extra_control
function theme_widget_extra_control()
{
global $wp_registered_widget_controls, $theme_widgets_style, $theme_widget_meta_options;
$_theme_widget_meta_options = $theme_widget_meta_options;
$params = func_get_args();
$widget_id = $params[count($params) - 1];
// see theme_widget_expand_control func
$widget_controls = theme_get_array_value($wp_registered_widget_controls, $widget_id, array());
if (isset($widget_controls['callback_redirect'])) {
$callback = $widget_controls['callback_redirect'];
if (is_callable($callback)) {
call_user_func_array($callback, $params);
}
}
if (!preg_match('/^(.*[^-])-([0-9]+)$/', $widget_id, $matches) || !isset($matches[1]) || !isset($matches[2])) {
return false;
}
$id = $matches[1] . '-' . $params[0]['number'];
if (theme_is_vmenu_widget($id)) {
$need_delete = false;
foreach ($_theme_widget_meta_options as $option_id => $option) {
if ($option['id'] == 'theme_widget_styles') {
$need_delete = true;
break;
}
}
if ($need_delete) {
unset($_theme_widget_meta_options[$option_id]);
}
}
?>
<h3 style="margin-bottom:3px;"><?php
_e('Theme Options', THEME_NS);
?>
</h3>
<?php
theme_print_meta_box($id, $_theme_widget_meta_options);
}
开发者ID:Wickwood-LLC,项目名称:trlf-artisteer,代码行数:38,代码来源:widgets.php
注:本文中的theme_get_array_value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论