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


PHP Frontend::instance方法代码示例

本文整理汇总了PHP中Frontend::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Frontend::instance方法的具体用法?PHP Frontend::instance怎么用?PHP Frontend::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Frontend的用法示例。


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

示例1: lookup

 public static function lookup($ip)
 {
     $ch = curl_init();
     // Notice: the request back to the Symphony services API includes your domain name
     // and the version of Symphony that you're using
     $version = Frontend::instance()->Configuration->get('version', 'symphony');
     $domain = $_SERVER[SERVER_NAME];
     curl_setopt($ch, CURLOPT_URL, "http://symphony-cms.net/_netspeed/1.0/?symphony=" . $version . "&domain=" . $domain . "&ip=" . $ip);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $speedinfo = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     if ($speedinfo === false || $info['http_code'] != 200) {
         return;
     } else {
         $speedinfo = explode(',', $speedinfo);
     }
     $result = new XMLElement("netspeed");
     $included = array('id', 'connection', 'error');
     $i = 0;
     foreach ($included as $netspeed) {
         $result->appendChild(new XMLElement($netspeed, $speedinfo[$i]));
         $i++;
     }
     return $result;
 }
开发者ID:josephdenne,项目名称:netspeed-service,代码行数:27,代码来源:class.netspeed_service.php

示例2: driver

 public static function driver()
 {
     if (class_exists('Administration')) {
         return Administration::instance()->Configuration;
     }
     return Frontend::instance()->Configuration;
 }
开发者ID:bauhouse,项目名称:library,代码行数:7,代码来源:class.configurationaccessor.php

示例3: start

 public static function start($lifetime = 0, $path = '/', $domain = NULL)
 {
     if (!self::$_initialized) {
         ## Crude method of determining if we're in the admin or frontend
         if (class_exists('Frontend')) {
             self::$_db =& Frontend::instance()->Database;
         } elseif (class_exists('Administration')) {
             self::$_db =& Administration::instance()->Database;
         } else {
             return false;
         }
         if (!is_object(self::$_db) || !self::$_db->isConnected()) {
             return false;
         }
         self::$_cache = new Cacheable(self::$_db);
         $installed = self::$_cache->check('_session_config');
         if (!$installed) {
             if (!self::createTable()) {
                 return false;
             }
             self::$_cache->write('_session_config', true);
         }
         ini_set('session.save_handler', 'user');
         session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
         session_set_cookie_params($lifetime, $path, $domain ? $domain : self::getDomain(), false, false);
         self::$_initialized = true;
         if (session_id() == '') {
             session_start();
         }
     }
     return session_id();
 }
开发者ID:bauhouse,项目名称:sym-fluid960gs,代码行数:32,代码来源:class.session.php

示例4: Context

 public function Context()
 {
     if (class_exists('Frontend')) {
         return (object) Frontend::instance();
     }
     return (object) Administration::instance();
 }
开发者ID:klaftertief,项目名称:entry_versions,代码行数:7,代码来源:class.entryversionsmanager.php

示例5: Database

 public static function Database()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database;
     }
     return Administration::instance()->Database;
 }
开发者ID:bauhouse,项目名称:sym-spectrum,代码行数:7,代码来源:class.symphony.php

示例6: __dbConnectionResource

 private static function __dbConnectionResource()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database->getConnectionResource();
     }
     return Administration::instance()->Database->getConnectionResource();
 }
开发者ID:bauhouse,项目名称:sym-spectrum-members,代码行数:7,代码来源:class.asdc.php

示例7: renderer

function renderer($mode = 'frontend')
{
    if (!in_array($mode, array('frontend', 'administration'))) {
        throw new Exception('Invalid Symphony Renderer mode specified. Must be either "frontend" or "administration".');
    }
    require_once CORE . "/class.{$mode}.php";
    return $mode == 'administration' ? Administration::instance() : Frontend::instance();
}
开发者ID:nils-werner,项目名称:symphony-2,代码行数:8,代码来源:index.php

示例8: renderer_json

