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


PHP includePackage函数代码示例

本文整理汇总了PHP中includePackage函数的典型用法代码示例。如果您正苦于以下问题:PHP includePackage函数的具体用法?PHP includePackage怎么用?PHP includePackage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: detectDeviceInternal

  private function detectDeviceInternal($user_agent) {
    includePackage('db');
    if (!$user_agent) {
      return;
    }
     
     if (!$db_file =  $GLOBALS['siteConfig']->getVar('MOBI_SERVICE_FILE')) {
        error_log('MOBI_SERVICE_FILE not specified in site config.');
        die("MOBI_SERVICE_FILE not specified in site config.");
     }
     
     try {
         $db = new db(array('DB_TYPE'=>'sqlite', 'DB_FILE'=>$db_file));
         $result = $db->query('SELECT * FROM userAgentPatterns WHERE version<=? ORDER BY patternorder,version DESC', array($this->version));
     } catch (Exception $e) {
        error_log("Error with device detection");
        return false;
     }

     while ($row = $result->fetch()) {
        if (preg_match("#" . $row['pattern'] . "#i", $user_agent)) {
            return $row;
        }
     }
     
     return false;
  }
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:27,代码来源:DeviceClassifier.php

示例2: init

   protected function init() {
        $moduleData = $this->getModuleData();

        if ($moduleData['disabled']) {
            $this->moduleDisabled();
        }
        
        if ($moduleData['secure'] && (!isset($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] !='on'))) { 
            $this->secureModule();
        }
        
        if ($this->getSiteVar('AUTHENTICATION_ENABLED')) {
            includePackage('Authentication');
            if ($moduleData['protected']) {
                if (!$this->isLoggedIn()) {
                    $this->unauthorizedAccess();
                }
            }
            
            if (!$this->evaluateACLS()) {
                $this->unauthorizedAccess();
            }
        }
    }
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:24,代码来源:Module.php

示例3: includePackage

<?php

includePackage('readability');
/**
 * KurogoReader 
 * 
 * @uses Readability
 * @package 
 * @license 
 */
