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


PHP Action::trimmed方法代码示例

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


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

示例1: onStartShowSections

 function onStartShowSections(Action $action)
 {
     $name = $action->trimmed('action');
     if ($name == 'tag') {
         $taginput = $action->trimmed('tag');
         $tag = common_canonical_tag($taginput);
         if (!empty($tag)) {
             $url = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=render', urlencode($tag));
             $editurl = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=edit', urlencode($tag));
             $request = HTTPClient::start();
             $response = $request->get($url);
             $html = $response->getBody();
             $action->elementStart('div', array('id' => 'wikihashtags', 'class' => 'section'));
             if ($response->isOk() && !empty($html)) {
                 $action->element('style', null, "span.editsection { display: none }\n" . "table.toc { display: none }");
                 $action->raw($html);
                 $action->elementStart('p');
                 $action->element('a', array('href' => $editurl, 'title' => sprintf(_m('Edit the article for #%s on WikiHashtags'), $tag)), _m('Edit'));
                 $action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html', 'title' => _m('Shared under the terms of the GNU Free Documentation License'), 'rel' => 'license'), _m('GNU FDL'));
                 $action->elementEnd('p');
             } else {
                 $action->element('a', array('href' => $editurl), sprintf(_m('Start the article for #%s on WikiHashtags'), $tag));
             }
             $action->elementEnd('div');
         }
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:28,代码来源:WikiHashtagsPlugin.php

示例2: onEndAccountSettingsNav

 /**
  * Menu item for personal subscriptions/groups area
  *
  * @param Action $action action being executed
  *
  * @return boolean hook return
  */
 function onEndAccountSettingsNav($action)
 {
     $action_name = $action->trimmed('action');
     common_debug("ACTION NAME = " . $action_name);
     $action->menuItem(common_local_url('mirrorsettings'), _m('MENU', 'Mirroring'), _m('Configure mirroring of posts from other feeds'), $action_name === 'mirrorsettings');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:14,代码来源:SubMirrorPlugin.php

示例3: onEndShowHeadElements

 /**
  * Add extra <meta> headers for certain pages that geourl.org understands
  *
  * @param Action $action page being shown
  *
  * @return boolean event handler flag
  */
 function onEndShowHeadElements(Action $action)
 {
     $name = $action->trimmed('action');
     $location = null;
     if ($action instanceof ShowstreamAction) {
         $profile = $action->getTarget();
         if (!empty($profile->lat) && !empty($profile->lon)) {
             $location = $profile->lat . ', ' . $profile->lon;
         }
     } elseif ($action instanceof ShownoticeAction) {
         // FIXME: getNotice in ShownoticeAction will do a new lookup, we should fix those classes
         // so they can reliably just get a pre-stored notice object which was fetched in Shownotice prepare()...
         $notice = $action->notice;
         if ($notice instanceof Notice && !empty($notice->lat) && !empty($notice->lon)) {
             $location = $notice->lat . ', ' . $notice->lon;
         }
     }
     if (!is_null($location)) {
         $action->element('meta', array('name' => 'ICBM', 'content' => $location));
         $action->element('meta', array('name' => 'DC.title', 'content' => $action->title()));
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:30,代码来源:GeoURLPlugin.php

示例4: onEndShowHeadElements

 /**
  * Add extra <meta> headers for certain pages that geourl.org understands
  *
  * @param Action $action page being shown
  *
  * @return boolean event handler flag
  */
 function onEndShowHeadElements($action)
 {
     $name = $action->trimmed('action');
     $location = null;
     if ($name == 'showstream') {
         $profile = $action->profile;
         if (!empty($profile) && !empty($profile->lat) && !empty($profile->lon)) {
             $location = $profile->lat . ', ' . $profile->lon;
         }
     } else {
         if ($name == 'shownotice') {
             $notice = $action->profile;
             if (!empty($notice) && !empty($notice->lat) && !empty($notice->lon)) {
                 $location = $notice->lat . ', ' . $notice->lon;
             }
         }
     }
     if (!empty($location)) {
         $action->element('meta', array('name' => 'ICBM', 'content' => $location));
         $action->element('meta', array('name' => 'DC.title', 'content' => $action->title()));
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:30,代码来源:GeoURLPlugin.php

示例5: onEndConnectSettingsNav

 /**
  * Add the Twitter Settings page to the Connect Settings menu
  *
  * @param Action $action The calling page
  *
  * @return boolean hook return
  */
 function onEndConnectSettingsNav($action)
 {
     if (self::hasKeys()) {
         $action_name = $action->trimmed('action');
         $action->menuItem(common_local_url('twittersettings'), _m('MENU', 'Twitter'), _m('Twitter integration options'), $action_name === 'twittersettings');
     }
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:15,代码来源:TwitterBridgePlugin.php

示例6: onEndAccountSettingsNav

 /**
  * Add the FetLife Settings page to the Account Settings menu
  *
  * @param Action $action The calling page
  * @return boolean hook return
  */
 function onEndAccountSettingsNav($action)
 {
     $action_name = $action->trimmed('action');
     $action->menuItem(common_local_url('fetlifesettings'), 'FetLife', 'FetLife integration options', 'fetlifesettings' === $action_name);
     return true;
 }
开发者ID:reaction,项目名称:fetlife-bridge,代码行数:12,代码来源:FetLifeBridgePlugin.php

示例7: onStartShowPageTitle

 /**
  * If a notice has a title, show it in the <h1> element
  *
  * @param Action $action Action being executed
  *
  * @return boolean hook value
  */
 function onStartShowPageTitle($action)
 {
     $actionName = $action->trimmed('action');
     if ($actionName == 'shownotice') {
         $title = Notice_title::fromNotice($action->notice);
         if (!empty($title)) {
             $action->element('h1', null, $title);
             return false;
         }
     }
     return true;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:19,代码来源:NoticeTitlePlugin.php

示例8: onEndShowSections

 function onEndShowSections(Action $action)
 {
     $actionName = $action->trimmed('action');
     // These are the ones that have maps on 'em
     if (!in_array($actionName, array('showstream', 'all'))) {
         return true;
     }
     $action->elementStart('div', array('id' => 'entity_map', 'class' => 'section'));
     // TRANS: Header for Map widget that displays a map with geodata for notices.
     $action->element('h2', null, _m('Map'));
     $action->element('div', array('id' => 'map_canvas', 'class' => 'gray smallmap', 'style' => "width: 100%; height: 240px"));
     $mapAct = $actionName == 'showstream' ? 'usermap' : 'allmap';
     $mapUrl = common_local_url($mapAct, array('nickname' => $action->trimmed('nickname')));
     $action->element('a', array('href' => $mapUrl), _m('Full size'));
     $action->elementEnd('div');
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:16,代码来源:MapstractionPlugin.php

示例9: onEndShowStatusNetStyles

 /**
  * Link in a styelsheet for the onboarding actions
  *
  * @param Action $action Action being shown
  *
  * @return boolean hook flag
  */
 function onEndShowStatusNetStyles($action)
 {
     if (in_array($action->trimmed('action'), array('userdirectory', 'groupdirectory'))) {
         $action->cssLink($this->path('css/directory.css'));
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:14,代码来源:DirectoryPlugin.php

示例10: onStartShowHeadElements

 /**
  * Meta tags for "claiming" a site
  *
  * We add extra meta tags that search engines like Yahoo!, Google, and Bing
  * require to let you claim your site.
  *
  * @param Action $action Action being executed
  *
  * @return boolean hook value.
  */
 function onStartShowHeadElements($action)
 {
     $actionName = $action->trimmed('action');
     $singleUser = common_config('singleuser', 'enabled');
     // Different "top" pages if it's single user or not
     if ($singleUser && $actionName == 'showstream' || !$singleUser && $actionName == 'public') {
         $keys = array('googlekey' => 'google-site-verification', 'yahookey' => 'y_key', 'bingkey' => 'msvalidate.01');
         // XXX: is this the same for all sites?
         foreach ($keys as $config => $metaname) {
             $content = common_config('sitemap', $config);
             if (!empty($content)) {
                 $action->element('meta', array('name' => $metaname, 'content' => $content));
             }
         }
     }
     return true;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:27,代码来源:SitemapPlugin.php

示例11: onEndShowPageNotice

 /**
  * Show some extra instructions for using OpenID
  *
  * @param Action $action Action being executed
  *
  * @return boolean hook value
  */
 function onEndShowPageNotice($action)
 {
     $name = $action->trimmed('action');
     switch ($name) {
         case 'register':
             if (common_logged_in()) {
                 $instr = '(Have an [OpenID](http://openid.net/)? ' . '[Add an OpenID to your account](%%action.openidsettings%%)!';
             } else {
                 $instr = '(Have an [OpenID](http://openid.net/)? ' . 'Try our [OpenID registration]' . '(%%action.openidlogin%%)!)';
             }
             break;
         case 'login':
             $instr = '(Have an [OpenID](http://openid.net/)? ' . 'Try our [OpenID login]' . '(%%action.openidlogin%%)!)';
             break;
         default:
             return true;
     }
     $output = common_markup_to_html($instr);
     $action->raw($output);
     return true;
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:28,代码来源:OpenIDPlugin.php

示例12: 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':
             // 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;
     }
     if ($this->provider == 'openlayers') {
         // We have an optimized path for our default case.
         //
         // Note that OpenLayers.js needs to be separate, or it won't
         // be able to find its UI images and styles.
         $action->script($this->path('usermap-mxn-openlayers.min.js'));
     } else {
         $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:microcosmx,项目名称:experiments,代码行数:55,代码来源:MapstractionPlugin.php

示例13: onStartProfileSaveForm

 /**
  * Hook profile update to prevent blacklisted homepages or nicknames
  *
  * Throws an exception if there's a blacklisted homepage or nickname.
  *
  * @param Action $action Action being called (usually register)
  *
  * @return boolean hook value
  */
 function onStartProfileSaveForm($action)
 {
     $homepage = strtolower($action->trimmed('homepage'));
     if (!empty($homepage)) {
         if (!$this->_checkUrl($homepage)) {
             // TRANS: Validation failure for URL. %s is the URL.
             $msg = sprintf(_m("You may not use homepage \"%s\"."), $homepage);
             throw new ClientException($msg);
         }
     }
     $nickname = strtolower($action->trimmed('nickname'));
     if (!empty($nickname)) {
         if (!$this->_checkNickname($nickname)) {
             // TRANS: Validation failure for nickname. %s is the nickname.
             $msg = sprintf(_m("You may not use nickname \"%s\"."), $nickname);
             throw new ClientException($msg);
         }
     }
     return true;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:29,代码来源:BlacklistPlugin.php

示例14: 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

示例15: onStartProfileSaveForm

 /**
  * Hook profile update to prevent blacklisted homepages or nicknames
  *
  * Throws an exception if there's a blacklisted homepage or nickname.
  *
  * @param Action $action Action being called (usually register)
  *
  * @return boolean hook value
  */
 function onStartProfileSaveForm($action)
 {
     $homepage = strtolower($action->trimmed('homepage'));
     if (!empty($homepage)) {
         if (!$this->_checkUrl($homepage)) {
             $msg = sprintf(_m("You may not use homepage '%s'."), $homepage);
             throw new ClientException($msg);
         }
     }
     $nickname = strtolower($action->trimmed('nickname'));
     if (!empty($nickname)) {
         if (!$this->_checkNickname($nickname)) {
             $msg = sprintf(_m("You may not use nickname '%s'."), $nickname);
             throw new ClientException($msg);
         }
     }
     return true;
 }
开发者ID:ronhuang,项目名称:statusnet,代码行数:27,代码来源:BlacklistPlugin.php


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