Esempio n. 1
0
<?php

PerchSystem::register_search_handler('PerchEvents_SearchHandler');
require 'PerchEvents_Events.class.php';
require 'PerchEvents_Event.class.php';
require 'PerchEvents_Categories.class.php';
require 'PerchEvents_Category.class.php';
require 'PerchEvents_DisplayCalendar.class.php';
require 'PerchEvents_DisplayListing.class.php';
require 'PerchEvents_SearchHandler.class.php';
require 'PerchEvents_Cache.class.php';
function perch_events_calendar($opts = false, $return = false)
{
    $year = date('Y');
    $month = date('m');
    if (isset($_GET['d']) && $_GET['d'] != '') {
        $date = explode('-', $_GET['d']);
        if (isset($date[0])) {
            $year = (int) $date[0];
        }
        if (isset($date[1])) {
            $month = (int) $date[1];
        }
    }
    $API = new PerchAPI(1.0, 'perch_events');
    $Events = new PerchEvents_Events($API);
    $r = $Events->get_display('calendar', $month, $year, $opts);
    if ($return) {
        return $r;
    }
    echo $r;
Esempio n. 2
0
<?php

PerchSystem::register_search_handler('PerchMailchimp_SearchHandler');
require 'PerchMailchimp_Campaigns.class.php';
require 'PerchMailchimp_Campaign.class.php';
require 'PerchMailchimp_Subscribers.class.php';
require 'PerchMailchimp_Subscriber.class.php';
require 'PerchMailchimp_SearchHandler.class.php';
require 'MailChimp.class.php';
function perch_mailchimp_form_handler($SubmittedForm)
{
    if ($SubmittedForm->validate()) {
        $API = new PerchAPI(1.0, 'perch_mailchimp');
        $Subscribers = new PerchMailchimp_Subscribers($API);
        $Subscribers->subscribe_from_form($SubmittedForm);
    }
    $Perch = Perch::fetch();
    PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}
/**
 * Display a form, e.g. a subscribe form
 * @param  [type]  $template [description]
 * @param  array   $content  [description]
 * @param  boolean $return   [description]
 * @return [type]            [description]
 */
function perch_mailchimp_form($template, $content = array(), $return = false)
{
    $API = new PerchAPI(1.0, 'perch_mailchimp');
    $Template = $API->get('Template');
    $Template->set('mailchimp' . DIRECTORY_SEPARATOR . $template, 'mailchimp');
Esempio n. 3
0
<?php

include __DIR__ . '/lib/vendor/autoload.php';
spl_autoload_register(function ($class_name) {
    if (strpos($class_name, 'RootLocator') === 0) {
        include PERCH_PATH . '/addons/apps/root_locator/lib/' . $class_name . '.class.php';
        return true;
    }
    return false;
});
// Search Handler
PerchSystem::register_search_handler('RootLocator_SearchHandler');
/**
 * Shortcut to output detail for single address
 *
 * @param int     $id
 * @param bool $return
 *
 * @return void|array
 */
function root_locator_address($id, $return = false)
{
    $options = ['template' => 'address.html', '_id' => (int) $id];
    if ($return) {
        return root_locator_get_custom($options, true);
    }
    root_locator_get_custom($options);
}
/**
 * Output data from single field
 *
Esempio n. 4
0
<?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)
{
Esempio n. 5
0
<?php

spl_autoload_register(function ($class_name) {
    if (strpos($class_name, 'PerchContent') === 0) {
        include PERCH_CORE . '/apps/content/' . $class_name . '.class.php';
        return true;
    }
    return false;
});
PerchSystem::register_search_handler('PerchContent_SearchHandler');
if (PERCH_RUNWAY) {
    include PERCH_CORE . '/runway/apps/content/runtime.php';
} else {
    perch_content_check_preview();
}
function perch_content($key = false, $return = false)
{
    if ($key === false) {
        echo 'You must pass in a <em>name</em> for the content. e.g. <code style="color: navy;background: white;">&lt;' . '?php perch_content(\'Phone number\'); ?' . '&gt;</code>';
    }
    $Content = PerchContent::fetch();
    $out = $Content->get($key);
    // Post processing - if there are still <perch:x /> tags
    if (strpos($out, '<perch:') !== false) {
        $Template = new PerchTemplate();
        $out = $Template->apply_runtime_post_processing($out);
    }
    if ($return) {
        return $out;
    }
    echo $out;