• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Weapon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 public function __construct(\Weapon $weapon, \Armor $armor, array $rings = [], $hp = 100)
 {
     $this->hp = $hp;
     $this->damage = $weapon->getDamage();
     $this->cost += $weapon->getCost();
     $this->armor = $armor->getArmor();
     $this->cost += $armor->getCost();
     foreach ($rings as $ring) {
         $this->damage += $ring->getDamage();
         $this->armor += $ring->getArmor();
         $this->cost += $ring->getCost();
     }
 }
开发者ID:boast,项目名称:adventofcode,代码行数:13,代码来源:day_21.php


示例2: create_object

 public function create_object($data)
 {
     $data = \Core\Dict::create($data);
     $assassin = Agent::mapper()->create_object(array('id' => $data->assassin, 'alias' => $data->assassin_agent_alias));
     $target = Agent::mapper()->create_object(array('id' => $data->target, 'alias' => $data->target_agent_alias));
     $weapon = Weapon::mapper()->create_object(array('id' => $data->weapon_id, 'name' => $data->weapon_name));
     return Kill::create(array('id' => $data->id, 'description' => $data->description, 'assassin' => $assassin, 'target' => $target, 'weapon' => $weapon, 'game' => $game, 'when_happened' => new \DateTime($data->when_happened)), True);
 }
开发者ID:radiosilence,项目名称:trouble,代码行数:8,代码来源:kill.php


示例3: shoot

 public function shoot(Ship $target, Weapon $weapon)
 {
     if ($weapon->getCharges() > 1) {
         $dice = rand(1, 6);
         $range = $this->check_range($target, $weapon);
         if ($range == 1 && $dice >= 4) {
             $target->receive_dmg();
         } else {
             if ($range == 2 && $dice >= 5) {
                 $target->receive_dmg();
             } else {
                 if ($range == 3 && $dice >= 6) {
                     $target->receive_dmg();
                 }
             }
         }
         $weapon->subCharge();
     }
 }
开发者ID:avallete,项目名称:PHPool,代码行数:19,代码来源:Cairn.class.php


示例4: check_range

 protected function check_range(Ship $target, Weapon $weapon)
 {
     $x = $target->getPos()['x'] - $this->getPos()['x'];
     $y = $target->getPos()['y'] - $this->getPos()['y'];
     $distance = sqrt(pow($x, 2) + pow($y, 2));
     if ($distance != 0) {
         if ($distance < $weapon->getRange()['short']) {
             return 1;
         } else {
             if ($distance < $weapon->getRange()['mid']) {
                 return 2;
             } else {
                 if ($distance < $weapon->getRange()['long']) {
                     return 3;
                 } else {
                     return 0;
                 }
             }
         }
     }
 }
开发者ID:avallete,项目名称:PHPool,代码行数:21,代码来源:Ship.class.php


示例5: getAll

 function getAll()
 {
     $db = DB::GetConn();
     $getQuery = "SELECT * FROM `Weapon`;";
     $res = $db->query($getQuery);
     //execute query
     $returnWeapons = array();
     while ($obj = $res->fetchObject()) {
         array_push($returnWeapons, Weapon::loadWeaponFromObject($obj));
     }
     return $returnWeapons;
 }
开发者ID:kroony,项目名称:squealing-funicular,代码行数:12,代码来源:weaponController.php


示例6: loadSaleFromObject

 function loadSaleFromObject($obj)
 {
     $returnSale = new Sale();
     $returnSale->ID = $obj->ID;
     $returnSale->SellerID = $obj->SellerID;
     $returnSale->ItemType = $obj->ItemType;
     $returnSale->ItemID = $obj->ItemID;
     $returnSale->Price = $obj->Price;
     $returnSale->Created = new DateTime($obj->Created);
     //load the actual object for sale
     if ($returnSale->ItemType == "Weapon") {
         $returnSale->Item = Weapon::loadWeapon($returnSale->ItemID);
     }
     return $returnSale;
 }
开发者ID:kroony,项目名称:squealing-funicular,代码行数:15,代码来源:sale.php


示例7: array

<?php

if (Weapon::exist('article_footer')) {
    ?>
<div><?php 
    Weapon::fire('article_footer', array($article));
    ?>
</div>
<?php 
}
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:10,代码来源:article.footer.index.php


示例8: array

?>
  <?php 
Shield::chunk('comment.form.message');
?>
  <?php 
Weapon::fire('comment_form_textarea_after', $hooks);
?>
  <?php 
