Plugin Directory

Changeset 3383591


Ignore:
Timestamp:
10/23/2025 05:21:30 PM (5 months ago)
Author:
dimitrisevis
Message:

Fixed script loading method and updated version to 1.0.5

Location:
shorterm/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shorterm/trunk/readme.txt

    r3383575 r3383591  
    55Requires at least: 5.0
    66Tested up to: 6.8
    7 Stable tag: 1.0.4
     7Stable tag: 1.0.5
    88Requires PHP: 7.4
    99License: GPLv2 or later
  • shorterm/trunk/shorterm.php

    r3383575 r3383591  
    44Plugin URI: https://shorterm.eu/
    55Description: A simple URL shortener plugin that creates short links. Upgrade to Pro for custom slugs, click tracking, and more!
    6 Version: 1.0.4
     6Version: 1.0.5
    77Author: Sevis Dimitris
    88Author URI: https://demedia.gr
     
    6868add_action( 'plugins_loaded', 'shorterm_update_db_check' );
    6969
     70// ... (Όλος ο υπόλοιπος κώδικας μέχρι τη συνάρτηση shorterm_menu παραμένει ο ίδιος) ...
     71// ... (Για λόγους συντομίας, παραλείπεται εδώ, αλλά εσύ τον έχεις ήδη) ...
     72
    7073/**
    7174 * Generates a unique random slug.
     
    8689        }
    8790       
    88         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
    8991        $exists = $wpdb->get_var(
    9092            $wpdb->prepare(
    91                 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    9293                "SELECT id FROM `{$table_name}` WHERE custom_slug = %s",
    9394                $random_slug
     
    122123    );
    123124   
    124     // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
    125125    $result = $wpdb->insert( $table_name, $data_to_insert, array( '%s', '%s', '%s' ) );
    126126
     
    163163
    164164    if ( false === $link ) {
    165         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
    166165        $link = $wpdb->get_row(
    167166            $wpdb->prepare(
    168                 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    169167                "SELECT * FROM `{$links_table_name}` WHERE custom_slug = %s",
    170168                $custom_slug
     
    190188        }
    191189
    192         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    193190        $wpdb->insert(
    194191            $clicks_table_name,
     
    200197        );
    201198
    202         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    203199        $wpdb->update(
    204200            $links_table_name,
     
    224220    if ( false === $links ) {
    225221        $table_name = $wpdb->prefix . 'shorterm_links';
    226         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    227222        $links = $wpdb->get_results( "SELECT * FROM `{$table_name}` ORDER BY created_at DESC" );
    228223        set_transient( 'shorterm_all_links', $links, 5 * MINUTE_IN_SECONDS );
     
    250245}
    251246
    252 
    253247/**
    254248 * AJAX handler to create a new short link.
     
    265259    }
    266260
    267     // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
    268261    $original_url = esc_url_raw( trim( wp_unslash( $_POST['original_url'] ) ) );
    269262
     
    309302    $table_name = $wpdb->prefix . 'shorterm_links';
    310303   
    311     // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
    312304    $slug_to_delete = $wpdb->get_var(
    313305        $wpdb->prepare(
    314             // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    315306            "SELECT custom_slug FROM `{$table_name}` WHERE id = %d",
    316307            $id
     
    318309    );
    319310   
    320     // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    321311    $result = $wpdb->delete( $table_name, array( 'id' => $id ), array( '%d' ) );
    322312
     
    338328 */
    339329function 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 );
    342332}
    343333add_action( 'admin_menu', 'shorterm_menu' );
     
    429419                       <tbody id="shorterm-links-body">
    430420                          <?php
    431                             // To satisfy strict WordPress coding standards checkers, we first store the output
    432                             // in a variable and then echo that variable through an escaping function.
    433421                            $links_html = shorterm_get_links_table();
    434422                            echo wp_kses_post( $links_html );
     
    446434 * Enqueues admin-specific scripts and styles.
    447435 */
    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';
     436function 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';
    451443
    452444    wp_enqueue_style(
     
    473465    );
    474466}
    475 
     467// *** ΔΙΟΡΘΩΣΗ: Χρησιμοποιούμε το σωστό, μοντέρνο hook για να φορτώνουμε τα admin assets. ***
     468add_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 */
    476473function 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 */
    480480function shorterm_enqueue_public_assets() {
     481    $plugin_version = '1.0.5';
     482
    481483    wp_enqueue_style(
    482484        'shorterm-public-styles',
    483485        plugin_dir_url( __FILE__ ) . 'assets/css/public-styles.css',
    484486        array(),
    485         '1.0.9'
     487        $plugin_version
    486488    );
    487489}
Note: See TracChangeset for help on using the changeset viewer.