Update for PHP CodeSniffer request
authorSteve Sutton <ssutton@gmail.com>
Mon, 30 May 2016 00:45:38 +0000 (20:45 -0400)
committerSteve Sutton <ssutton@gmail.com>
Mon, 30 May 2016 00:45:38 +0000 (20:45 -0400)
index.php

index 9188b49..7786dc5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -176,10 +176,10 @@ function miproduct_related_products() {
  */
 function miproduct_save_meta() {
        global $post;
-       if ( !wp_verify_nonce( $_POST['miproductmeta-meta-noncename'], 'miproductmeta-meta-noncename' ) ) {
+       if ( ! wp_verify_nonce( $_POST['miproductmeta-meta-noncename'], 'miproductmeta-meta-noncename' ) ) {
                return $post->ID;
        }
-       if ( !current_user_can( 'edit_post', $post->ID ) ) {
+       if ( ! current_user_can( 'edit_post', $post->ID ) ) {
                return $post->ID;
        }
        $features                 = filter_var( $_POST['miproduct_features'], FILTER_SANITIZE_STRING );
@@ -422,9 +422,9 @@ function michsci_admin_custom_columns( $column ) {
  * Add shortcode function. This will call the correct function based on the
  * front end search.
  *
- * @param mixed $atts
+ * @param mixed $atts Attribute array.
  * @access public
- * @return void
+ * @return type
  */
 function michsci_shortcode( $atts ) {
        extract( shortcode_atts( array( 'limit' => '10' ), $atts ) );
@@ -438,7 +438,7 @@ function michsci_shortcode( $atts ) {
                        $cat_id = $product_category->term_id;
                }
        }
-       $term = get_term_by( 'id', $_REQUEST[ MICHSCI_CATEGORY_NAME ],'michsci_category' );
+       $term = get_term_by( 'id', $_REQUEST[ MICHSCI_CATEGORY_NAME ], 'michsci_category' );
        $name = $term->name;
 
        if ( ! $name ) {
@@ -557,6 +557,7 @@ function michsci_get_terms_dropdown( $cat_id ) {
 function michsci_list_products( $text_query ) {
        global $wpdb, $wp;
 
+       // TODO: $cat_id is not initialized!
        $cat = get_term( $cat_id, MICHSCI_CATEGORY_NAME );
        $args = array(
                'posts_per_page' => -1,
@@ -579,10 +580,10 @@ function michsci_list_products( $text_query ) {
                );
        }
 
-       $products          = get_posts( $args );
+       $products           = get_posts( $args );
        $total_products = count( $products );
-       $current_url   = esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
-       $iterator          = 1;
+       $current_url    = esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
+       $iterator           = 1;
 
        foreach ( $products as $product ) {
                $product_terms = wp_get_post_terms( $product->ID, MICHSCI_CATEGORY_NAME, 'name' );
@@ -606,7 +607,7 @@ function michsci_list_products( $text_query ) {
  *
  * Create a list of categories.
  *
- * @param bool $cat_id Category id.
+ * @param bool $cat_id Parent Category to Display.
  *
  * @access public
  * @return void
@@ -675,8 +676,8 @@ function michsci_show_category( $cat_id ) {
        $term = get_terms(
                MICHSCI_CATEGORY_NAME,
                array(
-                       'child_of'         => $cat_id,
-                       'hide_empty'   => true,
+                       'child_of'       => $cat_id,
+                       'hide_empty' => true,
                )
        );
        include 'views/category_detail.php';