Example #1
0
     */
    public static function thisURI($fullPath = true)
    {
        return ($fullPath ? SITE_BASEURL : '') . strtr($_SERVER['REQUEST_URI'], array('<' => '%3C', '>' => '%3E', '"' => '%22', '\'' => '%27'));
    }
}
if (function_exists('add_gobe_callback')) {
    global $__WebPage;
    $__WebPage = new WebPage();
    // Miscellaneous
    add_gobe_callback('page', 'thisuri', array('WebPage', 'thisURI'));
    add_gobe_callback('page', 'select-options', array('WebPage', 'generateSelectOptions'));
    // Titles
    add_gobe_callback('page', 'site-title', array('WebPage', 'getSiteTitle'));
    add_gobe_callback('page', 'page-title', array($__WebPage, 'getPageTitle'));
    add_gobe_callback('page', 'set-title', array($__WebPage, 'setPageTitle'));
    // Meta
    add_gobe_callback('page', 'meta-includes', array('WebPage', 'metaList'));
    add_gobe_callback('include', 'meta', array('WebPage', 'metaInclude'));
    // CSS
    add_gobe_callback('page', 'css-includes', array('WebPage', 'cssList'));
    add_gobe_callback('page', 'css-title', array('WebPage', 'cssTitle'));
    add_gobe_callback('page', 'css-media', array('WebPage', 'cssMedia'));
    add_gobe_callback('include', 'css', array('WebPage', 'cssInclude'));
    // Javascript
    add_gobe_callback('page', 'javascript-includes', array('WebPage', 'javascriptList'));
    add_gobe_callback('include', 'javascript', array('WebPage', 'javascriptInclude'));
    // Rels
    add_gobe_callback('page', 'set-rel', array($__WebPage, 'setRel'));
    add_gobe_callback('page', 'get-rel', array($__WebPage, 'getRel'));
}
Example #2
0
        return $lvalue == $rvalue ? $trueCase : $falseCase;
    }
    public static function neq($lvalue, $rvalue, $trueCase, $falseCase = '')
    {
        return $lvalue != $rvalue ? $trueCase : $falseCase;
    }
    public static function gt($lvalue, $rvalue, $trueCase, $falseCase = '')
    {
        return $lvalue == $rvalue ? $trueCase : $falseCase;
    }
    public static function gte($lvalue, $rvalue, $trueCase, $falseCase = '')
    {
        return $lvalue >= $rvalue ? $trueCase : $falseCase;
    }
    public static function lt($lvalue, $rvalue, $trueCase, $falseCase = '')
    {
        return $lvalue < $rvalue ? $trueCase : $falseCase;
    }
    public static function lte($lvalue, $rvalue, $trueCase, $falseCase = '')
    {
        return $lvalue <= $rvalue ? $trueCase : $falseCase;
    }
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback('ternary', 'eq', array('Ternary', 'eq'));
    add_gobe_callback('ternary', 'neq', array('Ternary', 'neq'));
    add_gobe_callback('ternary', 'gt', array('Ternary', 'gt'));
    add_gobe_callback('ternary', 'gte', array('Ternary', 'gte'));
    add_gobe_callback('ternary', 'lt', array('Ternary', 'lt'));
    add_gobe_callback('ternary', 'lte', array('Ternary', 'lte'));
}
Example #3
0
    }
    public static function blockServer($domains)
    {
        self::$blockedServers = array_merge(self::$blockedServers, (array) $domains);
    }
    public static function blockUser($ips)
    {
        self::$blockedUsers = array_merge(self::$blockedUsers, (array) $ips);
    }
    private static function getTemplate($template)
    {
        if (empty($template)) {
            $template = self::DEFAULT_TEMPLATE;
        }
        $template .= self::TEMPLATE_EXTENSION;
        return file_get_contents(PATH_TEMPLATES_STUBS . self::TEMPLATE_PATH . $template);
    }
    private static function format($template, $id)
    {
        $goat = new goat();
        $goat->register_variable("id", $id);
        return $goat->parse($template);
    }
    public static function isBlocked()
    {
        return !in_array($_SERVER['SERVER_ADDR'], self::$blockedServers) && !in_array($_SERVER['HTTP_HOST'], self::$blockedServers) && !in_array($_SERVER['REMOTE_ADDR'], self::$blockedUsers);
    }
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback('web', 'analytics', array('Analytics', 'build'));
}
Example #4
0
    {
        return Format::text2links($data);
    }
    private static function fieldFormaterDate($data)
    {
        return date(STD_DATETIME_COMPACT, ctype_digit($data) ? $data : strtotime($data));
    }
    private static function getSource($source)
    {
        return str_replace("{domain}", $_SERVER['HTTP_HOST'], $source);
    }
    private static function getTemplate($template, $format)
    {
        $basePath = PATH_TEMPLATES_STUBS . self::TEMPLATE_PATH;
        // No template provided, try to get format specific first
        if ($template == false) {
            $template = file_exists($basePath . $format . self::TEMPLATE_EXTENSION) ? $format : self::DEFAULT_TEMPLATE;
            $template .= self::TEMPLATE_EXTENSION;
        }
        // Add the default extension if the file doesn't exist as specified
        if (!file_exists($basePath . $template)) {
            $template .= self::TEMPLATE_EXTENSION;
        }
        return file_get_contents($basePath . $template);
    }
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback('aggregate', 'rss', array('Aggregate', 'rss'));
    add_gobe_callback('aggregate', 'atom', array('Aggregate', 'atom'));
    add_gobe_callback('aggregate', 'twitter', array('Aggregate', 'twitter'));
}
Example #5
0
        } else {
            $this->content[$pane][] = $content;
        }
        return '';
    }
    public function display($pane, $truncate = false)
    {
        $content = parse_gobe_goat((isset($this->content[$pane]) ? implode("\n", $this->content[$pane]) : '') . (isset($this->delayedContent[$pane]) ? implode("\n", $this->delayedContent[$pane]) : ''));
        if ($truncate) {
            $this->remove($pane);
        }
        return $content;
    }
    public function remove($pane = null)
    {
        if (!is_null($pane)) {
            unset($this->content[$pane]);
            unset($this->delayedContent[$pane]);
        } else {
            $this->content = array();
            $this->delayedContent = array();
        }
    }
}
if (function_exists('add_gobe_callback')) {
    global $__ContentStub;
    $__ContentStub = new ContentStub();
    add_gobe_callback('content', 'display', array($__ContentStub, 'display'));
    add_gobe_callback('content', 'add', array($__ContentStub, 'add'));
    add_gobe_callback('content', 'remove', array($__ContentStub, 'remove'));
}
Example #6
0
 * @author Andrew Murphy <*****@*****.**>
 * @author Justin Johnson <johnsonj>
 * @version 1.2.0 20080318 AM
 * @version 1.0.0 20080211 AM
 * 
 * @package zk.modules.xsl
 */
