本文整理汇总了PHP中directory_map函数的典型用法代码示例。如果您正苦于以下问题:PHP directory_map函数的具体用法?PHP directory_map怎么用?PHP directory_map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了directory_map函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCrossWalks
function getCrossWalks()
{
// Prevent multiple class generations
global $ENV;
if (count($ENV['crosswalks']) > 0) {
return $ENV['crosswalks'];
}
// Include the interface
require_once REGISTRY_APP_PATH . "core/crosswalks/_crosswalk.php";
// List our crosswalks
$CI =& get_instance();
$CI->load->helper('directory');
$crosswalks = directory_map(REGISTRY_APP_PATH . "core/crosswalks");
$cw_objects = array();
foreach ($crosswalks as $cw_class) {
// Ignore directories and classes with _filename.php
if (is_array($cw_class) || substr($cw_class, 0, 1) == "_") {
continue;
}
// Construct the crosswalk object
$class_name = str_replace(".php", "", $cw_class);
try {
require_once REGISTRY_APP_PATH . "core/crosswalks/" . $cw_class;
// Add it to our objects array
$cw_objects[$class_name] = new $class_name();
} catch (Exception $e) {
// No need to fatal error here...just print an error
echo 'ERROR: Unable to load crosswalk: ' . $cw_class . '<br/>';
}
}
return $cw_objects;
}
示例2: index
function index()
{
if (!($faqRequest = $this->uri->segment(2))) {
$this->load->helper('directory');
// only map the top level directory
$faqDir = directory_map($this->_directory, TRUE);
$faqArticles;
foreach ($faqDir as $index => $file) {
// preg_match's third param takes the matches: first, the whole matched string,
// then each additional matched string
if (!preg_match('#^(.+).html$#', $file, $matches)) {
break;
}
$faqTitle = $this->titleFormat($matches[1]);
$faqArticles[$faqTitle] = $this->_faqFolder . $matches[1];
}
$viewData['faqArticles'] = $faqArticles;
$viewData['title'] = $this->_faqTitle;
$this->load->view('html_head.php', array('site_base' => $this->config->item('base_url')));
$this->load->view('page_head.php', array('userAuth' => @$this->session->userdata('email'), 'markerAuth' => @$this->session->userdata('markerEmail')));
$this->load->view('common/faq_list', $viewData);
$this->load->view('footer.php', array('site_base' => $this->config->item('base_url')));
return;
}
$this->load->helper('file');
$fileName = $this->_faqFolder . $faqRequest . ".html";
$faqTitle = $this->titleFormat($faqRequest);
$this->load->view('html_head.php', array('site_base' => $this->config->item('base_url')));
$this->load->view('page_head.php', array('userAuth' => @$this->session->userdata('email'), 'markerAuth' => @$this->session->userdata('markerEmail')));
$this->load->view('common/faq_header', array('title' => $this->_faqTitle, 'article' => $faqTitle));
$this->load->view($fileName);
$this->load->view('footer.php', array('site_base' => $this->config->item('base_url')));
}
示例3: load_config
function load_config()
{
$CI =& get_instance();
foreach ($CI->Appconfig->get_all()->result() as $app_config) {
$CI->config->set_item($app_config->key, $app_config->value);
}
//Set language from config database
//Loads all the language files from the language directory
if ($CI->config->item('language')) {
$CI->config->set_item('language', $CI->config->item('language'));
// fallback to english if language folder does not exist
$language = $CI->config->item('language');
if (!file_exists('./application/language/' . $language)) {
$language = 'en';
}
$map = directory_map('./application/language/' . $language);
foreach ($map as $file) {
if (substr(strrchr($file, '.'), 1) == "php") {
$CI->lang->load(str_replace('_lang.php', '', $file), $language);
}
}
}
//Set timezone from config database
if ($CI->config->item('timezone')) {
date_default_timezone_set($CI->config->item('timezone'));
} else {
date_default_timezone_set('America/New_York');
}
}
示例4: get_quote_templates
public function get_quote_templates()
{
$this->load->helper('directory');
$templates = directory_map(APPPATH . '/views/quote_templates', TRUE);
$templates = $this->remove_extension($templates);
return $templates;
}
示例5: load_config
function load_config()
{
$CI =& get_instance();
foreach ($CI->Appconfig->get_all()->result() as $app_config) {
$CI->config->set_item($CI->security->xss_clean($app_config->key), $CI->security->xss_clean($app_config->value));
}
//Set language from config database
$language = $CI->config->item('language');
//Loads all the language files from the language directory
if (!empty($language)) {
// fallback to English if language folder does not exist
if (!file_exists('./application/language/' . $language)) {
$language = 'en';
}
$CI->config->set_item('language', $language);
$map = directory_map('./application/language/' . $language);
foreach ($map as $file) {
if (!is_array($file) && substr(strrchr($file, '.'), 1) == "php") {
$CI->lang->load(strtr($file, '', '_lang.php'), $language);
}
}
}
//Set timezone from config database
if ($CI->config->item('timezone')) {
date_default_timezone_set($CI->config->item('timezone'));
} else {
date_default_timezone_set('America/New_York');
}
bcscale($CI->config->item('currency_decimals') + $CI->config->item('tax_decimals'));
}
示例6: get_template_modules_meta_data
function get_template_modules_meta_data()
{
//get ci instance
$ci = get_instance();
//load the module parent class
load_front_library('module.php');
//load language resources
$ci->lang->db_load('modules-boxes');
//modules paths
$path_array = array(store_front_path() . 'local/modules/', store_front_path() . 'system/tomatocart/modules/');
$modules = array();
$loaded = array();
//check all path and find modules
foreach ($path_array as $path) {
$directories = directory_map($path, 1, TRUE);
foreach ($directories as $directory) {
$file = $path . $directory . '/' . $directory . '.php';
if (file_exists($file) && !in_array($directory, $loaded)) {
require_once $file;
//class name
$class_name = 'Mod_' . $directory;
//create new instance
$class = new $class_name(array());
//append loaded module
$loaded[] = $directory;
//append data
$modules[] = array('code' => $class->get_code(), 'text' => $class->get_title(), 'params' => $class->get_params());
}
}
}
return $modules;
}
示例7: mobile
/**
* 移动端模板管理
*/
public function mobile()
{
$this->_init();
$this->load->helper('directory');
$dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
$path = $dir ? $this->path . $dir . '/' : $this->path;
$data = directory_map($path, 1);
$list = array();
if ($data) {
foreach ($data as $t) {
$ext = strrchr($t, '.');
if ($ext && in_array(strtolower($ext), array('.php'))) {
continue;
}
if (!$dir && in_array(basename($t), $this->_dir)) {
continue;
}
$icon = $eurl = '';
if ($ext) {
$ext = strtolower(trim($ext, '.'));
$icon = is_file(FCPATH . 'dayrui/statics/images/ext/' . $ext . '.gif') ? 'ext/' . $ext . '.gif' : 'file.gif';
if (in_array($ext, array('html', 'html', 'js', 'css'))) {
$eurl = dr_url($this->template->get_value('furi') . 'edit', array('file' => $dir . '/' . $t, 'ismb' => 1));
} elseif (in_array($ext, array('jpg', 'gif', 'png'))) {
$eurl = '' . str_replace(FCPATH, SITE_URL, $this->path) . trim($dir . '/' . $t, '/') . '" target="_blank"';
} else {
$eurl = 'javascript:;';
}
}
$list[] = array('ext' => $ext, 'file' => $t, 'icon' => $icon, 'eurl' => $eurl);
}
}
$this->template->assign(array('dir' => $dir, 'path' => $path, 'list' => $list, 'parent' => dirname($dir), 'upload' => 'dr_upload_files2(\'' . dr_url('api/upload', array('path' => $path)) . '\')'));
$this->template->display('file_index.html');
}
示例8: home
function home()
{
$data['title'] = 'Home';
$data['mi'] = '';
$data['innerJSs'] = array('panel/home.php');
$data['jscripts'] = array('tinymce/tinymce.min.js');
$this->load->model('MTexts', 'MTexts', TRUE);
$this->load->model('MFilms', 'MFilms', TRUE);
$this->load->helper('directory');
$this->load->helper('file');
$map = directory_map('./resources/', 1);
$this->load->model('MPosts', 'MPosts', TRUE);
$dataPage['posts'] = $this->MPosts->getAllTable('date', 'desc');
$dataPage['homelatest1'] = $this->MTexts->get('name', 'homelatest1')->pl;
$dataPage['homelatest1link'] = $this->MTexts->get('name', 'homelatest1')->en;
$dataPage['homelatest2'] = $this->MTexts->get('name', 'homelatest2')->pl;
$dataPage['homelatest2link'] = $this->MTexts->get('name', 'homelatest2')->en;
$dataPage['homelatest3'] = $this->MTexts->get('name', 'homelatest3')->pl;
$dataPage['homelatest3link'] = $this->MTexts->get('name', 'homelatest3')->en;
$dataPage['numberOfNewFiles'] = $this->MFilms->update();
$dataPage['mp4s'] = $this->MFilms->getAllTable();
$this->load->view('panel/header', $data);
$this->load->view('panel/page/home', $dataPage);
$this->load->view('panel/footer');
}
示例9: __construct
function __construct($id = NULL, $core_attributes_only = FALSE)
{
// Get our CI instance
$this->_CI =& get_instance();
// Prepare the extension list based on files in our extensions directory not starting with an underscore
if (count(self::$extensions) == 0) {
$this->_CI->load->helper('directory');
$map = directory_map(REGISTRY_APP_PATH . 'registry_object/models/extensions/');
include_once 'extensions/_base.php';
foreach ($map as $file) {
if (!preg_match("/\\.php\$/", $file)) {
continue;
}
if (substr($file, 0, 1) != '_') {
include_once 'extensions/' . $file;
$extension_name = str_replace(".php", "", $file);
self::$extensions[] = $extension_name;
}
}
}
parent::__construct();
// Setup our object id
if (!is_numeric($id) && !is_null($id)) {
throw new Exception("Registry Object Wrapper must be initialised with a numeric Identifier");
}
$this->id = $id;
// Load up all our extensions (effectively providing multiple class inheritence)
foreach (self::$extensions as $extension) {
$this->_extends($extension);
}
// Initialise the object if we haven't done so yet!
if (!is_null($id)) {
$this->init($core_attributes_only);
}
}
示例10: get_themes
/**
* Find all themes in the themes directory
*
* @access public
* @return array
*/
function get_themes()
{
$this->load->helper('directory');
$dir = './themes/';
$themes = directory_map($dir, TRUE);
return $themes;
}
示例11: index
/**
* XML method - output sitemap in XML format for search engines
*
* @return void
*/
public function index()
{
$this->load->helper('directory');
$this->load->helper('file');
$module_dirs = array();
$dir_map = directory_map(APPPATH . 'modules', 1);
foreach ($dir_map as $key => $name) {
if (strpos($name, '.') !== false) {
continue;
// Skip files.
}
$module_dirs[] = rtrim($name, DIRECTORY_SEPARATOR);
}
@sort($module_dirs);
$doc = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
foreach ($module_dirs as $module_name) {
if ($module_name == 'sitemap') {
continue;
}
if (!file_exists(APPPATH . 'modules/' . $module_name . '/controllers/Sitemap_controller.php') && !file_exists(APPPATH . 'modules/' . $module_name . '/controllers/Sitemap.php') && !file_exists(APPPATH . 'modules/' . $module_name . '/controllers/sitemap_controller.php') && !file_exists(APPPATH . 'modules/' . $module_name . '/controllers/sitemap.php')) {
continue;
}
$doc->addChild('sitemap')->addChild('loc', site_url($module_name . '/sitemap/xml'));
}
$this->output->set_content_type('application/xml')->set_output($doc->asXML());
}
示例12: list_services
/**
* Get all template modules
*/
public function list_services()
{
$this->load->helper('directory');
$path_array = array('../system/tomatocart/libraries/service/');
$modules = array();
$loaded = array();
foreach ($path_array as $path) {
$directories = directory_map($path, 1, TRUE);
foreach ($directories as $file) {
if (strpos($file, '.php') !== FALSE && $file != 'service_module.php') {
$module = substr($file, 0, strpos($file, '.php'));
//load language xml file
$this->lang->ini_load('modules/services/' . str_replace('service_', '', $module) . '.php');
//include path file
include_once $path . $file;
//get class
$class = config_item('subclass_prefix') . $module;
$class = str_replace('service', 'Service', $class);
$class = new $class();
if ($class->is_installed()) {
$edit_cls = 'icon-edit-record';
$install_cls = 'icon-uninstall-record';
} else {
$edit_cls = 'icon-edit-gray-record';
$install_cls = 'icon-install-record';
}
//$loaded[] = $directory;
$modules[] = array('code' => $class->get_code(), 'title' => $class->get_title(), 'is_installed' => $class->is_installed(), 'edit_cls' => $edit_cls, 'install_cls' => $install_cls);
}
}
}
$this->output->set_output(json_encode($modules));
}
示例13: controllers
private function controllers()
{
$controller_path = FCPATH . APPPATH . "controllers";
$this->load->helper("directory");
$listing = directory_map($controller_path);
$controllers = array();
foreach ($listing as $file) {
// don't include the welcome controller
if (!in_array($file, array("contents.php"))) {
// check if current file is an array
if (is_array($file)) {
foreach ($file as $actual_file) {
$controllers[] = $this->format_controller_methods($controller_path, $actual_file);
}
}
// prepare class information
$controllers[] = $this->format_controller_methods($controller_path, $file);
}
}
// remove empty entries
foreach (array_keys($controllers) as $key) {
if (empty($controllers[$key])) {
unset($controllers[$key]);
}
}
// sort controllers
sort($controllers);
return $controllers;
}
示例14: edit
public function edit($id = null)
{
// Fetch a article or set new one
if ($id) {
$this->data['article'] = $this->Article_M->get($id);
count($this->data['article']) or $this->data['errors'] = 'article Could not be found';
} else {
$this->data['article'] = $this->Article_M->get_new();
}
// Set up the form
$rules = $this->Article_M->rules;
$this->form_validation->set_rules($rules);
// Process the form
if ($this->form_validation->run() == true) {
$data = $this->Article_M->array_from_post(['title', 'slug', 'body', 'pubdate', 'image']);
$data['user_id'] = $this->session->userdata('id');
$this->Article_M->save($data, $id);
$message = isset($id) ? 'article Updated Successfully' : 'article added Successfully';
$this->session->set_flashdata('success', $message);
redirect('admin/article');
}
// get assets folder content
$this->load->helper('file');
$this->load->helper('directory');
$this->data['files'] = directory_map(FCPATH . 'assets/img/');
// Load the view
$this->data['subview'] = 'admin/article/edit';
$this->load->view('admin/_layout_main', $this->data);
}
示例15: upgrade_tables
public function upgrade_tables()
{
// Collect the available SQL files
$sql_files = directory_map(APPPATH . 'modules/setup/sql', TRUE);
// Sort them so they're in natural order
sort($sql_files);
// Unset the installer
unset($sql_files[0]);
// Loop through the files and take appropriate action
foreach ($sql_files as $sql_file) {
if (substr($sql_file, -4) == '.sql') {
// $this->db->select('COUNT(*) AS update_applied');
$this->db->where('version_file', $sql_file);
// $update_applied = $this->db->get('fi_versions')->row()->update_applied;
$update_applied = $this->db->get('fi_versions');
// if (!$update_applied)
if (!$update_applied->num_rows()) {
$file_contents = read_file(APPPATH . 'modules/setup/sql/' . $sql_file);
$this->execute_contents($file_contents);
$this->save_version($sql_file);
// Check for any required upgrade methods
$upgrade_method = 'upgrade_' . str_replace('.', '_', substr($sql_file, 0, -4));
if (method_exists($this, $upgrade_method)) {
$this->{$upgrade_method}();
}
}
}
}
if ($this->errors) {
return FALSE;
}
$this->install_default_settings();
return TRUE;
}