本文整理汇总了PHP中Kurogo::includePackage方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::includePackage方法的具体用法?PHP Kurogo::includePackage怎么用?PHP Kurogo::includePackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::includePackage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
public static function factory($parserClass, $args)
{
Kurogo::log(LOG_DEBUG, "Initializing DataParser {$parserClass}", "data");
if (isset($args['PACKAGE'])) {
Kurogo::includePackage($args['PACKAGE']);
}
if (!class_exists($parserClass)) {
throw new KurogoConfigurationException("Parser class {$parserClass} not defined");
}
$parser = new $parserClass();
if (!$parser instanceof DataParser) {
throw new KurogoConfigurationException("{$parserClass} is not a subclass of DataParser");
}
$parser->init($args);
return $parser;
}
示例2: connection
<?php
/**
* @package Core
*/
Kurogo::includePackage('db');
class KurogoStats
{
private $conn;
private static function connection()
{
static $conn;
if (!$conn) {
$conn = SiteDB::connection();
}
return $conn;
}
static $pagetypes = array('tablet' => 'Tablet', 'compliant' => 'Compliant', 'touch' => 'Touch', 'basic' => 'Basic');
static $platforms = array('iphone' => 'iPhone', 'android' => 'Android', 'webos' => 'webOS', 'winmo' => 'Windows Mobile', 'blackberry' => 'BlackBerry', 'bbplus' => 'Advanced BlackBerry', 'symbian' => 'Symbian', 'palmos' => 'Palm OS', 'featurephone' => 'Other Phone', 'computer' => 'Computer');
private static function setVisitCookie($visitID = null)
{
if (empty($visitID)) {
$visitID = md5(uniqid(rand(), true));
}
setCookie('visitID', $visitID, time() + Kurogo::getOptionalSiteVar('KUROGO_VISIT_LIFESPAN', 1800), COOKIE_PATH);
return $visitID;
}
private static function isFromThisSite($url)
{
if (empty($url)) {
return false;
示例3: setPageVariables
//.........这里部分代码省略.........
Kurogo::log(LOG_DEBUG, "Returned from initializeForPage for {$this->configModule} - {$this->page}", 'module');
}
}
// Set variables for each page
$this->assign('pageTitle', $this->pageTitle);
// Variables which may have been modified by the module subclass
$this->assign('inlineCSSBlocks', $this->inlineCSSBlocks);
$this->assign('cssURLs', $this->cssURLs);
$this->assign('inlineJavascriptBlocks', $this->inlineJavascriptBlocks);
$this->assign('onOrientationChangeBlocks', $this->onOrientationChangeBlocks);
$this->assign('onLoadBlocks', $this->onLoadBlocks);
$this->assign('inlineJavascriptFooterBlocks', $this->inlineJavascriptFooterBlocks);
$this->assign('javascriptURLs', $this->javascriptURLs);
$this->assign('breadcrumbs', $this->breadcrumbs);
$this->assign('breadcrumbArgs', $this->getBreadcrumbArgs());
$this->assign('breadcrumbSamePageArgs', $this->getBreadcrumbArgs(false));
$this->assign('moduleDebugStrings', $this->moduleDebugStrings);
$this->assign('webBridgeOnPageLoadParams', KurogoWebBridge::getOnPageLoadParams($this->pageTitle, $this->breadcrumbTitle, $this->hasWebBridgePageRefresh));
$this->assign('webBridgeConfig', KurogoWebBridge::getServerConfig($this->configModule, $this->page, $this->args));
$moduleStrings = $this->getOptionalModuleSection('strings');
$this->assign('moduleStrings', $moduleStrings);
$this->assign('homeLink', $this->buildURLForModule($this->getHomeModuleID(), '', array()));
$this->assign('homeModuleID', $this->getHomeModuleID());
$this->assignLocalizedStrings();
if ($this->page == 'help') {
// Module Help
$this->assign('hasHelp', false);
$template = 'common/templates/' . $this->page;
} else {
if ($this->page == '__nativeWebTemplates') {
$template = 'common/templates/staticContent';
} else {
if (KurogoWebBridge::useWrapperPageTemplate()) {
// Web bridge page wrapper
$template = 'common/templates/webBridge';
$this->assign('webBridgeJSLocalizedStrings', json_encode(Kurogo::getLocalizedStrings()));
} else {
$this->assign('hasHelp', isset($moduleStrings['help']));
$this->assign('helpLink', $this->buildBreadcrumbURL('help', array()));
$this->assign('helpLinkText', $this->getLocalizedString('HELP_TEXT', $this->getModuleName()));
$template = 'modules/' . $this->templateModule . '/templates/' . $this->templatePage;
}
}
}
Kurogo::log(LOG_DEBUG, "Template file is {$template}", 'module');
// Pager support
if (isset($this->htmlPager)) {
$this->assign('pager', $this->getPager());
}
// Tab support
if (isset($this->tabbedView)) {
$this->assign('tabbedView', $this->tabbedView);
}
$this->assign('imageExt', $this->imageExt);
$this->assign($this->getThemeVars());
// Access Key Start
$accessKeyStart = count($this->breadcrumbs);
if ($this->configModule != $this->getHomeModuleID()) {
$accessKeyStart++;
// Home link
}
$this->assign('accessKeyStart', $accessKeyStart);
if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
Kurogo::includePackage('Authentication');
$this->setCacheMaxAge(0);
$session = $this->getSession();
$this->assign('session', $session);
$this->assign('session_isLoggedIn', $this->isLoggedIn());
$this->assign('showLogin', Kurogo::getSiteVar('AUTHENTICATION_ENABLED') && $this->showLogin());
if ($this->isLoggedIn()) {
$user = $session->getUser();
$authority = $user->getAuthenticationAuthority();
$this->assign('session_userID', $user->getUserID());
$this->assign('session_fullName', $user->getFullname());
if (count($session->getUsers()) == 1) {
$this->assign('session_logout_url', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array('authority' => $user->getAuthenticationAuthorityIndex())));
$this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), '', array()));
$this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_SINGLE', $authority->getAuthorityTitle(), $user->getFullName()));
$this->assign('footerLoginClass', $authority->getAuthorityClass());
} else {
$this->assign('footerLoginClass', 'login_multiple');
$this->assign('session_logout_url', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array()));
$this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array()));
$this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_MULTIPLE'));
}
if ($session_max_idle = intval(Kurogo::getOptionalSiteVar('AUTHENTICATION_IDLE_TIMEOUT', 0))) {
$this->setRefresh($session_max_idle + 2);
}
} else {
$this->assign('footerLoginClass', 'noauth');
$this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), '', array()));
$this->assign('footerLoginText', $this->getLocalizedString('SIGN_IN_SITE', Kurogo::getSiteString('SITE_NAME')));
}
}
/* set cache age. Modules that present content that rarely changes can set this value
to something higher */
header(sprintf("Cache-Control: max-age=%d", $this->cacheMaxAge));
header("Expires: " . gmdate('D, d M Y H:i:s', time() + $this->cacheMaxAge) . ' GMT');
return $template;
}
示例4: __construct
<?php
// classes in here are required for unserialization
Kurogo::includePackage('Maps', 'KML');
Kurogo::includePackage('Maps', 'Shapefile');
class MapSearch extends DataRetriever
{
protected $searchResults;
protected $resultCount;
protected $feeds;
protected $feedGroup;
protected $searchParams;
protected $searchMode;
const SEARCH_MODE_TEXT = 0;
const SEARCH_MODE_NEARBY = 1;
public function __construct($feeds)
{
$this->setFeedData($feeds);
}
public function setFeedData($feeds)
{
$this->feeds = $feeds;
}
public function init($args)
{
parent::init($args);
$this->setCacheGroup(get_class($this));
}
public function setFeedGroup($feedGroup)
{
$this->feedGroup = $feedGroup;
示例5: factory
/**
*
* Initializes an authentication authority object
* @param string $authorityClass the name of the class to instantiate. Must be a subclass of AuthenticationAuthority
* @param array $args an associative array of arguments. Argument values depend on the authority
* @return AuthenticationAuthority
* @see AuthenticationAuthority::init()
*/
public static function factory($authorityClass, $args)
{
if (isset($args['PACKAGE'])) {
Kurogo::includePackage($args['PACKAGE']);
}
if (!class_exists($authorityClass) || !is_subclass_of($authorityClass, 'AuthenticationAuthority')) {
throw new KurogoConfigurationException("Invalid authentication class {$authorityClass}");
}
$authority = new $authorityClass();
$authority->init($args);
return $authority;
}
示例6: cleanContent
<?php
/*
* Copyright © 2010 - 2012 Modo Labs Inc. All rights reserved.
*
* The license governing the contents of this file is located in the LICENSE
* file located at the root directory of this distribution. If the LICENSE file
* is missing, please contact sales@modolabs.com.
*
*/
Kurogo::includePackage('News');
class AthleticsAPIModule extends APIModule
{
protected $id = 'athletics';
protected $vmin = 1;
protected $vmax = 1;
protected $imageExt = ".png";
protected static $defaultEventModel = 'AthleticEventsDataModel';
protected static $defaultNewsModel = 'NewsDataModel';
protected $maxPerPage = 10;
protected $feeds;
protected $navFeeds;
protected function cleanContent($content)
{
//deal with pre tags. strip out pre tags and add <br> for newlines
$bits = preg_split('#(<pre.*?' . '>)(.*?)(</pre>)#s', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
$content = array_shift($bits);
$i = 0;
while ($i < count($bits)) {
$tag = $bits[$i++];
$content .= nl2br($bits[$i++]);
示例7: getContactGroup
<?php
Kurogo::includePackage('People');
class PeopleAPIModule extends APIModule
{
protected $id = 'people';
protected $vmin = 1;
protected $vmax = 1;
private $fieldConfig;
protected $contactGroups = array();
protected function getContactGroup($group)
{
if (!$this->contactGroups) {
$this->contactGroups = $this->getModuleSections('api-contacts-groups');
}
if (isset($this->contactGroups[$group])) {
if (!isset($this->contactGroups[$group]['contacts'])) {
$this->contactGroups[$group]['contacts'] = $this->getModuleSections('api-contacts-' . $group);
}
if (!isset($this->contactGroups[$group]['description'])) {
$this->contactGroups[$group]['description'] = '';
}
return $this->contactGroups[$group];
} else {
throw new KurogoConfigurationException("Unable to find contact group information for {$group}");
}
}
private function formatPerson($person)
{
$result = array();
foreach ($this->fieldConfig as $fieldID => $fieldOptions) {
示例8: array
<?php
/*
* Copyright © 2010 - 2012 Modo Labs Inc. All rights reserved.
*
* The license governing the contents of this file is located in the LICENSE
* file located at the root directory of this distribution. If the LICENSE file
* is missing, please contact sales@modolabs.com.
*
*/
/**
* @package Authentication
*/
Kurogo::includePackage('Authentication');
/**
* @package Authentication
*/
abstract class Session
{
const SESSION_GC_TIME = 21600;
const TOKEN_COOKIE = 'lt';
const USERHASH_COOKIE = 'lh';
const API_TOKEN_COOKIE = 'alt';
const API_USERHASH_COOKIE = 'alh';
protected $session_id;
protected $users = array();
protected $login_token;
protected $maxIdleTime = 0;
protected $remainLoggedIn = false;
protected $remainLoggedInTime = 0;
protected $loginCookiePath;
示例9: define
<?php
define('MILES_PER_METER', 0.000621371192);
define('FEET_PER_METER', 3.2808399);
define('GEOGRAPHIC_PROJECTION', 4326);
define('EARTH_RADIUS_IN_METERS', 6378100);
define('EARTH_METERS_PER_DEGREE', 111319);
// very very rough
define('MAP_CATEGORY_DELIMITER', ':');
Kurogo::includePackage('Maps', 'Abstract');
Kurogo::includePackage('Maps', 'Base');
// http://en.wikipedia.org/wiki/Great-circle_distance
// chosen for what the page said about numerical accuracy
// but in practice the other formulas, i.e.
// law of cosines and haversine
// all yield pretty similar results
function greatCircleDistance($fromLat, $fromLon, $toLat, $toLon)
{
$radiansPerDegree = M_PI / 180.0;
$y1 = $fromLat * $radiansPerDegree;
$x1 = $fromLon * $radiansPerDegree;
$y2 = $toLat * $radiansPerDegree;
$x2 = $toLon * $radiansPerDegree;
$dx = $x2 - $x1;
$cosDx = cos($dx);
$cosY1 = cos($y1);
$sinY1 = sin($y1);
$cosY2 = cos($y2);
$sinY2 = sin($y2);
$leg1 = $cosY2 * sin($dx);
$leg2 = $cosY1 * $sinY2 - $sinY1 * $cosY2 * $cosDx;
示例10: arrayFromVideo
<?php
Kurogo::includePackage('Video');
class VideoAPIModule extends APIModule
{
protected $id = 'video';
// this affects which .ini is loaded
protected $vmin = 1;
protected $vmax = 1;
protected $feeds = array();
protected function arrayFromVideo($video)
{
return array("id" => $video->getID(), "title" => $video->getTitle(), "description" => strip_tags($video->getDescription()), "author" => $video->getAuthor(), "published" => $video->getPublished(), "date" => $video->getPublished()->format('M n, Y'), "url" => $video->getURL(), "image" => $video->getImage(), "width" => $video->getWidth(), "height" => $video->getHeight(), "duration" => $video->getDuration(), "tags" => $video->getTags(), "mobileURL" => $video->getMobileURL(), "streamingURL" => $video->getStreamingURL(), "stillFrameImage" => $video->getStillFrameImage());
}
protected function getFeed($feed = null)
{
$feed = isset($this->feeds[$feed]) ? $feed : $this->getDefaultSection();
$feedData = $this->feeds[$feed];
$controller = DataController::factory($feedData['CONTROLLER_CLASS'], $feedData);
return $controller;
}
protected function getDefaultSection()
{
return key($this->feeds);
}
public function initializeForCommand()
{
$this->feeds = $this->loadFeedData();
switch ($this->command) {
case 'sections':
$this->setResponse(VideoModuleUtils::getSectionsFromFeeds($this->feeds));
示例11: isManual
<?php
/*
* Copyright © 2010 - 2013 Modo Labs Inc. All rights reserved.
*
* The license governing the contents of this file is located in the LICENSE
* file located at the root directory of this distribution. If the LICENSE file
* is missing, please contact sales@modolabs.com.
*
*/
Kurogo::includePackage('UserContext');
class UserContext
{
const CONTEXT_DEFAULT = '*';
const RESOLUTION_TYPE_AUTO = 'auto';
const RESOLUTION_TYPE_MANUAL = 'manual';
protected $id;
protected $title;
protected $description;
protected $rule;
protected $active;
public function isManual()
{
return $this->rule->getResolution() == self::RESOLUTION_TYPE_MANUAL;
}
public function isAuto()
{
return $this->rule->getResolution() == self::RESOLUTION_TYPE_AUTO;
}
public function getContextArgs()
{
示例12: getFeed
<?php
Kurogo::includePackage('Photos');
class PhotosAPIModule extends APIModule
{
protected $id = 'photos';
protected $vmin = 1;
protected $vmax = 1;
protected $feeds = array();
protected function getFeed($feed)
{
if (!isset($this->feeds[$feed])) {
throw new KurogoException(get_class($this) . ": Invalid Album id: {$feed}");
return false;
}
$feedData = $this->feeds[$feed];
$modelClass = isset($feedData['MODEL_CLASS']) ? $feedData['MODEL_CLASS'] : 'PhotosDataModel';
$controller = DataModel::factory($modelClass, $feedData);
return $controller;
}
public function initializeForCommand()
{
// don't know how to use version?
$this->setResponseVersion(1);
$this->feeds = $this->loadFeedData();
switch ($this->command) {
case 'albums':
// get albums, output all available feeds
$albums = array();
foreach ($this->feeds as $id => $feed) {
$id = $feed['INDEX'];
示例13: setPageVariables
private function setPageVariables()
{
$this->loadTemplateEngineIfNeeded();
$this->loadPageConfig();
// Set variables common to all modules
$this->assign('moduleID', $this->id);
$this->assign('configModule', $this->configModule);
$this->assign('templateModule', $this->templateModule);
$this->assign('moduleName', $this->moduleName);
$this->assign('page', $this->page);
$this->assign('isModuleHome', $this->page == 'index');
$this->assign('request_uri', $_SERVER['REQUEST_URI']);
$this->assign('hideFooterLinks', $this->hideFooterLinks);
$this->assign('ajaxContentLoad', $this->ajaxContentLoad);
$this->assign('charset', Kurogo::getCharset());
// Font size for template
$this->assign('fontsizes', $this->fontsizes);
$this->assign('fontsize', $this->fontsize);
$this->assign('fontsizeCSS', $this->getFontSizeCSS());
$this->assign('fontSizeURLs', $this->getFontSizeURLs());
// Minify URLs
$this->assign('minify', $this->getMinifyUrls());
// Google Analytics. This probably needs to be moved
if ($gaID = Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_ID')) {
$this->assign('GOOGLE_ANALYTICS_ID', $gaID);
$this->assign('GOOGLE_ANALYTICS_DOMAIN', Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_DOMAIN'));
$this->assign('gaImageURL', $this->googleAnalyticsGetImageUrl($gaID));
}
// Percent Mobile Analytics
if ($pmID = Kurogo::getOptionalSiteVar('PERCENT_MOBILE_ID')) {
$this->assign('PERCENT_MOBILE_ID', $pmID);
$pmBASEURL = "http://assets.percentmobile.com/percent_mobile.js";
$this->assign('PERCENT_MOBILE_URL', $pmBASEURL);
//$this->assign('pmImageURLJS', $this->percentMobileAnalyticsGetImageUrlJS($pmID));
$this->assign('pmImageURL', $this->percentMobileAnalyticsGetImageUrl($pmID));
}
// Breadcrumbs
$this->loadBreadcrumbs();
// Tablet module nav list
if ($this->pagetype == 'tablet' && $this->page != 'pane') {
$this->addInternalJavascript('/common/javascript/lib/iscroll-4.0.js');
$this->assign('moduleNavList', $this->getModuleNavlist());
}
Kurogo::log(LOG_DEBUG, "Calling initializeForPage for {$this->configModule} - {$this->page}", 'module');
$this->initializeForPage();
//subclass behavior
Kurogo::log(LOG_DEBUG, "Returned from initializeForPage for {$this->configModule} - {$this->page}", 'module');
// Set variables for each page
$this->assign('pageTitle', $this->pageTitle);
// Variables which may have been modified by the module subclass
$this->assign('inlineCSSBlocks', $this->inlineCSSBlocks);
$this->assign('cssURLs', $this->cssURLs);
$this->assign('inlineJavascriptBlocks', $this->inlineJavascriptBlocks);
$this->assign('onOrientationChangeBlocks', $this->onOrientationChangeBlocks);
$this->assign('onLoadBlocks', $this->onLoadBlocks);
$this->assign('inlineJavascriptFooterBlocks', $this->inlineJavascriptFooterBlocks);
$this->assign('javascriptURLs', $this->javascriptURLs);
$this->assign('breadcrumbs', $this->breadcrumbs);
$this->assign('breadcrumbArgs', $this->getBreadcrumbArgs());
$this->assign('breadcrumbSamePageArgs', $this->getBreadcrumbArgs(false));
$this->assign('moduleDebugStrings', $this->moduleDebugStrings);
$moduleStrings = $this->getOptionalModuleSection('strings');
$this->assign('moduleStrings', $moduleStrings);
$this->assign('homeLink', $this->buildURLForModule($this->getHomeModuleID(), '', array()));
$this->assign('homeModuleID', $this->getHomeModuleID());
$this->assignLocalizedStrings();
// Module Help
if ($this->page == 'help') {
$this->assign('hasHelp', false);
$template = 'common/templates/' . $this->page;
} else {
$this->assign('hasHelp', isset($moduleStrings['help']));
$this->assign('helpLink', $this->buildBreadcrumbURL('help', array()));
$this->assign('helpLinkText', $this->getLocalizedString('HELP_TEXT', $this->getModuleName()));
$template = 'modules/' . $this->templateModule . '/templates/' . $this->templatePage;
}
Kurogo::log(LOG_DEBUG, "Template file is {$template}", 'module');
// Pager support
if (isset($this->htmlPager)) {
$this->assign('pager', $this->getPager());
}
// Tab support
if (isset($this->tabbedView)) {
$this->assign('tabbedView', $this->tabbedView);
}
$this->assign('imageExt', $this->imageExt);
$this->assign($this->getThemeVars());
// Access Key Start
$accessKeyStart = count($this->breadcrumbs);
if ($this->configModule != $this->getHomeModuleID()) {
$accessKeyStart++;
// Home link
}
$this->assign('accessKeyStart', $accessKeyStart);
if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
Kurogo::includePackage('Authentication');
$this->setCacheMaxAge(0);
$session = $this->getSession();
$this->assign('session', $session);
$this->assign('session_isLoggedIn', $this->isLoggedIn());
//.........这里部分代码省略.........
示例14: init
/**
* Common initialization. Checks access.
*/
protected function init()
{
if ($this->isDisabled()) {
Kurogo::log(LOG_NOTICE, "Access to {$this->configModule} is disabled", 'module');
$this->moduleDisabled();
}
$forceInsecure = $this->getOptionalModuleVar('FORCE_INSECURE', 0);
$secureRequired = (Kurogo::sharedInstance()->getSite()->getRequiresSecure() || $this->getOptionalModuleVar('secure', false, 'module')) && !$forceInsecure;
if ($secureRequired && !IS_SECURE) {
Kurogo::log(LOG_NOTICE, "{$this->configModule} requires HTTPS", 'module');
$this->secureModule();
} elseif ($this->getConfigModule() == Kurogo::sharedInstance()->getCurrentModuleID() && !$secureRequired && IS_SECURE && $forceInsecure) {
$this->unsecureModule();
}
if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
Kurogo::includePackage('Authentication');
if (!$this->getAccess()) {
$this->unauthorizedAccess();
}
}
$this->logView = Kurogo::getOptionalSiteVar('STATS_ENABLED', true) ? true : false;
}
示例15: factory
public static function factory($retrieverClass, $args)
{
Kurogo::log(LOG_DEBUG, "Initializing DataRetriever {$retrieverClass}", "data");
if (isset($args['PACKAGE'])) {
Kurogo::includePackage($args['PACKAGE']);
}
if (!class_exists($retrieverClass)) {
throw new KurogoConfigurationException("Retriever class {$retrieverClass} not defined");
}
$retriever = new $retrieverClass();
if (!$retriever instanceof DataRetriever) {
throw new KurogoConfigurationException(get_class($retriever) . " is not a subclass of DataRetriever");
}
$retriever->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
$retriever->init($args);
return $retriever;
}