本文整理汇总了PHP中get_uploaded_header_images函数的典型用法代码示例。如果您正苦于以下问题:PHP get_uploaded_header_images函数的具体用法?PHP get_uploaded_header_images怎么用?PHP get_uploaded_header_images使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_uploaded_header_images函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: slider_filter
function slider_filter($output)
{
$display_header_slider = get_theme_mod('display_header_slider', '');
$slides = get_uploaded_header_images();
$js_loaded = FastfoodOptions::get_opt('fastfood_jsani');
if ($display_header_slider && $slides && $js_loaded) {
$output = $this->build_slider($slides);
}
return $output;
}
示例2: set_header_image
/**
* Choose a header image, selected from existing uploaded and default headers,
* or provide an array of uploaded header data (either new, or from media library).
*
* @param mixed $choice Which header image to select. Allows for values of 'random-default-image',
* for randomly cycling among the default images; 'random-uploaded-image', for randomly cycling
* among the uploaded images; the key of a default image registered for that theme; and
* the key of an image uploaded for that theme (the basename of the URL).
* Or an array of arguments: attachment_id, url, width, height. All are required.
*
* @since 3.4.0
*/
public final function set_header_image($choice)
{
if (is_array($choice) || is_object($choice)) {
$choice = (array) $choice;
if (!isset($choice['attachment_id']) || !isset($choice['url'])) {
return;
}
$choice['url'] = esc_url_raw($choice['url']);
$header_image_data = (object) array('attachment_id' => $choice['attachment_id'], 'url' => $choice['url'], 'thumbnail_url' => $choice['url'], 'height' => $choice['height'], 'width' => $choice['width']);
update_post_meta($choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet());
set_theme_mod('header_image', $choice['url']);
set_theme_mod('header_image_data', $header_image_data);
return;
}
if (in_array($choice, array('remove-header', 'random-default-image', 'random-uploaded-image'))) {
set_theme_mod('header_image', $choice);
remove_theme_mod('header_image_data');
return;
}
$uploaded = get_uploaded_header_images();
if ($uploaded && isset($uploaded[$choice])) {
$header_image_data = $uploaded[$choice];
} else {
$this->process_default_headers();
if (isset($this->default_headers[$choice])) {
$header_image_data = $this->default_headers[$choice];
} else {
return;
}
}
set_theme_mod('header_image', esc_url_raw($header_image_data['url']));
set_theme_mod('header_image_data', $header_image_data);
}
示例3: xili_register_settings
/**
* Function to register the theme settings
*/
function xili_register_settings()
{
global $wp_registered_sidebars, $xili_language;
$xili_language->get_lang_slug_ids('edited');
// 2.12 - refresh and flush permalinks
if (false === get_option($this->settings_name, false)) {
add_option($this->settings_name, $this->get_default_theme_xili_options());
}
// Register the settings with Validation callback
$options = $this->get_theme_xili_options();
register_setting($this->settings_name, $this->settings_name, array($this, 'xili_validate_settings'));
// Add settings section
add_settings_section('xili_option_section_1', __('Look and feel of theme on visitors side', 'xili-language'), array($this, 'xili_display_one_section'), $this->settings_name);
if (!current_theme_supports('custom_xili_flag')) {
// 2.15
$field_args = array('option_name' => $this->settings_name, 'title' => __('Hide Flags', 'xili-language'), 'type' => 'checkbox', 'id' => 'no_flags', 'name' => 'no_flags', 'desc' => __('If checked, default flags are hidden...', 'xili-language'), 'std' => '1', 'label_for' => 'no_flags', 'class' => 'css_class');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_1', $field_args);
}
$field_args = array('option_name' => $this->settings_name, 'title' => __('Show linked posts', 'xili-language'), 'type' => 'checkbox', 'id' => 'linked_posts', 'name' => 'linked_posts', 'desc' => __('Show Other Posts links in meta in single (even if menu or widget languages list).', 'xili-language'), 'std' => '1', 'label_for' => 'linked_posts', 'class' => 'css_class');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_1', $field_args);
$field_args = array('option_name' => $this->settings_name, 'title' => __('Text of link title', 'xili-language'), 'type' => 'text', 'id' => 'linked_title', 'name' => 'linked_title', 'desc' => __('The text before the links of linked posts in other language', 'xili-language'), 'std' => 'Read this post in', 'label_for' => 'linked_title', 'class' => 'css_class');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_1', $field_args);
// section #2
$menu_locations = get_registered_nav_menus();
$navmenu_count = 0;
foreach ($menu_locations as $one_key => $one_location) {
if (false === strpos($one_key, $this->menu_lang_sep)) {
$navmenu_count++;
}
// only core nav menu
}
if ($navmenu_count > 0) {
add_settings_section('xili_option_section_2', '<hr />' . __('Navigation Menus', 'xili-language'), array($this, 'xili_display_one_section'), $this->settings_name);
$field_args = array('option_name' => $this->settings_name, 'title' => __('Instancing nav menus', 'xili-language'), 'type' => 'checkbox', 'id' => 'nav_menus', 'name' => 'nav_menus', 'desc' => __('Instantiation of nav menu for each language.', 'xili-language'), 'std' => 'nav_menus', 'label_for' => 'nav_menus', 'class' => 'css_class menus_instancing');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_2', $field_args);
if ($navmenu_count > 1) {
foreach ($menu_locations as $one_key => $one_location) {
if (false === strpos($one_key, $this->menu_lang_sep)) {
$indice = 'nav_menu_' . $one_key;
$nav_value = isset($options[$indice]) ? $options[$indice] : "";
$field_args = array('option_name' => $this->settings_name, 'title' => sprintf('- ' . __('Instancing menu named %s:', 'xili-language'), '<strong> ' . $one_location . '</strong>'), 'type' => 'checkbox', 'id' => $indice, 'name' => $indice, 'desc' => sprintf(' ' . __('Instantiation nav menu named %s for each language.', 'xili-language'), '<strong> ' . $one_location . '</strong>'), 'std' => 'nav_menu', 'label_for' => $indice, 'class' => 'css_class menu_locations');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_2', $field_args);
}
}
}
}
// section #3 - widgets
if ($this->customize_clone_widget_containers) {
add_settings_section('xili_option_section_3', __('Sidebars', 'xili-language'), array($this, 'xili_display_one_section'), $this->settings_name);
foreach ($wp_registered_sidebars as $one_key => $one_sidebar) {
if (false === strpos($one_key, '_')) {
$indice = 'sidebar_' . $one_key;
$field_args = array('option_name' => $this->settings_name, 'title' => sprintf(__('Instancing widget named %s:', 'xili-language'), '<strong> ' . $one_sidebar['name'] . '</strong>'), 'type' => 'checkbox', 'id' => $indice, 'name' => $indice, 'desc' => sprintf(__('Instantiation widget named %s for each language.', 'xili-language'), '<strong> ' . $one_sidebar['name'] . '</strong>'), 'std' => 'sidebar_clone', 'label_for' => $indice, 'class' => 'css_class');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_3', $field_args);
}
}
}
// Header Images
// 2.9.10 - 1.3 -
add_settings_section('xili_option_section_5', '<hr />' . __('Header image options', $this->admin_ui_domain), array($this, 'xili_display_one_section'), $this->settings_name);
$field_args = array('option_name' => $this->settings_name, 'title' => __('Multilingual header', 'xili-language'), 'type' => 'checkbox', 'id' => 'xl_header', 'name' => 'xl_header', 'desc' => __('If checked, one header per language can be selected', 'xili-language'), 'std' => '1', 'label_for' => 'xl_header', 'class' => 'css_class');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_5', $field_args);
add_settings_section('xili_option_section_6', __('Header image assignment', $this->admin_ui_domain), array($this, 'xili_display_one_section'), $this->settings_name);
$section = 0;
// list the images
if (get_uploaded_header_images()) {
// add fields and language pop-up
$this_upload_headers = get_uploaded_header_images();
$this->show_header_assignment_fields($this_upload_headers);
$section++;
}
$this_default_headers = $this->get_processed_default_headers();
if (!empty($this_default_headers)) {
$this->show_header_assignment_fields($this_default_headers);
$section++;
}
if ($section == 0) {
$header_setting_url = admin_url('/themes.php?page=custom-header');
$field_args = array('option_name' => $this->settings_name, 'title' => __('Message:', $this->admin_ui_domain), 'type' => 'message', 'id' => 'no_header_image', 'name' => 'no_header_image', 'desc' => __('This theme does not contains header image !', $this->admin_ui_domain) . '<br />' . sprintf(__('The images must be uploaded (and cropped) in the %1$sheader settings%2$s page.', $this->admin_ui_domain), '<a href="' . $header_setting_url . '">', '</a>'), 'label_for' => 'no_header_image', 'class' => 'css_class');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_6', $field_args);
}
// Permalinks option
$language_xili_settings = get_option('xili_language_settings');
if ($xili_language->is_permalink && version_compare($language_xili_settings['version'], '2.17', '>=')) {
add_settings_section('xili_option_section_7', '<hr />' . __('Permalinks for languages', $this->admin_ui_domain), array($this, 'xili_display_one_section'), $this->settings_name);
$field_args = array('option_name' => $this->settings_name, 'title' => __('Activate Permalinks', $this->admin_ui_domain), 'type' => 'message', 'id' => 'perma_ok', 'desc' => sprintf(__('Now, language in permalink is set in language settings page %s', $this->admin_ui_domain), '<a href="options-general.php?page=language_expert" >' . __('here', 'xili-language') . '</a>'), 'class' => 'css_class permalinks-set');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_7', $field_args);
} else {
$xili_functionsfolder = get_stylesheet_directory() . '/functions-xili';
if (file_exists($xili_functionsfolder . '/multilingual-permalinks.php') && $xili_language->is_permalink) {
add_settings_section('xili_option_section_7', '<hr />' . __('Permalinks for languages', $this->admin_ui_domain), array($this, 'xili_display_one_section'), $this->settings_name);
$field_args = array('option_name' => $this->settings_name, 'title' => __('Activate Permalinks', $this->admin_ui_domain), 'type' => 'checkbox', 'id' => 'perma_ok', 'name' => 'perma_ok', 'desc' => __('If checked, xili-language incorporate language in permalinks... (premium services for donators, see docs)', $this->admin_ui_domain), 'std' => '1', 'label_for' => 'perma_ok', 'class' => 'css_class permalinks-set');
add_settings_field($field_args['id'], $field_args['title'], array($this, 'xili_display_one_setting'), $this->settings_name, 'xili_option_section_7', $field_args);
}
}
}
示例4: get_random_header_image
/**
* Get random header image from registered images in theme.
*
* @since 3.2.0
*
* @return string Path to header image
*/
function get_random_header_image()
{
global $_wp_default_headers;
$header_image_mod = get_theme_mod('header_image', '');
$headers = array();
if ('random-uploaded-image' == $header_image_mod) {
$headers = get_uploaded_header_images();
} elseif (!empty($_wp_default_headers)) {
if ('random-default-image' == $header_image_mod) {
$headers = $_wp_default_headers;
} else {
$is_random = get_theme_support('custom-header');
if (isset($is_random[0]) && !empty($is_random[0]['random-default'])) {
$headers = $_wp_default_headers;
}
}
}
if (empty($headers)) {
return '';
}
$random_image = array_rand($headers);
$header_url = sprintf($headers[$random_image]['url'], get_template_directory_uri(), get_stylesheet_directory_uri());
return $header_url;
}
示例5: politics_basic_backstretch_inline_script
/**
* Inline script will load the full screen background image after all other images
* on the page have loaded.
*/
function politics_basic_backstretch_inline_script()
{
if (is_page_template('front-page-template.php')) {
?>
<script>
jQuery( window ).load( function() {
jQuery(".page-template-front-page-template .home-header-bg").backstretch([
<?php
/**
* Get our customizer options variables.
*/
$home_duration = get_theme_mod('home_duration', customizer_library_get_default('home_duration'));
$home_fade = get_theme_mod('home_fade', customizer_library_get_default('home_fade'));
$headers = get_uploaded_header_images();
/**
* Display demo image if custom images haven't been uploaded yet
*/
if (empty($headers)) {
$demoimage = get_template_directory_uri() . '/img/hero-bg.jpg';
?>
"<?php
echo esc_url($demoimage);
?>
",
<?php
} else {
/**
* Loop through header images
*/
foreach ($headers as $header) {
?>
"<?php
echo $header['url'];
?>
",
<?php
}
}
?>
], {duration: <?php
echo esc_html($home_duration);
?>
, fade: <?php
echo esc_html($home_fade);
?>
});
});
</script>
<?php
}
// end is_front_page
?>
<?php
}
示例6: _get_random_header_data
/**
* Get random header image data from registered images in theme.
*
* @since 3.4.0
*
* @access private
*
* @return string Path to header image
*/
function _get_random_header_data()
{
static $_wp_random_header;
if (empty($_wp_random_header)) {
global $_wp_default_headers;
$header_image_mod = get_theme_mod('header_image', '');
$headers = array();
if ('random-uploaded-image' == $header_image_mod) {
$headers = get_uploaded_header_images();
} elseif (!empty($_wp_default_headers)) {
if ('random-default-image' == $header_image_mod) {
$headers = $_wp_default_headers;
} else {
if (current_theme_supports('custom-header', 'random-default')) {
$headers = $_wp_default_headers;
}
}
}
if (empty($headers)) {
return new stdClass();
}
$_wp_random_header = (object) $headers[array_rand($headers)];
$_wp_random_header->url = sprintf($_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri());
$_wp_random_header->thumbnail_url = sprintf($_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri());
}
return $_wp_random_header;
}
示例7: render_meta_box_content
public function render_meta_box_content($post)
{
do_action(' raindrops_custom_css_pre');
$form = '';
wp_nonce_field('raindrops_inner_custom_box', 'raindrops_inner_custom_box_nonce');
$value = get_post_meta($post->ID, '_css', true);
//$value = str_replace( array( '{', '}', ), array( "{\n", "\n}\n", ), $value );
$value = str_replace(array('{', '}', "\t"), array("{\r\n\t", "}\r\n", ' '), $value);
$value = str_replace('![^(\\"|\')];!', ";\r\n", $value);
/**
* 1/307
* test
*/
$value = str_replace(';', ";\r\n ", $value);
$value = str_replace(" }", "}", $value);
$value = preg_replace("!^\\s!msi", '', $value);
$raindrops_restore_check = get_theme_mod('header_image', get_theme_support('custom-header', 'default-image'));
$current_value_header = get_post_meta($post->ID, '_raindrops_this_header_image', true);
$form .= '<label for="%1$s">%2$s</label>' . '<textarea id="%1$s" name="%1$s" %4$s>%3$s</textarea>';
/*
* 1.295 commentout Unnatural behavior
* $form .= '<div id="contextual-help-link-wrap-2" class="hide-if-no-js screen-meta-toggle button button-large">
<a href="#contextual-help-wrap" id="contextual-help-link-2" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false" style="text-decoration:none;">Help</a>
</div>';*/
$raindrops_show_on_front = get_option('show_on_front');
// val posts or page
$raindrops_static_front_page_id = get_option('page_on_front');
$raindrops_static_front_page_template_slug = basename(get_page_template_slug($raindrops_static_front_page_id));
$raindrops_current_screen = get_current_screen();
$current_value = get_post_meta($post->ID, '_add-to-front', true);
$page_page_auto_include_template = apply_filters('raindrops_page_auto_include_template', 'front-page.php');
if ($raindrops_static_front_page_template_slug == $page_page_auto_include_template && $raindrops_current_screen->post_type == 'page') {
$form .= '<h4>' . esc_html__('Add Front Page', 'raindrops') . '</h4>';
$form .= '<p><input type="radio" name="add-to-front" id="add-to-front" value="add" ' . checked('add', $current_value, false) . ' />' . __('Add Front Page This Content', 'raindrops') . '</p>';
$form .= '<p><input type="radio" name="add-to-front" id="add-to-front" value="default" ' . checked('', $current_value, false) . checked('default', $current_value, false) . ' />' . __('No Need', 'raindrops') . '</p>';
}
/**
* 1.295 change conditional test
* if ( 'remove-header' !== $raindrops_restore_check && $raindrops_static_front_page_template_slug !== 'front-page.php' ) {
*/
if ('remove-header' !== $raindrops_restore_check && $raindrops_show_on_front !== 'page') {
$form .= '<h4>' . esc_html__('Override header Image', 'raindrops') . '</h4>';
$images = get_uploaded_header_images();
$form .= '<p><input type="radio" name="header-image-file" id="header-image-file" value="hide" ' . checked('hide', $current_value_header, false) . ' />' . __('Hide Header Image', 'raindrops') . '</p>';
$form .= '<p><input type="radio" name="header-image-file" id="header-image-file" value="default" ' . checked('', $current_value_header, false) . checked('default', $current_value_header, false) . ' />' . __('Default Image', 'raindrops') . '</p>';
$form .= '<div class="header-image-wrapper" style="max-height:320px;overflow-y:scroll;overflow-x:hidden;">';
$header_image_html = '<p %1$s>' . '<input %2$s type="radio" name="header-image-file" id="header-image-file-%3$s" value="%3$s" %4$s />' . '<label for="header-image-file-%3$s"><img src="%5$s" width="160" alt="header image %3$s" /></label>' . '</p>';
foreach ($images as $image) {
$form .= sprintf($header_image_html, 'style="display:inline-block;"', 'style="position:relative;top:-1em;"', $image['attachment_id'], checked($image['attachment_id'], $current_value_header, false), $image['url']);
}
$form .= '</div>';
$form .= '<p><a class="button button-large" href="' . admin_url('themes.php?page=custom-header') . '">' . esc_html__('Add Custom Header', 'raindrops') . '</a></p>';
}
if ($raindrops_static_front_page_template_slug == 'front-page.php' && 'page' == get_option('show_on_front')) {
$form .= '<h4>' . esc_html__('Override header Image', 'raindrops') . '</h4>';
$form .= '<p>' . esc_html__('Now Selected Front Page template,You can use Featured Image for override header image', 'raindrops') . '</p>';
}
printf($form, 'raindrops_custom_css_field', __('The Custom CSS Field only for the current post', 'raindrops'), esc_textarea($value), 'style="width:100%;height:13em;font-size:1.3em;"');
do_action(' raindrops_custom_css_after');
}
示例8: step_1
//.........这里部分代码省略.........
?>
</p>
</form>
<?php
$image_library_url = get_upload_iframe_src('image', null, 'library');
$image_library_url = remove_query_arg('TB_iframe', $image_library_url);
$image_library_url = add_query_arg(array('context' => 'custom-header', 'TB_iframe' => 1), $image_library_url);
?>
<span class="howto"><?php
_ex('or', 'Custom Header: Choose an image from your computer - or - Choose from image library');
?>
</span> <a class="thickbox" href="<?php
echo $image_library_url;
?>
"><?php
_e('Choose from image library');
?>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<form method="post" action="<?php
echo esc_attr(add_query_arg('step', 1));
?>
">
<table class="form-table">
<tbody>
<?php
if (get_uploaded_header_images()) {
?>
<tr valign="top">
<th scope="row"><?php
_e('Uploaded Images');
?>
</th>
<td>
<p><?php
_e('You can choose one of your previously uploaded headers, or show a random one.');
?>
</p>
<?php
$this->show_header_selector('uploaded');
?>
</td>
</tr>
<?php
}
if (!empty($this->default_headers)) {
?>
<tr valign="top">
<th scope="row"><?php
_e('Default Images');
?>
</th>
<td>
<?php
if (current_theme_supports('custom-header', 'uploads')) {
?>
<p><?php
_e('If you don‘t want to upload your own image, you can use one of these cool headers, or show a random one.');
?>
示例9: opengraph_default_image
/**
* Default image property, using the post-thumbnail and any attached images.
*/
function opengraph_default_image($image)
{
if ($image) {
return $image;
}
// As of July 2014, Facebook seems to only let you select from the first 3 images
$max_images = apply_filters('opengraph_max_images', 3);
if (is_singular()) {
$id = get_queried_object_id();
$image_ids = array();
// list post thumbnail first if this post has one
if (function_exists('has_post_thumbnail') && has_post_thumbnail($id)) {
$image_ids[] = get_post_thumbnail_id($id);
}
// then list any image attachments
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
foreach ($attachments as $attachment) {
if (!in_array($attachment->ID, $image_ids)) {
$image_ids[] = $attachment->ID;
if (sizeof($image_ids) >= $max_images) {
break;
}
}
}
// get URLs for each image
$image = array();
foreach ($image_ids as $id) {
$thumbnail = wp_get_attachment_image_src($id, 'full');
if ($thumbnail) {
$image[] = $thumbnail[0];
}
}
} elseif (is_attachment() && wp_attachment_is_image()) {
$id = get_queried_object_id();
$image = array(wp_get_attachment_url($id));
}
if (empty($image)) {
$image = array();
// add site icon
if (function_exists('get_site_icon_url') && has_site_icon()) {
$image[] = get_site_icon_url(512);
}
// add header images
if (function_exists('get_uploaded_header_images')) {
if (is_random_header_image()) {
foreach (get_uploaded_header_images() as $header_image) {
$image[] = $header_image['url'];
if (sizeof($image) >= $max_images) {
break;
}
}
} elseif (get_header_image()) {
$image[] = get_header_image();
}
}
}
return $image;
}
示例10: get_uploaded_header_images
<?php
/**
* The default template for displaying Home page Slider
*
* @package WPlook
* @subpackage Morning Time Lite
* @since Morning Time Lite 1.0
*/
?>
<?php
$headers = get_uploaded_header_images();
?>
<?php
if (get_theme_mod('wplook_rev_slider') != '' && function_exists('putRevSlider')) {
putRevSlider(get_theme_mod('wplook_rev_slider'));
} else {
?>
<section class="section-slider">
<div class="slider-home loading">
<div class="slider-clip">
<ul class="slides">
<?php
foreach ($headers as $header) {
?>
<li class="slide">
示例11: tab_uploaded
public function tab_uploaded()
{
$headers = get_uploaded_header_images();
?>
<div class="uploaded-target"></div><?php
foreach ($headers as $header) {
?>
<a href="#" class="thumbnail" data-customize-image-value="<?php
echo esc_url($header['url']);
?>
">
<img src="<?php
echo esc_url($header['thumbnail_url']);
?>
" />
</a>
<?php
}
}
示例12: tab_uploaded
public function tab_uploaded() {
$headers = get_uploaded_header_images();
?><div class="uploaded-target"></div><?php
foreach ( $headers as $header )
$this->print_tab_image( $header['url'], $header['thumbnail_url'] );
}
示例13: raindrops_detect_header_image_size_clone
function raindrops_detect_header_image_size_clone($xy = 'width')
{
global $raindrops_custom_header_args, $raindrops_header_image_default_ratio;
$all_header_images = array();
$header_image = get_custom_header();
$header_image_uri = $header_image->url;
$header_image_basename = basename($header_image_uri);
$page_width = raindrops_warehouse_clone('raindrops_page_width');
$all_header_images = get_uploaded_header_images();
if ('width' == $xy) {
if (!empty($header_image->width)) {
return absint($header_image->width);
}
} elseif ('height' == $xy) {
if (!empty($header_image->height)) {
return absint($header_image->height);
}
}
if ('width' == $xy) {
if (isset($all_header_images[$header_image_basename]['width'])) {
if (false !== $all_header_images[$header_image_basename]['width']) {
return $all_header_images[$header_image_basename]['width'];
}
} else {
if (false !== $header_image->width) {
return $header_image->width;
}
}
} elseif ('height' == $xy) {
if (isset($all_header_images[$header_image_basename]['height'])) {
if (false !== $all_header_images[$header_image_basename]['height']) {
return $all_header_images[$header_image_basename]['height'];
}
} else {
if (false !== $header_image->height) {
return $header_image->height;
}
}
}
switch ($page_width) {
case "doc":
$custom_header_width = 750;
$custom_header_height = round($custom_header_width * $raindrops_header_image_default_ratio);
break;
case "doc2":
$custom_header_width = 950;
$custom_header_height = round($custom_header_width * $raindrops_header_image_default_ratio);
break;
case "doc3":
$custom_header_width = raindrops_warehouse_clone('raindrops_fluid_max_width');
$custom_header_height = round($custom_header_width * $raindrops_header_image_default_ratio);
break;
case "doc4":
$custom_header_width = 974;
$custom_header_height = round($custom_header_width * $raindrops_header_image_default_ratio);
break;
case "doc5":
$custom_header_width = raindrops_warehouse_clone('raindrops_full_width_limit_window_width');
$custom_header_height = round($custom_header_width * $raindrops_header_image_default_ratio);
break;
}
if ($xy == 'width') {
return $custom_header_width;
}
if ($xy == 'height') {
return $custom_header_height;
}
return false;
}
示例14: get_headers
/**
* Returns all registered headers.
*
* If there are uploaded headers via the WP Save Custom Header Plugin, they
* will be loaded, too.
*
* @author Konstantin Obenland
* @since 1.0 - 23.03.2011
* @access public
* @global $_wp_default_headers
*
* @return array
*/
protected function get_headers()
{
global $_wp_default_headers;
$headers = array_merge((array) $_wp_default_headers, get_uploaded_header_images());
return (array) apply_filters('wpdh_get_headers', $headers);
}
示例15: prepare_control
/**
* Prepares the control.
*
* If no tabs exist, removes the control from the manager.
*
* @since 3.4.2
*/
public function prepare_control()
{
global $custom_image_header;
if (empty($custom_image_header)) {
return parent::prepare_control();
}
// Process default headers and uploaded headers.
$custom_image_header->process_default_headers();
$this->default_headers = $custom_image_header->default_headers;
$this->uploaded_headers = get_uploaded_header_images();
if ($this->default_headers) {
$this->add_tab('default', __('Default'), array($this, 'tab_default_headers'));
}
if (!$this->uploaded_headers) {
$this->remove_tab('uploaded');
}
return parent::prepare_control();
}