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


PHP Events::SendEvent方法代码示例

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


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

示例1: smarty_cms_prefilter_precompilefunc

function smarty_cms_prefilter_precompilefunc($tpl_output, &$smarty)
{
    $result = explode(':', $smarty->_current_file);
    if (count($result) > 1) {
        if (startswith($result[0], 'tmp_')) {
            $result[0] = 'template';
        }
        switch ($result[0]) {
            case 'stylesheet':
                Events::SendEvent('Core', 'StylesheetPreCompile', array('stylesheet' => &$tpl_output));
                break;
            case "content":
                Events::SendEvent('Core', 'ContentPreCompile', array('content' => &$tpl_output));
                break;
            case "template":
                Events::SendEvent('Core', 'TemplatePreCompile', array('template' => &$tpl_output));
                break;
            case "globalcontent":
                Events::SendEvent('Core', 'GlobalContentPreCompile', array('global_content' => &$tpl_output));
                break;
            default:
                break;
        }
    }
    Events::SendEvent('Core', 'SmartyPreCompile', array('content' => &$tpl_output));
    return $tpl_output;
}
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:27,代码来源:prefilter.precompilefunc.php

示例2: smarty_postfilter_postcompilefunc

function smarty_postfilter_postcompilefunc($tpl_output, &$template)
{
    $smarty = $template->smarty;
    $result = explode(':', $smarty->_current_file);
    if (count($result) > 1) {
        switch ($result[0]) {
            case 'stylesheet':
                Events::SendEvent('Core', 'StylesheetPostCompile', array('stylesheet' => &$tpl_output));
                break;
            case "content":
                Events::SendEvent('Core', 'ContentPostCompile', array('content' => &$tpl_output));
                break;
            case "template":
            case 'tpl_top':
            case 'tpl_body':
            case 'tpl_head':
                Events::SendEvent('Core', 'TemplatePostCompile', array('template' => &$tpl_output, 'type' => $result[0]));
                break;
            case "globalcontent":
                Events::SendEvent('Core', 'GlobalContentPostCompile', array('global_content' => &$tpl_output));
                break;
            default:
                break;
        }
    }
    Events::SendEvent('Core', 'SmartyPostCompile', array('content' => &$tpl_output));
    return $tpl_output;
}
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:28,代码来源:postfilter.postcompilefunc.php

示例3: smarty_cms_prefilter_precompilefunc

function smarty_cms_prefilter_precompilefunc($tpl_output, &$smarty)
{
    global $gCms;
    $result = explode(':', $smarty->_current_file);
    if (count($result) > 1) {
        if (startswith($result[0], 'tmp_')) {
            $result[0] = 'template';
        }
        switch ($result[0]) {
            case "content":
                // 				foreach($gCms->modules as $key=>$value)
                // 				{
                // 					if ($gCms->modules[$key]['installed'] == true &&
                // 						$gCms->modules[$key]['active'] == true)
                // 					{
                // 						$gCms->modules[$key]['object']->ContentPreCompile($tpl_output);
                // 					}
                // 				}
                Events::SendEvent('Core', 'ContentPreCompile', array('content' => &$tpl_output));
                break;
            case "template":
                // 				foreach($gCms->modules as $key=>$value)
                // 				{
                // 					if ($gCms->modules[$key]['installed'] == true &&
                // 						$gCms->modules[$key]['active'] == true)
                // 					{
                // 						$gCms->modules[$key]['object']->TemplatePreCompile($tpl_output);
                // 					}
                // 				}
                Events::SendEvent('Core', 'TemplatePreCompile', array('template' => &$tpl_output));
                break;
            case "globalcontent":
                // 				foreach($gCms->modules as $key=>$value)
                // 				{
                // 					if ($gCms->modules[$key]['installed'] == true &&
                // 						$gCms->modules[$key]['active'] == true)
                // 					{
                // 						$gCms->modules[$key]['object']->GlobalContentPreCompile($tpl_output);
                // 					}
                // 				}
                Events::SendEvent('Core', 'GlobalContentPreCompile', array('global_content' => &$tpl_output));
                break;
            default:
                break;
        }
    }
    foreach ($gCms->modules as $key => $value) {
        if ($gCms->modules[$key]['installed'] == true && $gCms->modules[$key]['active'] == true) {
            $gCms->modules[$key]['object']->SmartyPreCompile($tpl_output);
        }
    }
    Events::SendEvent('Core', 'SmartyPreCompile', array('content' => &$tpl_output));
    return $tpl_output;
}
开发者ID:rasomu,项目名称:chuza,代码行数:54,代码来源:prefilter.precompilefunc.php

示例4: array

         $validinfo = false;
     }
 }
 if ($validinfo) {
     $onetemplate = $templateops->LoadTemplateByID($template_id);
     $onetemplate->name = $template;
     $onetemplate->content = $content;
     $onetemplate->stylesheet = $stylesheet;
     $onetemplate->encoding = $encoding;
     $onetemplate->active = $active;
     Events::SendEvent('Core', 'EditTemplatePre', array('template' => &$onetemplate));
     $result = $onetemplate->Save();
     if ($result) {
         #Make sure the new name is used if this is an apply
         $orig_template = $template;
         Events::SendEvent('Core', 'EditTemplatePost', array('template' => &$onetemplate));
         // put mention into the admin log
         audit($template_id, 'HTML-template: ' . $onetemplate->name, 'Edited');
         if (!$apply) {
             switch ($from) {
                 case 'content':
                     redirect("listcontent.php" . $urlext);
                     break;
                 case 'cssassoc':
                     redirect('templatecss.php' . $urlext . '&id=' . $cssid . '&type=template');
                     break;
                 case 'module_TemplateManager':
                     redirect('moduleinterface.php' . $urlext . '&module=TemplateManager');
                     break;
                 default:
                     redirect("listtemplates.php" . $urlext);
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:31,代码来源:edittemplate.php

示例5: fetch

 /**
  * fetch method
  * NOTE: Overwrites parent
  *
  * @param mixed $template
  * @param int $cache_id
  * @param mixed $parent
  * @param boolean $display
  * @param boolean $merge_tpl_vars
  * @param boolean $no_output_filter
  * @return mixed
  */
 public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     $name = $template;
     if (startswith($name, 'string:')) {
         $name = 'string:';
     }
     debug_buffer('', 'Fetch ' . $name . ' start');
     if (is_null($cache_id) || $cache_id === '') {
         $cache_id = $this->_global_cache_id;
     } else {
         if ($cache_id[0] == '|') {
             $cache_id = $this->_global_cache_id . $cache_id;
         }
     }
     // send an event before fetching...this allows us to change template stuff.
     if (cmsms()->is_frontend_request()) {
         $parms = array('template' => &$template, 'cache_id' => &$cache_id, 'compile_id' => &$compile_id, 'display' => &$display, 'no_output_filter' => &$no_output_filter);
         Events::SendEvent('Core', 'TemplatePreFetch', $parms);
     }
     $merge_tpl_vars = false;
     // hack
     $tmp = parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
     debug_buffer('', 'Fetch ' . $name . ' end');
     return $tmp;
 }
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:37,代码来源:class.Smarty_CMS.php

示例6: foreach

            foreach ($media_type as $onetype) {
                $types .= "{$onetype}, ";
            }
            if ($types != '') {
                $types = substr($types, 0, -2);
                #strip last space and comma
            } else {
                $types = '';
            }
            $newstylesheet->media_type = $types;
            Events::SendEvent('Core', 'AddStylesheetPre', array('stylesheet' => &$newstylesheet));
            $result = $newstylesheet->Save();
            # we now have to check that everything went well
            if ($result) {
                #Sent the post event
                Events::SendEvent('Core', 'AddStylesheetPost', array('stylesheet' => &$newstylesheet));
                # it's ok, we record the operation in the admin log
                audit($newstylesheet->id, 'Stylesheet: ' . $css_name, 'Added');
                # and goes back to the css list
                redirect("listcss.php" . $urlext);
                return;
            } else {
                $error .= "<li>" . lang('errorinsertingcss') . "</li>";
            }
        }
    }
}
include_once "header.php";
#******************************************************************************
# the user does not have access : error message
#******************************************************************************
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:31,代码来源:addcss.php

示例7: preg_replace

// Begin output
//
// postprocess
if ($stripbackground) {
    #$css = preg_replace('/(\w*?background-color.*?\:\w*?).*?(;.*?)/', '', $css);
    $css = preg_replace('/(\\w*?background-color.*?\\:\\w*?).*?(;.*?)/', '\\1transparent\\2', $css);
    $css = preg_replace('/(\\w*?background-image.*?\\:\\w*?).*?(;.*?)/', '', $css);
}
if (!isset($CMS_INSTALL_PAGE) && !isset($CMS_ADMIN_PAGE)) {
    if (!class_exists('Events')) {
        $fn = cms_join_path($config['root_path'], 'lib', 'classes', 'class.events.inc.php');
        include $fn;
    }
    $parms = array();
    $parms['content'] =& $css;
    Events::SendEvent('Core', 'ContentStylesheet', $parms);
}
if (isset($config['output_compression']) && $config['output_compression'] && $config['debug'] != true) {
    @ob_start('ob_gzhandler');
}
$max_age = (int) get_site_preference('css_max_age', 0);
header("Content-Type: text/css; charset={$encoding}");
$datestr = gmdate('D, d M Y H:i:s', $hashmtime) . ' GMT';
header("Last-Modified: " . $datestr);
if ($max_age > 0) {
    $datestr = gmdate('D, d M Y H:i:s', $hashmtime + $max_age) . ' GMT';
    header("Expires: " . $datestr);
    header("Cache-Control: must-revalidate");
    // no caching?
    //header("Cache-Control: max-age=$max_age, s-max-age=$max_age, must-revalidate");
}
开发者ID:rasomu,项目名称:chuza,代码行数:31,代码来源:stylesheet.php

