ID) $postId = $post->ID; else $postId = $post[*/ // $logo = get_bloginfo("url")."/wp-content/" . CouponHtml::fixLogo88($coupon["shopImage"], $postId); $couponType = $coupon["coupontype"]; $valid = date("d.m.Y", strtotime($coupon["expiresat"])); $isValid = false; if (strtotime($coupon["expiresat"]) > time()) $isValid = true; if ($coupon["expiry"] == 1) $valid = "auf Widerruf"; $type = strtolower(str_replace(array("ń"), array("ae"), $type)); if ($type == "gutscheincode" && strpos($coupon["value"], "%") !== false) $type = "gutscheincode-prozent"; // handle data errors in the type field if (!in_array($type, array ( "gutschein", "gutscheincode", "gutscheincode-prozent", "schnaeppchen", "sale", "praemie", "gratisartikel", "geschenkgutschein"))) $type = "gutscheincode-prozent"; // $excl = ""; if ($coupon["isExclusive"]) $excl = " "; $dom = $coupon["shopDomain"]; // $base = get_bloginfo("url"); // return path of the child template root directory (lol) $dir = get_stylesheet_directory() . "/"; // load and execute coupon $file = $dir."gutscheine/gutschein.php"; // $position = $cnt; // no user file - use default if (! file_exists($file)) $file = dirname(__FILE__)."/../gutscheine/gutschein.php"; // ob_start(); include($file); $inhalte = ob_get_contents(); ob_end_clean(); return $inhalte; } } CURRENT_DATE() ORDER BY `order` DESC LIMIT 1"; $res = mysql_query($sql); $coupon = mysql_fetch_assoc($res); if (!$coupon) { // get out of date coupons $sql = "SELECT * FROM coupon WHERE `key` = \"".mysql_real_escape_string($domain). "\" AND DATE(expiresat) <= CURRENT_DATE() ORDER BY `order` DESC LIMIT 1"; $res = mysql_query($sql); $coupon = mysql_fetch_assoc($res); } // return $coupon; } // public static function getGutscheinDerWoche() { // $sql = "SELECT * FROM coupon WHERE gutscheinDerWoche = 1"; $res = mysql_query($sql); $row = mysql_fetch_assoc($res); return $row; } public static function getCouponByKey($domain=null) { // if (!$domain) { // setup & validate required parameters $postId = get_the_ID(); if (!$postId) return null; $domain = get_post_meta($postId, "llg-gutschein-domain", true); } // $sql = "SELECT * FROM coupon WHERE `key` = '".mysql_real_escape_string($domain)."' OR `shopDomain` = '".mysql_real_escape_string($domain)."' ORDER BY `order` DESC LIMIT 1"; $res = mysql_query($sql); return mysql_fetch_assoc($res); } public static function getPublishedCouponByKey($domain=null) { // if (!$domain) { // setup & validate required parameters $postId = get_the_ID(); if (!$postId) return null; $domain = get_post_meta($postId, "llg-gutschein-domain", true); } // $sql = "SELECT * FROM coupon WHERE `key` = '".mysql_real_escape_string($domain)."' OR `shopDomain` = '".mysql_real_escape_string($domain)."' AND couponPublished = 1 ORDER BY `order` DESC LIMIT 1"; $res = mysql_query($sql); return mysql_fetch_assoc($res); } public static function getPermalinkForDomain($domain) { $post = CouponCommon::getPostBykey($domain); if ($post) { return get_permalink($post["ID"]); # return $post["post_name"]."/"; } } public static function getPostByKey($domain) { global $TBL_PREFIX; $sql = "SELECT * FROM {$TBL_PREFIX}posts INNER JOIN {$TBL_PREFIX}postmeta ON {$TBL_PREFIX}postmeta.post_id = ID AND post_status = 'publish' AND meta_key = 'llg-gutschein-domain' AND ( meta_value = '$domain' OR meta_value = '$domain') "; $res2 = mysql_query($sql); $p = mysql_fetch_assoc($res2); return $p; } public static function getCoupon($coupon, $postId=0, $cnt=0) { $html = CouponTemplate::getCoupon($coupon, $postId, $cnt); return $html; } public static function hasCoupons($postId) { // setup & validate required parameters if (!$postId) $postId = get_the_ID(); if (!$postId) return; // die("Keine PostID"); $domain = get_post_meta($postId, "llg-gutschein-domain", true); if (!$domain) return false; return true; } // public static function getCouponCountByCategory($categoryId) { global $TBL_PREFIX; // if (!$categoryId) echo ("Fehler, keine categoryId"); // select all llg-gutschein-domains for the given category $sql = "select count({$TBL_PREFIX}term_taxonomy.term_id) as cnt from {$TBL_PREFIX}terms inner join {$TBL_PREFIX}term_taxonomy on {$TBL_PREFIX}terms.term_id = {$TBL_PREFIX}term_taxonomy.term_id inner join {$TBL_PREFIX}term_relationships wpr on wpr.term_taxonomy_id = {$TBL_PREFIX}term_taxonomy.term_taxonomy_id inner join {$TBL_PREFIX}posts p on p.ID = wpr.object_id where taxonomy= 'category' and p.post_type = 'post' AND {$TBL_PREFIX}term_taxonomy.term_id = $categoryId"; // $res = mysql_query($sql); echo mysql_error(); $ret = array(); while ($coup = mysql_fetch_assoc($res)) return $coup["cnt"]; return 0; } // public static function getBeliebteCouponDomainsByCategory($categoryId, $limit = 5) { global $TBL_PREFIX; $custom = get_field("llg-top-shops-csv", "category_".$categoryId); if ($custom) { // put "" around each item $vals = explode(",", $custom); $ret = ""; foreach ($vals as $val) { if ($ret) $ret .= ", "; $ret .= '"' . trim($val). '"'; } // select all llg-gutschein-domains for the given list of domains $sql = "select DISTINCT(p1.meta_value) AS `key`, p.ID AS postId from {$TBL_PREFIX}posts AS p inner join {$TBL_PREFIX}postmeta p1 on p1.post_id = p.ID AND p1.meta_key = 'llg-gutschein-domain' where p.post_type = 'post' and p.post_status = 'publish' and p1.meta_value IN ($ret) group by p1.meta_value order by p1.meta_key asc LIMIT $limit"; // $res = mysql_query($sql); $ret = array(); while ($coup = mysql_fetch_assoc($res)) $ret []= $coup; $seen = array(); $real = array(); foreach ($ret as $r) { if ($seen[ $r["key"] ]) continue; else { $seen[ $r["key"] ] = true; $real []= $r; } } return $real; } else { // no top shops set return array(); } } // returns either "frameset" or "popup" public static function getCouponConversionStyle() { $coupon = CouponCommon::getCouponByKey(); #die(var_dump($coupon)); // if merchants forbid iframes use popup if ($coupon["shopNoIframe"]) return "popup"; // check for user's selection $option = get_option("llg-gutschein-setting-conversion"); return $option; } } "Januar", 2=>"Februar", 3=>"März", 4=>"April", 5=>"Mai", 6=>"Juni", 7=>"Juli", 8=>"August", 9=>"September", 10=>"Oktober", 11=>"November", 12=>"Dezember"); // $day = date("j"); // 1..31 $month = date("n"); // 1..12 $year = date("Y"); // 2012 ... // if ($day >= 30) { $month += 1; // switch to new year if ($month > 12) { $day = 1; $month = 1; $year += 1; } } // return $monate[$month]; } public function getExcerpt($postId) { $excerpt = get_the_excerpt( $postId ); return strip_tags($excerpt); } public function getExcerptLength($postId, $charlength) { $excerpt = CouponText::getExcerpt($postId); $charlength++; $ret = ""; if ( mb_strlen( $excerpt ) > $charlength ) { $subex = mb_substr( $excerpt, 0, $charlength - 5 ); $exwords = explode( ' ', $subex ); $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); if ( $excut < 0 ) { $ret = mb_substr( $subex, 0, $excut ); } else { $ret = $subex; } $ret .= '[...]'; } else { $ret = $excerpt; } // return $ret; } public function getMetaDescription($postId) { $length = get_option("llg-gutschein-seo-desc-length"); $excerpt = CouponText::getExcerptLength($postId, $length); return ($excerpt); } public function getYearName() { // $day = date("j"); // 1..31 $month = date("n"); // 1..12 $year = date("Y"); // 2012 ... // if ($day >= 30) { $month += 1; // switch to new year if ($month > 12) { $day = 1; $month = 1; $year += 1; } } // return $year; } }→ Alle " . CouponHtml::fixShopName($title) . " Gutscheine anzeigen"; } // public static function getAlleGutscheineAnzeigenText($coupon) { $kw = $coupon["shopAltKeywordPlural"]; if (!$kw) $kw = "Gutscheine"; return "→ Alle " . CouponHtml::fixShopName($coupon["shopName"], -1) . " $kw"; } // handle overwriting the shopname with the "shopname" more field public static function fixShopName($shopName, $postId=0) { // if (!$postId && is_single()) $postId = get_the_ID(); if (!$postId) return $shopName; if ($postId <0) return $shopName; $othername = get_post_meta($postId, "llg-shopname", true); if ($othername) return $othername; return $shopName; } // handle overwriting public static function fixLogo120($logo120, $postId=0) { // if (!$postId && is_single()) $postId = get_the_ID(); if (!$postId) return $logo120; if ($postId <0) return $logo120; $otherlogo120 = get_post_meta( $postId, "llg-clone-image-120", true); if ($otherlogo120) { $image = wp_get_attachment_image_src($otherlogo120, 'full'); if ($image) { $otherlogo120 = $image[0]; // make relative to follow convention if ($otherlogo120) { $otherlogo120 = str_replace(array("http://www.gutscheinrausch.de/", "https://www.gutscheinrausch.de/", "http://blabla.llg-media.de/", get_bloginfo("url")), "", $otherlogo120); return "../".$otherlogo120; } } } return $logo120; } // handle overwriting public static function fixLogo88($logo88, $postId=0) { // if (!$postId && is_single()) $postId = get_the_ID(); if (!$postId) return $logo88; if ($postId <0) return $logo88; $otherlogo88 = get_post_meta( $postId, "llg-clone-image-88", true); if ($otherlogo88) { $image = wp_get_attachment_image_src($otherlogo88, 'full'); if ($image) { $otherlogo88 = $image[0]; // make relative to follow convention if ($otherlogo88) { $otherlogo88 = str_replace(array("http://www.gutscheinrausch.de/", "https://www.gutscheinrausch.de/", "http://blabla.llg-media.de/", get_bloginfo("url")), "", $otherlogo88); return "../".$otherlogo88; } } } return $logo88; } public static function getAllCoupons($postId=0, $limit=999) { // setup & validate required parameters if (!$postId) $postId = get_the_ID(); if (!$postId) return; // die("Keine PostID"); $domain = get_post_meta($postId, "llg-gutschein-domain", true); if (!$domain) return null; $base = get_bloginfo("url"); $link = get_permalink(); $html = ""; // get valid coupons $sql = "SELECT * FROM coupon WHERE (`shopDomain` = \"".mysql_real_escape_string($domain). "\" OR `key` = \"".mysql_real_escape_string($domain). "\") AND DATE(expiresat) > CURRENT_DATE() ORDER BY `order` DESC LIMIT $limit"; $res = mysql_query($sql); // add in array $coupon = array(); while ($coupon = mysql_fetch_assoc($res)) { $coupons []= $coupon; } // user has inserted a manual first coupon? $manual = get_post_meta($postId, "manual-coupon-type-1", true); if ($manual && $manual != "Inaktiv") { $html .= CouponCustom::getAllCoupons($coupons[0], $postId, $limit); } $cnt = 0; if ( !$manual || // if no custom coupon was set - show normal coupons ($manual && $limit > 1) ) { // only show normal coupons with custom one if limit > 1 // add normal coupons to html output if ($coupons) foreach ($coupons as $coupon) { $html .= CouponCommon::getCoupon($coupon, $postId, $cnt++); //if (++$cnt % 2 == 0) $html .= "
 
"; } } // if has coupons and shall only show one if ($html && $limit == 1) return $html; // merchant forces us to remove outdated coupons? if ($coupon["shopHideExpired"]) return $html; // get out of date coupons $sql = "SELECT * FROM coupon WHERE `key` = \"".mysql_real_escape_string($domain). "\" AND DATE(expiresat) <= CURRENT_DATE() ORDER BY `order` DESC LIMIT $limit"; $res = mysql_query($sql); // foreach invalid coupon $first = true; $cnt = 0; while ($coupon = mysql_fetch_assoc($res)) { if ($first) { if (is_single()) $html .= "

Abgelaufene Gutscheine

"; $first = false; } $html .= CouponCommon::getCoupon($coupon, $postId, $cnt++); //if (++$cnt % 2 == 0) $html .= "
 
"; } // return "
" . $html . "
"; } } $bb) return -1; return 0; } class LLgInternalCouponMisc { private static function getSimilarPostsByTag($postId, $count=8) { $tags = wp_get_post_tags($postId); $ret = array(); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) { if (in_array($individual_tag->slug, array( "gutschein", "gutscheine", "coupons", "coupon", "rabatt", "rabatte", "gutscheincode", "gutscheincodes" ))) continue; $tag_ids[] = $individual_tag->term_id; } $seen = array(); $args=array( 'tag__in' => $tag_ids, 'post__not_in' => array($postId), 'showposts'=>$count*10, // Number of related posts that will be shown. 'caller_get_posts'=>1 ); $my_query = new wp_query($args); if( $my_query->have_posts() ) { $cnt = 1; while ($my_query->have_posts()) { $my_query->the_post(); $dom = get_post_meta(get_the_ID(), "llg-gutschein-domain", true); if (!$seen[$dom]) $seen[$dom] = true; else continue; $ret []= get_the_ID(); if ($cnt % $count ==0) break; $cnt++; } } } return $ret; } private function getSimilarPostsByCategory ($postId, $count) { $categories = get_the_category($postId); $ret = array(); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($postId), 'showposts'=> 3*$count, // Number of related posts that will be shown. 'caller_get_posts'=>1 ); $my_query = new wp_query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts() && count($ret) < $count) { $my_query->the_post(); /* // only add shops if they have coupons $sql = "SELECT * FROM coupon INNER JOIN wp_postmeta ON meta_name = 'llg-gutschein-domain' AND meta_value = coupon.key AND post_ID = " . get_the_ID(); die($sql); $res2 = mysql_query($sql); $row2 = mysql_fetch_assoc($res2); if ($row2) */ $ret []= get_the_ID(); } } } return $ret; } public static function getRelatedCoupons($id, $count=8) { //$posts = get_related_posts(); $posts = CouponMisc::getSimilarPostsByTag($id, $count); if (!$posts || count($posts) < 8) { $posts2 = CouponMisc::getSimilarPostsByCategory($id, $count-count($posts)+1); $posts = array_merge($posts, $posts2); } while (count($posts) > $count) array_pop($posts); $dom = get_post_meta($id, "llg-gutschein-domain", true); $seen = array( ); $seen[$dom] = true; $coupons = array(); foreach ($posts as $postId) { // don't show the same post if ($id == $postId) continue; // $dom = get_post_meta($postId, "llg-gutschein-domain", true); if ($dom) { $coupon = CouponCommon::getCouponByKey($dom); if ($coupon) { // if ($seen[ $coupon["shopDomain"] ]) continue; if ($coupon["key"] && $seen[ $coupon["shopDomain"] ]) continue; $seen[ $coupon["shopDomain"] ] = true; $seen[ $coupon["key"] ] = true; // $logo = CouponHtml::fixLogo88($coupon["shopImage"], $postId); $link = get_permalink($postId); if (!$link) continue; $coupon["link"] = $link; $coupons[]= $coupon; } } } // foreach post // now we got all the coupons - sort them by num clicks usort($coupons, "cmpMisc"); return $coupons; } public static function getRelatedCouponsHtml($postId=-1, $count=8) { if ($postId == -1) $postId = get_the_ID(); $coupons = CouponMisc::getRelatedCoupons($postId, $count); $ret = ''; return $ret; } // html for the sidebar box public static function getTopCouponsHtml ($domains) { $ret = ''; return $ret; } }$html"; } protected static function wrapLink($linkArray) { $anchor = $linkArray[0]; $link = $linkArray[1]; $title = $linkArray[2]; if ($link) { return " "; } else { return $anchor; } } public static function getSearchBreadrumbs() { $title = "Suche"; return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, "", $title)); } public static function get404Breadrumbs() { $title = "Seite nicht gefunden"; return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, "", $title)); } public static function getFrontpageBreadrumbs() { $arr = array("Startseite", get_bloginfo("url")."/", "Zur Startseite wechseln"); $ret = Breadcrumbs::wrapLink($arr); if (is_front_page()) return $ret; $ret .= Breadcrumbs::getSeperator(); return $ret; } public static function getCategoryBreadrumbs() { global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; $slug = $term->slug; // return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, get_bloginfo("url") . "/$slug/", $title)); } public static function getTagBreadrumbs() { global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; $slug = $term->slug; // return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, get_bloginfo("url") . "/$slug/", $title)); } public static function getCouponBreadcrumbs($domain) { $coupon = CouponCommon::getCouponByKey($domain); $link = get_permalink(); $categories = get_the_category(get_the_ID()); $catLink = ""; $catName = ""; if ($categories && $coupon) { $catLink = get_bloginfo("url") . "/" . $categories[0]->slug."/"; $catName = $categories[0]->name; $cat = array($catName, $catLink, $catName); $coup = array($coupon["shopName"] . " Gutschein", $link, "Alle " . $coupon["shopName"] . " Gutscheine"); return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($cat) . Breadcrumbs::getSeperator() . /*Breadcrumbs::wrapLink*/($coup[0]); } return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($cat) . Breadcrumbs::getSeperator(); } public static function getPageBreadrumbs() { $link = get_permalink(); $page = array(get_the_title(), $link, get_the_title()); return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($page); } public static function getSingleBreadrumbs(){ $link = get_permalink(); $post = array(get_the_title(), $link, get_the_title()); $categories = get_the_category(get_the_ID()); $catLink = ""; $catName = ""; if ($categories) { $catLink = get_bloginfo("url") . "/" . $categories[0]->slug."/"; $catName = $categories[0]->name; $cat = array($catName, $catLink, $catName); return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($cat) . Breadcrumbs::getSeperator() . Breadcrumbs::wrapLink($post); } return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($post); } public static function getTaxBreadrumbs(){ global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; $slug = $term->slug; // return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, get_bloginfo("url") . "/$slug/", $title)); } public static function getUnknownBreadrumbs(){ } public static function getSeperator() { return " > "; } }slug."/"; $catName = $categories[0]->name; $cat = array($catName, $catLink, $catName); $coup = array($coupon["shopName"] . " Gutschein", "", "Alle " . $coupon["shopName"] . " Gutscheine"); return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($cat) . Breadcrumbs::getSeperator() . Breadcrumbs::wrapLink($coup); } return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($cat) . Breadcrumbs::getSeperator(); } public static function getPageBreadrumbs() { $link = get_permalink(); $page = array(get_the_title(), "", get_the_title()); return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($page); } public static function getSingleBreadrumbs(){ $link = get_permalink(); $post = array(get_the_title(), "", get_the_title()); $categories = get_the_category(get_the_ID()); $catLink = ""; $catName = ""; if ($categories) { $catLink = get_bloginfo("url") . "/" . $categories[0]->slug."/"; $catName = $categories[0]->name; $cat = array($catName, $catLink, $catName); return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($cat) . Breadcrumbs::getSeperator() . Breadcrumbs::wrapLink($post); } return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink($post); } public static function getTaxBreadrumbs(){ global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; $slug = $term->slug; // return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, "", $title)); } public static function getTagBreadrumbs() { global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; $slug = $term->slug; // return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, "", $title)); } public static function getCategoryBreadrumbs() { global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; $slug = $term->slug; // return Breadcrumbs::getFrontpageBreadrumbs() . Breadcrumbs::wrapLink(array($title, "", $title)); } }purgeByPostId($postId); $this->purgeHomeUrl(); $this->purgeAdditionalPages(); $this->purgePostCategories($postId); $this->purgePostTags($postId); if (function_exists("wp_cache_post_change")) wp_cache_post_change($postId); // super cache // $this->executePurge(); } // delete post public function handleDeletePost($postId) { $this->purgeByPostId($postId); $this->purgeHomeUrl(); $this->purgeAdditionalPages(); $this->purgePostCategories($postId); $this->purgePostTags($postId); if (function_exists("wp_cache_post_change")) wp_cache_post_change($postId); // super cache // $this->executePurge(); } // edit post public function handleEditPost($postId) { $this->purgeByPostId($postId); $this->purgeHomeUrl(); $this->purgeAdditionalPages(); $this->purgePostCategories($postId); $this->purgePostTags($postId); if (function_exists("wp_cache_post_change")) wp_cache_post_change($postId); // super cache // $this->executePurge(); } // purge additional pages private function purgeAdditionalPages() { $pages = trim ( get_option("llg-gutschein-settings-varnish-additional-pages") ); if ($pages) { $lines = explode("\n", $pages); foreach ($lines as $line) { $line = trim($line); if ($line) $this->purgeByUrl($line); } } } // purge a posts category pages public function purgePostCategories($postId) { $post_categories = wp_get_post_categories( $postId ); foreach($post_categories as $c){ $cat = get_category( $c ); $this->purgeByUrl( home_url()."/".$cat->slug); } } // purge a posts tag pages public function purgePostTags($postId) { $post_tags = wp_get_post_tags( $postId ); foreach($post_tags as $t){ $this->purgeByUrl( home_url()."/".$t->slug); } } // purge / public function purgeHomeUrl() { $this->purgeByUrl(home_url()); } // add another post id to purge public function purgeByPostId($postId) { if (function_exists("wp_cache_post_change")) wp_cache_post_change($postId); // super cache array_push($this->purgeUrls, get_permalink($postId)); } // purge by url public function purgeByUrl($url) { array_push($this->purgeUrls, $url); } // called by shutdown handler: execute all collected purge requests public function executePurge() { $purgeUrls = array_unique($this->purgeUrls); foreach($purgeUrls as $url) $this->callCurl($url); } // call PURGE protected function callCurl($url) { // check if varnish is enabled $val = get_option("llg-gutschein-settings-varnish-enabled"); if ($val == "ja") { // $port = get_option('llg-gutschein-settings-varnish-port'); $c = curl_init($url); curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'PURGE'); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_PORT , $port); curl_exec($c); curl_close($c); } } } $cache = new LlgInternalHttpCache();page titleoverrideField = "llg-custom-meta-title"; } // single post page (NOT a coupon page) public function singlePost () { return $this->handleUiDefaults(null, "llg-gutschein-seo-post-title"); } // single post page for coupons public function couponPage($coupon) { return $this->handleUiDefaults($coupon, "llg-gutschein-seo-gutschein-title"); } // single post page for coupon not found public function couponNotFoundPage($domain) { return get_the_title(); } // single static content page public function staticPage() { return $this->handleUiDefaults(null, "llg-gutschein-seo-page-title"); } // category page public function category() { return $this->handleUiDefaults(null, "llg-gutschein-seo-category-title"); } public function pagedCategory($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-category-title"); } // tag page public function tag() { return $this->handleUiDefaults(null, "llg-gutschein-seo-tag-title"); } public function pagedTag($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-tag-title"); } // search page public function search() { return $this->handleUiDefaults(null, "llg-gutschein-seo-search-title"); } // archive public function archive() { return $this->handleUiDefaults(null, "llg-gutschein-seo-archive-title"); } public function pagedArchive($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-archive-title"); } } function CouponPlugin_HandleTitle($title) { $meta = new MetaTitle($title); return $meta->handle($title); } // $do = get_option("llg-gutschein-seo-enabled"); if ($do == "ja") add_filter('wp_title','CouponPlugin_HandleTitle', 100); overrideField = "llg-custom-meta-robots"; } // single post page (NOT a coupon page) public function singlePost () { return $this->handleUiDefaults(null, "llg-gutschein-seo-post-robots"); } // single post page for coupons public function couponPage($coupon) { return $this->handleUiDefaults($coupon, "llg-gutschein-seo-gutschein-robots"); } public function couponNotFoundPage($domain) { return ""; } // single static content page public function staticPage() { return $this->handleUiDefaults(null, "llg-gutschein-seo-page-robots"); } // category page public function category() { return $this->handleUiDefaults(null, "llg-gutschein-seo-category-robots"); } public function pagedCategory($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-category-robots"); } // tag page public function tag() { return $this->handleUiDefaults(null, "llg-gutschein-seo-tag-robots"); } public function pagedTag($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-tag-robots"); } // search page public function search() { return $this->handleUiDefaults(null, "llg-gutschein-seo-search-robots"); } // archive public function archive() { return $this->handleUiDefaults(null, "llg-gutschein-seo-archive-robots"); } public function pagedArchive($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-archive-robots"); } } function CouponPlugin_HandleRobots() { $robots = ""; // check if merchant forces us to use no-index $coupon = CouponCommon::getCouponByKey(); if ($coupon["shopNoIndex"]) { $robots = "noindex,follow"; } else { // calculate robots $meta = new MetaRobots(); $robots = $meta->handle(); } // always set noindex, follow if "?" in url if (strpos($_SERVER["REQUEST_URI"], "?") != false) $robots = "noindex, follow"; if ($robots) { $out = "\n"; echo $out; } } // $do = get_option("llg-gutschein-seo-enabled"); if ($do == "ja") add_action('wp_head', 'CouponPlugin_HandleRobots'); overrideField = "llg-custom-meta-desc"; } // single post page (NOT a coupon page) public function singlePost () { return $this->handleUiDefaults(null, "llg-gutschein-seo-post-description"); } // single post page for coupons public function couponPage($coupon) { return $this->handleUiDefaults($coupon, "llg-gutschein-seo-gutschein-description"); } public function couponNotFoundPage($domain) { return ""; } // single static content page public function staticPage() { return $this->handleUiDefaults(null, "llg-gutschein-seo-page-description"); } // category page public function category() { return $this->handleUiDefaults(null, "llg-gutschein-seo-category-description"); } public function pagedCategory($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-category-description"); } // tag page public function tag() { return $this->handleUiDefaults(null, "llg-gutschein-seo-tag-description"); } public function pagedTag($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-tag-description"); } // search page public function search() { return $this->handleUiDefaults(null, "llg-gutschein-seo-search-description"); } // archive public function archive() { return $this->handleUiDefaults(null, "llg-gutschein-seo-archive-description"); } public function pagedArchive($page) { return $this->handleUiDefaults(null, "llg-gutschein-seo-paged-archive-description"); } } function CouponPlugin_HandleDesc() { // calculate robots $meta = new MetaDesc(); $desc = $meta->handle(); if ($desc) { $out = "\n"; echo $out; } } // $do = get_option("llg-gutschein-seo-enabled"); if ($do == "ja") add_action('wp_head', 'CouponPlugin_HandleDesc'); $maxlength) { $length = $maxlength; } // set up a counter for how many characters are in the password so far $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, $maxlength-1), 1); // have we already used this character in $password? if (!strstr($password, $char)) { // no, so it's OK to add it onto the end of whatever we've already got... $password .= $char; // ... and increase the counter by one $i++; } } // done! return $password; } // on plugin activate public static function createRequiredResources() { // $dir = dirname(__FILE__)."/../../../logos/120"; if (!is_dir ($dir)) { if (!mkdir($dir, 0777, true)) wp_die("Kann das beschreibbare 'logos' Verzeichnis nicht anlegen unter '$dir'."); } // create database $sql = " CREATE TABLE IF NOT EXISTS `coupon` ( `id` int(11) unsigned NOT NULL auto_increment, `key` varchar(255) default NULL, `shopLink` text, `couponLink` text, `shopName` varchar(255) default NULL, `shopAltKeyword` varchar(255) default NULL, `shopAltKeywordPlural` varchar(255) default NULL, `shopIgnoreFirefox` int(1) unsigned default NULL, `shopDomain` varchar(255) default NULL, `shopMoreDomains` varchar(255) default NULL, `shopImage` varchar(255) default NULL, `value` varchar(255) default NULL, `minOrder` varchar(255) default NULL, `isExclusive` int(1) default NULL, `expiresat` date default NULL, `expiry` int(11) unsigned default NULL, `newCustomer` int(1) unsigned default NULL, `gutscheincode` varchar(255) default NULL, `order` int(11) default NULL, `createdat` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `info_paymentoptions` text, `info_shipmenttype` text, `info_shipmenttime` text, `info_shipmentcost` text, `info_returntime` text, `info_returncost` text, `info_seals` text, `info_slogan` text, `info_formaladress` text, `info_formalname` text, `info_contactphone` text, `info_contactmail` text, `info_contactfax` text, `info_socialyoutube` text, `info_socialblog` text, `info_socialfacebook` text, `info_socialtwitter` text, `coupontype` varchar(255) default NULL, `cleanvalue` varchar(256) default NULL, `ueberId` int(11) default NULL, `updatedat` datetime default NULL, `shopImageMedium` varchar(256) default NULL, `ueberShopId` int(11) default NULL, `shopNoIndex` int(11) default '0', `shopNoIframe` int(11) default '0', `shopHideExpired` int(11) default '0', `shopMinOrderLabel` int(11) default '0', `shopScreenshotUrl` varchar(256) default NULL, `shopCreatedat` datetime default NULL, `shopPermalink` varchar(256) default NULL, `shopNumClicks` int(11) default NULL, `keyword` varchar(256) default NULL, `validFor` varchar(256) default NULL, `information` text, `info_shipmentfree` varchar(256) default NULL, `info_agblink` varchar(256) default NULL, PRIMARY KEY (`id`), KEY `key` (`key`), KEY `shopDomain` (`shopDomain`,`key`) ) ;"; mysql_query($sql); if (mysql_error()) wp_die("Fehler beim Setup der 'coupon'-Tabelle: " . mysql_error()); // $sql = "alter table coupon add column gutscheinDerWoche integer default 0"; mysql_query($sql); } } function llgInternal_upgrade_plugin() { global $LLG_INTERNAL_VERSION; $version = get_option("llg-gutschein-version"); // update version number and call event handler if ($version != $LLG_INTERNAL_VERSION) { update_option("llg-gutschein-version", $LLG_INTERNAL_VERSION); update_option("llg-gutschein-version-installed", date("d.m.Y H:i")); CouponPluginInstallation::onUpdate($version, $LLG_INTERNAL_VERSION); } // no version - first install! if ($version == "") CouponPluginInstallation::onActivate(); } add_action('admin_init', 'llgInternal_upgrade_plugin' ); Page Not Found - WVW.at

Fehler 404 - Seite nicht gefunden