当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_parse_args函数代码示例

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


在下文中一共展示了wp_parse_args函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form

 /**
  * Render form
  *
  * @since 0.1.0
  *
  * @param Lsx_Properties_Widget $instance Class instance
  */
 function form($instance)
 {
     $instance = wp_parse_args((array) $instance, array('title' => '', 'order' => '', 'limit' => '', 'featured' => false, 'slider' => false));
     $title = strip_tags($instance['title']);
     $limit = strip_tags($instance['limit']);
     $isrand = '';
     if ($instance['order'] == 'rand') {
         $isrand = 'selected="selected"';
     }
     $isrecent = '';
     if ($instance['order'] == 'order_recent') {
         $isrecent = 'selected="selected"';
     }
     echo "<p><label for=\" " . $this->get_field_id('title') . "\">" . __('Title', 'happybeds-properties') . ": <input class=\"widefat\" id=\"" . $this->get_field_id('title') . "\" name=\"" . $this->get_field_name('title') . "\" type=\"text\" value=\"" . esc_attr($title) . "\" /></label></p>\r\n";
     echo "<p><label for=\" " . $this->get_field_id('limit') . "\">" . __('Limit', 'happybeds-properties') . ": <input id=\"" . $this->get_field_id('limit') . "\" name=\"" . $this->get_field_name('limit') . "\" type=\"number\" value=\"" . esc_attr($limit) . "\" /></label></p>\r\n";
     $featured = '';
     if (!empty($instance['featured'])) {
         $featured = 'checked="checked"';
     }
     echo "<p><label for=\"" . $this->get_field_id('featured') . "\">" . __('Show Featured Only', 'happybeds-properties') . ": <input id=\"" . $this->get_field_id('featured') . "\" " . $featured . " type=\"checkbox\" name=\"" . $this->get_field_name('featured') . "\" ></label>\r\n";
     $slider = '';
     if (!empty($instance['slider'])) {
         $slider = 'checked="checked"';
     }
     echo "<p><label for=\" " . $this->get_field_id('order') . "\">" . __('Order', 'happybeds-properties') . ": </label><select style=\"width:100%;\" name=\"" . $this->get_field_name('order') . "\">\r\n";
     echo "<option value=\"\"></option>\r\n";
     echo "<option value=\"rand\" " . $isrand . "\">" . __('Random', 'happybeds-properties') . "</option>\r\n";
     echo "<option value=\"order_recent\" " . $isrecent . ">" . __('Recent', 'happybeds-properties') . "</option>\r\n";
     echo "</select></p>\r\n";
     echo "<p><label for=\"" . $this->get_field_id('slider') . "\">" . __('Show as Slider', 'happybeds-properties') . ": <input id=\"" . $this->get_field_id('slider') . "\" " . $slider . " type=\"checkbox\" name=\"" . $this->get_field_name('slider') . "\" ></label>\r\n";
 }
开发者ID:JustinDMathew,项目名称:lsx-framework,代码行数:38,代码来源:class-widget.php

示例2: normalize_field

 /**
  * Add default value for 'taxonomy' field
  *
  * @param $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $default_args = array('hide_empty' => false);
     // Set default args
     $field['options']['args'] = !isset($field['options']['args']) ? $default_args : wp_parse_args($field['options']['args'], $default_args);
     $tax = get_taxonomy($field['options']['taxonomy']);
     $field['placeholder'] = empty($field['placeholder']) ? sprintf(__('Select a %s', 'framework'), $tax->labels->singular_name) : $field['placeholder'];
     switch ($field['options']['type']) {
         case 'select_advanced':
             $field = RWMB_Select_Advanced_Field::normalize_field($field);
             break;
         case 'checkbox_list':
         case 'checkbox_tree':
             $field = RWMB_Checkbox_List_Field::normalize_field($field);
             break;
         case 'select':
         case 'select_tree':
             $field = RWMB_Select_Field::normalize_field($field);
             break;
         default:
             $field['options']['type'] = 'select';
             $field = RWMB_Select_Field::normalize_field($field);
     }
     if (in_array($field['options']['type'], array('checkbox_tree', 'select_tree'))) {
         if (isset($field['options']['args']['parent'])) {
             $field['options']['parent'] = $field['options']['args']['parent'];
             unset($field['options']['args']['parent']);
         } else {
             $field['options']['parent'] = 0;
         }
     }
     $field['field_name'] = "{$field['id']}[]";
     return $field;
 }
开发者ID:ahmedelhadi,项目名称:TestProject,代码行数:41,代码来源:taxonomy.php

示例3: form

    /** 
     *	Create the necessary form to customize the widget.
     *
     *	@uses		title	@since 0.1
     *
     *	@author		Nate Jacobs
     *	@since		0.1
     *
     *	@param		array
     */
    public function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('title' => __('Brickset Themes', 'bs_api')));
        $title = esc_attr($instance['title']);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'bs_api');
        ?>
