Dotclear

source: admin/help.php @ 3731:3770620079d4

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

Simplify licence block at the beginning of each file

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

Sites map