Commits

simplemediacode committed a952bff

add: RC 3.3.0

Comments (0)

Files changed (6)

admin/adminipwp.php

 		<th valign="top"><?php _e('Author link','itempropwp');?></th>
 		<td valign="top">
 			<input type="text" id="smcipwp_author_link" name="smcipwp_author_link" value="<?php echo $smcipwp_author_link;?>" /><br />
-			<?php _e('if there is only 1 author and You would like to link to ano ther author page in itemprop','itempropwp');?>. 
+			<?php _e("if there is only 1 author and You would like to link to another author page in itemprop","itempropwp");?>. 
 			<?php 
 			printf(
-				__( 'leave empty and we will use default author page link %s','itempropwp' ),
-				get_home_url().'/author/'.$iareuser
+				__( 'Leave empty and we will use default author page link %s','itempropwp' ),
+				'<strong>'.get_home_url().'/author/'.$iareuser.'</strong>'
 			);
 			?>
 		</td>

itemprop_review.php

 		add_action('init', array( 'itempropwp_review', 'reviewinit' ),10);	
 	}
 	
+	private function reviewvers(){
+		return '1.0.0';
+	}
+
 	public function reviewinit() {
-		add_filter('article_content_before', array( 'itempropwp_review', 'review' ), 11); // Adding context @since 3.0
+		add_filter('itempropwp_article_content_before', array( 'itempropwp_review', 'review' ), 11); // Adding context @since 3.0
+		add_filter('add_meta_boxes', array( 'itempropwp_review', 'itempropwp_review_metabox' ), 11); // Adding context @since 3.3.0
+		add_filter('save_post', array( 'itempropwp_review', 'itempropwp_review_save' ), 11); // Adding context @since 3.3.0
 	}
 	
 	public function review($content){
 		if (is_singular() && !is_feed()){
 			global $post;
-			//$ipwprprefix = 'ipwp_';
+			
+			$reviewinit = new itempropwp_review;
+			$reviewv = $reviewinit->reviewvers();
+			
+			
+			$ipwprprefix = 'ipwp_';
 			$reviewid = $post->ID;
 			$reviewpost = get_post($post->ID);
 			$reviewname = get_post_meta($reviewid, $ipwprprefix.'product_name', true);
 			$reviewprice = get_post_meta($reviewid, $ipwprprefix.'product_price', true);
 			$reviewcurrency = get_post_meta($reviewid, $ipwprprefix.'currency', true);
-			$reviewrating = (float)get_post_meta($reviewid, $ipwprprefix.'rating', true);
+			$reviewrating = get_post_meta($reviewid, $ipwprprefix.'rating', true);
+			$reviewonoff = get_post_meta($reviewid, $ipwprprefix.'reviewonoff', true);
 			$newcontent = '';
 			$pricerows='';
 			$reviewratingrow='';
 			
-			if(!$reviewname){$reviewname = $reviewpost->post_title;}
-			if($reviewprice && $reviewcurrency){
-				$pricerows = '<span itemprop="offers" itemscope itemtype="http://schema.org/Offer"><meta itemprop="price" content="'.$reviewprice.'" /><meta itemprop="priceCurrency" content="'.$reviewcurrency.'" /><link itemprop="availability" href="http://schema.org/InStock" /></span>';
-			}
+			$itemrating = $reviewrating['rate'];
 			
-			if($reviewrating){
-				$reviewratingrow = '<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><meta itemprop="ratingValue" content="4.5" /><meta itemprop="bestRating" content="5" /></span>';
+			if($reviewonoff['onoff']=="on"){
+				if(!$reviewname){$reviewname = $reviewpost->post_title;}
+				if($reviewprice && $reviewcurrency){
+					$pricerows = '<span itemprop="offers" itemscope itemtype="http://schema.org/Offer"><meta itemprop="price" content="'.$reviewprice.'" /><meta itemprop="priceCurrency" content="'.$reviewcurrency.'" /><link itemprop="availability" href="http://schema.org/InStock" /></span>';
+				}
+				
+				if($reviewrating){
+					$reviewratingrow = '<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><meta itemprop="ratingValue" content="'.$itemrating.'" /><meta itemprop="bestRating" content="5" /></span>';
+				}
+	
+				
+				$newcontent .= '<span itemprop="review" itemscope itemtype="http://schema.org/Review"><meta itemprop="name" content="'.esc_attr($reviewpost->post_title).'" /><meta itemprop="author" content="'.esc_attr(get_the_author_meta( 'display_name', $reviewpost->post_author )).'" /><meta itemprop="datePublished" content="'.esc_attr($reviewpost->post_date).'" />'
+				.$reviewratingrow.'<span itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product"><meta itemprop="name" content="'.esc_attr($reviewname).'" />'
+				.$pricerows.'</span><meta itemprop="description" content="'.esc_attr($reviewpost->post_excerpt).'" /></span>';
+
+				$content = "\n".'<!-- '.IPWPTSN.' '.SMCIPWPV.'/ Review '.$reviewv.' by Rolands Umbrovskis '.IPWPT_HOMEPAGEC.' -->'.$newcontent.'<!-- '.IPWPTSN.' '.SMCIPWPV.'/ Review '.$reviewv.' end -->'."\n";
 			}
-			/*
-			$newcontent .= '<span itemprop="review" itemscope itemtype="http://schema.org/Review"><meta itemprop="name" content="'.esc_attr($reviewpost->post_title).'" /><meta itemprop="author" content="'.esc_attr(get_the_author_meta( 'display_name', $reviewpost->post_author )).'" /><meta itemprop="datePublished" content="'.esc_attr($reviewpost->post_date).'" />'
-			.$reviewratingrow.'<span itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product"><meta itemprop="name" content="'.esc_attr($reviewname).'" />'
-			.$pricerows.'</span><meta itemprop="description" content="'.esc_attr($reviewpost->post_excerpt).'" /></span>';
-			*/
-			
-			$newcontent .= '<span itemprop="review" itemscope itemtype="http://schema.org/Review"><meta itemprop="name" content="'.esc_attr($reviewpost->post_title).'" /><meta itemprop="author" content="'.esc_attr(get_the_author_meta( 'display_name', $reviewpost->post_author )).'" /><meta itemprop="datePublished" content="'.esc_attr($reviewpost->post_date).'" />'
-			.'<span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><meta itemprop="ratingValue" content="4.5" /><meta itemprop="bestRating" content="5" /></span>'.'<span itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product"><meta itemprop="name" content="'.esc_attr($reviewname).'" />'
-			.'<span itemprop="offers" itemscope itemtype="http://schema.org/Offer"><meta itemprop="price" content="56.25" /><meta itemprop="priceCurrency" content="EUR" /><link itemprop="availability" href="http://schema.org/InStock" /></span>'.'</span><meta itemprop="description" content="'.esc_attr($reviewpost->post_excerpt).'" /></span>';
 
-			//$content = $content."\n".'<!-- review -->'.$newcontent.'<!-- review end -->'."\n";
-			$content = "\n".'<!-- review -->'.$newcontent.'<!-- review end -->'."\n";
 				return $content;
 			}
 			return $content;
 	}
+	
+	public function itempropwp_review_metabox(){
+		$ipwprprefix = 'ipwp_';
+
+		add_meta_box($ipwprprefix.'postbox_review', sprintf(__( "%s Review","itempropwp" ),IPWPTSN), array( 'itempropwp_review', 'ipwp_cpbox' ),'post', 'normal', 'high');
+		add_meta_box($ipwprprefix.'pagebox_review', sprintf(__( "%s Review","itempropwp" ),IPWPTSN), array( 'itempropwp_review', 'ipwp_cpbox' ),'page', 'normal', 'high');
+	}
+	function ipwp_cpbox( $post ) {
+		$ipwprprefix = 'ipwp_';
+		wp_nonce_field( plugin_basename( __FILE__ ), $ipwprprefix.'pt_post_nonce' );
+
+		echo '<table class="form-table"><tbody>';
+		$reviewonoff = get_post_meta( $post->ID, $ipwprprefix.'reviewonoff', true);
+		$rating = get_post_meta( $post->ID, $ipwprprefix.'rating', true);
+
+		echo '<tr>';
+		echo '<th scope="row"><div class="'.$ipwprprefix.'postcbox-label">';
+		echo '<label for="'.$ipwprprefix.'reviewonoff">'.__("On/Off of item","itempropwp" ).'</label> ';
+		echo '</div></th>';
+			echo '<td>';
+				echo '<div class="'.$ipwprprefix.'postcbox-input">';
+					echo '<select name="'.$ipwprprefix.'reviewonoff[onoff]" id="'.$ipwprprefix.'reviewonoff">';
+						echo '<option value="on" '.selected($reviewonoff['onoff'], "on", false).'>On</option>';
+						echo '<option value="off" '.selected($reviewonoff['onoff'], "off", false).'>Off</option>';
+					echo '</select>';
+				echo '</div>';
+			echo '</td>';
+		echo '</tr>';
+		
+		echo '<tr>';
+			echo '<th scope="row">';
+				echo '<div class="'.$ipwprprefix.'postcbox-label">';
+					echo '<label for="'.$ipwprprefix.'product_name">'.__("Name of item","itempropwp" ).'</label>';
+				echo '</div>';
+			echo '</th>';
+			echo '<td>';
+				echo '<div class="'.$ipwprprefix.'postcbox-input">';
+					echo '<input type="text" id="'.$ipwprprefix.'product_name" name="'.$ipwprprefix.'product_name" value="'.esc_attr(get_post_meta( $post->ID, $ipwprprefix.'product_name', true)).'" size="25" class="large-text" />';
+				echo '</div>';
+			echo '</td>';
+		echo '</tr>';
+		
+		echo '<tr>';
+			echo '<th scope="row">';
+				echo '<div class="'.$ipwprprefix.'postcbox-label">';
+					echo '<label for="'.$ipwprprefix.'product_price">'.__("Price of item","itempropwp" ).'</label> ';
+				echo '</div>';
+			echo '</th>';
+			echo '<td><div class="'.$ipwprprefix.'postcbox-input"><input type="text" id="'.$ipwprprefix.'product_price" name="'.$ipwprprefix.'product_price" value="'.esc_attr(get_post_meta( $post->ID, $ipwprprefix.'product_price', true)).'" size="25" /></div></td>';
+		echo '</tr>';
+		
+		echo '<tr><th scope="row"><div class="'.$ipwprprefix.'postcbox-label">';
+			echo '<label for="'.$ipwprprefix.'currency">'.__("Currency of item","itempropwp" ).'</label> ';
+		echo '</div></th>';
+		echo '<td><div class="'.$ipwprprefix.'postcbox-input"><input type="text" id="'.$ipwprprefix.'currency" name="'.$ipwprprefix.'currency" value="'.esc_attr(get_post_meta( $post->ID, $ipwprprefix.'currency', true)).'" size="25" /></div></td></tr>';
+		
+		echo '<tr><th scope="row"><div class="'.$ipwprprefix.'postcbox-label">';
+			echo '<label for="'.$ipwprprefix.'rating">'.__("Rating of item","itempropwp" ).'</label> ';
+		echo '</div></th>';
+		echo '<td><div class="'.$ipwprprefix.'postcbox-input">
+		<select name="'.$ipwprprefix.'rating[rate]" id="'.$ipwprprefix.'reviewonoff">
+			<option value="0"	'.selected($rating['rate'], "0",	false).'>0.0</option>
+			<option value="0.5" '.selected($rating['rate'], "0.5",	false).'>0.5</option>
+			<option value="1.0" '.selected($rating['rate'], "1.0",	false).'>1.0</option>
+			<option value="1.5" '.selected($rating['rate'], "1.5",	false).'>1.5</option>
+			<option value="2.0" '.selected($rating['rate'], "2.0",	false).'>2.0</option>
+			<option value="2.5" '.selected($rating['rate'], "2.5",	false).'>2.5</option>
+			<option value="3.0" '.selected($rating['rate'], "3.0",	false).'>3.0</option>
+			<option value="3.5" '.selected($rating['rate'], "3.5",	false).'>3.5</option>
+			<option value="4.0" '.selected($rating['rate'], "4.0",	false).'>4.0</option>
+			<option value="4.5" '.selected($rating['rate'], "4.5",	false).'>4.5</option>
+			<option value="5"	'.selected($rating['rate'], "5",	false).'>5.0</option>
+		</select>';
+		echo '</div></td></tr>';
+		echo '</tbody></table>';
+	}
+
+	function itempropwp_review_save( $post_id ) {
+		$ipwprprefix = 'ipwp_';
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
+			return;
+		
+		if ( !wp_verify_nonce( $_POST[$ipwprprefix.'pt_post_nonce'], plugin_basename( __FILE__ ) ) )
+			return;
+		if ( 'page' == $_POST['post_type'] ){
+			if ( !current_user_can( 'edit_page', $post_id ) )
+				return;
+		}
+		else{
+			if ( !current_user_can( 'edit_post', $post_id ) )
+				return;
+		}
+		
+		$product_name = $_POST[$ipwprprefix.'product_name'];
+		$product_price = $_POST[$ipwprprefix.'product_price'];
+		$currency = $_POST[$ipwprprefix.'currency'];
+		$rating = $_POST[$ipwprprefix.'rating'];
+		$reviewonoff = $_POST[$ipwprprefix.'reviewonoff'];
+		
+		if(!$product_price||$product_price==''){$product_price = '0.00';}
+		if(!$currency||$currency==''){$currency = 'USD';}
+		
+		update_post_meta($post_id, $ipwprprefix.'product_name', $product_name);
+		update_post_meta($post_id, $ipwprprefix.'product_price', $product_price);
+		update_post_meta($post_id, $ipwprprefix.'currency', $currency);
+		update_post_meta($post_id, $ipwprprefix.'rating', $rating);
+		update_post_meta($post_id, $ipwprprefix.'reviewonoff', $reviewonoff);
+
+	}
 }
 
 new itempropwp_review;
 <?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.2.1-itempropWP_load_widgets
