/**
  * 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";
 }
Example #2
1
 /**
  * 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;
 }
    /** 
     *	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 
    }
 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;
 }
 /**
  * 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();
 }
Example #6
0
    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 
    }
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);
}
Example #8
0
 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;
 }
 /**
  * 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>';
 }
 /**
  * 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();
 }
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;
}
 /**
  * __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'));
 }
 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;
 }
Example #14
0
 /**
  * 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;
 }
Example #15
0
/**
 * 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);
        }
    }
}
 /**
  * Displays the widget admin form
  *
  * @since 6.0
  * @access public
  */
 function form($instance)
 {
     $defaults = array('default_action' => 'login', 'logged_in_widget' => 1, 'show_title' => 1, 'show_log_link' => 1, 'show_reg_link' => 1, 'show_pass_link' => 1, 'show_gravatar' => 1, 'gravatar_size' => 50, 'register_widget' => 1, 'lostpassword_widget' => 1);
     $instance = wp_parse_args($instance, $defaults);
     $actions = array('login' => __('Login', 'theme-my-login'), 'register' => __('Register', 'theme-my-login'), 'lostpassword' => __('Lost Password', 'theme-my-login'));
     echo '<p>' . __('Default Action', 'theme-my-login') . '<br /><select name="' . $this->get_field_name('default_action') . '" id="' . $this->get_field_id('default_action') . '">';
     foreach ($actions as $action => $title) {
         $is_selected = $instance['default_action'] == $action ? ' selected="selected"' : '';
         echo '<option value="' . $action . '"' . $is_selected . '>' . $title . '</option>';
     }
     echo '</select></p>' . "\n";
     $is_checked = empty($instance['logged_in_widget']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('logged_in_widget') . '" type="checkbox" id="' . $this->get_field_id('logged_in_widget') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('logged_in_widget') . '">' . __('Show When Logged In', 'theme-my-login') . '</label></p>' . "\n";
     $is_checked = empty($instance['show_title']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('show_title') . '" type="checkbox" id="' . $this->get_field_id('show_title') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_title') . '">' . __('Show Title', 'theme-my-login') . '</label></p>' . "\n";
     $is_checked = empty($instance['show_log_link']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('show_log_link') . '" type="checkbox" id="' . $this->get_field_id('show_log_link') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_log_link') . '">' . __('Show Login Link', 'theme-my-login') . '</label></p>' . "\n";
     $is_checked = empty($instance['show_reg_link']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('show_reg_link') . '" type="checkbox" id="' . $this->get_field_id('show_reg_link') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_reg_link') . '">' . __('Show Register Link', 'theme-my-login') . '</label></p>' . "\n";
     $is_checked = empty($instance['show_pass_link']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('show_pass_link') . '" type="checkbox" id="' . $this->get_field_id('show_pass_link') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_pass_link') . '">' . __('Show Lost Password Link', 'theme-my-login') . '</label></p>' . "\n";
     $is_checked = empty($instance['show_gravatar']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('show_gravatar') . '" type="checkbox" id="' . $this->get_field_id('show_gravatar') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('show_gravatar') . '">' . __('Show Gravatar', 'theme-my-login') . '</label></p>' . "\n";
     echo '<p>' . __('Gravatar Size', 'theme-my-login') . ': <input name="' . $this->get_field_name('gravatar_size') . '" type="text" id="' . $this->get_field_id('gravatar_size') . '" value="' . $instance['gravatar_size'] . '" size="3" /> <label for="' . $this->get_field_id('gravatar_size') . '"></label></p>' . "\n";
     $is_checked = empty($instance['register_widget']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('register_widget') . '" type="checkbox" id="' . $this->get_field_id('register_widget') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('register_widget') . '">' . __('Allow Registration', 'theme-my-login') . '</label></p>' . "\n";
     $is_checked = empty($instance['lostpassword_widget']) ? '' : 'checked="checked" ';
     echo '<p><input name="' . $this->get_field_name('lostpassword_widget') . '" type="checkbox" id="' . $this->get_field_id('lostpassword_widget') . '" value="1" ' . $is_checked . '/> <label for="' . $this->get_field_id('lostpassword_widget') . '">' . __('Allow Password Recovery', 'theme-my-login') . '</label></p>' . "\n";
 }
Example #17
0
 /**
  * Field Render Function.
  *
  * Takes the vars and outputs the HTML for the field in the settings
  *
  * @since       1.0.0
  * @access      public
  * @return      void
  */
 public function render()
 {
     echo '</fieldset></td></tr><tr><td colspan="2"><fieldset class="redux-field redux-container-custom_font">';
     $nonce = wp_create_nonce("redux_{$this->parent->args['opt_name']}_custom_fonts");
     // No errors please
     $defaults = array('id' => '', 'url' => '', 'width' => '', 'height' => '', 'thumbnail' => '');
     $this->value = wp_parse_args($this->value, $defaults);
     $this->field['custom_fonts'] = apply_filters("redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array());
     if (!empty($this->field['custom_fonts'])) {
         foreach ($this->field['custom_fonts'] as $section => $fonts) {
             if (empty($fonts)) {
                 continue;
             }
             echo '<h3>' . $section . '</h3>';
             echo '<table class="wp-list-table widefat plugins" cellspacing="0"><tbody>';
             foreach ($fonts as $font => $pieces) {
                 echo '<tr class="active">';
                 echo '<td class="plugin-title" style="min-width: 40%"><strong>' . $font . '</strong></td>';
                 echo '<td class="column-description desc"><div class="plugin-description">';
                 if (!empty($pieces)) {
                     foreach ($pieces as $piece) {
                         echo "<span class=\"button button-primary button-small font-pieces\">{$piece}</span> ";
                     }
                 }
                 echo '</div></td><td style="width: 140px;"><div class="action-row visible"><span style="display:none;"><a href="#" class="rename">Rename</a> | </span><a href="#" class="fontDelete delete" data-section="' . $section . '" data-name="' . $font . '" data-type="delete">Delete</a><span class="spinner" style="display: none;"></span></div></td></tr>';
             }
             echo '</tbody></table>';
             echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . $nonce . '" id="' . $this->field['id'] . '-custom_fonts">' . __('Add Font', 'redux-framework') . '</span></div><br />';
         }
     } else {
         echo "<h3>" . __('No Custom Fonts Found', 'redux-framework') . "</h3>";
         echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . $nonce . '" id="' . $this->field['id'] . '-custom_fonts">' . __('Add Font', 'redux-framework') . '</span></div>';
     }
     echo '</fieldset></td></tr>';
 }
Example #18
0
 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field = wp_parse_args($field, array('prefix' => '', 'suffix' => '', 'std' => '', 'js_options' => array()));
     $field['js_options'] = wp_parse_args($field['js_options'], array('range' => 'min', 'value' => $field['std']));
     return $field;
 }
Example #19
0
 /**
  * Update theme modifications for the current theme.
  * Note: Candidate core function.
  * http://core.trac.wordpress.org/ticket/20091
  *
  * @since 3.4.0
  *
  * @param array $mods Theme modifications.
  */
 public function set_theme_mods($mods)
 {
     $current = get_theme_mods();
     $mods = wp_parse_args($mods, $current);
     $theme = get_stylesheet();
     update_option("theme_mods_{$theme}", $mods);
 }
 function ci_the_post_thumbnail_full($args = array())
 {
     $args = wp_parse_args((array) $args, array('class' => '', 'noalign' => false));
     $attr = array();
     if (ci_setting('featured_full_use_full') == 'full') {
         $attr['class'] = $args['class'];
         //			if($args['noalign'] === false)
         //			{
         //				$attr['class'] .= ' '.ci_setting('featured_single_align').' ';
         //			}
         if (empty($attr['class'])) {
             unset($attr['class']);
         }
         the_post_thumbnail('ci_featured_full', $attr);
     }
     if (ci_setting('featured_full_use_full') == 'single') {
         $attr['class'] = $args['class'];
         if ($args['noalign'] === false) {
             $attr['class'] .= ' ' . ci_setting('featured_single_align') . ' ';
         }
         if (empty($attr['class'])) {
             unset($attr['class']);
         }
         the_post_thumbnail('ci_featured_single', $attr);
     }
     if (ci_setting('featured_full_use_full') == 'disabled') {
         // Do nothing
     }
 }
 static function render($list, $args = array())
 {
     if (empty($list->items)) {
         return '';
     }
     $args = wp_parse_args($args, array('before_list' => '<ul>', 'after_list' => '</ul>', 'before_item' => '<li>', 'after_item' => '</li>', 'separator' => false, 'echo' => true));
     if ($args['separator']) {
         if ('<ul>' == $args['before_list']) {
             $args['before_list'] = '';
         }
         if ('</ul>' == $args['after_list']) {
             $args['after_list'] = '';
         }
     }
     if (!$args['echo']) {
         ob_start();
     }
     echo $args['before_list'];
     if ($args['separator']) {
         $rendered = array();
         foreach ($list->items as $item) {
             $rendered[] = self::render_item($item);
         }
         echo implode($args['separator'], $rendered);
     } else {
         foreach ($list->items as $item) {
             echo $args['before_item'] . self::render_item($item) . $args['after_item'];
         }
     }
     echo $args['after_list'];
     if (!$args['echo']) {
         return ob_get_clean();
     }
 }
 /**
  * Constructor.
  *
  * @since 4.1.0
  * @since 4.2.0 Moved from WP_Customize_Upload_Control.
  *
  * @param WP_Customize_Manager $manager Customizer bootstrap instance.
  * @param string               $id      Control ID.
  * @param array                $args    Optional. Arguments to override class property defaults.
  */
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (!$this instanceof WP_Customize_Image_Control) {
         $this->button_labels = wp_parse_args($this->button_labels, array('select' => __('Select File'), 'change' => __('Change File'), 'default' => __('Default'), 'remove' => __('Remove'), 'placeholder' => __('No file selected'), 'frame_title' => __('Select File'), 'frame_button' => __('Choose File')));
     }
 }
 function form($instance)
 {
     $instance = wp_parse_args((array) $instance, array('sortby' => 'menu_order', 'title' => '', 'exclude' => ''));
     $title = esc_attr($instance['title']);
     $exclude = esc_attr($instance['exclude']);
     include locate_template('templates/widgets/conf/subpages.php');
 }
Example #24
0
function acf_get_valid_options_page($page = '')
{
    // allow for string
    if (empty($page)) {
        $page = array('page_title' => __('Options', 'acf'), 'menu_title' => __('Options', 'acf'), 'menu_slug' => 'acf-options');
    } elseif (is_string($page)) {
        $page_title = $page;
        $page = array('page_title' => $page_title, 'menu_title' => $page_title);
    }
    // defaults
    $page = wp_parse_args($page, array('page_title' => '', 'menu_title' => '', 'menu_slug' => '', 'capability' => 'edit_posts', 'parent_slug' => '', 'position' => false, 'icon_url' => false, 'redirect' => true, 'post_id' => 'options', 'autoload' => false, 'update_button' => __('Update', 'acf')));
    // ACF4 compatibility
    $migrate = array('title' => 'page_title', 'menu' => 'menu_title', 'slug' => 'menu_slug', 'parent' => 'parent_slug');
    foreach ($migrate as $old => $new) {
        if (!empty($page[$old])) {
            $page[$new] = acf_extract_var($page, $old);
        }
    }
    // page_title (allows user to define page with just page_title or title)
    if (empty($page['menu_title'])) {
        $page['menu_title'] = $page['page_title'];
    }
    // menu_slug
    if (empty($page['menu_slug'])) {
        $page['menu_slug'] = 'acf-options-' . sanitize_title($page['menu_title']);
    }
    // return
    return $page;
}
 /**
  * Display or return HTML-formatted team.
  *
  * @since  1.0.0
  * @param  string|array $args Arguments.
  * @return string
  */
 public function the_mailer($args = '')
 {
     /**
      * Filter the array of default arguments.
      *
      * @since 1.0.0
      * @param array Default arguments.
      * @param array The 'the_team' function argument.
      */
     $defaults = apply_filters('cherry_the_team_default_args', array('button_text' => __('Subscribe', 'cherry-mailer'), 'placeholder' => __('enter your email', 'cherry-mailer'), 'success_message' => __('Successfully', 'cherry-mailer'), 'fail_message' => __('Failed', 'cherry-mailer'), 'warning_message' => __('Warning', 'cherry-mailer'), 'is_popup' => __('true', 'cherry-mailer'), 'template' => 'default.tmpl', 'col_xs' => '12', 'col_sm' => '6', 'col_md' => '3', 'col_lg' => 'none', 'class' => ''), $args);
     $args = wp_parse_args($args, $defaults);
     $output = '';
     // The Display.
     if ('true' == $args['popup_is']) {
         // if popup
         $output .= '<a class="subscribe-popup-link" href="#cherry-mailer-form">';
         $output .= $args['button_text'];
         $output .= '</a>';
         $output .= '<div class="cherry-mailer-container">';
     }
     $output .= '<form id="cherry-mailer-form">';
     $output .= '<input type="hidden" name="action" value="mailersubscribe">';
     $output .= $this->get_mailer_loop($args);
     $output .= '</form>';
     if ('true' == $args['popup_is']) {
         // if popup
         $output .= '</div>';
     }
     return $output;
 }
Example #26
0
 public function display($args)
 {
     extract(wp_parse_args($args, array('content' => '', 'id' => 'dwqa-custom-content-editor', 'textarea_name' => 'custom-content', 'rows' => 5, 'wpautop' => false, 'media_buttons' => false)));
     $dwqa_tinymce_css = apply_filters('dwqa_editor_style', DWQA_URI . 'assets/css/tinymce.css');
     $toolbar1 = apply_filters('dwqa_tinymce_toolbar1', 'bold,italic,underline,|,' . 'bullist,numlist,blockquote,|,' . 'link,unlink,|,' . 'image,code,|,' . 'spellchecker,fullscreen,dwqaCodeEmbed,|,');
     wp_editor($content, $id, array('wpautop' => $wpautop, 'media_buttons' => $media_buttons, 'textarea_name' => $textarea_name, 'textarea_rows' => $rows, 'tinymce' => array('toolbar1' => $toolbar1, 'toolbar2' => '', 'content_css' => $dwqa_tinymce_css), 'quicktags' => false));
 }
Example #27
0
function hocwp_get_smtp_mail_data()
{
    $defaults = hocwp_smtp_mail_defaults();
    $option = hocwp_get_option('option_smtp_email');
    $result = wp_parse_args($option, $defaults);
    return apply_filters('hocwp_smtp_mail_args', $result);
}
        /**
         * Output the settings update form.
         *
         * @param array $instance Current settings.
         *
         * @return string Default return is 'noform'.
         * @author Andrea Grillo <*****@*****.**>
         */
        public function form($instance)
        {
            $defaults = array('title' => __('Store Location', 'yith_wc_product_vendors'));
            $instance = wp_parse_args((array) $instance, $defaults);
            ?>
            <p>
                <label for="<?php 
            echo $this->get_field_id('title');
            ?>
"><?php 
            _e('Title', 'yith_wc_product_vendors');
            ?>
:
                    <input type="text" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" value="<?php 
            echo $instance['title'];
            ?>
" class="widefat" />
                </label>
            </p>
        <?php 
        }
 /**
  * Replaces certain user and blog variables in $input string
  *
  * @since 6.0
  * @access public
  *
  * @param string $input The input string
  * @param int $user_id User ID to replace user specific variables
  * @param array $replacements Misc variables => values replacements
  * @return string The $input string with variables replaced
  */
 public static function replace_vars($input, $user_id = '', $replacements = array())
 {
     $defaults = array('%site_url%' => get_bloginfo('url'), '%user_ip%' => $_SERVER['REMOTE_ADDR']);
     $replacements = wp_parse_args($replacements, $defaults);
     // Get user data
     $user = false;
     if ($user_id) {
         $user = get_user_by('id', $user_id);
     }
     // Get all matches ($matches[0] will be '%value%'; $matches[1] will be 'value')
     preg_match_all('/%([a-zA-Z0-9-_]*)%/', $input, $matches);
     // Iterate through matches
     foreach ($matches[0] as $key => $match) {
         if (!isset($replacements[$match])) {
             if ($user && isset($user->{$matches[1][$key]})) {
                 // Replacement from WP_User object
                 $replacements[$match] = $user->{$matches[1][$key]};
             } else {
                 $replacements[$match] = get_bloginfo($matches[1][$key]);
             }
             // Replacement from get_bloginfo()
         }
     }
     // Allow replacements to be filtered
     $replacements = apply_filters('tml_replace_vars', $replacements, $user_id);
     if (empty($replacements)) {
         return $input;
     }
     // Get search values
     $search = array_keys($replacements);
     // Get replacement values
     $replace = array_values($replacements);
     return str_replace($search, $replace, $input);
 }
    function form($instance)
    {
        $defaults = array('text' => '');
        $instance = wp_parse_args($instance, $defaults);
        extract($instance);
        ?>
		
		<p class="description">
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				Link Text
				<?php 
        echo aq_field_input('title', $block_id, $title, $size = 'full');
        ?>
			</label>
		</p>
		
		<p class="description">
			<label for="<?php 
        echo $this->get_field_id('text');
        ?>
">
				Link URL
				<?php 
        echo aq_field_input('text', $block_id, $text, $size = 'full');
        ?>
			</label>
		</p>
		
	<?php 
    }