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


PHP File::exist方法代碼示例

本文整理匯總了PHP中File::exist方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::exist方法的具體用法?PHP File::exist怎麽用?PHP File::exist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在File的用法示例。


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

示例1: createFromFile

 public function createFromFile($file)
 {
     if (File::exist($file)) {
         $this->file = $file;
         list($width, $height, $type) = getimagesize($file);
         $this->type = $type;
         $this->name = mb_substr($file, strrpos($file, '/') + 1, mb_strlen($file, CHARSET), CHARSET);
         $this->dir = mb_substr($file, 0, strrpos($file, '/') + 1, CHARSET);
         switch ($type) {
             case IMAGETYPE_GIF:
                 $image = imagecreatefromgif($file);
                 break;
             case IMAGETYPE_JPEG:
                 $image = imagecreatefromjpeg($file);
                 break;
             case IMAGETYPE_PNG:
                 $image = imagecreatefrompng($file);
                 break;
             case IMAGETYPE_BMP:
                 $image = self::imageCreateFromBMP($file);
                 $this->type = IMAGETYPE_JPEG;
                 break;
         }
         $this->image = $image;
     }
 }
開發者ID:ben33,項目名稱:framework,代碼行數:26,代碼來源:ImageGD.php

示例2: path

 public static function path($path, $fallback = false)
 {
     $config = Config::get();
     // External URL, nothing to check!
     if (strpos($path, '://') !== false || strpos($path, '//') === 0) {
         if (strpos($path, $config->url) !== 0) {
             return $path;
         }
     }
     $path = File::path($path);
     // Full path, be quick!
     if (strpos($path, ROOT) === 0) {
         return File::exist($path, $fallback);
     }
     if ($_path = File::exist(SHIELD . DS . $config->shield . DS . ltrim($path, DS))) {
         return $_path;
     } else {
         if ($_path = File::exist(ASSET . DS . ltrim($path, DS))) {
             return $_path;
         } else {
             if ($_path = File::exist(ROOT . DS . ltrim($path, DS))) {
                 return $_path;
             }
         }
     }
     return $fallback;
 }
開發者ID:AdeHaze,項目名稱:mecha-cms,代碼行數:27,代碼來源:asset.php

示例3: path

 public static function path($path)
 {
     $path = File::path($path);
     if ($_path = File::exist(SHIELD . DS . Config::get('shield') . DS . ltrim($path, DS))) {
         return $_path;
     } else {
         if ($_path = File::exist(ROOT . DS . ltrim($path, DS))) {
             return $_path;
         }
     }
     return $path;
 }
開發者ID:razordaze,項目名稱:mecha-cms,代碼行數:12,代碼來源:asset.php

示例4: info

 public static function info($folder = null, $array = false)
 {
     $config = Config::get();
     $speak = Config::speak();
     // Check whether the localized "about" file is available
     if (!($info = File::exist(PLUGIN . DS . $folder . DS . 'about.' . $config->language . '.txt'))) {
         $info = PLUGIN . DS . $folder . DS . 'about.txt';
     }
     $default = 'Title' . S . ' ' . ucwords(Text::parse($folder, '->text')) . "\n" . 'Author' . S . ' ' . $speak->anon . "\n" . 'URL' . S . ' #' . "\n" . 'Version' . S . ' 0.0.0' . "\n" . "\n" . SEPARATOR . "\n" . "\n" . Config::speak('notify_not_available', $speak->description);
     $info = Text::toPage(File::open($info)->read($default), 'content', 'plugin:');
     return $array ? $info : Mecha::O($info);
 }
開發者ID:razordaze,項目名稱:mecha-cms,代碼行數:12,代碼來源:plugin.php

示例5: do_remove_cache

/**
 * Cache Killer
 * ------------
 */
function do_remove_cache()
{
    global $config, $c_cache;
    foreach ($c_cache->path as $path => $expire) {
        $path = str_replace(array('(:any)', '(:num)', '(:all)', '(', ')', '|', '/', ':'), array('*', '[0-9]*', '*', '{', '}', ',', '.', '.'), $path) . '.cache';
        if ($cache = File::exist(CACHE . DS . $path)) {
            File::open($cache)->delete();
        } else {
            foreach (glob(CACHE . DS . $path, GLOB_NOSORT | GLOB_BRACE) as $cache) {
                File::open($cache)->delete();
            }
        }
    }
}
開發者ID:AdeHaze,項目名稱:mecha-cms,代碼行數:18,代碼來源:__launch.php

