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


PHP PerchAPI::on方法代码示例

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


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

示例1: PerchAPI

<?php

if (PERCH_RUNWAY) {
    $varnish_config = PerchConfig::get('varnish');
    if ($varnish_config && $varnish_config['enabled']) {
        PerchUtil::debug("Varnish enavled!");
        $API = new PerchAPI(1.0, 'perch_varnish');
        $API->on('page.publish', function ($Event) use($API) {
            $PerchVarnish = new PerchVarnish($API);
            $PerchVarnish->purge($Event->subject);
        });
        spl_autoload_register(function ($class_name) {
            if (strpos($class_name, 'PerchVarnish') === 0) {
                include 'PerchVarnish.class.php';
                return true;
            }
            if ($class_name == 'PerchPageRoutes') {
                include PERCH_CORE . '/runway/PerchPageRoutes.class.php';
                include PERCH_CORE . '/runway/PerchPageRoute.class.php';
            }
            return false;
        });
    }
}
开发者ID:amillionmonkeys,项目名称:perchd,代码行数:24,代码来源:admin.php

示例2: perch_members_init

}
if (!defined('PERCH_MEMBERS_COOKIE')) {
    define('PERCH_MEMBERS_COOKIE', 'p_m');
}
spl_autoload_register(function ($class_name) {
    if (strpos($class_name, 'PerchMembers') === 0) {
        include __DIR__ . '/' . $class_name . '.class.php';
        return true;
    }
    return false;
});
PerchSystem::register_template_handler('PerchMembers_Template');
if (PERCH_RUNWAY) {
    $members_init = function () {
        $API = new PerchAPI(1.0, 'perch_members');
        $API->on('page.loaded', 'perch_members_init');
    };
    $members_init();
} else {
    perch_members_init();
}
function perch_members_init()
{
    perch_members_recover_session();
    perch_members_check_page_access();
}
function perch_members_form_handler($SubmittedForm)
{
    if ($SubmittedForm->validate()) {
        $API = new PerchAPI(1.0, 'perch_members');
        switch ($SubmittedForm->formID) {
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:31,代码来源:runtime.php

示例3: PerchAPI

include_once 'JwActivityLog_Actions.class.php';
include_once 'JwActivityLog_Action.class.php';
$API = new PerchAPI(1.0, 'jw_activity_log');
$Actions = new JwActivityLog_Actions($API);
/**
 * Regions
 */
$API->on('region.add_item', function (PerchSystemEvent $Event) use($Actions) {
    $data = array();
    $user = $Event->user->to_array();
    $subject = $Event->subject->to_array();
    $data['actionKey'] = $Event->event;
    $data['userAccountID'] = $user['userID'];
    $data['userAccountData'] = $user;
    $data['resourceType'] = LOG_REGION_TYPE;
    $data['resourceID'] = $subject['regionID'];
    $data['resourceTitle'] = $subject['regionKey'];
    $data['resourceModification'] = $subject['regionHTML'];
    // Save
    $Actions->create($data);
    // Debug
    PerchUtil::debug('Inserting new action log data:');
    PerchUtil::debug($data);
});
$API->on('region.publish', function (PerchSystemEvent $Event) use($Actions) {
    $data = array();
    $user = $Event->user->to_array();
    $subject = $Event->subject->to_array();
    $data['actionKey'] = $Event->event;
    $data['userAccountID'] = $user['userID'];
    $data['userAccountData'] = $user;
开发者ID:drewm,项目名称:Perch-Activity-Log,代码行数:31,代码来源:listeners.php

示例4: perch_blog_form_handler

<?php

spl_autoload_register(function ($class_name) {
    if (strpos($class_name, 'PerchBlog') === 0) {
        include __DIR__ . '/' . $class_name . '.class.php';
        return true;
    }
    return false;
});
PerchSystem::register_search_handler('PerchBlog_SearchHandler');
if (PERCH_RUNWAY) {
    $blog_init = function () {
        $API = new PerchAPI(1.0, 'perch_blog');
        $API->on('page.loaded', 'perch_blog_check_preview');
    };
    $blog_init();
} else {
    perch_blog_check_preview();
}
function perch_blog_form_handler($SubmittedForm)
{
    if ($SubmittedForm->formID == 'comment' && $SubmittedForm->validate()) {
        $API = new PerchAPI(1.0, 'perch_blog');
        $Comments = new PerchBlog_Comments($API);
        $Comments->receive_new_comment($SubmittedForm);
    }
    $Perch = Perch::fetch();
    PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}
function perch_blog_recent_posts($count = 10, $return_or_opts = false, $return = false)
{
开发者ID:jimcurran,项目名称:bdmusichub,代码行数:31,代码来源:runtime.php


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