Changeset 3281980
- Timestamp:
- 04/25/2025 03:08:01 PM (11 months ago)
- Location:
- quentn-wp/trunk
- Files:
-
- 10 edited
-
admin/class-quentn-wp-admin.php (modified) (5 diffs)
-
includes/class-quentn-wp-access-overview-list.php (modified) (3 diffs)
-
includes/class-quentn-wp-page-restrictions-list.php (modified) (5 diffs)
-
includes/class-quentn-wp-rest-api-controller.php (modified) (2 diffs)
-
includes/class-quentn-wp.php (modified) (2 diffs)
-
languages/quentn-wp-de_DE.mo (modified) (previous)
-
languages/quentn-wp-de_DE.po (modified) (3 diffs)
-
languages/quentn-wp.pot (modified) (1 diff)
-
quentn-wp.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
quentn-wp/trunk/admin/class-quentn-wp-admin.php
r3073163 r3281980 231 231 $hook_access_overview = add_submenu_page("NULL", __( 'Quentn User Access', 'quentn-wp'), __('Access', 'quentn-wp'), "manage_options", "quentn-page-access-overview", array( $this, 'access_restrictions_list' ) ); 232 232 233 add_action( "load-$hook_access_overview", array( $this, ' access_overview_list_screen_option' ) );233 add_action( "load-$hook_access_overview", array( $this, 'set_access_overview_screen_option' ) ); 234 234 } 235 235 … … 312 312 $args = array( 313 313 'label' => 'Access', 314 'default' => 1,315 'option' => 'quentn_restricted_ access_records_per_page'314 'default' => 20, 315 'option' => 'quentn_restricted_records_per_page' 316 316 ); 317 317 … … 328 328 */ 329 329 330 public function access_overview_list_screen_option() {330 public function set_access_overview_screen_option() { 331 331 332 332 $option = 'per_page'; … … 589 589 } 590 590 591 592 /** 593 * Display warning message for older version than 1.2.9 594 * 595 * @since 1.2.11 596 * @access public 597 * @return void 598 */ 599 public function version_update_warning($plugin_data) { 600 if ( version_compare( $plugin_data['Version'], '1.2.9', '<' ) ) { 601 printf( 602 '<span style="display:block; margin-top: 5px; color: #c00;"><strong>⚠️ %s</strong></span>', 603 esc_html__( 'This is an important update! Please update immediately to version 1.2.9 or higher!', 'quentn-wp' ) 604 ); 605 606 } 607 } 608 609 591 610 /** 592 611 * Check if learndash plugin is active … … 1113 1132 * @return void 1114 1133 */ 1115 public function set_screen_option( $status, $option, $value ) { 1116 return $value; 1134 public function set_screen_option($status, $option, $value) { 1135 $valid_options = [ 1136 'quentn_restricted_records_per_page', 1137 'quentn_access_overview_records_per_page' 1138 ]; 1139 1140 if (in_array($option, $valid_options)) { 1141 return $value; 1142 } 1143 return $status; 1117 1144 } 1118 1145 -
quentn-wp/trunk/includes/class-quentn-wp-access-overview-list.php
r3266307 r3281980 213 213 * @return mixed 214 214 */ 215 public function get_quentn_restrictions( $per_page = 5, $page_number = 1, $page_id ) {215 public function get_quentn_restrictions( $per_page = 20, $page_number = 1, $page_id ) { 216 216 global $wpdb; 217 217 … … 229 229 } 230 230 231 $ sql .= " LIMIT $per_page";232 $sql .= ' OFFSET ' . ( $page_number - 1 ) * $per_page;233 234 $results = $wpdb->get_results( $sql, 'ARRAY_A');231 $offset = ($page_number - 1) * $per_page; 232 $sql .= $wpdb->prepare(" LIMIT %d OFFSET %d", $per_page, $offset); 233 234 $results = $wpdb->get_results($sql, 'ARRAY_A'); 235 235 236 236 $is_countdown = ( isset( $this->quentn_page_restriction_data['countdown'] ) && $this->quentn_page_restriction_data['countdown'] ) ? true : false ; … … 471 471 472 472 $qntn_list_table = new Quentn_Wp_Access_Overview( sanitize_text_field( $_REQUEST['page_id'] ) ); 473 474 // Get current screen 475 $screen = get_current_screen(); 476 477 // Add screen option if not already added 478 if (!empty($screen) && !$screen->get_option('per_page')) { 479 add_screen_option('per_page', [ 480 'default' => 20, 481 'option' => 'quentn_access_overview_records_per_page', 482 'label' => __('Records per page', 'quentn-wp') 483 ]); 484 } 485 473 486 $qntn_list_table->prepare_items(); 474 487 -
quentn-wp/trunk/includes/class-quentn-wp-page-restrictions-list.php
r3073163 r3281980 48 48 $per_page = $this->get_items_per_page( 'quentn_restricted_records_per_page', 20 ); 49 49 $current_page = $this->get_pagenum(); 50 $total_items = count( $this->get_restricted_pages());50 $total_items = $this->get_total_restricted_pages_count(); 51 51 52 52 $this->set_pagination_args( array( … … 139 139 * @return array 140 140 */ 141 public function get_quentn_restrictions( $per_page = 20, $page_number = 1) {142 143 $restricted_pages = $this->get_restricted_pages(); 144 if( count( $restricted_pages ) < 1) {141 public function get_quentn_restrictions($per_page = 20, $page_number = 1) { 142 $restricted_pages = $this->get_restricted_pages($per_page, $page_number); 143 144 if(empty($restricted_pages)) { 145 145 return array(); 146 146 } 147 147 148 148 $result = array(); 149 150 //get number of access links for all restricted pages 151 $restricted_pages_ids = array_column( $restricted_pages, 'ID' ); 152 $number_of_access_links = $this->access_links_count( $restricted_pages_ids ); 153 154 foreach( $restricted_pages as $restricted_page ) 155 { 156 //get meta of page 157 $quentn_post_restrict_meta = get_post_meta( $restricted_page->ID, '_quentn_post_restrict_meta', true ); 158 159 $restriction_type = ( isset( $quentn_post_restrict_meta['countdown'] ) && $quentn_post_restrict_meta['countdown'] ) ? __( 'CountDown', 'quentn-wp' ): __( 'Access', 'quentn-wp' ); 149 $restricted_pages_ids = wp_list_pluck($restricted_pages, 'ID'); 150 $number_of_access_links = $this->access_links_count($restricted_pages_ids); 151 152 foreach($restricted_pages as $restricted_page) { 153 $quentn_post_restrict_meta = get_post_meta($restricted_page->ID, '_quentn_post_restrict_meta', true); 154 155 $restriction_type = (isset($quentn_post_restrict_meta['countdown']) && $quentn_post_restrict_meta['countdown']) 156 ? __('CountDown', 'quentn-wp') 157 : __('Access', 'quentn-wp'); 160 158 161 159 $result[] = array( … … 163 161 "page_title" => $restricted_page->post_title, 164 162 "restriction_type" => $restriction_type, 165 "total_access_links" => isset( $number_of_access_links[$restricted_page->ID] ) ? $number_of_access_links[$restricted_page->ID] : 0 , 163 "total_access_links" => isset($number_of_access_links[$restricted_page->ID]) 164 ? $number_of_access_links[$restricted_page->ID] 165 : 0, 166 166 ); 167 167 } 168 168 169 return $result; 169 170 } 171 170 172 171 173 /** … … 225 227 } 226 228 227 /** 228 * get restricted pages list 229 * 230 * @since 1.2.8 231 * @access public 232 * @return void 233 */ 234 public function get_restricted_pages() { 235 236 $restricted_pages_query = new WP_Query( array( 237 'post_type' => 'page', 238 'meta_key' => '_quentn_post_restrict_meta', 239 'orderby' => 'title', 240 'order' => 'ASC', 241 ) ); 242 $restricted_pages = []; 243 if ( $restricted_pages_query->have_posts() ) { 244 $restricted_pages = $restricted_pages_query->posts; 245 } 246 return $restricted_pages; 247 } 229 /** 230 * Get restricted pages list with pagination support 231 * 232 * @since 1.2.8 233 * @access public 234 * @param int $per_page Number of items per page 235 * @param int $page_number Current page number 236 * @return array 237 */ 238 public function get_restricted_pages($per_page = 20, $page_number = 1) { 239 $args = array( 240 'post_type' => 'page', 241 'meta_key' => '_quentn_post_restrict_meta', 242 'orderby' => 'title', 243 'order' => 'ASC', 244 'posts_per_page' => $per_page, 245 'paged' => $page_number, 246 'fields' => 'all', // Get full post objects 247 ); 248 249 $restricted_pages_query = new WP_Query($args); 250 return $restricted_pages_query->posts; 251 } 252 253 /** 254 * Get total count of restricted pages 255 * 256 * @return int 257 */ 258 public function get_total_restricted_pages_count() { 259 $args = array( 260 'post_type' => 'page', 261 'meta_key' => '_quentn_post_restrict_meta', 262 'fields' => 'ids', 263 'posts_per_page' => -1, 264 ); 265 266 $query = new WP_Query($args); 267 return $query->found_posts; 268 } 248 269 } 249 270 … … 255 276 */ 256 277 function quentn_show_data_page_restrictions_list() { 257 ?>258 <h3><?php _e( 'List of Pages With Limited Access', 'quentn-wp' ); ?></h3>259 <?php260 278 $qntn_list_table = new Quentn_Wp_Page_Restrictions_List(); 279 280 // Get current screen 281 $screen = get_current_screen(); 282 283 // Add screen option if not already added 284 if (!empty($screen) && !$screen->get_option('per_page')) { 285 add_screen_option('per_page', [ 286 'default' => 20, 287 'option' => 'quentn_restricted_records_per_page', 288 'label' => __('Records per page', 'quentn-wp') 289 ]); 290 } 291 292 echo '<div class="wrap">'; 293 echo '<h1>' . __('List of Pages With Limited Access', 'quentn-wp') . '</h1>'; 261 294 $qntn_list_table->prepare_items(); 262 295 $qntn_list_table->display(); 296 echo '</div>'; 263 297 } 264 298 -
quentn-wp/trunk/includes/class-quentn-wp-rest-api-controller.php
r3266340 r3281980 592 592 $wp_roles = new WP_Roles(); 593 593 $all_roles = $wp_roles->get_names(); 594 unset($all_roles['administrator']); //do not support anymore to add administrator role using api 594 595 //todo remove json_encode function 595 596 return rest_ensure_response( json_encode( $all_roles ) ); … … 863 864 return new WP_Error('page_access_call_failed', $wpdb->last_error); 864 865 } 865 866 866 867 867 //prepare response data -
quentn-wp/trunk/includes/class-quentn-wp.php
r3266340 r3281980 75 75 $this->version = QUENTN_WP_VERSION; 76 76 } else { 77 $this->version = '1.2.1 0';77 $this->version = '1.2.11'; 78 78 } 79 79 $this->plugin_name = 'quentn-wp'; … … 294 294 $this->loader->add_action( 'wp_ajax_quentn_dismiss_member_plugin_notice', $plugin_admin, 'member_plugin_notice_dismiss_ajax_handler' ); 295 295 296 $this->loader->add_action( 'in_plugin_update_message-'.Helper::get_plugin_name(), $plugin_admin, 'version_update_warning' ); 297 296 298 //filter screen options 297 299 $this->loader->add_filter( 'set-screen-option', $plugin_admin, 'set_screen_option', 10, 3 ); -
quentn-wp/trunk/languages/quentn-wp-de_DE.po
r3073163 r3281980 3 3 "Project-Id-Version: Quentn wp\n" 4 4 "POT-Creation-Date: 2019-08-07 17:34+0200\n" 5 "PO-Revision-Date: 202 4-03-19 14:43+0100\n"5 "PO-Revision-Date: 2025-04-25 18:13+0500\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: Quentn GmbH\n" … … 11 11 "Content-Transfer-Encoding: 8bit\n" 12 12 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 13 "X-Generator: Poedit 3. 4.2\n"13 "X-Generator: Poedit 3.6\n" 14 14 "X-Poedit-Basepath: ..\n" 15 15 "X-Poedit-KeywordsList: __;_e;_n;esc_html__;esc_html_e\n" … … 606 606 msgid "User access could not be deleted." 607 607 msgstr "Benutzerzugang konnte nicht gelöscht werden." 608 609 msgid "This is an important update! Please update immediately to version 1.2.9 or higher!" 610 msgstr "Wichtiges Update! Bitte update umgehend auf die Version 1.2.9 oder höher!" -
quentn-wp/trunk/languages/quentn-wp.pot
r3073163 r3281980 612 612 msgid "User access could not be deleted." 613 613 msgstr "" 614 615 msgid "This is an important update! Please update immediately to version 1.2.9 or higher!" 616 msgstr "" -
quentn-wp/trunk/quentn-wp.php
r3266340 r3281980 17 17 * Plugin URI: https://docs.quentn.com/de/beta-quentn-wordpress-plugin/installieren-und-verbinden 18 18 * Description: This plugin allows you to restrict access to specific pages, create custom access links and create dynamic page countdowns. Optionally, you can connect your Quentn account to your WordPress installation to share contacts and manage access restrictions through Quentn. 19 * Version: 1.2.1 019 * Version: 1.2.11 20 20 * Author: Quentn.com GmbH 21 21 * Author URI: https://quentn.com/ … … 35 35 define( "QUENTN_WP_PLUGIN_DIR", plugin_dir_path( __FILE__ ) ); 36 36 define( "QUENTN_WP_PLUGIN_URL", plugin_dir_url( __FILE__ ) ); 37 define( 'QUENTN_WP_VERSION', '1.2.1 0' );37 define( 'QUENTN_WP_VERSION', '1.2.11' ); 38 38 define( 'QUENTN_WP_DB_VERSION', '1.1' ); 39 39 -
quentn-wp/trunk/readme.txt
r3266340 r3281980 4 4 Requires at least: 4.6.0 5 5 Tested up to: 6.7.2 6 Stable tag: 1.2.1 06 Stable tag: 1.2.11 7 7 Requires PHP: 5.6.0 8 8 License: GPLv2 or later … … 67 67 == Changelog == 68 68 69 = 1.2.11 = 70 * Fix: Fixed pagination and screen options for list of restricted pages and access overview. 71 69 72 = 1.2.10 = 70 73 * Fix: Update user messages … … 175 178 == Upgrade Notice == 176 179 180 = 1.2.11 - Security Update = 181 Thanks for using Quentn Plugin! Please update the plugin to fix pagination and screen options for list of restricted pages and access overview. 182 177 183 = 1.2.10 - Security Update = 178 184 This is a critical security update. It addresses potential SQL injection vulnerabilities found in previous versions. Please update immediately to ensure your site remains secure.
Note: See TracChangeset
for help on using the changeset viewer.