loadHTMLFile($url); $doc2 = file_get_contents($url);// Get all link tags in an object $stylelink = $doc->getElementsByTagName('link');// Go through each link tag and see if it's a 'stylesheet' foreach($stylelink as $item){ if($item->attributes->getNamedItem('rel')->nodeValue == "stylesheet"){ // If it is a stylesheet, get the css link and see if it's named 'style.css' (wordpress naming convention) $href = $item->attributes->getNamedItem('href')->nodeValue; if(preg_match("/(.*)style.css(.*)/", $href)){ // See if the link is relative or not, make it useable if(preg_match("/http(.*)/", $href)){ $styleurl = $href; }else { $styleurl = $url . $href; }// Access the style.css file we found from the link tag $themecss = file_get_contents($styleurl);// Get values for our display variables from the css header if(preg_match("/Theme Name(.*)\n/", $themecss, $match)){ $themename = substr($match[0], 12); } if(preg_match("/Theme URI(.*)\n/", $themecss, $match)){ $themesite = substr($match[0], 11); // If it links to themeforest.net, add the smashthemes referral if(preg_match("/themeforest.net/", $themesite, $match)){ $themesite = $themesite . "?ref=smashthemes"; } } if(preg_match("/Description(.*)\n/", $themecss, $match)){ $themedescription = substr($match[0], 13); } if(preg_match("/Author(.*)\n/", $themecss, $match)){ $themeauthor = substr($match[0], 8); } if(preg_match("/Author URI(.*)\n/", $themecss, $match)){ $themeauthorsite = substr($match[0], 12); // If it links to themeforest.net, add the smashthemes referral if(preg_match("/themeforest.net/", $themeauthorsite, $match)){ $themeauthorsite = $themeauthorsite . "?ref=smashthemes"; } } if(preg_match("/Tags(.*)\n/", $themecss, $match)){ $themetags = substr($match[0], 5); } } } }// Search the file for the common wordpress theme filing convention and extract the name from the file path if(preg_match_all("/\/wp-content\/themes\/[A-Za-z0-9_-]+\//", $doc2, $matches)){ foreach($matches as $match){ // Make sure we don't run through duplicate theme links $match = array_unique($match); foreach($match as $mat){ // If we didn't find a theme name from our $doc link search, make the file path title our theme name if($themename == "No Wordpress Themes Found!"){ $themename = substr($mat, 19, -1); }// Construct and test the style.css url $stylesheetcss = $url . $mat . "style.css";if(remoteFileExists($stylesheetcss)){// Access the style.css file we just found $themecss = file_get_contents($stylesheetcss);// Get values for our display variables from the css header if(preg_match("/Theme Name(.*)\n/", $themecss, $match)){ $themename = substr($match[0], 12); } if(preg_match("/Theme URI(.*)\n/", $themecss, $match)){ $themesite = substr($match[0], 11); // If it links to themeforest.net, add the smashthemes referral if(preg_match("/themeforest.net/", $themesite, $match)){ $themesite = $themesite . "?ref=smashthemes"; } } if(preg_match("/Description(.*)\n/", $themecss, $match)){ $themedescription = substr($match[0], 13); } if(preg_match("/Author(.*)\n/", $themecss, $match)){ $themeauthor = substr($match[0], 8); } if(preg_match("/Author URI(.*)\n/", $themecss, $match)){ $themeauthorsite = substr($match[0], 12); // If it links to themeforest.net, add the smashthemes referral if(preg_match("/themeforest.net/", $themeauthorsite, $match)){ $themeauthorsite = $themeauthorsite . "?ref=smashthemes"; } } if(preg_match("/Tags(.*)\n/", $themecss, $match)){ $themetags = substr($match[0], 5); } } } } }// Search the file for the common wordpress theme filing convention and extract the name from the file path if(preg_match_all("/\/wp-content\/themes\/[A-Za-z0-9_-]+\//", $doc2, $matches)){ foreach($matches as $match){ // Make sure we don't run through duplicate theme links $match = array_unique($match); foreach($match as $mat){ // If we didn't find a theme name from our $doc link search, make the file path title our theme name if($themename == "No Wordpress Themes Found!"){ $themename = substr($mat, 19, -1); } // If we find our theme in the database, assign the database information to our display variables if($results = mysqli_query($con, "SELECT * FROM themes WHERE name LIKE '%" . substr($mat, 19, -1) . "%'")){ while($result = mysqli_fetch_array($results)){ $themename = $result["name"]; // If we didn't find a description with our $doc link search, use the database description if($themedescription == "No description found."){ $themedescription = $result["description"]; } $themeimageurl = $result["image"]; $themesite = $result["url"]; $themeauthor = $result["author"]; $themeauthorsite = $result["url"]; $themetags = $result["tags"]; // If it's a themeforest.net theme, add the smashthemes referral if($themeauthor == "Themeforest.net"){ $themesite = $themesite . "?ref=smashthemes"; $themeauthorsite = $themeauthorsite . "?ref=smashthemes"; } } } // Search for the wordpress standard 'screenshot.png' and if it's in the theme folder use it instead of the database image if(remoteFileExists($url . "/wp-content/themes/" . substr($mat, 19, -1) . "/screenshot.png")){ $themeimageurl = $url . "/wp-content/themes/" . substr($mat, 19, -1) . "/screenshot.png"; } } } }// Find any mentions of 'theme.wordpress.com' themes and extract that information for our display variables if(preg_match_all("/theme.wordpress.com\/themes\/[A-Za-z0-9_-]+\//", $doc2, $matches)){ foreach($matches as $match){ // Make sure we don't run through duplicate theme links $match = array_unique($match); foreach($match as $mat){ // If we find one, initially assign the path title for the theme name $themename = substr($mat, 27, -1); // If the theme page linked to exists, assign the meta data found within to our display variables if(remoteFileExists("http://" . $mat)){ $themedoc = new DOMDocument(); @$themedoc->loadHTMLFile("http://" . $mat);$metatags = $themedoc->getElementsByTagName('meta'); foreach($metatags as $meta){ if($meta->attributes->getNamedItem('property')->nodeValue == "og:title"){ $themename = $meta->attributes->getNamedItem('content')->nodeValue; } if($meta->attributes->getNamedItem('property')->nodeValue == "og:description"){ $themedescription = $meta->attributes->getNamedItem('content')->nodeValue; } if($meta->attributes->getNamedItem('property')->nodeValue == "og:url"){ $themesite = $meta->attributes->getNamedItem('content')->nodeValue; } // Make sure the author is named as WordPress.com instead of a blank if($meta->attributes->getNamedItem('property')->nodeValue == "og:url"){ $themeauthor = "WordPress.com"; $themeauthorsite = $meta->attributes->getNamedItem('content')->nodeValue; } if($meta->attributes->getNamedItem('property')->nodeValue == "og:image"){ $themeimageurl = $meta->attributes->getNamedItem('content')->nodeValue; } } } } } } } }get_header(); echo td_page_generator::wrap_start(); ?>
WordPress Theme Finder
URL :
WordPress Theme Info for
Theme Name :
Description :
Theme Site :
Author :
Author Site :
Tags :
Get This Theme Now!


COLLECTIONS