@@ -71,17 +71,12 @@ private function __construct() {
7171 add_action ( 'admin_head ' , array ( $ this , 'add_sortable ' ) );
7272 }
7373 }
74- } else if ( $ _GET [ 'page ' ] === 'adrotate-groups ' ) {
74+ } else if ( $ _GET [ 'page ' ] === 'adrotate-groups ' || $ _GET [ ' page ' ] === ' adrotate-schedules ' ) {
7575 $ setting = ( array ) get_option ( $ this ->plugin_slug );
7676 if ( isset ( $ setting [ 'sortable ' ] ) ) {
7777 add_action ( 'admin_head ' , array ( $ this , 'add_sortable ' ) );
7878 }
79- } else if ( $ _GET [ 'page ' ] === 'adrotate-schedules ' ) {
80- $ setting = ( array ) get_option ( $ this ->plugin_slug );
81- if ( isset ( $ setting [ 'sortable ' ] ) ) {
82- add_action ( 'admin_head ' , array ( $ this , 'add_sortable ' ) );
83- }
84- }
79+ }
8580 }
8681 }
8782
@@ -108,11 +103,6 @@ public static function get_instance() {
108103 * @since 1.0.0
109104 */
110105 public function add_plugin_admin_menu () {
111-
112- /*
113- * Add a settings page for this plugin to the Adrotate menu.
114- */
115-
116106 $ this ->plugin_screen_hook_suffix = add_submenu_page ( 'adrotate ' , __ ( 'Adrotate Extra Settings ' , $ this ->plugin_slug ), __ ( 'Extra Settings ' , $ this ->plugin_slug ), 'manage_options ' , $ this ->plugin_slug , array ( $ this , 'display_plugin_admin_page ' ) );
117107 }
118108
@@ -150,10 +140,6 @@ function adrotate_extra_settings_form() {
150140 $ this ->plugin_slug , __ ( 'Tweak ' , $ this ->plugin_slug ), '__return_false ' , $ this ->plugin_slug
151141 );
152142
153- // add_settings_field(
154- // $this->plugin_slug . '_free_or_pro', __( 'Check if you use AdRotate Pro, uncheck if you use AdRotate', $this->plugin_slug ), array( $this, 'field_free_or_pro' ), $this->plugin_slug, $this->plugin_slug
155- // );
156-
157143 add_settings_field (
158144 $ this ->plugin_slug . '_custom_examples ' , __ ( 'This add custom examples in the box for the ads.<br> One rule for line, empty for disable it ' , $ this ->plugin_slug ), array ( $ this , 'field_examples ' ), $ this ->plugin_slug , $ this ->plugin_slug
159145 );
@@ -167,31 +153,16 @@ function adrotate_extra_settings_form() {
167153 );
168154
169155 add_settings_field (
170- $ this ->plugin_slug . 'hide_geolocation ' , __ ( 'Hide geolocation section (only pro) ' , $ this ->plugin_slug ), array ( $ this , 'hide_geolocation ' ), $ this ->plugin_slug , $ this ->plugin_slug
156+ $ this ->plugin_slug . 'hide_geolocation ' , __ ( 'Hide geolocation section ' , $ this ->plugin_slug ), array ( $ this , 'hide_geolocation ' ), $ this ->plugin_slug , $ this ->plugin_slug
171157 );
172158
173159 add_settings_field (
174- $ this ->plugin_slug . 'hide_timeframe ' , __ ( 'Hide timeframe section (only pro) ' , $ this ->plugin_slug ), array ( $ this , 'hide_timeframe ' ), $ this ->plugin_slug , $ this ->plugin_slug
160+ $ this ->plugin_slug . 'hide_advanced ' , __ ( 'Hide advanced section ' , $ this ->plugin_slug ), array ( $ this , 'hide_advanced ' ), $ this ->plugin_slug , $ this ->plugin_slug
175161 );
176162
177163 register_setting ( $ this ->plugin_slug , $ this ->plugin_slug );
178164 }
179165
180- /**
181- * Check free or pro
182- *
183- * @since 1.0.0
184- */
185- function field_free_or_pro () {
186- $ setting = ( array ) get_option ( $ this ->plugin_slug );
187-
188- if ( !isset ( $ setting [ 'pro ' ] ) ) {
189- $ setting [ 'pro ' ] = false ;
190- }
191-
192- echo '<input type="checkbox" name=" ' . $ this ->plugin_slug . '[pro]" ' . checked ( $ setting [ 'pro ' ], 'on ' , false ) . ' /> ' ;
193- }
194-
195166 /**
196167 * Custom examples
197168 *
@@ -253,18 +224,18 @@ function hide_geolocation() {
253224 }
254225
255226 /**
256- * Hide usage
227+ * Hide advanced
257228 *
258- * @since 1.0 .0
229+ * @since 1.1 .0
259230 */
260- function hide_timeframe () {
231+ function hide_advanced () {
261232 $ setting = ( array ) get_option ( $ this ->plugin_slug );
262233
263- if ( !isset ( $ setting [ 'hide_timeframe ' ] ) ) {
264- $ setting [ 'hide_timeframe ' ] = false ;
234+ if ( !isset ( $ setting [ 'hide_advanced ' ] ) ) {
235+ $ setting [ 'hide_advanced ' ] = false ;
265236 }
266237
267- echo '<input type="checkbox" name=" ' . $ this ->plugin_slug . '[hide_timeframe ]" ' . checked ( $ setting [ 'hide_timeframe ' ], 'on ' , false ) . ' /> ' ;
238+ echo '<input type="checkbox" name=" ' . $ this ->plugin_slug . '[hide_advanced ]" ' . checked ( $ setting [ 'hide_advanced ' ], 'on ' , false ) . ' /> ' ;
268239 }
269240
270241 /**
@@ -277,10 +248,8 @@ public function add_examples() {
277248 echo '<script> ' . "\n" ;
278249 echo 'jQuery(function() { ' . "\n" ;
279250 $ setting [ 'examples ' ] = explode ( '\n ' , $ setting [ 'examples ' ] );
280- $ i = 4 ;
281251 foreach ( $ setting [ 'examples ' ] as $ value ) {
282- $ i ++;
283- echo "jQuery('table.widefat:first a[onclick]:last').parent().parent().after('<p> " . $ i . ". <em><a onclick= \"textatcursor(\'adrotate_bannercode\',\' " . htmlspecialchars ( $ value ) . "\');return false; \" href= \"# \"> " . htmlspecialchars ( $ value ) . "</a></em></p>') \n" ;
252+ echo "jQuery('table.widefat:first tr:nth-child(2n) a[onclick]:last').parent().parent().after('<p><em><a onclick= \"textatcursor(\'adrotate_bannercode\',\' " . htmlspecialchars ( $ value ) . "\');return false; \" href= \"# \"> " . htmlspecialchars ( $ value ) . "</a></em></p>') \n" ;
284253 }
285254 echo '}); ' . "\n" ;
286255 echo '</script> ' . "\n" ;
@@ -297,8 +266,7 @@ public function add_sortable() {
297266 echo '<script src=" ' . plugins_url ( 'assets/tablesorter/jquery.tablesorter.min.js ' , __FILE__ ) . '"></script> ' . "\n" ;
298267 echo '<script> ' . "\n" ;
299268 echo 'jQuery(function() { ' . "\n" ;
300- //if ( !isset( $setting[ 'pro' ] ) ) {
301- echo 'jQuery("table.widefat:not(:last)").addClass("tablesorter").tablesorter(); ' ;
269+ echo 'jQuery("table.widefat:not(:last)").addClass("tablesorter").tablesorter(); ' . "\n" ;
302270 echo '}); ' . "\n" ;
303271 echo '</script> ' . "\n" ;
304272 }
@@ -313,13 +281,13 @@ public function hide_section_js() {
313281 echo '<script> ' . "\n" ;
314282 echo 'jQuery(function() { ' . "\n" ;
315283 if ( isset ( $ setting [ 'hide_usage ' ] ) ) {
316- echo "jQuery('h3:contains( \"Usage \")').hide().next().hide().next().hide().next().hide(); \n" ;
284+ echo "jQuery('h3:contains( \"Usage \")').hide().next().hide().next().hide().next().hide().next().hide().next().hide() ; \n" ;
317285 }
318286 if ( isset ( $ setting [ 'hide_geolocation ' ] ) ) {
319- echo "jQuery('h3:contains( \"Geo Location \")').hide().next().hide().next().hide(); \n" ;
287+ echo "jQuery('h3:contains( \"Geo Targeting in AdRotate Pro \" ), h3:contains( \" Geo Targeting \")').hide().next().hide().next().hide(); \n" ;
320288 }
321- if ( isset ( $ setting [ 'hide_timeframe ' ] ) ) {
322- echo "jQuery('h3:contains( \"Timeframe \")').hide().next().hide().next().hide().next().hide(); \n" ;
289+ if ( isset ( $ setting [ 'hide_advanced ' ] ) ) {
290+ echo "jQuery('h3:contains( \"Advanced \")').hide().next().hide().next().hide().next().hide(); \n" ;
323291 }
324292 echo '}); ' . "\n" ;
325293 echo '</script> ' . "\n" ;
0 commit comments