Exemple #1
0
    public function displayBackend()
    {
        ?>
        <table class="form-table">
        <tbody>
        <tr>
            <th><?php 
        echo L10n::__('Control');
        ?>
</th>
            <td>
                <a
                    href="<?php 
        echo Url::getAjax(static::getOptID(), ['_nonce' => Security::createNonce()]);
        ?>
"
                    target="_blank"
                    class="button button-primary"
                >
                    <i class="fa fa-refresh"></i>
                    <?php 
        echo L10n::__('Flush cache');
        ?>
                </a>
            </td>
        </tr>
        </tbody>
        </table>
        <?php 
    }
Exemple #2
0
 protected function getConf()
 {
     $conf = ['ID' => Core::ID, 'ajaxURL' => Url::getAjax(), 'lang' => ['loading' => L10n::__('Loading, please wait...'), 'error' => L10n::__('Sorry, server is busy now, can not respond your request, please try again later.'), 'close' => L10n::__('Close'), 'ok' => L10n::__('OK')]];
     if (Condition::isAdmin()) {
         $conf['_nonce'] = Security::createNonce();
     }
     return \apply_filters(Functions::buildActionName('dynamicConf'), $conf);
 }
Exemple #3
0
 public function ajaxProcessLogged()
 {
     Security::checkNonce();
     Security::checkReferer();
     if (!User::currentUserCan('manage_options')) {
         die;
     }
     $mainApi = new MainApi();
     if ($mainApi->deleteCacheFile()) {
         die('Done!');
     }
     die(sprintf(L10n::__('Can not delete file %s.'), $mainApi->getCacheFilePath()));
 }
Exemple #4
0
    public function displayBackend()
    {
        ?>
        <div class="wrap <?php 
        echo Core::ID;
        ?>
-wrap">
        <form class="backend-fm <?php 
        echo Core::ID;
        ?>
-backend-fm" method="post" action="<?php 
        echo Url::getAjax(static::getOptID(), ['_nonce' => Security::createNonce()]);
        ?>
">
        <div class="tab-nav-container <?php 
        echo Core::ID;
        ?>
-tab-nav-container"></div>

        <div class="tab-body">
            <?php 
        $settings = \apply_filters(Functions::buildActionName('backendSettings'), []);
        ksort($settings);
        foreach ($settings as $legend => $setting) {
            ?>
                <fieldset>
                    <legend class="button button-primary">
                        <i class="fa fa-fw fa-<?php 
            echo $setting['icon'];
            ?>
"></i> <?php 
            echo $setting['title'];
            ?>
                    </legend>
                    <?php 
            call_user_func($setting['content']);
            ?>
                </fieldset>
            <?php 
        }
        ?>

        </div>

        <p>
            <input type="hidden" name="_nonce" value="<?php 
        echo Security::createNonce();
        ?>
">

            <button id="submit" type="submit" class="backend-submit button button-primary"><i class="fa fa-check"></i> <span class="tx"><?php 
        echo L10n::__('Save');
        ?>
</span></button>

            <label for="options-restore" class="label-options-restore" title="<?php 
        echo L10n::__('Something error with plugin? Try to restore. Be careful, plugin options will be cleared up!');
        ?>
">
                <input id="options-restore" name="restore" type="checkbox" value="1"/>
                <?php 
        echo L10n::__('Restore to default options');
        ?>
 <i class="fa fa-question-circle"></i>
            </label>
        </p>
        </form>
        </div>
        <?php 
    }