Skip to content

Commit

Permalink
Merge pull request #12 from alexminza/v1.1.8
Browse files Browse the repository at this point in the history
v1.1.8
  • Loading branch information
alexminza authored May 10, 2020
2 parents c5b7624 + 8be6285 commit 0df77fd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 26 deletions.
Binary file modified languages/wc-moldovaagroindbank-ro_RO.mo
Binary file not shown.
10 changes: 5 additions & 5 deletions languages/wc-moldovaagroindbank-ro_RO.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# This file is distributed under the same license as the WooCommerce Moldova Agroindbank Payment Gateway package.
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Moldova Agroindbank Payment Gateway 1.1.7\n"
"Project-Id-Version: WooCommerce Moldova Agroindbank Payment Gateway 1.1.8\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-"
"moldovaagroindbank\n"
"POT-Creation-Date: 2020-05-03 09:23+0300\n"
"PO-Revision-Date: 2020-05-03 09:25+0300\n"
"POT-Creation-Date: 2020-05-10 16:42+0300\n"
"PO-Revision-Date: 2020-05-10 16:43+0300\n"
"Last-Translator: Alexander Minza <alex@alexminza.com>\n"
"Language-Team: \n"
"Language: ro\n"
Expand Down Expand Up @@ -368,12 +368,12 @@ msgstr "Finalizează tranzacția prin %1$s"
msgid "Scheduled action %1$s is already registered."
msgstr "Acțiunea programată %1$s este deja înregistrată."

#: wc-moldovaagroindbank.php:1314
#: wc-moldovaagroindbank.php:1308
msgid "Registered scheduled action %1$s in timezone %2$s with ID %3$s."
msgstr ""
"Acțiunea programată %1$s a fost înregistrată în fusul orar %2$s cu ID %3$s."

#: wc-moldovaagroindbank.php:1321
#: wc-moldovaagroindbank.php:1315
msgid "Unregistered scheduled action %1$s."
msgstr "Acțiunea programată %1$s a fost anulată."

Expand Down
Binary file modified languages/wc-moldovaagroindbank-ru_RU.mo
Binary file not shown.
10 changes: 5 additions & 5 deletions languages/wc-moldovaagroindbank-ru_RU.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# This file is distributed under the same license as the WooCommerce Moldova Agroindbank Payment Gateway package.
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Moldova Agroindbank Payment Gateway 1.1.7\n"
"Project-Id-Version: WooCommerce Moldova Agroindbank Payment Gateway 1.1.8\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-"
"moldovaagroindbank\n"
"POT-Creation-Date: 2020-05-03 09:23+0300\n"
"PO-Revision-Date: 2020-05-03 09:24+0300\n"
"POT-Creation-Date: 2020-05-10 16:42+0300\n"
"PO-Revision-Date: 2020-05-10 16:44+0300\n"
"Last-Translator: Alexander Minza <alex@alexminza.com>\n"
"Language-Team: \n"
"Language: ru\n"
Expand Down Expand Up @@ -373,13 +373,13 @@ msgstr "Провести платеж через %1$s"
msgid "Scheduled action %1$s is already registered."
msgstr "Запланированное действие %1$s уже зарегистрировано."

#: wc-moldovaagroindbank.php:1314
#: wc-moldovaagroindbank.php:1308
msgid "Registered scheduled action %1$s in timezone %2$s with ID %3$s."
msgstr ""
"Зарегистрировано запланированное действие %1$s в часовом поясе %2$s с ID "
"%3$s."

#: wc-moldovaagroindbank.php:1321
#: wc-moldovaagroindbank.php:1315
msgid "Unregistered scheduled action %1$s."
msgstr "Запланированное действие %1$s отменено."

Expand Down
8 changes: 4 additions & 4 deletions languages/wc-moldovaagroindbank.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Moldova Agroindbank Payment Gateway 1.1.7\n"
"Project-Id-Version: WooCommerce Moldova Agroindbank Payment Gateway 1.1.8\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-moldovaagroindbank\n"
"POT-Creation-Date: 2020-05-03 09:23+0300\n"
"POT-Creation-Date: 2020-05-10 16:42+0300\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -326,11 +326,11 @@ msgstr ""
msgid "Scheduled action %1$s is already registered."
msgstr ""

#: wc-moldovaagroindbank.php:1314
#: wc-moldovaagroindbank.php:1308
msgid "Registered scheduled action %1$s in timezone %2$s with ID %3$s."
msgstr ""

