Пример #1
0
 /**
  * Display html templates
  *
  * @param string $path
  * @param array $var
  * @param bool $return
  * @return void
  * @since 1.0.0
  */
 function yit_get_template($path, $var = NULL, $return = false)
 {
     global $yit;
     //yit_debug( $path );
     $located = yit_locate_template($path, $var);
     if ($var && is_array($var)) {
         extract($var);
     }
     if ($return) {
         ob_start();
     }
     // include file located
     include $located;
     if ($return) {
         return ob_get_clean();
     }
 }
Пример #2
0
 /**
  * Display html templates
  *
  * @param string $path
  * @param array $var
  * @param bool $return
  * @return mixed
  * @since 1.0.0
  */
 function yit_get_template($path, $var = NULL, $return = false)
 {
     $located = yit_locate_template($path, $var);
     if (empty($located)) {
         $external_template_path = apply_filters('yit_add_external_template_path', '');
         if (!empty($external_template_path)) {
             $located = $external_template_path . $path;
         } else {
             return;
         }
     }
     if ($var && is_array($var)) {
         extract($var);
     }
     if ($return) {
         ob_start();
     }
     // include file located
     include $located;
     if ($return) {
         return ob_get_clean();
     }
 }
Пример #3
0
 /**
  * Save the skin in the database
  */
 public function save_skin()
 {
     if (!isset($_POST['yit-action']) || $_POST['yit-action'] != $this->admin_action) {
         return;
     }
     $skin = isset($_POST['skin']) ? $_POST['skin'] : null;
     if (empty($skin)) {
         return;
     }
     $skin_file = yit_locate_template('skins/' . $skin . '.txt');
     if (empty($skin_file)) {
         return;
     }
     $skin_config = @file_get_contents($skin_file);
     if (empty($skin_config)) {
         return;
     }
     $skin_config = unserialize(base64_decode($skin_config));
     // the options to remove from txt import data
     $exclude = apply_filters('yit_skin_exclude_options', array('pages' => array('buy', 'sidebars', 'seo', 'splash', 'maintenance', 'backup', 'support', 'update', 'skins', 'plugins'), 'tabs' => array('theme_option_blog_settings', 'theme_option_general_cachefonts', 'theme_option_general_newsletter', 'theme_option_general_sitemap', 'theme_option_general_responsive', 'theme_option_pages_404', 'theme_option_pages_archives', 'theme_option_pages_categories', 'theme_option_pages_search', 'theme_option_testimonials_settings', 'theme_option_custom_codes_custom_style', 'theme_option_custom_codes_custom_script', 'theme_option_popup_settings', 'theme_option_popup_newsletter', 'theme_option_shop_general_settings', 'theme_option_shop_products_page', 'theme_option_shop_products_details_page', 'theme_option_shop_category_page'), 'options' => array()));
     // the options to include in the skin import data
     $include = apply_filters('yit_skin_include_options', array('blog-type', 'blog-single-type', 'shop-layout'));
     // esclude options
     $fields = yit_get_model('panel')->panel;
     foreach ($fields as $page => $tabs) {
         if (in_array($page, $exclude['pages'])) {
             unset($fields[$page]);
         }
         foreach ($tabs as $tab => $options) {
             if (in_array($tab, $exclude['tabs'])) {
                 unset($fields[$page][$tab]);
             }
             if (empty($options) || !is_array($options)) {
                 continue;
             }
             foreach ($options as $option_pos => $option_args) {
                 if (isset($option_args['id']) && in_array($option_args['id'], $exclude['options'])) {
                     unset($fields[$page][$tab][$option_pos]);
                 }
             }
         }
     }
     // filter options
     $filter_options = array();
     foreach ($fields as $page => $tabs) {
         foreach ($tabs as $tab => $options) {
             if (empty($options) || !is_array($options)) {
                 continue;
             }
             foreach ($options as $option_pos => $option_args) {
                 if (!isset($option_args['id']) || !isset($skin_config[$option_args['id']])) {
                     continue;
                 }
                 yit_get_model('panel')->update_option($option_args['id'], $skin_config[$option_args['id']]);
             }
         }
     }
     foreach ($include as $id) {
         yit_get_model('panel')->update_option($id, $skin_config[$id]);
     }
     // save the actual skin
     yit_get_model('panel')->update_option('skin', $skin);
     //         yit_debug(yit_get_model('panel')->db_options);
     //         die;
     yit_add_message(__('Skin applyed', 'yit'), 'updated', 'panel');
     yit_get_model('panel')->update_db_options();
     if (defined('DOING_AJAX')) {
         yit_get_model('message')->printMessages();
         die;
     }
 }
Пример #4
0
 /**
  * Locate the file, first in "theme" folder and then in "core" folder             
  *      
  * @param $file string  The name of the file that is located inside the "slider" folder
  * @param $portfolio_type  The slider type (that is the folder name) where get the file          
  * @since 1.0.0
  */
 protected function _locatePortfolioFile($file, $portfolio_type)
 {
     $located = yit_locate_template($this->_portfolioTypeName . '/' . $portfolio_type . '/' . $file);
     return $located;
 }