本文整理汇总了PHP中add类的典型用法代码示例。如果您正苦于以下问题:PHP add类的具体用法?PHP add怎么用?PHP add使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了add类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process_mode_default
/**
* The default process
*
* @since ADD MVC 0.0
*/
public function process_mode_default()
{
$this->view()->assign('current_controller', add::current_controller_class());
$this->view()->assign('current_view', $this->view_filepath());
$this->view()->assign('utc_timestamp', time());
$this->view()->assign('member', member::current_logged_in());
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:12,代码来源:ctrl_page_index.class.php
示例2: require_dir_exists
/**
* Require existence of a directory
*
* @since ADD MVC 0.5
*/
public static function require_dir_exists($dir, $writable = null)
{
if (!file_exists($dir)) {
throw new e_system("Directory {$dir} is not existing", add::config());
}
if (!is_writable($dir)) {
throw new e_system("Directory {$dir} is not writable", add::config());
}
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:14,代码来源:ctrl_page_index.class.php
示例3: current_user_allowed
public static function current_user_allowed()
{
add::load_functions('network');
if (current_ip_in_network()) {
return true;
} else {
return false;
}
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:9,代码来源:debug.class.php
示例4: process
/**
* The pre-view process
*
* @since ADD MVC 0.0
*/
public function process()
{
# Required Directories
self::require_dir_exists(add::config()->incs_dir);
self::require_dir_exists(add::config()->caches_dir, true);
$this->require_dir($this->view()->compile_dir, true);
$this->require_dir($this->view()->cache_dir, true);
# Other essential directories
$this->check_dir_exists(add::config()->classes_dir);
$this->check_dir_exists(add::config()->assets_dir);
$this->check_dir_exists(add::config()->css_dir);
$this->check_dir_exists(add::config()->js_dir);
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:18,代码来源:ctrl_page_index.class.php
示例5: __construct
/**
* Smarty construct
*
* @since ADD MVC 0.0
*/
public function __construct()
{
$C = add::config();
parent::__construct();
if (is_array($C->views_dir)) {
$this->setTemplateDir(array_merge($C->views_dir, array($C->add_dir . '/views/')));
} else {
$this->setTemplateDir(array($C->views_dir, $C->add_dir . '/views/'));
}
$this->compile_dir = $C->caches_dir . '/smarty_compile/';
$this->config_dir = $C->configs_dir . '/smarty/';
$this->cache_dir = $C->caches_dir . '/smarty_cache/';
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:18,代码来源:add_smarty.class.php
示例6: execute
/**
* Must echo the page response
*
* @since ADD MVC 0.6
*/
public function execute()
{
# ADD MVC 0.5 backward support
if (method_exists($this, 'page')) {
return $this->page();
}
# Set Content Type
$this->content_type($this->content_type);
$this->mode = isset($_REQUEST['mode']) ? "{$_REQUEST['mode']}" : '';
add::$handle_shutdown = false;
$this->process_data(isset($this->common_gpc) ? ctrl_tpl_page::recursive_compact($this->common_gpc) : array());
$this->print_response($this->data);
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:18,代码来源:ctrl_tpl_ajax.class.php
示例7: page
/**
* run the page
*
* @since ADD MVC 0.4
*/
public function page()
{
header("Content-type: text/plain");
e_hack::assert($this->can_run(), "Invalid aux script authentication key");
ob_start();
try {
$this->process();
} catch (Exception $e) {
add::handle_exception($e);
}
$this->response = ob_get_clean();
$this->handle_response();
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:18,代码来源:ctrl_tpl_aux.class.php
示例8: execute
/**
* run the page
*
* @since ADD MVC 0.6.2
*/
public function execute()
{
e_hack::assert($this->can_run(), "Invalid aux script authentication key");
# Set Content Type
$this->content_type($this->content_type);
ob_start();
try {
$this->process_data();
} catch (Exception $e) {
add::handle_exception($e);
}
$this->response = ob_get_clean();
$this->handle_response();
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:19,代码来源:ctrl_tpl_aux.class.php
示例9: process_mode_login
/**
* Login
*
* @param array $gpc - contains $gpc['username'] and $gpc['password']
*
*/
public function process_mode_login($gpc)
{
# validation on controller
if (empty($gpc['username'])) {
throw new e_user_input("Blank username");
}
if (empty($gpc['password'])) {
throw new e_user_input("Blank password");
}
# login the session user class
if (member::login($gpc['username'], $gpc['password']) instanceof member) {
add::redirect(add::config()->path);
}
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:20,代码来源:ctrl_page_login.class.php
示例10: load_dir_classes
public static function load_dir_classes($dir)
{
$class_files = new DirectoryIterator($dir);
foreach ($class_files as $class_file) {
if ($class_file->isDot()) {
continue;
}
if ($class_file->isDir()) {
static::load_dir_classes($class_file->getPathName());
continue;
}
if (preg_match('/(\\.class)?\\.php$/', $class_file->getFileName())) {
$class_name = $class_file->getBaseName('.class.php');
if (!$class_name) {
var_dump($class_file->getPathName());
die;
}
if (add::load_class($class_name)) {
static::println("{$class_name} successfully loaded");
}
}
}
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:23,代码来源:load_classes.php
示例11: __construct
/**
* Smarty construct
*
* @since ADD MVC 0.0
*/
public function __construct()
{
$C = add::config();
parent::__construct();
if (is_array($C->views_dir)) {
$this->setTemplateDir(array_merge($C->views_dir, array($C->add_dir . '/views/')));
} else {
$this->setTemplateDir(array($C->views_dir, $C->add_dir . '/views/'));
}
$this->compile_dir = $C->caches_dir . '/smarty_compile/';
$this->config_dir = $C->configs_dir . '/smarty/';
$this->cache_dir = $C->caches_dir . '/smarty_cache/';
if (add::is_development()) {
foreach (array($this->compile_dir, $this->cache_dir) as $dir) {
if (!is_dir($dir)) {
$this->_dir_perms = 0777;
} else {
if (!is_writable($dir)) {
# Do something
}
}
}
}
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:29,代码来源:add_smarty.class.php
示例12: is_developer
/**
* is_developer()
*
* Checks if the user is developer according to his/her IP
*
* @since ADD MVC 0.7.2
*/
public static function is_developer()
{
/**
* @see http://code.google.com/p/add-mvc-framework/issues/detail?id=39
*/
if (php_sapi_name() == "cli") {
return true;
}
# Fix for issue #6
if (current_ip_in_network()) {
return true;
}
if (isset(add::config()->developer_ips)) {
return in_array(current_user_ip(), (array) add::config()->developer_ips);
} else {
return false;
}
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:25,代码来源:add.class.php
示例13:
<?php
/**
* Created by PhpStorm.
* @author albert
* Date: 1/18/16
* Time: 3:41 AM
*/
require 'add_configure.php';
$current_controller = add::current_controller();
$current_controller->execute();
开发者ID:albertdiones,项目名称:locust-mule,代码行数:11,代码来源:add.php
示例14: array
<?php
if (!class_exists('phpmailer')) {
add::load_lib('phpmailer');
}
/**
* Mailer Abstract
*
*/
abstract class ctrl_mailer_abstract extends phpmailer
{
/**
* Default Wordwrap 70 characters
*
* @var int
*
*/
public $WordWrap = 70;
/**
* View variable cache
*
*/
protected static $views;
/**
* assign()ed data
*
*/
protected $data = array();
/**
* controller variable cache
*
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:31,代码来源:ctrl_mailer_abstract.class.php
示例15: date_default_timezone_set
<?php
require '../config.php';
require $C->add_dir . '/init.php';
date_default_timezone_set('UTC');
$G_errors = array();
session_start();
session_set_cookie_params(3600, $C->path, $C->domain, true);
#add::canonicalize_path();
add::current_controller()->page();
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:10,代码来源:add.php
示例16: trigger_error
trigger_error("Cache directory is not writeable", E_USER_WARNING);
unset($cache_file, $cache_files);
}
if (!isset($C->assets_dir)) {
$C->assets_dir = $C->root_dir . '/assets';
}
if (!isset($C->images_dir)) {
$C->images_dir = $C->assets_dir . '/images';
}
if (!isset($C->css_dir)) {
$C->css_dir = $C->assets_dir . '/css';
}
$C->js_dir = $C->assets_dir . '/js';
$C->domain = ($C->sub_domain ? "{$C->sub_domain}." : "") . $C->super_domain;
$C->base_url = "http://{$C->domain}{$C->path}";
set_include_path($C->incs_dir);
/**
* assets
* @author [email protected]
*/
$C->assets_path = $C->path . 'assets/';
$C->css_path = $C->assets_path . 'css/';
$C->js_path = $C->assets_path . 'js/';
$C->images_path = $C->assets_path . 'images/';
$C->assets_libs_path = $C->assets_path . 'libs/';
/**
* Libraries
*/
add::load_lib('adodb');
add::load_lib('smarty');
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:30,代码来源:init.php
示例17: is_development
/**
* environment check: is_development()
*
* @since ADD MVC 0.7
*/
public static function is_development()
{
return add::config()->environment_status === 'development';
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:9,代码来源:add.class.php
示例18: fetch_view
public function fetch_view()
{
$this->view()->assign('C', add::config());
return $this->view()->fetch(static::view_filepath());
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:5,代码来源:ctrl_tpl_mailer.class.php
示例19: content_type
/**
* sets the content_type or get the current one
*
* @param string $new_content_type
*
* @deprecated see add::content_type();
*
* @since ADD MVC 0.8
*/
public function content_type($new_content_type = null)
{
return add::content_type($new_content_type);
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:13,代码来源:ctrl_tpl_page.class.php
示例20: handle_error
/**
* handle_error()
* callback function for handling trigger_error() errors
*
* @param int $errno contains the level of the error raised, as an integer.
* @param string $errstr contains the error message, as a string.
* @param string $errfile contains the filename that the error was raised in, as a string.
* @param int $errline contains the line number the error was raised at, as an integer.
* @param array $errcontext an array that points to the active symbol table at the point the error occurred. In other words, errcontext will contain an array of every variable that existed in the scope the error was triggered in. User error handler must not modify error context.
*
* @see http://www.php.net/manual/en/function.set-error-handler.php
* @version 1.0
*/
function handle_error($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL)
{
return add::handle_error($errno, $errstr, $errfile, $errline, $errcontext);
}
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:17,代码来源:common.functions.php
注:本文中的add类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论