#: wc-moldovaagroindbank.php:1321
#: wc-moldovaagroindbank.php:1315
msgid "Unregistered scheduled action %1$s."
msgstr ""

Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: alexminza
Donate link: https://www.paypal.me/AlexMinza
Tags: WooCommerce, Moldova, Agroindbank, MAIB, payment, gateway
Requires at least: 4.8
Tested up to: 5.4
Tested up to: 5.4.1
Stable tag: trunk
Requires PHP: 7.0
License: GPLv3 or later
Expand Down Expand Up @@ -81,6 +81,9 @@ You can also contribute to the plugin by translating it. Simply visit [translate

== Changelog ==

= 1.1.8 =
Updated WC tested up to 4.1.0

= 1.1.7 =
Improved Close day scheduled action registration.
For this feature to work properly at least WooCommerce 4 with [Action Scheduler 3](https://woocommerce.wordpress.com/2020/01/08/action-scheduler-3-0/) are required - see [bug fixes from PR #333](https://github.com/woocommerce/action-scheduler/pull/333) for details.
Expand Down Expand Up @@ -120,6 +123,9 @@ Initial release

== Upgrade Notice ==

= 1.1.8 =
Updated WC tested up to 4.1.0

= 1.1.7 =
Improved Close day scheduled action registration.
See Changelog for details.
Expand Down
31 changes: 20 additions & 11 deletions wc-moldovaagroindbank.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Moldova Agroindbank Payment Gateway
* Description: WooCommerce Payment Gateway for Moldova Agroindbank
* Plugin URI: https://github.com/alexminza/wc-moldovaagroindbank
* Version: 1.1.7
* Version: 1.1.8
* Author: Alexander Minza
* Author URI: https://profiles.wordpress.org/alexminza
* Developer: Alexander Minza
Expand All @@ -13,9 +13,9 @@
* License: GPLv3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Requires at least: 4.8
* Tested up to: 5.4
* Tested up to: 5.4.1
* WC requires at least: 3.3
* WC tested up to: 4.0.1
* WC tested up to: 4.1.0
*/

//Looking to contribute code to this plugin? Go ahead and fork the repository over at GitHub https://github.com/alexminza/wc-moldovaagroindbank
Expand Down Expand Up @@ -1228,7 +1228,7 @@ protected function log($message, $level = WC_Log_Levels::DEBUG) {

static function static_log($message, $level = WC_Log_Levels::DEBUG) {
$logger = wc_get_logger();
$log_context = array('source' => WC_MoldovaAgroindbank::MOD_ID);
$log_context = array('source' => self::MOD_ID);
$logger->log($level, $message, $log_context);
}

Expand Down Expand Up @@ -1302,14 +1302,8 @@ public static function register_scheduled_actions() {
$timestamp = as_get_datetime_object('tomorrow - 1 minute', $timezoneId);
$timestamp->setTimezone(new DateTimeZone('UTC'));

#region CRON
$cronSchedule = $timestamp->format('i H * * *'); #'59 23 * * *'
$action_id = as_schedule_cron_action(null, $cronSchedule, self::MOD_CLOSEDAY_ACTION, array(), self::MOD_ID);
#endregion

#region INTERVAL
#$action_id = as_schedule_recurring_action($timestamp, DAY_IN_SECONDS, self::MOD_CLOSEDAY_ACTION, array(), self::MOD_ID);
#entregion

$message = sprintf(__('Registered scheduled action %1$s in timezone %2$s with ID %3$s.', self::MOD_TEXT_DOMAIN), self::MOD_CLOSEDAY_ACTION, $timezoneId, $action_id);
self::static_log($message, WC_Log_Levels::INFO);
Expand All @@ -1322,6 +1316,19 @@ public static function unregister_scheduled_actions() {
self::static_log($message, WC_Log_Levels::INFO);
}

/* public static function action_upgrade_complete($upgrader_object, $options) {
//https://wordpress.stackexchange.com/questions/144870/wordpress-update-plugin-hook-action-since-3-9
if($options['action'] == 'update' && $options['type'] == 'plugin' && isset($options['plugins'])) {
$this_plugin = plugin_basename(__FILE__);
foreach($options['plugins'] as $plugin) {
if($plugin == $this_plugin) {
self::register_scheduled_actions();
}
}
}
} */

static function find_scheduled_action($status = null) {
$params = $status ? array('status' => $status) : null;
$action_id = ActionScheduler::store()->find_action(self::MOD_CLOSEDAY_ACTION, $params);
Expand Down Expand Up @@ -1358,8 +1365,10 @@ public static function is_wc_active() {
}
#endregion

//Add scheduled actions
#region Scheduled actions
#add_action('upgrader_process_complete', array(WC_MoldovaAgroindbank::class, 'action_upgrade_complete'), 10, 2);
add_action(WC_MoldovaAgroindbank::MOD_CLOSEDAY_ACTION, array(WC_MoldovaAgroindbank::class, 'action_close_day'));
#endregion
}

#region Register activation hooks
Expand Down

0 comments on commit 0df77fd

Please sign in to comment.