本文整理汇总了PHP中Doo::loadCore方法的典型用法代码示例。如果您正苦于以下问题:PHP Doo::loadCore方法的具体用法?PHP Doo::loadCore怎么用?PHP Doo::loadCore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doo
的用法示例。
在下文中一共展示了Doo::loadCore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dbAAA2
public function dbAAA2()
{
Doo::loadCore('db/DooSqlMagic');
$dbAAA = new DooSqlMagic();
$dbAAA->setDb(Doo::conf()->db_aaa2, Doo::conf()->APP_MODE);
$dbAAA->connect();
return $dbAAA;
}
示例2: dbW
public function dbW()
{
Doo::loadCore('db/DooSqlMagic');
$dbW = new DooSqlMagic();
$dbW->setDb(Doo::conf()->db_write, Doo::conf()->APP_MODE);
$dbW->connect();
return $dbW;
}
示例3: agregarRespuesta
function agregarRespuesta()
{
session_start();
if (Session::siExisteSesion()) {
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Doo::conf()->APP_URL . 'ionadmin/index';
$referer = strtok($referer, '?');
$this->data['idpregunta'] = intval($this->params['idpregunta']);
if (isset($_POST['respuesta']) && !empty($_POST['respuesta'])) {
Doo::loadModel('CtRespuesta');
Doo::loadCore('db/DooDbExpression');
$r = new CtRespuesta();
$r->respuesta = strip_tags(addslashes($_POST['respuesta']));
$r->id_pregunta = $this->data['idpregunta'];
$r->insert();
header('location:' . $referer . '?success=1');
} else {
header('location:' . $referer . '?error=1');
}
} else {
header('location:' . Doo::conf()->APP_URL . 'ionadmin/login?error=1');
}
}
示例4: get_recipe
<?php
Doo::loadCore('db/DooSmartModel');
class Food extends DooSmartModel
{
public $id;
public $name;
public $description;
public $location;
public $food_type_id;
public $_table = 'food';
public $_primarykey = 'id';
public $_fields = array('id', 'name', 'description', 'location', 'food_type_id');
function __construct()
{
//parent::__construct( array('id'=>1, 'name'=>'Ban Mian', 'location'=>'Malaysia') ); //This is for you to set the properties with constructor
//parent::$caseSensitive = true;
parent::$className = __CLASS__;
//a must if you are using static querying methods Food::_count(), Food::getById()
//parent::setupModel(__CLASS__);
//parent::setupModel(__CLASS__, true);
}
public function get_recipe()
{
return Doo::db()->relate('Recipe', __CLASS__, array('limit' => 'first'));
}
public function get_by_id()
{
if (intval($this->id) <= 0) {
return null;
}
示例5:
<?php
/**
* DooManageSqliteDb class file.
*
* @author Richard Myers <richard.myers@hotmail.co.uk>
* @link http://www.doophp.com/
* @copyright Copyright © 2009 Leng Sheng Hong
* @license http://www.doophp.com/license
* @package doo.db.manage.adapters
* @since 1.3
*/
Doo::loadCore('db/manage/DooManageDb');
class DooManageSqliteDb extends DooManageDb
{
/**
* A mapping of DooManageDb generic datatypes to RDBMS native datatypes for columns
* These must be defined in each specific adapter
*
* The datatypes are
* COL_TYPE_BOOL : A true or false boolean
* COL_TYPE_SMALLINT : 2-byte integer (-32,767 to 32,768)
* COL_TYPE_INT : 4-byte integer (-2,147,483,648 to 2,147,483,647)
* COL_TYPE_BIGINT : 8-byte integer (about -9,000 trilllion to 9,000 trillion)
* COL_TYPE_DECIMAL : Fixed point decimal of specific size (total digits) and scope (num digits after decimal point)
* COL_TYPE_FLOAT : A double-percision floating point decimal number
* COL_TYPE_CHAR : A fixed length string of 1-255 characters
* COL_TYPE_VARCHAR : A variable length string of 1-255 characters
* COL_TYPE_CLOB : A large character object of up to about 2Gb
* COL_TYPE_DATE : an ISO 8601 date eg. 2009-09-27
* COL_TYPE_TIME : an ISO 8601 time eg. 18:38:49
示例6: getDbEngineManager
/**
* Gets an instance of a Database Admin Adapter for the current DB's Engine
* @param object $engine
* @return
*/
private function getDbEngineManager($engine)
{
if ($engine == 'mysql') {
Doo::loadCore('db/manage/adapters/DooManageMySqlDb');
return new DooManageMySqlDb();
} else {
if ($engine == 'pgsql') {
Doo::loadCore('db/manage/adapters/DooManagePgSqlDb');
return new DooManagePgSqlDb();
} else {
if ($engine == 'sqlite') {
Doo::loadCore('db/manage/adapters/DooManageSqliteDb');
return new DooManageSqliteDb();
} else {
throw new DooDbUpdateException("Unsupported Database Engine : {$engine}");
}
}
}
}
示例7: route_to
/**
* Handles the routing process.
* Auto routing, sub folder, subdomain, sub folder on subdomain are supported.
* It can be used with or without the <i>index.php</i> in the URI
* @return mixed HTTP status code such as 404 or URL for redirection
*/
public function route_to()
{
Doo::loadCore('uri/DooUriRouter');
$router = new DooUriRouter();
$routeRs = $router->execute($this->route, Doo::conf()->SUBFOLDER);
if ($routeRs[0] != NULL && $routeRs[1] != NULL) {
//dispatch, call Controller class
#echo "<h1>Dispatched!</h1>{$routeRs[0]}->{$routeRs[1]}<br>";
require_once Doo::conf()->BASE_PATH . "controller/DooController.php";
require_once Doo::conf()->SITE_PATH . "protected/controller/{$routeRs[0]}.php";
if (strpos($routeRs[0], '/') !== FALSE) {
$clsname = explode('/', $routeRs[0]);
$routeRs[0] = $clsname[sizeof($clsname) - 1];
}
//if defined class name, use the class name to create the Controller object
$clsnameDefined = sizeof($routeRs) === 4;
if ($clsnameDefined) {
$controller = new $routeRs[3]();
} else {
$controller = new $routeRs[0]();
}
$controller->params = $routeRs[2];
if (isset($controller->params['__extension'])) {
$controller->extension = $controller->params['__extension'];
unset($controller->params['__extension']);
}
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
$controller->init_put_vars();
}
//before run, normally used for ACL auth
if ($clsnameDefined) {
if ($rs = $controller->beforeRun($routeRs[3], $routeRs[1])) {
return $rs;
}
} else {
if ($rs = $controller->beforeRun($routeRs[0], $routeRs[1])) {
return $rs;
}
}
return $controller->{$routeRs}[1]();
} else {
if (Doo::conf()->AUTOROUTE) {
list($controller_name, $method_name, $params) = $router->auto_connect(Doo::conf()->SUBFOLDER);
$controller_file = Doo::conf()->SITE_PATH . "protected/controller/{$controller_name}.php";
if (file_exists($controller_file)) {
require_once Doo::conf()->BASE_PATH . "controller/DooController.php";
require_once $controller_file;
$controller = new $controller_name();
if (!$controller->autoroute) {
$this->throwHeader(404);
}
if ($params != NULL) {
$controller->params = $params;
}
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
$controller->init_put_vars();
}
if (method_exists($controller, $method_name)) {
return $controller->{$method_name}();
} else {
$this->throwHeader(404);
}
} else {
$this->throwHeader(404);
}
} else {
$this->throwHeader(404);
}
}
}
示例8: isAllowed
<?php
/**
* DooRbAcl class file.
*
* @author aligo <aligo_x@163.com>
* @link http://www.doophp.com/
* @copyright Copyright © 2009 Leng Sheng Hong
* @license http://www.doophp.com/license
*
*/
Doo::loadCore('auth/DooAcl');
class DooRbAcl extends DooAcl
{
/**
* Check if the user Roles is allowed to access the resource or action list or both.
*
* <code>
* //Check if members are allowed for BlogController->post
* Doo::acl()->isAllowed(array('member','admin'), 'BlogController', 'post' );
*
* //Check if members are allowed for BlogController
* Doo::acl()->isAllowed(array('anonymous','member'), 'BlogController');
* </code>
*
* @param array $role Roles of a user, usually retrieve from user's login session
* @param string $resource Resource name (use Controller class name)
* @param string $action Action name (use Method name)
* @return bool
*/
public function isAllowed($roles, $resource, $action = '')
示例9: view
/**
* The view singleton, auto create if the singleton has not been created yet.
* @return DooView|DooViewBasic
*/
public function view()
{
if ($this->_view == NULL) {
$engine = Doo::conf()->TEMPLATE_ENGINE;
Doo::loadCore('view/' . $engine);
$this->_view = new $engine();
}
return $this->_view;
}
示例10: connect
* );
* </code>
*
* <p>In the bootstrap index.php you would need to call the <b>useDbReplicate</b> method.</p>
* <code>
* Doo::useDbReplicate();
* Doo::db()->setMap($dbmap);
* Doo::db()->setDb($dbconfig, $config['APP_MODE']);
* </code>
*
* @author Leng Sheng Hong <darkredz@gmail.com>
* @version $Id: DooMasterSlave.php 1000 2009-08-20 22:53:26
* @package doo.db
* @since 1.1
*/
Doo::loadCore('db/DooSqlMagic');
class DooMasterSlave extends DooSqlMagic
{
const MASTER = 'master';
const SLAVE = 'slave';
/**
* Stores the pdo connection for master & slave
* @var array
*/
protected $pdoList = array();
protected $autoToggle = True;
/**
* Connects to the database with the default slaves configurations
*/
public function connect()
{
示例11: gen_model
public function gen_model()
{
Doo::loadCore('db/DooModelGen');
global $dbconfig;
foreach ($dbconfig as $key => $value) {
$path = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . 'model/' . $key;
if (!is_dir($path)) {
mkdir($path);
}
$path .= '/';
Doo::db()->setDb($dbconfig, $key);
Doo::db()->reconnect($key);
DooModelGen::genMySQL($comments = true, $vrules = true, $extends = 'DooModel', $createBase = true, $baseSuffix = 'Base', $useAutoload = false, $chmod = null, $path, $dbname = ucfirst($key));
//exit;
}
}
示例12: view
/**
* The view singleton, auto create if the singleton has not been created yet.
* @return DooView
*/
public function view()
{
if ($this->_view == NULL) {
Doo::loadCore('view/DooView');
$this->_view = new DooView();
}
return $this->_view;
}
示例13: displayTitle
/**
* DooCliController class file.
*
* @author Richard Myers <richard.myers@hotmail.co.uk>
* @link http://www.doophp.com/
* @copyright Copyright © 2011 Leng Sheng Hong
* @license http://www.doophp.com/license
*/
/**
* DooCliController is the controller for CLI application should be use with Doo::app('DooCliApp')->run();
* @author Richard Myers <richard.myers@hotmail.co.uk>
* @package doo.controller
* @since 1.4
*/
Doo::loadCore('app/DooCliApp');
class DooCliController
{
const STREAM_STD_IN = "STD_IN";
const STREAM_STD_OUT = "STD_OUT";
/**
* Arguments from the comment line
*/
public $arguments = array();
/**
* Display a title in the consol
* @param string $title The title to be displayed
* @param bool $clearScreen Should the screen be cleared (so title sits at top of title)
* @param int $width Title will be positioned in the middle of this width
*/
protected function displayTitle($title, $clearScreen = true, $width = 80, $char = '=')
示例14: routeTo
/**
* Handles the routing process.
* Auto routing, sub folder, subdomain, sub folder on subdomain are supported.
* It can be used with or without the <i>index.php</i> in the URI
* @return mixed HTTP status code such as 404 or URL for redirection
*/
public function routeTo()
{
Doo::loadCore('uri/DooUriRouter');
$router = new DooUriRouter();
$routeRs = $router->execute($this->route, Doo::conf()->SUBFOLDER);
if ($routeRs[0] !== null && $routeRs[1] !== null) {
//dispatch, call Controller class
require_once Doo::conf()->BASE_PATH . "controller/DooController.php";
if ($routeRs[0][0] !== '[') {
if (strpos($routeRs[0], '\\') !== false) {
$nsClassFile = str_replace('\\', '/', $routeRs[0]);
$nsClassFile = explode(Doo::conf()->APP_NAMESPACE_ID . '/', $nsClassFile, 2);
$nsClassFile = $nsClassFile[1];
require_once Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . $nsClassFile . '.php';
} else {
// by Lua
$_File = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "controller/{$routeRs[0]}.php";
if (file_exists($_File)) {
require_once $_File;
} else {
require_once LUA_ROOT . ADMIN_ROOT . "/controller/{$routeRs[0]}.php";
}
}
} else {
$moduleParts = explode(']', $routeRs[0]);
$moduleName = substr($moduleParts[0], 1);
if (isset(Doo::conf()->PROTECTED_FOLDER_ORI) === true) {
require_once Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER_ORI . 'module/' . $moduleName . '/controller/' . $moduleParts[1] . '.php';
} else {
require_once Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . 'module/' . $moduleName . '/controller/' . $moduleParts[1] . '.php';
Doo::conf()->PROTECTED_FOLDER_ORI = Doo::conf()->PROTECTED_FOLDER;
}
//set class name
$routeRs[0] = $moduleParts[1];
Doo::conf()->PROTECTED_FOLDER = Doo::conf()->PROTECTED_FOLDER_ORI . 'module/' . $moduleName . '/';
}
if (strpos($routeRs[0], '/') !== false) {
$clsname = explode('/', $routeRs[0]);
$routeRs[0] = $clsname[sizeof($clsname) - 1];
}
//if defined class name, use the class name to create the Controller object
$clsnameDefined = sizeof($routeRs) === 4;
if ($clsnameDefined) {
$controller = new $routeRs[3]();
} else {
$controller = new $routeRs[0]();
}
$controller->params = $routeRs[2];
if (isset($controller->params['__extension']) === true) {
$controller->extension = $controller->params['__extension'];
unset($controller->params['__extension']);
}
if (isset($controller->params['__routematch']) === true) {
$controller->routematch = $controller->params['__routematch'];
unset($controller->params['__routematch']);
}
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
$controller->init_put_vars();
}
//before run, normally used for ACL auth
if ($clsnameDefined) {
if ($rs = $controller->beforeRun($routeRs[3], $routeRs[1])) {
return $rs;
}
} else {
if ($rs = $controller->beforeRun($routeRs[0], $routeRs[1])) {
return $rs;
}
}
$routeRs = $controller->{$routeRs}[1]();
$controller->afterRun($routeRs);
return $routeRs;
} else {
if (Doo::conf()->AUTOROUTE) {
list($controller_name, $method_name, $method_name_ori, $params, $moduleName) = $router->auto_connect(Doo::conf()->SUBFOLDER, isset($this->route['autoroute_alias']) === true ? $this->route['autoroute_alias'] : null);
if (empty($this->route['autoroute_force_dash']) === false) {
if ($method_name !== 'index' && $method_name === $method_name_ori && ctype_lower($method_name_ori) === false) {
$this->throwHeader(404);
return;
}
}
if (isset($moduleName) === true) {
Doo::conf()->PROTECTED_FOLDER_ORI = Doo::conf()->PROTECTED_FOLDER;
Doo::conf()->PROTECTED_FOLDER = Doo::conf()->PROTECTED_FOLDER_ORI . 'module/' . $moduleName . '/';
}
$controller_file = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "controller/{$controller_name}.php";
if (file_exists($controller_file)) {
require_once Doo::conf()->BASE_PATH . "controller/DooController.php";
require_once $controller_file;
$methodsArray = get_class_methods($controller_name);
//if the method not in controller class, check for a namespaced class with the same file name.
if ($methodsArray === null && isset(Doo::conf()->APP_NAMESPACE_ID) === true) {
if (isset($moduleName) === true) {
$controller_name = Doo::conf()->APP_NAMESPACE_ID . '\\module\\' . $moduleName . '\\controller\\' . $controller_name;
//.........这里部分代码省略.........
示例15: ProcessExecute
/**
* 供子类使用执行mysql
* @var array
*/
protected function ProcessExecute($procedure, &$param = array())
{
$output = array();
// 插入、变更数据必须进入下面的流程
if (!empty($param) && $this->cacheStrict) {
$res = self::get($this->_dbNameKey)->execute($procedure, $param, $this->_dimension, $this->_type);
foreach ($this->_cacheProcedureList as $key => $val) {
$vals = explode(',', $val);
if (in_array($procedure, $vals)) {
Doo::loadCore('cache/DooPhpCache');
$cacheObj = new DooPhpCache($this->_dbNameKey);
// 删除缓存数据
$cacheObj->del($cacheKey, $res);
}
}
} else {
if (isset($this->_cacheProcedureList[$procedure])) {
Doo::loadCore('cache/DooPhpCache');
$cacheObj = new DooPhpCache($this->_dbNameKey);
$cacheKey = empty($param) ? $procedure : $procedure . '_' . md5(var_export($param, true));
$res = $cacheObj->get($cacheKey);
if (empty($res)) {
$res = self::get($this->_dbNameKey)->execute($procedure, $param, $this->_dimension, $this->_type);
if (!empty($res)) {
// 写入缓存数据
$cacheObj->set($cacheKey, $res);
}
}
} else {
$res = self::get($this->_dbNameKey)->execute($procedure, $param, $this->_dimension, $this->_type);
}
}
// // 固定返回结果格式
// if($this->_success) {
// return array('success'=>$this->_success,'errors'=>$res);
// } else {
// return array('success'=>$this->_success,'errors'=>$this->_errors);
// }
$this->_dimension = 2;
$this->_type = 1;
return $res;
}