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!');
}
}
$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();
$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,
$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');
//echo '<pre>' . print_r($_REQUEST, true) . '</pre>';
// 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)) {
$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);
$pdf->saveState();
$pdf->setLineStyle(1, null, null, array());
$pdf->line($x, $y, $x + $coupon_width, $y); // make line for bottom
- $y = $pdf->ezText( "<b>".get_bloginfo('sitename')."</b> - <b>".get_bloginfo('url')."</b>\n", 8, $options );
+ $y = $pdf->ezText( "<b>".get_bloginfo('name')."</b> - <b>".get_bloginfo('url')."</b>\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