本文整理汇总了PHP中Asset::set_path方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::set_path方法的具体用法?PHP Asset::set_path怎么用?PHP Asset::set_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::set_path方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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');
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->data = array();
$this->error = array();
// Load theme and template
$this->load->helper('themes');
load_layout('default');
$CI = get_instance();
$CI->load->library('Asset');
// Work out module, controller and method and make them accessable throught the CI instance
$CI->module = $this->module = $this->router->fetch_module();
$CI->controller = $this->controller = $this->router->fetch_class();
$CI->method = $this->method = $this->router->fetch_method();
// Get meta data for the module
$this->template->module_details = $CI->module_details = $this->module_details = $CI->module;
Asset::add_path('module', APPPATH . 'modules/' . $CI->module . '/views/');
// Theme directory path
Asset::add_path('theme', APPPATH . 'themes/default/');
Asset::set_path('theme');
// Load language
//Get language that was set in db
$lang_cd = 'en';
$lang_name = 'english';
$CI->load->model('setting/setting_model');
$row = $CI->setting_model->getSetting('config', 'config_language');
if (isset($row)) {
$lang_cd = isset($row['config_language']) ? $row['config_language'] : 'en';
if ($lang_cd === 'vi') {
$lang_name = 'vietnamese';
}
}
$CI->session->set_userdata('config_language', $lang_cd);
// Get language id from language table and set to session
$where = array();
$where['status'] = 1;
$where['code'] = $lang_cd;
$CI->db->select('language_id');
$query = $CI->db->get_where('language', $where);
$result = $query->row_array();
if (isset($result['language_id'])) {
$CI->session->set_userdata('config_language_id', $result['language_id']);
}
// Load config
$this->load->helper('setting');
get_setting_to_session();
// Load information for header
$this->data['logo_img'] = base_url() . 'uploads/' . $this->session->userdata('config_logo');
// Load menu
$this->load->helper('menu_page');
menu_page($this->data);
// Load footer
$this->data['shop_name'] = $this->session->userdata('config_name');
$this->data['shop_address'] = $this->session->userdata('config_address');
$this->data['shop_telephone'] = $this->session->userdata('config_telephone');
$this->data['shop_email'] = $this->session->userdata('config_email');
}
示例3: __construct
public function __construct()
{
parent::__construct();
// First off set the db prefix
$this->db->set_dbprefix('core_');
// If we're on the MSM then we turn the session table off.
$this->config->set_item('sess_use_database', false);
// If using a URL not defined as a site, set this to stop the world ending
defined('SITE_REF') or define('SITE_REF', 'core');
// make sure they've ran the installer before trying to view our shiny panel
$this->db->table_exists('sites') or redirect('installer');
defined('ADMIN_THEME') or define('ADMIN_THEME', 'msm');
defined('MSMPATH') or redirect('404');
// define folders that we need to create for each new site
ci()->locations = $this->locations = array(APPPATH . 'cache' => array('simplepie'), 'addons' => array('modules', 'widgets', 'themes'), 'data' => array());
// Since we don't need to lock the lang with a setting like /admin and
// the front-end we just define CURRENT_LANGUAGE exactly the same as AUTO_LANGUAGE
defined('CURRENT_LANGUAGE') or define('CURRENT_LANGUAGE', AUTO_LANGUAGE);
// Load the Language files ready for output
$this->lang->load(array('admin', 'buttons', 'global', 'sites/sites', 'users/user'));
// Load all the required classes
$this->load->model(array('sites_m', 'user_m', 'settings_m'));
$this->load->library(array('session', 'form_validation', 'settings/settings'));
$this->load->dbforge();
// Work out module, controller and method and make them accessable throught the CI instance
ci()->module = $this->module = $this->router->fetch_module();
ci()->controller = $this->controller = $this->router->fetch_class();
ci()->method = $this->method = $this->router->fetch_method();
ci()->module_details = $this->module_details = array('slug' => 'sites');
// Load helpers
$this->load->helper('admin_theme');
$this->load->helper('file');
$this->load->helper('number');
$this->load->helper('date');
$this->load->helper('cookie');
// Load ion_auth config so our user's settings (password length, etc) are in sync
$this->load->config('users/ion_auth');
// Set the theme as a path for Asset library
Asset::add_path('theme', MSMPATH . 'themes/' . ADMIN_THEME . '/');
Asset::set_path('theme');
// check to make sure they're logged in
if ($this->method !== 'login' and !$this->user_m->logged_in()) {
redirect('sites/login');
}
$this->template->add_theme_location(MSMPATH . 'themes/');
// Template configuration
$this->template->append_css('theme::common.css')->append_js('jquery/jquery.cooki.js')->enable_parser(false)->set('super_username', $this->session->userdata('super_username'))->set_theme(ADMIN_THEME)->set_layout('default', 'admin');
}
示例4: __construct
/**
* The construct checks for authorization then loads in settings for
* all of the admin controllers.
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
$this->benchmark->mark('public_controller_start');
Events::trigger('public_controller');
// Check the frontend hasnt been disabled by an admin
if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) {
header('Retry-After: 600');
$error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error');
show_error($error, 503);
}
// Load the current theme so we can set the assets right away
ci()->theme = $this->theme_m->get();
if (empty($this->theme->slug)) {
show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.');
}
// Set the theme as a path for Asset library
Asset::add_path('theme', $this->theme->path . '/');
Asset::set_path('theme');
// Support CDN URL's like Amazon CloudFront
// if (Settings::get('cdn_domain')) {
// $protocol = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https' : 'http';
// Asset::set_url($protocol . '://' . rtrim(Settings::get('cdn_domain'), '/') . '/');
// }
// Set the theme view folder
$this->template->set_theme($this->theme->slug)->append_metadata('
<script type="text/javascript">
var APPPATH_URI = "' . APPPATH_URI . '";
var BASE_URI = "' . BASE_URI . '";
</script>');
// Is there a layout file for this module?
if ($this->template->layout_exists($this->module . '.html')) {
$this->template->set_layout($this->module . '.html');
} elseif ($this->template->layout_exists('default.html')) {
$this->template->set_layout('default.html');
}
// Make sure whatever page the user loads it by, its telling search robots the correct formatted URL
// $this -> template -> set_metadata('canonical', site_url($this -> uri -> uri_string()), 'link');
// grab the theme options if there are any
// $this -> theme -> options = $this -> appcache -> model('theme_m', 'get_values_by', array( array('theme' => $this -> theme -> slug)));
// $this -> template -> settings = $this -> settings -> get_all();
$this->template->server = $_SERVER;
$this->template->theme = $this->theme;
// $this -> benchmark -> mark('public_controller_end');
}
示例5: __construct
/**
* Load language, check flashdata, define https, load and setup the data
* for the admin theme
*/
public function __construct()
{
parent::__construct();
// Load the Language files ready for output
$this->lang->load('admin');
$this->lang->load('buttons');
// Show error and exit if the user does not have sufficient permissions
if (!self::_check_access()) {
$this->session->set_flashdata('error', lang('cp_access_denied'));
redirect();
}
// If the setting is enabled redirect request to HTTPS
if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's') {
redirect(str_replace('http:', 'https:', current_url()) . '?session=' . session_id());
}
$this->load->helper('admin_theme');
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('theme', $this->admin_theme->web_path . '/');
Asset::set_path('theme');
// grab the theme options if there are any
ci()->theme_options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => ADMIN_THEME)));
// Active Admin Section (might be null, but who cares)
$this->template->active_section = $this->section;
Events::trigger('admin_controller');
// Template configuration
$this->template->enable_parser(FALSE)->set('theme_options', $this->theme_options)->set_theme(ADMIN_THEME)->set_layout('default', 'admin');
// trigger the run() method in the selected admin theme
$class = 'Theme_' . ucfirst($this->admin_theme->slug);
call_user_func(array(new $class(), 'run'));
}
示例6: __construct
/**
* Loads the gazillion of stuff, in Flash Gordon speed.
* @todo Document properly please.
*/
public function __construct()
{
parent::__construct();
$this->benchmark->mark('public_controller_start');
// Check redirects if GET and Not AJAX
if (!$this->input->is_ajax_request() and $_SERVER['REQUEST_METHOD'] == 'GET') {
$this->load->model('redirects/redirect_m');
$uri = trim(uri_string(), '/');
if ($redirect = $this->redirect_m->get_from($uri)) {
// Check if it was direct match
if ($redirect->from == $uri) {
redirect($redirect->to, 'location', $redirect->type);
}
// If it has back reference
if (strpos($redirect->to, '$') !== FALSE) {
$from = str_replace('%', '(.*?)', $redirect->from);
$redirect->to = preg_replace('#^' . $from . '$#', $redirect->to, $uri);
}
// Redirect with wanted redirect header type
redirect($redirect->to, 'location', $redirect->type);
}
}
Events::trigger('public_controller');
// Check the frontend hasnt been disabled by an admin
if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) {
header('Retry-After: 600');
$error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error');
show_error($error, 503);
}
// -- Navigation menu -----------------------------------
$this->load->model('pages/page_m');
// Load the current theme so we can set the assets right away
ci()->theme = $this->theme_m->get();
if (empty($this->theme->slug)) {
show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.');
}
// Set the theme as a path for Asset library
Asset::add_path('theme', $this->theme->path . '/');
Asset::set_path('theme');
// Support CDN URL's like Amazon CloudFront
if (Settings::get('cdn_domain')) {
$protocol = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
// Make cdn.pyrocms.com into https://cdn.pyrocms.com/
Asset::set_url($protocol . '://' . rtrim(Settings::get('cdn_domain'), '/') . '/');
}
// Set the theme view folder
$this->template->set_theme($this->theme->slug)->append_metadata('
<script type="text/javascript">
var APPPATH_URI = "' . APPPATH_URI . '";
var BASE_URI = "' . BASE_URI . '";
</script>');
// Is there a layout file for this module?
if ($this->template->layout_exists($this->module . '.html')) {
$this->template->set_layout($this->module . '.html');
} elseif ($this->template->layout_exists('default.html')) {
$this->template->set_layout('default.html');
}
// Make sure whatever page the user loads it by, its telling search robots the correct formatted URL
$this->template->set_metadata('canonical', site_url($this->uri->uri_string()), 'link');
// If there is a blog module, link to its RSS feed in the head
if (module_exists('blog')) {
$this->template->append_metadata('<link rel="alternate" type="application/rss+xml" title="' . $this->settings->site_name . '" href="' . site_url('blog/rss/all.rss') . '" />');
}
// Frontend data
$this->load->library('variables/variables');
// grab the theme options if there are any
$this->theme->options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => $this->theme->slug)));
// Assign segments to the template the new way
$this->template->variables = $this->variables->get_all();
$this->template->settings = $this->settings->get_all();
$this->template->server = $_SERVER;
$this->template->theme = $this->theme;
$this->benchmark->mark('public_controller_end');
}
示例7: __construct
/**
* Load language, check flashdata, define https, load and setup the data
* for the admin theme
*/
public function __construct()
{
parent::__construct();
// Load the Language files ready for output
$this->lang->load('admin');
$this->lang->load('buttons');
// Show error and exit if the user does not have sufficient permissions
if (!self::_check_access()) {
$this->session->set_flashdata('error', lang('cp:access_denied'));
redirect();
}
// If the setting is enabled redirect request to HTTPS
if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's') {
redirect(str_replace('http:', 'https:', current_url()) . '?session=' . session_id());
}
$this->load->helper('admin_theme');
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('theme', $this->admin_theme->web_path . '/');
Asset::set_path('theme');
// grab the theme options if there are any
ci()->theme_options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => ADMIN_THEME)));
// Active Admin Section (might be null, but who cares)
$this->template->active_section = $this->section;
Events::trigger('admin_controller');
// -------------------------------------
// Build Admin Navigation
// -------------------------------------
// We'll get all of the backend modules
// from the DB and run their module items.
// -------------------------------------
if (is_logged_in()) {
// Here's our menu array.
$menu_items = array();
// This array controls the order of the admin items.
$this->template->menu_order = array('lang:cp:nav_content', 'lang:cp:nav_structure', 'lang:cp:nav_data', 'lang:cp:nav_users', 'lang:cp:nav_settings', 'lang:global:profile');
// $this->template->menu_order = array('lang:cp:nav_content', 'lang:cp:nav_structure', 'lang:cp:nav_data', 'lang:cp:nav_users', 'lang:cp:nav_settings', 'lang:global:profile');
$modules = $this->module_m->get_all(array('is_backend' => true, 'group' => $this->current_user->group, 'lang' => CURRENT_LANGUAGE));
foreach ($modules as $module) {
// If we do not have an admin_menu function, we use the
// regular way of checking out the details.php data.
if ($module['menu'] and (isset($this->permissions[$module['slug']]) or $this->current_user->group == 'admin')) {
// Legacy module routing. This is just a rough
// re-route and modules should change using their
// upgrade() details.php functions.
if ($module['menu'] == 'utilities') {
$module['menu'] = 'data';
}
if ($module['menu'] == 'design') {
$module['menu'] = 'structure';
}
$menu_items['lang:cp:nav_' . $module['menu']][$module['name']] = 'admin/' . $module['slug'];
}
// If a module has an admin_menu function, then
// we simply run that and allow it to manipulate the
// menu array.
if (method_exists($module['module'], 'admin_menu')) {
//echo "<pre>";
// print_r($menu_items);;
$module['module']->admin_menu($menu_items);
}
}
// We always have our
// edit profile links and such.
$menu_items['lang:global:profile'] = array('lang:cp:edit_profile_label' => 'edit-profile', 'lang:cp:logout_label' => 'admin/logout');
// Order the menu items. We go by our menu_order array.
$ordered_menu = array();
foreach ($this->template->menu_order as $order) {
if (isset($menu_items[$order])) {
$ordered_menu[lang_label($order)] = $menu_items[$order];
unset($menu_items[$order]);
}
}
// Any stragglers?
if ($menu_items) {
$translated_menu_items = array();
// translate any additional top level menu keys so the array_merge works
foreach ($menu_items as $key => $menu_item) {
$translated_menu_items[lang_label($key)] = $menu_item;
}
$ordered_menu = array_merge_recursive($ordered_menu, $translated_menu_items);
}
//unset($ordered_menu['Content']);
// And there we go! These are the admin menu items.
$this->template->menu_items = $ordered_menu;
}
// ------------------------------
// Template configuration
$this->template->enable_parser(false)->set('theme_options', $this->theme_options)->set_theme(ADMIN_THEME)->set_layout('default', 'admin');
// trigger the run() method in the selected admin theme
//.........这里部分代码省略.........
示例8: __construct
/**
* The construct checks for authorization then loads in settings for
* all of the admin controllers.
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
// Load the Language files ready for output
$this->lang->load('admin');
$this->lang->load('buttons');
if (in_array($this->method, $this->secured_methods) || in_array('_all_', $this->secured_methods)) {
if (!$this->ion_auth->logged_in() and $this->method != 'no_internet_access') {
$this->session->set_userdata('login_redirect', $this->uri->uri_string());
redirect('admin/users/login');
}
// Be an admin or have access to this module a bit
$module = $this->router->fetch_module();
if (!$this->ion_auth->is_sadmin() and (empty($this->permissions) or $module !== 'dashboard' and empty($this->permissions[$module]))) {
$this->session->set_userdata('error', lang('cp_access_denied'));
redirect('dashboard');
// show_error('Permission Denied');
}
}
// If the setting is enabled redirect request to HTTPS
if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's') {
redirect(str_replace('http:', 'https:', current_url()) . '?session=' . session_id());
}
$this->load->helper('admin_theme');
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);
$this->load->library('form_validation');
// Set the location of assets
Asset::add_path('theme', $this->admin_theme->web_path . '/');
Asset::set_path('theme');
// grab the theme options if there are any
ci()->theme_options = $this->appcache->model('theme_m', 'get_values_by', array(array('theme' => ADMIN_THEME)));
// Active Admin Section (might be null, but who cares)
$this->template->active_section = $this->section;
Events::trigger('admin_controller');
// Template configuration
$this->template->enable_parser(FALSE)->set('theme_options', $this->theme_options)->set_theme('' . PAN::setting('admin_theme'))->set_layout('index');
$this->template->set_partial('notifications', 'partials/notifications');
$this->template->module = $this->router->fetch_module();
// Active Admin Section (might be null, but who cares)
$this->template->active_section = $this->section;
// Get the diskspace library
$this->load->library('system/diskSpace');
// Get detils about the server
$dUsage = new diskSpace(".");
$this->template->perentagefree = $dUsage->percentage_free;
// will output: Percentage Free: 93%
$this->template->percentageused = $dUsage->percentage_used;
// Setting up the base pagination config
$this->pagination_config['per_page'] = Settings::get('items_per_page');
$this->pagination_config['num_links'] = 5;
$this->pagination_config['full_tag_open'] = '';
$this->pagination_config['full_tag_close'] = '';
$this->pagination_config['first_tag_open'] = '';
$this->pagination_config['first_tag_close'] = '';
$this->pagination_config['last_tag_open'] = '';
$this->pagination_config['last_tag_close'] = '';
$this->pagination_config['prev_tag_open'] = '';
$this->pagination_config['prev_tag_close'] = '';
$this->pagination_config['next_tag_open'] = '';
$this->pagination_config['next_tag_close'] = '';
$this->pagination_config['cur_tag_open'] = '';
$this->pagination_config['cur_tag_close'] = '';
$this->pagination_config['num_tag_open'] = '';
$this->pagination_config['num_tag_close'] = '';
// Try to determine the pagination base_url
$segments = $this->uri->segment_array();
if ($this->uri->total_segments() >= 4) {
array_pop($segments);
}
if (Settings::get('application_debug') == true) {
$this->output->enable_profiler(true);
} else {
$this->output->enable_profiler(false);
}
$this->pagination_config['base_url'] = site_url(implode('/', $segments));
$this->pagination_config['uri_segment'] = 4;
// Add the theme path to the asset paths
// trigger the run() method in the selected admin theme -
$class = 'Theme_' . ucfirst($this->admin_theme->slug);
call_user_func(array(new $class(), 'run'));
log_message('debug', "Main_Controller Class Initialized");
}