Esempio n. 1
0
    public function showAdminNotices()
    {
        $userdata = \PluginCore\UserData::getInstance();
        $data = $userdata->data('PluginCore');
        if (!empty($data['messages'])) {
            foreach ($data['messages'] as $type => $messages) {
                switch ($type) {
                    case 'info':
                    case 'updated':
                        $style = 'color: green ';
                        $class = 'updated';
                        break;
                    case 'update-nag':
                        $style = 'color: orange ';
                        $class = 'update-nag';
                        break;
                    case 'error':
                    default:
                        $class = 'error';
                        $style = 'color: red ';
                }
                foreach ($messages as $message) {
                    ?>
                    <div class="<?php 
                    echo $class;
                    ?>
">
                        <p style="<?php 
                    echo $style;
                    ?>
"><?php 
                    echo $message;
                    ?>
</p>
                    </div>
                <?php 
                }
            }
        }
        if (isset($data['messages'])) {
            unset($data['messages']);
        }
        $data = $userdata->set_data('PluginCore');
    }
Esempio n. 2
0
<?php

namespace PluginCore;

if (!defined('PluginCoreLoaded')) {
    define('PluginCoreLoaded', __DIR__);
    require PluginCoreLoaded . '/ActionHandler.php';
    require PluginCoreLoaded . '/Container.php';
    require PluginCoreLoaded . '/UserData.php';
    require PluginCoreLoaded . '/BasePlugin.php';
    require PluginCoreLoaded . '/functions.php';
    $userData = \PluginCore\UserData::getInstance();
    $container = \PluginCore\Container::getInstance();
    $container->register('wpdb', $wpdb);
    \PluginCore\Messages::getInstance();
    //añadimos notificaciones de errores.
}