public function get_options()
 {
     if (!$this->options) {
         $options_path = $this->path . '/options.php';
         if (file_exists($options_path)) {
             $vars = fw_get_variables_from_file($options_path, array('options' => null));
             $this->options = $vars['options'];
         }
     }
     return $this->options;
 }
 /**
  * used by $this->get_installed_extensions()
  * @param string $location
  * @param array $list
  * @param null|string $parent_extension_name
  */
 private function read_extensions($location, &$list, $parent_extension_name = null)
 {
     $paths = glob($location['path'] . '/*', GLOB_ONLYDIR | GLOB_NOSORT);
     if (empty($paths)) {
         return;
     }
     foreach ($paths as $extension_path) {
         $extension_name = basename($extension_path);
         if (isset($list[$extension_name])) {
             // extension already found
         } elseif (file_exists($extension_path . '/manifest.php')) {
             $vars = fw_get_variables_from_file($extension_path . '/manifest.php', array('manifest' => array()));
             $list[$extension_name] = array('path' => $extension_path, 'manifest' => $vars['manifest'], 'children' => array(), 'active' => (bool) fw()->extensions->get($extension_name), 'parent' => $parent_extension_name, 'is' => $location['is']);
             if ($parent_extension_name) {
                 $list[$parent_extension_name]['children'][$extension_name] = array();
             }
         } else {
             // it's a directory with customizations for an extension
             continue;
         }
         $sub_extension_location = $location;
         $sub_extension_location['path'] .= '/' . $extension_name . '/extensions';
         $this->read_extensions($sub_extension_location, $list, $extension_name);
     }
 }
Exemple #3
0
 /**
  * Return config key value, or entire config array
  * Config array is merged from child configs
  * @param string|null $key Multi key format accepted: 'a/b/c'
  * @param mixed $default_value
  * @return mixed|null
  */
 public final function get_config($key = null, $default_value = null)
 {
     $cache_key = self::$cache_key . '/config';
     try {
         $config = FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $config = array('settings_form_ajax_submit' => true, 'settings_form_side_tabs' => false);
         if (file_exists(fw_get_template_customizations_directory('/theme/config.php'))) {
             $variables = fw_get_variables_from_file(fw_get_template_customizations_directory('/theme/config.php'), array('cfg' => null));
             if (!empty($variables['cfg'])) {
                 $config = array_merge($config, $variables['cfg']);
                 unset($variables);
             }
         }
         if (is_child_theme() && file_exists(fw_get_stylesheet_customizations_directory('/theme/config.php'))) {
             $variables = fw_get_variables_from_file(fw_get_stylesheet_customizations_directory('/theme/config.php'), array('cfg' => null));
             if (!empty($variables['cfg'])) {
                 $config = array_merge($config, $variables['cfg']);
                 unset($variables);
             }
         }
         unset($path);
         FW_Cache::set($cache_key, $config);
     }
     return $key === null ? $config : fw_akg($key, $config, $default_value);
 }
