示例#1
0
文件: Backend.php 项目: kmvan/wordpoi
    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::__('Optimize');
        ?>
                </a>
            </td>
        </tr>
        </tbody>
        </table>
        <?php 
    }
示例#2
0
文件: Core.php 项目: kmvan/wordpoi
 public static function getMetaTranslation($key = null)
 {
     $data = ['name' => L10n::__('WordPoi'), 'pluginURL' => L10n::__('https://inn-studio.com/wordpoi'), 'authorURL' => L10n::__('https://inn-studio.com'), 'author' => L10n::__('INN STUDIO'), 'qqGroup' => ['number' => '170306005', 'link' => 'https://jq.qq.com/?_wv=1027&k=41RRWxk'], 'email' => '*****@*****.**', 'edition' => L10n::__('Professional edition'), 'des' => L10n::__('Accelerate your wordpress by modify source code.')];
     if ($key) {
         return isset($data[$key]) ? $data[$key] : false;
     }
     return $data;
 }
示例#3
0
文件: Update.php 项目: kmvan/wordpoi
 public function filterUpgraderSourceSelection($source, $remoteSource = null, $upgrader = null)
 {
     if ($this->last != Core::$basename) {
         return $source;
     }
     $correctedSource = $remoteSource . '/' . $this->last . '/';
     if (rename($source, $correctedSource)) {
         return $correctedSource;
     } else {
         $upgrader->skin->feedback(L10n::__('Unable to rename downloaded plugin.'));
         return new \WP_Error();
     }
 }
示例#4
0
文件: Ajax.php 项目: kmvan/wordpoi
    public function ajaxProcessLogged()
    {
        $inputs = ['cmd' => '_donations', 'item_name' => sprintf(L10n::__('Donate to INN STUDIO (%s)'), Core::getMetaTranslation('name')), 'amount' => '', 'currency_code' => 'USD', 'business' => '*****@*****.**', 'lc' => 'US', 'no_note' => 0];
        ?>
        <!doctype html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <title><?php 
        echo L10n::__('Redirecting...');
        ?>
</title>
        </head>
        <body>
            <h1><?php 
        echo L10n::__('Redirecting...');
        ?>
</h1>
            <form
                id="fm"
                name="_xclick"
                accept-charset="GBK"
                action="https://www.paypal.com/cgi-bin/webscr"
                method="post"
            >
                <?php 
        foreach ($inputs as $inputName => $inputValue) {
            ?>
                    <input type="hidden" name="<?php 
            echo $inputName;
            ?>
" value="<?php 
            echo $inputValue;
            ?>
">
                <?php 
        }
        ?>
            </form>
            <script>
            document.getElementById('fm').submit();
            </script>
        </body>
        </html>
       <?php 
        die;
    }
示例#5
0
文件: Comm.php 项目: kmvan/wordpoi
    protected function tplItemControl($placeholder)
    {
        ?>
        <tr>
            <th><?php 
        echo L10n::__('Control');
        ?>
</th>
            <td>
                <a href="javascript:;" class="button move-up" data-target="<?php 
        echo static::getOptID();
        ?>
item<?php 
        echo $placeholder;
        ?>
" title="<?php 
        echo L10n::__('Move up');
        ?>
"><i class="fa fa-arrow-up"></i></a>

                <a href="javascript:;" class="button move-down" data-target="<?php 
        echo static::getOptID();
        ?>
item<?php 
        echo $placeholder;
        ?>
" title="<?php 
        echo L10n::__('Move down');
        ?>
"><i class="fa fa-arrow-down"></i></a>

                <a href="javascript:;" data-target="<?php 
        echo static::getOptID();
        ?>
item<?php 
        echo $placeholder;
        ?>
" class="del button" title="<?php 
        echo L10n::__('Delete this item');
        ?>
" ><i class="fa fa-trash"></i></a>
            </td>
        </tr>
        <?php 
    }
