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


PHP add::is_development方法代码示例

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


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

示例1: execute

 /**
  * Process the page response (former $this->page())
  * @todo use a better term that is applicable to all response
  *
  * @since ADD MVC 0.0
  * @version 0.2
  */
 public function execute()
 {
     # ADD MVC 0.5 backward support
     if (method_exists($this, 'page')) {
         return $this->page();
     }
     try {
         $this->mode = isset($_REQUEST['mode']) ? "{$_REQUEST['mode']}" : '';
         $this->process_data();
     } catch (e_user $e) {
         if ($e instanceof e_user_malicious) {
             $e->handle_exception();
             die;
         }
         if ($this->mode) {
             $exception_label = "user_" . $this->mode;
         } else {
             $exception_label = "user";
         }
         $this->add_exception($e, $exception_label);
     }
     $this->assign('ctrl_basename', $this->basename());
     $this->assign('C', add::config());
     $error_messages = $this->view()->getTemplateVars('error_messages');
     if (is_array($error_messages)) {
         $this->assign('error_message', $error_messages[0]);
     }
     if (add::is_development()) {
         add::config()->root_timer->lap("Before Printing");
     }
     $this->print_response($this->data);
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:39,代码来源:ctrl_tpl_page.class.php

示例2: __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

示例3: environment_status

 /**
  * Sets and return or return an environment status
  *
  * @since ADD MVC 0.8
  */
 public static function environment_status($new_status = null)
 {
     if ($new_status) {
         if (is_string($new_status)) {
             if ($new_status === 'development') {
                 if (add::is_developer()) {
                     add::$environment_status = $new_status;
                 } else {
                     add::$environment_status = "live";
                 }
             } else {
                 if ($new_status === 'live') {
                     add::$environment_status = 'live';
                 } else {
                     throw new e_developer("Invalid environment_status: {$new_status}");
                 }
             }
         }
         /**
          * No errors if live
          *
          * @since ADD MVC 0.7.2
          */
         if (add::is_live()) {
             error_reporting(0);
             add::$handle_shutdown = false;
         } else {
             error_reporting(E_ALL);
             /**
              * When development, record the time spent on script execution
              *
              * @since ADD MVC 0.7.2
              */
             if (add::is_development()) {
                 add::$handle_shutdown = true;
                 if (!isset($GLOBALS['add_mvc_root_timer'])) {
                     $GLOBALS['add_mvc_root_timer'] = add_development_timer::start("Framework Configuration");
                 }
                 add::config()->root_timer = $GLOBALS['add_mvc_root_timer'];
             }
         }
     }
     return add::$environment_status;
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:49,代码来源:add.class.php

示例4: environment_status

 /**
  * Sets and return or return an environment status
  *
  * @since ADD MVC 0.8
  */
 public static function environment_status($new_status = null)
 {
     /**
      *
      * @see http://code.google.com/p/add-mvc-framework/issues/detail?id=33
      */
     if (!add::is_developer()) {
         if (add::$environment_status != 'live' || isset($new_status) && $new_status != 'live') {
             $new_status = 'live';
         }
     }
     if ($new_status) {
         if (is_string($new_status)) {
             if ($new_status === 'development') {
                 if (add::is_developer()) {
                     add::$environment_status = $new_status;
                 } else {
                     add::$environment_status = "live";
                 }
             } else {
                 if ($new_status === 'live') {
                     add::$environment_status = 'live';
                 } else {
                     throw new e_developer("Invalid environment_status: {$new_status}");
                 }
             }
         } else {
             if ($new_status !== true) {
                 throw new e_developer("Invalid new environment status", $new_status);
             }
         }
         /**
          * No errors if live
          *
          * @since ADD MVC 0.7.2
          */
         if (add::is_live()) {
             error_reporting(0);
             ini_set('display_errors', 0);
             add::$handle_shutdown = false;
         } else {
             error_reporting(E_ALL);
             ini_set('display_errors', 1);
             /**
              * When development, record the time spent on script execution
              *
              * @since ADD MVC 0.7.2
              */
             if (add::is_development()) {
                 add::$handle_shutdown = true;
                 if (!isset($GLOBALS['add_mvc_root_timer'])) {
                     $GLOBALS['add_mvc_root_timer'] = add_development_timer::start("Framework Configuration");
                 }
                 add::config()->root_timer = $GLOBALS['add_mvc_root_timer'];
             }
         }
     }
     return add::$environment_status;
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:64,代码来源:add.class.php

示例5: 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()
 {
     # Fix for issue #6
     if (current_ip_in_network()) {
         return true;
     }
     if (isset(add::config()->developer_ips) && is_array(add::config()->developer_ips)) {
         return in_array(current_user_ip(), add::config()->developer_ips);
     } else {
         return add::is_development();
     }
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:19,代码来源:add.class.php

示例6: process_data

 /**
  * The pre-view process
  *
  * @param array $common_gpc
  *
  * @since ADD MVC 0.0
  */
 public function process_data($common_gpc = array())
 {
     header("HTTP/1.0 404 Not Found");
     $this->assign('is_development', add::is_development());
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:12,代码来源:ctrl_page_404.class.php

示例7: execute

 /**
  * Process the page response (former $this->page())
  *
  * @todo remove the automatic assigning of {$C}
  *
  * @since ADD MVC 0.0
  * @version 0.2
  */
 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);
     try {
         $this->set_mode();
         $this->process_data(isset($this->common_gpc) ? $this->recursive_compact($this->common_gpc) : array());
     } catch (e_user $e) {
         if ($e instanceof e_user_malicious) {
             $e->handle_exception();
             die;
         }
         if ($this->mode) {
             $exception_label = "user_" . $this->mode;
         } else {
             $exception_label = "user";
         }
         /**
          *
          *
          * // what if $e is unrelated to $this->gpc_filter_exception
          * if ($this->gpc_filter_exception instanceof e_user_input) {
          *    $e = $this->gpc_filter_exception;
          * }
          *
          */
         $this->add_exception($e, $exception_label);
     }
     $this->assign('ctrl_basename', $this->basename());
     $this->assign('C', add::config());
     $error_messages = isset($this->data['error_messages']) && is_array($this->data['error_messages']) ? $this->data['error_messages'] : array();
     if (is_array($error_messages) && isset($error_messages[0])) {
         $this->assign('error_message', $error_messages[0]);
     }
     if (add::is_development()) {
         add::config()->root_timer->lap("Before Printing");
     }
     $this->print_response($this->data);
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:51,代码来源:ctrl_tpl_page.class.php

示例8: implode

 * Set the exception emails
 *
 * @see http://code.google.com/p/add-mvc-framework/issues/detail?id=38
 *
 *
 */
if (isset($C->developer_emails)) {
    if (is_string($C->developer_emails)) {
        e_add::$email_addresses = $C->developer_emails;
    } else {
        if (is_object($C->developer_emails) || is_array($C->developer_emails)) {
            e_add::$email_addresses = implode(", ", (array) $C->developer_emails);
        }
    }
}
if (add::is_development() && !is_writeable($C->caches_dir)) {
    $C->caches_dir = sys_get_temp_dir() . '/add_mvc_caches_' . sha1($C->root_dir);
    if (!file_exists($C->caches_dir)) {
        umask(0);
        mkdir($C->caches_dir);
    } else {
        if (!is_dir($C->caches_dir)) {
            throw new e_system("Cache directory is not a directory", $C->caches_dir);
        }
    }
}
if (!is_writeable($C->caches_dir)) {
    if (!file_exists($C->caches_dir)) {
        throw new e_system("Cache directory is not existing ", $C->caches_dir);
    }
    if (!is_dir($C->caches_dir)) {
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:31,代码来源:init.php

示例9: view_filepath

 /**
  * Exception page view filepath name
  *
  */
 public static function view_filepath()
 {
     if (add::is_development()) {
         $tpl_filepath = "exceptions/development/" . static::view_basename() . ".tpl";
         if (!static::view()->templateExists($tpl_filepath)) {
             $tpl_filepath = "exceptions/development/e_add.tpl";
         }
         if (static::view()->templateExists($tpl_filepath)) {
             return $tpl_filepath;
         } else {
             # Throw a default exception cause we are already on a a custom exception
             throw new Exception("No development view file found for exception " . print_r($this, true));
         }
     } else {
         $tpl_filepath = "exceptions/" . static::view_basename() . ".tpl";
         if (!static::view()->templateExists($tpl_filepath)) {
             $parent_class = get_parent_class(get_called_class());
             $tpl_filepath = $parent_class::view_filepath();
         }
         return $tpl_filepath;
     }
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:26,代码来源:e_add.class.php

示例10: handle_sensitive_exception

 /**
  * Handling Exceptions
  *
  * @since ADD MVC 0.7
  */
 public function handle_sensitive_exception($user_message = "An error has occured")
 {
     if (add::is_development()) {
         $this->print_exception();
         die;
     } else {
         $this->mail();
         $this->view()->assign('exception', $this);
         $this->view()->assign('C', add::config());
         $this->display_view();
     }
 }
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:17,代码来源:e_add.class.php

示例11:

<?php

require 'config.php';
#echo "ADD DIR: ".$C->add_dir;
require $C->add_dir . '/init.php';
#date_default_timezone_set(add::config()->default_timezone);
if (add::config()->debug_sql && add::is_development() && add::is_developer()) {
    locust_mule_db::singleton()->debug = true;
}
开发者ID:albertdiones,项目名称:locust-mule,代码行数:9,代码来源:add_configure.php

示例12: error_reporting

 */
$C->assets_path = $C->base_url . '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/';
/**
 * No errors if live
 *
 * @since ADD MVC 0.7.2
 */
if (add::is_live()) {
    error_reporting(0);
} else {
    error_reporting(E_ALL);
    /**
     * When development, record the time spent on script execution
     *
     * @since ADD MVC 0.7.2
     */
    if (add::is_development()) {
        $GLOBALS['add_mvc_root_timer'] = add_development_timer::start("Framework Configuration");
        add::config()->root_timer = $GLOBALS['add_mvc_root_timer'];
    }
}
add::load_functions('common');
/**
 * Libraries
 */
add::load_lib('adodb');
add::load_lib('smarty');
开发者ID:google-code-backups,项目名称:add-mvc-framework,代码行数:31,代码来源:init.php


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