示例6: ally

 /**
  * ============================================================
  *  GET ACCEPTED USER(S) DATA
  * ============================================================
  *
  * -- CODE: ---------------------------------------------------
  *
  *    echo Guardian::ally('mecha');
  *
  * ------------------------------------------------------------
  *
  *    var_dump(Guardian::ally());
  *
  * ------------------------------------------------------------
  *
  */
 public static function ally($user = null, $fallback = false)
 {
     if ($file = File::exist(SYSTEM . DS . 'log' . DS . 'users.txt')) {
         $ally = array();
         foreach (explode("\n", file_get_contents($file)) as $a) {
             // Pattern 1: `username: password (Author Name: status) email@domain.com`
             // Pattern 2: `username: password (Author Name @status) email@domain.com`
             preg_match('#^(.*?)\\:\\s*(.*?)\\s+\\((.*?)(?:\\s*@|\\:\\s*)(pilot|[a-z0-9_.]+)\\)(?:\\s+(.*?))?$#', trim($a), $matches);
             $ally[$matches[1]] = array('password' => $matches[2], 'author' => $matches[3], 'status' => $matches[4], 'email' => isset($matches[5]) && !empty($matches[5]) ? $matches[5] : false);
         }
         if (is_null($user)) {
             return $ally;
         }
         return isset($ally[$user]) ? $ally[$user] : $fallback;
     } else {
         self::abort('Missing <code>users.txt</code> file.');
     }
 }
開發者ID:razordaze,項目名稱:mecha-cms,代碼行數:34,代碼來源:guardian.php

示例7: ally

 /**
  * ============================================================
  *  GET ACCEPTED USER(S) DATA
  * ============================================================
  *
  * -- CODE: ---------------------------------------------------
  *
  *    echo Guardian::ally('mecha');
  *
  * ------------------------------------------------------------
  *
  *    var_dump(Guardian::ally());
  *
  * ------------------------------------------------------------
  *
  */
 public static function ally($user = null, $fallback = false)
 {
     if ($file = File::exist(LOG . DS . 'users.txt')) {
         $ally = array();
         foreach (explode("\n", file_get_contents($file)) as $str) {
             $s = trim($str);
             // serialized array
             if (strpos($s, 'a:') === 0) {
                 $s = unserialize($s);
                 // encoded JSON array
             } else {
                 if (strpos($s, '{"') === 0) {
                     $s = json_decode($s, true);
                     // Pattern 1: `user: pass (Author Name: status) email@domain.com`
                     // Pattern 2: `user: pass (Author Name $status) email@domain.com`
                 } else {
                     if (preg_match('#^(.*?)\\:\\s*(.*?)\\s+\\((.*?)(?:\\s*\\$|\\:\\s*)(pilot|[a-z0-9_.]+)\\)(?:\\s+(.*?))?$#', $s, $matches)) {
                         $s = array();
                         $s['user'] = $matches[1];
                         $s['pass'] = $matches[2];
                         $s['name'] = $matches[3];
                         $s['status'] = $matches[4];
                         $s['email'] = isset($matches[5]) && !empty($matches[5]) ? $matches[5] : false;
                     } else {
                         self::abort('Broken <code>' . LOG . DS . 'users.txt</code> format.');
                     }
                 }
             }
             foreach ($s as $k => $v) {
                 $v = Converter::strEval($v);
                 $s[$k . '_raw'] = Filter::colon('user:' . $k . '_raw', $v, $s);
                 $s[$k] = Filter::colon('user:' . $k, $v, $s);
             }
             $ally[$s['user']] = Filter::apply('user', $s, $s['user']);
         }
         $ally = Filter::apply('users', $ally);
         if (is_null($user)) {
             return $ally;
         }
         return isset($ally[$user]) ? $ally[$user] : $fallback;
     } else {
         self::abort('Missing <code>' . LOG . DS . 'users.txt</code> file.');
     }
 }
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:60,代碼來源:guardian.php

