Replace hard coded dev53 urls
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 27 Mar 2017 12:57:52 +0000 (08:57 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 27 Mar 2017 12:57:52 +0000 (08:57 -0400)
Use function to fetch the option form api plugin.

front-page.php
functions.php
parts/client-info-header.php
parts/top-bar.php

index bb67416..547ef4b 100644 (file)
@@ -19,7 +19,7 @@
                     <?php endif;?>
                 </div>
             </div>
-        </div>    
+        </div>
 <!--
             <div class="small-12 medium-6 large-4 columns small-text-center medium-text-left">
                 <?php //get_sidebar(); ?>
@@ -29,7 +29,7 @@
             <div class="row">
                 <div class="buy-tickets small-12 medium-6 text-center columns">
                     <a href="<?php echo get_permalink(40)?>"><img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/buy-tickets-graphics.png"></a>
-                    <a href="https://dev53.gaslightmedia.com/www.mackinacferry.com/order-tickets-online-6/"><h5>Buy Ferry <br>Tickets</h5></a>
+                    <a href="<?php echo ticket_url_base();?>order-tickets-online-6/"><h5>Buy Ferry <br>Tickets</h5></a>
                 </div>
                 <div class="get-schedule small-12 medium-6 text-center columns">
                     <a href="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/schedules/2016-1_Winter_Schedule.pdf" target="_blank"><img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/schedules-covers.png"></a>
index 39583c9..9bf7e46 100644 (file)
@@ -27,7 +27,7 @@ if (!function_exists('glm_quicksite_widget_init')) {
             'id'          => 'slideshow',
             'description' => __('Meta Slider/Slideshow Area')
         ));
-        
+
     }
 
 }
@@ -65,7 +65,7 @@ function woocommerce_support() {
 
 
 function shareThis(){
-    echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';   
+    echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';
 }
 add_action( 'woocommerce_single_product_summary', 'shareThis', 20);
 
@@ -99,8 +99,8 @@ function glm_site_scripts()
 function glm_get_header() {
     global $post;
     $post_id = $post->ID;
-    
-    if( is_page() ) { 
+
+    if( is_page() ) {
         $parents = get_post_ancestors( $post_id );
         $post_id = ($parents) ? $parents[count($parents)-1]: $post->ID;
 
@@ -110,8 +110,8 @@ function glm_get_header() {
     if ( is_post_type('page') ) {
         $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), "full");
         echo ' style="background-image: url('.$image_data[0].');padding:0;padding-bottom:16%;background-position:center bottom;background-size: cover;background-repeat:no-repeat;max-height: 250px; "';
-        
-    } else if ( !is_post_type('page') ){        
+
+    } else if ( !is_post_type('page') ){
         echo ' class="no-featured"';
     } else {
         echo ' style="background-image: url('.get_template_directory_uri().'/assets/Ticket-Featured.png);padding:0;padding-bottom:16%;background-position:center bottom;background-size:cover;background-repeat:no-repeat;max-height: 250px; "';
@@ -172,10 +172,10 @@ function is_post_type($type){
 }
 function starlineUrl(){
     // get the url from the api plugin serialized options and replace the http protocol with https using regex
-    $starlineOptions  = unserialize( get_option( GLM_MEMBERS_APIS_STARLINE_OPTION_NAME ) ); 
-    $starlineUrl      = ( isset( $starlineOptions['ticketUrl'] ) ) ? $starlineOptions['ticketUrl'] : ''; 
-    $starlineUrl = preg_replace("/^http:/i", "https:", $starlineUrl); 
-    
+    $starlineOptions  = unserialize( get_option( GLM_MEMBERS_APIS_STARLINE_OPTION_NAME ) );
+    $starlineUrl      = ( isset( $starlineOptions['ticketUrl'] ) ) ? $starlineOptions['ticketUrl'] : '';
+    $starlineUrl = preg_replace("/^http:/i", "https:", $starlineUrl);
+
     return $starlineUrl;
 }
 add_action('thematic_searchloop', 'mytheme_search_loop');
@@ -201,4 +201,18 @@ if (!function_exists('is_in_tree')) {
         return false;
     }
 }
-?>
+
+if (!function_exists('ticket_url_base')) {
+    function ticket_url_base()
+    {
+        // get the option for the ticket url from the api plugin
+        // if not found then return false.
+        if ( defined('GLM_MEMBERS_APIS_STARLINE_OPTION_NAME') ) {
+            $starlineOptions  = unserialize( get_option( GLM_MEMBERS_APIS_STARLINE_OPTION_NAME ) );
+            $starlineUrl      = ( isset( $starlineOptions['ticketUrl'] ) ) ? $starlineOptions['ticketUrl'] : '';
+            return $startlineUrl;
+        } else {
+            return false;
+        }
+    }
+}
index 1927392..386c0fa 100644 (file)
                     <?php endif;?>
                 </div>
                 <div class="right header-cart-container">
-                    <a href="https://dev53.gaslightmedia.com/www.mackinacferry.com/order-tickets-online-6/?x=1&Action=Shop_cart">
+                    <a href="<?php echo ticket_url_base();?>order-tickets-online-6/?x=1&Action=Shop_cart">
                         <span>Cart</span>
                         <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/cart-icon.png">
                     </a>
                 </div>
-                
+
             </div>
         </div>
     </div>
 </div>
-<?php endif;?>
\ No newline at end of file
+<?php endif;?>
index c6355a3..aa9a9d2 100644 (file)
         <a class="left-off-canvas-toggle menu-icon" href="#"><span>Menu</span></a>
     </section>
     <section class="center-small">
-        <a class="right-off-canvas-toggle" href="#"><span>Buy Tickets</span></a>    
+        <a class="right-off-canvas-toggle" href="#"><span>Buy Tickets</span></a>
     </section>
     <section class="right-small">
-        
+
         <div class="header-cart-container">
-            <a href="https://dev53.gaslightmedia.com/www.mackinacferry.com/order-tickets-online-6/?x=1&Action=Shop_cart">
+            <a href="<?php echo ticket_url_base();?>order-tickets-online-6/?x=1&Action=Shop_cart">
                 <span>Cart</span>
                 <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/cart-icon-white.png">
             </a>