function add_stylesheet() { if (empty($this->layout)) { return; } remove_action('wp_head', array($this, 'add_stylesheet'), 0, -100); $current_stylesheet_version = $this->get_current_stylesheet_version(); $this->stylesheet_version = $current_stylesheet_version; if (!isset($this->layout['stylesheet_version'])) { $this->layout['stylesheet_version'] = ''; } if (builder_theme_supports('builder-disable-stylesheet-cache')) { $this->stylesheet_type = 'disabled-cache'; $this->layout['stylesheet_file'] = ''; } else { if ($current_stylesheet_version != (string) $this->layout['stylesheet_version'] || !empty($_GET['builder_force_regenerate_stylesheet'])) { $this->stylesheet_type = 'regenerated'; $this->generate_stylesheet($this->layout_id, $this->layout_settings); } else { $this->stylesheet_type = 'cached'; } if (!empty($this->layout['stylesheet_file'])) { if (is_string($this->layout['stylesheet_file']) && file_exists($this->layout['stylesheet_file'])) { $url = ITUtility::get_url_from_file($this->layout['stylesheet_file']); } else { if (is_wp_error($this->layout['stylesheet_file'])) { echo "\n<!--\n\t" . __('Builder Error: Unable to find a writable location to store the generated stylesheet. Check directory permissions in the wp-content/uploads directory.', 'it-l10n-Builder-Madison') . "\n"; echo "\t" . sprintf(__('Error Message (%s): %s', 'it-l10n-Builder-Madison'), $this->layout['stylesheet_file']->get_error_code(), $this->layout['stylesheet_file']->get_error_message()) . "\n"; echo "-->\n"; } } } if (!empty($url)) { $version = md5($current_stylesheet_version); echo "<link rel=\"stylesheet\" href=\"{$url}?version={$version}\" type=\"text/css\" media=\"screen\" />\n"; return; } } if (empty($this->stylesheet)) { $this->generate_stylesheet($this->layout_id, $this->layout_settings); } if (empty($this->stylesheet_type)) { $this->stylesheet_type = 'fallback'; } echo "<style type=\"text/css\" media=\"screen\">\n{$this->stylesheet}</style>\n"; }
function _show_layouts_and_views_options() { $options = array('child_theme_type' => 'parent', 'theme_layouts' => 'ignore', 'theme_activation' => !empty($_REQUEST['theme_activation']) ? 1 : '', 'fresh_install' => !empty($_REQUEST['fresh_install']) ? 1 : '', 'step' => 'finish'); $logo_url = ITUtility::get_url_from_file(dirname(__FILE__) . '/images/builder-logo.png'); $old_theme = isset($GLOBALS['builder_old_theme']) ? $GLOBALS['builder_old_theme'] : false; $current_theme = wp_get_theme(); if ($old_theme && $old_theme->get_template() != $current_theme->get_template()) { $template_switch = true; } else { $template_switch = false; } $form = new ITForm($options); $this->_form =& $form; ?> <div class="wrap"> <?php $form->start_form(array('id' => 'it-builder-setup')); ?> <?php if (empty($_REQUEST['theme_activation'])) { ?> <?php ITUtility::screen_icon(); ?> <?php $this->_print_editor_tabs(); ?> <?php } ?> <div class="it-brochure-box"> <img class="it-logo" src="<?php echo $logo_url; ?> " alt="Builder Logo" /> <h1>Builder Setup</h1> <?php if ($template_switch) { ?> <p><?php _e('You are switching from a different Builder theme. Would you like to continue to use your current Layouts and Views? Or do you want to use the Layouts and Views included with this new theme?', 'it-l10n-Builder-Paige'); ?> </p> <div class="it-shrink-wrap-box"> <label><?php printf(__('%1$s Keep the site\'s current Layouts and Views', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'ignore', 'class' => 'show-hide-toggle'))); ?> </label> <br /> <label><?php printf(__('%1$s Use the Layouts and Views included with the new theme', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'use', 'class' => 'show-hide-toggle'))); ?> </label> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <p class="description"><?php _e('Important: This option will replace your current Layouts and Views with the Layouts and Views provided by the theme.', 'it-l10n-Builder-Paige'); ?> </p> </div> <!-- <div class="it-indent-box it-options-theme_layouts it-options-theme_layouts-use"> <label><?php printf(__('%1$s Keep current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'add')); ?> </label> <br /> <label><?php printf(__('%1$s Remove current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'replace')); ?> </label> </div>--> </div> <?php } else { ?> <p><?php _e('Your theme provides a set of default Layouts and Views. You can update your site to match these provided Layouts and Views.', 'it-l10n-Builder-Paige'); ?> </p> <div class="it-shrink-wrap-box"> <label><?php printf(__('%1$s Keep the site\'s current Layouts and Views', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'ignore', 'class' => 'show-hide-toggle'))); ?> </label> <br /> <label><?php printf(__('%1$s Use the Layouts and Views included with the theme', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'use', 'class' => 'show-hide-toggle'))); ?> </label> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <p class="description"><?php _e('Important: This option will replace your current Layouts and Views with the Layouts and Views provided by the theme.', 'it-l10n-Builder-Paige'); ?> </p> </div> <!-- <div class="it-indent-box it-options-theme_layouts it-options-theme_layouts-use"> <label><?php printf(__('%1$s Keep current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'add')); ?> </label> <br /> <label><?php printf(__('%1$s Remove current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'replace')); ?> </label> </div>--> </div> <?php } ?> <div class="it-input-set"> <div class="it-options-theme_layouts it-options-theme_layouts-ignore"> <?php $form->add_submit('update_layouts_and_views', array('value' => 'Keep current Layouts and Views')); ?> </div> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <?php $form->add_submit('update_layouts_and_views', array('value' => 'Update Layouts and Views')); ?> </div> <p><a class="it-skip" href="<?php echo admin_url('admin.php?page=ithemes-builder-theme'); ?> "><?php _e('Skip'); ?> </a></p> </div> </div> <?php $form->add_hidden('theme_activation'); ?> <?php $form->add_hidden('fresh_install'); ?> <?php $form->add_hidden('step'); ?> <?php $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab); ?> <?php $form->end_form(); ?> </div> <?php }
function builder_add_fitvids_scripts() { $base_url = ITUtility::get_url_from_file(dirname(__FILE__)); wp_register_script('fitvids', "{$base_url}/js/jquery.fitvids-max-width-modification.js", array('jquery'), '1.0', true); wp_enqueue_script('builder-init-fitvids', "{$base_url}/js/init-fitvids.js", array('fitvids'), '1.0', true); }
function builder_main_get_builder_core_url() { if (isset($GLOBALS['builder_main_builder_core_url'])) { return $GLOBALS['builder_main_builder_core_url']; } $GLOBALS['builder_main_builder_core_url'] = ITUtility::get_url_from_file(builder_main_get_builder_core_path()); return $GLOBALS['builder_main_builder_core_url']; }
public static function get_url_from_file($file, $auto_ssl = true) { return ITUtility::get_url_from_file($file, $auto_ssl); }
function _setVars() { $this->_plugin_url = ITUtility::get_url_from_file(dirname(__FILE__)); }
public static function render($content_callback, $options = array()) { global $current_user; if (!isset($current_user)) { $current_user = wp_get_current_user(); } remove_action('admin_enqueue_scripts', 'wp_auth_check_load'); $default_options = array('styles' => array('global', 'wp-admin', 'colors', 'media', 'ie'), 'hook_suffix' => 'it-dialog', 'content_callback_args' => array(), 'body_id' => ''); $options = array_merge($default_options, $options); ?> <!DOCTYPE html> <!--[if IE 8]> <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 it-dialog-html" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?> > <![endif]--> <!--[if !(IE 8) ]><!--> <html xmlns="http://www.w3.org/1999/xhtml" class="it-dialog-html" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?> > <!--<![endif]--> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php echo get_option('blog_charset'); ?> " /> <title>IT Dialog Window</title> <?php foreach ($options['styles'] as $style) { wp_enqueue_style($style); } $plugin_url = ITUtility::get_url_from_file(dirname(__FILE__)); wp_enqueue_style('it-dialog-inside-dialog-style', "{$plugin_url}/css/it-dialog-inside-dialog.css"); wp_enqueue_script('it-dialog-inside-dialog-script', "{$plugin_url}/js/it-dialog-inside-dialog.js", array('jquery'), false, true); ?> <script type="text/javascript"> //<![CDATA[ addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; var userSettings = { 'url': '<?php echo SITECOOKIEPATH; ?> ', 'uid': '<?php echo $current_user->ID; ?> ', 'time': '<?php echo time(); ?> ' }; var ajaxurl = '<?php echo esc_js(admin_url('admin-ajax.php', 'relative')); ?> '; var pagenow = '<?php echo esc_js($options['hook_suffix']); ?> '; var adminpage = '<?php echo esc_js($options['hook_suffix']); ?> '; var isRtl = <?php echo (int) is_rtl(); ?> ; //]]> </script> <?php do_action('admin_enqueue_scripts', $options['hook_suffix']); do_action("admin_print_styles-{$options['hook_suffix']}"); do_action('admin_print_styles'); do_action("admin_print_scripts-{$options['hook_suffix']}"); do_action('admin_print_scripts'); do_action("admin_head-{$options['hook_suffix']}"); do_action('admin_head'); if (is_string($content_callback)) { do_action("admin_head_{$content_callback}"); } ?> </head> <body<?php if (!empty($options['body_id'])) { echo " id='{$options['body_id']}'"; } ?> class="wp-admin wp-core-ui no-js"> <script type="text/javascript"> document.body.className = document.body.className.replace( 'no-js', 'js' ); </script> <div id="it-dialog-content-container"> <?php call_user_func_array($content_callback, $options['content_callback_args']); ?> </div> <?php do_action('admin_print_footer_scripts'); ?> <script type="text/javascript">if ( 'function' == typeof wpOnload ) wpOnload();</script> </body> </html><?php }
public static function get_url_from_file($file, $auto_ssl = true, $prevent_recursion = false) { $file = str_replace('\\', '/', $file); $url = ''; $upload_dir = ITUtility::get_cached_value('wp_upload_dir'); $upload_dir['basedir'] = str_replace('\\', '/', $upload_dir['basedir']); if (is_array($upload_dir) && false === $upload_dir['error']) { if (0 === strpos($file, $upload_dir['basedir'])) { $url = str_replace($upload_dir['basedir'], $upload_dir['baseurl'], $file); } else { if (false !== strpos($file, 'wp-content/uploads')) { $url = $upload_dir['baseurl'] . substr($file, strpos($file, 'wp-content/uploads') + 18); } } } if (empty($url)) { if (!isset($GLOBALS['it_classes_cache_wp_content_dir'])) { $GLOBALS['it_classes_cache_wp_content_dir'] = rtrim(str_replace('\\', '/', WP_CONTENT_DIR), '/'); } if (!isset($GLOBALS['it_classes_cache_abspath'])) { $GLOBALS['it_classes_cache_abspath'] = rtrim(str_replace('\\', '/', ABSPATH), '/'); } if (0 === strpos($file, $GLOBALS['it_classes_cache_wp_content_dir'])) { $url = WP_CONTENT_URL . str_replace('\\', '/', preg_replace('/^' . preg_quote($GLOBALS['it_classes_cache_wp_content_dir'], '/') . '/', '', $file)); } else { if (0 === strpos($file, $GLOBALS['it_classes_cache_abspath'])) { $url = get_option('siteurl') . str_replace('\\', '/', preg_replace('/^' . preg_quote($GLOBALS['it_classes_cache_abspath'], '/') . '/', '', $file)); } } } if (empty($url) && !$prevent_recursion) { $url = ITUtility::get_url_from_file(realpath($file), $auto_ssl, true); } if (empty($url)) { return ''; } if ($auto_ssl) { $url = ITUtility::fix_url($url); } return $url; }
public static function render_thickbox($content_func) { $plugin_url = ITUtility::get_url_from_file(dirname(__FILE__)); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?> class="thickbox-html"> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php echo get_option('blog_charset'); ?> " /> <title>Thickframe Window</title> <?php wp_enqueue_style('global'); wp_enqueue_style('wp-admin'); wp_enqueue_style('colors'); /* if ( 0 === strpos( $content_func, 'media' ) ) wp_enqueue_style( 'media' );*/ wp_enqueue_style('ie'); wp_enqueue_script('it-thickbox-script', $plugin_url . '/js/it-thickbox.js'); ?> <script type="text/javascript"> //<![CDATA[ addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?> ','uid':'<?php if (!isset($current_user)) { $current_user = wp_get_current_user(); } echo $current_user->ID; ?> ','time':'<?php echo time(); ?> '}; //]]> </script> <?php do_action('admin_print_styles'); do_action('admin_print_scripts'); do_action('admin_head'); if (is_string($content_func)) { do_action("admin_head_{$content_func}"); } ?> </head> <body style="height:auto;"<?php if (isset($GLOBALS['body_id'])) { echo ' id="' . $GLOBALS['body_id'] . '"'; } ?> > <div style="padding:10px;" id="thickbox-content-container"> <?php $args = func_get_args(); $args = array_slice($args, 1); call_user_func_array($content_func, $args); ?> <script type="text/javascript">if(typeof wpOnload=='function') wpOnload();</script> <script type="text/javascript">auto_resize_thickbox_height();</script> <?php do_action('admin_print_footer_scripts'); ?> </div> </body> </html> <?php }
function _set_vars() { $this->_class = get_class($this); if (isset($_REQUEST['page'])) { $uri_parts = explode('?', $_SERVER['REQUEST_URI']); $this->_self_link = $uri_parts[0] . '?page=' . $_REQUEST['page']; } if (empty($this->_file) || !is_file($this->_file)) { ITError::fatal("empty_var:class_var:{$this->_class}->_file", "The {$this->_class} class did not fill in the \$this->_file variable. This should be done in the class constructor with a value of __FILE__."); } $this->_plugin_path = dirname($this->_file); $this->_plugin_url = ITUtility::get_url_from_file($this->_plugin_path); $this->_class_path = dirname(__FILE__); $this->_class_url = ITUtility::get_url_from_file($this->_class_path); }
function _update_path_info($path_info) { if (false === ($paths = get_option($this->_args['option_name']))) { $paths = array(); } $this->_path = $path_info['path']; $this->_url = ITUtility::get_url_from_file($path_info['path']); $this->_versions = $path_info['versions']; $this->_empty_types = $path_info['empty_types']; $paths[$this->_name] = $path_info; update_option($this->_args['option_name'], $paths); }