Plugin Directory

Changeset 3418780


Ignore:
Timestamp:
12/13/2025 08:08:46 AM (4 months ago)
Author:
iomidev
Message:

Release version 1.7.0

Location:
uniqselprotb
Files:
6 added
6 edited
19 copied

Legend:

Unmodified
Added
Removed
  • uniqselprotb/tags/1.7.0/assets/js/uniqselprotb-admin.js

    r3411326 r3418780  
    11/**
    2  * Handles frontend interactions for the UNIQSELPROTB plugin admin panel.
     2 * Handles admin interactions for the UNIQSELPROTB plugin admin panel.
    33 *
    44 * @package UNIQSELPROTB
  • uniqselprotb/tags/1.7.0/includes/class-uniqselprotb-plugin.php

    r3357146 r3418780  
    5353     */
    5454    public function __construct() {
    55 
    5655        $this->uniqselprotb_load_dependencies();
    5756        $this->define_hooks();
     
    8887    private function define_hooks() {
    8988        if ( is_admin() ) {
     89
    9090            $this->loader->add_action( 'admin_enqueue_scripts', $this->admin_controller, 'uniqselprotb_enqueue_styles' );
    9191            $this->loader->add_action( 'admin_enqueue_scripts', $this->admin_controller, 'uniqselprotb_enqueue_scripts' );
    9292            $this->loader->add_action( 'admin_menu', $this->admin_controller, 'uniqselprotb_register_menu' );
     93            $this->loader->add_action( 'admin_footer', $this->admin_controller, 'uniqselprotb_render_feedback_model' );
     94            $this->loader->add_action( 'wp_ajax_send_feedback', $this->admin_controller, 'uniqselprotb_send_feedback' );
     95
    9396        } else {
    9497            $this->loader->add_action( 'wp_enqueue_scripts', $this->frontend_controller, 'uniqselprotb_register_frontend_assets' );
  • uniqselprotb/tags/1.7.0/includes/constants/class-uniqselprotb-plugin-constant.php

    r3388203 r3418780  
    2222 */
    2323class UNIQSELPROTB_Plugin_Constant {
    24 
    2524    const PLUGIN_PREFIX = 'uniqselprotb';
    2625
  • uniqselprotb/tags/1.7.0/includes/controllers/class-uniqselprotb-admin-controller.php

    r3411326 r3418780  
    5252     * @return void
    5353     */
    54     public function uniqselprotb_enqueue_styles() {
     54    public function uniqselprotb_enqueue_styles(string $hook) {
    5555        if ( ! is_admin() ) {
    5656            return;
     
    7575
    7676        wp_enqueue_style( 'wp-color-picker' );
     77
     78        if ( 'plugins.php' === $hook ) {
     79            wp_enqueue_style(
     80                'uniqselprotb-deactivation-feedback',
     81                plugin_dir_url( __FILE__ ) . '../../assets/css/uniqselprotb-deactivation-feedback.css',
     82                array(),
     83                '1.0.0'
     84            );
     85        }
    7786    }
    7887
     
    8796    public function uniqselprotb_enqueue_scripts( string $hook_suffix ): void {
    8897
    89         if ( 'toplevel_page_' . UNIQSELPROTB_Plugin_Constant::PLUGIN_SLUG === $hook_suffix ) {
     98        if ($hook_suffix === 'plugins.php') {
     99
     100            wp_enqueue_script(
     101                'uniqselprotb-deactivation-feedback',
     102                UNIQSELPROTB_PLUGIN_URL . 'assets/js/uniqselprotb-deactivation-feedback.js',
     103                ['jquery'],
     104                '1.7.0',
     105                true
     106            );
     107
     108            wp_localize_script('uniqselprotb-deactivation-feedback', 'UNIQSELPROTBFeedbackAJAX', [
     109                'ajax_url'     => admin_url('admin-ajax.php'),
     110                'nonce'        => wp_create_nonce('uniqselprotb_feedback_nonce'),
     111                'plugin_slug'  => plugin_basename(__FILE__),
     112            ]);
     113
     114        } else if ( 'toplevel_page_' . UNIQSELPROTB_Plugin_Constant::PLUGIN_SLUG === $hook_suffix ) {
    90115            if ( version_compare( get_bloginfo( 'version' ), '6.3', '>=' ) ) {
    91116                wp_enqueue_script(
     
    113138
    114139    /**
     140     * @since     1.7.0
     141     *
     142     * @return void
     143     */
     144    public function uniqselprotb_render_feedback_model() {
     145        $screen = get_current_screen();
     146
     147        // Only on Plugins page
     148        if ( ! $screen || $screen->id !== 'plugins' ) {
     149            return;
     150        }
     151
     152        include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     153
     154        $plugin_file = WP_PLUGIN_DIR . '/uniqselprotb/uniqselprotb.php';
     155        $plugin_data = get_plugin_data( $plugin_file );
     156
     157        require plugin_dir_path( __DIR__ ) . 'views/uniqselprotb-deactivate-feedback.php';
     158        ?>
     159        <?php
     160    }
     161
     162    /**
     163     * @since     1.7.0
     164     *
     165     * @return void
     166     */
     167    public function uniqselprotb_send_feedback()
     168    {
     169        // Nonce validation prevents CSRF attacks
     170        check_ajax_referer('uniqselprotb_feedback_nonce', 'nonce');
     171
     172        $reason = isset($_POST['reason']) ? sanitize_text_field( wp_unslash( $_POST['reason'] ) ) : '';
     173        $details = isset($_POST['details']) ? sanitize_text_field( wp_unslash( $_POST['details'] ) ) : '';
     174
     175        if (empty($details)) {
     176            $details = null;
     177        }
     178
     179        include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     180
     181        $plugin_file = WP_PLUGIN_DIR . '/uniqselprotb/uniqselprotb.php';
     182        $plugin_data = get_plugin_data( $plugin_file );
     183
     184        $payload = [
     185            'plugin'      => 'uniqselprotb',
     186            'feedback'    => $reason,
     187            'details'     => $details,
     188            'domain'      => esc_url( home_url() ),
     189            'wp_version'  => get_bloginfo('version'),
     190            'version'     => sanitize_text_field( $plugin_data['Version'] ),
     191        ];
     192
     193        $api_url = 'https://collect.iomitroulaki.dev/api/plugin/feedback';
     194
     195        $response = wp_remote_post($api_url, [
     196            'headers' => [
     197                'Content-Type'  => 'application/json'
     198            ],
     199            'body'    => wp_json_encode($payload),
     200            'method'  => 'POST',
     201            'timeout' => 20,
     202        ]);
     203
     204        wp_send_json_success();
     205    }
     206
     207    /**
    115208     * Adds the 'defer' attribute to a specific admin script for WordPress < 6.3.
    116209     *
  • uniqselprotb/tags/1.7.0/readme.txt

    r3411326 r3418780  
    66Tested up to: 6.9
    77Requires PHP: 8.0
    8 Stable tag: 1.6.0
     8Stable tag: 1.7.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9595== Changelog ==
    9696
     97= 1.7.0 =
     98* Added feedback modalbox
     99
    97100= 1.6.0 =
    98101* Updated for WP 6.9
  • uniqselprotb/tags/1.7.0/uniqselprotb.php

    r3411326 r3418780  
    2020 * Description:      Unique Selling Propositions Top Banner for WordPress
    2121 *                   with configurable USPs and icons.
    22  * Version:          1.6.0
     22 * Version:          1.7.0
    2323 * Requires at least: 6.0
    2424 * Requires PHP:      8.0
  • uniqselprotb/trunk/assets/js/uniqselprotb-admin.js

    r3411326 r3418780  
    11/**
    2  * Handles frontend interactions for the UNIQSELPROTB plugin admin panel.
     2 * Handles admin interactions for the UNIQSELPROTB plugin admin panel.
    33 *
    44 * @package UNIQSELPROTB
  • uniqselprotb/trunk/includes/class-uniqselprotb-plugin.php

    r3357146 r3418780  
    5353     */
    5454    public function __construct() {
    55 
    5655        $this->uniqselprotb_load_dependencies();
    5756        $this->define_hooks();
     
    8887    private function define_hooks() {
    8988        if ( is_admin() ) {
     89
    9090            $this->loader->add_action( 'admin_enqueue_scripts', $this->admin_controller, 'uniqselprotb_enqueue_styles' );
    9191            $this->loader->add_action( 'admin_enqueue_scripts', $this->admin_controller, 'uniqselprotb_enqueue_scripts' );
    9292            $this->loader->add_action( 'admin_menu', $this->admin_controller, 'uniqselprotb_register_menu' );
     93            $this->loader->add_action( 'admin_footer', $this->admin_controller, 'uniqselprotb_render_feedback_model' );
     94            $this->loader->add_action( 'wp_ajax_send_feedback', $this->admin_controller, 'uniqselprotb_send_feedback' );
     95
    9396        } else {
    9497            $this->loader->add_action( 'wp_enqueue_scripts', $this->frontend_controller, 'uniqselprotb_register_frontend_assets' );
  • uniqselprotb/trunk/includes/constants/class-uniqselprotb-plugin-constant.php

    r3388203 r3418780  
    2222 */
    2323class UNIQSELPROTB_Plugin_Constant {
    24 
    2524    const PLUGIN_PREFIX = 'uniqselprotb';
    2625
  • uniqselprotb/trunk/includes/controllers/class-uniqselprotb-admin-controller.php

    r3411326 r3418780  
    5252     * @return void
    5353     */
    54     public function uniqselprotb_enqueue_styles() {
     54    public function uniqselprotb_enqueue_styles(string $hook) {
    5555        if ( ! is_admin() ) {
    5656            return;
     
    7575
    7676        wp_enqueue_style( 'wp-color-picker' );
     77
     78        if ( 'plugins.php' === $hook ) {
     79            wp_enqueue_style(
     80                'uniqselprotb-deactivation-feedback',
     81                plugin_dir_url( __FILE__ ) . '../../assets/css/uniqselprotb-deactivation-feedback.css',
     82                array(),
     83                '1.0.0'
     84            );
     85        }
    7786    }
    7887
     
    8796    public function uniqselprotb_enqueue_scripts( string $hook_suffix ): void {
    8897
    89         if ( 'toplevel_page_' . UNIQSELPROTB_Plugin_Constant::PLUGIN_SLUG === $hook_suffix ) {
     98        if ($hook_suffix === 'plugins.php') {
     99
     100            wp_enqueue_script(
     101                'uniqselprotb-deactivation-feedback',
     102                UNIQSELPROTB_PLUGIN_URL . 'assets/js/uniqselprotb-deactivation-feedback.js',
     103                ['jquery'],
     104                '1.7.0',
     105                true
     106            );
     107
     108            wp_localize_script('uniqselprotb-deactivation-feedback', 'UNIQSELPROTBFeedbackAJAX', [
     109                'ajax_url'     => admin_url('admin-ajax.php'),
     110                'nonce'        => wp_create_nonce('uniqselprotb_feedback_nonce'),
     111                'plugin_slug'  => plugin_basename(__FILE__),
     112            ]);
     113
     114        } else if ( 'toplevel_page_' . UNIQSELPROTB_Plugin_Constant::PLUGIN_SLUG === $hook_suffix ) {
    90115            if ( version_compare( get_bloginfo( 'version' ), '6.3', '>=' ) ) {
    91116                wp_enqueue_script(
     
    113138
    114139    /**
     140     * @since     1.7.0
     141     *
     142     * @return void
     143     */
     144    public function uniqselprotb_render_feedback_model() {
     145        $screen = get_current_screen();
     146
     147        // Only on Plugins page
     148        if ( ! $screen || $screen->id !== 'plugins' ) {
     149            return;
     150        }
     151
     152        include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     153
     154        $plugin_file = WP_PLUGIN_DIR . '/uniqselprotb/uniqselprotb.php';
     155        $plugin_data = get_plugin_data( $plugin_file );
     156
     157        require plugin_dir_path( __DIR__ ) . 'views/uniqselprotb-deactivate-feedback.php';
     158        ?>
     159        <?php
     160    }
     161
     162    /**
     163     * @since     1.7.0
     164     *
     165     * @return void
     166     */
     167    public function uniqselprotb_send_feedback()
     168    {
     169        // Nonce validation prevents CSRF attacks
     170        check_ajax_referer('uniqselprotb_feedback_nonce', 'nonce');
     171
     172        $reason = isset($_POST['reason']) ? sanitize_text_field( wp_unslash( $_POST['reason'] ) ) : '';
     173        $details = isset($_POST['details']) ? sanitize_text_field( wp_unslash( $_POST['details'] ) ) : '';
     174
     175        if (empty($details)) {
     176            $details = null;
     177        }
     178
     179        include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     180
     181        $plugin_file = WP_PLUGIN_DIR . '/uniqselprotb/uniqselprotb.php';
     182        $plugin_data = get_plugin_data( $plugin_file );
     183
     184        $payload = [
     185            'plugin'      => 'uniqselprotb',
     186            'feedback'    => $reason,
     187            'details'     => $details,
     188            'domain'      => esc_url( home_url() ),
     189            'wp_version'  => get_bloginfo('version'),
     190            'version'     => sanitize_text_field( $plugin_data['Version'] ),
     191        ];
     192
     193        $api_url = 'https://collect.iomitroulaki.dev/api/plugin/feedback';
     194
     195        $response = wp_remote_post($api_url, [
     196            'headers' => [
     197                'Content-Type'  => 'application/json'
     198            ],
     199            'body'    => wp_json_encode($payload),
     200            'method'  => 'POST',
     201            'timeout' => 20,
     202        ]);
     203
     204        wp_send_json_success();
     205    }
     206
     207    /**
    115208     * Adds the 'defer' attribute to a specific admin script for WordPress < 6.3.
    116209     *
  • uniqselprotb/trunk/readme.txt

    r3411326 r3418780  
    66Tested up to: 6.9
    77Requires PHP: 8.0
    8 Stable tag: 1.6.0
     8Stable tag: 1.7.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9595== Changelog ==
    9696
     97= 1.7.0 =
     98* Added feedback modalbox
     99
    97100= 1.6.0 =
    98101* Updated for WP 6.9
  • uniqselprotb/trunk/uniqselprotb.php

    r3411326 r3418780  
    2020 * Description:      Unique Selling Propositions Top Banner for WordPress
    2121 *                   with configurable USPs and icons.
    22  * Version:          1.6.0
     22 * Version:          1.7.0
    2323 * Requires at least: 6.0
    2424 * Requires PHP:      8.0
Note: See TracChangeset for help on using the changeset viewer.