コード例 #1
0
 /**
  * Checks if the user can access the visual editor.
  * 
  * @uses headway_user_level()
  * @uses HeadwayOption::get()
  *
  * @return bool
  **/
 public static function can_user_visually_edit($ignore_debug_mode = false)
 {
     if (!$ignore_debug_mode && HeadwayOption::get('debug-mode')) {
         return true;
     }
     return is_user_logged_in() && self::can_user('headway_visual_editor');
 }
コード例 #2
0
ファイル: functions.php プロジェクト: danaiser/hollandLawns
/**
 * Starts the GZIP output buffer.
 *
 * @return bool
 **/
function headway_gzip()
{
    //If zlib is not loaded, we can't gzip.
    if (!extension_loaded('zlib')) {
        return false;
    }
    //If zlib.output_compression is on, do not gzip
    if (ini_get('zlib.output_compression') == 1) {
        return false;
    }
    //If a cache system is active then do not gzip
    if (defined('WP_CACHE') && WP_CACHE) {
        return false;
    }
    //Allow headway_gzip filter to cancel gzip compression.
    if (!($gzip = apply_filters('headway_gzip', HeadwayOption::get('enable-gzip', false, true)))) {
        return false;
    }
    //If gzip has already happened, then just return.
    if (in_array('ob_gzhandler', ob_list_handlers())) {
        return;
    }
    ob_start('ob_gzhandler');
    return true;
}
コード例 #3
0
 public static function init()
 {
     if (!HeadwayCapabilities::can_user_visually_edit()) {
         return;
     }
     //If no child theme is active or if a child theme IS active and the grid is supported, use the grid mode.
     if (current_theme_supports('headway-grid')) {
         self::$modes['Grid'] = 'Add blocks and arrange your website structure';
     }
     self::$modes['Design'] = 'Choose fonts, colors, and other styles';
     //If the grid is disabled, set Design as the default mode.
     if (!current_theme_supports('headway-grid')) {
         self::$default_mode = 'design';
     }
     //Attempt to raise memory limit to max
     @ini_set('memory_limit', apply_filters('headway_memory_limit', WP_MAX_MEMORY_LIMIT));
     //Load libraries and content
     Headway::load('visual-editor/preview', 'VisualEditorPreview');
     //Put in action so we can run top level functions
     do_action('headway_visual_editor_init');
     //Visual Editor AJAX
     add_action('wp_ajax_headway_visual_editor', array(__CLASS__, 'ajax'));
     if (HeadwayOption::get('debug-mode')) {
         add_action('wp_ajax_nopriv_headway_visual_editor', array(__CLASS__, 'ajax'));
     }
     //Iframe handling
     add_action('headway_body_close', array(__CLASS__, 'iframe_load_flag'));
     add_action('headway_grid_iframe_footer', array(__CLASS__, 'iframe_load_flag'));
 }
コード例 #4
0
ファイル: maintenance.php プロジェクト: danaiser/hollandLawns
 /**
  * Over time, there may be issues to be corrected between updates or naming conventions to be changed between updates.
  * All of that will be processed here.
  **/
 public static function db_upgrade($db_version)
 {
     /* Pre-3.0.3 */
     if (version_compare($db_version, '3.0.3', '<')) {
         self::fix_serialization_in_db();
         self::repair_blocks();
     }
     /**
      * Pre-3.2.3
      * 
      * Change the old wrapper-horizontal-padding and wrapper-vertical-padding to design editor values
      **/
     if (version_compare($db_version, '3.2.3', '<')) {
         $horizontal_padding = HeadwayOption::get('wrapper-horizontal-padding', 'general', 15);
         $vertical_padding = HeadwayOption::get('wrapper-vertical-padding', 'general', 15);
         HeadwayElementsData::set_property('structure', 'wrapper', 'padding-top', $vertical_padding);
         HeadwayElementsData::set_property('structure', 'wrapper', 'padding-bottom', $vertical_padding);
         HeadwayElementsData::set_property('structure', 'wrapper', 'padding-left', $horizontal_padding);
         HeadwayElementsData::set_property('structure', 'wrapper', 'padding-right', $horizontal_padding);
     }
     /**
      * Pre-3.4
      * 
      * - Change block and wrapper margins to Design Editor values
      * - Convert Media blocks to Slider or Embed blocks
      **/
     if (version_compare($db_version, '3.4', '<')) {
         /* Change block and wrapper margins to Design Editor values */
         HeadwayElementsData::set_property('structure', 'wrapper', 'margin-top', HeadwayOption::get('wrapper-top-margin', 'general', 30));
         HeadwayElementsData::set_property('structure', 'wrapper', 'margin-bottom', HeadwayOption::get('wrapper-bottom-margin', 'general', 30));
         HeadwayElementsData::set_property('default-elements', 'default-block', 'margin-bottom', HeadwayOption::get('block-bottom-margin', 'general', 10));
         /* Convert Media blocks to Slider or Embed blocks */
         $media_blocks = HeadwayBlocksData::get_blocks_by_type('media');
         if (is_array($media_blocks) && count($media_blocks)) {
             foreach ($media_blocks as $media_block_id => $media_block_layout_id) {
                 $media_block = HeadwayBlocksData::get_block($media_block_id);
                 $media_block_mode = headway_get('mode', $media_block['settings'], 'embed');
                 switch ($media_block_mode) {
                     case 'embed':
                         HeadwayBlocksData::update_block($media_block['layout'], $media_block['id'], array('type' => 'embed'));
                         break;
                     case 'image-rotator':
                         $slider_images = array();
                         foreach (headway_get('images', $media_block['settings'], array()) as $media_block_image) {
                             $slider_images[] = array('image' => $media_block_image, 'image-description' => null, 'image-hyperlink' => null);
                         }
                         HeadwayBlocksData::update_block($media_block['layout'], $media_block['id'], array('type' => 'slider', 'settings' => array('images' => $slider_images)));
                         break;
                 }
             }
         }
     }
     /* Add action to flush caches */
     do_action('headway_db_upgrade');
     /* Update the version here. */
     $headway_settings = get_option('headway', array('version' => 0));
     $headway_settings['version'] = HEADWAY_VERSION;
     update_option('headway', $headway_settings);
     return true;
 }