示例#6
0
文件: Backend.php 项目: kmvan/wordpoi
    public function displayBackend()
    {
        $isOem = isset($metaTrans['oem']) ? true : false;
        $metaTrans = isset($metaTrans['oem']) ? $metaTrans['oem'] : Core::getMetaTranslation();
        ?>
        <table class="form-table">
        <tbody>
        <?php 
        $item = function ($title, $value) {
            ?>
            <tr>
            <th scope="row"><?php 
            echo $title;
            ?>
</th>
            <td><p><?php 
            echo $value;
            ?>
</p></td>
            </tr>
            <?php 
        };
        $item(L10n::__('Plugin name'), $metaTrans['name']);
        $item(L10n::__('Plugin version'), Other::getPlugin('Version'));
        $item(L10n::__('Plugin description'), $metaTrans['des']);
        $item(L10n::__('Plugin author'), $metaTrans['author']);
        $item(L10n::__('Plugin homepage'), '<a href="' . $metaTrans['pluginURL'] . '" target="_blank">' . $metaTrans['pluginURL'] . '</a>');
        $item(L10n::__('Author site'), '<a href="' . $metaTrans['authorURL'] . '" target="_blank">' . $metaTrans['authorURL'] . '</a>');
        ?>
        <tr>
            <th scope="row"><?php 
        echo L10n::__('Feedback &amp; technical support');
        ?>
</th>
            <td>

                <?php 
        if (isset($metaTrans['email'])) {
            ?>
                    <p><?php 
            echo L10n::__('E-Mail');
            ?>
 <a href="mailto:<?php 
            echo $metaTrans['email'];
            ?>
"><?php 
            echo $metaTrans['email'];
            ?>
</a></p>
                <?php 
        }
        ?>

                <?php 
        if (isset($metaTrans['qqGroup'])) {
            ?>
                    <p><?php 
            echo L10n::__('QQ group');
            ?>
                        <?php 
            if (isset($metaTrans['qqGroup']['link'])) {
                ?>
                            <a target="_blank" href="<?php 
                echo $metaTrans['qqGroup']['link'];
                ?>
"><?php 
                echo $metaTrans['qqGroup']['number'];
                ?>
</a>
                        <?php 
            } else {
                ?>
                            <?php 
                echo $metaTrans['qqGroup']['number'];
                ?>
                        <?php 
            }
            ?>
                    </p>
                <?php 
        }
        ?>
            </td>
        </tr>
        <?php 
        if (!$isOem) {
            ?>
            <tr>
                <th scope="row"><?php 
            echo L10n::__('Donate');
            ?>
</th>
                <td>
                    <p>
                        <!-- paypal -->
                        <a id="paypal_donate" href="<?php 
            echo Url::getAjax(static::getOptID());
            ?>
" title="<?php 
            echo L10n::__('Donation via Paypal');
            ?>
" target="_blank">
                            <img src="//ws2.sinaimg.cn/large/686ee05djw1ella1kv74cj202o011wea.jpg" alt="<?php 
            echo L10n::__('Donation via Paypal');
            ?>
" width="96" height="37"/>
                        </a>
                        <!-- alipay -->
                        <a id="alipay_donate" target="_blank" href="//ws3.sinaimg.cn/mw600/686ee05djw1eihtkzlg6mj216y16ydll.jpg" title="<?php 
            echo L10n::__('Donation via Alipay');
            ?>
">
                            <img width="96" height="37" src="//ws1.sinaimg.cn/large/686ee05djw1ellabpq9euj202o011dfm.jpg" alt="<?php 
            echo L10n::__('Donation via Alipay');
            ?>
"/>
                        </a>
                        <!-- wechat -->
                        <a id="wechat_donate" target="_blank" href="//ws4.sinaimg.cn/mw600/686ee05djw1exukpkk4fwj20fr0f940r.jpg" title="<?php 
            echo L10n::__('Donation via Wechat');
            ?>
">
                            <img width="96" height="37" src="//ws3.sinaimg.cn/large/686ee05djw1exul2142tvj202o0113ya.jpg" alt="<?php 
            echo L10n::__('Donation via Wechat');
            ?>
"/>
                        </a>
                    </p>
                </td>
            </tr>
        <?php 
        } else {
            ?>
            <tr>
                <th scope="row"><?php 
            echo L10n::__('Plugin core');
            ?>
</th>
                <td><a href="<?php 
            echo $metaTrans['core']['url'];
            ?>
" target="_blank"><?php 
            echo $metaTrans['core']['name'];
            ?>
</a></td>
            </tr>
        <?php 
        }
        ?>
        </tbody>
        </table>
        <?php 
    }