class KurogoReader
{
    /**
     * baseurl 
     * the base url for this article
     * with protocol prefix, without slash suffix
     *
     * @var mixed
     * @access private
     */
    private $baseurl;
    /**
     * tidyAvailable 
     * flag to mark if tidy function available
     * 
     * @var mixed
     * @access private
     */
    private $tidyAvailable;
    /**
     * cache vars
开发者ID:nncsang,项目名称:Kurogo,代码行数:31,代码来源:KurogoReader.php

示例4: initializeForPage

 protected function initializeForPage()
 {
     if (!Kurogo::getOptionalSiteVar('STATS_ENABLED', true)) {
         throw new KurogoException($this->getLocalizedString('STATS_DISABLED'));
     }
     if ($this->page == 'updateStats') {
         KurogoStats::exportStatsData();
         $this->redirectTo('index');
     }
     if ($this->getOptionalModuleVar('AUTO_UPDATE_STATS')) {
         KurogoStats::exportStatsData();
     }
     $serviceTypes = $this->getServiceTypes();
     $service = $this->getArg('service', 'web');
     if (!array_key_exists($service, $serviceTypes)) {
         $service = 'web';
     }
     $interval_types = $this->getIntervalTypes();
     $interval = $this->getArg('interval', 'day');
     if (!array_key_exists($interval, $interval_types)) {
         $interval = 'day';
     }
     if ($interval == 'custom') {
         $start = $this->getArg('start');
         $startTime = $start ? mktime(0, 0, 0, $start['Month'], $start['Day'], $start['Year']) : mktime(0, 0, 0);
         $end = $this->getArg('end', array());
         $endTime = $end ? mktime(23, 59, 59, $end['Month'], $end['Day'], $end['Year']) : mktime(23, 59, 59);
         if ($endTime < $startTime) {
             $endTime = $startTime;
         }
     } else {
         $times = $this->getTimesForInterval($interval, $interval_types[$interval]['duration']);
         $startTime = $times['start'];
         $endTime = $times['end'];
     }
     $intervalOptions = array();
     $args = $this->args;
     $args['service'] = $service;
     $args['interval'] = $interval;
     foreach ($interval_types as $interval_type => $type) {
         $args['interval'] = $interval_type;
         $intervalOptions[$interval_type] = array('title' => $type['title'], 'selected' => $interval_type == $interval, 'url' => $this->buildbreadcrumbURL($this->page, $args, false));
     }
     $args = $this->args;
     $args['service'] = $service;
     $args['interval'] = $interval;
     foreach ($serviceTypes as $serviceType => $serviceTypeTitle) {
         $args['service'] = $serviceType;
         $serviceOptions[$serviceType] = array('title' => $serviceTypeTitle, 'selected' => $service == $serviceType, 'url' => $this->buildbreadcrumbURL($this->page, $args, false));
     }
     $this->assign('starttime', $startTime);
     $this->assign('endtime', $endTime);
     $this->assign('statsService', $service);
     $this->assign('interval', $interval);
     $this->assign('intervalOptions', $intervalOptions);
     $this->assign('serviceOptions', $serviceOptions);
     $this->assign('intervalTabclass', count($interval_types) == 4 ? 'fourtabs' : 'threetabs');
     $this->assign('serviceTabclass', 'twotabs');
     $commonData = array('service' => $service, 'start' => $startTime, 'end' => $endTime);
     if ($date = KurogoStats::getLastDateFromSummary()) {
         includePackage('DateTime');
         $date = new DateTime($date);
         $this->assign('lastUpdated', DateFormatter::formatDate($date, DateFormatter::LONG_STYLE, DateFormatter::NO_STYLE));
     }
     switch ($this->page) {
         case 'index':
             //get config
             $chartsConfig = $this->getModuleSections('stats-index');
             $charts = array();
             foreach ($chartsConfig as $chartIndex => $chartData) {
                 try {
                     $charts[] = $this->prepareChart(array_merge($chartData, $commonData), $interval);
                 } catch (KurogoStatsConfigurationException $e) {
                     $this->redirectTo('statsconfigerror', array('chart' => $chartData['title']));
                 }
             }
             $this->assign('charts', $charts);
             break;
         case 'detail':
             if (!($group = $this->getArg('group'))) {
                 $this->redirectTo('index');
             }
             if (!(${$group} = $this->getArg($group))) {
                 $this->redirectTo('index');
             }
             if (!($chartsConfig = $this->getChartsConfig($group, ${$group}))) {
                 $this->redirectTo('index');
             }
             $charts = array();
             $commonData[$group] = ${$group};
             foreach ($chartsConfig as $chartIndex => $chartData) {
                 try {
                     $charts[] = $this->prepareChart(array_merge($chartData, $commonData), $interval);
                 } catch (KurogoStatsConfigurationException $e) {
                     $this->redirectTo('statsconfigerror', array('chart' => $chartData['title']));
                 }
             }
             $this->setPageTitle(sprintf("Stats for %s", ${$group}));
             $this->assign('charts', $charts);
             break;
//.........这里部分代码省略.........
开发者ID:nncsang,项目名称:Kurogo,代码行数:101,代码来源:StatsWebModule.php

示例5: includePackage

/*
 * 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.
 *
 */
/**
 * @package ExternalData
 * @subpackage RSS
 */
/**
 */
includePackage('RSS');
/**
 * @package ExternalData
 * @subpackage RSS
 */
class LegacyRSSDataParser extends XMLDataParser
{
    protected $channel;
    protected $channelClass = 'RSSChannel';
    protected $itemClass = 'RSSItem';
    protected $imageClass = 'RSSImage';
    protected $enclosureClass = 'RSSEnclosure';
    protected $imageEnclosureClass = 'RSSImageEnclosure';
    protected $removeDuplicates = false;
    protected $htmlEscapedCDATA = false;
    protected $useDescriptionForContent = false;
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:30,代码来源:LegacyRSSDataParser.php

示例6: includePackage

<?php

/**
 * @package DataController
 */
/**
 * A generic class to handle the retrieval of external data
 * 
 * Handles retrieval, caching and parsing of data. 
 * @package DataController
 */
includePackage('DataController');
includePackage('DataResponse');
abstract class DataController
{
    protected $DEFAULT_PARSER_CLASS = 'PassthroughDataParser';
    protected $initArgs = array();
    protected $cacheFolder = 'Data';
    protected $parser;
    protected $url;
    protected $cache;
    protected $baseURL;
    protected $title;
    protected $method = 'GET';
    protected $filters = array();
    protected $requestHeaders = array();
    protected $response;
    protected $totalItems = null;
    protected $debugMode = false;
    protected $useCache = true;
    protected $useStaleCache = true;
开发者ID:nncsang,项目名称:Kurogo,代码行数:31,代码来源:DataController.php

示例7: includePackage

<?php
/**
  * @package Core
  */
  
includePackage('db');

/**
  * @package Core
  */
class PageViews {