示例8: ob_get_clean

                //eval('function testfunction'.rand().'() {'.$code.'}');
                $buffer = ob_get_clean();
                //add error
                $error[] = preg_replace('/<br \\/>/', '', $buffer);
                $validinfo = false;
            } else {
                ob_end_clean();
            }
        }
        if ($validinfo) {
            $new_usertag_id = $db->GenID(cms_db_prefix() . "userplugins_seq");
            Events::SendEvent('Core', 'AddUserDefinedTagPre', array('id' => $new_usertag_id, 'name' => &$plugin_name, 'code' => &$code));
            $query = "INSERT INTO " . cms_db_prefix() . "userplugins (userplugin_id, userplugin_name, code, create_date, modified_date) VALUES ({$new_usertag_id}, " . $db->qstr($plugin_name) . ", " . $db->qstr($code) . ", " . $db->DBTimeStamp(time()) . ", " . $db->DBTimeStamp(time()) . ")";
            $result = $db->Execute($query);
            if ($result) {
                Events::SendEvent('Core', 'AddUserDefinedTagPost', array('id' => $new_usertag_id, 'name' => &$plugin_name, 'code' => &$code));
                audit($new_usertag_id, $plugin_name, 'Added User Defined Tag');
                redirect("listusertags.php" . $urlext . "&message=usertagadded");
                return;
            } else {
                $error .= lang('errorinsertingtag');
            }
        }
    }
}
include_once "header.php";
if (!$access) {
    echo '<div class=\\"pageerrorcontainer\\"><p class="pageerror">' . lang('noaccessto', array(lang('addusertag'))) . '</p></div>';
} else {
    if (FALSE == empty($error)) {
        echo $themeObject->ShowErrors($error);
开发者ID:rasomu,项目名称:chuza,代码行数:31,代码来源:adduserplugin.php

示例9: Delete

 /**
  * Delete the current content object from the database.
  *
  * @todo this function should return something, or throw an exception
  */
 function Delete()
 {
     $gCms = cmsms();
     global $debug_errors;
     $config = $gCms->GetConfig();
     Events::SendEvent('Core', 'ContentDeletePre', array('content' => &$this));
     $db = $gCms->GetDb();
     $result = false;
     if (-1 > $this->mId) {
         if (true == $config["debug"]) {
             # :TODO: Translate the error message
             $debug_errors .= "<p>Could not delete content : invalid Id</p>\n";
         }
     } else {
         $query = "DELETE FROM " . cms_db_prefix() . "content WHERE content_id = ?";
         $dbresult = $db->Execute($query, array($this->mId));
         if (!$dbresult) {
             if (true == $config["debug"]) {
                 # :TODO: Translate the error message
                 $debug_errors .= "<p>Error deleting content</p>\n";
             }
         }
         // Fix the item_order if necessary
         $query = "UPDATE " . cms_db_prefix() . "content SET item_order = item_order - 1 WHERE parent_id = ? AND item_order > ?";
         $result = $db->Execute($query, array($this->ParentId(), $this->ItemOrder()));
         $cachefilename = TMP_CACHE_LOCATION . '/contentcache.php';
         @unlink($cachefilename);
         // DELETE properties
         $query = 'DELETE FROM ' . cms_db_prefix() . 'content_props WHERE content_id = ?';
         $result = $db->Execute($query, array($this->mId));
         $this->_props = null;
         // Delete additional editors.
         $query = 'DELETE FROM ' . cms_db_prefix() . 'additional_users WHERE content_id = ?';
         $result = $db->Execute($query, array($this->mId));
         $this->mAdditionalEditors = null;
         // Delete route
         if ($this->mURL != '') {
             cms_route_manager::del_static($this->mURL);
         }
     }
     Events::SendEvent('Core', 'ContentDeletePost', array('content' => &$this));
 }
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:47,代码来源:class.ContentBase.php

示例10: catch

            } catch (CmsEditContentException $e) {
                $error .= "<li>" . $e->getMessage() . "</li>";
                $validinfo = false;
            }
        }
        if ($validinfo) {
            $newtemplate = new Template();
            $newtemplate->name = $template;
            $newtemplate->content = $content;
            //$newtemplate->stylesheet = $stylesheet;
            $newtemplate->active = $active;
            $newtemplate->default = 0;
            Events::SendEvent('Core', 'AddTemplatePre', array('template' => &$newtemplate));
            $result = $newtemplate->save();
            if ($result) {
                Events::SendEvent('Core', 'AddTemplatePost', array('template' => &$newtemplate));
                // put mention into the admin log
                audit($newtemplate->id, 'HTML-template: ' . $template, 'Added');
                redirect($from);
                return;
            } else {
                $error .= "<li>" . lang('errorinsertingtemplate') . "{$query}</li>";
            }
        }
    }
}
include_once "header.php";
if (!$access) {
    //echo "<div class=\"pageerrorcontainer\"><p class=\"pageerror\">".lang('noaccessto', array(lang('addtemplate')))."</p></div>";
    $themeObject->ShowErrors(lang('noaccessto', lang('noaccessto', array(lang('addtemplate')))));
    return;
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:31,代码来源:addtemplate.php

示例11: SendEvent

 /**
  * Trigger an event.
  * This function will call all registered event handlers for the event
  *
  * @final
  * @param string The name of the event
  * @param array  The parameters associated with this event.
  * @return void
  */
 public final function SendEvent($eventname, $params)
 {
     Events::SendEvent($this->GetName(), $eventname, $params);
 }
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:13,代码来源:class.CMSModule.php

示例12: foreach

 #Perform the adduser_pre callback
 foreach ($gCms->modules as $key => $value) {
     if ($gCms->modules[$key]['installed'] == true && $gCms->modules[$key]['active'] == true) {
         $gCms->modules[$key]['object']->AddUserPre($newuser);
     }
 }
 Events::SendEvent('Core', 'AddUserPre', array('user' => &$newuser));
 $result = $newuser->save();
 if ($result) {
     #Perform the adduser_post callback
     foreach ($gCms->modules as $key => $value) {
         if ($gCms->modules[$key]['installed'] == true && $gCms->modules[$key]['active'] == true) {
             $gCms->modules[$key]['object']->AddUserPost($newuser);
         }
     }
     Events::SendEvent('Core', 'AddUserPost', array('user' => &$newuser));
     # set some default preferences, based on the user creating this user
     $adminid = get_userid();
     $userid = $newuser->id;
     set_preference($userid, 'wysiwyg', get_preference($adminid, 'wysiwyg'));
     set_preference($userid, 'default_cms_language', get_preference($adminid, 'default_cms_language'));
     set_preference($userid, 'admintheme', get_site_preference('logintheme', 'default'));
     set_preference($userid, 'bookmarks', get_preference($adminid, 'bookmarks'));
     set_preference($userid, 'recent', get_preference($adminid, 'recent'));
     if ($assign_group_perm && isset($_POST['groups'])) {
         $iquery = "insert into " . cms_db_prefix() . "user_groups (user_id,group_id) VALUES (?,?)";
         foreach ($group_list as $thisGroup) {
             if (isset($_POST['g' . $thisGroup->id]) && $_POST['g' . $thisGroup->id] == 1) {
                 $result = $db->Execute($iquery, array($userid, $thisGroup->id));
             }
         }
开发者ID:rasomu,项目名称:chuza,代码行数:31,代码来源:adduser.php

示例13: global_content_regex_callback

/**
 * A utility function to load the specified global content blocks and call the GlobalContentPrecompile method.
 *
 * @ignore
 * @access private
 * @param array Array containing the name of 1 global content block
 * @return void
 */
function global_content_regex_callback($matches)
{
    $gCms = cmsms();
    if (isset($matches[1])) {
        $gcbops =& $gCms->GetGlobalContentOperations();
        $oneblob = $gcbops->LoadHtmlBlobByName($matches[1]);
        if ($oneblob) {
            $text = $oneblob->content;
            Events::SendEvent('Core', 'GlobalContentPreCompile', array('content' => &$text));
            return $text;
        } else {
            return "<!-- Html blob '" . $matches[1] . "' does not exist  -->";
        }
    } else {
        return "<!-- Html blob has no name parameter -->";
    }
}
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:25,代码来源:content.functions.php

示例14: array

        $result = $db->Execute($query, array($userplugin_id));
        if ($result && $result->RecordCount()) {
            $row = $result->FetchRow();
            $userplugin_name = $row['userplugin_name'];
        }
        Events::SendEvent('Core', 'DeleteUserDefinedTagPre', array('id' => $userplugin_id, 'name' => &$userplugin_name));
        $query = 'SELECT event_id,handler_id,handler_order FROM ' . cms_db_prefix() . 'event_handlers 
                           WHERE tag_name = ?';
        $handlers = $db->GetArray($query, array($userplugin_name));
        if (is_array($handlers) && count($handlers) > 0) {
            $q1 = 'DELETE FROM ' . cms_db_prefix() . 'event_handlers WHERE handler_id = ?';
            $q2 = 'UPDATE ' . cms_db_prefix() . 'event_handlers SET handler_order = (handler_order - 1)
                            WHERE handler_order > ? AND event_id = ?';
            foreach ($handlers as $tmp) {
                $hid = $tmp['handler_id'];
                $eid = $tmp['event_id'];
                $db->Execute($q1, array($hid));
                $db->Execute($q2, array($tmp['handler_order'], $eid));
            }
        }
        $query = "DELETE FROM " . cms_db_prefix() . "userplugins where userplugin_id = ?";
        $result = $db->Execute($query, array($userplugin_id));
        if ($result) {
            Events::SendEvent('Core', 'DeleteUserDefinedTagPost', array('id' => $userplugin_id, 'name' => &$userplugin_name));
            // put mention into the admin log
            audit($userplugin_id, 'User Defined Tag: ' . $userplugin_name, 'Deleted');
        }
    }
}
redirect('listusertags.php' . $urlext . '&message=usertagdeleted');
# vim:ts=4 sw=4 noet
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:31,代码来源:deleteuserplugin.php

示例15: get_userid

    $userid = get_userid();
    $access = check_permission($userid, 'Remove Groups');
    # you can't delete admin group (also admin group it's the first group)
    if (!$access) {
        // no access
        redirect("listgroups.php" . $urlext);
    }
    $result = false;
    $gCms = cmsms();
    $groupops = $gCms->GetGroupOperations();
    $userops = $gCms->GetUserOperations();
    $groupobj = $groupops->LoadGroupByID($group_id);
    $group_name = $groupobj->name;
    # check to make sure we're not a member of this group
    if ($userops->UserInGroup($userid, $group_id)) {
        # can't delete a group we're a member of.
        redirect("listgroups.php" . $urlext);
    }
    // now do the work.
    Events::SendEvent('Core', 'DeleteGroupPre', array('group' => &$groupobj));
    if ($groupobj) {
        $result = $groupobj->Delete();
    }
    Events::SendEvent('Core', 'DeleteGroupPost', array('group' => &$groupobj));
    if ($result == true) {
        // put mention into the admin log
        audit($group_id, 'Admin User Group: ' . $group_name, 'Deleted');
    }
}
redirect("listgroups.php" . $urlext);
# vim:ts=4 sw=4 noet
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:31,代码来源:deletegroup.php


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