示例#7
0
文件: Admin.php 项目: kmvan/wordpoi
    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 
    }
示例#8
0
文件: Api.php 项目: kmvan/wordpoi
    public static function pageOptsList($addonID, $optID)
    {
        static $pages = null;
        if ($pages === null) {
            $pages = \get_pages();
        }
        $opt = Other::getOpts($addonID);
        $selectedPageID = isset($opt[$optID]) ? (int) $opt[$optID] : null;
        ?>
        <select name="<?php 
        echo $addonID;
        ?>
[<?php 
        echo $optID;
        ?>
]" id="<?php 
        echo $addonID;
        ?>
-<?php 
        echo $optID;
        ?>
">
            <option value="-1"><?php 
        echo L10n::__('Select page');
        ?>
</option>
            <?php 
        foreach ($pages as $page) {
            if ($selectedPageID == $page->ID) {
                $selected = ' selected ';
            } else {
                $selected = null;
            }
            ?>
                <option value="<?php 
            echo $page->ID;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo Post::getTheTitle($page->ID);
            ?>
</option>
                <?php 
        }
        ?>
        </select>
        <?php 
    }
示例#9
0
文件: Api.php 项目: kmvan/wordpoi
 public static function catOptsList($addonID, $catID, $child = false)
 {
     $opts = (array) Options::getOpts($addonID);
     if ($child !== false) {
         $selectedCatID = isset($opts[$catID][$child]) && $opts[$catID][$child] != 0 ? $opts[$catID][$child] : null;
     } else {
         $selectedCatID = isset($opts[$catID]) && $opts[$catID] != 0 ? $opts[$catID] : null;
     }
     $args = ['name' => $child !== false ? $addonID . '[' . $catID . '][' . $child . ']' : $addonID . '[' . $catID . ']', 'name' => $child !== false ? "{$addonID}[{$catID}][{$child}]" : $addonID . '[' . $catID . ']', 'id' => $child !== false ? $addonID . '-' . $catID . '-' . $child : $addonID . '-' . $catID, 'show_option_none' => L10n::__('Select category'), 'hierarchical' => 1, 'hide_empty' => false, 'selected' => $selectedCatID, 'echo' => 1];
     \wp_dropdown_categories($args);
 }
示例#10
0
 public static function getHumanDate($timestamp)
 {
     $text = '';
     $t = Other::getCurrentTime('timestamp') - $timestamp;
     switch ($t) {
         /**
          * in 1 minu, just now
          */
         case $t < 60:
             $text = L10n::__('Just');
             break;
             /**
              * in 1 hours, 60 * 60 = 3600
              */
         /**
          * in 1 hours, 60 * 60 = 3600
          */
         case $t < 3600:
             $text = sprintf(L10n::__('%dmin ago'), floor($t / 60));
             break;
             /**
              * in 1 day, 60 * 60 * 24 = 86400
              */
         /**
          * in 1 day, 60 * 60 * 24 = 86400
          */
         case $t < 86400:
             $text = sprintf(L10n::__('%dh ago'), floor($t / 3600));
             break;
             /**
              * in 1 month, 60 * 60 * 24 * 30 = 2592000
              */
         /**
          * in 1 month, 60 * 60 * 24 * 30 = 2592000
          */
         case $t < 2592000:
             $text = sprintf(L10n::__('%dd ago'), floor($t / 86400));
             break;
             /**
              * in 1 year, 60 * 60 * 24 * 30 * 12 = 31104000
              */
         /**
          * in 1 year, 60 * 60 * 24 * 30 * 12 = 31104000
          */
         case $t < 31104000:
             $text = sprintf(L10n::__('%dm ago'), floor($t / 2592000));
             break;
             /**
              * in 100 year 60 * 60 * 24 * 30 * 12 * 100 = 3110400000
              */
         /**
          * in 100 year 60 * 60 * 24 * 30 * 12 * 100 = 3110400000
          */
         case $t < 3110400000:
             $text = sprintf(L10n::__('%dy ago'), floor($t / 31104000));
             break;
             /**
              * dislay date
              */
         /**
          * dislay date
          */
         default:
             $text = date(L10n::__('M j, Y'), $timestamp);
     }
     return $text;
 }