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


PHP File::E方法代码示例

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


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

示例1: __do_response_reply_count

function __do_response_reply_count($response)
{
    global $config, $speak, $segment;
    $e = File::E($response->path);
    $replies = count(glob(COMMENT . DS . '*_*_' . Date::slug($response->id) . '.{txt,hold}', GLOB_NOSORT | GLOB_BRACE));
    $t = Jot::icon('reply-all') . ' ' . $replies;
    $tt = array('title' => $replies . ' ' . ($replies === 1 ? $speak->{$segment[0] . '_reply'} : $speak->{$segment[0] . '_replies'}));
    echo ($e === 'hold' || $replies === 0 ? Cell::span($t, $tt) : Cell::a($config->manager->slug . '/' . $segment[0] . '?filter=parent%3A' . $response->id, $t, null, $tt)) . ' · ';
}
开发者ID:tovic,项目名称:comment-reply-plugin-for-mecha-cms,代码行数:9,代码来源:__launch.php

示例2: path

 /**
  * ==========================================================
  *  GET SHIELD PATH BY ITS NAME
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    echo Shield::path('article');
  *
  * ----------------------------------------------------------
  *
  */
 public static function path($name)
 {
     $name = File::path($name) . '.' . File::E($name, 'php');
     if ($path = File::exist(SHIELD . DS . Config::get('shield') . DS . ltrim($name, DS))) {
         return $path;
     } else {
         if ($path = File::exist(ROOT . DS . ltrim($name, DS))) {
             return $path;
         }
     }
     return $name;
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:24,代码来源:shield.php

示例3: path

 /**
  * ==========================================================
  *  GET SHIELD PATH BY ITS NAME
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    echo Shield::path('article');
  *
  * ----------------------------------------------------------
  *
  */
 public static function path($name, $fallback = false)
 {
     $e = File::E($name, "") !== 'php' ? '.php' : "";
     $name = File::path($name) . $e;
     // Full path, be quick!
     if (strpos($name, ROOT) === 0) {
         return File::exist($name, $fallback);
     }
     if ($path = File::exist(SHIELD . DS . Config::get('shield') . DS . ltrim($name, DS))) {
         return $path;
     } else {
         if ($path = File::exist(CHUNK . DS . ltrim($name, DS))) {
             return $path;
         } else {
             if ($path = File::exist(ROOT . DS . ltrim($name, DS))) {
                 return $path;
             }
         }
     }
     return $fallback;
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:33,代码来源:shield.php

示例4: 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

示例5: foreach

    if (!file_exists(ASSET . DS . '__snippet' . DS . $e . DS . $_file)) {
        continue;
    }
    $_files[] = File::url($_file);
}
?>
      <?php 
if (!empty($_files)) {
    ?>
      <table class="table-bordered table-full-width">
        <tbody>
          <?php 
    foreach ($_files as $_file) {
        ?>
          <?php 
        $e = File::E($_file);
        ?>
          <tr>
            <td><a href="javascript:do_snippet('<?php 
        echo str_replace('.' . $e . X, "", $_file . X);
        ?>
', '<?php 
        echo $e === 'php' ? 'include' : 'print';
        ?>
');" title="<?php 
        echo $speak->shortcode;
        ?>
"><?php 
        echo Jot::icon($e === 'php' ? 'file-code-o' : 'file-o', 'fw') . ' ' . $_file;
        ?>
</a></td>
开发者ID:tovic,项目名称:snippet-plugin-for-mecha-cms,代码行数:31,代码来源:cargo.snippet.php

示例6: isset

 if ($type === 'option' || $type === 'o') {
     $html .= '<label class="grid-group grid-group-option">';
     $html .= '<span class="grid span-2 form-label">' . $title . '</span>';
     $html .= '<span class="grid span-4">';
     $select = isset($field[$key]) ? $field[$key] : "";
     $options = Converter::toArray($value['value'], S, '  ');
     if (isset($value['placeholder']) && trim($value['placeholder']) !== "") {
         $options = array("" => $value['placeholder']) + $options;
     }
     $html .= Form::select('fields[' . $key . '][value]', $options, $select, array('class' => 'select-block'));
     $html .= '</span>';
     $html .= '</label>';
 } else {
     if ($type === 'file' || $type === 'f') {
         $v = isset($value['value']) && $value['value'] !== "" ? $value['value'] : false;
         $vv = isset($field[$key]) && $field[$key] !== "" ? File::E($field[$key]) . DS . File::path($field[$key]) : false;
         $has_file = $vv !== false && file_exists(SUBSTANCE . DS . $vv) && is_file(SUBSTANCE . DS . $vv);
         $html .= '<div class="grid-group grid-group-file' . ($has_file ? ' grid-group-boolean' : "") . '">';
         $html .= !$has_file ? '<span class="grid span-2 form-label">' . $title . '</span>' : '<span class="grid span-2"></span>';
         $html .= '<span class="grid span-4">';
         if (!$has_file) {
             $html .= Form::file($key);
             $e = strtolower(str_replace(' ', "", (string) $v));
             $html .= $v !== false ? Form::hidden('fields[' . $key . '][accept]', $e) . '<br><small><strong>' . $speak->accepted . ':</strong> <code>*.' . str_replace(',', '</code>, <code>*.', $e) . '</code></small>' : "";
         } else {
             $html .= Form::hidden('fields[' . $key . '][value]', $vv);
             $html .= '<span title="' . strip_tags($value['title']) . '">' . Form::checkbox('fields[' . $key . '][remove]', $vv, false, $speak->delete . ' <code>' . $vv . '</code>') . '</span>';
         }
         $html .= '</span>';
         $html .= '</div>';
     } else {
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:fields[].php

示例7: function

         // include once ...
     }
 }, 20);
 Weapon::add('SHIPMENT_REGION_BOTTOM', function () use($config) {
     Session::kill('recent_item_update');
     $path = __DIR__ . DS . 'assets' . DS . 'sword' . DS;
     echo Asset::javascript(array($path . 'ajax.js', $path . 'row.js', $path . 'slug.js', $path . 'upload.js', $path . 'tab.js', $path . 'toggle.js', $path . 'modal.js', $path . 'tooltip.js', $path . 'sortable.js', $path . 'accordion.js', SHIELD . DS . $config->shield . DS . 'assets' . DS . 'sword' . DS . 'manager.js'), "", 'sword/manager.min.js');
 }, 1);
 /**
  * Footer Link(s)
  * --------------
  */
 if ($config->page_type === 'manager' || $config->is->post) {
     // Add default comment footer link(s)
     Weapon::add('comment_footer', function ($comment, $article) use($config, $speak) {
         $status = Mecha::alter(File::E($comment->path), array('hold' => Jot::span('info', Jot::icon('clock-o') . ' ' . $speak->pending) . ' &middot; '), "");
         echo $status . Cell::a($config->manager->slug . '/comment/repair/id:' . $comment->id, $speak->edit) . ' / ' . Cell::a($config->manager->slug . '/comment/kill/id:' . $comment->id, $speak->delete);
     }, 20);
 }
 /**
  * Widget Manager Menu(s) and Bar(s)
  * ---------------------------------
  *
  * [1]. Config::merge('manager_menu', array());
  * [2]. Config::merge('manager_bar', array());
  *
  */
 Weapon::add('shield_before', function () {
     $config = Config::get();
     $speak = Config::speak();
     $total = $config->__total_comments;
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:31,代码来源:launch.php

示例8: merge

 public static function merge($path, $name = null, $addon = "", $call = null)
 {
     $path = is_string($path) && strpos($path, ';') !== false ? explode(';', $path) : (array) $path;
     $the_path = ASSET . DS . File::path($name);
     $the_path_log = SYSTEM . DS . 'log' . DS . 'asset.' . str_replace(array(ASSET . DS, DS), array("", '__'), $the_path) . '.log';
     $is_valid = true;
     if (!file_exists($the_path_log)) {
         $is_valid = false;
     } else {
         $the_path_time = explode("\n", file_get_contents($the_path_log));
         if (count($the_path_time) !== count($path)) {
             $is_valid = false;
         } else {
             foreach ($the_path_time as $i => $time) {
                 $p = self::path($path[$i]);
                 if (!file_exists($p) || (int) filemtime($p) !== (int) $time) {
                     $is_valid = false;
                     break;
                 }
             }
         }
     }
     $time = "";
     $content = "";
     $e = File::E($name);
     if (!file_exists($the_path) || !$is_valid) {
         if (Text::check($e)->in(array('gif', 'jpeg', 'jpg', 'png'))) {
             foreach ($path as $p) {
                 if (!self::ignored($p)) {
                     $p = self::path($p);
                     if (file_exists($p)) {
                         $time .= filemtime($p) . "\n";
                     }
                 }
             }
             File::write(trim($time))->saveTo($the_path_log);
             Image::take($path)->merge()->saveTo($the_path);
         } else {
             foreach ($path as $p) {
                 if (!self::ignored($p)) {
                     $p = self::path($p);
                     if (file_exists($p)) {
                         $time .= filemtime($p) . "\n";
                         $c = file_get_contents($p);
                         if (strpos(File::B($p), '.min.') === false) {
                             if (strpos(File::B($the_path), '.min.css') !== false) {
                                 $content .= Converter::detractShell($c) . "\n";
                             } else {
                                 if (strpos(File::B($the_path), '.min.js') !== false) {
                                     $content .= Converter::detractSword($c) . "\n";
                                 } else {
                                     $content .= $c . "\n\n";
                                 }
                             }
                         } else {
                             $content .= $c . "\n\n";
                         }
                     }
                 }
             }
             File::write(trim($time))->saveTo($the_path_log);
             File::write(trim($content))->saveTo($the_path);
         }
     }
     if (is_null($call)) {
         $call = Mecha::alter($e, array('css' => 'stylesheet', 'js' => 'javascript', 'gif' => 'image', 'jpeg' => 'image', 'jpg' => 'image', 'png' => 'image'));
     }
     return call_user_func_array('self::' . $call, array($the_path, $addon));
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:69,代码来源:asset.php

示例9: array

            $P = array('data' => $request);
            if (!Notify::errors()) {
                if (Request::post('content')) {
                    File::open($file)->write($request['content'])->save();
                }
                File::open($file)->moveTo(ASSET . DS . $new);
                Notify::success(Config::speak('notify_' . (is_dir(ASSET . DS . $old) ? 'folder' : 'file') . '_updated', '<code>' . File::B($old) . '</code>'));
                $new = explode(DS, $new);
                Session::set('recent_file_update', $new[0]);
                Weapon::fire('on_asset_update', array($P, $P));
                Weapon::fire('on_asset_repair', array($P, $P));
                Guardian::kick($config->manager->slug . '/asset/1' . $p);
            }
        }
    }
    Shield::lot(array('segment' => 'asset', 'the_name' => $old, 'the_content' => is_file(ASSET . DS . $old) && strpos(',' . SCRIPT_EXT . ',', ',' . File::E($old) . ',') !== false ? File::open(ASSET . DS . $old)->read() : false))->attach('manager', false);
});
/**
 * Asset Killer
 * ------------
 */
Route::accept($config->manager->slug . '/asset/kill/(file|files):(:all)', function ($path = "", $name = "") use($config, $speak) {
    if (Guardian::get('status') !== 'pilot') {
        Shield::abort();
    }
    $name = File::path($name);
    $p = Request::get('path');
    $p = $p ? '?path=' . urlencode($p) : "";
    if (strpos($name, ';') !== false) {
        $deletes = explode(';', $name);
    } else {
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:route.asset.php

示例10: saveTo

 /**
  * ====================================================================
  *  SAVE THE IMAGE TO ANOTHER PLACE
  * ====================================================================
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter    | Type   | Description
  *  ------------ | ------ | -------------------------------------------
  *  $destination | string | Path to image file or directory
  *  ------------ | ------ | -------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function saveTo($destination)
 {
     if (is_dir($destination)) {
         $destination .= DS . File::B(self::$original);
     }
     $old_extension = File::E(self::$original);
     $new_extension = File::E($destination);
     if ($old_extension !== $new_extension) {
         self::gen();
         self::twin(null, $new_extension);
     }
     File::open(self::$placeholder)->moveTo($destination);
     imagedestroy(self::$GD);
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:27,代码来源:image.php

示例11: str_replace

        echo Session::get('recent_file_update') === File::B($file->path) ? ' class="active"' : "";
        ?>
>
      <td class="td-icon"><?php 
        echo Form::checkbox('selected[]', $url);
        ?>
</td>
      <td class="td-collapse"><time datetime="<?php 
        echo Date::format($file->update_raw, 'c');
        ?>
"><?php 
        echo str_replace('-', '/', $file->update);
        ?>
</time></td>
      <?php 
        $n = Jot::icon(is_file($file->path) ? 'file-' . Mecha::alter(File::E($file->path), array('xls' => 'excel-o', 'xlsx' => 'excel-o', 'doc' => 'word-o', 'docx' => 'word-o', 'ppt' => 'powerpoint-o', 'pptx' => 'powerpoint-o', 'pdf' => 'pdf-o', 'gz' => 'archive-o', 'iso' => 'archive-o', 'rar' => 'archive-o', 'tar' => 'archive-o', 'zip' => 'archive-o', 'zipx' => 'archive-o', 'bmp' => 'image-o', 'gif' => 'image-o', 'ico' => 'image-o', 'jpeg' => 'image-o', 'jpg' => 'image-o', 'png' => 'image-o', 'txt' => 'text-o', 'log' => 'text-o', 'mp3' => 'audio-o', 'ogg' => 'audio-o', 'wav' => 'audio-o', 'mkv' => 'video-o', 'flv' => 'video-o', 'avi' => 'video-o', 'mov' => 'video-o', 'mp4' => 'video-o', '3gp' => 'video-o', 'css' => 'code-o', 'js' => 'code-o', 'json' => 'code-o', 'jsonp' => 'code-o', 'htm' => 'code-o', 'html' => 'code-o', 'php' => 'code-o', 'xml' => 'code-o'), 'o') : 'folder') . ' ' . File::B($url);
        ?>
      <td>
        <?php 
        if (is_dir($file->path)) {
            ?>
        <a href="<?php 
            echo $config->url . '/' . $c_url . '/1?path=' . Text::parse(ltrim($q_path . '/' . File::B($url), '/'), '->encoded_url');
            ?>
" title="<?php 
            echo $speak->enter;
            ?>
&hellip;"><?php 
            echo $n;
            ?>
</a>
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:unit.explorer.3.php

示例12: merge

 public static function merge($path, $name = null, $addon = "", $call = null)
 {
     $the_path = strpos($name, ROOT) === 0 ? File::path($name) : ASSET . DS . File::path($name);
     $the_log = LOG . DS . 'asset.' . str_replace(array(ASSET . DS, DS), array("", '__'), $the_path) . '.log';
     $is_valid = true;
     if (!file_exists($the_log)) {
         $is_valid = false;
     } else {
         $the_time = explode("\n", file_get_contents($the_log));
         if (count($the_time) !== count($path)) {
             $is_valid = false;
         } else {
             foreach ($the_time as $i => $unix) {
                 $p = self::path($path[$i]);
                 if (!file_exists($p) || (int) filemtime($p) !== (int) $unix) {
                     $is_valid = false;
                     break;
                 }
             }
         }
     }
     $unix = "";
     $content = "";
     $e = File::E($name);
     if (!file_exists($the_path) || !$is_valid) {
         if (Text::check($e)->in(array('gif', 'jpeg', 'jpg', 'png'))) {
             foreach ($path as &$p) {
                 $p = Filter::colon('asset:source', $p);
                 if (!self::ignored($p) && ($p = Filter::colon('asset:path', self::path($p, false)))) {
                     $unix .= filemtime($p) . "\n";
                 }
             }
             File::write(trim($unix))->saveTo($the_log);
             Image::take($path)->merge()->saveTo($the_path);
         } else {
             foreach ($path as $p) {
                 $p = Filter::colon('asset:source', $p);
                 if (!self::ignored($p) && ($p = Filter::colon('asset:path', self::path($p, false)))) {
                     $unix .= filemtime($p) . "\n";
                     $c = Filter::apply('asset:input', file_get_contents($p) . "\n", $p);
                     if (strpos(File::B($p), '.min.') === false) {
                         if (strpos(File::B($the_path), '.min.css') !== false) {
                             $c = Converter::detractShell($c);
                         } else {
                             if (strpos(File::B($the_path), '.min.js') !== false) {
                                 $c = Converter::detractSword($c);
                             } else {
                                 $c = $c . "\n";
                             }
                         }
                         $content .= Filter::apply('asset:output', $c, $p);
                     } else {
                         $content .= Filter::apply('asset:output', $c . "\n", $p);
                     }
                 }
             }
             File::write(trim($unix))->saveTo($the_log);
             File::write(trim($content))->saveTo($the_path);
         }
     }
     if (is_null($call)) {
         $call = Mecha::alter($e, array('css' => 'stylesheet', 'js' => 'javascript', 'gif' => 'image', 'jpeg' => 'image', 'jpg' => 'image', 'png' => 'image'));
     }
     return call_user_func('self::' . $call, $the_path, $addon);
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:65,代码来源:asset.php

示例13: foreach

<?php

// New file data
if (isset($_FILES) && !empty($_FILES)) {
    $accept = File::$config['file_extension_allow'];
    foreach ($_FILES as $k => $v) {
        if (isset($field[$k]['accept'])) {
            File::$config['file_extension_allow'] = explode(',', $field[$k]['accept']);
        }
        if ($v['size'] > 0 && $v['error'] === 0) {
            $name = $name_o = Text::parse($v['name'], '->safe_file_name');
            // Group substance by extension
            if ($e = File::E($name, false)) {
                $name = $e . DS . $name;
            }
            // File already exists. Don't overwrite and don't show the error message
            if (file_exists(SUBSTANCE . DS . $name)) {
                $field[$k]['value'] = File::url($name_o);
                Notify::info(Config::speak('notify_file_exist', '<code>' . $name . '</code>'));
                // Upload new file
            } else {
                File::upload($v, SUBSTANCE . DS . File::D($name));
                if (!Notify::errors()) {
                    $field[$k]['value'] = File::url($name_o);
                    Weapon::fire(array('on_substance_update', 'on_substance_construct'), array($G, $P));
                }
            }
        }
        File::$config['file_extension_allow'] = $accept;
    }
    unset($accept);
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:task.ignite.substance.php

示例14: function

    if (!File::exist($htaccess)) {
        File::write('deny from all')->saveTo($htaccess, 0600);
    }
    Config::set(array('page_title' => $speak->snippets . $config->title_separator . $config->manager->title, 'cargo' => __DIR__ . DS . 'cargo.snippet.php'));
    Shield::lot(array('segment' => 'snippet'))->attach('manager');
});
Route::post($config->manager->slug . '/snippet/ignite', function () use($config, $speak) {
    $request = Request::post();
    $id = time();
    Guardian::checkToken($request['token']);
    if (trim($request['name']) === "") {
        $request['name'] = $id . '.txt';
        // empty file name
    }
    $_path = Text::parse(sprintf($request['name'], $id), '->safe_path_name');
    $e = File::E($_path, false);
    if ($e !== 'txt' && $e !== 'php') {
        $e = 'txt';
        $_path .= '.txt';
    }
    $_path_ = File::path($_path);
    $file = ASSET . DS . '__snippet' . DS . $e . DS . $_path;
    if (File::exist($file)) {
        // file already exists
        Notify::error(Config::speak('notify_file_exist', '<code>' . $_path_ . '</code>'));
    }
    if (trim($request['content']) === "") {
        // empty file content
        Notify::error($speak->notify_error_content_empty);
    }
    if (!Notify::errors()) {
开发者ID:tovic,项目名称:snippet-plugin-for-mecha-cms,代码行数:31,代码来源:route.snippet.php

示例15: array

<?php

$name = $_FILES['file']['name'];
$mime = $_FILES['file']['type'];
$extension = File::E($name);
$mime_accept = array('application/download', 'application/octet-stream', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip');
$extension_accept = array('zip');
$path = File::N($name);
if (!empty($name)) {
    if (File::exist($destination . DS . $path)) {
        Notify::error(Config::speak('notify_folder_exist', '<code>' . $path . '</code>'));
    } else {
        if (!Mecha::walk($mime_accept)->has($mime) || !Mecha::walk($extension_accept)->has($extension)) {
            Notify::error(Config::speak('notify_invalid_file_extension', 'ZIP'));
        }
    }
} else {
    Notify::error($speak->notify_error_no_file_selected);
}
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:19,代码来源:task.ignite.package.php


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