Esempio n. 1
0
/**
 * Helper function to remove all custom theme mods
 *
 * @since 2.0.0
 * @param string
 * @return mixed $default
 */
function hoot_remove_theme_mods()
{
    $hoot_customizer = Hoot_Customizer::get_instance();
    $settings = $hoot_customizer->get_options('settings');
    if (!empty($settings) && is_array($settings)) {
        foreach ($settings as $id => $setting) {
            remove_theme_mod($id);
        }
    }
}
Esempio n. 2
0
/**
 * Add Content to Customizer Panel Footer
 *
 * @since 2.0.0
 * @return void
 */
function hoot_customizer_premium()
{
    /** Load Premium Features Data **/
    include_once trailingslashit(HOOT_THEMEDIR) . 'admin/premium.php';
    /** Get Premium URL **/
    $hoot_customizer = Hoot_Customizer::get_instance();
    $infobuttons = $hoot_customizer->get_infobuttons();
    $premium_url = 'http://wphoot.com/';
    foreach ($infobuttons as $key => $button) {
        if (isset($button['type']) && $button['type'] == 'premium') {
            $premium_url = esc_url($button['url']);
        }
    }
    $demo_url = empty($demo_url) ? $premium_url : $demo_url;
    ?>
	<div id="hoot-flypremium" class="hoot-flypanel">
		<div class="hoot-flypanel-header hoot-flypanel-nav">
			<div class="primary-actions">
				<span class="hoot-flypanel-back" tabindex="-1"><span class="screen-reader-text"><?php 
    _e('Back', 'chromatic');
    ?>
</span></span>
				<a class="button button-primary" href="<?php 
    echo $premium_url;
    ?>
" target="_blank"><i class="fa fa-star"></i> <?php 
    _e('Buy Now', 'chromatic');
    ?>
</a>
			</div>
		</div>
		<div id="hoot-flypremium-content" class="hoot-flypanel-content">
			<?php 
    if (!empty($hoot_options_premium) && is_array($hoot_options_premium)) {
        foreach ($hoot_options_premium as $key => $feature) {
            ?>
					<div class="section-premium-info">
					<?php 
            if (!empty($feature['desc'])) {
                ?>
						<div class="premium-info">
							<div class="premium-info-text">
								<?php 
                if (!empty($feature['name'])) {
                    ?>
									<h4 class="heading"><?php 
                    echo $feature['name'];
                    ?>
</h4>
								<?php 
                }
                ?>
								<?php 
                echo $feature['desc'];
                ?>
							</div>
							<?php 
                if (!empty($feature['img'])) {
                    ?>
								<div class="premium-info-img">
									<img src="<?php 
                    echo esc_url($feature['img']);
                    ?>
" />
								</div>
							<?php 
                }
                ?>
							<div class="clear"></div>
						</div>
					<?php 
            } elseif (!empty($feature['name'])) {
                ?>
						<h4 class="heading"><?php 
                echo $feature['name'];
                ?>
</h4>
					<?php 
            }
            ?>
					<?php 
            if (!empty($feature['std'])) {
                echo $feature['std'];
            }
            ?>
					</div>
				<?php 
        }
    }
    ?>
		</div>
		<div class="hoot-flypanel-footer hoot-flypanel-nav">
			<div class="primary-actions">
				<a class="button button-primary" href="<?php 
    echo $demo_url;
    ?>
" target="_blank"><i class="fa fa-eye"></i> <?php 
    _e('Theme Demo', 'chromatic');
    ?>
</a>
			</div>
		</div>
	</div><!-- .hoot-flypanel -->
	<?php 
}
Esempio n. 3
0
/**
 * Sanitize sortlist value.
 *
 * @since 2.0.0
 * @param string $value The unsanitized string.
 * @param mixed $setting The setting for which the sanitizing is occurring.
 * @return string The sanitized value.
 */
