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


PHP HookManager::callHook方法代码示例

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


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

示例1: invalidateUserCacheByUserId

 protected function invalidateUserCacheByUserId($userId)
 {
     if (empty($userId) or !is_numeric($userId)) {
         throw new InvalidArgumentException("\$userId have to be non zero integer");
     }
     if ($this->memcache != null) {
         $this->memcache->invalidateCacheByTag(self::USER_TAG . $userId);
     }
     $hookParams = array('userId' => $userId);
     HookManager::callHook("ClearUserCache", $hookParams);
 }
开发者ID:Welvin,项目名称:stingle,代码行数:11,代码来源:UserManagerCaching.class.php

示例2: load

 /**
  * Load plugin
  * 
  * @param boolean $overrideObjects
  */
 public final function load($overrideObjects = false)
 {
     $hookArgs = array('packageName' => $this->packageName, 'pluginName' => $this->pluginName, 'pluginConfig' => $this->config);
     HookManager::callHook("BeforePluginInit", $hookArgs);
     $this->includes();
     $this->customInitBeforeObjects();
     $this->loadObjects($overrideObjects);
     $this->customInitAfterObjects();
     $this->registerHooks();
     HookManager::callHook("AfterPluginInit", $hookArgs);
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:16,代码来源:Loader.class.php

示例3: load

 /**
  * Load all plugin that have been loaded to the queue
  */
 public function load()
 {
     $this->buildAllowanceTables($this->pluginsToLoad);
     foreach ($this->pluginsToLoad as $packageName => $plugins) {
         foreach ($plugins as $pluginName) {
             $this->usePlugin($packageName, $pluginName);
         }
         HookManager::callHook("AfterThisPluginTreeInit");
         HookManager::unRegisterHook("AfterThisPluginTreeInit");
     }
     $this->customConfigs = new Config();
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:15,代码来源:PackageManager.class.php

示例4: load

 /**
  * Load plugin
  * 
  * @param boolean $overrideObjects
  */
 public final function load($overrideObjects = false, $forceIncludes = false)
 {
     $hookArgs = array('packageName' => $this->packageName, 'pluginName' => $this->pluginName, 'pluginConfig' => $this->config);
     HookManager::callHook("BeforePluginInit", $hookArgs);
     if ($forceIncludes or (!isset($GLOBALS['doNotIncludeClasses']) or $GLOBALS['doNotIncludeClasses'] !== true)) {
         $this->includes();
     }
     $this->customInitBeforeObjects();
     $this->loadObjects($overrideObjects);
     $this->customInitAfterObjects();
     $this->registerHooks();
     HookManager::callHook("AfterPluginInit", $hookArgs);
 }
开发者ID:Welvin,项目名称:stingle,代码行数:18,代码来源:Loader.class.php

示例5: doLogin

 /**
  * Login user of given user id
  * 
  * @param integer $userId
  * @param boolean $writeCookie
  *
  * @return User
  */
 public function doLogin($userId, $additionalCredentials = array(), $writeCookie = false)
 {
     if (empty($userId) or !is_numeric($userId)) {
         throw new InvalidArgumentException("\$userId have to be non zero integer!");
     }
     $usr = $this->um->getUserById($userId);
     $this->checkIfLoginIsAllowed($usr);
     $hookParams = array("user" => $usr, "additionalCredentials" => $additionalCredentials);
     HookManager::callHook("OnUserLogin", $hookParams);
     $this->saveUserIdInSession($usr);
     $this->updateUserLastLoginDateAndIP($usr);
     if ($writeCookie) {
         $this->writeLoginCookie($usr);
     }
     return $usr;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:24,代码来源:UserAuthorization.class.php

示例6: foreach

Debug::setMode($config->Debug->enabled);
SiteMode::set($config->SiteMode->mode);
// Register User Hooks
if (isset($config->Hooks)) {
    foreach (get_object_vars($config->Hooks) as $hookName => $funcName) {
        if (is_object($funcName)) {
            foreach (get_object_vars($funcName) as $regFuncName) {
                HookManager::registerHook(new Hook($hookName, $regFuncName));
            }
        } else {
            HookManager::registerHook(new Hook($hookName, $funcName));
        }
    }
}
// Init packages/plugins
HookManager::callHook("BeforePackagesLoad");
foreach (get_object_vars($config->Packages) as $package) {
    $package = get_object_vars($package);
    if (!isset($package[1])) {
        $package[1] = array();
    }
    Reg::get('packageMgr')->addPackage($package[0], $package[1]);
}
Reg::get('packageMgr')->load();
HookManager::callHook("AfterPackagesLoad");
// Request Parser
HookManager::callHook("BeforeRequestParser");
HookManager::callHook("BeforeRequestParserStep2");
HookManager::callHook("RequestParser");
HookManager::callHook("AfterRequestParser");
开发者ID:alexamiryan,项目名称:stingle,代码行数:30,代码来源:init.php

示例7: file_put_contents

                if (!empty($file['precompileCode'])) {
                    $fileContents .= $file['precompileCode'] . "\n\n";
                }
                $fileContents .= $content . "\n\n";
                if (!empty($file['postcompileCode'])) {
                    $fileContents .= $file['postcompileCode'] . "\n\n";
                }
            }
            file_put_contents($classesCacheFilename, $fileContents);
        }
    }
}
// Request Parser
HookManager::callHook("BeforeRequestParser");
HookManager::callHook("BeforeRequestParserStep2");
HookManager::callHook("RequestParser");
HookManager::callHook("AfterRequestParser");
HookManager::callHook("BeforeController");
HookManager::callHook("Controller");
HookManager::callHook("AfterController");
//$time = microtime(true);
HookManager::callHook("BeforeOutput");
HookManager::callHook("Output");
HookManager::callHook("AfterOutput");
if (ConfigManager::getGlobalConfig()->Stingle->BootCompiler === true) {
    if (!file_exists($configCacheFilename) and !$isGetConfigFromCache) {
        file_put_contents($configCacheFilename, serialize(ConfigManager::mergeConfigs(ConfigManager::getGlobalConfig(), ConfigManager::getCache())));
    }
}
//echo "out - " . (microtime(true) - $time) . "<br>";
// Finish
开发者ID:Welvin,项目名称:stingle,代码行数:31,代码来源:init.php

示例8:

<?php

require_once STINGLE_PATH . "configs/config.inc.php";
require_once SITE_CONFIGS_PATH . "config.inc.php";
require_once STINGLE_PATH . "init/init.php";
HookManager::callHook("BeforeController");
HookManager::callHook("Controller");
HookManager::callHook("AfterController");
HookManager::callHook("InitEnd");
开发者ID:alexamiryan,项目名称:stingle,代码行数:9,代码来源:index.php

示例9: changeConversationHasAttachmentStatus

 public function changeConversationHasAttachmentStatus($uuid, $status, $userId = null)
 {
     if (empty($uuid) or !is_numeric($uuid)) {
         throw new InvalidIntegerArgumentException("\$uuid have to be non zero integer.");
     }
     if (!is_numeric($status) or !in_array($status, $this->getConstsArray("STATUS_HAS_ATTACHMENT"))) {
         throw new InvalidIntegerArgumentException("Invalid \$status specified");
     }
     if ($userId !== null and (empty($userId) or !is_numeric($userId))) {
         throw new InvalidIntegerArgumentException("\$userId have to be non zero integer.");
     }
     $qb = new QueryBuilder();
     $qb->update(Tbl::get('TBL_CONVERSATIONS'))->set(new Field('has_attachment'), $status)->where($qb->expr()->equal(new Field('uuid'), $uuid));
     if ($userId !== null and !empty($userId) and is_numeric($userId)) {
         $qb->andWhere($qb->expr()->equal(new Field('user_id'), $userId));
     }
     $this->query->exec($qb->getSQL());
     $hookParams = array('type' => 'hasAttach', 'uuid' => $uuid, 'hasAttach' => $status);
     HookManager::callHook("ConversationUpdate", $hookParams);
 }
开发者ID:Welvin,项目名称:stingle,代码行数:20,代码来源:ConversationManager.class.php

示例10: output

 /**
  * Display a module page. <b>The $tpl var should be relative to /templates/modules
  * folder without a '/' at the begining.</b>
  * Examples:
  * home/home.tpl
  * users/profile.tpl
  *
  * @param string $tpl
  * @return SmartyWrapper
  */
 public function output()
 {
     // Do not display anything if output is disabled
     if ($this->isOutputDisabled) {
         return;
     }
     // Call layout init hook if there is any
     $hookFunctionName = 'initLayout_' . $this->layoutName;
     if (function_exists($hookFunctionName)) {
         $hookName = 'hookInitLayout_' . $this->layoutName;
         $layoutHook = new Hook($hookName, $hookFunctionName);
         HookManager::registerHook($layoutHook);
         HookManager::callHook($hookName);
     }
     // Call per template hook
     $hookFunctionName = 'initTemplate_' . $this->template;
     if (function_exists($hookFunctionName)) {
         $hookName = 'hookInitTemplate_' . $this->template;
         $templateHook = new Hook($hookName, $hookFunctionName);
         HookManager::registerHook($templateHook);
         HookManager::callHook($hookName);
     }
     // Check if page exists and if not show 404 error page
     if (!file_exists($this->getFilePathFromTemplate("{$this->modulesPath}{$this->module}/{$this->page}.tpl", true))) {
         header("HTTP/1.0 404 Not Found");
         $this->module = $this->errorsModule;
         $this->page = $this->error404Page;
         $this->removeWrapper();
     }
     $this->defaultAssingns();
     // Check if wrapper is set and if yes include it
     if (!empty($this->wrapper)) {
         $this->assign('modulePageTpl', $this->getFilePathFromTemplate($this->modulesPath . $this->module . "/" . $this->page . ".tpl"));
         $this->assign('__modulePageTpl', $this->getFilePathFromTemplate($this->modulesPath . $this->module . "/" . $this->wrappersDir . $this->wrapper . ".tpl"));
     } else {
         $this->assign('__modulePageTpl', $this->getFilePathFromTemplate($this->modulesPath . $this->module . "/" . $this->page . ".tpl"));
     }
     // Finally display
     parent::display($this->layoutPath);
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:50,代码来源:SmartyWrapper.class.php

示例11: shutdown

function shutdown()
{
    HookManager::callHook('Shutdown');
}
开发者ID:Welvin,项目名称:stingle,代码行数:4,代码来源:system.php

示例12: setUserPermissions

 /**
  * Set user permissions
  *
  * @param string $user_id
  * @param array $permissions_list
  * @return bool
  */
 public function setUserPermissions($user_id, $permissions_list)
 {
     $user_id = intval($user_id);
     $perms_ids = $this->getPermsIds($permissions_list);
     $this->query->exec("delete from `" . Tbl::get('TBL_USERS_PERMISSIONS') . "` where `user_id`='{$user_id}'");
     foreach ($perms_ids as $perm_id) {
         $this->query->exec("insert into `" . Tbl::get('TBL_USERS_PERMISSIONS') . "`(`user_id`,`permission_id`) values('{$user_id}', '{$perm_id}')");
     }
     $hookArgs = array("userId" => $user_id, 'permissions' => $permissions_list);
     HookManager::callHook("postUserSetPermissions", $hookArgs);
     return true;
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:19,代码来源:UserManagement.class.php


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