-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.inc.php
166 lines (138 loc) · 6 KB
/
config.inc.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
<?php
/**
* RexMarkitup for Redaxo
*
* @version 1.0.7
* @link http://markitup.jaysalvat.com
* @author Redaxo Addon: rexdev.de
* @package redaxo 4.4.x/4.5.x/4.6.x
*/
if($REX['SETUP'] === true) {
return;
}
#rex_register_extension('REX_MARKITUP_BUTTONS',
# function($params)
# { FB::log($params,' $params');
# $params['subject']['buttonsets'] .= ', headline: "h1,h2,h3"';
# $params['subject']['buttoncss'] .= '.markItUpButton.FOOBAR a {
# background-image: url("images/foobar.png") !important;
# }';
# return $params['subject'];
# }
#);
#rex_register_extension('REX_MARKITUP_IMAGE_TYPES_QUERY',
# function($params) use($REX)
# {
# return 'SELECT * FROM '.$REX['TABLE_PREFIX'].'679_types WHERE `name` NOT LIKE "rex_%" ORDER BY `name` ASC';
# }
#);
// PLUGIN IDENTIFIER & ROOT
////////////////////////////////////////////////////////////////////////////////
$mypage = 'rex_markitup';
$myroot = $REX['INCLUDE_PATH'].'/addons/'.$mypage.'/';
// APPEND LANG
////////////////////////////////////////////////////////////////////////////////
if(is_a($I18N,'i18n')) {
$I18N->appendFile($myroot.'lang/');
}
// AJAX API
////////////////////////////////////////////////////////////////////////////////
require_once $myroot.'pages/ajax_api.inc.php';
// ONLY @ LOGGED IN BACKEND SESSION
//////////////////////////////////////////////////////////////////////////////
if( !$REX['REDAXO'] || !is_a($REX["USER"],'rex_login_sql') ) {
return;
}
// REX COMMONS
////////////////////////////////////////////////////////////////////////////////
$REX['ADDON']['version'][$mypage] = '1.0.7';
$REX['ADDON']['author'][$mypage] = 'jdlx';
$REX['ADDON']['supportpage'][$mypage] = 'rexdev.de';
$REX['ADDON']['page'][$mypage] = $mypage;
$REX['ADDON']['name'][$mypage] = 'RexMarkitup';
$REX['ADDON']['title'][$mypage] = 'RexMarkitup';
$REX['ADDON']['perm'][$mypage] = 'rexmarkitup[]';
$REX['PERM'][] = 'rexmarkitup[]';
// DEFAULT SETTINGS
////////////////////////////////////////////////////////////////////////////////
$REX['ADDON'][$mypage]['settings'] = array (
'imm_sql_where' => '',
'buttoncss' => '',
'buttondefinitions' => '',
'buttonsets' => 'standard:
"h1,h2,h3,h4,|,bold,italic,stroke,ins,cite,code,|,listbullet,listnumeric,|,immimagemenu,linkmedia,|,linkintern,linkextern,linkmailto,|,preview,rex_a79_help,fullscreen,slice_update,slice_save",
compact:
"blockmenu,|,bold,italic,stroke,ins,cite,code,|,listbullet,listnumeric,|,immimagemenu,linkmedia,|,linkmenu,|,preview,rex_a79_help,fullscreen,slice_update,slice_save",
full:
"blockmenu,|,h1,h2,h3,h4,h5,h6,|,bold,italic,stroke,ins,cite,code,|,alignleft,alignright,aligncenter,alignjustify,|,listbullet,listnumeric,|,image,linkmedia,|,linkmenu,linkintern,linkextern,linkmailto,|,preview,rex_a79_help,fullscreen,slice_update,slice_save"',
'options' => 'smartinsert: true,
previewfrontend: false',
);
// USER SETTINGS
////////////////////////////////////////////////////////////////////////////////
$user_prefs = $REX['INCLUDE_PATH'].'/data/addons/'.$mypage.'/'.$mypage.'.settings.php';
if(file_exists($user_prefs)) {
require_once $user_prefs;
}
// INCLUDE ASSETS @ OPF
////////////////////////////////////////////////////////////////////////////////
rex_register_extension('OUTPUT_FILTER',
function($params) use($REX)
{
if(preg_match('/<textarea[^>]*class="[^"]*rex-markitup/',$params['subject']) == 0) {
return;
}
if(!isset($REX['ADDON']['image_manager']['types'])) {
rex_markitup_imm_imgtypes();
}
// EP
////////////////////////////////////////////////////////////////////////////
$ep = rex_register_extension_point(
'REX_MARKITUP_BUTTONS',
array(
'buttondefinitions' => stripslashes($REX['ADDON']['rex_markitup']['settings']["buttondefinitions"]),
'buttonsets' => stripslashes($REX['ADDON']['rex_markitup']['settings']["buttonsets"]),
'buttoncss' => stripslashes($REX['ADDON']['rex_markitup']['settings']["buttoncss"]),
'options' => stripslashes($REX['ADDON']['rex_markitup']['settings']["options"]),
'immtypes' => $REX['ADDON']['image_manager']['types'],
)
);
$buttondefinitions = $ep['buttondefinitions'];
$buttonsets = $ep['buttonsets'];
$buttoncss = $ep['buttoncss'];
$immtypes = $ep['immtypes'];
$options = $ep['options'];
// CSS @ HEAD
////////////////////////////////////////////////////////////////////////////
$head = '
<!-- rex_markitup head assets -->
<link rel="stylesheet" href="../files/addons/rex_markitup/custom/markitup/skins/rex_markitup/style.css">
<link rel="stylesheet" href="../files/addons/rex_markitup/custom/markitup/sets/rex_markitup/style.css">
<style>
'.$buttoncss.'
</style>
<!-- end rex_markitup head assets -->
';
$params['subject'] = str_replace('</head>',$head.'</head>',$params['subject']);
// JS @ BODY
////////////////////////////////////////////////////////////////////////////
$body = '
<!-- rex_markitup body assets -->
<script src="../files/addons/rex_markitup/vendor/markitup/jquery.markitup.js"></script>
<script type="text/javascript">
if(typeof rex_markitup === "undefined") { var rex_markitup = {}; }
rex_markitup.buttondefinitions = {'.PHP_EOL.$buttondefinitions.PHP_EOL.'} // buttondefinitions
rex_markitup.buttonsets = {'.PHP_EOL.$buttonsets.PHP_EOL.'} // buttonsets
rex_markitup.options = {'.PHP_EOL.$options.PHP_EOL.'} // buttonsets
rex_markitup.immtypes = '.json_encode($immtypes).' // immtypes
rex_markitup.chosen_imm_type = "" // last chosen imm type
</script>
<script src="../files/addons/rex_markitup/rex_markitup.js"></script>
<script type="text/javascript">
</script>
<!-- end rex_markitup body assets -->
';
$params['subject'] = str_replace('</body>',$body.'</body>',$params['subject']);
return $params['subject'];
}
);