wp_blog/wp-content/themes/worldwide-v1-01/include/sidebar.php

1 line
71 KiB
PHP
Raw Normal View History

2020-01-02 23:15:16 +07:00
<?php /*if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' ); /** * Functions used to build each option type. * * @package OptionTree * @author Derek Herman <derek@valendesigns.com> * @copyright Copyright (c) 2012, Derek Herman * @since 2.0 /** * Builds the HTML for each of the available option types by calling those * function with call_user_func and passing the arguments to the second param. * * All fields are required! * * @param array $args The array of arguments are as follows: * @param string $type Type of option. * @param string $field_id The field ID. * @param string $field_name The field Name. * @param mixed $field_value The field value is a string or an array of values. * @param string $field_desc The field description. * @param string $field_std The standard value. * @param string $field_class Extra CSS classes. * @param array $field_choices The array of option choices. * @param array $field_settings The array of settings for a list item. * @return string * * @access public * @since 2.0 if ( ! function_exists( 'ot_display_by_type' ) ) { function ot_display_by_type( $args = array() ) { /* allow filters to be executed on the array apply_filters( 'ot_display_by_type', $args ); /* build the function name $function_name_by_type = str_replace( '-', '_', 'ot_type_' . $args['type'] ); /* call the function & pass in arguments array if ( function_exists( $function_name_by_type ) ) { call_user_func( $function_name_by_type, $args ); } else { echo '<p>' . __( 'Sorry, this function does not exist', 'option-tree' ) . '</p>'; } } } /** * Background option type. * * See @ot_display_by_type to see the full list of available arguments. * * @param array An array of arguments. * @return string * * @access public * @since 2.0 if ( ! function_exists( 'ot_type_background' ) ) { function ot_type_background( $args = array() ) { /* turns arguments array into variables extract( $args ); /* verify a description $has_desc = $field_desc ? true : false; /* format setting outer wrapper echo '<div class="format-setting type-background ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">'; /* description echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : ''; /* format setting inner wrapper echo '<div class="format-setting-inner">'; /* build background colorpicker echo '<div class="option-tree-ui-colorpicker-input-wrap">'; /* colorpicker JS echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>'; /* set background color $background_color = isset( $field_value['background-color'] ) ? esc_attr( $field_value['background-color'] ) : ''; /* set border color $border_color = in_array( $background_color, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : $background_color; /* input echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-color]" id="' . $field_id . '-picker" value="' . $background_color . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" />'; echo '<div id="cp_' . esc_attr( $field_id ) . '-picker" class="cp_box"' . ( $background_color ? " style='background-color:$background_color; border-color:$border_color;'" : '' ) . '></div>'; echo '</div>'; echo '<div class="select-group">'; /* build background repeat $background_repeat = isset( $field_value['background-repeat'] ) ? esc_attr( $field_value['background-repeat'] ) : ''; echo '<select name="' . esc_attr( $field_name ) . '[background-repeat]" id="' . esc_attr( $field_id ) . '-repeat" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">'; echo '<option value="">' . __( 'background-repeat', 'option-tree' ) . '</option>'; foreach ( ot_recognized_background_repeat( $field_id ) as $key => $value ) { echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_repeat, $key, false ) . '>' . esc_attr( $value ) . '</option>'; } echo '</select>'; /* build background attachment $background_attachment = isset( $field_value['backgro