TinyMCE Templates - Version 1.2.1

Version Description

Download this release

Release Info

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

Code changes from version 1.2.0 to 1.2.1

Files changed (2) hide show
  1. readme.txt +3 -2
  2. tinymce_templates.php +32 -28
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.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,7 +45,8 @@ You can send your own language pack to me.
45
  == Screenshots ==
46
 
47
  1. Template Admin.
48
- 2. Visual Editor.
 
49
 
50
  == Credits ==
51
 
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
  == Screenshots ==
46
 
47
  1. Template Admin.
48
+ 2. Template Editor.
49
+ 3. Visual Editor.
50
 
51
  == Credits ==
52
 
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.0
8
  Author URI: http://firegoby.theta.ne.jp/
9
  */
10
 
@@ -50,21 +50,13 @@ class MceTemplates{
50
  function __construct()
51
  {
52
  add_action('admin_menu', array(&$this, 'loadAdmin'));
53
- add_action(
54
- 'admin_head-templates_page_addnewtemplates',
55
- array(&$this, 'admin_head')
56
- );
57
- add_action(
58
- 'admin_head-toplevel_page_edittemplates',
59
- array(&$this, 'admin_head')
60
- );
61
  add_filter('plugin_row_meta', array(&$this, 'plugin_row_meta'), 10, 2);
62
  }
63
 
64
  public function admin_head()
65
  {
66
- wp_enqueue_script( 'common' );
67
- wp_enqueue_script( 'jquery-color' );
68
  wp_print_scripts('editor');
69
  if (function_exists('add_thickbox')) add_thickbox();
70
  wp_print_scripts('media-upload');
@@ -81,21 +73,24 @@ class MceTemplates{
81
  public function activation()
82
  {
83
  global $wpdb;
84
- $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}mce_template (
85
- `ID` varchar(32) NOT NULL,
86
- `name` varchar(50) NOT NULL,
87
- `desc` varchar(100) NOT NULL,
88
- `html` text NOT NULL,
89
- `share` tinyint(1) unsigned NOT NULL,
90
- `author` bigint(20) unsigned NOT NULL,
91
- `modified` timestamp NOT NULL,
92
- UNIQUE KEY ID (`ID`))
93
- ENGINE = MYISAM
94
- CHARACTER SET utf8
95
- COLLATE utf8_unicode_ci;
96
- ";
97
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
98
- dbDelta($sql);
 
 
 
99
  }
100
 
101
  public function deactivation()
@@ -114,7 +109,7 @@ class MceTemplates{
114
  dirname(plugin_basename(__FILE__)).'/langs'
115
  );
116
 
117
- add_menu_page(
118
  __('tinyMCE Templates', TINYMCE_TEMPLATES_DOMAIN),
119
  __('Templates', TINYMCE_TEMPLATES_DOMAIN),
120
  'edit_pages',
@@ -130,7 +125,7 @@ class MceTemplates{
130
  'edittemplates',
131
  array(&$this, 'adminPage')
132
  );
133
- add_submenu_page(
134
  'edittemplates',
135
  __('Add New Templates', TINYMCE_TEMPLATES_DOMAIN),
136
  __('Add New', TINYMCE_TEMPLATES_DOMAIN),
@@ -138,6 +133,14 @@ class MceTemplates{
138
  'addnewtemplates',
139
  array(&$this, 'adminPage')
140
  );
 
 
 
 
 
 
 
 
141
  }
142
 
143
 
@@ -160,4 +163,5 @@ class MceTemplates{
160
  return $links;
161
  }
162
  }
 
163
  ?>
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
 
50
  function __construct()
51
  {
52
  add_action('admin_menu', array(&$this, 'loadAdmin'));
 
 
 
 
 
 
 
 
53
  add_filter('plugin_row_meta', array(&$this, 'plugin_row_meta'), 10, 2);
54
  }
55
 
56
  public function admin_head()
57
  {
58
+ wp_enqueue_script('common');
59
+ wp_enqueue_script('jquery-color');
60
  wp_print_scripts('editor');
61
  if (function_exists('add_thickbox')) add_thickbox();
62
  wp_print_scripts('media-upload');
73
  public function activation()
74
  {
75
  global $wpdb;
76
+ $table = $wpdb->prefix.'mce_template';
77
+ if ($wpdb->get_var("show tables like '$table'") != $table) {
78
+ $sql = "CREATE TABLE ".$table." (
79
+ `ID` varchar(32) NOT NULL,
80
+ `name` varchar(50) NOT NULL,
81
+ `desc` varchar(100) NOT NULL,
82
+ `html` text NOT NULL,
83
+ `share` tinyint(1) unsigned NOT NULL,
84
+ `author` bigint(20) unsigned NOT NULL,
85
+ `modified` timestamp NOT NULL,
86
+ UNIQUE KEY ID (`ID`))
87
+ ENGINE = MYISAM
88
+ CHARACTER SET utf8
89
+ COLLATE utf8_unicode_ci;
90
+ ";
91
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
92
+ dbDelta($sql);
93
+ }
94
  }
95
 
96
  public function deactivation()
109
  dirname(plugin_basename(__FILE__)).'/langs'
110
  );
111
 
112
+ $this->edit_hook = add_menu_page(
113
  __('tinyMCE Templates', TINYMCE_TEMPLATES_DOMAIN),
114
  __('Templates', TINYMCE_TEMPLATES_DOMAIN),
115
  'edit_pages',
125
  'edittemplates',
126
  array(&$this, 'adminPage')
127
  );
128
+ $this->add_hook = add_submenu_page(
129
  'edittemplates',
130
  __('Add New Templates', TINYMCE_TEMPLATES_DOMAIN),
131
  __('Add New', TINYMCE_TEMPLATES_DOMAIN),
133
  'addnewtemplates',
134
  array(&$this, 'adminPage')
135
  );
136
+ add_action(
137
+ 'admin_head-'.$this->edit_hook,
138
+ array(&$this, 'admin_head')
139
+ );
140
+ add_action(
141
+ 'admin_head-'.$this->add_hook,
142
+ array(&$this, 'admin_head')
143
+ );
144
  }
145
 
146
 
163
  return $links;
164
  }
165
  }
166
+
167
  ?>