Changeset 3383591
- Timestamp:
- 10/23/2025 05:21:30 PM (5 months ago)
- Location:
- shorterm/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
shorterm.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shorterm/trunk/readme.txt
r3383575 r3383591 5 5 Requires at least: 5.0 6 6 Tested up to: 6.8 7 Stable tag: 1.0. 47 Stable tag: 1.0.5 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later -
shorterm/trunk/shorterm.php
r3383575 r3383591 4 4 Plugin URI: https://shorterm.eu/ 5 5 Description: A simple URL shortener plugin that creates short links. Upgrade to Pro for custom slugs, click tracking, and more! 6 Version: 1.0. 46 Version: 1.0.5 7 7 Author: Sevis Dimitris 8 8 Author URI: https://demedia.gr … … 68 68 add_action( 'plugins_loaded', 'shorterm_update_db_check' ); 69 69 70 // ... (Όλος ο υπόλοιπος κώδικας μέχρι τη συνάρτηση shorterm_menu παραμένει ο ίδιος) ... 71 // ... (Για λόγους συντομίας, παραλείπεται εδώ, αλλά εσύ τον έχεις ήδη) ... 72 70 73 /** 71 74 * Generates a unique random slug. … … 86 89 } 87 90 88 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery89 91 $exists = $wpdb->get_var( 90 92 $wpdb->prepare( 91 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared92 93 "SELECT id FROM `{$table_name}` WHERE custom_slug = %s", 93 94 $random_slug … … 122 123 ); 123 124 124 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery125 125 $result = $wpdb->insert( $table_name, $data_to_insert, array( '%s', '%s', '%s' ) ); 126 126 … … 163 163 164 164 if ( false === $link ) { 165 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery166 165 $link = $wpdb->get_row( 167 166 $wpdb->prepare( 168 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared169 167 "SELECT * FROM `{$links_table_name}` WHERE custom_slug = %s", 170 168 $custom_slug … … 190 188 } 191 189 192 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching193 190 $wpdb->insert( 194 191 $clicks_table_name, … … 200 197 ); 201 198 202 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching203 199 $wpdb->update( 204 200 $links_table_name, … … 224 220 if ( false === $links ) { 225 221 $table_name = $wpdb->prefix . 'shorterm_links'; 226 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared227 222 $links = $wpdb->get_results( "SELECT * FROM `{$table_name}` ORDER BY created_at DESC" ); 228 223 set_transient( 'shorterm_all_links', $links, 5 * MINUTE_IN_SECONDS ); … … 250 245 } 251 246 252 253 247 /** 254 248 * AJAX handler to create a new short link. … … 265 259 } 266 260 267 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized268 261 $original_url = esc_url_raw( trim( wp_unslash( $_POST['original_url'] ) ) ); 269 262 … … 309 302 $table_name = $wpdb->prefix . 'shorterm_links'; 310 303 311 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery312 304 $slug_to_delete = $wpdb->get_var( 313 305 $wpdb->prepare( 314 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared315 306 "SELECT custom_slug FROM `{$table_name}` WHERE id = %d", 316 307 $id … … 318 309 ); 319 310 320 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching321 311 $result = $wpdb->delete( $table_name, array( 'id' => $id ), array( '%d' ) ); 322 312 … … 338 328 */ 339 329 function shorterm_menu() { 340 $page_hook_suffix = add_menu_page( 'Shorterm Dashboard', 'Shorterm', 'manage_options', 'shorterm-dashboard', 'shorterm_dashboard', 'dashicons-admin-links', 30 );341 add_ action( 'admin_print_styles-' . $page_hook_suffix, 'shorterm_enqueue_admin_assets');330 // *** ΔΙΟΡΘΩΣΗ: Δεν χρειάζεται πλέον να φορτώνουμε τα assets από εδώ. *** 331 add_menu_page( 'Shorterm Dashboard', 'Shorterm', 'manage_options', 'shorterm-dashboard', 'shorterm_dashboard', 'dashicons-admin-links', 30 ); 342 332 } 343 333 add_action( 'admin_menu', 'shorterm_menu' ); … … 429 419 <tbody id="shorterm-links-body"> 430 420 <?php 431 // To satisfy strict WordPress coding standards checkers, we first store the output432 // in a variable and then echo that variable through an escaping function.433 421 $links_html = shorterm_get_links_table(); 434 422 echo wp_kses_post( $links_html ); … … 446 434 * Enqueues admin-specific scripts and styles. 447 435 */ 448 function shorterm_enqueue_admin_assets() { 449 // We increment the version number to force browsers to download the new CSS file. 450 $plugin_version = '1.0.9'; 436 function shorterm_enqueue_admin_assets( $hook_suffix ) { 437 // *** ΔΙΟΡΘΩΣΗ: Φορτώνουμε τα αρχεία ΜΟΝΟ στη σελίδα του plugin μας. *** 438 if ( 'toplevel_page_shorterm-dashboard' !== $hook_suffix ) { 439 return; 440 } 441 442 $plugin_version = '1.0.5'; 451 443 452 444 wp_enqueue_style( … … 473 465 ); 474 466 } 475 467 // *** ΔΙΟΡΘΩΣΗ: Χρησιμοποιούμε το σωστό, μοντέρνο hook για να φορτώνουμε τα admin assets. *** 468 add_action( 'admin_enqueue_scripts', 'shorterm_enqueue_admin_assets' ); 469 470 /** 471 * This function seems to be unused in the provided logic but is kept for completeness. 472 */ 476 473 function shorterm_display_password_form( $link_id, $error = false ) { 477 // This function seems to be unused in the provided logic but is kept for completeness. 478 } 479 474 // 475 } 476 477 /** 478 * Enqueues public-facing styles. 479 */ 480 480 function shorterm_enqueue_public_assets() { 481 $plugin_version = '1.0.5'; 482 481 483 wp_enqueue_style( 482 484 'shorterm-public-styles', 483 485 plugin_dir_url( __FILE__ ) . 'assets/css/public-styles.css', 484 486 array(), 485 '1.0.9'487 $plugin_version 486 488 ); 487 489 }
Note: See TracChangeset
for help on using the changeset viewer.