register_gobe_debug_load_module('Loading gomo.xsl');
function xsl_transform_feed($feedUrl, $xslPath)
{
    $doc = new DOMDocument();
    $xsl = new XSLTProcessor();
    $doc->load(parse_path($xslPath));
    $xsl->importStyleSheet($doc);
    $doc->loadXML(file_get_contents(parse_path($feedUrl)));
    $xsl->registerPHPFunctions(array('xsl_counter'));
    return $xsl->transformToXML($doc);
}
function xsl_counter($index)
{
    static $list = array();
    if (isset($list[$index])) {
        $list[$index]++;
    } else {
        $list[$index] = 1;
    }
    return $list[$index];
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback('xsl', 'transform_feed', 'xsl_transform_feed');
}
Example #7
0
class NavigationSelector
{
    private $classResponse;
    private $selections;
    public function __construct($classResponse = 'selected')
    {
        $this->setClassResponse($classResponse);
        $this->selections = array();
    }
    public function setTeirSelection($teir, $selectedItem)
    {
        $this->selections[$teir] = $selectedItem;
        return '';
    }
    public function getTeirSelection($teir, $itemComparison, $classResponse = null)
    {
        return isset($this->selections[$teir]) && $this->selections[$teir] == $itemComparison ? !empty($classResponse) ? $classResponse : $this->classResponse : '';
    }
    public function setClassResponse($classResponse)
    {
        $this->classResponse = $classResponse;
        return '';
    }
}
if (function_exists('add_gobe_callback')) {
    global $__NavigationSelector;
    $__NavigationSelector = new NavigationSelector();
    add_gobe_callback('navigation', 'set-class-response', array($__NavigationSelector, 'setClassResponse'));
    add_gobe_callback('navigation', 'set-teir-selection', array($__NavigationSelector, 'setTeirSelection'));
    add_gobe_callback('navigation', 'get-teir-selection', array($__NavigationSelector, 'getTeirSelection'));
}
Example #8
0
 * @package zk.modules.debug
 */
