Changeset 3125940
- Timestamp:
- 07/26/2024 12:20:39 PM (20 months ago)
- Location:
- wp-cafe
- Files:
-
- 2 added
- 2 deleted
- 10 edited
- 21 copied
-
tags/2.2.29 (copied) (copied from wp-cafe/trunk)
-
tags/2.2.29/assets/js/wpc-block-location.js (copied) (copied from wp-cafe/trunk/assets/js/wpc-block-location.js)
-
tags/2.2.29/assets/js/wpc-block-pickup.js (copied) (copied from wp-cafe/trunk/assets/js/wpc-block-pickup.js)
-
tags/2.2.29/bootstrap.php (modified) (1 diff)
-
tags/2.2.29/core/menu/wpc-menus.php (copied) (copied from wp-cafe/trunk/core/menu/wpc-menus.php)
-
tags/2.2.29/core/modules/guten-block/build (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build)
-
tags/2.2.29/core/modules/guten-block/build/index-rtl.css (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build/index-rtl.css)
-
tags/2.2.29/core/modules/guten-block/build/index.asset.php (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build/index.asset.php)
-
tags/2.2.29/core/modules/guten-block/build/index.css (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build/index.css)
-
tags/2.2.29/core/modules/guten-block/build/index.js (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build/index.js)
-
tags/2.2.29/core/modules/guten-block/build/style-index-rtl.css (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build/style-index-rtl.css)
-
tags/2.2.29/core/modules/guten-block/build/style-index.css (copied) (copied from wp-cafe/trunk/core/modules/guten-block/build/style-index.css)
-
tags/2.2.29/core/modules/guten-block/inc/blocks/food-list.php (copied) (copied from wp-cafe/trunk/core/modules/guten-block/inc/blocks/food-list.php) (1 diff)
-
tags/2.2.29/core/modules/guten-block/inc/blocks/food-tab.php (copied) (copied from wp-cafe/trunk/core/modules/guten-block/inc/blocks/food-tab.php) (1 diff)
-
tags/2.2.29/core/modules/guten-block/inc/blocks/location.php (copied) (copied from wp-cafe/trunk/core/modules/guten-block/inc/blocks/location.php) (1 diff)
-
tags/2.2.29/core/modules/guten-block/inc/blocks/pickup-delivery.php (copied) (copied from wp-cafe/trunk/core/modules/guten-block/inc/blocks/pickup-delivery.php) (1 diff)
-
tags/2.2.29/core/modules/guten-block/inc/init.php (deleted)
-
tags/2.2.29/core/modules/guten-block/inc/register-blocks.php (added)
-
tags/2.2.29/core/shortcodes/hook.php (copied) (copied from wp-cafe/trunk/core/shortcodes/hook.php) (3 diffs)
-
tags/2.2.29/core/shortcodes/template-functions.php (copied) (copied from wp-cafe/trunk/core/shortcodes/template-functions.php)
-
tags/2.2.29/core/shortcodes/views/reservation/reservation-form-template.php (copied) (copied from wp-cafe/trunk/core/shortcodes/views/reservation/reservation-form-template.php)
-
tags/2.2.29/readme.txt (copied) (copied from wp-cafe/trunk/readme.txt) (3 diffs)
-
tags/2.2.29/utils/wpc-utilities.php (copied) (copied from wp-cafe/trunk/utils/wpc-utilities.php) (1 diff)
-
tags/2.2.29/wpcafe.php (copied) (copied from wp-cafe/trunk/wpcafe.php) (2 diffs)
-
trunk/bootstrap.php (modified) (1 diff)
-
trunk/core/modules/guten-block/inc/blocks/food-list.php (modified) (1 diff)
-
trunk/core/modules/guten-block/inc/blocks/food-tab.php (modified) (1 diff)
-
trunk/core/modules/guten-block/inc/blocks/location.php (modified) (1 diff)
-
trunk/core/modules/guten-block/inc/blocks/pickup-delivery.php (modified) (1 diff)
-
trunk/core/modules/guten-block/inc/init.php (deleted)
-
trunk/core/modules/guten-block/inc/register-blocks.php (added)
-
trunk/core/shortcodes/hook.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/utils/wpc-utilities.php (modified) (1 diff)
-
trunk/wpcafe.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-cafe/tags/2.2.29/bootstrap.php
r2982187 r3125940 108 108 109 109 // register gutenberg blocks 110 if( file_exists( \Wpcafe::plugin_dir() . 'core/modules/guten-block/inc/init.php' )){ 111 include_once \Wpcafe::plugin_dir() . 'core/modules/guten-block/inc/init.php'; 112 } 113 110 \WpCafe\Core\Modules\Guten_Block\Inc\Register_Blocks::instance()->init(); 111 114 112 if ( is_admin() ){ 115 113 \WpCafe\Core\Core::instance()->init(); -
wp-cafe/tags/2.2.29/core/modules/guten-block/inc/blocks/food-list.php
r3112563 r3125940 1 1 <?php 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 3 4 defined( "ABSPATH" ) || exit; 5 2 6 use WpCafe\Utils\Wpc_Utilities; 3 7 4 //register food list block 5 function register_food_list_block(){ 6 register_block_type( 7 'wpc/food-menu-list', array( 8 // Enqueue blocks.style.build.css on both frontend & backend. 9 'style' => 'wpc-block-style-css', 10 // Enqueue blocks.editor.build.css in the editor only. 11 'editor_style' => 'wpc-block-editor-style-css', 12 // Enqueue blocks.build.js in the editor only. 13 'editor_script' => 'wpc-block-js', 14 'render_callback' => 'wpc_food_menu_list_callback', 15 'api_version' => 1, 16 'attributes' => array( 17 'food_menu_style' => array( 18 'type' => 'string', 19 'default' => 'style-1' 20 ), 21 'show_thumbnail' => array( 22 'type' => 'string', 23 'default' => 'yes' 24 ), 25 'wpc_menu_cat' => array( 26 'type' => 'array', 27 'default' => [] 28 ), 29 'wpc_desc_limit' => array( 30 'type' => 'integer', 31 'default' => 20 32 ), 33 'wpc_show_desc' => array( 34 'type' => 'string', 35 'default' => 'yes' 36 ), 37 'wpc_cart_button_show' => array( 38 'type' => 'string', 39 'default' => 'yes' 40 ), 41 'title_link_show' => array( 42 'type' => 'string', 43 'default' => 'yes' 44 ), 45 'show_item_status' => array( 46 'type' => 'string', 47 'default' => 'yes' 48 ), 49 'wpc_price_show' => array( 50 'type' => 'string', 51 'default' => 'yes' 52 ), 53 'wpc_menu_count' => array( 54 'type' => 'integer', 55 'default' => 20 56 ), 57 'wpc_menu_order' => array( 58 'type' => 'string', 59 'default' => 'DESC' 60 ), 61 'wpc_show_vendor' => array( 62 'type' => 'string', 63 'default' => 'yes' 8 class Food_List { 9 10 use \WpCafe\Traits\Wpc_Singleton; 11 12 function init() { 13 add_action('init', [$this, 'register_food_list_block']); 14 } 15 16 function register_food_list_block(){ 17 register_block_type( 18 'wpc/food-menu-list', array( 19 // Enqueue blocks.style.build.css on both frontend & backend. 20 'style' => 'wpc-block-style-css', 21 // Enqueue blocks.editor.build.css in the editor only. 22 'editor_style' => 'wpc-block-editor-style-css', 23 // Enqueue blocks.build.js in the editor only. 24 'editor_script' => 'wpc-block-js', 25 'render_callback' => [$this, 'wpc_food_menu_list_callback'], 26 'api_version' => 1, 27 'attributes' => array( 28 'food_menu_style' => array( 29 'type' => 'string', 30 'default' => 'style-1' 31 ), 32 'show_thumbnail' => array( 33 'type' => 'string', 34 'default' => 'yes' 35 ), 36 'wpc_menu_cat' => array( 37 'type' => 'array', 38 'default' => [] 39 ), 40 'wpc_desc_limit' => array( 41 'type' => 'integer', 42 'default' => 20 43 ), 44 'wpc_show_desc' => array( 45 'type' => 'string', 46 'default' => 'yes' 47 ), 48 'wpc_cart_button_show' => array( 49 'type' => 'string', 50 'default' => 'yes' 51 ), 52 'title_link_show' => array( 53 'type' => 'string', 54 'default' => 'yes' 55 ), 56 'show_item_status' => array( 57 'type' => 'string', 58 'default' => 'yes' 59 ), 60 'wpc_price_show' => array( 61 'type' => 'string', 62 'default' => 'yes' 63 ), 64 'wpc_menu_count' => array( 65 'type' => 'integer', 66 'default' => 20 67 ), 68 'wpc_menu_order' => array( 69 'type' => 'string', 70 'default' => 'DESC' 71 ), 72 'wpc_show_vendor' => array( 73 'type' => 'string', 74 'default' => 'yes' 75 ) 64 76 ) 65 77 ) 66 ) 67 ); 68 } 69 add_action('init', 'register_food_list_block'); 78 ); 79 } 70 80 71 // food menu list block callback 72 function wpc_food_menu_list_callback($settings){ 73 //check if woocommerce exists 74 if (!class_exists('Woocommerce')) { return; } 81 // food menu list block callback 82 function wpc_food_menu_list_callback($settings){ 83 $unique_id = md5(md5(microtime())); 75 84 76 $unique_id = md5(md5(microtime())); 85 $style = $settings["food_menu_style"]; 86 $show_item_status = $settings["show_item_status"]; 87 $show_thumbnail = $settings["show_thumbnail"]; 88 $title_link_show = $settings["title_link_show"]; 89 $wpc_cart_button = $settings["wpc_cart_button_show"]; 90 $wpc_show_desc = $settings["wpc_show_desc"]; 91 $wpc_desc_limit = $settings["wpc_desc_limit"]; 92 $wpc_menu_cat = $settings["wpc_menu_cat"]; 93 $wpc_menu_count = $settings["wpc_menu_count"]; 94 $wpc_menu_order = $settings["wpc_menu_order"]; 95 $show_thumbnail = $settings["show_thumbnail"]; 96 $wpc_price_show = $settings["wpc_price_show"]; 97 $wpc_show_vendor = $settings["wpc_show_vendor"]; 98 99 apply_filters( 'elementor/control/search_data' , $settings , $unique_id , 'wpc-menus-list' ); 77 100 78 $style = $settings["food_menu_style"]; 79 $show_item_status = $settings["show_item_status"]; 80 $show_thumbnail = $settings["show_thumbnail"]; 81 $title_link_show = $settings["title_link_show"]; 82 $wpc_cart_button = $settings["wpc_cart_button_show"]; 83 $wpc_show_desc = $settings["wpc_show_desc"]; 84 $wpc_desc_limit = $settings["wpc_desc_limit"]; 85 $wpc_menu_cat = $settings["wpc_menu_cat"]; 86 $wpc_menu_count = $settings["wpc_menu_count"]; 87 $wpc_menu_order = $settings["wpc_menu_order"]; 88 $show_thumbnail = $settings["show_thumbnail"]; 89 $wpc_price_show = $settings["wpc_price_show"]; 90 $wpc_show_vendor = $settings["wpc_show_vendor"]; 91 92 apply_filters( 'elementor/control/search_data' , $settings , $unique_id , 'wpc-menus-list' ); 101 $allowed_file_names = [ 102 'style-1', 103 'style-2', 104 'style-3' 105 ]; 93 106 94 $allowed_file_names = [95 'style-1', 96 'style-2',97 'style-3'98 ]; 107 if( in_array($style, $allowed_file_names)){ 108 $template_file = esc_html($style); 109 }else{ 110 $template_file = $allowed_file_names[0]; 111 } 99 112 100 if( in_array($style, $allowed_file_names)){ 101 $template_file = esc_html($style); 102 }else{ 103 $template_file = $allowed_file_names[0]; 104 } 113 ob_start(); 114 ?> 115 <div class="main_wrapper_<?php echo esc_html($unique_id)?>"> 116 <div class="list_template_<?php echo esc_html($unique_id) ?> wpc-nav-shortcode wpc-widget-wrapper" data-id="<?php echo esc_attr($unique_id)?>"> 117 <?php 118 $food_list_args = array( 119 'post_type' => 'product', 120 'no_of_product' => $wpc_menu_count, 121 'wpc_cat' => $wpc_menu_cat, 122 'order' => $wpc_menu_order, 123 ); 124 $products = Wpc_Utilities::product_query( $food_list_args ); 125 include \Wpcafe::plugin_dir() . "widgets/wpc-menus-list/style/{$template_file}.php"; 126 ?> 127 </div> 128 </div> 129 <?php 105 130 106 ob_start(); 107 ?> 108 <div class="main_wrapper_<?php echo esc_html($unique_id)?>"> 109 <div class="list_template_<?php echo esc_html($unique_id) ?> wpc-nav-shortcode wpc-widget-wrapper" data-id="<?php echo esc_attr($unique_id)?>"> 110 <?php 111 $food_list_args = array( 112 'post_type' => 'product', 113 'no_of_product' => $wpc_menu_count, 114 'wpc_cat' => $wpc_menu_cat, 115 'order' => $wpc_menu_order, 116 ); 117 $products = Wpc_Utilities::product_query( $food_list_args ); 118 include \Wpcafe::plugin_dir() . "widgets/wpc-menus-list/style/{$template_file}.php"; 119 ?> 120 </div> 121 </div> 122 <?php 131 return ob_get_clean(); 123 132 124 return ob_get_clean();133 } 125 134 126 135 } -
wp-cafe/tags/2.2.29/core/modules/guten-block/inc/blocks/food-tab.php
r3112563 r3125940 1 1 <?php 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 3 4 defined( "ABSPATH" ) || exit; 5 2 6 use WpCafe\Utils\Wpc_Utilities; 3 7 4 //register food tab block 5 function register_food_tab_block(){ 6 register_block_type( 7 'wpc/food-menu-tab', array( 8 // Enqueue blocks.style.build.css on both frontend & backend. 9 'style' => 'wpc-block-style-css', 10 // Enqueue blocks.editor.build.css in the editor only. 11 'editor_style' => 'wpc-block-editor-style-css', 12 // Enqueue blocks.build.js in the editor only. 13 'editor_script' => 'wpc-block-js', 14 'render_callback' => 'wpc_food_menu_tab_callback', 15 'api_version' => 1, 16 'attributes' => array( 17 'food_menu_style' => array( 18 'type' => 'string', 19 'default' => 'style-1' 20 ), 21 'wpc_food_categories' => array( 22 'type' => 'array', 23 'default' => [] 24 ), 25 'show_thumbnail' => array( 26 'type' => 'string', 27 'default' => 'yes' 28 ), 29 'wpc_desc_limit' => array( 30 'type' => 'integer', 31 'default' => 20 32 ), 33 'wpc_show_desc' => array( 34 'type' => 'string', 35 'default' => 'yes' 36 ), 37 'wpc_cart_button' => array( 38 'type' => 'string', 39 'default' => 'yes' 40 ), 41 'title_link_show' => array( 42 'type' => 'string', 43 'default' => 'yes' 44 ), 45 'show_item_status' => array( 46 'type' => 'string', 47 'default' => 'yes' 48 ), 49 'wpc_price_show' => array( 50 'type' => 'string', 51 'default' => 'yes' 52 ), 53 'wpc_menu_count' => array( 54 'type' => 'integer', 55 'default' => 20 56 ), 57 'wpc_menu_order' => array( 58 'type' => 'string', 59 'default' => 'DESC' 60 ), 61 'wpc_show_vendor' => array( 62 'type' => 'string', 63 'default' => 'yes' 8 class Food_Tab { 9 10 use \WpCafe\Traits\Wpc_Singleton; 11 12 function init() { 13 add_action('init', [$this, 'register_food_tab_block']); 14 } 15 16 function register_food_tab_block(){ 17 register_block_type( 18 'wpc/food-menu-tab', array( 19 // Enqueue blocks.style.build.css on both frontend & backend. 20 'style' => 'wpc-block-style-css', 21 // Enqueue blocks.editor.build.css in the editor only. 22 'editor_style' => 'wpc-block-editor-style-css', 23 // Enqueue blocks.build.js in the editor only. 24 'editor_script' => 'wpc-block-js', 25 'render_callback' => [$this, 'wpc_food_menu_tab_callback'], 26 'api_version' => 1, 27 'attributes' => array( 28 'food_menu_style' => array( 29 'type' => 'string', 30 'default' => 'style-1' 31 ), 32 'wpc_food_categories' => array( 33 'type' => 'array', 34 'default' => [] 35 ), 36 'show_thumbnail' => array( 37 'type' => 'string', 38 'default' => 'yes' 39 ), 40 'wpc_desc_limit' => array( 41 'type' => 'integer', 42 'default' => 20 43 ), 44 'wpc_show_desc' => array( 45 'type' => 'string', 46 'default' => 'yes' 47 ), 48 'wpc_cart_button' => array( 49 'type' => 'string', 50 'default' => 'yes' 51 ), 52 'title_link_show' => array( 53 'type' => 'string', 54 'default' => 'yes' 55 ), 56 'show_item_status' => array( 57 'type' => 'string', 58 'default' => 'yes' 59 ), 60 'wpc_price_show' => array( 61 'type' => 'string', 62 'default' => 'yes' 63 ), 64 'wpc_menu_count' => array( 65 'type' => 'integer', 66 'default' => 20 67 ), 68 'wpc_menu_order' => array( 69 'type' => 'string', 70 'default' => 'DESC' 71 ), 72 'wpc_show_vendor' => array( 73 'type' => 'string', 74 'default' => 'yes' 75 ) 64 76 ) 65 77 ) 66 ) 67 ); 68 } 69 add_action('init', 'register_food_tab_block'); 78 ); 79 } 70 80 71 // food menu tab block callback72 function wpc_food_menu_tab_callback($settings){73 //check if woocommerce exists74 if (!class_exists('Woocommerce')) { return; }81 // food menu tab block callback 82 function wpc_food_menu_tab_callback($settings){ 83 //check if woocommerce exists 84 if (!class_exists('Woocommerce')) { return; } 75 85 76 $unique_id = md5(md5(microtime()));86 $unique_id = md5(md5(microtime())); 77 87 78 $style = $settings['food_menu_style'];79 $wpc_menu_order = $settings['wpc_menu_order'];80 $wpc_desc_limit = $settings['wpc_desc_limit'];81 $wpc_cart_button = $settings['wpc_cart_button'];82 $show_item_status = $settings['show_item_status'];83 $wpc_price_show = $settings["wpc_price_show"];84 $wpc_show_vendor = $settings["wpc_show_vendor"];88 $style = $settings['food_menu_style']; 89 $wpc_menu_order = $settings['wpc_menu_order']; 90 $wpc_desc_limit = $settings['wpc_desc_limit']; 91 $wpc_cart_button = $settings['wpc_cart_button']; 92 $show_item_status = $settings['show_item_status']; 93 $wpc_price_show = $settings["wpc_price_show"]; 94 $wpc_show_vendor = $settings["wpc_show_vendor"]; 85 95 86 $wpc_cat_arr = $settings['wpc_food_categories']; 87 88 $food_menu_tabs = []; 89 if (count($wpc_cat_arr) > 0) { 90 foreach ($wpc_cat_arr as $key => $value) { 91 if ($wpc_cat = get_term_by('id', $value, 'product_cat')) { 92 $wpc_get_menu_order = get_term_meta($wpc_cat->term_id, 'wpc_menu_order_priority', true); 93 $wpc_cat = get_term_by('id', $value, 'product_cat'); 94 $cat_name = ($wpc_cat && $wpc_cat->name ) ? $wpc_cat->name : ""; 95 $tab_data = array('post_cats'=>[$value],'tab_title' => $cat_name); 96 if ($wpc_get_menu_order == '') { 97 $food_menu_tabs[$key] = $tab_data; 98 } else { 99 $food_menu_tabs[$wpc_get_menu_order] = $tab_data; 96 $wpc_cat_arr = $settings['wpc_food_categories']; 97 98 $food_menu_tabs = []; 99 if (count($wpc_cat_arr) > 0) { 100 foreach ($wpc_cat_arr as $key => $value) { 101 if ($wpc_cat = get_term_by('id', $value, 'product_cat')) { 102 $wpc_get_menu_order = get_term_meta($wpc_cat->term_id, 'wpc_menu_order_priority', true); 103 $wpc_cat = get_term_by('id', $value, 'product_cat'); 104 $cat_name = ($wpc_cat && $wpc_cat->name ) ? $wpc_cat->name : ""; 105 $tab_data = array('post_cats'=>[$value],'tab_title' => $cat_name); 106 if ($wpc_get_menu_order == '') { 107 $food_menu_tabs[$key] = $tab_data; 108 } else { 109 $food_menu_tabs[$wpc_get_menu_order] = $tab_data; 110 } 100 111 } 101 112 } 113 }else{ 114 return "<p>Select at least one category.</p>"; 102 115 } 103 }else{ 104 return "<p>Select at least one category.</p>"; 116 117 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){ 118 $wpc_menu_count = is_array($settings) && isset($settings['wpc_menu_count']) ? $settings['wpc_menu_count'] : 5; 119 $wpc_show_desc = is_array($settings) && isset($settings['wpc_show_desc']) ? $settings['wpc_show_desc'] : 'yes'; 120 $show_thumbnail = is_array($settings) && isset($settings['show_thumbnail']) ? $settings['show_thumbnail'] : 'yes'; 121 $title_link_show= is_array($settings) && isset($settings['title_link_show']) ? $settings['title_link_show'] : 'yes'; 122 $class = ($title_link_show=='yes')? '' : 'wpc-no-link'; 123 124 $allowed_file_names = [ 125 'style-1', 126 'style-2' 127 ]; 128 129 if( in_array($style, $allowed_file_names)){ 130 $template_file = esc_html($style); 131 }else{ 132 $template_file = $allowed_file_names[0]; 133 } 134 135 ob_start(); 136 ?> 137 <div class="wpc-food-tab-wrapper wpc-nav-shortcode main_wrapper_<?php echo esc_html($unique_id)?>" data-id="<?php echo esc_attr($unique_id)?>"> 138 <ul class="wpc-nav"> 139 <?php 140 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){ 141 foreach ($food_menu_tabs as $tab_key => $value) { 142 $active_class = (($tab_key == array_keys($food_menu_tabs)[0]) ? 'wpc-active' : ' '); 143 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ; 144 ?> 145 <li> 146 <a href='#' class='wpc-tab-a <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($tab_key); ?>' 147 data-cat_id='<?php echo esc_attr( $cat_id ); ?>'> 148 <span><?php echo esc_html($value['tab_title']); ?></span> 149 </a> 150 </li> 151 <?php 152 } 153 } 154 ?> 155 </ul> 156 <div class="wpc-tab-content wpc-widget-wrapper"> 157 <?php 158 foreach ($food_menu_tabs as $content_key => $value) { 159 if(isset( $value['post_cats'][0] )){ 160 $active_class = (($content_key == array_keys($food_menu_tabs)[0]) ? 'tab-active' : ' '); 161 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ; 162 ?> 163 <div class='wpc-tab <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($content_key); ?>' 164 data-cat_id='<?php echo esc_attr($cat_id);?>'> 165 <div class="tab_template_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>"></div> 166 <div class="template_data_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>"> 167 <?php 168 $food_tab_args = array( 169 'post_type' => 'product', 170 'no_of_product' => $wpc_menu_count, 171 'wpc_cat' => $value['post_cats'], 172 'order' => $wpc_menu_order, 173 ); 174 $products = Wpc_Utilities::product_query( $food_tab_args ); 175 include \Wpcafe::plugin_dir() . "widgets/wpc-food-menu-tab/style/{$template_file}.php"; 176 ?> 177 </div> 178 </div><!-- Tab pane 1 end --> 179 <?php 180 } 181 } 182 ?> 183 </div><!-- Tab content--> 184 </div> 185 <?php 186 } 187 return ob_get_clean(); 188 105 189 } 106 190 107 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){108 $wpc_menu_count = is_array($settings) && isset($settings['wpc_menu_count']) ? $settings['wpc_menu_count'] : 5;109 $wpc_show_desc = is_array($settings) && isset($settings['wpc_show_desc']) ? $settings['wpc_show_desc'] : 'yes';110 $show_thumbnail = is_array($settings) && isset($settings['show_thumbnail']) ? $settings['show_thumbnail'] : 'yes';111 $title_link_show= is_array($settings) && isset($settings['title_link_show']) ? $settings['title_link_show'] : 'yes';112 $class = ($title_link_show=='yes')? '' : 'wpc-no-link';113 114 $allowed_file_names = [115 'style-1',116 'style-2'117 ];118 119 if( in_array($style, $allowed_file_names)){120 $template_file = esc_html($style);121 }else{122 $template_file = $allowed_file_names[0];123 }124 125 ob_start();126 ?>127 <div class="wpc-food-tab-wrapper wpc-nav-shortcode main_wrapper_<?php echo esc_html($unique_id)?>" data-id="<?php echo esc_attr($unique_id)?>">128 <ul class="wpc-nav">129 <?php130 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){131 foreach ($food_menu_tabs as $tab_key => $value) {132 $active_class = (($tab_key == array_keys($food_menu_tabs)[0]) ? 'wpc-active' : ' ');133 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ;134 ?>135 <li>136 <a href='#' class='wpc-tab-a <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($tab_key); ?>'137 data-cat_id='<?php echo esc_attr( $cat_id ); ?>'>138 <span><?php echo esc_html($value['tab_title']); ?></span>139 </a>140 </li>141 <?php142 }143 }144 ?>145 </ul>146 <div class="wpc-tab-content wpc-widget-wrapper">147 <?php148 foreach ($food_menu_tabs as $content_key => $value) {149 if(isset( $value['post_cats'][0] )){150 $active_class = (($content_key == array_keys($food_menu_tabs)[0]) ? 'tab-active' : ' ');151 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ;152 ?>153 <div class='wpc-tab <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($content_key); ?>'154 data-cat_id='<?php echo esc_attr($cat_id);?>'>155 <div class="tab_template_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>"></div>156 <div class="template_data_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>">157 <?php158 $food_tab_args = array(159 'post_type' => 'product',160 'no_of_product' => $wpc_menu_count,161 'wpc_cat' => $value['post_cats'],162 'order' => $wpc_menu_order,163 );164 $products = Wpc_Utilities::product_query( $food_tab_args );165 include \Wpcafe::plugin_dir() . "widgets/wpc-food-menu-tab/style/{$template_file}.php";166 ?>167 </div>168 </div><!-- Tab pane 1 end -->169 <?php170 }171 }172 ?>173 </div><!-- Tab content-->174 </div>175 <?php176 }177 return ob_get_clean();178 179 191 } -
wp-cafe/tags/2.2.29/core/modules/guten-block/inc/blocks/location.php
r3112563 r3125940 1 1 <?php 2 //register location checkout page block 3 function register_location_block(){ 4 register_block_type( 5 'wpc/location', array( 6 'editor_script' => 'wpc-block-js', 7 'render_callback' => 'wpc_location_callback', 8 'api_version' => 1, 9 'attributes' => array() 10 ) 11 ); 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 12 3 13 if(is_checkout()){ 14 wp_enqueue_script('frontend-js-block-location', \Wpcafe::assets_url() . 'js/wpc-block-location.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 15 } 4 defined( "ABSPATH" ) || exit; 5 6 class Location { 7 8 use \WpCafe\Traits\Wpc_Singleton; 9 10 function init() { 11 add_action('init', [$this, 'register_location_block']); 12 } 13 14 function register_location_block(){ 15 register_block_type( 16 'wpc/location', array( 17 'editor_script' => 'wpc-block-js', 18 'render_callback' => [$this, 'wpc_location_callback'], 19 'api_version' => 1, 20 'attributes' => array() 21 ) 22 ); 23 24 $this->register_location_block_scripts(); 25 26 } 27 28 function register_location_block_scripts(){ 29 wp_register_script('frontend-js-block-location', \Wpcafe::assets_url() . 'js/wpc-block-location.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 30 } 31 32 33 function wpc_location_callback() { 34 //check if the location module is active 35 $settings = \WpCafe\Core\Base\Wpc_Settings_Field::instance()->get_settings_option(); 36 37 if( ! isset( $settings['wpcafe_food_location']) ){ 38 return; 39 } 40 41 if(is_checkout() ){ 42 wp_enqueue_script( 'frontend-js-block-location' ); 43 } 44 45 return do_shortcode( '[wpc_location_checkout]' ); 46 } 16 47 17 48 } 18 add_action('init', 'register_location_block');19 20 // pickup delivery checkout page block callback21 function wpc_location_callback() {22 //check if woocommerce exists23 if ( ! class_exists( 'Woocommerce' ) ) { return; }24 25 return do_shortcode( '[wpc_location_checkout]' );26 } -
wp-cafe/tags/2.2.29/core/modules/guten-block/inc/blocks/pickup-delivery.php
r3112563 r3125940 1 1 <?php 2 //register pickup delivery checkout page block 3 function register_pickup_delivery_block(){ 4 register_block_type( 5 'wpc/pickup-delivery', array( 6 'editor_script' => 'wpc-block-js', 7 'render_callback' => 'wpc_pickup_delivery_callback', 8 'api_version' => 1, 9 'attributes' => array() 10 ) 11 ); 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 12 3 13 if(is_checkout()){ 14 wp_enqueue_script('frontend-js-block-pickup', \Wpcafe::assets_url() . 'js/wpc-block-pickup.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 15 } 4 defined( "ABSPATH" ) || exit; 5 6 class Pickup_Delivery { 7 8 use \WpCafe\Traits\Wpc_Singleton; 9 10 function init() { 11 add_action('init', [$this, 'register_pickup_delivery_block']); 12 } 13 14 function register_pickup_delivery_block(){ 15 register_block_type( 16 'wpc/pickup-delivery', array( 17 'editor_script' => 'wpc-block-js', 18 'render_callback' => [$this, 'wpc_pickup_delivery_callback'], 19 'api_version' => 1, 20 'attributes' => array() 21 ) 22 ); 23 24 $this->register_pickup_delivery_block_scripts(); 25 } 26 27 function register_pickup_delivery_block_scripts(){ 28 wp_register_script('frontend-js-block-pickup', \Wpcafe::assets_url() . 'js/wpc-block-pickup.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 29 } 30 31 // pickup delivery checkout page block callback 32 function wpc_pickup_delivery_callback() { 33 //check if the pickup/delivery module is active 34 $allowed_options = [ 35 'Both', 36 'Delivery', 37 'Pickup' 38 ]; 39 40 $settings = \WpCafe\Core\Base\Wpc_Settings_Field::instance()->get_settings_option(); 41 42 if( ! in_array($settings['wpc_pro_allow_order_for'], $allowed_options)){ 43 return; 44 } 45 46 if(is_checkout() ){ 47 wp_enqueue_script( 'frontend-js-block-pickup' ); 48 } 49 50 return do_shortcode( '[wpc_pickup_delivery_checkout]' ); 51 } 16 52 17 53 } 18 add_action('init', 'register_pickup_delivery_block');19 20 // pickup delivery checkout page block callback21 function wpc_pickup_delivery_callback() {22 //check if woocommerce exists23 if ( ! class_exists( 'Woocommerce' ) ) { return; }24 25 return do_shortcode( '[wpc_pickup_delivery_checkout]' );26 } -
wp-cafe/tags/2.2.29/core/shortcodes/hook.php
r3112563 r3125940 84 84 global $product; 85 85 86 if ( !$product->is_type('external')) {86 if (isset($product) && !$product->is_type('external')) { 87 87 ?> 88 88 <script type="text/javascript"> … … 331 331 $atts 332 332 )); 333 334 $allowed_file_names = [ 335 'style-1', 336 'style-2', 337 'style-3' 338 ]; 339 340 if( in_array($style, $allowed_file_names)){ 341 $template_file = esc_html($style); 342 }else{ 343 $template_file = $allowed_file_names[0]; 344 } 345 333 346 ob_start(); 334 347 // category sorting from backend … … 342 355 $unique_id = md5(md5(microtime())); 343 356 $settings = array(); 344 $settings["food_menu_style"] = $ style;357 $settings["food_menu_style"] = $template_file; 345 358 $settings["show_thumbnail"] = $product_thumbnail; 346 359 $settings["wpc_price_show"] = $wpc_price_show; -
wp-cafe/tags/2.2.29/readme.txt
r3112563 r3125940 4 4 Requires at least: 5.2 5 5 Tested up to: 6.5.5 6 Stable tag: 2.2.2 86 Stable tag: 2.2.29 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 397 397 == Changelog == 398 398 399 = 2.2.29 ( July 25, 2024 ) = 400 401 Fix : WooCommerce dependency error 402 Fix : Shortcode generation issue fix 403 Tweak : Patch LFI security for Food Menu List widget 404 Tweak : Improved Gutenberg blocks 405 399 406 = 2.2.28 ( July 4, 2024 ) = 400 407 … … 403 410 Fix : Single product add to cart issue fix 404 411 412 405 413 = 2.2.27 ( June 13, 2024 ) = 406 414 407 Update: Improved security for reservation408 New : Pickup/Delivery Gutenberg checkout block409 Fix : QR Reservation table name not appearing415 Tweak : Improved security for reservation 416 New : Pickup/Delivery Gutenberg checkout block 417 Fix : QR Reservation table name not appearing 410 418 411 419 = 2.2.26 ( May 30, 2024 ) = -
wp-cafe/tags/2.2.29/utils/wpc-utilities.php
r3112563 r3125940 210 210 'class' => [], 211 211 'multiple' => array(), 212 'data-cat' => [] 212 213 213 214 ], -
wp-cafe/tags/2.2.29/wpcafe.php
r3112563 r3125940 9 9 * Plugin URI: https://product.themewinter.com/wpcafe 10 10 * Description: WordPress Restaurant solution plugin to launch Restaurant Websites. 11 * Version: 2.2.2 811 * Version: 2.2.29 12 12 * Author: Themewinter 13 13 * Author URI: http://themewinter.com/ … … 30 30 */ 31 31 static function version() { 32 return '2.2.2 8';32 return '2.2.29'; 33 33 } 34 34 -
wp-cafe/trunk/bootstrap.php
r2982187 r3125940 108 108 109 109 // register gutenberg blocks 110 if( file_exists( \Wpcafe::plugin_dir() . 'core/modules/guten-block/inc/init.php' )){ 111 include_once \Wpcafe::plugin_dir() . 'core/modules/guten-block/inc/init.php'; 112 } 113 110 \WpCafe\Core\Modules\Guten_Block\Inc\Register_Blocks::instance()->init(); 111 114 112 if ( is_admin() ){ 115 113 \WpCafe\Core\Core::instance()->init(); -
wp-cafe/trunk/core/modules/guten-block/inc/blocks/food-list.php
r3112563 r3125940 1 1 <?php 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 3 4 defined( "ABSPATH" ) || exit; 5 2 6 use WpCafe\Utils\Wpc_Utilities; 3 7 4 //register food list block 5 function register_food_list_block(){ 6 register_block_type( 7 'wpc/food-menu-list', array( 8 // Enqueue blocks.style.build.css on both frontend & backend. 9 'style' => 'wpc-block-style-css', 10 // Enqueue blocks.editor.build.css in the editor only. 11 'editor_style' => 'wpc-block-editor-style-css', 12 // Enqueue blocks.build.js in the editor only. 13 'editor_script' => 'wpc-block-js', 14 'render_callback' => 'wpc_food_menu_list_callback', 15 'api_version' => 1, 16 'attributes' => array( 17 'food_menu_style' => array( 18 'type' => 'string', 19 'default' => 'style-1' 20 ), 21 'show_thumbnail' => array( 22 'type' => 'string', 23 'default' => 'yes' 24 ), 25 'wpc_menu_cat' => array( 26 'type' => 'array', 27 'default' => [] 28 ), 29 'wpc_desc_limit' => array( 30 'type' => 'integer', 31 'default' => 20 32 ), 33 'wpc_show_desc' => array( 34 'type' => 'string', 35 'default' => 'yes' 36 ), 37 'wpc_cart_button_show' => array( 38 'type' => 'string', 39 'default' => 'yes' 40 ), 41 'title_link_show' => array( 42 'type' => 'string', 43 'default' => 'yes' 44 ), 45 'show_item_status' => array( 46 'type' => 'string', 47 'default' => 'yes' 48 ), 49 'wpc_price_show' => array( 50 'type' => 'string', 51 'default' => 'yes' 52 ), 53 'wpc_menu_count' => array( 54 'type' => 'integer', 55 'default' => 20 56 ), 57 'wpc_menu_order' => array( 58 'type' => 'string', 59 'default' => 'DESC' 60 ), 61 'wpc_show_vendor' => array( 62 'type' => 'string', 63 'default' => 'yes' 8 class Food_List { 9 10 use \WpCafe\Traits\Wpc_Singleton; 11 12 function init() { 13 add_action('init', [$this, 'register_food_list_block']); 14 } 15 16 function register_food_list_block(){ 17 register_block_type( 18 'wpc/food-menu-list', array( 19 // Enqueue blocks.style.build.css on both frontend & backend. 20 'style' => 'wpc-block-style-css', 21 // Enqueue blocks.editor.build.css in the editor only. 22 'editor_style' => 'wpc-block-editor-style-css', 23 // Enqueue blocks.build.js in the editor only. 24 'editor_script' => 'wpc-block-js', 25 'render_callback' => [$this, 'wpc_food_menu_list_callback'], 26 'api_version' => 1, 27 'attributes' => array( 28 'food_menu_style' => array( 29 'type' => 'string', 30 'default' => 'style-1' 31 ), 32 'show_thumbnail' => array( 33 'type' => 'string', 34 'default' => 'yes' 35 ), 36 'wpc_menu_cat' => array( 37 'type' => 'array', 38 'default' => [] 39 ), 40 'wpc_desc_limit' => array( 41 'type' => 'integer', 42 'default' => 20 43 ), 44 'wpc_show_desc' => array( 45 'type' => 'string', 46 'default' => 'yes' 47 ), 48 'wpc_cart_button_show' => array( 49 'type' => 'string', 50 'default' => 'yes' 51 ), 52 'title_link_show' => array( 53 'type' => 'string', 54 'default' => 'yes' 55 ), 56 'show_item_status' => array( 57 'type' => 'string', 58 'default' => 'yes' 59 ), 60 'wpc_price_show' => array( 61 'type' => 'string', 62 'default' => 'yes' 63 ), 64 'wpc_menu_count' => array( 65 'type' => 'integer', 66 'default' => 20 67 ), 68 'wpc_menu_order' => array( 69 'type' => 'string', 70 'default' => 'DESC' 71 ), 72 'wpc_show_vendor' => array( 73 'type' => 'string', 74 'default' => 'yes' 75 ) 64 76 ) 65 77 ) 66 ) 67 ); 68 } 69 add_action('init', 'register_food_list_block'); 78 ); 79 } 70 80 71 // food menu list block callback 72 function wpc_food_menu_list_callback($settings){ 73 //check if woocommerce exists 74 if (!class_exists('Woocommerce')) { return; } 81 // food menu list block callback 82 function wpc_food_menu_list_callback($settings){ 83 $unique_id = md5(md5(microtime())); 75 84 76 $unique_id = md5(md5(microtime())); 85 $style = $settings["food_menu_style"]; 86 $show_item_status = $settings["show_item_status"]; 87 $show_thumbnail = $settings["show_thumbnail"]; 88 $title_link_show = $settings["title_link_show"]; 89 $wpc_cart_button = $settings["wpc_cart_button_show"]; 90 $wpc_show_desc = $settings["wpc_show_desc"]; 91 $wpc_desc_limit = $settings["wpc_desc_limit"]; 92 $wpc_menu_cat = $settings["wpc_menu_cat"]; 93 $wpc_menu_count = $settings["wpc_menu_count"]; 94 $wpc_menu_order = $settings["wpc_menu_order"]; 95 $show_thumbnail = $settings["show_thumbnail"]; 96 $wpc_price_show = $settings["wpc_price_show"]; 97 $wpc_show_vendor = $settings["wpc_show_vendor"]; 98 99 apply_filters( 'elementor/control/search_data' , $settings , $unique_id , 'wpc-menus-list' ); 77 100 78 $style = $settings["food_menu_style"]; 79 $show_item_status = $settings["show_item_status"]; 80 $show_thumbnail = $settings["show_thumbnail"]; 81 $title_link_show = $settings["title_link_show"]; 82 $wpc_cart_button = $settings["wpc_cart_button_show"]; 83 $wpc_show_desc = $settings["wpc_show_desc"]; 84 $wpc_desc_limit = $settings["wpc_desc_limit"]; 85 $wpc_menu_cat = $settings["wpc_menu_cat"]; 86 $wpc_menu_count = $settings["wpc_menu_count"]; 87 $wpc_menu_order = $settings["wpc_menu_order"]; 88 $show_thumbnail = $settings["show_thumbnail"]; 89 $wpc_price_show = $settings["wpc_price_show"]; 90 $wpc_show_vendor = $settings["wpc_show_vendor"]; 91 92 apply_filters( 'elementor/control/search_data' , $settings , $unique_id , 'wpc-menus-list' ); 101 $allowed_file_names = [ 102 'style-1', 103 'style-2', 104 'style-3' 105 ]; 93 106 94 $allowed_file_names = [95 'style-1', 96 'style-2',97 'style-3'98 ]; 107 if( in_array($style, $allowed_file_names)){ 108 $template_file = esc_html($style); 109 }else{ 110 $template_file = $allowed_file_names[0]; 111 } 99 112 100 if( in_array($style, $allowed_file_names)){ 101 $template_file = esc_html($style); 102 }else{ 103 $template_file = $allowed_file_names[0]; 104 } 113 ob_start(); 114 ?> 115 <div class="main_wrapper_<?php echo esc_html($unique_id)?>"> 116 <div class="list_template_<?php echo esc_html($unique_id) ?> wpc-nav-shortcode wpc-widget-wrapper" data-id="<?php echo esc_attr($unique_id)?>"> 117 <?php 118 $food_list_args = array( 119 'post_type' => 'product', 120 'no_of_product' => $wpc_menu_count, 121 'wpc_cat' => $wpc_menu_cat, 122 'order' => $wpc_menu_order, 123 ); 124 $products = Wpc_Utilities::product_query( $food_list_args ); 125 include \Wpcafe::plugin_dir() . "widgets/wpc-menus-list/style/{$template_file}.php"; 126 ?> 127 </div> 128 </div> 129 <?php 105 130 106 ob_start(); 107 ?> 108 <div class="main_wrapper_<?php echo esc_html($unique_id)?>"> 109 <div class="list_template_<?php echo esc_html($unique_id) ?> wpc-nav-shortcode wpc-widget-wrapper" data-id="<?php echo esc_attr($unique_id)?>"> 110 <?php 111 $food_list_args = array( 112 'post_type' => 'product', 113 'no_of_product' => $wpc_menu_count, 114 'wpc_cat' => $wpc_menu_cat, 115 'order' => $wpc_menu_order, 116 ); 117 $products = Wpc_Utilities::product_query( $food_list_args ); 118 include \Wpcafe::plugin_dir() . "widgets/wpc-menus-list/style/{$template_file}.php"; 119 ?> 120 </div> 121 </div> 122 <?php 131 return ob_get_clean(); 123 132 124 return ob_get_clean();133 } 125 134 126 135 } -
wp-cafe/trunk/core/modules/guten-block/inc/blocks/food-tab.php
r3112563 r3125940 1 1 <?php 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 3 4 defined( "ABSPATH" ) || exit; 5 2 6 use WpCafe\Utils\Wpc_Utilities; 3 7 4 //register food tab block 5 function register_food_tab_block(){ 6 register_block_type( 7 'wpc/food-menu-tab', array( 8 // Enqueue blocks.style.build.css on both frontend & backend. 9 'style' => 'wpc-block-style-css', 10 // Enqueue blocks.editor.build.css in the editor only. 11 'editor_style' => 'wpc-block-editor-style-css', 12 // Enqueue blocks.build.js in the editor only. 13 'editor_script' => 'wpc-block-js', 14 'render_callback' => 'wpc_food_menu_tab_callback', 15 'api_version' => 1, 16 'attributes' => array( 17 'food_menu_style' => array( 18 'type' => 'string', 19 'default' => 'style-1' 20 ), 21 'wpc_food_categories' => array( 22 'type' => 'array', 23 'default' => [] 24 ), 25 'show_thumbnail' => array( 26 'type' => 'string', 27 'default' => 'yes' 28 ), 29 'wpc_desc_limit' => array( 30 'type' => 'integer', 31 'default' => 20 32 ), 33 'wpc_show_desc' => array( 34 'type' => 'string', 35 'default' => 'yes' 36 ), 37 'wpc_cart_button' => array( 38 'type' => 'string', 39 'default' => 'yes' 40 ), 41 'title_link_show' => array( 42 'type' => 'string', 43 'default' => 'yes' 44 ), 45 'show_item_status' => array( 46 'type' => 'string', 47 'default' => 'yes' 48 ), 49 'wpc_price_show' => array( 50 'type' => 'string', 51 'default' => 'yes' 52 ), 53 'wpc_menu_count' => array( 54 'type' => 'integer', 55 'default' => 20 56 ), 57 'wpc_menu_order' => array( 58 'type' => 'string', 59 'default' => 'DESC' 60 ), 61 'wpc_show_vendor' => array( 62 'type' => 'string', 63 'default' => 'yes' 8 class Food_Tab { 9 10 use \WpCafe\Traits\Wpc_Singleton; 11 12 function init() { 13 add_action('init', [$this, 'register_food_tab_block']); 14 } 15 16 function register_food_tab_block(){ 17 register_block_type( 18 'wpc/food-menu-tab', array( 19 // Enqueue blocks.style.build.css on both frontend & backend. 20 'style' => 'wpc-block-style-css', 21 // Enqueue blocks.editor.build.css in the editor only. 22 'editor_style' => 'wpc-block-editor-style-css', 23 // Enqueue blocks.build.js in the editor only. 24 'editor_script' => 'wpc-block-js', 25 'render_callback' => [$this, 'wpc_food_menu_tab_callback'], 26 'api_version' => 1, 27 'attributes' => array( 28 'food_menu_style' => array( 29 'type' => 'string', 30 'default' => 'style-1' 31 ), 32 'wpc_food_categories' => array( 33 'type' => 'array', 34 'default' => [] 35 ), 36 'show_thumbnail' => array( 37 'type' => 'string', 38 'default' => 'yes' 39 ), 40 'wpc_desc_limit' => array( 41 'type' => 'integer', 42 'default' => 20 43 ), 44 'wpc_show_desc' => array( 45 'type' => 'string', 46 'default' => 'yes' 47 ), 48 'wpc_cart_button' => array( 49 'type' => 'string', 50 'default' => 'yes' 51 ), 52 'title_link_show' => array( 53 'type' => 'string', 54 'default' => 'yes' 55 ), 56 'show_item_status' => array( 57 'type' => 'string', 58 'default' => 'yes' 59 ), 60 'wpc_price_show' => array( 61 'type' => 'string', 62 'default' => 'yes' 63 ), 64 'wpc_menu_count' => array( 65 'type' => 'integer', 66 'default' => 20 67 ), 68 'wpc_menu_order' => array( 69 'type' => 'string', 70 'default' => 'DESC' 71 ), 72 'wpc_show_vendor' => array( 73 'type' => 'string', 74 'default' => 'yes' 75 ) 64 76 ) 65 77 ) 66 ) 67 ); 68 } 69 add_action('init', 'register_food_tab_block'); 78 ); 79 } 70 80 71 // food menu tab block callback72 function wpc_food_menu_tab_callback($settings){73 //check if woocommerce exists74 if (!class_exists('Woocommerce')) { return; }81 // food menu tab block callback 82 function wpc_food_menu_tab_callback($settings){ 83 //check if woocommerce exists 84 if (!class_exists('Woocommerce')) { return; } 75 85 76 $unique_id = md5(md5(microtime()));86 $unique_id = md5(md5(microtime())); 77 87 78 $style = $settings['food_menu_style'];79 $wpc_menu_order = $settings['wpc_menu_order'];80 $wpc_desc_limit = $settings['wpc_desc_limit'];81 $wpc_cart_button = $settings['wpc_cart_button'];82 $show_item_status = $settings['show_item_status'];83 $wpc_price_show = $settings["wpc_price_show"];84 $wpc_show_vendor = $settings["wpc_show_vendor"];88 $style = $settings['food_menu_style']; 89 $wpc_menu_order = $settings['wpc_menu_order']; 90 $wpc_desc_limit = $settings['wpc_desc_limit']; 91 $wpc_cart_button = $settings['wpc_cart_button']; 92 $show_item_status = $settings['show_item_status']; 93 $wpc_price_show = $settings["wpc_price_show"]; 94 $wpc_show_vendor = $settings["wpc_show_vendor"]; 85 95 86 $wpc_cat_arr = $settings['wpc_food_categories']; 87 88 $food_menu_tabs = []; 89 if (count($wpc_cat_arr) > 0) { 90 foreach ($wpc_cat_arr as $key => $value) { 91 if ($wpc_cat = get_term_by('id', $value, 'product_cat')) { 92 $wpc_get_menu_order = get_term_meta($wpc_cat->term_id, 'wpc_menu_order_priority', true); 93 $wpc_cat = get_term_by('id', $value, 'product_cat'); 94 $cat_name = ($wpc_cat && $wpc_cat->name ) ? $wpc_cat->name : ""; 95 $tab_data = array('post_cats'=>[$value],'tab_title' => $cat_name); 96 if ($wpc_get_menu_order == '') { 97 $food_menu_tabs[$key] = $tab_data; 98 } else { 99 $food_menu_tabs[$wpc_get_menu_order] = $tab_data; 96 $wpc_cat_arr = $settings['wpc_food_categories']; 97 98 $food_menu_tabs = []; 99 if (count($wpc_cat_arr) > 0) { 100 foreach ($wpc_cat_arr as $key => $value) { 101 if ($wpc_cat = get_term_by('id', $value, 'product_cat')) { 102 $wpc_get_menu_order = get_term_meta($wpc_cat->term_id, 'wpc_menu_order_priority', true); 103 $wpc_cat = get_term_by('id', $value, 'product_cat'); 104 $cat_name = ($wpc_cat && $wpc_cat->name ) ? $wpc_cat->name : ""; 105 $tab_data = array('post_cats'=>[$value],'tab_title' => $cat_name); 106 if ($wpc_get_menu_order == '') { 107 $food_menu_tabs[$key] = $tab_data; 108 } else { 109 $food_menu_tabs[$wpc_get_menu_order] = $tab_data; 110 } 100 111 } 101 112 } 113 }else{ 114 return "<p>Select at least one category.</p>"; 102 115 } 103 }else{ 104 return "<p>Select at least one category.</p>"; 116 117 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){ 118 $wpc_menu_count = is_array($settings) && isset($settings['wpc_menu_count']) ? $settings['wpc_menu_count'] : 5; 119 $wpc_show_desc = is_array($settings) && isset($settings['wpc_show_desc']) ? $settings['wpc_show_desc'] : 'yes'; 120 $show_thumbnail = is_array($settings) && isset($settings['show_thumbnail']) ? $settings['show_thumbnail'] : 'yes'; 121 $title_link_show= is_array($settings) && isset($settings['title_link_show']) ? $settings['title_link_show'] : 'yes'; 122 $class = ($title_link_show=='yes')? '' : 'wpc-no-link'; 123 124 $allowed_file_names = [ 125 'style-1', 126 'style-2' 127 ]; 128 129 if( in_array($style, $allowed_file_names)){ 130 $template_file = esc_html($style); 131 }else{ 132 $template_file = $allowed_file_names[0]; 133 } 134 135 ob_start(); 136 ?> 137 <div class="wpc-food-tab-wrapper wpc-nav-shortcode main_wrapper_<?php echo esc_html($unique_id)?>" data-id="<?php echo esc_attr($unique_id)?>"> 138 <ul class="wpc-nav"> 139 <?php 140 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){ 141 foreach ($food_menu_tabs as $tab_key => $value) { 142 $active_class = (($tab_key == array_keys($food_menu_tabs)[0]) ? 'wpc-active' : ' '); 143 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ; 144 ?> 145 <li> 146 <a href='#' class='wpc-tab-a <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($tab_key); ?>' 147 data-cat_id='<?php echo esc_attr( $cat_id ); ?>'> 148 <span><?php echo esc_html($value['tab_title']); ?></span> 149 </a> 150 </li> 151 <?php 152 } 153 } 154 ?> 155 </ul> 156 <div class="wpc-tab-content wpc-widget-wrapper"> 157 <?php 158 foreach ($food_menu_tabs as $content_key => $value) { 159 if(isset( $value['post_cats'][0] )){ 160 $active_class = (($content_key == array_keys($food_menu_tabs)[0]) ? 'tab-active' : ' '); 161 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ; 162 ?> 163 <div class='wpc-tab <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($content_key); ?>' 164 data-cat_id='<?php echo esc_attr($cat_id);?>'> 165 <div class="tab_template_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>"></div> 166 <div class="template_data_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>"> 167 <?php 168 $food_tab_args = array( 169 'post_type' => 'product', 170 'no_of_product' => $wpc_menu_count, 171 'wpc_cat' => $value['post_cats'], 172 'order' => $wpc_menu_order, 173 ); 174 $products = Wpc_Utilities::product_query( $food_tab_args ); 175 include \Wpcafe::plugin_dir() . "widgets/wpc-food-menu-tab/style/{$template_file}.php"; 176 ?> 177 </div> 178 </div><!-- Tab pane 1 end --> 179 <?php 180 } 181 } 182 ?> 183 </div><!-- Tab content--> 184 </div> 185 <?php 186 } 187 return ob_get_clean(); 188 105 189 } 106 190 107 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){108 $wpc_menu_count = is_array($settings) && isset($settings['wpc_menu_count']) ? $settings['wpc_menu_count'] : 5;109 $wpc_show_desc = is_array($settings) && isset($settings['wpc_show_desc']) ? $settings['wpc_show_desc'] : 'yes';110 $show_thumbnail = is_array($settings) && isset($settings['show_thumbnail']) ? $settings['show_thumbnail'] : 'yes';111 $title_link_show= is_array($settings) && isset($settings['title_link_show']) ? $settings['title_link_show'] : 'yes';112 $class = ($title_link_show=='yes')? '' : 'wpc-no-link';113 114 $allowed_file_names = [115 'style-1',116 'style-2'117 ];118 119 if( in_array($style, $allowed_file_names)){120 $template_file = esc_html($style);121 }else{122 $template_file = $allowed_file_names[0];123 }124 125 ob_start();126 ?>127 <div class="wpc-food-tab-wrapper wpc-nav-shortcode main_wrapper_<?php echo esc_html($unique_id)?>" data-id="<?php echo esc_attr($unique_id)?>">128 <ul class="wpc-nav">129 <?php130 if( is_array( $food_menu_tabs ) && count( $food_menu_tabs )>0 ){131 foreach ($food_menu_tabs as $tab_key => $value) {132 $active_class = (($tab_key == array_keys($food_menu_tabs)[0]) ? 'wpc-active' : ' ');133 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ;134 ?>135 <li>136 <a href='#' class='wpc-tab-a <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($tab_key); ?>'137 data-cat_id='<?php echo esc_attr( $cat_id ); ?>'>138 <span><?php echo esc_html($value['tab_title']); ?></span>139 </a>140 </li>141 <?php142 }143 }144 ?>145 </ul>146 <div class="wpc-tab-content wpc-widget-wrapper">147 <?php148 foreach ($food_menu_tabs as $content_key => $value) {149 if(isset( $value['post_cats'][0] )){150 $active_class = (($content_key == array_keys($food_menu_tabs)[0]) ? 'tab-active' : ' ');151 $cat_id = isset($value['post_cats'][0] ) ? intval( $value['post_cats'][0] ) : 0 ;152 ?>153 <div class='wpc-tab <?php echo esc_attr($active_class); ?>' data-id='tab_<?php echo intval($content_key); ?>'154 data-cat_id='<?php echo esc_attr($cat_id);?>'>155 <div class="tab_template_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>"></div>156 <div class="template_data_<?php echo esc_attr( $cat_id.'_'.$unique_id );?>">157 <?php158 $food_tab_args = array(159 'post_type' => 'product',160 'no_of_product' => $wpc_menu_count,161 'wpc_cat' => $value['post_cats'],162 'order' => $wpc_menu_order,163 );164 $products = Wpc_Utilities::product_query( $food_tab_args );165 include \Wpcafe::plugin_dir() . "widgets/wpc-food-menu-tab/style/{$template_file}.php";166 ?>167 </div>168 </div><!-- Tab pane 1 end -->169 <?php170 }171 }172 ?>173 </div><!-- Tab content-->174 </div>175 <?php176 }177 return ob_get_clean();178 179 191 } -
wp-cafe/trunk/core/modules/guten-block/inc/blocks/location.php
r3112563 r3125940 1 1 <?php 2 //register location checkout page block 3 function register_location_block(){ 4 register_block_type( 5 'wpc/location', array( 6 'editor_script' => 'wpc-block-js', 7 'render_callback' => 'wpc_location_callback', 8 'api_version' => 1, 9 'attributes' => array() 10 ) 11 ); 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 12 3 13 if(is_checkout()){ 14 wp_enqueue_script('frontend-js-block-location', \Wpcafe::assets_url() . 'js/wpc-block-location.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 15 } 4 defined( "ABSPATH" ) || exit; 5 6 class Location { 7 8 use \WpCafe\Traits\Wpc_Singleton; 9 10 function init() { 11 add_action('init', [$this, 'register_location_block']); 12 } 13 14 function register_location_block(){ 15 register_block_type( 16 'wpc/location', array( 17 'editor_script' => 'wpc-block-js', 18 'render_callback' => [$this, 'wpc_location_callback'], 19 'api_version' => 1, 20 'attributes' => array() 21 ) 22 ); 23 24 $this->register_location_block_scripts(); 25 26 } 27 28 function register_location_block_scripts(){ 29 wp_register_script('frontend-js-block-location', \Wpcafe::assets_url() . 'js/wpc-block-location.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 30 } 31 32 33 function wpc_location_callback() { 34 //check if the location module is active 35 $settings = \WpCafe\Core\Base\Wpc_Settings_Field::instance()->get_settings_option(); 36 37 if( ! isset( $settings['wpcafe_food_location']) ){ 38 return; 39 } 40 41 if(is_checkout() ){ 42 wp_enqueue_script( 'frontend-js-block-location' ); 43 } 44 45 return do_shortcode( '[wpc_location_checkout]' ); 46 } 16 47 17 48 } 18 add_action('init', 'register_location_block');19 20 // pickup delivery checkout page block callback21 function wpc_location_callback() {22 //check if woocommerce exists23 if ( ! class_exists( 'Woocommerce' ) ) { return; }24 25 return do_shortcode( '[wpc_location_checkout]' );26 } -
wp-cafe/trunk/core/modules/guten-block/inc/blocks/pickup-delivery.php
r3112563 r3125940 1 1 <?php 2 //register pickup delivery checkout page block 3 function register_pickup_delivery_block(){ 4 register_block_type( 5 'wpc/pickup-delivery', array( 6 'editor_script' => 'wpc-block-js', 7 'render_callback' => 'wpc_pickup_delivery_callback', 8 'api_version' => 1, 9 'attributes' => array() 10 ) 11 ); 2 namespace WpCafe\Core\Modules\Guten_Block\Inc\Blocks; 12 3 13 if(is_checkout()){ 14 wp_enqueue_script('frontend-js-block-pickup', \Wpcafe::assets_url() . 'js/wpc-block-pickup.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 15 } 4 defined( "ABSPATH" ) || exit; 5 6 class Pickup_Delivery { 7 8 use \WpCafe\Traits\Wpc_Singleton; 9 10 function init() { 11 add_action('init', [$this, 'register_pickup_delivery_block']); 12 } 13 14 function register_pickup_delivery_block(){ 15 register_block_type( 16 'wpc/pickup-delivery', array( 17 'editor_script' => 'wpc-block-js', 18 'render_callback' => [$this, 'wpc_pickup_delivery_callback'], 19 'api_version' => 1, 20 'attributes' => array() 21 ) 22 ); 23 24 $this->register_pickup_delivery_block_scripts(); 25 } 26 27 function register_pickup_delivery_block_scripts(){ 28 wp_register_script('frontend-js-block-pickup', \Wpcafe::assets_url() . 'js/wpc-block-pickup.js', [ 'jquery', 'wpc-pro-widgets-modal-script', 'jquery-timepicker', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n' ], \Wpcafe::version()); 29 } 30 31 // pickup delivery checkout page block callback 32 function wpc_pickup_delivery_callback() { 33 //check if the pickup/delivery module is active 34 $allowed_options = [ 35 'Both', 36 'Delivery', 37 'Pickup' 38 ]; 39 40 $settings = \WpCafe\Core\Base\Wpc_Settings_Field::instance()->get_settings_option(); 41 42 if( ! in_array($settings['wpc_pro_allow_order_for'], $allowed_options)){ 43 return; 44 } 45 46 if(is_checkout() ){ 47 wp_enqueue_script( 'frontend-js-block-pickup' ); 48 } 49 50 return do_shortcode( '[wpc_pickup_delivery_checkout]' ); 51 } 16 52 17 53 } 18 add_action('init', 'register_pickup_delivery_block');19 20 // pickup delivery checkout page block callback21 function wpc_pickup_delivery_callback() {22 //check if woocommerce exists23 if ( ! class_exists( 'Woocommerce' ) ) { return; }24 25 return do_shortcode( '[wpc_pickup_delivery_checkout]' );26 } -
wp-cafe/trunk/core/shortcodes/hook.php
r3112563 r3125940 84 84 global $product; 85 85 86 if ( !$product->is_type('external')) {86 if (isset($product) && !$product->is_type('external')) { 87 87 ?> 88 88 <script type="text/javascript"> … … 331 331 $atts 332 332 )); 333 334 $allowed_file_names = [ 335 'style-1', 336 'style-2', 337 'style-3' 338 ]; 339 340 if( in_array($style, $allowed_file_names)){ 341 $template_file = esc_html($style); 342 }else{ 343 $template_file = $allowed_file_names[0]; 344 } 345 333 346 ob_start(); 334 347 // category sorting from backend … … 342 355 $unique_id = md5(md5(microtime())); 343 356 $settings = array(); 344 $settings["food_menu_style"] = $ style;357 $settings["food_menu_style"] = $template_file; 345 358 $settings["show_thumbnail"] = $product_thumbnail; 346 359 $settings["wpc_price_show"] = $wpc_price_show; -
wp-cafe/trunk/readme.txt
r3112563 r3125940 4 4 Requires at least: 5.2 5 5 Tested up to: 6.5.5 6 Stable tag: 2.2.2 86 Stable tag: 2.2.29 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 397 397 == Changelog == 398 398 399 = 2.2.29 ( July 25, 2024 ) = 400 401 Fix : WooCommerce dependency error 402 Fix : Shortcode generation issue fix 403 Tweak : Patch LFI security for Food Menu List widget 404 Tweak : Improved Gutenberg blocks 405 399 406 = 2.2.28 ( July 4, 2024 ) = 400 407 … … 403 410 Fix : Single product add to cart issue fix 404 411 412 405 413 = 2.2.27 ( June 13, 2024 ) = 406 414 407 Update: Improved security for reservation408 New : Pickup/Delivery Gutenberg checkout block409 Fix : QR Reservation table name not appearing415 Tweak : Improved security for reservation 416 New : Pickup/Delivery Gutenberg checkout block 417 Fix : QR Reservation table name not appearing 410 418 411 419 = 2.2.26 ( May 30, 2024 ) = -
wp-cafe/trunk/utils/wpc-utilities.php
r3112563 r3125940 210 210 'class' => [], 211 211 'multiple' => array(), 212 'data-cat' => [] 212 213 213 214 ], -
wp-cafe/trunk/wpcafe.php
r3112563 r3125940 9 9 * Plugin URI: https://product.themewinter.com/wpcafe 10 10 * Description: WordPress Restaurant solution plugin to launch Restaurant Websites. 11 * Version: 2.2.2 811 * Version: 2.2.29 12 12 * Author: Themewinter 13 13 * Author URI: http://themewinter.com/ … … 30 30 */ 31 31 static function version() { 32 return '2.2.2 8';32 return '2.2.29'; 33 33 } 34 34
Note: See TracChangeset
for help on using the changeset viewer.