當前位置: 首頁>>代碼示例>>PHP>>正文


PHP require_array函數代碼示例

本文整理匯總了PHP中require_array函數的典型用法代碼示例。如果您正苦於以下問題:PHP require_array函數的具體用法?PHP require_array怎麽用?PHP require_array使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了require_array函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 /**
  * 應用程序初始化
  */
 public static function start()
 {
     // 加載默認配置
     C(include CONF_PATH . '/convention.php');
     date_default_timezone_set(C('DEFAULT_TIMEZONE'));
     // 環境變量
     putenv('LC_ALL=C');
     putenv('LANG="zh_CN.UTF-8"');
     spl_autoload_register(array('M3d', 'autoload'));
     require_array(array(LIB_PATH . '/Core/Dispatcher.class.php', LIB_PATH . '/Core/Model.class.php', LIB_PATH . '/Core/Action.class.php', LIB_PATH . '/Core/View.class.php', LIB_PATH . '/Core/Tool.class.php', LIB_PATH . '/Core/Plugin.class.php'));
     define('REQUEST_METHOD', strtolower($_SERVER['REQUEST_METHOD']));
     define('IS_GET', REQUEST_METHOD === 'get');
     define('IS_POST', REQUEST_METHOD === 'post');
     define('IS_PUT', REQUEST_METHOD === 'put');
     define('IS_DELETE', REQUEST_METHOD === 'delete');
     define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
     Tool::start();
     Plugin::start();
     // 加載全局配置
     C(include C('M3D_CONF_PATH') . '/config.php');
     // 加載project配置
     C(include PROJECT_PATH . '/conf/config.php');
     Dispatcher::dispatch();
     self::exec();
 }
開發者ID:chenyongze,項目名稱:m3d,代碼行數:28,代碼來源:M3d.class.php

示例2: factory

 public static function factory($options)
 {
     $options = is_array($options) ? $options : array();
     //隻實例化一個對象
     if (is_null(self::$cacheFactory)) {
         self::$cacheFactory = new cacheFactory();
     }
     $driver = isset($options['driver']) ? $options['driver'] : C("CACHE_TYPE");
     //靜態緩存實例名稱
     $driverName = md5_s($options);
     //對象實例存在
     if (isset(self::$cacheFactory->cacheList[$driverName])) {
         return self::$cacheFactory->cacheList[$driverName];
     }
     $class = 'Cache' . ucwords(strtolower($driver));
     //緩存驅動
     $classFile = YY_PATH . 'Cache/' . $class . '.class.php';
     //加載驅動類庫文件
     if (!require_array($classFile)) {
         halt("緩存類型指定錯誤,不存在緩存驅動文件:" . $classFile);
     }
     $cacheObj = new $class($options);
     self::$cacheFactory->cacheList[$driverName] = $cacheObj;
     return self::$cacheFactory->cacheList[$driverName];
 }
開發者ID:kumfo,項目名稱:YYphp,代碼行數:25,代碼來源:CacheFactory.class.php

示例3: autoload

 private static function autoload($className)
 {
     $class = ucfirst($className) . '.class.php';
     if (substr($className, -5) == "Model") {
         if (require_array(array(MODEL_PATH . $class, HDPHP_DRIVER_PATH . 'Model/' . $class, COMMON_MODEL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -7) == "Control") {
         if (require_array(array(CONTROL_PATH . $class, HDPHP_CORE_PATH . $class, COMMON_CONTROL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, 0, 2) == 'Db') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Db/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 5) == "Cache") {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Cache/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 7) == "Session") {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Session/' . $class))) {
             return;
         }
     } elseif (substr($className, -5) == "Event") {
         if (require_array(array(EVENT_PATH . $class, COMMON_EVENT_PATH . $class))) {
             return;
         }
     } elseif (alias_import($className)) {
         return;
     } elseif (require_array(array(EVENT_PATH . $class, LIB_PATH . $class, TAG_PATH . $class, COMMON_LIB_PATH . $class, HDPHP_CORE_PATH . $class, HDPHP_EXTEND_PATH . $class, HDPHP_EXTEND_PATH . '/Tool/' . $class))) {
         return;
     }
     $msg = "Class {$class} not found";
     Log::write($msg);
     error($msg);
 }