:</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
">
		</p>
		<?php 
    }
开发者ID:pedro-mendonca,项目名称:Brickset-API,代码行数:36,代码来源:class-theme-widget.php

示例4: parse_settings

 public static function parse_settings($editor_id, $settings)
 {
     $set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
     self::$this_tinymce = $set['tinymce'] && user_can_richedit();
     self::$this_quicktags = (bool) $set['quicktags'];
     if (self::$this_tinymce) {
         self::$has_tinymce = true;
     }
     if (self::$this_quicktags) {
         self::$has_quicktags = true;
     }
     if (empty($set['editor_height'])) {
         return $set;
     }
     if ('content' === $editor_id) {
         // A cookie (set when a user resizes the editor) overrides the height.
         $cookie = (int) get_user_setting('ed_size');
         // Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
         if (!$cookie && isset($_COOKIE['TinyMCE_content_size'])) {
             parse_str($_COOKIE['TinyMCE_content_size'], $cookie);
             $cookie = $cookie['ch'];
         }
         if ($cookie) {
             $set['editor_height'] = $cookie;
         }
     }
     if ($set['editor_height'] < 50) {
         $set['editor_height'] = 50;
     } elseif ($set['editor_height'] > 5000) {
         $set['editor_height'] = 5000;
     }
     return $set;
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:33,代码来源:class-wp-editor.php

示例5: __construct

 /**
  * Constructor method for the UI_Stepper class.
  *
  * @since  4.0.0
  */
 function __construct($args = array())
 {
     $this->defaults_settings['id'] = 'cherry-ui-stepper-' . uniqid();
     $this->settings = wp_parse_args($args, $this->defaults_settings);
     add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_assets'));
     self::enqueue_assets();
 }
开发者ID:roberto-alarcon,项目名称:Neuroglobal,代码行数:12,代码来源:ui-stepper.php

示例6: form

    function form($instance)
    {
        $defaults = array('title' => '', 'link' => '');
        $instance = wp_parse_args($instance, $defaults);
        extract($instance);
        ?>
		
		<p class="description">
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				Title (optional)
				<?php 
        echo aq_field_input('title', $block_id, $title, $size = 'full');
        ?>
			</label>
		</p>
		
		<p class="description">
			<label for="<?php 
        echo $this->get_field_id('link');
        ?>
">
				Link Download (optional)
				<?php 
        echo aq_field_input('link', $block_id, $link, $size = 'full');
        ?>
			</label>
		</p>
		
		<?php 
    }
开发者ID:egamboa,项目名称:estebangam,代码行数:33,代码来源:st-download-block.php

示例7: mm_ux_log

function mm_ux_log($args = array())
{
    $url = "https://ssl.google-analytics.com/collect";
    global $title;
    if (empty($_SERVER['REQUEST_URI'])) {
        return;
    }
    $path = explode('wp-admin', $_SERVER['REQUEST_URI']);
    if (empty($path) || empty($path[1])) {
        $path = array("", " ");
    }
    $defaults = array('v' => '1', 'tid' => 'UA-39246514-3', 't' => 'pageview', 'cid' => md5(get_option('siteurl')), 'uid' => md5(get_option('siteurl') . get_current_user_id()), 'cn' => 'mojo_wp_plugin', 'cs' => 'mojo_wp_plugin', 'cm' => 'plugin_admin', 'ul' => get_locale(), 'dp' => $path[1], 'sc' => '', 'ua' => @$_SERVER['HTTP_USER_AGENT'], 'dl' => $path[1], 'dh' => get_option('siteurl'), 'dt' => $title, 'ec' => '', 'ea' => '', 'el' => '', 'ev' => '');
    if (isset($_SERVER['REMOTE_ADDR'])) {
        $defaults['uip'] = $_SERVER['REMOTE_ADDR'];
    }
    $params = wp_parse_args($args, $defaults);
    $test = get_transient('mm_test', '');
    if (isset($test['key']) && isset($test['name'])) {
        $params['cm'] = $params['cm'] . "_" . $test['name'] . "_" . $test['key'];
    }
    //use test account for testing
    if (defined('WP_DEBUG') && WP_DEBUG) {
        $params['tid'] = 'UA-19617272-27';
    }
    $z = wp_rand(0, 1000000000);
    $query = http_build_query(array_filter($params));
    $args = array('body' => $query, 'method' => 'POST', 'blocking' => false);
    $url = add_query_arg(array('z' => $z), $url);
    wp_remote_post($url, $args);
}
开发者ID:hyperhy,项目名称:hyperhy,代码行数:30,代码来源:user-experience-tracking.php

示例8: get_valid_layout

 function get_valid_layout($layout = array())
 {
     // parse
     $layout = wp_parse_args($layout, array('key' => uniqid(), 'name' => '', 'label' => '', 'display' => 'block', 'sub_fields' => array(), 'min' => '', 'max' => ''));
     // return
     return $layout;
 }
开发者ID:Aqro,项目名称:NewDWM,代码行数:7,代码来源:flexible-content.php

示例9: render

 /**
  * Field Render Function.
  *
  * Takes the vars and outputs the HTML for the field in the settings
  *
  * @since ReduxFramework 3.0.0
  */
 function render()
 {
     if (empty($this->field['min'])) {
         $this->field['min'] = 0;
     } else {
         $this->field['min'] = intval($this->field['min']);
     }
     if (empty($this->field['max'])) {
         $this->field['max'] = intval($this->field['min']) + 1;
     } else {
         $this->field['max'] = intval($this->field['max']);
     }
     if (empty($this->field['step']) || $this->field['step'] > $this->field['max']) {
         $this->field['step'] = 1;
     } else {
         $this->field['step'] = intval($this->field['step']);
     }
     if (empty($this->value) && !empty($this->field['default']) && intval($this->field['min']) >= 1) {
         $this->value = intval($this->field['default']);
     }
     if (empty($this->value) && intval($this->field['min']) >= 1) {
         $this->value = intval($this->field['min']);
     }
     if (empty($this->value)) {
         $this->value = 0;
     }
     // Extra Validation
     if ($this->value < $this->field['min']) {
         $this->value = intval($this->field['min']);
     } else {
         if ($this->value > $this->field['max']) {
             $this->value = intval($this->field['max']);
         }
     }
     $params = array('id' => '', 'min' => '', 'max' => '', 'step' => '', 'val' => '', 'default' => '');
     $params = wp_parse_args($this->field, $params);
     $params['val'] = $this->value;
     // Don't allow input edit if there's a step
     $readonly = "";
     if (isset($this->field['edit']) && $this->field['edit'] == false) {
         $readonly = ' readonly="readonly"';
     }
     // Use javascript globalization, better than any other method.
     global $wp_scripts;
     $data = $wp_scripts->get_data('redux-field-spinner-js', 'data');
     if (!empty($data)) {
         // Adding to the previous localize script object
         if (!is_array($data)) {
             $data = json_decode(str_replace('var reduxSpinners = ', '', substr($data, 0, -1)), true);
         }
         foreach ($data as $key => $value) {
             $localized_data[$key] = $value;
         }
         $wp_scripts->add_data('redux-field-spinner-js', 'data', '');
     }
     $localized_data[$this->field['id']] = $params;
     wp_localize_script('redux-field-spinner-js', 'reduxSpinners', $localized_data);
     echo '<input type="text" name="' . $this->args['opt_name'] . '[' . $this->field['id'] . ']" id="' . $this->field['id'] . '" value="' . $this->value . '" class="mini spinner-input' . $this->field['class'] . '"' . $readonly . '/>';
     echo '<div id="' . $this->field['id'] . '-spinner" class="redux_spinner" rel="' . $this->field['id'] . '"></div>';
 }
开发者ID:Bitcoinsulting,项目名称:website-ads,代码行数:67,代码来源:field_spinner.php

示例10: __construct

 /**
  * Construct function that set message and default args
  * @param string $msg  
  * @param array $args 
  */
 public function __construct($msg, $args = '')
 {
     $defaults = array('type' => 'error', 'where' => 'header', 'auto_close' => true, 'delay' => '5');
     $this->args = wp_parse_args($args, $defaults);
     $this->msg = $msg;
     $this->run();
 }
开发者ID:Saigesp,项目名称:wp-design-community,代码行数:12,代码来源:class-frontend-box.php

示例11: wpsr_digg

function wpsr_digg($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'type' => 'DiggMedium', 'text' => __('Digg this', 'wpsr'), 'image' => WPSR_PUBLIC_URL . 'buttons/digg-bt.png', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $digg_processed = "\n<!-- Start WP Socializer Plugin - Digg Button -->\n";
    switch ($output) {
        // Display the ordinary button
        case 'button':
            $digg_processed .= '<a class="DiggThisButton ' . $type . '" href="http://digg.com/submit?url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '></a>';
            break;
            // Display the Image format
        // Display the Image format
        case 'image':
            $digg_processed .= '<a href="http://digg.com/submit?url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '><img src="' . $image . '" alt="Digg!"  /></a>';
            break;
            // Display the Text format
        // Display the Text format
        case 'text':
            $digg_processed .= '<a href="http://digg.com/submit?url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '>' . $text . '</a>';
            break;
    }
    $digg_processed .= "\n<!-- End WP Socializer Plugin - Digg Button -->\n";
    return $digg_processed;
}
开发者ID:pankajsinghjarial,项目名称:SYLC-AMERICAN,代码行数:29,代码来源:wpsr-digg.php

示例12: __construct

 /**
  * __construct function.
  * 
  * @access public
  * @return void
  */
 public function __construct($args)
 {
     global $NF_Pushover;
     $defaults = array('parent_slug' => 'options-general.php', 'page_title' => $NF_Pushover->name, 'menu_title' => $NF_Pushover->name, 'capability' => 'manage_options', 'menu_slug' => $NF_Pushover->token, 'default_tab' => isset($NF_Pushover->default_tab) ? $NF_Pushover->default_tab : '', 'screen_icon' => 'options-general');
     $this->args = wp_parse_args($args, $defaults);
     add_action('admin_menu', array($this, 'register_settings_screen'));
 }
开发者ID:emtv,项目名称:hackmsi,代码行数:13,代码来源:class-nf-pushover-settings-screen.php

示例13: woo_enforce_defaults

 function woo_enforce_defaults($instance)
 {
     $defaults = $this->woo_get_settings();
     $instance = wp_parse_args($instance, $defaults);
     if ($instance['limit'] < 1) {
         $instance['limit'] = 1;
     } elseif ($instance['limit'] > 10) {
         $instance['limit'] = 10;
     }
     $instance['width'] = absint($instance['width']);
     if ($instance['width'] < 1) {
         $instance['width'] = $defaults['width'];
     }
     $instance['height'] = absint($instance['height']);
     if ($instance['height'] < 1) {
         $instance['height'] = $defaults['height'];
     }
     if ($instance['sorting'] != 'random') {
         $instance['sorting'] = $defaults['sorting'];
     }
     if (!in_array($instance['size'], array('s', 'm', 't'))) {
         $instance['size'] = $defaults['size'];
     }
     if ($instance['type'] != 'group') {
         $instance['type'] = $defaults['type'];
     }
     return $instance;
 }
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:28,代码来源:widget-woo-flickr.php

示例14: getForm

 /**
  * Returns HTML settings form. Should be a collection of <tr> elements containing two columns.
  *
  * @return string HTML snippet
  */
 function getForm()
 {
     global $wpdb;
     $shipping = wp_parse_args(get_option('flat_rates'), array('southisland' => '', 'northisland' => '', 'continental' => '', 'all' => '', 'local' => '', 'northamerica' => '', 'southamerica' => '', 'asiapacific' => '', 'europe' => '', 'africa' => ''));
     $output = "<tr><td colspan='2'>";
     $output .= "<table>";
     $output .= "<tr><th colspan='2'><strong>" . __('Base Local', 'wp-e-commerce') . "</strong></th></tr>";
     switch (get_option('base_country')) {
         case 'NZ':
             $output .= $this->settings_form_shipping_price_field('southisland', __('South Island', 'wp-e-commerce'), $shipping['southisland']);
             $output .= $this->settings_form_shipping_price_field('northisland', __('North Island', 'wp-e-commerce'), $shipping['northisland']);
             break;
         case 'US':
             $output .= $this->settings_form_shipping_price_field('continental', __('Continental 48 States', 'wp-e-commerce'), $shipping['continental']);
             $output .= $this->settings_form_shipping_price_field('all', __('All 50 States', 'wp-e-commerce'), $shipping['all']);
             break;
         default:
             $output .= $this->settings_form_shipping_price_field('local', __('Domestic', 'wp-e-commerce'), $shipping['local']);
             break;
     }
     $output .= "<tr><th colspan='2'><strong>" . __('Base International', 'wp-e-commerce') . "</strong></th></tr>";
     $output .= $this->settings_form_shipping_price_field('northamerica', __('North America', 'wp-e-commerce'), $shipping['northamerica']);
     $output .= $this->settings_form_shipping_price_field('southamerica', __('South America', 'wp-e-commerce'), $shipping['southamerica']);
     $output .= $this->settings_form_shipping_price_field('asiapacific', __('Asia and Pacific', 'wp-e-commerce'), $shipping['asiapacific']);
     $output .= $this->settings_form_shipping_price_field('europe', __('Europe', 'wp-e-commerce'), $shipping['europe']);
     $output .= $this->settings_form_shipping_price_field('africa', __('Africa', 'wp-e-commerce'), $shipping['africa']);
     $output .= "</table>";
     $output .= "<br /><p class='description'>" . __('If you do not wish to ship to a particular region, leave the field blank. To offer free shipping to a region, enter 0.', 'wp-e-commerce') . "</p>";
     $output .= "</td></tr>";
     return $output;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:36,代码来源:flatrate.php

示例15: hybrid_register_sidebars

/**
 * Registers the default framework dynamic sidebars based on the sidebars the theme has added support 
 * for using add_theme_support().
 *
 * @since 0.7.0
 * @access private
 * @uses register_sidebar() Registers a sidebar with WordPress.
 * @link http://codex.wordpress.org/Function_Reference/register_sidebar
 * @return void
 */
function hybrid_register_sidebars()
{
    /* Get the theme-supported sidebars. */
    $supported_sidebars = get_theme_support('hybrid-core-sidebars');
    /* If the theme doesn't add support for any sidebars, return. */
    if (!is_array($supported_sidebars[0])) {
        return;
    }
    /* Get the available core framework sidebars. */
    $core_sidebars = hybrid_get_sidebars();
    /* Loop through the supported sidebars. */
    foreach ($supported_sidebars[0] as $sidebar) {
        /* Make sure the given sidebar is one of the core sidebars. */
        if (isset($core_sidebars[$sidebar])) {
            /* Set up some default sidebar arguments. */
            $defaults = array('before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-wrap widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>');
            /* Allow developers to filter the default sidebar arguments. */
            $defaults = apply_filters(hybrid_get_prefix() . '_sidebar_defaults', $defaults, $sidebar);
            /* Parse the sidebar arguments and defaults. */
            $args = wp_parse_args($core_sidebars[$sidebar], $defaults);
            /* If no 'id' was given, use the $sidebar variable and sanitize it. */
            $args['id'] = isset($args['id']) ? sanitize_key($args['id']) : sanitize_key($sidebar);
            /* Allow developers to filter the sidebar arguments. */
            $args = apply_filters(hybrid_get_prefix() . '_sidebar_args', $args, $sidebar);
            /* Register the sidebar. */
            register_sidebar($args);
        }
    }
}
开发者ID:jacko5,项目名称:bjj,代码行数:39,代码来源:sidebars.php


注:本文中的wp_parse_args函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。