Shield::chunk('comment.form.math');
?>
  <div class="grid-group">
    <span class="grid span-1"></span>
    <div class="grid span-5">
      <p>
        <?php 
Weapon::fire('comment_form_button_before', $hooks);
?>
        <?php 
echo Form::button($speak->publish, null, 'submit', null, array('class' => array('btn', 'btn-construct')));
?>
        <?php 
Weapon::fire('comment_form_button_after', $hooks);
?>
      </p>
      <p><?php 
echo $speak->comment_wizard;
?>
</p>
    </div>
  </div>
</form>
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:comment.form.php


示例9: Get_Item_Information

 public function Get_Item_Information($itemtypeid)
 {
     $itemtypeid = urldecode($itemtypeid);
     if (!is_numeric($itemtypeid)) {
         return Response::json(array('status' => 'error', 'error' => 'This is not a proper ItemTypeID.'));
     }
     if (strlen($itemtypeid) > 8) {
         return Response::json(array('status' => 'error', 'error' => 'This is not a proper ItemTypeID.'));
     }
     //check the cache
     if (Cache::has($this->class_name . "_" . $itemtypeid)) {
         //pull from cache
         $itemtypeid_info = Cache::get($this->class_name . "_" . $itemtypeid);
         return json_encode($itemtypeid_info);
     }
     $basic_info = hWebIcon::where(function ($query) use($itemtypeid) {
         $query->where('itemTypeId', '=', $itemtypeid);
         $query->where('version', '=', $this->version);
     })->first(array('asset_path', 'abilitymodule_id', 'backpack_id', 'basic_id', 'blueprint_id', 'chassis_id', 'consumable_id', 'craftingcomponent_id', 'craftingstation_id', 'craftingsubcomponent_id', 'framemodule_id', 'palettemodule_id', 'powerup_id', 'resourceitem_id', 'scopemodule_id', 'weapon_id', 'weaponmodule_id'));
     if (empty($basic_info)) {
         return Response::json(array('status' => 'error', 'error' => 'ItemTypeID not found in db.'));
     }
     //break up the types
     $detailed_info = array();
     $constraint_info = array();
     $weapon_info = array();
     if ($basic_info['abilitymodule_id'] != "") {
         $detailed_info = AbilityModule::where('id', '=', $basic_info['abilitymodule_id'])->first(array('type', 'abilityId', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'powerLevel', 'rarity', 'durability'));
         $constraint_info = hConstraint::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('cpu', 'mass', 'power'));
     }
     if ($basic_info['basic_id'] != "") {
         $detailed_info = Basic::where('id', '=', $basic_info['basic_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['blueprint_id'] != "") {
         //Note -> blueprint_id = recipe_id
     }
     if ($basic_info['chassis_id'] != "") {
         //Note -> links to hattributes
         $detailed_info = Chassis::where('id', '=', $basic_info['chassis_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity', 'progression_item_id', 'progression_resource_id'));
         $chassis_info = hAttributes::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->get(array('description', 'display_name', 'value', 'stat_id'));
     }
     if ($basic_info['consumable_id'] != "") {
         $detailed_info = Consumable::where('id', '=', $basic_info['consumable_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'powerLevel', 'name', 'rarity'));
     }
     if ($basic_info['craftingcomponent_id'] != "") {
         $detailed_info = CraftingComponent::where('id', '=', $basic_info['craftingcomponent_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['craftingsubcomponent_id'] != "") {
         $detailed_info = CraftingSubcomponent::where('id', '=', $basic_info['craftingsubcomponent_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['framemodule_id'] != "") {
         $detailed_info = FrameModule::where('id', '=', $basic_info['framemodule_id'])->first(array('type', 'abilityId', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'powerLevel', 'rarity', 'durability'));
         $constraint_info = hConstraint::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('cpu', 'mass', 'power'));
     }
     if ($basic_info['palletmodule_id'] != "") {
         $detailed_info = PaletteModule::where('id', '=', $basic_info['palettemodule_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['powerup_id'] != "") {
         $detailed_info = Powerup::where('id', '=', $basic_info['powerup_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['resourceitem_id'] != "") {
         $detailed_info = ResourceItem::where('id', '=', $basic_info['resourceitem_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity', 'resource_color'));
     }
     if ($basic_info['weapon_id'] != "") {
         //weapons have hstats also!
         $detailed_info = Weapon::where('id', '=', $basic_info['weapon_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity', 'durability'));
         $constraint_info = hConstraint::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('cpu', 'mass', 'power'));
         $weapon_info = hStat::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('ammoPerBurst', 'clipSize', 'damagePerRound', 'damagePerSecond', 'healthPerRound', 'maxAmmo', 'range', 'reloadTime', 'roundsPerBurst', 'roundsPerMinute', 'splashRadius', 'spread'));
     }
     if (empty($detailed_info)) {
         return Response::json(array('status' => 'error', 'error' => 'error getting detailed information for this itemtypeid.'));
     }
     $detailed_info = $detailed_info->toArray();
     $detailed_info['asset_path'] = $basic_info['asset_path'];
     //add contstraint details
     if (!empty($constraint_info)) {
         $constraint_info = $constraint_info->toArray();
         $detailed_info['cpu'] = $constraint_info['cpu'];
         $detailed_info['mass'] = $constraint_info['mass'];
         $detailed_info['power'] = $constraint_info['power'];
     }
     if (!empty($weapon_info)) {
         $weapon_info = $weapon_info->toArray();
         foreach ($weapon_info as $key => $data) {
             $detailed_info[$key] = $data;
//.........这里部分代码省略.........
开发者ID:odie5533,项目名称:ThumpDumpDB,代码行数:101,代码来源:ItemAPIController.php


示例10:

 } else {
     if ($_REQUEST['action'] == "changeWeapon") {
         $weapon = Weapon::loadWeapon($_REQUEST['WeaponID']);
         // @TODO also check that weapon is currently unassigned,
         // so people like me cannot cheat and assign a weapon twice
         if ($weapon->UserID == $currentUID) {
             $hero->Weapon = $weapon;
             $hero->SaveHero();
             $smarty->assign("hero", $hero);
             $smarty->assign("message", $hero->Name . " has equipped " . $weapon->Name);
         } else {
             $smarty->assign("error", "That does not belong to you.");
         }
     } else {
         if ($_REQUEST['action'] == "editWeaponName") {
             $weapon = Weapon::loadWeapon($_REQUEST['WeaponID']);
             if ($weapon->UserID == $currentUID) {
                 $oldName = $weapon->Name;
                 $weapon->Name = $_REQUEST['weaponName'];
                 $weapon->save();
                 $smarty->assign("message", $oldName . " was renamed to " . $weapon->Name);
                 $hero->Weapon = $weapon;
                 $smarty->assign("hero", $hero);
             } else {
                 $smarty->assign("error", "You can't rename what does not belong to you.");
             }
         } else {
             if ($_REQUEST['action'] == "levelUp") {
                 if ($hero->canLevelUp()) {
                     if ($hero->Status == "") {
                         $hero->Status = "Level Up";
开发者ID:kroony,项目名称:squealing-funicular,代码行数:31,代码来源:viewHero.php


示例11: function

    if ($articles = Mecha::eat($s)->chunk(1, $config->index->per_page)->vomit()) {
        $articles = Mecha::walk($articles, function ($path) use($excludes) {
            return Get::article($path, $excludes);
        });
    } else {
        $articles = false;
    }
    Filter::add('pager:url', function ($url) {
        return Filter::apply('index:url', $url);
    });
    Config::set(array('articles' => $articles, 'pagination' => Navigator::extract($s, 1, $config->index->per_page, $config->index->slug)));
    Shield::attach('page-home');
}, 110);
/**
 * Route Hook: after
 * -----------------
 */
Weapon::fire('routes_after');
/**
 * Do Routing
 * ----------
 */
Route::execute();
/**
 * 404 Page
 * --------
 *
 * Fallback to 404 page if nothing matched.
 *
 */
Shield::abort();
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:launch.php


示例12: array

        <time datetime="<?php 
        echo $page->date->W3C;
        ?>
"><?php 
        echo $page->date->FORMAT_3;
        ?>
</time>
      </span>
    </div>
    <div class="page-body"><?php 
        echo $page->description;
        ?>
</div>
    <div class="page-footer">
      <?php 
        Weapon::fire('page_footer', array($page));
        ?>
    </div>
  </li>
  <?php 
    }
    ?>
</ol>
<?php 
    include DECK . DS . 'workers' . DS . 'unit.pager.1.php';
} else {
    ?>
<p><?php 
    echo Config::speak('notify_empty', strtolower($speak->pages));
    ?>
</p>
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:cargo.page.php


示例13: function

<?php

/**
 * Shortcode Manager
 * -----------------
 */
Route::accept($config->manager->slug . '/shortcode', function () use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $shortcodes = Get::state_shortcode(null, array(), false);
    $G = array('data' => $shortcodes);
    Config::set(array('page_title' => $speak->shortcodes . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.shortcode.php'));
    if ($request = Request::post()) {
        $request = Filter::apply('request:__shortcode', $request);
        Guardian::checkToken($request['token']);
        $data = array();
        for ($i = 0, $keys = $request['key'], $count = count($keys); $i < $count; ++$i) {
            if (trim($keys[$i]) !== "") {
                $data[$keys[$i]] = $request['value'][$i];
            }
        }
        $P = array('data' => $data);
        File::serialize($data)->saveTo(STATE . DS . 'shortcode.txt', 0600);
        Notify::success(Config::speak('notify_success_updated', $speak->shortcode));
        Weapon::fire('on_shortcode_update', array($G, $P));
        Guardian::kick($config->url_current);
    }
    Shield::lot(array('segment' => 'shortcode', 'files' => Mecha::O($shortcodes)))->attach('manager');
});
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:30,代码来源:route.shortcode.php


示例14: function

<?php

Weapon::add('on_comment_construct', function ($G, $P) use($config, $speak) {
    if ($config->is->post && ($post = $G['data'][$config->page_type])) {
        $c = $config->states->{'plugin_' . md5(File::B(__DIR__))};
        $title = $post['title'];
        $url = $post['url'] . '#' . sprintf($G['data']['comment_id'], Date::format($P['data']['id'], 'U'));
        $topic = sprintf($c->subject, $title, $url);
        $parser = Request::post('content_type', $config->html_parser->active);
        $message = '<blockquote><p>' . sprintf($c->message, $title, $url) . '</p></blockquote>';
        $message .= '<h3>' . $P['data']['name'] . '</h3>';
        $message .= $parser !== false && $parser !== 'HTML' ? Text::parse($P['data']['message'], '->html') : $P['data']['message'];
        $message .= '<p>';
        $message .= '<a href="' . $config->url . '/' . $config->manager->slug . '/comment/repair/id:' . $P['data']['id'] . '">' . $speak->edit . '</a>';
        $message .= ' / ';
        $message .= '<a href="' . $config->url . '/' . $config->manager->slug . '/comment/kill/id:' . $P['data']['id'] . '">' . $speak->delete . '</a>';
        $message .= '</p>';
        // Sending email notification ...
        if (!Guardian::happy() && Notify::send($P['data']['email'], $config->author->email, $topic, $message, 'comment:')) {
            Weapon::fire('on_comment_notify_construct', array($P, $config->author->email, $topic, $message));
        }
    }
});
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:23,代码来源:launch.php


示例15: function

<?php

/**
 * Error Log
 * ---------
 */
Route::accept($config->manager->slug . '/error', function () use($config, $speak) {
    Config::set(array('page_title' => $speak->errors . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.error.php'));
    Shield::lot(array('segment' => 'error', 'content' => File::open(ini_get('error_log'))->read(false)))->attach('manager');
});
/**
 * Error Log Killer
 * ----------------
 */
Route::accept($config->manager->slug . '/error/kill', function () use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $errors = LOG . DS . 'errors.log';
    $G = array('data' => array('content' => File::open($errors)->read()));
    File::open($errors)->delete();
    Weapon::fire('on_error_destruct', array($G, $G));
    Notify::success(Config::speak('notify_success_deleted', $speak->file));
    Guardian::kick(File::D($config->url_current));
});
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:25,代码来源:route.error.php


示例16: chunk

 /**
  * ==========================================================
  *  RENDER A SHIELD CHUNK
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    Shield::chunk('header');
  *
  * ----------------------------------------------------------
  *
  *    Shield::chunk('header', array('title' => 'Yo!'));
  *
  * ----------------------------------------------------------
  *
  */
 public static function chunk($name, $fallback = false, $buffer = true)
 {
     $path__ = File::path($name);
     $G = array('data' => array('name' => $name));
     if (is_array($fallback)) {
         self::$lot = array_merge(self::$lot, $fallback);
         $fallback = false;
     }
     $path__ = Filter::apply('chunk:path', self::path($path__, $fallback));
     $G['data']['lot'] = self::$lot;
     $G['data']['path'] = $path__;
     $out = "";
     if ($path__) {
         // Begin chunk
         Weapon::fire('chunk_lot_before', array($G, $G));
         extract(Filter::apply('chunk:lot', self::$lot));
         Weapon::fire('chunk_lot_after', array($G, $G));
         Weapon::fire('chunk_before', array($G, $G));
         if ($buffer) {
             ob_start(function ($content) use($path__, &$out) {
                 $content = Filter::apply('chunk:input', $content, $path__);
                 $out = Filter::apply('chunk:output', $content, $path__);
                 return $out;
             });
             require $path__;
             ob_end_flush();
         } else {
             require $path__;
         }
         $G['data']['content'] = $out;
         // End chunk
         Weapon::fire('chunk_after', array($G, $G));
     }
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:50,代码来源:shield.php


示例17: function

<?php

Weapon::add('meta', function () {
    $config = Config::get();
    $indent = str_repeat(TAB, 2);
    echo $indent . '<!-- Start Facebook Open Graph -->' . NL;
    echo $indent . '<meta property="og:title" content="' . strip_tags($config->page_title) . '"' . ES . NL;
    echo $indent . '<meta property="og:type" content="' . ($config->page_type == 'article' ? 'article' : 'website') . '"' . ES . NL;
    echo $indent . '<meta property="og:url" content="' . $config->url_current . '"' . ES . NL;
    if (isset($config->article->image)) {
        echo $indent . '<meta property="og:image" content="' . $config->article->image . '"' . ES . NL;
    } else {
        if (isset($config->page->image)) {
            echo $indent . '<meta property="og:image" content="' . $config->page->image . '"' . ES . NL;
        }
    }
    echo $indent . '<meta property="og:site_name" content="' . $config->title . '"' . ES . NL;
    if (isset($config->article->description)) {
        echo $indent . '<meta property="og:description" content="' . strip_tags($config->article->description) . '"' . ES . NL;
    } else {
        if (isset($config->page->description)) {
            echo $indent . '<meta property="og:description" content="' . strip_tags($config->page->description) . '"' . ES . NL;
        } else {
            echo $indent . '<meta property="og:description" content="' . strip_tags($config->description) . '"' . ES . NL;
        }
    }
    echo $indent . '<!-- End Facebook Open Graph -->' . NL;
}, 11);
开发者ID:razordaze,项目名称:mecha-cms,代码行数:28,代码来源:launch.php


示例18: array

<header class="post-header">
  <?php 
Shield::chunk('page.title.404');
?>
  <?php 
if (Weapon::exist('page_header')) {
    ?>
  <div><?php 
    Weapon::fire('page_header', array($page));
    ?>
</div>
  <?php 
}
?>
</header>
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:15,代码来源:page.header.404.php


示例19:

    <?php 
Weapon::fire('SHIPMENT_REGION_TOP');
?>
    <?php 
Weapon::fire('shell_before');
?>
    <?php 
echo Asset::stylesheet(array($config->protocol . ICON_LIBRARY_PATH, 'assets/shell/atom.css', 'assets/shell/layout.css'));
?>
    <?php 
Weapon::fire('shell_after');
?>
  </head>
  <body>
    <?php 
Weapon::fire('cargo_before');
?>
    <div class="blog-wrapper">
      <header class="blog-header">
        <?php 
if ($config->url_current == $config->url) {
    ?>
        <h1 class="blog-title"><?php 
    echo $config->title;
    ?>
</h1>
        <?php 
} else {
    ?>
        <h1 class="blog-title"><a href="<?php 
    echo $config->url;
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:header.php


示例20: foreach

    $route_cache = $cache_config['path'][$config->url_path];
} else {
    foreach ($cache_config['path'] as $path => $exp) {
        if (Route::is($path)) {
            $route_cache = $exp;
            break;
        }
    }
}
if ($route_cache !== false) {
    Weapon::add('shield_before', function () use($config, $route_cache) {
        $q = !empty($config->url_query) ? '.' . md5($config->url_query) : "";
        $cache = CACHE . DS . str_replace(array('/', ':'), '.', $config->url_path) . $q . '.cache';
        $time = file_exists($cache) ? filemtime($cache) : false;
        if ($time !== false && ($route_cache === true || time() - $route_cache * 60 * 60 < $time)) {
            $content = file_get_contents($cache);
            if (strpos($content, '<?xml ') === 0 || strpos($content, '</html>') !== false) {
                $content .= '<!-- cached: ' . date('Y-m-d H:i:s', $time) . ' -->';
            }
            $content = Filter::apply('cache:input', $content);
            $content = Filter::apply('cache:output', $content);
            echo $content;
            exit;
        }
        Weapon::add('shield_after', function ($G) use($cache) {
            $G['data']['cache'] = $cache;
            File::write($G['data']['content'])->saveTo($cache);
            Weapon::fire('on_cache_construct', array($G, $G));
        });
    });
}
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:launch.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Web类代码示例发布时间:2022-05-23
下一篇:
PHP WeUtility类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap