示例#1
0
 public static function add_editor_style($css)
 {
     if (HeadwayOption::get('disable-editor-style', false, false)) {
         return $css;
     }
     if (!current_theme_supports('editor-style')) {
         return $css;
     }
     if (!current_theme_supports('headway-design-editor')) {
         return $css;
     }
     HeadwayCompiler::register_file(array('name' => 'editor-style', 'format' => 'css', 'fragments' => array('headway_content_block_editor_style'), 'dependencies' => array(HEADWAY_LIBRARY_DIR . '/blocks/content/editor-style.php'), 'enqueue' => false));
     return $css . ',' . HeadwayCompiler::get_url('editor-style');
 }
示例#2
0
 public static function maybe_run_trigger()
 {
     if (!self::is_trigger()) {
         return;
     }
     //Deactivate redirect so the weird 301's don't happen
     remove_action('template_redirect', 'redirect_canonical');
     add_filter('wp_redirect', '__return_false', 12);
     //Cycle through
     switch (headway_get('headway-trigger')) {
         case 'compiler':
             HeadwayCompiler::output_trigger();
             break;
         case 'layout-redirect':
             self::redirect_to_layout();
             break;
     }
     exit;
 }
示例#3
0
 public static function register_visual_editor_css()
 {
     if (!HeadwayRoute::is_visual_editor_iframe()) {
         return;
     }
     HeadwayCompiler::register_file(array('name' => 've-iframe', 'format' => 'less', 'fragments' => array(HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-loading.css', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-mixins.less', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-iframe.less', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-tooltips.less'), 'require-hard-flush' => true, 'iframe-cache' => true));
 }
示例#4
0
	<?php 
}
?>
    
    Responsive Grid: 	<?php 
echo HeadwayResponsiveGrid::is_enabled() ? 'Enabled' . "\n" : 'Disabled' . "\n";
?>
    
    Caching Allowed: 	<?php 
echo HeadwayCompiler::can_cache() ? 'Yes' . "\n" : 'No' . "\n";
?>
    Caching Enabled: 	<?php 
echo HeadwayCompiler::caching_enabled() ? 'Yes' . "\n" : 'No' . "\n";
?>
    Caching Plugin: 	<?php 
echo HeadwayCompiler::is_plugin_caching() ? HeadwayCompiler::is_plugin_caching() . "\n" : 'No caching plugin active' . "\n";
?>
    
	SEO Plugin: 		<?php 
echo HeadwaySEO::plugin_active() ? HeadwaySEO::plugin_active() . "\n" : 'No SEO plugin active' . "\n";
?>

    Operating System:	<?php 
echo ucwords($browser['platform']) . "\n";
?>
    Browser:			<?php 
echo $browser['name'] . "\n";
?>
    Browser Version:	<?php 
echo $browser['version'] . "\n";
?>
示例#5
0
 /**
  * Assembles the classes for the body element.
  **/
 public static function body_class($c)
 {
     global $wp_query, $authordata;
     $c[] = 'custom';
     /* User Agents */
     if (!HeadwayCompiler::is_plugin_caching()) {
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
         /* IE */
         if ($ie_version = headway_is_ie()) {
             $c[] = 'ie';
             $c[] = 'ie' . $ie_version;
         }
         /* Modern Browsers */
         if (stripos($user_agent, 'Safari') !== false) {
             $c[] = 'safari';
         } elseif (stripos($user_agent, 'Firefox') !== false) {
             $c[] = 'firefox';
         } elseif (stripos($user_agent, 'Chrome') !== false) {
             $c[] = 'chrome';
         } elseif (stripos($user_agent, 'Opera') !== false) {
             $c[] = 'opera';
         }
         /* Rendering Engines */
         if (stripos($user_agent, 'WebKit') !== false) {
             $c[] = 'webkit';
         } elseif (stripos($user_agent, 'Gecko') !== false) {
             $c[] = 'gecko';
         }
         /* Mobile */
         if (stripos($user_agent, 'iPhone') !== false) {
             $c[] = 'iphone';
         } elseif (stripos($user_agent, 'iPod') !== false) {
             $c[] = 'ipod';
         } elseif (stripos($user_agent, 'iPad') !== false) {
             $c[] = 'ipad';
         } elseif (stripos($user_agent, 'Android') !== false) {
             $c[] = 'android';
         }
     }
     /* End User Agents */
     /* Responsive Grid */
     if (HeadwayResponsiveGrid::is_enabled()) {
         $c[] = 'responsive-grid-enabled';
     }
     if (HeadwayResponsiveGrid::is_active()) {
         $c[] = 'responsive-grid-active';
     }
     /* Pages */
     if (is_page() && isset($wp_query->post) && isset($wp_query->post->ID)) {
         $c[] = 'pageid-' . $wp_query->post->ID;
         $c[] = 'page-slug-' . $wp_query->post->post_name;
     }
     /* Posts & Pages */
     if (is_singular() && isset($wp_query->post) && isset($wp_query->post->ID)) {
         //Add the custom classes from the meta box
         if ($custom_css_class = HeadwayLayoutOption::get($wp_query->post->ID, 'css-class', null)) {
             $custom_css_classes = str_replace('  ', ' ', str_replace(',', ' ', htmlspecialchars(strip_tags($custom_css_class))));
             $c = array_merge($c, array_filter(explode(' ', $custom_css_classes)));
         }
     }
     /* Layout IDs, etc */
     $c[] = 'layout-' . HeadwayLayout::get_current();
     $c[] = 'layout-using-' . HeadwayLayout::get_current_in_use();
     if (HeadwayRoute::is_visual_editor_iframe()) {
         $c[] = 've-iframe';
     }
     if (headway_get('ve-iframe-mode') && HeadwayRoute::is_visual_editor_iframe()) {
         $c[] = 'visual-editor-mode-' . headway_get('ve-iframe-mode');
     }
     if (!current_theme_supports('headway-design-editor')) {
         $c[] = 'design-editor-disabled';
     }
     $c = array_unique(array_filter($c));
     return $c;
 }
