Commits

simplemediacode  committed 651cbbb

add: version 3.1.4

  • Participants
  • Parent commits 7c1026a

Comments (0)

Files changed (11)

 	 <meta itemprop="url" content="http://fulllink.example.com/seo-optimized-article/" />
 	 <meta itemprop="image" content="http://fulllink.example.com/seo-optimized-article/example.jpg" />
 	 <meta itemprop="author" content="http://fulllink.example.com/author/authorusername/"/>
-	 <meta itemprop="description" content="excerpt from post OR first 128 symbols (with full word), ..." />
+	 <meta itemprop="description" content="excerpt from post OR first 170 symbols (with full word), ..." />
 	 <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.1.3 by Rolands Umbrovskis http://umbrovskis.com end -->
 	</span>
 
 ### Features
 
+* Admin interface for options: description lenght (if excerpt not provided),show/hide UserComments:325,  show/hide dateModified 
 * itemprop="description" (since 3.1.1)
 * itemprop="name" (since 3.0)
 * itemprop="url" (since 3.0)
 
 ### Links
 
-* [Project Page](http://simplemediacode.info/snippets/itemprop-attributes-for-wordpress-serp-results/)
-* [Documentation](http://simplemediacode.info/snippets/add-itemprop-image-to-all-wordpress-images/)
+* [Project Page](http://simplemediacode.com/wordpress-pugins/itemprop-wp/)
 * [SMC Facebook](http://www.facebook.com/pages/SimpleMediaCode/125547717479727)
 * Development: [Git at bitbucket](https://bitbucket.org/simplemediacode/itempropwp) | [Github](https://github.com/rolandinsh/itempropwp)
 
 1. Activate the plugin through the 'Plugins' menu in WordPress
 1. See `itempropwp.php` for usage
 
+Require PHP at least 5.3
+
 ## Frequently Asked Questions
 
-There are no questions for now! [Ask!](http://simplemediacode.info/snippets/itemprop-attributes-for-wordpress-serp-results/)
+There are no questions for now! [Ask!](http://simplemediacode.com/wordpress-pugins/itemprop-wp/)
 
-## ToDo
+## Changelog
 
-* fix: itemprop="description" full fix
+### 3.1.4
 
-## Changelog
+* updated: itemprop="description"
+* Admin interface for options: description lenght (if excerpt not provided),show/hide UserComments:325,  show/hide dateModified 
 
 ### 3.1.2
 

File admin/adminipwp.php

+<?php 
+/*
+ * itempropwp Admin interface
+ * @since 3.1.4
+ * @version 1.0
+*/
+add_action('admin_menu', 'smc_ipwp_admin_menu');
+
+function smc_ipwp_admin_menu() {
+	//create new top-level menu
+	add_menu_page(__('itemprop WP for SERP/SEO Rich snippets','itempropwp'), __('itemprop WP','itempropwp'), 'activate_plugins', 'smcipwp_menu', 'smcipwp_settings');
+	//add_submenu_page( 'smcipwp_menu', __('Help','itempropwp'), __('Help','itempropwp'), 'edit_posts', 'smcipwphelp', 'smcipwp_help');
+	register_setting( 'smcipwp-settings', 'smcipwp_maxlenght' );
+	register_setting( 'smcipwp-settings', 'smcipwp_showcommcount' );
+	register_setting( 'smcipwp-settings', 'smcipwp_datemodified' );
+
+}
+
+function smcipwp_settings(){ ?><div class="wrap"><div class="icon32" id="icon-tools"><br /></div>
+	<h2><?php _e('Settings');?></h2>
+	<form method="post" action="options.php">
+<?php 
+
+settings_fields( 'smcipwp-settings' );
+
+$smcipwp_maxlenght = get_option('smcipwp_maxlenght');
+$smcipwp_showcommcount = get_option('smcipwp_showcommcount');
+$smcipwp_datemodified = get_option('smcipwp_datemodified');
+
+if(!$smcipwp_maxlenght||$smcipwp_maxlenght==''){
+	$smcipwp_maxlenght = '170'; /* well, we need some value anyway */
+}
+
+?>
+<table class="form-table table">
+	<tr>
+		<th valign="top"><?php _e('Description max lenght if no excerpt is provided','itempropwp');?></th>
+		<td valign="top"><input type="text" id="smcipwp_maxlenght" name="smcipwp_maxlenght" value="<?php echo $smcipwp_maxlenght;?>" /></td>
+	</tr>
+	<tr>
+		<th valign="top"><?php _e('Show comment count?','itempropwp');?></th>
+		<td valign="top"><input type="checkbox" id="smcipwp_showcommcount" name="smcipwp_showcommcount" <?php checked($smcipwp_showcommcount,'on') ?> /></td>
+	</tr>
+	<tr>
+		<th valign="top"><?php _e('Show dateModified?','itempropwp');?></th>
+		<td valign="top"><input type="checkbox" id="smcipwp_datemodified" name="smcipwp_datemodified" <?php checked($smcipwp_datemodified,'on') ?> /></td>
+	</tr>
+ </table>
+    <p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes','itempropwp') ?>" /></p>
+</form>
+<hr />
+<p class="description">
+	<a href="http://simplemediacode.com/" target="_blank">SimpleMediaCode.com - custom WordPress development</a> | 
+	<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>
+</div><?php } // smcwpd_settings()

File assets/img/itempropwp-icon-125.jpg

Added
New image

File assets/img/itempropwp-icon-170.jpg

Added
New image

File assets/img/itempropwp-icon-64.jpg

Added
New image

File assets/img/itempropwp-icon.jpg

Added
New image

File itempropwp.php

 <?php 
 /**
- * Plugin Name: itemprop WP for SERP/SEO Rich snippets
- * Plugin URI: http://simplemediacode.com/wordpress/itempropwp/?utm_source=wordpress&utm_medium=wpplugin&utm_campaign=itempropWP&utm_content=v-3-1-3-itempropWP_load_widgets
- * Description: Add human invisible schema.org itemprop code to images
- * Version: 3.1.3
- * Requires at least: 3.3
- * Tested up to: 3.5
- * Author: Rolands Umbrovskis
- * Author URI: http://umbrovskis.com
- * License: simplemediacode
- * License URI: http://simplemediacode.com/license/gpl/
+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-1-4-itempropWP_load_widgets
+Description: Add human invisible schema.org itemprop code to images
+Version: 3.1.3
+Requires at least: 3.3
+Tested up to: 3.5
+Author: Rolands Umbrovskis
+Author URI: http://umbrovskis.com
+License: simplemediacode
+License URI: http://simplemediacode.com/license/gpl/
+
+Copyright (C) 2008-2012, Rolands Umbrovskis - rolands@simplemediacode.com
+
  */
-	define('SMCIPWPV','3.1.3'); // location general @since 1.0
+	define('SMCIPWPV','3.1.4'); // 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('SMCIPWPURL', plugin_dir_url(__FILE__)); // Plugin URI @since 1.0
 	$smcipwp_url = SMCIPWPURL; // @since 3.1 Use of undefined constant SMCIPWPURL - assumed 'SMCIPWPURL' in 
 	$smcipwp_f = SMCIPWPF; // @since 3.1 Use of undefined constant SMCIPWPF - assumed 'SMCIPWPF' in 
 	
 	define('SMCIPWPI',trailingslashit( $smcipwp_url. '/img' )); // Image location @since 1.0
 	define('SMCIPWPORG','http://wordpress.org/extend/plugins/'.trailingslashit($smcipwp_f)); // Plugin on WordPress.org @since 1.0
-	define('IPWPT',__('itemprop WP for SERP/SEO Rich snippets','itempropwp')); // Name @since 1.1
-	define('IPWPT_HOMEPAGE','http://simplemediacode.com/wordpress/itempropwp/'); // Homepage @since 3.1
+	
+/** Plugin homepage based on WP language
+ * @since 3.1.4
+*/
+	$plugref='?'.SMCIPWPF.'='.SMCIPWPV;
+	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
+	}else{
+		define('IPWPT_HOMEPAGE','http://simplemediacode.com/wordpress-pugins/itemprop-wp/'.$plugref); // Homepage @since 3.1
+	}
+	
 	define('IPWPT_GITHUB','https://github.com/rolandinsh/itempropwp'); // Homepage @since 3.1
 	define('IPWPT_BITBUCKET','https://bitbucket.org/simplemediacode/itempropwp'); // Homepage @since 3.1
 /*
  * itempropwp class
  * @since 2.0
 */
-
+//if (!class_exists('itempropwp')) {
 	class itempropwp {
 		public function __construct(){
-			add_filter('the_content', array( 'itempropwp', 'ipwp_the_content_filter' ), 10, 2 );
+			add_action('init', array( 'itempropwp', 'init' ),10);
+/*
+ * itempropwp Admin interface
+ * @since 3.1.4
+ * @version 1.0
+*/
+			if(is_admin()):
+				include_once(SMCIPWPM.'/admin/adminipwp.php');
+			endif;
 		} 
 		// Initialize
 		public function init() {
-			// add_filter('wp_get_attachment_image_attributes', array( 'itempropwp', 'ipwp_img_attr' ), 10, 2 ); // Adding itemprop=image to thumbnails  @since 2.0
+			load_plugin_textdomain( 'itempropwp', false, dirname( plugin_basename( __FILE__ ) ). '/lang/');
 			add_filter('the_content', array( 'itempropwp', 'ipwp_the_content_filter' ), 10, 2 ); // Adding context @since 3.0
+			
 		}
 		/* 3.0 drop */
 		public function ipwp_img_attr($attr) {
 			$attr['itemprop'] = 'image';
 			return apply_filters('ipwp_img_attr_filter', $attr); // Extending @since 3.1
 		}
+
+
 	/*
 	 * if post has no excerpt, we will use this
 	 * @Todo rewrite
 			/* did we get content? No, let's make it from post */
 			if($ipwp_content==''){
 				global $post;  
-				$ipwp_content = apply_filters('ipwp_excmc_filter_content', $post->post_excerpt);  // Extending @since 3.1.2
+				$ipwp_content = apply_filters('ipwp_excmc_filter_excerpt', $post->post_excerpt);  // Extending @since 3.1.2
 				if(!$ipwp_content||$ipwp_content==''){
-					$ipwp_content = apply_filters('ipwp_excmc_filter_content', strip_shortcodes( $post->post_content ));  // Extending @since 3.1
+					$ipwp_content = apply_filters('ipwp_excmc_filter_content', strip_shortcodes($post->post_content));  // Extending @since 3.1
+					$ipwp_content = str_replace(array("\r\n", "\n", "\r", "\t"), "", $ipwp_content);
 				}
 			}
 			
 				}
 				return apply_filters('ipwp_excmc_filter_more', '[...]'); // Extending @since 3.1
 			}elseif(!$ipwp_content||$ipwp_content==''){
-				 // Extending @since 3.1.3
-				/* heeeeey! We still have no content! OK, let's tray get post title */
-				// rare cases where post content is ONLY shortcode
+/** rare cases where post content is ONLY shortcode
+* heeeeey! We still have no content! OK, let's tray get post title
+* @since 3.1.3
+*/
 				global $post;
 				$ipwp_content = $post->post_title;
-				return $ipwp_content;
+				return apply_filters('ipwp_excmc_nocontent', $ipwp_content);
 			}
 			else{
 				/* I give up! Some very rare,rare cases where we do not have content AND we do not have title. That's weird!*/
-				return $ipwp_content;
+				return apply_filters('ipwp_excmc_nocontent_notitle', $ipwp_content);
 			}
 
 		}
 				$thisipwp_post = get_post($post->ID);
 				$ipwp_posth = '';
 				$ipwp_image = '';
+				$showcommcount = '';
+				$ipwp_datemodified='';
+				$ipwpdatemodified = get_option('smcipwp_datemodified');
+
 				$ipwp_post_dsc = apply_filters('ipwp_post_dsc', $thisipwp_post->post_excerpt);
 				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 :| 
 				}
 	
 				if(!$ipwp_post_dsc){
-					$ipwp_n = new itempropwp;
-					$ipwp_post_dsc = apply_filters('ipwp_post_dsc', $ipwp_n->ipwp_excerpt_maxchr(170, strip_shortcodes($thisipwp_post->post_content) )); // Extending @since 3.1
-					//$ipwp_post_dsc = apply_filters('ipwp_post_dsc', $thisipwp_post->post_title); // Extending @since 3.1.2
+		$ipwp_n = new itempropwp;
+		$ipwp_post_dsc = apply_filters('ipwp_post_dsc', $ipwp_n->ipwp_excerpt_maxchr(get_option('smcipwp_maxlenght'), strip_shortcodes($thisipwp_post->post_content) )); // Extending @since 3.1
 				}
 				
-	
-				$content = $content."\n".'<span itemscope itemtype="http://schema.org/Article">
+				if(get_option('smcipwp_showcommcount')=='on'){
+					$showcommcount = "\n\t".'<meta itemprop="interactionCount" content="UserComments:'.esc_attr($thisipwp_post->comment_count).'" />';
+				}
+				if($ipwpdatemodified=='on'){
+					$ipwp_datemodified= "\n\t".'<meta itemprop="dateModified" content="'.esc_attr($thisipwp_post->post_modified).'" />';
+				}
+
+				$content = $content.'
+<span itemscope itemtype="http://schema.org/Article">
 <!-- 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($ipwp_post_dsc).'"/>
-	<meta itemprop="datePublished" content="'.esc_attr($thisipwp_post->post_date).'" />
-	<meta itemprop="interactionCount" content="UserComments:'.esc_attr($thisipwp_post->comment_count).'" />
+	'<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_datemodified
+	.$showcommcount.'
 <!-- ItemProp WP '.SMCIPWPV.' by Rolands Umbrovskis http://umbrovskis.com end -->
-</span>'."\n";
-			
+</span>
+';
 				return $content;
 			}
 			return $content;
 		}
 	
 	}
