Completed
Push — imgbot ( 76bc99 )
by
unknown
01:21
created
Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 * Module: randomquote
15
 *
16
 * @category        Module
17
 * @package         randomquote
18
 * @author          XOOPS Development Team <[email protected]> - <https://xoops.org>
19
 * @copyright       {@link https://xoops.org/ XOOPS Project}
20
 * @license         GPL 2.0 or later
21
 * @link            https://xoops.org/
22
 * @since           1.0.0
23
 */
24
25
use Xoopsmodules\randomquote;
0 ignored issues
show
This use statement conflicts with another class in this namespace, randomquote.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
26
27
$GLOBALS['xoopsOption']['template_main'] = 'randomquote_index.tpl';
28
require_once __DIR__ . '/header.php';
29
require_once XOOPS_ROOT_PATH . '/header.php';
30
//require_once __DIR__ . '/include/config.php';
31
// Define Stylesheet
32
//$xoTheme->addStylesheet($stylesheet);
33
// keywords
34
$utility::meta_keywords(xoops_getModuleOption('keywords', $moduleDirName));
35
// description
36
$utility::meta_description(MD_RANDOMQUOTE_DESC);
37
//
38
$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', RANDOMQUOTE_URL . '/index.php');
39
$GLOBALS['xoopsTpl']->assign('randomquote_url', RANDOMQUOTE_URL);
40
$GLOBALS['xoopsTpl']->assign('adv', xoops_getModuleOption('advertise', $moduleDirName));
41
//
42
$GLOBALS['xoopsTpl']->assign('bookmarks', xoops_getModuleOption('bookmarks', $moduleDirName));
43
$GLOBALS['xoopsTpl']->assign('fbcomments', xoops_getModuleOption('fbcomments', $moduleDirName));
44
//
45
$GLOBALS['xoopsTpl']->assign('admin', MD_RANDOMQUOTE_ADMIN);
46
//$GLOBALS['xoopsTpl']->assign('copyright', $copyright);
47
//
48
require_once XOOPS_ROOT_PATH . '/footer.php';
49