+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.2.2
+Version: 3.3.0
 Requires at least: 3.3
 Tested up to: 3.5
 Author: Rolands Umbrovskis
 Copyright (C) 2008-2012, Rolands Umbrovskis - rolands@simplemediacode.com
 
 */
-	define('SMCIPWPV','3.2.2'); // location general @since 1.0
+	define('SMCIPWPV','3.3.0'); // 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
+	define('IPWPTSN',__('itemprop WP','itempropwp')); // Name @since 3.3.0
 	define('SMCIPWPURL', plugin_dir_url(__FILE__)); // Plugin URI @since 1.0
 	define('SMCIPWPDIR',dirname( plugin_basename( __FILE__ ) ));/* @since 3.2.0 */
 	$smcipwp_url = SMCIPWPURL; // @since 3.1 Use of undefined constant SMCIPWPURL - assumed 'SMCIPWPURL' in 
 /** Plugin homepage based on WP language
 * @since 3.1.4
 */
-	$plugref='?'.SMCIPWPF.'='.SMCIPWPV;
+	$plugref='?utm_campaign='.SMCIPWPF.'&utm_content='.SMCIPWPF.'-'.SMCIPWPV.'&utm_medium=link&utm_source='.get_home_url();
 	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{
 		define('IPWPT_HOMEPAGE','http://simplemediacode.com/wordpress-pugins/itemprop-wp/'.$plugref); // Homepage @since 3.1
+		define('IPWPT_HOMEPAGEC','http://simplemediacode.com/wordpress-pugins/itemprop-wp/'); // Homepage @since 3.3.0
 	}
 	