class Debug
{
    /**
     * @abstract The standard var_dump() wrapped in <pre>.
     * @params mixed An number of variables can be passed.
     */
    public static function var_dump()
    {
        echo "<pre>";
        var_dump(func_get_args());
        echo "</pre>";
    }
    /**
     * @abstract The standard print_r() wrapped in <pre>.
     * @params mixed An number of variables can be passed.
     */
    public static function print_r()
    {
        echo "<pre>";
        foreach (func_get_args() as $arg) {
            echo print_r($arg, true), "\n";
        }
        echo "</pre>";
    }
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback('debug', 'dump', array('Debug', 'var_dump'));
    add_gobe_callback('debug', 'print', array('Debug', 'print'));
}
Example #9
0
            $path = substr($path, 0, -1);
        }
    }
    return $path;
}
function set_path($path, $value)
{
    return handle_paths(HANDLE_SET, array($path, $value));
}
//Note: assumes no end slash
function parse_path($str)
{
    return preg_replace_callback("/%([^\\s]+)%/i", "callback_parse_path", $str);
}
function callback_parse_path($matches)
{
    if (count($matches) < 2) {
        return "";
    }
    return get_path($matches[1]);
}
function infolder($needle, $haystack)
{
    $haystack = pathinfo($haystack, PATHINFO_DIRNAME);
    return strpos($haystack, $needle) !== false;
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback("path", "set", "set_path");
    add_gobe_callback("path", "get", "get_path");
    add_gobe_callback("path", "parse", "\t");
}
Example #10
0
        return false;
    }
    /**
     * @abstract Add a breadcrumb to the list.
     * @param string The URL for the breadcrumb. If $url is empty or '#', then 
     * Breadcrumbs::TMPL_LAST will be used to format the link; otherwise, Breadcrumbs::TMPL_NORM will be used.
     * @param $innerHTML The displayed/clickable link.
     * @param string $title Optional. The value for the title attribute of the link (default: ''). Ignored if
     * $url is empty.
     * @return string Returns an empty string for us in GOAT callbacks.
     */
    public static function add($url, $innerHTML, $title = '')
    {
        $url = trim($url);
        // Add this breadcrumb
        Breadcrumbs::handler(HANDLE_ADD, array($url == '#' || empty($url) ? false : $url, htmlentities($innerHTML, ENT_QUOTES), str_replace('"', '', $title)));
        return '';
    }
    /**
     * @abstract Constructs the breadcrumbs output.
     * @return string The formatted breadcrumbs separated by Breadcrumbs::TMPL_SPACER.
     */
    public static function build()
    {
        return implode(Breadcrumbs::TMPL_SPACER, Breadcrumbs::handler(HANDLE_GET));
    }
}
if (function_exists('add_gobe_callback')) {
    add_gobe_callback('breadcrumbs', 'display', array('Breadcrumbs', 'build'));
    add_gobe_callback('breadcrumbs', 'add', array('Breadcrumbs', 'add'));
}