示例8: md5

        $speak = Config::speak();
        // refresh ...
    }
    Weapon::fire(array('plugin_before', 'plugin_' . md5($k) . '_before'));
    if ($launch = File::exist($__ . 'launch.php')) {
        if (strpos(File::B($__), '__') === 0) {
            if (Guardian::happy() && $config->page_type === 'manager') {
                include $launch;
                // backend
            }
        } else {
            include $launch;
            // frontend
        }
    }
    if ($launch = File::exist($__ . '__launch.php')) {
        if (Guardian::happy() && $config->page_type === 'manager') {
            include $launch;
            // backend
        }
    }
    Weapon::fire(array('plugin_after', 'plugin_' . md5($k) . '_after'));
}
Weapon::fire('plugins_after');
/**
 * Check the Plugin(s) Order
 * -------------------------
 */
// var_dump($plugins); exit;
/**
 * Loading Menu(s)
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:31,代碼來源:ignite.php

示例9: do_comment_construct

 function do_comment_construct()
 {
     $config = Config::get();
     $speak = Config::speak();
     if ($config->page_type === 'article') {
         $comment_id = 'comment-%d';
         // Your comment ID
         $comment_form_id = 'comment-form';
         // Your comment form ID
         $article = isset($config->article->path) ? $config->article : false;
         $G = array('data' => array('article' => Mecha::A($article), 'comment_id' => $comment_id, 'comment_form_id' => $comment_form_id));
         if ($article !== false && ($request = Request::post())) {
             if ($task = File::exist(SHIELD . DS . $config->shield . DS . 'workers' . DS . 'task.comment.php')) {
                 require $task;
                 // Custom comment constructor
             } else {
                 // Check token
                 Guardian::checkToken($request['token'], $article->url . '#' . $comment_form_id);
                 $extension = $config->comments->moderation && !Guardian::happy() ? '.hold' : '.txt';
                 // Check name
                 if (trim($request['name']) === "") {
                     Notify::error(Config::speak('notify_error_empty_field', $speak->name));
                 }
                 // Check email
                 if (trim($request['email']) !== "") {
                     if (!Guardian::check($request['email'], '->email')) {
                         Notify::error($speak->notify_invalid_email);
                     } else {
                         // Disallow passenger(s) from entering your email address in the comment email field
                         if (!Guardian::happy() && $request['email'] === $config->author->email) {
                             Notify::warning(Config::speak('notify_warning_forbidden_input', array('<em>' . $request['email'] . '</em>', strtolower($speak->email))));
                         }
                     }
                 } else {
                     Notify::error(Config::speak('notify_error_empty_field', $speak->email));
                 }
                 // Check URL
                 if (trim($request['url']) !== "" && !Guardian::check($request['url'], '->url')) {
                     Notify::error($speak->notify_invalid_url);
                 }
                 // Check message
                 if (trim($request['message']) === "") {
                     Notify::error(Config::speak('notify_error_empty_field', $speak->message));
                 }
                 // Check challenge
                 if (!Guardian::checkMath($request['math'])) {
                     Notify::error($speak->notify_invalid_math_answer);
                 }
                 // Check name length
                 if (Guardian::check($request['name'], '->too_long', 100)) {
                     Notify::error(Config::speak('notify_error_too_long', $speak->name));
                 }
                 // Check email length
                 if (Guardian::check($request['email'], '->too_long', 100)) {
                     Notify::error(Config::speak('notify_error_too_long', $speak->email));
                 }
                 // Check URL length
                 if (Guardian::check($request['url'], '->too_long', 100)) {
                     Notify::error(Config::speak('notify_error_too_long', $speak->url));
                 }
                 // Check message length
                 if (Guardian::check($request['message'], '->too_long', 1700)) {
                     Notify::error(Config::speak('notify_error_too_long', $speak->message));
                 }
                 // Check for spam keyword(s) in comment
                 $fucking_words = explode(',', $config->keywords_spam);
                 foreach ($fucking_words as $spam) {
                     if ($fuck = trim($spam)) {
                         if ($request['email'] === $fuck || strpos(strtolower($request['message']), strtolower($fuck)) !== false) {
                             Notify::warning($speak->notify_warning_intruder_detected . ' <strong class="text-error pull-right">' . $fuck . '</strong>');
                             break;
                         }
                     }
                 }
                 if (!Notify::errors()) {
                     $post = Date::slug($article->time);
                     $id = (int) time();
                     $parent = Request::post('parent');
                     $P = array('data' => $request);
                     $P['data']['id'] = $id;
                     $name = strip_tags($request['name']);
                     $email = Text::parse($request['email'], '->broken_entity');
                     $url = isset($request['url']) && trim($request['url']) !== "" ? $request['url'] : false;
                     $parser = strip_tags(Request::post('content_type', $config->html_parser->active));
                     $message = Text::parse($request['message'], '->text', WISE_CELL . '<img>', false);
                     $field = Request::post('fields', array());
                     include File::D(__DIR__, 2) . DS . 'task.fields.php';
                     // Temporarily disallow image(s) in comment to prevent XSS
                     $message = preg_replace('#<img(\\s[^<>]*?)>#i', '&lt;img$1&gt;', $message);
                     Page::header(array('Name' => $name, 'Email' => $email, 'URL' => $url, 'Status' => Guardian::happy() ? 1 : 2, 'Content Type' => $parser, 'Fields' => !empty($field) ? Text::parse($field, '->encoded_json') : false))->content($message)->saveTo(COMMENT . DS . $post . '_' . Date::slug($id) . '_' . ($parent ? Date::slug($parent) : '0000-00-00-00-00-00') . $extension);
                     Notify::success(Config::speak('notify_success_submitted', $speak->comment));
                     if ($extension === '.hold') {
                         Notify::info($speak->notify_info_comment_moderation);
                     }
                     Weapon::fire(array('on_comment_update', 'on_comment_construct'), array($G, $P));
                     Guardian::kick($config->url_current . $config->ur_query . (!Guardian::happy() && $config->comments->moderation ? '#' . $comment_form_id : '#' . sprintf($comment_id, Date::format($id, 'U'))));
                 } else {
                     Guardian::kick($config->url_current . $config->url_query . '#' . $comment_form_id);
                 }
             }
//.........這裏部分代碼省略.........
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:101,代碼來源:__task.comment.php

示例10: function

<?php

/**
 * Login Page
 * ----------
 *
 * [1]. manager/login
 *
 */
