Make WordPress Themes

Changeset 318838


Ignore:
Timestamp:
03/20/2026 01:12:30 PM (7 months ago)
Author:
themedropbox
Message:

New version of Food Restro Zone - 0.1.6

Location:
food-restro-zone/0.1.6
Files:
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • food-restro-zone/0.1.6/assets/js/theme-importer.js

    r294053 r318838  
    6666          });
    6767        } catch (err) {
    68           console.log('Installation failed for:', plugin.slug, err);
     68          // Installation failed, continue to activation attempt
    6969        }
    7070      }
  • food-restro-zone/0.1.6/footer.php

    r290267 r318838  
    106106                <?php } ?>
    107107            <?php if(get_theme_mod('food_restro_zone_scroll_hide',true)){ ?>
    108                 <a id="button"><?php esc_html_e('TOP','food-restro-zone'); ?></a>
     108                <a href="#" id="button"><?php esc_html_e('TOP','food-restro-zone'); ?></a>
    109109            <?php } ?>
    110110    </div>
  • food-restro-zone/0.1.6/functions.php

    r309561 r318838  
    106106function tm_install_and_activate_plugin() {
    107107
    108         $post_plugin_details = $_POST['plugin_details'];
    109         $plugin_text_domain = $post_plugin_details['plugin_text_domain'];
    110         $plugin_main_file               =       $post_plugin_details['plugin_main_file'];
    111         $plugin_url                                     =       $post_plugin_details['plugin_url'];
     108        if ( ! isset( $_POST['_ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_ajax_nonce'] ) ), 'theme_importer_nonce' ) ) {
     109                wp_send_json_error( 'Invalid nonce.' );
     110                wp_die();
     111        }
     112
     113        if ( ! current_user_can( 'install_plugins' ) ) {
     114                wp_send_json_error( 'Insufficient permissions.' );
     115                wp_die();
     116        }
     117
     118        $post_plugin_details = isset( $_POST['plugin_details'] ) ? $_POST['plugin_details'] : array();
     119        $plugin_text_domain = isset( $post_plugin_details['plugin_text_domain'] ) ? sanitize_text_field( wp_unslash( $post_plugin_details['plugin_text_domain'] ) ) : '';
     120        $plugin_main_file               =       isset( $post_plugin_details['plugin_main_file'] ) ? sanitize_text_field( wp_unslash( $post_plugin_details['plugin_main_file'] ) ) : '';
     121        $plugin_url                                     =       isset( $post_plugin_details['plugin_url'] ) ? esc_url_raw( wp_unslash( $post_plugin_details['plugin_url'] ) ) : '';
    112122
    113123        $plugin = array(
    … …  
    124134        $activate_plugin = activate_plugin( $plugin_path );
    125135
    126         if($activate_plugin) {
    127 
    128                 echo $activate_plugin;
    129 
    130         } else {
    131                 echo $activate_plugin;
     136        // activate_plugin() returns WP_Error on failure, null on success
     137        if ( is_wp_error( $activate_plugin ) ) {
     138                wp_send_json_error( $activate_plugin->get_error_message() );
     139                wp_die();
    132140        }
    133141
    … …  
    140148
    141149function tm_check_plugin_exists() {
    142                 $plugin_text_domain = $_POST['plugin_text_domain'];
    143                 $main_plugin_file       = $_POST['main_plugin_file'];
     150                if ( ! isset( $_POST['_ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_ajax_nonce'] ) ), 'theme_importer_nonce' ) ) {
     151                        wp_send_json_error( 'Invalid nonce.' );
     152                        wp_die();
     153                }
     154                if ( ! current_user_can( 'install_plugins' ) ) {
     155                        wp_send_json_error( 'Insufficient permissions.' );
     156                        wp_die();
     157                }
     158                $plugin_text_domain = isset( $_POST['plugin_text_domain'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_text_domain'] ) ) : '';
     159                $main_plugin_file       = isset( $_POST['main_plugin_file'] ) ? sanitize_text_field( wp_unslash( $_POST['main_plugin_file'] ) ) : '';
    144160                $plugin_path = $plugin_text_domain . '/' . $main_plugin_file;
    145161
    … …  
    589605//Admin Notice For Getstart
    590606function food_restro_zone_ajax_notice_handler() {
     607        if (!wp_verify_nonce($_POST['wpnonce'], 'food_restro_zone_dismissed_notice_nonce')) {
     608                exit;
     609        }
    591610    if ( isset( $_POST['type'] ) ) {
    592611        $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
    593612        update_option( 'dismissed-' . $type, TRUE );
    594613    }
    595 }
     614        wp_die();
     615}
     616add_action( 'wp_ajax_food_restro_zone_dismissed_notice_handler', 'food_restro_zone_ajax_notice_handler' );
    596617
    597618function food_restro_zone_deprecated_hook_admin_notice() {
    … …  
    613634                </div>
    614635                <div class="tm-admin-content" style="padding-left: 30px; align-self: center">
    615                         <h2 style="font-weight: 600;line-height: 1.3; margin: 0px;"><?php esc_html_e('Thank You For Choosing ', 'food-restro-zone'); ?><?php echo wp_get_theme(); ?><h2>
    616                         <p style="color: #3c434a; font-weight: 400; margin-bottom: 30px;"><?php _e('Get Started With Theme By Clicking On Getting Started.', 'food-restro-zone'); ?><p>
     636                        <h2 style="font-weight: 600;line-height: 1.3; margin: 0px;"><?php esc_html_e('Thank You For Choosing ', 'food-restro-zone'); ?><?php echo esc_html( wp_get_theme() ); ?></h2>
     637                        <p style="color: #3c434a; font-weight: 400; margin-bottom: 30px;"><?php esc_html_e('Get Started With Theme By Clicking On Getting Started.', 'food-restro-zone'); ?></p>
    617638                        <a class="admin-notice-btn button button-primary button-hero" href="<?php echo esc_url( admin_url( 'themes.php?page=food-restro-zone-info' )); ?>"><?php esc_html_e( 'Get started', 'food-restro-zone' ) ?></a>
    618639                        <a class="admin-notice-btn button button-primary button-hero notice-pro-btn" target="_blank" href="<?php echo esc_url( FOOD_RESTRO_ZONE_GET_PREMIUM_PRO ); ?>"><?php esc_html_e( 'Get Premium ', 'food-restro-zone' ) ?></a>
    … …  
    634655add_action('after_switch_theme', 'food_restro_zone_switch_theme');
    635656function food_restro_zone_dismissable_notice() {
     657        check_ajax_referer( 'food_restro_zone_dismissed_notice_nonce', 'wpnonce' );
    636658    update_user_meta(get_current_user_id(), 'food_restro_zone_dismissable_notice', true);
    637     die();
     659    wp_die();
    638660}
    639661
    … …  
    646668
    647669// Add the AJAX action to trigger theme mods import
    648 add_action('wp_ajax_import_theme_mods', 'demo_importer_ajax_handler');
     670add_action('wp_ajax_import_theme_mods', 'food_restro_zone_demo_importer_ajax_handler');
    649671
    650672// Handle the AJAX request
    651 function demo_importer_ajax_handler() {
     673function food_restro_zone_demo_importer_ajax_handler() {
     674
     675    check_ajax_referer( 'theme_importer_nonce' );
     676
     677    if ( ! current_user_can( 'edit_theme_options' ) ) {
     678        wp_send_json_error( 'Permission denied.' );
     679        return;
     680    }
     681
    652682    // Sample data to import
    653683    $theme_mods_data = array(
    … …  
    659689
    660690    // Call the function to import theme mods
    661     if (demo_theme_importer($theme_mods_data)) {
     691    if (food_restro_zone_demo_theme_importer($theme_mods_data)) {
    662692        // After importing theme mods, create the menu
    663         create_demo_menu();
     693        food_restro_zone_create_demo_menu();
    664694        wp_send_json_success(array(
    665695                'msg' => 'Theme mods imported successfully.',
    … …  
    674704
    675705// Function to set theme mods
    676 function demo_theme_importer($import_data) {
     706function food_restro_zone_demo_theme_importer($import_data) {
    677707    if (is_array($import_data)) {
    678708        foreach ($import_data as $mod_name => $mod_value) {
    … …  
    686716
    687717// Function to create demo menu
    688 function create_demo_menu() {
     718function food_restro_zone_create_demo_menu() {
    689719
    690720    // Page import process
    … …  
    738768        use (&$create_page_and_menu, &$created_pages, $menu_id) {
    739769
    740         $page = get_page_by_title($item['title']);
     770        $pages = get_posts( array( 'post_type' => 'page', 'title' => $item['title'], 'post_status' => 'all', 'numberposts' => 1 ) );
     771        $page = ! empty( $pages ) ? $pages[0] : null;
    741772
    742773        if (!$page) {
  • food-restro-zone/0.1.6/inc/template-tags.php

    r275291 r318838  
    153153                    <div class="media-body-wrap card">
    154154                        <div class="card-header">
    155                             <h5 class="mt-0"><?php /* translators: %s: author */ printf('<cite class="fn">%s</cite>', esc_url( get_comment_author_link() ) ); ?></h5>
     155                            <h5 class="mt-0"><?php /* translators: %s: author */ printf( '<cite class="fn">%s</cite>', get_comment_author_link() ); ?></h5>
    156156                            <div class="comment-meta">
    157157                                <a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>">
    158158                                    <time datetime="<?php comment_time('c'); ?>">
    159                                         <?php /* translators: %s: Date */ printf( esc_attr('%1$s at %2$s', '1: date, 2: time', 'food-restro-zone'), esc_attr( get_comment_date() ), esc_attr( get_comment_time() ) ); ?>
     159                                        <?php /* translators: %s: Date */ printf( esc_html__( '%1$s at %2$s', 'food-restro-zone' ), esc_html( get_comment_date() ), esc_html( get_comment_time() ) ); ?>
    160160                                    </time>
    161161                                </a>
  • food-restro-zone/0.1.6/inc/theme-installation/assets/js/theme-installation.js

    r298973 r318838  
    1919                action: 'tm_theme_info_update_recommend_action',
    2020                id: id,
    21                 todo: action
     21                todo: action,
     22                _ajax_nonce: tm_theme_info_box_object.recommend_action_nonce
    2223            },
    2324            dataType  : "html",
    … …  
    3233            },
    3334            error     : function (jqXHR, textStatus, errorThrown) {
    34                 console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown);
     35                // Handle error silently
    3536            }
    3637        });
  • food-restro-zone/0.1.6/inc/theme-installation/theme-installation.php

    r298973 r318838  
    5555        public function food_restro_zone_update_recommended_action_callback() {
    5656
     57            check_ajax_referer( 'tm_recommend_action_nonce' );
     58
     59            if ( ! current_user_can( 'edit_theme_options' ) ) {
     60                wp_send_json_error( 'Permission denied.' );
     61                return;
     62            }
     63
    5764            /*getting for provided array*/
    5865            $recommended_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
    5966
    6067            /*from js action*/
    61             $action_id = esc_attr( ( isset( $_GET['id'] ) ) ? $_GET['id'] : 0 );
    62             $todo = esc_attr( ( isset( $_GET['todo'] ) ) ? $_GET['todo'] : '' );
     68            $action_id = isset( $_GET['id'] ) ? sanitize_key( wp_unslash( $_GET['id'] ) ) : '';
     69            $todo = isset( $_GET['todo'] ) ? sanitize_key( wp_unslash( $_GET['todo'] ) ) : '';
    6370
    6471            /*getting saved actions*/
    … …  
    804811                $count = $this->food_restro_zone_count_recommended_actions();
    805812                wp_localize_script( 'food-restro-zone-theme-installation-js', 'tm_theme_info_box_object', array(
    806                     'nr_actions_recommended'   => $count,
     813                    'count_actions_recommended'   => $count,
    807814                    'ajaxurl'                  => admin_url( 'admin-ajax.php' ),
    808815                    'template_directory'       => get_template_directory_uri(),
    809                     'nonce'   => wp_create_nonce('free_mnssp_create_pagination_nonce_action')
     816                    'nonce'   => wp_create_nonce('free_mnssp_create_pagination_nonce_action'),
     817                'recommend_action_nonce' => wp_create_nonce('tm_recommend_action_nonce')
    810818                ) );
    811819
  • food-restro-zone/0.1.6/index.php

    r298973 r318838  
    2727                <div class="row">
    2828                    <?php
    29                         get_template_part( 'template-parts/patterns');
     29                        get_template_part( 'template-parts/patterns'); ?>
     30                </div>
    3031
    31                     } else {
     32                <?php } else {
    3233
    3334                        get_template_part('template-parts/content', 'none');
    3435
    3536                    } ?>
    36                 </div>
    3737
    3838            </main>
  • food-restro-zone/0.1.6/readme.txt

    r309561 r318838  
    44Tested up to: 6.9
    55Requires PHP: 7.2
    6 Stable tag: 0.1.5
     6Stable tag: 0.1.6
    77License: GNU General Public License v3.0
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
    … …  
    107107
    108108== Changelog ==
     109
     110= 0.1.6 =
     111
     112* Fixed malformed HTML closing tags in admin notice (h2, p).
     113* Fixed missing output escaping: replaced echo wp_get_theme() with esc_html(), _e() with esc_html_e().
     114* Fixed security: added check_ajax_referer() and current_user_can() to tm_install_and_activate_plugin(), tm_check_plugin_exists(), food_restro_zone_demo_importer_ajax_handler() AJAX handlers.
     115* Fixed security: added nonce verification to food_restro_zone_dismissable_notice() and food_restro_zone_ajax_notice_handler().
     116* Fixed security: added nonce verification and capability check to food_restro_zone_update_recommended_action_callback() in theme-installation.php.
     117* Fixed sanitization of $_POST inputs in AJAX handlers using sanitize_key(), sanitize_file_name(), wp_unslash().
     118* Fixed incorrect esc_attr() usage with multiple arguments in comment date/time display in template-tags.php.
     119* Fixed esc_url() incorrectly applied to get_comment_author_link() HTML output in template-tags.php.
     120* Fixed orphaned </div> in index.php when no posts are found.
     121* Fixed scroll-to-top anchor missing href attribute in footer.php.
     122* Fixed deprecated get_page_by_title() replaced with WP_Query via get_posts() per WordPress 6.2 handbook.
     123* Fixed key name mismatch: nr_actions_recommended -> count_actions_recommended in theme-installation localize script.
     124* Replaced console.log() calls in theme-installation.js and theme-importer.js with silent error handling.
     125* Added nonce to recommend-action AJAX call in theme-installation.js.
     126* Replaced die() with wp_die() in AJAX handler functions.
    109127
    110128= 0.1.5
  • food-restro-zone/0.1.6/style.css

    r309561 r318838  
    66Author URI: https://www.themagnifico.net/
    77Description: The Food Restro Zone Theme is a stylish, modern, and visually captivating lite theme designed specifically for food and beverage businesses like food restaurants, cafes, bistros, diners, takeaway joints, eateries, and also juice bars, tea houses, ice cream parlors, bakeries, and dessert cafés, making it ideal for a variety of culinary businesses. Whether you run a fine dining establishment, casual dining spot, fast food outlet, easter catering, themed party catering, destination event catering, cultural event dining, family reunion catering, social event catering, engagement party catering, bridal shower catering, baby shower catering, rooftop lounge, themed diner, or a gourmet kitchen, this theme offers the ideal digital platform to showcase your culinary brand online. Built with clean code and a mobile-responsive layout, it caters perfectly to family eateries, vegan cafés, burger houses, pizza places, food courts, and food trucks. With built-in customization tools and an intuitive structure, the theme allows restaurant owners to efficiently manage digital food menus, promote chef specials, announce happy hour deals, and enable table reservations, takeaway orders, or food delivery services. Its visual design includes elegant homepage sliders, high-resolution food image galleries, menu display sections, and interactive blocks for customer reviews, daily specials, lunch combos, and dinner menus. The theme is perfect for showcasing seasonal dishes, tasting menus, romantic dinner events, or promotional offers in an engaging way. It supports core features like online table booking, browse-by-category food items, reservation forms, order tracking, and contactless delivery information—integrating seamlessly with plugins like RestaurantPress for optimized menu management. Whether you’re operating a cozy corner café or a bustling downtown restaurant, the Food Restro Zone Theme helps you create a compelling, search-friendly online presence that attracts food lovers, increases reservations, and enhances your culinary brand’s visibility across major search engines.
    8 Version: 0.1.5
     8Version: 0.1.6
    99Requires at least: 5.0
    1010Tested up to: 6.9
Note: See TracChangeset for help on using the changeset viewer.