PluginProbe
Datafeedr API / 1.4.3
Datafeedr API v1.4.3
1.4.3 1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 All 182 releases
← All changes | classes/class-dfrapi-account.php +36 -34 1.0.125 → 1.4.3 View file →
@@ -11,8 +11,10 @@
11 11
12 12 private $page = 'dfrapi-account';
13 13 private $key;
14 14
15 + public $options;
16 +
15 17 public function __construct() {
16 18 $this->key = 'dfrapi_account';
17 19 add_action( 'admin_init', array( $this, 'register_settings' ) );
18 20 add_action( 'admin_menu', array( $this, 'admin_menu' ), 70 );
@@ -17,10 +19,10 @@
17 19 add_action( 'admin_init', array( $this, 'register_settings' ) );
18 20 add_action( 'admin_menu', array( $this, 'admin_menu' ), 70 );
19 21 add_action( 'init', array( $this, 'load_settings' ) );
20 22 }
21 -
22 - function load_settings() {
23 +
24 + function load_settings() {
23 25 $this->options = (array) get_option( $this->key );
24 26 if ( isset( $this->options[0] ) && empty( $this->options[0] ) ) {
25 27 $this->options = $status = dfrapi_api_get_status();
26 28 if ( !array_key_exists( 'dfrapi_api_error', $status ) ) {
@@ -27,17 +29,17 @@
27 29 update_option( $this->key, $status );
28 30 }
29 31 }
30 32 }
31 -
33 +
32 34 function admin_menu() {
33 35 add_submenu_page(
34 36 'dfrapi',
35 - __( 'Account — Datafeedr API', DFRAPI_DOMAIN ),
36 - __( 'Account', DFRAPI_DOMAIN ),
37 - 'manage_options',
37 + __( 'Account — Datafeedr API', 'datafeedr-api' ),
38 + __( 'Account', 'datafeedr-api' ),
39 + 'manage_options',
38 40 $this->key,
39 - array( $this, 'output' )
41 + array( $this, 'output' )
40 42 );
41 43 }
42 44
43 45 function output() {
@@ -48,27 +50,27 @@
48 50 echo '</div>';
49 51 }
50 52
51 53 function register_settings() {
52 -
54 +
53 55 register_setting( $this->page, $this->key, array( $this, 'validate' ) );
54 -
56 +
55 57 // Current Plan
56 - add_settings_section( 'current_plan', __( 'Current Plan', DFRAPI_DOMAIN ), array( &$this, 'section_current_plan_desc' ), $this->page );
57 -
58 + add_settings_section( 'current_plan', __( 'Current Plan', 'datafeedr-api' ), array( &$this, 'section_current_plan_desc' ), $this->page );
59 +
58 60 // Only show the following if there is no Error.
59 61 if ( !array_key_exists( 'dfrapi_api_error', $this->options ) ) {
60 -
62 +
61 63 // Current Usage
62 - add_settings_section( 'current_usage', __( 'Current Usage', DFRAPI_DOMAIN ), array( &$this, 'section_current_usage_desc' ), $this->page );
64 + add_settings_section( 'current_usage', __( 'Current Usage', 'datafeedr-api' ), array( &$this, 'section_current_usage_desc' ), $this->page );
63 65 }
64 -
66 +
65 67 // Account Links
66 - add_settings_section( 'account', __( 'Account Links', DFRAPI_DOMAIN ), array( &$this, 'section_account_desc' ), $this->page );
68 + add_settings_section( 'account', __( 'Account Links', 'datafeedr-api' ), array( &$this, 'section_account_desc' ), $this->page );
67 69 }
68 -
70 +
69 71 function section_current_plan_desc() {
70 -
72 +
71 73 $plans = dfrapi_get_membership_plans();
72 74 $plan_name = '';
73 75 if ( $this->options['plan_id'] > 0 ) {
74 76 $plan_name .= $plans[$this->options['plan_id']];
@@ -73,62 +75,62 @@
73 75 if ( $this->options['plan_id'] > 0 ) {
74 76 $plan_name .= $plans[$this->options['plan_id']];
75 77 if ( $this->options['plan_id'] != 10250000 ) {
76 78 $plan_name .= ' (';
77 - $plan_name .= '<a href="' . dfrapi_user_pages( 'change' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank" class="dfrapi_plan_link">' . __( 'Upgrade', DFRAPI_DOMAIN ) . '</a>';
79 + $plan_name .= '<a href="' . dfrapi_user_pages( 'change' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank" class="dfrapi_plan_link">' . __( 'Upgrade', 'datafeedr-api' ) . '</a>';
78 80 $plan_name .= ')';
79 81 }
80 82 } else {
81 83 $plan_name .= '<em>';
82 - $plan_name .= __( 'None', DFRAPI_DOMAIN );
84 + $plan_name .= __( 'None', 'datafeedr-api' );
83 85 $plan_name .= '</em> (';
84 - $plan_name .= '<a href="' . dfrapi_user_pages( 'signup' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank" class="dfrapi_plan_link">' . __( 'Reactivate your subscription', DFRAPI_DOMAIN ) . '</a>';
86 + $plan_name .= '<a href="' . dfrapi_user_pages( 'signup' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank" class="dfrapi_plan_link">' . __( 'Reactivate your subscription', 'datafeedr-api' ) . '</a>';
85 87 $plan_name .= ')';
86 88 }
87 -
89 +
88 90 echo '
89 91 <table class="widefat account_table" cellspacing="0">
90 92 <tbody>
91 93 <tr class="alternate">
92 - <td class="row-title">' . __( 'Plan name', DFRAPI_DOMAIN ) . '</td>
94 + <td class="row-title">' . __( 'Plan name', 'datafeedr-api' ) . '</td>
93 95 <td class="desc">' . $plan_name . '</td>
94 96 </tr>
95 97 ';
96 -
98 +
97 99 if ( !array_key_exists( 'dfrapi_api_error', $this->options ) ) {
98 100 echo '
99 101 <tr>
100 - <td class="row-title">' . __( 'Requests per month (RPM)', DFRAPI_DOMAIN ) . '</td>
102 + <td class="row-title">' . __( 'Requests per month (RPM)', 'datafeedr-api' ) . '</td>
101 103 <td class="desc">' . number_format( $this->options['max_requests'] ) . '</td>
102 104 </tr>
103 105 <tr class="alternate">
104 - <td class="row-title">' . __( 'Products per request (PPR)', DFRAPI_DOMAIN ) . '</td>
106 + <td class="row-title">' . __( 'Products per request (PPR)', 'datafeedr-api' ) . '</td>
105 107 <td class="desc">' . number_format( $this->options['max_length'] ) . '</td>
106 108 </tr>
107 109 ';
108 110 }
109 -
111 +
110 112 echo '
111 113 </tbody>
112 114 </table>
113 115 ';
114 116 }
115 -
117 +
116 118 function section_current_usage_desc() {
117 119 echo '<p>';
118 - _e( 'View your current API usage, number of API requests remaining and reset date', DFRAPI_DOMAIN );
119 - echo ' <a href="' . dfrapi_user_pages( 'api' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage#api-usage" target="_blank">' . __( 'here', DFRAPI_DOMAIN ) . '</a>.';
120 + _e( 'View your current API usage, number of API requests remaining and reset date', 'datafeedr-api' );
121 + echo ' <a href="' . dfrapi_user_pages( 'api' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage#api-usage" target="_blank">' . __( 'here', 'datafeedr-api' ) . '</a>.';
120 122 echo '<p>';
121 123 }
122 -
124 +
123 125 function section_account_desc() {
124 - echo '<p><a href="' . dfrapi_user_pages( 'summary' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank">' . __( 'View your Datafeedr account', DFRAPI_DOMAIN ) . '</a></p>';
125 - echo '<p><a href="' . dfrapi_user_pages( 'change' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank">' . __( 'Upgrade your plan', DFRAPI_DOMAIN ) . '</a></p>';
126 + echo '<p><a href="' . dfrapi_user_pages( 'summary' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank">' . __( 'View your Datafeedr account', 'datafeedr-api' ) . '</a></p>';
127 + echo '<p><a href="' . dfrapi_user_pages( 'change' ) . '?utm_source=plugin&utm_medium=link&utm_campaign=dfrapiaccountpage" target="_blank">' . __( 'Upgrade your plan', 'datafeedr-api' ) . '</a></p>';
126 128 }
127 -
129 +
128 130 function validate( $input ) {
129 131 return $input;
130 132 }
131 -
133 +
132 134 } // class Dfrapi_Account
133 135
134 136 } // class_exists check