'', 'metalink' => '', 'link' => '%s', 'mailto' => '%s', 'form' => '
', 'formend' => '
', 'input' => '', 'textarea' => '', 'hidden' => '', 'checkbox' => '', 'checkboxmultiple' => '', 'radio' => '%s', 'selectstart' => '', 'selectempty' => '', 'selectoption' => '', 'selectend' => '', 'optiongroup' => '', 'optiongroupend' => '', 'checkboxmultiplestart' => '', 'checkboxmultipleend' => '', 'password' => '', 'file' => '', 'file_no_model' => '', 'submit' => '', 'submitimage' => '', 'button' => '', 'image' => '', 'tableheader' => '%s', 'tableheaderrow' => '%s', 'tablecell' => '%s', 'tablerow' => '%s', 'block' => '%s', 'blockstart' => '', 'blockend' => '', 'tag' => '<%s%s>%s', 'tagstart' => '<%s%s>', 'tagend' => '', 'para' => '%s

', 'parastart' => '', 'label' => '', 'fieldset' => '%s', 'fieldsetstart' => '
%s', 'fieldsetend' => '
', 'legend' => '%s', 'css' => '', 'style' => '', 'charset' => '', 'ul' => '%s', 'ol' => '%s', 'li' => '%s', 'error' => '%s' ); /** * Base URL * * @var string */ var $base = null; /** * URL to current action. * * @var string */ var $here = null; /** * Parameter array. * * @var array */ var $params = array(); /** * Current action. * * @var string */ var $action = null; /** * Enter description here... * * @var array */ var $data = null; /**#@-*/ /************************************************************************* * Private variables *************************************************************************/ /**#@+ * @access private */ /** * Breadcrumbs. * * @var array * @access private */ var $_crumbs = array(); /** * Document type definitions * * @var array * @access private */ var $__docTypes = array( 'html4-strict' => '', 'html4-trans' => '', 'html4-frame' => '', 'xhtml-strict' => '', 'xhtml-trans' => '', 'xhtml-frame' => '', 'xhtml11' => '' ); /** * Adds a link to the breadcrumbs array. * * @param string $name Text for link * @param string $link URL for link (if empty it won't be a link) * @param mixed $options Link attributes e.g. array('id'=>'selected') */ function addCrumb($name, $link = null, $options = null) { $this->_crumbs[] = array($name, $link, $options); } /** * Returns a doctype string. * * Possible doctypes: * + html4-strict: HTML4 Strict. * + html4-trans: HTML4 Transitional. * + html4-frame: HTML4 Frameset. * + xhtml-strict: XHTML1 Strict. * + xhtml-trans: XHTML1 Transitional. * + xhtml-frame: XHTML1 Frameset. * + xhtml11: XHTML1.1. * * @param string $type Doctype to use. * @return string Doctype. */ function docType($type = 'xhtml-strict') { if (isset($this->__docTypes[$type])) { return $this->output($this->__docTypes[$type]); } return null; } /** * Creates a link to an external resource and handles basic meta tags * * @param string $type The title of the external resource * @param mixed $url The address of the external resource or string for content attribute * @param array $attributes Other attributes for the generated tag. If the type attribute is html, rss, atom, or icon, the mime-type is returned. * @param boolean $inline If set to false, the generated tag appears in the head tag of the layout. * @return string */ function meta($type, $url = null, $attributes = array(), $inline = true) { if (!is_array($type)) { $types = array( 'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $url), 'atom' => array('type' => 'application/atom+xml', 'title' => $type, 'link' => $url), 'icon' => array('type' => 'image/x-icon', 'rel' => 'icon', 'link' => $url), 'keywords' => array('name' => 'keywords', 'content' => $url), 'description' => array('name' => 'description', 'content' => $url), ); if ($type === 'icon' && $url === null) { $types['icon']['link'] = $this->webroot('favicon.ico'); } if (isset($types[$type])) { $type = $types[$type]; } elseif (!isset($attributes['type']) && $url !== null) { if (is_array($url) && isset($url['ext'])) { $type = $types[$url['ext']]; } else { $type = $types['rss']; } } elseif (isset($attributes['type']) && isset($types[$attributes['type']])) { $type = $types[$attributes['type']]; unset($attributes['type']); } else { $type = array(); } } elseif ($url !== null) { $inline = $url; } $attributes = array_merge($type, $attributes); $out = null; if (isset($attributes['link'])) { if (isset($attributes['rel']) && $attributes['rel'] === 'icon') { $out = sprintf($this->tags['metalink'], $attributes['link'], $this->_parseAttributes($attributes, array('link'), ' ', ' ')); $attributes['rel'] = 'shortcut icon'; } else { $attributes['link'] = $this->url($attributes['link'], true); } $out .= sprintf($this->tags['metalink'], $attributes['link'], $this->_parseAttributes($attributes, array('link'), ' ', ' ')); } else { $out = sprintf($this->tags['meta'], $this->_parseAttributes($attributes, array('type'))); } if ($inline) { return $this->output($out); } else { $view =& ClassRegistry::getObject('view'); $view->addScript($out); } } /** * Returns a charset META-tag. * * @param string $charset The character set to be used in the meta tag. Example: "utf-8". * @return string A meta tag containing the specified character set. */ function charset($charset = null) { if (empty($charset)) { $charset = strtolower(Configure::read('App.encoding')); } return $this->output(sprintf($this->tags['charset'], (!empty($charset) ? $charset : 'utf-8'))); } /** * Creates an HTML link. * * If $url starts with "http://" this is treated as an external link. Else, * it is treated as a path to controller/action and parsed with the * HtmlHelper::url() method. * * If the $url is empty, $title is used instead. * * @param string $title The content to be wrapped by tags. * @param mixed $url Cake-relative URL or array of URL parameters, or external URL (starts with http://) * @param array $htmlAttributes Array of HTML attributes. * @param string $confirmMessage JavaScript confirmation message. * @param boolean $escapeTitle Whether or not $title should be HTML escaped. * @return string An element. */ function link($title, $url = null, $htmlAttributes = array(), $confirmMessage = false, $escapeTitle = true) { if ($url !== null) { $url = $this->url($url); } else { $url = $this->url($title); $title = $url; $escapeTitle = false; } if (isset($htmlAttributes['escape'])) { $escapeTitle = $htmlAttributes['escape']; unset($htmlAttributes['escape']); } if ($escapeTitle === true) { $title = h($title); } elseif (is_string($escapeTitle)) { $title = htmlentities($title, ENT_QUOTES, $escapeTitle); } if (!empty($htmlAttributes['confirm'])) { $confirmMessage = $htmlAttributes['confirm']; unset($htmlAttributes['confirm']); } if ($confirmMessage) { $confirmMessage = str_replace("'", "\'", $confirmMessage); $confirmMessage = str_replace('"', '\"', $confirmMessage); $htmlAttributes['onclick'] = "return confirm('{$confirmMessage}');"; } elseif (isset($htmlAttributes['default']) && $htmlAttributes['default'] == false) { if (isset($htmlAttributes['onclick'])) { $htmlAttributes['onclick'] .= ' event.returnValue = false; return false;'; } else { $htmlAttributes['onclick'] = 'event.returnValue = false; return false;'; } unset($htmlAttributes['default']); } return $this->output(sprintf($this->tags['link'], $url, $this->_parseAttributes($htmlAttributes), $title)); } /** * Creates a link element for CSS stylesheets. * * @param mixed $path The name of a CSS style sheet in /app/webroot/css, or an array containing names of CSS stylesheets in that directory. * @param string $rel Rel attribute. Defaults to "stylesheet". * @param array $htmlAttributes Array of HTML attributes. * @param boolean $inline If set to false, the generated tag appears in the head tag of the layout. * @return string CSS or