Changeset 1516997
- Timestamp:
- 10/17/2016 10:07:41 PM (9 years ago)
- Location:
- no-page-comment/trunk
- Files:
-
- 2 edited
-
no-page-comment-settings.php (modified) (2 diffs)
-
no-page-comment.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
no-page-comment/trunk/no-page-comment-settings.php
r1217695 r1516997 6 6 ?> 7 7 8 <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" class="wrap npc-settings"> 8 <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" class="wrap npc-settings"> 9 10 <?php 11 // Add nonce to prevent CSRF 12 wp_nonce_field( 'sta_npc_csrf_nonce' ); 13 $nonce = ( isset( $_REQUEST['_wpnonce'] ) ) ? $_REQUEST['_wpnonce'] : false; 14 ?> 9 15 10 16 <?php 11 17 // Prints out the admin settings page 12 $sta_npc_nonce = wp_create_nonce( 'sta_npc_nonce');18 $sta_npc_nonce = wp_create_nonce( 'sta_npc_nonce' ); 13 19 $sta_npc_options = $this->sta_npc_get_admin_options(); 14 20 15 if ( isset($_POST['update_sta_npc_plugin_settings']) ) {21 if ( wp_verify_nonce( $nonce, 'sta_npc_csrf_nonce' ) && isset( $_POST['update_sta_npc_plugin_settings'] ) ) { 16 22 17 foreach ( get_post_types( '','objects') as $posttype ) {23 foreach ( get_post_types( '', 'objects' ) as $posttype ) { 18 24 if ( in_array( $posttype->name, $this->excluded_posttypes ) ) 19 25 continue; 20 26 21 if ( isset( $_POST['sta_npc_disable_comments_' . $posttype->name]) ) {27 if ( isset( $_POST['sta_npc_disable_comments_' . $posttype->name] ) ) { 22 28 $sta_npc_options['disable_comments_' . $posttype->name] = $_POST['sta_npc_disable_comments_' . $posttype->name]; 23 29 } else { … … 25 31 } 26 32 27 if ( isset( $_POST['sta_npc_disable_trackbacks_' . $posttype->name]) ) {33 if ( isset( $_POST['sta_npc_disable_trackbacks_' . $posttype->name] ) ) { 28 34 $sta_npc_options['disable_trackbacks_' . $posttype->name] = $_POST['sta_npc_disable_trackbacks_' . $posttype->name]; 29 35 } else { -
no-page-comment/trunk/no-page-comment.php
r1217740 r1516997 4 4 Plugin URI: http://sethalling.com/plugins/no-page-comment 5 5 Description: An admin interface to control the default comment and trackback settings on new posts, pages and custom post types. 6 Version: 1. 16 Version: 1.2 7 7 Author: Seth Alling 8 8 Author URI: http://sethalling.com/ … … 57 57 58 58 if ( ! function_exists( 'sta_npc_load' ) ) { 59 59 60 function sta_npc_load() { 61 60 62 if ( ! class_exists( 'STA_NPC_Plugin' ) ) { 63 61 64 class STA_NPC_Plugin { 65 62 66 var $admin_options_name = 'sta_npc_options', 63 67 $admin_options_name_old = 'sta_npc_admin_options_name', … … 73 77 'attachment' 74 78 ); 79 75 80 public $excluded_posttypes = array( 76 81 'revision', 77 82 'nav_menu_item', 78 83 ); 79 public $plugin_ver = '1.0.7'; 84 85 public $plugin_ver = '1.2'; 80 86 81 87 // Plugin Constructor 82 function sta_npc_plugin() {88 function __construct() { 83 89 $this->plugin_dir = plugins_url( '/', __FILE__ ); 84 90 $this->plugin_file = $this->plugin_name . '.php'; … … 122 128 $sta_npc_admin_options[$key] = $option; 123 129 } 130 124 131 update_option( $this->admin_options_name, $sta_npc_admin_options ); 125 132 return $sta_npc_admin_options; … … 450 457 451 458 } 459 452 460 } 461 453 462 } 454 463
Note: See TracChangeset
for help on using the changeset viewer.