Changeset 2919893
- Timestamp:
- 05/31/2023 10:28:57 PM (3 years ago)
- Location:
- notify-events/trunk
- Files:
-
- 6 added
- 10 edited
-
controllers/EventController.php (modified) (1 diff)
-
models/Core.php (modified) (2 diffs)
-
models/Model.php (modified) (1 diff)
-
modules/woocommerce/models/WooCommerce.php (modified) (2 diffs)
-
modules/woocommerce/models/events/product/ProductAdded.php (added)
-
modules/woocommerce/models/events/product/ProductApproved.php (added)
-
modules/woocommerce/models/events/product/ProductCustom.php (added)
-
modules/woocommerce/models/events/product/ProductPending.php (added)
-
modules/woocommerce/models/events/product/ProductPublished.php (added)
-
modules/woocommerce/views/event/product_custom.php (added)
-
modules/wordpress/models/events/post/PostCustom.php (modified) (6 diffs)
-
modules/wordpress/views/event/post_custom.php (modified) (1 diff)
-
notify-events.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
-
views/event/form/_multi_select.php (modified) (1 diff)
-
views/event/index.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
notify-events/trunk/controllers/EventController.php
r2383243 r2919893 36 36 public function action_create() 37 37 { 38 /** @var Event $event_class */38 /** @var Event|string $event_class */ 39 39 $event_class = wp_unslash($_GET['event']); 40 40 -
notify-events/trunk/models/Core.php
r2882680 r2919893 160 160 /** @var Module $module_b */ 161 161 162 return $module_a::module_order() > $module_b::module_order();162 return ($module_a::module_order() > $module_b::module_order()) ? 1 : -1; 163 163 }); 164 164 … … 173 173 { 174 174 if (!array_key_exists($module_name, $this->_modules)) { 175 wp_die(__('Can\'t find %s module'),$module_name);175 wp_die(__('Can\'t find module: ') . $module_name); 176 176 } 177 177 -
notify-events/trunk/models/Model.php
r2856139 r2919893 342 342 protected function rule_each($attribute, $value, array $params) 343 343 { 344 if (!is_array($value) ) {344 if (!is_array($value) && !empty($value)) { 345 345 $message = array_key_exists('message', $params) ? $params['message'] : __('Value must be array', WPNE); 346 346 -
notify-events/trunk/modules/woocommerce/models/WooCommerce.php
r2432603 r2919893 9 9 use notify_events\modules\woocommerce\models\events\product\NoStock; 10 10 use notify_events\modules\woocommerce\models\events\product\OnBackorder; 11 use notify_events\modules\woocommerce\models\events\product\ProductAdded; 12 use notify_events\modules\woocommerce\models\events\product\ProductApproved; 13 use notify_events\modules\woocommerce\models\events\product\ProductCustom; 14 use notify_events\modules\woocommerce\models\events\product\ProductPending; 15 use notify_events\modules\woocommerce\models\events\product\ProductPublished; 11 16 12 17 /** … … 59 64 ], 60 65 __('Product', WPNE) => [ 66 ProductAdded::class, 67 ProductPublished::class, 68 ProductPending::class, 69 ProductApproved::class, 70 ProductCustom::class, 71 OnBackorder::class, 72 ], 73 __('Stock', WPNE) => [ 61 74 LowStock::class, 62 75 NoStock::class, 63 OnBackorder::class,64 76 ], 65 77 ]; -
notify-events/trunk/modules/wordpress/models/events/post/PostCustom.php
r2532490 r2919893 18 18 * @property int $channel_id 19 19 * @property string $post_type 20 * @property bool $post_is_status_changed 21 * @property string $post_old_status 20 22 * @property string $post_status 21 23 */ … … 43 45 public static function handle($new_status, $old_status, $post) 44 46 { 45 if ($new_status == $old_status) {46 return;47 }48 49 47 $author = get_userdata($post->post_author); 50 48 $editor = get_userdata(get_post_meta($post->ID, '_edit_last', true)); … … 65 63 ], 66 64 [ 65 'key' => '_wpne_post_is_status_changed', 66 'value' => (int)($old_status != $new_status), 67 ], 68 [ 69 'key' => '_wpne_post_old_status', 70 'value' => serialize($old_status), 71 'compare' => 'LIKE' 72 ], 73 [ 67 74 'key' => '_wpne_post_status', 68 'value' => serialize($ post->post_status),75 'value' => serialize($new_status), 69 76 'compare' => 'LIKE' 70 77 ], … … 88 95 return array_merge(parent::fields(), [ 89 96 'post_type', 97 'post_is_status_changed', 98 'post_old_status', 90 99 'post_status', 91 100 ]); … … 99 108 return array_merge(parent::rules(), [ 100 109 'post_type' => [ 101 ['required'],102 110 ['each', 'rules' => [ 103 111 ['string'], … … 105 113 ]], 106 114 ], 115 'post_is_status_changed' => [ 116 ['boolean'], 117 ], 118 'post_old_status' => [ 119 ['each', 'rules' => [ 120 ['string'], 121 ['in', 'range' => array_keys(self::post_status_list())], 122 ]], 123 ], 107 124 'post_status' => [ 108 ['required'],109 125 ['each', 'rules' => [ 110 126 ['string'], -
notify-events/trunk/modules/wordpress/views/event/post_custom.php
r2532490 r2919893 42 42 'items' => $event::post_type_list(), 43 43 ], false) ?> 44 <?= $this->render('form/_checkbox', [ 45 'model' => $event, 46 'title' => __('Is Status Changed', WPNE), 47 'field' => 'post_is_status_changed', 48 ], false) ?> 44 49 <?= $this->render('form/_multi_select', [ 45 50 'model' => $event, 46 'title' => __('Post Status', WPNE), 51 'title' => __('Old Type', WPNE), 52 'field' => 'post_old_status', 53 'items' => $event::post_status_list(), 54 ], false) ?> 55 <?= $this->render('form/_multi_select', [ 56 'model' => $event, 57 'title' => __('Status', WPNE), 47 58 'field' => 'post_status', 48 59 'items' => $event::post_status_list(), -
notify-events/trunk/notify-events.php
r2882680 r2919893 6 6 Author: Notify.Events 7 7 Author URI: https://notify.events/ 8 Version: 1. 3.38 Version: 1.4.0 9 9 License: GPL-2.0 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 15 15 use notify_events\models\Core; 16 16 use notify_events\modules\contact_form_7\models\ContactForm7; 17 use notify_events\modules\easy_digital_downloads\models\EasyDigitalDownloads; 17 18 use notify_events\modules\ninja_forms\models\NinjaForms; 18 19 use notify_events\modules\woocommerce\models\WooCommerce; … … 56 57 NinjaForms::register(); 57 58 } 59 60 if (Core::is_plugin_active('easy-digital-downloads/easy-digital-downloads.php')) { 61 EasyDigitalDownloads::register(); 62 } 58 63 }); -
notify-events/trunk/readme.txt
r2882680 r2919893 4 4 Requires at least: 5.3 5 5 Requires PHP: 5.6 6 Tested up to: 6.2 7 Stable tag: 1. 3.36 Tested up to: 6.2.1 7 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 43 43 * Order Status Change 44 44 * Product 45 * Product Added 46 * Product Published 47 * Product Sent for Review 48 * Product Approved 49 * Product Custom Event 45 50 * Low Stock 46 51 * Out Of Stock … … 83 88 84 89 == Changelog == 90 91 = 1.4.0 = 92 Adding WooCommerce product manipulation event support. 85 93 86 94 = 1.3.0 = -
notify-events/trunk/views/event/form/_multi_select.php
r2532490 r2919893 14 14 ?> 15 15 16 <style> 17 .checkbox-list { 18 border: 1px solid #c3c4c7; 19 border-radius: 4px; 20 padding: 0 4px; 21 max-height: 150px; 22 overflow-y: auto; 23 } 24 .checkbox-list label { 25 display: block; 26 margin: 4px 0; 27 } 28 </style> 29 16 30 <tr class="wpne-form-group <?= $model->has_error($field) ? 'wpne-has-error' : '' ?>"> 17 31 <th scope="row"><?= $title ?></th> 18 32 <td> 19 <?php foreach ($items as $key => $title) { ?> 20 <label> 21 <input type="checkbox" name="form[<?= $field ?>][]" value="<?= $key ?>" <?= in_array($key, (array)$model->{$field}) ? 'checked' : '' ?>> 22 <?= esc_html($title) ?> 23 </label><br> 24 <?php } ?> 33 <div class="checkbox-list"> 34 <?php foreach ($items as $key => $title) { ?> 35 <label> 36 <input type="checkbox" name="form[<?= $field ?>][]" value="<?= $key ?>" <?= in_array($key, (array)$model->{$field}) ? 'checked' : '' ?>> 37 <?= esc_html($title) ?> 38 </label> 39 <?php } ?> 40 </div> 25 41 <?php if ($model->has_error($field)) { ?> 26 42 <div class="wpne-error"><?= esc_html($model->get_error($field)) ?></div> -
notify-events/trunk/views/event/index.php
r2532490 r2919893 15 15 ?> 16 16 17 <style type="text/css">17 <style> 18 18 .column-enabled { 19 19 width: 10%; … … 34 34 flex-wrap: wrap; 35 35 } 36 .event-list .button { 37 width: 30%; 38 margin: 2px; 36 .event-list .event-list-item { 37 width: 33.33%; 38 padding: 2px; 39 box-sizing: border-box; 40 } 41 .event-list .event-list-item .button { 42 width: 100%; 39 43 } 40 44 .contact_us { … … 49 53 <?php $events->display() ?> 50 54 51 <div id="wpne-event-create" class="wpne-modal-form" data-title="<?= esc_attr(__('Select event type', WPNE)) ?>" data-width=" 500" data-height="400">55 <div id="wpne-event-create" class="wpne-modal-form" data-title="<?= esc_attr(__('Select event type', WPNE)) ?>" data-width="650" data-height="400"> 52 56 <div class="module-list"> 53 57 <?php foreach ($modules as $module) { ?> … … 62 66 <div class="event-list"> 63 67 <?php foreach ($events as $event) { ?> 64 <?= Html::a($event::event_title(), [ 65 'controller' => 'event', 66 'action' => 'create', 67 'event' => rawurlencode($event), 68 ], [ 69 'class' => 'button', 70 ]) ?> 68 <div class="event-list-item"> 69 <?= Html::a($event::event_title(), [ 70 'controller' => 'event', 71 'action' => 'create', 72 'event' => rawurlencode($event), 73 ], [ 74 'class' => 'button', 75 ]) ?> 76 </div> 71 77 <?php } ?> 72 78 </div>
Note: See TracChangeset
for help on using the changeset viewer.