コード例 #1
0
ファイル: tab-setup.php プロジェクト: jimrucinski/Vine
 function _init()
 {
     require_once builder_main_get_builder_core_path() . '/lib/setup/init.php';
     if (!empty($_POST)) {
         $this->_handle_post_data();
     }
 }
コード例 #2
0
ファイル: editor.php プロジェクト: jimrucinski/Vine
 function BuilderLayoutEditor()
 {
     $this->_storage_version = builder_get_data_version('layout-settings');
     $this->_page_title = _x('Manage Layouts and Views', 'page title', 'it-l10n-Builder-Paige');
     $this->_menu_title = _x('Layouts & Views', 'menu title', 'it-l10n-Builder-Paige');
     $this->ITCoreClass();
     $this->_file = __FILE__;
     require_once builder_main_get_builder_core_path() . '/lib/layout-engine/layout-meta-box.php';
     // This action has to be pushed back in order to allow the after_switch_theme action to fire first.
     remove_action('init', array(&$this, 'init'), 0);
     add_action('init', array(&$this, 'init'), 1000);
 }
コード例 #3
0
ファイル: functions.php プロジェクト: jimrucinski/Vine
 function _setup_plugin_feature($plugin_feature)
 {
     $dir = "plugin-features/{$plugin_feature}";
     $template = locate_template("{$dir}/init.php", true);
     if (empty($template) && file_exists(builder_main_get_builder_core_path() . "/{$dir}/init.php")) {
         require_once builder_main_get_builder_core_path() . "/{$dir}/init.php";
     }
     if (!is_admin()) {
         it_classes_load('it-file-utility.php');
         $file = locate_template("{$dir}/style.css");
         if (!empty($file)) {
             $url = ITFileUtility::get_url_from_file($file);
             $this->_style_queue[] = array($plugin_feature, $url);
         }
         $file = locate_template("{$dir}/script.js");
         if (!empty($file)) {
             $url = ITFileUtility::get_url_from_file($file);
             $this->_script_queue[] = array($plugin_feature, $url);
         }
     }
     if (!empty($this->_style_queue) || !empty($this->_script_queue)) {
         add_action('wp_enqueue_scripts', array($this, 'enqueue_files'));
     }
 }
コード例 #4
0
ファイル: functions.php プロジェクト: jimrucinski/Vine
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'));
    }
    //	}
}
コード例 #5
0
ファイル: module.php プロジェクト: jimrucinski/Vine
 function _render($fields)
 {
     $data = $fields['data'];
     if (!empty($data['attachment'])) {
         if (!wp_attachment_is_image($data['attachment'])) {
             return;
         }
         $post = get_post($data['attachment']);
         $file = get_attached_file($data['attachment']);
     } else {
         if (!empty($data['manual_file'])) {
             $file = builder_main_get_builder_core_path() . '/lib/layout-engine/default-images/' . $data['manual_file'];
             if (!file_exists($file)) {
                 return;
             }
         }
     }
     $image_width = $fields['widths']['element_width'];
     it_classes_load('it-file-utility.php');
     if ('custom' == $data['height_type']) {
         $resized_image = ITFileUtility::resize_image($file, $image_width, $data['height'], true);
     } else {
         $resized_image = ITFileUtility::resize_image($file, $image_width);
     }
     if (!is_array($resized_image) && is_wp_error($resized_image)) {
         echo "<!-- Resize Error: " . $resized_image->get_error_message() . " -->";
     } else {
         $image_url = $resized_image['url'];
     }
     if (!empty($data['url'])) {
         $attributes['href'] = $data['url'];
         if (!empty($data['new_window'])) {
             $attributes['target'] = '_blank';
         }
         ITUtility::print_open_tag('a', $attributes);
     }
     if (!empty($data['image_alt'])) {
         $alt = $data['image_alt'];
     }
     if (empty($alt)) {
         $alt = get_post_meta($data['attachment'], '_wp_attachment_image_alt', true);
     }
     if (empty($alt)) {
         $alt = $data['name'];
     }
     $attributes = array('src' => $image_url, 'alt' => $alt);
     $new_attributes = apply_filters('builder_image_module_filter_img_attributes', $attributes, $fields);
     if (empty($new_attributes)) {
         $new_attributes = $attributes;
     } else {
         if (empty($new_attributes['src'])) {
             $new_attributes['src'] = $attributes['src'];
         }
     }
     $attributes = $new_attributes;
     ITUtility::print_self_closing_tag('img', $attributes);
     if (!empty($data['url'])) {
         echo "</a>";
     }
 }
