Changeset 3304286
- Timestamp:
- 06/01/2025 01:48:26 PM (10 months ago)
- Location:
- reality-shop-3d/trunk
- Files:
-
- 3 edited
-
RealityShop3D.php (modified) (1 diff)
-
assets/php/widgets/widget-glb-shortcode.php (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
reality-shop-3d/trunk/RealityShop3D.php
r3303917 r3304286 4 4 Plugin URI: https://en.kouroshweb.com/ 5 5 Description: Reality shop is a free 3D WordPress plugin for Elementor and WooCommerce fully compatible, Lightweight and high-performance settings. 6 Version: 1.8.9. 796 Version: 1.8.9.80 7 7 Author: kouroshweb 8 8 Author URI: https://en.kouroshweb.com/ -
reality-shop-3d/trunk/assets/php/widgets/widget-glb-shortcode.php
r3302854 r3304286 1 1 <?php 2 2 if (!defined('ABSPATH')) { 3 exit; // جلوگیری از دسترسی مستقیم3 exit; 4 4 } 5 5 … … 21 21 return ['reality_shop_3d']; 22 22 } 23 24 // تنظیمات ویجت 23 25 24 protected function _register_controls() { 26 25 $this->start_controls_section( … … 32 31 ); 33 32 34 // تنظیمات عرض و ارتفاع Canvas 35 $this->add_control( 36 'canvas_width', 33 $this->add_control('canvas_width', [ 34 'label' => esc_html__('Canvas Width', 'reality-shop-3d'), 35 'type' => \Elementor\Controls_Manager::NUMBER, 36 'default' => 500, 37 ]); 38 39 $this->add_control('canvas_height', [ 40 'label' => esc_html__('Canvas Height', 'reality-shop-3d'), 41 'type' => \Elementor\Controls_Manager::NUMBER, 42 'default' => 500, 43 ]); 44 45 $this->add_control('slider_max', [ 46 'label' => esc_html__('Slider Max', 'reality-shop-3d'), 47 'type' => \Elementor\Controls_Manager::NUMBER, 48 'default' => 5, 49 ]); 50 51 $this->add_control('custom_shortcode', [ 52 'label' => esc_html__('Custom Shortcode', 'reality-shop-3d'), 53 'type' => \Elementor\Controls_Manager::TEXT, 54 'default' => '', 55 ]); 56 57 $this->add_control('background_color', [ 58 'label' => esc_html__('Background Color', 'reality-shop-3d'), 59 'type' => \Elementor\Controls_Manager::COLOR, 60 'default' => 'null', 61 ]); 62 63 $this->add_control('background_null', [ 64 'label' => esc_html__('Remove Background', 'reality-shop-3d'), 65 'type' => \Elementor\Controls_Manager::SWITCHER, 66 'return_value' => 'yes', 67 ]); 68 69 $this->add_control('zoom', [ 70 'label' => esc_html__('Enable zoom', 'reality-shop-3d'), 71 'type' => \Elementor\Controls_Manager::SWITCHER, 72 'return_value' => 'yes', 73 ]); 74 75 $this->add_control('autoRotate', [ 76 'label' => esc_html__('Enable auto rotate', 'reality-shop-3d'), 77 'type' => \Elementor\Controls_Manager::SWITCHER, 78 'return_value' => 'yes', 79 ]); 80 81 $this->add_control('fullScreen', [ 82 'label' => esc_html__('Enable full screen', 'reality-shop-3d'), 83 'type' => \Elementor\Controls_Manager::SWITCHER, 84 'return_value' => 'yes', 85 ]); 86 87 $this->add_control('lazyLoad', [ 88 'label' => esc_html__('Enable lazy load', 'reality-shop-3d'), 89 'type' => \Elementor\Controls_Manager::SWITCHER, 90 'return_value' => 'yes', 91 ]); 92 93 $open_modal = get_option('reality_shop_open_in_modal'); 94 if (!empty($open_modal)) { 95 $this->add_control('open_in_modal_content', [ 96 'label' => esc_html__('Modal Content Message', 'reality-shop-3d'), 97 'type' => \Elementor\Controls_Manager::TEXTAREA, 98 'default' => 'Your 3D model will open in a modal.', 99 ]); 100 } 101 102 $this->end_controls_section(); 103 104 // 🎨 تنظیمات استایل متن 105 $this->start_controls_section( 106 'style_section', 37 107 [ 38 'label' => esc_html__('Canvas Width', 'reality-shop-3d'), 39 'type' => \Elementor\Controls_Manager::NUMBER, 40 'default' => 500, 41 'description' => esc_html__('Width of the 3D canvas in pixels.', 'reality-shop-3d'), 108 'label' => esc_html__('Text Style', 'reality-shop-3d'), 109 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 42 110 ] 43 111 ); 44 112 45 $this->add_control( 46 'canvas_height', 113 $this->add_control('text_color', [ 114 'label' => esc_html__('Text Color', 'reality-shop-3d'), 115 'type' => \Elementor\Controls_Manager::COLOR, 116 'selectors' => [ 117 '{{WRAPPER}} .rs3d-widget-text' => 'color: {{VALUE}};', 118 ], 119 ]); 120 121 $this->add_group_control( 122 \Elementor\Group_Control_Typography::get_type(), 47 123 [ 48 'label' => esc_html__('Canvas Height', 'reality-shop-3d'), 49 'type' => \Elementor\Controls_Manager::NUMBER, 50 'default' => 500, 51 'description' => esc_html__('Height of the 3D canvas in pixels.', 'reality-shop-3d'), 124 'name' => 'typography', 125 'label' => esc_html__('Typography', 'reality-shop-3d'), 126 'selector' => '{{WRAPPER}} .rs3d-widget-text', 52 127 ] 53 128 ); 54 129 55 // تنظیمات دیگر56 $this->add_control(57 'slider_max',58 [59 'label' => esc_html__('Slider Max', 'reality-shop-3d'),60 'type' => \Elementor\Controls_Manager::NUMBER,61 'default' => 5,62 'description' => esc_html__('Maximum brightness value.', 'reality-shop-3d'),63 ]64 );65 66 $this->add_control(67 'custom_shortcode',68 [69 'label' => esc_html__('Custom Shortcode', 'reality-shop-3d'),70 'type' => \Elementor\Controls_Manager::TEXT,71 'placeholder' => esc_html__('Enter a custom shortcode if needed', 'reality-shop-3d'),72 'default' => '',73 'description' => esc_html__('Enter a custom shortcode here. If empty, the product\'s meta shortcode will be used.', 'reality-shop-3d'),74 ]75 );76 77 // رنگ پسزمینه78 $this->add_control(79 'background_color',80 [81 'label' => esc_html__('Background Color', 'reality-shop-3d'),82 'type' => \Elementor\Controls_Manager::COLOR,83 'default' => 'null',84 'description' => esc_html__('Select the background color for the 3D canvas.', 'reality-shop-3d'),85 ]86 );87 88 // حذف پسزمینه89 $this->add_control(90 'background_null',91 [92 'label' => esc_html__('Remove Background', 'reality-shop-3d'),93 'type' => \Elementor\Controls_Manager::SWITCHER,94 'label_on' => esc_html__('Yes', 'reality-shop-3d'),95 'label_off' => esc_html__('No', 'reality-shop-3d'),96 'return_value' => 'yes',97 'default' => '',98 'description' => esc_html__('Enable to remove the background color.', 'reality-shop-3d'),99 ]100 );101 102 // فعال کردن Zoom103 $this->add_control(104 'zoom',105 [106 'label' => esc_html__('Enable zoom', 'reality-shop-3d'),107 'type' => \Elementor\Controls_Manager::SWITCHER,108 'label_on' => esc_html__('Yes', 'reality-shop-3d'),109 'label_off' => esc_html__('No', 'reality-shop-3d'),110 'return_value' => 'yes',111 'default' => '',112 'description' => esc_html__('Enable to zoom.', 'reality-shop-3d'),113 ]114 );115 116 // فعال کردن Auto-Rotate117 $this->add_control(118 'autoRotate',119 [120 'label' => esc_html__('Enable auto rotate', 'reality-shop-3d'),121 'type' => \Elementor\Controls_Manager::SWITCHER,122 'label_on' => esc_html__('Yes', 'reality-shop-3d'),123 'label_off' => esc_html__('No', 'reality-shop-3d'),124 'return_value' => 'yes',125 'default' => '',126 'description' => esc_html__('Enable to auto rotate.', 'reality-shop-3d'),127 ]128 );129 130 // فعال کردن Fullscreen131 $this->add_control(132 'fullScreen',133 [134 'label' => esc_html__('Enable full screen', 'reality-shop-3d'),135 'type' => \Elementor\Controls_Manager::SWITCHER,136 'label_on' => esc_html__('Yes', 'reality-shop-3d'),137 'label_off' => esc_html__('No', 'reality-shop-3d'),138 'return_value' => 'yes',139 'default' => '',140 'description' => esc_html__('Enable to full screen.', 'reality-shop-3d'),141 ]142 );143 144 // فعال کردن Lazy Load145 $this->add_control(146 'lazyLoad',147 [148 'label' => esc_html__('Enable lazy load', 'reality-shop-3d'),149 'type' => \Elementor\Controls_Manager::SWITCHER,150 'label_on' => esc_html__('Yes', 'reality-shop-3d'),151 'label_off' => esc_html__('No', 'reality-shop-3d'),152 'return_value' => 'yes',153 'default' => '',154 'description' => esc_html__('Enable to lazy load.', 'reality-shop-3d'),155 ]156 );157 158 // تنظیمات Modal159 $open_modal = get_option('reality_shop_open_in_modal');160 if (!empty($open_modal)) {161 $this->add_control(162 'open_in_modal_content',163 [164 'label' => esc_html__('Modal Content Message', 'reality-shop-3d'),165 'type' => \Elementor\Controls_Manager::TEXTAREA,166 'default' => 'Your 3D model will open in a modal.',167 'description' => esc_html__('This message will be shown inside the modal.', 'reality-shop-3d'),168 ]169 );170 }171 172 130 $this->end_controls_section(); 173 131 } 174 132 175 // رندر ویجت176 133 protected function render() { 177 134 global $post; … … 203 160 foreach ($shortcodes as $code) { 204 161 $file_url = ''; 205 206 162 foreach ($files as $file) { 207 163 if ($file['id'] === $code) { 208 // بررسی به ترتیب اولویت: glb -> gltf -> usdz 209 if (!empty($file['glb']) && in_array('glb', $allowed_extensions)) { 210 $file_url = esc_url($file['glb']); 211 } elseif (!empty($file['gltf']) && in_array('gltf', $allowed_extensions)) { 212 $file_url = esc_url($file['gltf']); 213 } elseif (!empty($file['usdz']) && in_array('usdz', $allowed_extensions)) { 214 $file_url = esc_url($file['usdz']); 215 } 164 if (!empty($file['glb'])) $file_url = esc_url($file['glb']); 165 elseif (!empty($file['gltf'])) $file_url = esc_url($file['gltf']); 166 elseif (!empty($file['usdz'])) $file_url = esc_url($file['usdz']); 216 167 break; 217 168 } 218 169 } 219 170 220 // اگر فایل نداشت یا پسوند مجاز نبود، ردش کن221 171 if (empty($file_url)) continue; 222 172 … … 224 174 if (!in_array($file_extension, $allowed_extensions)) continue; 225 175 226 // فقط یکبار اسکریپتها لود بشن227 176 if (!$rendered_any) { 228 177 wp_enqueue_style('bootstrap-css', 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css'); … … 248 197 $modal_message = $settings['open_in_modal_content'] ?: 'Your 3D model will open in a modal.'; 249 198 echo ' 250 <p id="modalBtn" style="cursor: pointer;"> 251 ' . esc_html($modal_message) . ' 252 </p> 199 <p id="modalBtn" class="rs3d-widget-text" style="cursor: pointer;">' . esc_html($modal_message) . '</p> 253 200 <div id="myModal" style="display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6);"> 254 <div style="background-color: #ffffff; margin: 3% auto; padding: 20px; border: 2px solid #ffffff; width: ' . esc_attr($canvas_width + 70) . 'px; height: ' . esc_attr($canvas_height + 70) . 'px; border-radius: 20px; text-align: center; box-shadow: 0 0 20px rgba(224, 224, 224, 0.5); position: relative;">255 <span id="closeBtn" style="color: #353535; position: absolute; top: 10px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer;">×</span>201 <div style="background-color: #ffffff; margin: 3% auto; padding: 20px; border: 2px solid #ffffff; width: ' . esc_attr($canvas_width + 70) . 'px; height: ' . esc_attr($canvas_height + 70) . 'px; border-radius: 20px; text-align: center;"> 202 <span id="closeBtn" class="rs3d-widget-text" style="color: #353535; position: absolute; top: 10px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer;">×</span> 256 203 <div class="d-flex flex-column mt-4 ms-3"> 257 204 <canvas class="threeDWidgetCanvas" style="width: ' . esc_attr($canvas_width) . 'px; height: ' . esc_attr($canvas_height) . 'px;"></canvas> -
reality-shop-3d/trunk/readme.txt
r3303917 r3304286 6 6 Requires at least: 5.5 7 7 Tested up to: 6.7 8 Stable tag: 1.8.9. 798 Stable tag: 1.8.9.80 9 9 Requires PHP: 7.4 10 10 License: GPL-3.0+
Note: See TracChangeset
for help on using the changeset viewer.