/** * Generates the adapter * * @param array|IfwPsn_Vendor_Zend_Config $options Translation content */ public function __construct($options = array()) { $this->_options['delimiter'] = ";"; $this->_options['length'] = 0; $this->_options['enclosure'] = '"'; if ($options instanceof IfwPsn_Vendor_Zend_Config) { $options = $options->toArray(); } else { if (func_num_args() > 1) { $args = func_get_args(); $options = array(); $options['content'] = array_shift($args); if (!empty($args)) { $options['locale'] = array_shift($args); } if (!empty($args)) { $opt = array_shift($args); $options = array_merge($opt, $options); } } else { if (!is_array($options)) { $options = array('content' => $options); } } } parent::__construct($options); }
/** * Set translator * * @param IfwPsn_Vendor_Zend_Translate|IfwPsn_Vendor_Zend_Translate_Adapter|null $translator * @return IfwPsn_Vendor_Zend_View_Helper_FormElement */ public function setTranslator($translator = null) { if (null === $translator) { $this->_translator = null; } elseif ($translator instanceof IfwPsn_Vendor_Zend_Translate_Adapter) { $this->_translator = $translator; } elseif ($translator instanceof IfwPsn_Vendor_Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/View/Exception.php'; $e = new IfwPsn_Vendor_Zend_View_Exception('Invalid translator specified'); $e->setView($this->view); throw $e; } return $this; }
/** * Sets a translation Adapter for translation * * @param IfwPsn_Vendor_Zend_Translate|IfwPsn_Vendor_Zend_Translate_Adapter $translate Instance of IfwPsn_Vendor_Zend_Translate * @throws IfwPsn_Vendor_Zend_View_Exception When no or a false instance was set * @return IfwPsn_Vendor_Zend_View_Helper_Translate */ public function setTranslator($translate) { if ($translate instanceof IfwPsn_Vendor_Zend_Translate_Adapter) { $this->_translator = $translate; } else { if ($translate instanceof IfwPsn_Vendor_Zend_Translate) { $this->_translator = $translate->getAdapter(); } else { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/View/Exception.php'; $e = new IfwPsn_Vendor_Zend_View_Exception('You must set an instance of IfwPsn_Vendor_Zend_Translate or IfwPsn_Vendor_Zend_Translate_Adapter'); $e->setView($this->view); throw $e; } } return $this; }
/** * Internal method to check if the given cache supports tags * * @param IfwPsn_Vendor_Zend_Cache $cache */ private static function _getTagSupportForCache() { $backend = self::$_cache->getBackend(); if ($backend instanceof IfwPsn_Vendor_Zend_Cache_Backend_ExtendedInterface) { $cacheOptions = $backend->getCapabilities(); self::$_cacheTags = $cacheOptions['tags']; } else { self::$_cacheTags = false; } return self::$_cacheTags; }
/** * Set translator object * * @param IfwPsn_Vendor_Zend_Translate|IfwPsn_Vendor_Zend_Translate_Adapter|null $translator * @return IfwPsn_Vendor_Zend_Form_DisplayGroup */ public function setTranslator($translator = null) { if (null === $translator || $translator instanceof IfwPsn_Vendor_Zend_Translate_Adapter) { $this->_translator = $translator; } elseif ($translator instanceof IfwPsn_Vendor_Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Form/Exception.php'; throw new IfwPsn_Vendor_Zend_Form_Exception('Invalid translator specified'); } return $this; }
/** * Set global default translator object * * @param IfwPsn_Vendor_Zend_Translate|IfwPsn_Vendor_Zend_Translate_Adapter|null $translator * @return void */ public static function setDefaultTranslator($translator = null) { if (null === $translator) { self::$_translatorDefault = null; } elseif ($translator instanceof IfwPsn_Vendor_Zend_Translate_Adapter) { self::$_translatorDefault = $translator; } elseif ($translator instanceof IfwPsn_Vendor_Zend_Translate) { self::$_translatorDefault = $translator->getAdapter(); } else { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Form/Exception.php'; throw new IfwPsn_Vendor_Zend_Form_Exception('Invalid translator specified'); } }
/** * Clears all set cache data * * @param string $tag Tag to clear when the default tag name is not used * @return void */ public static function clearCache($tag = null) { IfwPsn_Vendor_Zend_Translate_Adapter::clearCache($tag); }