-	define('IPWPT_GITHUB','https://github.com/rolandinsh/itempropwp'); // Homepage @since 3.1
-	define('IPWPT_BITBUCKET','https://bitbucket.org/simplemediacode/itempropwp'); // Homepage @since 3.1
+	define('IPWPT_GITHUB','https://github.com/rolandinsh/'.$smcipwp_f); // Homepage @since 3.1
+	define('IPWPT_BITBUCKET','https://bitbucket.org/simplemediacode/'.$smcipwp_f); // Homepage @since 3.1
+	define('IPWPT_VERSUPPORT','http://simplemediacode.org/forums/topic/itempropwp-3-3-0/'.$plugref); // Version specific support @since 3.3.0
+	
 /*
  * Starting itempropwp
 */
 	class itempropwp {
 		public function __construct(){
 			add_action('init', array( 'itempropwp', 'init' ),10);
+			add_action('plugin_row_meta', array( 'itempropwp', 'smcwpd_set_plugin_meta' ), 10, 2 );
+
 /*
  * itempropwp Admin interface
  * @since 3.1.4
 			add_filter('the_content', array( 'itempropwp', 'ipwp_the_content_filter' ), 10, 2 ); // Adding context @since 3.0
 			
 		}
+
+		function smcwpd_set_plugin_meta($links, $file) {
+			$plugin = plugin_basename(__FILE__);
+			// create link
+			if ($file == $plugin) {
+				return array_merge( $links, array( 
+		
+					'<a href="http://simplemediacode.org/groups/itempropwp-plugin/forum/">' . __("Support Forum","itempropwp") . '</a>',
+					'<a href="'.IPWPT_VERSUPPORT.'">' . sprintf(__("Support for version %s","itempropwp"),SMCIPWPV) . '</a>',
+					'<a href="http://simplemediacode.org/groups/itempropwp-plugin/forum/topic/suggestions-for-more-options/">' . __('Feature request') . '</a>',
+					'<a href="http://simplemediacode.org/groups/itempropwp-plugin/">' . __("Join Members group","itempropwp") . '</a>',
+					//'<a href="http://darbi.mediabox.lv/draugiem-lvlapas-fanu-wordpress-spraudnis/">www</a>',
+					// ,'<a href="http://umbrovskis.com/">Umbrovskis.com</a>'
+				));
+			}
+			return $links;
+		}
+
 		/* 3.0 drop */
 		public function ipwp_img_attr($attr) {
 			$attr['itemprop'] = 'image';
 					$ipwp_datemodified= '<meta itemprop="dateModified" content="'.esc_attr($thisipwp_post->post_modified).'" />';
 				}
 				
-				//$xfactorer = apply_filters('article_content_before');
-				$xfactorer = apply_filters('article_content_before','<span itemscope itemtype="http://schema.org/Article" class="itempropwp-wrap"><!-- ItemProp WP '.SMCIPWPV.' by Rolands Umbrovskis http://umbrovskis.com -->
+				$smcipwp_author_link = get_option('smcipwp_author_link'); /* Per post options @since 3.3.0 */
+				if($smcipwp_author_link==''){
+					$smcipwp_author_link = get_author_posts_url($thisipwp_post->post_author);
+				}
+				$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_image.'<meta itemprop="author" content="'.get_author_posts_url($thisipwp_post->post_author).'" /><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_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>');
-				
-				
 
 				$content = $content.$xfactorer;
-	
-	//$content = $content.$xfactorer;
-
-				$content = apply_filters('article_content', $content);
+				$content = apply_filters('itempropwp_article_content', $content);
 				
 				return $content;
 			}

lang/itempropwp-lv.mo

Binary file modified.

lang/itempropwp-lv.po

 "Project-Id-Version: itempropwp\n"
 "Report-Msgid-Bugs-To: webapp@mediabox.lv\n"
 "POT-Creation-Date: 2010-03-10 06:11+0000\n"
-"PO-Revision-Date: 2012-11-07 10:58+0200\n"
+"PO-Revision-Date: 2012-11-30 01:06+0200\n"
 "Last-Translator: rolandinsh <rolands@mediabox.lv>\n"
 "Language-Team: Latvian <rolands@mediabox.lv>\n"
+"Language: lv\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: Latvian\n"
-"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : "
+"2);\n"
+"X-Generator: Poedit 1.5.4\n"
 
 msgid "itemprop WP for SERP/SEO Rich snippets"
 msgstr "itemprop WP Labākiem SERP rezultātiem"
 msgid "Author link"
 msgstr "Autora lapas saite"
 
-msgid "if there is only 1 author and You would like to link to another author page in itemprop"
-msgstr "ja ir tikai 1 autors un vēlies norādīt citu autora profila lapu savā itemprop"
+msgid ""
+"if there is only 1 author and You would like to link to another author page "
+"in itemprop"
+msgstr ""
+"ja ir tikai 1 autors un vēlies norādīt citu autora profila lapu savā itemprop"
+
+msgid "Leave empty and we will use default author page link %s"
+msgstr "Atstāj tukšu un izmantosim noklusēto autora saiti %s"
 
+msgid "Support for version %s"
+msgstr "%s versijas atbalsts"

lang/itempropwp.pot

 msgid "if there is only 1 author and You would like to link to another author page in itemprop"
 msgstr ""
 
+msgid "Leave empty and we will use default author page link %s"
+msgstr ""
+
+msgid "%s Review"
+msgstr ""
+
+msgid "Support for version %s"
+msgstr ""
+
+msgid "Name of item"
+msgstr ""
+
+msgid "Price of item"
+msgstr ""
+
+msgid "Currency of item"
+msgstr ""
+
+msgid "Rating of item"
+msgstr ""