function renderer_json($mode)
{
    if (strtolower($mode) == 'administration') {
        throw new Lib\Exceptions\InvalidModeException('JSON Renderer launcher is only available on the frontend');
    }
    $renderer = Frontend::instance();
    // Check if we should enable exception debug information
    $exceptionDebugEnabled = Symphony::isLoggedIn();
    // Use the JSON exception and error handlers instead of the Symphony one.
    Lib\ExceptionHandler::initialise($exceptionDebugEnabled);
    Lib\ErrorHandler::initialise($exceptionDebugEnabled);
    // #1808
    if (isset($_SERVER['HTTP_MOD_REWRITE'])) {
        throw new Exception("mod_rewrite is required, however is not enabled.");
    }
    $output = $renderer->display(getCurrentPage());
    cleanup_session_cookies();
    if (in_array('JSON', Frontend::Page()->pageData()['type'])) {
        // Load the output into a SimpleXML Container and convert to JSON
        try {
            $xml = new SimpleXMLElement($output, LIBXML_NOCDATA);
            // Convert the XML to a plain array. This step is necessary as we cannot
            // use JSON_PRETTY_PRINT directly on a SimpleXMLElement object
            $outputArray = json_decode(json_encode($xml), true);
            // Get the transforer object ready. Other extensions will
            // add their transormations to this.
            $transformer = new Lib\Transformer();
            /**
             * Allow other extensions to add their own transformers
             */
            Symphony::ExtensionManager()->notifyMembers('APIFrameworkJSONRendererAppendTransformations', '/frontend/', ['transformer' => &$transformer]);
            // Apply transformations
            $outputArray = $transformer->run($outputArray);
            // Now put the array through a json_encode
            $output = json_encode($outputArray, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
        } catch (\Exception $e) {
            // This happened because the input was not valid XML. This could
            // occur for a few reasons, but there are two scenarios
            // we are interested in.
            // 1) This is a devkit page (profile, debug etc). We want the data
            //    to be passed through and displayed rather than converted into
            //    JSON. There is no easy way in Symphony to tell if a devkit has
            //    control over the page, so instead lets inspect the output for
            //    any signs a devkit is rendering the page.
            // 2) It is actually bad XML. In that case we need to let the error
            //    bubble through.
            // Currently the easiest method is to check for the devkit.min.css
            // in the output. This may fail in the furture if this file is
            // renamed or moved.
            if (!preg_match("@\\/symphony\\/assets\\/css\\/devkit.min.css@", $output)) {
                throw $e;
            }
        }
    }
    echo $output;
    return $renderer;
}
开发者ID:pointybeard,项目名称:api_framework,代码行数:57,代码来源:JsonRendererLauncher.php

示例9: __construct

 public function __construct($message)
 {
     parent::__construct($message);
     $this->error = NULL;
     $bFoundFile = false;
     if (XSLProc::getErrors() instanceof MessageStack) {
         foreach (XSLProc::getErrors() as $e) {
             if ($e->type == XSLProc::ERROR_XML) {
                 $this->error = $errors[0];
                 $this->file = XSLProc::lastXML();
                 $this->line = $this->error->line;
                 $bFoundFile = true;
                 break;
             } elseif (strlen(trim($e->file)) == 0) {
                 continue;
             }
             $this->error = $errors[0];
             $this->file = $this->error->file;
             $this->line = $this->error->line;
             $bFoundFile = true;
             break;
         }
         if (is_null($this->error)) {
             foreach (XSLProc::getErrors() as $e) {
                 if (preg_match_all('/(\\/?[^\\/\\s]+\\/.+.xsl) line (\\d+)/i', $e->message, $matches, PREG_SET_ORDER)) {
                     $this->file = $matches[0][1];
                     $this->line = $matches[0][2];
                     $bFoundFile = true;
                     break;
                 } elseif (preg_match_all('/([^:]+): (.+) line (\\d+)/i', $e->message, $matches, PREG_SET_ORDER)) {
                     //throw new Exception("Fix XSLPROC Frontend doesn't have access to Page");
                     $this->line = $matches[0][3];
                     $this->file = VIEWS . '/' . Frontend::instance()->loadedView()->templatePathname();
                     $bFoundFile = true;
                 }
             }
         }
     }
     /*
     			// FIXME: This happens when there is an error in the page XSL. Since it is loaded in to a string then passed to the processor it does not return a file
     			if(!$bFoundFile){
     				$page = Symphony::parent()->Page()->pageData();
     				$this->file = VIEWS . '/' . $page['filelocation'];
     				$this->line = 0;
     
     				// Need to look for a potential line number, since
     				// it will not have been grabbed
     				foreach($errors as $e){
     					if($e->line > 0){
     						$this->line = $e->line;
     						break;
     					}
     				}
     			}
     */
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:56,代码来源:class.xslproc.php

示例10: getSectionId

 public function getSectionId()
 {
     $sectionManager = new SectionManager(Frontend::instance());
     $section_id = $sectionManager->fetchIDFromHandle(General::sanitize($_REQUEST['MUUsource']));
     if (!($section = $sectionManager->fetch($section_id))) {
         return NULL;
     } else {
         return $section_id;
     }
 }
开发者ID:scottkf,项目名称:massuploadutility,代码行数:10,代码来源:content.index.php

示例11: __construct

 function __construct($args)
 {
     require_once 'lib/class.cachelite.php';
     require_once CORE . '/class.frontend.php';
     $this->_Parent =& $args['parent'];
     $this->_frontend = Frontend::instance();
     $this->_lifetime = $this->_get_lifetime();
     $this->_cacheLite = new Cache_Lite(array('cacheDir' => CACHE . '/', 'lifeTime' => $this->_lifetime));
     $this->_url = $_SERVER['REQUEST_URI'];
 }
开发者ID:nickdunn,项目名称:cachelite,代码行数:10,代码来源:extension.driver.php

示例12: __construct

 public function __construct()
 {
     if (class_exists('Frontend')) {
         self::$_context = Frontend::instance();
     } else {
         self::$_context = Administration::instance();
     }
     self::$_entryManager = new EntryManager(self::$_context);
     self::$_sectionManager = self::$_entryManager->sectionManager;
     self::$_fieldManager = self::$_entryManager->fieldManager;
 }
开发者ID:psychoticmeowArchives,项目名称:symql,代码行数:11,代码来源:class.symql.php

示例13: __construct

 /**
  * Construct a new instance of an Entry.
  *
  * @param mixed $parent
  *	The class that created this Entry object, usually the EntryManager,
  *	passed by reference.
  */
 public function __construct(&$parent)
 {
     $this->_Parent =& $parent;
     if (class_exists('Administration')) {
         $this->_engine = Administration::instance();
     } elseif (class_exists('Frontend')) {
         $this->_engine = Frontend::instance();
     } else {
         throw new Exception(__('No suitable engine object found'));
     }
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:18,代码来源:class.entry.php

示例14: assert

 /**
  * Set up static members
  */
 private function assert()
 {
     $mode = isset($_GET['mode']) && strtolower($_GET['mode']) == 'administration' ? 'administration' : 'frontend';
     self::$_context = $mode == 'administration' ? Administration::instance() : Frontend::instance();
     if (self::$_entry_manager == NULL) {
         self::$_entry_manager = new EntryManager(self::$_context);
     }
     if (self::$_entry_xml_datasource == NULL) {
         self::$_entry_xml_datasource = new EntryXMLDataSource(self::$_context, NULL, FALSE);
     }
 }
开发者ID:TwistedInteractive,项目名称:search_index,代码行数:14,代码来源:class.search_index.php

示例15: grab

 public function grab(&$param_pool)
 {
     $result = new XMLElement($this->dsParamROOTELEMENT);
     $driver = Frontend::instance()->ExtensionManager->create('iplocation_lookup');
     $location = extension_IPLocation_Lookup::lookup();
     if (is_null($location)) {
         $result->appendChild(new XMLElement('error', 'unknown location'));
     } else {
         $result->setValue($location);
     }
     return $result;
 }
开发者ID:pointybeard,项目名称:iplocation_lookup,代码行数:12,代码来源:data.iplocationlookup.php


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