/**
  * End Caching
  * 
  * return void
  */
 public static function end_cache()
 {
     if (!self::$turnoff_cache && !empty(self::$cache)) {
         self::$started--;
         if (self::$started == 0) {
             $content = '';
             if (!self::check_cache(self::$cache['cache_dir'], self::$cache['time'])) {
                 $content = ob_get_contents();
                 ob_end_clean();
                 $dir = pathinfo(self::$cache['cache_dir'], PATHINFO_DIRNAME);
                 if (!is_dir($dir)) {
                     wp_mkdir_p($dir);
                 }
                 unset($dir);
                 $wp_filesystem = self::InitWpFile();
                 self::$turnoff_cache = !$wp_filesystem->put_contents(self::$cache['cache_dir'], self::minify_html($content));
             }
             if (!self::$turnoff_cache) {
                 readfile(self::$cache['cache_dir']);
             } else {
                 echo $content;
                 self::removeDirectory(self::get_cache_dir());
                 $data = themify_get_data();
                 $data['setting-page_builder_cache'] = 'on';
                 themify_set_data($data);
                 self::$turnoff_cache = true;
             }
             self::$cache = 0;
         }
     }
 }
 public function setup_defaults()
 {
     $data = themify_get_data();
     if (isset($data[$this->setting_name]) && null === $data[$this->setting_name]) {
         $this->fonts = array('Muli', 'Jura', 'Istok Web', 'Nunito', 'Lato', 'PT Sans', 'EB Garamond', 'Oranienbaum', 'Kameron', 'Lustria', 'Cinzel', 'Oswald', 'Open Sans');
         $data[$this->setting_name] = json_encode($this->fonts);
         update_option('themify_data', $data);
     }
 }
/**
 * Default Page Layout Module
 * @param array $data Theme settings data
 * @return string Markup for module.
 * @since 1.0.0
 */
