Plugin Directory

Changeset 3476306


Ignore:
Timestamp:
03/06/2026 11:17:09 AM (3 weeks ago)
Author:
FARAZFRANK
Message:

New plugin update v1.1.3

Location:
coming-soon-maintenance-mode
Files:
284 added
5 edited

Legend:

Unmodified
Added
Removed
  • coming-soon-maintenance-mode/trunk/admin/csmm.php

    r3473597 r3476306  
    489489</div><!-- end container-->
    490490</div>
    491 <script>
    492 function csmm_save(tab, id){
    493    
    494     // website-mode-top tab data post start
    495     if(tab == 'website-mode-top'){
    496         var website_mode = jQuery('input[name="website-mode-top"]:checked').val();
    497         var selected_posts = [];
    498         var selected_pages = [];
    499         var selected_other_pages = [];
    500         jQuery.ajax({
    501             type: 'POST',
    502             url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
    503             data: {
    504                 'action': 'csmm_save', //this is the name of the AJAX method called in WordPress
    505                 'tab': 'settings',
    506                 'website_mode': website_mode,
    507                 'selected_posts': selected_posts,
    508                 'selected_pages': selected_pages,
    509                 'selected_other_pages': selected_other_pages,
    510                 'nonce': "<?php echo esc_js( wp_create_nonce( 'csmm-save' ) ); ?>",
    511             },
    512             success: function (response) {
    513                 console.log('website-mode-top-saved');
    514             },
    515             error: function () {
    516                 //alert("error");
    517             }
    518         });
    519     }
    520     // website-mode-top tab data post end
    521    
    522     // settings tab data post start
    523     if(tab == 'settings'){
    524         jQuery('button#csmm-save-setings').addClass('d-none');
    525         jQuery('div#csmm-setings-saving').removeClass('d-none');
    526         var website_mode = jQuery('input[name="website-mode"]:checked').val();
    527         var selected_posts = [];
    528         jQuery("input:checkbox[name=csmm_posts]:checked").each(function(){
    529             selected_posts.push(jQuery(this).val());
    530         });
    531         var selected_pages = [];
    532         jQuery("input:checkbox[name=csmm_pages]:checked").each(function(){
    533             selected_pages.push(jQuery(this).val());
    534         });
    535         var selected_other_pages = [];
    536         jQuery("input:checkbox[name=csmm_other_pages]:checked").each(function(){
    537             selected_other_pages.push(jQuery(this).val());
    538         });
    539         //console.log(selected_posts);
    540         //console.log(selected_pages);
    541         //console.log(selected_other_pages);
    542         jQuery.ajax({
    543             type: 'POST',
    544             url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
    545             data: {
    546                 'action': 'csmm_save', //this is the name of the AJAX method called in WordPress
    547                 'tab': tab,
    548                 'website_mode': website_mode,
    549                 'selected_posts': selected_posts,
    550                 'selected_pages': selected_pages,
    551                 'selected_other_pages': selected_other_pages,
    552                 'nonce': "<?php echo esc_js( wp_create_nonce( 'csmm-save' ) ); ?>",
    553             },
    554             success: function (response) {
    555                 //console.log(response);
    556                 jQuery(function() {
    557                     // it will wait for 5 sec. and then will fire
    558                     setTimeout(function() {
    559                         // hide processing icon and show button
    560                         jQuery('div#csmm-setings-saving').addClass('d-none');
    561                         jQuery('button#csmm-save-setings').removeClass('d-none');
    562                         // shake live preview button
    563                         jQuery( "#csmm-live-preview" ).effect("shake");
    564                     }, 500);
    565                 });
    566             },
    567             error: function () {
    568                 //alert("error");
    569             }
    570         });
    571     }
    572     // settings tab data post end
    573    
    574     // templates tab data post start
    575     if(tab == 'templates'){
    576         var template_id = jQuery("#" + id).val();
    577         jQuery('button.cmss-templates').html('Activate'); // change all template button text to Activate
    578         jQuery('button.cmss-templates').removeClass('btn-primary'); // to remove previouly selected template button class
    579         jQuery('button.cmss-templates').addClass('btn-outline-primary'); // change all template button class to btn-outline-primary
    580         jQuery('button#' + id).removeClass('btn-outline-primary');
    581         jQuery('button#' + id).addClass('btn-primary');
    582         jQuery('button#' + id).html('Activated'); // change clicled template button text to Activated
    583         jQuery.ajax({
    584             type: 'POST',
    585             url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
    586             data: {
    587                 'action': 'csmm_save', //this is the name of the AJAX method called in WordPress
    588                 'tab': tab,
    589                 'template_id': template_id,
    590                 'nonce': "<?php echo esc_js( wp_create_nonce( 'csmm-save' ) ); ?>",
    591             },
    592             success: function (response) {
    593                 //console.log(response);
    594                 // shake live preview button
    595                 jQuery( "#csmm-live-preview" ).effect("shake");
    596             },
    597             error: function () {
    598                 //alert("error");
    599             }
    600         });
    601     }
    602     // templates tab data post end
    603    
    604     // content tab data post start
    605     if(tab == 'content'){
    606         jQuery('button#csmm-save-content').addClass('d-none');
    607         jQuery('div#csmm-content-saving').removeClass('d-none');
    608         var logo = jQuery("#csmm-logo-id").val();
    609         var title = jQuery("#csmm-title").val();
    610         var description = jQuery("#csmm-description").val();
    611         var countdown = jQuery('input[name="csmm-countdown"]:checked').val();
    612         var countdown_title = jQuery("#csmm-countdown-title").val();
    613         var countdown_date = jQuery("#csmm-countdown-date").val();
    614         var countdown_time = jQuery("#csmm-countdown-time").val();
    615         jQuery.ajax({
    616             type: 'POST',
    617             url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
    618             data: {
    619                 'action': 'csmm_save', //this is the name of the AJAX method called in WordPress
    620                 'tab': tab,
    621                 'logo': logo,
    622                 'title': title,
    623                 'description': description,
    624                 'countdown': countdown,
    625                 'countdown_title': countdown_title,
    626                 'countdown_date': countdown_date,
    627                 'countdown_time': countdown_time,
    628                 'nonce': "<?php echo esc_js( wp_create_nonce( 'csmm-save' ) ); ?>",
    629             },
    630             success: function (response) {
    631                 jQuery(function() {
    632                     // it will wait for 5 sec. and then will fire
    633                     setTimeout(function() {
    634                         // hide processing icon and show button
    635                         jQuery('div#csmm-content-saving').addClass('d-none');
    636                         jQuery('button#csmm-save-content').removeClass('d-none');
    637                         // shake live preview button
    638                         jQuery( "#csmm-live-preview" ).effect("shake");
    639                     }, 500);
    640                 });
    641             },
    642             error: function () {
    643                 //alert("error");
    644             }
    645         });
    646     }
    647     // content tab data post end
    648    
    649     // social media tab data post start
    650     if(tab == 'social-media'){
    651         jQuery('button#csmm-save-sm').addClass('d-none');
    652         jQuery('div#csmm-sm-saving').removeClass('d-none');
    653         var csmm_sm_facebook = jQuery("#csmm-sm-facebook").val();
    654         var csmm_sm_twitter = jQuery("#csmm-sm-twitter").val();
    655         var csmm_sm_instagram = jQuery("#csmm-sm-instagram").val();
    656         jQuery.ajax({
    657             type: 'POST',
    658             url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>",
    659             data: {
    660                 'action': 'csmm_save', //this is the name of the AJAX method called in WordPress
    661                 'tab': tab,
    662                 'csmm_sm_facebook': csmm_sm_facebook,
    663                 'csmm_sm_twitter': csmm_sm_twitter,
    664                 'csmm_sm_instagram': csmm_sm_instagram,
    665                 'nonce': "<?php echo esc_js( wp_create_nonce( 'csmm-save' ) ); ?>",
    666             },
    667             success: function (response) {
    668                 jQuery(function() {
    669                     // it will wait for 5 sec. and then will fire
    670                     setTimeout(function() {
    671                         // hide processing icon and show button
    672                         jQuery('div#csmm-sm-saving').addClass('d-none');
    673                         jQuery('button#csmm-save-sm').removeClass('d-none');
    674                         // shake live preview button
    675                         jQuery( "#csmm-live-preview" ).effect("shake");
    676                     }, 500);
    677                 });
    678             },
    679             error: function () {
    680                 //alert("error");
    681             }
    682         });
    683     }
    684     // social media tab data post end
    685    
    686     // remove logo start
    687     if(tab == 'remove-logo'){
    688         jQuery("li.csmm-logo-" + id).fadeOut(700, function() {
    689             jQuery("li.csmm-logo-" + id).remove();
    690         });
    691     }
    692     // remove logo end
    693    
    694 }
    695 
    696 jQuery(document).ready(function(){
    697     // select all posts
    698     jQuery("#check-all-posts").click(function(){
    699         jQuery(".csmm-post-list").prop('checked', jQuery(this).prop('checked'));
    700     });
    701    
    702     // select all pages
    703     jQuery("#check-all-pages").click(function(){
    704         jQuery(".csmm-page-list").prop('checked', jQuery(this).prop('checked'));
    705     });
    706     // select all other pages
    707     jQuery("#check-all-other-pages").click(function(){
    708         jQuery(".csmm-other-page-list").prop('checked', jQuery(this).prop('checked'));
    709     });
    710    
    711     //get active tab id start
    712     jQuery('button').click(function() {
    713         if(this.id == "nav-settings-tab") {
    714             jQuery("div.website-mode-top").addClass('d-none');
    715         }
    716         if(this.id == "nav-templates-tab" || this.id == "nav-content-tab" || this.id == "nav-social-media-tab") {
    717             jQuery("div.website-mode-top").removeClass('d-none');
    718         }
    719     });
    720     //get active tab id end
    721    
    722     //set website mode on top start
    723     // at top
    724     jQuery('input[name="website-mode-top"]').click(function() {
    725         var website_mode = jQuery('input[name="website-mode-top"]:checked').val();
    726         if(website_mode == 1) {
    727             jQuery("#website-mode1").prop('checked', true);
    728             jQuery("#maintenance-mode-options").fadeOut( "slow", function() {});
    729         }
    730         if(website_mode == 2) {
    731             jQuery("#website-mode2").prop('checked', true);
    732             jQuery("#maintenance-mode-options").fadeIn( "slow", function(){ });
    733         }
    734         if(website_mode == 3) {
    735             jQuery("#website-mode3").prop('checked', true);
    736             jQuery("#maintenance-mode-options").fadeOut( "slow", function() {});
    737         }
    738     });
    739    
    740     // in tab
    741     jQuery('input[name="website-mode"]').click(function() {
    742         var website_mode = jQuery('input[name="website-mode"]:checked').val();
    743         if(website_mode == 1) {
    744             jQuery("#website-mode-top1").prop('checked', true);
    745         }
    746         if(website_mode == 2) {
    747             jQuery("#website-mode-top2").prop('checked', true);
    748         }
    749         if(website_mode == 3) {
    750             jQuery("#website-mode-top3").prop('checked', true);
    751         }
    752         //hide and show maintenance-mode-options settings
    753         if(website_mode == 2){
    754             jQuery("#maintenance-mode-options").fadeIn( "slow", function() {});
    755         } else {
    756             jQuery("#maintenance-mode-options").fadeOut( "slow", function() {});
    757         }
    758     });
    759     //set website mode on top end
    760 
    761 });
    762 </script>
  • coming-soon-maintenance-mode/trunk/coming-soon-maintenance-mode.php

    r3473597 r3476306  
    88 * Plugin URI:        https://wpfrank.com/
    99 * Description:       One of the most recommended and crucial plugin to start your website projects.
    10  * Version:           1.1.2
     10 * Version:           1.1.3
    1111 * Requires at least: 5.0
    1212 * Requires PHP:      5.6
     
    131131
    132132                // CSS
    133                 wp_enqueue_style( 'csmm-admin-style-css', plugin_dir_url( __FILE__ ) . 'admin/assets/css/style.css', array(), '1.1.2' );
     133                wp_enqueue_style( 'csmm-admin-style-css', plugin_dir_url( __FILE__ ) . 'admin/assets/css/style.css', array(), '1.1.3' );
    134134                wp_enqueue_style( 'csmm-bootstrap-admin-css', plugin_dir_url( __FILE__ ) . 'admin/assets/bootstrap-5.2.3-dist/css/bootstrap.css', array(), '5.2.3' );
    135135                wp_enqueue_style( 'csmm-fontawesome-admin-css', plugin_dir_url( __FILE__ ) . 'admin/assets/fontawesome-free-6.2.1-web/css/all.css', array(), '6.2.1' );
     
    139139                wp_enqueue_script( 'jquery-ui-tabs' );
    140140                wp_enqueue_script( 'jquery-effects-shake', '', array( 'jquery', 'jquery-ui-core', 'jquery-effects-core' ), '1.0.0', true );
    141                 // wp_enqueue_script('csmm-color-picker-js', plugin_dir_url( __FILE__ ) . 'admin/assets/js/csmm-color-picker.js', array('jquery'), '' );
    142                 //wp_enqueue_script( 'csmm-bootstrap-js', plugin_dir_url( __FILE__ ) . 'admin/assets/bootstrap-5.2.3-dist/js/bootstrap.js', array( 'jquery' ), '5.2.3' );
    143141                wp_enqueue_script( 'csmm-bootstrap-bundle-js', plugin_dir_url( __FILE__ ) . 'admin/assets/bootstrap-5.2.3-dist/js/bootstrap.bundle.js', array( 'jquery' ), '5.2.3', true );
     142
     143                // Admin page main JS (extracted from inline script)
     144                wp_enqueue_script( 'csmm-admin-js', plugin_dir_url( __FILE__ ) . 'admin/assets/js/csmm-admin.js', array( 'jquery', 'jquery-effects-shake' ), '1.1.3', true );
     145                wp_localize_script(
     146                    'csmm-admin-js',
     147                    'CSMMAdmin',
     148                    array(
     149                        'ajaxUrl' => admin_url( 'admin-ajax.php' ),
     150                        'nonce'   => wp_create_nonce( 'csmm-save' ),
     151                    )
     152                );
    144153                }
    145154
     
    208217
    209218function csmm_admin_notice_script() {
    210     // Create a nonce and pass it to the JavaScript
    211     $cmss_ajax_nonce = wp_create_nonce('csmm_dismiss_notice_nonce');
    212     ?>
    213     <script type="text/javascript">
    214         jQuery(document).ready(function($) {
    215             jQuery(document).on('click', '.awp-notice-custom .notice-dismiss', function(e) {
    216                 e.preventDefault();
    217                 var notice = jQuery(this).closest('.awp-notice-custom');
    218                 jQuery.ajax({
    219                     type: "POST",
    220                     url: ajaxurl,
    221                     data: {
    222                         action: "csmm_dismiss_notice",
    223                         security: '<?php echo esc_js($cmss_ajax_nonce); ?>',
    224                     },
    225                     success: function(response) {
    226                         notice.fadeOut(200);
    227                     }
    228                 });
    229             });
    230         });
    231     </script>
    232     <style>
    233     .awp-notice-custom {
    234         background: #fff;
    235         box-shadow: 0 1px 1px rgba(0,0,0,.04);
    236         padding: 0px !important;
    237         border: none !important;
    238         position: relative;
    239        
    240     }
    241     .awp-notice-custom img {
    242         width:1690px;
    243         max-width: 100%;
    244     }
    245     .awp-notice-custom a {
    246         color: #0073aa;
    247         text-decoration: none;
    248     }
    249     .awp-notice-custom a:hover {
    250         text-decoration: underline;
    251     }
    252     .awp-notice-custom .notice-dismiss {
    253         background: #ff3030;
    254     }
    255     .awp-notice-custom .notice-dismiss:before {
    256         color:#FFF;
    257     }
    258     </style>
    259     <?php
    260 }
    261 add_action('admin_footer', 'csmm_admin_notice_script');
     219    // Enqueue notice CSS.
     220    wp_enqueue_style( 'csmm-notice-css', plugin_dir_url( __FILE__ ) . 'admin/assets/css/csmm-notice.css', array(), '1.1.3' );
     221
     222    // Enqueue notice JS.
     223    wp_enqueue_script( 'csmm-notice-js', plugin_dir_url( __FILE__ ) . 'admin/assets/js/csmm-notice.js', array( 'jquery' ), '1.1.3', true );
     224    wp_localize_script(
     225        'csmm-notice-js',
     226        'CSMMNotice',
     227        array(
     228            'ajaxUrl' => admin_url( 'admin-ajax.php' ),
     229            'nonce'   => wp_create_nonce( 'csmm_dismiss_notice_nonce' ),
     230        )
     231    );
     232}
     233add_action('admin_enqueue_scripts', 'csmm_admin_notice_script');
    262234function csmm_dismiss_notice() {
    263235    // Check the nonce
     
    273245function csmm_save() {
    274246    if ( current_user_can( 'manage_options' ) ) {
    275         if ( sanitize_text_field( wp_unslash( isset( $_POST['nonce'] ) ) ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'csmm-save' ) ) {
     247        if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'csmm-save' ) ) {
    276248            // verified action
    277249            //print_r($_POST);
     
    384356}
    385357add_action( 'wp_ajax_csmm_save', 'csmm_save' );
    386 add_action( 'wp_ajax_nopriv_csmm_save', 'csmm_save' );
     358// Removed wp_ajax_nopriv_csmm_save — save handler requires manage_options and must not be exposed to unauthenticated users.
    387359// save CSMM end
    388360
  • coming-soon-maintenance-mode/trunk/our-products/our-products.php

    r3416477 r3476306  
    44}
    55
    6 // Process the AJAX request to install and activate plugins.
     6// Process the AJAX request to install and update plugins.
    77add_action( 'wp_ajax_extras_plugin_install', 'csmm_extras_install_plugin' );
    88add_action( 'wp_ajax_extras_plugin_update', 'csmm_extras_update_plugin' );
     
    1515
    1616function csmm_extras_install_plugin() {
     17    // Check user capabilities.
     18    if ( ! current_user_can( 'install_plugins' ) ) {
     19        wp_send_json_error( 'You do not have permission to install plugins.' );
     20    }
     21
    1722    // Verify the nonce for install action.
    1823    if ( ! isset( $_POST['extnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['extnonce'] ) ), 'csmm-extra-nonce' ) ) {
     
    4348    }
    4449
    45     // Send response.
    46     csmm_extras_activate_plugin();
     50    // Send response - do NOT auto-activate, let user activate manually.
    4751    wp_send_json_success( 'Plugin installed successfully.' );
    4852}
    4953
    5054function csmm_extras_update_plugin() {
     55    // Check user capabilities.
     56    if ( ! current_user_can( 'update_plugins' ) ) {
     57        wp_send_json_error( 'You do not have permission to update plugins.' );
     58    }
     59
    5160    // Verify the nonce for update action.
    5261    if ( ! isset( $_POST['extnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['extnonce'] ) ), 'csmm-extra-nonce' ) ) {
     
    8291
    8392function csmm_extras_activate_plugin() {
     93    // Check user capabilities.
     94    if ( ! current_user_can( 'activate_plugins' ) ) {
     95        wp_send_json_error( 'You do not have permission to activate plugins.' );
     96    }
     97
    8498    // Verify the nonce for activate action.
    8599    if ( ! isset( $_POST['extnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['extnonce'] ) ), 'csmm-extra-nonce' ) ) {
     
    111125// Theme functions.
    112126function csmm_extras_install_theme() {
     127    // Check user capabilities.
     128    if ( ! current_user_can( 'install_themes' ) ) {
     129        wp_send_json_error( 'You do not have permission to install themes.' );
     130    }
     131
    113132    // Verify the nonce for install action.
    114133    if ( ! isset( $_POST['extnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['extnonce'] ) ), 'csmm-extra-nonce' ) ) {
     
    146165
    147166function csmm_extras_update_theme() {
     167    // Check user capabilities.
     168    if ( ! current_user_can( 'update_themes' ) ) {
     169        wp_send_json_error( 'You do not have permission to update themes.' );
     170    }
     171
    148172    // Verify the nonce for update action.
    149173    if ( ! isset( $_POST['extnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['extnonce'] ) ), 'csmm-extra-nonce' ) ) {
  • coming-soon-maintenance-mode/trunk/our-products/plugins-and-themes-api.php

    r3416477 r3476306  
    3131
    3232        // Required Info to Fetch Plugin Data.
    33         require ABSPATH . 'wp-admin/includes/plugin-install.php';
    34         require ABSPATH . 'wp-admin/includes/theme-install.php';
     33        require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     34        require_once ABSPATH . 'wp-admin/includes/theme-install.php';
    3535
    3636        foreach ( $csmm_frank_plugin_slugs as $csmm_plugin_slug ) {
  • coming-soon-maintenance-mode/trunk/readme.txt

    r3473597 r3476306  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 1.1.2
     6Stable tag: 1.1.3
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    166166== Changelog ==
    167167
     168= 1.1.3 =
     169*   Security: Fixed broken nonce verification in AJAX save handler
     170*   Security: Removed unauthenticated AJAX endpoint (wp_ajax_nopriv_csmm_save)
     171*   Security: Used require_once for core file includes (plugin-install.php, theme-install.php) per WP.org guidelines
     172*   Fixed: Removed auto-activation of plugins after install — install and activate are now separate user actions
     173*   Fixed: Added proper capability checks to all AJAX handlers for plugin/theme install, update, and activate
     174*   Update: Removed duplicate inline JavaScript in favour of properly enqueued external script
     175
    168176= 1.1.2 =
    169177*   Update: Cleaned up plugin dashboard for WordPress.org guidelines compliance by removing Pro up-sells
Note: See TracChangeset for help on using the changeset viewer.