mambax7/gwiki

View on GitHub
admin/functions.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php
/**
 * functions.php - admin area functions
 *
 * @param mixed $langdir
 * @license    gwiki/docs/license.txt  GNU General Public License (GPL)
 * @since      1.0
 * @author     Richard Griffith <richard@geekwright.com>
 * @package    gwiki
 * @copyright  Copyright © 2013 geekwright, LLC. All rights reserved.
 */

use XoopsModules\Gwiki;

/**
 * @param $langdir
 *
 * @return bool
 */
function loadmodinfo($langdir)
{
    global $xoopsModule;
    if (is_file(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $langdir . '/modinfo.php')) {
        require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $langdir . '/modinfo.php';

        return true;
    }

    return false;
}

/**
 * @param $title
 * @param $cols
 */
function adminTableStart($title, $cols)
{
    echo '<table width="100%" border="0" cellspacing="1" class="outer">';
    echo '<tr><th colspan="' . $cols . '">' . $title . '</th></tr>';
}

/**
 * @param $links
 */
function adminTableEnd($links)
{
    echo '</table>';

    if (!empty($links)) {
        $linkline = '';
        foreach ($links as $legend => $link) {
            if ('' !== $linkline) {
                $linkline .= ' | ';
            }
            if ('!PREFORMATTED!' === $legend) {
                $linkline .= $link;
            } else {
                $linkline .= '<a href="' . $link . '">' . $legend . '</a>';
            }
        }

        echo '<div style="text-align: right; padding-top: 2px; border-top: 1px solid #000000;">' . $linkline . '</div>';
    }
}

$dir = \basename(\dirname(__DIR__));
//require_once XOOPS_ROOT_PATH . '/modules/' . $dir . '/class/GwikiPage.php';
global $wikiPage;
$wikiPage = new Gwiki\GwikiPage();