+//}

File lang/itempropwp-lv.mo

Binary file added.

File lang/itempropwp-lv.po

+# Translation of itemprop WP.
+# Copyright (C) 2012 Rolands Umbrovskis
+# This file is distributed under the same license as the BuddyPress package.
+# Rolands Umbrovskis <rolands@mediabox.lv>, 2010.
+#
+msgid ""
+msgstr ""
+"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-10-05 19:31+0200\n"
+"Last-Translator: rolandinsh <rolands@mediabox.lv>\n"
+"Language-Team: Latvian <rolands@mediabox.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"
+
+msgid "itemprop WP for SERP/SEO Rich snippets"
+msgstr "itemprop WP Labākiem SERP rezultātiem"
+
+msgid "itemprop WP"
+msgstr "itemprop WP"
+
+msgid "Description max lenght if no excerpt is provided"
+msgstr "Apraksta garums, ja izraksts nav pieejams"
+
+msgid "Show comment count?"
+msgstr "Rādīt komentāru skaitu?"
+
+msgid "Show dateModified?"
+msgstr ""
+
+msgid "Save Changes"
+msgstr "Saglabāt izmaiņas"
+

File lang/itempropwp.pot

+# Translation of itemprop WP.
+# Copyright (C) 2012 Rolands Umbrovskis
+# This file is distributed under the same license as the BuddyPress package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
+#
+msgid ""
+msgstr ""
+"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: 2010-03-11 11:01+0200\n"
+"Last-Translator: rolandinsh <info@mediabox.lv>\n"
+"Language-Team: LANGUAGE <LL@li.org>\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"
+
+msgid "itemprop WP for SERP/SEO Rich snippets"
+msgstr ""
+
+msgid "itemprop WP"
+msgstr ""
+
+msgid "Description max lenght if no excerpt is provided"
+msgstr ""
+
+msgid "Show comment count?"
+msgstr ""
+
+msgid "Show dateModified?"
+msgstr ""
+
+msgid "Save Changes"
+msgstr ""
 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=Z4ALL9WUMY3CL&lc=LV&item_name=Umbrovskis%2e%20WordPress%20plugins&item_number=002&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
 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.4.2