示例#6
0
 public static function enqueue_block_dynamic_js_file()
 {
     //Do not run these if it's the admin page or the visual editor is open
     if (is_admin() || HeadwayRoute::is_visual_editor()) {
         return false;
     }
     $current_layout_in_use = HeadwayLayout::get_current_in_use();
     $script_name = 'block-dynamic-js-layout-' . HeadwayLayout::get_current_in_use();
     $block_actions = self::get_blocks_for_dynamic_asset('js', $current_layout_in_use);
     if (empty($block_actions)) {
         return;
     }
     HeadwayCompiler::register_file(array('name' => $script_name, 'format' => 'js', 'fragments' => array(array('HeadwayBlocks', 'output_block_dynamic_js')), 'enqueue' => false));
     if (strlen((string) self::output_block_dynamic_js($current_layout_in_use)) > 0) {
         wp_enqueue_script($script_name, HeadwayCompiler::get_url($script_name), array('jquery'));
     }
 }
示例#7
0
    public static function menu_links()
    {
        echo '<li id="menu-link-tools" class="menu-link-has-submenu">
				<span>Tools</span>

				<ul>';
        // echo '<li id="tools-undo"><span>Undo <small>Ctrl + Z</small></span></li>
        // <li id="tools-redo"><span>Redo <small>Ctrl + Y</small></span></li>';
        if (HeadwayVisualEditor::is_mode('grid')) {
            echo '<li id="tools-grid-wizard"><span>Grid Wizard</span></li>';
        }
        if (!HeadwayVisualEditor::is_mode('grid') && current_theme_supports('headway-live-css')) {
            echo '<li id="tools-live-css"><span>Live CSS <small>Ctrl + E</small></span></li>';
        }
        if (HeadwayCompiler::can_cache()) {
            echo '<li id="tools-clear-cache"><span>Clear Cache' . (!HeadwayCompiler::caching_enabled() ? ' (Disabled)' : '') . '</span></li>';
        }
        echo '<li id="tools-tour"><span>Tour</span></li>
				</ul>

			</li>';
        echo '<li id="menu-link-admin" class="menu-link-has-submenu">
				<span>Admin</span>

				<ul>
					<li><a href="' . admin_url() . '" target="_blank">Dashboard</a></li>				
					<li><a href="' . admin_url('widgets.php') . '" target="_blank">Widgets</a></li>
					<li><a href="' . admin_url('nav-menus.php') . '" target="_blank">Menus</a></li>
					<li><a href="' . admin_url('admin.php?page=headway-options') . '" target="_blank">Headway Options</a></li>				
					<li><a href="http://docs.headwaythemes.com" target="_blank">Documentation</a></li>
					<li><a href="http://support.headwaythemes.com" target="_blank">Support</a></li>
				</ul>

			</li>';
        echo '<li id="menu-link-view-site"><a href="' . home_url() . '" target="_blank">View Site</a></li>';
    }
示例#8
0
 public static function enqueue_canvas_assets()
 {
     HeadwayCompiler::register_file(array('name' => 've-iframe-grid', 'format' => 'less', 'fragments' => array(HEADWAY_LIBRARY_DIR . '/media/css/reset.css', HEADWAY_LIBRARY_DIR . '/media/css/grid.css', HEADWAY_LIBRARY_DIR . '/media/css/block-basics.css', HEADWAY_LIBRARY_DIR . '/media/css/content-styling.css', HEADWAY_LIBRARY_DIR . '/media/css/alerts.css', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-loading.css', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-mixins.less', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-iframe.less', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-tooltips.less', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-iframe-grid.less', HEADWAY_LIBRARY_DIR . '/visual-editor/css/editor-iframe-grid-block-content.less'), 'require-hard-flush' => true, 'iframe-cache' => true));
     HeadwayCompiler::register_file(array('name' => 've-iframe-grid-dynamic', 'format' => 'css', 'fragments' => array(array('HeadwayDynamicStyle', 'wrapper')), 'dependencies' => array(HEADWAY_LIBRARY_DIR . '/media/dynamic/style.php')));
 }
 public static function method_clear_cache()
 {
     if (HeadwayCompiler::flush_cache(true) && HeadwayBlocks::clear_block_actions_cache()) {
         echo 'success';
     } else {
         echo 'failure';
     }
 }