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; }
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; }
/** * 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'); }
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); }
/** * 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; }
/** * 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; }
/** * 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; }