Changeset 2399483
- Timestamp:
- 10/14/2020 01:24:54 PM (4 years ago)
- Location:
- adredux
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
adredux/tags/1.1.0/adredux.php
r2085348 r2399483 1 1 <?php 2 2 /* 3 Plugin Name: AdRedux - Insert Ads 3 Plugin Name: AdRedux - Insert Ads & Codes 4 4 Plugin URI: http://reduxthemes.com/adredux-wordpress-ad-plugin/ 5 Description: Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or custom ad codes, newsletter signup alerts, image banners, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. Place your ads at the beginning, after the first/second/third paragraphs, in the middle or at the end of the content. Exclude selected posts, pages, categories, tags from ad displays. The plugin is equipped with the essential features without making your website slow. No clutter in your WP database.6 Version: 1. 0.95 Description: Easily insert advertisements and codes in your website. Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, custom ad codes, analytics codes, newsletter signup forms, image banners, meta tags, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. Place your ads at the beginning, after the first/second/third paragraphs, in the middle or at the end of the content. Exclude selected posts, pages, categories, tags from ad displays. No clutter in your WP database. 6 Version: 1.1.0 7 7 Author: ReduxThemes.com 8 8 Author URI: http://reduxthemes.com/ … … 33 33 } 34 34 35 include_once( plugin_dir_path( __FILE__ ) .'defaults.php'); 36 include_once( plugin_dir_path( __FILE__ ) .'adredux_displayads.php'); 35 /** 36 * Constants 37 */ 38 if( ! defined( 'ADREDUX_VERSION' ) ) { 39 // Plugin version 40 define( 'ADREDUX_VERSION', '1.1.0' ); 41 } 42 if( ! defined( 'ADREDUX_DIR' ) ) { 43 // Plugin directory path 44 define( 'ADREDUX_DIR', plugin_dir_path( __FILE__ ) ); 45 } 46 if( ! defined( 'ADREDUX_DIR_URI' ) ) { 47 // Plugin directory URL 48 define( 'ADREDUX_DIR_URI', plugin_dir_url( __FILE__ ) ); 49 } 50 if( ! defined( 'ADREDUX_SETTINGS' ) ) { 51 // Plugin settings name 52 define( 'ADREDUX_SETTINGS', 'adredux_settings' ); 53 } 54 55 56 include_once( ADREDUX_DIR .'defaults.php'); 57 include_once( ADREDUX_DIR .'adredux_displayads.php'); 58 include_once( ADREDUX_DIR .'admin/settings-page.php'); 37 59 38 60 class Adredux_Plugin { … … 40 62 public function __construct() { 41 63 42 if ( is_multisite() ) { 43 44 //Network Wide Settings Page (Coming Soon) 45 //add_action( 'network_admin_menu', array( &$this, 'network_page' ) ); 46 47 // Hook into the admin menu 48 add_action( 'admin_menu', array( $this, 'adredux_create_settings_page' ) ); 49 50 } else { 51 52 // Hook into the admin menu 53 add_action( 'admin_menu', array( $this, 'adredux_create_settings_page' ) ); 54 55 } 64 // Plugin activation 65 register_activation_hook(__FILE__, array($this, 'adredux_plugin_activation')); 66 67 // Plugin deactivation 68 register_deactivation_hook(__FILE__, array( $this, 'adredux_plugin_deactivation')); 69 70 // Activation notice 71 add_action( 'admin_notices', array( $this, 'welcome_admin_notice' ) ); 56 72 57 73 // Add Settings and Fields … … 62 78 add_action('wp_head', array($this, 'adredux_pagelevel_adcode') ); 63 79 add_action('wp_footer', array($this, 'adredux_footer_codes') ); 80 81 //add_action( 'admin_notices', array( $this, 'welcome_admin_notice' ) ); 64 82 65 83 // Real Magic that Inserts Ads the Right Way … … 77 95 } 78 96 } ); 79 80 97 81 98 } … … 150 167 } 151 168 152 public function adredux_create_settings_page() { 153 154 // Add the menu item and page 155 $page_title = __('Ad Redux', 'adredux'); 156 $menu_title = __('Ad Redux', 'adredux'); 157 $capability = 'manage_options'; 158 $slug = 'adredux_settings'; 159 $callback = array( $this, 'adredux_settings_page_content' ); 160 $icon = 'dashicons-admin-plugins'; 161 $position = 100; 162 163 add_menu_page( $page_title, $menu_title, $capability, $slug, $callback, $icon, $position ); 164 add_submenu_page( $slug, __('Ad Redux Settings', 'adredux'), __('General Settings', 'adredux'), $capability, $slug, $callback ); 165 add_submenu_page( $slug, __('About Ad Redux', 'adredux'), __('About Ad Redux', 'adredux'), $capability, 'adredux_settings_ads', array( $this, 'adredux_settings_adpage_content' ) ); 166 167 } 168 169 public function adredux_settings_page_content() {?> 170 171 <div class="wrap"> 172 173 <h1><?php _e('Ad Redux', 'adredux'); ?></h1><?php 174 if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ){ 175 $this->adredux_admin_notice(); 176 } ?> 177 <div class="notice notice-warning" style="overflow: hidden;"> 178 179 <?php _e('<p>Set up your advertisements and display preferences for the website.</p>', 'adredux'); ?> 180 181 </div> 182 183 <form method="POST" action="options.php"> 184 <?php 185 settings_fields( 'adredux_settings'); 186 do_settings_sections( 'adredux_settings' ); 187 submit_button(); 188 ?> 189 </form> 190 191 </div> 192 193 <div class="wrap about-wrap" style="overflow: hidden; margin-left: 0;"> 194 195 <div class="postbox" style="overflow: hidden; padding-left: 30px;"> 196 197 <?php _e('<h3>Contribute & Support</h3>', 'adredux'); ?> 198 199 <?php $plugininfo = get_plugin_data(plugin_dir_path( __FILE__ ).'adredux.php'); ?> 200 201 <img src="<?php echo plugin_dir_url( __FILE__ ).'assets/icon-128x128.png'; ?>" alt="<?php echo $plugininfo['Name'];?>" style="float: right; align: left; margin: 0 30px 20px 20px; max-width: 100px; height: auto; border: 3px solid #f9f9f9;"> 202 203 <div class="about-text"> 204 <p class="about-description"><span class="dashicons dashicons-heart" style="color: #f21a1a;"></span> <?php _e('Found the AdRedux plugin useful? If you like the plugin, encourage us for the plugin development through your contributions. Consider supporting us with some money for coffee. Send some love & contributions.','adredux');?> <span class="dashicons dashicons-editor-help"></span> <?php _e('For support, drop an email to','adredux');?> <code>[email protected]</code></p> 205 <a href="http://reduxthemes.com/donate/" class="button button-primary"><?php _e('Donate & Support Us','adredux');?></a> 206 207 </div> 208 209 </div> 210 211 </div> 212 213 214 <?php } 215 216 217 public function adredux_settings_adpage_content() {?> 218 219 <?php $plugininfo = get_plugin_data(plugin_dir_path( __FILE__ ).'adredux.php'); ?> 220 221 <div class="wrap about-wrap"> 222 223 <h1><?php _e('Ad Redux — Easy Ad Management', 'adredux'); ?></h1> 224 <img src="<?php echo plugin_dir_url( __FILE__ ).'assets/banner-1544x500.png'; ?>" alt="<?php echo $plugininfo['Name'];?>" style="max-width: 99%; height: auto; border: 3px solid #f9f9f9;"> 225 226 <?php 227 if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ){ 228 $this->adredux_admin_notice(); 229 } ?> 230 231 <div class="about-text"> 232 <p class="about-description"><?php echo $plugininfo['Description'];?></p> 233 234 <?php _e('<ul style="list-style-type: square; margin-left: 20px;"> 235 <li>Use Adsense or Other Custom Codes</li> 236 <li>Insert advertisements at effective locations 237 <ul style="list-style-type: circle; margin-left: 20px;"><li>Above content</li><li>After first/second para</li><li>Middle of posts</li><li>End of content</li></ul></li> 238 <li>Define ad alignment styles: left, right, center or random</li> 239 <li>Set ad section width to make responsive advertisement codes show large rectangle box for better visibility</li> 240 <li>Exclude posts in certain categories from ads</li> 241 <li>Saves all the settings in serialized form in just one <strong>adredux_settings</strong> option in WordPress settings to avoid clutter</li> 242 <li>No clutter in database: the plugin data is deleted from your website when you <strong>deactive and delete</strong> the plugin</li> 243 </ul> 244 245 <hr/>','adredux'); ?> 246 247 </div> 248 249 <div class="wrap"> 250 251 <h3><?php _e('Recommended for You!','adredux');?></h3> 252 <p class="about-description"><span class="dashicons dashicons-megaphone" style="color: #0073aa"></span> <?php _e('Thank you for choosing AdRedux as your preferred ad inserter plugin!','adredux');?></p> 253 <p class="about-description"><span class="dashicons dashicons-megaphone" style="color: #0073aa"></span> <?php _e('There is no PRO or premium version of the plugin. Everything is absolutely FREE!','adredux');?></a>.</p> 254 <p class="about-description"><span class="dashicons dashicons-megaphone" style="color: #0073aa"></span> <?php _e('Do not forget to rate the plugin. Share your love by','adredux');?> <a href="http://reduxthemes.com/donate/"><?php _e('sending some money contributions','adredux');?></a>.</p> 255 256 <div class="plugin-card"> 257 <div class="plugin-card-top"> 258 <h3><?php _e('Our WP Themes','adredux');?></h3> 259 <p><?php _e('We have some great WordPress themes for you. Check our profile on WordPress.org, or preview the themes in your website:','adredux');?> <a href="<?php echo esc_url_raw( add_query_arg( array('search'=> 'undedicated'), admin_url( 'theme-install.php' ) ) ); ?>"><?php _e('Undedicated','adredux');?></a>, <a href="<?php echo esc_url_raw( add_query_arg( array('search'=> 'prakashan'), admin_url( 'theme-install.php' ) ) ); ?>"><?php _e('Prakashan','adredux');?></a></p> 260 </div> 261 <div class="plugin-card-bottom"> 262 <a class="button button-primary" href="https://wordpress.org/themes/author/reduxthemes/" target="_blank"><?php _e('View @ WordPress.org','adredux');?></a> 263 </div> 264 </div> 265 266 <div class="plugin-card"> 267 <div class="plugin-card-top"> 268 <h3><?php _e('Contribute & Help','adredux');?></h3> 269 <p><span class="dashicons dashicons-heart" style="color: #f21a1a;"></span> <?php _e('Found the plugin useful? Consider supporting us with some coffee. Send some love & contributions.','adredux');?> <span class="dashicons dashicons-editor-help"></span> <?php _e('For support, drop an email to','adredux');?> <code>[email protected]</code></p> 270 </div> 271 272 <div class="plugin-card-bottom"> 273 <a href="http://reduxthemes.com/donate/" class="button button-primary"><?php _e('Donate & Support Us','adredux');?></a> 274 </div> 275 </div> 276 277 </div> 278 279 280 <div class="wrap"> 281 282 <br/><hr/><br/> 283 284 <h3><?php _e('Ad Redux Settings Data','adredux');?></h3> 285 <p><?php _e('Here is the raw data as saved in the WordPress options settings of your website. All of your Ad Redux settings are saved in WordPress options, in the adredux_settings option.','adredux');?></p> 286 287 <code><?php 288 $rawdata = esc_html(print_r(get_option('adredux_settings'), true)); 289 if ($rawdata=='') { 290 _e('Empty! When you save your plugin settings, you will find the saved data here. Have fun.', 'adredux'); 291 } else { 292 echo $rawdata; 293 } 294 ?></code> 295 </div> 296 297 <div class="wrap"> 298 299 <br/><hr/><br/> 300 301 <ul> 302 <li><strong><?php _e('Plugin:', 'adredux'); ?></strong> <a href="<?php echo $plugininfo['PluginURI'];?>" rel="designer"><?php echo $plugininfo['Name'];?></a></li> 303 <li><strong><?php _e('Author:', 'adredux'); ?></strong> <a href="<?php echo $plugininfo['AuthorURI'];?>" rel="designer"><?php echo $plugininfo['Author'];?></a></li> 304 <li><strong><?php _e('Plugin URL:', 'adredux'); ?></strong> <a href="<?php echo $plugininfo['PluginURI'];?>" rel="designer"><?php echo $plugininfo['PluginURI'];?></a></li> 305 <li><strong><?php _e('Version:', 'adredux'); ?></strong> <?php echo $plugininfo['Version'];?></li> 306 </ul> 307 308 </div> 309 310 311 </div> 312 313 <?php } 314 315 public function adredux_admin_notice() { ?> 316 317 <div class="notice notice-success is-dismissible"> 318 <p><?php _e('Your ad settings have been updated!', 'adredux'); ?></p> 319 </div><?php 320 321 } 322 169 323 170 public function adredux_setup_sections() { 324 171 325 add_settings_section( 'adredux_general_settings', __('General Settings', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 326 add_settings_section( 'adredux_pagelevel_ads', __('Adsense Page-Level Ads', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 327 add_settings_section( 'adredux_adcode_one', __('Advertisement #1', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 328 add_settings_section( 'adredux_adcode_two', __('Advertisement #2', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 329 add_settings_section( 'adredux_adcode_three', __('Advertisement #3', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 330 add_settings_section( 'adredux_adcode_four', __('Advertisement #4', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 331 add_settings_section( 'adredux_adcode_five', __('Advertisement #5', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 332 add_settings_section( 'adredux_adcode_six', __('Advertisement #6', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 333 add_settings_section( 'adredux_adcode_seven', __('Advertisement #7', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 334 add_settings_section( 'adredux_adcode_eight', __('Advertisement #8', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 172 add_settings_section( 'adredux_general_settings', __('General Settings', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 173 add_settings_section( 'adredux_insert_codes', __('Insert Header & Footer Codes', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 174 add_settings_section( 'adredux_pagelevel_ads', __('Page-Level Ad Codes', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 175 add_settings_section( 'adredux_adcode_one', __('Advertisement #1', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 176 add_settings_section( 'adredux_adcode_two', __('Advertisement #2', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 177 add_settings_section( 'adredux_adcode_three', __('Advertisement #3', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 178 add_settings_section( 'adredux_adcode_four', __('Advertisement #4', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 179 add_settings_section( 'adredux_adcode_five', __('Advertisement #5', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 180 add_settings_section( 'adredux_adcode_six', __('Advertisement #6', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 181 add_settings_section( 'adredux_adcode_seven', __('Advertisement #7', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 182 add_settings_section( 'adredux_adcode_eight', __('Advertisement #8', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 335 183 336 184 } … … 341 189 case 'adredux_general_settings': 342 190 echo __('Set up your advertisement display preferences for the website.<hr/>', 'adredux'); 191 break; 192 case 'adredux_insert_codes': 193 echo __('Add the codes, styles and scripts. Displayed on all pages even when the ads disabled. For advertising codes, use the Advertising Code option instead.<hr/>', 'adredux'); 343 194 break; 344 195 case 'adredux_pagelevel_ads': … … 359 210 public function adredux_setup_fields() { 360 211 361 //Settings Name Must Be Same As Below362 $adredux_settings_name = 'adredux_settings';363 364 212 // WordPress Categories via an Array 365 213 $adredux_categories = array(); … … 379 227 380 228 $fields = array( 229 381 230 array( 382 231 'uid' => 'ad_page', … … 465 314 'supplimental' => __('Select the <strong>disable</strong> option if you want to use custom styles your advertisement blocks.', 'adredux'), 466 315 'default' => array('yes') 467 ),468 469 array(470 'uid' => 'adredux_header_codes',471 'label' => __('Header Insert (Scripts/Styles)', 'adredux'),472 'section' => 'adredux_general_settings',473 'type' => 'textarea',474 'placeholder' => '',475 'helper' => '',476 'supplimental' => __('Insert common styles and scripts across the website in the <strong> <head></strong>.', 'adredux'),477 'default' => ''478 ),479 480 array(481 'uid' => 'adredux_footer_codes',482 'label' => __('Footer Insert (Scripts)', 'adredux'),483 'section' => 'adredux_general_settings',484 'type' => 'textarea',485 'placeholder' => '',486 'helper' => '',487 'supplimental' => __('Insert common scripts for output in the <strong>HTML</strong> code, just before the closing <strong></body><strong>.', 'adredux'),488 'default' => ''489 316 ), 490 317 … … 505 332 'default' => array('1') 506 333 ), 507 334 335 array( 336 'uid' => 'adredux_header_codes', 337 'label' => __('Header Insert (Scripts/Styles)', 'adredux'), 338 'section' => 'adredux_insert_codes', 339 'type' => 'textarea', 340 'placeholder' => '', 341 'helper' => '', 342 'supplimental' => __('Insert common styles and scripts across the website in the <strong> <head></strong>.', 'adredux'), 343 'default' => '' 344 ), 345 346 array( 347 'uid' => 'adredux_footer_codes', 348 'label' => __('Footer Insert (Scripts)', 'adredux'), 349 'section' => 'adredux_insert_codes', 350 'type' => 'textarea', 351 'placeholder' => '', 352 'helper' => '', 353 'supplimental' => __('Insert common scripts for output in the <strong>HTML</strong> code, just before the closing <strong></body><strong>.', 'adredux'), 354 'default' => '' 355 ), 356 508 357 ); 509 358 510 359 foreach( $fields as $field ){ 511 360 512 add_settings_field( $adredux_settings_name.'['.$field['uid'].']', $field['label'], array( $this, 'field_callback' ), 'adredux_settings', $field['section'], $field );361 add_settings_field( ADREDUX_SETTINGS.'['.$field['uid'].']', $field['label'], array( $this, 'field_callback' ), ADREDUX_SETTINGS, $field['section'], $field ); 513 362 514 363 } … … 518 367 array( 519 368 'uid' => 'adredux_pagelevel_adcode', 520 'label' => __('Page-Level Ads ', 'adredux'),369 'label' => __('Page-Level Ads & Codes', 'adredux'), 521 370 'section' => 'adredux_pagelevel_ads', 522 371 'type' => 'textarea', 523 372 'placeholder' => '', 524 373 'helper' => '', 525 'supplimental' => __('Insert <strong>Google Adsense Page-Level Ads</strong> codeto be included within <strong><head></strong>.', 'adredux'),374 'supplimental' => __('Insert <strong>Google Adsense Page-Level Ads</strong> and advertisement script / JS codes to be included within <strong><head></strong>.', 'adredux'), 526 375 'default' => '' 527 376 ); … … 602 451 603 452 foreach( $adfields as $key=>$adfield ){ 604 add_settings_field( $adredux_settings_name.'['.$adfield['uid'].']', $adfield['label'], array( $this, 'field_callback' ), 'adredux_settings', $adfield['section'], $adfield );605 } 606 607 register_setting( 'adredux_settings', $adredux_settings_name);608 register_setting( 'adredux_settings_ads', $adredux_settings_name);453 add_settings_field( ADREDUX_SETTINGS.'['.$adfield['uid'].']', $adfield['label'], array( $this, 'field_callback' ), ADREDUX_SETTINGS, $adfield['section'], $adfield ); 454 } 455 456 register_setting( 'adredux_settings', ADREDUX_SETTINGS ); 457 register_setting( 'adredux_settings_ads', ADREDUX_SETTINGS ); 609 458 610 459 } … … 612 461 public function field_callback( $arguments ) { 613 462 614 //Settings Name Must Be Same As Above 615 $adredux_settings_name = 'adredux_settings'; 616 617 $settings = get_option( $adredux_settings_name ); 463 $settings = get_option( ADREDUX_SETTINGS ); 618 464 619 465 if ( isset( $settings[$arguments['uid']] ) ) { … … 630 476 case 'password': 631 477 case 'text': 632 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value );478 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value ); 633 479 break; 634 480 case 'number': 635 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value );481 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value ); 636 482 break; 637 483 case 'textarea': 638 printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="5" cols="50">%3$s</textarea>', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['placeholder'], $value );484 printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="5" cols="50">%3$s</textarea>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['placeholder'], $value ); 639 485 break; 640 486 case 'select': … … 649 495 $attributes = ' multiple="multiple" '; 650 496 } 651 printf( '<select name="%1$s[]" id="%1$s" %2$s>%3$s</select>', $adredux_settings_name.'['.$arguments['uid'].']', $attributes, $options_markup );497 printf( '<select name="%1$s[]" id="%1$s" %2$s>%3$s</select>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $attributes, $options_markup ); 652 498 } 653 499 break; … … 659 505 foreach( $arguments['options'] as $key => $label ){ 660 506 $iterator++; 661 $options_markup .= sprintf( '<label for="%1$s_%6$s"><input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s /> %5$s</label><br/>', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['type'], $key, checked( $value[ array_search( $key, $value, true ) ], $key, false ), $label, $iterator );507 $options_markup .= sprintf( '<label for="%1$s_%6$s"><input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s /> %5$s</label><br/>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $key, checked( $value[ array_search( $key, $value, true ) ], $key, false ), $label, $iterator ); 662 508 } 663 509 printf( '<fieldset>%s</fieldset>', $options_markup ); 664 510 } 665 511 break; 512 case 'hidden': 513 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" /><p>%4$s</p>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value ); 514 break; 666 515 } 667 516 if( $helper = $arguments['helper'] ){ … … 673 522 } 674 523 524 525 /** 526 * Display a welcome notice when the plugin is activated. 527 * 528 * @access public 529 */ 530 public function welcome_admin_notice() { 531 532 /* Check transient, if available display notice */ 533 if( get_transient( 'adredux-activated' ) ){ 534 535 $plugininfo = get_plugin_data( ADREDUX_DIR .'adredux.php'); ?> 536 537 <div class="updated notice notice-success notice-alt is-dismissible"> 538 <p> 539 <?php 540 /* translators: %1$s and %2$s are placeholders that will be replaced by variables passed as an argument. */ 541 printf( wp_kses( __( 'Welcome and thanks for choosing %1$s! To get started, please visit the <a href="%2$s">settings page</a>.', 'adredux' ), array( 'a' => array( 'href' => array() ) ) ), esc_attr( $plugininfo['Name'] ), esc_url( admin_url( 'admin.php?page=adredux' ) ) ); ?> 542 </p> 543 </div><!-- .notice --> 544 545 <?php 546 } 547 548 /* Delete transient, only display this notice once. */ 549 delete_transient( 'adredux-activated' ); 550 551 } 552 553 554 /** 555 * Run when the plugin is activated. 556 * 557 * @access public 558 */ 559 public function adredux_plugin_activation() { 560 561 /* Create transient data */ 562 set_transient( 'adredux-activated', true, 15 ); 563 564 do_action( 'adredux_activation' ); 565 566 } 567 568 569 /** 570 * Run when the plugin is deactivated. 571 * 572 * @access public 573 */ 574 public function adredux_plugin_deactivation() { 575 576 // Delete plugin settings when deactivated 577 // delete_option(ADREDUX_SETTINGS); 578 579 } 580 675 581 } 676 582 new Adredux_Plugin(); -
adredux/tags/1.1.0/defaults.php
r2073817 r2399483 6 6 } 7 7 8 function adredux_activation_actions(){9 10 do_action( 'adredux_extension_activation' );11 12 }13 14 register_activation_hook( plugin_dir_path( __FILE__ ).'adredux.php', 'adredux_activation_actions' );15 16 8 // Set Default Plugin Settings Values Here 17 9 function adredux_default_options(){ 18 10 19 11 $default = array ( 12 'version' => ADREDUX_VERSION, 20 13 'ad_page' => array ( '0' => 'posts' ), 21 14 'min_words' => '300', … … 65 58 66 59 67 if ( get_option( 'adredux_settings') !== false ) {60 if ( get_option( ADREDUX_SETTINGS ) !== false ) { 68 61 // Option Exists, Nothing to Update 69 62 } else { 70 63 // Option Not Added Yet. Add Defaults. 71 add_option( 'adredux_settings', $default);64 add_option( ADREDUX_SETTINGS, $default); 72 65 } 73 66 74 67 } 75 68 76 add_action( 'adredux_ extension_activation', 'adredux_default_options' );69 add_action( 'adredux_activation', 'adredux_default_options' ); -
adredux/tags/1.1.0/readme.txt
r2085348 r2399483 4 4 Tags: advertisements, advertising, adverts, ads, adsense, ad inserter, ad injection, ad manager, ads manager, adrotate, advertise, ad, advert, amazon, banner, banners, banner ads, blog ads, buysellads, chitika, clickbank, dfp, doubleclick, easy ads, google dfp, google adsense, google ads, insert ads, insert adsense, monetization, responsive ads, newsletter box, signup box, custom ads, rotate ads 5 5 Requires at least: 4.1 6 Tested up to: 5. 26 Tested up to: 5.5.1 7 7 Requires PHP: 5.2 8 Stable tag: 1. 0.98 Stable tag: 1.1.o 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 11 12 Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or cu tom ad codes, newsletter signup alerts, image banners, etc. in posts and pages. The plugin has been tested to work with the latest WordPress 5.0 & with the new Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. Better control and customizations for showing ads on websites based on rules such as word counts and paragraphs.12 Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or custom ad codes, newsletter signup forms, image banners, etc. in posts and pages. The plugin has been tested to work with the latest WordPress 5.0 & with the new Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. Better control and customizations for showing ads on websites based on rules such as word counts and paragraphs. You can also use this plugin to insert codes such as Google Analytics, Facebook, chat and others. You can include scripts and CSS files, and also add meta tags in your website head section. No need to edit your theme files. 13 13 14 14 == Description == 15 15 16 Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or cutom ad codes, newsletter signup alerts, image banners, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. The plugin has been tested to work with the latest WordPress 5.0 & with the Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. 16 Easily inesrt advertisements and codes in your websites. Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or cutom ad codes, newsletter signup alerts, image banners, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. The plugin has been tested to work with the latest WordPress 5.0 & with the Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. 17 18 Use this plugin to insert codes for analytics, chat, social media integration and more. Never lose your codes or meta tags on theme updates. 17 19 18 20 Place your ads at the beginning, after the first/second/third paragraphs, in the middle or at the end of the content. Better control and customizations for showing ads on websites based on rules such as word counts and paragraphs. Exclude selected post tags and categories from ad displays. Also, manually exclude specific posts and pages from ad display. The plugin is equipped with the essential features without making your website slow. Also, no clutter in your WP database. … … 123 125 == Changelog == 124 126 127 = 1.1.0 = 128 * Design updated 129 125 130 = 1.0.8 = 126 131 * Fixed ad display error for middle post & paragraph-based ads -
adredux/trunk/adredux.php
r2085348 r2399483 1 1 <?php 2 2 /* 3 Plugin Name: AdRedux - Insert Ads 3 Plugin Name: AdRedux - Insert Ads & Codes 4 4 Plugin URI: http://reduxthemes.com/adredux-wordpress-ad-plugin/ 5 Description: Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or custom ad codes, newsletter signup alerts, image banners, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. Place your ads at the beginning, after the first/second/third paragraphs, in the middle or at the end of the content. Exclude selected posts, pages, categories, tags from ad displays. The plugin is equipped with the essential features without making your website slow. No clutter in your WP database.6 Version: 1. 0.95 Description: Easily insert advertisements and codes in your website. Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, custom ad codes, analytics codes, newsletter signup forms, image banners, meta tags, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. Place your ads at the beginning, after the first/second/third paragraphs, in the middle or at the end of the content. Exclude selected posts, pages, categories, tags from ad displays. No clutter in your WP database. 6 Version: 1.1.0 7 7 Author: ReduxThemes.com 8 8 Author URI: http://reduxthemes.com/ … … 33 33 } 34 34 35 include_once( plugin_dir_path( __FILE__ ) .'defaults.php'); 36 include_once( plugin_dir_path( __FILE__ ) .'adredux_displayads.php'); 35 /** 36 * Constants 37 */ 38 if( ! defined( 'ADREDUX_VERSION' ) ) { 39 // Plugin version 40 define( 'ADREDUX_VERSION', '1.1.0' ); 41 } 42 if( ! defined( 'ADREDUX_DIR' ) ) { 43 // Plugin directory path 44 define( 'ADREDUX_DIR', plugin_dir_path( __FILE__ ) ); 45 } 46 if( ! defined( 'ADREDUX_DIR_URI' ) ) { 47 // Plugin directory URL 48 define( 'ADREDUX_DIR_URI', plugin_dir_url( __FILE__ ) ); 49 } 50 if( ! defined( 'ADREDUX_SETTINGS' ) ) { 51 // Plugin settings name 52 define( 'ADREDUX_SETTINGS', 'adredux_settings' ); 53 } 54 55 56 include_once( ADREDUX_DIR .'defaults.php'); 57 include_once( ADREDUX_DIR .'adredux_displayads.php'); 58 include_once( ADREDUX_DIR .'admin/settings-page.php'); 37 59 38 60 class Adredux_Plugin { … … 40 62 public function __construct() { 41 63 42 if ( is_multisite() ) { 43 44 //Network Wide Settings Page (Coming Soon) 45 //add_action( 'network_admin_menu', array( &$this, 'network_page' ) ); 46 47 // Hook into the admin menu 48 add_action( 'admin_menu', array( $this, 'adredux_create_settings_page' ) ); 49 50 } else { 51 52 // Hook into the admin menu 53 add_action( 'admin_menu', array( $this, 'adredux_create_settings_page' ) ); 54 55 } 64 // Plugin activation 65 register_activation_hook(__FILE__, array($this, 'adredux_plugin_activation')); 66 67 // Plugin deactivation 68 register_deactivation_hook(__FILE__, array( $this, 'adredux_plugin_deactivation')); 69 70 // Activation notice 71 add_action( 'admin_notices', array( $this, 'welcome_admin_notice' ) ); 56 72 57 73 // Add Settings and Fields … … 62 78 add_action('wp_head', array($this, 'adredux_pagelevel_adcode') ); 63 79 add_action('wp_footer', array($this, 'adredux_footer_codes') ); 80 81 //add_action( 'admin_notices', array( $this, 'welcome_admin_notice' ) ); 64 82 65 83 // Real Magic that Inserts Ads the Right Way … … 77 95 } 78 96 } ); 79 80 97 81 98 } … … 150 167 } 151 168 152 public function adredux_create_settings_page() { 153 154 // Add the menu item and page 155 $page_title = __('Ad Redux', 'adredux'); 156 $menu_title = __('Ad Redux', 'adredux'); 157 $capability = 'manage_options'; 158 $slug = 'adredux_settings'; 159 $callback = array( $this, 'adredux_settings_page_content' ); 160 $icon = 'dashicons-admin-plugins'; 161 $position = 100; 162 163 add_menu_page( $page_title, $menu_title, $capability, $slug, $callback, $icon, $position ); 164 add_submenu_page( $slug, __('Ad Redux Settings', 'adredux'), __('General Settings', 'adredux'), $capability, $slug, $callback ); 165 add_submenu_page( $slug, __('About Ad Redux', 'adredux'), __('About Ad Redux', 'adredux'), $capability, 'adredux_settings_ads', array( $this, 'adredux_settings_adpage_content' ) ); 166 167 } 168 169 public function adredux_settings_page_content() {?> 170 171 <div class="wrap"> 172 173 <h1><?php _e('Ad Redux', 'adredux'); ?></h1><?php 174 if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ){ 175 $this->adredux_admin_notice(); 176 } ?> 177 <div class="notice notice-warning" style="overflow: hidden;"> 178 179 <?php _e('<p>Set up your advertisements and display preferences for the website.</p>', 'adredux'); ?> 180 181 </div> 182 183 <form method="POST" action="options.php"> 184 <?php 185 settings_fields( 'adredux_settings'); 186 do_settings_sections( 'adredux_settings' ); 187 submit_button(); 188 ?> 189 </form> 190 191 </div> 192 193 <div class="wrap about-wrap" style="overflow: hidden; margin-left: 0;"> 194 195 <div class="postbox" style="overflow: hidden; padding-left: 30px;"> 196 197 <?php _e('<h3>Contribute & Support</h3>', 'adredux'); ?> 198 199 <?php $plugininfo = get_plugin_data(plugin_dir_path( __FILE__ ).'adredux.php'); ?> 200 201 <img src="<?php echo plugin_dir_url( __FILE__ ).'assets/icon-128x128.png'; ?>" alt="<?php echo $plugininfo['Name'];?>" style="float: right; align: left; margin: 0 30px 20px 20px; max-width: 100px; height: auto; border: 3px solid #f9f9f9;"> 202 203 <div class="about-text"> 204 <p class="about-description"><span class="dashicons dashicons-heart" style="color: #f21a1a;"></span> <?php _e('Found the AdRedux plugin useful? If you like the plugin, encourage us for the plugin development through your contributions. Consider supporting us with some money for coffee. Send some love & contributions.','adredux');?> <span class="dashicons dashicons-editor-help"></span> <?php _e('For support, drop an email to','adredux');?> <code>[email protected]</code></p> 205 <a href="http://reduxthemes.com/donate/" class="button button-primary"><?php _e('Donate & Support Us','adredux');?></a> 206 207 </div> 208 209 </div> 210 211 </div> 212 213 214 <?php } 215 216 217 public function adredux_settings_adpage_content() {?> 218 219 <?php $plugininfo = get_plugin_data(plugin_dir_path( __FILE__ ).'adredux.php'); ?> 220 221 <div class="wrap about-wrap"> 222 223 <h1><?php _e('Ad Redux — Easy Ad Management', 'adredux'); ?></h1> 224 <img src="<?php echo plugin_dir_url( __FILE__ ).'assets/banner-1544x500.png'; ?>" alt="<?php echo $plugininfo['Name'];?>" style="max-width: 99%; height: auto; border: 3px solid #f9f9f9;"> 225 226 <?php 227 if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ){ 228 $this->adredux_admin_notice(); 229 } ?> 230 231 <div class="about-text"> 232 <p class="about-description"><?php echo $plugininfo['Description'];?></p> 233 234 <?php _e('<ul style="list-style-type: square; margin-left: 20px;"> 235 <li>Use Adsense or Other Custom Codes</li> 236 <li>Insert advertisements at effective locations 237 <ul style="list-style-type: circle; margin-left: 20px;"><li>Above content</li><li>After first/second para</li><li>Middle of posts</li><li>End of content</li></ul></li> 238 <li>Define ad alignment styles: left, right, center or random</li> 239 <li>Set ad section width to make responsive advertisement codes show large rectangle box for better visibility</li> 240 <li>Exclude posts in certain categories from ads</li> 241 <li>Saves all the settings in serialized form in just one <strong>adredux_settings</strong> option in WordPress settings to avoid clutter</li> 242 <li>No clutter in database: the plugin data is deleted from your website when you <strong>deactive and delete</strong> the plugin</li> 243 </ul> 244 245 <hr/>','adredux'); ?> 246 247 </div> 248 249 <div class="wrap"> 250 251 <h3><?php _e('Recommended for You!','adredux');?></h3> 252 <p class="about-description"><span class="dashicons dashicons-megaphone" style="color: #0073aa"></span> <?php _e('Thank you for choosing AdRedux as your preferred ad inserter plugin!','adredux');?></p> 253 <p class="about-description"><span class="dashicons dashicons-megaphone" style="color: #0073aa"></span> <?php _e('There is no PRO or premium version of the plugin. Everything is absolutely FREE!','adredux');?></a>.</p> 254 <p class="about-description"><span class="dashicons dashicons-megaphone" style="color: #0073aa"></span> <?php _e('Do not forget to rate the plugin. Share your love by','adredux');?> <a href="http://reduxthemes.com/donate/"><?php _e('sending some money contributions','adredux');?></a>.</p> 255 256 <div class="plugin-card"> 257 <div class="plugin-card-top"> 258 <h3><?php _e('Our WP Themes','adredux');?></h3> 259 <p><?php _e('We have some great WordPress themes for you. Check our profile on WordPress.org, or preview the themes in your website:','adredux');?> <a href="<?php echo esc_url_raw( add_query_arg( array('search'=> 'undedicated'), admin_url( 'theme-install.php' ) ) ); ?>"><?php _e('Undedicated','adredux');?></a>, <a href="<?php echo esc_url_raw( add_query_arg( array('search'=> 'prakashan'), admin_url( 'theme-install.php' ) ) ); ?>"><?php _e('Prakashan','adredux');?></a></p> 260 </div> 261 <div class="plugin-card-bottom"> 262 <a class="button button-primary" href="https://wordpress.org/themes/author/reduxthemes/" target="_blank"><?php _e('View @ WordPress.org','adredux');?></a> 263 </div> 264 </div> 265 266 <div class="plugin-card"> 267 <div class="plugin-card-top"> 268 <h3><?php _e('Contribute & Help','adredux');?></h3> 269 <p><span class="dashicons dashicons-heart" style="color: #f21a1a;"></span> <?php _e('Found the plugin useful? Consider supporting us with some coffee. Send some love & contributions.','adredux');?> <span class="dashicons dashicons-editor-help"></span> <?php _e('For support, drop an email to','adredux');?> <code>[email protected]</code></p> 270 </div> 271 272 <div class="plugin-card-bottom"> 273 <a href="http://reduxthemes.com/donate/" class="button button-primary"><?php _e('Donate & Support Us','adredux');?></a> 274 </div> 275 </div> 276 277 </div> 278 279 280 <div class="wrap"> 281 282 <br/><hr/><br/> 283 284 <h3><?php _e('Ad Redux Settings Data','adredux');?></h3> 285 <p><?php _e('Here is the raw data as saved in the WordPress options settings of your website. All of your Ad Redux settings are saved in WordPress options, in the adredux_settings option.','adredux');?></p> 286 287 <code><?php 288 $rawdata = esc_html(print_r(get_option('adredux_settings'), true)); 289 if ($rawdata=='') { 290 _e('Empty! When you save your plugin settings, you will find the saved data here. Have fun.', 'adredux'); 291 } else { 292 echo $rawdata; 293 } 294 ?></code> 295 </div> 296 297 <div class="wrap"> 298 299 <br/><hr/><br/> 300 301 <ul> 302 <li><strong><?php _e('Plugin:', 'adredux'); ?></strong> <a href="<?php echo $plugininfo['PluginURI'];?>" rel="designer"><?php echo $plugininfo['Name'];?></a></li> 303 <li><strong><?php _e('Author:', 'adredux'); ?></strong> <a href="<?php echo $plugininfo['AuthorURI'];?>" rel="designer"><?php echo $plugininfo['Author'];?></a></li> 304 <li><strong><?php _e('Plugin URL:', 'adredux'); ?></strong> <a href="<?php echo $plugininfo['PluginURI'];?>" rel="designer"><?php echo $plugininfo['PluginURI'];?></a></li> 305 <li><strong><?php _e('Version:', 'adredux'); ?></strong> <?php echo $plugininfo['Version'];?></li> 306 </ul> 307 308 </div> 309 310 311 </div> 312 313 <?php } 314 315 public function adredux_admin_notice() { ?> 316 317 <div class="notice notice-success is-dismissible"> 318 <p><?php _e('Your ad settings have been updated!', 'adredux'); ?></p> 319 </div><?php 320 321 } 322 169 323 170 public function adredux_setup_sections() { 324 171 325 add_settings_section( 'adredux_general_settings', __('General Settings', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 326 add_settings_section( 'adredux_pagelevel_ads', __('Adsense Page-Level Ads', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 327 add_settings_section( 'adredux_adcode_one', __('Advertisement #1', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 328 add_settings_section( 'adredux_adcode_two', __('Advertisement #2', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 329 add_settings_section( 'adredux_adcode_three', __('Advertisement #3', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 330 add_settings_section( 'adredux_adcode_four', __('Advertisement #4', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 331 add_settings_section( 'adredux_adcode_five', __('Advertisement #5', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 332 add_settings_section( 'adredux_adcode_six', __('Advertisement #6', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 333 add_settings_section( 'adredux_adcode_seven', __('Advertisement #7', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 334 add_settings_section( 'adredux_adcode_eight', __('Advertisement #8', 'adredux'), array( $this, 'adredux_section_callback' ), 'adredux_settings' ); 172 add_settings_section( 'adredux_general_settings', __('General Settings', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 173 add_settings_section( 'adredux_insert_codes', __('Insert Header & Footer Codes', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 174 add_settings_section( 'adredux_pagelevel_ads', __('Page-Level Ad Codes', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 175 add_settings_section( 'adredux_adcode_one', __('Advertisement #1', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 176 add_settings_section( 'adredux_adcode_two', __('Advertisement #2', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 177 add_settings_section( 'adredux_adcode_three', __('Advertisement #3', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 178 add_settings_section( 'adredux_adcode_four', __('Advertisement #4', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 179 add_settings_section( 'adredux_adcode_five', __('Advertisement #5', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 180 add_settings_section( 'adredux_adcode_six', __('Advertisement #6', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 181 add_settings_section( 'adredux_adcode_seven', __('Advertisement #7', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 182 add_settings_section( 'adredux_adcode_eight', __('Advertisement #8', 'adredux'), array( $this, 'adredux_section_callback' ), ADREDUX_SETTINGS ); 335 183 336 184 } … … 341 189 case 'adredux_general_settings': 342 190 echo __('Set up your advertisement display preferences for the website.<hr/>', 'adredux'); 191 break; 192 case 'adredux_insert_codes': 193 echo __('Add the codes, styles and scripts. Displayed on all pages even when the ads disabled. For advertising codes, use the Advertising Code option instead.<hr/>', 'adredux'); 343 194 break; 344 195 case 'adredux_pagelevel_ads': … … 359 210 public function adredux_setup_fields() { 360 211 361 //Settings Name Must Be Same As Below362 $adredux_settings_name = 'adredux_settings';363 364 212 // WordPress Categories via an Array 365 213 $adredux_categories = array(); … … 379 227 380 228 $fields = array( 229 381 230 array( 382 231 'uid' => 'ad_page', … … 465 314 'supplimental' => __('Select the <strong>disable</strong> option if you want to use custom styles your advertisement blocks.', 'adredux'), 466 315 'default' => array('yes') 467 ),468 469 array(470 'uid' => 'adredux_header_codes',471 'label' => __('Header Insert (Scripts/Styles)', 'adredux'),472 'section' => 'adredux_general_settings',473 'type' => 'textarea',474 'placeholder' => '',475 'helper' => '',476 'supplimental' => __('Insert common styles and scripts across the website in the <strong> <head></strong>.', 'adredux'),477 'default' => ''478 ),479 480 array(481 'uid' => 'adredux_footer_codes',482 'label' => __('Footer Insert (Scripts)', 'adredux'),483 'section' => 'adredux_general_settings',484 'type' => 'textarea',485 'placeholder' => '',486 'helper' => '',487 'supplimental' => __('Insert common scripts for output in the <strong>HTML</strong> code, just before the closing <strong></body><strong>.', 'adredux'),488 'default' => ''489 316 ), 490 317 … … 505 332 'default' => array('1') 506 333 ), 507 334 335 array( 336 'uid' => 'adredux_header_codes', 337 'label' => __('Header Insert (Scripts/Styles)', 'adredux'), 338 'section' => 'adredux_insert_codes', 339 'type' => 'textarea', 340 'placeholder' => '', 341 'helper' => '', 342 'supplimental' => __('Insert common styles and scripts across the website in the <strong> <head></strong>.', 'adredux'), 343 'default' => '' 344 ), 345 346 array( 347 'uid' => 'adredux_footer_codes', 348 'label' => __('Footer Insert (Scripts)', 'adredux'), 349 'section' => 'adredux_insert_codes', 350 'type' => 'textarea', 351 'placeholder' => '', 352 'helper' => '', 353 'supplimental' => __('Insert common scripts for output in the <strong>HTML</strong> code, just before the closing <strong></body><strong>.', 'adredux'), 354 'default' => '' 355 ), 356 508 357 ); 509 358 510 359 foreach( $fields as $field ){ 511 360 512 add_settings_field( $adredux_settings_name.'['.$field['uid'].']', $field['label'], array( $this, 'field_callback' ), 'adredux_settings', $field['section'], $field );361 add_settings_field( ADREDUX_SETTINGS.'['.$field['uid'].']', $field['label'], array( $this, 'field_callback' ), ADREDUX_SETTINGS, $field['section'], $field ); 513 362 514 363 } … … 518 367 array( 519 368 'uid' => 'adredux_pagelevel_adcode', 520 'label' => __('Page-Level Ads ', 'adredux'),369 'label' => __('Page-Level Ads & Codes', 'adredux'), 521 370 'section' => 'adredux_pagelevel_ads', 522 371 'type' => 'textarea', 523 372 'placeholder' => '', 524 373 'helper' => '', 525 'supplimental' => __('Insert <strong>Google Adsense Page-Level Ads</strong> codeto be included within <strong><head></strong>.', 'adredux'),374 'supplimental' => __('Insert <strong>Google Adsense Page-Level Ads</strong> and advertisement script / JS codes to be included within <strong><head></strong>.', 'adredux'), 526 375 'default' => '' 527 376 ); … … 602 451 603 452 foreach( $adfields as $key=>$adfield ){ 604 add_settings_field( $adredux_settings_name.'['.$adfield['uid'].']', $adfield['label'], array( $this, 'field_callback' ), 'adredux_settings', $adfield['section'], $adfield );605 } 606 607 register_setting( 'adredux_settings', $adredux_settings_name);608 register_setting( 'adredux_settings_ads', $adredux_settings_name);453 add_settings_field( ADREDUX_SETTINGS.'['.$adfield['uid'].']', $adfield['label'], array( $this, 'field_callback' ), ADREDUX_SETTINGS, $adfield['section'], $adfield ); 454 } 455 456 register_setting( 'adredux_settings', ADREDUX_SETTINGS ); 457 register_setting( 'adredux_settings_ads', ADREDUX_SETTINGS ); 609 458 610 459 } … … 612 461 public function field_callback( $arguments ) { 613 462 614 //Settings Name Must Be Same As Above 615 $adredux_settings_name = 'adredux_settings'; 616 617 $settings = get_option( $adredux_settings_name ); 463 $settings = get_option( ADREDUX_SETTINGS ); 618 464 619 465 if ( isset( $settings[$arguments['uid']] ) ) { … … 630 476 case 'password': 631 477 case 'text': 632 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value );478 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value ); 633 479 break; 634 480 case 'number': 635 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value );481 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" />', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value ); 636 482 break; 637 483 case 'textarea': 638 printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="5" cols="50">%3$s</textarea>', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['placeholder'], $value );484 printf( '<textarea name="%1$s" id="%1$s" placeholder="%2$s" rows="5" cols="50">%3$s</textarea>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['placeholder'], $value ); 639 485 break; 640 486 case 'select': … … 649 495 $attributes = ' multiple="multiple" '; 650 496 } 651 printf( '<select name="%1$s[]" id="%1$s" %2$s>%3$s</select>', $adredux_settings_name.'['.$arguments['uid'].']', $attributes, $options_markup );497 printf( '<select name="%1$s[]" id="%1$s" %2$s>%3$s</select>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $attributes, $options_markup ); 652 498 } 653 499 break; … … 659 505 foreach( $arguments['options'] as $key => $label ){ 660 506 $iterator++; 661 $options_markup .= sprintf( '<label for="%1$s_%6$s"><input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s /> %5$s</label><br/>', $adredux_settings_name.'['.$arguments['uid'].']', $arguments['type'], $key, checked( $value[ array_search( $key, $value, true ) ], $key, false ), $label, $iterator );507 $options_markup .= sprintf( '<label for="%1$s_%6$s"><input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s /> %5$s</label><br/>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $key, checked( $value[ array_search( $key, $value, true ) ], $key, false ), $label, $iterator ); 662 508 } 663 509 printf( '<fieldset>%s</fieldset>', $options_markup ); 664 510 } 665 511 break; 512 case 'hidden': 513 printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" /><p>%4$s</p>', ADREDUX_SETTINGS.'['.$arguments['uid'].']', $arguments['type'], $arguments['placeholder'], $value ); 514 break; 666 515 } 667 516 if( $helper = $arguments['helper'] ){ … … 673 522 } 674 523 524 525 /** 526 * Display a welcome notice when the plugin is activated. 527 * 528 * @access public 529 */ 530 public function welcome_admin_notice() { 531 532 /* Check transient, if available display notice */ 533 if( get_transient( 'adredux-activated' ) ){ 534 535 $plugininfo = get_plugin_data( ADREDUX_DIR .'adredux.php'); ?> 536 537 <div class="updated notice notice-success notice-alt is-dismissible"> 538 <p> 539 <?php 540 /* translators: %1$s and %2$s are placeholders that will be replaced by variables passed as an argument. */ 541 printf( wp_kses( __( 'Welcome and thanks for choosing %1$s! To get started, please visit the <a href="%2$s">settings page</a>.', 'adredux' ), array( 'a' => array( 'href' => array() ) ) ), esc_attr( $plugininfo['Name'] ), esc_url( admin_url( 'admin.php?page=adredux' ) ) ); ?> 542 </p> 543 </div><!-- .notice --> 544 545 <?php 546 } 547 548 /* Delete transient, only display this notice once. */ 549 delete_transient( 'adredux-activated' ); 550 551 } 552 553 554 /** 555 * Run when the plugin is activated. 556 * 557 * @access public 558 */ 559 public function adredux_plugin_activation() { 560 561 /* Create transient data */ 562 set_transient( 'adredux-activated', true, 15 ); 563 564 do_action( 'adredux_activation' ); 565 566 } 567 568 569 /** 570 * Run when the plugin is deactivated. 571 * 572 * @access public 573 */ 574 public function adredux_plugin_deactivation() { 575 576 // Delete plugin settings when deactivated 577 // delete_option(ADREDUX_SETTINGS); 578 579 } 580 675 581 } 676 582 new Adredux_Plugin(); -
adredux/trunk/defaults.php
r2073817 r2399483 6 6 } 7 7 8 function adredux_activation_actions(){9 10 do_action( 'adredux_extension_activation' );11 12 }13 14 register_activation_hook( plugin_dir_path( __FILE__ ).'adredux.php', 'adredux_activation_actions' );15 16 8 // Set Default Plugin Settings Values Here 17 9 function adredux_default_options(){ 18 10 19 11 $default = array ( 12 'version' => ADREDUX_VERSION, 20 13 'ad_page' => array ( '0' => 'posts' ), 21 14 'min_words' => '300', … … 65 58 66 59 67 if ( get_option( 'adredux_settings') !== false ) {60 if ( get_option( ADREDUX_SETTINGS ) !== false ) { 68 61 // Option Exists, Nothing to Update 69 62 } else { 70 63 // Option Not Added Yet. Add Defaults. 71 add_option( 'adredux_settings', $default);64 add_option( ADREDUX_SETTINGS, $default); 72 65 } 73 66 74 67 } 75 68 76 add_action( 'adredux_ extension_activation', 'adredux_default_options' );69 add_action( 'adredux_activation', 'adredux_default_options' ); -
adredux/trunk/readme.txt
r2085348 r2399483 4 4 Tags: advertisements, advertising, adverts, ads, adsense, ad inserter, ad injection, ad manager, ads manager, adrotate, advertise, ad, advert, amazon, banner, banners, banner ads, blog ads, buysellads, chitika, clickbank, dfp, doubleclick, easy ads, google dfp, google adsense, google ads, insert ads, insert adsense, monetization, responsive ads, newsletter box, signup box, custom ads, rotate ads 5 5 Requires at least: 4.1 6 Tested up to: 5. 26 Tested up to: 5.5.1 7 7 Requires PHP: 5.2 8 Stable tag: 1. 0.98 Stable tag: 1.1.o 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 11 12 Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or cu tom ad codes, newsletter signup alerts, image banners, etc. in posts and pages. The plugin has been tested to work with the latest WordPress 5.0 & with the new Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. Better control and customizations for showing ads on websites based on rules such as word counts and paragraphs.12 Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or custom ad codes, newsletter signup forms, image banners, etc. in posts and pages. The plugin has been tested to work with the latest WordPress 5.0 & with the new Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. Better control and customizations for showing ads on websites based on rules such as word counts and paragraphs. You can also use this plugin to insert codes such as Google Analytics, Facebook, chat and others. You can include scripts and CSS files, and also add meta tags in your website head section. No need to edit your theme files. 13 13 14 14 == Description == 15 15 16 Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or cutom ad codes, newsletter signup alerts, image banners, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. The plugin has been tested to work with the latest WordPress 5.0 & with the Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. 16 Easily inesrt advertisements and codes in your websites. Simple in-post ad management plugin to help you show ads on your website easily. Insert Google Adsense code, or cutom ad codes, newsletter signup alerts, image banners, etc., easily within the content in posts and/or pages. Place you ads at strategic locations within the content and also rotate the ad placements to fight ad-blindness. The plugin has been tested to work with the latest WordPress 5.0 & with the Gutenberg editor. Manage and insert Google Ads, and other advertisements easily. 17 18 Use this plugin to insert codes for analytics, chat, social media integration and more. Never lose your codes or meta tags on theme updates. 17 19 18 20 Place your ads at the beginning, after the first/second/third paragraphs, in the middle or at the end of the content. Better control and customizations for showing ads on websites based on rules such as word counts and paragraphs. Exclude selected post tags and categories from ad displays. Also, manually exclude specific posts and pages from ad display. The plugin is equipped with the essential features without making your website slow. Also, no clutter in your WP database. … … 123 125 == Changelog == 124 126 127 = 1.1.0 = 128 * Design updated 129 125 130 = 1.0.8 = 126 131 * Fixed ad display error for middle post & paragraph-based ads
Note: See TracChangeset
for help on using the changeset viewer.