Exemple #4
0
 /**
  * Return config key value, or entire config array
  * Config array is merged from child configs
  * @param string|null $key Multi key format accepted: 'a/b/c'
  * @return mixed|null
  */
 public final function get_config($key = null)
 {
     $cache_key = self::$cache_key . '/config';
     try {
         $config = FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $config = array();
         if (file_exists(FW_PT_CUSTOM_DIR . '/theme/config.php')) {
             $variables = fw_get_variables_from_file(FW_PT_CUSTOM_DIR . '/theme/config.php', array('cfg' => null));
             if (!empty($variables['cfg'])) {
                 $config = array_merge($config, $variables['cfg']);
                 unset($variables);
             }
         }
         if (FW_CT && file_exists(FW_CT_CUSTOM_DIR . '/theme/config.php')) {
             $variables = fw_get_variables_from_file(FW_CT_CUSTOM_DIR . '/theme/config.php', array('cfg' => null));
             if (!empty($variables['cfg'])) {
                 $config = array_merge($config, $variables['cfg']);
                 unset($variables);
             }
         }
         unset($path);
         FW_Cache::set($cache_key, $config);
     }
     return $key === null ? $config : fw_akg($key, $config);
 }
 public final function get_settings_options()
 {
     $cache_key = $this->get_cache_key() . '/settings_options';
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $path = $this->get_declared_path('/settings-options.php');
         if (!file_exists($path)) {
             FW_Cache::set($cache_key, array());
             return array();
         }
         $variables = fw_get_variables_from_file($path, array('options' => array()));
         FW_Cache::set($cache_key, $variables['options']);
         return $variables['options'];
     }
 }
 public function get_options()
 {
     if (!$this->options) {
         $options_path = $this->locate_path('/options.php');
         if ($options_path) {
             $vars = fw_get_variables_from_file($options_path, array('options' => null));
             $this->options = $vars['options'];
         }
     }
     return $this->options;
 }
 /**
  * Return array with options from specified name/path
  * @param string $name Examples: 'framework', 'posts/portfolio'
  * @return array
  */
 public final function get_options($name)
 {
     $path = $this->locate_path('/options/' . $name . '.php');
     if (!$path) {
         return array();
     }
     $variables = fw_get_variables_from_file($path, array('options' => array()));
     return $variables['options'];
 }
 public function get_options()
 {
     if (!$this->options) {
         $options_path = $this->locate_path('/options.php');
         if ($options_path) {
             $vars = fw_get_variables_from_file($options_path, array('options' => null));
             $this->options = $vars['options'];
         }
     }
     return apply_filters('fw_shortcode_get_options', $this->options, $this->tag);
 }
 /**
  * @return FW_Ext_Backups_Demo[]
  */
 private function get_demos()
 {
     if (is_null(self::$demos)) {
         $demos = array();
         foreach (apply_filters('fw_ext_backups_demo_dirs', array(fw_fix_path(get_template_directory()) . '/demo-content' => get_template_directory_uri() . '/demo-content')) as $dir_path => $dir_uri) {
             if (!is_dir($dir_path) || !($dirs = glob($dir_path . '/*', GLOB_ONLYDIR))) {
                 continue;
             }
             foreach (array_map('fw_fix_path', $dirs) as $demo_dir) {
                 $demo_dir_name = basename($demo_dir);
                 if (!file_exists($demo_dir . '/manifest.php')) {
                     continue;
                 }
                 $manifest = fw_get_variables_from_file($demo_dir . '/manifest.php', array('manifest' => array()), array('uri' => $dir_uri . '/' . $demo_dir_name));
                 $manifest = array_merge(array('title' => fw_id_to_title($demo_dir_name), 'screenshot' => fw_get_framework_directory_uri('/static/img/no-image.png'), 'preview_link' => '', 'extra' => array()), $manifest['manifest']);
                 $demo = new FW_Ext_Backups_Demo('local-' . md5($demo_dir), 'local', array('source' => $demo_dir));
                 $demo->set_title($manifest['title']);
                 $demo->set_screenshot($manifest['screenshot']);
                 $demo->set_preview_link($manifest['preview_link']);
                 $demo->set_extra($manifest['extra']);
                 $demos[$demo->get_id()] = $demo;
                 unset($demo);
             }
         }
         self::$demos = array_merge(apply_filters('fw:ext:backups-demo:demos', array()), $demos);
     }
     return self::$demos;
 }
 private function get_options()
 {
     $options = fw_get_variables_from_file(dirname(__FILE__) . '/settings-options.php', array('options' => array()));
     return $options['options'];
 }
 public final function get_settings_options()
 {
     try {
         return FW_Cache::get($cache_key = $this->get_cache_key('/settings_options'));
     } catch (FW_Cache_Not_Found_Exception $e) {
         if (file_exists($path = $this->get_path('/settings-options.php'))) {
             $variables = fw_get_variables_from_file($path, array('options' => array()));
         } else {
             $variables = array('options' => array());
         }
         FW_Cache::set($cache_key, $variables['options']);
         return $variables['options'];
     }
 }