本文整理汇总了PHP中Action::raw方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::raw方法的具体用法?PHP Action::raw怎么用?PHP Action::raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::raw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: themeOption
private function themeOption($page)
{
$themeOptions = function () use($page) {
add_theme_page('Theme Options', 'تنظیمات قالب', 'edit_theme_options', 'theme_options', $page);
};
\Action::raw('admin_menu', $themeOptions);
return $themeOptions;
}
示例3: onEndShowSections
/**
* Add the conrnify button
*
* @param Action $action the current action
*
* @return void
*/
function onEndShowSections(Action $action)
{
$action->elementStart('div', array('id' => 'cornify_section', 'class' => 'section'));
$action->raw(<<<EOT
<a href="http://www.cornify.com" onclick="cornify_add();return false;">
<img src="http://www.cornify.com/assets/cornify.gif" width="61" height="16" border="0" alt="Cornify" />
</a>
<script type="text/javascript">(function() {
var js = document.createElement('script');
js.type = 'text/javascript';
js.async = true;
js.src = 'http://www.cornify.com/js/cornify.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(js);
})();</script>
EOT
);
$action->elementEnd('div');
}
示例4: afterPublished
public static function afterPublished($name, $func)
{
\Action::raw('transition_post_status', function ($new_status, $old_status, $post) use($func, $name) {
if ($post->post_status == 'publish') {
if (!\Session::has($name)) {
$funcArray = array('func' => $func);
$publishedPost = Post::where('post_id', '=', $post->ID)->first();
if (isset($publishedPost->id)) {
$publishedPost->post_title = $post->post_title;
$publishedPost->save();
} else {
$publishedPost = new Post();
$publishedPost->post_title = $post->post_title;
$publishedPost->post_id = $post->ID;
$publishedPost->save();
}
\Session::put($name, $name);
} else {
\Session::delete($name);
}
}
}, 10, 3);
}
示例5: 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;
}
示例6: 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()) {
// TRANS: Page notice for logged in users to try and get them to add an OpenID account to their StatusNet account.
// TRANS: This message contains Markdown links in the form (description)[link].
$instr = _m('(Have an [OpenID](http://openid.net/)? ' . '[Add an OpenID to your account](%%action.openidsettings%%)!');
} else {
// TRANS: Page notice for anonymous users to try and get them to register with an OpenID account.
// TRANS: This message contains Markdown links in the form (description)[link].
$instr = _m('(Have an [OpenID](http://openid.net/)? ' . 'Try our [OpenID registration]' . '(%%action.openidlogin%%)!)');
}
break;
case 'login':
// TRANS: Page notice on the login page to try and get them to log on with an OpenID account.
// TRANS: This message contains Markdown links in the form (description)[link].
$instr = _m('(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;
}
示例7: onEndShowScripts
/**
* Called when all scripts have been shown
*
* @param Action $action Current action
*
* @return boolean ignored
*/
function onEndShowScripts($action)
{
$piwikCode = <<<ENDOFPIWIK
<!-- Piwik -->
<script type="text/javascript">
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"));
</script>
<script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<!-- End Piwik Tag -->
ENDOFPIWIK;
$action->raw($piwikCode);
return true;
}