Beispiel #1
0
function builder_handle_theme_activation($old_theme_name, $old_theme = false)
{
    if (false != get_option('builder_manually_switched_theme')) {
        delete_option('builder_manually_switched_theme');
        return;
    }
    if (false !== $old_theme) {
        $GLOBALS['builder_old_theme'] = $old_theme;
    }
    //	$switch_to_setup_screen = false;
    $default_layouts = builder_get_theme_setting('activation_default_layouts');
    $child_theme_setup = builder_get_theme_setting('activation_child_theme_setup');
    if (get_template_directory() != get_stylesheet_directory()) {
        $child_theme_setup = 'ignore';
    }
    //	if ( ( 'ignore' != $default_layouts ) && ( 'ignore' != $child_theme_setup ) )
    //		$switch_to_setup_screen = true;
    //	if ( 'use' == $default_layouts )
    //		add_filter( 'it_storage_filter_load_layout_settings', 'builder_import_theme_default_layouts_and_views', 20 );
    if ('create' == $child_theme_setup) {
        require_once builder_main_get_builder_core_path() . '/lib/setup/init.php';
        add_action('wp_loaded', 'builder_create_child_theme');
    }
    //	if ( $switch_to_setup_screen ) {
    if (current_theme_supports('builder-my-theme-menu')) {
        add_action('admin_head', 'builder_show_setup_tab_notice');
        wp_redirect(admin_url('admin.php?page=theme-settings&editor_tab=setup&theme_activation=1'));
    }
    //	}
}
Beispiel #2
0
function builder_get_closed_comments_message($default_message, $before = '<div id="respond"><p class="nocomments comments-closed">', $after = '</p></div>')
{
    $setting = builder_get_theme_setting('comments_disabled_message');
    $message = '';
    if ('standard' === $setting) {
        $message = $default_message;
    } else {
        if ('custom' === $setting) {
            $message = builder_get_theme_setting('comments_disabled_message_custom_message');
        }
    }
    $message = apply_filters('builder_filter_closed_comments_message', $message);
    if (empty($message)) {
        return '';
    }
    return $before . $message . $after;
}
Beispiel #3
0
 function _format_content($content)
 {
     if ('yes' == builder_get_theme_setting('widget_content_the_content_filter')) {
         return apply_filters('the_content', $content);
     }
     $content = wptexturize($content);
     $content = convert_smilies($content);
     $content = convert_chars($content);
     $content = wpautop($content);
     $content = shortcode_unautop($content);
     $content = prepend_attachment($content);
     $content = do_shortcode($content);
     return $content;
 }
Beispiel #4
0
 function _render($fields)
 {
     $data = $fields['data'];
     if (is_numeric($data['type'])) {
         if (function_exists('is_nav_menu') && is_nav_menu($data['type'])) {
             $menu = wp_get_nav_menu_object($data['type']);
             wp_nav_menu(array('menu' => $data['type'], 'container_class' => "menu-{$menu->slug}-container {$fields['class_prefix']}-navigation-menu-wrapper"));
         }
     } else {
         echo "<div class='{$fields['class_prefix']}-navigation-menu-wrapper'>\n";
         echo "<ul class='menu'>\n";
         if ('pages' === $data['type']) {
             $include_pages_setting = builder_get_theme_setting('include_pages');
             if (!empty($include_pages_setting)) {
                 if (in_array('home', (array) $include_pages_setting)) {
                     $classes = 'home';
                     if (is_front_page()) {
                         $classes .= ' current_page_item';
                     }
                     $link = get_option('home');
                     $link = ITUtility::fix_url($link);
                     echo "<li class='{$classes}'><a href='{$link}'>" . __('Home', 'it-l10n-Builder-Cohen') . "</a></li>\n";
                 }
                 if (in_array('site_name', (array) $include_pages_setting)) {
                     $classs = 'site-name';
                     if (is_front_page()) {
                         $classes .= ' current_page_item';
                     }
                     $link = get_option('home');
                     $link = ITUtility::fix_url($link);
                     $link_text = get_bloginfo('name');
                     echo "<li class='{$classes}'><a href='{$link}'>{$link_text}</a></li>\n";
                 }
                 $include_page_ids = array();
                 foreach ((array) $include_pages_setting as $include_page_id) {
                     if (is_numeric($include_page_id)) {
                         $include_page_ids[] = $include_page_id;
                     }
                 }
                 $exclude_page_ids = apply_filters('wp_list_pages_excludes', array());
                 $include_page_ids = array_diff((array) $include_page_ids, (array) $exclude_page_ids);
                 if (!empty($include_page_ids)) {
                     $include = implode(',', (array) $include_page_ids);
                     $my_pages = "title_li=&depth=0&include={$include}";
                     wp_list_pages($my_pages);
                 }
             }
         } else {
             if ('categories' === $data['type']) {
                 $include_cats_setting = builder_get_theme_setting('include_cats');
                 if (!empty($include_cats_setting)) {
                     $include = implode(',', (array) $include_cats_setting);
                     $my_cats = "title_li=&depth=0&include={$include}";
                     wp_list_categories($my_cats);
                 }
             } else {
                 wp_list_pages('title_li=');
             }
         }
         echo "</ul>\n</div>\n";
     }
 }