Route::accept($config->manager->slug . '/login', function () use($config, $speak) {
    if (!File::exist(File::D(__DIR__) . DS . 'launch.php')) {
        Shield::abort('404-manager');
    }
    if (Guardian::happy()) {
        Guardian::kick($config->manager->slug . '/article');
    }
    Config::set(array('page_title' => $speak->log_in . $config->title_separator . $config->title, 'cargo' => 'cargo.login.php'));
    include __DIR__ . DS . 'cargo.php';
    if ($request = Request::post()) {
        Guardian::authorize()->kick(isset($request['kick']) ? $request['kick'] : $config->manager->slug . '/article');
    }
    Shield::attach('manager-login');
}, 20);
/**
 * Logout Page
 * -----------
 *
 * [1]. manager/logout
 *
 */
Route::accept($config->manager->slug . '/logout', function () use($config, $speak) {
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:31,代碼來源:route.login.php

示例11: function

<?php

Weapon::add('shield_before', function () {
    $config = Config::get();
    if ($config->comments->allow) {
        $comment_service_config = File::open(__DIR__ . DS . 'states' . DS . 'config.txt')->unserialize();
        Config::set('plugins.comment_service_config', $comment_service_config);
        $active = $comment_service_config['service'];
        if ($s = Config::get($config->page_type)) {
            $active = isset($s->fields->comment_service) && trim($s->fields->comment_service) !== "" ? $s->fields->comment_service : $active;
        }
        if ($launch = File::exist(__DIR__ . DS . 'workers' . DS . $active . DS . 'launch.php')) {
            require $launch;
        }
        Filter::add('chunk:path', function ($path) use($active) {
            if ($active !== 0 && File::N($path) === 'comments') {
                return __DIR__ . DS . 'workers' . DS . $active . DS . 'comments.php';
            }
            return $path;
        });
    }
});
開發者ID:tovic,項目名稱:comment-service-plugin-for-mecha-cms,代碼行數:22,代碼來源:launch.php

示例12: page

 /**
  * ==========================================================================
  *  EXTRACT PAGE FILE INTO LIST OF PAGE DATA FROM ITS PATH/SLUG/ID
  * ==========================================================================
  *
  * -- CODE: -----------------------------------------------------------------
  *
  *    var_dump(Get::page('about'));
  *
  * --------------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type   | Description
  *  ---------- | ------ | ---------------------------------------------------
  *  $reference | mixed  | Slug, ID, path or array of `Get::pageExtract()`
  *  $excludes  | array  | Exclude some field(s) from result(s)
  *  $folder    | string | Folder of the page(s)
  *  $connector | string | Path connector for page URL
  *  $FP        | string | Filter prefix for `Text::toPage()`
  *  ---------- | ------ | ---------------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function page($reference, $excludes = array(), $folder = PAGE, $connector = '/', $FP = 'page:')
 {
     $config = Config::get();
     $speak = Config::speak();
     $excludes = array_flip($excludes);
     $results = false;
     // From `Get::pageExtract()`
     if (is_array($reference)) {
         $results = $reference;
     } else {
         // By path => `cabinet\pages\0000-00-00-00-00-00_1,2,3_page-slug.txt`
         if (strpos($reference, $folder) === 0) {
             $results = self::pageExtract($reference, $FP);
         } else {
             // By slug => `page-slug` or by ID => 12345
             $results = self::pageExtract(self::pagePath($reference, $folder), $FP);
         }
     }
     if (!$results || !file_exists($results['path'])) {
         return false;
     }
     /**
      * RULES: Do not do any tags looping, content Markdown-ing
      * and external file requesting if it has been marked as
      * the excluded field(s). For better performance.
      */
     $results = $results + Text::toPage(File::open($results['path'])->read(), isset($excludes['content']) ? false : 'content', $FP);
     $content = isset($results['content_raw']) ? $results['content_raw'] : "";
     $time = str_replace(array(' ', ':'), '-', $results['time']);
     $extension = File::E($results['path']);
     if ($php_file = File::exist(File::D($results['path']) . DS . $results['slug'] . '.php')) {
         ob_start();
         include $php_file;
         $results['content'] = ob_get_clean();
     }
     $results['date'] = self::AMF(Date::extract($results['time']), $FP, 'date');
     $results['url'] = self::AMF($config->url . $connector . $results['slug'], $FP, 'url');
     $results['link'] = "";
     $results['excerpt'] = "";
     if (!isset($results['author'])) {
         $results['author'] = self::AMF($config->author, $FP, 'author');
     }
     if (!isset($results['description'])) {
         $summary = Converter::curt($content, $config->excerpt_length, $config->excerpt_tail);
         $results['description'] = self::AMF($summary, $FP, 'description');
     }
     $content_test = isset($excludes['content']) && strpos($content, '<!--') !== false ? Text::toPage(Text::ES($content), 'content', $FP) : $results;
     $content_test = $content_test['content'];
     $content_test = is_array($content_test) ? implode("", $content_test) : $content_test;
     // Redirect 301 with `<!-- kick: "http://example.com" -->`
     if (strpos($content_test, '<!-- kick:') !== false && $config->page_type === rtrim($FP, ':')) {
         preg_match('#<!-- kick\\: *([\'"]?)(.*?)\\1 -->#', $content_test, $matches);
         Guardian::kick($matches[2]);
     }
     // External link with `<!-- link: "http://example.com" -->`
     if (strpos($content_test, '<!-- link:') !== false) {
         preg_match('#<!-- link\\: *([\'"]?)(.*?)\\1 -->#', $content_test, $matches);
         $results['link'] = $matches[2];
         $results['content'] = preg_replace('#<!-- link\\:.*? -->#', "", $results['content']);
     }
     // Manual post excerpt with `<!-- cut+ "Read More" -->`
     if (strpos($content_test, '<!-- cut+ ') !== false) {
         preg_match('#<!-- cut\\+( +([\'"]?)(.*?)\\2)? -->#', $content_test, $matches);
         $more = !empty($matches[3]) ? $matches[3] : $speak->read_more;
         $content_test = preg_replace('#<!-- cut\\+( +(.*?))? -->#', '<p><a class="fi-link" href="' . $results['url'] . '#read-more:' . $results['id'] . '">' . $more . '</a></p><!-- cut -->', $content_test);
     }
     // ... or `<!-- cut -->`
     if (strpos($content_test, '<!-- cut -->') !== false) {
         $parts = explode('<!-- cut -->', $content_test, 2);
         $results['excerpt'] = self::AMF(trim($parts[0]), $FP, 'excerpt');
         $results['content'] = preg_replace('#<p><a class="fi-link" href=".*?">.*?<\\/a><\\/p>#', "", trim($parts[0])) . NL . NL . '<span class="fi" id="read-more:' . $results['id'] . '" aria-hidden="true"></span>' . NL . NL . trim($parts[1]);
     }
     if (!isset($excludes['tags'])) {
         $tags = array();
         foreach ($results['kind'] as $id) {
             $tags[] = self::rawTag($id);
         }
//.........這裏部分代碼省略.........
開發者ID:razordaze,項目名稱:mecha-cms,代碼行數:101,代碼來源:get.php

示例13: applyRevCheck


//.........這裏部分代碼省略.........
                 $query = 'DELETE FROM `errorfiles`
                          WHERE `project`="%s" AND
                                `lang`="en" AND
                                `path`="%s" AND
                                `name`="%s"';
                 $params = array($am->project, $f->path, $f->name);
                 $this->conn->query($query, $params);
             }
             // Sql insert.
             $query = 'INSERT INTO `files` (`project`, `lang`, `xmlid`, `path`, `name`, `revision`, `size`, `mdate`, `maintainer`, `status`, `check_oldstyle`,  `check_undoc`, `check_roleerror`, `check_badorder`, `check_noseealso`, `check_noreturnvalues`, `check_noparameters`, `check_noexamples`, `check_noerrors`)
                     VALUES ("%s", "en", "%s", "%s", "%s", "%s", "%s", "%s", NULL, NULL, "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")';
             $params = array($am->project, $xmlid, $f->path, $f->name, $en_revision, $en_size, $en_date, $ToolsCheckDocResult['check_oldstyle'], $ToolsCheckDocResult['check_undoc'], $ToolsCheckDocResult['check_roleerror'], $ToolsCheckDocResult['check_badorder'], $ToolsCheckDocResult['check_noseealso'], $ToolsCheckDocResult['check_noreturnvalues'], $ToolsCheckDocResult['check_noparameters'], $ToolsCheckDocResult['check_noexamples'], $ToolsCheckDocResult['check_noerrors']);
             $this->conn->query($query, $params);
             /*
             $error = new ToolsError();
             $error->setParams($infoEN['content'], '', 'en', $f->path, $f->name, '');
             $error->run();
             $error->saveError();
             */
             if ($revType == 'update') {
                 // If we are in update, we have 2 case. $revLang can be en or LANG.
                 // If revLang is en, we must re-check all available language to reflect changes.
                 if ($revLang == 'en') {
                     $ExistingLanguage = $this->getExistingLanguage();
                 } else {
                     $ExistingLanguage[] = array("code" => $revLang);
                 }
             } else {
                 // If this is not an update, we check all languages
                 $ExistingLanguage = $this->getExistingLanguage();
             }
             foreach ($ExistingLanguage as $lang) {
                 $lang = $lang["code"];
                 // We skip en language
                 if ($lang == 'en') {
                     continue;
                 }
                 $lang_file = new File($lang, $f->path . $f->name);
                 // If the type of this revcheck is an update, we start be delete all reference to this file in table...
                 if ($revType == 'update') {
                     // ... `file`
                     $query = 'DELETE FROM `files`
                              WHERE `project`="%s" AND
                                    `lang`="%s" AND
                                    `path`="%s" AND
                                    `name`="%s"';
                     $params = array($project, $lang, $lang_file->path, $lang_file->name);
                     $this->conn->query($query, $params);
                     //... table `errorfiles`
                     $query = 'DELETE FROM `errorfiles`
                              WHERE `project`="%s" AND
                                    `lang`="%s" AND
                                    `path`="%s" AND
                                    `name`="%s"';
                     $params = array($project, $lang, $lang_file->path, $lang_file->name);
                     $this->conn->query($query, $params);
                 }
                 if ($lang_file->exist()) {
                     // Initial revcheck method
                     $size = intval(filesize($lang_file->full_path) / 1024);
                     $date = filemtime($lang_file->full_path);
                     $size_diff = $en_size - $size;
                     $date_diff = intval((time() - $en_date) / 86400) - intval((time() - $date) / 86400);
                     $infoLANG = $lang_file->getInfo();
                     $revision = $infoLANG['en-rev'] == 'NULL' ? 'NULL' : $infoLANG['en-rev'];
                     $maintainer = $infoLANG['maintainer'] == 'NULL' ? 'NULL' : $infoLANG['maintainer'];
                     $status = $infoLANG['status'] == 'NULL' ? 'NULL' : $infoLANG['status'];
                     $xmlid = $infoLANG['xmlid'] == 'NULL' ? 'NULL' : $infoLANG['xmlid'];
                     $reviewed = $infoLANG['reviewed'] == 'NULL' ? 'NULL' : $infoLANG['reviewed'];
                     $reviewed_maintainer = $infoLANG['reviewed_maintainer'] == 'NULL' ? 'NULL' : $infoLANG['reviewed_maintainer'];
                     $query = 'INSERT INTO `files` (`project`, `lang`, `xmlid`, `path`, `name`, `revision`, `en_revision`, `reviewed`, `reviewed_maintainer`, `size`, `size_diff`, `mdate`, `mdate_diff`, `maintainer`, `status`)
                             VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")';
                     $params = array($project, $lang, $xmlid, $lang_file->path, $lang_file->name, $revision, $en_revision, $reviewed, $reviewed_maintainer, $size, $size_diff, $date, $date_diff, $maintainer, $status);
                     $this->conn->query($query, $params);
                     /*
                     // Check for error in this file ONLY if this file is uptodate
                     
                     if ($revision == $en_revision &&  $revision != 0 ) {
                         $error = new ToolsError();
                         $error->setParams(
                             $infoEN['content'], $infoLANG['content'],
                             $lang, $lang_file->path, $lang_file->name, $maintainer
                         );
                         $error->run();
                         $error->saveError();
                     }
                     */
                 } else {
                     $query = 'INSERT INTO `files` (`project`, `lang`, `path`, `name`, `size`)
                             VALUES ("%s", "%s", "%s", "%s", "%s")';
                     $params = array($project, $lang, $lang_file->path, $lang_file->name, $en_size);
                     $this->conn->query($query, $params);
                 }
             }
         }
         foreach ($dirs as $d) {
             $this->applyRevCheck($d->path, $revType, $revLang);
         }
     }
 }
