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


PHP Asset::getInstance方法代码示例

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


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

示例1: smarty_function_asset

/**
 * Add an html tag for the given asset(s)
 * 
 * @param array $params
 * @param Template $smarty
 * @return string
 */
function smarty_function_asset($params, &$smarty)
{
    if (!isset($params['href'])) {
        throw new SmartyException('No parameter href is set');
    }
    // Getting files list
    $files = explode(',', $params['href']);
    if (empty($files)) {
        throw new SmartyException('href parameter is empty');
    }
    $dir = '';
    if (isset($params['dir'])) {
        $dir = '/' . trim($params['dir'], '/') . '/';
    }
    // Getting file type
    if (!isset($params['type'])) {
        $ext = substr($files[0], strrpos($files[0], '.') + 1);
        switch ($ext) {
            case 'less':
            case 'css':
                $type = 'css';
                break;
            case 'js':
                $type = 'js';
                break;
        }
    } else {
        $type = $params['type'];
    }
    if (!isset($type) || $type !== 'js' && $type !== 'css') {
        throw new SmartyException('Type is not defined');
    }
    if (Config::get('asset.combine', true) === false || count($files) === 1) {
        foreach ($files as $file) {
            $timestamp = Asset::getInstance()->add($dir . $file)->getLastModified();
            if ($type === 'css') {
                echo '<link rel="stylesheet" type="text/css" href="/' . $timestamp . $dir . $file . '" />' . PHP_EOL;
            } else {
                echo '<script src="/' . $timestamp . $dir . $file . '"></script>' . PHP_EOL;
            }
        }
    } else {
        $asset = Asset::getInstance();
        foreach ($files as $file) {
            $asset->add($dir . $file);
        }
        $uid = isset($params['name']) ? str_replace('.' . $type, '', $params['name']) : $asset->getUid();
        $timestamp = $asset->getLastModified();
        $asset->compile($uid);
        if ($type === 'css') {
            echo '<link rel="stylesheet" type="text/css" href="/' . $timestamp . '/' . $uid . '.css" />' . PHP_EOL;
        } else {
            echo '<script src="/' . $timestamp . '/' . $uid . '.js"></script>' . PHP_EOL;
        }
    }
}
开发者ID:salomalo,项目名称:php-oxygen,代码行数:63,代码来源:function.asset.php

示例2: finishDynamicArea

 public function finishDynamicArea()
 {
     if (self::$curDynamicId !== $this->id) {
         return false;
     }
     echo '<!--\'end_frame_cache_' . $this->id . '\'-->';
     self::$curDynamicId = false;
     Asset::getInstance()->stopTarget($this->getAssetId());
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:framestatic.php

示例3: setup_game_data

 /**
  * setup initial game data when player play the game for the first time.
  * invoked by: Controller.GameServer.setup_data()
  * @param $game_data
  * @return bool
  */
 public function setup_game_data($game_data)
 {
     $game_data["gme_player"] = $_SESSION['ply_id'];
     $this->Create(Utility::TABLE_GAME_DATA, $game_data);
     $product = Product::getInstance();
     $product->initialize_product();
     $asset = Asset::getInstance();
     $asset->initialize_asset();
     return true;
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:16,代码来源:Memorycard.class.php

示例4: explode

<?php

/**
 * This file is part of the PHP Oxygen package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2011-2012 Sébastien HEYD <sheyd@php-oxygen.com>
 * @author      Sébastien HEYD <sheyd@php-oxygen.com>
 * @package     PHP Oxygen
 */
// Load the framework
require_once '../oxygen/bootstrap.php';
if (isset($_GET['asset'])) {
    $asset = Asset::getInstance();
    $assets = explode(',', $_GET['asset']);
    foreach ($assets as $a) {
        $asset->add($a);
    }
    $asset->output();
} else {
    // Run the dispatcher
    Controller::getInstance()->dispatch();
}
开发者ID:salomalo,项目名称:php-oxygen,代码行数:25,代码来源:index.php

示例5: detail

 /**
  * show player details, show achievement and statistic.
  * role: administrator
  * redirected from: Controller.Player.suspend() whatever suspend result
  *                  Controller.Player.reactivate() whatever reactivate result
  */
 public function detail()
 {
     if (Authenticate::is_authorized()) {
         $model_player = Player::getInstance();
         $model_journal = Journal::getInstance();
         $model_achievement = Achievement::getInstance();
         $model_asset = Asset::getInstance();
         $model_material = Material::getInstance();
         $model_employee = Employee::getInstance();
         $model_memorycard = Memorycard::getInstance();
         $id = $this->framework->url->url_part(3);
         $this->framework->view->page = "player";
         $this->framework->view->content = "/backend/pages/player_detail";
         $this->framework->view->player_detail = $model_player->player_detail($id);
         $this->framework->view->player_summary = $model_player->fetch($id);
         $this->framework->view->player_performance = $model_player->performance($id);
         $this->framework->view->player_finance = $model_journal->finance_summaries($id);
         $this->framework->view->player_achievements = $model_achievement->get_achievement($id);
         $this->framework->view->player_assets = $model_asset->get_player_asset($id);
         $this->framework->view->player_employees = $model_employee->get_player_employee($id);
         $this->framework->view->player_materials = $model_material->get_player_material($id);
         $this->framework->view->player_game = $model_memorycard->load_game_data($id);
         $this->framework->view->show("backend/template");
     } else {
         transport("administrator");
     }
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:33,代码来源:PlayerController.php

示例6: repair_asset

 /**
  * role: player
  */
 public function repair_asset()
 {
     if (Authenticate::is_player()) {
         if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
             $this->model_asset = Asset::getInstance();
             $result = $this->model_asset->repair_asset();
             $binding = array("result_var" => "session_ready", "status_var" => $result);
             binding_data($binding);
         } else {
             transport("error404");
         }
     } else {
         $binding = array("result_var" => "no_session");
         binding_data($binding);
     }
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:19,代码来源:InventoryController.php

示例7: insert_simulation

 /**
  * role: player
  * @return string
  */
 public function insert_simulation()
 {
     if (Authenticate::is_player()) {
         if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
             $this->model_memorycard = Memorycard::getInstance();
             $day = $_POST['day'];
             $served = $_POST['served'];
             $loss = $_POST['loss'];
             $stress = $_POST['stress'];
             $work = $_POST['work'];
             $location = $_POST['location'];
             $popularity = $_POST['popularity'];
             $overview = $_POST['overview'];
             $result = $this->model_memorycard->insert_simulation($day, $served, $loss, $stress, $work, $location, $popularity, $overview);
             $this->model_asset = Asset::getInstance();
             $this->model_asset->increase_depreciation();
             $log = Log::getInstance();
             $log->logging_game_simulation(json_encode(array($day, $served, $loss, $stress, $work, $location, $popularity, $overview)));
             $binding = array("result_var" => "session_ready", "simulation_var" => $result);
             binding_data($binding);
         } else {
             transport("error404");
         }
     } else {
         $binding = array("result_var" => "no_session");
         binding_data($binding);
     }
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:32,代码来源:GameServerController.php


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