• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP trigger函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中trigger函数的典型用法代码示例。如果您正苦于以下问题:PHP trigger函数的具体用法?PHP trigger怎么用?PHP trigger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: execute

 /**
  * @return mixed
  */
 public function execute()
 {
     $data = $this->loginForm->getRawData(['email', 'password']);
     foreach (config('pckg.auth.providers') as $providerKey => $providerConfig) {
         /**
          * Create and set new provider.
          */
         $provider = Reflect::create($providerConfig['type'], [$this->auth]);
         $provider->setEntity($providerConfig['entity']);
         /**
          * If user doesnt exists, don't proceed with execution.
          */
         if (!($user = $provider->getUserByEmailAndPassword($data['email'], sha1($data['password'] . $providerConfig['hash'])))) {
             continue;
         }
         /**
          * Try to login.
          */
         $this->auth->useProvider($provider, $providerKey);
         if ($this->auth->performLogin($user)) {
             /**
              * @T00D00 - login user on all providers!
              */
             $this->auth->useProvider($provider);
             trigger('user.loggedIn', [$this->auth->getUser()]);
             if (isset($data['autologin'])) {
                 $this->auth->setAutologin();
             }
             return $this->successful();
         }
     }
     return $this->error();
 }
开发者ID:pckg,项目名称:auth,代码行数:36,代码来源:LoginUser.php


