Skip to content

Commit

Permalink
Fixed an issue where post Tags were set after the post was published …
Browse files Browse the repository at this point in the history
…which caused interference with other plugin processes
  • Loading branch information
jchristopher committed May 24, 2013
1 parent 32d3ac8 commit 2ba284f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ That's about it. Clicking Publish pushes the entry live instantly (or schedules
1. Install the bookmarklet provided on the `Settings > Linkmarklet` screen
1. Customize your installation using the `Settings > Linkmarklet` menu in the WordPress admin


## Usage

1. Install the bookmarklet provided on the `Settings > Linkmarklet` screen
Expand All @@ -46,6 +45,10 @@ That's about it. Clicking Publish pushes the entry live instantly (or schedules
## Changelog

<dl>

<dt>0.7</dt>
<dd>Fixed an issue where post Tags were set after the post was published which caused interference with other plugin processes</dd>

<dt>0.6</dt>
<dd>Fixed an issue where Future Publish settings wouldn't properly unset after being set.</dd>
<dd>Added autocomplete to Tags</dd>
Expand Down
20 changes: 10 additions & 10 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function linkmarklet_post()

// see if we need to process any images
$images = array();
$markdown_pattern = "/(!\\[(.*?)\\]\\s?\\([ \\n]*(?:<(\\S*)>|(.*?))[ \\n]*(([\\'\"])(.*?)\\6[ \\n]*)?\\))/ui";
// $markdown_pattern = "/(!\\[(.*?)\\]\\s?\\([ \\n]*(?:<(\\S*)>|(.*?))[ \\n]*(([\\'\"])(.*?)\\6[ \\n]*)?\\))/ui";
$markdown_pattern = "/(!\\[(.*?)\\]\\s?\\([ \\n]*(?:<(\\S*)>|(.*?))[ \\n]*?\\))/ui";
preg_match_all( $markdown_pattern, $content, $images );

Expand Down Expand Up @@ -320,6 +320,15 @@ function linkmarklet_post()
// update what we've set
$post_ID = wp_update_post( $post );

// we also need to add our custom field link
$custom_field = isset( $settings['custom_field'] ) ? $settings['custom_field'] : '';
if( !empty( $custom_field ) )
update_post_meta( $post_ID, $custom_field, mysql_real_escape_string( $_POST['url'] ) );

// set our post tags if applicable
if( !empty( $settings['support_tags'] ) && !empty( $_POST['tags'] ) )
wp_set_post_tags( $post_ID, $_POST['tags'] );

// mark as published if that's the intention
if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) )
{
Expand Down Expand Up @@ -349,15 +358,6 @@ function linkmarklet_post()
// our final update
$post_ID = wp_update_post( $post );

// we also need to add our custom field link
$custom_field = isset( $settings['custom_field'] ) ? $settings['custom_field'] : '';
if( !empty( $custom_field ) )
update_post_meta( $post_ID, $custom_field, mysql_real_escape_string( $_POST['url'] ) );

// set our post tags if applicable
if( !empty( $settings['support_tags'] ) && !empty( $_POST['tags'] ) )
wp_set_post_tags( $post_ID, $_POST['tags'] );

return $post_ID;
}

Expand Down
8 changes: 4 additions & 4 deletions linkmarklet.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
/*
Plugin Name: Linkmarklet
Plugin URI: http://wordpress.org/extend/plugins/linkmarklet/
Description: Alternate to Press This! specifically geared to linkblogging. Quickly post while saving a link to a Custom Field.
Plugin URI: https://github.com/jchristopher/linkmarklet
Description: Alternative to Press This! specifically geared to linkblogging. Quickly post while saving a link to a Custom Field you define.
Author: Jonathan Christopher
Version: 0.6
Version: 0.7
Author URI: http://mondaybynoon.com/
*/

if( !defined( 'IS_ADMIN' ) )
define( 'IS_ADMIN', is_admin() );

define( 'LINKMARKLET_VERSION', '0.6' );
define( 'LINKMARKLET_VERSION', '0.7' );
define( 'LINKMARKLET_PREFIX', '_iti_linkmarklet_' );
define( 'LINKMARKLET_DIR', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) );
define( 'LINKMARKLET_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: jchristopher
Donate link:http://mondaybynoon.com/donate/
Tags: link, linkblog, press this
Requires at least: 3.3
Tested up to: 3.5
Stable tag: 0.6
Tested up to: 3.6
Stable tag: 0.7
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -31,6 +31,9 @@ That's about it. Clicking Publish pushes the entry live instantly (or schedules

== Changelog ==

= 0.7 =
* Fixed an issue where post Tags were set after the post was published which caused interference with other plugin processes

= 0.6 =
* Fixed an issue where Future Publish settings wouldn't properly unset after being set.
* Added autocomplete to Tags
Expand Down

0 comments on commit 2ba284f

Please sign in to comment.