開發者ID:sxau-web-team,項目名稱:wish-web,代碼行數:36,代碼來源:Boot.php

示例4: autoload

 /**
  * 係統自動加載ThinkPHP類庫
  * 並且支持配置自動加載路徑
  * @param string $class 對象類名
  * @return void
  */
 public static function autoload($class)
 {
     // 檢查是否存在別名定義
     if (alias_import($class)) {
         return;
     }
     $libPath = defined('BASE_LIB_PATH') ? BASE_LIB_PATH : LIB_PATH;
     $group = defined('GROUP_NAME') && C('APP_GROUP_MODE') == 0 ? GROUP_NAME . '/' : '';
     $file = $class . '.class.php';
     if (substr($class, -8) == 'Behavior') {
         // 加載行為
         if (require_array(array(CORE_PATH . 'Behavior/' . $file, EXTEND_PATH . 'Behavior/' . $file, LIB_PATH . 'Behavior/' . $file, $libPath . 'Behavior/' . $file), true) || defined('MODE_NAME') && require_cache(MODE_PATH . ucwords(MODE_NAME) . '/Behavior/' . $file)) {
             return;
         }
     } elseif (substr($class, -5) == 'Model') {
         // 加載模型
         if (require_array(array(LIB_PATH . 'Model/' . $group . $file, $libPath . 'Model/' . $file, EXTEND_PATH . 'Model/' . $file), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'Action') {
         // 加載控製器
         if (require_array(array(LIB_PATH . 'Action/' . $group . $file, $libPath . 'Action/' . $file, EXTEND_PATH . 'Action/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 5) == 'Cache') {
         // 加載緩存驅動
         if (require_array(array(EXTEND_PATH . 'Driver/Cache/' . $file, CORE_PATH . 'Driver/Cache/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 2) == 'Db') {
         // 加載數據庫驅動
         if (require_array(array(EXTEND_PATH . 'Driver/Db/' . $file, CORE_PATH . 'Driver/Db/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Template') {
         // 加載模板引擎驅動
         if (require_array(array(EXTEND_PATH . 'Driver/Template/' . $file, CORE_PATH . 'Driver/Template/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 6) == 'TagLib') {
         // 加載標簽庫驅動
         if (require_array(array(EXTEND_PATH . 'Driver/TagLib/' . $file, CORE_PATH . 'Driver/TagLib/' . $file), true)) {
             return;
         }
     }
     // 根據自動加載路徑設置進行嘗試搜索
     $paths = explode(',', C('APP_AUTOLOAD_PATH'));
     foreach ($paths as $path) {
         if (import($path . '.' . $class)) {
             // 如果加載類成功則返回
             return;
         }
     }
 }
開發者ID:ysking,項目名稱:commlib,代碼行數:60,代碼來源:Think.class.php

示例5: autoload

 /**
  * The system automatically loads the library Senthot
  * And Support configure automatic loading path
  * @param string $class Object class name
  * @return void
  */
 public static function autoload($class)
 {
     // Check for alias definitions
     if (alias_import($class)) {
         return;
     }
     $libPath = defined('BASE_LIB_PATH') ? BASE_LIB_PATH : LIB_PATH;
     $group = defined('GROUP_NAME') && C('APP_GROUP_MODE') == 0 ? GROUP_NAME . '/' : '';
     $file = $class . '.class.php';
     if (substr($class, -8) == 'Behavior') {
         // Load Behavior
         if (require_array(array(CORE_PATH . 'Behavior/' . $file, ADDONS_PATH . 'Behavior/' . $file, LIB_PATH . 'Behavior/' . $file, $libPath . 'Behavior/' . $file), true) || defined('MODE_NAME') && require_cache(MODE_PATH . ucwords(MODE_NAME) . '/Behavior/' . $file)) {
             return;
         }
     } elseif (substr($class, -5) == 'Model') {
         // Load Model
         if (require_array(array(LIB_PATH . 'Model/' . $group . $file, $libPath . 'Model/' . $file, ADDONS_PATH . 'Model/' . $file), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'Action') {
         // Load Controller
         if (require_array(array(LIB_PATH . 'Action/' . $group . $file, $libPath . 'Action/' . $file, ADDONS_PATH . 'Action/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 5) == 'Cache') {
         // Load cache drive
         if (require_array(array(ADDONS_PATH . 'Driver/Cache/' . $file, CORE_PATH . 'Driver/Cache/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 2) == 'Db') {
         // Load database driver
         if (require_array(array(ADDONS_PATH . 'Driver/Db/' . $file, CORE_PATH . 'Driver/Db/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Template') {
         // Loading template engine driven
         if (require_array(array(ADDONS_PATH . 'Driver/Template/' . $file, CORE_PATH . 'Driver/Template/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 6) == 'TagLib') {
         // Load tag library drive
         if (require_array(array(ADDONS_PATH . 'Driver/TagLib/' . $file, CORE_PATH . 'Driver/TagLib/' . $file), true)) {
             return;
         }
     }
     // According to the settings automatically load path try to search
     $paths = explode(',', C('APP_AUTOLOAD_PATH'));
     foreach ($paths as $path) {
         if (import($path . '.' . $class)) {
             // If you load the class success, returns
             return;
         }
     }
 }
開發者ID:davidpersson,項目名稱:FrameworkBenchmarks,代碼行數:60,代碼來源:Sen.class.php

示例6: autoload

 public static function autoload($class)
 {
     if (alias_import($class)) {
         return;
     }
     $libPath = defined('BASE_LIB_PATH') ? BASE_LIB_PATH : LIB_PATH;
     $group = defined('GROUP_NAME') && C('APP_GROUP_MODE') == 0 ? GROUP_NAME . '/' : '';
     $file = $class . '.class.php';
     if (substr($class, -8) == 'Behavior') {
         if (require_array(array(CORE_PATH . 'Behavior/' . $file, EXTEND_PATH . 'Behavior/' . $file, LIB_PATH . 'Behavior/' . $file, $libPath . 'Behavior/' . $file), true) || defined('MODE_NAME') && require_cache(MODE_PATH . ucwords(MODE_NAME) . '/Behavior/' . $file)) {
             return;
         }
     } elseif (substr($class, -5) == 'Model') {
         $model = ucwords(str_replace('Model', "", $class));
         if (require_array(array(LIB_PATH . 'Model/' . $group . $file, $libPath . 'Model/' . $file, EXTEND_PATH . 'Model/' . $file, APP_PATH . C("APP_GROUP_PATH") . "/{$model}/Model/{$class}.class.php"), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'Action') {
         if (require_array(array(LIB_PATH . 'Action/' . $group . $file, $libPath . 'Action/' . $file, EXTEND_PATH . 'Action/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 5) == 'Cache') {
         if (require_array(array(EXTEND_PATH . 'Driver/Cache/' . $file, CORE_PATH . 'Driver/Cache/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 2) == 'Db') {
         if (require_array(array(EXTEND_PATH . 'Driver/Db/' . $file, CORE_PATH . 'Driver/Db/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Template') {
         if (require_array(array(EXTEND_PATH . 'Driver/Template/' . $file, CORE_PATH . 'Driver/Template/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 6) == 'TagLib') {
         if (require_array(array(EXTEND_PATH . 'Driver/TagLib/' . $file, CORE_PATH . 'Driver/TagLib/' . $file, LIB_PATH . "/TagLib/{$class}.class.php"), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'TagLib') {
         if (require_cache(LIB_PATH . "/TagLib/{$class}.class.php")) {
             return;
         }
     } elseif (substr($class, -7) == 'Service') {
         if (require_cache(LIB_PATH . "/Service/{$class}.class.php")) {
             return;
         }
     } elseif (substr($class, 0, 10) == 'Attachment') {
         if (require_cache(LIB_PATH . "/Driver/Attachment/{$class}.class.php")) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Passport') {
         if (require_cache(LIB_PATH . "/Driver/Passport/{$class}.class.php")) {
             return;
         }
     } elseif (in_array($class, array('content_update', 'content_output', 'content_input', 'content_form', 'content_delete'))) {
         if (require_cache(RUNTIME_PATH . "{$class}.class.php")) {
             return;
         } else {
             D("Content_cache")->model_content_cache();
             if (is_file(RUNTIME_PATH . "{$class}.class.php")) {
                 include RUNTIME_PATH . "{$class}.class.php";
             }
         }
     } else {
         if (require_cache(LIB_PATH . "/Util/{$class}.class.php")) {
             return;
         }
     }
     $paths = explode(',', C('APP_AUTOLOAD_PATH'));
     foreach ($paths as $path) {
         if (import($path . '.' . $class)) {
             return;
         }
     }
 }
開發者ID:NeilFee,項目名稱:vipxinbaigo,代碼行數:74,代碼來源:~runtime.php

示例7: __autoload

function __autoload($class)
{
    if (substr($class, -10) == 'Controller') {
        require_array(array(CONTROLLER_PATH . $class . '.class.php', YY_PATH . $class . '.class.php'));
    } else {
        if (substr($class, -5) == 'Model') {
            require_array(array(MODEL_PATH . $class . '.class.php', YY_PATH . $class . '.class.php'));
        } elseif (substr($class, 0, 2) == 'Db') {
            require_array(array(YY_PATH . 'Driver/Db/' . $class . '.class.php'));
        } elseif (substr($class, -5) == 'Cache') {
            require_array(array(YY_PATH . 'Core/' . $class . '.class.php'));
        }
    }
}
開發者ID:kumfo,項目名稱:YYphp,代碼行數:14,代碼來源:functions.php

示例8: control

/**
 * 實例化控製器並執行方法
 * @param $control 控製器
 * @param null $method 方法
 * @param array $args 參數
 * @return bool|mixed
 */
function control($class, $method = NULl, $args = array())
{
    $class = $class . C('CONTROL_FIX');
    $classfile = $class . '.class.php';
    if (require_array(array(HDPHP_CORE_PATH . $classfile, CONTROL_PATH . $classfile, COMMON_CONTROL_PATH . $classfile))) {
        if (class_exists($class)) {
            $obj = new $class();
            if ($method && method_exists($obj, $method)) {
                return call_user_func_array(array(&$obj, $method), $args);
            }
            return $obj;
        }
    } else {
        return false;
    }
}
開發者ID:jyht,項目名稱:v5,代碼行數:23,代碼來源:Functions.php

示例9: autoload

 /**
  * 自動載入函數
  * @param string $className 類名
  * @access private
  * @return void
  */
 public static function autoload($className)
 {
     $class = ucfirst($className) . '.class.php';
     //類文件
     if (substr($className, -5) == 'Model' && require_array(array(HDPHP_DRIVER_PATH . 'Model/' . $class, MODULE_MODEL_PATH . $class, APP_MODEL_PATH . $class))) {
         return;
     } elseif (substr($className, -10) == 'Controller' && require_array(array(HDPHP_CORE_PATH . $class, MODULE_CONTROLLER_PATH . $class, APP_CONTROLLER_PATH . $class))) {
         return;
     } elseif (substr($className, 0, 2) == 'Db' && require_array(array(HDPHP_DRIVER_PATH . 'Db/' . $class))) {
         return;
     } elseif (substr($className, 0, 5) == 'Cache' && require_array(array(HDPHP_DRIVER_PATH . 'Cache/' . $class))) {
         return;
     } elseif (substr($className, 0, 4) == 'View' && require_array(array(HDPHP_DRIVER_PATH . 'View/' . $class))) {
         return;
     } elseif (substr($className, -4) == 'Hook' && require_array(array(MODULE_HOOK_PATH . $class, APP_HOOK_PATH . $class))) {
         return;
     } elseif (substr($className, -5) == 'Addon' && require_array(array(APP_ADDON_PATH . $class))) {
         return;
     } elseif (substr($className, -3) == 'Tag' && require_array(array(APP_TAG_PATH . $class, MODULE_TAG_PATH . $class))) {
         return;
     } elseif (substr($className, -7) == 'Storage' && require_array(array(HDPHP_DRIVER_PATH . 'Storage/' . $class))) {
         return;
     } elseif (alias_import($className)) {
         return;
     } elseif (require_array(array(MODULE_LIB_PATH . $class, APP_LIB_PATH . $class, HDPHP_CORE_PATH . $class, HDPHP_EXTEND_PATH . '/Tool/' . $class))) {
         return;
     }
 }
開發者ID:hdbaiyu,項目名稱:HDPHP,代碼行數:34,代碼來源:HDPHP.class.php

示例10: loadParseTags

 private function loadParseTags()
 {
     $tagClass = array();
     $tags = C('TPL_TAGS');
     if (!empty($tags) && is_array($tags)) {
         foreach ($tags as $file) {
             $file = str_replace(".", "/", $file);
             $info = explode("/", $file);
             $class = array_pop($info);
             if (class_exists($class, false)) {
             } else {
                 if (require_array(array(TAG_PATH . $file . '.class.php', COMMON_TAG_PATH . $file . '.class.php'))) {
                 } else {
                     if (import($file)) {
                     } else {
                         if (DEBUG) {
                             halt("標簽類文件{$class}不存在");
                         } else {
                             continue;
                         }
                     }
                 }
             }
             $tmp = explode(".", $class);
             $tagClass[] = array_pop($tmp);
         }
     }
     if (import('HDPHP.Lib.Driver.View.ViewTag')) {
         $tagClass[] = 'ViewTag';
         $this->parseTagClass($tagClass);
     }
 }
開發者ID:jyht,項目名稱:v5,代碼行數:32,代碼來源:~boot.php

示例11: autoload

 /**
  * 自動載入函數
  * @param string $className 類名
  * @access private
  * @return void
  */
 public static function autoload($className)
 {
     $class = ucfirst($className) . '.class.php';
     //類文件
     if (substr($className, -5) == 'Model') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Model/' . $class, MODEL_PATH . $class, COMMON_MODEL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -7) == 'Control') {
         if (require_array(array(HDPHP_CORE_PATH . $class, CONTROL_PATH . $class, COMMON_CONTROL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, 0, 2) == 'Db') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Db/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 5) == 'Cache') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Cache/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 4) == 'View') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'View/' . $class))) {
             return;
         }
     } elseif (substr($className, -5) == 'Event') {
         if (require_array(array(EVENT_PATH . $class, COMMON_EVENT_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -3) == 'Tag') {
         if (require_array(array(TAG_PATH . $class, COMMON_TAG_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -7) == 'Storage') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Storage/' . $class))) {
             return;
         }
     } elseif (alias_import($className)) {
         return;
     } elseif (require_array(array(LIB_PATH . $class, COMMON_LIB_PATH . $class, HDPHP_CORE_PATH . $class, HDPHP_EXTEND_PATH . $class, HDPHP_EXTEND_PATH . '/Tool/' . $class))) {
         return;
     }
     $msg = "Class {$className} not found";
     Log::write($msg);
     halt($msg);
 }
開發者ID:jyht,項目名稱:v5,代碼行數:51,代碼來源:HDPHP.class.php

示例12: loadParseTags

 /**
  * 加載標簽庫與解析標簽
  */
 private function loadParseTags()
 {
     //標簽庫類
     $tagClass = array();
     //加載框架核心標簽庫
     if (import('HDPHP.Lib.Driver.View.ViewTag')) {
         $tagClass[] = 'ViewTag';
     }
     //加載擴展標簽庫
     $tags = C('TPL_TAGS');
     //如果配置文件中存在標簽定義
     if (!empty($tags) && is_array($tags)) {
         //加載其他模塊或應用中的標簽庫
         foreach ($tags as $file) {
             $file = str_replace(".", "/", $file);
             $info = explode("/", $file);
             //類名
             $class = array_pop($info);
             if (class_exists($class, false)) {
             } else {
                 if (require_array(array(MODULE_TAG_PATH . $file . '.class.php', APP_TAG_PATH . $file . '.class.php'))) {
                 } else {
                     if (import($file)) {
                     } else {
                         continue;
                     }
                 }
             }
             $tmp = explode(".", $class);
             $tagClass[] = array_pop($tmp);
         }
     }
     $this->parseTagClass($tagClass);
 }
開發者ID:www2511550,項目名稱:ECSHOP,代碼行數:37,代碼來源:ViewCompile.class.php

示例13: edit

 /**
  * 修改內容 
  * @param array $data 數據
  * @param type $id 信息ID
  * @return boolean 
  */
 public function edit($data, $id)
 {
     require_array(array(RUNTIME_PATH . 'content_input.class.php', RUNTIME_PATH . 'content_update.class.php'));
     $this->catid = (int) $data['catid'];
     $this->modelid = $this->categorys[$this->catid]['modelid'];
     //主表操作開始
     $this->table_name = ucwords($this->Model[$this->modelid]['tablename']);
     $this->fbtable_name = $this->table_name . "_data";
     $this->Content = new ContentModel($this->table_name);
     $content_input = new content_input($this->modelid, $this);
     $inputinfo = $content_input->get($data);
     if (is_bool($inputinfo) && $inputinfo == false) {
         //顯示錯誤
         $this->error($content_input->getError());
         return false;
     }
     //主表字段內容
     $systeminfo = $inputinfo['system'];
     //副表字段內容
     $modelinfo = $inputinfo['model'];
     //欄目數據
     $catidinfo = $this->categorys[$systeminfo['catid']];
     //setting配置
     $catidsetting = unserialize($catidinfo['setting']);
     //前台投稿狀態判斷
     if (defined('IN_ADMIN') && IN_ADMIN == false) {
         //前台投稿編輯是否需要審核
         if ($catidsetting['member_editcheck']) {
             $systeminfo['status'] = 1;
         }
     }
     //取得inputtime的真實發布時間
     //inputtime為真實發表時間,不允許修改
     $data['inputtime'] = $systeminfo['inputtime'] = $inputtime = $this->Content->where(array("id" => $id))->getField("inputtime");
     //更新時間處理
     if ($data['updatetime'] && !is_numeric($data['updatetime'])) {
         $systeminfo['updatetime'] = strtotime($data['updatetime']);
     } elseif (!$data['updatetime']) {
         $systeminfo['updatetime'] = time();
     } else {
         $systeminfo['updatetime'] = $data['updatetime'];
     }
     //自動提取摘要,如果有設置自動提取,且description為空,且有內容字段才執行
     if (isset($_POST['add_introduce']) && $systeminfo['description'] == '' && isset($modelinfo['content'])) {
         $content = stripslashes($modelinfo['content']);
         $introcude_length = intval($_POST['introcude_length']);
         $systeminfo['description'] = str_cut(str_replace(array("\r\n", "\t", '[page]', '[/page]', '“', '”', ' '), '', strip_tags($content)), $introcude_length);
         $inputinfo['system']['description'] = $systeminfo['description'] = Input::getVar($systeminfo['description']);
     }
     //自動提取縮略圖,從content 中提取
     if (isset($_POST['auto_thumb']) && $systeminfo['thumb'] == '' && isset($modelinfo['content'])) {
         $content = $content ? $content : stripslashes($modelinfo['content']);
         $auto_thumb_no = intval($_POST['auto_thumb_no']) - 1;
         if (preg_match_all("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $matches)) {
             $systeminfo['thumb'] = $matches[3][$auto_thumb_no];
         }
     }
     //轉向地址
     if ($data['islink'] == 1) {
         $systeminfo['url'] = $_POST['linkurl'];
     } else {
         //生成該篇地址
         $urls = $this->url->show($id, 0, $systeminfo['catid'], $inputtime, $data['prefix'], $inputinfo, 'edit');
         $systeminfo['url'] = $urls[0];
     }
     //使用TP的自動驗證,所以要把令牌合並
     $systeminfo = array_merge($systeminfo, array(C("TOKEN_NAME") => $_POST[C("TOKEN_NAME")]));
     $status = $this->Content->create($systeminfo);
     if (!$status) {
         $this->error($this->Content->getError());
     }
     //把副表的數據合並,按關聯模型的需求合並
     $status['id'] = $id;
     $fdata = array($this->fbtable_name => $modelinfo);
     $status = array_merge($status, $fdata);
     //刪除真實時間的信息,避免被更新
     unset($status['inputtime']);
     //數據修改,這裏使用關聯操作
     $this->Content->relation(true)->where(array('id' => $id))->save($status);
     //調用 update
     $content_update = new content_update($this->modelid, $id, $this);
     $data['url'] = $systeminfo['url'];
     $content_update->update($data);
     //更新附件狀態,把相關附件和文章進行管理
     $this->attachment_db = service("Attachment");
     $this->attachment_db->api_update('', 'c-' . $systeminfo['catid'] . '-' . $id, 2);
     //更新到全站搜索
     if ($systeminfo['status'] == 99) {
         $this->search_api($id, $inputinfo, "updata");
     } else {
         $this->search_api($id, $inputinfo, "delete");
     }
     //生成相關
     $generatelish = 0;
//.........這裏部分代碼省略.........
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:101,代碼來源:Content.class.php


注:本文中的require_array函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。