TinyMCE Templates - Version 1.3.0

Version Description

Download this release

Release Info

Developer miyauchi
Plugin Icon 128x128 TinyMCE Templates
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.1 to 1.3.0

includes/TinyMCETemplate.class.php CHANGED
@@ -9,7 +9,7 @@ class TinyMCETemplate{
9
  function __construct()
10
  {
11
  new AddRewriteRules(
12
- 'mce_templates.js$',
13
  'mce_templates',
14
  array(&$this, 'get_templates')
15
  );
@@ -49,7 +49,7 @@ class TinyMCETemplate{
49
  $inits = array();
50
  $url = home_url();
51
  if ($wp_rewrite->using_permalinks()) {
52
- $this->list_url = $url.'/mce_templates.js';
53
  } else {
54
  $this->list_url = $url.'/?mce_templates=1';
55
  }
@@ -67,32 +67,36 @@ class TinyMCETemplate{
67
  // return display templates as JSON
68
  //
69
  public function get_templates(){
70
- global $wp_rewrite;
71
  if (get_query_var('mce_templates')) {
72
- global $wpdb;
73
- global $user_login;
74
- global $current_user;
75
- global $MceTemplates;
76
-
77
- if (!$user_login) {
78
  exit;
79
  }
 
 
80
 
81
  if( isset($_GET['id']) && strlen($_GET['id']) ){
82
  $sql = "select html from ".$wpdb->prefix."mce_template
83
- where (`ID`=%s) and (`author`={$current_user->ID} or `share`=1)
84
  order by `modified` desc";
85
- $sql = $wpdb->prepare($sql, $_GET['id']);
86
  $template = $wpdb->get_var($sql);
87
  if ($template) {
88
- echo wpautop(stripslashes($template));
 
 
 
 
89
  }
90
  exit;
91
  }
92
 
93
  $sql = "select * from ".$wpdb->prefix."mce_template
94
- where `author`={$current_user->ID} or `share`=1
95
  order by `modified` desc";
 
96
  $row = $wpdb->get_results($sql);
97
 
98
  header( 'Content-Type: application/x-javascript; charset=UTF-8' );
9
  function __construct()
10
  {
11
  new AddRewriteRules(
12
+ 'wp-admin/mce_templates.js$',
13
  'mce_templates',
14
  array(&$this, 'get_templates')
15
  );
49
  $inits = array();
50
  $url = home_url();
51
  if ($wp_rewrite->using_permalinks()) {
52
+ $this->list_url = $url.'/wp-admin/mce_templates.js';
53
  } else {
54
  $this->list_url = $url.'/?mce_templates=1';
55
  }
67
  // return display templates as JSON
68
  //
69
  public function get_templates(){
 
70
  if (get_query_var('mce_templates')) {
71
+ $u = wp_get_current_user();
72
+ if (!$u->ID) {
73
+ header("HTTP/1.1 404 Not Found");
74
+ echo "404 Not Found.";
 
 
75
  exit;
76
  }
77
+ global $wp_rewrite;
78
+ global $wpdb;
79
 
80
  if( isset($_GET['id']) && strlen($_GET['id']) ){
81
  $sql = "select html from ".$wpdb->prefix."mce_template
82
+ where (`ID`=%s) and (`author`=%d or `share`=1)
83
  order by `modified` desc";
84
+ $sql = $wpdb->prepare($sql, $_GET['id'], $u->ID);
85
  $template = $wpdb->get_var($sql);
86
  if ($template) {
87
+ echo apply_filters(
88
+ "tinymce_templates",
89
+ wpautop(stripslashes($template)),
90
+ stripslashes($template)
91
+ );
92
  }
93
  exit;
94
  }
95
 
96
  $sql = "select * from ".$wpdb->prefix."mce_template
97
+ where `author`=%d or `share`=1
98
  order by `modified` desc";
99
+ $sql = $wpdb->prepare($sql, $u->ID);
100
  $row = $wpdb->get_results($sql);
101
 
102
  header( 'Content-Type: application/x-javascript; charset=UTF-8' );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === TinyMCE Templates ===
2
  Contributors: miyauchi
3
- Donate link: http://firegoby.theta.ne.jp/
4
  Tags: tinymce, Visual Editor, template
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
- Stable tag: 1.2.1
8
 
9
  TinyMCE Template plugin will enable to use HTML template on WordPress Visual Editor.
10
  You can edit and share this template with WordPress users.
@@ -45,8 +45,7 @@ You can send your own language pack to me.
45
  == Screenshots ==
46
 
47
  1. Template Admin.
48
- 2. Template Editor.
49
- 3. Visual Editor.
50
 
51
  == Credits ==
52
 
@@ -55,6 +54,6 @@ The author must acknowledge the thing that the operation guarantee and the suppo
55
 
56
  == Contact ==
57
 
58
- email to miya[at]theta.ne.jp
59
- twitter @miya001
60
 
1
  === TinyMCE Templates ===
2
  Contributors: miyauchi
3
+ Donate link: https://www.paypal.com/jp/cgi-bin/webscr?cmd=_flow&SESSION=vVwWrw6VVHF22np9_GU0-V40_AQGlVgFMJBcwaUbLfZPzirnfNd92OY6dV0&dispatch=50a222a57771920b6a3d7b606239e4d529b525e0b7e69bf0224adecfb0124e9b61f737ba21b0819838956b846fa597911f234fb937456ea7
4
  Tags: tinymce, Visual Editor, template
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
+ Stable tag: 1.3.0
8
 
9
  TinyMCE Template plugin will enable to use HTML template on WordPress Visual Editor.
10
  You can edit and share this template with WordPress users.
45
  == Screenshots ==
46
 
47
  1. Template Admin.
48
+ 2. Visual Editor.
 
49
 
50
  == Credits ==
51
 
54
 
55
  == Contact ==
56
 
57
+ * email to miya[at]theta.ne.jp
58
+ * twitter @miya001
59
 
screenshot-3.png DELETED
Binary file
tinymce_templates.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: TinyMCE Templates
4
  Plugin URI: http://firegoby.theta.ne.jp/wp/tinymce_templates
5
  Description: Manage & Add Tiny MCE template.
6
  Author: Takayuki Miyauchi
7
- Version: 1.2.1
8
  Author URI: http://firegoby.theta.ne.jp/
9
  */
10
 
4
  Plugin URI: http://firegoby.theta.ne.jp/wp/tinymce_templates
5
  Description: Manage & Add Tiny MCE template.
6
  Author: Takayuki Miyauchi
7
+ Version: 1.3.0
8
  Author URI: http://firegoby.theta.ne.jp/
9
  */
10