PluginProbe
MyRewards / trunk
MyRewards vtrunk
5.7.8 5.7.7 5.7.6 trunk 1.2.2 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.1 2.2.0 2.3.0 2.4.0 2.4.1 2.5.0 2.6.4 2.6.6 3.0.0.0 3.1.0 3.1.2 3.1.2.1 3.10.4 3.10.9 All 165 releases
woorewards / include / pointsflow / methods / woorewards.php

woorewards.php in MyRewards trunk, at include/pointsflow/methods/woorewards.php

44 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace LWS\WOOREWARDS\PointsFlow\Methods;
3
4 // don't call the file directly
5 if( !defined( 'ABSPATH' ) ) exit();
6
7 class WooRewards extends \LWS\WOOREWARDS\PointsFlow\ExportMethod
8 {
9 /** @return (array) the json that will be send,
10 * An array with each entries as {email, points} */
11 public function export($value, $arg)
12 {
13 $stackName = $value;
14 if (\class_exists('\LWS\WOOREWARDS\PRO\Core\Pool')) {
15 $pool = \LWS\WOOREWARDS\PRO\Core\Pool::getOrLoad($value, false);
16 } else {
17 $pool = \apply_filters('lws_woorewards_get_pools_by_args', false, array(
18 'system' => $value,
19 'force' => true,
20 ));
21 if ($pool)
22 $pool = $pool->last();
23 }
24 if ($pool)
25 $stackName = $pool->getStackId();
26
27 global $wpdb;
28 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
29 return $wpdb->get_results($wpdb->prepare("SELECT user_email as `email`, meta_value as `points` FROM {$wpdb->users} LEFT JOIN {$wpdb->usermeta} ON ID=user_id AND `meta_key`=%s", 'lws_wre_points_' . $stackName));
30 }
31
32 /** @return (string) human readable name */
33 public function getTitle()
34 {
35 return __("MyRewards", 'woorewards-lite');
36 }
37
38 /** @return (bool) appear in method combobox */
39 public function isVisible()
40 {
41 return false;
42 }
43 }
44