本文整理汇总了PHP中EventUtil类的典型用法代码示例。如果您正苦于以下问题:PHP EventUtil类的具体用法?PHP EventUtil怎么用?PHP EventUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upgrade
public function upgrade($oldversion)
{
switch ($oldversion) {
case '4.3.0':
// drop the old unused table
$connection = $this->entityManager->getConnection();
$prefix = $this->serviceManager['prefix'];
$prefix = empty($prefix) ? '' : $prefix . "_";
$sql = 'DROP TABLE ' . $prefix . 'scribite';
$stmt = $connection->prepare($sql);
try {
$stmt->execute();
} catch (Exception $e) {
LogUtil::registerError($e->getMessage());
}
// standard 'upgrades' from earlier versions are not supported but
// not required either - just uninstall and install the new version
$this->uninstall();
// remove old peristent handlers
EventUtil::unregisterPersistentModuleHandlers('Scribite');
$this->install();
case '5.0.0':
case '5.0.1':
// future upgrade
}
return true;
}
开发者ID:pheski,项目名称:Scribite,代码行数:27,代码来源:Installer.php
示例2: stopQuery
public function stopQuery()
{
$query = $this->currentQuery;
$query['time'] = microtime(true) - $this->start;
$zevent = new GenericEvent(null, $query);
\EventUtil::dispatch('log.sql', $zevent);
}
开发者ID:planetenkiller,项目名称:core,代码行数:7,代码来源:ZikulaSqlLogger.php
示例3: bootstrap
protected function bootstrap($disableSessions = true, $loadZikulaCore = true, $fakeRequest = true)
{
define('_ZINSTALLVER', \Zikula_Core::VERSION_NUM);
$kernel = $this->getContainer()->get('kernel');
$loader = (require $kernel->getRootDir() . '/autoload.php');
\ZLoader::register($loader);
if ($loadZikulaCore && !$this->getContainer()->has('zikula')) {
$core = new Zikula_Core();
$core->setKernel($kernel);
$core->boot();
foreach ($GLOBALS['ZConfig'] as $config) {
$core->getContainer()->loadArguments($config);
}
$GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir');
$GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir');
$GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir');
\ServiceUtil::getManager($core);
\EventUtil::getManager($core);
}
if ($disableSessions) {
// Disable sessions.
$this->getContainer()->set('session.storage', new MockArraySessionStorage());
$this->getContainer()->set('session.handler', new NullSessionHandler());
}
if ($fakeRequest) {
// Fake request
$request = Request::create('http://localhost/install');
$this->getContainer()->set('request', $request);
}
}
开发者ID:rojblake,项目名称:core,代码行数:30,代码来源:AbstractCoreInstallerCommand.php
示例4: getPlugins
public static function getPlugins($type = 'Content')
{
$type = in_array($type, array('Content', 'Layout')) ? trim(ucwords(strtolower($type))) . "Type" : 'ContentType';
// trigger event
$event = new Zikula_Event('module.content.gettypes', new Content_Types());
$plugins = EventUtil::getManager()->notify($event)->getSubject()->getValidatedPlugins($type);
return $plugins;
}
开发者ID:robbrandt,项目名称:Content,代码行数:8,代码来源:Util.php
示例5: stopQuery
public function stopQuery()
{
$query = $this->currentQuery;
$query['time'] = microtime(true) - $this->start;
$zevent = new Zikula_Event('log.sql', null, $query);
EventUtil::notify($zevent);
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:8,代码来源:ZikulaSqlLogger.php
示例6: ev_error
public function ev_error($listener, $ctx)
{
$errno = EventUtil::getLastSocketErrno();
fprintf(STDERR, "Got an error %d (%s) on the listener. Shutting down.\n", $errno, EventUtil::getLastSocketError());
if ($errno != 0) {
$this->base->exit(NULL);
exit;
}
}
开发者ID:jinguanio,项目名称:david,代码行数:9,代码来源:simple_smtp.php
示例7: uninstall
/**
* delete the module
*
* @author Francesc Bassas i Bullich
* @return bool true if successful, false otherwise
*/
public function uninstall() {
// Delete all module variables
$this->delVar('SiriusXtecMailer');
EventUtil::unregisterPersistentModuleHandler('SiriusXtecMailer');
// Deletion successful
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:15,代码来源:Installer.php
示例8: uninstall
/**
* @return bool
*/
public function uninstall()
{
try {
DoctrineHelper::dropSchema($this->entityManager, array('Dashboard_Entity_UserWidget', 'Dashboard_Entity_Widget'));
} catch (Exception $e) {
return false;
}
EventUtil::unregisterPersistentModuleHandlers($this->name);
return true;
}
开发者ID:robbrandt,项目名称:Dashboard,代码行数:13,代码来源:Installer.php
示例9: echoEventCallback
public function echoEventCallback($bev, $events, $ctx)
{
if ($events & EventBufferEvent::ERROR) {
echo "Error from bufferevent\n";
}
if ($events & (EventBufferEvent::EOF | EventBufferEvent::ERROR)) {
$bev->free();
$error_no = EventUtil::getLastSocketErrno();
$error_msg = EventUtil::getLastSocketError();
$log = "line: " . __LINE__ . ", {$error_msg} ({$error_no})";
var_dump($log);
}
}
开发者ID:jinguanio,项目名称:david,代码行数:13,代码来源:s.php
示例10: upgrade
/**
* Upgrade the dynamic user data module from an old version.
*
* @param string $oldversion The version from which the upgrade is beginning (the currently installed version); this should be compatible
* with {@link version_compare()}.
*
* @return boolean True on success or false on failure.
*/
public function upgrade($oldversion)
{
switch ($oldversion)
{
case '1.5.2':
// 1.5.2 -> 1.6.0
EventUtil::registerPersistentEventHandlerClass($this->name, 'Profile_Listener_UsersUiHandler');
$connection = Doctrine_Manager::getInstance()->getConnection('default');
$sqlStatements = array();
// N.B. statements generated with PHPMyAdmin
$sqlStatements[] = 'RENAME TABLE ' . DBUtil::getLimitedTablename('user_property') . " TO user_property";
$sqlStatements[] = "ALTER TABLE `user_property` CHANGE `pn_prop_id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
CHANGE `pn_prop_label` `label` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_prop_dtype` `dtype` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `pn_prop_modname` `modname` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_prop_weight` `weight` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `pn_prop_validation` `validation` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
CHANGE `pn_prop_attribute_name` `attributename` VARCHAR( 80 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL";
foreach ($sqlStatements as $sql) {
$stmt = $connection->prepare($sql);
try {
$stmt->execute();
} catch (Exception $e) {
}
}
case '1.6.0':
case '1.6.1':
// 1.6.0 -> X.X.X when appropriate.
}
$modVars = $this->getVars();
$defaultModVars = $this->getDefaultModVars();
// Remove modvars no longer in the default set.
foreach ($modVars as $modVar => $value) {
if (!array_key_exists($modVar, $defaultModVars)) {
$this->delVar($modVar);
}
}
// Add vars defined in the default set, but missing from the current set.
foreach ($defaultModVars as $modVar => $value) {
if (!array_key_exists($modVar, $modVars)) {
$this->setVar($modVar, $value);
}
}
// Update successful
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:59,代码来源:Installer.php
示例11: upgrade
/**
* Upgrade the MUVideo application from an older version.
*
* If the upgrade fails at some point, it returns the last upgraded version.
*
* @param integer $oldVersion Version to upgrade from.
*
* @return boolean True on success, false otherwise.
*/
public function upgrade($oldVersion)
{
// Upgrade dependent on old version number
switch ($oldVersion) {
case '1.0.0':
// update the database schema
try {
DoctrineHelper::updateSchema($this->entityManager, $this->listEntityClasses());
} catch (\Exception $e) {
if (System::isDevelopmentMode()) {
return LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage());
}
return LogUtil::registerError($this->__f('An error was encountered while updating tables for the %s extension.', array($this->getName())));
}
$categoryRegistryIdsPerEntity = array();
// add default entry for category registry (property named Main)
include_once 'modules/MUVideo/lib/MUVideo/Api/Base/Category.php';
include_once 'modules/MUVideo/lib/MUVideo/Api/Category.php';
$categoryApi = new MUVideo_Api_Category($this->serviceManager);
$categoryGlobal = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Global');
$registryData = array();
$registryData['modname'] = $this->name;
$registryData['table'] = 'Collection';
$registryData['property'] = $categoryApi->getPrimaryProperty(array('ot' => 'Collection'));
$registryData['category_id'] = $categoryGlobal['id'];
$registryData['id'] = false;
if (!DBUtil::insertObject($registryData, 'categories_registry')) {
LogUtil::registerError($this->__f('Error! Could not create a category registry for the %s entity.', array('collection')));
}
$categoryRegistryIdsPerEntity['collection'] = $registryData['id'];
$registryData = array();
$registryData['modname'] = $this->name;
$registryData['table'] = 'Movie';
$registryData['property'] = $categoryApi->getPrimaryProperty(array('ot' => 'Movie'));
$registryData['category_id'] = $categoryGlobal['id'];
$registryData['id'] = false;
if (!DBUtil::insertObject($registryData, 'categories_registry')) {
LogUtil::registerError($this->__f('Error! Could not create a category registry for the %s entity.', array('movie')));
}
$categoryRegistryIdsPerEntity['movie'] = $registryData['id'];
// unregister persistent event handlers
EventUtil::unregisterPersistentModuleHandlers($this->name);
// register persistent event handlers
$this->registerPersistentEventHandlers();
case '1.1.0':
// for later updates
}
// update successful
return true;
}
开发者ID:robbrandt,项目名称:MUVideo,代码行数:59,代码来源:Installer.php
示例12: upgrade
public function upgrade($oldversion)
{
switch ($oldVersion) {
case '1.0.0':
EventUtil::registerPersistentModuleHandler('SiriusXtecAuth', 'module.users.ui.logout.succeeded', array('SiriusXtecAuth_Listeners', 'logoutXtecApps'));
$this->setVars(array('loginXtecApps' => false,
'logoutXtecApps' => false,
'gtafURL' => 'aplitic.xtec.cat/pls/gafoas/pk_for_mod_menu.p_for_opcions_menu?p_perfil=RES',
'e13URL' => 'aplitic.xtec.cat/pls/e13_formacio_gaf/formacio_gaf.inici',
'loginTime' => 200,
'logoutTime' => 200));
case '1.0.1':
$this->setVars(array('gtafProtocol' => 'http',
'e13Protocol' => 'http'));
case '1.0.2':
//This is the current version. Here next changes will be added
}
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:19,代码来源:Installer.php
示例13: upgrade
/**
* Upgrade the module from an old version.
*
* This function must consider all the released versions of the module!
* If the upgrade fails at some point, it returns the last upgraded version.
*
* @param string $oldVersion Version number string to upgrade from.
*
* @return boolean|string True on success, last valid version string or false if fails.
*/
public function upgrade($oldversion)
{
// Upgrade dependent on old version number
switch ($oldversion) {
case '3.6':
case '3.7':
// legacy is no longer supported
System::delVar('loadlegacy');
DBUtil::changeTable('modules');
case '3.7.4':
case '3.7.5':
case '3.7.6':
case '3.7.8':
// create the new hooks tables
Doctrine_Core::createTablesFromArray(array('Zikula_Doctrine_Model_HookArea', 'Zikula_Doctrine_Model_HookProvider', 'Zikula_Doctrine_Model_HookSubscriber', 'Zikula_Doctrine_Model_HookBinding', 'Zikula_Doctrine_Model_HookRuntime'));
EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'hooks'));
EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'moduleservices'));
case '3.7.9':
// increase length of some hook table fields from 60 to 100
$commands = array();
$commands[] = "ALTER TABLE hook_area CHANGE areaname areaname VARCHAR(100) NOT NULL";
$commands[] = "ALTER TABLE hook_runtime CHANGE eventname eventname VARCHAR(100) NOT NULL";
$commands[] = "ALTER TABLE hook_subscriber CHANGE eventname eventname VARCHAR(100) NOT NULL";
// Load DB connection
$dbEvent = new Zikula_Event('doctrine.init_connection');
$connection = $this->eventManager->notify($dbEvent)->getData();
foreach ($commands as $sql) {
$stmt = $connection->prepare($sql);
$stmt->execute();
}
case '3.7.10':
// future upgrade routines
}
// Update successful
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:51,代码来源:Installer.php
示例14: bootstrap
/**
* Initialises own (and legacy) components, like service manager.
*/
protected function bootstrap()
{
// taken from lib/bootstrap.php
// legacy handling
$core = new \Zikula_Core();
$core->setKernel($this->kernel);
$core->boot();
// these two events are called for BC only. remove in 2.0.0
$core->getDispatcher()->dispatch('bootstrap.getconfig', new GenericEvent($core));
$core->getDispatcher()->dispatch('bootstrap.custom', new GenericEvent($core));
foreach ($GLOBALS['ZConfig'] as $config) {
$core->getContainer()->loadArguments($config);
}
$GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir');
$GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir');
$GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir');
\ServiceUtil::getManager($core);
\EventUtil::getManager($core);
$core->attachHandlers('config/EventHandlers');
return $core;
}
开发者ID:rojblake,项目名称:core,代码行数:24,代码来源:Application.php
示例15: getRegisteredWidgets
/**
* Gets all registered widgets
*
* @return array Collection of Dashboard_AbstractWidget
*/
public function getRegisteredWidgets($uid)
{
$dbWidgets = $this->em->getRepository('Dashboard_Entity_Widget')->findAll();
$widgets = array();
/* @var Dashboard_Entity_Widget $dbWidget */
foreach ($dbWidgets as $dbWidget) {
if (!SecurityUtil::checkPermission('Dashboard::', "{$dbWidget->getId()}:{$dbWidget->getModule()}:{$uid}", ACCESS_READ)) {
continue;
// error
}
$event = new Zikula_Event(new Zikula_Event(Dashboard_Events::FILTER_WIDGET_CLASS, null, array(), $dbWidget->getClass()));
$class = EventUtil::notify($event)->getData();
if (!class_exists($class)) {
continue;
}
/* @var Dashboard_AbstractWidget $widget */
$widget = new $class();
$widget->setId($dbWidget->getId());
$widgets[] = $widget;
}
return $widgets;
}
开发者ID:robbrandt,项目名称:Dashboard,代码行数:27,代码来源:WidgetHelper.php
示例16: addExternalPlugins
/**
* fetch external plugins
* @return array
*/
public static function addExternalPlugins()
{
$event = new Zikula_Event('moduleplugin.ckeditor.externalplugins', new ModulePlugin_Scribite_CKEditor_EditorPlugin());
$plugins = EventUtil::getManager()->notify($event)->getSubject()->getPlugins();
return $plugins;
}
开发者ID:pheski,项目名称:Scribite,代码行数:10,代码来源:Util.php
示例17: validatePostProcess
/**
* Post-Process the basic object validation with class specific logic.
*
* Subclasses can define appropriate implementations.
*
* @param string $type Controller type.
* @param array $data Data to be used for validation.
*
* @return boolean
*/
public function validatePostProcess($type = 'user', $data = null)
{
EventUtil::dispatch('dbobject.validatepostprocess', new \Zikula\Core\Event\GenericEvent($this));
return true;
}
开发者ID:Silwereth,项目名称:core,代码行数:15,代码来源:DBObject.php
示例18: unregisterSubscriberBundles
/**
* Unregister all subscribers from the system.
*
* This cascades to remove all event handlers, sorting data and update bindings table.
*
* @param array $bundles Module's bundles object.
*
* @return void
*/
public static function unregisterSubscriberBundles(array $bundles)
{
$hookManager = ServiceUtil::getManager()->get('hook_dispatcher');
foreach ($bundles as $bundle) {
$hookManager->unregisterSubscriberBundle($bundle);
$event = new \Zikula\Core\Event\GenericEvent($bundle, array('areaid' => $hookManager->getAreaId($bundle->getArea())));
EventUtil::dispatch('installer.subscriberbundle.uninstalled', $event);
}
}
开发者ID:rmaiwald,项目名称:core,代码行数:18,代码来源:HookUtil.php
示例19: define
<?php
/**
* Copyright Zikula Foundation 2009 - Zikula Application Framework
*
* This work is contributed to the Zikula Foundation under one or more
* Contributor Agreements and licensed to You under the following license:
*
* @license GNU/LGPLv3 (or at your option, any later version).
* @package Zikula
*
* Please see the NOTICE file distributed with this source code for further
* information regarding copyright and licensing.
*/
if (!defined('HTMLPURIFIER_PREFIX')) {
define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/vendor/htmlpurifier'));
}
if (!defined('PHPIDS_PATH_PREFIX')) {
define('PHPIDS_PATH_PREFIX', realpath(dirname(__FILE__) . '/vendor/IDS'));
}
// include the PHPIDS and get access to the result object
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/vendor'));
$autoloader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$autoloader->register();
$autoloader->registerPrefixes(array('HTMLPurifier' => realpath(dirname(__FILE__) . '/vendor/htmlpurifier'), 'IDS' => realpath(dirname(__FILE__) . '/vendor')));
// register event handlers
EventUtil::attachEventHandler('SecurityCenterModule\\Listener\\FilterListener');
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:27,代码来源:bootstrap.php
示例20: uninstall
/**
* delete the comments module
*
*/
public function uninstall() {
// drop tables
$tables = array('IWstats', 'IWstats_summary');
foreach ($tables as $table) {
if (!DBUtil::dropTable($table)) {
return false;
}
}
// delete config variables
$this->delVars();
// delete the system init hook
EventUtil::unregisterPersistentModuleHandler('IWstats', 'core.postinit', array('IWstats_Listeners', 'coreinit'));
// Deletion successful
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:23,代码来源:Installer.php
注:本文中的EventUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论