Small text updates
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 29 Jul 2016 19:08:49 +0000 (15:08 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 29 Jul 2016 19:08:49 +0000 (15:08 -0400)
mostly adding spacing to method calls.

index.php

index 3a79d1c..fedfda6 100644 (file)
--- a/index.php
+++ b/index.php
@@ -14,8 +14,8 @@ define( 'MICHSCI_PRODUCT_SINGLE', 'Product' );
 define( 'MICHSCI_PRODUCT_PLURAL', 'Products' );
 define( 'MICHSCI_CATEGORY_NAME', 'michsci_category' );
 define( 'MICHSCI_CATEGORY_SLUG', 'michsci-category' );
-define( 'MICHSCI_CATEGORY_SINGLE', 'Category');
-define( 'MICHSCI_CATEGORY_PLURAL', 'Categories');
+define( 'MICHSCI_CATEGORY_SINGLE', 'Category' );
+define( 'MICHSCI_CATEGORY_PLURAL', 'Categories' );
 define( 'MICHSCI_TAG_NAME', 'michsci_tag' );
 define( 'MICHSCI_TAG_SLUG', 'michsci-tag' );
 define( 'MICHSCI_TAG_SINGLE', 'Tag' );
@@ -105,8 +105,8 @@ function michsci_custom_post_type() {
  */
 function michsci_add_metaboxes()
 {
-     add_meta_box('miproduct_features', 'Features', 'miproduct_features', MICHSCI_POST_TYPE, 'normal', 'high');
-     add_meta_box('miproduct_related_products', 'Related Files', 'miproduct_related_products', MICHSCI_POST_TYPE, 'normal', 'high');
+     add_meta_box('miproduct_features', 'Features', 'miproduct_features', MICHSCI_POST_TYPE, 'normal', 'high' );
+     add_meta_box('miproduct_related_products', 'Related Files', 'miproduct_related_products', MICHSCI_POST_TYPE, 'normal', 'high' );
 }
 
 /**
@@ -203,8 +203,8 @@ function michsci_taxonomies()
 
     // Categories
     $labels = array(
-        'name'              => _x( MICHSCI_CATEGORY_NAME, 'taxonomy general name'),
-        'singular_name'     => _x( MICHSCI_CATEGORY_NAME, 'taxonomy singular name'),
+        'name'              => _x( MICHSCI_CATEGORY_NAME, 'taxonomy general name' ),
+        'singular_name'     => _x( MICHSCI_CATEGORY_NAME, 'taxonomy singular name' ),
         'search_items'      => __( 'Search ' . MICHSCI_CATEGORY_PLURAL),
         'all_items'         => __( 'All ' . MICHSCI_CATEGORY_PLURAL),
         'parent_item'       => __( 'Parent ' . MICHSCI_CATEGORY_SINGLE),
@@ -212,7 +212,7 @@ function michsci_taxonomies()
         'edit_item'         => __( 'Edit ' . MICHSCI_CATEGORY_SINGLE),
         'update_item'       => __( 'Update ' . MICHSCI_CATEGORY_SINGLE),
         'add_new_item'      => __( 'Add New ' . MICHSCI_CATEGORY_SINGLE),
-        'new_item_name'     => __( 'New ' . MICHSCI_CATEGORY_SINGLE . ' Name'),
+        'new_item_name'     => __( 'New ' . MICHSCI_CATEGORY_SINGLE . ' Name' ),
         'menu_name'         => __( 'Product ' . MICHSCI_CATEGORY_SINGLE ),
     );
 
@@ -241,8 +241,8 @@ function michsci_taxonomies()
 
     // Tags
     $labels = array(
-        'name'              => _x( MICHSCI_TAG_SINGLE, 'taxonomy general name'),
-        'singular_name'     => _x( MICHSCI_TAG_SINGLE, 'taxonomy singular name'),
+        'name'              => _x( MICHSCI_TAG_SINGLE, 'taxonomy general name' ),
+        'singular_name'     => _x( MICHSCI_TAG_SINGLE, 'taxonomy singular name' ),
         'search_items'      => __( 'Search ' . MICHSCI_TAG_PLURAL),
         'all_items'         => __( 'All ' . MICHSCI_TAG_PLURAL),
         'parent_item'       => __( 'Parent ' . MICHSCI_TAG_SINGLE),
@@ -250,7 +250,7 @@ function michsci_taxonomies()
         'edit_item'         => __( 'Edit ' . MICHSCI_TAG_SINGLE),
         'update_item'       => __( 'Update ' . MICHSCI_TAG_SINGLE),
         'add_new_item'      => __( 'Add New ' . MICHSCI_TAG_SINGLE),
-        'new_item_name'     => __( 'New ' . MICHSCI_TAG_SINGLE . ' Name'),
+        'new_item_name'     => __( 'New ' . MICHSCI_TAG_SINGLE . ' Name' ),
         'menu_name'         => __( 'Product ' . MICHSCI_TAG_SINGLE),
     );
 
@@ -444,7 +444,7 @@ function michsci_shortcode($atts)
     }
     $term = get_term_by("id", $_REQUEST[MICHSCI_CATEGORY_NAME],"michsci_category");
     $name = $term->name;
-    
+
     if(!$name){
         $name = "ALL PRODUCTS";
     }
@@ -455,7 +455,7 @@ function michsci_shortcode($atts)
     echo '</div><div id="searchContainer" class="small-12 medium-3 columns"></form> <form class="searchform" role="search" method="post" action="">
          <input id="filter" class="search-input" placeholder="SEARCH ' . strtoupper($name) . '" value="" autocomplete="off" name="tsearch" type="text">
          <input id="input" class="search-button" name="searchButton" value="Search" type="submit">
-        
+
          <a id="magnifying-glass" class="show-for-large-up" href="#">
     </a>
        </form></div></div>';
@@ -465,9 +465,7 @@ function michsci_shortcode($atts)
     } else if ( $cat_id = filter_var( $_REQUEST['category'], FILTER_VALIDATE_INT ) ) {
         michsci_list_categories($cat_id);
     } else if ( !$catid_id && !$product_id ) {
-//        $text_query = $_REQUEST['tsearch'];
         $text_query = filter_var($_REQUEST['tsearch'], FILTER_SANITIZE_STRING);
-//        strip_tags($text_query);
         if(isset($_REQUEST['tsearch'])){
             setcookie("search", "true",time()+2, "/" );
         } else {
@@ -475,8 +473,8 @@ function michsci_shortcode($atts)
         }
         michsci_list_products($text_query);
         michsci_list_categories();
-    } 
-    
+    }
+
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
@@ -492,11 +490,6 @@ function michsci_shortcode($atts)
  */
 function michsci_get_terms_dropdown($cat_id)
 {
-//    $test = $_REQUEST['tsearch'];
-//    $filterTest = filter_var($test, FILTER_SANITIZE_STRING);
-//    echo $filterTest;
-    
-
     $taxonomyName = MICHSCI_CATEGORY_NAME;
     if($cat_id){
         $main = get_term($cat_id, MICHSCI_CATEGORY_NAME);
@@ -512,10 +505,10 @@ function michsci_get_terms_dropdown($cat_id)
         }
         $output .="</select>";
     } else {
-        
+
     $parent_terms = get_terms($taxonomyName, array('parent' => 0, 'orderby' => 'name', 'hide_empty' => false));
     $terms = get_terms($taxonomyName, array('orderby' => 'name', 'hide_empty' => false));
+
     $output ="<select id='categoryDropdown' name=\"" . MICHSCI_CATEGORY_NAME . "\"><option value=\"\">Select " . MICHSCI_CATEGORY_SINGLE . "</option>";
         // get parent categories
         foreach ($parent_terms as $parent){
@@ -566,20 +559,12 @@ function michsci_get_terms_dropdown($cat_id)
 function michsci_list_products($text_query)
 {
     global $wpdb, $wp;
-    
+
     $cat = get_term($cat_id, MICHSCI_CATEGORY_NAME);
     $args = array(
         'posts_per_page' => -1,
         'post_type'     => 'miproduct',
         's' => $text_query
-//        'meta_query' => array(
-//        array(
-//            'key' => 'post_title',
-//            'value' => $text_query,
-//            'compare' => 'LIKE'
-//        )
-//    )
-       // add meta query here
     );
     $misch_category = ( isset( $_REQUEST[MICHSCI_CATEGORY_NAME] ) )
         ? filter_var( $_REQUEST[MICHSCI_CATEGORY_NAME] )
@@ -609,10 +594,11 @@ function michsci_list_products($text_query)
         if ( $iterator == $totalProducts ) {
             $product->end = true;
         }
-        $cat->href =   "?michsci_category="; 
+        $cat->href =   "?michsci_category=";
         $product->href = $current_url
             . ( ( strpos( $current_url, '?' ) ) ? '&' : '?' )
             . "product=" . $product->ID;
+        $product->href = get_permalink( $product->ID );
         ++$iterator;
     }
     //echo '<pre>' . print_r($products, true) . '</pre>';