-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·120 lines (93 loc) · 2.74 KB
/
index.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
<?php
/**
* @package post-editor
*/
/*
Plugin Name: Post Editor
Plugin URI: http://david-coombes.com
Description: Add a model for manipulating pasted data on the wordpress posts/page editor. Modal will be called from button on normal tinyMCE toolbar
Version: 0.1
Author: David Coombes
Author URI: http://david-coombes.com
*/
//debug?
error_reporting(E_ALL);
ini_set("display_errors", "on");
//constants
define("POSTEDITOR_DIR", WP_PLUGIN_DIR . "/" . basename(dirname(__FILE__)));
define("POSTEDITOR_URL", WP_PLUGIN_URL . "/" . basename(dirname(__FILE__)));
//vars
$posteditor_action = @$_REQUEST['posteditor_action'];
$posteditor_error = array();
$posteditor_message = array();
//include files
require_once( POSTEDITOR_DIR . "/application/includes/debug.func.php");
require_once( POSTEDITOR_DIR . "/application/Posteditor.class.php");
require_once( POSTEDITOR_DIR . "/application/modules/PosteditorModal.class.php");
//construct plugin objects
$posteditor = new Posteditor();
$posteditor_modal = new PosteditorModal();
/**
* Actions and Filters
*/
add_action('admin_init', array($posteditor, 'admin_init'));
add_action('admin_head', array($posteditor, 'admin_head'));
add_action('init', array($posteditor, 'init'));
add_action('wp_ajax_get_modal_editor',array($posteditor_modal,'get_page'));
register_activation_hook(__FILE__, 'posteditor_INSTALL');
function append_new_media_tab($tabs){
$newtab = array('genify' => __('Axcoto Genify','axcotogenify'));
return array_merge($tabs, $newtab);
}
add_filter('media_upload_tabs', 'append_new_media_tab');
/**
* Adds an error to the errors array.
*
* @global array $posteditor_error
* @param string $msg The error message
*/
function posteditor_error( $msg ){
global $posteditor_error;
$posteditor_error[] = $msg;
}
/**
* Builds up the error box from the errors array.
*
* @global array $posteditor_error
* @return string
*/
function posteditor_get_errors(){
global $posteditor_error;
$html = "<div id=\"message\" class=\"error\"><ul>\n";
if (!count($posteditor_error))
return false;
foreach ($posteditor_error as $error)
$html .= "<li>{$error}</li>\n";
return $html . "</ul></div>\n";
}
/**
* Builds up the messages box from the messages array.
*
* @global array $posteditor_message
* @return string
*/
function posteditor_get_messages(){
global $posteditor_message;
$html = "<div id=\"message-1\" class=\"updated\"><ul>\n";
if (!count($posteditor_message))
return false;
foreach ($posteditor_message as $msg)
$html .= "<li>{$msg}</li>\n";
return $html . "</ul></div>\n";
}
/**
* Adds a message to the messages array.
*
* @global array $posteditor_message
* @param string $msg
*/
function posteditor_message( $msg ){
global $posteditor_message;
$posteditor_message[] = $msg;
}
?>