本文整理汇总了PHP中HtmlHelper::javascript方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::javascript方法的具体用法?PHP HtmlHelper::javascript怎么用?PHP HtmlHelper::javascript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper::javascript方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HtmlHelper
function __toString()
{
$help = new HtmlHelper();
$html = $help->css('/admin/custom/formtabs.css') . $help->javascript('/admin/custom/formtabs.js');
$html .= '<div id="tabs">';
foreach ($this->tabs as $tab) {
$html .= $help->absoluteLink($tab[0], '#' . $tab[1]);
}
$html .= '<div class="clear"></div></div>';
$html .= $this->getClientValidationHtml();
return $html;
}
示例2: HtmlHelper
function __toString()
{
$this->_html_name = $this->_name . '[file]';
if ($this->current_filename == '') {
return parent::__toString();
}
$html = new HtmlHelper();
$id = $this->getAttribute('id');
$button = '<div id="editablebox_' . $id . '">' . $this->current_filename . ' ';
$button .= $html->absoluteLink('[X]', 'javascript:void(0)', array('id' => 'delete_' . $id));
$button .= $html->inlineJavascript('Phaxsi.Event.addEvent(document.getElementById("delete_' . $id . '"), "click", deleteFile.createDelegate(this, ["' . $id . '", "' . $this->input_hidden->getAttribute('id') . '"]));');
$button .= '</div>';
$this->beforeHTML = $html->javascript('/widgets/custom/editablefile.js') . $button . $this->input_hidden->__toString();
return parent::__toString();
}
示例3: HtmlHelper
function __toString()
{
if ($this->countElements() < $this->min_inputs) {
for ($i = 0; $i < $this->min_inputs - $this->countElements(); $i++) {
$this->add();
}
}
$html = new HtmlHelper();
$output = $html->javascript('/widgets/custom/textlist.js');
$output .= $html->css('/widgets/custom/textlist.css');
$output .= '<div class="phaxsi-textlist" data-max="' . $this->max_inputs . '" data-callback="' . $this->on_insert . '" data-name="' . $this->_name . '">';
$output .= '<div>' . $this->toString() . '</div>';
$output .= $this->max_inputs == 0 || count($this->_elements) < $this->max_inputs ? $html->absoluteLink($this->link_text, 'javascript:void(0)', '') : '';
$output .= '</div>';
return $output;
}
示例4: javascript
/**
* Includes a JavaScript file. This function looks in several places.
* First, if the item is either a path or a URL it just returns the link to that item (as XHTML-formatted script tag.)
* If a package is specified it checks there. Otherwise if nothing is found it
* fires off a request to the relative directory JavaScript directory.
* @param $file
* @return $str
*/
public function javascript($file, $pkgHandle = null)
{
if (!is_array($file)) {
// Use default behavior
return parent::javascript($file, $pkgHandle);
} else {
// Override the default behavior
$js = new V2JavaScriptOutputObject();
// create a new variable name so it's not so confusing...
$args = $file;
if (isset($args['url'])) {
$js->url = $args['url'];
}
if (isset($args['inline'])) {
$js->inline = $args['inline'];
}
if (isset($args['minify'])) {
$js->minify = $args['minify'];
}
if (isset($args['script'])) {
$js->script = $args['script'];
}
if (isset($args['IE'])) {
$js->IE = $args['IE'];
}
if (isset($args['IEversion'])) {
$js->IEversion = $args['IEversion'];
}
if (isset($args['fullTag'])) {
$js->fullTag = $args['fullTag'];
}
if (isset($args['xhtml'])) {
$js->xhtml = $args['xhtml'];
}
// Validate URLs to see if they match a local file
if ($js->url && !preg_match('/^http:/', $js->url) && !strstr($js->url, '../')) {
// for relative links only... and for security reasons, don't allow ../ in the url
// The following code blocks are mostly copied straight from the CORE HtmlHelper
$v = View::getInstance();
if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . $js->url)) {
$js->file = $v->getThemePath() . '/' . $js->url;
$js->abs = $v->getThemeDirectory() . '/' . $js->url;
} else {
if ($pkgHandle != null) {
if (file_exists(DIR_BASE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url)) {
$js->file = DIR_REL . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
$js->abs = DIR_BASE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
} else {
if (file_exists(DIR_BASE_CORE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url)) {
$js->file = ASSETS_URL . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
$js->abs = DIR_BASE_CORE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
}
}
}
}
if ($js->file == '') {
if (file_exists(DIR_BASE . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url)) {
$js->file = DIR_REL . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
$js->abs = DIR_BASE . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
} elseif (file_exists(DIR_BASE . '/' . DIRNAME_APP . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url)) {
// this works but it's not good to hard-code it in.
$js->file = ASSETS_URL_JAVASCRIPT . '/' . $js->url;
$js->abs = DIR_BASE . '/' . DIRNAME_APP . '/' . DIRNAME_JAVASCRIPT . '/' . $js->url;
} elseif (file_exists(DIR_BASE . '/' . $js->url)) {
$js->file = DIR_REL . '/' . $js->url;
$js->abs = DIR_BASE . '/' . $js->url;
} else {
// Can't find the url locally, so just output it as is
}
}
}
// this line was added in Concrete v5.4, so we'll add it here for backwards-compatibility... just in case
$js->href = $js->file;
return $js;
}
}
示例5: getHeadHtml
protected function getHeadHtml()
{
$html = new HtmlHelper($this->context);
$output = '';
foreach ($this->metas as $meta) {
if ($meta['name']) {
$output .= "<meta name=\"{$meta['name']}\" content=\"" . HtmlHelper::escape($meta['content']) . "\" />\r\n";
} elseif ($meta['http-equiv']) {
$output .= "<meta http-equiv=\"{$meta['http-equiv']}\" content=\"" . HtmlHelper::escape($meta['content']) . "\" />\r\n";
}
}
$output .= "<title>" . HtmlHelper::escape($this->title) . "</title>\r\n";
$output .= '<base href="' . UrlHelper::get('/') . '"/>' . "\r\n";
if ($this->favico) {
$output .= '<link rel="icon" type="' . $this->favico[1] . "\" href=\"" . UrlHelper::resource($this->favico[0]) . "\">\r\n";
}
if ($this->description) {
$output .= '<meta name="description" content="' . HtmlHelper::escape($this->description) . "\" />\r\n";
}
if ($this->keywords) {
$output .= '<meta name="keywords" content="' . HtmlHelper::escape($this->keywords) . "\" />\r\n";
}
foreach ($this->feeds as $feed) {
$output .= '<link rel="alternate" type="application/rss+xml" title="RSS" href="' . UrlHelper::get($feed) . "\" />\r\n";
}
foreach ($this->styles as $style) {
$output .= $html->css($style[0], $style[1]) . "\r\n";
}
if ($this->js_library) {
$output .= "<script type=\"text/javascript\" src=\"{$this->js_library}\"></script>\r\n";
$output .= $html->javascript('/' . APPU_PHAXSI . '/' . 'phaxsi-' . PhaxsiConfig::FRAMEWORK_VERSION . (AppConfig::DEBUG_MODE ? '' : '.min') . '.js') . "\r\n";
$output .= HtmlHelper::inlineJavascript("Phaxsi.path = {" . "base: '" . UrlHelper::get('') . "'," . "local: '" . UrlHelper::localized('/') . "'," . "'public': '" . APPU_PUBLIC . "'," . "lang: '" . Lang::getCurrent() . "'}");
}
foreach ($this->scripts as $script) {
$output .= $html->javascript($script) . "\r\n";
}
$this->styles = $this->scripts = array();
return $output;
}