本文整理汇总了PHP中Asset类的典型用法代码示例。如果您正苦于以下问题:PHP Asset类的具体用法?PHP Asset怎么用?PHP Asset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Asset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Process asset content
*
* @param string $content
* @param Asset $asset
*
* @return string
*/
public static function process($content, Asset $asset)
{
// Set Less
$lc = new lessc();
$lc->importDir = dirname($asset->source_file()) . DIRECTORY_SEPARATOR;
return $lc->parse($content);
}
示例2: run
public function run()
{
// create default user asset
$asset = Asset::where('filename', '=', 'default.png')->first();
if ($asset == NULL) {
$asset = new Asset();
$asset->filename = 'default.png';
$asset->path = 'assets/content/users';
$asset->save();
}
$admin = Role::where('name', '=', 'Admin')->first();
// create default roles
if ($admin == NULL) {
$admin = new Role();
$admin->name = 'Admin';
$admin->save();
}
$adminUser = User::where('username', '=', 'admin')->first();
if ($adminUser != NULL) {
echo "Admin User Already Exsit";
} else {
$adminUser = new User();
$adminUser->username = 'admin';
$adminUser->email = 'admin@admin.com';
$adminUser->password = 'admin';
$adminUser->password_confirmation = 'admin';
$adminUser->confirmation_code = md5(uniqid(mt_rand(), true));
if ($adminUser->save()) {
$adminUser->attachRole($admin);
echo "Admin User Created";
}
}
}
示例3: getDataForResource
/**
* @see Object\ClassDefinition\Data::getDataForResource
* @param Asset $data
* @param null|Model\Object\AbstractObject $object
* @return integer|null
*/
public function getDataForResource($data, $object = null)
{
if ($data instanceof PriceRule) {
return $data->getId();
}
return null;
}
示例4: setupDatabases
public function setupDatabases()
{
$name = $this->call('migrate', array('--path' => 'app/database/migrations/setup/'));
$name = $this->call('migrate');
// create the roles
$roles = ['Admin', 'Writer', 'Reader'];
foreach ($roles as $r) {
$role = Role::whereName($r)->first();
if ($role == null) {
$role = new Role();
$role->name = $r;
$role->display_name = $r;
$role->save();
$this->info("{$role->id} Creating Role:{$r}");
}
}
foreach (User::all() as $u) {
$this->info("{$u->id} : user: {$u->username}");
}
// add core assets
$m = Asset::findFromTag('missing-user-image');
if ($m == NULL) {
$m = new Asset();
$m->path = "assets/content/uploads";
$m->saveLocalFile(public_path('assets/content/common/missing/profile-default.png'), 'profile-default.png');
$m->tag = 'missing-user-image';
$m->shared = 1;
$m->type = Asset::ASSET_TYPE_IMAGE;
$m->save();
}
$this->comment("****\tAll Databases for Halp have been setup :-) \t****");
return;
}
示例5: test_process
public function test_process()
{
$asset = new Asset(Assets::STYLESHEET, 'test-sass.css.sass');
$sass = file_get_contents($asset->source_file());
$css = file_get_contents($asset->destination_file());
$converted = Asset_Engine_Sass::process($sass, $asset);
$this->assertEquals($css, $converted);
}
示例6: test_process
public function test_process()
{
$asset = new Asset(Assets::JAVASCRIPT, 'test-coffee.js.coffee');
$coffee = file_get_contents($asset->source_file());
$js = file_get_contents($asset->destination_file());
$converted = Asset_Engine_Coffee::process($coffee, $asset);
$this->assertEquals($js, $converted);
}
示例7: addAsset
/**
* @param Asset $asset
*/
public function addAsset(Asset $asset)
{
if ($asset->getAssetHandle()) {
$this->add($asset->getAssetPointer());
} else {
// doesn't check anything. this is useful for layouts, etc... other handle-less assets.
$this->assets[] = $asset;
}
}
示例8: userpic
public function userpic()
{
$userpic_id = $this->author_userpic_asset_id;
if (empty($userpic_id) || !is_numeric($userpic_id)) {
return;
}
require_once 'class.mt_asset.php';
$asset = new Asset();
$asset->Load("asset_id = {$userpic_id}");
return $asset;
}
示例9: process
/**
* Process asset content
*
* @param string $content
* @param Asset $asset
*
* @return string
*/
public static function process($content, Asset $asset)
{
// Set error reporting
$old = error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));
// Set content
CoffeeScript\Init::load();
$options = array('filename' => Debug::path($asset->source_file()), 'header' => FALSE);
$content = CoffeeScript\Compiler::compile($content, $options);
// Set error reporting
error_reporting($old);
return $content;
}
示例10: asset
public function asset()
{
$col_name = "objectasset_asset_id";
$asset = null;
if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
$asset_id = $this->{$col_name};
require_once 'class.mt_asset.php';
$asset = new Asset();
$asset->Load("asset_id = {$asset_id}");
}
return $asset;
}
示例11: process
/**
* Process asset content
*
* @param string $content
* @param Asset $asset
* @return string
*/
public static function process($content, Asset $asset)
{
// Set error reporting
$old = error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));
// Include the engine
include_once Kohana::find_file('vendor/coffeescript/CoffeeScript', 'Init');
// Set content
CoffeeScript\Init::load();
$options = array('filename' => Debug::path($asset->source_file()), 'header' => TRUE);
$content = CoffeeScript\Compiler::compile($content, $options);
// Set error reporting
error_reporting($old);
return $content;
}
示例12: get_detail
/**
* フリーマーケット詳細表示画面
*
* @access public
* @param mixed $fleamarket_id フリーマーケットID
* @return void
* @author ida
*/
public function get_detail($fleamarket_id)
{
Asset::css('jquery-ui.min.css', array(), 'add_css');
Asset::js('jquery-ui.min.js', array(), 'add_js');
if (!$fleamarket_id) {
return $this->forward('errors/notfound', 404);
}
$fleamarket = \Model_Fleamarket::findDetail($fleamarket_id);
if (!$fleamarket) {
return $this->forward('errors/notfound', 404);
}
$this->setHtmlReplace(array('AREA' => $this->getArea($fleamarket['prefecture_id']), 'AREA_NAME' => $this->getAreaName($fleamarket['prefecture_id']), 'FLEAMARKET_NAME' => $fleamarket['name'], 'LOCATION_ID' => $fleamarket['location_id'], 'LOCATION_NAME' => $fleamarket['location_name']));
$fleamarket_abouts = \Model_Fleamarket_About::findByFleamarketId($fleamarket_id);
$fleamarket_images = \Model_Fleamarket_Image::findByFleamarketId($fleamarket_id);
$entry_styles = \Model_Fleamarket_Entry_Style::findByFleamarketId($fleamarket_id);
$entries = \Model_Entry::getTotalEntryByFleamarketId($fleamarket_id);
$fleamarket['entries'] = $entries;
$view_model = \ViewModel::forge('search/detail');
$view_model->set('fleamarket', $fleamarket, false);
$view_model->set('fleamarket_images', $fleamarket_images, false);
$view_model->set('fleamarket_abouts', $fleamarket_abouts, false);
$view_model->set('fleamarket_entry_styles', $entry_styles, false);
$view_model->set('entries', $entries, false);
$view_model->set('prefectures', \Config::get('master.prefectures'), false);
$view_model->set('user', $this->login_user, false);
$this->template->content = $view_model;
}
示例13: __construct
public function __construct()
{
/* Set the Language Based on Agent Browser */
$languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
$lang = substr($languages[0], 0, 2);
App::setLocale($lang);
/* Load Assets */
Asset::add('bootstraptheme', 'assets/css/bootstrap-spacelab.css');
Asset::add('bootstrapresponsive', 'assets/css/bootstrap-responsive.css');
Asset::add('charisma', 'assets/css/charisma-app.css');
Asset::add('uniform', 'assets/css/uniform.default.css');
Asset::add('elfinder', 'assets/css/elfinder.min.css');
Asset::add('opaicons', 'assets/css/opa-icons.css');
Asset::add('famfam', 'assets/css/famfam.css');
Asset::add('jqueryloadermin', 'assets/css/jquery.loader-min.css');
Asset::add('reportula', 'assets/css/reportula.css');
Asset::add('jquery', 'assets/js/jquery-2.0.3.min.js');
Asset::add('datatables', 'assets/js/jquery.dataTables.min.js', 'jquery');
Asset::add('jqueryloader', 'assets/js/jquery.loader-min.js', 'jquery');
Asset::add('main', 'assets/js/main.js', 'TableTools');
Asset::add('modal', 'assets/js/bootstrap-modal.js', 'jquery');
/* Get Monolog instance from Laravel */
$monolog = Log::getMonolog();
/* Add the FirePHP handler */
$monolog->pushHandler(new \Monolog\Handler\FirePHPHandler());
/* Resolve Database Names Myslq and Postgres */
if (Config::get('database.default') == 'mysql') {
$this->tables = array('job' => 'Job', 'client' => 'Client', 'files' => 'Files', 'media' => 'Media', 'pool' => 'Pool', 'path' => 'Path', 'filename' => 'Filename', 'file' => 'File', 'jobfiles' => 'JobFiles', 'jobmedia' => 'JobMedia');
} else {
$this->tables = array('job' => 'job', 'client' => 'client', 'files' => 'files', 'media' => 'media', 'pool' => 'pool', 'path' => 'path', 'filename' => 'filename', 'file' => 'file', 'jobfiles' => 'jobfiles', 'jobmedia' => 'jobmedia');
}
}
示例14: __construct
public function __construct()
{
parent::__construct();
Config::set('auth.driver', 'adminauth');
Asset::add('bootstrap', 'bundles/adminify/css/bootstrap.min.css');
Asset::add('style', 'bundles/adminify/css/style.css');
}
示例15: __construct
/**
* @todo Document this please.
*/
public function __construct()
{
parent::__construct();
// Not logged in or not an admin and don't have permission to see files
if (!$this->current_user or $this->current_user->group !== 'admin' and (!isset($this->permissions['files']) or !isset($this->permissions['files']['wysiwyg']))) {
$this->load->language('files/files');
show_error(lang('files:no_permissions'));
}
ci()->admin_theme = $this->theme_m->get_admin();
// Using a bad slug? Weak
if (empty($this->admin_theme->slug)) {
show_error('This site has been set to use an admin theme that does not exist.');
}
// Make a constant as this is used in a lot of places
defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug);
// Set the location of assets
Asset::add_path('module', APPPATH . 'modules/wysiwyg/');
Asset::add_path('theme', $this->admin_theme->web_path . '/');
Asset::set_path('theme');
$this->load->library('files/files');
$this->lang->load('files/files');
$this->lang->load('wysiwyg');
$this->lang->load('buttons');
$this->template->set_theme(ADMIN_THEME)->set_layout('wysiwyg', 'admin')->enable_parser(false)->append_css('module::wysiwyg.css')->append_css('jquery/ui-lightness/jquery-ui.css')->append_js('jquery/jquery.js')->append_js('jquery/jquery-ui.min.js')->append_js('plugins.js')->append_js('module::wysiwyg.js');
}