BaseObject moved to src/Core

BaseObject moved to Friendica\Core namespace. References and function calls updated.
This commit is contained in:
Adam Magness 2017-11-16 13:05:41 -05:00
parent fda48ec431
commit ecd9e3e07e
6 changed files with 76 additions and 58 deletions

View file

@ -1,26 +1,21 @@
<?php <?php
/** /**
* * @file index.php
* Friendica * Friendica
*
*/ */
/** /**
* * Bootstrap the application
* bootstrap the application
*
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\BaseObject;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
require_once 'boot.php'; require_once 'boot.php';
require_once 'object/BaseObject.php';
if (empty($a)) { if (empty($a)) {
$a = new App(__DIR__); $a = new App(__DIR__);
@ -32,11 +27,9 @@ BaseObject::set_app($a);
$a->backend = false; $a->backend = false;
/** /**
*
* Load the configuration file which contains our DB credentials. * Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in * Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode. * installation mode.
*
*/ */
$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true); $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);

View file

@ -1,35 +0,0 @@
<?php
if(class_exists('BaseObject'))
return;
require_once('boot.php');
/**
* Basic object
*
* Contains what is usefull to any object
*/
class BaseObject {
private static $app = null;
/**
* Get the app
*
* Same as get_app from boot.php
*/
public function get_app() {
if(self::$app)
return self::$app;
self::$app = get_app();
return self::$app;
}
/**
* Set the app
*/
public static function set_app($app) {
self::$app = $app;
}
}

View file

@ -1,11 +1,16 @@
<?php <?php
if(class_exists('Conversation')) /**
* @file object/Conversation.php
*/
if (class_exists('Conversation')) {
return; return;
}
require_once('boot.php'); use Friendica\Core\BaseObject;
require_once('object/BaseObject.php');
require_once('object/Item.php'); require_once 'boot.php';
require_once('include/text.php'); require_once 'object/Item.php';
require_once 'include/text.php';
/** /**
* A list of threads * A list of threads

View file

@ -1,15 +1,19 @@
<?php <?php
if(class_exists('Item')) /**
* @file object/Item.php
*/
if (class_exists('Item')) {
return; return;
}
use Friendica\Core\BaseObject;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
require_once('object/BaseObject.php'); require_once 'include/text.php';
require_once('include/text.php'); require_once 'boot.php';
require_once('boot.php');
/** /**
* An item * An item

View file

@ -1,11 +1,15 @@
<?php <?php
require_once 'boot.php'; /**
* @file object/TemplateEngine.php
*/
require_once 'boot.php';
/** /**
* Interface for template engines * Interface for template engines
*/ */
interface ITemplateEngine { interface ITemplateEngine
{
public function replace_macros($s, $v); public function replace_macros($s, $v);
public function get_template_file($file, $root = ''); public function get_template_file($file, $root = '');
} }

47
src/Core/BaseObject.php Normal file
View file

@ -0,0 +1,47 @@
<?php
/**
* @file src/Core/BaseObject.php
*/
namespace Friendica\Core;
if (class_exists('BaseObject')) {
return;
}
require_once 'boot.php';
/**
* Basic object
*
* Contains what is useful to any object
*/
class BaseObject
{
private static $app = null;
/**
* Get the app
*
* Same as get_app from boot.php
*/
public function get_app()
{
if (self::$app) {
return self::$app;
}
self::$app = boot::get_app();
return self::$app;
}
/**
* Set the app
*
* @param object $app App
*/
public static function set_app($app)
{
self::$app = $app;
}
}