function hoot_customizer_sanitize_sortlist($value, $setting)
{
    parse_str($value, $valuearray);
    if (!empty($valuearray) && is_array($valuearray)) {
        $return = array();
        $id = array_keys($valuearray);
        $id = current($id);
        // use $id instead of reset( $id ) : reset returns false if empty, only 1 element, so we good to go
        // Get Choice Options if exist
        if (is_object($setting)) {
            $setting = $setting->id;
        }
        $hoot_customizer = Hoot_Customizer::get_instance();
        $settings = $hoot_customizer->get_options('settings');
        $choices = isset($settings[$setting]['choices']) ? $settings[$setting]['choices'] : array();
        $options = isset($settings[$setting]['options']) ? $settings[$setting]['options'] : array();
        // Build return array
        foreach ($valuearray[$id] as $choiceid => $choicevalues) {
            // Sanitize choice name
            if (!empty($choices[$choiceid])) {
                // Sanitize choice values: hidden
                $return[$id][$choiceid]['sortitem_hide'] = isset($choicevalues['sortitem_hide']) ? $choicevalues['sortitem_hide'] : 0;
                // Sanitize choice values: options
                if (!empty($options[$choiceid])) {
                    foreach ($options[$choiceid] as $optionid => $optionarray) {
                        if (!empty($optionarray['type'])) {
                            switch ($optionarray['type']) {
                                case 'text':
                                case 'textarea':
                                    global $allowedtags;
                                    $return[$id][$choiceid][$optionid] = isset($choicevalues[$optionid]) ? wp_kses($choicevalues[$optionid], $allowedtags) : '';
                                    break;
                                case 'checkbox':
                                    $return[$id][$choiceid][$optionid] = !empty($choicevalues[$optionid]) ? 1 : 0;
                                    break;
                                case 'select':
                                    $return[$id][$choiceid][$optionid] = !array_key_exists($choicevalues[$optionid], $optionarray['choices']) ? $choicevalues[$optionid] : $choicevalues[$optionid];
                                    break;
                            }
                        }
                    }
                }
            }
        }
        // Same as jquery.serialize ( though it also converts entities. example: & to &amp; )
        // If using JSON.stringify, use json_encode instead
        return http_build_query($return);
    } else {
        return '';
    }
}
 function hoot_theme_add_customizer_options()
 {
     $hoot_customizer = Hoot_Customizer::get_instance();
     // Add Options
     $options = hoot_theme_customizer_options();
     $hoot_customizer->add_options(array('settings' => $options['settings'], 'sections' => $options['sections'], 'panels' => $options['panels']));
     // Add Inforbuttons
     $hoot_customizer->add_infobuttons(array('demo' => array('text' => __('Demo', 'responsive-brix'), 'url' => 'http://demo.wphoot.com/responsive-brix/', 'icon' => 'fa fa-eye'), 'docs' => array('text' => __('Documentation &amp; Support', 'responsive-brix'), 'url' => 'http://help.wphoot.com/support/solutions', 'icon' => 'fa fa-support'), 'rate' => array('text' => __('If you like this theme, support our work by giving it a 5<i class="fa fa-star"></i> rating on wordpress.org :)', 'responsive-brix'), 'url' => 'https://wordpress.org/support/view/theme-reviews/responsive-brix#postform', 'icon' => 'fa fa-star')));
     // Add Premium Infobutton
     $hoot_customizer->add_infobuttons(array('premium' => array('text' => __('Premium', 'responsive-brix'), 'type' => 'premium', 'url' => 'http://wphoot.com/themes/responsive-brix/', 'icon' => 'fa fa-rocket')));
 }
Esempio n. 5
0
 /**
  * Instantiate or return the one Hoot_Customizer instance.
  *
  * @since 2.0.0
  * @access public
  * @return Hoot_Customizer
  */
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 6
0
/**
 * Add Content to JS object passed to hoot-customizer-script
 *
 * @since 2.0.0
 * @return void
 */
function hoot_customizer_control_js_data_object($data)
{
    $hoot_customizer = Hoot_Customizer::get_instance();
    $panels = $hoot_customizer->get_options('panels');
    $panels = apply_filters('hoot_customizer_panel_icons', $panels);
    $panelicons = array();
    if (!empty($panels) && is_array($panels)) {
        foreach ($panels as $id => $panel) {
            if (!isset($id)) {
                continue;
            }
            if (isset($panel['icon'])) {
                $panelicons[$id] = $panel['icon'];
            } else {
                $panelicons[$id] = 'fa fa-cog';
            }
        }
    }
    $data['panelicons'] = $panelicons;
    global $wp_version;
    $data['bcomp'] = version_compare($wp_version, '4.3', '>=') ? 'no' : 'yes';
    // Compare to 4.3 and not 4.3.0
    $data['scomp'] = version_compare($wp_version, '4.3', '==') ? 'yes' : 'no';
    // Compare to 4.3 and not 4.3.0
    return $data;
}