当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlHelper::script方法代码示例

本文整理汇总了PHP中HtmlHelper::script方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::script方法的具体用法?PHP HtmlHelper::script怎么用?PHP HtmlHelper::script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlHelper的用法示例。


在下文中一共展示了HtmlHelper::script方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadScript

 /**
  * load Anywhere script
  *
  * @param string $dataSource
  * @param string $apiKey
  * @param string $apiVersion
  */
 public function loadScript($dataSource = 'twitter', $apiKey = null, $apiVersion = 1)
 {
     if (empty($apiKey)) {
         /* @var $ds TwitterSource */
         $ds = ConnectionManager::getDataSource($dataSource);
         if (!empty($ds->config['api_key'])) {
             $apiKey = $ds->config['api_key'];
         }
     }
     $params = array('id' => $apiKey, 'v' => $apiVersion);
     return $this->Html->script(self::$anywhereUri . Router::queryString($params, array(), true));
 }
开发者ID:hiromi2424,项目名称:twitter_kit,代码行数:19,代码来源:anywhere.php

示例2: script

 /**
  * Returns one or many `<script>` tags depending on the number of scripts given.
  *
  * If the filename is prefixed with "//", it will be returned early as its a special http(s) indepenent url.
  *
  * If the filename is prefixed with "/", the path will be relative to the base path of your
  * application.  Otherwise, the path will be relative to your JavaScript path, usually webroot/js.
  *
  * Can include one or many Javascript files.
  *
  * ### Options
  *
  * - `inline` - Whether script should be output inline or into scripts_for_layout.
  * - `once` - Whether or not the script should be checked for uniqueness. If true scripts will only be
  *   included once, use false to allow the same script to be included more than once per request.
  *
  * @param mixed $url String or array of javascript files to include
  * @param mixed $options Array of options, and html attributes see above. If boolean sets $options['inline'] = value
  * @return mixed String of `<script />` tags or null if $inline is false or if $once is true and the file has been
  *   included before.
  * @access public
  * @link http://book.cakephp.org/view/1589/script
  */
 function script($url, $options = array())
 {
     if (strpos((string) $url, '//') !== false) {
         return sprintf($this->tags['javascriptlink'], $url, null);
     }
     return parent::script($url, $options);
 }
开发者ID:hipposdigital,项目名称:BakingPlate,代码行数:30,代码来源:html_plus.php

示例3: bootstrapScript

 public function bootstrapScript($url = 'bootstrap.min.js', $options = array())
 {
     $pluginRoot = dirname(dirname(DIRNAME(__FILE__)));
     $pluginName = end(explode(DS, $pluginRoot));
     $url = '/' . Inflector::underscore($pluginName) . '/js/' . $url;
     return parent::script($url, $options);
 }
开发者ID:racklin,项目名称:TwitterBootstrap,代码行数:7,代码来源:BootstrapHtmlHelper.php