コード例 #5
0
 public static function is_enabled()
 {
     //If the theme doesn't support the responsive grid, then disable it.
     if (!current_theme_supports('headway-grid') || !current_theme_supports('headway-responsive-grid')) {
         return false;
     }
     return HeadwayOption::get('enable-responsive-grid', false, false);
 }
コード例 #6
0
ファイル: footer.php プロジェクト: danaiser/hollandLawns
 /**
  * Echos the Powered By Headway link.
  * 
  * @uses HeadwayOption::get()
  *
  * @param string $text The name of the program to be displayed.  Defaults to Headway (obviously).
  * 
  * @return mixed
  **/
 public static function show_headway_link()
 {
     if (HeadwayOption::get('affiliate-link')) {
         $headway_location = strip_tags(HeadwayOption::get('affiliate-link'));
     } else {
         $headway_location = 'http://headwaythemes.com/';
     }
     echo apply_filters('headway_link', '<p class="footer-left footer-headway-link footer-link">' . __('Powered by Headway, the ', 'headway') . ' <a href="' . $headway_location . '" title="Headway Premium WordPress Theme">drag and drop WordPress theme</a></p>');
 }
コード例 #7
0
 public static function get_fonts_in_use()
 {
     /* If cache exists then use it */
     $cache = HeadwayOption::get('webfont-cache');
     if (is_array($cache)) {
         return $cache;
     }
     /* Build cache otherwise */
     self::cache();
     return HeadwayOption::get('webfont-cache');
 }
コード例 #8
0
ファイル: feed.php プロジェクト: danaiser/hollandLawns
 public static function feed_url($feed)
 {
     //Do not change the URL of comment feed URLs.
     if (strpos($feed, 'comment') !== false) {
         return $feed;
     }
     $feed_url = HeadwayOption::get('feed-url');
     //If the feed URL option doesn't have http[://] at the beginning, then we're a no go on changing the feed URL.
     if (!$feed_url || strpos($feed_url, 'http') !== 0) {
         return $feed;
     }
     return $feed_url;
 }
コード例 #9
0
ファイル: content.php プロジェクト: danaiser/hollandLawns
 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');
 }
コード例 #10
0
ファイル: route.php プロジェクト: danaiser/hollandLawns
 /**
  * Direct index.php to the appropriate function
  * 
  * @return bool
  **/
 public static function direct()
 {
     //If viewing the visual editor, stop the template loading and show the visual editor.
     if (self::is_visual_editor()) {
         //If user is logged in and can't visually edit, loop them back to normal template.
         if (is_user_logged_in() && !HeadwayCapabilities::can_user_visually_edit()) {
             wp_die('You have insufficient permissions to use the Headway Visual Editor.<br /><br /><a href="' . home_url() . '">Return to Home</a>');
             return false;
             //If the user isn't logged in at all, log 'em in and loop back to visual editor as long as debug mode isn't active
         } elseif (!is_user_logged_in() && !HeadwayOption::get('debug-mode')) {
             return auth_redirect();
         }
         HeadwayVisualEditor::display();
         die;
         //Theme Preview
     } elseif (self::is_theme_preview()) {
         return wp_die('Headway and Headway Child Themes cannot be previewed.  Please activate the theme if you wish to see how it looks.');
     } elseif (self::is_grid()) {
         Headway::load('visual-editor/iframe-grid');
         HeadwayVisualEditorIframeGrid::show();
         die;
     }
 }
コード例 #11
0
ファイル: compiler.php プロジェクト: danaiser/hollandLawns
 /**
  * @return bool
  **/
 public static function flush_cache($hard = false)
 {
     //Flush Headway cache if it is active.
     if (self::can_cache()) {
         //Delete the Headway cache option if hard flush otherwise delete the ones that aren't set to stay with soft flush
         if ($hard) {
             HeadwayOption::delete('cache');
         } else {
             $cache = HeadwayOption::get('cache');
             foreach ($cache as $cached_file_id => $cached_file) {
                 if (!headway_get('require-hard-flush', $cached_file, false)) {
                     unset($cache[$cached_file_id]);
                 }
             }
             HeadwayOption::set('cache', $cache);
         }
         //Set do not delete list
         $no_delete = array('..', '.');
         if ($handle = opendir(HEADWAY_CACHE_DIR)) {
             while (false !== ($file = readdir($handle))) {
                 if (in_array($file, $no_delete) || strpos($file, 'hard-cache') !== false && !$hard) {
                     continue;
                 }
                 @unlink(HEADWAY_CACHE_DIR . '/' . $file);
             }
             closedir($handle);
         }
     }
     //Flush plugin caches
     self::flush_plugin_caches();
     return true;
 }