function themify_default_page_layout($data = array())
{
    $data = themify_get_data();
    /**
     * Theme Settings Option Key Prefix
     * @var string
     */
    $prefix = 'setting-default_page_';
    /**
     * Sidebar placement options
     * @var array
     */
    $sidebar_location_options = array(array('value' => 'sidebar1', 'img' => 'images/layout-icons/sidebar1.png', 'selected' => true, 'title' => __('Sidebar Right', 'themify')), array('value' => 'sidebar1 sidebar-left', 'img' => 'images/layout-icons/sidebar1-left.png', 'title' => __('Sidebar Left', 'themify')), array('value' => 'sidebar-none', 'img' => 'images/layout-icons/sidebar-none.png', 'title' => __('No Sidebar', 'themify')));
    /**
     * Tertiary options <blank>|yes|no
     * @var array
     */
    $default_options = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    /**
     * Module markup
     * @var string
     */
    $output = '';
    /**
     * Page sidebar placement
     */
    $output .= '<p>
					<span class="label">' . __('Page Sidebar Option', 'themify') . '</span>';
    $val = isset($data[$prefix . 'layout']) ? $data[$prefix . 'layout'] : '';
    foreach ($sidebar_location_options as $option) {
        if (('' == $val || !$val || !isset($val)) && (isset($option['selected']) && $option['selected'])) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = "selected";
        } else {
            $class = "";
        }
        $output .= '<a href="#" class="preview-icon ' . $class . '" title="' . $option['title'] . '"><img src="' . THEME_URI . '/' . $option['img'] . '" alt="' . $option['value'] . '"  /></a>';
    }
    $output .= '<input type="hidden" name="' . $prefix . 'layout" class="val" value="' . $val . '" /></p>';
    /**
     * Hide Title in All Pages
     */
    $output .= '<p>
					<span class="label">' . __('Hide Title in All Pages', 'themify') . '</span>
					<select name="setting-hide_page_title">' . themify_options_module($default_options, 'setting-hide_page_title') . '
					</select>
				</p>';
    /**
     * Page Comments
     */
    $pre = 'setting-comments_pages';
    $output .= '<p><span class="label">' . __('Page Comments', 'themify') . '</span><label for="' . $pre . '"><input type="checkbox" id="' . $pre . '" name="' . $pre . '" ' . checked(themify_get($pre), 'on', false) . ' /> ' . __('Disable comments in all Pages', 'themify') . '</label></p>';
    return $output;
}
Example #4
0
    function widget($args, $instance)
    {
        extract($args);
        /* User-selected settings. */
        $title = apply_filters('widget_title', $instance['title']);
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Title of widget (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $data = themify_get_data();
        $pre = 'setting-link_';
        $field_ids = json_decode($data[$pre . 'field_ids']);
        $show_link_name = $instance['show_link_name'] ? true : false;
        $open_new_window = $instance['open_new_window'] ? true : false;
        $new_window_attr = $open_new_window ? 'target="_blank"' : '';
        $out = '<ul class="social-links">';
        foreach ($field_ids as $key => $fid) {
            $title_name = $pre . 'title_' . $fid;
            if (function_exists('icl_t')) {
                $title_val = icl_t('Themify', $title_name, $data[$title_name]);
            } else {
                $title_val = isset($data[$title_name]) ? $data[$title_name] : '';
            }
            $link_name = $pre . 'link_' . $fid;
            $link_val = isset($data[$link_name]) ? trim($data[$link_name]) : '';
            $img_name = $pre . 'img_' . $fid;
            $w = isset($instance['thumb_width']) && '' != $instance['thumb_width'] ? 'width="' . $instance['thumb_width'] . '"' : '';
            $h = isset($instance['thumb_height']) && '' != $instance['thumb_height'] ? 'height="' . $instance['thumb_height'] . '"' : '';
            $img_val = '' == $data[$img_name] || !isset($data[$img_name]) ? '' : '<img src="' . $data[$img_name] . '" ' . $w . ' ' . $h . ' />';
            if ('' != $link_val) {
                $out .= sprintf('
						<li class="social-link-item %s">
							<a href="%s" title="%s" %s>%s %s</a>
						</li>
						<!-- /themify-link-item -->', sanitize_title($title_val), $link_val, $title_val, $new_window_attr, $img_val, $show_link_name ? $title_val : '');
            }
        }
        $out .= '</ul>';
        echo $out;
        /* After widget (defined by themes). */
        echo $after_widget;
    }
Example #5
0
    /**
     * Add transition effect
     * FlyIn/FadeIn/disabled
     * @return string
     */
    function themify_transition_effect()
    {
        $data = themify_get_data();
        $prefix = 'setting-transition_effect_';
        $fadein_checked = '';
        $mobile_checked = '';
        $disabled_checked = '';
        $mobile_options = array(array('name' => __('Off', 'themify'), 'value' => 'off'), array('name' => __('On', 'themify'), 'value' => 'on'));
        if (themify_check($prefix . 'fadein')) {
            $fadein_checked = "checked='checked'";
        }
        if (themify_check($prefix . 'mobile_exclude')) {
            $mobile_checked = "checked='checked'";
        }
        if (themify_check($prefix . 'all_disabled')) {
            $disabled_checked = "checked='checked'";
        }
        $output = '<p>
						<span class="label" style="width:400px;">' . __('Turn off fly-in animation on mobile/tablet for better performance', 'themify') . '</span> 
						<select name="' . $prefix . 'mobile_exclude">';
        foreach ($mobile_options as $mobile_option) {
            $output .= '<option ' . selected(themify_get($prefix . 'mobile_exclude'), $mobile_option['value'], false) . ' value="' . $mobile_option['value'] . '">' . $mobile_option['name'] . '</option>';
        }
        $output .= '	</select>
					</p>';
        $output .= '<p><label for="' . $prefix . 'fadein"><input type="checkbox" id="' . $prefix . 'fadein" name="' . $prefix . 'fadein" ' . $fadein_checked . '/> ' . __('Use fade-in transition effect instead of fly-in', 'themify') . '</label></p>';
        $output .= '<p><label for="' . $prefix . 'all_disabled"><input type="checkbox" id="' . $prefix . 'all_disabled" name="' . $prefix . 'all_disabled" ' . $disabled_checked . '/> ' . __('Disable all transition effect', 'themify') . '</label></p>';
        return $output;
    }
 /**
  * Display module to select numbered pagination or links to previous and next posts.
  * @param $data array
  * @return $html Module markup.
  * @since 1.6.0
  */
 function themify_entries_navigation($data = array())
 {
     $data = themify_get_data();
     $key = 'setting-entries_nav';
     $html = '<p>';
     // Numbered pagination
     $html .= '<label for="' . $key . '_numbered">';
     $html .= '<input ' . checked(isset($data[$key]) ? $data[$key] : 'numbered', 'numbered', false) . ' type="radio" id="' . $key . '_numbered" name="' . $key . '" value="numbered" /> ';
     $html .= __('Numbered Page Navigation (page 1, 2, 3, etc.)', 'themify') . '</label>';
     $html .= '<br/>';
     // Previous / Next links
     $html .= '<label for="' . $key . '_prevnext">';
     $html .= '<input ' . checked(isset($data[$key]) ? $data[$key] : '', 'prevnext', false) . ' type="radio" id="' . $key . '_prevnext" name="' . $key . '" value="prevnext" /> ';
     $html .= __('Previous Posts and Next Posts Links', 'themify') . '</label>';
     $html .= '</p>';
     return $html;
 }
Example #7
0
/**
 * Checks if there is styling data or custom CSS.
 *
 * 1.9.1 Removed cached option because it might be misleading on certain situations.
 *		 Refactored to exit as soon as possible and minimize execution time and memory usage.
 *
 * @since 1.8.2
 *
 * @return bool
 */
function themify_has_styling_data()
{
    /* Allow to restore the Styling panel by filtering and returning true */
    if (apply_filters('themify_show_styling_panel', false)) {
        return true;
    }
    /**
     * @var array $themify_data Themify theme settings and styling. 
     */
    $themify_data = themify_get_data();
    // Check Custom CSS
    $custom_css = isset($themify_data['setting-custom_css']) && !empty($themify_data['setting-custom_css']);
    if ($custom_css) {
        return true;
    }
    // Check styling data
    foreach ($themify_data as $key => $val) {
        if (false !== stripos($key, 'styling-')) {
            $val = trim($val);
            if (!empty($val)) {
                return true;
            }
        }
    }
    return false;
}
/**
 * Get request tweets from service api
 * @param $args
 * @return bool|object
 */
function themify_request_tweets($args)
{
    $data = themify_get_data();
    $prefix = 'setting-twitter_settings_';
    $screen_name = urlencode(strip_tags(sanitize_user(str_replace('@', '', $args['username']))));
    if ($args['limit'] != '') {
        $count = intval($args['limit']);
    }
    if ($args['include_retweets'] == 'true') {
        $include_rts = '1';
    } else {
        $include_rts = '0';
    }
    $exclude_replies = $args['exclude_replies'];
    $consumer_key = isset($data[$prefix . 'consumer_key']) ? $data[$prefix . 'consumer_key'] : '';
    $consumer_secret = isset($data[$prefix . 'consumer_secret']) ? $data[$prefix . 'consumer_secret'] : '';
    if (!class_exists('Wp_Twitter_Api')) {
        // Require twitter oauth class
        require 'twitteroauth/class-wp-twitter-api.php';
    }
    $credentials = apply_filters('themify_twitter_credentials', array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret));
    $query = 'screen_name=' . $screen_name . '&count=' . $count . '&include_rts=' . $include_rts . '&exclude_replies=' . $exclude_replies . '&include_entities=true';
    $twitterConnection = new Wp_Twitter_Api($credentials);
    $tweets = $twitterConnection->query($query);
    return $tweets;
}
Example #9
0
function themify_footer_logo($data = array())
{
    if ($data['attr']['target'] != '') {
        $target = "<span class='hide target'>" . $data['attr']['target'] . "</span>";
    }
    $data = themify_get_data();
    if ($data['setting-footer_logo'] == "image") {
        $image = "checked='checked'";
        $image_display = "style='display:block;'";
        $text_display = "";
    } else {
        $text = "checked='checked'";
        $text_display = "";
        $image_display = "style='display:none;'";
    }
    return '<div class="themify_field_row">
					<p>
						<span class="label">' . __('Display', 'themify') . '</span> 
						<input name="setting-footer_logo" type="radio" value="text" ' . $text . ' /> ' . __('Site Title', 'themify') . ' 
						<input name="setting-footer_logo" type="radio" value="image" ' . $image . ' /> ' . __('Image', 'themify') . '
					</p>
					' . $target . '
					<div class="uploader-fields pushlabel image" ' . $image_display . '>
						<input type="text" class="width10" id="setting-footer_logo_image_value" name="setting-footer_logo_image_value" value="' . $data['setting-footer_logo_image_value'] . '" /> <br />
						<div style="display:block;">' . themify_get_uploader('setting-footer_logo_image_value', array('tomedia' => true)) . '</div>
					</div>
					<p class="pushlabel image" ' . $image_display . '>
						<input type="text" name="setting-footer_logo_width" class="width2" value="' . $data['setting-footer_logo_width'] . '" /> ' . __('width', 'themify') . ' 
						<input type="text" name="setting-footer_logo_height" class="width2" value="' . $data['setting-footer_logo_height'] . '" /> ' . __('height', 'themify') . '
					</p>
				</div>';
}
    /**
     * Builder Settings
     * @param array $data
     * @return string
     * @since 1.2.7
     */
    function themify_manage_builder($data = array())
    {
        global $ThemifyBuilder;
        $data = themify_get_data();
        $pre = 'setting-page_builder_';
        $output = '';
        $modules = $ThemifyBuilder->get_modules();
        foreach ($modules as $m) {
            $exclude = $pre . 'exc_' . $m['name'];
            $checked = isset($data[$exclude]) ? 'checked="checked"' : '';
            $output .= '<p>
						<span><input id="builder_module_' . $m['name'] . '" type="checkbox" name="' . $exclude . '" value="1" ' . $checked . '/> <label for="builder_module_' . $m['name'] . '">' . sprintf(__('Exclude %s module', 'themify'), ucfirst($m['name'])) . '</label></span>
					</p>';
        }
        return $output;
    }
/**
 * Default Index Layout Module
 * @param array $data Theme settings data
 * @return string Markup for module.
 * @since 1.0.0
 */
function themify_default_layout($data = array())
{
    $data = themify_get_data();
    /**
     * Theme Settings Option Key Prefix
     * @var string
     */
    $prefix = 'setting-default_';
    if (!isset($data[$prefix . 'more_text']) || '' == $data[$prefix . 'more_text']) {
        $more_text = __('More', 'themify');
    } else {
        $more_text = $data[$prefix . 'more_text'];
    }
    /**
     * Tertiary options <blank>|yes|no
     * @var array
     */
    $default_options = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    /**
     * Default options 'yes', 'no'
     * @var array
     */
    $binary_options = array(array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    /**
     * Post content display options
     * @var array
     */
    $default_display_options = array(array('name' => __('Full Content', 'themify'), 'value' => 'content'), array('name' => __('Excerpt', 'themify'), 'value' => 'excerpt'), array('name' => __('None', 'themify'), 'value' => 'none'));
    /**
     * Post layout options
     * @var array
     */
    $default_post_layout_options = array(array('value' => 'list-post', 'img' => 'images/layout-icons/list-post.png', 'title' => __('List Post', 'themify'), "selected" => true), array('value' => 'grid4', 'img' => 'images/layout-icons/grid4.png', 'title' => __('Grid 4', 'themify')), array('value' => 'grid3', 'img' => 'images/layout-icons/grid3.png', 'title' => __('Grid 3', 'themify')), array('value' => 'grid2', 'img' => 'images/layout-icons/grid2.png', 'title' => __('Grid 2', 'themify')), array('value' => 'slider', 'img' => 'images/layout-icons/slider-default.png', 'title' => __('Slider', 'themify')));
    /**
     * Sidebar placement options
     * @var array
     */
    $sidebar_location_options = array(array('value' => 'sidebar1', 'img' => 'images/layout-icons/sidebar1.png', 'selected' => true, 'title' => __('Sidebar Right', 'themify')), array('value' => 'sidebar1 sidebar-left', 'img' => 'images/layout-icons/sidebar1-left.png', 'title' => __('Sidebar Left', 'themify')), array('value' => 'sidebar-none', 'img' => 'images/layout-icons/sidebar-none.png', 'title' => __('No Sidebar', 'themify')));
    /**
     * Image alignment options
     * @var array
     */
    $alignment_options = array(array('name' => '', 'value' => ''), array('name' => __('Left', 'themify'), 'value' => 'left'), array('name' => __('Right', 'themify'), 'value' => 'right'));
    /**
     * Entry media position, above or below the title
     */
    $media_position = array(array('name' => __('Above Post Title', 'themify'), 'value' => 'above'), array('name' => __('Below Post Title', 'themify'), 'value' => 'below'));
    /**
     * HTML for settings panel
     * @var string
     */
    $output = '<div class="themify-info-link">' . __('Here you can set the <a href="http://themify.me/docs/default-layouts">Default Layouts</a> for WordPress archive post layout (category, search, archive, tag pages, etc.), single post layout (single post page), and the static Page layout. The default single post and page layout can be override individually on the post/page > edit > Themify Custom Panel.', 'themify') . '</div>';
    /**
     * Index Sidebar Option
     */
    $output .= '<p>
					<span class="label">' . __('Index Sidebar Option', 'themify') . '</span>';
    $val = isset($data[$prefix . 'layout']) ? $data[$prefix . 'layout'] : '';
    foreach ($sidebar_location_options as $option) {
        if (($val == '' || !$val || !isset($val)) && $option['selected']) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = 'selected';
        } else {
            $class = '';
        }
        $output .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $output .= '	<input type="hidden" name="' . esc_attr($prefix) . 'layout" class="val" value="' . esc_attr($val) . '" />
				</p>';
    /**
     * Post Layout
     */
    $output .= '<p>
					<span class="label">' . __('Post Layout', 'themify') . '</span>';
    $val = isset($data[$prefix . 'post_layout']) ? $data[$prefix . 'post_layout'] : '';
    foreach ($default_post_layout_options as $option) {
        if (($val == '' || !$val || !isset($val)) && $option['selected']) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = 'selected';
        } else {
            $class = '';
        }
        $output .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $output .= '	<input type="hidden" name="' . esc_attr($prefix) . 'post_layout" class="val" value="' . esc_attr($val) . '" />
				</p>';
    /**
     * Post Content Layout
     */
    $output .= '<p>
					<span class="label">' . __('Post Content Layout', 'themify') . '</span>
					<select name="setting-post_content_layout">' . themify_options_module(array(array('name' => __('Default', 'themify'), 'value' => ''), array('name' => __('Overlay', 'themify'), 'value' => 'overlay'), array('name' => __('Polaroid', 'themify'), 'value' => 'polaroid')), 'setting-post_content_layout') . '
					</select>
				</p>';
    /**
     * Enable Masonry
     */
    $output .= '<p>
					<span class="label">' . __('Post Masonry', 'themify') . '</span>
					<select name="setting-disable_masonry">' . themify_options_module($binary_options, 'setting-disable_masonry') . '
					</select>
				</p>';
    /**
     * Post Gutter
     */
    $output .= '<p>
					<span class="label">' . __('Post Gutter', 'themify') . '</span>
					<select name="setting-post_gutter">' . themify_options_module(array(array('name' => __('Default', 'themify'), 'value' => 'gutter'), array('name' => __('No gutter', 'themify'), 'value' => 'no-gutter')), 'setting-post_gutter') . '
					</select>
				</p>';
    /**
     * Infinite scroll or pagination
     */
    $output .= '<p>
					<span class="label">' . __('Pagination Option', 'themify') . '</span>';
    //Infinite Scroll
    $output .= '<input ' . checked(themify_check('setting-more_posts') ? themify_get('setting-more_posts') : 'infinite', 'infinite', false) . ' type="radio" name="setting-more_posts" value="infinite" /> ';
    $output .= __('Infinite Scroll (posts are loaded on the same page)', 'themify');
    $output .= '<br/>';
    $output .= '<label for="setting-autoinfinite"><input class="disable-autoinfinite" type="checkbox" id="setting-autoinfinite" name="setting-autoinfinite" ' . checked(themify_check('setting-autoinfinite'), true, false) . '/> ' . __('Disable automatic infinite scroll', 'themify') . '</label>';
    $output .= '<br/><br/>';
    //Numbered pagination
    $output .= '<span class="pushlabel"><input ' . checked(themify_get('setting-more_posts'), 'pagination', false) . ' type="radio" name="setting-more_posts" value="pagination" /> ';
    $output .= __('Standard Pagination', 'themify') . '</span>';
    $output .= '</p>';
    /**
     * Display Content
     */
    $output .= '<p>
					<span class="label">' . __('Display Content', 'themify') . '</span> 
					<select name="' . esc_attr($prefix) . 'layout_display">' . themify_options_module($default_display_options, $prefix . 'layout_display') . '
					</select>
				</p>';
    /**
     * More Text
     */
    $output .= '<p>
					<span class="label">' . __('More Text', 'themify') . '</span>
					<input type="text" name="' . esc_attr($prefix) . 'more_text" value="' . esc_attr($more_text) . '">
					
					<span class="pushlabel vertical-grouped"><label for="setting-excerpt_more"><input type="checkbox" value="1" id="setting-excerpt_more" name="setting-excerpt_more" ' . checked(themify_get('setting-excerpt_more'), 1, false) . '/> ' . __('Display more link button in excerpt mode as well.', 'themify') . '</label></span>
				</p>';
    /**
     * Order & OrderBy Options
     */
    $output .= themify_post_sorting_options('setting-index_order', $data);
    /**
     * Hide Post Title
     */
    $output .= '<p>
					<span class="label">' . __('Hide Post Title', 'themify') . '</span>
					<select name="' . esc_attr($prefix) . 'post_title">' . themify_options_module($default_options, $prefix . 'post_title') . '
					</select>
				</p>';
    /**
     * Unlink Post Title
     */
    $output .= '<p>
					<span class="label">' . __('Unlink Post Title', 'themify') . '</span>
					<select name="' . esc_attr($prefix) . 'unlink_post_title">' . themify_options_module($default_options, $prefix . 'unlink_post_title') . '
					</select>
				</p>';
    /**
     * Hide Post Meta
     */
    $output .= themify_post_meta_options($prefix . 'post_meta', $data);
    /**
     * Hide Post Date
     */
    $output .= '<p>
					<span class="label">' . __('Hide Post Date', 'themify') . '</span>
					<select name="' . esc_attr($prefix) . 'post_date">' . themify_options_module($default_options, $prefix . 'post_date') . '
					</select>
				</p>';
    /**
     * Auto Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Auto Featured Image', 'themify') . '</span>
					<label for="setting-auto_featured_image"><input type="checkbox" value="1" id="setting-auto_featured_image" name="setting-auto_featured_image" ' . checked(themify_get('setting-auto_featured_image'), 1, false) . '/> ' . __('If no featured image is specified, display first image in content.', 'themify') . '</label>
				</p>';
    /**
     * Media Position
     */
    $output .= '<p>
					<span class="label">' . __('Featured Image Position', 'themify') . '</span>
					<select name="' . esc_attr($prefix) . 'media_position">' . themify_options_module($media_position, $prefix . 'media_position') . '
					</select>
				</p>';
    /**
     * Hide Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Hide Featured Image', 'themify') . '</span>
					<select name="' . esc_attr($prefix) . 'post_image">' . themify_options_module($default_options, $prefix . 'post_image') . '
					</select>
				</p>';
    /**
     * Unlink Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Unlink Featured Image', 'themify') . '</span>
					<select name="' . esc_attr($prefix) . 'unlink_post_image">' . themify_options_module($default_options, $prefix . 'unlink_post_image') . '
					</select>
				</p>';
    /**
     * Featured Image Sizes
     */
    $output .= themify_feature_image_sizes_select('image_post_feature_size');
    /**
     * Image Dimensions
     */
    $output .= '<p>
					<span class="label">' . __('Image Size', 'themify') . '</span>  
					<input type="text" class="width2" name="setting-image_post_width" value="' . themify_get('setting-image_post_width') . '" /> ' . __('width', 'themify') . ' <small>(px)</small>
					<input type="text" class="width2" name="setting-image_post_height" value="' . themify_get('setting-image_post_height') . '" /> ' . __('height', 'themify') . ' <small>(px)</small>
					<br /><span class="pushlabel"><small>' . __('Enter height = 0 to disable vertical cropping with img.php enabled', 'themify') . '</small></span>
				</p>';
    return $output;
}
Example #12
0
    /**
     * Builder Settings
     * @param array $data
     * @return string
     * @since 1.2.7
     */
    function themify_manage_builder_active($data = array())
    {
        global $ThemifyBuilder;
        $data = themify_get_data();
        $pre = 'setting-page_builder_';
        $output = '';
        $options = array(array('name' => __('Enable', 'themify'), 'value' => 'enable'), array('name' => __('Disable', 'themify'), 'value' => 'disable'));
        $output .= '<p>
						<span class="label">' . __('Themify Builder:', 'themify') . '</span> 
						<select name="' . $pre . 'is_active">' . themify_options_module($options, $pre . 'is_active') . '
						</select>
					</p>';
        return $output;
    }
Example #13
0
/**
 * Add different CSS classes to body tag.
 * Outputs:
 * 		skin name
 * 		layout
 * @param Array
 * @return Array
 * @since 1.2.2
 */
function themify_body_classes($classes)
{
    global $themify;
    $data = themify_get_data();
    // Add skin name
    if ($data['skin']) {
        $skin_dir = explode('/', $data['skin']);
        $classes[] = 'skin-' . $skin_dir[sizeof($skin_dir) - 2];
    } else {
        $classes[] = 'skin-default';
    }
    // Browser classes
    global $is_gecko, $is_opera, $is_iphone, $is_IE, $is_winIE, $is_macIE;
    $is_android = stripos($_SERVER['HTTP_USER_AGENT'], 'android') ? true : false;
    $is_webkit = stripos($_SERVER['HTTP_USER_AGENT'], 'webkit') ? true : false;
    $is_ie10 = stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 10') ? true : false;
    $is_ie9 = stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9') ? true : false;
    $is_ie8 = stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8') ? true : false;
    $is_ie7 = stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') ? true : false;
    $browsers = array($is_gecko => 'gecko', $is_opera => 'opera', $is_iphone => 'iphone', $is_IE => 'ie', $is_winIE => 'iewin', $is_macIE => 'iemac', $is_android => 'android', $is_webkit => 'webkit', $is_ie10 => 'ie10', $is_ie9 => 'ie9', $is_ie8 => 'ie8', $is_ie7 => 'ie7');
    foreach ($browsers as $browser => $name) {
        if ($browser) {
            $classes[] = $name;
        }
    }
    // Add default layout and post layout
    $layout = themify_get('setting-default_layout');
    $post_layout = themify_get('setting-default_post_layout');
    // It's a page
    if (is_page()) {
        // It's a page
        $layout = themify_get('page_layout') != 'default' && themify_check('page_layout') ? themify_get('page_layout') : themify_get('setting-default_page_layout');
    }
    // It's a post
    if (is_single()) {
        $layout = themify_get('layout') != 'default' && themify_check('layout') ? themify_get('layout') : themify_get('setting-default_page_post_layout');
    }
    // If still empty, set default
    if (apply_filters('themify_default_layout_condition', '' == $layout)) {
        $layout = apply_filters('themify_default_layout', 'sidebar1');
    }
    $classes[] = $layout;
    // Set post layout for blog, archive or a query category page
    $post_query_category = themify_get('query_category');
    if (is_home() || is_archive() || '' != $post_query_category || is_search()) {
        $post_layout = $themify->post_layout;
        if (apply_filters('themify_default_post_layout_condition', '' == $post_layout)) {
            $post_layout = apply_filters('themify_default_post_layout', 'list-post');
        }
        $classes[] = $post_layout;
    }
    return apply_filters('themify_body_classes', $classes);
}
    function themify_gallery_slider()
    {
        /**
         * Associative array containing theme settings
         * @var array
         */
        $data = themify_get_data();
        /**
         * Variable prefix key
         * @var string
         */
        $prefix = 'setting-portfolio_slider_';
        /**
         * Basic default options '', 'yes', 'no'
         * @var array
         */
        $default_options = array(array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
        $auto_options = array(__('4 Secs (default)', 'themify') => 4000, __('Off', 'themify') => 'off', __('1 Sec', 'themify') => 1000, __('2 Secs', 'themify') => 2000, __('3 Secs', 'themify') => 3000, __('4 Secs', 'themify') => 4000, __('5 Secs', 'themify') => 5000, __('6 Secs', 'themify') => 6000, __('7 Secs', 'themify') => 7000, __('8 Secs', 'themify') => 8000, __('9 Secs', 'themify') => 9000, __('10 Secs', 'themify') => 10000);
        $speed_options = array(__('Fast', 'themify') => 500, __('Normal', 'themify') => 1000, __('Slow', 'themify') => 1500);
        $effect_options = array(array('name' => __('Slide', 'themify'), 'value' => 'slide'), array('name' => __('Fade', 'themify'), 'value' => 'fade'));
        $output = '<p>
						<span class="label">' . __('Auto Play', 'themify') . '</span>
						<select name="' . $prefix . 'autoplay">';
        foreach ($auto_options as $name => $val) {
            $output .= '<option value="' . $val . '" ' . selected($data[$prefix . 'autoplay'], $data[$prefix . 'autoplay'] ? $val : 4000, false) . '>' . $name . '</option>';
        }
        $output .= '	</select>
					</p>';
        $output .= '<p>
						<span class="label">' . __('Effect', 'themify') . '</span>
						<select name="' . $prefix . 'effect">' . themify_options_module($effect_options, $prefix . 'effect') . '
						</select>
					</p>';
        $output .= '<p>
						<span class="label">' . __('Transition Speed', 'themify') . '</span>
						<select name="' . $prefix . 'transition_speed">';
        foreach ($speed_options as $name => $val) {
            $output .= '<option value="' . $val . '" ' . selected($data[$prefix . 'transition_speed'], $data[$prefix . 'transition_speed'] ? $val : 500, false) . '>' . $name . '</option>';
        }
        $output .= '	</select>
					</p>';
        return $output;
    }
Example #15
0
 /**
  * Builder Setting Animations
  * @param array $data
  * @return string
  * @since 2.0.2
  */
 function themify_manage_builder_parallax($data = array())
 {
     $opt_data = themify_get_data();
     $pre = 'setting-page_builder_parallax_';
     $mobile_checked = '';
     $disabled_checked = '';
     if (isset($opt_data[$pre . 'mobile_exclude']) && $opt_data[$pre . 'mobile_exclude']) {
         $mobile_checked = " checked='checked'";
     }
     if (isset($opt_data[$pre . 'disabled']) && $opt_data[$pre . 'disabled']) {
         $disabled_checked = " checked='checked'";
     }
     $out = '';
     $out .= sprintf('<p><label for="%s"><input type="checkbox" id="%s" name="%s"%s> %s</label></p>', esc_attr($pre . 'mobile_exclude'), esc_attr($pre . 'mobile_exclude'), esc_attr($pre . 'mobile_exclude'), $mobile_checked, wp_kses_post(__('Disable Builder parallax on mobile and tablet only', 'themify')));
     $out .= sprintf('<p><label for="%s"><input type="checkbox" id="%s" name="%s"%s> %s</label></p>', esc_attr($pre . 'disabled'), esc_attr($pre . 'disabled'), esc_attr($pre . 'disabled'), $disabled_checked, wp_kses_post(__('Disable Builder parallax on all devices (all row will not have any effect)', 'themify')));
     return $out;
 }
Example #16
0
function themify_default_post_layout($data = array())
{
    $data = themify_get_data();
    $default_options = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    $val = isset($data['setting-default_page_post_layout']) ? $data['setting-default_page_post_layout'] : '';
    /**
     * HTML for settings panel
     * @var string
     */
    $output = '<p>
						<span class="label">' . __('Post Sidebar Option', 'themify') . '</span>';
    $options = array(array('value' => 'sidebar1', 'img' => 'images/layout-icons/sidebar1.png', 'selected' => true, 'title' => __('Sidebar Right', 'themify')), array('value' => 'sidebar1 sidebar-left', 'img' => 'images/layout-icons/sidebar1-left.png', 'title' => __('Sidebar Left', 'themify')), array('value' => 'sidebar-none', 'img' => 'images/layout-icons/sidebar-none.png', 'title' => __('No Sidebar', 'themify')));
    foreach ($options as $option) {
        if (('' == $val || !$val || !isset($val)) && (isset($option['selected']) && $option['selected'])) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = "selected";
        } else {
            $class = '';
        }
        $output .= '<a href="#" class="preview-icon ' . $class . '" title="' . $option['title'] . '"><img src="' . THEME_URI . '/' . $option['img'] . '" alt="' . $option['value'] . '"  /></a>';
    }
    $output .= '<input type="hidden" name="setting-default_page_post_layout" class="val" value="' . $val . '" />';
    $output .= '</p>
					<p>
						<span class="label">' . __('Hide Post Title', 'themify') . '</span>
						
						<select name="setting-default_page_post_title">';
    foreach ($default_options as $title_option) {
        if (isset($data['setting-default_page_post_title']) && $title_option['value'] == $data['setting-default_page_post_title']) {
            $output .= '<option selected="selected" value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        }
    }
    $output .= '</select>
					</p>
					<p>
						<span class="label">' . __('Unlink Post Title', 'themify') . '</span>
						
						<select name="setting-default_page_unlink_post_title">';
    foreach ($default_options as $title_option) {
        if (isset($data['setting-default_page_unlink_post_title']) && $title_option['value'] == $data['setting-default_page_unlink_post_title']) {
            $output .= '<option selected="selected" value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        }
    }
    $output .= '</select>
					</p>
					<p>
						<span class="label">' . __('Hide Post Meta', 'themify') . '</span>
						
						<select name="setting-default_page_post_meta">';
    foreach ($default_options as $title_option) {
        if (isset($data['setting-default_page_post_meta']) && $title_option['value'] == $data['setting-default_page_post_meta']) {
            $output .= '<option selected="selected" value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        }
    }
    $output .= '</select>
					</p>
					<p>
						<span class="label">' . __('Hide Post Date', 'themify') . '</span>
						
						<select name="setting-default_page_post_date">';
    foreach ($default_options as $title_option) {
        if (isset($data['setting-default_page_post_date']) && $title_option['value'] == $data['setting-default_page_post_date']) {
            $output .= '<option selected="selected" value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        }
    }
    $output .= '</select>
					</p>
					<p>
						<span class="label">' . __('Hide Featured Image', 'themify') . '</span>
						
						<select name="setting-default_page_post_image">';
    foreach ($default_options as $title_option) {
        if (isset($data['setting-default_page_post_image']) && $title_option['value'] == $data['setting-default_page_post_image']) {
            $output .= '<option selected="selected" value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        }
    }
    $output .= '</select>
					</p><p>
						<span class="label">' . __('Unlink Featured Image', 'themify') . '</span>
						
						<select name="setting-default_page_unlink_post_image">';
    foreach ($default_options as $title_option) {
        if (isset($data['setting-default_page_unlink_post_image']) && $title_option['value'] == $data['setting-default_page_unlink_post_image']) {
            $output .= '<option selected="selected" value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        } else {
            $output .= '<option value="' . $title_option['value'] . '">' . $title_option['name'] . '</option>';
        }
    }
    $output .= '</select></p>';
    $output .= themify_feature_image_sizes_select('image_post_single_feature_size');
    $output .= '<p>
				<span class="label">' . __('Image Size', 'themify') . '</span>
						<input type="text" class="width2" name="setting-image_post_single_width" value="' . themify_get('setting-image_post_single_width') . '" /> ' . __('width', 'themify') . ' <small>(px)</small>  
						<input type="text" class="width2 show_if_enabled_img_php" name="setting-image_post_single_height" value="' . themify_get('setting-image_post_single_height') . '" /> <span class="show_if_enabled_img_php">' . __('height', 'themify') . ' <small>(px)</small></span>
						<br /><span class="pushlabel show_if_enabled_img_php"><small>' . __('Enter height = 0 to disable vertical cropping with img.php enabled', 'themify') . '</small></span>
					</p>';
    $output .= '<p><span class="label">' . __('Post Comments', 'themify') . '</span><label for="setting-comments_posts"><input type="checkbox" id="setting-comments_posts" name="setting-comments_posts" ' . checked(themify_get('setting-comments_posts'), 'on', false) . ' /> ' . __('Disable comments in all Posts', 'themify') . '</label></p>';
    $output .= '<p><span class="label">' . __('Show Author Box', 'themify') . '</span><label for="setting-post_author_box"><input type="checkbox" id="setting-post_author_box" name="setting-post_author_box" ' . checked(themify_get('setting-post_author_box'), 'on', false) . ' /> ' . __('Show author box in all Posts', 'themify') . '</label></p>';
    // Post Navigation
    $pre = 'setting-post_nav_';
    $output .= '
		<p>
			<span class="label">' . __('Post Navigation', 'themify') . '</span>
			<label for="' . $pre . 'disable">
				<input type="checkbox" id="' . $pre . 'disable" name="' . $pre . 'disable" ' . checked(themify_get($pre . 'disable'), 'on', false) . '/> ' . __('Remove Post Navigation', 'themify') . '
				</label>
		<span class="pushlabel vertical-grouped">
				<label for="' . $pre . 'same_cat">
					<input type="checkbox" id="' . $pre . 'same_cat" name="' . $pre . 'same_cat" ' . checked(themify_get($pre . 'same_cat'), 'on', false) . '/> ' . __('Show only posts in the same category', 'themify') . '
				</label>
			</span>
		</p>';
    return $output;
}
Example #17
0
/**
 * Outputs module to manage links to be shown using the corresponding widget
 * @param array $data
 * @return string
 * @since 1.2.7
 */
function themify_manage_links($data = array())
{
    $data = themify_get_data();
    $pre = 'setting-link_';
    $field_hash = $data[$pre . 'field_hash'] ? $data[$pre . 'field_hash'] : 5;
    $start = array();
    for ($i = 0; $i < $field_hash; $i++) {
        $start['themify-link-' . $i] = 'themify-link-' . $i;
    }
    //$data[$pre.'field_ids'] = json_encode($start);
    if (json_decode($data[$pre . 'field_ids'])) {
        $field_ids = json_decode($data[$pre . 'field_ids']);
    } else {
        $field_ids = $start;
        $data[$pre . 'title_themify-link-0'] = 'Twitter';
        $data[$pre . 'title_themify-link-1'] = 'Facebook';
        $data[$pre . 'title_themify-link-2'] = 'Google+';
        $data[$pre . 'title_themify-link-3'] = 'YouTube';
        $data[$pre . 'title_themify-link-4'] = 'Pinterest';
        $data[$pre . 'link_themify-link-0'] = '';
        $data[$pre . 'link_themify-link-1'] = '';
        $data[$pre . 'link_themify-link-2'] = '';
        $data[$pre . 'link_themify-link-3'] = '';
        $data[$pre . 'link_themify-link-4'] = '';
        $data[$pre . 'img_themify-link-0'] = THEMIFY_URI . '/img/social/twitter.png';
        $data[$pre . 'img_themify-link-1'] = THEMIFY_URI . '/img/social/facebook.png';
        $data[$pre . 'img_themify-link-2'] = THEMIFY_URI . '/img/social/google-plus.png';
        $data[$pre . 'img_themify-link-3'] = THEMIFY_URI . '/img/social/youtube.png';
        $data[$pre . 'img_themify-link-4'] = THEMIFY_URI . '/img/social/pinterest.png';
    }
    $out = '<ul id="social-links-wrapper">';
    foreach ($field_ids as $key => $fid) {
        $out .= themify_add_link_template($fid, $data);
    }
    $out .= '</ul>';
    $out .= '<p class="add-social-link"><a href="#">' . __('Add Link', 'themify') . '</a></p>';
    $out .= '<p><small>' . sprintf(__('To display the links: go to Appearance > <a href="%s">Widgets</a> and drop a Themify - Social Links widget in a widget area (<a href="%s">learn more</a>)', 'themify'), admin_url('widgets.php'), 'http://themify.me/docs/social-media-links') . '</small></p>';
    $out .= '<input type="hidden" id="' . $pre . 'field_ids" name="' . $pre . 'field_ids" value=\'' . json_encode($field_ids) . '\'/>';
    $out .= '<input type="hidden" id="' . $pre . 'field_hash" name="' . $pre . 'field_hash" value="' . $field_hash . '"/>';
    //$out .= '<p>Fields: '.json_encode($field_ids).'</p><p>Hash: '.$field_hash.'</p>';
    return $out;
}
Example #18
0
/**
 * Pull data for inspection
 * @since 1.1.3
 * @package themify
 */
function themify_pull()
{
    print_r(themify_get_data());
    die;
}
Example #19
0
 /**
  * Add transition effect
  * FlyIn/FadeIn/disabled
  * @return string
  */
 function themify_transition_effect()
 {
     $data = themify_get_data();
     $prefix = 'setting-transition_effect_';
     $fadein_checked = '';
     $mobile_checked = '';
     $disabled_checked = '';
     if (themify_check($prefix . 'fadein')) {
         $fadein_checked = "checked='checked'";
     }
     if (themify_check($prefix . 'mobile_exclude')) {
         $mobile_checked = "checked='checked'";
     }
     if (themify_check($prefix . 'all_disabled')) {
         $disabled_checked = "checked='checked'";
     }
     $output = '<p><label for="' . $prefix . 'fadein"><input type="checkbox" id="' . $prefix . 'fadein" name="' . $prefix . 'fadein" ' . $fadein_checked . '/> ' . __('Use fade-in transition effect instead of fly-in', 'themify') . '</label></p>';
     $output .= '<p><label for="' . $prefix . 'mobile_exclude"><input type="checkbox" id="' . $prefix . 'mobile_exclude" name="' . $prefix . 'mobile_exclude" ' . $mobile_checked . '/> ' . __('Disable transition effect on mobile and tablet only', 'themify') . '</label></p>';
     $output .= '<p><label for="' . $prefix . 'all_disabled"><input type="checkbox" id="' . $prefix . 'all_disabled" name="' . $prefix . 'all_disabled" ' . $disabled_checked . '/> ' . __('Disable all transition effect', 'themify') . '</label></p>';
     return $output;
 }
 /**
  * Get module php files data
  * @param string $select
  * @return array
  */
 function get_modules($select = 'all')
 {
     $_modules = array();
     foreach ($this->get_directory_path('modules') as $dir) {
         if (file_exists($dir)) {
             $d = dir($dir);
             while (false !== ($entry = $d->read())) {
                 if ($entry !== '.' && $entry !== '..' && $entry !== '.svn') {
                     $path = $d->path . $entry;
                     $module_name = basename($path);
                     $_modules[$module_name] = $path;
                 }
             }
         }
     }
     ksort($_modules);
     foreach ($_modules as $value) {
         if (is_dir($value)) {
             continue;
         }
         /* clean-up, make sure no directories is included in the list */
         $path_info = pathinfo($value);
         $id = str_replace('module-', '', $path_info['filename']);
         $module_data = get_file_data($value, array('Module Name'));
         $modules[$id] = array('name' => $module_data[0], 'id' => $id, 'dirname' => $path_info['dirname'], 'extension' => $path_info['extension'], 'basename' => $path_info['basename']);
     }
     if ('active' == $select) {
         $pre = 'setting-page_builder_';
         $data = themify_get_data();
         if (count($modules) > 0) {
             foreach ($modules as $key => $m) {
                 $exclude = $pre . 'exc_' . $m['id'];
                 if (isset($data[$exclude])) {
                     unset($modules[$m['id']]);
                 }
             }
         }
     } elseif ('registered' == $select) {
         foreach ($modules as $key => $m) {
             /* check if module is registered */
             if (!Themify_Builder_Model::check_module_active($key)) {
                 unset($modules[$key]);
             }
         }
     }
     return $modules;
 }
Example #21
0
/**
 * Checks ONLY ONCE if img.php exists and if it doesn't, sets setting-img_settings_use=on.
 * Note that if later, for whatever reason, img.php is restored, this won't automatically enable it.
 * User will have to manually enable img.php again.
 * @since 1.6.0
 */
function themify_maybe_unset_image_script()
{
    $flag = 'themify_unset_image_script';
    $noimg = get_option($flag);
    if (!isset($noimg) || !$noimg) {
        if (!file_exists(trailingslashit(THEMIFY_DIR) . 'img.php')) {
            $get_data = array_merge(themify_get_data(), array('setting-img_settings_use' => 'on'));
            $data = array();
            foreach ($get_data as $key => $val) {
                $data[] = $key . '=' . $val;
            }
            $temp = array();
            foreach ($data as $a) {
                $v = explode('=', $a);
                $temp[$v[0]] = urldecode(str_replace('+', ' ', preg_replace('/%([0-9a-f]{2})/ie', "chr(hexdec('\\1'))", urlencode($v[1]))));
            }
            themify_set_data($temp);
        }
        update_option($flag, true);
    }
}
Example #22
0
/**
 * Default Single Post Layout
 * @param array $data Theme settings data
 * @return string Markup for module.
 * @since 1.0.0
 */
function themify_default_post_layout($data = array())
{
    $data = themify_get_data();
    /**
     * Theme Settings Option Key Prefix
     * @var string
     */
    $prefix = 'setting-default_page_';
    /**
     * Tertiary options <blank>|yes|no
     * @var array
     */
    $default_options = array(array('name' => '', 'value' => ''), array('name' => __('Yes', 'themify'), 'value' => 'yes'), array('name' => __('No', 'themify'), 'value' => 'no'));
    /**
     * Sidebar placement options
     * @var array
     */
    $sidebar_location_options = array(array('value' => 'sidebar1', 'img' => 'images/layout-icons/sidebar1.png', 'selected' => true, 'title' => __('Sidebar Right', 'themify')), array('value' => 'sidebar1 sidebar-left', 'img' => 'images/layout-icons/sidebar1-left.png', 'title' => __('Sidebar Left', 'themify')), array('value' => 'sidebar-none', 'img' => 'images/layout-icons/sidebar-none.png', 'title' => __('No Sidebar', 'themify')));
    /**
     * Image alignment options
     * @var array
     */
    $alignment_options = array(array('name' => '', 'value' => ''), array('name' => __('Left', 'themify'), 'value' => 'left'), array('name' => __('Right', 'themify'), 'value' => 'right'));
    /**
     * Module markup
     * @var string
     */
    $output = '';
    /**
     * Post sidebar placement
     */
    $output .= '<p>
					<span class="label">' . __('Post Sidebar Option', 'themify') . '</span>';
    $val = isset($data[$prefix . 'post_layout']) ? $data[$prefix . 'post_layout'] : '';
    foreach ($sidebar_location_options as $option) {
        if (('' == $val || !$val || !isset($val)) && (isset($option['selected']) && $option['selected'])) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = 'selected';
        } else {
            $class = '';
        }
        $output .= '<a href="#" class="preview-icon ' . $class . '" title="' . $option['title'] . '"><img src="' . THEME_URI . '/' . $option['img'] . '" alt="' . $option['value'] . '"  /></a>';
    }
    $output .= '	<input type="hidden" name="' . $prefix . 'post_layout" class="val" value="' . $val . '" />
				</p>';
    /**
     * Hide Post Title
     */
    $output .= '<p>
					<span class="label">' . __('Hide Post Title', 'themify') . '</span>
					<select name="' . $prefix . 'post_title">' . themify_options_module($default_options, $prefix . 'post_title') . '
					</select>
				</p>';
    /**
     * Unlink Post Title
     */
    $output .= '<p>
					<span class="label">' . __('Unlink Post Title', 'themify') . '</span>
					<select name="' . $prefix . 'unlink_post_title">' . themify_options_module($default_options, $prefix . 'unlink_post_title') . '
					</select>
				</p>';
    /**
     * Hide Post Meta
     */
    $output .= themify_post_meta_options($prefix . 'post_meta', $data);
    /**
     * Hide Post Date
     */
    $output .= '<p>
					<span class="label">' . __('Hide Post Date', 'themify') . '</span>
					<select name="' . $prefix . 'post_date">' . themify_options_module($default_options, $prefix . 'post_date') . '
					</select>
				</p>';
    /**
     * Hide Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Hide Featured Image', 'themify') . '</span>
					<select name="' . $prefix . 'post_image">' . themify_options_module($default_options, $prefix . 'post_image') . '
					</select>
				</p>';
    /**
     * Unlink Featured Image
     */
    $output .= '<p>
					<span class="label">' . __('Unlink Featured Image', 'themify') . '</span>
					<select name="' . $prefix . 'unlink_post_image">' . themify_options_module($default_options, $prefix . 'unlink_post_image') . '
					</select>
				</p>';
    /**
     * Featured Image Sizes
     */
    $output .= themify_feature_image_sizes_select('image_post_single_feature_size');
    /**
     * Image dimensions
     */
    $output .= '<p>
			<span class="label">' . __('Image Size', 'themify') . '</span>
					<input type="text" class="width2" name="setting-image_post_single_width" value="' . themify_get('setting-image_post_single_width') . '" /> ' . __('width', 'themify') . ' <small>(px)</small>
					<input type="text" class="width2" name="setting-image_post_single_height" value="' . themify_get('setting-image_post_single_height') . '" /> ' . __('height', 'themify') . ' <small>(px)</small>
				</p>';
    /**
     * Featured Image Alignment
     */
    $output .= '<p>
					<span class="label">' . __('Featured Image Alignment', 'themify') . '</span>
					<select name="setting-image_post_single_align">' . themify_options_module($alignment_options, 'setting-image_post_single_align') . '
					</select>
				</p>';
    /**
     * Disable comments
     */
    $pre = 'setting-comments_posts';
    $output .= '<p><span class="label">' . __('Post Comments', 'themify') . '</span><label for="' . $pre . '"><input type="checkbox" id="' . $pre . '" name="' . $pre . '" ' . checked(themify_get($pre), 'on', false) . ' /> ' . __('Disable comments in all Posts', 'themify') . '</label></p>';
    /**
     * Show author box
     */
    $pre = 'setting-post_author_box';
    $output .= '<p><span class="label">' . __('Show Author Box', 'themify') . '</span><label for="' . $pre . '"><input type="checkbox" id="' . $pre . '" name="' . $pre . '" ' . checked(themify_get($pre), 'on', false) . ' /> ' . __('Show author box in all Posts', 'themify') . '</label></p>';
    /**
     * Remove Post Navigation
     */
    $pre = 'setting-post_nav_';
    $output .= '<p>
					<span class="label">' . __('Post Navigation', 'themify') . '</span>
					<label for="' . $pre . 'disable">
						<input type="checkbox" id="' . $pre . 'disable" name="' . $pre . 'disable" ' . checked(themify_get($pre . 'disable'), 'on', false) . '/> ' . __('Remove Post Navigation', 'themify') . '
						</label>
					<span class="pushlabel vertical-grouped">
						<label for="' . $pre . 'same_cat">
							<input type="checkbox" id="' . $pre . 'same_cat" name="' . $pre . 'same_cat" ' . checked(themify_get($pre . 'same_cat'), 'on', false) . '/> ' . __('Show only posts in the same category', 'themify') . '
						</label>
					</span>
				</p>';
    return $output;
}
Example #23
0
}
///////////////////////////////////////
// Register Sidebars
///////////////////////////////////////
if (function_exists('register_sidebar')) {
    register_sidebar(array('name' => __('Sidebar 1', 'themify'), 'id' => 'sidebar-main', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widgettitle">', 'after_title' => '</h4>'));
    register_sidebar(array('name' => __('Sidebar 2A', 'themify'), 'id' => 'sidebar-main-2a', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widgettitle">', 'after_title' => '</h4>'));
    register_sidebar(array('name' => __('Sidebar 2B', 'themify'), 'id' => 'sidebar-main-2b', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widgettitle">', 'after_title' => '</h4>'));
    register_sidebar(array('name' => __('Sidebar 3', 'themify'), 'id' => 'sidebar-main-3', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widgettitle">', 'after_title' => '</h4>'));
    register_sidebar(array('name' => __('Social Widget', 'themify'), 'id' => 'social-widget', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<strong class="widgettitle">', 'after_title' => '</strong>'));
}
///////////////////////////////////////
// Footer Sidebars
///////////////////////////////////////
if (function_exists('register_sidebar')) {
    $data = themify_get_data();
    $columns = array('footerwidget-4col' => 4, 'footerwidget-3col' => 3, 'footerwidget-2col' => 2, 'footerwidget-1col' => 1, 'none' => 0);
    $option = $data['setting-footer_widgets'] == "" || !isset($data['setting-footer_widgets']) ? "footerwidget-3col" : $data['setting-footer_widgets'];
    for ($x = 1; $x <= $columns[$option]; $x++) {
        register_sidebar(array('name' => __('Footer Widget', 'themify') . ' ' . $x, 'id' => 'footer-widget-' . $x, 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widgettitle">', 'after_title' => '</h4>'));
    }
}
///////////////////////////////////////
// Custom Theme Comment
///////////////////////////////////////
function themify_theme_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
		<li <?php 
    comment_class();
 /**
  * Get module php files data
  * @param string $select
  * @return array
  */
 function get_modules($select = 'all')
 {
     $_modules = array();
     foreach ($this->get_directory_path('modules') as $dir) {
         if (file_exists($dir)) {
             $d = dir($dir);
             while (false !== ($entry = $d->read())) {
                 if ($entry !== '.' && $entry !== '..' && $entry !== '.svn') {
                     $path = $d->path . $entry;
                     $module_name = basename($path);
                     $_modules[$module_name] = $path;
                 }
             }
         }
     }
     ksort($_modules);
     foreach ($_modules as $value) {
         $path_info = pathinfo($value);
         $name = explode('-', $path_info['filename']);
         $name = $name[1];
         $modules[$name] = array('name' => $name, 'dirname' => $path_info['dirname'], 'extension' => $path_info['extension'], 'basename' => $path_info['basename']);
     }
     if ('active' == $select) {
         $pre = 'setting-page_builder_';
         $data = themify_get_data();
         if (count($modules) > 0) {
             foreach ($modules as $key => $m) {
                 $exclude = $pre . 'exc_' . $m['name'];
                 if (isset($data[$exclude])) {
                     unset($modules[$m['name']]);
                 }
             }
         }
     } elseif ('registered' == $select) {
         foreach ($modules as $key => $m) {
             /* check if module is registered */
             if (!Themify_Builder_Model::check_module_active($key)) {
                 unset($modules[$key]);
             }
         }
     }
     return $modules;
 }
Example #25
0
    /**
     * Creates a general module to setup slider parameters
     * @param $prefix
     * @return string
     */
    function themify_generic_slider_controls($prefix)
    {
        /**
         * Associative array containing theme settings
         * @var array
         */
        $data = themify_get_data();
        $auto_options = apply_filters('themify_generic_slider_auto', array(__('4 Secs (default)', 'themify') => 4000, __('Off', 'themify') => 'off', __('1 Sec', 'themify') => 1000, __('2 Secs', 'themify') => 2000, __('3 Secs', 'themify') => 3000, __('4 Secs', 'themify') => 4000, __('5 Secs', 'themify') => 5000, __('6 Secs', 'themify') => 6000, __('7 Secs', 'themify') => 7000, __('8 Secs', 'themify') => 8000, __('9 Secs', 'themify') => 9000, __('10 Secs', 'themify') => 10000));
        $speed_options = apply_filters('themify_generic_slider_speed', array(__('Fast', 'themify') => 500, __('Normal', 'themify') => 1000, __('Slow', 'themify') => 1500));
        $effect_options = array(array('name' => __('Slide', 'themify'), 'value' => 'slide'), array('name' => __('Fade', 'themify'), 'value' => 'fade'));
        /**
         * Auto Play
         */
        $output = '<p>
						<span class="label">' . __('Auto Play', 'themify') . '</span>
						<select name="' . $prefix . 'autoplay">';
        foreach ($auto_options as $name => $val) {
            $output .= '<option value="' . $val . '" ' . selected($data[$prefix . 'autoplay'], $data[$prefix . 'autoplay'] ? $val : 4000, false) . '>' . $name . '</option>';
        }
        $output .= '	</select>
					</p>';
        /**
         * Effect
         */
        $output .= '<p>
						<span class="label">' . __('Effect', 'themify') . '</span>
						<select name="' . $prefix . 'effect">' . themify_options_module($effect_options, $prefix . 'effect') . '
						</select>
					</p>';
        /**
         * Transition Speed
         */
        $output .= '<p>
						<span class="label">' . __('Transition Speed', 'themify') . '</span>
						<select name="' . $prefix . 'transition_speed">';
        foreach ($speed_options as $name => $val) {
            $output .= '<option value="' . $val . '" ' . selected($data[$prefix . 'transition_speed'], $data[$prefix . 'transition_speed'] ? $val : 500, false) . '>' . $name . '</option>';
        }
        $output .= '	</select>
					</p>';
        return apply_filters('themify_generic_slider_controls', $output);
    }
    /**
     * Portfolio Slug
     * @param array $data
     * @return string
     */
    function themify_portfolio_slug($data = array())
    {
        $data = themify_get_data();
        $portfolio_slug = isset($data['themify_portfolio_slug']) ? $data['themify_portfolio_slug'] : apply_filters('themify_portfolio_rewrite', 'project');
        return '
			<p>
				<span class="label">' . __('Portfolio Base Slug', 'themify') . '</span>
				<input type="text" name="themify_portfolio_slug" value="' . $portfolio_slug . '" class="slug-rewrite">
				<br />
				<span class="pushlabel"><small>' . __('Use only lowercase letters, numbers, underscores and dashes.', 'themify') . '</small></span>
				<br />
				<span class="pushlabel"><small>' . sprintf(__('After changing this, go to <a href="%s">permalinks</a> and click "Save changes" to refresh them.', 'themify'), admin_url('options-permalink.php')) . '</small></span><br />
			</p>';
    }
    function widget($args, $instance)
    {
        extract($args);
        /* User-selected settings. */
        $title = apply_filters('widget_title', $instance['title']);
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Title of widget (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $data = themify_get_data();
        $pre = 'setting-link_';
        $out = '';
        $field_ids = isset($data[$pre . 'field_ids']) ? json_decode($data[$pre . 'field_ids']) : '';
        if (is_array($field_ids) || is_object($field_ids)) {
            $show_link_name = isset($instance['show_link_name']) && $instance['show_link_name'] ? true : false;
            $open_new_window = isset($instance['open_new_window']) && $instance['open_new_window'] ? true : false;
            $new_window_attr = $open_new_window ? 'target="_blank"' : '';
            $icon_type = themify_check($pre . 'icon_type') ? themify_get($pre . 'icon_type') : 'image-icon';
            // Icon Size
            $icon_size = isset($instance['icon_size']) && '' != $instance['icon_size'] ? $instance['icon_size'] : 'icon-medium';
            // Orientation
            $orientation = isset($instance['orientation']) && '' != $instance['orientation'] ? $instance['orientation'] : 'horizontal';
            $out .= '<ul class="social-links ' . $orientation . '">';
            foreach ($field_ids as $key => $fid) {
                $type_val = isset($data[$pre . 'type_' . $fid]) ? $data[$pre . 'type_' . $fid] : '';
                if ($type_val != $icon_type) {
                    continue;
                }
                $title_name = $pre . 'title_' . $fid;
                if (function_exists('icl_t')) {
                    $title_val = icl_t('Themify', $title_name, $data[$title_name]);
                } else {
                    $title_val = isset($data[$title_name]) ? $data[$title_name] : '';
                }
                $link_name = $pre . 'link_' . $fid;
                $link_val = isset($data[$link_name]) ? trim($data[$link_name]) : '';
                if ('' == $link_val) {
                    continue;
                }
                // Image Icon
                $img_name = $pre . 'img_' . $fid;
                $img_val = !isset($data[$img_name]) || '' == $data[$img_name] ? '' : '<img src="' . $data[$img_name] . '" />';
                // Font Icon
                $font_icon = '';
                if ($font_icon_class = themify_get($pre . 'ficon_' . $fid)) {
                    $fi_style = '';
                    $font_icon_class = 'fa ' . $font_icon_class;
                    if (stripos($font_icon_class, 'icon-') !== false) {
                        $font_icon_class = str_replace('icon-', 'fa-', $font_icon_class);
                    }
                    if ($font_icon_color = themify_get($pre . 'ficolor_' . $fid)) {
                        $fi_style .= 'color: #' . $font_icon_color . ';';
                    }
                    if ($font_icon_bgcolor = themify_get($pre . 'fibgcolor_' . $fid)) {
                        $fi_style .= 'background-color: #' . $font_icon_bgcolor . ';';
                    }
                    if ('' != $fi_style) {
                        $fi_style = 'style="' . $fi_style . '"';
                    }
                    $font_icon = '<i class="' . $font_icon_class . '" ' . $fi_style . '></i>';
                }
                if ('' != $link_val) {
                    $out .= sprintf('
							<li class="social-link-item %s %s %s">
								<a href="%s" title="%s" %s>%s %s %s</a>
							</li>
							<!-- /themify-link-item -->', sanitize_title($title_val), $icon_type, $icon_size, esc_attr($link_val), $title_val, $new_window_attr, $font_icon, $img_val, $show_link_name ? $title_val : '');
                }
            }
            $out .= '</ul>';
        }
        echo $out;
        /* After widget (defined by themes). */
        echo $after_widget;
    }
 function config_view($data = array())
 {
     $data = themify_get_data();
     $field_ids_json = isset($data["{$this->pre}_field_ids"]) ? $data["{$this->pre}_field_ids"] : '';
     $field_ids = json_decode($field_ids_json);
     if (!is_array($field_ids)) {
         $field_ids = array();
     }
     $out = '<div class="themify-info-link">' . sprintf(__('Use <a href="%s">Hook Content</a> to add content to the theme without editing any template file.', 'themify'), 'http://themify.me/docs/hook-content') . '</div>';
     $out .= '<ul id="hook-content-list">';
     if (!empty($field_ids)) {
         foreach ($field_ids as $key => $value) {
             $out .= $this->item_template($value);
         }
     }
     $out .= '</ul>';
     $out .= '<p class="add-link themify-add-hook alignleft"><a href="#">' . __('Add item', 'themify') . '</a></p>';
     $out .= '<a class="button button-secondary see-hook-locations alignright" href="' . add_query_arg(array('tp' => 1), home_url()) . '">' . __('See Hook Locations', 'themify') . '</a>';
     $out .= '<input type="hidden" id="themify-hooks-field-ids" name="' . esc_attr($this->pre . '_field_ids') . '" value=\'' . json_encode($field_ids) . '\' />';
     return $out;
 }
 /**
  * Get module php files data
  * @param string $select
  * @return array
  */
 function get_modules($select = 'all')
 {
     $files = array();
     $file_names = apply_filters('themify_builder_modules_list', array('accordion', 'box', 'callout', 'divider', 'gallery', 'highlight', 'image', 'map', 'menu', 'portfolio', 'post', 'slider', 'tab', 'testimonial', 'text', 'video', 'widget', 'widgetized'));
     foreach ($file_names as $file_name) {
         $tmp = THEMIFY_BUILDER_MODULES_DIR . '/module-' . $file_name . '.php';
         if (file_exists($tmp)) {
             $files[$file_name] = $tmp;
         }
     }
     $modules = array();
     if (count($files) > 0) {
         foreach ($files as $key => $value) {
             $path_info = pathinfo($value);
             $name = explode('-', $path_info['filename']);
             $name = $name[1];
             $modules[$name] = array('name' => $name, 'dirname' => $path_info['dirname'], 'extension' => $path_info['extension'], 'basename' => $path_info['basename']);
         }
     }
     if ('active' == $select) {
         $pre = 'setting-page_builder_';
         $data = themify_get_data();
         if (count($modules) > 0) {
             foreach ($modules as $key => $m) {
                 $exclude = $pre . 'exc_' . $m['name'];
                 if (isset($data[$exclude])) {
                     unset($modules[$m['name']]);
                 }
             }
         }
     }
     return $modules;
 }