Beispiel #5
0
function builder_custom_post_gallery($output, $attr)
{
    global $post, $wp_locale;
    static $instance = 0;
    $instance++;
    // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (empty($attr['orderby'])) {
            unset($attr['orderby']);
        }
    }
    $defaults = array('builder' => 'on', 'captiontag' => 'dd', 'columns' => '', 'exclude' => '', 'icontag' => 'dt', 'id' => $post->ID, 'include' => '', 'itemtag' => 'dl', 'link' => 'attachment', 'margin' => '5px', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'size' => 'thumbnail');
    $defaults = apply_filters('builder_filter_gallery_default_attributes', $defaults);
    $attr = shortcode_atts($defaults, $attr);
    extract($attr);
    if ('off' == $builder) {
        return $output;
    }
    if ('auto' != $columns) {
        if (!is_numeric($columns)) {
            $columns = '';
        } else {
            if ($columns < 1) {
                $columns = 1;
            }
        }
        if (empty($columns)) {
            if ('auto' == builder_get_theme_setting('gallery_default_render_method')) {
                $columns = 'auto';
            } else {
                $columns = 3;
            }
        }
    }
    $id = intval($id);
    if ('RAND' === $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $include = preg_replace('/[^0-9,]+/', '', $include);
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } else {
        if (!empty($exclude)) {
            $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
            $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        } else {
            $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        }
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $itemtag = tag_escape($itemtag);
    $captiontag = tag_escape($captiontag);
    $float = 'rtl' === $wp_locale->text_direction ? 'right' : 'left';
    $selector = "gallery-{$instance}";
    $size_class = sanitize_html_class($size);
    if ('auto' != $columns && apply_filters('use_default_gallery_style', true, $attr)) {
        $itemwidth = 100 / $columns;
        ob_start();
        ?>
	<style type="text/css" scoped="scoped">
		#<?php 
        echo $selector;
        ?>
 {
			clear: both;
		}
		#<?php 
        echo $selector;
        ?>
 .gallery-item-wrapper {
			float: <?php 
        echo $float;
        ?>
;
			margin: 0;
			padding: 0;
			width: <?php 
        echo $itemwidth;
        ?>
%;
		}
		#ie6 #<?php 
        echo $selector;
        ?>
 .gallery-item-wrapper,
		#ie7 #<?php 
        echo $selector;
        ?>
 .gallery-item-wrapper {
			width: <?php 
        echo floor($itemwidth);
        ?>
%;
		}
		#<?php 
        echo $selector;
        ?>
 .gallery-item {
			display: block;
			float: none;
			margin: <?php 
        echo $margin;
        ?>
;
			width: auto !important;
		}
		#ie6 #<?php 
        echo $selector;
        ?>
 .gallery-item {
			display: inline;
		}
		#<?php 
        echo $selector;
        ?>
 .gallery-icon a {
			display: block;
			line-height: 0;
		}
		#<?php 
        echo $selector;
        ?>
 img {
			width: 100% !important;
			max-width: 100% !important;
			height: auto !important;
		}
		#<?php 
        echo $selector;
        ?>
 .gallery-caption {
			overflow: hidden;
		}
		#ie6 #<?php 
        echo $selector;
        ?>
 .gallery-caption {
			word-wrap: break-word;
		}
	</style>
<?php 
        $output .= ob_get_clean();
    }
    $output .= "<div id='{$selector}' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class} clearfix'>\n";
    $output = apply_filters('gallery_style', $output);
    $count = 0;
    foreach ($attachments as $id => $attachment) {
        if ('file' == $attr['link']) {
            $link = wp_get_attachment_link($id, $size);
        } else {
            if ('none' == $attr['link']) {
                $link = wp_get_attachment_image($id, $size);
            } else {
                $link = wp_get_attachment_link($id, $size, true);
            }
        }
        if ($captiontag && trim($attachment->post_excerpt)) {
            $gallery_item_wrapper_class = 'gallery-item-wrapper gallery-item-wrapper-with-caption';
            $gallery_item_class = 'gallery-item gallery-item-with-caption';
        } else {
            $gallery_item_wrapper_class = 'gallery-item-wrapper';
            $gallery_item_class = 'gallery-item';
        }
        if (is_numeric($columns)) {
            $output .= "<div class='{$gallery_item_wrapper_class}'>\n";
        }
        $output .= "<{$itemtag} class='{$gallery_item_class}'>";
        $output .= "\n\t\t\t<{$icontag} class='gallery-icon'>\n\t\t\t\t{$link}\n\t\t\t</{$icontag}>";
        if ($captiontag && trim($attachment->post_excerpt)) {
            $output .= "\n\t\t\t\t<{$captiontag} class='gallery-caption'>\n\t\t\t\t" . wptexturize($attachment->post_excerpt) . "\n\t\t\t\t</{$captiontag}>";
        }
        $output .= "</{$itemtag}>\n";
        if (is_numeric($columns)) {
            $output .= "</div>\n";
        }
        if (is_numeric($columns) && 0 == ++$count % $columns) {
            $output .= '<br style="clear: both" />';
        }
    }
    if (is_numeric($columns) && 0 != $count % $columns) {
        $output .= '<br style="clear: both" />';
    }
    $output .= "</div>\n";
    return $output;
}
Beispiel #6
0
function builder_get_theme_option($name)
{
    return builder_get_theme_setting($name);
}
Beispiel #7
0
function it_builder_load_theme_features()
{
    global $wp_version;
    $path = dirname(dirname(__FILE__));
    it_classes_load('it-cache.php');
    require $path . '/import-export/init.php';
    require $path . '/widgets/init.php';
    require $path . '/data/init.php';
    require $path . '/theme-settings/init.php';
    require $path . '/layout-engine/init.php';
    require $path . '/title/init.php';
    $file_cache = builder_theme_supports('builder-file-cache') ? true : false;
    $GLOBALS['builder_cache'] = new ITCache('builder-core', array('enable_file_cache' => $file_cache));
    $GLOBALS['builder_cache']->add_content_type('javascript-footer', 'javascript-footer.js', 'text/javascript', array('async_load' => true));
    $GLOBALS['builder_cache']->add_content_filter('javascript', 'builder_filter_javascript_content');
    $GLOBALS['builder_cache']->add_content_filter('javascript-footer', 'builder_filter_javascript_footer_content');
    $GLOBALS['builder_cache']->add_content_filter('css', 'builder_filter_css_content');
    if (builder_theme_supports('builder-my-theme-menu')) {
        require $path . '/tutorials/init.php';
    }
    // Compatibility check for pre-3.0 automatic-feed-links support
    if (version_compare($wp_version, '2.9.7', '<=') && builder_theme_supports('automatic-feed-links') && function_exists('automatic_feed_links')) {
        automatic_feed_links();
    }
    if (builder_theme_supports('builder-extensions')) {
        require $path . '/extensions/init.php';
    }
    if (builder_theme_supports('builder-admin-bar')) {
        require $path . '/admin-bar/init.php';
    }
    if (builder_theme_supports('builder-plugin-features')) {
        require $path . '/plugin-features/init.php';
    }
    if (builder_theme_supports('builder-3.0')) {
        add_theme_support('loop-standard');
    }
    if (builder_theme_supports('loop-standard')) {
        require $path . '/loop-standard/functions.php';
    }
    if (builder_theme_supports('builder-responsive')) {
        add_theme_support('builder-percentage-widths');
        add_theme_support('builder-responsive-ready');
        require $path . '/responsive/init.php';
    }
    if (builder_theme_supports('builder-gallery-shortcode')) {
        require $path . '/gallery-shortcode/init.php';
    }
    if ('on' == builder_get_theme_setting('dashboard_favicon')) {
        add_action('admin_enqueue_scripts', 'builder_add_favicon', 0);
    }
    do_action('builder_theme_features_loaded');
}
Beispiel #8
0
function builder_generate_gosquared_code($content)
{
    if (!builder_get_theme_setting('gosquared_enable')) {
        return $content;
    }
    $site_token = builder_get_theme_setting('gosquared_site_token');
    if (empty($site_token)) {
        return $content;
    }
    ob_start();
    ?>
var GoSquared={};
GoSquared.acct = "<?php 
    echo $site_token;
    ?>
";

(function(w){
	w._gstc_lt=+(new Date); var d=document;
	var g = d.createElement("script"); g.type = "text/javascript"; g.async = true; g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
	var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(g, s);
})(window);
<?php 
    $script = ob_get_contents();
    ob_end_clean();
    if (!empty($content)) {
        $content .= "\n";
    }
    return $content . $script;
}
			ev=new WoopraEvent('download',{});
			ev.addProperty('url',link.href);
			ev.fire();
			pntr.sleep(100);
		}
		if (!_download&&link.hostname != location.host && link.hostname.indexOf('javascript')==-1 && link.hostname!=''){
			ev=new WoopraEvent('exit',{});
			ev.addProperty('url',link.href);
			ev.fire();
			pntr.sleep(400);
		}
	}

}
<?php 
if (builder_get_theme_setting('google_analytics_enable') && builder_get_theme_setting('google_analytics_action_tracker_download_links')) {
    ?>
function builder_ga_track_event( category, action, label, value ) {
	try {
		var ga_args = ['_trackEvent', category, action];
		
		if ( 'undefined' !== typeof( label ) ) {
			ga_args.push( label );
			
			if ( 'undefined' !== typeof( value ) )
				ga_args.push( value );
		}
		
		_gaq.push(ga_args);
	}catch(err){}
}