'', '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', 'javascriptblock' => '', 'javascriptstart' => '', 'javascriptend' => '' ); /** * Breadcrumbs. * * @var array * @access protected */ var $_crumbs = array(); /** * Names of script files that have been included once * * @var array * @access private */ var $__includedScripts = array(); /** * Options for the currently opened script block buffer if any. * * @var array * @access protected */ var $_scriptBlockOptions = 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') * @return void * @see HtmlHelper::link() for details on $options that can be used. * @access public */ 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 string * @access public * @link http://book.cakephp.org/view/1439/docType */ function docType($type = 'xhtml-strict') { if (isset($this->__docTypes[$type])) { return $this->__docTypes[$type]; } return null; } /** * Creates a link to an external resource and handles basic meta tags * * ### Options * * - `inline` Whether or not the link element should be output inline, or in scripts_for_layout. * * @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 $options Other attributes for the generated tag. If the type attribute is html, * rss, atom, or icon, the mime-type is returned. * @return string A completed `` element. * @access public * @link http://book.cakephp.org/view/1438/meta */ function meta($type, $url = null, $options = array()) { $inline = isset($options['inline']) ? $options['inline'] : true; unset($options['inline']); 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($options['type']) && $url !== null) { if (is_array($url) && isset($url['ext'])) { $type = $types[$url['ext']]; } else { $type = $types['rss']; } } elseif (isset($options['type']) && isset($types[$options['type']])) { $type = $types[$options['type']]; unset($options['type']); } else { $type = array(); } } elseif ($url !== null) { $inline = $url; } $options = array_merge($type, $options); $out = null; if (isset($options['link'])) { if (isset($options['rel']) && $options['rel'] === 'icon') { $out = sprintf($this->tags['metalink'], $options['link'], $this->_parseAttributes($options, array('link'), ' ', ' ')); $options['rel'] = 'shortcut icon'; } else { $options['link'] = $this->url($options['link'], true); } $out .= sprintf($this->tags['metalink'], $options['link'], $this->_parseAttributes($options, array('link'), ' ', ' ')); } else { $out = sprintf($this->tags['meta'], $this->_parseAttributes($options, array('type'), ' ', ' ')); } if ($inline) { return $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. If empty, * The App.encoding value will be used. Example: "utf-8". * @return string A meta tag containing the specified character set. * @access public * @link http://book.cakephp.org/view/1436/charset */ function charset($charset = null) { if (empty($charset)) { $charset = strtolower(Configure::read('App.encoding')); } return 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. * * ### Options * * - `escape` Set to false to disable escaping of title and attributes. * * @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 $options Array of HTML attributes. * @param string $confirmMessage JavaScript confirmation message. * @return string An `` element. * @access public * @link http://book.cakephp.org/view/1442/link */ function link($title, $url = null, $options = array(), $confirmMessage = false) { $escapeTitle = true; if ($url !== null) { $url = $this->url($url); } else { $url = $this->url($title); $title = $url; $escapeTitle = false; } if (isset($options['escape'])) { $escapeTitle = $options['escape']; } if ($escapeTitle === true) { $title = h($title); } elseif (is_string($escapeTitle)) { $title = htmlentities($title, ENT_QUOTES, $escapeTitle); } if (!empty($options['confirm'])) { $confirmMessage = $options['confirm']; unset($options['confirm']); } if ($confirmMessage) { $confirmMessage = str_replace("'", "\'", $confirmMessage); $confirmMessage = str_replace('"', '\"', $confirmMessage); $options['onclick'] = "return confirm('{$confirmMessage}');"; } elseif (isset($options['default']) && $options['default'] == false) { if (isset($options['onclick'])) { $options['onclick'] .= ' event.returnValue = false; return false;'; } else { $options['onclick'] = 'event.returnValue = false; return false;'; } unset($options['default']); } return sprintf($this->tags['link'], $url, $this->_parseAttributes($options), $title); } /** * Creates a link element for CSS stylesheets. * * ### Options * * - `inline` If set to false, the generated tag appears in the head tag of the layout. Defaults to true * * @param mixed $path The name of a CSS style sheet or an array containing names of * CSS stylesheets. If `$path` is prefixed with '/', the path will be relative to the webroot * of your application. Otherwise, the path will be relative to your CSS path, usually webroot/css. * @param string $rel Rel attribute. Defaults to "stylesheet". If equal to 'import' the stylesheet will be imported. * @param array $options Array of HTML attributes. * @return string CSS or