Plugin Directory

Changeset 3310464


Ignore:
Timestamp:
06/12/2025 11:31:26 AM (10 months ago)
Author:
ZanderZ
Message:

Update to version 6.3.6 from GitHub

Location:
recras
Files:
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • recras/tags/6.3.6/changelog.md

    r3306911 r3310464  
    11# Changelog
     2
     3## 6.3.6 (2025-06-12)
     4* Fix errors when using WP CLI for certain things
    25
    36## 6.3.5 (2025-06-05)
  • recras/tags/6.3.6/readme.txt

    r3306911 r3310464  
    33Tags: recras, recreation, reservation, booking, voucher
    44Tested up to: 6.8
    5 Stable tag: 6.3.5
     5Stable tag: 6.3.6
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7575== Changelog ==
    7676
     77= 6.3.6 =
     78* Fix errors when using WP CLI for certain things
     79
    7780= 6.3.5 =
    7881* Fix warning when using PHP 8.4
  • recras/tags/6.3.6/recras-wordpress-plugin.php

    r3306911 r3310464  
    33Plugin Name: Recras WordPress Plugin
    44Plugin URI: https://www.recras.nl/
    5 Version: 6.3.5
     5Version: 6.3.6
    66Description: Easily integrate your Recras data into your own site
    77Requires at least: 6.6
  • recras/tags/6.3.6/src/Arrangement.php

    r3217607 r3310464  
    9696    public static function clearCache(): int
    9797    {
    98         global $recrasPlugin;
    99 
    10098        $subdomain = get_option('recras_subdomain');
    10199        $errors = 0;
     
    104102        foreach ($packages as $id) {
    105103            $name = $subdomain . '_arrangement_' . $id;
    106             if ($recrasPlugin->transients->get($name)) {
    107                 $errors += $recrasPlugin->transients->delete($name);
    108             }
    109         }
    110         $errors += $recrasPlugin->transients->delete($subdomain . '_arrangements');
     104            if (Transient::get($name)) {
     105                $errors += Transient::delete($name);
     106            }
     107        }
     108        $errors += Transient::delete($subdomain . '_arrangements');
    111109
    112110        return $errors;
     
    238236    public static function getPackages(string $subdomain, bool $onlyOnline = false, bool $includeEmpty = true)
    239237    {
    240         global $recrasPlugin;
    241 
    242         $json = $recrasPlugin->transients->get($subdomain . '_arrangements');
     238        $json = Transient::get($subdomain . '_arrangements');
    243239        if ($json === false) {
    244240            try {
     
    247243                return $e->getMessage();
    248244            }
    249             $recrasPlugin->transients->set($subdomain . '_arrangements', $json);
     245            Transient::set($subdomain . '_arrangements', $json);
    250246        }
    251247
     
    364360    public static function getPackage(string $subdomain, int $id)
    365361    {
    366         global $recrasPlugin;
    367 
    368         $json = $recrasPlugin->transients->get($subdomain . '_arrangement_' . $id);
     362        $json = Transient::get($subdomain . '_arrangement_' . $id);
    369363        if ($json === false) {
    370364            try {
     
    373367                return $e->getMessage();
    374368            }
    375             $recrasPlugin->transients->set($subdomain . '_arrangement_' . $id, $json);
     369            Transient::set($subdomain . '_arrangement_' . $id, $json);
    376370        }
    377371        return $json;
  • recras/tags/6.3.6/src/Bookprocess.php

    r3268913 r3310464  
    1111    public static function clearCache(): int
    1212    {
    13         global $recrasPlugin;
    14 
    1513        $subdomain = get_option('recras_subdomain');
    16         return $recrasPlugin->transients->delete($subdomain . '_bookprocesses_v2');
     14        return Transient::delete($subdomain . '_bookprocesses_v2');
    1715    }
    1816
     
    3836    public static function getProcesses(string $subdomain)
    3937    {
    40         global $recrasPlugin;
    41 
    42         $json = $recrasPlugin->transients->get($subdomain . '_bookprocesses_v2');
     38        $json = Transient::get($subdomain . '_bookprocesses_v2');
    4339        if ($json === false) {
    4440            try {
     
    4743                return $e->getMessage();
    4844            }
    49             $recrasPlugin->transients->set($subdomain . '_bookprocesses_v2', $json);
     45            Transient::set($subdomain . '_bookprocesses_v2', $json);
    5046        }
    5147
  • recras/tags/6.3.6/src/ContactForm.php

    r3217607 r3310464  
    2626    public static function getForm(string $subdomain, int $id)
    2727    {
    28         global $recrasPlugin;
    29 
    30         $form = $recrasPlugin->transients->get($subdomain . '_contactform_' . $id . '_v2');
     28        $form = Transient::get($subdomain . '_contactform_' . $id . '_v2');
    3129        if ($form === false) {
    3230            try {
     
    3836                return $form->message;
    3937            }
    40             $recrasPlugin->transients->set($subdomain . '_contactform_' . $id . '_v2', $form);
     38            Transient::set($subdomain . '_contactform_' . $id . '_v2', $form);
    4139        }
    4240        return $form;
     
    151149    public static function clearCache(): int
    152150    {
    153         global $recrasPlugin;
    154 
    155151        $subdomain = get_option('recras_subdomain');
    156152        $errors = 0;
     
    160156            $errors += self::deleteTransients($subdomain, $id);
    161157        }
    162         if ($recrasPlugin->transients->get($subdomain . '_contactforms')) {
    163             $errors += $recrasPlugin->transients->delete($subdomain . '_contactforms');
     158        if (Transient::get($subdomain . '_contactforms')) {
     159            $errors += Transient::delete($subdomain . '_contactforms');
    164160        }
    165161
     
    173169    private static function deleteTransients(string $subdomain, int $formID): int
    174170    {
    175         global $recrasPlugin;
    176 
    177171        $errors = 0;
    178172
    179173        $name = $subdomain . '_contactform_' . $formID . '_v2';
    180         if ($recrasPlugin->transients->get($name)) {
    181             $errors += $recrasPlugin->transients->delete($name);
     174        if (Transient::get($name)) {
     175            $errors += Transient::delete($name);
    182176        }
    183177
     
    635629    public static function getForms(string $subdomain)
    636630    {
    637         global $recrasPlugin;
    638 
    639         $json = $recrasPlugin->transients->get($subdomain . '_contactforms');
     631        $json = Transient::get($subdomain . '_contactforms');
    640632        if ($json === false) {
    641633            try {
     
    644636                return $e->getMessage();
    645637            }
    646             $recrasPlugin->transients->set($subdomain . '_contactforms', $json);
     638            Transient::set($subdomain . '_contactforms', $json);
    647639        }
    648640
  • recras/tags/6.3.6/src/Plugin.php

    r3306911 r3310464  
    1616    {
    1717        $this->setBaseUrl();
    18         $this->transients = new Transient();
    1918
    2019        // Needs to run before: Gutenberg::addBlocks, self::loadAdminScripts
     
    144143        }
    145144
    146         $setting = $this->transients->get($subdomain . '_show_old_online_booking');
     145        $setting = Transient::get($subdomain . '_show_old_online_booking');
    147146        if ($setting === false) {
    148147            try {
     
    152151            }
    153152            if (is_object($setting) && property_exists($setting, 'waarde')) {
    154                 $this->transients->set($subdomain . '_show_old_online_booking', $setting->waarde, DAY_IN_SECONDS);
    155             }
    156         }
    157 
    158         $setting = $this->transients->get($subdomain . '_show_old_voucher_sales');
     153                Transient::set($subdomain . '_show_old_online_booking', $setting->waarde, DAY_IN_SECONDS);
     154            }
     155        }
     156
     157        $setting = Transient::get($subdomain . '_show_old_voucher_sales');
    159158        if ($setting === false) {
    160159            try {
     
    164163            }
    165164            if (is_object($setting) && property_exists($setting, 'waarde')) {
    166                 $this->transients->set($subdomain . '_show_old_voucher_sales', $setting->waarde, DAY_IN_SECONDS);
     165                Transient::set($subdomain . '_show_old_voucher_sales', $setting->waarde, DAY_IN_SECONDS);
    167166            }
    168167        }
  • recras/tags/6.3.6/src/Products.php

    r3217607 r3310464  
    7878    public static function clearCache(): int
    7979    {
    80         global $recrasPlugin;
    81 
    8280        $subdomain = get_option('recras_subdomain');
    8381        $errors = 0;
    84         if ($recrasPlugin->transients->get($subdomain . '_products_v2')) {
    85             $errors = $recrasPlugin->transients->delete($subdomain . '_products_v2');
     82        if (Transient::get($subdomain . '_products_v2')) {
     83            $errors = Transient::delete($subdomain . '_products_v2');
    8684        }
    8785
     
    125123    public static function getProducts(string $subdomain)
    126124    {
    127         global $recrasPlugin;
    128 
    129         $json = $recrasPlugin->transients->get($subdomain . '_products_v2');
     125        $json = Transient::get($subdomain . '_products_v2');
    130126        if ($json === false) {
    131127            try {
     
    135131            }
    136132
    137             $recrasPlugin->transients->set($subdomain . '_products_v2', $json);
     133            Transient::set($subdomain . '_products_v2', $json);
    138134        }
    139135
  • recras/tags/6.3.6/src/Settings.php

    r3250273 r3310464  
    115115    public static function allowOnlinePackageBooking(): bool
    116116    {
    117         global $recrasPlugin;
    118 
    119117        $subdomain = get_option('recras_subdomain');
    120118        if (!$subdomain) {
    121119            return true;
    122120        }
    123         $setting = $recrasPlugin->transients->get($subdomain . '_show_old_online_booking');
     121        $setting = Transient::get($subdomain . '_show_old_online_booking');
    124122        // if getting the transient fails, we want to show the button to be sure, so comparing with 'no' is safest
    125123        return ($setting === 'no') ? false : true;
     
    129127    public static function allowOldVoucherSales(): bool
    130128    {
    131         global $recrasPlugin;
    132 
    133129        $subdomain = get_option('recras_subdomain');
    134130        if (!$subdomain) {
    135131            return true;
    136132        }
    137         $setting = $recrasPlugin->transients->get($subdomain . '_show_old_voucher_sales');
     133        $setting = Transient::get($subdomain . '_show_old_voucher_sales');
    138134        // if getting the transient fails, we want to show the button to be sure, so comparing with 'no' is safest
    139135        return ($setting === 'no') ? false : true;
     
    145141    public static function clearCache(): int
    146142    {
    147         global $recrasPlugin;
    148 
    149143        $subdomain = get_option('recras_subdomain');
    150144        $errors = 0;
    151         if ($recrasPlugin->transients->get($subdomain . '_show_old_online_booking')) {
    152             $errors = $recrasPlugin->transients->delete($subdomain . '_show_old_online_booking');
    153         }
    154         if ($recrasPlugin->transients->get($subdomain . '_show_old_voucher_sales')) {
    155             $errors = $recrasPlugin->transients->delete($subdomain . '_show_old_voucher_sales');
     145        if (Transient::get($subdomain . '_show_old_online_booking')) {
     146            $errors = Transient::delete($subdomain . '_show_old_online_booking');
     147        }
     148        if (Transient::get($subdomain . '_show_old_voucher_sales')) {
     149            $errors = Transient::delete($subdomain . '_show_old_voucher_sales');
    156150        }
    157151
  • recras/tags/6.3.6/src/Transient.php

    r3221428 r3310464  
    99     * Delete a transient. Returns 0 for success/not existing, 1 for error for easy error counting
    1010     */
    11     public function delete(string $name): int
     11    public static function delete(string $name): int
    1212    {
    13         if (!$this->get($name)) {
     13        if (!self::get($name)) {
    1414            return 0;
    1515        }
     
    2020     * @return mixed
    2121     */
    22     public function get(string $name)
     22    public static function get(string $name)
    2323    {
    2424        return get_transient(self::BASE . $name);
     
    2626
    2727    // HOUR_IN_SECONDS is defined by WordPress
    28     public function set(string $name, $value, int $expiration = HOUR_IN_SECONDS): bool
     28    public static function set(string $name, $value, int $expiration = HOUR_IN_SECONDS): bool
    2929    {
    3030        return set_transient(self::BASE . $name, $value, $expiration);
  • recras/tags/6.3.6/src/Vouchers.php

    r3268913 r3310464  
    127127    public static function clearCache(): int
    128128    {
    129         global $recrasPlugin;
    130 
    131129        $subdomain = get_option('recras_subdomain');
    132130        $errors = 0;
    133         if ($recrasPlugin->transients->get($subdomain . '_voucher_templates')) {
    134             $errors = $recrasPlugin->transients->delete($subdomain . '_voucher_templates');
     131        if (Transient::get($subdomain . '_voucher_templates')) {
     132            $errors = Transient::delete($subdomain . '_voucher_templates');
    135133        }
    136134
     
    144142    public function getTemplates(string $subdomain): array
    145143    {
    146         global $recrasPlugin;
    147 
    148         $json = $recrasPlugin->transients->get($subdomain . '_voucher_templates');
     144        $json = Transient::get($subdomain . '_voucher_templates');
    149145        if ($json === false) {
    150146            try {
     
    153149                return $e->getMessage();
    154150            }
    155             $recrasPlugin->transients->set($subdomain . '_voucher_templates', $json);
     151            Transient::set($subdomain . '_voucher_templates', $json);
    156152        }
    157153
  • recras/trunk/changelog.md

    r3306911 r3310464  
    11# Changelog
     2
     3## 6.3.6 (2025-06-12)
     4* Fix errors when using WP CLI for certain things
    25
    36## 6.3.5 (2025-06-05)
  • recras/trunk/readme.txt

    r3306911 r3310464  
    33Tags: recras, recreation, reservation, booking, voucher
    44Tested up to: 6.8
    5 Stable tag: 6.3.5
     5Stable tag: 6.3.6
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7575== Changelog ==
    7676
     77= 6.3.6 =
     78* Fix errors when using WP CLI for certain things
     79
    7780= 6.3.5 =
    7881* Fix warning when using PHP 8.4
  • recras/trunk/recras-wordpress-plugin.php

    r3306911 r3310464  
    33Plugin Name: Recras WordPress Plugin
    44Plugin URI: https://www.recras.nl/
    5 Version: 6.3.5
     5Version: 6.3.6
    66Description: Easily integrate your Recras data into your own site
    77Requires at least: 6.6
  • recras/trunk/src/Arrangement.php

    r3217607 r3310464  
    9696    public static function clearCache(): int
    9797    {
    98         global $recrasPlugin;
    99 
    10098        $subdomain = get_option('recras_subdomain');
    10199        $errors = 0;
     
    104102        foreach ($packages as $id) {
    105103            $name = $subdomain . '_arrangement_' . $id;
    106             if ($recrasPlugin->transients->get($name)) {
    107                 $errors += $recrasPlugin->transients->delete($name);
    108             }
    109         }
    110         $errors += $recrasPlugin->transients->delete($subdomain . '_arrangements');
     104            if (Transient::get($name)) {
     105                $errors += Transient::delete($name);
     106            }
     107        }
     108        $errors += Transient::delete($subdomain . '_arrangements');
    111109
    112110        return $errors;
     
    238236    public static function getPackages(string $subdomain, bool $onlyOnline = false, bool $includeEmpty = true)
    239237    {
    240         global $recrasPlugin;
    241 
    242         $json = $recrasPlugin->transients->get($subdomain . '_arrangements');
     238        $json = Transient::get($subdomain . '_arrangements');
    243239        if ($json === false) {
    244240            try {
     
    247243                return $e->getMessage();
    248244            }
    249             $recrasPlugin->transients->set($subdomain . '_arrangements', $json);
     245            Transient::set($subdomain . '_arrangements', $json);
    250246        }
    251247
     
    364360    public static function getPackage(string $subdomain, int $id)
    365361    {
    366         global $recrasPlugin;
    367 
    368         $json = $recrasPlugin->transients->get($subdomain . '_arrangement_' . $id);
     362        $json = Transient::get($subdomain . '_arrangement_' . $id);
    369363        if ($json === false) {
    370364            try {
     
    373367                return $e->getMessage();
    374368            }
    375             $recrasPlugin->transients->set($subdomain . '_arrangement_' . $id, $json);
     369            Transient::set($subdomain . '_arrangement_' . $id, $json);
    376370        }
    377371        return $json;
  • recras/trunk/src/Bookprocess.php

    r3268913 r3310464  
    1111    public static function clearCache(): int
    1212    {
    13         global $recrasPlugin;
    14 
    1513        $subdomain = get_option('recras_subdomain');
    16         return $recrasPlugin->transients->delete($subdomain . '_bookprocesses_v2');
     14        return Transient::delete($subdomain . '_bookprocesses_v2');
    1715    }
    1816
     
    3836    public static function getProcesses(string $subdomain)
    3937    {
    40         global $recrasPlugin;
    41 
    42         $json = $recrasPlugin->transients->get($subdomain . '_bookprocesses_v2');
     38        $json = Transient::get($subdomain . '_bookprocesses_v2');
    4339        if ($json === false) {
    4440            try {
     
    4743                return $e->getMessage();
    4844            }
    49             $recrasPlugin->transients->set($subdomain . '_bookprocesses_v2', $json);
     45            Transient::set($subdomain . '_bookprocesses_v2', $json);
    5046        }
    5147
  • recras/trunk/src/ContactForm.php

    r3217607 r3310464  
    2626    public static function getForm(string $subdomain, int $id)
    2727    {
    28         global $recrasPlugin;
    29 
    30         $form = $recrasPlugin->transients->get($subdomain . '_contactform_' . $id . '_v2');
     28        $form = Transient::get($subdomain . '_contactform_' . $id . '_v2');
    3129        if ($form === false) {
    3230            try {
     
    3836                return $form->message;
    3937            }
    40             $recrasPlugin->transients->set($subdomain . '_contactform_' . $id . '_v2', $form);
     38            Transient::set($subdomain . '_contactform_' . $id . '_v2', $form);
    4139        }
    4240        return $form;
     
    151149    public static function clearCache(): int
    152150    {
    153         global $recrasPlugin;
    154 
    155151        $subdomain = get_option('recras_subdomain');
    156152        $errors = 0;
     
    160156            $errors += self::deleteTransients($subdomain, $id);
    161157        }
    162         if ($recrasPlugin->transients->get($subdomain . '_contactforms')) {
    163             $errors += $recrasPlugin->transients->delete($subdomain . '_contactforms');
     158        if (Transient::get($subdomain . '_contactforms')) {
     159            $errors += Transient::delete($subdomain . '_contactforms');
    164160        }
    165161
     
    173169    private static function deleteTransients(string $subdomain, int $formID): int
    174170    {
    175         global $recrasPlugin;
    176 
    177171        $errors = 0;
    178172
    179173        $name = $subdomain . '_contactform_' . $formID . '_v2';
    180         if ($recrasPlugin->transients->get($name)) {
    181             $errors += $recrasPlugin->transients->delete($name);
     174        if (Transient::get($name)) {
     175            $errors += Transient::delete($name);
    182176        }
    183177
     
    635629    public static function getForms(string $subdomain)
    636630    {
    637         global $recrasPlugin;
    638 
    639         $json = $recrasPlugin->transients->get($subdomain . '_contactforms');
     631        $json = Transient::get($subdomain . '_contactforms');
    640632        if ($json === false) {
    641633            try {
     
    644636                return $e->getMessage();
    645637            }
    646             $recrasPlugin->transients->set($subdomain . '_contactforms', $json);
     638            Transient::set($subdomain . '_contactforms', $json);
    647639        }
    648640
  • recras/trunk/src/Plugin.php

    r3306911 r3310464  
    1616    {
    1717        $this->setBaseUrl();
    18         $this->transients = new Transient();
    1918
    2019        // Needs to run before: Gutenberg::addBlocks, self::loadAdminScripts
     
    144143        }
    145144
    146         $setting = $this->transients->get($subdomain . '_show_old_online_booking');
     145        $setting = Transient::get($subdomain . '_show_old_online_booking');
    147146        if ($setting === false) {
    148147            try {
     
    152151            }
    153152            if (is_object($setting) && property_exists($setting, 'waarde')) {
    154                 $this->transients->set($subdomain . '_show_old_online_booking', $setting->waarde, DAY_IN_SECONDS);
    155             }
    156         }
    157 
    158         $setting = $this->transients->get($subdomain . '_show_old_voucher_sales');
     153                Transient::set($subdomain . '_show_old_online_booking', $setting->waarde, DAY_IN_SECONDS);
     154            }
     155        }
     156
     157        $setting = Transient::get($subdomain . '_show_old_voucher_sales');
    159158        if ($setting === false) {
    160159            try {
     
    164163            }
    165164            if (is_object($setting) && property_exists($setting, 'waarde')) {
    166                 $this->transients->set($subdomain . '_show_old_voucher_sales', $setting->waarde, DAY_IN_SECONDS);
     165                Transient::set($subdomain . '_show_old_voucher_sales', $setting->waarde, DAY_IN_SECONDS);
    167166            }
    168167        }
  • recras/trunk/src/Products.php

    r3217607 r3310464  
    7878    public static function clearCache(): int
    7979    {
    80         global $recrasPlugin;
    81 
    8280        $subdomain = get_option('recras_subdomain');
    8381        $errors = 0;
    84         if ($recrasPlugin->transients->get($subdomain . '_products_v2')) {
    85             $errors = $recrasPlugin->transients->delete($subdomain . '_products_v2');
     82        if (Transient::get($subdomain . '_products_v2')) {
     83            $errors = Transient::delete($subdomain . '_products_v2');
    8684        }
    8785
     
    125123    public static function getProducts(string $subdomain)
    126124    {
    127         global $recrasPlugin;
    128 
    129         $json = $recrasPlugin->transients->get($subdomain . '_products_v2');
     125        $json = Transient::get($subdomain . '_products_v2');
    130126        if ($json === false) {
    131127            try {
     
    135131            }
    136132
    137             $recrasPlugin->transients->set($subdomain . '_products_v2', $json);
     133            Transient::set($subdomain . '_products_v2', $json);
    138134        }
    139135
  • recras/trunk/src/Settings.php

    r3250273 r3310464  
    115115    public static function allowOnlinePackageBooking(): bool
    116116    {
    117         global $recrasPlugin;
    118 
    119117        $subdomain = get_option('recras_subdomain');
    120118        if (!$subdomain) {
    121119            return true;
    122120        }
    123         $setting = $recrasPlugin->transients->get($subdomain . '_show_old_online_booking');
     121        $setting = Transient::get($subdomain . '_show_old_online_booking');
    124122        // if getting the transient fails, we want to show the button to be sure, so comparing with 'no' is safest
    125123        return ($setting === 'no') ? false : true;
     
    129127    public static function allowOldVoucherSales(): bool
    130128    {
    131         global $recrasPlugin;
    132 
    133129        $subdomain = get_option('recras_subdomain');
    134130        if (!$subdomain) {
    135131            return true;
    136132        }
    137         $setting = $recrasPlugin->transients->get($subdomain . '_show_old_voucher_sales');
     133        $setting = Transient::get($subdomain . '_show_old_voucher_sales');
    138134        // if getting the transient fails, we want to show the button to be sure, so comparing with 'no' is safest
    139135        return ($setting === 'no') ? false : true;
     
    145141    public static function clearCache(): int
    146142    {
    147         global $recrasPlugin;
    148 
    149143        $subdomain = get_option('recras_subdomain');
    150144        $errors = 0;
    151         if ($recrasPlugin->transients->get($subdomain . '_show_old_online_booking')) {
    152             $errors = $recrasPlugin->transients->delete($subdomain . '_show_old_online_booking');
    153         }
    154         if ($recrasPlugin->transients->get($subdomain . '_show_old_voucher_sales')) {
    155             $errors = $recrasPlugin->transients->delete($subdomain . '_show_old_voucher_sales');
     145        if (Transient::get($subdomain . '_show_old_online_booking')) {
     146            $errors = Transient::delete($subdomain . '_show_old_online_booking');
     147        }
     148        if (Transient::get($subdomain . '_show_old_voucher_sales')) {
     149            $errors = Transient::delete($subdomain . '_show_old_voucher_sales');
    156150        }
    157151
  • recras/trunk/src/Transient.php

    r3221428 r3310464  
    99     * Delete a transient. Returns 0 for success/not existing, 1 for error for easy error counting
    1010     */
    11     public function delete(string $name): int
     11    public static function delete(string $name): int
    1212    {
    13         if (!$this->get($name)) {
     13        if (!self::get($name)) {
    1414            return 0;
    1515        }
     
    2020     * @return mixed
    2121     */
    22     public function get(string $name)
     22    public static function get(string $name)
    2323    {
    2424        return get_transient(self::BASE . $name);
     
    2626
    2727    // HOUR_IN_SECONDS is defined by WordPress
    28     public function set(string $name, $value, int $expiration = HOUR_IN_SECONDS): bool
     28    public static function set(string $name, $value, int $expiration = HOUR_IN_SECONDS): bool
    2929    {
    3030        return set_transient(self::BASE . $name, $value, $expiration);
  • recras/trunk/src/Vouchers.php

    r3268913 r3310464  
    127127    public static function clearCache(): int
    128128    {
    129         global $recrasPlugin;
    130 
    131129        $subdomain = get_option('recras_subdomain');
    132130        $errors = 0;
    133         if ($recrasPlugin->transients->get($subdomain . '_voucher_templates')) {
    134             $errors = $recrasPlugin->transients->delete($subdomain . '_voucher_templates');
     131        if (Transient::get($subdomain . '_voucher_templates')) {
     132            $errors = Transient::delete($subdomain . '_voucher_templates');
    135133        }
    136134
     
    144142    public function getTemplates(string $subdomain): array
    145143    {
    146         global $recrasPlugin;
    147 
    148         $json = $recrasPlugin->transients->get($subdomain . '_voucher_templates');
     144        $json = Transient::get($subdomain . '_voucher_templates');
    149145        if ($json === false) {
    150146            try {
     
    153149                return $e->getMessage();
    154150            }
    155             $recrasPlugin->transients->set($subdomain . '_voucher_templates', $json);
     151            Transient::set($subdomain . '_voucher_templates', $json);
    156152        }
    157153
Note: See TracChangeset for help on using the changeset viewer.