本文整理汇总了PHP中Action::script方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::script方法的具体用法?PHP Action::script怎么用?PHP Action::script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::script方法的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'));
}
示例2: onEndShowScripts
function onEndShowScripts(Action $action)
{
if ($this->isSocial()) {
$action->script($this->path('js/jquery.details.min.js'));
$action->script($this->path('js/ol.js'));
$action->script($this->path('js/chartist.min.js'));
$action->script($this->path('js/sa.js'));
}
return true;
}
示例3: 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) {
$action->script($this->path('modplus.js'));
}
return true;
}
示例4: onEndShowStatusNetScripts
/**
* Link in a JavaScript script for the whitelist invite form
*
* @param Action $action Action being shown
*
* @return boolean hook flag
*/
function onEndShowStatusNetScripts($action)
{
$name = $action->arg('action');
if ($name == 'invite') {
$action->script($this->getPath() . '/js/whitelistinvite.js');
}
return true;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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);
}
示例8: onEndShowScripts
/**
* adds javascript to do same thing on input textarea
*
* @param Action $action
*/
function onEndShowScripts($action)
{
if (common_logged_in()) {
$action->script('plugins/DirectionDetector/jquery.DirectionDetector.js');
}
}
示例9: onEndShowScripts
/**
* Load JS at runtime.
*
* @param Action $action
* @return boolean hook result
*/
function onEndShowScripts(Action $action)
{
$action->script($this->path('js/modplus.js'));
return true;
}
示例10: onEndShowScripts
/**
* adds javascript to do same thing on input textarea
*
* @param Action $action
*/
function onEndShowScripts($action)
{
if (common_logged_in()) {
$action->script($this->path('jquery.DirectionDetector.js'));
}
}
示例11: 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;
}