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


PHP BaseObject::set_app方法代码示例

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


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

示例1: App

<?php

/**
 *
 * Friendica
 *
 */
/**
 *
 * bootstrap the application
 *
 */
require_once 'boot.php';
require_once 'object/BaseObject.php';
$a = new App();
BaseObject::set_app($a);
/**
 *
 * Load the configuration file which contains our DB credentials.
 * Ignore errors. If the file doesn't exist or is empty, we are running in installation mode.
 *
 */
$install = file_exists('.htconfig.php') && filesize('.htconfig.php') ? false : true;
@(include ".htconfig.php");
/**
 *
 * Try to open the database;
 *
 */
require_once "include/dba.php";
if (!$install) {
开发者ID:ridcully,项目名称:friendica,代码行数:31,代码来源:index.php

示例2: __construct

 /**
  * App constructor.
  */
 function __construct()
 {
     // we'll reset this after we read our config file
     date_default_timezone_set('UTC');
     $this->config = array('system' => array());
     $this->page = array();
     $this->pager = array();
     $this->query_string = '';
     startup();
     set_include_path('include' . PATH_SEPARATOR . 'library' . PATH_SEPARATOR . 'library/phpsec' . PATH_SEPARATOR . 'library/langdet' . PATH_SEPARATOR . '.');
     $this->scheme = 'http';
     if (x($_SERVER, 'HTTPS') && $_SERVER['HTTPS']) {
         $this->scheme = 'https';
     } elseif (x($_SERVER, 'SERVER_PORT') && intval($_SERVER['SERVER_PORT']) == 443) {
         $this->scheme = 'https';
     }
     if (x($_SERVER, 'SERVER_NAME')) {
         $this->hostname = $_SERVER['SERVER_NAME'];
         if (x($_SERVER, 'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
             $this->hostname .= ':' . $_SERVER['SERVER_PORT'];
         }
         /**
          * Figure out if we are running at the top of a domain
          * or in a sub-directory and adjust accordingly
          */
         $path = trim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
         if (isset($path) && strlen($path) && $path != $this->path) {
             $this->path = $path;
         }
     }
     set_include_path("include/{$this->hostname}" . PATH_SEPARATOR . get_include_path());
     if (x($_SERVER, 'QUERY_STRING') && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") {
         $this->query_string = substr($_SERVER['QUERY_STRING'], 2);
         // removing trailing / - maybe a nginx problem
         if (substr($this->query_string, 0, 1) == "/") {
             $this->query_string = substr($this->query_string, 1);
         }
     }
     if (x($_GET, 'q')) {
         $this->cmd = trim($_GET['q'], '/\\');
     }
     // unix style "homedir"
     if (substr($this->cmd, 0, 1) === '~') {
         $this->cmd = 'channel/' . substr($this->cmd, 1);
     }
     /*
      * Break the URL path into C style argc/argv style arguments for our
      * modules. Given "http://example.com/module/arg1/arg2", $this->argc
      * will be 3 (integer) and $this->argv will contain:
      *   [0] => 'module'
      *   [1] => 'arg1'
      *   [2] => 'arg2'
      *
      * There will always be one argument. If provided a naked domain
      * URL, $this->argv[0] is set to "home".
      */
     $this->argv = explode('/', $this->cmd);
     $this->argc = count($this->argv);
     if (array_key_exists('0', $this->argv) && strlen($this->argv[0])) {
         $this->module = str_replace(".", "_", $this->argv[0]);
         $this->module = str_replace("-", "_", $this->module);
     } else {
         $this->argc = 1;
         $this->argv = array('home');
         $this->module = 'home';
     }
     /*
      * See if there is any page number information, and initialise
      * pagination
      */
     $this->pager['page'] = x($_GET, 'page') && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
     $this->pager['itemspage'] = 60;
     $this->pager['start'] = $this->pager['page'] * $this->pager['itemspage'] - $this->pager['itemspage'];
     if ($this->pager['start'] < 0) {
         $this->pager['start'] = 0;
     }
     $this->pager['total'] = 0;
     /*
      * Detect mobile devices
      */
     $mobile_detect = new Mobile_Detect();
     $this->is_mobile = $mobile_detect->isMobile();
     $this->is_tablet = $mobile_detect->isTablet();
     $this->head_set_icon('/images/rm-32.png');
     BaseObject::set_app($this);
     /*
      * register template engines
      */
     $dc = get_declared_classes();
     foreach ($dc as $k) {
         if (in_array("ITemplateEngine", class_implements($k))) {
             $this->register_template_engine($k);
         }
     }
 }
开发者ID:HaakonME,项目名称:redmatrix,代码行数:98,代码来源:boot.php


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