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


PHP I2CE::setupFileSearch方法代码示例

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


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

示例1: setUp

 function setUp()
 {
     parent::setUp();
     I2CE::setupFileSearch();
     self::$c = new I2CE_Configurator();
     self::$c->resetCheckedPaths();
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:7,代码来源:I2CE_ProcessTest.php

示例2: setUp

 function setUp()
 {
     parent::setup();
     I2CE::setupFileSearch();
     $store = new I2CE_MagicDataStorageMem();
     self::$md = TestMagicDataTearDown::instance("config");
     self::$md->addStorage($store);
     I2CE::setConfig(self::$md);
     self::$c = new I2CE_Configurator(self::$md);
     self::$c->resetCheckedPaths();
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:11,代码来源:I2CE_MagicDataTest.php

示例3: getAvailableModules

function getAvailableModules()
{
    global $configurator;
    global $modules;
    global $search_dirs;
    global $found_modules;
    global $booleans;
    if (is_array($found_modules)) {
        return $found_modules;
    }
    $found_modules = array();
    $bad_modules = array();
    foreach ($search_dirs as $dir) {
        foreach (glob($dir) as $d) {
            $d = realpath($d);
            I2CE::raiseError("Searching {$d}");
            I2CE::setupFileSearch(array('MODULES' => $d));
            $fileSearch = I2CE::getFileSearch();
            $top_module = $configurator->findAvailableConfigs($fileSearch, false);
            if (!is_array($top_module) || count($top_module) != 1) {
                I2CE::raiseError("WARNING:  no top-level module found for {$dir} -- Skipping.");
                continue;
            }
            $top_module = $top_module[0];
            I2CE::raiseError("Found {$top_module} as top-level module for {$d}");
            $searchPath = $fileSearch->getSearchPath('MODULES', true);
            if ($booleans['limit_search']) {
                I2CE::raiseError("Limiting search to {$d}");
                $avail_modules = $configurator->findAvailableConfigs($fileSearch, true, $d);
            } else {
                $avail_modules = $configurator->findAvailableConfigs($fileSearch, true);
            }
            if (is_array($modules)) {
                $avail_modules = array_intersect($modules, $avail_modules);
            }
            foreach ($avail_modules as $m) {
                if (array_key_exists($m, $found_modules)) {
                    I2CE::raiseError("WARNING: conflict with module {$m}.  Found more than once -- Skipping");
                    $found_modules[$m] = false;
                    $bad_modules[] = $m;
                } else {
                    $found_modules[$m] = $top_module;
                }
            }
        }
    }
    foreach ($bad_modules as $m) {
        unset($found_modules[$m]);
    }
    if (count($found_modules) == 0) {
        usage("No modules files found in this directory:\n\t" . implode("\n\t", $search_dirs) . "\n");
    }
    return $found_modules;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:54,代码来源:base.php

示例4: usage

* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 
* received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
* @version 2.1
* @access public
*/
$translations_dir = "translations" . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
$usage[] = "Looks for .pot files in {$translations_dir}\n";
$set_categories = false;
$set_configs = false;
require_once "translate_base.php";
@(require_once "Archive/Tar.php");
if (!class_exists('Archive_Tar')) {
    usage('Please install the PEAR Archive_Tar package');
}
I2CE::setupFileSearch(array('MODULES' => getcwd()));
$fileSearch = I2CE::getFileSearch();
$module = $configurator->findAvailableConfigs($fileSearch, false);
if (count($module) != 1) {
    usage("No Modules Specified");
}
$module = $module[0];
$out_dir = 'translations' . DIRECTORY_SEPARATOR . 'launchpad';
$archive_file = $out_dir . DIRECTORY_SEPARATOR . 'templates-' . $module . '.tgz';
if ($translations_dir[strlen($translations_dir) - 1] == DIRECTORY_SEPARATOR) {
    $translations_dir = substr($translations_dir, 0, -1);
}
if (!is_dir($translations_dir) || !is_readable($translations_dir)) {
    usage("Could not find/read {$translations_dir} directory");
}
if (!is_dir($out_dir)) {
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:create_launchpad_upload.php

示例5: foreach

            $qry['subcategory'] = $h3_list->item(0)->textContent;
        }
    }
    $mods = $template->query("ancestor-or-self::*[@type='module'][1]", $li);
    if ($mods->length == 1 && ($mod = $mods->item(0)->getAttribute('name'))) {
        $qry['mods'] = $mod;
    }
    $qry['text'] = $a->textContent;
    $data[$type] = $qry;
}
$list_storage = I2CE_MagicData::instance("temp_lists");
$list_storage->modules->Lists->auto_list = $data;
foreach ($list_storage->modules->Lists->auto_list as $type => $listConfig) {
    $listConfig->traverse('text', true, false)->setTranslatable();
}
I2CE::setupFileSearch(array('XML' => array(dirname(dirname(__FILE__) . "/../modules/MagicDataExport/xml/export_magicdata.xml"))));
echo $list_storage;
$export = new I2CE_MagicDataExport_Template();
$export->loadRootFile(dirname(dirname(__FILE__) . "/../modules/MagicDataExport/xml/export_magicdata.xml") . "/export_magicdata.xml");
$configNodes = $export->query('/I2CEConfiguration/configurationGroup');
$configNode = $configNodes->item(0);
$configNode->setAttribute('name', 'auto_list');
$configNode->setAttribute('path', '/modules/Lists/auto_list');
$export->createExport($configNode, $list_storage->modules->Lists->auto_list);
foreach ($export->query('//displayName', $configNode) as $dp) {
    $dp->parentNode->removeChild($dp);
    //condense the .xml export
}
foreach ($export->query('//*[@name="category"] | //*[@name="subcategory"] | //*[@name="text"]') as $t) {
    $t->setAttribute('locale', 'en_US');
    //shouldn't have to do this because we set the nodes as translatbale above.  there is a bug in magic data export
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:convert_lists_to_magic_data_xml.php

示例6: _updateModules

 protected static function _updateModules($updates, $removals = array(), $optional_excludes = array(), $disables = array())
 {
     I2CE::raiseError("Updating Modules");
     //make sure everything is nice and fresh
     clearstatcache();
     $mod_factory = I2CE_ModuleFactory::instance();
     $exec = array('max_execution_time' => 20 * 60, 'memory_limit' => 256 * 1048576);
     I2CE::longExecution($exec);
     if (!is_array($updates)) {
         $updates = array($updates);
     }
     if (!is_array($removals)) {
         $removals = array($removals);
     }
     $msg = "Will attempt to update:\n";
     foreach (array('Updates' => $updates, 'Removals' => $removals, 'Disables' => $disables) as $k => $v) {
         if (count($v) > 0) {
             $msg .= "\t{$k}:\n\t\t" . implode(',', $v) . "\n";
         }
     }
     I2CE::raiseError($msg);
     $storage = I2CE::getConfig();
     $tmp_storage = I2CE_MagicData::instance("temp_ModuleFactory");
     $configurator = new I2CE_Configurator($tmp_storage);
     if ($storage->setIfIsSet($sitemodule, "config/site/module")) {
         I2CE::raiseError("Site is set at " . $storage->getPath() . ' to be ' . $sitemodule);
         //make sure the site direcotry is added in to the config path.
         $data = $configurator->checkRequirements($updates, $disables, $removals, $mod_factory->getEnabled(), $sitemodule);
     } else {
         I2CE::raiseError("Site is not set at " . $storage->getPath());
         $data = $configurator->checkRequirements($updates, $disables, $removals, $mod_factory->getEnabled());
     }
     //note that checkRequirements has the result of putting _all_ valid config module metadata under /config/data of $tmp_storage
     if (isset($data['failure'])) {
         $storage->clearCache();
         I2CE::raiseError("Installation failed: " . $data['failure']);
         return false;
     }
     foreach (array_keys($data['removals']) as $shortname) {
         if (!$mod_factory->disable($shortname)) {
             $storage->clearCache();
             I2CE::raiseError("Unable to disable {$shortname}", E_USER_NOTICE);
             return false;
         }
     }
     //now we remove from the requirements list anything that is already enabled and  up-to-date
     if (count($data['moved']) > 0) {
         I2CE::raiseError("Found the following in another location.  Attempting to move:" . implode(',', array_keys($data['moved'])));
         I2CE::setupFileSearch(array(), true);
         //reset the file search and clear its cache
         I2CE::getFileSearch()->addPath('MODULES', dirname(dirname(__FILE__)), 'EVEN_HIGHER');
     }
     $skipped = array();
     $moved = array();
     foreach ($data['requirements'] as $shortname => $file) {
         if (!$mod_factory->isEnabled($shortname)) {
             continue;
         }
         if ($mod_factory->isUpToDate($shortname, $file) && $mod_factory->isUpToDateModule($shortname)) {
             //everything is in the correct place and up to date.
             $skipped[] = $shortname;
             $mod_factory->loadPaths($shortname, null, true);
             //for the loading of all categories for this module
             $storage->config->data->{$shortname}->file = $data['requirements'][$shortname];
             I2CE::raiseError("Updated {$shortname} config file to be " . $data['requirements'][$shortname]);
             unset($data['requirements'][$shortname]);
             //this module is enabled and the config is up-to-date so we dont need to do anything
             continue;
         }
         //let us see if this module has been moved
         if (!$storage->__isset("config/data/{$shortname}")) {
             continue;
         }
         if (!$tmp_storage->__isset("config/data/{$shortname}")) {
             continue;
         }
         $meta = $storage->config->data->{$shortname};
         $tmp_meta = $tmp_storage->config->data->{$shortname};
         foreach (array("hash", "last_access") as $key) {
             if (!isset($meta->{$key}) || !isset($tmp_meta->{$key}) || $tmp_meta->{$key} !== $meta->{$key}) {
                 continue 2;
             }
         }
         $class_file = null;
         $tmp_meta->setIfIsSet($class_file, "class/file");
         if ($class_file && ($class_file = I2CE_FileSearch::realPath($class_file))) {
             if (!$meta->__isset("class/hash")) {
                 continue;
             }
             if (!is_readable($class_file)) {
                 continue;
             }
             $contents = file_get_contents($class_file);
             if (!$contents) {
                 continue;
             }
             if ($meta->class->hash !== md5($contents)) {
                 continue;
             }
         }
//.........这里部分代码省略.........
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:101,代码来源:I2CE_Updater.php

示例7: getTranslatableDocuments

function getTranslatableDocuments($show_bad = true)
{
    global $categories;
    global $found_modules;
    I2CE::raiseError("Getting Translate-able Documents");
    getAvailableModules();
    I2CE::raiseError("Will attempt to  template files for the following modules:\n\t" . implode(",", array_keys($found_modules)));
    $factory = I2CE_ModuleFactory::instance();
    $templates = array();
    foreach ($found_modules as $module => $top_module) {
        I2CE::setupFileSearch();
        //reset the file search.
        $fileSearch = I2CE::getFileSearch();
        $good_paths = array();
        $bad_paths = array();
        foreach ($categories as $cat) {
            $fileSearch->setPreferredLocales($cat, I2CE_Locales::DEFAULT_LOCALE);
            //only search the en_US locale
            $factory->loadPaths($module, $cat, true, $fileSearch);
            //load all template paths
            $ordered_paths = $fileSearch->getSearchPath($cat, true);
            //get the paths found with their localization;
            if (count($ordered_paths) == 0) {
                //echo "\tNo $cat directories for $module. -- Skipping\n";
                continue;
            }
            foreach ($ordered_paths as $paths) {
                foreach ($paths as $path => $locale) {
                    if ($locale !== I2CE_Locales::DEFAULT_LOCALE) {
                        //should not happen.
                        var_dump($locale);
                        die("Yell at Carl -- you have locale {$locale} instead of " . I2CE_Locales::DEFAULT_LOCALE . "\n");
                    }
                    $dir = basename($path);
                    if ($dir != I2CE_Locales::DEFAULT_LOCALE) {
                        $bad_paths[] = $path;
                    } else {
                        $good_paths[$path] = I2CE_Locales::DEFAULT_LOCALE;
                    }
                }
            }
        }
        if ($show_bad && count($bad_paths) > 0) {
            I2CE::raiseError("The following template paths for {$module} were not localized:\n\t" . implode("\n\t", $bad_paths));
        }
        if (count($good_paths) == 0) {
            //echo "\tNo localized template files for $module -- Skipping\n";
            continue;
        }
        foreach ($good_paths as $path => $locale) {
            $rec_path = $path . DIRECTORY_SEPARATOR . '**';
            //do a recursive search
            $files = $fileSearch->resolve(array('/^.*\\.html?$/'), array($rec_path => I2CE_Locales::DEFAULT_LOCALE), true);
            if (is_array($files) && count($files) > 0) {
                $templates[$module][$path] = $files;
            }
        }
    }
    if (count($templates) == 0) {
        I2CE::raiseError("None of the modules available are setup with localized tempaltes.  Nothing to do.");
    } else {
        I2CE::raiseError("The following modules has translatable templates:\n\t" . implode(",", array_keys($templates)));
    }
    return $templates;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:65,代码来源:translate_base.php

示例8: array

 ************************/
$template_list = array();
$template_by_mod_list = array();
if ($do_wiki_template = simple_prompt("Make wiki pages related to templates?")) {
    foreach ($found_modules as $module => $top_module) {
        $current_pkg = false;
        $current_pkg = $module_packages[$module];
        if (!array_key_exists($module, $module_packages)) {
            I2CE::raiseError("Could not deterine which package {$module} resides in");
            //should not happen
            continue;
        }
        $len = strlen($packages[$current_pkg]['dir']);
        $priority = 50;
        $storage->setIfIsSet($priority, "/config/data/{$module}/priority");
        I2CE::setupFileSearch();
        //reset the file search.
        $fileSearch = I2CE::getFileSearch();
        $mod_factory->loadPaths($module, 'TEMPLATES', true, $fileSearch);
        //load all template paths
        $results = $fileSearch->findByRegularExpression('TEMPLATES', '/^.*html$/', true);
        //get the paths found with their **=recusrive search
        $files = array();
        $template_by_mod_list[$module] = array();
        foreach ($results as $file) {
            $file = realpath($file);
            $template = basename($file);
            $file_base = ltrim(substr($file, $len), '/');
            $template_by_mod_list[$module][] = "[[iHRIS Template List{$title_append}#{$template} | {$template}]]";
            if (!array_key_exists($template, $template_list)) {
                $template_list[$template] = array();
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:wikidoc.php

示例9: getTopModule

 /**
  * Find the top-level module in a directory.  (e.g. I2CE,
  * ihris-common, ihris-manage)
  *
  * @param string $d Directory to check
  *
  * @param boolean $verbose
  * @return
  */
 public function getTopModule($d, $verbose = false)
 {
     $d = realpath($d);
     if (!array_key_exists($d, $this->top_module)) {
         I2CE::setupFileSearch(array('MODULES' => $d));
         $top_module = $this->findAvailableConfigs(I2CE::getFileSearch(), false, "", $verbose);
         I2CE::getFileSearch()->removePath('MODULES', $d);
         if (!is_array($top_module) || count($top_module) != 1) {
             return false;
         }
         $this->setTopModule($d, $top_module[0]);
     }
     return $this->top_module[$d];
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:23,代码来源:I2CE_Configurator.php

示例10: testGetModuleFileMap

 public function testGetModuleFileMap()
 {
     $dir = self::data_dir(__CLASS__) . "testI2CE/";
     I2CE::setupFileSearch(array('MODULES' => $dir));
     self::$c->setRoot($dir);
     self::$c->findAvailableConfigs(NULL, TRUE, array("xml"), '', TRUE);
     $b = array("BIN" => array("bin/found.php"), 'MODULES' => array("modules/not-found.php"), '' => array("one.xml"));
     $a = self::$c->getModuleFileMap("testI2CE");
     $c = array_merge((array) array_diff($a, $b), (array) array_diff($b, $a));
     $this->assertEquals(array(), $c);
     $this->assertEquals(array(), self::$errors);
     $this->assertEquals(array(), self::$not_errors);
     $this->assertEquals(array(), I2CE::getFileSearch()->getSearchPath('MODULES'));
     $this->assertEquals(array(), self::$errors);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:15,代码来源:I2CE_ConfiguratorTest.php


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