本文整理汇总了PHP中Web::modules方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::modules方法的具体用法?PHP Web::modules怎么用?PHP Web::modules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web::modules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: composer_ALL
function composer_ALL(Web $w)
{
echo "<pre>" . file_get_contents(ROOT_PATH . '/log/composer.log') . "</pre>";
// Collect dependencies
$dependencies_array = array();
foreach ($w->modules() as $module) {
$dependencies = Config::get("{$module}.dependencies");
if (!empty($dependencies)) {
$dependencies_array = array_merge($dependencies, $dependencies_array);
}
}
$json_obj = array();
$json_obj["config"] = array();
$json_obj["config"]["vendor-dir"] = 'composer/vendor';
$json_obj["config"]["cache-dir"] = 'composer/cache';
$json_obj["config"]["bin-dir"] = 'composer/bin';
$json_obj["require"] = $dependencies_array;
// Need to change dir so composer can find the json file
chdir(SYSTEM_PATH);
// Create the JSON file
file_put_contents(SYSTEM_PATH . "/composer.json", json_encode($json_obj, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT));
//Create the commands
$input = new ArrayInput(array('command' => 'update', '--prefer-dist' => 'true'));
$filestream = new StreamOutput(fopen(ROOT_PATH . '/log/composer.log', 'w'));
//Create the application and run it with the commands
$application = new Application();
$exitcode = $application->run($input, $filestream);
// Change dir back to root
chdir(ROOT_PATH);
// This doesn't happen for some reason
$w->msg("Composer update return exit code " . $exitcode . " (0 is OK)<br/>Check the /log/composer.log for output", "/admin");
}
示例2: addwidget_GET
function addwidget_GET(Web $w)
{
$p = $w->pathMatch("module");
$module = $p["module"];
$modulelist = $w->modules();
$modules = array_filter($modulelist, function ($module) use(&$w) {
$names = $w->Widget->getWidgetNamesForModule($module);
return !empty($names);
});
$form = array("Add a widget" => array(array(array("Source module", "select", "source_module", null, $modules)), array(array("Widget Name", "select", "widget_name", null, array()))));
$w->ctx("widgetform", Html::multiColForm($form, "/main/addwidget/{$module}", "POST", "Add"));
}
示例3: toc_GET
/**
* Show a Table of Contents by searching
* through all modules for the file
* ./help/<module>_toc.help
*
* @param \Web $w
*/
function toc_GET(Web $w)
{
foreach ($w->modules() as $h) {
$p = HelpLib::getHelpFilePath($w, $h, null, $h . "_toc");
if ($p) {
$tocs[$h] = $p;
}
}
foreach ($tocs as $module => $path) {
if ($w->Auth->allowed($module . '/index')) {
$content = file_get_contents($path);
$title = HelpLib::extractTitle($content);
$ul[] = Html::a(WEBROOT . '/help/view/' . $module . '/' . $module . '_toc', $title ? $title : ucfirst($module));
}
}
$w->ctx("ul", Html::ul($ul));
}