  public static function log_api($module, $platform, $time=NULL) {
    $extra = serialize($_GET);
    self::log_item('api', $module, $platform, $extra, $time);
  }

  public static function increment($module, $platform, $time=NULL) {
    self::log_item('web', $module, $platform, "", $time);
  }

  public static function log_item($system, $module, $platform, $extra, $time) {
    if ($time === NULL)
      $time = time();

    if ($system == 'web')
      $logfile = $GLOBALS['siteConfig']->getVar('WEB_CURRENT_LOG_FILE');
    else // assume 'api'
      $logfile = $GLOBALS['siteConfig']->getVar('API_CURRENT_LOG_FILE');
      
    if (empty($logfile)) {
开发者ID:JimiSlew,项目名称:kurogo-old,代码行数:31,代码来源:PageViews.php

示例8: includePackage

 * 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 ExternalData
 */
/**
 * A generic class to handle the retrieval of external data
 * use soap api
 * @package ExternalData
 */
includePackage('DataRetriever', 'SOAP');
class SOAPDataRetriever extends DataRetriever
{
    protected $DEFAULT_RESPONSE_CLASS = 'SOAPDataResponse';
    protected $wsdl;
    protected $soapClient;
    protected $soapOptions = array('trace' => 1);
    //use it and wsdl to instantiate SoapClient
    protected $method;
    protected $parameters = array();
    protected $location;
    protected $uri;
    protected $action;
    protected $saveToFile = false;
    protected $soapHeaders = array();
    public function setWSDL($wsdl)
开发者ID:nncsang,项目名称:Kurogo,代码行数:31,代码来源:SOAPDataRetriever.php

示例9: timeText

 protected function timeText($photo, $timeOnly = false)
 {
     includePackage('Calendar');
     return DateFormatter::formatDate($photo->getPublished(), DateFormatter::SHORT_STYLE, DateFormatter::SHORT_STYLE);
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:5,代码来源:PhotosWebModule.php

示例10: getCacheClasses

 public static function getCacheClasses()
 {
     includePackage('Cache');
     return KurogoMemoryCache::getCacheClasses();
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:5,代码来源:Kurogo.php

示例11: includePackage

<?php

includePackage('Emergency');

class EmergencyWebModule extends WebModule 
{
    protected $id='emergency';
    protected $hasFeeds = true;

    protected function prepareAdminForSection($section, &$adminModule) {
        switch ($section)
        {
            case 'feeds':
                $feeds = $this->loadFeedData();
                $adminModule->assign('feeds', $feeds);
                $adminModule->setTemplatePage('feedAdmin', $this->id);
                break;
            default:
                return parent::prepareAdminForSection($section, $adminModule);
        }
   }
    
    protected function initializeForPage() {
        // construct controllers

        $config = $this->loadFeedData();
        if(isset($config['contacts'])) {
          $contactsController = DataController::factory($config['contacts']['CONTROLLER_CLASS'], $config['contacts']);
        } else {
          $contactsController = NULL;
        }
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:31,代码来源:EmergencyWebModule.php

示例12: init

    /**
      * Common initialization. Checks access.
      */
    protected function init() {

        if ($this->getModuleVar('disabled','module')) {
            $this->moduleDisabled();
        }

        if ((Kurogo::getOptionalSiteVar('SECURE_REQUIRED') || $this->getModuleVar('secure','module')) && 
            (!isset($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] !='on'))) { 
            $this->secureModule();
        }
        
        if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
            includePackage('Authentication');
            if (!$this->getAccess()) {
                $this->unauthorizedAccess();
            }
        }
    }
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:21,代码来源:Module.php

示例13: initializeForCommand


//.........这里部分代码省略.........
                 }
                 $places[] = $place;
             }
             $response = array('total' => count($places), 'returned' => count($places), 'results' => $places);
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
             // ajax calls
         // ajax calls
         case 'projectPoint':
             $lat = $this->getArg('lat', 0);
             $lon = $this->getArg('lon', 0);
             $fromProj = $this->getArg('from', GEOGRAPHIC_PROJECTION);
             $toProj = $this->getArg('to', GEOGRAPHIC_PROJECTION);
             $projector = new MapProjector();
             $projector->setSrcProj($fromProj);
             $projector->setDstProj($toProj);
             $result = $projector->projectPoint(array('lat' => $lat, 'lon' => $lon));
             $this->setResponse($result);
             $this->setResponseVersion(1);
             break;
         case 'sortGroupsByDistance':
             $lat = $this->getArg('lat', 0);
             $lon = $this->getArg('lon', 0);
             $categories = array();
             $showDistances = $this->getOptionalModuleVar('SHOW_DISTANCES', true);
             if ($lat || $lon) {
                 foreach ($this->getFeedGroups() as $id => $groupData) {
                     $center = filterLatLon($groupData['center']);
                     $distance = greatCircleDistance($lat, $lon, $center['lat'], $center['lon']);
                     $category = array('title' => $groupData['title'], 'id' => $id);
                     if ($showDistances && ($displayText = $this->displayTextFromMeters($distance))) {
                         $category['distance'] = $displayText;
                     }
                     $categories[] = $category;
                     $distances[] = $distance;
                 }
                 array_multisort($distances, SORT_ASC, $categories);
             }
             $this->setResponse($categories);
             $this->setResponseVersion(1);
             break;
         case 'staticImageURL':
             $params = array('STATIC_MAP_BASE_URL' => $this->getArg('baseURL'), 'STATIC_MAP_CLASS' => $this->getArg('mapClass'));
             $dc = Kurogo::deviceClassifier();
             $mapDevice = new MapDevice($dc->getPagetype(), $dc->getPlatform());
             $mapController = MapImageController::factory($params, $mapDevice);
             if (!$mapController->isStatic()) {
                 $error = new KurogoError(0, "staticImageURL must be used with a StaticMapImageController subclass");
                 $this->throwError($error);
             }
             $currentQuery = $this->getArg('query');
             $mapController->parseQuery($currentQuery);
             $overrides = $this->getArg('overrides');
             $mapController->parseQuery($overrides);
             $zoomDir = $this->getArg('zoom');
             if ($zoomDir == 1 || $zoomDir == 'in') {
                 $level = $mapController->getLevelForZooming('in');
                 $mapController->setZoomLevel($level);
             } elseif ($zoomDir == -1 || $zoomDir == 'out') {
                 $level = $mapController->getLevelForZooming('out');
                 $mapController->setZoomLevel($level);
             }
             $scrollDir = $this->getArg('scroll');
             if ($scrollDir) {
                 $center = $mapController->getCenterForPanning($scrollDir);
                 $mapController->setCenter($center);
             }
             $url = $mapController->getImageURL();
             $this->setResponse($url);
             $this->setResponseVersion(1);
             break;
         case 'geocode':
             // TODO: this is not fully implemented. do not use this API.
             includePackage('Maps', 'Geocoding');
             $locationSearchTerms = $this->getArg('q');
             $geocodingDataRetrieverClass = $this->getOptionalModuleVar('GEOCODING_DATA_RETRIEVER_CLASS');
             $geocodingDataParserClass = $this->getOptionalModuleVar('GEOCODING_DATA_PARSER_CLASS');
             $geocoding_base_url = $this->getOptionalModuleVar('GEOCODING_BASE_URL');
             $arguments = array('BASE_URL' => $geocoding_base_url, 'CACHE_LIFETIME' => 86400, 'PARSER_CLASS' => $geocodingDataParserClass);
             $controller = DataRetriever::factory($geocodingDataRetrieverClass, $arguments);
             $controller->addCustomFilters($locationSearchTerms);
             $response = $controller->getParsedData();
             // checking for Geocoding service error
             if ($response['errorCode'] == 0) {
                 unset($response['errorCode']);
                 unset($response['errorMessage']);
                 $this->setResponse($response);
                 $this->setResponseVersion(1);
             } else {
                 $kurogoError = new KurogoError($response['errorCode'], "Geocoding service Erroe", $response['errorMessage']);
                 $this->setResponseError($kurogoError);
                 $this->setResponseVersion(1);
             }
             break;
         default:
             $this->invalidCommand();
             break;
     }
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:101,代码来源:MapAPIModule.php

示例14: setPageVariables

  private function setPageVariables() {
    $this->loadTemplateEngineIfNeeded();
        
    $this->loadPageConfig();
    
    // Set variables common to all modules
    $this->assign('moduleID',     $this->id);
    $this->assign('moduleName',   $this->moduleName);
    $this->assign('page',         $this->page);
    $this->assign('isModuleHome', $this->page == 'index');
    $this->assign('request_uri' , $_SERVER['REQUEST_URI']);
    
    // 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 = $this->getSiteVar('GOOGLE_ANALYTICS_ID', null, Config::SUPRESS_ERRORS)) {
        $this->assign('GOOGLE_ANALYTICS_ID', $gaID);
        $this->assign('gaImageURL', $this->googleAnalyticsGetImageUrl($gaID));
    }
    
    // Breadcrumbs
    $this->loadBreadcrumbs();
    
    // Tablet module nav list
    if ($this->pagetype == 'tablet') {
      $this->addInternalJavascript('/common/javascript/lib/iscroll.js');
      $this->assign('moduleNavList', $this->getModuleNavlist());
    }
            
    // Set variables for each page
    $this->initializeForPage();

    $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->getModuleSection('strings', array(), Config::SUPRESS_ERRORS);
    $this->assign('moduleStrings', $moduleStrings);

    // Module Help
    if ($this->page == 'help') {
      $this->assign('hasHelp', false);
      $template = 'common/'.$this->page;
    } else {
      $this->assign('hasHelp', isset($moduleStrings['help']));
      $template = 'modules/'.$this->templateModule.'/templates/'.$this->templatePage;
    }
    
    // Pager support
    if (isset($this->htmlPager)) {
      $this->assign('pager', $this->getPager());
    }
    
    // Tab support
    if (isset($this->tabbedView)) {
      $this->assign('tabbedView', $this->tabbedView);
    }
    
    // Access Key Start
    $accessKeyStart = count($this->breadcrumbs);
    if ($this->id != 'home') {
      $accessKeyStart++;  // Home link
    }
    $this->assign('accessKeyStart', $accessKeyStart);

    if ($this->getSiteVar('AUTHENTICATION_ENABLED')) {
        includePackage('Authentication');
        $this->setCacheMaxAge(0);
        $session = $this->getSession();
        $this->assign('session', $session);
        $this->assign('session_isLoggedIn', $this->isLoggedIn());

        if ($this->isLoggedIn()) {
            $this->assign('session_max_idle', intval($this->getSiteVar('AUTHENTICATION_IDLE_TIMEOUT', 0, Config::SUPRESS_ERRORS)));
        }
    }

    /* 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));
//.........这里部分代码省略.........
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:101,代码来源:WebModule.php

示例15: includePackage

<?php

// http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd
// http://portal.opengeospatial.org/files/?artifact_id=27810
includePackage('Maps', 'KML');
class KMLDataParser extends XMLDataParser implements MapDataParser
{
    protected $root;
    protected $elementStack = array();
    protected $data = '';
    protected $document;
    protected $folders = array();
    protected $features = array();
    protected $title;
    protected $category;
    // whitelists
    protected static $startElements = array('DOCUMENT', 'FOLDER', 'STYLE', 'STYLEMAP', 'PLACEMARK', 'POINT', 'LINESTRING', 'LINEARRING', 'POLYGON');
    protected static $endElements = array('DOCUMENT', 'FOLDER', 'STYLE', 'STYLEMAP', 'STYLEURL', 'PLACEMARK');
    /////// MapDataParser
    public function getProjection()
    {
        return null;
    }
    public function getAllPlacemarks()
    {
        return $this->features;
    }
    public function getChildCategories()
    {
        return $this->folders;
    }
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:31,代码来源:KMLDataParser.php


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