本文整理汇总了PHP中Assets::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::instance方法的具体用法?PHP Assets::instance怎么用?PHP Assets::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* show map
*
* @param string $id
* @return void
* @author Andy Bennett
*/
public function index($id = 1)
{
$db = new Database();
$m = ORM::factory('imagemap', $id);
if (!$m->loaded) {
Kohana::show_404('Imagemap ' . $id, 'common/error_404');
return;
}
Assets::instance()->add_javascript('/cache/js/photonotes');
Assets::instance()->add_css('/cache/css/photonotes');
Assets::instance()->add_css('/cache/css/photonotes_client');
$pages_array = strstr(APPPATH, 'backend_') === FALSE ? array() : imagemap_helper::get_pages();
$pages = json_encode($pages_array);
// Build the Image object
$image = array();
$image['img'] = $m->upload->id . $m->upload->file_ext;
$image['alt'] = $m->title;
// Load the view as an object
$view = new View('imagemap');
// Add variable data to the view
$view->image = $image;
$view->notes = $m->imagenotes;
$view->admin = true;
//APPENV == 'backend'; // Are the image maps editable?
$view->id = $id;
// Needed for reporting changes back to the backend via ajax
$view->pages = $pages;
// Send the array of pages through to the view
// Render the View
$view->render(TRUE);
}
示例2: upload_form
/**
* show upload form
*
* @return void
* @author Andy Bennett
*/
public static function upload_form()
{
Assets::instance()->add_css('/cache/css/swfupload/default');
Assets::instance()->add_javascript('/cache/js/swfupload/swfupload');
Assets::instance()->add_javascript('/cache/js/swfupload/swfupload.swfobject');
Assets::instance()->add_javascript('/cache/js/swfupload/swfupload.queue');
Assets::instance()->add_javascript('/cache/js/swfupload/fileprogress');
Assets::instance()->add_javascript('/cache/js/swfupload/handlers');
$s = URI::instance()->segment(1);
Session::instance();
$gal = Input::instance()->get('gallery_id');
if (!is_numeric($gal)) {
$gal = 0;
}
$u = isset($_GET['ajax']) ? '?ajax=true' : '';
$config = array();
$config['flash_url'] = url::site() . "cache/swf/swfupload/swfupload.swf";
$config['post_upload_url'] = url::site() . $s . "/post_upload/" . $gal . $u;
$config['upload_url'] = url::site() . $s . "/process_upload" . $u;
$config['session_id'] = session_id();
$config['postname'] = gallery_helper::get_upload_config()->upload_name;
$config['filetypes'] = '*.' . implode(';*.', gallery_helper::get_upload_config()->extension_whitelist);
$config['cat_id'] = $gal;
Display::instance()->add_head_content(View::factory('upload_head_js', $config)->render());
Display::instance()->display(View::factory('pages/' . $s . '_upload', array('gal' => $gal)));
}
示例3: geocode
/**
*
* @link http://hpneo.github.io/gmaps/examples.html
*/
public static function geocode(array $params = [])
{
Assets::instance()->add_scripts(['http://maps.google.com/maps/api/js?sensor=true', 'vendor/gmaps/gmaps.js']);
$init = ['id' => 'map', 'class' => 'map', 'lat' => '-19.258078', 'lng' => '146.813046', 'zoom' => 16, 'zoomControl' => 'true', 'zoomControlOpt' => 'LEFT_CENTER', 'scrollwheel' => 'false', 'streetViewControl' => 'false', 'address' => 'Australia, Sydney'];
$params = array_merge($init, $params);
// Inline JS
//
Assets::instance()->add_inlineJS("\n\t\t\tvar " . $params['id'] . ";\n\t\t\t\$(document).ready(function(){\n\t\t\t\tmap = new GMaps({\n\t\t\t\t\tel : '#" . $params['id'] . "',\n\t\t\t\t\tlat : " . $params['lat'] . ",\n\t\t\t\t\tlng : " . $params['lng'] . ",\n\t\t\t\t\tzoom : " . $params['zoom'] . ",\n\t\t\t\t\tzoomControl : " . $params['zoomControl'] . ",\n\t\t\t\t\tzoomControlOpt :\n\t\t\t\t\t{\n\t\t\t\t\t\tposition : '" . $params['zoomControlOpt'] . "'\n\t\t\t\t\t},\n\t\t\t\t\tscrollwheel : " . $params['scrollwheel'] . ",\n\t\t\t\t\tstreetViewControl : " . $params['streetViewControl'] . "\n\t\t\t\t});\n\t\t\t\tGMaps.geocode({\n\t\t\t\t\taddress: '" . $params['address'] . "',\n\t\t\t\t\tcallback: function(results, status){\n\t\t\t\t\t\tif(status=='OK'){\n\t\t\t\t\t\t\tvar latlng = results[0].geometry.location;\n\t\t\t\t\t\t\tmap.setCenter(latlng.lat(), latlng.lng());\n\t\t\t\t\t\t\tmap.addMarker({\n\t\t\t\t\t\t\t\tlat: latlng.lat(),\n\t\t\t\t\t\t\t\tlng: latlng.lng(),\n\t\t\t\t\t\t\t\ttitle: '" . $params['address'] . "',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t");
return '<div id="' . $params['id'] . '" class="' . $params['class'] . '"></div>';
}
示例4: v_nestable
/**
* Return view ordering tree
* @return string
* @throws Exception
*/
public function v_nestable()
{
Assets::instance()->add_styles(['vendor/nestable/nestable.css']);
Assets::instance()->add_scripts(['vendor/nestable/nestable.js']);
$url = Route::url('ajax', ['module' => $this->_module, 'controller' => Request::get('controller'), 'action' => 'order']);
Assets::instance()->add_inlineJS("\n\t\t \$('#nestable')\n\t\t .nestable({\n\t\t maxDepth: {$this->_max_nested}\n\t\t })\n\t\t .change(function() {\n\t\t APP.nestableSorter('{$url}', \$('#nestable'));\n\t\t });\n\t\t");
$arr = DB::select('id', 'parent_id', $this->_display_field)->from($this->_table_name)->order_by('position')->execute()->as_array('id');
ob_start();
$this->echo_ol(Tree::flat2nested($arr));
return '<div class="dd" id="nestable">' . ob_get_clean() . '</div>';
}
示例5: __construct
/**
* constructor; check acl, set display
*
* @author Andy Bennett
*/
public function __construct()
{
parent::__construct();
$this->setup['status_states'] = 2;
if (!User::instance()->id) {
url::redirect('/auth/login');
}
Acl::instance()->redirect(User::instance()->get_role(), 'admin', null, '/auth/login');
$tpl = (request::is_ajax() or isset($_GET['ajax'])) ? 'template-ajax' : 'template-admin';
Display::instance()->set_template($tpl);
Assets::instance()->add_css('admin');
}
示例6: before
/**
* Before action
*/
public function before()
{
parent::before();
Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap.min.css', 'vendor/awesome/css/font-awesome.min.css', 'css/style.css'])->add_scripts(['vendor/jquery-1.11.3.min.js', 'vendor/bootstrap/js/bootstrap.min.js', 'js/app.js']);
$this->cms_modules = Module::get_modules();
if (Module::is_on('cms_shop')) {
$this->cart = new Cart();
$this->template->set_global('cart', $this->cart);
Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap-select.min.css', 'vendor/slick/slick.css', 'vendor/slick/slick-theme.css'])->add_scripts(['vendor/jquery.maskedinput.js', 'vendor/bootstrap/js/bootstrap-select.min.js', 'vendor/slick/slick.min.js', 'js/cart.js']);
}
$this->template->v_footer = View::factory('frontend/v_footer');
$this->template->v_header = View::factory('frontend/v_header');
}
示例7: before
/**
* Before action
*/
public function before()
{
parent::before();
// If not admin
if (!$this->is_admin) {
HTTP::redirect(Route::url('b_auth', ['action' => 'login']));
}
$this->cms_modules = Module::get_modules();
$this->curr_module = $this->config_mod['cms_module'];
$this->settings_mod = $this->config_mod['settings'];
$this->template->bind_global('settings_mod', $this->settings_mod);
Assets::instance()->add_styles(['css/style.min.css'])->add_scripts(['vendor/jquery-1.11.3.min.js', 'vendor/jquery.extends.js', 'vendor/bootstrap/js/bootstrap.min.js', 'vendor/bootstrap-notify/notify.js', 'js/app.js']);
}
示例8: index
/**
* Get plugins and show
*
* @return void
* @author Dan Chadwick
*/
public function index()
{
Event::add('steamcore.aclcheck', array('acl_listeners', 'redirect'));
$data = array('action' => 'admin', 'name' => null, 'role' => User::instance()->get_role());
Event::run('steamcore.aclcheck', $data);
Assets::instance()->add_css('admin');
$view = View::factory('plugins_list');
$view->plugins = PluginManager::instance()->getPluginObjects();
$content = array('content' => new stdClass());
$content['content']->title = 'Plugins Admin';
$content['content']->copy = $view->render();
Assets::instance()->add_css('/cache/css/display');
Assets::instance()->add_javascript('/cache/js/display');
Display::instance()->display(Container::instance('display')->render($content));
}
示例9: run
public function run()
{
Util\Template::init();
Util\TemplateTags::init();
Util\Images::init();
Util\Shortcodes::init();
Util\BootstrapNavMenu::init();
Util\BootstrapGallery::init();
Assets::instance()->run();
Customizer::instance()->run();
AJAX::instance()->run();
PluginCompat::instance()->run();
add_action('after_setup_theme', array($this, 'after_setup_theme'));
add_action('widgets_init', array($this, 'widgets_init'));
}
示例10: __construct
/**
* constructor; add js / css; set up listener
*
* @author Andy Bennett
*/
function __construct()
{
//parent::__construct();
Assets::instance()->add_css('/cache/css/forum');
Assets::instance()->add_javascript('/cache/js/forum');
Event::add('forum.render', array('steamforum_listeners', 'render'));
$this->argv = Router::$arguments;
$this->current_page = "forum";
// Remove the first argument which is always the name of the current page
if (is_array($this->argv)) {
$this->current_page = array_shift($this->argv);
} else {
$this->argv = array();
}
// Work out the base url for links - TODO: This needs to be generalised as its currently itim specific
$this->base_url = sitemap_helper::get_base() . "/" . $this->current_page;
}
示例11: __construct
/**
* Loads URI, and Input into this controller.
*
* @return void
*/
public function __construct()
{
$session = Session::instance();
$site_config = yaml::parse($_SESSION['site_name'], 'site_config');
foreach ($site_config as $key => $value) {
$this->{$key} = $value;
}
// --- Setup our required library instances ---
// --------------------------------------------
# Auth Instance for editing site capability
$this->client = new Auth($this->claimed);
# Account Instance for user account tool.
$this->account_user = new Account();
# assets instance to fetch datapath urls.
$this->assets = Assets::instance($this->site_name, $this->theme);
# URI should always be available
$this->uri = URI::instance();
# Input should always be available
$this->input = Input::instance();
if (Kohana::$instance == NULL) {
# Set the instance to the first controller loaded
Kohana::$instance = $this;
}
}
示例12: act
/**
* Anchors of actions in list table
*
* @param string $name route name
* @param array $params route url params
* @param string $title title for display
*
* @return string
*/
public static function act($name, array $params, $title = '')
{
if (Arr::get($params, 'action') == 'add') {
return HTML::anchor(Route::url($name, $params), '<i class="fa fa-plus fa-lg fa-fw"></i>', ['data-toggle' => 'tooltip', 'title' => $title ? $title : __('settings.act_add')]);
} elseif (Arr::get($params, 'action') == 'edit') {
return HTML::anchor(Route::url($name, $params), $title ? $title : '<i class="fa fa-pencil fa-lg fa-fw"></i>', ['data-toggle' => 'tooltip', 'title' => __('settings.act_edit')]);
} elseif (Arr::get($params, 'action') == 'filter') {
return HTML::anchor(Route::url($name, $params), $title, ['data-toggle' => 'tooltip', 'title' => __('settings.act_filter')]);
} elseif (Arr::get($params, 'action') == 'delete') {
$title = $title ? $title : __('settings.act_delete');
if (self::$is_running_delete === false) {
Assets::instance()->add_inlineJS("\n\t\t\t\t\t\$('.delete').click(function(e){\n\t\t\t\t\t\tif ( ! confirm('{$title}')) { return false; }\n\t\t\t\t\t});\n\t\t\t\t");
self::$is_running_delete = true;
}
return HTML::anchor(Route::url($name, $params), '<i class="fa fa-trash-o fa-lg fa-fw text-danger"></i>', ['class' => 'delete', 'data-toggle' => 'tooltip', 'title' => __('settings.act_delete')]);
} elseif (Arr::get($params, 'action') == 'undelete') {
$title = $title ? $title : __('settings.act_delete');
if (self::$is_running_delete === false) {
Assets::instance()->add_inlineJS("\n\t\t\t\t\t\$('.delete').click(function(e){\n\t\t\t\t\t\tif ( ! confirm('{$title}')) { return false; }\n\t\t\t\t\t});\n\t\t\t\t");
self::$is_running_delete = true;
}
return HTML::anchor(Route::url($name, $params), '<i class="fa fa-arrow-up fa-lg fa-fw text-success"></i>', ['class' => 'delete', 'data-toggle' => 'tooltip', 'title' => __('settings.act_undelete')]);
} elseif (Arr::get($params, 'slug')) {
return HTML::anchor(Route::url($name, $params), $title ? $title : '<i class="fa fa-eye fa-fw"></i>', ['target' => '_blank', 'data-toggle' => 'tooltip', 'title' => __('settings.act_view_link')]);
}
return '';
}
示例13: showLinkToCity
</div>
<div class="form-group" id="city_link">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<p class="form-control-static">
<?php
echo HTML::anchor('', '', ['id' => 'a_city', 'target' => '_blank']);
?>
</p>
</div>
</div>
<?php
Assets::instance()->add_inlineJS('
$(function () {
$("#np_city_ref").selectpicker({
size: 5
});
function showLinkToCity() {
var cityRef = $("#np_city_ref").val();
if (cityRef) {
$("#div_address").show();
$("#a_city").attr("href", "http://novaposhta.ua/office/list?city=" + $("#np_city_ref option:selected").text());
$("#a_city").empty().append(\'Смотреть отделения на сайте Новой Почты <i class="fa fa-external-link"></i>\');
$.post("/ajax/cart/warehouses", {
city_ref : cityRef
示例14: date
<?php
Assets::instance()->add_javascript('/cache/jeremycal/prototype-date-extensions');
Assets::instance()->add_javascript('/cache/jeremycal/datepicker');
Assets::instance()->add_css('/cache/jeremycal/datepicker');
?>
<p>
<?php
echo form::input($o->form_name . '_datetime' . $o->group_id, date("Y-m-d H:i", strtotime($o->cval)));
?>
<script type="text/javascript">
//<![CDATA[
new Control.DatePicker('<?php
echo $o->form_name . '_datetime' . $o->group_id;
?>
', {icon: '/cache/jeremycal/calendar.png',
timePicker: true, timePickerAdjacent: true, locale: 'en_iso8601'});
//]]>
</script>
</p>
<?php
echo $o->get_error($o->name);
示例15: __
echo Form::open(null, ['class' => 'form-signin']);
?>
<?php
echo Message::get(false);
?>
<?php
echo $content;
?>
<i class="fa fa-home fa-fw"></i>
<?php
echo HTML::anchor(Route::url('f_home'), __('settings.go_to_home_page'));
?>
<?php
echo Form::close();
?>
</div>
<?php
Assets::instance()->render(Assets::SCRIPTS);
?>
<?php
echo $v_profiler;
?>
</body>
</html>