コード例 #12
0
ファイル: layout.php プロジェクト: danaiser/hollandLawns
 public static function add_template($template_name = null, $blocks = null, $wrappers = null)
 {
     $templates = HeadwayOption::get('list', 'templates', array());
     $last_template_id = HeadwayOption::get('last-id', 'templates', 0);
     /* These  two variables be used for when a blocks/wrappers imported ID is different than the one that it ends up with... i.g. skin importing to line up instances */
     $block_id_translations = array();
     $wrapper_id_translations = array();
     /* Build name */
     $id = $last_template_id + 1;
     $template_name = $template_name ? $template_name : 'Template ' . $id;
     /* Add template to templates array so it can be sent to DB */
     $templates[$id] = $template_name;
     /* Send array to DB */
     HeadwayOption::set('list', $templates, 'templates');
     HeadwayOption::set('last-id', $id, 'templates');
     /* Add blocks and wrappers */
     if ($blocks && $wrappers) {
         /* Format wrappers */
         foreach ($wrappers as $wrapper_id => $wrapper_settings) {
             $old_wrapper_id = $wrapper_id;
             $new_wrapper = HeadwayWrappers::add_wrapper('template-' . $id, $wrapper_settings);
             $wrapper_id_translations[str_replace('wrapper-', '', $old_wrapper_id)] = array('id' => $new_wrapper['id'], 'layout' => 'template-' . $id);
         }
         /* Add blocks */
         foreach ($blocks as $block) {
             $old_block_id = $block['id'];
             unset($block['id']);
             unset($block['layout']);
             /* Update block's wrapper ID to match the real ID of the imported wrapper because if you link to the old ID from the export file then it won't match up */
             $block['wrapper'] = 'wrapper-' . $wrapper_id_translations[str_replace('wrapper-', '', $block['wrapper'])]['id'];
             $new_block_id = HeadwayBlocksData::add_block('template-' . $id, $block);
             $block_id_translations[$old_block_id] = $new_block_id;
         }
     }
     /* End adding wrappers and blocks */
     return array('id' => $id, 'name' => $template_name, 'block-id-translations' => $block_id_translations, 'wrapper-id-translations' => $wrapper_id_translations);
 }
コード例 #13
0
ファイル: api-updater.php プロジェクト: danaiser/hollandLawns
 public function update_notice()
 {
     if (!is_super_admin() || HeadwayOption::get('disable-update-notices', false, false) || !($update_info = $this->retrieve_update_info())) {
         return;
     }
     $changelog_url = headway_get('changelog_url', $update_info, false);
     $new_version = headway_get('new_version', $update_info);
     $valid_key = headway_get('is_valid_key', $update_info, false);
     if ($valid_key === true) {
         if (!$this->notify_only) {
             echo sprintf(__('<div id="update-nag">%s %s is now available, you\'re running %s! <a href="%s">Click here to update</a> or <a href="%s" target="_blank">learn more</a> about the update.</div>', 'headway'), $this->name, $new_version, $this->current_version, admin_url('update-core.php'), str_replace('{KEY}', headway_get_license_key(), $changelog_url));
         } else {
             echo sprintf(__('<div id="update-nag">%s %s is now available, you\'re running %s! Go to the <a href="%s" target="_blank">Headway Dashboard</a> to download the latest version or <a href="%s" target="_blank">learn more</a> about the update.</div>', 'headway'), $this->name, $new_version, $this->current_version, HEADWAY_DASHBOARD_URL, str_replace('{KEY}', headway_get_license_key(), $changelog_url));
         }
         return true;
     } else {
         switch ($valid_key) {
             case 'expired':
                 echo sprintf(__('<div id="update-nag">%s %s is now available, you\'re running %s!  Your Headway license has expired.  Please visit the <a href="%s">Headway Dashboard</a> to renew your license so you can continue to receive updates.</div>', 'headway'), $this->name, $new_version, $this->current_version, HEADWAY_DASHBOARD_URL);
                 break;
             default:
                 echo sprintf(__('<div id="update-nag">%s %s is now available, you\'re running %s!  You will not be able to update until you enter a valid license key on the <a href="%s">Headway Options</a> panel.</div>', 'headway'), $this->name, $new_version, $this->current_version, admin_url('admin.php?page=headway-options'));
                 break;
         }
         return false;
     }
 }
コード例 #14
0
ファイル: wrappers.php プロジェクト: danaiser/hollandLawns
 public static function get_grid_width($wrapper)
 {
     if (!is_array($wrapper)) {
         return false;
     }
     /* If wrapper is mirrored then use settings from it for the grid */
     if ($potential_wrapper_mirror = HeadwayWrappers::get_wrapper_mirror($wrapper)) {
         $wrapper = $potential_wrapper_mirror;
     }
     $column_width = headway_get('use-independent-grid', $wrapper) ? headway_get('column-width', $wrapper) : HeadwayOption::get('column-width', false, HeadwayWrappers::$default_column_width);
     $gutter_width = headway_get('use-independent-grid', $wrapper) ? headway_get('gutter-width', $wrapper) : HeadwayOption::get('gutter-width', false, HeadwayWrappers::$default_gutter_width);
     return $column_width * headway_get('columns', $wrapper) + (headway_get('columns', $wrapper) - 1) * $gutter_width;
 }
コード例 #15
0
ファイル: tools.php プロジェクト: danaiser/hollandLawns
    GD Support:			<?php 
echo function_exists('gd_info') ? "Yes\n" : "***WARNING*** No\n";
?>
    
    PHP Memory Limit:	<?php 
echo ini_get('memory_limit') . "\n";
?>
    PHP Post Max Size:	<?php 
echo ini_get('post_max_size') . "\n";
?>
    
    WP_DEBUG: 			<?php 
echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n";
?>
    Debug Mode: 		<?php 
echo HeadwayOption::get('debug-mode', false, false) ? 'Enabled' . "\n" : 'Disabled' . "\n";
?>
    
	Show On Front: 		<?php 
echo get_option('show_on_front') . "\n";
?>
	Page On Front: 		<?php 
echo get_option('page_on_front') . "\n";
?>
	Page For Posts: 	<?php 
echo get_option('page_for_posts') . "\n";
?>

	<?php 
if (!headway_get('exclude-counts')) {
    ?>
コード例 #16
0
 protected function modify_arguments($post = false)
 {
     //Do not use this box if the page being edited is the front page since they can edit the setting in the configuration.
     if (get_option('page_on_front') == headway_get('post') && get_option('show_on_front') == 'page') {
         $this->info = '<strong>Configure the SEO settings for this page (Front Page) in the Headway Search Engine Optimization settings tab in <a href="' . admin_url('admin.php?page=headway-options#tab-seo-content') . '" target="_blank">Headway &raquo; Configuration</a>.</strong>';
         $this->inputs = array();
         return;
     }
     //Setup the defaults for the title and checkboxes
     $current_screen = get_current_screen();
     $seo_templates_query = HeadwayOption::get('seo-templates', 'general', HeadwaySEO::output_layouts_and_defaults());
     $seo_templates = headway_get('single-' . $current_screen->id, $seo_templates_query, array());
     $title_template = str_replace(array('%sitename%', '%SITENAME%'), get_bloginfo('name'), headway_get('title', $seo_templates));
     echo '<input type="hidden" id="title-seo-template" value="' . $title_template . '" />';
     $this->inputs['noindex']['default'] = headway_get('noindex', $seo_templates);
     $this->inputs['nofollow']['default'] = headway_get('nofollow', $seo_templates);
     $this->inputs['noarchive']['default'] = headway_get('noarchive', $seo_templates);
     $this->inputs['nosnippet']['default'] = headway_get('nosnippet', $seo_templates);
     $this->inputs['noodp']['default'] = headway_get('noodp', $seo_templates);
     $this->inputs['noydir']['default'] = headway_get('noydir', $seo_templates);
 }
コード例 #17
0
ファイル: options.php プロジェクト: danaiser/hollandLawns
HeadwayAdminInputs::generate($form);
?>
						
			<h3 class="title title-hr">Admin</h3>
			
			<?php 
$form = array(array('type' => 'checkbox', 'label' => 'Version Number', 'checkboxes' => array(array('id' => 'hide-menu-version-number', 'label' => 'Hide Headway Version Number From Menu', 'checked' => HeadwayOption::get('hide-menu-version-number', false, false))), 'description' => 'Check this if you wish to have the Menu say "Headway" instead of "Headway ' . HEADWAY_VERSION . '"'), array('type' => 'checkbox', 'label' => 'Update Notices', 'checkboxes' => array(array('id' => 'disable-update-notices', 'label' => 'Disable Headway Update Notices', 'checked' => HeadwayOption::get('disable-update-notices', false, false))), 'description' => 'If you wish to hide the notices that appear when an update is available for Headway, check this.'), array('type' => 'checkbox', 'label' => 'Editor Style', 'checkboxes' => array(array('id' => 'disable-editor-style', 'label' => 'Disable Editor Style', 'checked' => HeadwayOption::get('disable-editor-style', false, false))), 'description' => 'By default, Headway will take any settings in the Design Editor and add them to <a href="http://codex.wordpress.org/TinyMCE" target="_blank">WordPress\' TinyMCE editor</a> style.  Use this option to prevent that.'));
HeadwayAdminInputs::generate($form);
?>
			
			<h3 class="title title-hr">Debugging</h3>
			
			<div class="alert alert-red"><p>The following option should only be checked if a member of the Headway Themes team asks you to do so.</p></div>
			
			<?php 
$form = array(array('type' => 'checkbox', 'label' => 'Debug Mode', 'checkboxes' => array(array('id' => 'debug-mode', 'label' => 'Enable Debug Mode', 'checked' => HeadwayOption::get('debug-mode', false, false))), 'description' => 'Having Debug Mode enabled will allow the Headway Themes team to access the Visual Editor for support purposes, but <strong>will not allow changes to be saved<strong>.'));
HeadwayAdminInputs::generate($form);
?>
			
		</div>
		
		
	</div>

	<div class="hr hr-submit" style="display: none;"></div>

	<p class="submit" style="display: none;">
		<input type="submit" name="headway-submit" value="Save Changes" class="button-primary headway-save" />
	</p>
	
</form>
コード例 #18
0
 public function display()
 {
     if (!$this->blocks) {
         return $this->display_no_blocks_message();
     }
     foreach ($this->wrappers as $wrapper_id => $wrapper_settings) {
         $wrapper_id_for_blocks = $wrapper_id;
         /* Check if mirroring.  If mirroring, change wrapper ID to the wrapper being mirrored and preserve original ID for a later class */
         if ($wrapper_being_mirrored = HeadwayWrappers::get_wrapper_mirror($wrapper_settings)) {
             $mirrored_wrapper_id = $wrapper_being_mirrored['id'];
             $wrapper_id_for_blocks = $mirrored_wrapper_id;
             foreach (HeadwayBlocksData::get_blocks_by_wrapper($wrapper_being_mirrored['layout'], $mirrored_wrapper_id) as $block_from_mirrored_wrapper) {
                 $this->blocks[$block_from_mirrored_wrapper['id']] = $block_from_mirrored_wrapper;
             }
         }
         /* Grab blocks belonging to this wrapper */
         $wrapper_blocks = array();
         foreach ($this->blocks as $block_id => $block) {
             if (headway_get('wrapper', $block, HeadwayWrappers::$default_wrapper_id) === $wrapper_id_for_blocks) {
                 $wrapper_blocks[$block_id] = $block;
             }
             /* If there's only one wrapper and the block does not have a proper ID or is default, move it to that wrapper */
             if (count($this->wrappers) === 1 && (headway_get('wrapper', $block) === null || headway_get('wrapper', $block) == 'wrapper-default' || !isset($this->wrappers[headway_get('wrapper', $block)]))) {
                 $wrapper_blocks[$block_id] = $block;
             }
         }
         /* Setup wrapper classes */
         $wrapper_column_width = headway_get('use-independent-grid', $wrapper_settings) ? headway_get('column-width', $wrapper_settings) : HeadwayOption::get('column-width', false, HeadwayWrappers::$default_column_width);
         $wrapper_gutter_width = headway_get('use-independent-grid', $wrapper_settings) ? headway_get('gutter-width', $wrapper_settings) : HeadwayOption::get('gutter-width', false, HeadwayWrappers::$default_gutter_width);
         $wrapper_classes = array('wrapper');
         $wrapper_classes[] = $wrapper_settings['fluid'] ? 'wrapper-fluid' : 'wrapper-fixed';
         $wrapper_classes[] = HeadwayResponsiveGrid::is_active() ? 'responsive-grid' : null;
         $wrapper_classes[] = headway_get('use-independent-grid', $wrapper_settings) ? 'independent-grid' : null;
         $wrapper_classes[] = 'grid-' . ($wrapper_settings['fluid-grid'] || HeadwayResponsiveGrid::is_enabled() ? 'fluid' : 'fixed') . '-' . $wrapper_settings['columns'] . '-' . $wrapper_column_width . '-' . $wrapper_gutter_width;
         $wrapper_classes[] = $wrapper_being_mirrored ? 'wrapper-mirroring-' . HeadwayWrappers::format_wrapper_id($mirrored_wrapper_id) : null;
         $last_wrapper_id = array_slice(array_keys($this->wrappers), -1, 1);
         $last_wrapper_id = $last_wrapper_id[0];
         $first_wrapper_id = array_keys($this->wrappers);
         $first_wrapper_id = $first_wrapper_id[0];
         if ($last_wrapper_id == $wrapper_id) {
             $wrapper_classes[] = 'wrapper-last';
         } else {
             if ($first_wrapper_id == $wrapper_id) {
                 $wrapper_classes[] = 'wrapper-first';
             }
         }
         /* Custom wrapper classes */
         $custom_css_classes = explode(' ', str_replace('  ', ' ', str_replace(',', ' ', htmlspecialchars(strip_tags(headway_get('css-classes', $wrapper_settings, ''))))));
         $wrapper_classes = array_merge($wrapper_classes, $custom_css_classes);
         /* Display the wrapper */
         do_action('headway_before_wrapper');
         echo '<div id="' . $wrapper_id . '" class="' . implode(' ', array_unique(array_filter($wrapper_classes))) . '">' . "\n\n";
         do_action('headway_wrapper_open');
         $wrapper = new HeadwayGridRenderer($wrapper_blocks, $wrapper_settings);
         $wrapper->render_grid();
         do_action('headway_wrapper_close');
         echo '</div><!-- .wrapper -->' . "\n\n";
         do_action('headway_after_wrapper');
         /* End displaying wrapper */
     }
 }
コード例 #19
0
ファイル: display.php プロジェクト: danaiser/hollandLawns
 public static function add_visual_editor_js_vars()
 {
     //Gather the URLs for the block types
     $block_types = HeadwayBlocks::get_block_types();
     $block_type_urls = array();
     foreach ($block_types as $block_type => $block_type_options) {
         $block_type_urls[$block_type] = $block_type_options['url'];
     }
     $block_styles = class_exists('HeadwayChildThemeAPI') ? HeadwayChildThemeAPI::get_block_style_classes() : array();
     $current_layout_status = HeadwayLayout::get_status(HeadwayLayout::get_current());
     $script_name = is_ssl() ? 'headway-ve-js-https' : 'headway-ve-js';
     wp_localize_script($script_name, 'Headway', array('ajaxURL' => admin_url('admin-ajax.php'), 'currentLayout' => HeadwayLayout::get_current(), 'currentLayoutName' => HeadwayLayout::get_name(HeadwayLayout::get_current()), 'currentLayoutCustomized' => $current_layout_status['customized'], 'currentLayoutTemplate' => $current_layout_status['template'], 'availableBlockID' => HeadwayBlocksData::get_available_block_id(), 'availableWrapperID' => HeadwayWrappers::get_available_wrapper_id(), 'headwayURL' => get_template_directory_uri(), 'siteURL' => site_url(), 'homeURL' => home_url(), 'adminURL' => admin_url(), 'mode' => HeadwayVisualEditor::get_current_mode(), 'designEditorSupport' => current_theme_supports('headway-design-editor'), 'siteName' => get_bloginfo('name'), 'siteDescription' => get_bloginfo('description'), 'security' => wp_create_nonce('headway-visual-editor-ajax'), 'ranTour' => json_encode(array('legacy' => HeadwayOption::get('ran-tour', false, false), 'grid' => HeadwayOption::get('ran-tour-grid', false, false), 'design' => HeadwayOption::get('ran-tour-design', false, false))), 'blockTypeURLs' => json_encode($block_type_urls), 'allBlockTypes' => json_encode($block_types), 'disableCodeMirror' => HeadwayOption::get('disable-codemirror', false, false), 'frontPage' => get_option('show_on_front', 'posts'), 'gridSupported' => current_theme_supports('headway-grid'), 'disableTooltips' => HeadwayOption::get('disable-visual-editor-tooltips', false, false), 'blockStyles' => $block_styles, 'responsiveGrid' => HeadwayResponsiveGrid::is_enabled(), 'designEditorProperties' => HeadwayVisualEditor::is_mode('design') ? json_encode(HeadwayElementProperties::get_properties()) : json_encode(array()), 'colorpickerSwatches' => HeadwayOption::get('colorpicker-swatches', false, array()), 'gridSafeMode' => HeadwayOption::get('grid-safe-mode', false, false), 'defaultGridColumnCount' => HeadwayWrappers::$default_columns, 'globalGridColumnWidth' => HeadwayWrappers::$global_grid_column_width, 'globalGridGutterWidth' => HeadwayWrappers::$global_grid_gutter_width, 'touch' => stripos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false ? true : false));
 }
コード例 #20
0
ファイル: api-panel.php プロジェクト: danaiser/hollandLawns
 public function render_input($input)
 {
     //Fill defaults
     $defaults = array('tooltip' => false, 'default' => false, 'callback' => null);
     //Merge defaults
     $input = array_merge($defaults, $input);
     //Fix up inputs
     $input = $this->parse_function_args($input);
     if (!isset($input['name']) || !isset($input['type'])) {
         return;
     }
     /* Set up main input variables */
     $input['name'] = strtolower($input['name']);
     $input['group'] = isset($input['group']) ? $input['group'] : $this->options_group;
     $input['tooltip'] = isset($input['tooltip']) && $input['tooltip'] != false ? $input['tooltip'] : false;
     /* Populate the value */
     $input['default'] = isset($input['default']) ? $input['default'] : null;
     if (isset($this->wrapper) && $this->wrapper && !isset($input['value'])) {
         $input['value'] = HeadwayWrappers::get_wrapper_setting($this->wrapper, $input['name'], $input['default']);
     } else {
         if (isset($this->block) && $this->block && !isset($input['value'])) {
             $input['value'] = HeadwayBlocksData::get_block_setting($this->block, $input['name'], $input['default']);
         } else {
             if (!isset($input['value'])) {
                 $input['value'] = HeadwayOption::get($input['name'], $input['group'], $input['default']);
             }
         }
     }
     /* Setup Attributes */
     $attributes_array = array('id' => isset($this->block) && $this->block ? 'input-' . $this->block['id'] . '-' . $input['name'] : 'input-' . $input['group'] . '-' . $input['name'], 'name' => $input['name'], 'data-group' => $input['group']);
     /* Set up the callback attribute */
     $attributes_array['data-callback'] = htmlspecialchars('(function(args){var input=args.input;var value=args.value;var block=args.block || null;' . $input['callback'] . '})');
     /* Set up data handler override if it's used */
     if (headway_get('data-handler-callback', $input)) {
         $attributes_array['data-data-handler-callback'] = htmlspecialchars('(function(args){' . $input['data-handler-callback'] . '})');
     }
     /* Set up toggle attribute */
     if (headway_get('toggle', $input)) {
         $attributes_array['data-toggle'] = htmlspecialchars(json_encode($input['toggle']));
     }
     /* No save attribute */
     if (headway_get('no-save', $input, false)) {
         $attributes_array['data-no-save'] = 'true';
     }
     /* Turn attributes array into a string for HTML */
     $input['attributes'] = '';
     foreach ($attributes_array as $attribute => $attribute_value) {
         $input['attributes'] .= $attribute . '="' . $attribute_value . '" ';
     }
     $input['attributes'] = trim($input['attributes']);
     /* If it's a repeater then handle it before it's handled as an input */
     if ($input['type'] == 'repeater') {
         return $this->repeater($input);
     }
     /* Handle regular input */
     if (method_exists($this, 'input_' . str_replace('-', '_', $input['type']))) {
         /* Handle all types except for raw HTML input */
         if ($input['type'] != 'raw-html') {
             echo '<div class="input input-' . $input['type'] . '" id="input-' . $input['name'] . '">';
             if ($input['tooltip']) {
                 echo '<div class="tooltip-button" title="' . htmlspecialchars($input['tooltip']) . '"></div>';
             }
             call_user_func(array($this, 'input_' . str_replace('-', '_', $input['type'])), $input);
             echo '</div><!-- #input-' . $input['name'] . ' -->';
         } else {
             call_user_func(array($this, 'input_' . str_replace('-', '_', $input['type'])), $input);
         }
     }
     /* End regular input handling */
 }
コード例 #21
0
 public static function delete_special_element_properties($element_group, $element_id, $special_element_type, $special_element_meta)
 {
     $element = HeadwayOption::get($element_id, 'design-editor-group-' . $element_group);
     /* Delete all special elements matching the meta and type */
     if (isset($element['special-element-' . $special_element_type][$special_element_meta])) {
         unset($element['special-element-' . $special_element_type][$special_element_meta]);
     }
     /* Send it back to DB */
     return HeadwayOption::set($element_id, $element, 'design-editor-group-' . $element_group);
 }
コード例 #22
0
ファイル: head.php プロジェクト: danaiser/hollandLawns
 /**
  * To promote caching on browsers, Headway can tell WordPress to not put in the query variables on the style and script URLs.
  **/
 public static function remove_dependency_query_vars($query)
 {
     if (!HeadwayOption::get('remove-dependency-query-vars', 'general', false) && !HeadwayRoute::is_visual_editor_iframe()) {
         return $query;
     }
     return remove_query_arg('ver', $query);
 }
コード例 #23
0
 public static function export_skin($skin_name = 'Unnamed', $include_live_css = false, $included_templates = false)
 {
     do_action('headway_before_export_skin');
     /* Set up variables */
     $element_data = HeadwayElementsData::get_all_elements();
     $skin = array('name' => $skin_name, 'element-data' => $element_data);
     if ($include_live_css) {
         $skin['live-css'] = HeadwayOption::get('live-css');
     }
     /* If templates are to be included then query for them and convert all mirrored blocks into original blocks by pulling their mirror target's settings */
     if (is_array($included_templates)) {
         $skin['templates'] = array();
         $white_listed_block_instances = array();
         $white_listed_wrapper_instances = array();
         foreach ($included_templates as $template_id) {
             $template_name = HeadwayLayout::get_name('template-' . $template_id);
             $template_blocks = HeadwayBlocksData::get_blocks_by_layout('template-' . $template_id);
             $template_wrappers = HeadwayWrappers::get_layout_wrappers('template-' . $template_id);
             /* Loop through each block in the template and check if it's mirrored.  If it is, replace it with the block that it's mirroring */
             foreach ($template_blocks as $template_block_index => $template_block) {
                 if (!($mirrored_block = HeadwayBlocksData::is_block_mirrored($template_block))) {
                     /* Allow this block's instances to be in the skin */
                     $white_listed_block_instances[] = $template_block['id'];
                     /* Delete mirror option in case it's present */
                     if (isset($template_blocks[$template_block_index]['settings']['mirror-block'])) {
                         unset($template_blocks[$template_block_index]['settings']['mirror-block']);
                     }
                     continue;
                 }
                 $template_blocks[$template_block_index]['id'] = $mirrored_block['id'];
                 $template_blocks[$template_block_index]['settings'] = $mirrored_block['settings'];
                 /* Allow this block's instances to be in the skin */
                 $white_listed_block_instances[] = $mirrored_block['id'];
             }
             /* Whitelist wrapper instances */
             foreach ($template_wrappers as $template_wrapper_id => $template_wrapper_settings) {
                 $white_listed_wrapper_instances[] = $template_wrapper_id;
             }
             $skin['templates'][$template_name] = $template_blocks;
             $skin['templates'][$template_name]['wrappers'] = $template_wrappers;
         }
     }
     /* Need to remove instances that aren't in the included templates and layout specific customizations from $element_data here */
     foreach ($skin['element-data'] as $element_id => $element) {
         /* Add in the element group that way it can be saved @since 3.4.8 */
         $element_registration = HeadwayElementAPI::get_element($element_id);
         $skin['element-data'][$element_id]['group'] = $element_registration['group'];
         /* Remove instances that aren't in this skin's templates */
         if (isset($element['special-element-instance'])) {
             /* White list doesn't exist, just remove all instances */
             if (!isset($white_listed_block_instances)) {
                 unset($skin['element-data'][$element_id]['special-element-instance']);
                 /* White List Exists, loop through each instance and check its ID */
             } else {
                 foreach ($skin['element-data'][$element_id]['special-element-instance'] as $instance_id => $properties) {
                     $instance_id_fragments = explode('-', $instance_id);
                     $instance_potential_block_id_search = preg_match('/\\bblock\\b\\-[0-9]+/', $instance_id, $instance_potential_block_id_search_results);
                     $instance_potential_block_id = str_replace('block-', '', end($instance_potential_block_id_search_results));
                     $instance_potential_wrapper_id = $instance_id_fragments[0] . '-' . $instance_id_fragments[1];
                     /* Wrapper instance conditional.  If a positive match, CONTINUE that way the unset doesn't happen */
                     if (strpos($instance_id, 'wrapper-') === 0 && in_array($instance_potential_wrapper_id, $white_listed_wrapper_instances)) {
                         continue;
                     } else {
                         if (strpos($instance_id, 'block-') !== false && is_numeric($instance_potential_block_id) && in_array($instance_potential_block_id, $white_listed_block_instances)) {
                             continue;
                         }
                     }
                     /* Delete the instance if it doesn't match the block OR wrapper whitelist */
                     unset($skin['element-data'][$element_id]['special-element-instance'][$instance_id]);
                 }
             }
         }
         /* Remove layout-specific customizations from the skin */
         if (isset($element['special-element-layout'])) {
             unset($skin['element-data'][$element_id]['special-element-layout']);
         }
     }
     /* Spit the file out */
     return self::to_json('Headway Skin - ' . $skin_name, 'skin', $skin);
 }
コード例 #24
0
ファイル: style.php プロジェクト: danaiser/hollandLawns
 static function live_css()
 {
     if (headway_get('visual-editor-open')) {
         return null;
     }
     return HeadwayOption::get('live-css');
 }
コード例 #25
0
ファイル: blocks.php プロジェクト: danaiser/hollandLawns
 public static function setup_block_actions()
 {
     /* If cache exists then use it */
     if (HeadwayOption::get('cached', 'block-actions-cache', false) && !(headway_get('ve-preview') && HeadwayCapabilities::can_user_visually_edit())) {
         self::$block_actions = array('init' => HeadwayOption::get('init', 'block-actions-cache', array()), 'enqueue' => HeadwayOption::get('enqueue', 'block-actions-cache', array()), 'dynamic-js' => HeadwayOption::get('dynamic-js', 'block-actions-cache', array()), 'dynamic-css' => HeadwayOption::get('dynamic-css', 'block-actions-cache', array()), 'block-objects' => HeadwayOption::get('block-objects', 'block-actions-cache', array()));
         return self::$block_actions;
     }
     /* Build the cache */
     $block_types = self::get_block_types();
     foreach ($block_types as $block_type => $block_type_options) {
         //Make sure that the block type has at least one of the following: init_action, enqueue_action, or dynamic_js
         if (!method_exists($block_type_options['class'], 'init_action') && !method_exists($block_type_options['class'], 'enqueue_action') && !(method_exists($block_type_options['class'], 'dynamic_js') || method_exists($block_type_options['class'], 'js_content')) && !method_exists($block_type_options['class'], 'dynamic_css')) {
             continue;
         }
         $blocks = HeadwayBlocksData::get_blocks_by_type($block_type);
         /* If there are no blocks for this type, skip it */
         if (!is_array($blocks) || count($blocks) === 0) {
             continue;
         }
         /* Go through each type and add a flag if the method exists */
         foreach ($blocks as $block_id => $layout_id) {
             /* Make sure that the layout is set to customized and not using a template */
             if (!HeadwayLayout::is_customized($layout_id) && strpos($layout_id, 'template-') === false) {
                 continue;
             }
             /* Retrieve block.  If it doesn't exist, skip it of course. */
             if (!($block = HeadwayBlocksData::get_block($block_id))) {
                 continue;
             }
             /* If layout ID is numeric (a post), change it to the single-POSTTYPE-ID format */
             if (is_numeric($layout_id)) {
                 $layout_id = 'single-' . get_post_type($layout_id) . '-' . $layout_id;
             }
             /* Init */
             if (method_exists($block_type_options['class'], 'init_action')) {
                 if (!isset(self::$block_actions['init'][$layout_id])) {
                     self::$block_actions['init'][$layout_id] = array();
                 }
                 if (!HeadwayBlocksData::is_block_mirrored($block)) {
                     self::$block_actions['init'][$layout_id][] = $block_id;
                 }
             }
             /* End Init */
             /* Enqueue */
             if (method_exists($block_type_options['class'], 'enqueue_action')) {
                 if (!isset(self::$block_actions['enqueue'][$layout_id])) {
                     self::$block_actions['enqueue'][$layout_id] = array();
                 }
                 self::$block_actions['enqueue'][$layout_id][] = $block_id;
             }
             /* End Enqueue */
             /* Dynamic JS */
             if (method_exists($block_type_options['class'], 'dynamic_js') || method_exists($block_type_options['class'], 'js_content')) {
                 if (!isset(self::$block_actions['dynamic-js'][$layout_id])) {
                     self::$block_actions['dynamic-js'][$layout_id] = array();
                 }
                 self::$block_actions['dynamic-js'][$layout_id][] = $block_id;
             }
             /* End JS Content */
             /* Dynamic CSS */
             if (method_exists($block_type_options['class'], 'dynamic_css')) {
                 if (!isset(self::$block_actions['dynamic-css'][$layout_id])) {
                     self::$block_actions['dynamic-css'][$layout_id] = array();
                 }
                 self::$block_actions['dynamic-css'][$layout_id][] = $block_id;
             }
             /* End Dynamic CSS */
             /* Add block to Block Objects Array */
             if (!isset(self::$block_actions['block-objects']) || !is_array(self::$block_actions['block-objects'])) {
                 self::$block_actions['block-objects'] = array();
             }
             if (!headway_get($block_id, self::$block_actions['block-objects'])) {
                 self::$block_actions['block-objects'][$block_id] = $block;
                 self::$block_actions['block-objects'][$block_id]['class'] = $block_type_options['class'];
                 self::$block_actions['block-objects'][$block_id]['layout'] = $layout_id;
             }
             /* End block objects array */
         }
     }
     /* Set the cache */
     HeadwayOption::set('init', self::$block_actions['init'], 'block-actions-cache');
     HeadwayOption::set('enqueue', self::$block_actions['enqueue'], 'block-actions-cache');
     HeadwayOption::set('dynamic-js', self::$block_actions['dynamic-js'], 'block-actions-cache');
     HeadwayOption::set('dynamic-css', self::$block_actions['dynamic-css'], 'block-actions-cache');
     HeadwayOption::set('block-objects', self::$block_actions['block-objects'], 'block-actions-cache');
     HeadwayOption::set('cached', true, 'block-actions-cache');
     return self::$block_actions;
 }
コード例 #26
0
ファイル: live-css.php プロジェクト: danaiser/hollandLawns
 public function content()
 {
     echo '<textarea id="live-css" name="live-css" data-group="general">' . HeadwayOption::get('live-css') . '</textarea>';
 }
コード例 #27
0
ファイル: admin.php プロジェクト: danaiser/hollandLawns
 public static function parent_menu()
 {
     $menu_setup = HeadwayOption::get('menu-setup', false, 'getting-started');
     /* Figure out the primary page */
     switch ($menu_setup) {
         case 'getting-started':
             $parent_menu = array('id' => 'getting-started', 'name' => 'Getting Started', 'callback' => array('HeadwayAdminPages', 'getting_started'));
             break;
         case 'visual-editor':
             $parent_menu = array('id' => 'visual-editor', 'name' => 'Visual Editor', 'callback' => array('HeadwayAdminPages', 'visual_editor'));
             break;
         case 'options':
             $parent_menu = array('id' => 'options', 'name' => 'Options', 'callback' => array('HeadwayAdminPages', 'options'));
             break;
     }
     return $parent_menu;
 }
コード例 #28
0
ファイル: seo.php プロジェクト: danaiser/hollandLawns
 public static function get_seo_templates($layout = false)
 {
     $seo_templates_query = HeadwayOption::get('seo-templates', 'general', self::output_layouts_and_defaults());
     if ($layout) {
         return headway_get(self::current_seo_layout(), $seo_templates_query, array());
     } else {
         return $seo_templates_query;
     }
 }
コード例 #29
0
 public static function secure_method_delete_template()
 {
     //Retreive templates
     $templates = HeadwayOption::get('list', 'templates', array());
     //Unset the deleted ID
     $id = headway_post('template_to_delete');
     //Delete template if it exists and send array back to DB
     if (isset($templates[$id])) {
         unset($templates[$id]);
         //Delete the blocks from the template
         HeadwayBlocksData::delete_by_layout('template-' . $id);
         //Delete all options from the template
         HeadwayLayoutOption::delete_all_from_layout('template-' . $id);
         //Delete template from templates list
         HeadwayOption::set('list', $templates, 'templates');
         do_action('headway_visual_editor_delete_template');
         echo 'success';
     } else {
         echo 'failure';
     }
 }