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


PHP Modules::path方法代码示例

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


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

示例1: module_path

 /**
  * Returns the path to the module and it's specified folder.
  *
  * @deprecated since 0.7.1 Use Modules::path() instead.
  *
  * @param $module string The name of the module (must match the folder name)
  * @param $folder string The folder name to search for. (Optional)
  *
  * @return string The path, relative to the front controller.
  */
 function module_path($module = null, $folder = null)
 {
     return Modules::path($module, $folder);
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:14,代码来源:application_helper.php

示例2: save_lang_file

 /**
  * Save a language file
  *
  * @param string $filename The name of the file to locate. The file will be found by looking in all modules.
  * @param string $language The language to retrieve.
  * @param array  $settings An array of the language settings
  * @param bool   $return   TRUE to return the contents or FALSE to write to file
  * @param bool   $allowNewValues if true, new values can be added to the file
  *
  * @return mixed A string when the $return setting is true
  */
 function save_lang_file($filename = null, $language = 'english', $settings = null, $return = false, $allowNewValues = false)
 {
     if (empty($filename) || !is_array($settings)) {
         return false;
     }
     // Is it a application lang file? Use the English folder to determine.
     $arFiles = scandir(APPPATH . "language/english/");
     if ($filename == 'application_lang.php' || in_array($filename, $arFiles)) {
         $orig_path = APPPATH . "language/english/{$filename}";
         $path = APPPATH . "language/{$language}/{$filename}";
     } else {
         $module = str_replace('_lang.php', '', $filename);
         $orig_path = Modules::file_path($module, 'language', "english/{$filename}");
         $path = Modules::file_path($module, 'language', "{$language}/{$filename}");
         // If it's still empty, grab the module path
         if (empty($path)) {
             $path = Modules::path($module, 'language');
         }
     }
     // Load the file and loop through the lines
     if (!is_file($orig_path)) {
         return false;
     }
     $contents = file_get_contents($orig_path);
     $contents = trim($contents) . "\n";
     if (!is_file($path)) {
         // Create the folder...
         $folder = basename($path) == 'language' ? "{$path}/{$language}" : dirname($path);
         if (!is_dir($folder)) {
             mkdir($folder);
             $path = basename($path) == 'language' ? "{$folder}/{$module}_lang.php" : $path;
         }
     }
     // Save the file.
     foreach ($settings as $name => $val) {
         if ($val !== '') {
             $val = '\'' . addcslashes($val, '\'\\') . '\'';
         }
         // Use strrpos() instead of strpos() so we don't lose data when
         // people have put duplicate keys in the english files
         $start = strrpos($contents, '$lang[\'' . $name . '\']');
         if ($start === false) {
             // Tried to add non-existent value?
             if ($allowNewValues && $val !== '') {
                 $contents .= "\n\$lang['{$name}'] = {$val};";
                 continue;
             } else {
                 return false;
             }
         }
         $end = strpos($contents, "\n", $start) + strlen("\n");
         if ($val !== '') {
             $replace = '$lang[\'' . $name . '\'] = ' . $val . ";\n";
         } else {
             $replace = '// ' . substr($contents, $start, $end - $start);
         }
         $contents = substr($contents, 0, $start) . $replace . substr($contents, $end);
     }
     // Is the produced code OK?
     if (!is_null(eval(str_replace('<?php', '', $contents)))) {
         return false;
     }
     // Make sure the file still has the php opening header in it...
     if (strpos($contents, '<?php') === false) {
         $contents = "<?php defined('BASEPATH') || exit('No direct script access allowed');\n\n{$contents}";
     }
     if ($return) {
         return $contents;
     }
     // Write the changes out...
     if (!function_exists('write_file')) {
         $CI = get_instance();
         $CI->load->helper('file');
     }
     if (write_file($path, $contents)) {
         return true;
     }
     return false;
 }
开发者ID:brkrishna,项目名称:freelance,代码行数:90,代码来源:languages_helper.php

示例3: delete

 /**
  * Delete a Blox and all of its files.
  *
  * @return void
  */
 public function delete()
 {
     // If there's no module to delete, redirect
     $module_name = $this->input->post('module');
     if (empty($module_name)) {
         redirect('/buildablox');
     }
     //$this->auth->restrict('Modules.Delete');
     // Remove the module's data and permissions from the database
     if ($this->deleteModuleData($module_name) === false) {
         // Something went wrong while trying to delete the data
         Template::set_message(lang('mb_delete_trans_false'), $this->db->error, 'error');
         redirect('/buildablox');
     }
     // Data deleted successfully, now try to remove the files.
     $this->load->helper('file');
     if (delete_files(Modules::path($module_name), true)) {
         @rmdir(Modules::path("{$module_name}/"));
         log_activity((int) $this->auth->user_id(), lang('mb_act_delete') . ": {$module_name} : " . $this->input->ip_address(), 'buildablox');
         Template::set_message(lang('mb_delete_success'), 'success');
     } else {
         // Database removal succeeded, but the files may still be present
         Template::set_message(lang('mb_delete_success') . lang('mb_delete_success_db_only'), 'info');
     }
     redirect('/buildablox');
 }
开发者ID:ci-blox,项目名称:Ignition-Go,代码行数:31,代码来源:buildablox.php

示例4: get_module_docs

 /**
  * Checks all modules to see if they include docs and prepares their doc
  * information for use in the sidebar.
  *
  * @return array
  */
 private function get_module_docs()
 {
     $docs_modules = array();
     foreach (Modules::list_modules() as $module) {
         $ignored_folders = array();
         $path = Modules::path($module) . $this->docsDir;
         // If these are developer docs, add the folder to the path.
         if ($this->docsGroup == $this->docsTypeBf) {
             $path .= '/' . $this->docsTypeBf;
         } else {
             // For Application docs, ignore the 'developers' folder.
             $ignored_folders[] = $this->docsTypeBf;
         }
         if (is_dir($path)) {
             $files = $this->get_folder_files($path, $module, $ignored_folders);
             if (is_array($files) && count($files)) {
                 $docs_modules[$module] = $files;
             }
         }
     }
     ksort($docs_modules);
     return $docs_modules;
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:29,代码来源:Docs.php

示例5: getMigrationsPath

 /**
  * Get the migrations path for a given migration type.
  *
  * @param string $type The name of the module for module migrations.
  * self::APP_MIGRATION_PREFIX for application migrations.
  * Empty for core migrations.
  *
  * @return string The migrations path for the given migration type.
  */
 protected function getMigrationsPath($type = '')
 {
     switch ($type) {
         // Core migrations
         case '':
         case self::CORE_MIGRATIONS:
             return $this->coreMigrationsPath;
             // Application migrations
         // Application migrations
         case self::APP_MIGRATION_PREFIX:
             return APPPATH . 'db/migrations/';
             // If it is not a core migration or application migration, it should
             // be the name of a module.
         // If it is not a core migration or application migration, it should
         // be the name of a module.
         default:
             return Modules::path(substr($type, 0, -1), 'migrations') . '/';
     }
 }
开发者ID:vamsi683,项目名称:accept,代码行数:28,代码来源:Migrations.php

示例6: runMigration

 /**
  * Migrate to the latest version or drop all migrations
  * for a given module migration
  *
  * @param        $module
  * @param bool $downgrade
  *
  * @return bool
  */
 public function runMigration($module, $downgrade = FALSE)
 {
     $path = Modules::path($module, 'config/');
     if (!is_file($path . 'migration.php')) {
         return FALSE;
     }
     $migration = Modules::load_file('migration', $path, 'config');
     $migration['migration_enabled'] = TRUE;
     $this->CI->load->library('migration', $migration);
     if ($downgrade === TRUE) {
         $this->CI->migration->version('0', $module);
     } else {
         $this->CI->migration->current($module);
     }
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:24,代码来源:Extension.php

示例7: delete_language

 /**
  * Delete existing language folder.
  *
  * @param string $language The language to delete.
  *
  * @return bool
  */
 function delete_language($language = NULL)
 {
     if (empty($language)) {
         return FALSE;
     }
     if (!function_exists('delete_files')) {
         get_instance()->load->helper('file');
     }
     // Delete the specified admin and main language folder.
     foreach (array(MAINDIR, ADMINDIR) as $domain) {
         $path = ROOTPATH . "{$domain}/language/{$language}";
         if (is_dir($path)) {
             delete_files($path, TRUE);
             rmdir($path);
         }
     }
     // Clone then specified module language files.
     $modules = Modules::list_modules();
     foreach ($modules as $module) {
         $moduleLangs = Modules::files($module, 'language');
         if (isset($moduleLangs[$module]['language'][$language])) {
             $path = Modules::path($module, 'language');
             delete_files("{$path}/{$language}", TRUE);
             rmdir("{$path}/{$language}");
         }
     }
     return FALSE;
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:35,代码来源:TI_language_helper.php

示例8: get_migrations_path

 /**
  * Retrieves the migrations path for a given migration type
  *
  * @param string $type
  *
  * @return string migration path
  */
 public function get_migrations_path($type = '')
 {
     switch ($type) {
         // Core migrations
         case '':
         case 'core':
             return $this->_migration_path;
             // If it is not a core migration, it should be the name of a module.
         // If it is not a core migration, it should be the name of a module.
         default:
             return Modules::path($type, 'migrations/');
     }
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:20,代码来源:TI_Migration.php

示例9: clone_language

 /**
  * Clone a single existing language.
  *
  * @param string $filename The name for the newly cloned language.
  * @param string $language The language to clone.
  *
  * @return mixed The $lang array from the file or false if not found. Returns
  * null if $filename is empty.
  */
 function clone_language($filename = NULL, $language = 'english')
 {
     if (empty($filename)) {
         return FALSE;
     }
     // Clone the specified admin and main language files.
     foreach (array(MAINDIR, ADMINDIR) as $domain) {
         copy_language_files(ROOTPATH . "{$domain}/language/{$language}", ROOTPATH . "{$domain}/language/{$filename}");
     }
     // Clone then specified module language files.
     $modules = Modules::list_modules();
     foreach ($modules as $module) {
         $moduleLangs = Modules::files($module, 'language');
         if (isset($moduleLangs[$module]['language'][$language])) {
             $path = Modules::path($module, 'language');
             copy_language_files("{$path}/{$language}", "{$path}/{$filename}");
         }
     }
     return TRUE;
 }
开发者ID:allrested,项目名称:TastyIgniter,代码行数:29,代码来源:TI_language_helper.php


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