Index: readme.txt
===================================================================
--- readme.txt (revision 101997)
+++ readme.txt (working copy)
@@ -4,7 +4,7 @@
Tags: directory,links,directory links,business directory
Requires at least: 2.7
Tested up to: 2.7
-Stable tag: 1.4.0
+Stable tag: 1.5.0
Add a Business Directory or Directory of Links in different categories and pages.
@@ -19,10 +19,12 @@
Manage the links easily by allowing your users to submit a link. Links can also be added manually.
-The links integrate easily with your own theme. No CSS to configure as it uses the CSS from your current theme. Just customize the way your Links show up with the Built in tags, text and your own html. Put multiple links in each row.
+The links integrate easily with your own theme. No CSS to configure as it uses the CSS from your current theme. Or build your own CSS just for the links. Just customize the way your Links show up with the Built in tags, text and your own html. Put multiple links in each row.
Add a widget to your sidebar with Random Links, Popular Links or Newest Links.
+Keep robot submissions by requiring users to be logged in and solving a Captcha code.
+
== Installation ==
1. Upload entire directory to the `/wp-content/plugins/` directory
@@ -40,6 +42,9 @@
13. Add Random Links widget to your sidebar.
14. Configure the Random Links widget with the edit link.
15. Save the sidebar changes.
+16. Customize the link layout in the options menu
+17. Customize the submit form in the options menu
+18. Signup for a reCaptcha key and activate the Captcha for the submission form.
== Screenshots ==
Index: stw.class.php
===================================================================
--- stw.class.php (revision 0)
+++ stw.class.php (revision 0)
@@ -0,0 +1,189 @@
+$v)
+ if (!isset($args[$k]))
+ $args[$k] = $v;
+
+ $args["stwUrl"] = $url; // now url is last
+
+ #$request_url = urldecode("http://www.shrinktheweb.com/xino.php?".http_build_query($args));
+ $request_url = urldecode("http://www.shrinktheweb.com/xino.php?".http_build_query($args,'','&')); // avoid &
+
+ $line = self::make_http_request($request_url);
+
+ if ($debug) {
+ echo '
';
+ }
+
+ $regex = '/<[^:]*:Thumbnail\\s*(?:Exists=\"((?:true)|(?:false))\")?[^>]*>([^<]*)<\//';
+
+ if (preg_match($regex, $line, $matches) == 1 && $matches[1] == "true")
+ return $matches[2];
+
+ return null;
+ }
+
+ /**
+ * Refreshes the thumbnail if it is expired or creates it if it does
+ * not exist. There is no cleanup of the thumbnails for ones that don't
+ * get used again, e.g. find /static/images/thumbnails -type f -mtime +7 -delete
+ *
+ * Every combination of url and call arguments results in a unique filename
+ * through a MD5 hash. The size argument can also be an array where you can
+ * add any parameter you wish to the request, or override any default.
+ *
+ * It is up to the calling function to decide what to do with the results when
+ * a null is returned. I often store the src in a database with a timestamp so
+ * that I do not bombard the server with repeated requests for a thumbnail that
+ * doesn't yet exist, although STW is very fast at processing.
+ *
+ * @param string $url URL to get thumbnail for
+ * @param array $args Array of parameters to use
+ * @param boolean $force Force call to bypass cache, was used for debugging
+ * @return string Local SRC URI for the thumbnail.
+ */
+ public static function getThumbnail($url, $args = null, $force = false) {
+ $args = $args ? $args : array("Size"=>"lg");
+ $name = md5($url.serialize($args)).".jpg";
+ $src = self::THUMBNAIL_URI."/$name";
+ $path = self::THUMBNAIL_DIR.$src;
+ $cutoff = time() - 3600 * 24 * self::CACHE_DAYS;
+
+ if ($force || !file_exists($path) || filemtime($path) <= $cutoff)
+ if (($jpgurl = self::queryRemoteThumbnail($url, $args)))
+ if (($im = imagecreatefromjpeg($jpgurl)))
+ imagejpeg($im, $path, 100);
+
+ if (file_exists($path))
+ return $src;
+
+ return null;
+ }
+
+ /**
+ * Always retrieves the X-Large thumbnail from STW, then uses
+ * local gd library to create arbitrary sized thumbnails.
+ *
+ * By passing the same arguments used for small/large should
+ * generate cache hits so the only size every retrieved would
+ * be xlg.
+ *
+ * @param string $url URL to get thumbnail for
+ * @param string $width The desired image width
+ * @param string $height The desired image height
+ * @param string $args Used to make name same as sm/lg fetches.
+ */
+ public static function getScaledThumbnail($url, $width, $height, $args = null, $force) {
+ $args = $args ? $args : array("width"=>$width, "height"=>$height);
+ $name = md5($url.serialize($args)).".jpg";
+ $src = self::THUMBNAIL_URI."/$name";
+ $path = self::THUMBNAIL_DIR.$src;
+ $cutoff = time() - 3600 * 24 * self::CACHE_DAYS;
+
+ if ($force || !file_exists($path) || filemtime($path) <= $cutoff)
+ if (($xlg = self::getXLargeThumbnail($url)))
+ if (($im = imagecreatefromjpeg(self::THUMBNAIL_DIR.$xlg))) {
+ list($xw, $xh) = getimagesize(self::THUMBNAIL_DIR.$xlg);
+ $scaled = imagecreatetruecolor($width, $height);
+
+ if (imagecopyresampled($scaled, $im, 0, 0, 0, 0, $width, $height, $xw, $xh))
+ imagejpeg($scaled, $path, 100);
+ }
+
+ if (file_exists($path))
+ return $src;
+
+ return null;
+ }
+
+ /**
+ * Convenience Function for custom sized requests
+ *
+ * @param string $url URL to get thumbnail for
+ */
+ public static function getCustomThumbnail($url) {
+ return self::getThumbnail($url, array("xmax"=>"YYY"));
+ }
+
+ /**
+ * Convenience Function for 320x240
+ *
+ * @param string $url URL to get thumbnail for
+ */
+ public static function getXLargeThumbnail($url) {
+ return self::getThumbnail($url, array("Size"=>"xlg"));
+ }
+
+ /**
+ * Convenience Function for 200x150
+ *
+ * @param string $url URL to get thumbnail for
+ * @param boolean $scaler Scale image from xlg
+ */
+ public static function getLargeThumbnail($url, $scaler = true, $force = false) {
+ if ($scaler)
+ return self::getScaledThumbnail($url, 200, 150, array("Size"=>"lg"), $force);
+
+ return self::getThumbnail($url);
+ }
+
+ /**
+ * Convenience Function for 120x90
+ *
+ * @param string $url URL to get thumbnail for
+ * @param boolean $scaler Scale image from xlg
+ */
+ public static function getSmallThumbnail($url, $scaler = true, $force = false) {
+ if ($scaler)
+ return self::getScaledThumbnail($url, 120, 90, array("Size"=>"sm"), $force);
+
+ return self::getThumbnail($url, array("Size"=>"sm"));
+ }
+}
+
+?>
\ No newline at end of file
Index: wp-directory-countries-list.php
===================================================================
--- wp-directory-countries-list.php (revision 101997)
+++ wp-directory-countries-list.php (working copy)
@@ -12,41 +12,47 @@
* - Version 1.0.1 *
* *
*********************************************************************/
-global $wpdb;
-$country_table = $wpdb->prefix .'directory_country_list';
+function get_country_options($editcountry=null){
-if(''!=get_option('directory_country')){
+ global $wpdb;
+ $country_table = $wpdb->prefix .'directory_country_list';
+ $results = '';
+
+
if($editcountry){
-
+
$sql = "SELECT name FROM $country_table WHERE iso3='".$editcountry."'";
+ $get_country = $wpdb->get_results($sql);
+ $results .= '';
+
+ }elseif(''!=get_option('directory_country')){
+ $sql = "SELECT name FROM $country_table WHERE iso3='".get_option('directory_country')."'";
+ $get_country = $wpdb->get_results($sql);
+ $results .= '';
+
}else{
-
- $sql = "SELECT name FROM $country_table WHERE iso3='".get_option('directory_country')."'";
-
+
+ $results .= '';
+
}
- $get_country = $wpdb->get_results($sql);
-
-?>
-
-
-
-
-
-get_results($sql);
+ $results .= '';
-if($get_countries){
- foreach($get_countries as $countries){
- ?>
- get_results($sql);
+
+ if($get_countries){
+ foreach($get_countries as $countries){
+
+ $results .= '';
+
+ }
+
+ }
+
+ return $results;
+
}
- }?>
\ No newline at end of file
+ ?>
\ No newline at end of file
Index: wp-directory-form-html.php
===================================================================
--- wp-directory-form-html.php (revision 101997)
+++ wp-directory-form-html.php (working copy)
@@ -20,142 +20,67 @@
require_once('recaptchalib.php');
$publickey = get_option('recap_pub');
-?>
-
-
-
if ( $login_allowed || !get_option('directory_requireuser')) {
- _e('Please fill out completely. All fields are required. Once submitted, your link will be evaluated. It may take up to 48 hours for your link to be included.', 'wp-directory-list');
-?>
+include(dirname(__FILE__).'/wp-directory-countries-list.php');
-
-
-