本文整理汇总了PHP中event::register方法的典型用法代码示例。如果您正苦于以下问题:PHP event::register方法的具体用法?PHP event::register怎么用?PHP event::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event
的用法示例。
在下文中一共展示了event::register方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
global $xajax;
if (isset($xajax)) {
if (get_class($xajax) == 'xajax') {
// we're good to go, set up our asynchronous callback
$xuf = new xajaxUserFunction(array('ajcron', 'ajcron', 'xajax_req'), null);
$xajax->register(XAJAX_FUNCTION, $xuf);
// fastest way to check wether we have to run or not
if (config::get('ajcron_nextrun') < time()) {
// we need to run
mod_xajax::xajax();
$xajax->configure('waitCursor', false);
event::register('page_assembleheader', 'ajcron::insertHTML');
}
}
}
}
示例2: renderScoutsList
<?php
$modInfo['known_members']['name'] = "scout";
$modInfo['known_members']['abstract'] = "Allow individuals to opt-in to killmails, for purposes of scouting or logistics.";
$modInfo['known_members']['about'] = "https://github.com/jjlupa/edk-mods/tree/master/scout";
// The docs say you can use this to replace the core class. But as soon as I do that, it gives me errors. Easier for now
// to copy the changes into commong/include, and everything just works.
//
// edkloader::register('Kill', dirname(FILE).'/class.kill.php' );
event::register("killDetail_assembling", "ScoutMod::renderScoutsList");
class ScoutMod
{
function renderScoutsList($page)
{
require_once 'class.scout.php';
$page->addBehind("involved", "ScoutMod::listScouts");
}
function listScouts($page)
{
$scouts = new Scouts($page->kll_id);
$confirmDelete = false;
$error = '';
if (isset($_POST['scoutsubmit'])) {
$pw = false;
if (!config::get('scouts_pw') || $page->page->isAdmin()) {
$pw = true;
}
if ($_POST['password'] == config::get("scouts_password") || $pw) {
if ($_POST['scoutname'] == '') {
$error = 'Error: No pilot name specified.';
} else {
示例3: addContractMenu
<?php
/**
* @package EDK
*/
$modInfo['forum_post']['name'] = "Forum Post";
$modInfo['forum_post']['abstract'] = "Adds a link to contracts and kill_related that gives a summary of the results.";
$modInfo['forum_post']['about'] = "Core distribution mod.";
event::register("contractDetail_context_assembling", "forumPost::addContractMenu");
event::register("killRelated_assembling", "forumPost::addRelatedMenu");
/**
* @package EDK
*/
class forumPost
{
public static function addContractMenu($object)
{
$object->addMenuItem("link", "Forum Summary", "javascript:sndReq('index.php?a=forum_post&ctr_id=" . $object->ctr_id . "');ReverseContentDisplay('popup')");
}
public static function addRelatedMenu($object)
{
$object->addMenuItem("link", "Forum Summary", "javascript:sndReq('index.php?a=forum_post&kll_id=" . $object->kll_id . "');ReverseContentDisplay('popup')");
}
}
示例4: modify
$modInfo['highlight_capitals']['abstract'] = "highlights (Super)Capital kills/losses in killlisttables";
$modInfo['highlight_capitals']['about'] = "by <a href=\"http://gate.eveonline.com/Profile/Salvoxia\">Salvoxia</a>";
// register for adding a highlight class to every kill
event::register("killlist_table_kill", "highlight_capitals::modify");
// register for home page assembling for CSS injection and template replacement
event::register("home_assembling", "highlight_capitals::handler");
// register for corp detail assembling for CSS injection and template replacement
event::register("corpDetail_assembling", "highlight_capitals::handler");
// register for alliance detail assembling for CSS injection and template replacement
event::register("allianceDetail_assembling", "highlight_capitals::handler");
// register for pilot detail assembling for CSS injection and template replacement
event::register("pilotDetail_assembling", "highlight_capitals::handler");
// register for contract detail assembling for CSS injection and template replacement
event::register("contractDetail_assembling", "highlight_capitals::handler");
// register for system detail assembling for CSS injection and template replacement
event::register("systemdetail_assembling", "highlight_capitals::handler");
class highlight_capitals
{
private static $capitals = array(19, 27, 20, 29, 34, 39);
private static $superCapitals = array(26, 28);
/**
* adds the highlight parameter with the highlight class name to each kill
* @param array $kill
* @return array
*/
public static function modify(&$kill)
{
$shipClassId = self::getShipClassIDByName($kill["victimshipclass"]);
if (in_array($shipClassId, self::$capitals)) {
$kill["highlight"] = "kl-capital-highlight";
} elseif (in_array($shipClassId, self::$superCapitals)) {
示例5: using
// We need URL support to match the queries
using('lepton.web.url');
using('s2s.request');
using('s2s.response');
class S2SRequestHandler
{
static function request($event, $data)
{
$qurl = $data['uri'];
if (url($qurl)->like('/^\\/sts-rpc[\\/]?/')) {
using('s2s.request');
$cmd = request::get('cmd');
$req = new S2SRequest(S2SRequest::RT_HTTP, $cmd, request::getAll());
$res = new S2SResponse(S2SRequest::RT_HTTP, $cmd);
$cmdp = explode('.', $cmd);
$mod = $cmdp[0];
$modc = $mod . 'S2SEndpoint';
if (class_exists($modc)) {
$ci = new $modc();
$rd = $ci->invoke($req, $res);
var_dump($rd);
} else {
printf("Bad endpoint");
}
return true;
}
return false;
}
}
event::register('lepton.mvc.routing.pre', new EventHandler('S2SRequestHandler', 'request'));
示例6:
<?php
require_once "mods/advanced_search/class.search.php";
event::register("search_assembling", "AdvSearch::replace");
$modInfo['advanced_search']['name'] = "Advanced Search";
$modInfo['advanced_search']['abstract'] = "Adds many different custom search criterea to a custom search dialogue, creates links for sharing search result";
$modInfo['advanced_search']['about'] = "Version " . ADV_SRCH_VERSION . " by <b>Sonya Rayner</b>, fixed by <b>Redhouse</b>, enhanced for better compatibility by <b>Salvoxia</b>";
示例7: addView
<?php
$modInfo['known_members']['name'] = "Known Members";
$modInfo['known_members']['abstract'] = "Add an option for a list of known members to the corp details page.";
$modInfo['known_members']['about'] = "Core distribution mod.";
event::register('corpDetail_assembling', 'known_members::addView');
event::register('corpDetail_context_assembling', 'known_members::addMenu');
/**
* @package EDK
*/
class known_members
{
/**
* Add a view to the corp detail page
* @param pCorpDetail $home
*/
public static function addView($home)
{
$home->addView('known_members', array('known_members', 'view'));
}
/**
* Add a menu item to the corp detail page.
* @param pCorpDetail $home
*/
public static function addMenu($home)
{
$args = array();
$args[] = array('a', 'corp_detail', true);
$args[] = array('crp_id', $home->crp_id, true);
$args[] = array('view', "known_members", true);
$home->addMenuItem("link", "Known Members", edkURI::build($args));
示例8: onHeader
<?php
class GoogleAnalytics
{
function onHeader($event, $data)
{
if (config::get('ganalytics.account') == NULL) {
logger::err("No Google Analytics account key set in configuration");
return;
}
printf("<script type=\"text/javascript\">");
printf("var _gaq = _gaq || [];");
printf("_gaq.push(['_setAccount', '%s']);", config::get('ganalytics.account'));
printf("_gaq.push(['_setDomainName', '%s']);", request::getDomain());
printf("_gaq.push(['_trackPageview']);");
printf("</script>");
printf("<script type=\"text/javascript\"> (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>");
}
}
using('lepton.mvc.document');
event::register(document::EVENT_HEADER, new EventHandler('GoogleAnalytics', 'onHeader'));
示例9: add_head
* @see https://github.com/evekb/evedev-kb/blob/master/common/includes/class.page.php
*/
public static function add_head(&$page)
{
if (isset(self::$opt['head']) && !empty(self::$opt['head'])) {
foreach (self::$opt['head'] as $head) {
$page->addHeader($head);
}
}
}
/**
* Adds code in <body>.
*
* @param Page &$page object of class Page
*
* @return none
* @see https://github.com/evekb/evedev-kb/blob/master/common/includes/class.page.php
*/
public static function add_body(&$page)
{
if (isset(self::$opt['body']) && !empty(self::$opt['body'])) {
foreach (self::$opt['body'] as $body) {
$page->addBody($body);
}
}
}
}
IncCC::init();
event::register('page_assembleheader', 'IncCC::add_head');
event::register('page_assemblebody', 'IncCC::add_body');
示例10: define
<?php
define('MOST_EXP_TOPLIST_VERSION', 1.1);
$modInfo['most_expensive_toplist']['name'] = "Most Expensive Toplist v" . MOST_EXP_TOPLIST_VERSION;
$modInfo['most_expensive_toplist']['abstract'] = "Adds alltime/monthly toplists for most expensive kills/losses to corp/alliance detail view";
$modInfo['most_expensive_toplist']['about'] = "by <a href=\"http://gate.eveonline.com/Profile/Salvoxia\">Salvoxia</a>";
// hooks for alliance detail page
event::register('allianceDetail_assembling', 'MostExpensiveToplist::initAlliance');
event::register('allianceDetail_context_assembling', 'MostExpensiveToplist::initContextAlliance');
// hooks for corp detail page
event::register('corpDetail_assembling', 'MostExpensiveToplist::initCorp');
event::register('corpDetail_context_assembling', 'MostExpensiveToplist::initContextCorp');
class MostExpensiveToplist
{
/**
* callback for injecting our custom views to the corp detail page
* @param \pCorpDetail the corp detail page
*/
public static function initCorp($corporationDetail)
{
$corporationDetail->addView('expensive_kills', 'MostExpensiveToplist::killListCorp');
$corporationDetail->addView('expensive_losses', 'MostExpensiveToplist::killListCorp');
}
/**
* callback for injecting our custom menu options into the corp detail context menu
* @param \pCorpDetail the corp detail page
*/
public static function initContextCorp($corporationDetail)
{
$corporationDetail->addBehind("menuSetup", 'MostExpensiveToplist::menuSetupMostExpToplistCorp');
}
示例11: di
<?php
/*
* $Date$
* $Revision$
* $HeadURL$
*/
$modInfo['killcharts']['name'] = "killcharts by vasco di (V3.0)";
$modInfo['killcharts']['abstract'] = "Adds a graph of recent kills/losses to front page.";
$modInfo['killcharts']['about'] = "<a href='http://eve-id.net/forum/viewtopic.php?f=505&t=16828'>EveDev forum page</a><br>";
$modInfo['killcharts']['about'] .= "<a href='http://code.google.com/p/evedev-kb-mod-killcharts/'>Google Code</a><br/>";
$modInfo['killcharts']['about'] .= "<a href='http://www.rgraph.net' target='_blank'>Utilises the RGraph javascript charts library</a>";
include_once 'class.killchart.php';
event::register('home_assembling', 'kgraph::add');
class kgraph
{
public static function add($home)
{
$home->addBehind("contracts", "kgraph::generate");
}
function generate()
{
$killchart = new KillChart();
$html = $killchart->generate();
return $html;
}
//$days = 25; //No of days to chart: mod_killcharts_days
function daysToTrend()
{
$html = '';
if (isset($_POST['option_mod_killcharts_days'])) {
示例12: function
<?php
require_once '../classes/event.php';
require_once '../classes/log.php';
// register the new event and do what needs to be done
event::register('USER_REGISTRATION', function ($args = array()) {
// do whatever you want here
});
// initiate the event
event::fire('USER_REGISTRATION');
示例13: using
<?php
using('lepton.web.url');
class LdwpManager
{
function request($event, $data)
{
$qurl = $data['uri'];
if (url($qurl)->like('/^\\/ldwp-webxml\\//')) {
view::load('base:/dist/ldwp/dynamic/manager.php');
return true;
}
return false;
}
}
event::register('lepton.mvc.routing.pre', new EventHandler('LdwpManager', 'request'));
示例14: array
<?php
require_once 'event.class.php';
// dummy user data entered on registration
$userInfo = array('id' => '1', 'username' => 'kingy', 'password' => '12345');
// register the new event and do what needs to be done
event::register('USER_REGISTRATION', function ($args = array()) {
/* do whatever you want here
* insert new registration log for $userInfo[id] etc
*/
});
// initiate the event
event::fire('USER_REGISTRATION', $userInfo);
示例15: switch
$msg = 'You can\'t just leave your comment empty, nobody can read it.';
return;
}
if (strlen($content) <= 3) {
$msg = 'Your comment should ideally be over 4 characters long...';
return;
}
/* is this hack... shit? */
if (empty($table)) {
$msg = 'You need to include the table';
return;
}
switch ($table) {
case 1:
$table = tbl_blog;
break;
case 2:
$table = tbl_goals;
break;
}
event::register('COMMENT_POST', function ($args = array()) {
/*
We want to give a badge to every user who posts heaps...
*/
});
$add = $comments->add($userid, $pageid, $table, $content);
if (!empty($add)) {
event::fire('COMMENT_POST');
$msg = 'Thank you for adding your comment ' . $_SESSION['username'];
}
}