Dotclear

source: admin/help.php @ 3874:ab8368569446

Revision 3874:ab8368569446, 2.2 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

short notation for array (array() → [])

RevLine 
[491]1<?php
[3731]2/**
3 * @package Dotclear
4 * @subpackage Backend
5 *
6 * @copyright Olivier Meunier & Association Dotclear
7 * @copyright GPL-2.0-only
8 */
[491]9
[3730]10require dirname(__FILE__) . '/../inc/admin/prepend.php';
[491]11
[3647]12dcPage::check('usage,contentadmin');
[491]13
[3872]14$helpPage = function (...$args) {
[3874]15    $ret = ['content' => '', 'title' => ''];
[1793]16
[3730]17    if (empty($args)) {
18        return $ret;
19    }
20    ;
[2566]21
[3730]22    global $__resources;
23    if (empty($__resources['help'])) {
24        return $ret;
25    }
[2566]26
[3730]27    $content = '';
28    $title   = '';
29    foreach ($args as $v) {
30        if (is_object($v) && isset($v->content)) {
31            $content .= $v->content;
32            continue;
33        }
[2566]34
[3730]35        if (!isset($__resources['help'][$v])) {
36            continue;
37        }
38        $f = $__resources['help'][$v];
39        if (!file_exists($f) || !is_readable($f)) {
40            continue;
41        }
[2566]42
[3730]43        $fc = file_get_contents($f);
44        if (preg_match('|<body[^>]*?>(.*?)</body>|ms', $fc, $matches)) {
45            $content .= $matches[1];
46            if (preg_match('|<title[^>]*?>(.*?)</title>|ms', $fc, $matches)) {
47                $title = $matches[1];
48            }
49        } else {
50            $content .= $fc;
51        }
52    }
[2566]53
[3730]54    if (trim($content) == '') {
55        return $ret;
56    }
[2566]57
[3730]58    $ret['content'] = $content;
59    if ($title != '') {
60        $ret['title'] = $title;
61    }
62    return $ret;
[3491]63};
[491]64
[3730]65$help_page     = !empty($_GET['page']) ? html::escapeHTML($_GET['page']) : 'index';
[3491]66$content_array = $helpPage($help_page);
[1799]67if (($content_array['content'] == '') || ($help_page == 'index')) {
[3730]68    $content_array = $helpPage('index');
[1793]69}
70if ($content_array['title'] != '') {
[3730]71    $breadcrumb = dcPage::breadcrumb(
[3874]72        [
[3730]73            __('Global help')       => $core->adminurl->get("admin.help"),
74            $content_array['title'] => ''
[3874]75        ]);
[1793]76} else {
[3730]77    $breadcrumb = dcPage::breadcrumb(
[3874]78        [
[3730]79            __('Global help') => ''
[3874]80        ]);
[1793]81}
[491]82
83/* DISPLAY
84-------------------------------------------------------- */
85dcPage::open(__('Global help'),
[3730]86    dcPage::jsPageTabs('first-step'),
87    $breadcrumb
[491]88);
89
[1793]90echo $content_array['content'];
[491]91
[1933]92// Prevents global help link display
93$GLOBALS['__resources']['ctxhelp'] = true;
94
[491]95dcPage::close();
Note: See TracBrowser for help on using the repository browser.

Sites map