示例2: run

 public function run($params)
 {
     //        $oldRevision = 117093;
     $oldRevision = self::getPrevRevision();
     //        $oldRevision = null;
     // 检查m3d配置文件是否已改变
     $path = defined('M3D_FILE') ? M3D_FILE : (defined('SRC_ROOT') ? SRC_ROOT . '/m3d.php' : null);
     if ($path && self::checkFileChange($path, $oldRevision)) {
         mark('m3d配置文件已改变,重新加载配置,并且进行全量编译', 'especial');
         $params[1]->reload(PROJECT_SITE_PATH . '/' . C('PROJECT.SRC_DIR') . '/' . PROJECT_MODULE_NAME . '/' . C('M3D_FILENAME'));
         C('INCRE.IS_INCRE', false);
         trigger('m3d_config_change');
     }
     if (isset($_GET['isIncre']) && $_GET['isIncre'] === 'false' || !C('INCRE.IS_INCRE') || is_null($oldRevision)) {
         // 事件解绑
         self::off();
     } else {
         mark('增量编译准备中...', 'emphasize');
         $newRevision = IncreMap::getRevision();
         self::$files = self::getChangeList($newRevision, $oldRevision);
         IncreMap::loadBelongMap();
         if (!empty(self::$files[self::DELETE])) {
             IncreMap::rebuildBelongMap(self::$files[self::DELETE]);
         }
         // 更新modify列表
         self::$files[self::MODIFY] = array_unique(array_merge(self::$files[self::MODIFY], IncreMap::getAffectList(self::$files[self::MODIFY])));
     }
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:28,代码来源:IncreProcessPlugin.class.php


示例3: __invoke

 function __invoke($error, $method, $path, \cms\Sphido $cms)
 {
     trigger(MissingPage::class . '_before', $error, $method, $path, $cms);
     if ($cms->page = Page::fromPath(\dir\content() . '/404', (array) \app\config()->meta)) {
         return $cms->render();
     }
     trigger(MissingPage::class . '_default', $error, $method, $path, $cms);
 }
开发者ID:sphido,项目名称:cms,代码行数:8,代码来源:MissingPage.php


示例4: latte

/**
 * @return Engine
 */
function latte()
{
    $latte = new Engine();
    $latte->setLoader(filter('latte.loader', new FileLoader()));
    $latte->setTempDirectory(\dir\cache());
    $latte->addFilter('md', '\\cms\\md');
    trigger('latte.macroset', new MacroSet($latte->getCompiler()));
    return filter('latte', $latte);
}
开发者ID:austinvernsonger,项目名称:cms,代码行数:12,代码来源:Render.php


示例5: handle

 private function handle($matches)
 {
     $path = Tool::getActualPath($matches[1]);
     $processor = new JsPreprocess($this->processor->getMap());
     $processor->setFile(C('SRC.SRC_PATH') . $path);
     $processor->process();
     trigger('js_import', $this->processor, $processor);
     return $processor->getContents();
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:9,代码来源:IframeRefreshPlugin.class.php


示例6: latte

/**
 * @return Engine
 */
function latte()
{
    $latte = new Engine();
    $latte->setLoader(filter(FileLoader::class, new FileLoader()));
    $latte->setTempDirectory(\dir\cache());
    $latte->addFilter('md', '\\cms\\md');
    trigger(MacroSet::class, new MacroSet($latte->getCompiler()));
    return filter(Engine::class, $latte);
}
开发者ID:sphido,项目名称:cms,代码行数:12,代码来源:Render.php


示例7: execute

 /**
  * @return mixed
  */
 public function execute()
 {
     $rUser->setArray($this->request->post());
     $rUser->hashPassword();
     if ($rUser->save()) {
         trigger('user.registered', [$rUser]);
         return $this->successful();
     }
     return $this->error();
 }
开发者ID:pckg,项目名称:auth,代码行数:13,代码来源:RegisterUser.php


示例8: replaceMediaPath

 private function replaceMediaPath($matches)
 {
     $path = $matches[0];
     $aPath = Tool::getActualPath($path);
     if (isset($this->map['media'][$aPath])) {
         trigger('js_replace', $this, $aPath);
         return Tool::addCdn($this->map['media'][$aPath]);
     }
     return $path;
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:10,代码来源:JsPreprocess.class.php


示例9: run

 public function run()
 {
     trigger('imerge_start', $this);
     mark('开始自动合图扫描', 'emphasize');
     $files = get_files_by_type(C('SRC.SRC_PATH'), 'css');
     $generator = new MergeConfigGenerator($files);
     $generator->generate();
     $writer = new MergeConfigWriter(C('IMERGE_PATH'));
     $writer->writeImageConfig($generator->getConfig());
     // 更新大图
     $this->updateSprite();
     trigger('imerge_end', $this);
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:13,代码来源:InstantmergeTool.class.php


示例10: getInstance

 public static final function getInstance($class, $options = null)
 {
     if (empty($class)) {
         return null;
     }
     $class = ucfirst(strtolower($class)) . 'Compressor';
     if (!isset(self::$_instance[$class])) {
         $instance = new stdClass();
         $instance->return = null;
         trigger('get_compressor', $instance, $options);
         self::$_instance[$class] = is_null($instance->return) ? empty($options) ? new $class() : new $class($options) : $instance->return;
     }
     return self::$_instance[$class];
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:14,代码来源:Compressor.class.php


示例11: publishMETA

 public function publishMETA()
 {
     $title = trigger('page_title', $this->pageTitle);
     if (empty($title) || !isset($title)) {
         publish('<title>' . $this->pageTitle . '</title>');
     } else {
         publish('<title>' . $title . '</title>');
     }
     publish('<meta name="description" content="' . $this->pageDesc . '">');
     publish('<meta name="keywords" content="' . $this->pageTags . '">');
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
         publish('<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>');
     }
     publish('<script>var resourceURL = "/' . currentSite()->relativePath . 'res/' . '";</script>');
 }
开发者ID:loonpwn,项目名称:Lunor-CMS,代码行数:15,代码来源:page.php


示例12: error

 /**
  * Page not found error.
  *
  * @param $error
  * @param callable $method
  * @param string $path
  * @param Sphido $cms
  * @return int|null
  */
 public function error($error, $method, $path, $cms)
 {
     trigger('render.error', $error, $method, $path, $cms);
     if ($this->page = Page::fromPath(\dir\content() . '/404', (array) config()->meta)) {
         return print ensure('render.error', [$this, 'render'], $this);
     }
     /**
      * @param int $error
      * @param string $method
      * @param string $path
      * @param Sphido $cms
      * @name render .default.error
      */
     ensure('render.default.error', $error, $method, $path, $cms);
     // default error is on you
 }
开发者ID:nunodotferreira,项目名称:cms-3,代码行数:25,代码来源:cms.php


示例13: render

 /**
  * @return mixed|null|string
  * @throws \Exception
  */
 public function render()
 {
     trigger(Sphido::class . '::' . __FUNCTION__, $this->page, $this);
     // HTTP status code
     if ($code = isset($this->page->status) ? $this->page->status : null) {
         http_response_code($code);
     }
     // PHTML file execute
     if ($this->page->is('phtml')) {
         extract(get_object_vars($this), EXTR_SKIP);
         ob_start();
         require $this->page;
         return ob_get_clean();
     }
     return latte()->renderToString($this->page, get_object_vars($this));
 }
开发者ID:sphido,项目名称:cms,代码行数:20,代码来源:cms.php


示例14: run

 public function run($params)
 {
     $item = $params[2];
     if ($this->options['requirejs.path'] && $item['processor'] === 'js') {
         mark('requireJs插件开始处理' . $this->options['requirejs.path'], 'emphasize');
         $this->options['requirejs.path'] = C('SRC.SRC_PATH') . $this->options['requirejs.path'];
         if (!file_exists($this->options['requirejs.path'])) {
             mark('"' . $this->options['requirejs.path'] . '"不存在,请检查m3d.php中requireJs配置', 'error');
             return;
         }
         $tool = $params[1];
         $map = $this->getMap($tool);
         $script = $this->genScript($map);
         $processor = Preprocess::getInstance('js');
         $mapFiles = $this->options['requirejs.path'];
         if (is_string($mapFiles)) {
             $mapFiles = array($mapFiles);
         }
         foreach ($mapFiles as $file) {
             $processor->setFile($file);
             $processor->setContents($script);
             $processor->process();
             $processor->compress();
             $path = $processor->getRelativePath();
             $buildPath = $tool->writeBuildFile($processor, $item, $path);
             $oldBuildPath = $tool->getMap('js', $path);
             if ($buildPath !== $oldBuildPath) {
                 $tool->updateMap('js', $path, $buildPath);
                 // 清除文件
                 $file = C('SRC.BUILD_PATH') . $oldBuildPath;
                 if (file_exists($file)) {
                     unlink($file);
                 }
                 $file = C('SRC.BUILD_CACHE_PATH') . $oldBuildPath;
                 if (file_exists($file)) {
                     unlink($file);
                 }
                 trigger('change_file', $path);
             }
         }
     }
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:42,代码来源:RequireJsPlugin.class.php


示例15: draw

 /**
  * 绘制图像
  * @param $type
  */
 public function draw($type, $config = array())
 {
     if (empty($config)) {
         $loader = new MergeConfigLoader($this->imergePath);
         $config = $loader->getImageConfigByType($type);
     }
     $imgList = array();
     if (!empty($config)) {
         foreach ($config as $key => $value) {
             try {
                 $imgList[$key] = new Image($this->staticRelativePath . $key, $value);
             } catch (ImageException $e) {
                 mark("合图{$type}中,存在小图{$key}的配置文件,但该小图不存在,请到合图配置界面删除该小图", 'warn');
             }
         }
     }
     $layout = new Layout($imgList);
     $spriteConfigs = array();
     $spriteConfigs[$type] = array();
     if ($layout->reflow($width, $height)) {
         $this->sprite = imagecreatetruecolor($width, $height);
         imagealphablending($this->sprite, false);
         imagesavealpha($this->sprite, true);
         imagefill($this->sprite, 0, 0, imagecolorallocatealpha($this->sprite, 0, 0, 0, 127));
         $spriteConfigs[$type]['config'] = $this->repaint($this->sprite, $imgList, $width, $height);
         // 记录sprite的属性
         $spriteConfigs[$type]['attr'] = array('filename' => $type . C('SPRITE_SUFFIX') . '.png', 'width' => $width, 'height' => $height);
         //            $spriteConfigs[$type]['filename'] = $type.C('SPRITE_SUFFIX').'.png';
         // 生成大图到imerge_sprite_dir
         $path = $this->imergePath . '/' . C('IMERGE_SPRITE_DIR') . '/' . $type . C('SPRITE_SUFFIX') . '.png';
         imagepng($this->sprite, $path);
         // 写入配置
         $writer = new MergeConfigWriter($this->imergePath);
         $writer->writeSpriteConfig($spriteConfigs);
         // 派发处理完成事件
         trigger('DRAW_SPRITE_END', $path);
     }
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:42,代码来源:Sprite.class.php


示例16: check_for_duplicates

/**
 * search in the Incidents DB for incident(s) titles that match the subject of this email
 * @author Nico du toit
 * @param string $subject. Normally the subject of an email to compare as from the inbound script
 * @param string $contactid. The contact id to check the incidents against (saves time .. i think)
 * @return Returns either YES(continue with auto create), NO (don't auto create) or the incidentID
 *          (of an exact match between the title and the email subject)
 */
function check_for_duplicates($subject, $contactid)
{
    //Revert to second function that does the preg_match
    $count_dup = find_duplicate_cases($subject, $contactid);
    //There is one match for the subject in the DB, array is returned
    if (is_array($count_dup)) {
        // TODO: **Depreciated - after verification we can remove this
        //$incidentid = id_of_duplicate($subject, $contactid);
        $count = $count_dup[0];
        $incidentid = $count_dup[1];
        debug_log("Duplicate email sent!! - Reverting with incidentid to import into case !!" . $incidentid);
        //Just in case the search fails and no ID is retrieved we need to exit correctly
        if (!$incidentid) {
            debug_log("Incident ID could not be found as intended !!");
            $create = "NO";
            return $create;
        }
        trigger('TRIGGER_EMAIL_DUPLICATE_IMPORTED', array('incidentid' => $incidentid));
        $create = $incidentid;
        return $create;
    }
    //There are multiple matches for the subject in the DB
    if (!is_array($count_dup) && $count_dup > 1) {
        $id = 0;
        $uid = 3;
        //TODO: For now this is my id but i need to change it to system's later
        debug_log("Possible duplicate email. Number of cases with similar subject: " . $count_dup . " - NOT auto creating!! /n ");
        trigger('TRIGGER_POSSIBLE_DUPLICATE', array('incidentid' => $id, 'userid' => $uid, 'emailsubject' => $subject));
        $create = "NO";
        return $create;
    }
    //There are no results thus return and auto create the case if possible
    if (!is_array($count_dup) && $count_dup == 0) {
        debug_log("No duplicates found continuiing !!" . $count_dup);
        $create = "YES";
        return $create;
    }
}
开发者ID:nicdev007,项目名称:auto-create,代码行数:46,代码来源:functions_auto_create.php


示例17: autoparse

 public function autoparse()
 {
     self::addDir(path('root'), Twig::PRIORITY_LAST);
     $this->initTwig($this->file);
     if ($this->file) {
         $this->twig = $this->twig->loadTemplate($this->file . ".twig");
     } else {
         $this->twig = $this->twig->createTemplate($this->template);
     }
     try {
         /**
          * Trigger rendering event so we can attach some handlers.
          */
         trigger(RenderingView::class, ['view' => $this->file]);
         /**
          * Render template.
          */
         $render = measure('Rendering ' . $this->file, function () {
             return $this->twig->render($this->getFullData());
         });
         if ($render == $this->file . '.twig') {
             if (prod()) {
                 return null;
             }
             return '<p style="color: black; font-weight: bold; background-color: red;">' . 'Cannot load file ' . $this->file . '</p>';
         }
         return $render;
     } catch (Twig_Error_Syntax $e) {
         return "<pre>Twig error:" . exception($e) . "</pre>";
     } catch (Throwable $e) {
         return '<pre>' . exception($e) . '</pre>';
     }
 }
开发者ID:pckg,项目名称:framework,代码行数:33,代码来源:Twig.php


示例18: redirect

 public function redirect($url = null, $httpParams = [], $routerParams = [])
 {
     $output = null;
     if ($url === -1) {
         $url = $this->getMinusUrl();
         $output = '<html><body><script>history.go(-1);</script></body></html>';
     } else {
         if (substr($url, 0, 1) == '@') {
             $url = (new URL())->setParams($httpParams)->setUrl($this->router->make(substr($url, 1), $routerParams))->relative();
         } else {
             if ($url === null) {
                 $url = $this->router->getUri();
             }
         }
     }
     if (!$output) {
         $output = '<html><head><meta http-equiv="refresh" content="0; url=' . $url . '" /></head><body></body></html>';
     }
     /**
      * @T00D00 - implement event
      */
     trigger('response.redirect', [$this]);
     if (context()->exists(Flash::class)) {
         context()->get(Flash::class)->__destruct();
     }
     // try with php
     header("Location: " . $url);
     // fallback with html
     $this->respond($output);
     return $this;
 }
开发者ID:pckg,项目名称:framework,代码行数:31,代码来源:Response.php


示例19: create_incident_feedback

 if ($CONFIG['feedback_form'] != '' and $CONFIG['feedback_form'] > 0 and $send_feedback == TRUE) {
     create_incident_feedback($CONFIG['feedback_form'], $id);
 }
 $notifyexternal = $notifycontact = $awaitingclosure = 0;
 if ($send_engineer_email == 'yes') {
     $notifyexternal = 1;
 }
 if ($send_email == 'yes') {
     $notifycontact = 1;
     if ($wait == 'yes') {
         $awaitingclosure = 1;
     } else {
         $awaitingclosure = 0;
     }
 }
 trigger('TRIGGER_INCIDENT_CLOSED', array('incidentid' => $incidentid, 'userid' => $sit[2], 'notifyexternal' => $notifyexternal, 'notifycontact' => $notifycontact, 'awaitingclosure' => $awaitingclosure));
 // Tidy up drafts i.e. delete
 $draft_sql = "DELETE FROM `{$dbDrafts}` WHERE incidentid = {$id}";
 mysql_query($draft_sql);
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
 }
 // Check for knowledge base stuff, prior to confirming:
 if ($_REQUEST['kbarticle'] == 'yes') {
     $sql = "INSERT INTO `{$dbKBArticles}` (doctype, title, distribution, author, published, keywords) VALUES ";
     $sql .= "('1', ";
     $sql .= "'{$kbtitle}', ";
     $sql .= "'{$distribution}', ";
     $sql .= "'" . mysql_real_escape_string($sit[2]) . "', ";
     $sql .= "'" . date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'))) . "', ";
     $sql .= "'[{$id}]') ";
开发者ID:sitracker,项目名称:sitracker_old,代码行数:31,代码来源:incident_close.php


示例20: incident_owner

 }
 $owner = incident_owner($id);
 // visible update
 if ($cust_vis == "yes") {
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, bodytext, timestamp, currentowner, currentstatus, customervisibility, nextaction) ";
     $sql .= "VALUES ('{$id}', '{$sit['2']}', '{$updatetype}', '{$bodytext}', '{$now}', '{$owner}', '{$newstatus}', 'show' , '{$nextaction}')";
 } else {
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, bodytext, timestamp, currentowner, currentstatus, nextaction) ";
     $sql .= "VALUES ({$id}, {$sit['2']}, '{$updatetype}', '{$bodytext}', '{$now}', '{$owner}', '{$newstatus}', '{$nextaction}')";
 }
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
 }
 $updateid = mysql_insert_id();
 trigger('TRIGGER_INCIDENT_UPDATED_INTERNAL', array('incidentid' => $id, 'userid' => $sit[2]));
 //upload file, here because we need updateid
 if ($_FILES['attachment']['name'] != '') {
     // try to figure out what delimeter is being used (for windows or unix)...
     //.... // $delim = (strstr($filesarray[$c],"/")) ? "/" : "\\";
     $delim = strstr($_FILES['attachment']['tmp_name'], "/") ? "/" : "\\";
     // make incident attachment dir if it doesn't exist
     $umask = umask(00);
     if (!file_exists("{$CONFIG['attachment_fspath']}{$id}")) {
         $mk = @mkdir("{$CONFIG['attachment_fspath']}{$id}", 0770, TRUE);
         if (!$mk) {
             $sql = "DELETE FROM `{$dbUpdates}` WHERE id='{$updateid}'";
             mysql_query($sql);
             if (mysql_error()) {
                 trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
             }
开发者ID:nicdev007,项目名称:sitracker,代码行数:31,代码来源:incident_update.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP trigger_change函数代码示例发布时间:2022-05-23
下一篇:
PHP tribe_update_option函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap