예제 #1
0
 /**
  * Retrieve translation object
  *
  * @return Zend_Translate_Adapter
  */
 public function initTranslate($forceReload = false)
 {
     if (is_null($this->_translate) || $forceReload) {
         $this->_translate = App_Main::getModel('core/translate_csv', array(App_Main::getBaseDir('locale'), $this->getLocale()));
     }
     return $this->_translate;
 }
예제 #2
0
파일: Template.php 프로젝트: hettema/Stages
 /**
  * Set the template file
  * 
  * @param type $template
  * @return Core_Block_Email_Template 
  */
 public function setTemplate($template)
 {
     $fileName = App_Main::getBaseDir('locale') . DS . 'email' . DS . $this->getLocale() . DS . $template;
     if (file_exists($fileName)) {
         $this->setData('template', $fileName);
     } else {
         //no need to check file existance here as it will be checked durinng ->fetchview
         $fileName = App_Main::getBaseDir('locale') . DS . 'email' . DS . $this->_defaltLocale . DS . $template;
         $this->setData('template', $fileName);
     }
     return $this;
 }
예제 #3
0
파일: Csv.php 프로젝트: hettema/Stages
 public function __construct()
 {
     $args = func_get_args();
     $options = array('delimiter' => ",", 'length' => 0, 'enclosure' => '"', 'scan' => 'directory', 'ignore' => 'email');
     $data = !empty($args[0][0]) ? $args[0][0] : App_Main::getBaseDir('locale');
     $locale = !empty($args[0][1]) ? $args[0][1] : App_Main::getWebsite()->getLocale();
     App_Main::setErrorHandler();
     try {
         parent::__construct($data, $locale, $options);
     } catch (Exception $e) {
     }
 }
예제 #4
0
파일: Session.php 프로젝트: hettema/Stages
 /**
  * Set the save handler, enalbes DB based handler only if the session table is found
  * 
  * @return Core_Model_Resource_Session 
  */
 public function setSaveHandler()
 {
     if ($this->hasConnection()) {
         session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
     } else {
         session_save_path(App_Main::getBaseDir('session'));
     }
     return $this;
 }
예제 #5
0
파일: Abstract.php 프로젝트: hettema/Stages
 /**
  * Get sesssion save path
  *
  * @return string
  */
 public function getSessionSavePath()
 {
     return App_Main::getBaseDir('session');
 }
예제 #6
0
파일: Cache.php 프로젝트: hettema/Stages
 /**
  * Get Zend cache object
  *
  * @return Zend_Cache_Core
  */
 public function getCache()
 {
     if ($this->_cache) {
         return $this->_cache;
     }
     $backend = $this->getCacheBackend();
     $cachePrefix = $this->getCachePrefix();
     if (!$cachePrefix) {
         $cachePrefix = md5(App_Main::getBaseDir());
     }
     if (extension_loaded('apc') && ini_get('apc.enabled') && $backend == 'apc') {
         $backend = 'Apc';
         $backendAttributes = array('cache_prefix' => $cachePrefix);
     } elseif (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable') && $backend == 'eaccelerator') {
         $backend = 'Eaccelerator';
         $backendAttributes = array('cache_prefix' => $cachePrefix);
     } elseif ('memcached' == $backend && extension_loaded('memcache')) {
         $backend = 'Memcached';
         $memcachedConfig = $this->getMemCacheConfig();
         $backendAttributes = array('compression' => (bool) $memcachedConfig->getCompression(), 'cache_dir' => (string) $memcachedConfig->getCacheDir(), 'hashed_directory_level' => (string) $memcachedConfig->getHashedDirectoryLevel(), 'hashed_directory_umask' => (string) $memcachedConfig->getHashedDirectoryUmask(), 'file_name_prefix' => (string) $memcachedConfig->getFileNamePrefix(), 'servers' => array());
         foreach ($memcachedConfig->servers->children() as $serverConfig) {
             $backendAttributes['servers'][] = array('host' => (string) $serverConfig->getHost(), 'port' => (string) $serverConfig->getPort(), 'persistent' => (string) $serverConfig->getPersistent());
         }
     } else {
         $backend = 'File';
         $backendAttributes = array('cache_dir' => App_Main::getBaseDir('cache'), 'hashed_directory_level' => 1, 'hashed_directory_umask' => 0777, 'file_name_prefix' => 'cgs');
     }
     $lifetime = $this->getCacheLifetime();
     $this->_cache = Zend_Cache::factory('Core', $backend, array('caching' => true, 'lifetime' => $lifetime, 'automatic_cleaning_factor' => 0), $backendAttributes, false, false, true);
     return $this->_cache;
 }
예제 #7
0
파일: Design.php 프로젝트: hettema/Stages
 /**
  * Get the loaded themes layout directory
  *
  * @param array $params
  * @return string theme layout directory
  */
 public function getLayoutBaseDir(array $params = array())
 {
     $this->updateParamDefaults($params);
     $baseDir = (empty($params['_relative']) ? App_Main::getBaseDir('design') . DS : '') . $params['_area'] . DS . $params['_theme'];
     return $baseDir;
 }
예제 #8
0
파일: Template.php 프로젝트: hettema/Stages
 /**
  * Render block
  */
 public function renderView()
 {
     $this->setScriptPath(App_Main::getBaseDir('design'));
     //$params = array('_relative'=>true);
     $params = array();
     if ($area = $this->getArea()) {
         $params['_area'] = $area;
     }
     $templateName = App_Main::getDesign()->getTemplateFilename($this->getTemplate(), $params);
     $html = $this->fetchView($templateName);
     return $html;
 }
예제 #9
0
파일: Edit.php 프로젝트: hettema/Stages
 /**
  * Get the theme list for the frontend
  * from the __base-dir__/design/frontend directory
  * 
  * @return array 
  */
 public function getFrontDesignThemeList()
 {
     $themeDir = App_Main::getBaseDir('design') . DS . 'frontend';
     if (!($handle = opendir($themeDir))) {
         return array();
     }
     $themes = array();
     $themes['default'] = 'Default';
     while (false !== ($file = readdir($handle))) {
         $exclude = strstr($file, '.') && strpos($file, '.') == 0;
         if ($file == 'default' || $exclude || !is_dir($themeDir . DS . $file)) {
             continue;
         }
         $themes[$file] = ucfirst($file);
     }
     return $themes;
 }