From: Steve Sutton Date: Thu, 7 Jan 2016 15:42:23 +0000 (-0500) Subject: Bug fixes X-Git-Tag: v0.0.6^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=dd8a9c13888e3483b8ac6e6dc90beb1c85d260c5;p=WP-Plugins%2Fglm-coupons.git Bug fixes fix for error reporting of undefined variables. --- diff --git a/controllers/front.php b/controllers/front.php index 5481881..9db5425 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -30,8 +30,6 @@ class glm_coupon_front if (array_key_exists('glm-coupon-pdf', $wp->query_vars) && $wp->query_vars['glm-coupon-pdf'] == 'true') { $this->list_coupons(true); exit; - die('more test'); - wp_die('test is test for pdf output!'); } } @@ -102,7 +100,7 @@ class glm_coupon_front $coupons = get_posts($args); foreach ($coupons as $coupon) { $custom = get_post_custom($coupon->ID); - if ($custom['glm_coupons_member'][0]) { + if (isset($custom['glm_coupons_member'][0]) && $custom['glm_coupons_member'][0]) { $member_data = $this->_getMemberData($custom['glm_coupons_member'][0]); } else { $member_data = array(); @@ -112,8 +110,8 @@ class glm_coupon_front $coupon->glm_coupons_enddate = $custom['glm_coupons_enddate'][0]; $coupon->glm_coupons_expdate = $custom['glm_coupons_expdate'][0]; $coupon->glm_coupons_url = preg_replace('/http:\/\//i', '', $coupon->glm_coupons_url); - $coupon->glm_coupons_member = ($member_data['member_name']) ? $member_data['member_name'] : ''; - $coupon->glm_coupons_address = ($member_data['address']) ? $member_data['address'] : ''; + $coupon->glm_coupons_member = (isset($member_data['member_name']) && $member_data['member_name']) ? $member_data['member_name'] : ''; + $coupon->glm_coupons_address = (isset($member_data['address']) && $member_data['address']) ? $member_data['address'] : ''; $coupon->glm_coupons_thumb = get_the_post_thumbnail($coupon->ID, array(151, 151), array('class' => 'aligncenter')); $post_categories = wp_get_object_terms( $coupon->ID, diff --git a/views/front/couponPrint.php b/views/front/couponPrint.php index ba3d999..02645ed 100644 --- a/views/front/couponPrint.php +++ b/views/front/couponPrint.php @@ -19,7 +19,7 @@ $all = $pdf->openObject(); $pdf->saveState(); $pdf->setLineStyle(1, '', '', array(20, 5, 10, 5)); $pdf->setStrokeColor(0, 0, 0, 1); -$pdf->addText(50, 34, 6, get_bloginfo('siteurl') .date('F jS, Y')); +$pdf->addText(50, 34, 6, get_bloginfo('url') .date('F jS, Y')); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); @@ -37,7 +37,7 @@ $coupon_rgt_opt = array( //echo '
' . print_r($_REQUEST, true) . '
'; // check to see if Print selected is on $printIds = array(); -if ($_REQUEST['printSel']) { +if (isset($_REQUEST['printSel']) && $_REQUEST['printSel']) { $printAll = false; foreach ($_REQUEST as $posted => $value) { if (preg_match('%coupon-id-(\d+)%', $posted, $matches)) { @@ -94,13 +94,13 @@ foreach ($coupons as $coupon) { $pdf->ezSetY($y); $y = $pdf->ezText("\n".$header, 12, $header_options); $y = $pdf->ezText($descr, 10, $options); - if ($coupon->glm_coupons_address) { + if (isset($coupon->glm_coupons_address) && $coupon->glm_coupons_address) { $y = $pdf->ezText($coupon->glm_coupons_address, 9, $header_options); } - if ($phone) { + if (isset($phone) && $phone) { $y = $pdf->ezText($phone, 9, $header_options); } - if ($url) { + if (isset($url) && $url) { $y = $pdf->ezText($url, 9, $header_options); } $y = $pdf->ezText("\n".$expire."\n", 9, $options); @@ -108,7 +108,7 @@ foreach ($coupons as $coupon) { $pdf->saveState(); $pdf->setLineStyle(1, null, null, array()); $pdf->line($x, $y, $x + $coupon_width, $y); // make line for bottom - $y = $pdf->ezText( "".get_bloginfo('sitename')." - ".get_bloginfo('url')."\n", 8, $options ); + $y = $pdf->ezText( "".get_bloginfo('name')." - ".get_bloginfo('url')."\n", 8, $options ); $pdf->restoreState(); $pdf->line($x, $y, $x + $coupon_width, $y); // make line for bottom $pdf->line($x + $coupon_width, $reset, $x + $coupon_width, $y); // make right