コード例 #6
0
ファイル: tab-basic.php プロジェクト: jimrucinski/Vine
        function meta_box_favicon($form)
        {
            $preset_files = glob(builder_main_get_builder_core_path() . '/favicons/*.png');
            $presets = array();
            foreach ((array) $preset_files as $file) {
                $base = basename($file);
                $name = ucwords(preg_replace('/[\\-_]+/', ' ', preg_replace('/\\.[^.]+$/', '', $base)));
                $file = preg_replace('/\\.[^.]+$/', '', $base);
                $presets[$file] = $name;
            }
            natcasesort($presets);
            if ('' == $form->get_option('favicon_preset')) {
                $form->set_option('favicon_preset', key($presets));
            }
            ?>
	<p><?php 
            _e('Favicons are small images that are used in a variety of ways, but the one most people are familiar with is that the Favicon is the small image used next to the title of a site in browser tabs. This makes it easy for people to quickly identify specific sites just by skimming the images on the tabs.', 'it-l10n-Builder-Cohen');
            ?>
</p>
	<hr />
	
	<p><?php 
            _e('The following options allow you to control the Favicon settings for your site. You can select from a few built-in options, upload your own image to use, or opt for the minimalist route by disabling the Favicon entirely.', 'it-l10n-Builder-Cohen');
            ?>
</p>
	
	<ul class="no-bullets">
		<li>
			<label for="favicon_option-preset"><?php 
            $form->add_radio('favicon_option', array('value' => 'preset', 'class' => 'show-hide-toggle'));
            ?>
 <?php 
            _e('Choose from a set of provided images (default)', 'it-l10n-Builder-Cohen');
            ?>
</label>
			<?php 
            ITUtility::add_tooltip(__('Don\'t have your own image that you want to use? Try one of ours.', 'it-l10n-Builder-Cohen'));
            ?>
		</li>
		<li>
			<label for="favicon_option-custom"><?php 
            $form->add_radio('favicon_option', array('value' => 'custom', 'class' => 'show-hide-toggle'));
            ?>
 <?php 
            _e('Upload your own image', 'it-l10n-Builder-Cohen');
            ?>
</label>
			<?php 
            ITUtility::add_tooltip(__('Make your site your own by uploading a custom image to use.', 'it-l10n-Builder-Cohen'));
            ?>
		</li>
		<li>
			<label for="favicon_option-theme"><?php 
            $form->add_radio('favicon_option', array('value' => 'theme', 'class' => 'show-hide-toggle'));
            ?>
 <?php 
            _e('Use the active child theme\'s Favicon image located at images/favicon.ico', 'it-l10n-Builder-Cohen');
            ?>
</label>
			<?php 
            ITUtility::add_tooltip(__('This is a legacy option provided to help some users transition to this new feature. Since this feature helps prevent issues with different browsers caching the Favicon image, it is recommended that you use the "Upload your own image" option to upload the image rather than this option.', 'it-l10n-Builder-Cohen'));
            ?>
		</li>
		<li>
			<label for="favicon_option-off"><?php 
            $form->add_radio('favicon_option', array('value' => 'off', 'class' => 'show-hide-toggle'));
            ?>
 <?php 
            _e('Don\'t use a Favicon from Builder', 'it-l10n-Builder-Cohen');
            ?>
</label>
			<?php 
            ITUtility::add_tooltip(__('This will turn off Builder\'s built-in Favicon feature. Plugins can still provide a Favicon, and you can modify the header.php file if you\'d like to hand-code in your own solution.', 'it-l10n-Builder-Cohen'));
            ?>
		</li>
	</ul>
	
	<div class="favicon_option-options">
		<div class="favicon_option-preset-option">
			<br />
			
			<p><?php 
            _e('Which image would you like to use for your Favicon?', 'it-l10n-Builder-Cohen');
            ?>
</p>
			
			<ul class="no-bullets">
				<?php 
            foreach ($presets as $file => $name) {
                ?>
					<li><label for="favicon_preset-<?php 
                echo str_replace('.', '-', $file);
                ?>
"><?php 
                $form->add_radio('favicon_preset', $file);
                ?>
 <img width="16" height="16" src="<?php 
                echo builder_main_get_builder_core_url() . "/favicons/{$file}.png";
                ?>
" alt="<?php 
                echo $name;
                ?>
" title="<?php 
                echo $name;
                ?>
" /></li>
				<?php 
            }
            ?>
			</ul>
		</div>
		
		<div class="favicon_option-custom-option">
			<br />
			
			
			<?php 
            if (isset($this->_options['favicon']) && !empty($this->_options['favicon']['file'])) {
                ?>
				<?php 
                $image_url = '';
                if (!empty($this->_options['favicon']['original_resized_url'])) {
                    $image_url = $this->_options['favicon']['original_resized_url'];
                } else {
                    if (!empty($this->_options['favicon']['original_url'])) {
                        $image_url = $this->_options['favicon']['original_url'];
                    }
                }
                ?>
				
				<div class="existing-custom-favicon-details">
					<?php 
                if (!empty($image_url)) {
                    ?>
						<p><?php 
                    _e('You currently have the following image uploaded:', 'it-l10n-Builder-Cohen');
                    ?>
 <img width="16" height="16" alt="Uploaded Favicon Image" src="<?php 
                    echo $image_url;
                    ?>
" /></p>
					<?php 
                } else {
                    ?>
						<p><?php 
                    _e('You currently have an image uploaded.', 'it-l10n-Builder-Cohen');
                    ?>
</p>
					<?php 
                }
                ?>
					
					<p><a href="#" class="upload-new-custom-favicon">Click here</a> to upload a new image.</p>
				</div>
			<?php 
            }
            ?>
			
			<div class="upload-favicon-info">
				<p><?php 
            _e('The file format for a Favicon image should be ICO, a format created for Windows; however, if you upload a JPG, PNG, or GIF image, a valid ICO file will automatically be generated for you.', 'it-l10n-Builder-Cohen');
            ?>
</p>
				<p><?php 
            _e('This image will be shown at just 16 pixels by 16 pixels, so make sure that the image you use is that size or is square and can resize nicely to those dimensions.', 'it-l10n-Builder-Cohen');
            ?>
</p>
				
				<p>
					<?php 
            $form->add_file_upload('uploaded_favicon');
            ?>
					<?php 
            ITUtility::add_tooltip('The following image formats are accepted: JPG, PNG, GIF, and ICO.', 'it-l10n-Builder-Cohen');
            ?>
				</p>
				
				<p><?php 
            _e('<em>Make sure that you click on the "Save Settings" button below for your file to be uploaded.</em>', 'it-l10n-Builder-Cohen');
            ?>
</p>
			</div>
		</div>
		
		<div class="favicon_option-preset-option favicon_option-custom-option">
			<br />
			
			<p><?php 
            _e('Should the selected Favicon be used for the WordPress Dashboard?', 'it-l10n-Builder-Cohen');
            ?>
</p>
			
			<ul class="no-bullets">
				<li>
					<label for="dashboard_favicon-on"><?php 
            $form->add_radio('dashboard_favicon', 'on');
            ?>
 <?php 
            _e('Yes, use the selected Favicon in the Dashboard (default)', 'it-l10n-Builder-Cohen');
            ?>
</label>
					<?php 
            ITUtility::add_tooltip(__('Make your site\'s tabs easier to identify by using the same Favicon for all tabs, even those that show the Dashboard (the back-end of WordPress).', 'it-l10n-Builder-Cohen'));
            ?>
				</li>
				<li>
					<label for="dashboard_favicon-off"><?php 
            $form->add_radio('dashboard_favicon', 'off');
            ?>
 <?php 
            _e('No, do not use the selected Favicon in the Dashboard', 'it-l10n-Builder-Cohen');
            ?>
</label>
					<?php 
            ITUtility::add_tooltip(__('Do not add the Favicon to the Dashboard. This will not prevent a plugin from adding a Favicon to the Dashboard.', 'it-l10n-Builder-Cohen'));
            ?>
				</li>
			</ul>
		</div>
	</div>
	
<?php 
        }
コード例 #7
0
 function _get_extension_directories()
 {
     if (isset($this->_directories)) {
         return $this->_directories;
     }
     $this->_directories = array(get_stylesheet_directory() . '/' . $this->_extension_directory, get_template_directory() . '/' . $this->_extension_directory, builder_main_get_builder_core_path() . '/extensions');
     $this->_directories = array_unique($this->_directories);
     $this->_directories = apply_filters('builder_get_extension_directories', $this->_directories);
     foreach ((array) $this->_directories as $index => $directory) {
         if (!is_dir($directory)) {
             unset($this->_directories[$index]);
         }
     }
     return $this->_directories;
 }