Commits

simplemediacode committed a99d7e5

Compatibility with NextGen gallery

Comments (0)

Files changed (3)

admin/adminipwp.php

 	<a href="http://twitter.com/SimpleMediaCode" target="_blank">Follow @SimpleMediaCode</a> | 
 	Freelance WordPress developer <a href="http://umbrovskis.com/" target="_blank">Rolands Umbrovskis</a>
 </p>
+
+
+<p>Coming soon: <strong>itempropWP theme</strong> (free and paid versions)! <a href="http://simplemediacode.org/forums/forum/itempropwp-wordpress-theme-support/itempropwp-wordpress-theme-feature-requests/?utm_source=<?php echo esc_url(get_home_url());?>&utm_medium=link&utm_campaign=itempropWP-WordPress-theme-feature-requests-<?php echo SMCIPWPV;?>&utm_content=<?php echo 'WordPress-plugin-'.SMCIPWPF.'-'.SMCIPWPV;?>">itempropWP WordPress theme feature requests</a></p>
+
 </div><?php } // smcwpd_settings()
 <?php 
 /**
-Plugin Name: itemprop WP for SERP/SEO Rich snippets
-Plugin URI: http://simplemediacode.com/wordpress-pugins/itemprop-wp/?utm_source=wordpress&utm_medium=wpplugin&utm_campaign=itempropWP&utm_content=v-3.3.0-itempropWP_load_widgets
-Description: Add human invisible schema.org itemprop code to images
-Version: 3.3.1
+Plugin Name: itemprop WP for SERP (and SEO) Rich snippets
+Plugin URI: http://simplemediacode.com/wordpress-pugins/itemprop-wp/?utm_source=wordpress&utm_medium=wpplugin&utm_campaign=itempropWP&utm_content=v-3.3.2-itempropWP_load_widgets
+Description: Add human invisible schema.org code to conent
+Version: 3.3.2
 Requires at least: 3.3
 Tested up to: 3.5
 Author: Rolands Umbrovskis
 License: simplemediacode
 License URI: http://simplemediacode.com/license/gpl/
 
-Copyright (C) 2008-2012, Rolands Umbrovskis - rolands@simplemediacode.com
+Copyright (C) 2008-2013, Rolands Umbrovskis - rolands@simplemediacode.com
 
 */
-	define('SMCIPWPV','3.3.1'); // location general @since 1.0
+	define('SMCIPWPV','3.3.2'); // location general @since 1.0
 	define('SMCIPWPM',dirname(__FILE__)); // location general @since 1.0
 	define('SMCIPWPF','itempropwp'); // location folder @since 1.0 
 	define('IPWPT',__('itemprop WP for SERP/SEO Rich snippets','itempropwp')); // Name @since 1.1
 */
 	$plugref='?utm_campaign='.SMCIPWPF.'&utm_content='.SMCIPWPF.'-'.SMCIPWPV.'&utm_medium=link&utm_source='.SMCIPWPF.'-plugin';
 	if(WPLANG=='lv'){ 
-		//define('IPWPT_HOMEPAGE','http://mediabox.lv/wordpress-pugins/itemprop-wp/'.$plugref); // Homepage @since 3.1
 		define('IPWPT_HOMEPAGE','http://simplemediacode.com/wordpress-pugins/itemprop-wp/'.$plugref); // Homepage @since 3.1.4
 		define('IPWPT_HOMEPAGEC','http://simplemediacode.com/wordpress-pugins/itemprop-wp/'); // Homepage @since 3.3.0
 	}else{
 					'<a href="http://simplemediacode.org/forums/forum/itempropwp-plugin/">' . __("Support Forum","itempropwp") . '</a>',
 					'<a href="'.IPWPT_VERSUPPORT.'">' . sprintf(__("Support for version %s","itempropwp"),SMCIPWPV) . '</a>',
 					'<a href="http://simplemediacode.org/forums/forum/itempropwp-plugin/suggestions-for-itempropwp/">' . __('Feature request') . '</a>',
-					//'<a href="http://simplemediacode.org/forums/forum/itempropwp-plugin/">' . __("Join Members group","itempropwp") . '</a>',
+					// '<a href="http://simplemediacode.org/forums/forum/itempropwp-plugin/">' . __("Join Members group","itempropwp") . '</a>',
 				));
 			}
 			return $links;
 		}
 
 
