forked from scribu/wp-front-end-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-end-editor.php
197 lines (160 loc) · 5.1 KB
/
front-end-editor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?php
/*
Plugin Name: Front-end Editor
Version: 1.9.3-alpha
Description: Allows you to edit your posts without going through the admin interface
Author: scribu
Author URI: http://scribu.net/
Plugin URI: http://scribu.net/wordpress/front-end-editor
Text Domain: front-end-editor
Domain Path: /lang
Copyright (C) 2010 Cristi Burcă (scribu@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
( at your option ) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Load scbFramework
require dirname( __FILE__ ) . '/scb/load.php';
define( 'FRONT_END_EDITOR_PLUGIN_BASENAME', dirname( plugin_basename( __FILE__ ) ) );
function _fee_init() {
$dir = dirname( __FILE__ );
// Load files
require_once $dir . '/core.php';
foreach ( array( 'base', 'post', 'other' ) as $name )
require_once "$dir/fields/$name.php";
$options = new scbOptions( 'front-end-editor', __FILE__, array(
'disabled' => array('bloginfo'),
'highlight' => true,
'tooltip' => true,
'rich' => true,
'chunks' => false,
'cleditor_controls' =>
"bold italic strikethrough | " .
"alignleft center alignright | " .
"font size style | " .
"color highlight removeformat | " .
"bullets numbering | " .
"link wpimage | " .
"source"
) );
FEE_Core::init( $options, '1.9.2' );
FEE_Field_Option::init( __FILE__ );
FEE_Field_Image::init( __FILE__ );
if ( is_admin() ) {
load_plugin_textdomain( 'front-end-editor', '', FRONT_END_EDITOR_PLUGIN_BASENAME . '/lang/admin' );
require_once $dir . '/admin/admin.php';
scbAdminPage::register( 'Fee_Admin', __FILE__, $options );
}
add_action( 'init', 'fee_register_defaults' );
}
scb_init( '_fee_init' );
function fee_register_defaults() {
$fields = array(
'the_title' => array(
'title' => __( 'Post title', 'front-end-editor' ),
'class' => 'FEE_Field_Post',
'type' => 'input',
'argc' => 2,
),
'the_content' => array(
'title' => __( 'Post content', 'front-end-editor' ),
'class' => FEE_Core::$options->chunks ? 'FEE_Field_Chunks' : 'FEE_Field_Post',
'type' => FEE_Core::$options->rich ? 'rich' : 'textarea',
),
'editable' => array(
'title' => '',
'class' => 'FEE_Shortcode_Editable',
),
'the_excerpt' => array(
'title' => __( 'Post excerpt', 'front-end-editor' ),
'class' => 'FEE_Field_Excerpt',
'type' => 'textarea',
),
'the_category' => array(
'title' => __( 'Post categories', 'front-end-editor' ),
'class' => 'FEE_Field_Category',
'type' => 'terminput',
'argc' => 3,
),
'the_tags' => array(
'title' => __( 'Post tags', 'front-end-editor' ),
'class' => 'FEE_Field_Tags',
'type' => 'terminput',
'argc' => 4,
),
'the_terms' => array(
'title' => __( 'Post terms', 'front-end-editor' ),
'class' => 'FEE_Field_Terms',
'type' => 'terminput',
'argc' => 5,
),
'post_meta' => array(
'title' => __( 'Post custom fields', 'front-end-editor' ),
'class' => 'FEE_Field_Meta',
'argc' => 5,
),
'post_thumbnail_html' => array(
'title' => __( 'Post thumbnail', 'front-end-editor' ),
'class' => 'FEE_Field_Thumbnail',
'type' => 'thumbnail',
'argc' => 4,
),
'comment_text' => array(
'title' => __( 'Comment text', 'front-end-editor' ),
'class' => 'FEE_Field_Comment',
'type' => 'textarea',
),
'single_cat_title' => array(
'title' => __( 'Category title', 'front-end-editor' ),
'class' => 'FEE_Field_Single_Title',
),
'single_tag_title' => array(
'title' => __( 'Tag title', 'front-end-editor' ),
'class' => 'FEE_Field_Single_Title',
),
'term_description' => array(
'title' => __( 'Term description', 'front-end-editor' ),
'class' => 'FEE_Field_Term_Field',
'type' => 'textarea',
'argc' => 3,
),
'the_author_description' => array(
'title' => __( 'Author description', 'front-end-editor' ),
'class' => 'FEE_Field_Author_Desc',
'type' => 'textarea',
'argc' => 2,
),
'dynamic_sidebar_params' => array(
'title' => __( 'Widgets', 'front-end-editor' ),
'class' => 'FEE_Field_Widget',
'type' => 'widget',
),
'bloginfo' => array(
'title' => __( 'Site title and description', 'front-end-editor' ),
'class' => 'FEE_Field_Bloginfo',
'argc' => 2,
),
'editable_option' => array(
'title' => __( 'Site options', 'front-end-editor' ),
'class' => 'FEE_Field_Option',
'argc' => 3,
),
'editable_image' => array(
'title' => __( 'Theme images', 'front-end-editor' ),
'class' => 'FEE_Field_Image',
'type' => 'image',
'argc' => 2,
),
);
foreach ( $fields as $filter => $args )
fee_register_field( $filter, $args );
// Safe hook for new editable fields to be registered
do_action( 'front_end_editor_fields' );
}