Changeset 2999820
- Timestamp:
- 11/22/2023 02:03:45 AM (2 years ago)
- Location:
- vistawp
- Files:
-
- 10 added
- 18 edited
- 1 copied
-
tags/1.3.0 (copied) (copied from vistawp/trunk)
-
tags/1.3.0/css/admin.css (modified) (1 diff)
-
tags/1.3.0/css/slideshow.css (modified) (16 diffs)
-
tags/1.3.0/img/vista_banner_icon.svg (added)
-
tags/1.3.0/includes/listings/single-listing.php (modified) (3 diffs)
-
tags/1.3.0/includes/options/notifications-banner.php (added)
-
tags/1.3.0/includes/options/options-display.php (modified) (6 diffs)
-
tags/1.3.0/includes/options/options-page.php (modified) (1 diff)
-
tags/1.3.0/includes/options/page-generator.php (added)
-
tags/1.3.0/includes/options/welcome-header.php (modified) (1 diff)
-
tags/1.3.0/js/slideshow.js (modified) (4 diffs)
-
tags/1.3.0/readme.txt (modified) (1 diff)
-
tags/1.3.0/templates/pages (added)
-
tags/1.3.0/templates/pages/main_page.php (added)
-
tags/1.3.0/vista.php (modified) (6 diffs)
-
trunk/css/admin.css (modified) (1 diff)
-
trunk/css/slideshow.css (modified) (16 diffs)
-
trunk/img/vista_banner_icon.svg (added)
-
trunk/includes/listings/single-listing.php (modified) (3 diffs)
-
trunk/includes/options/notifications-banner.php (added)
-
trunk/includes/options/options-display.php (modified) (6 diffs)
-
trunk/includes/options/options-page.php (modified) (1 diff)
-
trunk/includes/options/page-generator.php (added)
-
trunk/includes/options/welcome-header.php (modified) (1 diff)
-
trunk/js/slideshow.js (modified) (4 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/templates/pages (added)
-
trunk/templates/pages/main_page.php (added)
-
trunk/vista.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vistawp/tags/1.3.0/css/admin.css
r2949654 r2999820 104 104 } 105 105 106 #vistawp-banner{ 107 display: grid; 108 grid-template-columns: 40px auto; 109 } 106 110 107 111 112 .vsta-text-error { 113 color: #d63638; 114 font-weight: bold; 115 } 108 116 117 .vsta-text-success { 118 color: #00a32a; 119 font-weight: bold; 120 } 121 -
vistawp/tags/1.3.0/css/slideshow.css
r2949654 r2999820 1 * { 2 box-sizing: border-box; 3 } 4 1 5 .vista-grid-img { 2 6 max-width: 100%; … … 8 12 } 9 13 10 11 14 .vista-grid-img:hover { 12 15 -ms-transform: scale(1.05); /* IE 9 */ … … 14 17 transform: scale(1.05); 15 18 } 19 16 20 /* Main CSS */ 17 21 .grid-wrapper > div { … … 20 24 align-items: center; 21 25 } 26 22 27 .grid-wrapper > div > img { 23 28 width: 100%; … … 36 41 overflow: hidden; 37 42 } 43 38 44 .grid-wrapper .wide { 39 45 grid-column: span 2; 40 46 } 47 41 48 .grid-wrapper .tall { 42 49 grid-row: span 2; 43 50 } 51 44 52 .grid-wrapper .big { 45 53 grid-column: span 2; … … 89 97 width:90%; 90 98 } 99 91 100 .close{ 92 101 top:25px; … … 97 106 top:50%; 98 107 } 99 100 101 } 102 108 } 103 109 104 110 .close:hover, … … 110 116 111 117 /* Next & previous buttons */ 112 .vista-grid-prev, 113 .vista-grid-next {118 div .slideshow-container .vista-grid-prev, 119 div .slideshow-container .vista-grid-next { 114 120 cursor: pointer; 115 121 position: absolute; … … 118 124 padding: 16px; 119 125 margin-top: -50px; 120 color: white;126 color: #fff; 121 127 font-weight: bold; 122 128 font-size: 20px; 123 129 transition: 0.6s ease; 124 border-radius: 0 3px 3px 0;125 130 user-select: none; 126 131 -webkit-user-select: none; 127 132 background-color: rgba(0, 0, 0, 0.8); 133 } 134 135 div .slideshow-container .vista-grid-prev { 136 border-radius: 0 3px 3px 0; 137 } 138 139 div .slideshow-container .vista-grid-next { 140 border-radius: 3px 0px 0px 3px; 128 141 } 129 142 … … 140 153 } 141 154 142 . mySlides{155 .vista-slide-item { 143 156 display: none; 144 157 } … … 165 178 } 166 179 167 168 .vista-scroller-photobanner:hover img{ 169 170 } 171 172 * { 173 box-sizing: border-box; 174 } 175 176 180 .vista-scroller-photobanner:hover img{} 177 181 178 182 .zoom { … … 190 194 191 195 .zoom-main { 192 193 196 transition: transform .2s; /* Animation */ 194 197 } … … 198 201 transform: scale(1.1); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */ 199 202 } 200 201 203 202 204 /* Next & previous buttons */ … … 230 232 /* Slideshow container */ 231 233 .slideshow-container { 232 max-width: 1000px; 234 max-width: 100%; 235 height: 100%; 233 236 position: relative; 237 overflow: hidden; 234 238 margin: auto; 235 239 font-family: Verdana, sans-serif; 236 margin: 0;237 240 } 238 241 239 242 .slideshow-container * {box-sizing: border-box} 240 243 .slideshow-container .otherSlides {display: none} 241 .slideshow-container img {vertical-align: middle; max-height: 600px; width: auto;} 242 244 .slideshow-container img { 245 vertical-align: middle; 246 height: auto; 247 width: 100%; 248 } 243 249 244 250 /* Fading animation */ … … 265 271 } 266 272 267 268 273 .grid-container { 269 274 padding: 10px; … … 283 288 } 284 289 290 .thumbnails-carousel { 291 height:150px !important; 292 width:16.6%; 293 display: inline-block; 294 object-fit: cover; 295 } 296 297 .slides-masonry { 298 width:100%; 299 } 300 301 #vista-grid-load-btn { 302 width:100%; 303 } 304 305 /* slide count element */ 306 #vista-slide-number { 307 top: 50px; 308 z-index: 1; 309 position: relative; 310 float: right; 311 padding: 8px; 312 width: 40px; 313 background:#000; 314 color:#fff; 315 text-align:center; 316 margin-top: -50px; 317 font-size: 9px; 318 border-radius: 0px 0px 0px 3px; 319 opacity: 0.6; 320 } -
vistawp/tags/1.3.0/includes/listings/single-listing.php
r2964274 r2999820 83 83 */ 84 84 protected function price_sqft_field(?int $price, ?int $sqft): void { 85 if( 86 isset( $price ) && !empty( $price ) && 87 isset( $sqft ) && !empty( $sqft ) 88 ) { 85 if (!empty($price) && !empty($sqft)) { 89 86 try { 90 $this->try_process_field( 'sqftPrice', $price / $sqft);87 $this->try_process_field('sqftPrice', $price / $sqft); 91 88 92 89 } catch(\Exception $e) { 93 $this->try_process_field( 'sqftPrice', parent::ERROR ); 94 90 $this->try_process_field('sqftPrice', parent::ERROR); 95 91 } 96 92 } else { … … 366 362 if (is_null($value)) { 367 363 $this->try_process_field('photos', NULL); 364 368 365 return; 369 366 } 370 367 371 // Initialize an empty string to hold the HTML for the slideshow 372 $photos = ""; 373 374 // Create a container for the slideshow 375 $photos .= "<div class='slideshow-container'>"; 376 377 // Initialize a counter to keep track of the index of the current photo being displayed 378 $slider_count = 0; 379 380 // Loop through the array of photos and add <img> elements to the slideshow container 368 // set slideshow 369 $slideshow = ''; 370 371 // Loops through the slideshow and adds `<img>` elements to the `$fields` array 381 372 foreach ($value as $photo) { 382 // If this is the first photo in the array, give it a special CSS class to display it larger 383 if ($slider_count == 0){ 384 $photos .= "<div class='mySlides fade' style='display:block;'>" . "<img class='vista-listing-photo zoom-main' src='$photo' style='display:block;' alt='Property photo'> " . "</div>"; 385 } else { 386 // For all other photos, use a different CSS class 387 $photos .= "<div class='mySlides fade otherSlides'>" . "<img class='vista-listing-photo' src='$photo' alt='Property photo'> " . "</div>"; 373 $other_slide = ''; 374 if (empty($slideshow)) { 375 $other_slide = 'otherSlides'; 388 376 } 389 $slider_count++; // Increment the counter 390 } 391 392 // Close the slideshow container 393 $photos .= "</div>"; 394 395 // Initialize another counter to keep track of the index of the current photo in the thumbnail banner 396 $slider_count = 0; 397 398 // Create a container for the thumbnail banner 399 $photos .= "<div id='vista-scroller-container'><div class='vista-scroller-photobanner'>"; 400 401 // Loop through the array of photos again to create the thumbnail banner 402 foreach ($value as $photo) { 403 // Create an <img> element for each photo, with a click handler that will display the corresponding slide in the main slideshow 404 405 $photos .= "<img class='zoom' src='$photo' style='height:150px; width:16.6%;display: inline-block;object-fit: cover;' onclick='currentSlide($slider_count+1)' alt='The Woods'>"; 406 407 $slider_count++; // Increment the counter 408 } 409 410 // Close the thumbnail banner container and add previous/next buttons 411 $photos .= "</div><a class='prev' onclick=" . "vista_scroller('left')" . ">❮</a>" . "<a class='next' onclick='vista_scroller()'>❯</a>" . "</div>"; 412 413 // Pass the HTML for the slideshow to a function that will process it and insert it into the page 414 $this->try_process_field('photos', $photos); 415 416 // Create a modal container for the slideshow 417 $masonry = '<div id="myModal" class="modal"> 418 <span class="close cursor" onclick="closeModal()">×</span> 419 <div class="modal-content">'; 420 421 // Loop through the array of photos again to create the slideshow inside the modal 422 foreach ($value as $photo) { 423 // Create an <img> element for each photo to be displayed in the modal slideshow 424 $masonry .= "<div class='mySlides'> 425 <img src='$photo' style='width:100%'></div>"; 426 } 427 428 // Close the modal container and add previous/next buttons 429 $masonry .= '<a class="vista-grid-prev" onclick="plusSlides(-1)">❮</a> 430 <a class="vista-grid-next" onclick="plusSlides(1)">❯</a></div></div>'; 431 432 // Create a grid of images with randomly assigned sizes 433 $masonry .= '<div class="grid-wrapper">'; 434 $sizes = array("", "tall", "wide", "big", "", "tall", "wide"); 435 $masonryCount = 0 ; 436 437 foreach ($value as $photo) { 438 $random = array_rand($sizes, 2); 439 $randomSize = $sizes[$random[0]]; 440 $masonry .= "<div class='$randomSize'> 441 <img onclick='openModal();currentSlide($masonryCount+1)' class='vista-grid-img' src='$photo' /></div>"; 442 $masonryCount++; 443 } 444 445 $masonry .= '</div><div><button id="vista-grid-load-btn" onclick="vistaGridLoadMore()"style="width:100%" >Load More</button></div>'; 446 447 // Try to process the 'photos-masonry' field with the generated HTML 448 $this->try_process_field('photos-masonry', $masonry); 449 } 377 378 $slideshow .= "<div class='vista-slide-item fade {$other_slide}'><img class='vista-listing-photo' src='". esc_url($photo) ."' alt='Property photo'></div>"; 379 } 380 381 // Create a container for the slideshow and add previous/next buttons 382 $slideshow_container = <<<EOD 383 <div id='vista-slide-number'></div> 384 <div class='slideshow-container'> 385 %s 386 <a class='vista-grid-prev' onclick='plusSlides(-1)'>❮</a> 387 <a class='vista-grid-next' onclick='plusSlides(1)'>❯</a> 388 </div> 389 EOD; 390 391 $this->try_process_field( 392 'photos', 393 sprintf( 394 $slideshow_container, 395 $slideshow 396 ) 397 ); 398 } 399 450 400 /** 451 401 * Process the virtualTourUrl field into an unstyled <a> element with class vista-tour-button … … 461 411 $this->try_process_field('virtualTourUrl', "No virtual tour available"); 462 412 } 463 464 413 } 465 466 467 468 469 ?> -
vistawp/tags/1.3.0/includes/options/options-display.php
r2949654 r2999820 8 8 9 9 /** 10 * Adds options pages and defines their display HTML11 */10 * Adds options pages and defines their display HTML 11 */ 12 12 class Options_Display { 13 /** 14 * Option name for the listings page type. 15 * 16 * This constant holds the option name for the listings page type, 17 * which is used to store and retrieve the page ID associated with 18 * the 'listings' type of page. 19 * 20 * @var string 21 */ 22 public const LISTINGS_OPTION = Generate_Pages::OPTION_PREFIX . 'listings'; 23 24 /** 25 * Option name for the individual listings page type. 26 * 27 * This constant holds the option name for the individual listings 28 * page type, which is used to store and retrieve the page ID associated 29 * with the 'individual' type of page. 30 * 31 * @var string 32 */ 33 public const INDIVIDUAL_OPTION = Generate_Pages::OPTION_PREFIX . 'individual'; 34 35 /** 36 * Option name for the openhouse page type. 37 * 38 * This constant holds the option name for the openhouse page type, 39 * which is used to store and retrieve the page ID associated with 40 * the 'openhouse' type of page. 41 * 42 * @var string 43 */ 44 public const OPENHOUSE_OPTION = Generate_Pages::OPTION_PREFIX . 'openhouse'; 45 46 /** 47 * Singleton instance of this class 48 * @var Options_Display 49 */ 50 private static ?Options_Display $instance = NULL; 13 51 14 52 /** 15 * Singleton instance of this class 16 * @var Options_Display 53 * The slug that should be used for the main page 54 * when the View menu header is selected. 55 * This slug should only be used for an Options_Page. 56 * 57 * @var string 17 58 */ 18 private static ?Options_Display $instance = NULL; 19 20 /** 21 * The options_page with this slug will be the default 22 * selected page when the Vista menu header is selected. 23 * This slug must only be used for one Options_Page 59 public const MAIN_PAGE_SLUG = 'vista_main'; 60 61 /** 62 * Default capability required to interact with vista settings 63 * Individual pages may use this or set their own role requirement 24 64 * @var string 25 65 */ 26 public const DEFAULT_PAGE_SLUG = 'vista_default';27 66 public const VISTA_CAPABILITY = 'manage_options'; 67 28 68 /** 29 * Default capability required to interact with vista settings30 * Individual pages may use this or set their own role requirement31 * @var string32 */33 p ublic const VISTA_CAPABILITY = 'manage_options';34 69 * This will be a file path to the icon for the 70 * vista menu item 71 * @var string 72 */ 73 private string $icon_url; 74 35 75 /** 36 * This will be a file path to the icon for the37 * vista menu item38 * @var string39 */40 private string $icon_url;41 42 /**43 76 * Array of Options_Page objects that have been registered 44 77 * with register_settings_page … … 46 79 */ 47 80 private array $pages; 48 49 /**81 82 /** 50 83 * Retrieve the single instance of this class 51 84 * @return Options_Display … … 55 88 self::$instance = new self(); 56 89 } 57 90 58 91 return self::$instance; 59 92 } 60 61 /**93 94 /** 62 95 * Protected to enforce singleton pattern 63 96 */ 64 97 protected function __construct() { 65 98 add_action('admin_menu', array($this, 'init_settings')); 66 67 99 $this->icon_url = \vista_plugin_url("/img/dashboard_logo.png"); 68 69 100 70 101 // Styles for admin dashboard 71 102 V\Main::get_instance()->register_style('vsta_admin', \vista_plugin_url("/css/admin.css")); 72 73 103 if (\is_admin()) { 74 104 V\Main::get_instance()->enqueue_style('vsta_admin'); 75 105 } 76 77 106 } 78 79 /**107 108 /** 80 109 * Registers a settings page, to be included under the Vista menu header. 81 * If the slug is 'vista_ default', this will be the default selected page110 * If the slug is 'vista_main', this will be the default selected page 82 111 * @param Options_Page $page Class representing the page 83 112 */ … … 85 114 $this->pages[] = $page; 86 115 } 87 88 /**116 117 /** 89 118 * Initializes the settings page and all subpages 90 119 * These are registered by other classes and this is called when admin_menu … … 95 124 "Vista", 96 125 self::VISTA_CAPABILITY, 97 self::DEFAULT_PAGE_SLUG, 98 array($this, 'default_page'), 126 self::MAIN_PAGE_SLUG, 127 array( 128 $this, 129 'main_page' 130 ), 99 131 $this->icon_url, 100 132 8, 101 133 ); 134 135 // This bug only occurs in very specific circumstances, 136 // so this check is rarely necessary, but it's here just in case 137 if (empty($this->pages)) { 138 return; 139 } 102 140 103 141 foreach($this->pages as $page) { 104 142 \add_submenu_page( 105 self:: DEFAULT_PAGE_SLUG,143 self::MAIN_PAGE_SLUG, 106 144 $page->page_title(), 107 145 $page->menu_title(), … … 113 151 } 114 152 } 153 154 /** 155 * Creates the three default pages 156 * and displays a banner indicating success or failure 157 */ 158 private function create_pages(): void { 159 $listings_page = new Generate_Pages(); 160 $allPagesCreated = true; 161 162 // Try to create pages 163 if (isset($_POST['generate_pages'])) { 164 $allPagesCreated &= $listings_page->auto_create_page(Options_Display::LISTINGS_OPTION, 'Listings'); 165 $allPagesCreated &= $listings_page->auto_create_page(Options_Display::INDIVIDUAL_OPTION, 'Individual Listing'); 166 // $allPagesCreated &= $listings_page->auto_create_page(Options_Display::OPENHOUSE_OPTION, 'Openhouses'); 167 168 if ($allPagesCreated) { 169 $notification = Notifications_Banner::create('success','Success All Pages Created'); 170 $notification->display_notification(); 171 } else { 172 $notification = Notifications_Banner::create('error','Error Some Pages Failed to Create'); 173 $notification->display_notification(); 174 } 175 } 176 } 177 178 /** 179 * Outputs text for the default Vista admin page 180 * This should be overridden by registering a function 181 * with slug set to MAIN_PAGE_SLUG 182 */ 183 public function main_page(): void { 184 $this->create_pages(); 115 185 116 /** 117 * Outputs text for the default Vista admin page 118 * This should be overridden by registering a function 119 * with slug set to DEFAULT_PAGE_SLUG 120 */ 121 public function default_page(): void { 122 ?> 123 <div> 124 <h2>Welcome to VistaWP!</h2> 186 ob_start(); 187 \vista_get_template( 188 'pages/main_page.php', 189 array( 190 'listings' => get_option(Options_Display::LISTINGS_OPTION), 191 'individual' => get_option(Options_Display::INDIVIDUAL_OPTION), 192 ), 193 ); 125 194 126 <h3>Getting Started</h3> 127 128 <p> Watch this short intro video to understand how the plugin works.</p> 129 130 <iframe width="560" height="315" src="https://www.youtube.com/embed/5r2DZiB2yXU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> 131 <br> 132 133 <p>We’ve made getting started with VistaWP simple. Find simple instructions and ready-made templates at https://vistawp.com/get-started.</p> 134 135 <h3>Getting Help</h3> 136 137 <p> For more detailed documentation and tutorials, visit https://vistawp.com/support.</p> 138 139 <p>Need extra help? Reach out with questions, or to schedule a 1-on-1 live work session with someone from the VistaWP team. You can email us directly at [email protected].</p> 140 141 <h3>License</h3> 142 143 <p>If you don’t have a valid VistaWP license key entered below, VistaWP will show dummy data. After submitting your MLS/IDX setup request with VistaWP support, enter your VistaWP license on the VistaWP license page.</p> 144 145 <br> 146 <h3>Integrating Your MLS/IDX Feed</h3> 147 148 <p> The VistaWP team will need to set up your MLS/IDX feed for you. Once you have access to your MLS database, submit the MLS/IDX Setup Request form in the VistaWP support panel. Our team will set up your feed and VistaWP will start showing listings from your MLS instead of dummy data. It can take our team 24-72 hours to set up your feed.</p> 149 </div> 150 <?php 195 echo ob_get_clean(); 151 196 } 152 153 197 } 154 155 156 ?> -
vistawp/tags/1.3.0/includes/options/options-page.php
r2924340 r2999820 69 69 /** 70 70 * Get the slug for this page. 71 * If the slug is Options_Display:: DEFAULT_PAGE_SLUG, this page will be selected71 * If the slug is Options_Display::MAIN_PAGE_SLUG, this page will be selected 72 72 * by default when a user clicks the vista menu header 73 73 * Every slug must be unique -
vistawp/tags/1.3.0/includes/options/welcome-header.php
r2961844 r2999820 66 66 <div> 67 67 <h3>Thanks for activating VistaWP</h3> 68 <p>Head to the <a href="/wp-admin/admin.php?page=vista_ default">settings page</a> to get started</p>68 <p>Head to the <a href="/wp-admin/admin.php?page=vista_main">settings page</a> to get started</p> 69 69 </div> 70 70 </div> -
vistawp/tags/1.3.0/js/slideshow.js
r2949654 r2999820 30 30 } 31 31 32 var slideIndex = 1;32 var vista_slide_index = 1; 33 33 34 34 /** … … 37 37 */ 38 38 function plusSlides(n) { 39 showSlides( slideIndex += n);39 showSlides(vista_slide_index += n); 40 40 } 41 41 … … 45 45 */ 46 46 function currentSlide(n) { 47 showSlides( slideIndex = n);47 showSlides(vista_slide_index = n); 48 48 } 49 49 … … 53 53 */ 54 54 function showSlides(n) { 55 var i; 56 var slides = document.getElementsByClassName("mySlides"); 55 var slides = document.getElementsByClassName('vista-slide-item'); 56 var slide_number = document.getElementById('vista-slide-number'); 57 var size = slides.length; 57 58 58 if (n > s lides.length) {59 slideIndex = 1;59 if (n > size) { 60 vista_slide_index = 1; 60 61 } 62 61 63 if (n < 1) { 62 slideIndex = slides.length;64 vista_slide_index = size; 63 65 } 64 for (i = 0; i < slides.length; i++) { 66 67 for (let i = 0; i < size; i++) { 65 68 slides[i].style.display = "none"; 66 69 } 67 slides[slideIndex - 1].style.display = "block"; 70 slides[vista_slide_index - 1].style.display = "block"; 71 72 slide_number.innerHTML = "<span>" + vista_slide_index + "/" + size + "</span>"; 68 73 } 69 74 -
vistawp/tags/1.3.0/readme.txt
r2990365 r2999820 4 4 Tags: IDX, MLS, idx search, Real Estate Search, IDX plugin, RETS, real-estate 5 5 Requires at least: 4.7 6 Tested up to: 6. 37 Stable tag: 1. 2.48 Requires PHP: 7. 06 Tested up to: 6.4 7 Stable tag: 1.3.0 8 Requires PHP: 7.4.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
vistawp/tags/1.3.0/vista.php
r2990365 r2999820 3 3 * Plugin Name: VistaWP 4 4 * Description: Retrieves and displays real estate listings 5 * Version: 1. 2.45 * Version: 1.3.0 6 6 * Author: VistaWP 7 7 * Author URI: https://vistawp.com/ … … 183 183 require_once "includes/openhouses/multiple-openhouse-display.php"; 184 184 } 185 185 186 // Welcome Header file 186 187 if ( !class_exists("\\VSTA\\Options\\Welcome_Header") ) { … … 188 189 } 189 190 191 // Notifications Banenr File 192 if ( !class_exists("\\VSTA\\Options\\Notifications_Banner") ) { 193 require_once "includes/options/notifications-banner.php"; 194 } 195 196 // Welcome Header file 197 if ( !class_exists("\\VSTA\\Options\\Notifications_Banner") ) { 198 require_once "includes/options/notifications-banner.php"; 199 } 200 190 201 // Abstract class for forms 191 202 if ( !class_exists("\\VSTA\\Forms\\Form") ) { 192 203 require_once 'includes/forms/form.php'; 193 204 } 194 // Class for VistawpAdvanced form205 // Class for Advanced form 195 206 if ( !class_exists("\\VSTA\\Forms\\Advanced") ) { 196 207 require_once 'includes/forms/advanced.php'; 197 208 } 198 // Class for Vistawpbasic form209 // Class for basic form 199 210 if ( !class_exists("\\VSTA\\Forms\\Basic") ) { 200 211 require_once 'includes/forms/basic.php'; 201 212 } 202 // Class for Vistawp qform213 // Class for search form 203 214 if ( !class_exists("\\VSTA\\Forms\\Search") ) { 204 215 require_once 'includes/forms/search.php'; 216 } 217 // Class for auto-generated pages 218 if ( !class_exists("\\VSTA\\Options\\Generate_Pages") ) { 219 require_once 'includes/options/page-generator.php'; 205 220 } 206 221 … … 329 344 330 345 // Init hooks 331 add_action('plugins_loaded', '\VSTA\ Vista_init', 12);332 function Vista_init() {346 add_action('plugins_loaded', '\VSTA\vista_init', 12); 347 function vista_init() { 333 348 // This is a bugfix for wp_redirect not firing properly inside this plugin, 334 349 // probably because the redirect gets canceled when things are added to the output buffer. … … 336 351 ob_start(); 337 352 338 // Init plugin 339 \VSTA\Main::get_instance(); 353 // Init plugin with failsafe block for initialization errors 354 try { 355 \VSTA\Main::get_instance(); 356 } catch (\Exception $e) { 357 $GLOBALS['vista_error_message'] = $e->getMessage(); 358 \add_action('admin_notices', '\VSTA\vista_fallback_error', 11); 359 \add_action('wp_loaded', '\VSTA\deactivate_vista', 12); 360 } 340 361 341 362 // This is a courtesy to other developers, … … 344 365 } 345 366 346 ?> 367 /** 368 * Deactivates the plugin- used in case of fatal error. 369 * Must be called after the plugins_loaded hook 370 */ 371 function deactivate_vista(): void { 372 // Sometimes the file with this function isn't included, so include it 373 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 374 \deactivate_plugins(plugin_basename(__FILE__)); 375 } 376 377 /** 378 * Display an admin error with customizable message. 379 * This should only be used in the event that the plugin 380 * encounters a fatal error. 381 * Otherwise, the Notifications_Banner class should be used. 382 * The message is retrieved from the global vista_error_message variable. 383 */ 384 function vista_fallback_error(): void { 385 ?> 386 <div class="error notice"> 387 <p> 388 The VistaWP plugin has encountered a fatal error and self-deactivated. 389 Error message: <?php echo $GLOBALS['vista_error_message']; ?> 390 </p> 391 </div> 392 <?php 393 } -
vistawp/trunk/css/admin.css
r2949654 r2999820 104 104 } 105 105 106 #vistawp-banner{ 107 display: grid; 108 grid-template-columns: 40px auto; 109 } 106 110 107 111 112 .vsta-text-error { 113 color: #d63638; 114 font-weight: bold; 115 } 108 116 117 .vsta-text-success { 118 color: #00a32a; 119 font-weight: bold; 120 } 121 -
vistawp/trunk/css/slideshow.css
r2949654 r2999820 1 * { 2 box-sizing: border-box; 3 } 4 1 5 .vista-grid-img { 2 6 max-width: 100%; … … 8 12 } 9 13 10 11 14 .vista-grid-img:hover { 12 15 -ms-transform: scale(1.05); /* IE 9 */ … … 14 17 transform: scale(1.05); 15 18 } 19 16 20 /* Main CSS */ 17 21 .grid-wrapper > div { … … 20 24 align-items: center; 21 25 } 26 22 27 .grid-wrapper > div > img { 23 28 width: 100%; … … 36 41 overflow: hidden; 37 42 } 43 38 44 .grid-wrapper .wide { 39 45 grid-column: span 2; 40 46 } 47 41 48 .grid-wrapper .tall { 42 49 grid-row: span 2; 43 50 } 51 44 52 .grid-wrapper .big { 45 53 grid-column: span 2; … … 89 97 width:90%; 90 98 } 99 91 100 .close{ 92 101 top:25px; … … 97 106 top:50%; 98 107 } 99 100 101 } 102 108 } 103 109 104 110 .close:hover, … … 110 116 111 117 /* Next & previous buttons */ 112 .vista-grid-prev, 113 .vista-grid-next {118 div .slideshow-container .vista-grid-prev, 119 div .slideshow-container .vista-grid-next { 114 120 cursor: pointer; 115 121 position: absolute; … … 118 124 padding: 16px; 119 125 margin-top: -50px; 120 color: white;126 color: #fff; 121 127 font-weight: bold; 122 128 font-size: 20px; 123 129 transition: 0.6s ease; 124 border-radius: 0 3px 3px 0;125 130 user-select: none; 126 131 -webkit-user-select: none; 127 132 background-color: rgba(0, 0, 0, 0.8); 133 } 134 135 div .slideshow-container .vista-grid-prev { 136 border-radius: 0 3px 3px 0; 137 } 138 139 div .slideshow-container .vista-grid-next { 140 border-radius: 3px 0px 0px 3px; 128 141 } 129 142 … … 140 153 } 141 154 142 . mySlides{155 .vista-slide-item { 143 156 display: none; 144 157 } … … 165 178 } 166 179 167 168 .vista-scroller-photobanner:hover img{ 169 170 } 171 172 * { 173 box-sizing: border-box; 174 } 175 176 180 .vista-scroller-photobanner:hover img{} 177 181 178 182 .zoom { … … 190 194 191 195 .zoom-main { 192 193 196 transition: transform .2s; /* Animation */ 194 197 } … … 198 201 transform: scale(1.1); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */ 199 202 } 200 201 203 202 204 /* Next & previous buttons */ … … 230 232 /* Slideshow container */ 231 233 .slideshow-container { 232 max-width: 1000px; 234 max-width: 100%; 235 height: 100%; 233 236 position: relative; 237 overflow: hidden; 234 238 margin: auto; 235 239 font-family: Verdana, sans-serif; 236 margin: 0;237 240 } 238 241 239 242 .slideshow-container * {box-sizing: border-box} 240 243 .slideshow-container .otherSlides {display: none} 241 .slideshow-container img {vertical-align: middle; max-height: 600px; width: auto;} 242 244 .slideshow-container img { 245 vertical-align: middle; 246 height: auto; 247 width: 100%; 248 } 243 249 244 250 /* Fading animation */ … … 265 271 } 266 272 267 268 273 .grid-container { 269 274 padding: 10px; … … 283 288 } 284 289 290 .thumbnails-carousel { 291 height:150px !important; 292 width:16.6%; 293 display: inline-block; 294 object-fit: cover; 295 } 296 297 .slides-masonry { 298 width:100%; 299 } 300 301 #vista-grid-load-btn { 302 width:100%; 303 } 304 305 /* slide count element */ 306 #vista-slide-number { 307 top: 50px; 308 z-index: 1; 309 position: relative; 310 float: right; 311 padding: 8px; 312 width: 40px; 313 background:#000; 314 color:#fff; 315 text-align:center; 316 margin-top: -50px; 317 font-size: 9px; 318 border-radius: 0px 0px 0px 3px; 319 opacity: 0.6; 320 } -
vistawp/trunk/includes/listings/single-listing.php
r2964274 r2999820 83 83 */ 84 84 protected function price_sqft_field(?int $price, ?int $sqft): void { 85 if( 86 isset( $price ) && !empty( $price ) && 87 isset( $sqft ) && !empty( $sqft ) 88 ) { 85 if (!empty($price) && !empty($sqft)) { 89 86 try { 90 $this->try_process_field( 'sqftPrice', $price / $sqft);87 $this->try_process_field('sqftPrice', $price / $sqft); 91 88 92 89 } catch(\Exception $e) { 93 $this->try_process_field( 'sqftPrice', parent::ERROR ); 94 90 $this->try_process_field('sqftPrice', parent::ERROR); 95 91 } 96 92 } else { … … 366 362 if (is_null($value)) { 367 363 $this->try_process_field('photos', NULL); 364 368 365 return; 369 366 } 370 367 371 // Initialize an empty string to hold the HTML for the slideshow 372 $photos = ""; 373 374 // Create a container for the slideshow 375 $photos .= "<div class='slideshow-container'>"; 376 377 // Initialize a counter to keep track of the index of the current photo being displayed 378 $slider_count = 0; 379 380 // Loop through the array of photos and add <img> elements to the slideshow container 368 // set slideshow 369 $slideshow = ''; 370 371 // Loops through the slideshow and adds `<img>` elements to the `$fields` array 381 372 foreach ($value as $photo) { 382 // If this is the first photo in the array, give it a special CSS class to display it larger 383 if ($slider_count == 0){ 384 $photos .= "<div class='mySlides fade' style='display:block;'>" . "<img class='vista-listing-photo zoom-main' src='$photo' style='display:block;' alt='Property photo'> " . "</div>"; 385 } else { 386 // For all other photos, use a different CSS class 387 $photos .= "<div class='mySlides fade otherSlides'>" . "<img class='vista-listing-photo' src='$photo' alt='Property photo'> " . "</div>"; 373 $other_slide = ''; 374 if (empty($slideshow)) { 375 $other_slide = 'otherSlides'; 388 376 } 389 $slider_count++; // Increment the counter 390 } 391 392 // Close the slideshow container 393 $photos .= "</div>"; 394 395 // Initialize another counter to keep track of the index of the current photo in the thumbnail banner 396 $slider_count = 0; 397 398 // Create a container for the thumbnail banner 399 $photos .= "<div id='vista-scroller-container'><div class='vista-scroller-photobanner'>"; 400 401 // Loop through the array of photos again to create the thumbnail banner 402 foreach ($value as $photo) { 403 // Create an <img> element for each photo, with a click handler that will display the corresponding slide in the main slideshow 404 405 $photos .= "<img class='zoom' src='$photo' style='height:150px; width:16.6%;display: inline-block;object-fit: cover;' onclick='currentSlide($slider_count+1)' alt='The Woods'>"; 406 407 $slider_count++; // Increment the counter 408 } 409 410 // Close the thumbnail banner container and add previous/next buttons 411 $photos .= "</div><a class='prev' onclick=" . "vista_scroller('left')" . ">❮</a>" . "<a class='next' onclick='vista_scroller()'>❯</a>" . "</div>"; 412 413 // Pass the HTML for the slideshow to a function that will process it and insert it into the page 414 $this->try_process_field('photos', $photos); 415 416 // Create a modal container for the slideshow 417 $masonry = '<div id="myModal" class="modal"> 418 <span class="close cursor" onclick="closeModal()">×</span> 419 <div class="modal-content">'; 420 421 // Loop through the array of photos again to create the slideshow inside the modal 422 foreach ($value as $photo) { 423 // Create an <img> element for each photo to be displayed in the modal slideshow 424 $masonry .= "<div class='mySlides'> 425 <img src='$photo' style='width:100%'></div>"; 426 } 427 428 // Close the modal container and add previous/next buttons 429 $masonry .= '<a class="vista-grid-prev" onclick="plusSlides(-1)">❮</a> 430 <a class="vista-grid-next" onclick="plusSlides(1)">❯</a></div></div>'; 431 432 // Create a grid of images with randomly assigned sizes 433 $masonry .= '<div class="grid-wrapper">'; 434 $sizes = array("", "tall", "wide", "big", "", "tall", "wide"); 435 $masonryCount = 0 ; 436 437 foreach ($value as $photo) { 438 $random = array_rand($sizes, 2); 439 $randomSize = $sizes[$random[0]]; 440 $masonry .= "<div class='$randomSize'> 441 <img onclick='openModal();currentSlide($masonryCount+1)' class='vista-grid-img' src='$photo' /></div>"; 442 $masonryCount++; 443 } 444 445 $masonry .= '</div><div><button id="vista-grid-load-btn" onclick="vistaGridLoadMore()"style="width:100%" >Load More</button></div>'; 446 447 // Try to process the 'photos-masonry' field with the generated HTML 448 $this->try_process_field('photos-masonry', $masonry); 449 } 377 378 $slideshow .= "<div class='vista-slide-item fade {$other_slide}'><img class='vista-listing-photo' src='". esc_url($photo) ."' alt='Property photo'></div>"; 379 } 380 381 // Create a container for the slideshow and add previous/next buttons 382 $slideshow_container = <<<EOD 383 <div id='vista-slide-number'></div> 384 <div class='slideshow-container'> 385 %s 386 <a class='vista-grid-prev' onclick='plusSlides(-1)'>❮</a> 387 <a class='vista-grid-next' onclick='plusSlides(1)'>❯</a> 388 </div> 389 EOD; 390 391 $this->try_process_field( 392 'photos', 393 sprintf( 394 $slideshow_container, 395 $slideshow 396 ) 397 ); 398 } 399 450 400 /** 451 401 * Process the virtualTourUrl field into an unstyled <a> element with class vista-tour-button … … 461 411 $this->try_process_field('virtualTourUrl', "No virtual tour available"); 462 412 } 463 464 413 } 465 466 467 468 469 ?> -
vistawp/trunk/includes/options/options-display.php
r2949654 r2999820 8 8 9 9 /** 10 * Adds options pages and defines their display HTML11 */10 * Adds options pages and defines their display HTML 11 */ 12 12 class Options_Display { 13 /** 14 * Option name for the listings page type. 15 * 16 * This constant holds the option name for the listings page type, 17 * which is used to store and retrieve the page ID associated with 18 * the 'listings' type of page. 19 * 20 * @var string 21 */ 22 public const LISTINGS_OPTION = Generate_Pages::OPTION_PREFIX . 'listings'; 23 24 /** 25 * Option name for the individual listings page type. 26 * 27 * This constant holds the option name for the individual listings 28 * page type, which is used to store and retrieve the page ID associated 29 * with the 'individual' type of page. 30 * 31 * @var string 32 */ 33 public const INDIVIDUAL_OPTION = Generate_Pages::OPTION_PREFIX . 'individual'; 34 35 /** 36 * Option name for the openhouse page type. 37 * 38 * This constant holds the option name for the openhouse page type, 39 * which is used to store and retrieve the page ID associated with 40 * the 'openhouse' type of page. 41 * 42 * @var string 43 */ 44 public const OPENHOUSE_OPTION = Generate_Pages::OPTION_PREFIX . 'openhouse'; 45 46 /** 47 * Singleton instance of this class 48 * @var Options_Display 49 */ 50 private static ?Options_Display $instance = NULL; 13 51 14 52 /** 15 * Singleton instance of this class 16 * @var Options_Display 53 * The slug that should be used for the main page 54 * when the View menu header is selected. 55 * This slug should only be used for an Options_Page. 56 * 57 * @var string 17 58 */ 18 private static ?Options_Display $instance = NULL; 19 20 /** 21 * The options_page with this slug will be the default 22 * selected page when the Vista menu header is selected. 23 * This slug must only be used for one Options_Page 59 public const MAIN_PAGE_SLUG = 'vista_main'; 60 61 /** 62 * Default capability required to interact with vista settings 63 * Individual pages may use this or set their own role requirement 24 64 * @var string 25 65 */ 26 public const DEFAULT_PAGE_SLUG = 'vista_default';27 66 public const VISTA_CAPABILITY = 'manage_options'; 67 28 68 /** 29 * Default capability required to interact with vista settings30 * Individual pages may use this or set their own role requirement31 * @var string32 */33 p ublic const VISTA_CAPABILITY = 'manage_options';34 69 * This will be a file path to the icon for the 70 * vista menu item 71 * @var string 72 */ 73 private string $icon_url; 74 35 75 /** 36 * This will be a file path to the icon for the37 * vista menu item38 * @var string39 */40 private string $icon_url;41 42 /**43 76 * Array of Options_Page objects that have been registered 44 77 * with register_settings_page … … 46 79 */ 47 80 private array $pages; 48 49 /**81 82 /** 50 83 * Retrieve the single instance of this class 51 84 * @return Options_Display … … 55 88 self::$instance = new self(); 56 89 } 57 90 58 91 return self::$instance; 59 92 } 60 61 /**93 94 /** 62 95 * Protected to enforce singleton pattern 63 96 */ 64 97 protected function __construct() { 65 98 add_action('admin_menu', array($this, 'init_settings')); 66 67 99 $this->icon_url = \vista_plugin_url("/img/dashboard_logo.png"); 68 69 100 70 101 // Styles for admin dashboard 71 102 V\Main::get_instance()->register_style('vsta_admin', \vista_plugin_url("/css/admin.css")); 72 73 103 if (\is_admin()) { 74 104 V\Main::get_instance()->enqueue_style('vsta_admin'); 75 105 } 76 77 106 } 78 79 /**107 108 /** 80 109 * Registers a settings page, to be included under the Vista menu header. 81 * If the slug is 'vista_ default', this will be the default selected page110 * If the slug is 'vista_main', this will be the default selected page 82 111 * @param Options_Page $page Class representing the page 83 112 */ … … 85 114 $this->pages[] = $page; 86 115 } 87 88 /**116 117 /** 89 118 * Initializes the settings page and all subpages 90 119 * These are registered by other classes and this is called when admin_menu … … 95 124 "Vista", 96 125 self::VISTA_CAPABILITY, 97 self::DEFAULT_PAGE_SLUG, 98 array($this, 'default_page'), 126 self::MAIN_PAGE_SLUG, 127 array( 128 $this, 129 'main_page' 130 ), 99 131 $this->icon_url, 100 132 8, 101 133 ); 134 135 // This bug only occurs in very specific circumstances, 136 // so this check is rarely necessary, but it's here just in case 137 if (empty($this->pages)) { 138 return; 139 } 102 140 103 141 foreach($this->pages as $page) { 104 142 \add_submenu_page( 105 self:: DEFAULT_PAGE_SLUG,143 self::MAIN_PAGE_SLUG, 106 144 $page->page_title(), 107 145 $page->menu_title(), … … 113 151 } 114 152 } 153 154 /** 155 * Creates the three default pages 156 * and displays a banner indicating success or failure 157 */ 158 private function create_pages(): void { 159 $listings_page = new Generate_Pages(); 160 $allPagesCreated = true; 161 162 // Try to create pages 163 if (isset($_POST['generate_pages'])) { 164 $allPagesCreated &= $listings_page->auto_create_page(Options_Display::LISTINGS_OPTION, 'Listings'); 165 $allPagesCreated &= $listings_page->auto_create_page(Options_Display::INDIVIDUAL_OPTION, 'Individual Listing'); 166 // $allPagesCreated &= $listings_page->auto_create_page(Options_Display::OPENHOUSE_OPTION, 'Openhouses'); 167 168 if ($allPagesCreated) { 169 $notification = Notifications_Banner::create('success','Success All Pages Created'); 170 $notification->display_notification(); 171 } else { 172 $notification = Notifications_Banner::create('error','Error Some Pages Failed to Create'); 173 $notification->display_notification(); 174 } 175 } 176 } 177 178 /** 179 * Outputs text for the default Vista admin page 180 * This should be overridden by registering a function 181 * with slug set to MAIN_PAGE_SLUG 182 */ 183 public function main_page(): void { 184 $this->create_pages(); 115 185 116 /** 117 * Outputs text for the default Vista admin page 118 * This should be overridden by registering a function 119 * with slug set to DEFAULT_PAGE_SLUG 120 */ 121 public function default_page(): void { 122 ?> 123 <div> 124 <h2>Welcome to VistaWP!</h2> 186 ob_start(); 187 \vista_get_template( 188 'pages/main_page.php', 189 array( 190 'listings' => get_option(Options_Display::LISTINGS_OPTION), 191 'individual' => get_option(Options_Display::INDIVIDUAL_OPTION), 192 ), 193 ); 125 194 126 <h3>Getting Started</h3> 127 128 <p> Watch this short intro video to understand how the plugin works.</p> 129 130 <iframe width="560" height="315" src="https://www.youtube.com/embed/5r2DZiB2yXU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> 131 <br> 132 133 <p>We’ve made getting started with VistaWP simple. Find simple instructions and ready-made templates at https://vistawp.com/get-started.</p> 134 135 <h3>Getting Help</h3> 136 137 <p> For more detailed documentation and tutorials, visit https://vistawp.com/support.</p> 138 139 <p>Need extra help? Reach out with questions, or to schedule a 1-on-1 live work session with someone from the VistaWP team. You can email us directly at [email protected].</p> 140 141 <h3>License</h3> 142 143 <p>If you don’t have a valid VistaWP license key entered below, VistaWP will show dummy data. After submitting your MLS/IDX setup request with VistaWP support, enter your VistaWP license on the VistaWP license page.</p> 144 145 <br> 146 <h3>Integrating Your MLS/IDX Feed</h3> 147 148 <p> The VistaWP team will need to set up your MLS/IDX feed for you. Once you have access to your MLS database, submit the MLS/IDX Setup Request form in the VistaWP support panel. Our team will set up your feed and VistaWP will start showing listings from your MLS instead of dummy data. It can take our team 24-72 hours to set up your feed.</p> 149 </div> 150 <?php 195 echo ob_get_clean(); 151 196 } 152 153 197 } 154 155 156 ?> -
vistawp/trunk/includes/options/options-page.php
r2924340 r2999820 69 69 /** 70 70 * Get the slug for this page. 71 * If the slug is Options_Display:: DEFAULT_PAGE_SLUG, this page will be selected71 * If the slug is Options_Display::MAIN_PAGE_SLUG, this page will be selected 72 72 * by default when a user clicks the vista menu header 73 73 * Every slug must be unique -
vistawp/trunk/includes/options/welcome-header.php
r2961844 r2999820 66 66 <div> 67 67 <h3>Thanks for activating VistaWP</h3> 68 <p>Head to the <a href="/wp-admin/admin.php?page=vista_ default">settings page</a> to get started</p>68 <p>Head to the <a href="/wp-admin/admin.php?page=vista_main">settings page</a> to get started</p> 69 69 </div> 70 70 </div> -
vistawp/trunk/js/slideshow.js
r2949654 r2999820 30 30 } 31 31 32 var slideIndex = 1;32 var vista_slide_index = 1; 33 33 34 34 /** … … 37 37 */ 38 38 function plusSlides(n) { 39 showSlides( slideIndex += n);39 showSlides(vista_slide_index += n); 40 40 } 41 41 … … 45 45 */ 46 46 function currentSlide(n) { 47 showSlides( slideIndex = n);47 showSlides(vista_slide_index = n); 48 48 } 49 49 … … 53 53 */ 54 54 function showSlides(n) { 55 var i; 56 var slides = document.getElementsByClassName("mySlides"); 55 var slides = document.getElementsByClassName('vista-slide-item'); 56 var slide_number = document.getElementById('vista-slide-number'); 57 var size = slides.length; 57 58 58 if (n > s lides.length) {59 slideIndex = 1;59 if (n > size) { 60 vista_slide_index = 1; 60 61 } 62 61 63 if (n < 1) { 62 slideIndex = slides.length;64 vista_slide_index = size; 63 65 } 64 for (i = 0; i < slides.length; i++) { 66 67 for (let i = 0; i < size; i++) { 65 68 slides[i].style.display = "none"; 66 69 } 67 slides[slideIndex - 1].style.display = "block"; 70 slides[vista_slide_index - 1].style.display = "block"; 71 72 slide_number.innerHTML = "<span>" + vista_slide_index + "/" + size + "</span>"; 68 73 } 69 74 -
vistawp/trunk/readme.txt
r2990365 r2999820 4 4 Tags: IDX, MLS, idx search, Real Estate Search, IDX plugin, RETS, real-estate 5 5 Requires at least: 4.7 6 Tested up to: 6. 37 Stable tag: 1. 2.48 Requires PHP: 7. 06 Tested up to: 6.4 7 Stable tag: 1.3.0 8 Requires PHP: 7.4.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
vistawp/trunk/vista.php
r2990365 r2999820 3 3 * Plugin Name: VistaWP 4 4 * Description: Retrieves and displays real estate listings 5 * Version: 1. 2.45 * Version: 1.3.0 6 6 * Author: VistaWP 7 7 * Author URI: https://vistawp.com/ … … 183 183 require_once "includes/openhouses/multiple-openhouse-display.php"; 184 184 } 185 185 186 // Welcome Header file 186 187 if ( !class_exists("\\VSTA\\Options\\Welcome_Header") ) { … … 188 189 } 189 190 191 // Notifications Banenr File 192 if ( !class_exists("\\VSTA\\Options\\Notifications_Banner") ) { 193 require_once "includes/options/notifications-banner.php"; 194 } 195 196 // Welcome Header file 197 if ( !class_exists("\\VSTA\\Options\\Notifications_Banner") ) { 198 require_once "includes/options/notifications-banner.php"; 199 } 200 190 201 // Abstract class for forms 191 202 if ( !class_exists("\\VSTA\\Forms\\Form") ) { 192 203 require_once 'includes/forms/form.php'; 193 204 } 194 // Class for VistawpAdvanced form205 // Class for Advanced form 195 206 if ( !class_exists("\\VSTA\\Forms\\Advanced") ) { 196 207 require_once 'includes/forms/advanced.php'; 197 208 } 198 // Class for Vistawpbasic form209 // Class for basic form 199 210 if ( !class_exists("\\VSTA\\Forms\\Basic") ) { 200 211 require_once 'includes/forms/basic.php'; 201 212 } 202 // Class for Vistawp qform213 // Class for search form 203 214 if ( !class_exists("\\VSTA\\Forms\\Search") ) { 204 215 require_once 'includes/forms/search.php'; 216 } 217 // Class for auto-generated pages 218 if ( !class_exists("\\VSTA\\Options\\Generate_Pages") ) { 219 require_once 'includes/options/page-generator.php'; 205 220 } 206 221 … … 329 344 330 345 // Init hooks 331 add_action('plugins_loaded', '\VSTA\ Vista_init', 12);332 function Vista_init() {346 add_action('plugins_loaded', '\VSTA\vista_init', 12); 347 function vista_init() { 333 348 // This is a bugfix for wp_redirect not firing properly inside this plugin, 334 349 // probably because the redirect gets canceled when things are added to the output buffer. … … 336 351 ob_start(); 337 352 338 // Init plugin 339 \VSTA\Main::get_instance(); 353 // Init plugin with failsafe block for initialization errors 354 try { 355 \VSTA\Main::get_instance(); 356 } catch (\Exception $e) { 357 $GLOBALS['vista_error_message'] = $e->getMessage(); 358 \add_action('admin_notices', '\VSTA\vista_fallback_error', 11); 359 \add_action('wp_loaded', '\VSTA\deactivate_vista', 12); 360 } 340 361 341 362 // This is a courtesy to other developers, … … 344 365 } 345 366 346 ?> 367 /** 368 * Deactivates the plugin- used in case of fatal error. 369 * Must be called after the plugins_loaded hook 370 */ 371 function deactivate_vista(): void { 372 // Sometimes the file with this function isn't included, so include it 373 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 374 \deactivate_plugins(plugin_basename(__FILE__)); 375 } 376 377 /** 378 * Display an admin error with customizable message. 379 * This should only be used in the event that the plugin 380 * encounters a fatal error. 381 * Otherwise, the Notifications_Banner class should be used. 382 * The message is retrieved from the global vista_error_message variable. 383 */ 384 function vista_fallback_error(): void { 385 ?> 386 <div class="error notice"> 387 <p> 388 The VistaWP plugin has encountered a fatal error and self-deactivated. 389 Error message: <?php echo $GLOBALS['vista_error_message']; ?> 390 </p> 391 </div> 392 <?php 393 }
Note: See TracChangeset
for help on using the changeset viewer.