Plugin Directory

Changeset 3154429


Ignore:
Timestamp:
09/19/2024 10:06:13 AM (17 months ago)
Author:
pmpr
Message:

fix some bug and optimize codebase

Location:
pmpr-ir/trunk
Files:
8 added
9 deleted
38 edited

Legend:

Unmodified
Added
Removed
  • pmpr-ir/trunk/pmpr-ir.php

    r3152426 r3154429  
    44    Plugin Name: Pmpr-IR
    55    Description: Pmpr official Wordpress plugin. Pmpr development team offers high quality products and services on Wordpress.
    6     Version: 1.3.8
     6    Version: 1.4.0
    77    Requires PHP: 7.4
    88    Author: Pmpr Development Team
     
    2222@define('PR__PLG__PMPR', 'pmpr-ir');
    2323@define('PR__PLG__PMPR__DIR', __DIR__);
    24 @define('PR__PLG__PMPR__VER', '1.3.8');
     24@define('PR__PLG__PMPR__VER', '1.4.0');
    2525@define('PR__PLG__PMPR__NAME', plugin_basename(__DIR__) . '/' . basename(__FILE__));
    2626
  • pmpr-ir/trunk/readme.txt

    r3152426 r3154429  
    55Tags: wordpress, development, programming, pmpr, دکتر, محمدپور, برنامه نویسی, توسعه, وردپرس
    66Requires at least: 5.3
    7 Tested up to: 6.6.1
    8 Stable tag: 1.3.8
     7Tested up to: 6.6.2
     8Stable tag: 1.4.0
    99Requires PHP: 7.4
    1010License: GPLv2
     
    4040
    4141== Changelog ==
     42= 1.4.0 =
     43* بهبود کارایی و رفع برخی باگ‌ها
    4244= 1.3.8 =
    4345* رفع برخی باگ‌ها
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/API.php

    r3125582 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Container\Container;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67use WP_Error;
    78
     
    2122    private function get($query, $params = [], $default = [])
    2223    {
     24        $default['host']    = get_home_url();
     25        $default['api_key'] = $this->getHelper()->getSetting()->getAPIKey();
     26
    2327        $params = wp_parse_args($params, $default);
    2428
     
    7882    {
    7983        $result = false;
    80         if (strlen($apikey) === self::APIKEY_LENGTH) {
     84        if (strlen($apikey) === Constants::APIKEY_LENGTH) {
    8185
    8286            $response = $this->get('/domain-manager/check-apikey', [
     
    106110    {
    107111        return $this->get('/component/get-items', $args, [
    108             self::IPS      => $this->getHelper()->getServer()->getIPs(),
    109             self::TYPE     => self::MODULE,
    110             self::PAGE     => 1,
    111             self::SEARCH   => '',
    112             self::API_KEY  => $this->getAPIKey(),
    113             self::PER_PAGE => 12,
    114             self::REQUIRED => false,
     112            Constants::IPS      => $this->getHelper()->getServer()->getIPs(),
     113            Constants::TYPE     => Constants::MODULE,
     114            Constants::PAGE     => 1,
     115            Constants::SEARCH   => '',
     116            Constants::PER_PAGE => 12,
     117            Constants::REQUIRED => false,
    115118        ]);
    116119    }
     
    122125     * @return array|mixed|WP_Error
    123126     */
    124     public function getComponent(string $name, string $type = self::MODULE)
     127    public function getComponent(string $name, string $type = Constants::MODULE)
    125128    {
    126129        return $this->get('/component/get-item', [
    127             self::IPS     => $this->getHelper()->getServer()->getIPs(),
    128             self::TYPE    => $type,
    129             self::NAME    => $name,
    130             self::API_KEY => $this->getAPIKey(),
     130            Constants::IPS  => $this->getHelper()->getServer()->getIPs(),
     131            Constants::TYPE => $type,
     132            Constants::NAME => $name,
    131133        ]);
    132134    }
     
    138140    {
    139141        return $this->get('/component/get-plugin-tab', [
    140             self::IPS     => $this->getHelper()->getServer()->getIPs(),
    141             self::API_KEY => $this->getAPIKey(),
     142            Constants::IPS => $this->getHelper()->getServer()->getIPs(),
    142143        ]);
    143144    }
     
    148149    public function getRESTApiEndpoint(): string
    149150    {
    150         return "{$this->getPMPRBaseURL()}/wp-json/pmpr/v1";
     151        return "{$this->getHelper()->getTool()->getPMPRBaseURL()}/wp-json/pmpr/v1";
    151152    }
    152153}
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Ajax.php

    r3145930 r3154429  
    44
    55use Exception;
    6 use Pmpr\Plugin\Pmpr\Component\Common;
    76use Pmpr\Plugin\Pmpr\Component\Process;
    87use Pmpr\Plugin\Pmpr\Container\Container;
     8use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    99use Pmpr\Plugin\Pmpr\Traits\ManagerTrait;
    1010use WP_Error;
     
    1818    use ManagerTrait;
    1919
    20     const RUN_JOB = self::PLUGIN_PREFIX . 'run_job';
    21     const CHECK_JOB = self::PLUGIN_PREFIX . 'check_job';
    22     const SAVE_APIKEY = self::PLUGIN_PREFIX . 'save_apikey';
    23     const FETCH_API_KEY = self::PLUGIN_PREFIX . 'fetch_api_key';
    24     const REGENERATE_STATIC_RESOURCES = self::PLUGIN_PREFIX . 'regenerate_static_resources';
     20    const RUN_JOB = Constants::PLUGIN_PREFIX . 'run_job';
     21    const CHECK_JOB = Constants::PLUGIN_PREFIX . 'check_job';
     22    const SAVE_APIKEY = Constants::PLUGIN_PREFIX . 'save_apikey';
     23    const FETCH_API_KEY = Constants::PLUGIN_PREFIX . 'fetch_api_key';
     24    const REGENERATE_STATIC_RESOURCES = Constants::PLUGIN_PREFIX . 'regenerate_static_resources';
    2525
    2626    const ACTIONS = [
     
    4242        $success = false;
    4343        $result  = '';
    44         if ($this->isRequirementsSatisfied()) {
     44        if ($this->getHelper()->getComponent()->isRequirementsSatisfied()) {
    4545
    4646            if (current_user_can('manage_options')) {
     
    5050                    $componentHelper = $this->getHelper()->getComponent();
    5151
    52                     $job  = $serverHelper->getPost(self::JOB);
    53                     $name = $serverHelper->getPost(self::NAME);
     52                    $job  = $serverHelper->getPost(Constants::JOB);
     53                    $name = $serverHelper->getPost(Constants::NAME);
    5454
    5555                    $manager = $this->getManager();
     
    139139                                }
    140140                                break;
    141                             case self::INSTALL:
     141                            case Constants::INSTALL:
    142142                                if (current_user_can('install_plugins')) {
    143143
     
    156156
    157157                                            $result = $componentObject->createAction([
    158                                                 self::JOB   => 'activate',
    159                                                 self::COLOR => 'primary',
    160                                                 self::TITLE => __('Activate', PR__PLG__PMPR),
     158                                                Constants::JOB   => 'activate',
     159                                                Constants::COLOR => 'primary',
     160                                                Constants::TITLE => __('Activate', PR__PLG__PMPR),
    161161                                            ]);
    162162
     
    194194
    195195                                    $result = $componentHelper->getObject($name)->createAction([
    196                                         self::TITLE  => __('Active', PR__PLG__PMPR),
    197                                         self::ENABLE => false,
     196                                        Constants::TITLE  => __('Active', PR__PLG__PMPR),
     197                                        Constants::ENABLE => false,
    198198                                    ]);
    199199                                } else {
     
    231231        }
    232232
    233         $this->ajaxResponse($result, $success, false);
     233        $this->getHelper()->getServer()->ajaxResponse($result, $success, false);
    234234    }
    235235
     
    250250        }
    251251
    252         $this->ajaxResponse($response, $success, false);
     252        $this->getHelper()->getServer()->ajaxResponse($response, $success, false);
    253253    }
    254254
     
    266266            $message = __('Your request is not valid', PR__PLG__PMPR);
    267267        }
    268         $this->ajaxResponse($message, $success, false);
     268        $this->getHelper()->getServer()->ajaxResponse($message, $success, false);
    269269    }
    270270
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Asset.php

    r3148079 r3154429  
    55use Pmpr\Plugin\Pmpr\Component\Ajax as ComponentAjax;
    66use Pmpr\Plugin\Pmpr\Container\Container;
     7use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    78
    89/**
     
    2526    {
    2627        $this->getHelper()->getHTML()->renderElement('div', [
    27             self::ID => 'pmpr_dialog',
     28            Constants::ID => 'pmpr_dialog',
    2829            'class'  => 'hidden pmpr-plg-dialog',
    2930        ]);
     
    4546        if ($this->getHelper()->getComponent()->isRequiredInstalled()) {
    4647
    47             $page = $this->getHelper()->getServer()->getGet(self::PAGE, '');
    48             if ($page && strpos($page, self::PLUGIN_PREFIX) !== false) {
     48            $page = $this->getHelper()->getServer()->getGet(Constants::PAGE, '');
     49            if ($page && strpos($page, Constants::PLUGIN_PREFIX) !== false) {
    4950
    5051                wp_enqueue_script(self::HANDLE_PREFIX . 'admin', $assetHelper->getURL("js/admin-{$ver}.js"), ['cmn__fndtn-helper', 'cmn__fndtn-backend-helper'], PR__PLG__PMPR__VER);
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Ajax.php

    r3078042 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Container\Container;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67
    78/**
     
    1112class Ajax extends Container
    1213{
    13     const SEARCH_COMPONENTS           = self::PLUGIN_PREFIX . '_search_components';
    14     const SEARCH_INSTALLED_COMPONENTS = self::PLUGIN_PREFIX . '_search_installed_components';
     14    const SEARCH_COMPONENTS           = Constants::PLUGIN_PREFIX . '_search_components';
     15    const SEARCH_INSTALLED_COMPONENTS = Constants::PLUGIN_PREFIX . '_search_installed_components';
    1516
    1617    const ACTIONS = [
     
    4748        }
    4849
    49         $this->ajaxResponse([
     50        $this->getHelper()->getServer()->ajaxResponse([
    5051            'result'  => $result,
    5152            'filters' => $filters,
     
    7576        }
    7677
    77         $this->ajaxResponse([
     78        $this->getHelper()->getServer()->ajaxResponse([
    7879            'table'  => $table,
    7980            'search' => $search,
     
    9091        if (!$type) {
    9192
    92             $type = $this->getHelper()->getServer()->getPost(self::TYPE, self::MODULE);
     93            $type = $this->getHelper()->getServer()->getPost(Constants::TYPE, Constants::MODULE);
    9394        }
    9495        $object = null;
    9596        switch ($type) {
    96             case self::MODULE:
     97            case Constants::MODULE:
    9798                $object = Module::getInstance();
    9899                break;
    99             case self::COVER:
     100            case Constants::COVER:
    100101                $object = Cover::getInstance();
    101102                break;
    102             case self::CUSTOM:
     103            case Constants::CUSTOM:
    103104                $object = Custom::getInstance();
    104105                break;
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Base.php

    r3140998 r3154429  
    88use Pmpr\Plugin\Pmpr\Component\Manager\Skin\Upgrader;
    99use Pmpr\Plugin\Pmpr\Container\Container;
     10use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    1011use Pmpr\Plugin\Pmpr\Traits\ManagerTrait;
    1112
     
    2223     */
    2324    protected array $args = [
    24         self::PRIVATE => false,
     25        Constants::PRIVATE => false,
    2526    ];
    2627
     
    3940        if (!$this->isPrivate()) {
    4041
    41             $this->addArg(self::MENU_SLUG, self::PLUGIN_PREFIX . $this->getName());
     42            $this->addArg(Constants::MENU_SLUG, Constants::PLUGIN_PREFIX . $this->getName());
    4243        }
    4344
     
    5051    public function isPrivate(): bool
    5152    {
    52         return (bool)$this->getArg(self::PRIVATE);
     53        return (bool)$this->getArg(Constants::PRIVATE);
    5354    }
    5455
     
    5960    public function getType(): string
    6061    {
    61         return $this->getArg(self::TYPE);
     62        return $this->getArg(Constants::TYPE);
    6263    }
    6364
     
    6869    public function getName(): string
    6970    {
    70         return $this->getArg(self::NAME);
     71        return $this->getArg(Constants::NAME);
    7172    }
    7273
     
    7677    public function getMenuSlug(): string
    7778    {
    78         return $this->getArg(self::MENU_SLUG);
     79        return $this->getArg(Constants::MENU_SLUG);
    7980    }
    8081
     
    150151    {
    151152        return $this->getHelper()->getServer()->getAdminURL([
    152             self::PAGE => $this->getMenuSlug(),
     153            Constants::PAGE => $this->getMenuSlug(),
    153154        ]);
    154155    }
     
    177178    public function adminMenu()
    178179    {
    179         $menuTitle = $this->getArg(self::MENU_TITLE);
     180        $menuTitle = $this->getArg(Constants::MENU_TITLE);
    180181        if (!$menuTitle) {
    181182
    182             $menuTitle = $this->getArg(self::PLURAL_NAME);
     183            $menuTitle = $this->getArg(Constants::PLURAL_NAME);
    183184        }
    184185
    185186        add_submenu_page(
    186187            PR__PLG__PMPR,
    187             sprintf($this->getArg('page_title'), $this->getArg(self::PLURAL_NAME)),
     188            sprintf($this->getArg('page_title'), $this->getArg(Constants::PLURAL_NAME)),
    188189            $this->updateMenuTitle($menuTitle),
    189190            apply_filters('pmpr_menu_capability', 'manage_options'),
    190191            $this->getMenuSlug(),
    191192            [$this, 'pageOutput'],
    192             $this->getArg(self::POSITION, 0)
     193            $this->getArg(Constants::POSITION, 0)
    193194        );
    194195
     
    210211        $serverHelper = $this->getHelper()->getServer();
    211212
    212         $tab     = $serverHelper->getGet(self::TAB);
    213         $context = $serverHelper->getGet(self::CONTEXT);
     213        $tab     = $serverHelper->getGet(Constants::TAB);
     214        $context = $serverHelper->getGet(Constants::CONTEXT);
    214215
    215216        $this->render($context, $tab);
     
    225226
    226227        $serverHelper = $this->getHelper()->getServer();
    227         if (self::INSTALL === $context) {
    228 
    229             $prefix = self::INSTALL;
     228        if (Constants::INSTALL === $context) {
     229
     230            $prefix = Constants::INSTALL;
    230231            if ('upload-component' === $serverHelper->getRequest('action')) {
    231232
     
    240241            }
    241242
    242             $parameters[self::TAB]   = $tab;
    243             $parameters[self::TITLE] = sprintf($mask, $this->getArg(self::SINGULAR_NAME));
     243            $parameters[Constants::TAB]   = $tab;
     244            $parameters[Constants::TITLE] = sprintf($mask, $this->getArg(Constants::SINGULAR_NAME));
    244245        } else {
    245246
    246             $prefix                  = self::INSTALLED;
    247             $parameters[self::TITLE] = $this->getArg(self::PLURAL_NAME);
     247            $prefix                  = Constants::INSTALLED;
     248            $parameters[Constants::TITLE] = $this->getArg(Constants::PLURAL_NAME);
    248249        }
    249250
     
    275276
    276277            $this->initListTables();
    277             if (self::INSTALL === $context) {
     278            if (Constants::INSTALL === $context) {
    278279
    279280                $table = $this->getInstall();
     
    286287                $parameters = [
    287288                    's'          => $this->getHelper()->getServer()->getRequest('s', ''),
    288                     self::STATUS => $status,
     289                    Constants::STATUS => $status,
    289290                ];
    290291                $table->prepare_items();
     
    356357    public function compareNotice()
    357358    {
    358         if ($alternative = $this->getArg(self::ALTERNATIVE_NAME)) {
     359        if ($alternative = $this->getArg(Constants::ALTERNATIVE_NAME)) {
    359360
    360361            $remoteTab = get_transient(self::REMOTE_TAB_CONTENT);
     
    369370                );
    370371
    371                 $content = $this->getSettingLinkElement($message, 'remote-tab');
     372                $content = $this->getHelper()->getSetting()->getLinkElement($message, 'remote-tab');
    372373
    373374                $HTMLHelper->renderNotice($content, [
     
    375376                    'prefix'     => false,
    376377                    'dismiss'    => false,
    377                     self::TYPE   => 'info',
    378                     self::CUSTOM => true,
     378                    Constants::TYPE   => 'info',
     379                    Constants::CUSTOM => true,
    379380                ]);
    380381            }
     
    388389            $this->getHelper()->getHTML()->renderElement('a', [
    389390                'href'  => $this->getHelper()->getServer()->getAdminURL([
    390                     self::TAB     => self::GENERAL,
    391                     self::PAGE    => $this->getMenuSlug(),
    392                     self::CONTEXT => self::INSTALL,
     391                    Constants::TAB     => Constants::GENERAL,
     392                    Constants::PAGE    => $this->getMenuSlug(),
     393                    Constants::CONTEXT => Constants::INSTALL,
    393394                ]),
    394395                'class' => 'page-title-action',
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Common.php

    r3145930 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Common\Installed;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67
    78/**
     
    1718    {
    1819        $this->args = [
    19             self::TYPE     => self::CMN,
    20             self::NAME     => self::COMMON,
    21             self::POSITION => 0,
     20            Constants::TYPE     => Constants::CMN,
     21            Constants::NAME     => Constants::COMMON,
     22            Constants::POSITION => 0,
    2223        ];
    2324
     
    2930        parent::setTranslations();
    3031
    31         $this->addArg(self::PLURAL_NAME, __('Commons', PR__PLG__PMPR))
    32              ->addArg(self::SINGULAR_NAME, __('Common', PR__PLG__PMPR));
     32        $this->addArg(Constants::PLURAL_NAME, __('Commons', PR__PLG__PMPR))
     33             ->addArg(Constants::SINGULAR_NAME, __('Common', PR__PLG__PMPR));
    3334    }
    3435
     
    6667                });
    6768            }
    68         } else if ($this->isRequirementsSatisfied()
     69        } else if ($this->getHelper()->getComponent()->isRequirementsSatisfied()
    6970            && !$this->getHelper()->getComponent()->isRequiredInstalled()) {
    7071
     
    7576    public function installRequiredComponents()
    7677    {
    77         if ($this->isRequirementsSatisfied()) {
     78        if ($this->getHelper()->getComponent()->isRequirementsSatisfied()) {
    7879
    7980            $componentHelper = $this->getHelper()->getComponent();
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Component.php

    r3140999 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Component\Manager\Initiator;
    6 use Pmpr\Plugin\Pmpr\Component\Manager\Installer;
    76use Pmpr\Plugin\Pmpr\Component\Manager\Preparation;
    87use Pmpr\Plugin\Pmpr\Container\Container;
     
    3332    public function loadRequirement()
    3433    {
     34        Initiator::getInstance();
    3535        if (is_admin()) {
    3636
    37             Ajax::getInstance();
    38             Cover::getInstance();
    39             Custom::getInstance();
    40             Module::getInstance();
    41             Common::getInstance();
     37            if ($this->getHelper()->getTool()->isAjax()) {
     38                Ajax::getInstance();
     39            } else {
     40
     41                Cover::getInstance();
     42                Custom::getInstance();
     43                Module::getInstance();
     44                Common::getInstance();
     45                Update::getInstance();
     46                Preparation::getInstance();
     47            }
    4248        }
    43 
    44         Update::getInstance();
    45         Preparation::getInstance();
    46         Initiator::getInstance();
    4749    }
    4850
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Cover.php

    r2781204 r3154429  
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Cover\Install;
    66use Pmpr\Plugin\Pmpr\Component\ListTable\Cover\Installed;
     7use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    78
    89/**
     
    1819    {
    1920        $this->args = [
    20             self::TYPE     => self::CVR,
    21             self::NAME     => self::COVER,
    22             self::POSITION => 5,
     21            Constants::TYPE     => Constants::CVR,
     22            Constants::NAME     => Constants::COVER,
     23            Constants::POSITION => 5,
    2324        ];
    2425
     
    2930    {
    3031        parent::setTranslations();
    31         $this->addArg(self::PLURAL_NAME, __('Covers', PR__PLG__PMPR))
    32              ->addArg(self::SINGULAR_NAME, __('Cover', PR__PLG__PMPR))
    33              ->addArg(self::ALTERNATIVE_NAME, __('Theme', PR__PLG__PMPR))
    34              ->addArg(self::NOT_FOUND, sprintf(__('Wordpress %s will be available here to get installed, very soon.', PR__PLG__PMPR), __('Covers', PR__PLG__PMPR)));
     32        $this->addArg(Constants::PLURAL_NAME, __('Covers', PR__PLG__PMPR))
     33             ->addArg(Constants::SINGULAR_NAME, __('Cover', PR__PLG__PMPR))
     34             ->addArg(Constants::ALTERNATIVE_NAME, __('Theme', PR__PLG__PMPR))
     35             ->addArg(Constants::NOT_FOUND, sprintf(__('Wordpress %s will be available here to get installed, very soon.', PR__PLG__PMPR), __('Covers', PR__PLG__PMPR)));
    3536    }
    3637
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Custom.php

    r2781204 r3154429  
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Custom\Install;
    66use Pmpr\Plugin\Pmpr\Component\ListTable\Custom\Installed;
     7use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    78
    89/**
     
    1819    {
    1920        $this->args = [
    20             self::TYPE     => self::CST,
    21             self::NAME     => self::CUSTOM,
    22             self::POSITION => 6,
     21            Constants::TYPE     => Constants::CST,
     22            Constants::NAME     => Constants::CUSTOM,
     23            Constants::POSITION => 6,
    2324        ];
    2425
     
    3031        parent::setTranslations();
    3132
    32         $this->addArg(self::PLURAL_NAME, __('Customs', PR__PLG__PMPR))
    33              ->addArg(self::SINGULAR_NAME, __('Custom', PR__PLG__PMPR))
    34             ->addArg(self::NOT_FOUND, sprintf(__('no %s founded for your domain.', PR__PLG__PMPR), __('Custom', PR__PLG__PMPR)));
     33        $this->addArg(Constants::PLURAL_NAME, __('Customs', PR__PLG__PMPR))
     34             ->addArg(Constants::SINGULAR_NAME, __('Custom', PR__PLG__PMPR))
     35            ->addArg(Constants::NOT_FOUND, sprintf(__('no %s founded for your domain.', PR__PLG__PMPR), __('Custom', PR__PLG__PMPR)));
    3536    }
    3637
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Item.php

    r3152426 r3154429  
    33namespace Pmpr\Plugin\Pmpr\Component;
    44
    5 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    66use Pmpr\Plugin\Pmpr\Traits\HelperTrait;
    77
     
    1010 * @package Pmpr\Plugin\Pmpr\Component
    1111 */
    12 class Item implements ConstantInterface
     12class Item
    1313{
    1414    use HelperTrait;
     
    133133            }
    134134
    135             $component[self::TITLE]       = $title;
    136             $component[self::DESCRIPTION] = $description;
     135            $component[Constants::TITLE]       = $title;
     136            $component[Constants::DESCRIPTION] = $description;
    137137
    138138            $this->data = $component;
     
    356356    public function isRequired(): bool
    357357    {
    358 
     358        return false;
    359359    }
    360360
     
    381381    {
    382382        $name = $this->getName();
    383         if (in_array($this->getType(), [self::COMMON, self::UTILITY], true)) {
     383        if (in_array($this->getType(), [Constants::COMMON, Constants::UTILITY], true)) {
    384384
    385385            $isActive = $this->getHelper()->getComponent()->isInstalled($name);
     
    484484
    485485                $actions[] = $this->createAction([
    486                     self::TITLE  => __('Coming Soon', PR__PLG__PMPR),
    487                     self::ENABLE => false,
     486                    Constants::TITLE  => __('Coming Soon', PR__PLG__PMPR),
     487                    Constants::ENABLE => false,
    488488                ]);
    489489            } else if ($backlinkModal = $this->getBacklinkModal()) {
     
    492492
    493493                $actions[] = $HTMLHelper->createModal([
    494                     self::NAME    => 'install-component',
    495                     self::TITLE   => $typeHelper->arrayGetItem($backlinkModal, self::TITLE),
    496                     self::PREFIX  => $this->getName() . '_modal',
    497                     self::CONTENT => wpautop($typeHelper->arrayGetItem($backlinkModal, self::TEXT)),
    498                     self::BUTTONS => [
    499                         self::CANCEL,
    500                         self::INSTALL => $this->createAction([
    501                             self::JOB   => self::INSTALL,
    502                             self::TITLE => __('Accept & Install', PR__PLG__PMPR),
    503                             self::ATTRS => [
     494                    Constants::NAME    => 'install-component',
     495                    Constants::TITLE   => $typeHelper->arrayGetItem($backlinkModal, Constants::TITLE),
     496                    Constants::PREFIX  => $this->getName() . '_modal',
     497                    Constants::CONTENT => wpautop($typeHelper->arrayGetItem($backlinkModal, Constants::TEXT)),
     498                    Constants::BUTTONS => [
     499                        Constants::CANCEL,
     500                        Constants::INSTALL => $this->createAction([
     501                            Constants::JOB   => Constants::INSTALL,
     502                            Constants::TITLE => __('Accept & Install', PR__PLG__PMPR),
     503                            Constants::ATTRS => [
    504504                                'rol'   => 'button',
    505505                                'type'  => 'button',
     
    513513
    514514                $actions[] = $this->createAction([
    515                     self::JOB   => self::INSTALL,
    516                     self::TITLE => __('Install Now', PR__PLG__PMPR),
     515                    Constants::JOB   => Constants::INSTALL,
     516                    Constants::TITLE => __('Install Now', PR__PLG__PMPR),
    517517                ]);
    518518            }
     
    520520
    521521            $actions[] = $this->createAction([
    522                 self::JOB   => 'update',
    523                 self::TITLE => __('Update', PR__PLG__PMPR),
     522                Constants::JOB   => 'update',
     523                Constants::TITLE => __('Update', PR__PLG__PMPR),
    524524            ]);
    525525
     
    527527
    528528            $actions[] = $this->createAction([
    529                 self::TITLE  => __('Active', PR__PLG__PMPR),
    530                 self::ENABLE => false,
     529                Constants::TITLE  => __('Active', PR__PLG__PMPR),
     530                Constants::ENABLE => false,
    531531            ]);
    532532        } else {
    533533
    534534            $actions[] = $this->createAction([
    535                 self::JOB   => 'activate',
    536                 self::COLOR => self::PRIMARY,
    537                 self::TITLE => __('Activation', PR__PLG__PMPR),
     535                Constants::JOB   => 'activate',
     536                Constants::COLOR => Constants::PRIMARY,
     537                Constants::TITLE => __('Activation', PR__PLG__PMPR),
    538538            ]);
    539539        }
     
    569569        $typeHelper = $this->getHelper()->getType();
    570570
    571         $job    = $typeHelper->arrayGetItem($args, self::JOB);
    572         $title  = $typeHelper->arrayGetItem($args, self::TITLE);
    573         $enable = $typeHelper->arrayGetItem($args, 'enable', true);
    574 
    575         $color = $args[self::COLOR] ?? 'default';
     571        $job    = $typeHelper->arrayGetItem($args, Constants::JOB);
     572        $title  = $typeHelper->arrayGetItem($args, Constants::TITLE);
     573        $enable = $typeHelper->arrayGetItem($args, Constants::ENABLE, true);
     574
     575        $color = $args[Constants::COLOR] ?? 'default';
    576576
    577577        $args = $typeHelper->parseArgs($args, [
    578             self::JOB   => $job,
    579             self::NAME  => $this->getName(),
    580             self::SLUG  => $this->getSlug(),
    581             self::TYPE  => $this->getType(),
    582             self::COLOR => 'default',
    583             self::TITLE => $title,
    584             self::ATTRS => [
     578            Constants::JOB   => $job,
     579            Constants::NAME  => $this->getName(),
     580            Constants::SLUG  => $this->getSlug(),
     581            Constants::TYPE  => $this->getType(),
     582            Constants::COLOR => 'default',
     583            Constants::TITLE => $title,
     584            Constants::ATTRS => [
    585585                'rol'   => 'button',
    586586                'type'  => 'button',
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/ListTable/Cover/Install.php

    r2707477 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Install as BaseClass;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67
    78/**
     
    1718    public function getTabs($tabs)
    1819    {
    19         $tabs[self::DEDICATED] = __('Dedicated', PR__PLG__PMPR);
     20        $tabs[Constants::DEDICATED] = __('Dedicated', PR__PLG__PMPR);
    2021
    2122        return $tabs;
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/ListTable/Install.php

    r3078042 r3154429  
    33namespace Pmpr\Plugin\Pmpr\Component\ListTable;
    44
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    56use WP_Error;
    67
     
    6061    public function getName(): ?string
    6162    {
    62         return $this->getArg(self::NAME);
     63        return $this->getArg(Constants::NAME);
    6364    }
    6465
     
    6869        global $tabs, $tab, $paged, $s;
    6970
    70         wp_reset_vars([self::TAB]);
     71        wp_reset_vars([Constants::TAB]);
    7172
    7273        $perPage = 36;
     
    7576        $tabs    = $this->applyFilters("install_{$name}_tabs", $tabs);
    7677
    77         if (self::SEARCH === $tab) {
    78 
    79             $tabs[self::SEARCH] = __('Search Results', PR__PLG__PMPR);
    80             $args[self::SEARCH] = $s;
    81         }
    82 
    83         $tabs[self::GENERAL] = __('General', PR__PLG__PMPR);
     78        if (Constants::SEARCH === $tab) {
     79
     80            $tabs[Constants::SEARCH] = __('Search Results', PR__PLG__PMPR);
     81            $args[Constants::SEARCH] = $s;
     82        }
     83
     84        $tabs[Constants::GENERAL] = __('General', PR__PLG__PMPR);
    8485
    8586        $tabs = $this->getTabs($tabs);
    8687
    87         $componentHelper =$this->getHelper()->getComponent();
     88        $componentHelper = $this->getHelper()->getComponent();
    8889
    8990        if ($componentHelper->isRequiredInstalled()) {
    9091
    9192            $args = [
    92                 self::PAGE      => $paged,
    93                 self::TYPE      => $name,
    94                 self::LOCALE    => get_user_locale(),
    95                 self::PER_PAGE  => $perPage,
    96                 self::DEDICATED => isset($tabs[self::DEDICATED]) && self::DEDICATED === $tab,
     93                Constants::PAGE      => $paged,
     94                Constants::TYPE      => $name,
     95                Constants::LOCALE    => get_user_locale(),
     96                Constants::PER_PAGE  => $perPage,
     97                Constants::DEDICATED => isset($tabs[Constants::DEDICATED]) && Constants::DEDICATED === $tab,
    9798            ];
    9899
     
    110111                    $this->set_pagination_args(
    111112                        [
    112                             'total_items'  => $result->pagination->total,
    113                             self::PER_PAGE => $perPage,
     113                            'total_items'       => $result->pagination->total,
     114                            Constants::PER_PAGE => $perPage,
    114115                        ]
    115116                    );
     
    139140                $attrs = [
    140141                    'class'        => 'current',
    141                     'aria-current' => self::PAGE,
     142                    'aria-current' => Constants::PAGE,
    142143                ];
    143144            }
    144145            $attrs['href'] = $serverHelper->getAdminURL([
    145                 self::TAB     => $action,
    146                 self::PAGE    => $this->getArg(self::MENU_SLUG),
    147                 self::CONTEXT => self::INSTALL,
     146                Constants::TAB     => $action,
     147                Constants::PAGE    => $this->getArg(Constants::MENU_SLUG),
     148                Constants::CONTEXT => Constants::INSTALL,
    148149            ]);
    149150
     
    173174        global $tab;
    174175
    175         $plural     = $this->getArg(self::PLURAL_NAME);
     176        $plural     = $this->getArg(Constants::PLURAL_NAME);
    176177        $search     = '';
    177178        $HTMLHelper = $this->getHelper()->getHTML();
    178         if (self::DEDICATED !== $tab) {
     179        if (Constants::DEDICATED !== $tab) {
    179180
    180181            $search = $HTMLHelper->renderTemplate('install/search', [
    181182                'args'               => [
    182                     self::TAB     => self::SEARCH,
    183                     self::PAGE    => $this->getArg(self::MENU_SLUG),
    184                     self::CONTEXT => self::INSTALL,
     183                    Constants::TAB     => Constants::SEARCH,
     184                    Constants::PAGE    => $this->getArg(Constants::MENU_SLUG),
     185                    Constants::CONTEXT => Constants::INSTALL,
    185186                ],
    186187                'search_label'       => sprintf($this->getArg('search_label'), $plural),
     
    199200        global $tab;
    200201
    201         $singular = $this->getArg(self::SINGULAR_NAME);
    202         if (self::DEDICATED === $tab) {
     202        $singular = $this->getArg(Constants::SINGULAR_NAME);
     203        if (Constants::DEDICATED === $tab) {
    203204
    204205            $message = sprintf(__('No exclusive %s found for your domain.', PR__PLG__PMPR), $singular);
    205206        } else {
    206207
    207             $message = $this->getArg(self::NOT_FOUND);
     208            $message = $this->getArg(Constants::NOT_FOUND);
    208209            if (!$message) {
    209210
    210                 if (self::SEARCH === $tab) {
     211                if (Constants::SEARCH === $tab) {
    211212
    212213                    $message = sprintf(__('No %s found. Try a different search.', PR__PLG__PMPR), $singular);
     
    219220
    220221        $this->getHelper()->getHTML()->renderTemplate('install/not-found', [
    221             'error'         => $this->getError(),
    222             self::NOT_FOUND => $message,
     222            Constants::ERROR     => $this->getError(),
     223            Constants::NOT_FOUND => $message,
    223224        ]);
    224225    }
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/ListTable/Installed.php

    r3152426 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Component\Item;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67
    78/**
     
    2526        global $status;
    2627
    27         $status = $this->getHelper()->getServer()->getRequest(self::STATUS, self::ALL);
     28        $status = $this->getHelper()->getServer()->getRequest(Constants::STATUS, Constants::ALL);
    2829
    2930        $statuses = ['active', 'inactive', 'search', 'paused'];
     
    4849
    4950        $columns = array_merge($columns, [
    50             self::TITLE       => $this->getArg(self::SINGULAR_NAME),
    51             self::DESCRIPTION => __('Description', PR__PLG__PMPR),
     51            Constants::TITLE       => $this->getArg(Constants::SINGULAR_NAME),
     52            Constants::DESCRIPTION => __('Description', PR__PLG__PMPR),
    5253        ]);
    5354
    54         if ($this->getArg(self::AUTO_UPDATE)) {
     55        if ($this->getArg(Constants::AUTO_UPDATE)) {
    5556
    5657            $columns['auto-updates'] = __('Automatic Updates', PR__PLG__PMPR);
     
    9596
    9697                $args = [
    97                     self::PAGE   => $this->getArg(self::MENU_SLUG),
    98                     self::STATUS => $type,
     98                    Constants::PAGE   => $this->getArg(Constants::MENU_SLUG),
     99                    Constants::STATUS => $type,
    99100                ];
    100101
     
    139140                    'href' => $this->getHelper()->getServer()->getAdminURL([
    140141                        's'           => urlencode($s),
    141                         self::TAB     => self::SEARCH,
    142                         self::PAGE    => $this->getArg(self::MENU_SLUG),
    143                         self::CONTEXT => self::INSTALL,
     142                        Constants::TAB     => Constants::SEARCH,
     143                        Constants::PAGE    => $this->getArg(Constants::MENU_SLUG),
     144                        Constants::CONTEXT => Constants::INSTALL,
    144145                    ]),
    145                 ], sprintf(__('Search for %s in the Pmpr Modules Directory.', PR__PLG__PMPR), $this->getArg(self::PLURAL_NAME)));
     146                ], sprintf(__('Search for %s in the Pmpr Modules Directory.', PR__PLG__PMPR), $this->getArg(Constants::PLURAL_NAME)));
    146147            }
    147148
     
    173174
    174175        $components = [
    175             self::ALL      => $allComponents,
    176             self::SEARCH   => [],
    177             self::ACTIVE   => [],
    178             self::INACTIVE => [],
     176            Constants::ALL      => $allComponents,
     177            Constants::SEARCH   => [],
     178            Constants::ACTIVE   => [],
     179            Constants::INACTIVE => [],
    179180        ];
    180181
     
    183184        if ($s) {
    184185
    185             $status                   = self::SEARCH;
    186             $components[self::SEARCH] = array_filter($components[self::ALL], [$this, '_search_callback']);
     186            $status                   = Constants::SEARCH;
     187            $components[Constants::SEARCH] = array_filter($components[Constants::ALL], [$this, '_search_callback']);
    187188        }
    188189
    189190        $typeHelper = $this->getHelper()->getType();
    190         foreach ($components[self::ALL] as $data) {
    191 
    192             $componentStatus = $typeHelper->arrayGetItem($data, self::STATUS);
     191        foreach ($components[Constants::ALL] as $data) {
     192
     193            $componentStatus = $typeHelper->arrayGetItem($data, Constants::STATUS);
    193194            if (isset($components[$componentStatus])) {
    194195
     
    204205
    205206        if (empty($components[$status])
    206             && !in_array($status, [self::ALL, self::SEARCH], true)) {
    207 
    208             $status = self::ALL;
     207            && !in_array($status, [Constants::ALL, Constants::SEARCH], true)) {
     208
     209            $status = Constants::ALL;
    209210        }
    210211
     
    213214        if (!$orderby) {
    214215
    215             $orderby = self::NAME;
     216            $orderby = Constants::NAME;
    216217        } else {
    217218
     
    235236            [
    236237                'total_items'  => $total,
    237                 self::PER_PAGE => $perPage,
     238                Constants::PER_PAGE => $perPage,
    238239            ]
    239240        );
     
    431432                    'orderby'  => sanitize_text_field($serverHelper->getRequest('orderby') ?? ''),
    432433                    'order'    => sanitize_text_field($serverHelper->getRequest('order') ?? ''),
    433                     self::PAGE => $this->getArg(self::MENU_SLUG),
     434                    Constants::PAGE => $this->getArg(Constants::MENU_SLUG),
    434435                ],
    435436                'text'     => $text,
    436                 self::TYPE => $this->getArg(self::NAME),
    437                 self::NAME => $this->getArg(self::SINGULAR_NAME),
     437                Constants::TYPE => $this->getArg(Constants::NAME),
     438                Constants::NAME => $this->getArg(Constants::SINGULAR_NAME),
    438439                'input_id' => $input_id . '-search-input',
    439440            ]);
     
    443444    protected function get_primary_column_name()
    444445    {
    445         return self::TITLE;
     446        return Constants::TITLE;
    446447    }
    447448
     
    534535                'class' => 'pr-installed-action' . ((!isset($args['reload']) || $args['reload']) ? ' pr-component-reload' : ''),
    535536            ],
    536             self::JOB     => $job,
    537             self::NAME    => $item->getName(),
    538             self::TYPE    => $item->getType(),
    539             self::SLUG    => $item->getSlug(),
    540             self::TITLE   => $title,
    541             self::ELEMENT => 'a',
     537            Constants::JOB     => $job,
     538            Constants::NAME    => $item->getName(),
     539            Constants::TYPE    => $item->getType(),
     540            Constants::SLUG    => $item->getSlug(),
     541            Constants::TITLE   => $title,
     542            Constants::ELEMENT => 'a',
    542543        ]);
    543544
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/ListTable/ListTable.php

    r3140039 r3154429  
    33namespace Pmpr\Plugin\Pmpr\Component\ListTable;
    44
    5 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    66use Pmpr\Plugin\Pmpr\Traits\APITrait;
    7 use Pmpr\Plugin\Pmpr\Traits\CommonTrait;
    87use Pmpr\Plugin\Pmpr\Traits\HelperTrait;
    98use Pmpr\Plugin\Pmpr\Traits\HookTrait;
    109use Pmpr\Plugin\Pmpr\Traits\ManagerTrait;
    11 use Pmpr\Plugin\Pmpr\Traits\SettingTrait;
    1210use WP_List_Table;
    1311
     
    1614 * @package Pmpr\Plugin\Pmpr\Component
    1715 */
    18 abstract class ListTable extends WP_List_Table implements ConstantInterface
     16abstract class ListTable extends WP_List_Table
    1917{
    2018    use APITrait,
    2119        HookTrait,
    2220        HelperTrait,
    23         CommonTrait,
    24         ManagerTrait,
    25         SettingTrait;
     21        ManagerTrait;
    2622
    2723    /**
     
    3228    public function __construct($args = [])
    3329    {
    34         $args['screen'] = "{$this->getArg(self::MENU_SLUG)}-{$this->getArg(self::NAME)}";
     30        $args['screen'] = "{$this->getArg(Constants::MENU_SLUG)}-{$this->getArg(Constants::NAME)}";
    3531
    3632        global $page, $s;
     
    5147    public function getType(): string
    5248    {
    53         return (string)$this->getArg(self::TYPE, '');
     49        return (string)$this->getArg(Constants::TYPE, '');
    5450    }
    5551
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/ListTable/Module/Install.php

    r2707477 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Install as BaseClass;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67
    78/**
     
    1718    public function getTabs($tabs)
    1819    {
    19         $tabs[self::DEDICATED] = __('Dedicated', PR__PLG__PMPR);
     20        $tabs[Constants::DEDICATED] = __('Dedicated', PR__PLG__PMPR);
    2021
    2122        return $tabs;
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/ListTable/Update/Installed.php

    r3152426 r3154429  
    55use Pmpr\Plugin\Pmpr\Component\Item;
    66use Pmpr\Plugin\Pmpr\Component\ListTable\ListTable;
     7use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    78
    89/**
     
    1920    {
    2021        return [
    21             self::TITLE       => __('Component', PR__PLG__PMPR),
    22             self::VERSION     => __('Current Version', PR__PLG__PMPR),
    23             self::NEW_VERSION => __('New Version', PR__PLG__PMPR),
     22            Constants::TITLE       => __('Component', PR__PLG__PMPR),
     23            Constants::VERSION     => __('Current Version', PR__PLG__PMPR),
     24            Constants::NEW_VERSION => __('New Version', PR__PLG__PMPR),
    2425        ];
    2526    }
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Manager/Initiator.php

    r3152426 r3154429  
    44
    55use Exception;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67use Pmpr\Plugin\Pmpr\Traits\ManagerTrait;
    78
     
    2122            return;
    2223        }
    23         $this->loadComponents();
     24//        $this->loadComponents();
    2425    }
    2526
     
    5758    public function loadCommons(): bool
    5859    {
    59         $commons = $this->getHelper()->getComponent()->getInstalledByType(self::COMMON);
     60        $commons = $this->getHelper()->getComponent()->getInstalledByType(Constants::COMMON);
    6061        foreach ($commons as $component) {
    6162
     
    7273    {
    7374        $types = [
    74             self::MODULE,
    75             self::CUSTOM,
     75            Constants::MODULE,
     76            Constants::CUSTOM,
    7677        ];
    7778
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Module.php

    r2706126 r3154429  
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Module\Install;
    66use Pmpr\Plugin\Pmpr\Component\ListTable\Module\Installed;
     7use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    78
    89/**
     
    1819    {
    1920        $this->args = [
    20             self::TYPE     => self::MDL,
    21             self::NAME     => self::MODULE,
    22             self::POSITION => 0,
     21            Constants::TYPE     => Constants::MDL,
     22            Constants::NAME     => Constants::MODULE,
     23            Constants::POSITION => 0,
    2324        ];
    2425
     
    2930    {
    3031        parent::setTranslations();
    31         $this->addArg(self::PLURAL_NAME, __('Modules', PR__PLG__PMPR))
    32              ->addArg(self::SINGULAR_NAME, __('Module', PR__PLG__PMPR))
    33              ->addArg(self::ALTERNATIVE_NAME, __('Plugin', PR__PLG__PMPR));
     32        $this->addArg(Constants::PLURAL_NAME, __('Modules', PR__PLG__PMPR))
     33             ->addArg(Constants::SINGULAR_NAME, __('Module', PR__PLG__PMPR))
     34             ->addArg(Constants::ALTERNATIVE_NAME, __('Plugin', PR__PLG__PMPR));
    3435    }
    3536
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Process.php

    r3142498 r3154429  
    33namespace Pmpr\Plugin\Pmpr\Component;
    44
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    56use Pmpr\Plugin\Pmpr\Queue;
    67
     
    1112class Process extends Queue
    1213{
    13     const MIDNIGHT_UPDATE_JOB = self::PLUGIN_PREFIX . '_midnight_update';
    14     const INSTALL_REQUIRED_COMMONS = self::PLUGIN_PREFIX . '_install_required_commons';
    15     const CHECK_COMPONENTS_UPDATE_JOB = self::PLUGIN_PREFIX . '_check_components_update';
     14    const MIDNIGHT_UPDATE_JOB = Constants::PLUGIN_PREFIX . '_midnight_update';
     15    const INSTALL_REQUIRED_COMMONS = Constants::PLUGIN_PREFIX . '_install_required_commons';
     16    const CHECK_COMPONENTS_UPDATE_JOB = Constants::PLUGIN_PREFIX . '_check_components_update';
    1617
    1718    public function __construct()
     
    6869    {
    6970        return $this->exists([
    70             self::HOOK   => self::MIDNIGHT_UPDATE_JOB,
    71             self::STATUS => [self::PENDING, self::IN_PROGRESS],
     71            Constants::HOOK   => self::MIDNIGHT_UPDATE_JOB,
     72            Constants::STATUS => [Constants::PENDING, Constants::IN_PROGRESS],
    7273        ]);
    7374    }
     
    7980    {
    8081        return $this->exists([
    81             self::HOOK   => self::INSTALL_REQUIRED_COMMONS,
    82             self::STATUS => [self::PENDING, self::IN_PROGRESS],
     82            Constants::HOOK   => self::INSTALL_REQUIRED_COMMONS,
     83            Constants::STATUS => [Constants::PENDING, Constants::IN_PROGRESS],
    8384        ]);
    8485    }
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Update.php

    r3078046 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Component\ListTable\Update\Installed;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67
    78/**
     
    1718    {
    1819        $this->args = [
    19             self::NAME     => 'update',
    20             self::POSITION => 10,
     20            Constants::NAME     => 'update',
     21            Constants::POSITION => 10,
    2122        ];
    2223
     
    2829        parent::setTranslations();
    2930
    30         $this->addArg(self::PLURAL_NAME, __('Update', PR__PLG__PMPR))
    31              ->addArg(self::SINGULAR_NAME, __('Update', PR__PLG__PMPR));
     31        $this->addArg(Constants::PLURAL_NAME, __('Update', PR__PLG__PMPR))
     32             ->addArg(Constants::SINGULAR_NAME, __('Update', PR__PLG__PMPR));
    3233    }
    3334
     
    3940
    4041        parent::addActions();
    41     }
    42 
    43     public function addFilters()
    44     {
    45         if (!$this->isPrivate()) {
    46 
    47             $this->addFilter('pmpr_components_update_count', [$this, 'getUpdateCount']);
    48         }
    4942    }
    5043
     
    9588
    9689        $types = [
    97             self::COMMON => [
    98                 self::TITLE => __('Commons', PR__PLG__PMPR),
    99                 self::COUNT => 0,
     90            Constants::COMMON => [
     91                Constants::TITLE => __('Commons', PR__PLG__PMPR),
     92                Constants::COUNT => 0,
    10093            ],
    101             self::MODULE => [
    102                 self::TITLE => __('Modules', PR__PLG__PMPR),
    103                 self::COUNT => 0,
     94            Constants::MODULE => [
     95                Constants::TITLE => __('Modules', PR__PLG__PMPR),
     96                Constants::COUNT => 0,
    10497            ],
    105             self::COVER  => [
    106                 self::TITLE => __('Covers', PR__PLG__PMPR),
    107                 self::COUNT => 0,
     98            Constants::COVER  => [
     99                Constants::TITLE => __('Covers', PR__PLG__PMPR),
     100                Constants::COUNT => 0,
    108101            ],
    109             self::CUSTOM => [
    110                 self::TITLE => __('Customs', PR__PLG__PMPR),
    111                 self::COUNT => 0,
     102            Constants::CUSTOM => [
     103                Constants::TITLE => __('Customs', PR__PLG__PMPR),
     104                Constants::COUNT => 0,
    112105            ],
    113106        ];
     
    124117
    125118                    $hasUpdate = true;
    126                     $types[$type][self::COUNT]++;
    127                     $types[$type][self::UPDATE][$componentName] = $component;
     119                    $types[$type][Constants::COUNT]++;
     120                    $types[$type][Constants::UPDATE][$componentName] = $component;
    128121                }
    129122            }
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Container/Container.php

    r3078042 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Container\Traits\SingletonTrait;
    6 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    77use Pmpr\Plugin\Pmpr\Traits\APITrait;
    8 use Pmpr\Plugin\Pmpr\Traits\CommonTrait;
    98use Pmpr\Plugin\Pmpr\Traits\HelperTrait;
    109use Pmpr\Plugin\Pmpr\Traits\HookTrait;
    11 use Pmpr\Plugin\Pmpr\Traits\SettingTrait;
    1210
    1311/**
     
    1513 * @package Pmpr\Plugin\Pmpr\Container
    1614 */
    17 class Container implements ConstantInterface
     15class Container
    1816{
    19     const REMOTE_TAB_CONTENT = self::PLUGIN_PREFIX . 'remote_tab_content_transient';
     17    const REMOTE_TAB_CONTENT = Constants::PLUGIN_PREFIX . 'remote_tab_content_transient';
    2018
    2119    use APITrait,
    2220        HookTrait,
    23         CommonTrait,
    2421        HelperTrait,
    25         SettingTrait,
    2622        SingletonTrait;
    2723
     
    5652        $result = null;
    5753        switch ($target) {
    58             case self::COMMONS_INSTALLATION_PROBLEM:
     54            case Constants::COMMONS_INSTALLATION_PROBLEM:
    5955                $result = __('There is a problem in commons installation. Please refresh the page to try again. Contact us, if the problem remain.', PR__PLG__PMPR);
    6056                break;
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Container/Storage.php

    r3078042 r3154429  
    44
    55use Exception;
    6 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
    76
    87/**
     
    109 * @package Pmpr\Plugin\Pmpr\Container
    1110 */
    12 class Storage implements ConstantInterface
     11class Storage
    1312{
    1413    /**
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Helper/Common.php

    r3078046 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Container\Traits\SingletonTrait;
    6 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
    76use Pmpr\Plugin\Pmpr\Traits\HelperTrait;
    87
     
    1110 * @package Pmpr\Plugin\Pmpr\Helper
    1211 */
    13 abstract class Common implements ConstantInterface
     12abstract class Common
    1413{
    1514    use SingletonTrait,
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Helper/Component.php

    r3152426 r3154429  
    66use Pmpr\Plugin\Pmpr\API;
    77use Pmpr\Plugin\Pmpr\Component\Item;
     8use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    89
    910/**
     
    143144            $typeHelper = $this->getHelper()->getType();
    144145
    145             $name = $typeHelper->arrayGetItem($fetched, self::NAME);
     146            $name = $typeHelper->arrayGetItem($fetched, Constants::NAME);
    146147            if ($name && ($component = $this->getData($name))) {
    147148
     
    205206        $data    = $this->getData($component);
    206207        $changed = false;
    207         if ($data && isset($data[self::STATUS])
    208             && $data[self::STATUS] !== $status) {
    209 
    210             $data[self::STATUS] = $status;
     208        if ($data && isset($data[Constants::STATUS])
     209            && $data[Constants::STATUS] !== $status) {
     210
     211            $data[Constants::STATUS] = $status;
    211212            $this->updateData($component, $data);
    212213            $changed = true;
     
    223224    public function active($component): bool
    224225    {
    225         return $this->changeStatus($component, self::ACTIVE);
     226        return $this->changeStatus($component, Constants::ACTIVE);
    226227    }
    227228
     
    233234    public function deactivate($component): bool
    234235    {
    235         return $this->changeStatus($component, self::INACTIVE);
     236        return $this->changeStatus($component, Constants::INACTIVE);
    236237    }
    237238
     
    261262     * @return false|mixed|Item|null
    262263     */
    263     public function getData(string $component, string $output = self::ARRAY)
     264    public function getData(string $component, string $output = Constants::ARRAY)
    264265    {
    265266        $return = get_option(self::COMPONENT_ . $component, []);
    266267
    267         if (is_array($return) && empty($return[self::NAME])) {
    268 
    269             $return[self::NAME] = $component;
    270         }
    271 
    272         if (self::OBJECT === $output) {
     268        if (is_array($return) && empty($return[Constants::NAME])) {
     269
     270            $return[Constants::NAME] = $component;
     271        }
     272
     273        if (Constants::OBJECT === $output) {
    273274
    274275            $return = $this->getObject($return);
     
    285286    public function getDataAsObject(string $component)
    286287    {
    287         return $this->getData($component, self::OBJECT);
     288        return $this->getData($component, Constants::OBJECT);
    288289    }
    289290
     
    321322    {
    322323        $component = $this->getData($name);
    323         return $this->isInstalled($name) && ($component[self::STATUS] ?? '') === self::ACTIVE;
     324        return $this->isInstalled($name)
     325            && ($component[Constants::STATUS] ?? '') === Constants::ACTIVE;
    324326    }
    325327
     
    332334    {
    333335        $types = [
    334             self::COMMON  => self::CMN,
    335             self::UTILITY => self::UTL,
    336             self::MODULE  => self::MDL,
    337             self::COVER   => self::CVR,
    338             self::CUSTOM  => self::CST,
     336            Constants::COMMON  => Constants::CMN,
     337            Constants::UTILITY => Constants::UTL,
     338            Constants::MODULE  => Constants::MDL,
     339            Constants::COVER   => Constants::CVR,
     340            Constants::CUSTOM  => Constants::CST,
    339341        ];
    340342
     
    419421    public function clearCache()
    420422    {
    421         delete_option(self::UPDATE_COUNT);
     423        delete_option(Constants::UPDATE_COUNT);
    422424        $this->getHelper()->getAsset()->clearBuildPath();
    423425    }
     
    428430    public function getUpdateCount()
    429431    {
    430         return get_option(self::UPDATE_COUNT);
     432        return get_option(Constants::UPDATE_COUNT);
     433    }
     434
     435    /**
     436     * @param bool $checkAPI
     437     * @return bool
     438     */
     439    public function isRequirementsSatisfied(bool $checkAPI = true): bool
     440    {
     441        $satisfied    = true;
     442        $typeHelper   = $this->getHelper()->getType();
     443        $requirements = $this->requirementsNotices();
     444        foreach ($requirements as $requirement) {
     445
     446            if ($typeHelper->arrayGetItem($requirement, 'show')) {
     447
     448                $satisfied = false;
     449                break;
     450            }
     451        }
     452
     453        if ($satisfied && $checkAPI
     454            && !$this->getHelper()->getSetting()->getAPIKey()) {
     455
     456            $satisfied = false;
     457        }
     458
     459        return $satisfied;
     460    }
     461
     462    /**
     463     * @param bool $echo
     464     * @param array $args
     465     * @return array
     466     */
     467    public function requirementsNotices(bool $echo = false, array $args = []): array
     468    {
     469        $base = $this->getHelper()->getFile()->getBaseDirPath();
     470        $settingHelper = $this->getHelper()->getSetting();
     471
     472        $requirements['writable'] = [
     473            Constants::SHOW        => !$base || !$this->getHelper()->getFile()->isWritable($base),
     474            Constants::TEXT        => __('Please contact us.', PR__PLG__PMPR),
     475            Constants::TITLE       => __('Components Installation Possibility', PR__PLG__PMPR),
     476            Constants::DESCRIPTION => __('Access to domain root directory is required to complete the installation process.', PR__PLG__PMPR),
     477        ];
     478
     479        $requirements['api-key'] = [
     480            Constants::SHOW        => !$settingHelper->getAPIKey() && !$settingHelper->isSettingPage(),
     481            Constants::TEXT        => sprintf(
     482                '%s, %s.',
     483                __('To complete the installation of PMPR plugin', PR__PLG__PMPR),
     484                $settingHelper->getLinkElement(__('enter your api key in here', PR__PLG__PMPR))
     485            ),
     486            Constants::TYPE        => 'info',
     487            Constants::TITLE       => __('API Key', PR__PLG__PMPR),
     488            Constants::DESCRIPTION => __('It\'s required to communicate with the server.', PR__PLG__PMPR),
     489        ];
     490
     491        foreach ($requirements as $index => $requirement) {
     492
     493            $text    = $requirement[Constants::TEXT];
     494            $desc    = $requirement[Constants::DESCRIPTION];
     495            $message = sprintf('%s %s', $text, $desc);
     496
     497            $args[Constants::TYPE] = $requirement[Constants::TYPE] ?? ($args[Constants::TYPE] ?? 'warning');
     498
     499            if ($echo) {
     500
     501                if ($requirement['show']) {
     502
     503                    $this->getHelper()->getHTML()->renderNotice($message, $args);
     504                } else {
     505
     506                    unset($requirements[$index]);
     507                }
     508            } else {
     509
     510                $requirements[$index][Constants::TEXT] = $this->getHelper()->getHTML()->createNotice($message, $args);
     511            }
     512        }
     513
     514        return $requirements;
     515    }
     516
     517    /**
     518     * @return string
     519     */
     520    public function getCommonsNotice(): string
     521    {
     522        $link = $this->getHelper()->getHTML()->createElement('a', [
     523            'href' => apply_filters('pmpr_plugin_commons_url', ''),
     524        ], __('here', PR__PLG__PMPR));
     525
     526        return sprintf(__('Please install commons from %s.', PR__PLG__PMPR), $link);
    431527    }
    432528}
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Helper/HTML.php

    r3145930 r3154429  
    22
    33namespace Pmpr\Plugin\Pmpr\Helper;
     4
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    46
    57/**
     
    209211
    210212            $allowAttrs = [
    211                 self::ID   => [],
     213                Constants::ID   => [],
    212214                'data'     => [],
    213215                'style'    => [],
     
    364366    {
    365367        $args = $this->getHelper()->getType()->parseArgs($args, [
    366             self::JOB     => '',
    367             self::TYPE    => '',
    368             self::SLUG    => '',
    369             self::NAME    => '',
    370             self::ATTRS   => [],
    371             self::TITLE   => '',
    372             self::LOADING => false,
    373             self::ELEMENT => 'button',
     368            Constants::JOB     => '',
     369            Constants::TYPE    => '',
     370            Constants::SLUG    => '',
     371            Constants::NAME    => '',
     372            Constants::ATTRS   => [],
     373            Constants::TITLE   => '',
     374            Constants::LOADING => false,
     375            Constants::ELEMENT => 'button',
    374376        ]);
    375377
    376378        $spinner = '';
    377         $context = $this->getHelper()->getServer()->getGet(self::CONTEXT, self::INSTALLED);
     379        $context = $this->getHelper()->getServer()->getGet(Constants::CONTEXT, Constants::INSTALLED);
    378380        $class   = "pr-component-action pr-{$context}-action";
    379381
    380         if ($args[self::LOADING]) {
     382        if ($args[Constants::LOADING]) {
    381383
    382384            $spinner = $this->createSpan('', [
     
    386388        }
    387389
    388         $attrs = $args[self::ATTRS];
     390        $attrs = $args[Constants::ATTRS];
    389391        if (isset($attrs['class'])) {
    390392
     
    396398
    397399        $attrs = array_merge($attrs, [
    398             'data-job'   => $args[self::JOB],
    399             'data-type'  => $args[self::TYPE],
    400             'data-name'  => $args[self::NAME],
    401             'data-slug'  => $args[self::SLUG],
     400            'data-job'   => $args[Constants::JOB],
     401            'data-type'  => $args[Constants::TYPE],
     402            'data-name'  => $args[Constants::NAME],
     403            'data-slug'  => $args[Constants::SLUG],
    402404            'data-nonce' => wp_create_nonce(PR__PLG__PMPR . '_nonce_action'),
    403405        ]);
     
    405407        $attrs = array_filter($attrs);
    406408
    407         $content = $spinner . $this->createSpan($args[self::TITLE], ['class' => 'action-title']);
    408 
    409         return $this->createElement($args[self::ELEMENT], $attrs, $content);
     409        $content = $spinner . $this->createSpan($args[Constants::TITLE], ['class' => 'action-title']);
     410
     411        return $this->createElement($args[Constants::ELEMENT], $attrs, $content);
    410412    }
    411413
     
    420422        $args = $this->getHelper()->getType()->parseArgs($args, [
    421423            'class'         => '',
    422             self::ID        => '',
    423             self::ECHO      => false,
    424             self::TYPE      => 'warning',
    425             self::PREFIX    => __('Pmpr Plugin', PR__PLG__PMPR),
    426             self::CUSTOM    => false,
    427             self::DISMISS   => true,
    428             self::ELEMENT   => 'p',
     424            Constants::ID        => '',
     425            Constants::ECHO      => false,
     426            Constants::TYPE      => 'warning',
     427            Constants::PREFIX    => __('Pmpr Plugin', PR__PLG__PMPR),
     428            Constants::CUSTOM    => false,
     429            Constants::DISMISS   => true,
     430            Constants::ELEMENT   => 'p',
    429431            'element_attrs' => [],
    430432        ]);
    431433
    432         $element = $args[self::ELEMENT];
     434        $element = $args[Constants::ELEMENT];
    433435
    434436        if (is_wp_error($message)) {
     
    493495    public function renderModal(array $args, string $title, array $attrs = [])
    494496    {
    495         $args[self::ECHO] = true;
     497        $args[Constants::ECHO] = true;
    496498
    497499        $this->createModal($args, $title, $attrs);
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Helper/Helper.php

    r3078046 r3154429  
    44
    55use Exception;
     6use Pmpr\Plugin\Pmpr\Setting;
    67
    78/**
     
    6768
    6869    /**
     70     * @return Setting
     71     */
     72    public function getSetting(): Setting
     73    {
     74        return Setting::getInstance();
     75    }
     76
     77    /**
     78     * @return Tool
     79     */
     80    public function getTool(): Tool
     81    {
     82        return $this->getInstance(Tool::class);
     83    }
     84
     85    /**
    6986     * @return File
    7087     */
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Helper/Server.php

    r3140903 r3154429  
    22
    33namespace Pmpr\Plugin\Pmpr\Helper;
     4
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    46
    57/**
     
    190192    public function isPluginPage(): bool
    191193    {
    192         return str_contains($this->getGet('page', ''), self::PLUGIN_PREFIX);
     194        return str_contains($this->getGet('page', ''), Constants::PLUGIN_PREFIX);
     195    }
     196
     197    /**
     198     * @param       $data
     199     * @param bool $success
     200     * @param bool|string $notice
     201     */
     202    public function ajaxResponse($data, bool $success = true, $notice = true)
     203    {
     204        if ($notice && is_string($data)) {
     205
     206            if (is_bool($notice)) {
     207
     208                $notice = $success ? 'success' : 'error';
     209            }
     210
     211            $data = $this->getHelper()->getHTML()->createNotice($data, [
     212                Constants::TYPE => $notice,
     213            ]);
     214        }
     215        if ($success) {
     216
     217            wp_send_json_success($data);
     218        } else {
     219
     220            wp_send_json_error($data);
     221        }
    193222    }
    194223}
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Manager.php

    r3152426 r3154429  
    66use Pmpr\Plugin\Pmpr\Component\Manager\Installer;
    77use Pmpr\Plugin\Pmpr\Container\Container;
     8use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    89use WP_Ajax_Upgrader_Skin;
    910use WP_Error;
     
    7374    public function install(string $component, array $args = [])
    7475    {
    75         $this->updateOption($component, self::INACTIVE, true);
     76        $this->updateOption($component, Constants::INACTIVE, true);
    7677
    7778        $result = true;
     
    112113    public function remove(string $component)
    113114    {
    114         $this->updateOption($component, self::INACTIVE, true);
     115        $this->updateOption($component, Constants::INACTIVE, true);
    115116        return $this->getInstaller()->remove($component);
    116117    }
     
    121122    public function activate(string $component)
    122123    {
    123         $this->updateOption($component, self::ACTIVE);
     124        $this->updateOption($component, Constants::ACTIVE);
    124125        $this->afterChange($component);
    125126    }
     
    130131    public function deactivate(string $component)
    131132    {
    132         $this->updateOption($component, self::INACTIVE);
     133        $this->updateOption($component, Constants::INACTIVE);
    133134        $this->afterChange($component);
    134135    }
     
    184185
    185186                    $data = [
    186                         self::NAME  => $component,
    187                         self::TITLE => $component,
     187                        Constants::NAME  => $component,
     188                        Constants::TITLE => $component,
    188189                    ];
    189190                } else {
     
    195196
    196197                $data               = (array)$data;
    197                 $data[self::STATUS] = $status;
     198                $data[Constants::STATUS] = $status;
    198199                $componentHelper->updateData($component, $data);
    199200            }
     
    213214            if (!is_wp_error($info) && !empty($info[$versionKey]) && $componentObject->hasUpdate($info[$versionKey])) {
    214215
    215                 $this->fetchAndStoreComponentData($component, [self::NEW_VERSION => $info[$versionKey]]);
     216                $this->fetchAndStoreComponentData($component, [Constants::NEW_VERSION => $info[$versionKey]]);
    216217            }
    217218        }
     
    222223    public function storeUpdates()
    223224    {
    224         update_option(self::UPDATE_COUNT, count($this->getHelper()->getComponent()->getNeedUpdates()));
     225        update_option(Constants::UPDATE_COUNT, count($this->getHelper()->getComponent()->getNeedUpdates()));
    225226    }
    226227
     
    230231    public function fetchAndStoreAPIKey()
    231232    {
    232         if (empty($this->getAPIKey())) {
     233        if (empty($this->getHelper()->getSetting()->getAPIKey())) {
    233234
    234235            $authKey = '';
     
    262263                    if ($fs->put_contents(trailingslashit($rootPath) . $filename, $authKey)) {
    263264
    264                         update_option(self::CONNECTION_AUTH_KEY, $authKey);
     265                        update_option(Constants::CONNECTION_AUTH_KEY, $authKey);
    265266                    }
    266267                } else {
     
    273274                    }
    274275
    275                     if (get_option(self::CONNECTION_AUTH_KEY, '') !== $authKey) {
    276 
    277                         update_option(self::CONNECTION_AUTH_KEY, $authKey);
     276                    if (get_option(Constants::CONNECTION_AUTH_KEY, '') !== $authKey) {
     277
     278                        update_option(Constants::CONNECTION_AUTH_KEY, $authKey);
    278279                    }
    279280                }
     
    335336            if ($componentData && !is_wp_error($fetchedData)) {
    336337
    337                 $extraData[self::STATUS] = $this->getHelper()->getType()->arrayGetItem($componentData, self::STATUS, 'inactive');
     338                $extraData[Constants::STATUS] = $this->getHelper()->getType()->arrayGetItem($componentData, Constants::STATUS, 'inactive');
    338339
    339340                $fetchedData = array_merge((array)$fetchedData, $extraData);
     
    393394
    394395                        $componentData = [
    395                             self::NAME => $componentFile,
     396                            Constants::NAME => $componentFile,
    396397                        ];
    397398                    }
     
    403404                    }
    404405
    405                     $componentData[self::TITLE]       = $title;
    406                     $componentData[self::DESCRIPTION] = $description;
     406                    $componentData[Constants::TITLE]       = $title;
     407                    $componentData[Constants::DESCRIPTION] = $description;
    407408                }
    408409                if ($componentData) {
    409410
    410                     if (!isset($componentData[self::NAME])) {
    411 
    412                         $componentData[self::NAME] = $componentFile;
     411                    if (!isset($componentData[Constants::NAME])) {
     412
     413                        $componentData[Constants::NAME] = $componentFile;
    413414                    }
    414415                    $components[$componentFile] = $componentData;
     
    434435        $typeHelper = $this->getHelper()->getType();
    435436
    436         $aName = $typeHelper->arrayGetItem($a, self::NAME);
    437         $bName = $typeHelper->arrayGetItem($b, self::NAME);
     437        $aName = $typeHelper->arrayGetItem($a, Constants::NAME);
     438        $bName = $typeHelper->arrayGetItem($b, Constants::NAME);
    438439
    439440        return strnatcasecmp($aName, $bName);
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Pmpr.php

    r3142498 r3154429  
    77use Pmpr\Plugin\Pmpr\Component\Update;
    88use Pmpr\Plugin\Pmpr\Container\Container;
     9use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    910use Pmpr\Plugin\Pmpr\REST\REST;
    1011use Pmpr\Plugin\Pmpr\Traits\ManagerTrait;
     
    1819    use ManagerTrait;
    1920
    20     const ACTIVE_COMPONENTS = self::PLUGIN_PREFIX . 'active_components';
     21    const ACTIVE_COMPONENTS = Constants::PLUGIN_PREFIX . 'active_components';
    2122
    2223    /**
     
    3334    public function addActions()
    3435    {
    35         $this->addAction('admin_menu', [$this, 'adminMenu'])
    36              ->addAction('admin_notices', [$this, 'adminNotice'])
    37              ->addAction('plugins_loaded', [$this, 'pluginsLoaded'])
    38              ->addAction('admin_enqueue_scripts', [$this, 'enqueue'])
    39              ->addAction('admin_head', [$this, 'addFontStyle'], 9999);
     36        $this
     37            ->addAction('admin_menu', [$this, 'adminMenu'])
     38            ->addAction('admin_notices', [$this, 'adminNotice'])
     39            ->addAction('plugins_loaded', [$this, 'pluginsLoaded'])
     40            ->addAction('admin_enqueue_scripts', [$this, 'enqueue'])
     41            ->addAction('admin_head', [$this, 'addFontStyle'], 9999)
     42        ;
    4043    }
    4144
     
    4952    }
    5053
     54    public function getAPIKey()
     55    {
     56        return $this->getHelper()->getSetting()->getAPIKey();
     57    }
     58
    5159    public function loadRequirement()
    5260    {
    53         REST::getInstance();
    54         Setting::getInstance();
    5561        Component::getInstance();
    5662        if (is_admin()) {
    5763
    58             Ajax::getInstance();
    59             Asset::getInstance();
     64            Setting::getInstance();
     65            if ($this->getHelper()->getTool()->isAjax()) {
     66                Ajax::getInstance();
     67            } else {
     68                Asset::getInstance();
     69            }
     70            if (wp_is_rest_endpoint()) {
     71                REST::getInstance();
     72            }
    6073        }
    6174
     
    6376        $filepath   = $fileHelper->getPath('/vendor/woocommerce/action-scheduler/action-scheduler.php');
    6477        if ($fileHelper->exists($filepath)) {
    65 
    6678            require_once $filepath;
    6779        }
     
    137149
    138150                        $HTMLHelper->renderTemplate('setting/remote/side', [
    139                             'url'           => $this->getPMPRBaseURL(),
     151                            'url'           => $this->getHelper()->getTool()->getPMPRBaseURL(),
    140152                            'logo'          => $logo,
    141153                            'items'         => $badges,
    142                             'title'         => $typeHelper->arrayGetItem($side, self::TITLE),
     154                            'title'         => $typeHelper->arrayGetItem($side, Constants::TITLE),
    143155                            'stackoverflow' => $stackoverflow,
    144156                        ]);
     
    147159                }
    148160
    149                 if ($title = $typeHelper->arrayGetItem($remoteTab, self::TITLE)) {
     161                if ($title = $typeHelper->arrayGetItem($remoteTab, Constants::TITLE)) {
    150162
    151163                    $tabs['remote-tab'] = [
    152                         self::PRIORITY  => 1,
    153                         self::TITLE     => $title,
    154                         self::FIELDS    => $fields,
    155                         self::SIDEBAR   => $sidebar,
    156                         self::NO_SUBMIT => true,
     164                        Constants::PRIORITY  => 1,
     165                        Constants::TITLE     => $title,
     166                        Constants::FIELDS    => $fields,
     167                        Constants::SIDEBAR   => $sidebar,
     168                        Constants::NO_SUBMIT => true,
    157169                    ];
    158170                }
     
    185197        if (current_user_can('manage_options')) {
    186198
    187             $links[] = $this->getSettingLinkElement(__('Setting', PR__PLG__PMPR));
     199            $links[] = $this->getHelper()->getSetting()->getLinkElement(__('Setting', PR__PLG__PMPR));
    188200        }
    189201
     
    215227    public function adminNotice()
    216228    {
    217         $this->requirementsNotices(true);
     229        $this->getHelper()->getComponent()->requirementsNotices(true);
    218230        $updateInstance = Update::getInstance();
    219231        if (!$updateInstance->isCurrentPage()
     
    231243                ),
    232244                [
    233                     self::ID   => 'update_components',
    234                     self::TYPE => 'primary',
     245                    Constants::ID   => 'update_components',
     246                    Constants::TYPE => 'primary',
    235247                ]
    236248            );
     
    286298                if ($componentHelper->isInstalled($component)) {
    287299
    288                     $componentHelper->changeStatus($component, self::ACTIVE);
    289                 }
    290             }
    291         }
    292 
    293         delete_transient(self::FETCHED_REQUIRED_COMPONENTS);
     300                    $componentHelper->changeStatus($component, Constants::ACTIVE);
     301                }
     302            }
     303        }
     304
     305        delete_transient(Constants::FETCHED_REQUIRED_COMPONENTS);
    294306
    295307        $this->getManager()->fetchAndStoreAPIKey();
     
    299311    {
    300312        $types = [
    301             self::MDL,
    302             self::CVR,
    303             self::CST,
     313            Constants::MDL,
     314            Constants::CVR,
     315            Constants::CST,
    304316        ];
    305317
     
    311323            foreach ($components as $component) {
    312324
    313                 if ($componentHelper->changeStatus($component, self::INACTIVE)) {
     325                if ($componentHelper->changeStatus($component, Constants::INACTIVE)) {
    314326
    315327                    $activeComponents[] = $component;
     
    320332        update_option(self::ACTIVE_COMPONENTS, $activeComponents);
    321333
    322         delete_transient(self::FETCHED_REQUIRED_COMPONENTS);
     334        delete_transient(Constants::FETCHED_REQUIRED_COMPONENTS);
    323335    }
    324336
    325337    public function adminMenu()
    326338    {
    327         $count = $this->applyFilters('pmpr_components_update_count', 0);
     339        $count = $this->getHelper()->getComponent()->getUpdateCount();
    328340        $title = sprintf("%s %s", __('Pmpr', PR__PLG__PMPR), $this->getHelper()->getHTML()->createBubbleNotification($count));
    329341        add_menu_page($title, $title, 'manage_options', PR__PLG__PMPR, null, $this->getLogoIcon(), 0);
     
    344356        if ($font = $this->getFontURL()) {
    345357
    346             $handle = self::PLUGIN_PREFIX . '-admin-font';
     358            $handle = Constants::PLUGIN_PREFIX . '-admin-font';
    347359            wp_register_style($handle, $font);
    348360            wp_enqueue_style($handle);
     
    380392    public function getFontName()
    381393    {
    382         return $this->getSettingOption(Setting::ADMIN_FONT, 'Vazir');
     394        return $this->getHelper()->getSetting()->getOption(Setting::ADMIN_FONT, 'Vazir');
    383395    }
    384396
     
    388400    public function getFontURL()
    389401    {
    390         $font = $this->getSettingObject()->getFonts($this->getFontName());
     402        $font = $this->getHelper()->getSetting()->getFonts($this->getFontName());
    391403        if (!is_string($font)) {
    392404
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Queue.php

    r3078046 r3154429  
    88use Exception;
    99use Pmpr\Plugin\Pmpr\Container\Container;
     10use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    1011
    1112/**
     
    8788            // TODO: When v3.3.0 from Action Scheduler is commonly used use the array notation for status to reduce search queries to one.
    8889            $pendingActions = $this->search([
    89                 self::HOOK   => $hook,
    90                 self::STATUS => self::PENDING,
    91             ], self::IDS);
     90                Constants::HOOK   => $hook,
     91                Constants::STATUS => Constants::PENDING,
     92            ], Constants::IDS);
    9293
    9394            if (1 < count($pendingActions)) {
     
    9899
    99100            $runningActions = $this->search([
    100                 self::HOOK   => $hook,
    101                 self::STATUS => self::IN_PROGRESS,
    102             ], self::IDS);
     101                Constants::HOOK   => $hook,
     102                Constants::STATUS => Constants::IN_PROGRESS,
     103            ], Constants::IDS);
    103104
    104105            if (1 === count($pendingActions) + count($runningActions)) {
     
    155156        $query = [
    156157            'hook'     => $hook,
    157             'status'   => self::PENDING,
     158            'status'   => Constants::PENDING,
    158159            'group'    => $this->getGroup(),
    159160            'orderby'  => 'none',
     
    327328    public function exists(array $args): bool
    328329    {
    329         $rowFound = $this->search($args, self::IDS);
     330        $rowFound = $this->search($args, Constants::IDS);
    330331
    331332        return count($rowFound) > 0;
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/REST/Controller.php

    r3078042 r3154429  
    33namespace Pmpr\Plugin\Pmpr\REST;
    44
    5 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
     5use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    66use Pmpr\Plugin\Pmpr\Traits\APITrait;
    7 use Pmpr\Plugin\Pmpr\Traits\CommonTrait;
    87use Pmpr\Plugin\Pmpr\Traits\HelperTrait;
    98use Pmpr\Plugin\Pmpr\Traits\ManagerTrait;
    10 use Pmpr\Plugin\Pmpr\Traits\SettingTrait;
    119use WP_Error;
    1210use WP_HTTP_Response;
     
    2018 * @package Pmpr\Plugin\Pmpr\REST
    2119 */
    22 class Controller extends WP_REST_Controller implements ConstantInterface
     20class Controller extends WP_REST_Controller
    2321{
    2422    use APITrait,
    25         CommonTrait,
    2623        HelperTrait,
    27         ManagerTrait,
    28         SettingTrait;
     24        ManagerTrait;
    2925
    3026    public function __construct()
     
    4339    {
    4440        $args = wp_parse_args($args, [
    45             self::ARGS                => [],
    46             self::METHODS             => WP_REST_Server::READABLE,
    47             self::PERMISSION_CALLBACK => [$this, 'permissionCheck'],
     41            Constants::ARGS                => [],
     42            Constants::METHODS             => WP_REST_Server::READABLE,
     43            Constants::PERMISSION_CALLBACK => [$this, 'permissionCheck'],
    4844        ]);
    4945
     
    5450    {
    5551        $this->register('push-update', [
    56             self::ARGS     => [],
    57             self::METHODS  => WP_REST_Server::CREATABLE,
    58             self::CALLBACK => [$this, 'pushUpdate']
     52            Constants::ARGS     => [],
     53            Constants::METHODS  => WP_REST_Server::CREATABLE,
     54            Constants::CALLBACK => [$this, 'pushUpdate']
    5955        ]);
    6056    }
     
    6763    public function pushUpdate(WP_REST_Request $request)
    6864    {
    69         $token     = $request->get_param('token');
    70         $version   = $request->get_param(self::VERSION);
    71         $component = $request->get_param(self::COMPONENT);
    72         if ($token && $component && $version) {
    73 
    74             if ($token === $this->getAPIKey()) {
    75 
    76                 $componentHelper = $this->getHelper()->getComponent();
    77 
    78                 if ($componentHelper->isInstalled($component)) {
    79 
    80                     $component = $componentHelper->getData($component);
    81                     if (version_compare($component[self::VERSION] ?? '', $version, '<')) {
    82 
    83                         if ($this->getManager()->update($component, $message, $version)) {
    84 
    85                             $response = $this->successResponse(__('Your request is ok.', PR__PLG__PMPR));
    86                         } else {
    87 
    88                             $response = $this->wpError(sprintf(__('Something wrong on install update for %s: %s', PR__PLG__PMPR), $component, $message), 'Error');
    89                         }
    90                     } else {
    91 
    92                         $response = $this->wpError(sprintf(__('Version %s or higher version already installed.', PR__PLG__PMPR), $version), 'Already Installed');
    93                     }
    94                 } else {
    95 
    96                     $response = $this->wpError(sprintf(__('%s not installed in %s', PR__PLG__PMPR), $component, get_home_url()), 'Bad Request');
    97                 }
    98             } else {
    99 
    100                 $response = $this->wpError(__('Your request is not valid.', PR__PLG__PMPR), 'Request Denied');
    101             }
    102         } else {
    103 
    104             $response = $this->wpError(__('Require parameters missing.', PR__PLG__PMPR), 'Bad Request');
    105         }
     65//        $token     = $request->get_param('token');
     66//        $version   = $request->get_param(Constants::VERSION);
     67//        $component = $request->get_param(Constants::COMPONENT);
     68//        if ($token && $component && $version) {
     69//
     70//            if ($token === $this->getAPIKey()) {
     71//
     72//                $componentHelper = $this->getHelper()->getComponent();
     73//
     74//                if ($componentHelper->isInstalled($component)) {
     75//
     76//                    $component = $componentHelper->getData($component);
     77//                    if (version_compare($component[Constants::VERSION] ?? '', $version, '<')) {
     78//
     79//                        if ($this->getManager()->updateAll()) {
     80//
     81//                            $response = $this->successResponse(__('Your request is ok.', PR__PLG__PMPR));
     82//                        } else {
     83//
     84//                            $response = $this->wpError(sprintf(__('Something wrong on install update for %s: %s', PR__PLG__PMPR), $component, $message), 'Error');
     85//                        }
     86//                    } else {
     87//
     88//                        $response = $this->wpError(sprintf(__('Version %s or higher version already installed.', PR__PLG__PMPR), $version), 'Already Installed');
     89//                    }
     90//                } else {
     91//
     92//                    $response = $this->wpError(sprintf(__('%s not installed in %s', PR__PLG__PMPR), $component, get_home_url()), 'Bad Request');
     93//                }
     94//            } else {
     95//
     96//                $response = $this->wpError(__('Your request is not valid.', PR__PLG__PMPR), 'Request Denied');
     97//            }
     98//        } else {
     99//
     100//            $response = $this->wpError(__('Require parameters missing.', PR__PLG__PMPR), 'Bad Request');
     101//        }
     102        $response = $this->getHelper()->getTool()->wpError(__('it\'s deprecated.', PR__PLG__PMPR), 'deprecated');
    106103
    107104        return rest_ensure_response($response);
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Setting.php

    r3140039 r3154429  
    44
    55use Pmpr\Plugin\Pmpr\Container\Container;
     6use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    67use WP_Error;
    78
     
    1718    const CONTACT = 'contact';
    1819
    19     const SETTING_KEY = self::PLUGIN_PREFIX . 'settings';
     20    const SETTING_KEY = Constants::PLUGIN_PREFIX . 'settings';
    2021    const APIKEY = 'apikey';
    2122    const ADMIN_FONT = 'admin_font';
     
    3031     */
    3132    public array $success = [];
     33
     34    /**
     35     * @var array
     36     */
     37    protected array $options = [];
    3238
    3339    public function __construct()
     
    7581    private function showNotice(array $messages, string $type = 'warning')
    7682    {
    77         $this->getHelper()->getHTML()->renderNotice($messages, [self::TYPE => $type]);
     83        $this->getHelper()->getHTML()->renderNotice($messages, [Constants::TYPE => $type]);
    7884    }
    7985
     
    117123                                if ($value) {
    118124
    119                                     if (!$this->isRequirementsSatisfied(false)) {
     125                                    if (!$this->getHelper()->getComponent()->isRequirementsSatisfied(false)) {
    120126
    121127                                        $this->getError()->add('requirements_not_satisfied', __('Requirements not satisfied', PR__PLG__PMPR));
     
    157163        $tab    = $this->getCurrentTab();
    158164        $fields = [];
    159         if ($tab && isset($tab[self::FIELDS])) {
    160 
    161             $fields = $tab[self::FIELDS];
     165        if ($tab && isset($tab[Constants::FIELDS])) {
     166
     167            $fields = $tab[Constants::FIELDS];
    162168        }
    163169
     
    172178        $serverHelper = $this->getHelper()->getServer();
    173179
    174         $tab  = $serverHelper->getGet(self::TAB);
     180        $tab  = $serverHelper->getGet(Constants::TAB);
    175181        $tabs = $this->getTabs();
    176182        if (!$tab) {
    177183
    178             $tab = $serverHelper->getPost(self::TAB);
     184            $tab = $serverHelper->getPost(Constants::TAB);
    179185        }
    180186        if (!$tab || !isset($tabs[$tab])) {
     
    184190
    185191        $current           = $tabs[$tab];
    186         $current[self::ID] = $tab;
     192        $current[Constants::ID] = $tab;
    187193
    188194        return $current;
     
    197203        $tabs       = [
    198204            self::GENERAL => [
    199                 self::PRIORITY => 10,
    200                 self::TITLE    => __('General', PR__PLG__PMPR),
    201                 self::FIELDS   => [
     205                Constants::PRIORITY => 10,
     206                Constants::TITLE    => __('General', PR__PLG__PMPR),
     207                Constants::FIELDS   => [
    202208                    self::APIKEY                      => [
    203209                        'type'  => 'text',
     
    225231            ],
    226232            self::CONTACT => [
    227                 self::PRIORITY  => 20,
    228                 self::TITLE     => __('Contact', PR__PLG__PMPR),
    229                 self::FIELDS    => [
     233                Constants::PRIORITY  => 20,
     234                Constants::TITLE     => __('Contact', PR__PLG__PMPR),
     235                Constants::FIELDS    => [
    230236                    'contact'  => [
    231237                        'label' => __('Contact US', PR__PLG__PMPR),
    232238                        'html'  => $HTMLHelper->createElement('a', [
    233                             'href'   => $this->getPMPRBaseURL('contact'),
     239                            'href'   => $this->getHelper()->getTool()->getPMPRBaseURL('contact'),
    234240                            'class'  => 'button',
    235241                            'target' => '_blank',
     
    253259                    ],
    254260                ],
    255                 self::NO_SUBMIT => true,
     261                Constants::NO_SUBMIT => true,
    256262            ],
    257263        ];
     
    266272        if ($tab) {
    267273
    268             foreach ($tab[self::FIELDS] as $field => $args) {
     274            foreach ($tab[Constants::FIELDS] as $field => $args) {
    269275
    270276                if ($args) {
    271277
    272                     $args[self::VALUE] = $this->getValue($field);
    273 
    274                     $tab[self::FIELDS][$field] = $args;
     278                    $args[Constants::VALUE] = $this->getValue($field);
     279
     280                    $tab[Constants::FIELDS][$field] = $args;
    275281                }
    276282            }
     
    279285        $HTMLHelper = $this->getHelper()->getHTML();
    280286
    281         $tabs = $this->getHelper()->getType()->arraySort($tabs, self::PRIORITY);
     287        $tabs = $this->getHelper()->getType()->arraySort($tabs, Constants::PRIORITY);
    282288
    283289        $HTMLHelper->renderTemplate('setting/index', [
    284290            'tabs'    => $tabs,
    285             self::ID  => self::SETTING_KEY,
     291            Constants::ID  => self::SETTING_KEY,
    286292            'current' => $tab,
    287293        ]);
     
    361367    public function getOptions(): array
    362368    {
    363         $options = wp_cache_get(self::SETTING_KEY, 'setting');
    364         if (!$options) {
    365 
    366             $options = get_option(self::SETTING_KEY, []);
    367             if ($options) {
    368 
    369                 $options = maybe_unserialize($options);
    370                 wp_cache_set(self::SETTING_KEY, $options, 'setting');
     369        if (empty($this->options)) {
     370
     371            $options = wp_cache_get(self::SETTING_KEY, 'setting');
     372            if (!$options) {
     373
     374                $options = get_option(self::SETTING_KEY, []);
     375                if ($options) {
     376
     377                    $options = maybe_unserialize($options);
     378                    wp_cache_set(self::SETTING_KEY, $options, 'setting');
     379                }
    371380            }
    372         }
    373 
    374         return (array)$options;
     381            if(is_array($options)) {
     382                $this->options = $options;
     383            }
     384        }
     385
     386        return $this->options;
    375387    }
    376388
     
    396408    public function isSettingPage(): bool
    397409    {
    398         return $this->getHelper()->getServer()->getGet(self::PAGE, '') === self::SETTING_KEY;
     410        return $this->getHelper()->getServer()->getGet(Constants::PAGE, '') === self::SETTING_KEY;
    399411    }
    400412
     
    407419    {
    408420        $args = [
    409             self::PAGE => self::SETTING_KEY,
     421            Constants::PAGE => self::SETTING_KEY,
    410422        ];
    411423        if ($tab) {
    412424
    413             $args[self::TAB] = $tab;
     425            $args[Constants::TAB] = $tab;
    414426        }
    415427
     
    474486        return $fonts;
    475487    }
     488
     489    /**
     490     * @param $apikey
     491     *
     492     * @return bool|string
     493     */
     494    public function getAPIKey($apikey = '')
     495    {
     496        $apikey = (string)$this->getOption(self::APIKEY, $apikey);
     497
     498        if ($apikey && strlen($apikey) !== Constants::APIKEY_LENGTH) {
     499
     500            $apikey = false;
     501        }
     502        return $apikey;
     503    }
     504
     505    /**
     506     * @param string $text
     507     * @param string $tab
     508     * @param array $attrs
     509     *
     510     * @return string
     511     */
     512    public function getLinkElement(string $text, string $tab = '', array $attrs = []): string
     513    {
     514        $attrs['href']  = $this->getPageURL($tab);
     515        $attrs['class'] = 'text-decoration-none';
     516        return $this->getHelper()->getHTML()->createElement('a', $attrs, $text);
     517    }
    476518}
  • pmpr-ir/trunk/template/modal.php

    r3078042 r3154429  
    11<?php
    22
    3 use Pmpr\Plugin\Pmpr\Interfaces\ConstantInterface;
     3use Pmpr\Plugin\Pmpr\Interfaces\Constants;
    44
    55if (!defined('ABSPATH')) {
     
    4040                            } else if (is_array($step)) {
    4141
    42                                 $template = $step[ConstantInterface::TEMPLATE] ?? '';
     42                                $template = $step[Constants::TEMPLATE] ?? '';
    4343                                if ($template) {
    4444
     
    4646                                } else {
    4747
    48                                     $content = $step[ConstantInterface::CONTENT] ?? '';
     48                                    $content = $step[Constants::CONTENT] ?? '';
    4949                                }
    5050
    51                                 $image = $step[ConstantInterface::IMAGE] ?? '';
     51                                $image = $step[Constants::IMAGE] ?? '';
    5252                                if ($image) {
    5353
     
    6060                                }
    6161
    62                                 $title = $step[ConstantInterface::TITLE] ?? '';
     62                                $title = $step[Constants::TITLE] ?? '';
    6363                                if ($title) {
    6464
  • pmpr-ir/trunk/vendor/composer/autoload_classmap.php

    r3140903 r3154429  
    4848    'Pmpr\\Plugin\\Pmpr\\Helper\\Hook' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Helper/Hook.php',
    4949    'Pmpr\\Plugin\\Pmpr\\Helper\\Server' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Helper/Server.php',
     50    'Pmpr\\Plugin\\Pmpr\\Helper\\Tool' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Helper/Tool.php',
    5051    'Pmpr\\Plugin\\Pmpr\\Helper\\Type' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Helper/Type.php',
    51     'Pmpr\\Plugin\\Pmpr\\Interfaces\\ConstantInterface' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Interfaces/ConstantInterface.php',
     52    'Pmpr\\Plugin\\Pmpr\\Interfaces\\Constants' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Interfaces/Constants.php',
    5253    'Pmpr\\Plugin\\Pmpr\\Manager' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Manager.php',
    5354    'Pmpr\\Plugin\\Pmpr\\Pmpr' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Pmpr.php',
     
    5758    'Pmpr\\Plugin\\Pmpr\\Setting' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Setting.php',
    5859    'Pmpr\\Plugin\\Pmpr\\Traits\\APITrait' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Traits/APITrait.php',
    59     'Pmpr\\Plugin\\Pmpr\\Traits\\CommonTrait' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Traits/CommonTrait.php',
    6060    'Pmpr\\Plugin\\Pmpr\\Traits\\HelperTrait' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Traits/HelperTrait.php',
    6161    'Pmpr\\Plugin\\Pmpr\\Traits\\HookTrait' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Traits/HookTrait.php',
    6262    'Pmpr\\Plugin\\Pmpr\\Traits\\ManagerTrait' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Traits/ManagerTrait.php',
    63     'Pmpr\\Plugin\\Pmpr\\Traits\\SettingTrait' => $baseDir . '/src/Pmpr/Plugin/Pmpr/Traits/SettingTrait.php',
    6463);
  • pmpr-ir/trunk/vendor/composer/autoload_static.php

    r3140903 r3154429  
    6363        'Pmpr\\Plugin\\Pmpr\\Helper\\Hook' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Helper/Hook.php',
    6464        'Pmpr\\Plugin\\Pmpr\\Helper\\Server' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Helper/Server.php',
     65        'Pmpr\\Plugin\\Pmpr\\Helper\\Tool' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Helper/Tool.php',
    6566        'Pmpr\\Plugin\\Pmpr\\Helper\\Type' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Helper/Type.php',
    66         'Pmpr\\Plugin\\Pmpr\\Interfaces\\ConstantInterface' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Interfaces/ConstantInterface.php',
     67        'Pmpr\\Plugin\\Pmpr\\Interfaces\\Constants' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Interfaces/Constants.php',
    6768        'Pmpr\\Plugin\\Pmpr\\Manager' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Manager.php',
    6869        'Pmpr\\Plugin\\Pmpr\\Pmpr' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Pmpr.php',
     
    7273        'Pmpr\\Plugin\\Pmpr\\Setting' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Setting.php',
    7374        'Pmpr\\Plugin\\Pmpr\\Traits\\APITrait' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Traits/APITrait.php',
    74         'Pmpr\\Plugin\\Pmpr\\Traits\\CommonTrait' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Traits/CommonTrait.php',
    7575        'Pmpr\\Plugin\\Pmpr\\Traits\\HelperTrait' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Traits/HelperTrait.php',
    7676        'Pmpr\\Plugin\\Pmpr\\Traits\\HookTrait' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Traits/HookTrait.php',
    7777        'Pmpr\\Plugin\\Pmpr\\Traits\\ManagerTrait' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Traits/ManagerTrait.php',
    78         'Pmpr\\Plugin\\Pmpr\\Traits\\SettingTrait' => __DIR__ . '/../..' . '/src/Pmpr/Plugin/Pmpr/Traits/SettingTrait.php',
    7978    );
    8079
  • pmpr-ir/trunk/vendor/composer/installed.php

    r3152426 r3154429  
    11<?php return array(
    22    'root' => array(
    3         'pretty_version' => '1.3.8',
    4         'version' => '1.3.8.0',
     3        'pretty_version' => '1.4.0',
     4        'version' => '1.4.0.0',
    55        'type' => 'project',
    66        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'pmpr/wp-plg-pmpr' => array(
    14             'pretty_version' => '1.3.8',
    15             'version' => '1.3.8.0',
     14            'pretty_version' => '1.4.0',
     15            'version' => '1.4.0.0',
    1616            'type' => 'project',
    1717            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.