-	/*
-	 * if post has no excerpt, we will use this
-	 * @Todo rewrite
-	 * @since 3.1
-	*/
+/*
+ * if post has no excerpt, we will use this
+ * @Todo rewrite
+ * @since 3.1
+*/
 		public function ipwp_excerpt_maxchr($charlength=170,$ipwp_content='') {
 			/* did we get content? No, let's make it from post */
 			if($ipwp_content==''){
 			}
 
 		}
-		
+/** indevd:As a NextGen Gallery user, I encountered a problem showing my image URL for post where postthumbnail was not uploaded to the WP media gallery but picked from the NextGen Gallery.
+ * http://wordpress.org/support/topic/mod-for-nextgen-gallery-users?replies=2#post-3807567
+ * @since 3.3.2
+ * @author indevd
+ * @date 2013-02-06
+*/
+		public function itempropwp_get_image_path($post_id) {
+			if(!$post_id||$post_id==''){
+				global $post;
+				$post_id = $post->ID;
+			}
+			$id = get_post_thumbnail_id($post_id);
+			
+			if(stripos($id,'ngg-') !== false && class_exists('nggdb')){
+				$nggImage = nggdb::find_image(str_replace('ngg-','',$id));
+				$thumbnail = array(
+					$nggImage->imageURL,
+					$nggImage->width,
+					$nggImage->height
+				);
+			} else {
+				$thumbnail = wp_get_attachment_image_src($id,'full');
+				//$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
+			}
+			$theimage = $thumbnail[0];
+			$theimage = str_replace('?uamfiletype=nggImage','',$theimage);
+			return apply_filters('ipwp_post_imguri', $theimage);
+		}
 		public function ipwp_the_content_filter($content) {
 			if (is_singular() && !is_feed()){
 				global $post;
-				/* var_dump($post); */
+				$post_id = $post->ID;
 	
-				$thisipwp_post = get_post($post->ID);
+				$thisipwp_post = get_post($post_id);
 				$ipwp_posth = '';
 				$ipwp_image = '';
 				$showcommcount = '';
 
 				$ipwp_post_dsc = apply_filters('ipwp_post_dsc', $thisipwp_post->post_excerpt);
 				if (function_exists('has_post_thumbnail')) {
-					if ( has_post_thumbnail($post->ID)) {
-						$ipwp_post_imga = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full'); // all other sizes are not permanent :| 
-						$ipwp_posth = apply_filters('ipwp_post_imguri', $ipwp_post_imga[0]); // image link + Extending @since 3.1
+					if ( has_post_thumbnail($post_id)) {
+						$itempropwpimg = new itempropwp;
+						$ipwp_posth = $itempropwpimg->itempropwp_get_image_path($post_id);
+						// removed @since 3.3.2 replaced with  itemprop_get_image_path()
+						//$ipwp_post_imga = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full'); // all other sizes are not permanent :| 
+						//$ipwp_posth = apply_filters('ipwp_post_imguri', $ipwp_post_imga[0]); // image link + Extending @since 3.1
 					}
 				}
 				
 				
 				if($ipwp_posth){
-					$ipwp_image = '<meta itemprop="image" content="'.esc_url($ipwp_posth).'" />'."\n\t";
+					$ipwp_image = '<meta itemprop="image" content="'.esc_url($ipwp_posth).'" />';
 				}
 	
 				if(!$ipwp_post_dsc){
 				}
 				$postauthoris = esc_url($smcipwp_author_link);
 				
-				$xfactorer = apply_filters('itempropwp_article_content_before','<span itemscope itemtype="http://schema.org/Article" class="itempropwp-wrap"><!-- ItemProp WP '.SMCIPWPV.' by Rolands Umbrovskis http://umbrovskis.com --><meta itemprop="name" content="'.esc_attr($thisipwp_post->post_title).'"><meta itemprop="url" content="'.esc_url(get_permalink()).'">'
+				$ipwp_contentx = apply_filters('itempropwp_article_content_before','<span itemscope itemtype="http://schema.org/Article" class="itempropwp-wrap"><!-- ItemProp WP '.SMCIPWPV.' by Rolands Umbrovskis http://umbrovskis.com/ --><meta itemprop="name" content="'.esc_attr($thisipwp_post->post_title).'"><meta itemprop="url" content="'.esc_url(get_permalink()).'">'
 	.$ipwp_image.'<meta itemprop="author" content="'.$postauthoris.'"><meta itemprop="description" content="'.strip_tags(str_replace(array("\r\n", "\n", "\r", "\t"), "", $ipwp_post_dsc)).'"><meta itemprop="datePublished" content="'.esc_attr($thisipwp_post->post_date).'">'
 	.$ipwp_datemodified
-	.$showcommcount.'<!-- ItemProp WP '.SMCIPWPV.' by Rolands Umbrovskis http://umbrovskis.com end --></span>');
+	.$showcommcount.'<!-- ItemProp WP '.SMCIPWPV.' by Rolands Umbrovskis http://umbrovskis.com/ end --></span>');
 
-				$content = $content.$xfactorer;
+				$content = $content.$ipwp_contentx;
 				$content = apply_filters('itempropwp_article_content', $content);
 				
 				return $content;
 	
 	}
 //}
-
+/* itemprop Review */
 include_once(SMCIPWPM.'/itemprop_review.php');
+/* itemprop Person */
+/* itemprop LocalBusiness */
+/* itemprop RealEstateAgent */
 Tags: SEO, schema, schema.org, itemprop, schema.org itemprop, images, microdata, rich snippets, richsnippets, SERP, html5, structured data
 Requires at least: 3.3
 Tested up to: 3.5
-Stable tag: 3.3.1
+Stable tag: 3.3.2
 License: simplemediacode
 License URI: http://simplemediacode.com/license/gpl/
 
 
 This plugin is very simple. Using WordPress built in function to filter element attributes and adding < meta > tags with schema.org item properties.
 
+Coming soon: **itempropWP theme** (free and paid versions)! (itempropWP WordPress theme feature requests)[http://simplemediacode.org/forums/forum/itempropwp-wordpress-theme-support/itempropwp-wordpress-theme-feature-requests/?utm_source=http://wordpress.org/extend/plugins/itempropwp/&utm_medium=link&utm_campaign=itempropWP-WordPress-theme-feature-requests-3.3.2&utm_content=WordPress-plugin-itempropwp-3.3.2]
+
 Example output:
 
 `
 <span itemscope itemtype="http://schema.org/Article" class="itempropwp-wrap">
-<!-- Itemprop WP 3.3.1 by Rolands Umbrovskis http://umbrovskis.com -->
+<!-- Itemprop WP 3.3.2 by Rolands Umbrovskis http://umbrovskis.com -->
  <meta itemprop="name" content="Title of the Article" />
  <meta itemprop="url" content="http://example.com/seo-optimized-article/" />
  <meta itemprop="image" content="http://example.com/images/example.jpg" />
  <meta itemprop="datePublished" content="2012-09-13 19:17:21" />
  <meta itemprop="dateModified" content="2012-09-29 13:33:25" />
  <meta itemprop="interactionCount" content="UserComments:356" />
-<!-- Itemprop WP 3.3.1 by Rolands Umbrovskis http://umbrovskis.com end -->
+<!-- Itemprop WP 3.3.2 by Rolands Umbrovskis http://umbrovskis.com end -->
 </span>
 `
 
 
 == Changelog ==
 
+= 3.3.2 =
+
+* Compatibility with NextGen gallery. Thanks to [indevd](http://wordpress.org/support/topic/mod-for-nextgen-gallery-users?replies=2#post-3807567)
+
 = 3.3.1  =
 
 * Review summary fix
 
 == Upgrade Notice ==
 
+= 3.3.2 =
+
+* Compatibility with NextGen gallery. Thanks to [indevd](http://wordpress.org/support/topic/mod-for-nextgen-gallery-users?replies=2#post-3807567)
+
 = 3.3.1  =
 
 * Review summary fix