開發者ID:vrkansagara,項目名稱:web-doc-editor,代碼行數:101,代碼來源:RepositoryManager.php

示例14: elseif

<?php

$attr = ' alt="" width="60" height="60"';
if ($avatar = File::exist(ASSET . DS . '__avatar' . DS . '60x60' . DS . md5($comment->email) . '.png')) {
    echo Asset::image($avatar, $attr);
} elseif ($avatar = File::exist(ASSET . DS . '__avatar' . DS . md5($comment->email) . '.png')) {
    echo Asset::image($avatar, $attr);
} else {
    echo Asset::image($config->protocol . 'www.gravatar.com/avatar/' . md5($comment->email) . '?s=60&amp;d=monsterid', $attr);
}
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:10,代碼來源:comment.avatar.photo.php

示例15: addFile

 /**
  * ====================================================================
  *  ADD A FILE TO A ZIP FILE
  * ====================================================================
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter    | Type   | Description
  *  ------------ | ------ | -------------------------------------------
  *  $path        | string | File to be added into the ZIP file
  *  $destination | string | File location path in the ZIP file
  *  ------------ | ------ | -------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function addFile($file, $destination = null)
 {
     if (self::$zip->open(self::$open) === true) {
         // Handling for `Package::take('file.zip')->addFile('test.txt')`
         if (strpos($file, DS) === false) {
             $file = File::D(self::$open) . DS . $file;
         }
         if (File::exist($file)) {
             if (is_null($destination)) {
                 $destination = File::B($file);
             }
             self::$zip->addFile($file, $destination);
         }
         self::$zip->close();
     }
     return new static();
 }
開發者ID:AdeHaze,項目名稱:mecha-cms,代碼行數:31,代碼來源:package.php


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