示例4: get_markup

 /**
  * (non-PHPdoc)
  * @see GalleryHelper::get_markup()
  */
 public function get_markup()
 {
     if (empty($this->images)) {
         return '';
     }
     if (empty($this->unid)) {
         $this->calculate_unique();
     }
     $this->load_assets();
     $list = array();
     foreach ($this->images as $k => $image) {
         $list[] = $this->render_element($k);
     }
     $first_image = array_shift($list);
     /*$src = '/images/ajax-loader.gif';
     		if(file_exists(get_stylesheet_directory().$src))
     			$src = get_stylesheet_directory_uri().$src;
     		
     		if(file_exists(get_template_directory().$src))
     			$src = get_template_directory_uri().$src;
     		
     		$first_image = HtmlHelper::image($src, array('id'=>'loading-gif'));*/
     $script = HtmlHelper::script(json_encode($list), array('id' => 'script_' . $this->unid));
     $defaults = array('id' => $this->unid, 'class' => 'cycle-slideshow', 'data-cycle-loader' => 'true', 'data-cycle-progressive' => '#script_' . $this->unid);
     return HtmlHelper::div($first_image . $script, wp_parse_args($this->cycle_attrs, $defaults));
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:30,代码来源:ImageProgressiveLoading.class.php

示例5: test_void_elements

 public function test_void_elements()
 {
     $h = new HtmlHelper();
     $this->assertEquals('<area />', $h->area()->toString());
     $this->assertEquals('<br />', $h->BR()->toString());
     $this->assertEquals('<script></script>', $h->script()->toString());
 }
开发者ID:iakio,项目名称:htmlhelper,代码行数:7,代码来源:HtmlHelperTest.php

示例6: tweetButton

 /**
  * create tweet button
  *
  * @see http://dev.twitter.com/pages/tweet_button
  * @param string  $label
  * @param array   $options
  * @param boolean $dataAttribute
  * @param boolean $scriptInline
  * @return string
  */
 public function tweetButton($label = null, $options = array(), $dataAttribute = false, $scriptInline = false)
 {
     $attributes = array();
     $defaults = array('class' => 'twitter-share-button', 'url' => '', 'via' => '', 'text' => '', 'related' => '', 'count' => 'horizontal', 'lang' => 'en', 'counturl' => '');
     if (empty($label)) {
         $label = 'Tweet';
     }
     $options = am($defaults, $options);
     $attributes['class'] = $options['class'];
     unset($options['class']);
     $options['count'] = strtolower($options['count']);
     if (!in_array($options['count'], array('none', 'horizontal', 'vertical'))) {
         $options['count'] = 'none';
     }
     $options = Set::filter($options);
     if ($dataAttribute) {
         foreach ($options as $key => $val) {
             $attributes['data-' . $key] = $val;
         }
         $options = array();
     }
     $out = $this->Html->link($label, 'http://twitter.com/share' . Router::queryString($options), $attributes);
     $out .= $this->Html->script('http://platform.twitter.com/widgets.js', array('inline' => $scriptInline));
     return $this->output($out);
 }
开发者ID:hiromi2424,项目名称:twitter_kit,代码行数:35,代码来源:twitter.php

示例7: loadScript

 /**
  * load Anywhere script
  *
  * @param array $options
  * @return string
  */
 public function loadScript($options = array())
 {
     $dataSource = $apiKey = $apiVersion = null;
     $defaults = array('dataSource' => 'twitter', 'apiKey' => null, 'apiVersion' => 1, 'inline' => false);
     $options = am($defaults, $options);
     extract($options, EXTR_OVERWRITE);
     unset($options['dataSource']);
     unset($options['apiKey']);
     unset($options['apiVersion']);
     if (empty($apiKey)) {
         /* @var $ds TwitterSource */
         $ds = ConnectionManager::getDataSource($dataSource);
         if (!empty($ds->config['api_key'])) {
             $apiKey = $ds->config['api_key'];
         }
     }
     $params = array('id' => $apiKey, 'v' => $apiVersion);
     return $this->Html->script(self::$anywhereUri . Router::queryString($params, array(), true), $options);
 }
开发者ID:elstc,项目名称:twitter_kit,代码行数:25,代码来源:anywhere.php

示例8: _addScripts

 /**
  * _addScripts method
  *
  * Adds properties
  *
  * @param mixed $view
  * @return boolean
  */
 public function _addScripts($view)
 {
     if ($this->request->params['plugin'] == 'lil_tasks' || $this->request->params['plugin'] == 'lil' && $this->request->params['action'] == 'admin_dashboard') {
         App::uses('HtmlHelper', 'View/Helper');
         $Html = new HtmlHelper($view);
         $Html->css('/lil_tasks/css/lil_tasks.css', null, array('inline' => false));
         $Html->script('/lil_tasks/js/lil_tasks.js');
     }
     return true;
 }
开发者ID:malamalca,项目名称:lil-tasks,代码行数:18,代码来源:LilTasksPluginController.php

示例9: script

 public function script($src = "", $attr = array(), $full = false)
 {
     $tags = "";
     if (is_array($src)) {
         foreach ($src as $tag) {
             $tags .= HtmlHelper::script($tag, $attr, $full) . PHP_EOL;
         }
         return $tags;
     }
     $attrs = array("src" => $this->internalUrl("/scripts", $src, $full), "type" => "text/javascript");
     $attr = array_merge($attrs, $attr);
     return $this->output($this->tag("script", null, $attr));
 }
开发者ID:simaopedros,项目名称:spaghettiphp,代码行数:13,代码来源:html_helper.php

示例10: script

 public function script($url, $options = array())
 {
     $options += array('assetFilter' => true);
     if (!$options['assetFilter']) {
         $__backup = Configure::read('Asset.filter.js');
         Configure::write('Asset.filter.js', null);
     }
     unset($options['assetFilter']);
     $result = parent::script($url, $options);
     if (isset($__backup)) {
         Configure::write('Asset.filter.js', $__backup);
     }
     return $result;
 }
开发者ID:hiromi2424,项目名称:ninja,代码行数:14,代码来源:ninja_html.php

示例11: scriptsForLayout

 public function scriptsForLayout($type = null)
 {
     $scripts = '';
     $files = $this->Baklava->getCombined();
     foreach ($files as $t => $file) {
         if ($type && $type != $t) {
             continue;
         }
         switch ($t) {
             case 'css':
                 $scripts .= parent::css($file, null, array('inline' => true));
                 break;
             case 'js':
                 $scripts .= parent::script($file, array('inline' => true, 'defer' => true));
                 break;
             case 'style':
                 $scripts .= parent::tag('style', $file, array('type' => 'text/css'));
                 break;
         }
     }
     return $scripts;
 }
开发者ID:0x20h,项目名称:Baklava,代码行数:22,代码来源:BaklavaHtmlHelper.php

示例12: get_script_content

 /**
  * Get a <script> tag with a JSON variable in it.
  * @example GMapDataRetriever.example.json
  * @return string
  */
 function get_script_content()
 {
     return HtmlHelper::script('var map_info = ' . json_encode($this->map_data));
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:9,代码来源:GMapDataRetriever.class.php

示例13: on_print_footer_script

 /**
  * Callback for wp_footer, prints the window.tests variable
  * Useful to read the information on a external node.js environment (ex zombiejs)
  */
 public function on_print_footer_script()
 {
     echo HtmlHelper::script('window.tests = ' . json_encode($this->tests) . ';');
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:8,代码来源:TestsManager.class.php

示例14: script

 /**
  * Include Zuluru-specific JS files from the configured location.
  * This replicates a bare minimum of the main HtmlHelper's js function,
  * to avoid prefixing absolute paths. Everything else is passed to the
  * parent for processing.
  */
 function script($path, $options = array())
 {
     $base = Configure::read('urls.zuluru_js');
     if (is_array($path)) {
         $scripts = array();
         foreach ($path as $i) {
             $scripts[] = $this->script($i, $options);
         }
         return implode("\n", $scripts);
     }
     if (strpos($path, '://') !== false) {
         $url = $path;
     } else {
         if ($path[0] !== '/') {
             $url = $base . $path;
         }
     }
     return parent::script($url, $options);
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:25,代码来源:zuluru_html.php

示例15: get_head

    /**
     * Retrieves some usefull meta tags for the <head>
     * @return some usefull meta tags for the <head>
     */
    public function get_head()
    {
        $meta_tags = $this->render_meta_tags();
        $title = esc_html($this->title);
        $desc = $this->render_meta_tag('description');
        $ga_tracking = '';
        $favicon = $this->locate_favicon();
        /*file_exists(get_stylesheet_directory().'/images/favicon.ico')
        		? get_stylesheet_directory_uri()
        		: get_template_directory_uri();*/
        if (!empty($this->ua)) {
            $ga_tracking = HtmlHelper::script(<<<EOF
     var _gaq = _gaq || [];
     _gaq.push(['_setAccount', '{$this->ua}'],
     ['_setDomainName', 'none'],
     ['_setAllowLinker', true ],
     ['_trackPageview'],
     ['_trackPageLoadTime'],
     ['second._setAccount', 'UA-4717938-7'],
     ['second._setDomainName', 'none'],
     ['second._trackPageview'],
     ['second._trackPageLoadTime']
      );
     (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
EOF
);
        }
        $custom_scripts = '';
        if (count($this->custom_scripts)) {
            foreach ($this->custom_scripts as $name => $script) {
                $custom_scripts = HtmlHelper::script($script, array('id' => $name));
            }
        }
        echo <<<EOF
\t\t<title>{$title}</title>
\t\t{$desc}
\t    <meta charset="{$this->charset}">
\t    {$meta_tags}
\t    <link rel="shortcut icon" href="{$favicon}">
\t    {$ga_tracking}
\t    {$custom_scripts}
EOF;
    }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:51,代码来源:HeadHelper.class.php


注:本文中的HtmlHelper::script方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。