本文整理汇总了PHP中add类的典型用法代码示例。如果您正苦于以下问题:PHP add类的具体用法?PHP add怎么用?PHP add使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了add类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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());
}
}
示例3: current_user_allowed
public static function current_user_allowed()
{
add::load_functions('network');
if (current_ip_in_network()) {
return true;
} else {
return false;
}
}
示例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);
}
示例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/';
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
}
示例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");
}
}
}
}
示例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
}
}
}
}
}
示例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;
}
}
示例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();
示例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
*
示例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();