<?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; }); } }
} 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) {
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;
<?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) {