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


PHP Events::fire方法代码示例

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


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

示例1: testFire

 /**
  * @todo Implement testFire().
  */
 public function testFire()
 {
     $observer = new EventsTestObserver();
     $this->object->extend('fire', $observer, 'invoke', null);
     $this->object->fire('dontfire', array('a' => 1, 'b' => 2));
     $this->assertEquals(0, $observer->invoked);
     $this->object->fire('fire', array('a' => 18, 'b' => 81));
     $this->assertEquals(1, $observer->invoked);
     $this->assertEquals(81, $observer->lastArgs['b']);
 }
开发者ID:notzen,项目名称:concrete5-tests,代码行数:13,代码来源:EventsTest.php

示例2: approve

 public function approve(WorkflowProgress $wp)
 {
     $c = Page::getByID($this->getRequestedPageID());
     $v = CollectionVersion::get($c, $this->cvID);
     $v->approve(false);
     Events::fire('on_page_version_submit_approve', $c);
     $wpr = new WorkflowProgressResponse();
     $wpr->setWorkflowProgressResponseURL(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $c->getCollectionID());
     return $wpr;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:10,代码来源:approve_page.php

示例3: __construct

 public function __construct()
 {
     $this->stateProvinces['GB'] = $this->stateProvinces['UK'];
     $stateProvincesFromEvent = Events::fire('on_get_states_provinces_list', $this->stateProvinces);
     if (is_array($stateProvincesFromEvent)) {
         $this->stateProvinces = $stateProvincesFromEvent;
     } else {
         foreach (array_keys($this->stateProvinces) as $country) {
             asort($this->stateProvinces[$country]);
         }
     }
 }
开发者ID:Mihail9575,项目名称:concrete5,代码行数:12,代码来源:states_provinces.php

示例4: __construct

 public function __construct()
 {
     Loader::library('3rdparty/Zend/Locale');
     $countries = Zend_Locale::getTranslationList('territory', Localization::activeLocale(), 2);
     unset($countries['FX'], $countries['IM'], $countries['JE'], $countries['NT'], $countries['PU'], $countries['ZZ'], $countries['CS'], $countries['CT'], $countries['DD'], $countries['PC'], $countries['PZ'], $countries['SU'], $countries['VD'], $countries['YD']);
     $countriesFromEvent = Events::fire('on_get_countries_list', $countries);
     if (is_array($countriesFromEvent)) {
         $countries = $countriesFromEvent;
     } else {
         asort($countries, SORT_LOCALE_STRING);
     }
     $this->countries = $countries;
 }
开发者ID:Mihail9575,项目名称:concrete5,代码行数:13,代码来源:countries.php

示例5: approve

 public function approve(WorkflowProgress $wp)
 {
     $s = Stack::getByID($this->getRequestedPageID());
     $v = CollectionVersion::get($s, $this->cvID);
     $v->approve(false);
     if ($s->getStackName() != $v->getVersionName()) {
         // The stack name has changed so we need to
         // update that for the stack object as well.
         $s->update(array('stackName' => $v->getVersionName()));
     }
     Events::fire('on_page_version_submit_approve', $s);
     $wpr = new WorkflowProgressResponse();
     $wpr->setWorkflowProgressResponseURL(BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $s->getCollectionID());
     return $wpr;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:15,代码来源:approve_stack.php

示例6: removeFriend

	static function removeFriend($friendUID,$uID=0){
		if( !intval($friendUID) ) return false;
		if( !intval($uID) ){
			$u = new User();
			if(!$u || !intval($u->uID)) return false;
			$uID=$u->uID;
		}
		$db = Loader::db();	 
		$vals = array( $friendUID, $uID);
		$sql = 'DELETE FROM UsersFriends WHERE friendUID=? AND uID=?'; 
		$ret = Events::fire('on_user_friend_remove', $uID, $friendUID);
		if($ret < 0) {
			return;
		}
		$db->query($sql,$vals); 
		return true;
	}		
开发者ID:rii-J,项目名称:concrete5-de,代码行数:17,代码来源:users_friends.php

示例7: reset

 public function reset()
 {
     $locale = Localization::activeLocale();
     if ($locale === $this->locale) {
         return;
     }
     $this->locale = $locale;
     $this->stateProvinces['GB'] = $this->stateProvinces['UK'];
     $stateProvincesFromEvent = Events::fire('on_get_states_provinces_list', $this->stateProvinces);
     if (is_array($stateProvincesFromEvent)) {
         $this->stateProvinces = $stateProvincesFromEvent;
     } else {
         foreach (array_keys($this->stateProvinces) as $country) {
             if (!in_array($country, $this->sortedCountries)) {
                 asort($this->stateProvinces[$country]);
             }
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:19,代码来源:states_provinces.php

示例8: flush

 /** 
  * Completely flushes the cache
  */
 public function flush()
 {
     $db = Loader::db();
     $r = $db->MetaTables();
     // flush the CSS cache
     if (is_dir(DIR_FILES_CACHE . '/' . DIRNAME_CSS)) {
         $fh = Loader::helper("file");
         $fh->removeAll(DIR_FILES_CACHE . '/' . DIRNAME_CSS);
     }
     $pageCache = PageCache::getLibrary();
     if (is_object($pageCache)) {
         $pageCache->flush();
     }
     if (in_array('Config', $r)) {
         // clear the environment overrides cache
         $env = Environment::get();
         $env->clearOverrideCache();
         if (in_array('btCachedBlockRecord', $db->MetaColumnNames('Blocks'))) {
             $db->Execute('update Blocks set btCachedBlockRecord = null');
         }
         if (in_array('CollectionVersionBlocksOutputCache', $r)) {
             $db->Execute('truncate table CollectionVersionBlocksOutputCache');
         }
     }
     $loc = CacheLocal::get();
     $loc->cache = array();
     $cache = Cache::getLibrary();
     if ($cache) {
         $cache->setOption('caching', true);
         $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
     }
     if (function_exists('apc_clear_cache')) {
         apc_clear_cache();
     }
     Events::fire('on_cache_flush', $cache);
     return true;
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:40,代码来源:cache.php

示例9: add

		function add($gName, $gDescription) {
			$db = Loader::db();
			$v = array($gName, $gDescription);
			$r = $db->prepare("insert into Groups (gName, gDescription) values (?, ?)");
			$res = $db->Execute($r, $v);
			
			if ($res) {
				$ng = Group::getByID($db->Insert_ID());
				Events::fire('on_group_add', $ng);
				return $ng;
			}
		}
开发者ID:notzen,项目名称:concrete5,代码行数:12,代码来源:groups.php

示例10: load

 /** 
  * Loads the BlockRecord class based on its attribute names
  * @return void
  */
 protected function load()
 {
     if ($this->btTable) {
         if ($this->btCacheBlockRecord && $this->btCachedBlockRecord && ENABLE_BLOCK_CACHE) {
             $this->record = unserialize($this->btCachedBlockRecord);
         } else {
             $this->record = new BlockRecord($this->btTable);
             $this->record->bID = $this->bID;
             $this->record->Load('bID=' . $this->bID);
             if ($this->btCacheBlockRecord && ENABLE_BLOCK_CACHE) {
                 // this is the first time we're loading
                 $record = serialize($this->record);
                 $db = Loader::db();
                 $db->Execute('update Blocks set btCachedBlockRecord = ? where bID = ?', array($record, $this->bID));
             }
         }
     }
     $ret = Events::fire('on_block_load', $this->record, $this->btHandle, $this->bID);
     if ($ret && is_object($ret)) {
         $this->record = $ret;
     }
     if (is_object($this->record)) {
         foreach ($this->record as $key => $value) {
             $this->{$key} = $value;
             $this->set($key, $value);
         }
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:32,代码来源:block_controller.php

示例11: notifyAdmin

		protected function notifyAdmin($offenderID) {
			$offender = UserInfo::getByID($offenderID);
			Events::fire('on_private_message_over_limit', $offender);
			$admin = UserInfo::getByID(USER_SUPER_ID);
			
			Log::addEntry(t("User: %s has tried to send more than %s private messages within %s minutes", $offender->getUserName(), USER_PRIVATE_MESSAGE_MAX, USER_PRIVATE_MESSAGE_MAX_TIME_SPAN),t('warning'));
			
			Loader::helper('mail');
			$mh = new MailHelper();
			
			$mh->addParameter('offenderUname', $offender->getUserName());
			$mh->addParameter('profileURL', BASE_URL . View::url('/profile', 'view', $offender->getUserID()));
			$mh->addParameter('profilePreferencesURL', BASE_URL . View::url('/profile/edit'));
			
			$mh->to($admin->getUserEmail());
			$mh->load('private_message_admin_warning');
			$mh->sendMail();
		}
开发者ID:nbourguig,项目名称:concrete5,代码行数:18,代码来源:user_private_message.php

示例12: defined

<?php

defined('C5_EXECUTE') or die("Access Denied.");
if (Loader::helper('validation/token')->validate('get_url_slug', $_REQUEST['token'])) {
    $lang = LANGUAGE;
    if (isset($_REQUEST['parentID']) && ($multilingual = Package::getByHandle('multilingual'))) {
        $ms = MultilingualSection::getBySectionOfSite(Page::getByID($_REQUEST['parentID']));
        if (is_object($ms)) {
            $lang = $ms->getLanguage();
        }
    }
    $text = Loader::helper('text');
    $name = $text->urlify($_REQUEST['name'], PAGE_PATH_SEGMENT_MAX_LENGTH, $lang);
    $ret = Events::fire('on_page_urlify', $_REQUEST['name']);
    if ($ret) {
        $name = $ret;
    }
    echo $name;
}
开发者ID:Zyqsempai,项目名称:amanet,代码行数:19,代码来源:url_slug.php

示例13: render

 /**
  * render takes one argument - the item being rendered - and it can either be a path or a page object
  * @access public
  * @param string $view
  * @param array $args
  * @return void
  */
 public function render($view, $args = null)
 {
     if (is_array($args)) {
         extract($args);
     }
     // strip off a slash if there is one at the end
     if (is_string($view)) {
         if (substr($view, strlen($view) - 1) == '/') {
             $view = substr($view, 0, strlen($view) - 1);
         }
     }
     $dsh = Loader::helper('concrete/dashboard');
     $wrapTemplateInTheme = false;
     $this->checkMobileView();
     if (defined('DB_DATABASE') && $view !== '/upgrade') {
         Events::fire('on_start', $this);
     }
     // Extract controller information from the view, and put it in the current context
     if (!isset($this->controller)) {
         $this->controller = Loader::controller($view);
         $this->controller->setupAndRun();
     }
     if ($this->controller->getRenderOverride() != '') {
         $view = $this->controller->getRenderOverride();
     }
     // Determine which inner item to load, load it, and stick it in $innerContent
     $content = false;
     ob_start();
     if ($view instanceof Page) {
         $_pageBlocks = $view->getBlocks();
         if (!$dsh->inDashboard()) {
             $_pageBlocksGlobal = $view->getGlobalBlocks();
             $_pageBlocks = array_merge($_pageBlocks, $_pageBlocksGlobal);
         }
         // do we have any custom menu plugins?
         $cp = new Permissions($view);
         if ($cp->canViewToolbar()) {
             $ih = Loader::helper('concrete/interface/menu');
             $_interfaceItems = $ih->getPageHeaderMenuItems();
             foreach ($_interfaceItems as $_im) {
                 $_controller = $_im->getController();
                 $_controller->outputAutoHeaderItems();
             }
             unset($_interfaceItems);
             unset($_im);
             unset($_controller);
         }
         unset($_interfaceItems);
         unset($_im);
         unset($_controller);
         // now, we output all the custom style records for the design tab in blocks/areas on the page
         $c = $this->getCollectionObject();
         $view->outputCustomStyleHeaderItems();
         $viewPath = $view->getCollectionPath();
         $this->viewPath = $viewPath;
         $cFilename = $view->getCollectionFilename();
         $ctHandle = $view->getCollectionTypeHandle();
         $editMode = $view->isEditMode();
         $c = $view;
         $this->c = $c;
         $env = Environment::get();
         // $view is a page. It can either be a SinglePage or just a Page, but we're not sure at this point, unfortunately
         if ($view->getCollectionTypeID() == 0 && $cFilename) {
             $wrapTemplateInTheme = true;
             $cFilename = trim($cFilename, '/');
             $content = $env->getPath(DIRNAME_PAGES . '/' . $cFilename, $view->getPackageHandle());
             $themeFilename = $c->getCollectionHandle() . '.php';
         } else {
             $rec = $env->getRecord(DIRNAME_PAGE_TYPES . '/' . $ctHandle . '.php', $view->getPackageHandle());
             if ($rec->exists()) {
                 $wrapTemplateInTheme = true;
                 $content = $rec->file;
             }
             $themeFilename = $ctHandle . '.php';
         }
     } else {
         if (is_string($view)) {
             // if we're passing a view but our render override is not null, that means that we're passing
             // a new view from within a controller. If that's the case, then we DON'T override the viewPath, we want to keep it
             // In order to enable editable 404 pages, other editable pages that we render without actually visiting
             if (defined('DB_DATABASE') && $view == '/page_not_found') {
                 $pp = Page::getByPath($view);
                 if (!$pp->isError()) {
                     $this->c = $pp;
                 }
             }
             $viewPath = $view;
             if ($this->controller->getRenderOverride() != '' && $this->getCollectionObject() != null) {
                 // we are INSIDE a collection renderring a view. Which means we want to keep the viewPath that of the collection
                 $this->viewPath = $this->getCollectionObject()->getCollectionPath();
             }
             // we're just passing something like "/login" or whatever. This will typically just be
             // internal Concrete stuff, but we also prepare for potentially having something in DIR_FILES_CONTENT (ie: the webroot)
//.........这里部分代码省略.........
开发者ID:Mihail9575,项目名称:concrete5,代码行数:101,代码来源:view.php

示例14: delete

		/**
		 * Deletes a group
		 * @return void
		 */
		function delete(){
			// we will NOT let you delete the required groups
			if ($this->gID == REGISTERED_GROUP_ID || $this->gID == GUEST_GROUP_ID) {
				return false;
			}
			
			// run any internal event we have for group deletion
			$ret = Events::fire('on_group_delete', $this);
			if ($ret < 0) {
				return false;
			}
			
			$db = Loader::db(); 
			$r = $db->query("DELETE FROM UserGroups WHERE gID = ?",array(intval($this->gID)) );
			$r = $db->query("DELETE FROM Groups WHERE gID = ?",array(intval($this->gID)) );
			$r = $db->query("DELETE FROM CollectionVersionBlockPermissions WHERE gID = ?",array(intval($this->gID)) );
			$r = $db->query("DELETE FROM PagePermissionPageTypes WHERE gID = ?",array(intval($this->gID)) );
			$r = $db->query("DELETE FROM PagePermissions WHERE gID = ?",array(intval($this->gID)) );
			$r = $db->query("DELETE FROM AreaGroupBlockTypes WHERE gID = ?",array(intval($this->gID)) );
			$r = $db->query("DELETE FROM AreaGroups WHERE gID = ?",array(intval($this->gID)) ); 
		}
开发者ID:remkoj,项目名称:concrete5,代码行数:25,代码来源:groups.php

示例15: uninstall

 public function uninstall()
 {
     $ret = Events::fire('on_job_uninstall', $this);
     if ($ret < 0) {
         return $ret;
     }
     $db = Loader::db();
     $db->query('DELETE FROM Jobs WHERE jHandle=?', array($this->jHandle));
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:9,代码来源:job.php


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