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


PHP Action::inlineScript方法代码示例

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


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

示例1: onEndShowScripts

 function onEndShowScripts(Action $action)
 {
     $action->inlineScript('var infinite_scroll_on_next_only = ' . ($this->on_next_only ? 'true' : 'false') . ';');
     $action->inlineScript('var ajax_loader_url = "' . $this->path('ajax-loader.gif') . '";');
     $action->script($this->path('jquery.infinitescroll.js'));
     $action->script($this->path('infinitescroll.js'));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:InfiniteScrollPlugin.php

示例2: onEndShowScripts

 /**
  * Load JS at runtime if we're logged in.
  *
  * @param Action $action
  * @return boolean hook result
  */
 function onEndShowScripts($action)
 {
     $user = common_current_user();
     if ($user && common_config('attachments', 'process_links')) {
         $action->script($this->path('linkpreview.min.js'));
         $data = json_encode(array('api' => common_local_url('oembedproxy'), 'width' => common_config('attachments', 'thumbwidth'), 'height' => common_config('attachments', 'thumbheight')));
         $action->inlineScript('$(function() {SN.Init.LinkPreview && SN.Init.LinkPreview(' . $data . ');})');
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:16,代码来源:LinkPreviewPlugin.php

示例3: showAdsenseCode

 /**
  * Output the bits of JavaScript code to show Adsense
  *
  * @param Action  $action Action being shown
  * @param integer $width  Width of the block
  * @param integer $height Height of the block
  * @param string  $slot   Slot identifier
  *
  * @return void
  */
 protected function showAdsenseCode($action, $width, $height, $slot)
 {
     $code = 'google_ad_client = "' . $this->client . '"; ';
     $code .= 'google_ad_slot = "' . $slot . '"; ';
     $code .= 'google_ad_width = ' . $width . '; ';
     $code .= 'google_ad_height = ' . $height . '; ';
     $action->inlineScript($code);
     $action->script($this->adScript);
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:19,代码来源:AdsensePlugin.php

示例4: onEndShowScripts

    /**
     * Called when all scripts have been shown
     *
     * @param Action $action Current action
     *
     * @return boolean ignored
     */
    function onEndShowScripts($action)
    {
        $piwikCode1 = <<<ENDOFPIWIK
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$this->piwikroot}" : "http://{$this->piwikroot}");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
ENDOFPIWIK;
        $piwikCode2 = <<<ENDOFPIWIK
try {
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$this->piwikId});
    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
} catch( err ) {}
ENDOFPIWIK;
        $action->inlineScript($piwikCode1);
        $action->inlineScript($piwikCode2);
        return true;
    }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:24,代码来源:PiwikAnalyticsPlugin.php

示例5: onEndShowScripts

 /**
  * Hook for adding extra JavaScript
  *
  * This makes sure our scripts get loaded for map-related pages
  *
  * @param Action $action Action object for the page
  *
  * @return boolean event handler return
  */
 function onEndShowScripts($action)
 {
     $actionName = $action->trimmed('action');
     if (!in_array($actionName, array('showstream', 'all', 'usermap', 'allmap'))) {
         return true;
     }
     switch ($this->provider) {
         case 'cloudmade':
             $action->script('http://tile.cloudmade.com/wml/0.2/web-maps-lite.js');
             break;
         case 'google':
             $action->script(sprintf('http://maps.google.com/maps?file=api&v=2&sensor=false&key=%s', urlencode($this->apikey)));
             break;
         case 'microsoft':
             $action->script((GNUsocial::isHTTPS() ? 'https' : 'http') + '://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6');
             break;
         case 'openlayers':
             // Use our included stripped & minified OpenLayers.
             $action->script($this->path('OpenLayers/OpenLayers.js'));
             break;
         case 'yahoo':
             $action->script(sprintf('http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=%s', urlencode($this->apikey)));
             break;
         case 'geocommons':
             // don't support this yet
         // don't support this yet
         default:
             return true;
     }
     $action->script(sprintf('%s?(%s)', $this->path('js/mxn.js'), $this->provider));
     $action->script($this->path('usermap.js'));
     $action->inlineScript(sprintf('var _provider = "%s";', $this->provider));
     // usermap and allmap handle this themselves
     if (in_array($actionName, array('showstream', 'all'))) {
         $action->inlineScript('$(document).ready(function() { ' . ' var user = null; ' . ($actionName == 'showstream' ? ' user = scrapeUser(); ' : '') . ' var notices = scrapeNotices(user); ' . ' var canvas = $("#map_canvas")[0]; ' . ' if (typeof(canvas) != "undefined") { showMapstraction(canvas, notices); } ' . '});');
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:47,代码来源:MapstractionPlugin.php

示例6: showAd

    /**
     * Show an ad using OpenX
     *
     * @param Action  $action Action being shown
     * @param integer $zone   Zone to show
     *
     * @return void
     */
    protected function showAd($action, $zone)
    {
        $scr = <<<ENDOFSCRIPT
var m3_u = '%s';
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=%d");
document.write ('&amp;cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
document.write ("&amp;loc=" + escape(window.location));
if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
document.write ("'><\\/scr"+"ipt>");
ENDOFSCRIPT;
        $action->inlineScript(sprintf($scr, $this->adScript, $zone));
        return true;
    }
开发者ID:microcosmx,项目名称:experiments,代码行数:28,代码来源:OpenXPlugin.php

示例7: onEndShowScripts

    /**
     * Add Disqus comment count script to the end of the scripts section
     *
     * @param Action $action the current action
     *
     */
    function onEndShowScripts($action)
    {
        // fugly
        $script = <<<ENDOFSCRIPT
var disqus_shortname = '%s';
(function () {
  var s = document.createElement('script'); s.async = true;
  s.src = 'http://disqus.com/forums/%s/count.js';
  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
ENDOFSCRIPT;
        $action->inlineScript(sprintf($script, $this->shortname, $this->shortname));
    }
开发者ID:microcosmx,项目名称:experiments,代码行数:19,代码来源:DisqusPlugin.php

示例8: onEndShowScripts

 /**
  * Hook for adding extra JavaScript
  *
  * This makes sure our scripts get loaded for map-related pages
  *
  * @param Action $action Action object for the page
  *
  * @return boolean event handler return
  */
 function onEndShowScripts($action)
 {
     $actionName = $action->trimmed('action');
     if (!in_array($actionName, array('showstream', 'all', 'usermap', 'allmap'))) {
         return true;
     }
     switch ($this->provider) {
         case 'cloudmade':
             $action->script('http://tile.cloudmade.com/wml/0.2/web-maps-lite.js');
             break;
         case 'google':
             $action->script(sprintf('http://maps.google.com/maps?file=api&v=2&sensor=false&key=%s', urlencode($this->apikey)));
             break;
         case 'microsoft':
             $action->script('http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6');
             break;
         case 'openlayers':
             // XXX: is this not nice...?
             $action->script('http://openlayers.org/api/OpenLayers.js');
             break;
         case 'yahoo':
             $action->script(sprintf('http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=%s', urlencode($this->apikey)));
             break;
         case 'geocommons':
             // don't support this yet
         // don't support this yet
         default:
             return true;
     }
     $action->script(sprintf('%s?(%s)', common_path('plugins/Mapstraction/js/mxn.js'), $this->provider));
     $action->script(common_path('plugins/Mapstraction/usermap.js'));
     $action->inlineScript(sprintf('var _provider = "%s";', $this->provider));
     // usermap and allmap handle this themselves
     if (in_array($actionName, array('showstream', 'all'))) {
         $action->inlineScript('$(document).ready(function() { ' . ' var user = null; ' . ($actionName == 'showstream' ? ' user = scrapeUser(); ' : '') . ' var notices = scrapeNotices(user); ' . ' showMapstraction($("#map_canvas"), notices); ' . '});');
     }
     return true;
 }
开发者ID:Br3nda,项目名称:StatusNet,代码行数:47,代码来源:MapstractionPlugin.php

示例9: onEndShowScripts

 /**
  * Initialize any flagging buttons on the page
  *
  * @param Action $action action being shown
  *
  * @return boolean hook result
  */
 function onEndShowScripts($action)
 {
     $action->inlineScript('if ($(".form_entity_flag").length > 0) { ' . '$(".form_entity_flag").bind("click", function() {' . 'SN.U.FormXHR($(this)); return false; }); }');
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:12,代码来源:UserFlagPlugin.php

示例10: onEndShowScripts

    /**
     * Called when all scripts have been shown
     *
     * @param Action $action Current action
     *
     * @return boolean ignored
     */
    function onEndShowScripts($action)
    {
        // Slight modification to the default code.
        // Loading the piwik.js file from a <script> created in a document.write
        // meant that the browser had no way to preload it, ensuring that its
        // loading will be synchronous, blocking further page rendering.
        //
        // User-agents understand protocol-relative links, so instead of the
        // URL produced in JS we can just give a universal one. Since it's
        // sitting there in the DOM ready to go, the browser can preload the
        // file for us and we're less likely to have to wait for it.
        $piwikUrl = '//' . $this->piwikroot . 'piwik.js';
        $piwikCode = <<<ENDOFPIWIK
try {
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$this->piwikroot}" : "http://{$this->piwikroot}");
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$this->piwikId});
    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
} catch( err ) {}
ENDOFPIWIK;
        // Don't use $action->script() here; it'll try to preface the URL.
        $action->element('script', array('type' => 'text/javascript', 'src' => $piwikUrl), ' ');
        $action->inlineScript($piwikCode);
        return true;
    }
开发者ID:Grasia,项目名称:bolotweet,代码行数:32,代码来源:PiwikAnalyticsPlugin.php

示例11: onEndShowScripts

 public function onEndShowScripts(Action $action)
 {
     // @todo FIXME: "Show Navigation" / "Hide Navigation" needs i18n
     $action->inlineScript('
         $(function() {
             $("#mobile-toggle-disable").click(function() {
                 $.cookie("MobileOverride", "0", {path: "/"});
                 window.location.reload();
                 return false;
             });
             $("#mobile-toggle-enable").click(function() {
                 $.cookie("MobileOverride", "1", {path: "/"});
                 window.location.reload();
                 return false;
             });
             $("#navtoggle").click(function () {
                       $("#site_nav_local_views").fadeToggle();
                       var text = $("#navtoggle").text();
                       $("#navtoggle").text(
                       text == "Show Navigation" ? "Hide Navigation" : "Show Navigation");
             });
         });');
     if ($this->serveMobile) {
         $action->inlineScript('$(function() { $(".checkbox-wrapper").unbind("click"); });');
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:26,代码来源:MobileProfilePlugin.php


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