-Stable tag: 3.1.3
+Tested up to: 3.5
+Stable tag: 3.1.4
 License: simplemediacode
 License URI: http://simplemediacode.com/license/gpl/
 
 
 `
 <span itemscope itemtype="http://schema.org/Article">
-<!-- Itemprop WP 3.1.3 by Rolands Umbrovskis http://umbrovskis.com -->
+<!-- Itemprop WP 3.1.4 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="author" content="http://example.com/author/authorusername/"/>
  <meta itemprop="description" content="excerpt from post" />
  <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.1.3 by Rolands Umbrovskis http://umbrovskis.com end -->
+<!-- Itemprop WP 3.1.4 by Rolands Umbrovskis http://umbrovskis.com end -->
 </span>
 `
 
 
 Other options, like `datePublished`, `UserComments`, `url` are taken from post
 
+NEW in 3.1.4
+
+* updated: itemprop="description"
+* Admin interface for options: description lenght (if excerpt not provided),show/hide UserComments:325,  show/hide dateModified 
 
 NEW in 3.1
 
 
 Developer on twitter [@UmbrovskisCom](http://twitter.com/UmbrovskisCom)  /  [@SimpleMediaCode](http://twitter.com/SimpleMediaCode)
 
+Require PHP at least 5.3
+
 == Installation ==
 
 1. Unzip the download package
 
 == Changelog ==
 
+= 3.1.4 =
+
+* updated: itemprop="description"
+* Admin interface for options: description lenght (if excerpt not provided),show/hide UserComments:325,  show/hide dateModified 
+
 = 3.1.3 =
 
 * fixed: itemprop="description"
 
 == Upgrade Notice ==
 
+= 3.1.4 =
+
+* updated: itemprop="description"
+* Admin interface for options: description lenght (if excerpt not provided),show/hide UserComments:325,  show/hide dateModified 
+
 = 3.1.3 =
 
 * new: itemprop="description"
 
-= 2.0 =
-* new: as extendable class function
-* new: using WordPress filter for image attributed on thumbnails
-
 = 3.0 =
 * new: context
 * new: itemprop="name"
 * new: itemprop="datePublished"
 * new: "UserComments:325" itemprop="interactionCount"
 
+= 2.0 =
+* new: as extendable class function
+* new: using WordPress filter for image attributed on thumbnails
+
 == Screenshots ==
 1. 3.0 Full futured example http://simplemediacode.info/snippets/add-itemprop-image-to-all-wordpress-images/