From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- library/vendor/Zend/View/Abstract.php | 1186 ++++++++++++++++++++ library/vendor/Zend/View/Exception.php | 50 + library/vendor/Zend/View/Helper/Abstract.php | 63 ++ library/vendor/Zend/View/Helper/Action.php | 161 +++ library/vendor/Zend/View/Helper/BaseUrl.php | 114 ++ library/vendor/Zend/View/Helper/Cycle.php | 225 ++++ library/vendor/Zend/View/Helper/DeclareVars.php | 94 ++ library/vendor/Zend/View/Helper/Doctype.php | 239 ++++ library/vendor/Zend/View/Helper/Fieldset.php | 78 ++ library/vendor/Zend/View/Helper/Form.php | 85 ++ library/vendor/Zend/View/Helper/FormButton.php | 104 ++ library/vendor/Zend/View/Helper/FormCheckbox.php | 163 +++ library/vendor/Zend/View/Helper/FormElement.php | 202 ++++ library/vendor/Zend/View/Helper/FormErrors.php | 166 +++ library/vendor/Zend/View/Helper/FormFile.php | 74 ++ library/vendor/Zend/View/Helper/FormHidden.php | 65 ++ library/vendor/Zend/View/Helper/FormImage.php | 94 ++ library/vendor/Zend/View/Helper/FormLabel.php | 71 ++ .../vendor/Zend/View/Helper/FormMultiCheckbox.php | 73 ++ library/vendor/Zend/View/Helper/FormNote.php | 60 + library/vendor/Zend/View/Helper/FormPassword.php | 88 ++ library/vendor/Zend/View/Helper/FormRadio.php | 185 +++ library/vendor/Zend/View/Helper/FormReset.php | 81 ++ library/vendor/Zend/View/Helper/FormSelect.php | 199 ++++ library/vendor/Zend/View/Helper/FormSubmit.php | 80 ++ library/vendor/Zend/View/Helper/FormText.php | 77 ++ library/vendor/Zend/View/Helper/FormTextarea.php | 103 ++ library/vendor/Zend/View/Helper/Gravatar.php | 361 ++++++ library/vendor/Zend/View/Helper/HeadLink.php | 471 ++++++++ library/vendor/Zend/View/Helper/HeadMeta.php | 440 ++++++++ library/vendor/Zend/View/Helper/HeadScript.php | 512 +++++++++ library/vendor/Zend/View/Helper/HeadStyle.php | 426 +++++++ library/vendor/Zend/View/Helper/HeadTitle.php | 218 ++++ library/vendor/Zend/View/Helper/HtmlElement.php | 165 +++ library/vendor/Zend/View/Helper/HtmlFlash.php | 59 + library/vendor/Zend/View/Helper/HtmlList.php | 88 ++ library/vendor/Zend/View/Helper/HtmlObject.php | 79 ++ library/vendor/Zend/View/Helper/HtmlPage.php | 74 ++ library/vendor/Zend/View/Helper/HtmlQuicktime.php | 81 ++ library/vendor/Zend/View/Helper/InlineScript.php | 60 + library/vendor/Zend/View/Helper/Interface.php | 46 + library/vendor/Zend/View/Helper/Json.php | 86 ++ library/vendor/Zend/View/Helper/Layout.php | 79 ++ .../vendor/Zend/View/Helper/PaginationControl.php | 142 +++ library/vendor/Zend/View/Helper/Partial.php | 150 +++ .../vendor/Zend/View/Helper/Partial/Exception.php | 38 + library/vendor/Zend/View/Helper/PartialLoop.php | 98 ++ library/vendor/Zend/View/Helper/Placeholder.php | 85 ++ .../Zend/View/Helper/Placeholder/Container.php | 35 + .../View/Helper/Placeholder/Container/Abstract.php | 384 +++++++ .../Helper/Placeholder/Container/Exception.php | 38 + .../Helper/Placeholder/Container/Standalone.php | 322 ++++++ .../Zend/View/Helper/Placeholder/Registry.php | 183 +++ .../View/Helper/Placeholder/Registry/Exception.php | 38 + .../Zend/View/Helper/RenderToPlaceholder.php | 52 + library/vendor/Zend/View/Helper/ServerUrl.php | 148 +++ library/vendor/Zend/View/Helper/Translate.php | 174 +++ library/vendor/Zend/View/Helper/Url.php | 50 + library/vendor/Zend/View/Interface.php | 137 +++ library/vendor/Zend/View/Stream.php | 183 +++ 60 files changed, 9682 insertions(+) create mode 100644 library/vendor/Zend/View/Abstract.php create mode 100644 library/vendor/Zend/View/Exception.php create mode 100644 library/vendor/Zend/View/Helper/Abstract.php create mode 100644 library/vendor/Zend/View/Helper/Action.php create mode 100644 library/vendor/Zend/View/Helper/BaseUrl.php create mode 100644 library/vendor/Zend/View/Helper/Cycle.php create mode 100644 library/vendor/Zend/View/Helper/DeclareVars.php create mode 100644 library/vendor/Zend/View/Helper/Doctype.php create mode 100644 library/vendor/Zend/View/Helper/Fieldset.php create mode 100644 library/vendor/Zend/View/Helper/Form.php create mode 100644 library/vendor/Zend/View/Helper/FormButton.php create mode 100644 library/vendor/Zend/View/Helper/FormCheckbox.php create mode 100644 library/vendor/Zend/View/Helper/FormElement.php create mode 100644 library/vendor/Zend/View/Helper/FormErrors.php create mode 100644 library/vendor/Zend/View/Helper/FormFile.php create mode 100644 library/vendor/Zend/View/Helper/FormHidden.php create mode 100644 library/vendor/Zend/View/Helper/FormImage.php create mode 100644 library/vendor/Zend/View/Helper/FormLabel.php create mode 100644 library/vendor/Zend/View/Helper/FormMultiCheckbox.php create mode 100644 library/vendor/Zend/View/Helper/FormNote.php create mode 100644 library/vendor/Zend/View/Helper/FormPassword.php create mode 100644 library/vendor/Zend/View/Helper/FormRadio.php create mode 100644 library/vendor/Zend/View/Helper/FormReset.php create mode 100644 library/vendor/Zend/View/Helper/FormSelect.php create mode 100644 library/vendor/Zend/View/Helper/FormSubmit.php create mode 100644 library/vendor/Zend/View/Helper/FormText.php create mode 100644 library/vendor/Zend/View/Helper/FormTextarea.php create mode 100644 library/vendor/Zend/View/Helper/Gravatar.php create mode 100644 library/vendor/Zend/View/Helper/HeadLink.php create mode 100644 library/vendor/Zend/View/Helper/HeadMeta.php create mode 100644 library/vendor/Zend/View/Helper/HeadScript.php create mode 100644 library/vendor/Zend/View/Helper/HeadStyle.php create mode 100644 library/vendor/Zend/View/Helper/HeadTitle.php create mode 100644 library/vendor/Zend/View/Helper/HtmlElement.php create mode 100644 library/vendor/Zend/View/Helper/HtmlFlash.php create mode 100644 library/vendor/Zend/View/Helper/HtmlList.php create mode 100644 library/vendor/Zend/View/Helper/HtmlObject.php create mode 100644 library/vendor/Zend/View/Helper/HtmlPage.php create mode 100644 library/vendor/Zend/View/Helper/HtmlQuicktime.php create mode 100644 library/vendor/Zend/View/Helper/InlineScript.php create mode 100644 library/vendor/Zend/View/Helper/Interface.php create mode 100644 library/vendor/Zend/View/Helper/Json.php create mode 100644 library/vendor/Zend/View/Helper/Layout.php create mode 100644 library/vendor/Zend/View/Helper/PaginationControl.php create mode 100644 library/vendor/Zend/View/Helper/Partial.php create mode 100644 library/vendor/Zend/View/Helper/Partial/Exception.php create mode 100644 library/vendor/Zend/View/Helper/PartialLoop.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder/Container.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder/Container/Abstract.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder/Registry.php create mode 100644 library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php create mode 100644 library/vendor/Zend/View/Helper/RenderToPlaceholder.php create mode 100644 library/vendor/Zend/View/Helper/ServerUrl.php create mode 100644 library/vendor/Zend/View/Helper/Translate.php create mode 100644 library/vendor/Zend/View/Helper/Url.php create mode 100644 library/vendor/Zend/View/Interface.php create mode 100644 library/vendor/Zend/View/Stream.php (limited to 'library/vendor/Zend/View') diff --git a/library/vendor/Zend/View/Abstract.php b/library/vendor/Zend/View/Abstract.php new file mode 100644 index 0000000..edb577d --- /dev/null +++ b/library/vendor/Zend/View/Abstract.php @@ -0,0 +1,1186 @@ + array(), + 'helper' => array(), + 'filter' => array(), + ); + + /** + * Script file name to execute + * + * @var string + */ + private $_file = null; + + /** + * Instances of helper objects. + * + * @var array + */ + private $_helper = array(); + + /** + * Map of helper => class pairs to help in determining helper class from + * name + * @var array + */ + private $_helperLoaded = array(); + + /** + * Map of helper => classfile pairs to aid in determining helper classfile + * @var array + */ + private $_helperLoadedDir = array(); + + /** + * Stack of Zend_View_Filter names to apply as filters. + * @var array + */ + private $_filter = array(); + + /** + * Stack of Zend_View_Filter objects that have been loaded + * @var array + */ + private $_filterClass = array(); + + /** + * Map of filter => class pairs to help in determining filter class from + * name + * @var array + */ + private $_filterLoaded = array(); + + /** + * Map of filter => classfile pairs to aid in determining filter classfile + * @var array + */ + private $_filterLoadedDir = array(); + + /** + * Callback for escaping. + * + * @var string + */ + private $_escape = 'htmlspecialchars'; + + /** + * Encoding to use in escaping mechanisms; defaults to utf-8 + * @var string + */ + private $_encoding = 'UTF-8'; + + /** + * Flag indicating whether or not LFI protection for rendering view scripts is enabled + * @var bool + */ + private $_lfiProtectionOn = true; + + /** + * Plugin loaders + * @var array + */ + private $_loaders = array(); + + /** + * Plugin types + * @var array + */ + private $_loaderTypes = array('filter', 'helper'); + + /** + * Strict variables flag; when on, undefined variables accessed in the view + * scripts will trigger notices + * @var boolean + */ + private $_strictVars = false; + + /** + * Constructor. + * + * @param array $config Configuration key-value pairs. + */ + public function __construct($config = array()) + { + // set inital paths and properties + $this->setScriptPath(null); + + // $this->setHelperPath(null); + $this->setFilterPath(null); + + // user-defined escaping callback + if (array_key_exists('escape', $config)) { + $this->setEscape($config['escape']); + } + + // encoding + if (array_key_exists('encoding', $config)) { + $this->setEncoding($config['encoding']); + } + + // base path + if (array_key_exists('basePath', $config)) { + $prefix = 'Zend_View'; + if (array_key_exists('basePathPrefix', $config)) { + $prefix = $config['basePathPrefix']; + } + $this->setBasePath($config['basePath'], $prefix); + } + + // user-defined view script path + if (array_key_exists('scriptPath', $config)) { + $this->addScriptPath($config['scriptPath']); + } + + // user-defined helper path + if (array_key_exists('helperPath', $config)) { + if (is_array($config['helperPath'])) { + foreach ($config['helperPath'] as $prefix => $path) { + $this->addHelperPath($path, $prefix); + } + } else { + $prefix = 'Zend_View_Helper'; + if (array_key_exists('helperPathPrefix', $config)) { + $prefix = $config['helperPathPrefix']; + } + $this->addHelperPath($config['helperPath'], $prefix); + } + } + + // user-defined filter path + if (array_key_exists('filterPath', $config)) { + if (is_array($config['filterPath'])) { + foreach ($config['filterPath'] as $prefix => $path) { + $this->addFilterPath($path, $prefix); + } + } else { + $prefix = 'Zend_View_Filter'; + if (array_key_exists('filterPathPrefix', $config)) { + $prefix = $config['filterPathPrefix']; + } + $this->addFilterPath($config['filterPath'], $prefix); + } + } + + // user-defined filters + if (array_key_exists('filter', $config)) { + $this->addFilter($config['filter']); + } + + // strict vars + if (array_key_exists('strictVars', $config)) { + $this->strictVars($config['strictVars']); + } + + // LFI protection flag + if (array_key_exists('lfiProtectionOn', $config)) { + $this->setLfiProtection($config['lfiProtectionOn']); + } + + if (array_key_exists('assign', $config) + && is_array($config['assign']) + ) { + foreach ($config['assign'] as $key => $value) { + $this->assign($key, $value); + } + } + + $this->init(); + } + + /** + * Return the template engine object + * + * Returns the object instance, as it is its own template engine + * + * @return Zend_View_Abstract + */ + public function getEngine() + { + return $this; + } + + /** + * Allow custom object initialization when extending Zend_View_Abstract or + * Zend_View + * + * Triggered by {@link __construct() the constructor} as its final action. + * + * @return void + */ + public function init() + { + } + + /** + * Prevent E_NOTICE for nonexistent values + * + * If {@link strictVars()} is on, raises a notice. + * + * @param string $key + * @return null + */ + public function __get($key) + { + if ($this->_strictVars) { + trigger_error('Key "' . $key . '" does not exist', E_USER_NOTICE); + } + + return null; + } + + /** + * Allows testing with empty() and isset() to work inside + * templates. + * + * @param string $key + * @return boolean + */ + public function __isset($key) + { + if ('_' != substr($key, 0, 1)) { + return isset($this->$key); + } + + return false; + } + + /** + * Directly assigns a variable to the view script. + * + * Checks first to ensure that the caller is not attempting to set a + * protected or private member (by checking for a prefixed underscore); if + * not, the public member is set; otherwise, an exception is raised. + * + * @param string $key The variable name. + * @param mixed $val The variable value. + * @return void + * @throws Zend_View_Exception if an attempt to set a private or protected + * member is detected + */ + public function __set($key, $val) + { + if ('_' != substr($key, 0, 1)) { + $this->$key = $val; + return; + } + + $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); + $e->setView($this); + throw $e; + } + + /** + * Allows unset() on object properties to work + * + * @param string $key + * @return void + */ + public function __unset($key) + { + if ('_' != substr($key, 0, 1) && isset($this->$key)) { + unset($this->$key); + } + } + + /** + * Accesses a helper object from within a script. + * + * If the helper class has a 'view' property, sets it with the current view + * object. + * + * @param string $name The helper name. + * @param array $args The parameters for the helper. + * @return string The result of the helper output. + */ + public function __call($name, $args) + { + // is the helper already loaded? + $helper = $this->getHelper($name); + + // call the helper method + return call_user_func_array( + array($helper, $name), + $args + ); + } + + /** + * Given a base path, sets the script, helper, and filter paths relative to it + * + * Assumes a directory structure of: + * + * basePath/ + * scripts/ + * helpers/ + * filters/ + * + * + * @param string $path + * @param string $prefix Prefix to use for helper and filter paths + * @return Zend_View_Abstract + */ + public function setBasePath($path, $classPrefix = 'Zend_View') + { + $path = rtrim($path, '/'); + $path = rtrim($path, '\\'); + $path .= DIRECTORY_SEPARATOR; + $classPrefix = rtrim($classPrefix, '_') . '_'; + $this->setScriptPath($path . 'scripts'); + $this->setHelperPath($path . 'helpers', $classPrefix . 'Helper'); + $this->setFilterPath($path . 'filters', $classPrefix . 'Filter'); + return $this; + } + + /** + * Given a base path, add script, helper, and filter paths relative to it + * + * Assumes a directory structure of: + * + * basePath/ + * scripts/ + * helpers/ + * filters/ + * + * + * @param string $path + * @param string $prefix Prefix to use for helper and filter paths + * @return Zend_View_Abstract + */ + public function addBasePath($path, $classPrefix = 'Zend_View') + { + $path = rtrim($path, '/'); + $path = rtrim($path, '\\'); + $path .= DIRECTORY_SEPARATOR; + $classPrefix = rtrim($classPrefix, '_') . '_'; + $this->addScriptPath($path . 'scripts'); + $this->addHelperPath($path . 'helpers', $classPrefix . 'Helper'); + $this->addFilterPath($path . 'filters', $classPrefix . 'Filter'); + return $this; + } + + /** + * Adds to the stack of view script paths in LIFO order. + * + * @param string|array The directory (-ies) to add. + * @return Zend_View_Abstract + */ + public function addScriptPath($path) + { + $this->_addPath('script', $path); + return $this; + } + + /** + * Resets the stack of view script paths. + * + * To clear all paths, use Zend_View::setScriptPath(null). + * + * @param string|array The directory (-ies) to set as the path. + * @return Zend_View_Abstract + */ + public function setScriptPath($path) + { + $this->_path['script'] = array(); + $this->_addPath('script', $path); + return $this; + } + + /** + * Return full path to a view script specified by $name + * + * @param string $name + * @return false|string False if script not found + * @throws Zend_View_Exception if no script directory set + */ + public function getScriptPath($name) + { + try { + $path = $this->_script($name); + return $path; + } catch (Zend_View_Exception $e) { + if (strstr($e->getMessage(), 'no view script directory set')) { + throw $e; + } + + return false; + } + } + + /** + * Returns an array of all currently set script paths + * + * @return array + */ + public function getScriptPaths() + { + return $this->_getPaths('script'); + } + + /** + * Set plugin loader for a particular plugin type + * + * @param Zend_Loader_PluginLoader $loader + * @param string $type + * @return Zend_View_Abstract + */ + public function setPluginLoader(Zend_Loader_PluginLoader $loader, $type) + { + $type = strtolower($type); + if (!in_array($type, $this->_loaderTypes)) { + $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"', $type)); + $e->setView($this); + throw $e; + } + + $this->_loaders[$type] = $loader; + return $this; + } + + /** + * Retrieve plugin loader for a specific plugin type + * + * @param string $type + * @return Zend_Loader_PluginLoader + */ + public function getPluginLoader($type) + { + $type = strtolower($type); + if (!in_array($type, $this->_loaderTypes)) { + $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"; cannot retrieve', $type)); + $e->setView($this); + throw $e; + } + + if (!array_key_exists($type, $this->_loaders)) { + $prefix = 'Zend_View_'; + $pathPrefix = 'Zend/View/'; + + $pType = ucfirst($type); + switch ($type) { + case 'filter': + case 'helper': + default: + $prefix .= $pType; + $pathPrefix .= $pType; + $loader = new Zend_Loader_PluginLoader(array( + $prefix => $pathPrefix + )); + $this->_loaders[$type] = $loader; + break; + } + } + return $this->_loaders[$type]; + } + + /** + * Adds to the stack of helper paths in LIFO order. + * + * @param string|array The directory (-ies) to add. + * @param string $classPrefix Class prefix to use with classes in this + * directory; defaults to Zend_View_Helper + * @return Zend_View_Abstract + */ + public function addHelperPath($path, $classPrefix = 'Zend_View_Helper_') + { + return $this->_addPluginPath('helper', $classPrefix, (array) $path); + } + + /** + * Resets the stack of helper paths. + * + * To clear all paths, use Zend_View::setHelperPath(null). + * + * @param string|array $path The directory (-ies) to set as the path. + * @param string $classPrefix The class prefix to apply to all elements in + * $path; defaults to Zend_View_Helper + * @return Zend_View_Abstract + */ + public function setHelperPath($path, $classPrefix = 'Zend_View_Helper_') + { + unset($this->_loaders['helper']); + return $this->addHelperPath($path, $classPrefix); + } + + /** + * Get full path to a helper class file specified by $name + * + * @param string $name + * @return string|false False on failure, path on success + */ + public function getHelperPath($name) + { + return $this->_getPluginPath('helper', $name); + } + + /** + * Returns an array of all currently set helper paths + * + * @return array + */ + public function getHelperPaths() + { + return $this->getPluginLoader('helper')->getPaths(); + } + + /** + * Registers a helper object, bypassing plugin loader + * + * @param Zend_View_Helper_Abstract|object $helper + * @param string $name + * @return Zend_View_Abstract + * @throws Zend_View_Exception + */ + public function registerHelper($helper, $name) + { + if (!is_object($helper)) { + $e = new Zend_View_Exception('View helper must be an object'); + $e->setView($this); + throw $e; + } + + if (!$helper instanceof Zend_View_Interface) { + if (!method_exists($helper, $name)) { + $e = new Zend_View_Exception( + 'View helper must implement Zend_View_Interface or have a method matching the name provided' + ); + $e->setView($this); + throw $e; + } + } + + if (method_exists($helper, 'setView')) { + $helper->setView($this); + } + + $name = ucfirst($name); + $this->_helper[$name] = $helper; + return $this; + } + + /** + * Get a helper by name + * + * @param string $name + * @return object + */ + public function getHelper($name) + { + return $this->_getPlugin('helper', $name); + } + + /** + * Get array of all active helpers + * + * Only returns those that have already been instantiated. + * + * @return array + */ + public function getHelpers() + { + return $this->_helper; + } + + /** + * Adds to the stack of filter paths in LIFO order. + * + * @param string|array The directory (-ies) to add. + * @param string $classPrefix Class prefix to use with classes in this + * directory; defaults to Zend_View_Filter + * @return Zend_View_Abstract + */ + public function addFilterPath($path, $classPrefix = 'Zend_View_Filter_') + { + return $this->_addPluginPath('filter', $classPrefix, (array) $path); + } + + /** + * Resets the stack of filter paths. + * + * To clear all paths, use Zend_View::setFilterPath(null). + * + * @param string|array The directory (-ies) to set as the path. + * @param string $classPrefix The class prefix to apply to all elements in + * $path; defaults to Zend_View_Filter + * @return Zend_View_Abstract + */ + public function setFilterPath($path, $classPrefix = 'Zend_View_Filter_') + { + unset($this->_loaders['filter']); + return $this->addFilterPath($path, $classPrefix); + } + + /** + * Get full path to a filter class file specified by $name + * + * @param string $name + * @return string|false False on failure, path on success + */ + public function getFilterPath($name) + { + return $this->_getPluginPath('filter', $name); + } + + /** + * Get a filter object by name + * + * @param string $name + * @return object + */ + public function getFilter($name) + { + return $this->_getPlugin('filter', $name); + } + + /** + * Return array of all currently active filters + * + * Only returns those that have already been instantiated. + * + * @return array + */ + public function getFilters() + { + return $this->_filter; + } + + /** + * Returns an array of all currently set filter paths + * + * @return array + */ + public function getFilterPaths() + { + return $this->getPluginLoader('filter')->getPaths(); + } + + /** + * Return associative array of path types => paths + * + * @return array + */ + public function getAllPaths() + { + $paths = $this->_path; + $paths['helper'] = $this->getHelperPaths(); + $paths['filter'] = $this->getFilterPaths(); + return $paths; + } + + /** + * Add one or more filters to the stack in FIFO order. + * + * @param string|array One or more filters to add. + * @return Zend_View_Abstract + */ + public function addFilter($name) + { + foreach ((array) $name as $val) { + $this->_filter[] = $val; + } + return $this; + } + + /** + * Resets the filter stack. + * + * To clear all filters, use Zend_View::setFilter(null). + * + * @param string|array One or more filters to set. + * @return Zend_View_Abstract + */ + public function setFilter($name) + { + $this->_filter = array(); + $this->addFilter($name); + return $this; + } + + /** + * Sets the _escape() callback. + * + * @param mixed $spec The callback for _escape() to use. + * @return Zend_View_Abstract + */ + public function setEscape($spec) + { + $this->_escape = $spec; + return $this; + } + + /** + * Set LFI protection flag + * + * @param bool $flag + * @return Zend_View_Abstract + */ + public function setLfiProtection($flag) + { + $this->_lfiProtectionOn = (bool) $flag; + return $this; + } + + /** + * Return status of LFI protection flag + * + * @return bool + */ + public function isLfiProtectionOn() + { + return $this->_lfiProtectionOn; + } + + /** + * Assigns variables to the view script via differing strategies. + * + * Zend_View::assign('name', $value) assigns a variable called 'name' + * with the corresponding $value. + * + * Zend_View::assign($array) assigns the array keys as variable + * names (with the corresponding array values). + * + * @see __set() + * @param string|array The assignment strategy to use. + * @param mixed (Optional) If assigning a named variable, use this + * as the value. + * @return Zend_View_Abstract Fluent interface + * @throws Zend_View_Exception if $spec is neither a string nor an array, + * or if an attempt to set a private or protected member is detected + */ + public function assign($spec, $value = null) + { + // which strategy to use? + if (is_string($spec)) { + // assign by name and value + if ('_' == substr($spec, 0, 1)) { + $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); + $e->setView($this); + throw $e; + } + $this->$spec = $value; + } elseif (is_array($spec)) { + // assign from associative array + $error = false; + foreach ($spec as $key => $val) { + if ('_' == substr($key, 0, 1)) { + $error = true; + break; + } + $this->$key = $val; + } + if ($error) { + $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); + $e->setView($this); + throw $e; + } + } else { + $e = new Zend_View_Exception('assign() expects a string or array, received ' . gettype($spec)); + $e->setView($this); + throw $e; + } + + return $this; + } + + /** + * Return list of all assigned variables + * + * Returns all public properties of the object. Reflection is not used + * here as testing reflection properties for visibility is buggy. + * + * @return array + */ + public function getVars() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ('_' == substr($key, 0, 1)) { + unset($vars[$key]); + } + } + + return $vars; + } + + /** + * Clear all assigned variables + * + * Clears all variables assigned to Zend_View either via {@link assign()} or + * property overloading ({@link __set()}). + * + * @return void + */ + public function clearVars() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ('_' != substr($key, 0, 1)) { + unset($this->$key); + } + } + } + + /** + * Processes a view script and returns the output. + * + * @param string $name The script name to process. + * @return string The script output. + */ + public function render($name) + { + // find the script file name using the parent private method + $this->_file = $this->_script($name); + unset($name); // remove $name from local scope + + ob_start(); + $this->_run($this->_file); + + return $this->_filter(ob_get_clean()); // filter output + } + + /** + * Escapes a value for output in a view script. + * + * If escaping mechanism is one of htmlspecialchars or htmlentities, uses + * {@link $_encoding} setting. + * + * @param mixed $var The output to escape. + * @return mixed The escaped value. + */ + public function escape($var) + { + if (in_array($this->_escape, array('htmlspecialchars', 'htmlentities'))) { + return call_user_func($this->_escape, $var, ENT_COMPAT, $this->_encoding); + } + + if (1 == func_num_args()) { + return call_user_func($this->_escape, $var); + } + $args = func_get_args(); + return call_user_func_array($this->_escape, $args); + } + + /** + * Set encoding to use with htmlentities() and htmlspecialchars() + * + * @param string $encoding + * @return Zend_View_Abstract + */ + public function setEncoding($encoding) + { + $this->_encoding = $encoding; + return $this; + } + + /** + * Return current escape encoding + * + * @return string + */ + public function getEncoding() + { + return $this->_encoding; + } + + /** + * Enable or disable strict vars + * + * If strict variables are enabled, {@link __get()} will raise a notice + * when a variable is not defined. + * + * Use in conjunction with {@link Zend_View_Helper_DeclareVars the declareVars() helper} + * to enforce strict variable handling in your view scripts. + * + * @param boolean $flag + * @return Zend_View_Abstract + */ + public function strictVars($flag = true) + { + $this->_strictVars = ($flag) ? true : false; + + return $this; + } + + /** + * Finds a view script from the available directories. + * + * @param string $name The base name of the script. + * @return void + */ + protected function _script($name) + { + if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { + $e = new Zend_View_Exception('Requested scripts may not include parent directory traversal ("../", "..\\" notation)'); + $e->setView($this); + throw $e; + } + + if (0 == count($this->_path['script'])) { + $e = new Zend_View_Exception('no view script directory set; unable to determine location for view script'); + $e->setView($this); + throw $e; + } + + foreach ($this->_path['script'] as $dir) { + if (is_readable($dir . $name)) { + return $dir . $name; + } + } + + $message = "script '$name' not found in path (" + . implode(PATH_SEPARATOR, $this->_path['script']) + . ")"; + $e = new Zend_View_Exception($message); + $e->setView($this); + throw $e; + } + + /** + * Applies the filter callback to a buffer. + * + * @param string $buffer The buffer contents. + * @return string The filtered buffer. + */ + private function _filter($buffer) + { + // loop through each filter class + foreach ($this->_filter as $name) { + // load and apply the filter class + $filter = $this->getFilter($name); + $buffer = call_user_func(array($filter, 'filter'), $buffer); + } + + // done! + return $buffer; + } + + /** + * Adds paths to the path stack in LIFO order. + * + * Zend_View::_addPath($type, 'dirname') adds one directory + * to the path stack. + * + * Zend_View::_addPath($type, $array) adds one directory for + * each array element value. + * + * In the case of filter and helper paths, $prefix should be used to + * specify what class prefix to use with the given path. + * + * @param string $type The path type ('script', 'helper', or 'filter'). + * @param string|array $path The path specification. + * @param string $prefix Class prefix to use with path (helpers and filters + * only) + * @return void + */ + private function _addPath($type, $path, $prefix = null) + { + foreach ((array) $path as $dir) { + // attempt to strip any possible separator and + // append the system directory separator + $dir = rtrim($dir, '/'); + $dir = rtrim($dir, '\\'); + $dir .= '/'; + + switch ($type) { + case 'script': + // add to the top of the stack. + array_unshift($this->_path[$type], $dir); + break; + case 'filter': + case 'helper': + default: + // add as array with prefix and dir keys + array_unshift($this->_path[$type], array('prefix' => $prefix, 'dir' => $dir)); + break; + } + } + } + + /** + * Resets the path stack for helpers and filters. + * + * @param string $type The path type ('helper' or 'filter'). + * @param string|array $path The directory (-ies) to set as the path. + * @param string $classPrefix Class prefix to apply to elements of $path + */ + private function _setPath($type, $path, $classPrefix = null) + { + $dir = DIRECTORY_SEPARATOR . ucfirst($type) . DIRECTORY_SEPARATOR; + + switch ($type) { + case 'script': + $this->_path[$type] = array(dirname(__FILE__) . $dir); + $this->_addPath($type, $path); + break; + case 'filter': + case 'helper': + default: + $this->_path[$type] = array(array( + 'prefix' => 'Zend_View_' . ucfirst($type) . '_', + 'dir' => dirname(__FILE__) . $dir + )); + $this->_addPath($type, $path, $classPrefix); + break; + } + } + + /** + * Return all paths for a given path type + * + * @param string $type The path type ('helper', 'filter', 'script') + * @return array + */ + private function _getPaths($type) + { + return $this->_path[$type]; + } + + /** + * Register helper class as loaded + * + * @param string $name + * @param string $class + * @param string $file path to class file + * @return void + */ + private function _setHelperClass($name, $class, $file) + { + $this->_helperLoadedDir[$name] = $file; + $this->_helperLoaded[$name] = $class; + } + + /** + * Register filter class as loaded + * + * @param string $name + * @param string $class + * @param string $file path to class file + * @return void + */ + private function _setFilterClass($name, $class, $file) + { + $this->_filterLoadedDir[$name] = $file; + $this->_filterLoaded[$name] = $class; + } + + /** + * Add a prefixPath for a plugin type + * + * @param string $type + * @param string $classPrefix + * @param array $paths + * @return Zend_View_Abstract + */ + private function _addPluginPath($type, $classPrefix, array $paths) + { + $loader = $this->getPluginLoader($type); + foreach ($paths as $path) { + $loader->addPrefixPath($classPrefix, $path); + } + return $this; + } + + /** + * Get a path to a given plugin class of a given type + * + * @param string $type + * @param string $name + * @return string|false + */ + private function _getPluginPath($type, $name) + { + $loader = $this->getPluginLoader($type); + if ($loader->isLoaded($name)) { + return $loader->getClassPath($name); + } + + try { + $loader->load($name); + return $loader->getClassPath($name); + } catch (Zend_Loader_Exception $e) { + return false; + } + } + + /** + * Retrieve a plugin object + * + * @param string $type + * @param string $name + * @return object + */ + private function _getPlugin($type, $name) + { + $name = ucfirst($name); + switch ($type) { + case 'filter': + $storeVar = '_filterClass'; + $store = $this->_filterClass; + break; + case 'helper': + $storeVar = '_helper'; + $store = $this->_helper; + break; + } + + if (!isset($store[$name])) { + $class = $this->getPluginLoader($type)->load($name); + $store[$name] = new $class(); + if (method_exists($store[$name], 'setView')) { + $store[$name]->setView($this); + } + } + + $this->$storeVar = $store; + return $store[$name]; + } + + /** + * Use to include the view script in a scope that only allows public + * members. + * + * @return mixed + */ + abstract protected function _run(); +} diff --git a/library/vendor/Zend/View/Exception.php b/library/vendor/Zend/View/Exception.php new file mode 100644 index 0000000..87685b8 --- /dev/null +++ b/library/vendor/Zend/View/Exception.php @@ -0,0 +1,50 @@ +view = $view; + return $this; + } + + public function getView() + { + return $this->view; + } +} diff --git a/library/vendor/Zend/View/Helper/Abstract.php b/library/vendor/Zend/View/Helper/Abstract.php new file mode 100644 index 0000000..0946bc3 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Abstract.php @@ -0,0 +1,63 @@ +view = $view; + return $this; + } + + /** + * Strategy pattern: currently unutilized + * + * @return void + */ + public function direct() + { + } +} diff --git a/library/vendor/Zend/View/Helper/Action.php b/library/vendor/Zend/View/Helper/Action.php new file mode 100644 index 0000000..5020a47 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Action.php @@ -0,0 +1,161 @@ +getControllerDirectory(); + if (empty($modules)) { + $e = new Zend_View_Exception('Action helper depends on valid front controller instance'); + $e->setView($this->view); + throw $e; + } + + $request = $front->getRequest(); + $response = $front->getResponse(); + + if (empty($request) || empty($response)) { + $e = new Zend_View_Exception('Action view helper requires both a registered request and response object in the front controller instance'); + $e->setView($this->view); + throw $e; + } + + $this->request = clone $request; + $this->response = clone $response; + $this->dispatcher = clone $front->getDispatcher(); + $this->defaultModule = $front->getDefaultModule(); + } + + /** + * Reset object states + * + * @return void + */ + public function resetObjects() + { + $params = $this->request->getUserParams(); + foreach (array_keys($params) as $key) { + $this->request->setParam($key, null); + } + + $this->response->clearBody(); + $this->response->clearHeaders() + ->clearRawHeaders(); + } + + /** + * Retrieve rendered contents of a controller action + * + * If the action results in a forward or redirect, returns empty string. + * + * @param string $action + * @param string $controller + * @param string $module Defaults to default module + * @param array $params + * @return string + */ + public function action($action, $controller, $module = null, array $params = array()) + { + $this->resetObjects(); + if (null === $module) { + $module = $this->defaultModule; + } + + // clone the view object to prevent over-writing of view variables + $viewRendererObj = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); + Zend_Controller_Action_HelperBroker::addHelper(clone $viewRendererObj); + + $this->request->setParams($params) + ->setModuleName($module) + ->setControllerName($controller) + ->setActionName($action) + ->setDispatched(true); + + $this->dispatcher->dispatch($this->request, $this->response); + + // reset the viewRenderer object to it's original state + Zend_Controller_Action_HelperBroker::addHelper($viewRendererObj); + + + if (!$this->request->isDispatched() + || $this->response->isRedirect()) + { + // forwards and redirects render nothing + return ''; + } + + $return = $this->response->getBody(); + $this->resetObjects(); + return $return; + } + + /** + * Clone the current View + * + * @return Zend_View_Interface + */ + public function cloneView() + { + $view = clone $this->view; + $view->clearVars(); + return $view; + } +} diff --git a/library/vendor/Zend/View/Helper/BaseUrl.php b/library/vendor/Zend/View/Helper/BaseUrl.php new file mode 100644 index 0000000..48f8049 --- /dev/null +++ b/library/vendor/Zend/View/Helper/BaseUrl.php @@ -0,0 +1,114 @@ +getBaseUrl(); + + // Remove trailing slashes + if (null !== $file) { + $file = '/' . ltrim($file, '/\\'); + } + + return $baseUrl . $file; + } + + /** + * Set BaseUrl + * + * @param string $base + * @return Zend_View_Helper_BaseUrl + */ + public function setBaseUrl($base) + { + $this->_baseUrl = rtrim($base, '/\\'); + return $this; + } + + /** + * Get BaseUrl + * + * @return string + */ + public function getBaseUrl() + { + if ($this->_baseUrl === null) { + /** @see Zend_Controller_Front */ + $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); + + // Remove scriptname, eg. index.php from baseUrl + $baseUrl = $this->_removeScriptName($baseUrl); + + $this->setBaseUrl($baseUrl); + } + + return $this->_baseUrl; + } + + /** + * Remove Script filename from baseurl + * + * @param string $url + * @return string + */ + protected function _removeScriptName($url) + { + if (!isset($_SERVER['SCRIPT_NAME'])) { + // We can't do much now can we? (Well, we could parse out by ".") + return $url; + } + + if (($pos = strripos($url, basename($_SERVER['SCRIPT_NAME']))) !== false) { + $url = substr($url, 0, $pos); + } + + return $url; + } +} diff --git a/library/vendor/Zend/View/Helper/Cycle.php b/library/vendor/Zend/View/Helper/Cycle.php new file mode 100644 index 0000000..eb5fd51 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Cycle.php @@ -0,0 +1,225 @@ +-1) ; + + /** + * Array of values + * + * @var array + */ + protected $_data = array(self::DEFAULT_NAME=>array()); + + /** + * Actual name of cycle + * + * @var string + */ + protected $_name = self::DEFAULT_NAME; + + /** + * Add elements to alternate + * + * @param array $data + * @param string $name + * @return Zend_View_Helper_Cycle + */ + public function cycle(array $data = array(), $name = self::DEFAULT_NAME) + { + if(!empty($data)) + $this->_data[$name] = $data; + + $this->setName($name); + return $this; + } + + /** + * Add elements to alternate + * + * @param array $data + * @param string $name + * @return Zend_View_Helper_Cycle + */ + public function assign(Array $data , $name = self::DEFAULT_NAME) + { + $this->setName($name); + $this->_data[$name] = $data; + $this->rewind(); + return $this; + } + + /** + * Sets actual name of cycle + * + * @param string $name + * @return Zend_View_Helper_Cycle + */ + public function setName($name = self::DEFAULT_NAME) + { + $this->_name = $name; + + if(!isset($this->_data[$this->_name])) + $this->_data[$this->_name] = array(); + + if(!isset($this->_pointers[$this->_name])) + $this->rewind(); + + return $this; + } + + /** + * Gets actual name of cycle + * + * @return string + */ + public function getName() + { + return $this->_name; + } + + + /** + * Return all elements + * + * @return array + */ + public function getAll() + { + return $this->_data[$this->_name]; + } + + /** + * Turn helper into string + * + * @return string + */ + public function toString() + { + return (string) $this->_data[$this->_name][$this->key()]; + } + + /** + * Cast to string + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Move to next value + * + * @return Zend_View_Helper_Cycle + */ + public function next() + { + $count = count($this->_data[$this->_name]); + if ($this->_pointers[$this->_name] == ($count - 1)) + $this->_pointers[$this->_name] = 0; + else + $this->_pointers[$this->_name] = ++$this->_pointers[$this->_name]; + return $this; + } + + /** + * Move to previous value + * + * @return Zend_View_Helper_Cycle + */ + public function prev() + { + $count = count($this->_data[$this->_name]); + if ($this->_pointers[$this->_name] <= 0) + $this->_pointers[$this->_name] = $count - 1; + else + $this->_pointers[$this->_name] = --$this->_pointers[$this->_name]; + return $this; + } + + /** + * Return iteration number + * + * @return int + */ + public function key() + { + if ($this->_pointers[$this->_name] < 0) + return 0; + else + return $this->_pointers[$this->_name]; + } + + /** + * Rewind pointer + * + * @return Zend_View_Helper_Cycle + */ + public function rewind() + { + $this->_pointers[$this->_name] = -1; + return $this; + } + + /** + * Check if element is valid + * + * @return bool + */ + public function valid() + { + return isset($this->_data[$this->_name][$this->key()]); + } + + /** + * Return current element + * + * @return mixed + */ + public function current() + { + return $this->_data[$this->_name][$this->key()]; + } +} diff --git a/library/vendor/Zend/View/Helper/DeclareVars.php b/library/vendor/Zend/View/Helper/DeclareVars.php new file mode 100644 index 0000000..a6c0fcf --- /dev/null +++ b/library/vendor/Zend/View/Helper/DeclareVars.php @@ -0,0 +1,94 @@ + + * $this->declareVars( + * 'varName1', + * 'varName2', + * array('varName3' => 'defaultValue', + * 'varName4' => array() + * ) + * ); + * + * + * @param string|array variable number of arguments, all string names of variables to test + * @return void + */ + public function declareVars() + { + $args = func_get_args(); + foreach($args as $key) { + if (is_array($key)) { + foreach ($key as $name => $value) { + $this->_declareVar($name, $value); + } + } else if (!isset($view->$key)) { + $this->_declareVar($key); + } + } + } + + /** + * Set a view variable + * + * Checks to see if a $key is set in the view object; if not, sets it to $value. + * + * @param string $key + * @param string $value Defaults to an empty string + * @return void + */ + protected function _declareVar($key, $value = '') + { + if (!isset($this->view->$key)) { + $this->view->$key = $value; + } + } +} diff --git a/library/vendor/Zend/View/Helper/Doctype.php b/library/vendor/Zend/View/Helper/Doctype.php new file mode 100644 index 0000000..866b193 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Doctype.php @@ -0,0 +1,239 @@ +_regKey)) { + $this->_registry = new ArrayObject(array( + 'doctypes' => array( + self::XHTML11 => '', + self::XHTML1_STRICT => '', + self::XHTML1_TRANSITIONAL => '', + self::XHTML1_FRAMESET => '', + self::XHTML1_RDFA => '', + self::XHTML1_RDFA11 => '', + self::XHTML_BASIC1 => '', + self::XHTML5 => '', + self::HTML4_STRICT => '', + self::HTML4_LOOSE => '', + self::HTML4_FRAMESET => '', + self::HTML5 => '', + ) + )); + Zend_Registry::set($this->_regKey, $this->_registry); + $this->setDoctype($this->_defaultDoctype); + } else { + $this->_registry = Zend_Registry::get($this->_regKey); + } + } + + /** + * Set or retrieve doctype + * + * @param string $doctype + * @return Zend_View_Helper_Doctype + */ + public function doctype($doctype = null) + { + if (null !== $doctype) { + switch ($doctype) { + case self::XHTML11: + case self::XHTML1_STRICT: + case self::XHTML1_TRANSITIONAL: + case self::XHTML1_FRAMESET: + case self::XHTML_BASIC1: + case self::XHTML1_RDFA: + case self::XHTML1_RDFA11: + case self::XHTML5: + case self::HTML4_STRICT: + case self::HTML4_LOOSE: + case self::HTML4_FRAMESET: + case self::HTML5: + $this->setDoctype($doctype); + break; + default: + if (substr($doctype, 0, 9) != 'setView($this->view); + throw $e; + } + if (stristr($doctype, 'xhtml')) { + $type = self::CUSTOM_XHTML; + } else { + $type = self::CUSTOM; + } + $this->setDoctype($type); + $this->_registry['doctypes'][$type] = $doctype; + break; + } + } + + return $this; + } + + /** + * Set doctype + * + * @param string $doctype + * @return Zend_View_Helper_Doctype + */ + public function setDoctype($doctype) + { + $this->_registry['doctype'] = $doctype; + return $this; + } + + /** + * Retrieve doctype + * + * @return string + */ + public function getDoctype() + { + return $this->_registry['doctype']; + } + + /** + * Get doctype => string mappings + * + * @return array + */ + public function getDoctypes() + { + return $this->_registry['doctypes']; + } + + /** + * Is doctype XHTML? + * + * @return boolean + */ + public function isXhtml() + { + return (stristr($this->getDoctype(), 'xhtml') ? true : false); + } + + /** + * Is doctype strict? + * + * @return boolean + */ + public function isStrict() + { + switch ( $this->getDoctype() ) + { + case self::XHTML1_STRICT: + case self::XHTML11: + case self::HTML4_STRICT: + return true; + default: + return false; + } + } + + /** + * Is doctype HTML5? (HeadMeta uses this for validation) + * + * @return booleean + */ + public function isHtml5() { + return (stristr($this->doctype(), '') ? true : false); + } + + /** + * Is doctype RDFa? + * + * @return booleean + */ + public function isRdfa() { + return (stristr($this->getDoctype(), 'rdfa') ? true : false); + } + + /** + * String representation of doctype + * + * @return string + */ + public function __toString() + { + $doctypes = $this->getDoctypes(); + return $doctypes[$this->getDoctype()]; + } +} diff --git a/library/vendor/Zend/View/Helper/Fieldset.php b/library/vendor/Zend/View/Helper/Fieldset.php new file mode 100644 index 0000000..5456782 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Fieldset.php @@ -0,0 +1,78 @@ +_getInfo($name, $content, $attribs); + extract($info); + + // get legend + $legend = ''; + if (isset($attribs['legend'])) { + $legendString = trim($attribs['legend']); + if (!empty($legendString)) { + $legend = '' + . (($escape) ? $this->view->escape($legendString) : $legendString) + . '' . PHP_EOL; + } + unset($attribs['legend']); + } + + // get id + if (!empty($id)) { + $id = ' id="' . $this->view->escape($id) . '"'; + } else { + $id = ''; + } + + // render fieldset + $xhtml = '_htmlAttribs($attribs) + . '>' + . $legend + . $content + . ''; + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/Form.php b/library/vendor/Zend/View/Helper/Form.php new file mode 100644 index 0000000..87811d4 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Form.php @@ -0,0 +1,85 @@ +_getInfo($name, $content, $attribs); + extract($info); + + if (!empty($id)) { + $id = ' id="' . $this->view->escape($id) . '"'; + } else { + $id = ''; + } + + if (array_key_exists('id', $attribs) && empty($attribs['id'])) { + unset($attribs['id']); + } + + if (!empty($name) && !($this->_isXhtml() && $this->_isStrictDoctype())) { + $name = ' name="' . $this->view->escape($name) . '"'; + } else { + $name = ''; + } + + if ($this->_isHtml5() && array_key_exists('action', $attribs) && !$attribs['action']) { + unset($attribs['action']); + } + + if ( array_key_exists('name', $attribs) && empty($attribs['id'])) { + unset($attribs['id']); + } + + $xhtml = '_htmlAttribs($attribs) + . '>'; + + if (false !== $content) { + $xhtml .= $content + . ''; + } + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormButton.php b/library/vendor/Zend/View/Helper/FormButton.php new file mode 100644 index 0000000..312952e --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormButton.php @@ -0,0 +1,104 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, id, value, attribs, options, listsep, disable, escape + + // Get content + $content = ''; + if (isset($attribs['content'])) { + $content = $attribs['content']; + unset($attribs['content']); + } else { + $content = $value; + } + + // Ensure type is sane + $type = 'button'; + if (isset($attribs['type'])) { + $attribs['type'] = strtolower($attribs['type']); + if (in_array($attribs['type'], array('submit', 'reset', 'button'))) { + $type = $attribs['type']; + } + unset($attribs['type']); + } + + // build the element + if ($disable) { + $attribs['disabled'] = 'disabled'; + } + + $content = ($escape) ? $this->view->escape($content) : $content; + + $xhtml = 'view->escape($value) . '"'; + } + + // add attributes and close start tag + $xhtml .= $this->_htmlAttribs($attribs) . '>'; + + // add content and end tag + $xhtml .= $content . ''; + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormCheckbox.php b/library/vendor/Zend/View/Helper/FormCheckbox.php new file mode 100644 index 0000000..4acf3cb --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormCheckbox.php @@ -0,0 +1,163 @@ + '1', + 'uncheckedValue' => '0' + ); + + /** + * Generates a 'checkbox' element. + * + * @access public + * + * @param string|array $name If a string, the element name. If an + * array, all other parameters are ignored, and the array elements + * are extracted in place of added parameters. + * @param mixed $value The element value. + * @param array $attribs Attributes for the element tag. + * @return string The element XHTML. + */ + public function formCheckbox($name, $value = null, $attribs = null, array $checkedOptions = null) + { + $info = $this->_getInfo($name, $value, $attribs); + extract($info); // name, id, value, attribs, options, listsep, disable + + $checked = false; + if (isset($attribs['checked']) && $attribs['checked']) { + $checked = true; + unset($attribs['checked']); + } elseif (isset($attribs['checked'])) { + $checked = false; + unset($attribs['checked']); + } + + $checkedOptions = self::determineCheckboxInfo($value, $checked, $checkedOptions); + + // is the element disabled? + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + // build the element + $xhtml = ''; + if ((!$disable && !strstr($name, '[]')) + && (empty($attribs['disableHidden']) || !$attribs['disableHidden']) + ) { + $xhtml = $this->_hidden($name, $checkedOptions['uncheckedValue']); + } + + if (array_key_exists('disableHidden', $attribs)) { + unset($attribs['disableHidden']); + } + + $xhtml .= '_htmlAttribs($attribs) + . $this->getClosingBracket(); + + return $xhtml; + } + + /** + * Determine checkbox information + * + * @param string $value + * @param bool $checked + * @param array|null $checkedOptions + * @return array + */ + public static function determineCheckboxInfo($value, $checked, array $checkedOptions = null) + { + // Checked/unchecked values + $checkedValue = null; + $uncheckedValue = null; + if (is_array($checkedOptions)) { + if (array_key_exists('checkedValue', $checkedOptions)) { + $checkedValue = (string) $checkedOptions['checkedValue']; + unset($checkedOptions['checkedValue']); + } + if (array_key_exists('uncheckedValue', $checkedOptions)) { + $uncheckedValue = (string) $checkedOptions['uncheckedValue']; + unset($checkedOptions['uncheckedValue']); + } + if (null === $checkedValue) { + $checkedValue = (string) array_shift($checkedOptions); + } + if (null === $uncheckedValue) { + $uncheckedValue = (string) array_shift($checkedOptions); + } + } elseif ($value !== null) { + $uncheckedValue = self::$_defaultCheckedOptions['uncheckedValue']; + } else { + $checkedValue = self::$_defaultCheckedOptions['checkedValue']; + $uncheckedValue = self::$_defaultCheckedOptions['uncheckedValue']; + } + + // is the element checked? + $checkedString = ''; + if ($checked || ((string) $value === $checkedValue)) { + $checkedString = ' checked="checked"'; + $checked = true; + } else { + $checked = false; + } + + // Checked value should be value if no checked options provided + if ($checkedValue == null) { + $checkedValue = $value; + } + + return array( + 'checked' => $checked, + 'checkedString' => $checkedString, + 'checkedValue' => $checkedValue, + 'uncheckedValue' => $uncheckedValue, + ); + } +} diff --git a/library/vendor/Zend/View/Helper/FormElement.php b/library/vendor/Zend/View/Helper/FormElement.php new file mode 100644 index 0000000..25f77b5 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormElement.php @@ -0,0 +1,202 @@ +_translator; + } + + /** + * Set translator + * + * @param Zend_Translate|Zend_Translate_Adapter|null $translator + * @return Zend_View_Helper_FormElement + */ + public function setTranslator($translator = null) + { + if (null === $translator) { + $this->_translator = null; + } elseif ($translator instanceof Zend_Translate_Adapter) { + $this->_translator = $translator; + } elseif ($translator instanceof Zend_Translate) { + $this->_translator = $translator->getAdapter(); + } else { + $e = new Zend_View_Exception('Invalid translator specified'); + $e->setView($this->view); + throw $e; + } + return $this; + } + + /** + * Converts parameter arguments to an element info array. + * + * E.g, formExample($name, $value, $attribs, $options, $listsep) is + * the same thing as formExample(array('name' => ...)). + * + * Note that you cannot pass a 'disable' param; you need to pass + * it as an 'attribs' key. + * + * @access protected + * + * @return array An element info array with keys for name, value, + * attribs, options, listsep, disable, and escape. + */ + protected function _getInfo($name, $value = null, $attribs = null, + $options = null, $listsep = null + ) { + // the baseline info. note that $name serves a dual purpose; + // if an array, it's an element info array that will override + // these baseline values. as such, ignore it for the 'name' + // if it's an array. + $info = array( + 'name' => is_array($name) ? '' : $name, + 'id' => is_array($name) ? '' : $name, + 'value' => $value, + 'attribs' => $attribs, + 'options' => $options, + 'listsep' => $listsep, + 'disable' => false, + 'escape' => true, + ); + + // override with named args + if (is_array($name)) { + // only set keys that are already in info + foreach ($info as $key => $val) { + if (isset($name[$key])) { + $info[$key] = $name[$key]; + } + } + + // If all helper options are passed as an array, attribs may have + // been as well + if (null === $attribs) { + $attribs = $info['attribs']; + } + } + + $attribs = (array)$attribs; + + // Normalize readonly tag + if (array_key_exists('readonly', $attribs)) { + $attribs['readonly'] = 'readonly'; + } + + // Disable attribute + if (array_key_exists('disable', $attribs)) { + if (is_scalar($attribs['disable'])) { + // disable the element + $info['disable'] = (bool)$attribs['disable']; + } else if (is_array($attribs['disable'])) { + $info['disable'] = $attribs['disable']; + } + } + + // Set ID for element + if (array_key_exists('id', $attribs)) { + $info['id'] = (string)$attribs['id']; + } else if ('' !== $info['name']) { + $info['id'] = trim(strtr($info['name'], + array('[' => '-', ']' => '')), '-'); + } + + // Remove NULL name attribute override + if (array_key_exists('name', $attribs) && is_null($attribs['name'])) { + unset($attribs['name']); + } + + // Override name in info if specified in attribs + if (array_key_exists('name', $attribs) && $attribs['name'] != $info['name']) { + $info['name'] = $attribs['name']; + } + + // Determine escaping from attributes + if (array_key_exists('escape', $attribs)) { + $info['escape'] = (bool)$attribs['escape']; + } + + // Determine listsetp from attributes + if (array_key_exists('listsep', $attribs)) { + $info['listsep'] = (string)$attribs['listsep']; + } + + // Remove attribs that might overwrite the other keys. We do this LAST + // because we needed the other attribs values earlier. + foreach ($info as $key => $val) { + if (array_key_exists($key, $attribs)) { + unset($attribs[$key]); + } + } + $info['attribs'] = $attribs; + + // done! + return $info; + } + + /** + * Creates a hidden element. + * + * We have this as a common method because other elements often + * need hidden elements for their operation. + * + * @access protected + * + * @param string $name The element name. + * @param string $value The element value. + * @param array $attribs Attributes for the element. + * + * @return string A hidden element. + */ + protected function _hidden($name, $value = null, $attribs = null) + { + return '_htmlAttribs($attribs) . $this->getClosingBracket(); + } +} diff --git a/library/vendor/Zend/View/Helper/FormErrors.php b/library/vendor/Zend/View/Helper/FormErrors.php new file mode 100644 index 0000000..b57d851 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormErrors.php @@ -0,0 +1,166 @@ +'; + protected $_htmlElementStart = '
  • '; + protected $_htmlElementSeparator = '
  • '; + /**#@-*/ + + /** + * Render form errors + * + * @param string|array $errors Error(s) to render + * @param array $options + * @return string + */ + public function formErrors($errors, array $options = null) + { + $escape = true; + if (isset($options['escape'])) { + $escape = (bool) $options['escape']; + unset($options['escape']); + } + + if (empty($options['class'])) { + $options['class'] = 'errors'; + } + + if (isset($options['elementStart'])) { + $this->setElementStart($options['elementStart']); + } + if (isset($options['elementEnd'])) { + $this->setElementEnd($options['elementEnd']); + } + if (isset($options['elementSeparator'])) { + $this->setElementSeparator($options['elementSeparator']); + } + + $start = $this->getElementStart(); + if (strstr($start, '%s')) { + $attribs = $this->_htmlAttribs($options); + $start = sprintf($start, $attribs); + } + + if ($escape) { + foreach ($errors as $key => $error) { + $errors[$key] = $this->view->escape($error); + } + } + + $html = $start + . implode($this->getElementSeparator(), (array) $errors) + . $this->getElementEnd(); + + return $html; + } + + /** + * Set end string for displaying errors + * + * @param string $string + * @return Zend_View_Helper_FormErrors + */ + public function setElementEnd($string) + { + $this->_htmlElementEnd = (string) $string; + return $this; + } + + /** + * Retrieve end string for displaying errors + * + * @return string + */ + public function getElementEnd() + { + return $this->_htmlElementEnd; + } + + /** + * Set separator string for displaying errors + * + * @param string $string + * @return Zend_View_Helper_FormErrors + */ + public function setElementSeparator($string) + { + $this->_htmlElementSeparator = (string) $string; + return $this; + } + + /** + * Retrieve separator string for displaying errors + * + * @return string + */ + public function getElementSeparator() + { + return $this->_htmlElementSeparator; + } + + /** + * Set start string for displaying errors + * + * @param string $string + * @return Zend_View_Helper_FormErrors + */ + public function setElementStart($string) + { + $this->_htmlElementStart = (string) $string; + return $this; + } + + /** + * Retrieve start string for displaying errors + * + * @return string + */ + public function getElementStart() + { + return $this->_htmlElementStart; + } + +} diff --git a/library/vendor/Zend/View/Helper/FormFile.php b/library/vendor/Zend/View/Helper/FormFile.php new file mode 100644 index 0000000..24a37db --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormFile.php @@ -0,0 +1,74 @@ +_getInfo($name, null, $attribs); + extract($info); // name, id, value, attribs, options, listsep, disable + + // is it disabled? + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + // build the element + $xhtml = '_htmlAttribs($attribs) + . $this->getClosingBracket(); + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormHidden.php b/library/vendor/Zend/View/Helper/FormHidden.php new file mode 100644 index 0000000..36c9c9b --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormHidden.php @@ -0,0 +1,65 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable + if (isset($id)) { + if (isset($attribs) && is_array($attribs)) { + $attribs['id'] = $id; + } else { + $attribs = array('id' => $id); + } + } + return $this->_hidden($name, $value, $attribs); + } +} diff --git a/library/vendor/Zend/View/Helper/FormImage.php b/library/vendor/Zend/View/Helper/FormImage.php new file mode 100644 index 0000000..31d6545 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormImage.php @@ -0,0 +1,94 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable + + // Determine if we should use the value or the src attribute + if (isset($attribs['src'])) { + $src = ' src="' . $this->view->escape($attribs['src']) . '"'; + unset($attribs['src']); + } else { + $src = ' src="' . $this->view->escape($value) . '"'; + unset($value); + } + + // Do we have a value? + if (isset($value) && !empty($value)) { + $value = ' value="' . $this->view->escape($value) . '"'; + } else { + $value = ''; + } + + // Disabled? + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + // build the element + $xhtml = '_htmlAttribs($attribs) + . $this->getClosingBracket(); + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormLabel.php b/library/vendor/Zend/View/Helper/FormLabel.php new file mode 100644 index 0000000..8b5fa71 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormLabel.php @@ -0,0 +1,71 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable, escape + + // build the element + if ($disable) { + // disabled; display nothing + return ''; + } + + $value = ($escape) ? $this->view->escape($value) : $value; + $for = (empty($attribs['disableFor']) || !$attribs['disableFor']) + ? ' for="' . $this->view->escape($id) . '"' + : ''; + if (array_key_exists('disableFor', $attribs)) { + unset($attribs['disableFor']); + } + + // enabled; display label + $xhtml = '_htmlAttribs($attribs) + . '>' . $value . ''; + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormMultiCheckbox.php b/library/vendor/Zend/View/Helper/FormMultiCheckbox.php new file mode 100644 index 0000000..3147369 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormMultiCheckbox.php @@ -0,0 +1,73 @@ +\n") + { + return $this->formRadio($name, $value, $attribs, $options, $listsep); + } +} diff --git a/library/vendor/Zend/View/Helper/FormNote.php b/library/vendor/Zend/View/Helper/FormNote.php new file mode 100644 index 0000000..adeb411 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormNote.php @@ -0,0 +1,60 @@ +_getInfo($name, $value); + extract($info); // name, value, attribs, options, listsep, disable + return $value; + } +} diff --git a/library/vendor/Zend/View/Helper/FormPassword.php b/library/vendor/Zend/View/Helper/FormPassword.php new file mode 100644 index 0000000..3cd880d --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormPassword.php @@ -0,0 +1,88 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable + + // is it disabled? + $disabled = ''; + if ($disable) { + // disabled + $disabled = ' disabled="disabled"'; + } + + // determine the XHTML value + $valueString = ' value=""'; + if (array_key_exists('renderPassword', $attribs)) { + if ($attribs['renderPassword']) { + $valueString = ' value="' . $this->view->escape($value) . '"'; + } + unset($attribs['renderPassword']); + } + + // render the element + $xhtml = '_htmlAttribs($attribs) + . $this->getClosingBracket(); + + return $xhtml; + } + +} diff --git a/library/vendor/Zend/View/Helper/FormRadio.php b/library/vendor/Zend/View/Helper/FormRadio.php new file mode 100644 index 0000000..b67c0d6 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormRadio.php @@ -0,0 +1,185 @@ +\n") + { + + $info = $this->_getInfo($name, $value, $attribs, $options, $listsep); + extract($info); // name, value, attribs, options, listsep, disable + + // retrieve attributes for labels (prefixed with 'label_' or 'label') + $label_attribs = array(); + foreach ($attribs as $key => $val) { + $tmp = false; + $keyLen = strlen($key); + if ((6 < $keyLen) && (substr($key, 0, 6) == 'label_')) { + $tmp = substr($key, 6); + } elseif ((5 < $keyLen) && (substr($key, 0, 5) == 'label')) { + $tmp = substr($key, 5); + } + + if ($tmp) { + // make sure first char is lowercase + $tmp[0] = strtolower($tmp[0]); + $label_attribs[$tmp] = $val; + unset($attribs[$key]); + } + } + + $labelPlacement = 'append'; + foreach ($label_attribs as $key => $val) { + switch (strtolower($key)) { + case 'placement': + unset($label_attribs[$key]); + $val = strtolower($val); + if (in_array($val, array('prepend', 'append'))) { + $labelPlacement = $val; + } + break; + } + } + + // the radio button values and labels + $options = (array) $options; + + // build the element + $xhtml = ''; + $list = array(); + + // should the name affect an array collection? + $name = $this->view->escape($name); + if ($this->_isArray && ('[]' != substr($name, -2))) { + $name .= '[]'; + } + + // ensure value is an array to allow matching multiple times + $value = (array) $value; + + // Set up the filter - Alnum + hyphen + underscore + $pattern = @preg_match('/\pL/u', 'a') + ? '/[^\p{L}\p{N}\-\_]/u' // Unicode + : '/[^a-zA-Z0-9\-\_]/'; // No Unicode + $filter = new Zend_Filter_PregReplace($pattern, ""); + + // add radio buttons to the list. + foreach ($options as $opt_value => $opt_label) { + + // Should the label be escaped? + if ($escape) { + $opt_label = $this->view->escape($opt_label); + } + + // is it disabled? + $disabled = ''; + if (true === $disable) { + $disabled = ' disabled="disabled"'; + } elseif (is_array($disable) && in_array($opt_value, $disable)) { + $disabled = ' disabled="disabled"'; + } + + // is it checked? + $checked = ''; + if (in_array($opt_value, $value)) { + $checked = ' checked="checked"'; + } + + // generate ID + $optId = $id . '-' . $filter->filter($opt_value); + + // Wrap the radios in labels + $radio = '_htmlAttribs($label_attribs) . '>' + . (('prepend' == $labelPlacement) ? $opt_label : '') + . '_htmlAttribs($attribs) + . $this->getClosingBracket() + . (('append' == $labelPlacement) ? $opt_label : '') + . ''; + + // add to the array of radio buttons + $list[] = $radio; + } + + // XHTML or HTML for standard list separator? + if (!$this->_isXhtml() && false !== strpos($listsep, '
    ')) { + $listsep = str_replace('
    ', '
    ', $listsep); + } + + // done! + $xhtml .= implode($listsep, $list); + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormReset.php b/library/vendor/Zend/View/Helper/FormReset.php new file mode 100644 index 0000000..d6276f6 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormReset.php @@ -0,0 +1,81 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable + + // check if disabled + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + // Render button + $xhtml = 'view->escape($value) . '"'; + } + + // add attributes, close, and return + $xhtml .= $this->_htmlAttribs($attribs) . $this->getClosingBracket(); + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormSelect.php b/library/vendor/Zend/View/Helper/FormSelect.php new file mode 100644 index 0000000..82709b1 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormSelect.php @@ -0,0 +1,199 @@ +\n") + { + $info = $this->_getInfo($name, $value, $attribs, $options, $listsep); + extract($info); // name, id, value, attribs, options, listsep, disable + + // force $value to array so we can compare multiple values to multiple + // options; also ensure it's a string for comparison purposes. + $value = array_map('strval', (array) $value); + + // check if element may have multiple values + $multiple = ''; + + if (substr($name, -2) == '[]') { + // multiple implied by the name + $multiple = ' multiple="multiple"'; + } + + if (isset($attribs['multiple'])) { + // Attribute set + if ($attribs['multiple']) { + // True attribute; set multiple attribute + $multiple = ' multiple="multiple"'; + + // Make sure name indicates multiple values are allowed + if (!empty($multiple) && (substr($name, -2) != '[]')) { + $name .= '[]'; + } + } else { + // False attribute; ensure attribute not set + $multiple = ''; + } + unset($attribs['multiple']); + } + + // handle the options classes + $optionClasses = array(); + if (isset($attribs['optionClasses'])) { + $optionClasses = $attribs['optionClasses']; + unset($attribs['optionClasses']); + } + + // now start building the XHTML. + $disabled = ''; + if (true === $disable) { + $disabled = ' disabled="disabled"'; + } + + // Build the surrounding select element first. + $xhtml = '_htmlAttribs($attribs) + . ">\n "; + + // build the list of options + $list = array(); + $translator = $this->getTranslator(); + foreach ((array) $options as $opt_value => $opt_label) { + if (is_array($opt_label)) { + $opt_disable = ''; + if (is_array($disable) && in_array($opt_value, $disable)) { + $opt_disable = ' disabled="disabled"'; + } + if (null !== $translator) { + $opt_value = $translator->translate($opt_value); + } + $opt_id = ' id="' . $this->view->escape($id) . '-optgroup-' + . $this->view->escape($opt_value) . '"'; + $list[] = ''; + foreach ($opt_label as $val => $lab) { + $list[] = $this->_build($val, $lab, $value, $disable, $optionClasses); + } + $list[] = ''; + } else { + $list[] = $this->_build($opt_value, $opt_label, $value, $disable, $optionClasses); + } + } + + // add the options to the xhtml and close the select + $xhtml .= implode("\n ", $list) . "\n"; + + return $xhtml; + } + + /** + * Builds the actual "; + + return $opt; + } + +} diff --git a/library/vendor/Zend/View/Helper/FormSubmit.php b/library/vendor/Zend/View/Helper/FormSubmit.php new file mode 100644 index 0000000..959feb1 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormSubmit.php @@ -0,0 +1,80 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable, id + // check if disabled + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + if ($id) { + $id = ' id="' . $this->view->escape($id) . '"'; + } + + // Render the button. + $xhtml = '_htmlAttribs($attribs) + . $this->getClosingBracket(); + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormText.php b/library/vendor/Zend/View/Helper/FormText.php new file mode 100644 index 0000000..8b2dbd9 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormText.php @@ -0,0 +1,77 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable + + // build the element + $disabled = ''; + if ($disable) { + // disabled + $disabled = ' disabled="disabled"'; + } + + $xhtml = '_htmlAttribs($attribs) + . $this->getClosingBracket(); + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/FormTextarea.php b/library/vendor/Zend/View/Helper/FormTextarea.php new file mode 100644 index 0000000..7fa8442 --- /dev/null +++ b/library/vendor/Zend/View/Helper/FormTextarea.php @@ -0,0 +1,103 @@ +_getInfo($name, $value, $attribs); + extract($info); // name, value, attribs, options, listsep, disable + + // is it disabled? + $disabled = ''; + if ($disable) { + // disabled. + $disabled = ' disabled="disabled"'; + } + + // Make sure that there are 'rows' and 'cols' values + // as required by the spec. noted by Orjan Persson. + if (empty($attribs['rows'])) { + $attribs['rows'] = (int) $this->rows; + } + if (empty($attribs['cols'])) { + $attribs['cols'] = (int) $this->cols; + } + + // build the element + $xhtml = ''; + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/Gravatar.php b/library/vendor/Zend/View/Helper/Gravatar.php new file mode 100644 index 0000000..1afc4cb --- /dev/null +++ b/library/vendor/Zend/View/Helper/Gravatar.php @@ -0,0 +1,361 @@ + 80, + 'default_img' => self::DEFAULT_MM, + 'rating' => self::RATING_G, + 'secure' => null, + ); + + /** + * Email Adress + * + * @var string + */ + protected $_email; + + /** + * Attributes for HTML image tag + * + * @var array + */ + protected $_attribs; + + /** + * Returns an avatar from gravatar's service. + * + * $options may include the following: + * - 'img_size' int height of img to return + * - 'default_img' string img to return if email adress has not found + * - 'rating' string rating parameter for avatar + * - 'secure' bool load from the SSL or Non-SSL location + * + * @see http://pl.gravatar.com/site/implement/url + * @see http://pl.gravatar.com/site/implement/url More information about gravatar's service. + * @param string|null $email Email adress. + * @param null|array $options Options + * @param array $attribs Attributes for image tag (title, alt etc.) + * @return Zend_View_Helper_Gravatar + */ + public function gravatar($email = "", $options = array(), $attribs = array()) + { + $this->setEmail($email); + $this->setOptions($options); + $this->setAttribs($attribs); + return $this; + } + + /** + * Configure state + * + * @param array $options + * @return Zend_View_Helper_Gravatar + */ + public function setOptions(array $options) + { + foreach ($options as $key => $value) { + $method = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); + if (method_exists($this, $method)) { + $this->{$method}($value); + } + } + return $this; + } + + /** + * Get img size + * + * @return int The img size + */ + public function getImgSize() + { + return $this->_options['img_size']; + } + + /** + * Set img size in pixels + * + * @param int $imgSize Size of img must be between 1 and 512 + * @return Zend_View_Helper_Gravatar + */ + public function setImgSize($imgSize) + { + $this->_options['img_size'] = (int) $imgSize; + return $this; + } + + /** + * Get default img + * + * @return string + */ + public function getDefaultImg() + { + return $this->_options['default_img']; + } + + /** + * Set default img + * + * Can be either an absolute URL to an image, or one of the DEFAULT_* constants + * + * @param string $defaultImg + * @link http://pl.gravatar.com/site/implement/url More information about default image. + * @return Zend_View_Helper_Gravatar + */ + public function setDefaultImg($defaultImg) + { + $this->_options['default_img'] = urlencode($defaultImg); + return $this; + } + + /** + * Set rating value + * + * Must be one of the RATING_* constants + * + * @param string $rating Value for rating. Allowed values are: g, px, r,x + * @link http://pl.gravatar.com/site/implement/url More information about rating. + * @throws Zend_View_Exception + */ + public function setRating($rating) + { + switch ($rating) { + case self::RATING_G: + case self::RATING_PG: + case self::RATING_R: + case self::RATING_X: + $this->_options['rating'] = $rating; + break; + default: + throw new Zend_View_Exception(sprintf( + 'The rating value "%s" is not allowed', + $rating + )); + } + return $this; + } + + /** + * Get rating value + * + * @return string + */ + public function getRating() + { + return $this->_options['rating']; + } + + /** + * Set email adress + * + * @param string $email + * @return Zend_View_Helper_Gravatar + */ + public function setEmail( $email ) + { + $this->_email = $email; + return $this; + } + + /** + * Get email adress + * + * @return string + */ + public function getEmail() + { + return $this->_email; + } + + /** + * Load from an SSL or No-SSL location? + * + * @param bool $flag + * @return Zend_View_Helper_Gravatar + */ + public function setSecure($flag) + { + $this->_options['secure'] = ($flag === null) ? null : (bool) $flag; + return $this; + } + + /** + * Get an SSL or a No-SSL location + * + * @return bool + */ + public function getSecure() + { + if ($this->_options['secure'] === null) { + return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); + } + return $this->_options['secure']; + } + + /** + * Get attribs of image + * + * Warning! + * If you set src attrib, you get it, but this value will be overwritten in + * protected method _setSrcAttribForImg(). And finally your get other src + * value! + * + * @return array + */ + public function getAttribs() + { + return $this->_attribs; + } + + /** + * Set attribs for image tag + * + * Warning! You shouldn't set src attrib for image tag. + * This attrib is overwritten in protected method _setSrcAttribForImg(). + * This method(_setSrcAttribForImg) is called in public method getImgTag(). + + * @param array $attribs + * @return Zend_View_Helper_Gravatar + */ + public function setAttribs(array $attribs) + { + $this->_attribs = $attribs; + return $this; + } + + /** + * Get URL to gravatar's service. + * + * @return string URL + */ + protected function _getGravatarUrl() + { + return ($this->getSecure() === false) ? self::GRAVATAR_URL : self::GRAVATAR_URL_SECURE; + } + + /** + * Get avatar url (including size, rating and default image oprions) + * + * @return string + */ + protected function _getAvatarUrl() + { + $src = $this->_getGravatarUrl() + . '/' + . md5(strtolower(trim($this->getEmail()))) + . '?s=' + . $this->getImgSize() + . '&d=' + . $this->getDefaultImg() + . '&r=' + . $this->getRating(); + return $src; + } + + /** + * Set src attrib for image. + * + * You shouldn't set a own url value! + * It sets value, uses protected method _getAvatarUrl. + * + * If already exsist overwritten. + */ + protected function _setSrcAttribForImg() + { + $attribs = $this->getAttribs(); + $attribs['src'] = $this->_getAvatarUrl(); + $this->setAttribs($attribs); + } + + /** + * Return valid image tag + * + * @return string + */ + public function getImgTag() + { + $this->_setSrcAttribForImg(); + $html = '_htmlAttribs($this->getAttribs()) + . $this->getClosingBracket(); + + return $html; + } + + /** + * Return valid image tag + * + * @return string + */ + public function __toString() + { + return $this->getImgTag(); + + } +} diff --git a/library/vendor/Zend/View/Helper/HeadLink.php b/library/vendor/Zend/View/Helper/HeadLink.php new file mode 100644 index 0000000..3b1bcb7 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HeadLink.php @@ -0,0 +1,471 @@ +setSeparator(PHP_EOL); + } + + /** + * headLink() - View Helper Method + * + * Returns current object instance. Optionally, allows passing array of + * values to build link. + * + * @return Zend_View_Helper_HeadLink + */ + public function headLink(array $attributes = null, $placement = Zend_View_Helper_Placeholder_Container_Abstract::APPEND) + { + if (null !== $attributes) { + $item = $this->createData($attributes); + switch ($placement) { + case Zend_View_Helper_Placeholder_Container_Abstract::SET: + $this->set($item); + break; + case Zend_View_Helper_Placeholder_Container_Abstract::PREPEND: + $this->prepend($item); + break; + case Zend_View_Helper_Placeholder_Container_Abstract::APPEND: + default: + $this->append($item); + break; + } + } + return $this; + } + + /** + * Overload method access + * + * Creates the following virtual methods: + * - appendStylesheet($href, $media, $conditionalStylesheet, $extras) + * - offsetSetStylesheet($index, $href, $media, $conditionalStylesheet, $extras) + * - prependStylesheet($href, $media, $conditionalStylesheet, $extras) + * - setStylesheet($href, $media, $conditionalStylesheet, $extras) + * - appendAlternate($href, $type, $title, $extras) + * - offsetSetAlternate($index, $href, $type, $title, $extras) + * - prependAlternate($href, $type, $title, $extras) + * - setAlternate($href, $type, $title, $extras) + * + * Items that may be added in the future: + * - Navigation? need to find docs on this + * - public function appendStart() + * - public function appendContents() + * - public function appendPrev() + * - public function appendNext() + * - public function appendIndex() + * - public function appendEnd() + * - public function appendGlossary() + * - public function appendAppendix() + * - public function appendHelp() + * - public function appendBookmark() + * - Other? + * - public function appendCopyright() + * - public function appendChapter() + * - public function appendSection() + * - public function appendSubsection() + * + * @param mixed $method + * @param mixed $args + * @return void + */ + public function __call($method, $args) + { + if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(?PStylesheet|Alternate)$/', $method, $matches)) { + $argc = count($args); + $action = $matches['action']; + $type = $matches['type']; + $index = null; + + if ('offsetSet' == $action) { + if (0 < $argc) { + $index = array_shift($args); + --$argc; + } + } + + if (1 > $argc) { + $e = new Zend_View_Exception(sprintf('%s requires at least one argument', $method)); + $e->setView($this->view); + throw $e; + } + + if (is_array($args[0])) { + $item = $this->createData($args[0]); + } else { + $dataMethod = 'createData' . $type; + $item = $this->$dataMethod($args); + } + + if ($item) { + if ('offsetSet' == $action) { + $this->offsetSet($index, $item); + } else { + $this->$action($item); + } + } + + return $this; + } + + return parent::__call($method, $args); + } + + /** + * Check if value is valid + * + * @param mixed $value + * @return boolean + */ + protected function _isValid($value) + { + if (!$value instanceof stdClass) { + return false; + } + + $vars = get_object_vars($value); + $keys = array_keys($vars); + $intersection = array_intersect($this->_itemKeys, $keys); + if (empty($intersection)) { + return false; + } + + return true; + } + + /** + * append() + * + * @param array $value + * @return void + */ + public function append($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('append() expects a data token; please use one of the custom append*() methods'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->append($value); + } + + /** + * offsetSet() + * + * @param string|int $index + * @param array $value + * @return void + */ + public function offsetSet($index, $value): void + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('offsetSet() expects a data token; please use one of the custom offsetSet*() methods'); + $e->setView($this->view); + throw $e; + } + + $this->getContainer()->offsetSet($index, $value); + } + + /** + * prepend() + * + * @param array $value + * @return Zend_Layout_ViewHelper_HeadLink + */ + public function prepend($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('prepend() expects a data token; please use one of the custom prepend*() methods'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->prepend($value); + } + + /** + * set() + * + * @param array $value + * @return Zend_Layout_ViewHelper_HeadLink + */ + public function set($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('set() expects a data token; please use one of the custom set*() methods'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->set($value); + } + + + /** + * Create HTML link element from data item + * + * @param stdClass $item + * @return string + */ + public function itemToString(stdClass $item) + { + $attributes = (array) $item; + $link = '_itemKeys as $itemKey) { + if (isset($attributes[$itemKey])) { + if(is_array($attributes[$itemKey])) { + foreach($attributes[$itemKey] as $key => $value) { + $link .= sprintf('%s="%s" ', $key, ($this->_autoEscape) ? $this->_escape($value) : $value); + } + } else { + $link .= sprintf('%s="%s" ', $itemKey, ($this->_autoEscape) ? $this->_escape($attributes[$itemKey]) : $attributes[$itemKey]); + } + } + } + + if ($this->view instanceof Zend_View_Abstract) { + $link .= ($this->view->doctype()->isXhtml()) ? '/>' : '>'; + } else { + $link .= '/>'; + } + + if (($link == '') || ($link == '')) { + return ''; + } + + if (isset($attributes['conditionalStylesheet']) + && !empty($attributes['conditionalStylesheet']) + && is_string($attributes['conditionalStylesheet'])) + { + if (str_replace(' ', '', $attributes['conditionalStylesheet']) === '!IE') { + $link = '' . $link . ''; + } + + return $link; + } + + /** + * Render link elements as string + * + * @param string|int $indent + * @return string + */ + public function toString($indent = null) + { + $indent = (null !== $indent) + ? $this->getWhitespace($indent) + : $this->getIndent(); + + $items = array(); + $this->getContainer()->ksort(); + foreach ($this as $item) { + $items[] = $this->itemToString($item); + } + + return $indent . implode($this->_escape($this->getSeparator()) . $indent, $items); + } + + /** + * Create data item for stack + * + * @param array $attributes + * @return stdClass + */ + public function createData(array $attributes) + { + $data = (object) $attributes; + return $data; + } + + /** + * Create item for stylesheet link item + * + * @param array $args + * @return stdClass|false Returns fals if stylesheet is a duplicate + */ + public function createDataStylesheet(array $args) + { + $rel = 'stylesheet'; + $type = 'text/css'; + $media = 'screen'; + $conditionalStylesheet = false; + $href = array_shift($args); + + if ($this->_isDuplicateStylesheet($href)) { + return false; + } + + if (0 < count($args)) { + $media = array_shift($args); + if(is_array($media)) { + $media = implode(',', $media); + } else { + $media = (string) $media; + } + } + if (0 < count($args)) { + $conditionalStylesheet = array_shift($args); + if(!empty($conditionalStylesheet) && is_string($conditionalStylesheet)) { + $conditionalStylesheet = (string) $conditionalStylesheet; + } else { + $conditionalStylesheet = null; + } + } + + if(0 < count($args) && is_array($args[0])) { + $extras = array_shift($args); + $extras = (array) $extras; + } + + $attributes = compact('rel', 'type', 'href', 'media', 'conditionalStylesheet', 'extras'); + return $this->createData($this->_applyExtras($attributes)); + } + + /** + * Is the linked stylesheet a duplicate? + * + * @param string $uri + * @return bool + */ + protected function _isDuplicateStylesheet($uri) + { + foreach ($this->getContainer() as $item) { + if (($item->rel == 'stylesheet') && ($item->href == $uri)) { + return true; + } + } + return false; + } + + /** + * Create item for alternate link item + * + * @param array $args + * @return stdClass + */ + public function createDataAlternate(array $args) + { + if (3 > count($args)) { + $e = new Zend_View_Exception(sprintf('Alternate tags require 3 arguments; %s provided', count($args))); + $e->setView($this->view); + throw $e; + } + + $rel = 'alternate'; + $href = array_shift($args); + $type = array_shift($args); + $title = array_shift($args); + + if(0 < count($args) && is_array($args[0])) { + $extras = array_shift($args); + $extras = (array) $extras; + + if(isset($extras['media']) && is_array($extras['media'])) { + $extras['media'] = implode(',', $extras['media']); + } + } + + $href = (string) $href; + $type = (string) $type; + $title = (string) $title; + + $attributes = compact('rel', 'href', 'type', 'title', 'extras'); + return $this->createData($this->_applyExtras($attributes)); + } + + /** + * Apply any overrides specified in the 'extras' array + * @param array $attributes + * @return array + */ + protected function _applyExtras($attributes) + { + if (isset($attributes['extras'])) { + foreach ($attributes['extras'] as $eKey=>$eVal) { + if (isset($attributes[$eKey])) { + $attributes[$eKey] = $eVal; + unset($attributes['extras'][$eKey]); + } + } + } + return $attributes; + } +} diff --git a/library/vendor/Zend/View/Helper/HeadMeta.php b/library/vendor/Zend/View/Helper/HeadMeta.php new file mode 100644 index 0000000..88cd3a7 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HeadMeta.php @@ -0,0 +1,440 @@ +setSeparator(PHP_EOL); + } + + /** + * Retrieve object instance; optionally add meta tag + * + * @param string $content + * @param string $keyValue + * @param string $keyType + * @param array $modifiers + * @param string $placement + * @return Zend_View_Helper_HeadMeta + */ + public function headMeta($content = null, $keyValue = null, $keyType = 'name', $modifiers = array(), $placement = Zend_View_Helper_Placeholder_Container_Abstract::APPEND) + { + if ((null !== $content) && (null !== $keyValue)) { + $item = $this->createData($keyType, $keyValue, $content, $modifiers); + $action = strtolower($placement); + switch ($action) { + case 'append': + case 'prepend': + case 'set': + $this->$action($item); + break; + default: + $this->append($item); + break; + } + } + + return $this; + } + + protected function _normalizeType($type) + { + switch ($type) { + case 'Name': + return 'name'; + case 'HttpEquiv': + return 'http-equiv'; + case 'Property': + return 'property'; + default: + $e = new Zend_View_Exception(sprintf('Invalid type "%s" passed to _normalizeType', $type)); + $e->setView($this->view); + throw $e; + } + } + + /** + * Overload method access + * + * Allows the following 'virtual' methods: + * - appendName($keyValue, $content, $modifiers = array()) + * - offsetGetName($index, $keyValue, $content, $modifers = array()) + * - prependName($keyValue, $content, $modifiers = array()) + * - setName($keyValue, $content, $modifiers = array()) + * - appendHttpEquiv($keyValue, $content, $modifiers = array()) + * - offsetGetHttpEquiv($index, $keyValue, $content, $modifers = array()) + * - prependHttpEquiv($keyValue, $content, $modifiers = array()) + * - setHttpEquiv($keyValue, $content, $modifiers = array()) + * - appendProperty($keyValue, $content, $modifiers = array()) + * - offsetGetProperty($index, $keyValue, $content, $modifiers = array()) + * - prependProperty($keyValue, $content, $modifiers = array()) + * - setProperty($keyValue, $content, $modifiers = array()) + * + * @param string $method + * @param array $args + * @return Zend_View_Helper_HeadMeta + */ + public function __call($method, $args) + { + if (preg_match('/^(?Pset|(pre|ap)pend|offsetSet)(?PName|HttpEquiv|Property)$/', $method, $matches)) { + $action = $matches['action']; + $type = $this->_normalizeType($matches['type']); + $argc = count($args); + $index = null; + + if ('offsetSet' == $action) { + if (0 < $argc) { + $index = array_shift($args); + --$argc; + } + } + + if (2 > $argc) { + $e = new Zend_View_Exception('Too few arguments provided; requires key value, and content'); + $e->setView($this->view); + throw $e; + } + + if (3 > $argc) { + $args[] = array(); + } + + $item = $this->createData($type, $args[0], $args[1], $args[2]); + + if ('offsetSet' == $action) { + $this->offsetSet($index, $item); + return $this; + } + + $this->$action($item); + return $this; + } + + return parent::__call($method, $args); + } + + /** + * Create an HTML5-style meta charset tag. Something like + * + * Not valid in a non-HTML5 doctype + * + * @param string $charset + * @return Zend_View_Helper_HeadMeta Provides a fluent interface + */ + public function setCharset($charset) + { + $item = new stdClass; + $item->type = 'charset'; + $item->charset = $charset; + $item->content = null; + $item->modifiers = array(); + $this->set($item); + return $this; + } + + /** + * Determine if item is valid + * + * @param mixed $item + * @return boolean + */ + protected function _isValid($item) + { + if ((!$item instanceof stdClass) + || !isset($item->type) + || !isset($item->modifiers)) + { + return false; + } + + $isHtml5 = is_null($this->view) ? false : $this->view->doctype()->isHtml5(); + + if (!isset($item->content) + && (! $isHtml5 || (! $isHtml5 && $item->type !== 'charset'))) { + return false; + } + + // is only supported with doctype RDFa + if ( !is_null($this->view) && !$this->view->doctype()->isRdfa() + && $item->type === 'property') { + return false; + } + + return true; + } + + /** + * Append + * + * @param string $value + * @return void + * @throws Zend_View_Exception + */ + public function append($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to append; please use appendMeta()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->append($value); + } + + /** + * OffsetSet + * + * @param string|int $index + * @param string $value + * @return void + * @throws Zend_View_Exception + */ + public function offsetSet($index, $value): void + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetName() or offsetSetHttpEquiv()'); + $e->setView($this->view); + throw $e; + } + + $this->getContainer()->offsetSet($index, $value); + } + + /** + * OffsetUnset + * + * @param string|int $index + * @return void + * @throws Zend_View_Exception + */ + public function offsetUnset($index): void + { + if (!in_array($index, $this->getContainer()->getKeys())) { + $e = new Zend_View_Exception('Invalid index passed to offsetUnset()'); + $e->setView($this->view); + throw $e; + } + + $this->getContainer()->offsetUnset($index); + } + + /** + * Prepend + * + * @param string $value + * @return void + * @throws Zend_View_Exception + */ + public function prepend($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependMeta()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->prepend($value); + } + + /** + * Set + * + * @param string $value + * @return void + * @throws Zend_View_Exception + */ + public function set($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to set; please use setMeta()'); + $e->setView($this->view); + throw $e; + } + + $container = $this->getContainer(); + foreach ($container->getArrayCopy() as $index => $item) { + if ($item->type == $value->type && $item->{$item->type} == $value->{$value->type}) { + $this->offsetUnset($index); + } + } + + return $this->append($value); + } + + /** + * Build meta HTML string + * + * @param string $type + * @param string $typeValue + * @param string $content + * @param array $modifiers + * @return string + */ + public function itemToString(stdClass $item) + { + if (!in_array($item->type, $this->_typeKeys)) { + $e = new Zend_View_Exception(sprintf('Invalid type "%s" provided for meta', $item->type)); + $e->setView($this->view); + throw $e; + } + $type = $item->type; + + $modifiersString = ''; + foreach ($item->modifiers as $key => $value) { + if (!is_null($this->view) && $this->view->doctype()->isHtml5() + && $key == 'scheme') { + throw new Zend_View_Exception('Invalid modifier ' + . '"scheme" provided; not supported by HTML5'); + } + if (!in_array($key, $this->_modifierKeys)) { + continue; + } + $modifiersString .= $key . '="' . $this->_escape($value) . '" '; + } + + if ($this->view instanceof Zend_View_Abstract) { + if ($this->view->doctype()->isHtml5() + && $type == 'charset') { + $tpl = ($this->view->doctype()->isXhtml()) + ? '' + : ''; + } elseif ($this->view->doctype()->isXhtml()) { + $tpl = ''; + } else { + $tpl = ''; + } + } else { + $tpl = ''; + } + + $meta = sprintf( + $tpl, + $type, + $this->_escape($item->$type), + $this->_escape($item->content), + $modifiersString + ); + + if (isset($item->modifiers['conditional']) + && !empty($item->modifiers['conditional']) + && is_string($item->modifiers['conditional'])) + { + if (str_replace(' ', '', $item->modifiers['conditional']) === '!IE') { + $meta = '' . $meta . ''; + } + + return $meta; + } + + /** + * Render placeholder as string + * + * @param string|int $indent + * @return string + */ + public function toString($indent = null) + { + $indent = (null !== $indent) + ? $this->getWhitespace($indent) + : $this->getIndent(); + + $items = array(); + $this->getContainer()->ksort(); + try { + foreach ($this as $item) { + $items[] = $this->itemToString($item); + } + } catch (Zend_View_Exception $e) { + trigger_error($e->getMessage(), E_USER_WARNING); + return ''; + } + return $indent . implode($this->_escape($this->getSeparator()) . $indent, $items); + } + + /** + * Create data item for inserting into stack + * + * @param string $type + * @param string $typeValue + * @param string $content + * @param array $modifiers + * @return stdClass + */ + public function createData($type, $typeValue, $content, array $modifiers) + { + $data = new stdClass; + $data->type = $type; + $data->$type = $typeValue; + $data->content = $content; + $data->modifiers = $modifiers; + return $data; + } +} diff --git a/library/vendor/Zend/View/Helper/HeadScript.php b/library/vendor/Zend/View/Helper/HeadScript.php new file mode 100644 index 0000000..5b8461d --- /dev/null +++ b/library/vendor/Zend/View/Helper/HeadScript.php @@ -0,0 +1,512 @@ +setSeparator(PHP_EOL); + } + + /** + * Return headScript object + * + * Returns headScript helper object; optionally, allows specifying a script + * or script file to include. + * + * @param string $mode Script or file + * @param string $spec Script/url + * @param string $placement Append, prepend, or set + * @param array $attrs Array of script attributes + * @param string $type Script type and/or array of script attributes + * @return Zend_View_Helper_HeadScript + */ + public function headScript($mode = Zend_View_Helper_HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript') + { + if ((null !== $spec) && is_string($spec)) { + $action = ucfirst(strtolower($mode)); + $placement = strtolower($placement); + switch ($placement) { + case 'set': + case 'prepend': + case 'append': + $action = $placement . $action; + break; + default: + $action = 'append' . $action; + break; + } + $this->$action($spec, $type, $attrs); + } + + return $this; + } + + /** + * Start capture action + * + * @param mixed $captureType + * @param string $typeOrAttrs + * @return void + */ + public function captureStart($captureType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $type = 'text/javascript', $attrs = array()) + { + if ($this->_captureLock) { + $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headScript captures'); + $e->setView($this->view); + throw $e; + } + + $this->_captureLock = true; + $this->_captureType = $captureType; + $this->_captureScriptType = $type; + $this->_captureScriptAttrs = $attrs; + ob_start(); + } + + /** + * End capture action and store + * + * @return void + */ + public function captureEnd() + { + $content = ob_get_clean(); + $type = $this->_captureScriptType; + $attrs = $this->_captureScriptAttrs; + $this->_captureScriptType = null; + $this->_captureScriptAttrs = null; + $this->_captureLock = false; + + switch ($this->_captureType) { + case Zend_View_Helper_Placeholder_Container_Abstract::SET: + case Zend_View_Helper_Placeholder_Container_Abstract::PREPEND: + case Zend_View_Helper_Placeholder_Container_Abstract::APPEND: + $action = strtolower($this->_captureType) . 'Script'; + break; + default: + $action = 'appendScript'; + break; + } + $this->$action($content, $type, $attrs); + } + + /** + * Overload method access + * + * Allows the following method calls: + * - appendFile($src, $type = 'text/javascript', $attrs = array()) + * - offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array()) + * - prependFile($src, $type = 'text/javascript', $attrs = array()) + * - setFile($src, $type = 'text/javascript', $attrs = array()) + * - appendScript($script, $type = 'text/javascript', $attrs = array()) + * - offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array()) + * - prependScript($script, $type = 'text/javascript', $attrs = array()) + * - setScript($script, $type = 'text/javascript', $attrs = array()) + * + * @param string $method + * @param array $args + * @return Zend_View_Helper_HeadScript + * @throws Zend_View_Exception if too few arguments or invalid method + */ + public function __call($method, $args) + { + if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(?PFile|Script)$/', $method, $matches)) { + if (1 > count($args)) { + $e = new Zend_View_Exception(sprintf('Method "%s" requires at least one argument', $method)); + $e->setView($this->view); + throw $e; + } + + $action = $matches['action']; + $mode = strtolower($matches['mode']); + $type = 'text/javascript'; + $attrs = array(); + + if ('offsetSet' == $action) { + $index = array_shift($args); + if (1 > count($args)) { + $e = new Zend_View_Exception(sprintf('Method "%s" requires at least two arguments, an index and source', $method)); + $e->setView($this->view); + throw $e; + } + } + + $content = $args[0]; + + if (isset($args[1])) { + $type = (string) $args[1]; + } + if (isset($args[2])) { + $attrs = (array) $args[2]; + } + + switch ($mode) { + case 'script': + $item = $this->createData($type, $attrs, $content); + if ('offsetSet' == $action) { + $this->offsetSet($index, $item); + } else { + $this->$action($item); + } + break; + case 'file': + default: + if (!$this->_isDuplicate($content) || $action=='set') { + $attrs['src'] = $content; + $item = $this->createData($type, $attrs); + if ('offsetSet' == $action) { + $this->offsetSet($index, $item); + } else { + $this->$action($item); + } + } + break; + } + + return $this; + } + + return parent::__call($method, $args); + } + + /** + * Is the file specified a duplicate? + * + * @param string $file + * @return bool + */ + protected function _isDuplicate($file) + { + foreach ($this->getContainer() as $item) { + if (($item->source === null) + && array_key_exists('src', $item->attributes) + && ($file == $item->attributes['src'])) + { + return true; + } + } + return false; + } + + /** + * Is the script provided valid? + * + * @param mixed $value + * @param string $method + * @return bool + */ + protected function _isValid($value) + { + if ((!$value instanceof stdClass) + || !isset($value->type) + || (!isset($value->source) && !isset($value->attributes))) + { + return false; + } + + return true; + } + + /** + * Override append + * + * @param string $value + * @return void + */ + public function append($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid argument passed to append(); please use one of the helper methods, appendScript() or appendFile()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->append($value); + } + + /** + * Override prepend + * + * @param string $value + * @return void + */ + public function prepend($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid argument passed to prepend(); please use one of the helper methods, prependScript() or prependFile()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->prepend($value); + } + + /** + * Override set + * + * @param string $value + * @return void + */ + public function set($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid argument passed to set(); please use one of the helper methods, setScript() or setFile()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->set($value); + } + + /** + * Override offsetSet + * + * @param string|int $index + * @param mixed $value + * @return void + */ + public function offsetSet($index, $value): void + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()'); + $e->setView($this->view); + throw $e; + } + + $this->getContainer()->offsetSet($index, $value); + } + + /** + * Set flag indicating if arbitrary attributes are allowed + * + * @param bool $flag + * @return Zend_View_Helper_HeadScript + */ + public function setAllowArbitraryAttributes($flag) + { + $this->_arbitraryAttributes = (bool) $flag; + return $this; + } + + /** + * Are arbitrary attributes allowed? + * + * @return bool + */ + public function arbitraryAttributesAllowed() + { + return $this->_arbitraryAttributes; + } + + /** + * Create script HTML + * + * @param string $type + * @param array $attributes + * @param string $content + * @param string|int $indent + * @return string + */ + public function itemToString($item, $indent, $escapeStart, $escapeEnd) + { + $attrString = ''; + if (!empty($item->attributes)) { + foreach ($item->attributes as $key => $value) { + if ((!$this->arbitraryAttributesAllowed() && !in_array($key, $this->_optionalAttributes)) + || in_array($key, array('conditional', 'noescape'))) + { + continue; + } + if ('defer' == $key) { + $value = 'defer'; + } + $attrString .= sprintf(' %s="%s"', $key, ($this->_autoEscape) ? $this->_escape($value) : $value); + } + } + + $addScriptEscape = !(isset($item->attributes['noescape']) && filter_var($item->attributes['noescape'], FILTER_VALIDATE_BOOLEAN)); + + $type = ($this->_autoEscape) ? $this->_escape($item->type) : $item->type; + $html = ''; + + if (isset($item->attributes['conditional']) + && !empty($item->attributes['conditional']) + && is_string($item->attributes['conditional'])) + { + // inner wrap with comment end and start if !IE + if (str_replace(' ', '', $item->attributes['conditional']) === '!IE') { + $html = '' . $html . ''; + } else { + $html = $indent . $html; + } + + return $html; + } + + /** + * Retrieve string representation + * + * @param string|int $indent + * @return string + */ + public function toString($indent = null) + { + $indent = (null !== $indent) + ? $this->getWhitespace($indent) + : $this->getIndent(); + + if ($this->view) { + $useCdata = $this->view->doctype()->isXhtml() ? true : false; + } else { + $useCdata = $this->useCdata ? true : false; + } + $escapeStart = ($useCdata) ? '//' : '//-->'; + + $items = array(); + $this->getContainer()->ksort(); + foreach ($this as $item) { + if (!$this->_isValid($item)) { + continue; + } + + $items[] = $this->itemToString($item, $indent, $escapeStart, $escapeEnd); + } + + $return = implode($this->getSeparator(), $items); + return $return; + } + + /** + * Create data item containing all necessary components of script + * + * @param string $type + * @param array $attributes + * @param string $content + * @return stdClass + */ + public function createData($type, array $attributes, $content = null) + { + $data = new stdClass(); + $data->type = $type; + $data->attributes = $attributes; + $data->source = $content; + return $data; + } +} diff --git a/library/vendor/Zend/View/Helper/HeadStyle.php b/library/vendor/Zend/View/Helper/HeadStyle.php new file mode 100644 index 0000000..c28f997 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HeadStyle.php @@ -0,0 +1,426 @@ +setSeparator(PHP_EOL); + } + + /** + * Return headStyle object + * + * Returns headStyle helper object; optionally, allows specifying + * + * @param string $content Stylesheet contents + * @param string $placement Append, prepend, or set + * @param string|array $attributes Optional attributes to utilize + * @return Zend_View_Helper_HeadStyle + */ + public function headStyle($content = null, $placement = 'APPEND', $attributes = array()) + { + if ((null !== $content) && is_string($content)) { + switch (strtoupper($placement)) { + case 'SET': + $action = 'setStyle'; + break; + case 'PREPEND': + $action = 'prependStyle'; + break; + case 'APPEND': + default: + $action = 'appendStyle'; + break; + } + $this->$action($content, $attributes); + } + + return $this; + } + + /** + * Overload method calls + * + * Allows the following method calls: + * - appendStyle($content, $attributes = array()) + * - offsetSetStyle($index, $content, $attributes = array()) + * - prependStyle($content, $attributes = array()) + * - setStyle($content, $attributes = array()) + * + * @param string $method + * @param array $args + * @return void + * @throws Zend_View_Exception When no $content provided or invalid method + */ + public function __call($method, $args) + { + if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(Style)$/', $method, $matches)) { + $index = null; + $argc = count($args); + $action = $matches['action']; + + if ('offsetSet' == $action) { + if (0 < $argc) { + $index = array_shift($args); + --$argc; + } + } + + if (1 > $argc) { + $e = new Zend_View_Exception(sprintf('Method "%s" requires minimally content for the stylesheet', $method)); + $e->setView($this->view); + throw $e; + } + + $content = $args[0]; + $attrs = array(); + if (isset($args[1])) { + $attrs = (array) $args[1]; + } + + $item = $this->createData($content, $attrs); + + if ('offsetSet' == $action) { + $this->offsetSet($index, $item); + } else { + $this->$action($item); + } + + return $this; + } + + return parent::__call($method, $args); + } + + /** + * Determine if a value is a valid style tag + * + * @param mixed $value + * @param string $method + * @return boolean + */ + protected function _isValid($value) + { + if ((!$value instanceof stdClass) + || !isset($value->content) + || !isset($value->attributes)) + { + return false; + } + + return true; + } + + /** + * Override append to enforce style creation + * + * @param mixed $value + * @return void + */ + public function append($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to append; please use appendStyle()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->append($value); + } + + /** + * Override offsetSet to enforce style creation + * + * @param string|int $index + * @param mixed $value + * @return void + */ + public function offsetSet($index, $value): void + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetStyle()'); + $e->setView($this->view); + throw $e; + } + + $this->getContainer()->offsetSet($index, $value); + } + + /** + * Override prepend to enforce style creation + * + * @param mixed $value + * @return void + */ + public function prepend($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependStyle()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->prepend($value); + } + + /** + * Override set to enforce style creation + * + * @param mixed $value + * @return void + */ + public function set($value) + { + if (!$this->_isValid($value)) { + $e = new Zend_View_Exception('Invalid value passed to set; please use setStyle()'); + $e->setView($this->view); + throw $e; + } + + return $this->getContainer()->set($value); + } + + /** + * Start capture action + * + * @param mixed $captureType + * @param string $typeOrAttrs + * @return void + */ + public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $attrs = null) + { + if ($this->_captureLock) { + $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headStyle captures'); + $e->setView($this->view); + throw $e; + } + + $this->_captureLock = true; + $this->_captureAttrs = $attrs; + $this->_captureType = $type; + ob_start(); + } + + /** + * End capture action and store + * + * @return void + */ + public function captureEnd() + { + $content = ob_get_clean(); + $attrs = $this->_captureAttrs; + $this->_captureAttrs = null; + $this->_captureLock = false; + + switch ($this->_captureType) { + case Zend_View_Helper_Placeholder_Container_Abstract::SET: + $this->setStyle($content, $attrs); + break; + case Zend_View_Helper_Placeholder_Container_Abstract::PREPEND: + $this->prependStyle($content, $attrs); + break; + case Zend_View_Helper_Placeholder_Container_Abstract::APPEND: + default: + $this->appendStyle($content, $attrs); + break; + } + } + + /** + * Convert content and attributes into valid style tag + * + * @param stdClass $item Item to render + * @param string $indent Indentation to use + * @return string + */ + public function itemToString(stdClass $item, $indent) + { + $attrString = ''; + if (!empty($item->attributes)) { + $enc = 'UTF-8'; + if ($this->view instanceof Zend_View_Interface + && method_exists($this->view, 'getEncoding') + ) { + $enc = $this->view->getEncoding(); + } + foreach ($item->attributes as $key => $value) { + if (!in_array($key, $this->_optionalAttributes)) { + continue; + } + if ('media' == $key) { + if(false === strpos($value, ',')) { + if (!in_array($value, $this->_mediaTypes)) { + continue; + } + } else { + $media_types = explode(',', $value); + $value = ''; + foreach($media_types as $type) { + $type = trim($type); + if (!in_array($type, $this->_mediaTypes)) { + continue; + } + $value .= $type .','; + } + $value = substr($value, 0, -1); + } + } + $attrString .= sprintf(' %s="%s"', $key, htmlspecialchars($value, ENT_COMPAT, $enc)); + } + } + + $escapeStart = $indent . ''. PHP_EOL; + if (isset($item->attributes['conditional']) + && !empty($item->attributes['conditional']) + && is_string($item->attributes['conditional']) + ) { + $escapeStart = null; + $escapeEnd = null; + } + + $html = ''; + + if (null == $escapeStart && null == $escapeEnd) { + if (str_replace(' ', '', $item->attributes['conditional']) === '!IE') { + $html = '' . $html . ''; + } + + return $html; + } + + /** + * Create string representation of placeholder + * + * @param string|int $indent + * @return string + */ + public function toString($indent = null) + { + $indent = (null !== $indent) + ? $this->getWhitespace($indent) + : $this->getIndent(); + + $items = array(); + $this->getContainer()->ksort(); + foreach ($this as $item) { + if (!$this->_isValid($item)) { + continue; + } + $items[] = $this->itemToString($item, $indent); + } + + $return = $indent . implode($this->getSeparator() . $indent, $items); + $return = preg_replace("/(\r\n?|\n)/", '$1' . $indent, $return); + return $return; + } + + /** + * Create data item for use in stack + * + * @param string $content + * @param array $attributes + * @return stdClass + */ + public function createData($content, array $attributes) + { + if (!isset($attributes['media'])) { + $attributes['media'] = 'screen'; + } else if(is_array($attributes['media'])) { + $attributes['media'] = implode(',', $attributes['media']); + } + + $data = new stdClass(); + $data->content = $content; + $data->attributes = $attributes; + + return $data; + } +} diff --git a/library/vendor/Zend/View/Helper/HeadTitle.php b/library/vendor/Zend/View/Helper/HeadTitle.php new file mode 100644 index 0000000..77aef26 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HeadTitle.php @@ -0,0 +1,218 @@ +getDefaultAttachOrder()) + ? Zend_View_Helper_Placeholder_Container_Abstract::APPEND + : $this->getDefaultAttachOrder(); + } + $title = (string) $title; + if ($title !== '') { + if ($setType == Zend_View_Helper_Placeholder_Container_Abstract::SET) { + $this->set($title); + } elseif ($setType == Zend_View_Helper_Placeholder_Container_Abstract::PREPEND) { + $this->prepend($title); + } else { + $this->append($title); + } + } + + return $this; + } + + /** + * Set a default order to add titles + * + * @param string $setType + */ + public function setDefaultAttachOrder($setType) + { + if (!in_array($setType, array( + Zend_View_Helper_Placeholder_Container_Abstract::APPEND, + Zend_View_Helper_Placeholder_Container_Abstract::SET, + Zend_View_Helper_Placeholder_Container_Abstract::PREPEND + ))) { + throw new Zend_View_Exception("You must use a valid attach order: 'PREPEND', 'APPEND' or 'SET'"); + } + + $this->_defaultAttachOrder = $setType; + return $this; + } + + /** + * Get the default attach order, if any. + * + * @return mixed + */ + public function getDefaultAttachOrder() + { + return $this->_defaultAttachOrder; + } + + /** + * Sets a translation Adapter for translation + * + * @param Zend_Translate|Zend_Translate_Adapter $translate + * @return Zend_View_Helper_HeadTitle + */ + public function setTranslator($translate) + { + if ($translate instanceof Zend_Translate_Adapter) { + $this->_translator = $translate; + } elseif ($translate instanceof Zend_Translate) { + $this->_translator = $translate->getAdapter(); + } else { + $e = new Zend_View_Exception("You must set an instance of Zend_Translate or Zend_Translate_Adapter"); + $e->setView($this->view); + throw $e; + } + return $this; + } + + /** + * Retrieve translation object + * + * If none is currently registered, attempts to pull it from the registry + * using the key 'Zend_Translate'. + * + * @return Zend_Translate_Adapter|null + */ + public function getTranslator() + { + if (null === $this->_translator) { + if (Zend_Registry::isRegistered('Zend_Translate')) { + $this->setTranslator(Zend_Registry::get('Zend_Translate')); + } + } + return $this->_translator; + } + + /** + * Enables translation + * + * @return Zend_View_Helper_HeadTitle + */ + public function enableTranslation() + { + $this->_translate = true; + return $this; + } + + /** + * Disables translation + * + * @return Zend_View_Helper_HeadTitle + */ + public function disableTranslation() + { + $this->_translate = false; + return $this; + } + + /** + * Turn helper into string + * + * @param string|null $indent + * @param string|null $locale + * @return string + */ + public function toString($indent = null, $locale = null) + { + $indent = (null !== $indent) + ? $this->getWhitespace($indent) + : $this->getIndent(); + + $items = array(); + + if($this->_translate && $translator = $this->getTranslator()) { + foreach ($this as $item) { + $items[] = $translator->translate($item, $locale); + } + } else { + foreach ($this as $item) { + $items[] = $item; + } + } + + $separator = $this->getSeparator(); + $output = ''; + if(($prefix = $this->getPrefix())) { + $output .= $prefix; + } + $output .= implode($separator, $items); + if(($postfix = $this->getPostfix())) { + $output .= $postfix; + } + + $output = ($this->_autoEscape) ? $this->_escape($output) : $output; + + return $indent . '' . $output . ''; + } +} diff --git a/library/vendor/Zend/View/Helper/HtmlElement.php b/library/vendor/Zend/View/Helper/HtmlElement.php new file mode 100644 index 0000000..212afbd --- /dev/null +++ b/library/vendor/Zend/View/Helper/HtmlElement.php @@ -0,0 +1,165 @@ +_closingBracket) { + if ($this->_isXhtml()) { + $this->_closingBracket = ' />'; + } else { + $this->_closingBracket = '>'; + } + } + + return $this->_closingBracket; + } + + /** + * Is doctype XHTML? + * + * @return boolean + */ + protected function _isXhtml() + { + $doctype = $this->view->doctype(); + return $doctype->isXhtml(); + } + + /** + * Is doctype HTML5? + * + * @return boolean + */ + protected function _isHtml5() + { + $doctype = $this->view->doctype(); + return $doctype->isHtml5(); + } + + /** + * Is doctype strict? + * + * @return boolean + */ + protected function _isStrictDoctype() + { + $doctype = $this->view->doctype(); + return $doctype->isStrict(); + } + + /** + * Converts an associative array to a string of tag attributes. + * + * @access public + * + * @param array $attribs From this array, each key-value pair is + * converted to an attribute name and value. + * + * @return string The XHTML for the attributes. + */ + protected function _htmlAttribs($attribs) + { + $xhtml = ''; + foreach ((array) $attribs as $key => $val) { + $key = $this->view->escape($key); + + if (('on' == substr($key, 0, 2)) || ('constraints' == $key)) { + // Don't escape event attributes; _do_ substitute double quotes with singles + if (!is_scalar($val)) { + // non-scalar data should be cast to JSON first + $val = Zend_Json::encode($val); + } + // Escape single quotes inside event attribute values. + // This will create html, where the attribute value has + // single quotes around it, and escaped single quotes or + // non-escaped double quotes inside of it + $val = str_replace('\'', ''', $val); + } else { + if (is_array($val)) { + $val = implode(' ', $val); + } + $val = $this->view->escape($val); + } + + if ('id' == $key) { + $val = $this->_normalizeId($val); + } + + if (strpos($val, '"') !== false) { + $xhtml .= " $key='$val'"; + } else { + $xhtml .= " $key=\"$val\""; + } + + } + return $xhtml; + } + + /** + * Normalize an ID + * + * @param string $value + * @return string + */ + protected function _normalizeId($value) + { + if (strstr($value, '[')) { + if ('[]' == substr($value, -2)) { + $value = substr($value, 0, strlen($value) - 2); + } + $value = trim($value, ']'); + $value = str_replace('][', '-', $value); + $value = str_replace('[', '-', $value); + } + return $value; + } +} diff --git a/library/vendor/Zend/View/Helper/HtmlFlash.php b/library/vendor/Zend/View/Helper/HtmlFlash.php new file mode 100644 index 0000000..b33ad51 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HtmlFlash.php @@ -0,0 +1,59 @@ + $data, + 'quality' => 'high'), $params); + + return $this->htmlObject($data, self::TYPE, $attribs, $params, $content); + } +} diff --git a/library/vendor/Zend/View/Helper/HtmlList.php b/library/vendor/Zend/View/Helper/HtmlList.php new file mode 100644 index 0000000..e080eb1 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HtmlList.php @@ -0,0 +1,88 @@ +setView($this->view); + throw $e; + } + + $list = ''; + + foreach ($items as $item) { + if (!is_array($item)) { + if ($escape) { + $item = $this->view->escape($item); + } + $list .= '
  • ' . $item . '
  • ' . self::EOL; + } else { + if (6 < strlen($list)) { + $list = substr($list, 0, strlen($list) - 6) + . $this->htmlList($item, $ordered, $attribs, $escape) . '' . self::EOL; + } else { + $list .= '
  • ' . $this->htmlList($item, $ordered, $attribs, $escape) . '
  • ' . self::EOL; + } + } + } + + if ($attribs) { + $attribs = $this->_htmlAttribs($attribs); + } else { + $attribs = ''; + } + + $tag = 'ul'; + if ($ordered) { + $tag = 'ol'; + } + + return '<' . $tag . $attribs . '>' . self::EOL . $list . '' . self::EOL; + } +} diff --git a/library/vendor/Zend/View/Helper/HtmlObject.php b/library/vendor/Zend/View/Helper/HtmlObject.php new file mode 100644 index 0000000..a5a4e22 --- /dev/null +++ b/library/vendor/Zend/View/Helper/HtmlObject.php @@ -0,0 +1,79 @@ + $data, + 'type' => $type), $attribs); + + // Params + $paramHtml = array(); + $closingBracket = $this->getClosingBracket(); + + foreach ($params as $param => $options) { + if (is_string($options)) { + $options = array('value' => $options); + } + + $options = array_merge(array('name' => $param), $options); + + $paramHtml[] = '_htmlAttribs($options) . $closingBracket; + } + + // Content + if (is_array($content)) { + $content = implode(self::EOL, $content); + } + + // Object header + $xhtml = '_htmlAttribs($attribs) . '>' . self::EOL + . implode(self::EOL, $paramHtml) . self::EOL + . ($content ? $content . self::EOL : '') + . ''; + + return $xhtml; + } +} diff --git a/library/vendor/Zend/View/Helper/HtmlPage.php b/library/vendor/Zend/View/Helper/HtmlPage.php new file mode 100644 index 0000000..2a2265c --- /dev/null +++ b/library/vendor/Zend/View/Helper/HtmlPage.php @@ -0,0 +1,74 @@ + self::ATTRIB_CLASSID); + + /** + * Output a html object tag + * + * @param string $data The html url + * @param array $attribs Attribs for the object tag + * @param array $params Params for in the object tag + * @param string $content Alternative content + * @return string + */ + public function htmlPage($data, array $attribs = array(), array $params = array(), $content = null) + { + // Attrs + $attribs = array_merge($this->_attribs, $attribs); + + // Params + $params = array_merge(array('data' => $data), $params); + + return $this->htmlObject($data, self::TYPE, $attribs, $params, $content); + } +} diff --git a/library/vendor/Zend/View/Helper/HtmlQuicktime.php b/library/vendor/Zend/View/Helper/HtmlQuicktime.php new file mode 100644 index 0000000..f09452d --- /dev/null +++ b/library/vendor/Zend/View/Helper/HtmlQuicktime.php @@ -0,0 +1,81 @@ + self::ATTRIB_CLASSID, + 'codebase' => self::ATTRIB_CODEBASE); + + /** + * Output a quicktime movie object tag + * + * @param string $data The quicktime file + * @param array $attribs Attribs for the object tag + * @param array $params Params for in the object tag + * @param string $content Alternative content + * @return string + */ + public function htmlQuicktime($data, array $attribs = array(), array $params = array(), $content = null) + { + // Attrs + $attribs = array_merge($this->_attribs, $attribs); + + // Params + $params = array_merge(array('src' => $data), $params); + + return $this->htmlObject($data, self::TYPE, $attribs, $params, $content); + } +} diff --git a/library/vendor/Zend/View/Helper/InlineScript.php b/library/vendor/Zend/View/Helper/InlineScript.php new file mode 100644 index 0000000..555a2f4 --- /dev/null +++ b/library/vendor/Zend/View/Helper/InlineScript.php @@ -0,0 +1,60 @@ +headScript($mode, $spec, $placement, $attrs, $type); + } +} diff --git a/library/vendor/Zend/View/Helper/Interface.php b/library/vendor/Zend/View/Helper/Interface.php new file mode 100644 index 0000000..c7e761b --- /dev/null +++ b/library/vendor/Zend/View/Helper/Interface.php @@ -0,0 +1,46 @@ +true|false + * this array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false + * that will not be passed to Zend_Json::encode method but will be used here + * @param bool $encodeData + * @return string|void + */ + public function json($data, $keepLayouts = false, $encodeData = true) + { + $options = array(); + if (is_array($keepLayouts)) { + $options = $keepLayouts; + + $keepLayouts = false; + if (array_key_exists('keepLayouts', $options)) { + $keepLayouts = $options['keepLayouts']; + unset($options['keepLayouts']); + } + + if (array_key_exists('encodeData', $options)) { + $encodeData = $options['encodeData']; + unset($options['encodeData']); + } + } + + if ($encodeData) { + $data = Zend_Json::encode($data, null, $options); + } + if (!$keepLayouts) { + $layout = Zend_Layout::getMvcInstance(); + if ($layout instanceof Zend_Layout) { + $layout->disableLayout(); + } + } + + $response = Zend_Controller_Front::getInstance()->getResponse(); + $response->setHeader('Content-Type', 'application/json', true); + return $data; + } +} diff --git a/library/vendor/Zend/View/Helper/Layout.php b/library/vendor/Zend/View/Helper/Layout.php new file mode 100644 index 0000000..a83bf06 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Layout.php @@ -0,0 +1,79 @@ +_layout) { + $this->_layout = Zend_Layout::getMvcInstance(); + if (null === $this->_layout) { + // Implicitly creates layout object + $this->_layout = new Zend_Layout(); + } + } + + return $this->_layout; + } + + /** + * Set layout object + * + * @param Zend_Layout $layout + * @return Zend_Layout_Controller_Action_Helper_Layout + */ + public function setLayout(Zend_Layout $layout) + { + $this->_layout = $layout; + return $this; + } + + /** + * Return layout object + * + * Usage: $this->layout()->setLayout('alternate'); + * + * @return Zend_Layout + */ + public function layout() + { + return $this->getLayout(); + } +} diff --git a/library/vendor/Zend/View/Helper/PaginationControl.php b/library/vendor/Zend/View/Helper/PaginationControl.php new file mode 100644 index 0000000..b474963 --- /dev/null +++ b/library/vendor/Zend/View/Helper/PaginationControl.php @@ -0,0 +1,142 @@ +view = $view; + return $this; + } + + /** + * Sets the default view partial. + * + * @param string|array $partial View partial + */ + public static function setDefaultViewPartial($partial) + { + self::$_defaultViewPartial = $partial; + } + + /** + * Gets the default view partial + * + * @return string|array + */ + public static function getDefaultViewPartial() + { + return self::$_defaultViewPartial; + } + + /** + * Render the provided pages. This checks if $view->paginator is set and, + * if so, uses that. Also, if no scrolling style or partial are specified, + * the defaults will be used (if set). + * + * @param Zend_Paginator (Optional) $paginator + * @param string $scrollingStyle (Optional) Scrolling style + * @param string $partial (Optional) View partial + * @param array|string $params (Optional) params to pass to the partial + * @return string + * @throws Zend_View_Exception + */ + public function paginationControl(Zend_Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null) + { + if ($paginator === null) { + if (isset($this->view->paginator) and $this->view->paginator !== null and $this->view->paginator instanceof Zend_Paginator) { + $paginator = $this->view->paginator; + } else { + /** + * @see Zend_View_Exception + */ + + $e = new Zend_View_Exception('No paginator instance provided or incorrect type'); + $e->setView($this->view); + throw $e; + } + } + + if ($partial === null) { + if (self::$_defaultViewPartial === null) { + /** + * @see Zend_View_Exception + */ + $e = new Zend_View_Exception('No view partial provided and no default set'); + $e->setView($this->view); + throw $e; + } + + $partial = self::$_defaultViewPartial; + } + + $pages = get_object_vars($paginator->getPages($scrollingStyle)); + + if ($params !== null) { + $pages = array_merge($pages, (array) $params); + } + + if (is_array($partial)) { + if (count($partial) != 2) { + /** + * @see Zend_View_Exception + */ + $e = new Zend_View_Exception('A view partial supplied as an array must contain two values: the filename and its module'); + $e->setView($this->view); + throw $e; + } + + if ($partial[1] !== null) { + return $this->view->partial($partial[0], $partial[1], $pages); + } + + $partial = $partial[0]; + } + + return $this->view->partial($partial, $pages); + } +} diff --git a/library/vendor/Zend/View/Helper/Partial.php b/library/vendor/Zend/View/Helper/Partial.php new file mode 100644 index 0000000..787db9c --- /dev/null +++ b/library/vendor/Zend/View/Helper/Partial.php @@ -0,0 +1,150 @@ +cloneView(); + if (isset($this->partialCounter)) { + $view->partialCounter = $this->partialCounter; + } + if (isset($this->partialTotalCount)) { + $view->partialTotalCount = $this->partialTotalCount; + } + + if ((null !== $module) && is_string($module)) { + $moduleDir = Zend_Controller_Front::getInstance()->getControllerDirectory($module); + if (null === $moduleDir) { + $e = new Zend_View_Helper_Partial_Exception('Cannot render partial; module does not exist'); + $e->setView($this->view); + throw $e; + } + $viewsDir = dirname($moduleDir) . '/views'; + $view->addBasePath($viewsDir); + } elseif ((null == $model) && (null !== $module) + && (is_array($module) || is_object($module))) + { + $model = $module; + } + + if (!empty($model)) { + if (is_array($model)) { + $view->assign($model); + } elseif (is_object($model)) { + if (null !== ($objectKey = $this->getObjectKey())) { + $view->assign($objectKey, $model); + } elseif (method_exists($model, 'toArray')) { + $view->assign($model->toArray()); + } else { + $view->assign(get_object_vars($model)); + } + } + } + + return $view->render($name); + } + + /** + * Clone the current View + * + * @return Zend_View_Interface + */ + public function cloneView() + { + $view = clone $this->view; + $view->clearVars(); + return $view; + } + + /** + * Set object key + * + * @param string $key + * @return Zend_View_Helper_Partial + */ + public function setObjectKey($key) + { + if (null === $key) { + $this->_objectKey = null; + } else { + $this->_objectKey = (string) $key; + } + + return $this; + } + + /** + * Retrieve object key + * + * The objectKey is the variable to which an object in the iterator will be + * assigned. + * + * @return null|string + */ + public function getObjectKey() + { + return $this->_objectKey; + } +} diff --git a/library/vendor/Zend/View/Helper/Partial/Exception.php b/library/vendor/Zend/View/Helper/Partial/Exception.php new file mode 100644 index 0000000..5cd850a --- /dev/null +++ b/library/vendor/Zend/View/Helper/Partial/Exception.php @@ -0,0 +1,38 @@ +setView($this->view); + throw $e; + } + + if (is_object($model) + && (!$model instanceof Traversable) + && method_exists($model, 'toArray') + ) { + $model = $model->toArray(); + } + + $content = ''; + // reset the counter if it's call again + $this->partialCounter = 0; + $this->partialTotalCount = count($model); + + foreach ($model as $item) { + // increment the counter variable + $this->partialCounter++; + + $content .= $this->partial($name, $module, $item); + } + + return $content; + } +} diff --git a/library/vendor/Zend/View/Helper/Placeholder.php b/library/vendor/Zend/View/Helper/Placeholder.php new file mode 100644 index 0000000..3ca47ad --- /dev/null +++ b/library/vendor/Zend/View/Helper/Placeholder.php @@ -0,0 +1,85 @@ +_registry = Zend_View_Helper_Placeholder_Registry::getRegistry(); + } + + + /** + * Placeholder helper + * + * @param string $name + * @return Zend_View_Helper_Placeholder_Container_Abstract + */ + public function placeholder($name) + { + $name = (string) $name; + return $this->_registry->getContainer($name); + } + + /** + * Retrieve the registry + * + * @return Zend_View_Helper_Placeholder_Registry + */ + public function getRegistry() + { + return $this->_registry; + } +} diff --git a/library/vendor/Zend/View/Helper/Placeholder/Container.php b/library/vendor/Zend/View/Helper/Placeholder/Container.php new file mode 100644 index 0000000..c30025a --- /dev/null +++ b/library/vendor/Zend/View/Helper/Placeholder/Container.php @@ -0,0 +1,35 @@ +exchangeArray(array($value)); + } + + /** + * Prepend a value to the top of the container + * + * @param mixed $value + * @return void + */ + public function prepend($value) + { + $values = $this->getArrayCopy(); + array_unshift($values, $value); + $this->exchangeArray($values); + } + + /** + * Retrieve container value + * + * If single element registered, returns that element; otherwise, + * serializes to array. + * + * @return mixed + */ + public function getValue() + { + if (1 == count($this)) { + $keys = $this->getKeys(); + $key = array_shift($keys); + return $this[$key]; + } + + return $this->getArrayCopy(); + } + + /** + * Set prefix for __toString() serialization + * + * @param string $prefix + * @return Zend_View_Helper_Placeholder_Container + */ + public function setPrefix($prefix) + { + $this->_prefix = (string) $prefix; + return $this; + } + + /** + * Retrieve prefix + * + * @return string + */ + public function getPrefix() + { + return $this->_prefix; + } + + /** + * Set postfix for __toString() serialization + * + * @param string $postfix + * @return Zend_View_Helper_Placeholder_Container + */ + public function setPostfix($postfix) + { + $this->_postfix = (string) $postfix; + return $this; + } + + /** + * Retrieve postfix + * + * @return string + */ + public function getPostfix() + { + return $this->_postfix; + } + + /** + * Set separator for __toString() serialization + * + * Used to implode elements in container + * + * @param string $separator + * @return Zend_View_Helper_Placeholder_Container + */ + public function setSeparator($separator) + { + $this->_separator = (string) $separator; + return $this; + } + + /** + * Retrieve separator + * + * @return string + */ + public function getSeparator() + { + return $this->_separator; + } + + /** + * Set the indentation string for __toString() serialization, + * optionally, if a number is passed, it will be the number of spaces + * + * @param string|int $indent + * @return Zend_View_Helper_Placeholder_Container_Abstract + */ + public function setIndent($indent) + { + $this->_indent = $this->getWhitespace($indent); + return $this; + } + + /** + * Retrieve indentation + * + * @return string + */ + public function getIndent() + { + return $this->_indent; + } + + /** + * Retrieve whitespace representation of $indent + * + * @param int|string $indent + * @return string + */ + public function getWhitespace($indent) + { + if (is_int($indent)) { + $indent = str_repeat(' ', $indent); + } + + return (string) $indent; + } + + /** + * Start capturing content to push into placeholder + * + * @param int|string $type How to capture content into placeholder; append, prepend, or set + * @param null $key + * @throws Zend_View_Helper_Placeholder_Container_Exception + * @return void + */ + public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $key = null) + { + if ($this->_captureLock) { + $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest placeholder captures for the same placeholder'); + $e->setView($this->view); + throw $e; + } + + $this->_captureLock = true; + $this->_captureType = $type; + if ((null !== $key) && is_scalar($key)) { + $this->_captureKey = (string) $key; + } + ob_start(); + } + + /** + * End content capture + * + * @return void + */ + public function captureEnd() + { + $data = ob_get_clean(); + $key = null; + $this->_captureLock = false; + if (null !== $this->_captureKey) { + $key = $this->_captureKey; + } + switch ($this->_captureType) { + case self::SET: + if (null !== $key) { + $this[$key] = $data; + } else { + $this->exchangeArray(array($data)); + } + break; + case self::PREPEND: + if (null !== $key) { + $array = array($key => $data); + $values = $this->getArrayCopy(); + $final = $array + $values; + $this->exchangeArray($final); + } else { + $this->prepend($data); + } + break; + case self::APPEND: + default: + if (null !== $key) { + if (empty($this[$key])) { + $this[$key] = $data; + } else { + $this[$key] .= $data; + } + } else { + $this[$this->nextIndex()] = $data; + } + break; + } + } + + /** + * Get keys + * + * @return array + */ + public function getKeys() + { + $array = $this->getArrayCopy(); + return array_keys($array); + } + + /** + * Next Index + * + * as defined by the PHP manual + * @return int + */ + public function nextIndex() + { + $keys = $this->getKeys(); + if (0 == count($keys)) { + return 0; + } + + return $nextIndex = max($keys) + 1; + } + + /** + * Render the placeholder + * + * @param null $indent + * @return string + */ + public function toString($indent = null) + { + // Check items + if (0 === $this->count()) { + return ''; + } + + $indent = ($indent !== null) + ? $this->getWhitespace($indent) + : $this->getIndent(); + + $items = $this->getArrayCopy(); + $return = $indent + . $this->getPrefix() + . implode($this->getSeparator(), $items) + . $this->getPostfix(); + $return = preg_replace("/(\r\n?|\n)/", '$1' . $indent, $return); + return $return; + } + + /** + * Serialize object to string + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } +} diff --git a/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php b/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php new file mode 100644 index 0000000..aceb769 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php @@ -0,0 +1,38 @@ +setRegistry(Zend_View_Helper_Placeholder_Registry::getRegistry()); + $this->setContainer($this->getRegistry()->getContainer($this->_regKey)); + } + + /** + * Retrieve registry + * + * @return Zend_View_Helper_Placeholder_Registry + */ + public function getRegistry() + { + return $this->_registry; + } + + /** + * Set registry object + * + * @param Zend_View_Helper_Placeholder_Registry $registry + * @return Zend_View_Helper_Placeholder_Container_Standalone + */ + public function setRegistry(Zend_View_Helper_Placeholder_Registry $registry) + { + $this->_registry = $registry; + return $this; + } + + /** + * Set whether or not auto escaping should be used + * + * @param bool $autoEscape whether or not to auto escape output + * @return Zend_View_Helper_Placeholder_Container_Standalone + */ + public function setAutoEscape($autoEscape = true) + { + $this->_autoEscape = ($autoEscape) ? true : false; + return $this; + } + + /** + * Return whether autoEscaping is enabled or disabled + * + * return bool + */ + public function getAutoEscape() + { + return $this->_autoEscape; + } + + /** + * Escape a string + * + * @param string $string + * @return string + */ + protected function _escape($string) + { + $enc = 'UTF-8'; + if ($this->view instanceof Zend_View_Interface + && method_exists($this->view, 'getEncoding') + ) { + $enc = $this->view->getEncoding(); + } + + return htmlspecialchars((string) $string, ENT_COMPAT, $enc); + } + + /** + * Set container on which to operate + * + * @param Zend_View_Helper_Placeholder_Container_Abstract $container + * @return Zend_View_Helper_Placeholder_Container_Standalone + */ + public function setContainer(Zend_View_Helper_Placeholder_Container_Abstract $container) + { + $this->_container = $container; + return $this; + } + + /** + * Retrieve placeholder container + * + * @return Zend_View_Helper_Placeholder_Container_Abstract + */ + public function getContainer() + { + return $this->_container; + } + + /** + * Overloading: set property value + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $container = $this->getContainer(); + $container[$key] = $value; + } + + /** + * Overloading: retrieve property + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + $container = $this->getContainer(); + if (isset($container[$key])) { + return $container[$key]; + } + + return null; + } + + /** + * Overloading: check if property is set + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + $container = $this->getContainer(); + return isset($container[$key]); + } + + /** + * Overloading: unset property + * + * @param string $key + * @return void + */ + public function __unset($key) + { + $container = $this->getContainer(); + if (isset($container[$key])) { + unset($container[$key]); + } + } + + /** + * Overload + * + * Proxy to container methods + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + $container = $this->getContainer(); + if (method_exists($container, $method)) { + $return = call_user_func_array(array($container, $method), $args); + if ($return === $container) { + // If the container is returned, we really want the current object + return $this; + } + return $return; + } + + $e = new Zend_View_Exception('Method "' . $method . '" does not exist'); + $e->setView($this->view); + throw $e; + } + + /** + * String representation + * + * @return string + */ + public function toString() + { + return $this->getContainer()->toString(); + } + + /** + * Cast to string representation + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Countable + * + * @return int + */ + public function count(): int + { + $container = $this->getContainer(); + return count($container); + } + + /** + * ArrayAccess: offsetExists + * + * @param string|int $offset + * @return bool + */ + public function offsetExists($offset): bool + { + return $this->getContainer()->offsetExists($offset); + } + + /** + * ArrayAccess: offsetGet + * + * @param string|int $offset + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->getContainer()->offsetGet($offset); + } + + /** + * ArrayAccess: offsetSet + * + * @param string|int $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value): void + { + $this->getContainer()->offsetSet($offset, $value); + } + + /** + * ArrayAccess: offsetUnset + * + * @param string|int $offset + * @return void + */ + public function offsetUnset($offset): void + { + $this->getContainer()->offsetUnset($offset); + } + + /** + * IteratorAggregate: get Iterator + * + * @return Iterator + */ + public function getIterator(): Traversable + { + return $this->getContainer()->getIterator(); + } +} diff --git a/library/vendor/Zend/View/Helper/Placeholder/Registry.php b/library/vendor/Zend/View/Helper/Placeholder/Registry.php new file mode 100644 index 0000000..111604c --- /dev/null +++ b/library/vendor/Zend/View/Helper/Placeholder/Registry.php @@ -0,0 +1,183 @@ +_items[$key] = new $this->_containerClass($value); + return $this->_items[$key]; + } + + /** + * Retrieve a placeholder container + * + * @param string $key + * @return Zend_View_Helper_Placeholder_Container_Abstract + */ + public function getContainer($key) + { + $key = (string) $key; + if (isset($this->_items[$key])) { + return $this->_items[$key]; + } + + $container = $this->createContainer($key); + + return $container; + } + + /** + * Does a particular container exist? + * + * @param string $key + * @return bool + */ + public function containerExists($key) + { + $key = (string) $key; + $return = array_key_exists($key, $this->_items); + return $return; + } + + /** + * Set the container for an item in the registry + * + * @param string $key + * @param Zend_View_Placeholder_Container_Abstract $container + * @return Zend_View_Placeholder_Registry + */ + public function setContainer($key, Zend_View_Helper_Placeholder_Container_Abstract $container) + { + $key = (string) $key; + $this->_items[$key] = $container; + return $this; + } + + /** + * Delete a container + * + * @param string $key + * @return bool + */ + public function deleteContainer($key) + { + $key = (string) $key; + if (isset($this->_items[$key])) { + unset($this->_items[$key]); + return true; + } + + return false; + } + + /** + * Set the container class to use + * + * @param string $name + * @return Zend_View_Helper_Placeholder_Registry + */ + public function setContainerClass($name) + { + if (!class_exists($name)) { + Zend_Loader::loadClass($name); + } + + $reflection = new ReflectionClass($name); + if (!$reflection->isSubclassOf(new ReflectionClass('Zend_View_Helper_Placeholder_Container_Abstract'))) { + $e = new Zend_View_Helper_Placeholder_Registry_Exception('Invalid Container class specified'); + $e->setView($this->view); + throw $e; + } + + $this->_containerClass = $name; + return $this; + } + + /** + * Retrieve the container class + * + * @return string + */ + public function getContainerClass() + { + return $this->_containerClass; + } +} diff --git a/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php b/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php new file mode 100644 index 0000000..42d7a28 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php @@ -0,0 +1,38 @@ +view->placeholder($placeholder)->captureStart(); + echo $this->view->render($script); + $this->view->placeholder($placeholder)->captureEnd(); + } +} diff --git a/library/vendor/Zend/View/Helper/ServerUrl.php b/library/vendor/Zend/View/Helper/ServerUrl.php new file mode 100644 index 0000000..c38ec8b --- /dev/null +++ b/library/vendor/Zend/View/Helper/ServerUrl.php @@ -0,0 +1,148 @@ +setScheme($scheme); + + if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) { + $this->setHost($_SERVER['HTTP_HOST']); + } else if (isset($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'])) { + $name = $_SERVER['SERVER_NAME']; + $port = $_SERVER['SERVER_PORT']; + + if (($scheme == 'http' && $port == 80) || + ($scheme == 'https' && $port == 443)) { + $this->setHost($name); + } else { + $this->setHost($name . ':' . $port); + } + } + } + + /** + * View helper entry point: + * Returns the current host's URL like http://site.com + * + * @param string|boolean $requestUri [optional] if true, the request URI + * found in $_SERVER will be appended + * as a path. If a string is given, it + * will be appended as a path. Default + * is to not append any path. + * @return string server url + */ + public function serverUrl($requestUri = null) + { + if ($requestUri === true) { + $path = $_SERVER['REQUEST_URI']; + } else if (is_string($requestUri)) { + $path = $requestUri; + } else { + $path = ''; + } + + return $this->getScheme() . '://' . $this->getHost() . $path; + } + + /** + * Returns host + * + * @return string host + */ + public function getHost() + { + return $this->_host; + } + + /** + * Sets host + * + * @param string $host new host + * @return Zend_View_Helper_ServerUrl fluent interface, returns self + */ + public function setHost($host) + { + $this->_host = $host; + return $this; + } + + /** + * Returns scheme (typically http or https) + * + * @return string scheme (typically http or https) + */ + public function getScheme() + { + return $this->_scheme; + } + + /** + * Sets scheme (typically http or https) + * + * @param string $scheme new scheme (typically http or https) + * @return Zend_View_Helper_ServerUrl fluent interface, returns self + */ + public function setScheme($scheme) + { + $this->_scheme = $scheme; + return $this; + } +} diff --git a/library/vendor/Zend/View/Helper/Translate.php b/library/vendor/Zend/View/Helper/Translate.php new file mode 100644 index 0000000..8a7d916 --- /dev/null +++ b/library/vendor/Zend/View/Helper/Translate.php @@ -0,0 +1,174 @@ +setTranslator($translate); + } + } + + /** + * Translate a message + * You can give multiple params or an array of params. + * If you want to output another locale just set it as last single parameter + * Example 1: translate('%1\$s + %2\$s', $value1, $value2, $locale); + * Example 2: translate('%1\$s + %2\$s', array($value1, $value2), $locale); + * + * @param string $messageid Id of the message to be translated + * @return string|Zend_View_Helper_Translate Translated message + */ + public function translate($messageid = null) + { + if ($messageid === null) { + return $this; + } + + $translate = $this->getTranslator(); + $options = func_get_args(); + + array_shift($options); + $count = count($options); + $locale = null; + if ($count > 0) { + if (Zend_Locale::isLocale($options[($count - 1)], null, false) !== false) { + $locale = array_pop($options); + } + } + + if ((count($options) === 1) and (is_array($options[0]) === true)) { + $options = $options[0]; + } + + if ($translate !== null) { + $messageid = $translate->translate($messageid, $locale); + } + + if (count($options) === 0) { + return $messageid; + } + + return vsprintf($messageid, $options); + } + + /** + * Sets a translation Adapter for translation + * + * @param Zend_Translate|Zend_Translate_Adapter $translate Instance of Zend_Translate + * @throws Zend_View_Exception When no or a false instance was set + * @return Zend_View_Helper_Translate + */ + public function setTranslator($translate) + { + if ($translate instanceof Zend_Translate_Adapter) { + $this->_translator = $translate; + } else if ($translate instanceof Zend_Translate) { + $this->_translator = $translate->getAdapter(); + } else { + $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); + $e->setView($this->view); + throw $e; + } + + return $this; + } + + /** + * Retrieve translation object + * + * @return Zend_Translate_Adapter|null + */ + public function getTranslator() + { + if ($this->_translator === null) { + if (Zend_Registry::isRegistered('Zend_Translate')) { + $this->setTranslator(Zend_Registry::get('Zend_Translate')); + } + } + + return $this->_translator; + } + + /** + * Set's an new locale for all further translations + * + * @param string|Zend_Locale $locale New locale to set + * @throws Zend_View_Exception When no Zend_Translate instance was set + * @return Zend_View_Helper_Translate + */ + public function setLocale($locale = null) + { + $translate = $this->getTranslator(); + if ($translate === null) { + $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); + $e->setView($this->view); + throw $e; + } + + $translate->setLocale($locale); + return $this; + } + + /** + * Returns the set locale for translations + * + * @throws Zend_View_Exception When no Zend_Translate instance was set + * @return string|Zend_Locale + */ + public function getLocale() + { + $translate = $this->getTranslator(); + if ($translate === null) { + $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); + $e->setView($this->view); + throw $e; + } + + return $translate->getLocale(); + } +} diff --git a/library/vendor/Zend/View/Helper/Url.php b/library/vendor/Zend/View/Helper/Url.php new file mode 100644 index 0000000..3ed84ca --- /dev/null +++ b/library/vendor/Zend/View/Helper/Url.php @@ -0,0 +1,50 @@ +getRouter(); + return $router->assemble($urlOptions, $name, $reset, $encode); + } +} diff --git a/library/vendor/Zend/View/Interface.php b/library/vendor/Zend/View/Interface.php new file mode 100644 index 0000000..496ec71 --- /dev/null +++ b/library/vendor/Zend/View/Interface.php @@ -0,0 +1,137 @@ + value pairs to set en + * masse. + * + * @see __set() + * @param string|array $spec The assignment strategy to use (key or array of key + * => value pairs) + * @param mixed $value (Optional) If assigning a named variable, use this + * as the value. + * @return void + */ + public function assign($spec, $value = null); + + /** + * Clear all assigned variables + * + * Clears all variables assigned to Zend_View either via {@link assign()} or + * property overloading ({@link __get()}/{@link __set()}). + * + * @return void + */ + public function clearVars(); + + /** + * Processes a view script and returns the output. + * + * @param string $name The script name to process. + * @return string The script output. + */ + public function render($name); +} diff --git a/library/vendor/Zend/View/Stream.php b/library/vendor/Zend/View/Stream.php new file mode 100644 index 0000000..ae8d524 --- /dev/null +++ b/library/vendor/Zend/View/Stream.php @@ -0,0 +1,183 @@ +_data = file_get_contents($path); + + /** + * If reading the file failed, update our local stat store + * to reflect the real stat of the file, then return on failure + */ + if ($this->_data === false) { + $this->_stat = stat($path); + return false; + } + + /** + * Convert to long-form and to + * + */ + $this->_data = preg_replace('/\<\?\=/', "_data); + $this->_data = preg_replace('/<\?(?!xml|php)/s', '_data); + + /** + * file_get_contents() won't update PHP's stat cache, so we grab a stat + * of the file to prevent additional reads should the script be + * requested again, which will make include() happy. + */ + $this->_stat = stat($path); + + return true; + } + + /** + * Included so that __FILE__ returns the appropriate info + * + * @return array + */ + public function url_stat() + { + return $this->_stat; + } + + /** + * Reads from the stream. + */ + public function stream_read($count) + { + $ret = substr($this->_data, $this->_pos, $count); + $this->_pos += strlen($ret); + return $ret; + } + + + /** + * Tells the current position in the stream. + */ + public function stream_tell() + { + return $this->_pos; + } + + + /** + * Tells if we are at the end of the stream. + */ + public function stream_eof() + { + return $this->_pos >= strlen($this->_data); + } + + + /** + * Stream statistics. + */ + public function stream_stat() + { + return $this->_stat; + } + + + /** + * Seek to a specific point in the stream. + */ + public function stream_seek($offset, $whence) + { + switch ($whence) { + case SEEK_SET: + if ($offset < strlen($this->_data) && $offset >= 0) { + $this->_pos = $offset; + return true; + } else { + return false; + } + break; + + case SEEK_CUR: + if ($offset >= 0) { + $this->_pos += $offset; + return true; + } else { + return false; + } + break; + + case SEEK_END: + if (strlen($this->_data) + $offset >= 0) { + $this->_pos = strlen($this->_data) + $offset; + return true; + } else { + return false; + } + break; + + default: + return false; + } + } +} -- cgit v1.2.3