Version Description
- Fixed : Non-administrators with user editing capabilities could give new users a role with a higher level than their own (including Administrator)
Download this release
Release Info
Developer | kevinB |
Plugin | Capability Manager Enhanced |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.9 to 1.5.1
- admin.css +85 -6
- admin.dev.js +69 -0
- admin.js +3 -0
- capsman-enhanced.php +46 -10
- framework/.htaccess +0 -4
- framework/classes/abstract/component.php +0 -182
- framework/classes/abstract/module.php +0 -718
- framework/classes/abstract/plugin.php +126 -335
- framework/classes/abstract/theme.php +0 -273
- framework/classes/admin-notices.php +0 -70
- framework/classes/settings.php +0 -330
- framework/classes/template.php +0 -380
- framework/init.php +5 -60
- framework/lang/bg_BG.mo +0 -0
- framework/lang/bg_BG.po +0 -352
- framework/lang/ca.mo +0 -0
- framework/lang/ca.po +0 -315
- framework/lang/es_ES.mo +0 -0
- framework/lang/es_ES.po +0 -316
- framework/lang/framework.pot +0 -317
- framework/lang/it_IT.mo +0 -0
- framework/lang/it_IT.po +0 -417
- framework/lib/filesystem.php +0 -198
- framework/lib/formating.php +1 -123
- framework/lib/modules.php +0 -207
- framework/lib/objects.php +0 -110
- framework/lib/plugins.php +0 -33
- framework/lib/system.php +0 -36
- framework/lib/themes-agapetry.php +30 -0
- framework/lib/themes.php +0 -251
- framework/lib/users.php +1 -35
- framework/loader.php +3 -42
- framework/samples/alkivia.ini +0 -33
- framework/samples/alkivia.php +0 -42
- framework/styles/.htaccess +0 -4
- framework/styles/admin.css +3 -6
- framework/styles/images/alkivia.png +0 -0
- framework/styles/images/paypal.png +0 -0
- framework/vendor/upload/class.upload.php +0 -4752
- images/play.png +0 -0
- images/pp-logo.png +0 -0
- includes/admin.php +287 -205
- includes/author-widget.php +0 -40
- includes/backup-handler.php +91 -0
- includes/backup.php +8 -6
- includes/handler.php +351 -0
- includes/manager.php +53 -440
- includes/modify.php +265 -0
- includes/network.php +74 -0
- includes/pp-handler.php +65 -0
- includes/pp-ui.php +169 -0
- lang/capsman.mo +0 -0
- lang/capsman.po +281 -559
- lang/capsman.pot +156 -393
- readme.txt +61 -30
- samples/alkivia.ini +0 -18
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
- screenshot-4.jpg +0 -0
- screenshot-5.jpg +0 -0
- screenshot-6.jpg +0 -0
admin.css
CHANGED
@@ -48,7 +48,7 @@ a.cap_type:hover {
|
|
48 |
|
49 |
ul.cme-listhoriz li {
|
50 |
text-align: center;
|
51 |
-
padding-right:
|
52 |
}
|
53 |
|
54 |
ul.cme-listhoriz li table{
|
@@ -85,16 +85,92 @@ height: 2em;
|
|
85 |
}
|
86 |
|
87 |
table .cme-typecaps th {
|
88 |
-
padding-left: 0.
|
89 |
-
padding-right: 0.
|
90 |
}
|
91 |
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
color:green;font-weight:bold;
|
94 |
}
|
95 |
|
96 |
-
td.
|
97 |
-
color
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
|
100 |
#akmin input.button {
|
@@ -123,4 +199,7 @@ margin-top:5px;
|
|
123 |
padding-bottom: 30px;
|
124 |
}
|
125 |
|
|
|
|
|
|
|
126 |
/* EOF */
|
48 |
|
49 |
ul.cme-listhoriz li {
|
50 |
text-align: center;
|
51 |
+
padding-right: 1em;
|
52 |
}
|
53 |
|
54 |
ul.cme-listhoriz li table{
|
85 |
}
|
86 |
|
87 |
table .cme-typecaps th {
|
88 |
+
padding-left: 0.3em;
|
89 |
+
padding-right: 0.3em;
|
90 |
}
|
91 |
|
92 |
+
table.cme-typecaps span.cap-x {
|
93 |
+
display: none;
|
94 |
+
}
|
95 |
+
|
96 |
+
a.neg-cap, a.cap-on, a.type-on, a.neg-type-caps, a.cme-neg-all {
|
97 |
+
text-decoration: none;
|
98 |
+
}
|
99 |
+
|
100 |
+
span.cap-x, a.cme-neg-all {
|
101 |
+
color: red;
|
102 |
+
font-size: 1.5em;
|
103 |
+
padding-left: 1px;
|
104 |
+
padding-right: 1px;
|
105 |
+
vertical-align: middle;
|
106 |
+
}
|
107 |
+
|
108 |
+
a.cme-switch-all {
|
109 |
+
color: black;
|
110 |
+
font-size: 1.5em;
|
111 |
+
padding-right: 1px;
|
112 |
+
padding-right: 1px;
|
113 |
+
vertical-align: middle;
|
114 |
+
text-decoration: line-through;
|
115 |
+
}
|
116 |
+
|
117 |
+
td.cap-yes span {
|
118 |
color:green;font-weight:bold;
|
119 |
}
|
120 |
|
121 |
+
td.cap-no {
|
122 |
+
color:#777;
|
123 |
+
}
|
124 |
+
|
125 |
+
td.cap-neg label span {
|
126 |
+
color: red;
|
127 |
+
}
|
128 |
+
|
129 |
+
td.cap-neg input {
|
130 |
+
display:none;
|
131 |
+
}
|
132 |
+
|
133 |
+
td.cap-no span.cap-x, td.cap-yes span.cap-x {
|
134 |
+
display:none;
|
135 |
+
}
|
136 |
+
|
137 |
+
td.cap-neg span.cap-x {
|
138 |
+
display:inline;
|
139 |
+
}
|
140 |
+
|
141 |
+
td.cap-neg a.neg-cap {
|
142 |
+
display:none;
|
143 |
+
}
|
144 |
+
|
145 |
+
/*
|
146 |
+
span.cme-drop-cap {
|
147 |
+
color: #aaa;
|
148 |
+
}
|
149 |
+
*/
|
150 |
+
|
151 |
+
td.cap-metagroup label span {
|
152 |
+
color: #080 !important;
|
153 |
+
}
|
154 |
+
|
155 |
+
td.cap-locked label input {
|
156 |
+
display: inline !important;
|
157 |
+
}
|
158 |
+
|
159 |
+
td.cap-locked a.neg-cap {
|
160 |
+
display: none !important;
|
161 |
+
}
|
162 |
+
|
163 |
+
a.type-off, a.neg-cap, a.cme-neg-all, a.neg-type-caps {
|
164 |
+
color: #800;
|
165 |
+
}
|
166 |
+
|
167 |
+
a.type-on, a.cap-on, a.cme-switch-all {
|
168 |
+
color: black;
|
169 |
+
}
|
170 |
+
|
171 |
+
input.cme-check-all, a.cme-neg-all {
|
172 |
+
margin-right: 10px;
|
173 |
+
padding-right: 10px;
|
174 |
}
|
175 |
|
176 |
#akmin input.button {
|
199 |
padding-bottom: 30px;
|
200 |
}
|
201 |
|
202 |
+
td.cm-has-via-pp {
|
203 |
+
background-color: #7f7;
|
204 |
+
}
|
205 |
/* EOF */
|
admin.dev.js
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready( function($) {
|
2 |
+
$('a.neg-cap').attr('title',cmeAdmin.negationCaption);
|
3 |
+
$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);
|
4 |
+
$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);
|
5 |
+
$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);
|
6 |
+
$('span.cap-x').attr('title',cmeAdmin.capNegated);
|
7 |
+
$('table.cme-checklist input[class!="cme-check-all"]').attr('title',cmeAdmin.chkCaption);
|
8 |
+
|
9 |
+
$('table.cme-checklist a.neg-cap').click( function(e) {
|
10 |
+
$(this).closest('td').removeClass('cap-yes').removeClass('cap-no').addClass('cap-neg');
|
11 |
+
|
12 |
+
var cap_name_attr = $(this).parent().find('input[type="checkbox"]').attr('name');
|
13 |
+
$(this).after('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');
|
14 |
+
|
15 |
+
return false;
|
16 |
+
});
|
17 |
+
|
18 |
+
//$('table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span').live( 'click', function(e) {
|
19 |
+
$(document).on( 'click', 'table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span', function(e) {
|
20 |
+
$(this).closest('td').removeClass('cap-neg').removeClass('cap-yes').addClass('cap-no');
|
21 |
+
$(this).parent().find('input[type="checkbox"]').prop('checked',false);
|
22 |
+
$(this).parent().find('input.cme-negation-input').remove();
|
23 |
+
|
24 |
+
return false;
|
25 |
+
});
|
26 |
+
|
27 |
+
$('input.cme-check-all').click( function(e) {
|
28 |
+
$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked', $(this).is(":checked") );
|
29 |
+
});
|
30 |
+
|
31 |
+
$('a.cme-neg-all').click( function(e) {
|
32 |
+
$(this).closest('table').find('a.neg-cap:visible').click();
|
33 |
+
return false;
|
34 |
+
});
|
35 |
+
|
36 |
+
$('a.cme-switch-all').click( function(e) {
|
37 |
+
$(this).closest('table').find('td.cap-neg span').click();
|
38 |
+
return false;
|
39 |
+
});
|
40 |
+
|
41 |
+
$('table.cme-typecaps a.neg-type-caps').click( function(e) {
|
42 |
+
$(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each( function(e) {
|
43 |
+
$(this).addClass('cap-neg');
|
44 |
+
|
45 |
+
var cap_name_attr = $(this).parent().find('input[type="checkbox"]').attr('name');
|
46 |
+
$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');
|
47 |
+
});
|
48 |
+
|
49 |
+
return false;
|
50 |
+
});
|
51 |
+
|
52 |
+
//http://stackoverflow.com/users/803925/nbrooks
|
53 |
+
$('table.cme-typecaps th').click(function(){
|
54 |
+
var columnNo = $(this).index();
|
55 |
+
|
56 |
+
var check_val = ! $(this).prop('checked_all');
|
57 |
+
|
58 |
+
if ( $(this).hasClass('term-cap') )
|
59 |
+
var class_sel = '[class*="term-cap"]';
|
60 |
+
else
|
61 |
+
var class_sel = '[class*="post-cap"]';
|
62 |
+
|
63 |
+
$(this).closest("table")
|
64 |
+
.find("tr td" + class_sel + ":nth-child(" + (columnNo+1) + ') input[type="checkbox"]:visible')
|
65 |
+
.prop("checked", check_val);
|
66 |
+
|
67 |
+
$(this).prop('checked_all',check_val);
|
68 |
+
});
|
69 |
+
});
|
admin.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){$('a.neg-cap').attr('title',cmeAdmin.negationCaption);$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);$('span.cap-x').attr('title',cmeAdmin.capNegated);$('table.cme-checklist input[class!="cme-check-all"]').attr('title',cmeAdmin.chkCaption);$('table.cme-checklist a.neg-cap').click(function(e){$(this).closest('td').removeClass('cap-yes').removeClass('cap-no').addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).after('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');return false;});$(document).on('click','table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span',function(e){$(this).closest('td').removeClass('cap-neg').removeClass('cap-yes').addClass('cap-no');$(this).parent().find('input[type="checkbox"]').prop('checked',false);$(this).parent().find('input.cme-negation-input').remove();return false;});$('input.cme-check-all').click(function(e){$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked',$(this).is(":checked"));});$('a.cme-neg-all').click(function(e){$(this).closest('table').find('a.neg-cap:visible').click();return false;});$('a.cme-switch-all').click(function(e){$(this).closest('table').find('td.cap-neg span').click();return false;});$('table.cme-typecaps a.neg-type-caps').click(function(e){$(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each(function(e){$(this).addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');});return false;});$('table.cme-typecaps th').click(function(){var columnNo=$(this).index();var check_val=!$(this).prop('checked_all');if($(this).hasClass('term-cap'))
|
2 |
+
var class_sel='[class*="term-cap"]';else
|
3 |
+
var class_sel='[class*="post-cap"]';$(this).closest("table").find("tr td"+class_sel+":nth-child("+(columnNo+1)+') input[type="checkbox"]:visible').prop("checked",check_val);$(this).prop('checked_all',check_val);});});
|
capsman-enhanced.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
Plugin Name: Capability Manager Enhanced
|
4 |
Plugin URI: http://presspermit.com/capability-manager
|
5 |
Description: Manage WordPress role definitions. Organizes available capabilities by post type, status and source.
|
6 |
-
Version: 1.
|
7 |
Author: Jordi Canals, Kevin Behrens
|
8 |
Author URI: http://agapetry.net
|
9 |
*/
|
10 |
-
|
11 |
/**
|
12 |
* Capability Manager. Main Plugin File.
|
13 |
* Plugin to create and manage Roles and Capabilities.
|
@@ -32,8 +32,8 @@ Author URI: http://agapetry.net
|
|
32 |
*/
|
33 |
|
34 |
if ( ! defined( 'CAPSMAN_VERSION' ) ) {
|
35 |
-
define( 'CAPSMAN_VERSION', '1.
|
36 |
-
define( 'CAPSMAN_ENH_VERSION', '1.
|
37 |
}
|
38 |
|
39 |
if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
@@ -41,6 +41,7 @@ if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
|
41 |
add_action('admin_notices', create_function('', 'echo \'<div id="message" class="error fade" style="color: black">' . $message . '</div>\';'));
|
42 |
return;
|
43 |
} else {
|
|
|
44 |
define ( 'AK_CMAN_PATH', dirname(__FILE__) );
|
45 |
define ( 'AK_CMAN_LIB', AK_CMAN_PATH . '/includes' );
|
46 |
|
@@ -68,11 +69,24 @@ if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
|
68 |
// Send an armin warning
|
69 |
add_action('admin_notices', '_cman_php_warning');
|
70 |
} else {
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
// Run the plugin
|
73 |
include_once ( AK_CMAN_PATH . '/framework/loader.php' );
|
74 |
include ( AK_CMAN_LIB . '/manager.php' );
|
75 |
-
|
|
|
|
|
|
|
|
|
76 |
} else {
|
77 |
load_plugin_textdomain('capsman', false, basename(dirname(__FILE__)) .'/lang');
|
78 |
add_action( 'admin_menu', 'cme_submenus' );
|
@@ -87,20 +101,28 @@ function _cme_act_pp_active() {
|
|
87 |
define( 'PP_ACTIVE', true );
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
// perf enchancement: display submenu links without loading framework and plugin code
|
91 |
function cme_submenus() {
|
92 |
if ( defined('PP_ACTIVE') ) { // Press Permit integrates into Permissions menu
|
93 |
add_action( 'pp_permissions_menu', '_cme_pp_menu' );
|
94 |
} else {
|
95 |
-
$menu_caption = ( defined('WPLANG') && WPLANG ) ? __('Capabilities', 'capsman') :
|
96 |
add_users_page( __('Capability Manager', 'capsman'), $menu_caption, 'manage_capabilities', 'capsman', 'cme_fakefunc');
|
97 |
}
|
98 |
|
99 |
-
|
|
|
100 |
}
|
101 |
|
102 |
function _cme_pp_menu() {
|
103 |
-
|
|
|
104 |
}
|
105 |
|
106 |
function cme_is_plugin_active($check_plugin_file) {
|
@@ -113,4 +135,18 @@ function cme_is_plugin_active($check_plugin_file) {
|
|
113 |
if ( false !== strpos($plugin_file, $check_plugin_file) )
|
114 |
return $plugin_file;
|
115 |
}
|
116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Plugin Name: Capability Manager Enhanced
|
4 |
Plugin URI: http://presspermit.com/capability-manager
|
5 |
Description: Manage WordPress role definitions. Organizes available capabilities by post type, status and source.
|
6 |
+
Version: 1.5.1
|
7 |
Author: Jordi Canals, Kevin Behrens
|
8 |
Author URI: http://agapetry.net
|
9 |
*/
|
10 |
+
|
11 |
/**
|
12 |
* Capability Manager. Main Plugin File.
|
13 |
* Plugin to create and manage Roles and Capabilities.
|
32 |
*/
|
33 |
|
34 |
if ( ! defined( 'CAPSMAN_VERSION' ) ) {
|
35 |
+
define( 'CAPSMAN_VERSION', '1.5.1' );
|
36 |
+
define( 'CAPSMAN_ENH_VERSION', '1.5.1' );
|
37 |
}
|
38 |
|
39 |
if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
41 |
add_action('admin_notices', create_function('', 'echo \'<div id="message" class="error fade" style="color: black">' . $message . '</div>\';'));
|
42 |
return;
|
43 |
} else {
|
44 |
+
define ( 'CME_FILE', __FILE__ );
|
45 |
define ( 'AK_CMAN_PATH', dirname(__FILE__) );
|
46 |
define ( 'AK_CMAN_LIB', AK_CMAN_PATH . '/includes' );
|
47 |
|
69 |
// Send an armin warning
|
70 |
add_action('admin_notices', '_cman_php_warning');
|
71 |
} else {
|
72 |
+
global $pagenow;
|
73 |
+
|
74 |
+
if ( is_admin() &&
|
75 |
+
( isset($_REQUEST['page']) && in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) )
|
76 |
+
|| ( ! empty($_SERVER['SCRIPT_NAME']) && strpos( $_SERVER['SCRIPT_NAME'], 'p-admin/plugins.php' ) && ! empty($_REQUEST['action'] ) )
|
77 |
+
|| ( isset($_GET['action']) && 'reset-defaults' == $_GET['action'] )
|
78 |
+
|| in_array( $pagenow, array( 'users.php', 'user-edit.php', 'profile.php', 'user-new.php' ) )
|
79 |
+
) ) {
|
80 |
+
global $capsman;
|
81 |
+
|
82 |
// Run the plugin
|
83 |
include_once ( AK_CMAN_PATH . '/framework/loader.php' );
|
84 |
include ( AK_CMAN_LIB . '/manager.php' );
|
85 |
+
$capsman = new CapabilityManager(__FILE__, 'capsman');
|
86 |
+
|
87 |
+
if ( isset($_REQUEST['page']) && ( 'capsman' == $_REQUEST['page'] ) ) {
|
88 |
+
add_action( 'admin_enqueue_scripts', '_cme_pp_scripts' );
|
89 |
+
}
|
90 |
} else {
|
91 |
load_plugin_textdomain('capsman', false, basename(dirname(__FILE__)) .'/lang');
|
92 |
add_action( 'admin_menu', 'cme_submenus' );
|
101 |
define( 'PP_ACTIVE', true );
|
102 |
}
|
103 |
|
104 |
+
function _cme_pp_scripts() {
|
105 |
+
wp_enqueue_style( 'plugin-install' );
|
106 |
+
wp_enqueue_script( 'plugin-install' );
|
107 |
+
add_thickbox();
|
108 |
+
}
|
109 |
+
|
110 |
// perf enchancement: display submenu links without loading framework and plugin code
|
111 |
function cme_submenus() {
|
112 |
if ( defined('PP_ACTIVE') ) { // Press Permit integrates into Permissions menu
|
113 |
add_action( 'pp_permissions_menu', '_cme_pp_menu' );
|
114 |
} else {
|
115 |
+
$menu_caption = ( defined('WPLANG') && WPLANG ) ? __('Capabilities', 'capsman') : 'Role Capabilities';
|
116 |
add_users_page( __('Capability Manager', 'capsman'), $menu_caption, 'manage_capabilities', 'capsman', 'cme_fakefunc');
|
117 |
}
|
118 |
|
119 |
+
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
|
120 |
+
add_management_page(__('Capability Manager', 'capsman'), __('Capability Manager', 'capsman'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
|
121 |
}
|
122 |
|
123 |
function _cme_pp_menu() {
|
124 |
+
global $pp_admin;
|
125 |
+
add_submenu_page( $pp_admin->get_menu('options'), __('Capability Manager', 'capsman'), __('Role Capabilities', 'capsman'), 'manage_capabilities', 'capsman', 'cme_fakefunc' );
|
126 |
}
|
127 |
|
128 |
function cme_is_plugin_active($check_plugin_file) {
|
135 |
if ( false !== strpos($plugin_file, $check_plugin_file) )
|
136 |
return $plugin_file;
|
137 |
}
|
138 |
+
}
|
139 |
+
|
140 |
+
// if a role is marked as hidden, also default it for use by Press Permit as a Pattern Role (when PP Collaborative Editing is activated and Advanced Settings enabled)
|
141 |
+
function _cme_pp_default_pattern_role( $role ) {
|
142 |
+
if ( ! $pp_role_usage = get_option( 'pp_role_usage' ) )
|
143 |
+
$pp_role_usage = array();
|
144 |
+
|
145 |
+
if ( empty( $pp_role_usage[$role] ) ) {
|
146 |
+
$pp_role_usage[$role] = 'pattern';
|
147 |
+
update_option( 'pp_role_usage', $pp_role_usage );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
if ( is_multisite() )
|
152 |
+
require_once ( AK_CMAN_PATH . '/includes/network.php' );
|
framework/.htaccess
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
# Prevent running or accessing any file directly.
|
2 |
-
|
3 |
-
Order Deny,Allow
|
4 |
-
Deny from all
|
|
|
|
|
|
|
|
framework/classes/abstract/component.php
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Component.
|
4 |
-
* Manages the main functionality for all components.
|
5 |
-
*
|
6 |
-
* @version $Rev: 203758 $
|
7 |
-
* @author Jordi Canals
|
8 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
9 |
-
* @license GNU General Public License version 2
|
10 |
-
* @link http://alkivia.org
|
11 |
-
* @package Alkivia
|
12 |
-
* @subpackage Framework
|
13 |
-
*
|
14 |
-
|
15 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
16 |
-
|
17 |
-
This program is free software; you can redistribute it and/or
|
18 |
-
modify it under the terms of the GNU General Public License
|
19 |
-
version 2 as published by the Free Software Foundation.
|
20 |
-
|
21 |
-
This program is distributed in the hope that it will be useful,
|
22 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
-
GNU General Public License for more details.
|
25 |
-
|
26 |
-
You should have received a copy of the GNU General Public License
|
27 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
-
*/
|
29 |
-
|
30 |
-
require_once ( AK_CLASSES . '/abstract/module.php' );
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Abtract class to be used as a component template.
|
34 |
-
* There are some special functions thay can declared in implementations to perform main actions:
|
35 |
-
* - componentActivate: (Protected) Actions to run when activating the component.
|
36 |
-
* - componentDeactivate: (Hook, must be public) Actions to run when deactivating the component.
|
37 |
-
* - componentUpdate: (Protected) Actions to update the component to a new version. (Updating version on DB is done after this).
|
38 |
-
* - componentsLoaded: (Protected) Actions to run when components initialization is performed (In plugins loaded).
|
39 |
-
* - registerWidgets: (Protected) Actions to init plugin widgets (In widgets_init).
|
40 |
-
*
|
41 |
-
* @since 0.7
|
42 |
-
* @author Jordi Canals
|
43 |
-
* @package AOC
|
44 |
-
* @subpackage Library
|
45 |
-
* @link http://alkivia.org
|
46 |
-
*/
|
47 |
-
abstract class akComponentAbstract extends akModuleAbstract
|
48 |
-
{
|
49 |
-
/**
|
50 |
-
* Parent plugin slug.
|
51 |
-
* This is used on menus and form actions.
|
52 |
-
*
|
53 |
-
* @var string
|
54 |
-
*/
|
55 |
-
protected $slug;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Class constructor.
|
59 |
-
* Calls the implementated method 'startUp' if it exists. This is done at plugins loading time.
|
60 |
-
* Prepares admin menus by seting an action for the implemented method '_adminMenus' if it exists.
|
61 |
-
*
|
62 |
-
* @param string $file The main file to run the component.
|
63 |
-
* @return aocComponent The component object.
|
64 |
-
*/
|
65 |
-
final function __construct ( $file )
|
66 |
-
{
|
67 |
-
parent::__construct('component', '', $file);
|
68 |
-
$this->slug = ak_get_object($this->PID)->getSlug();
|
69 |
-
|
70 |
-
// Activating and deactivating hooks.
|
71 |
-
add_action('ak_activate_' . $this->ID, array($this, 'activate'));
|
72 |
-
add_action('ak_deactivate_' . $this->ID, array($this, 'componentDeactivate'));
|
73 |
-
|
74 |
-
add_action('ak_' . $this->PID . '_components_init', array($this, 'init'));
|
75 |
-
add_action('ak_' . $this->PID . '_widgets_init', array($this, 'widgetsInit'));
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Fires on plugin activation.
|
80 |
-
* @return void
|
81 |
-
*/
|
82 |
-
protected function componentActivate () {}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Fires on plugin deactivation.
|
86 |
-
* @return void
|
87 |
-
*/
|
88 |
-
public function componentDeactivate () {}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Updates the plugin to a new version.
|
92 |
-
* @param string $version Old component version.
|
93 |
-
* @return void
|
94 |
-
*/
|
95 |
-
protected function componentUpdate ( $version ) {}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Fires when plugins have been loaded.
|
99 |
-
* @return void
|
100 |
-
*/
|
101 |
-
protected function componentsLoaded () {}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Fires on Widgets init.
|
105 |
-
* @return void
|
106 |
-
*/
|
107 |
-
protected function registerWidgets () {}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Activates the Component.
|
111 |
-
* Sets the plugin version in the component settings to be saved to DB.
|
112 |
-
*
|
113 |
-
* @hook action aoc_activate_$component
|
114 |
-
* @access private
|
115 |
-
* @return void
|
116 |
-
*/
|
117 |
-
final function activate()
|
118 |
-
{
|
119 |
-
$this->componentActivate();
|
120 |
-
add_option($this->ID . '_version', $this->version);
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Inits the component.
|
125 |
-
* Here whe call the 'update' and 'init' functions. This is done after the components are loaded.
|
126 |
-
* Also the component version is updated here.
|
127 |
-
*
|
128 |
-
* @hook action aoc_components_init
|
129 |
-
* @access private
|
130 |
-
* @return void
|
131 |
-
*/
|
132 |
-
final function init ()
|
133 |
-
{
|
134 |
-
if ( $this->needs_update ) {
|
135 |
-
$this->componentUpdate( $this->getOption('version') );
|
136 |
-
update_option($this->ID . '_version', $this->version);
|
137 |
-
}
|
138 |
-
|
139 |
-
// Call the custom init for the component.
|
140 |
-
$this->componentsLoaded();
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Inits the widgets (In action 'widgets_init')
|
145 |
-
* Before loading the widgets, we check that standard sidebar is present.
|
146 |
-
*
|
147 |
-
* @hook action 'widgets_init'
|
148 |
-
* @return void
|
149 |
-
*/
|
150 |
-
final function widgetsInit()
|
151 |
-
{
|
152 |
-
if ( class_exists('WP_Widget') && function_exists('register_widget') && function_exists('unregister_widget') ) {
|
153 |
-
$this->registerWidgets();
|
154 |
-
} else {
|
155 |
-
add_action('admin_notices', array($this, 'noSidebarWarning'));
|
156 |
-
}
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Loads component data.
|
161 |
-
* As it is a child component, data is loaded into akModuleAbstract::child_data
|
162 |
-
*
|
163 |
-
* @return void
|
164 |
-
*/
|
165 |
-
final protected function loadData()
|
166 |
-
{
|
167 |
-
if ( empty( $this->child_data) ) {
|
168 |
-
$component_data = ak_component_data($this->mod_file, true);
|
169 |
-
$readme_data = ak_module_readme_data($this->mod_file);
|
170 |
-
$this->child_data = array_merge($readme_data, $component_data);
|
171 |
-
|
172 |
-
$this->PID = $this->child_data['Parent'];
|
173 |
-
$this->mod_data = ak_get_object($this->PID)->getModData();
|
174 |
-
|
175 |
-
if ( empty( $this->child_data['Version']) ) {
|
176 |
-
$this->version = $this->mod_data['Version'];
|
177 |
-
} else {
|
178 |
-
$this->version = $this->child_data['Version'];
|
179 |
-
}
|
180 |
-
}
|
181 |
-
}
|
182 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/classes/abstract/module.php
DELETED
@@ -1,718 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class for Modules management.
|
4 |
-
* Modules are Plugins, Themes and plugin components.
|
5 |
-
*
|
6 |
-
* @version $Rev: 203758 $
|
7 |
-
* @author Jordi Canals
|
8 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
9 |
-
* @license GNU General Public License version 2
|
10 |
-
* @link http://alkivia.org
|
11 |
-
* @package Alkivia
|
12 |
-
* @subpackage Framework
|
13 |
-
*
|
14 |
-
|
15 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
16 |
-
|
17 |
-
This program is free software; you can redistribute it and/or
|
18 |
-
modify it under the terms of the GNU General Public License
|
19 |
-
version 2 as published by the Free Software Foundation.
|
20 |
-
|
21 |
-
This program is distributed in the hope that it will be useful,
|
22 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
-
GNU General Public License for more details.
|
25 |
-
|
26 |
-
You should have received a copy of the GNU General Public License
|
27 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
-
*/
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Abtract class to be used as a theme template.
|
32 |
-
* Must be implemented before using this class.
|
33 |
-
* There are some special functions that have to be declared in implementations to perform main actions:
|
34 |
-
* - moduleLoad (Protected) Additional actions to be run at module load time.
|
35 |
-
* - defaultOptions (Protected) Returns the module default options.
|
36 |
-
* - widgetsInit (Public) Runs at 'widgets_init' action.
|
37 |
-
* - wpInit (Public) Runs at 'init' action.
|
38 |
-
* - adminMenus (Public) Runs at 'admin_menus' option, used to set admin menus and page options.
|
39 |
-
*
|
40 |
-
* @author Jordi Canals
|
41 |
-
* @package Alkivia
|
42 |
-
* @subpackage Framework
|
43 |
-
* @link http://wiki.alkivia.org/framework/classes/module
|
44 |
-
*
|
45 |
-
* @uses akSettings
|
46 |
-
*/
|
47 |
-
|
48 |
-
abstract class akModuleAbstract
|
49 |
-
{
|
50 |
-
/**
|
51 |
-
* Module ID. Is the module internal short name.
|
52 |
-
* Filled in constructor (as a constructor param). Used for translations textdomain.
|
53 |
-
*
|
54 |
-
* @var string
|
55 |
-
*/
|
56 |
-
public $ID;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Component parent ID.
|
60 |
-
* Used only for components.
|
61 |
-
*
|
62 |
-
* @var string
|
63 |
-
*/
|
64 |
-
public $PID = '';
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Module version number.
|
68 |
-
*
|
69 |
-
* @since 0.8
|
70 |
-
*
|
71 |
-
* @var string
|
72 |
-
*/
|
73 |
-
public $version;
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Module Type using a class constant: self::PLUGIN, self::COMPONENT, seelf::THEME, self::CHILD_THEME
|
77 |
-
* By default is set to 0 (unknown).
|
78 |
-
*
|
79 |
-
* @var int
|
80 |
-
*/
|
81 |
-
protected $mod_type = 0;
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Full path to module main file.
|
85 |
-
* Main file is 'style.css' for themes and the php file with data header for plugins and components.
|
86 |
-
*
|
87 |
-
* @var string
|
88 |
-
*/
|
89 |
-
protected $mod_file;
|
90 |
-
|
91 |
-
/**
|
92 |
-
* URL to the module folder.
|
93 |
-
*
|
94 |
-
* @var string
|
95 |
-
*/
|
96 |
-
protected $mod_url;
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Module data. Readed from the main plugin file header and the readme file.
|
100 |
-
* Filled in loadModuleData(). Called in constructor.
|
101 |
-
* From the filename:
|
102 |
-
* - 'ID' - Module internal short name. Taken from main module's file name.
|
103 |
-
* From themes style.css file header:
|
104 |
-
* - 'Name' - Name of the theme.
|
105 |
-
* - 'Title' - Long title for the theme. As WP 2.8 is the same as 'Name'.
|
106 |
-
* - 'URI' - Theme's page URI.
|
107 |
-
* - 'Description' - Description of theme's features.
|
108 |
-
* - 'Author' - Author name and link (to author home).
|
109 |
-
* - 'Version' - Theme Version number.
|
110 |
-
* - 'Template' - The parent theme (If this is a child theme).
|
111 |
-
* - 'Tags' - An array of theme tags features.
|
112 |
-
* From plugins file header:
|
113 |
-
* - 'Name' - Name of the plugin, must be unique.
|
114 |
-
* - 'Title' - Title of the plugin and the link to the plugin's web site.
|
115 |
-
* - 'Description' - Description of what the plugin does and/or notes from the author.
|
116 |
-
* - 'Author' - The author's name
|
117 |
-
* - 'AuthorURI' - The author's web site address.
|
118 |
-
* - 'Version' - The plugin's version number.
|
119 |
-
* - 'PluginURI' - Plugin's web site address.
|
120 |
-
* - 'TextDomain' - Plugin's text domain for localization.
|
121 |
-
* - 'DomainPath' - Plugin's relative directory path to .mo files.
|
122 |
-
* From readme.txt file :
|
123 |
-
* - 'Contributors' - An array with all contributors nicknames.
|
124 |
-
* - 'Tags' - An array with all plugin tags.
|
125 |
-
* - 'DonateURI' - The donations page address.
|
126 |
-
* - 'Requires' - Minimum required WordPress version.
|
127 |
-
* - 'Tested' - Higher WordPress version this plugin has been tested.
|
128 |
-
* - 'Stable' - Last stable tag when this was released.
|
129 |
-
*
|
130 |
-
* @var array
|
131 |
-
*/
|
132 |
-
protected $mod_data;
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Same as $mod_data but for child themes and components.
|
136 |
-
*
|
137 |
-
* From the Component file:
|
138 |
-
* - 'File' - FileName of the component (relative to plugin's folder).
|
139 |
-
* From componets file header:
|
140 |
-
* - 'File' - The component filename, relative to the plugin folder.
|
141 |
-
* - 'Component' - The component short name or ID.
|
142 |
-
* - 'Name' - Descriptive name for the component.
|
143 |
-
* - 'Description' - A descriptive text about the component.
|
144 |
-
* - 'Author' - Component author name
|
145 |
-
* - 'URL' - Author homepage URL.
|
146 |
-
* - 'Link' - Author anchor to home page.
|
147 |
-
* - 'Core' - If this is a core compoment or not.
|
148 |
-
* - 'Version' - Component version number.
|
149 |
-
* From readme.txt file:
|
150 |
-
* - Same as seen on akModuleAbstract::mod_data.
|
151 |
-
* From child themes file header:
|
152 |
-
* - Same as seen on akModuleAbstract::mod_data for themes.
|
153 |
-
*
|
154 |
-
* @var array
|
155 |
-
*/
|
156 |
-
protected $child_data = array();
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Theme saved data.
|
160 |
-
* - 'post' - Saves the current post.
|
161 |
-
* - 'more' - Saves the read more status.
|
162 |
-
*
|
163 |
-
* @var array
|
164 |
-
*/
|
165 |
-
protected $saved;
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Holds a reference to the global 'settings' object.
|
169 |
-
* This object has been created on the framework loader.
|
170 |
-
*
|
171 |
-
* @var akSettings
|
172 |
-
*/
|
173 |
-
protected $cfg;
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Flag to see if we are installing (activating for first time) or reactivating the module.
|
177 |
-
*
|
178 |
-
* @var boolean
|
179 |
-
*/
|
180 |
-
protected $installing = false;
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Flag to see if module needs to be updated.
|
184 |
-
*
|
185 |
-
* @var boolean
|
186 |
-
*/
|
187 |
-
protected $needs_update = false;
|
188 |
-
|
189 |
-
/** Constant used to define module as plugin. */
|
190 |
-
const PLUGIN = 10;
|
191 |
-
|
192 |
-
/** Constant used to define module as component. */
|
193 |
-
const COMPONENT = 15;
|
194 |
-
|
195 |
-
/** Constant used to define module as theme. */
|
196 |
-
const THEME = 20;
|
197 |
-
|
198 |
-
/** Constant used to define module as child theme. */
|
199 |
-
const CHILD_THEME = 25;
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Class constructor.
|
203 |
-
* Calls the implementated method 'startUp' if it exists. This is done at theme's loading time.
|
204 |
-
* Prepares admin menus by setting an action for the implemented method '_adminMenus' if it exists.
|
205 |
-
*
|
206 |
-
* @param string $type Module type. Must be one of 'plugin', 'component', 'theme'. (child themes are detected).
|
207 |
-
* @param string $ID Theme internal short name (known as theme ID).
|
208 |
-
* @param string $file Module file. Only for plugins and components. (For themes style.css is always used).
|
209 |
-
* @return akTheme
|
210 |
-
*/
|
211 |
-
public function __construct ( $type = '', $ID = '', $file = '' )
|
212 |
-
{
|
213 |
-
$this->cfg =& ak_settings_object();
|
214 |
-
|
215 |
-
switch ( strtolower($type) ) {
|
216 |
-
case 'plugin' :
|
217 |
-
$this->mod_type = self::PLUGIN;
|
218 |
-
$this->mod_file = trim($file);
|
219 |
-
break;
|
220 |
-
case 'component' :
|
221 |
-
$this->mod_type = self::COMPONENT;
|
222 |
-
$this->mod_file = trim($file);
|
223 |
-
break;
|
224 |
-
case 'theme' :
|
225 |
-
$this->mod_type = self::THEME;
|
226 |
-
$this->mod_file = STYLESHEETPATH . '/style.css';
|
227 |
-
break;
|
228 |
-
default:
|
229 |
-
$this->mod_type = 0; // Unknown.
|
230 |
-
}
|
231 |
-
|
232 |
-
$this->loadModuleData($ID);
|
233 |
-
if ( $this->isCompatible() ) {
|
234 |
-
add_action('init', array($this, 'systemInit'));
|
235 |
-
add_action('plugins_loaded', array($this, 'pluginsInit'));
|
236 |
-
add_action('widgets_init', array($this, 'widgetsInit'));
|
237 |
-
|
238 |
-
if ( ! apply_filters('ak_' . $this->ID . '_disable_admin', $this->getOption('disable-admin-page')) ) {
|
239 |
-
add_action('admin_menu', array($this, 'adminMenus'), 5); // execute prior to PP, to use menu hook
|
240 |
-
}
|
241 |
-
|
242 |
-
// Load styles
|
243 |
-
if ( is_admin() ) {
|
244 |
-
add_action('admin_print_styles', array($this, 'adminStyles'));
|
245 |
-
} else {
|
246 |
-
add_action('wp_print_styles', array($this, 'enqueueStyles'));
|
247 |
-
}
|
248 |
-
|
249 |
-
$this->moduleLoad();
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Executes as soon as module class is loaded.
|
255 |
-
*
|
256 |
-
* @return void
|
257 |
-
*/
|
258 |
-
protected function moduleLoad() {}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Prepares and returns default module options.
|
262 |
-
*
|
263 |
-
* @return array Options array
|
264 |
-
*/
|
265 |
-
protected function defaultOptions()
|
266 |
-
{
|
267 |
-
return array();
|
268 |
-
}
|
269 |
-
|
270 |
-
/**
|
271 |
-
* Fires at 'widgets_init' action hook
|
272 |
-
*.
|
273 |
-
* @return void
|
274 |
-
*/
|
275 |
-
public function widgetsInit () {}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Fires at 'init' action hook.
|
279 |
-
*
|
280 |
-
* @return void
|
281 |
-
*/
|
282 |
-
protected function wpInit () {}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Fires at 'admin_menus' action hook.
|
286 |
-
*
|
287 |
-
* @return void
|
288 |
-
*/
|
289 |
-
public function adminMenus () {}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Dummy method provided to check additional WP compatibility on inplementations.
|
293 |
-
* This is mostly used on plugins to check for WordPress required version.
|
294 |
-
*
|
295 |
-
* @return boolean
|
296 |
-
*/
|
297 |
-
public function isCompatible ()
|
298 |
-
{
|
299 |
-
return true;
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Loads module data.
|
304 |
-
* Loads different data for Plugin, Theme or Component.
|
305 |
-
*
|
306 |
-
* @return void
|
307 |
-
*/
|
308 |
-
abstract protected function loadData ();
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Functions to execute at system Init.
|
312 |
-
*
|
313 |
-
* @hook action 'init'
|
314 |
-
* @access private
|
315 |
-
*
|
316 |
-
* @return void
|
317 |
-
*/
|
318 |
-
final function systemInit ()
|
319 |
-
{
|
320 |
-
switch ( $this->mod_type ) {
|
321 |
-
case self::CHILD_THEME :
|
322 |
-
load_theme_textdomain('akchild', STYLESHEETPATH . '/lang');
|
323 |
-
case self::THEME :
|
324 |
-
load_theme_textdomain('aktheme', TEMPLATEPATH . '/lang');
|
325 |
-
break;
|
326 |
-
}
|
327 |
-
|
328 |
-
$this->wpInit();
|
329 |
-
}
|
330 |
-
|
331 |
-
/**
|
332 |
-
* Functions to execute after loading plugins.
|
333 |
-
*
|
334 |
-
* @return void
|
335 |
-
*/
|
336 |
-
final function pluginsInit ()
|
337 |
-
{
|
338 |
-
switch ( $this->mod_type ) {
|
339 |
-
case self::PLUGIN :
|
340 |
-
load_plugin_textdomain($this->ID, false, basename(dirname($this->mod_file)) . '/lang');
|
341 |
-
break;
|
342 |
-
case self::COMPONENT :
|
343 |
-
// TODO: Manage components translations.
|
344 |
-
break;
|
345 |
-
}
|
346 |
-
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Enqueues additional administration styles.
|
351 |
-
* Send the framework admin.css file and additionally any other admin.css file
|
352 |
-
* found on the module direcotry.
|
353 |
-
*
|
354 |
-
* @hook action 'admin_print_styles'
|
355 |
-
* @uses apply_filters() Calls the 'ak_framework_style_admin' filter on the framework style url.
|
356 |
-
* @uses apply_filters() Calls the 'ak_<Mod_ID>_style_admin' filter on the style url.
|
357 |
-
* @access private
|
358 |
-
*
|
359 |
-
* @return void
|
360 |
-
*/
|
361 |
-
final function adminStyles()
|
362 |
-
{
|
363 |
-
// FRAMEWORK admin styles.
|
364 |
-
$url = apply_filters('ak_framework_style_admin', AK_STYLES_URL . '/admin.css');
|
365 |
-
if ( ! empty($url) ) {
|
366 |
-
wp_register_style('ak_framework_admin', $url, false, get_option('ak_framework_version'));
|
367 |
-
wp_enqueue_style('ak_framework_admin');
|
368 |
-
}
|
369 |
-
|
370 |
-
// MODULE admin styles.
|
371 |
-
if ( $this->isChildTheme() && file_exists(STYLESHEETPATH . '/admin.css') ) {
|
372 |
-
$url = get_stylesheet_directory_uri() . '/admin.css';
|
373 |
-
} elseif ( $this->isTheme() && file_exists(TEMPLATEPATH . '/admin.css') ) {
|
374 |
-
$url = get_template_directory_uri() . '/admin.css';
|
375 |
-
} elseif ( file_exists(dirname($this->mod_file) . '/admin.css') ) {
|
376 |
-
$url = $this->mod_url . '/admin.css';
|
377 |
-
} else {
|
378 |
-
$url = '';
|
379 |
-
}
|
380 |
-
|
381 |
-
$url = apply_filters('ak_' . $this->ID . '_style_admin', $url);
|
382 |
-
if ( ! empty($url) ) {
|
383 |
-
wp_register_style('ak_' . $this->ID . '_admin', $url, array('ak_framework_admin'), $this->version);
|
384 |
-
wp_enqueue_style('ak_' . $this->ID . '_admin');
|
385 |
-
}
|
386 |
-
}
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Enqueues additional styles for plugins and components.
|
390 |
-
* For themes no styles are enqueued as them are already sent by WP.
|
391 |
-
*
|
392 |
-
* @hook action 'wp_print_styles'
|
393 |
-
* @uses apply_filters() Calls the 'ak_<Mod_ID>_style_url' filter on the style url.
|
394 |
-
* @access private
|
395 |
-
*
|
396 |
-
* @return void
|
397 |
-
*/
|
398 |
-
final function enqueueStyles()
|
399 |
-
{
|
400 |
-
if ( $this->isTheme() || $this->getOption('disable-module-styles') ) {
|
401 |
-
return;
|
402 |
-
}
|
403 |
-
|
404 |
-
$url = $this->getOption('style-url', false);
|
405 |
-
if ( false === $url ) {
|
406 |
-
if ( file_exists(dirname($this->mod_file) . '/style.css') ) {
|
407 |
-
$url = $this->mod_url . '/style.css';
|
408 |
-
} else {
|
409 |
-
$url = '';
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
$url = apply_filters('ak_' . $this->ID . '_style_url', $url);
|
414 |
-
if ( ! empty($url) ) {
|
415 |
-
wp_register_style('ak_' . $this->ID, $url, false, $this->version);
|
416 |
-
wp_enqueue_style('ak_' . $this->ID);
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Checks if current module is a Plugin.
|
422 |
-
* @return boolean
|
423 |
-
*/
|
424 |
-
final public function isPlugin()
|
425 |
-
{
|
426 |
-
return ( self::PLUGIN == $this->mod_type ) ? true : false;
|
427 |
-
}
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Checks if current module is a Component.
|
431 |
-
* @return boolean
|
432 |
-
*/
|
433 |
-
final public function isComponent()
|
434 |
-
{
|
435 |
-
return ( self::COMPONENT == $this->mod_type ) ? true : false;
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Checks if current module is a Theme (or child)
|
440 |
-
* @return boolean
|
441 |
-
*/
|
442 |
-
final public function isTheme()
|
443 |
-
{
|
444 |
-
return ( self::THEME == $this->mod_type || self::CHILD_THEME == $this->mod_type ) ? true : false;
|
445 |
-
}
|
446 |
-
|
447 |
-
/**
|
448 |
-
* Checks if current module is a child theme.
|
449 |
-
* @return boolean
|
450 |
-
*/
|
451 |
-
final public function isChildTheme()
|
452 |
-
{
|
453 |
-
return ( self::CHILD_THEME == $this->mod_type ) ? true : false;
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* Returns a module option.
|
458 |
-
* If no specific option is requested, returns all options.
|
459 |
-
* If requested a non existent settings, returns $default.
|
460 |
-
*
|
461 |
-
* @param $name Name for the option to return.
|
462 |
-
* @param $default Default value to use if the option does not exists.
|
463 |
-
* @return mixed The option's value or an array with all options.
|
464 |
-
*/
|
465 |
-
final public function getOption ( $name = '', $default = false )
|
466 |
-
{
|
467 |
-
return $this->cfg->getSetting($this->ID, $name, $default);
|
468 |
-
}
|
469 |
-
|
470 |
-
/**
|
471 |
-
* Updates a module option.
|
472 |
-
*
|
473 |
-
* @param string $name Option Name
|
474 |
-
* @param mixed $value Option value
|
475 |
-
* @return void
|
476 |
-
*/
|
477 |
-
final public function updateOption ( $name, $value )
|
478 |
-
{
|
479 |
-
$this->cfg->updateOption($this->ID, $name, $value );
|
480 |
-
}
|
481 |
-
|
482 |
-
/**
|
483 |
-
* Deletes a module option.
|
484 |
-
*
|
485 |
-
* @param string $name Option Name
|
486 |
-
* @return void
|
487 |
-
*/
|
488 |
-
final public function deleteOption( $name )
|
489 |
-
{
|
490 |
-
$this->cfg->deleteOption($this->ID, $name);
|
491 |
-
}
|
492 |
-
|
493 |
-
/**
|
494 |
-
* Merges new options into module settings.
|
495 |
-
* Replaces exsisting ones and adds new ones.
|
496 |
-
*
|
497 |
-
* @since 0.7
|
498 |
-
*
|
499 |
-
* @param array $options New options to merge into settings.
|
500 |
-
* @return void
|
501 |
-
*/
|
502 |
-
final protected function mergeOptions ( $options )
|
503 |
-
{
|
504 |
-
$current = $this->cfg->getSetting($this->ID);
|
505 |
-
$new_opt = array_merge($current, $options);
|
506 |
-
$this->cfg->replaceOptions($this->ID, $new_opt);
|
507 |
-
}
|
508 |
-
|
509 |
-
/**
|
510 |
-
* Replaces ALL module options by new ones.
|
511 |
-
*
|
512 |
-
* @param array $options Array with all options pairs (name=>value)
|
513 |
-
* @return void
|
514 |
-
*/
|
515 |
-
final public function setNewOptions ( $options )
|
516 |
-
{
|
517 |
-
$this->cfg->replaceOptions($this->ID, $options);
|
518 |
-
}
|
519 |
-
|
520 |
-
/**
|
521 |
-
* Returns current module default options.
|
522 |
-
*
|
523 |
-
* @since 0.7
|
524 |
-
*
|
525 |
-
* @return array Default module options.
|
526 |
-
*/
|
527 |
-
final protected function getDefaults ()
|
528 |
-
{
|
529 |
-
$this->cfg->getDefaults($this->ID);
|
530 |
-
}
|
531 |
-
|
532 |
-
/**
|
533 |
-
* Replaces current module defaults by new ones.
|
534 |
-
*
|
535 |
-
* @since 0.7
|
536 |
-
*
|
537 |
-
* @param array $options New default options-
|
538 |
-
* @return void
|
539 |
-
*/
|
540 |
-
final protected function setDefaults ( $options )
|
541 |
-
{
|
542 |
-
$this->cfg->setDefaults($this->ID, $options);
|
543 |
-
}
|
544 |
-
|
545 |
-
/**
|
546 |
-
* Merges new options into module defaults.
|
547 |
-
* Replaces exsisting ones and adds new ones.
|
548 |
-
*
|
549 |
-
* @since 0.7
|
550 |
-
*
|
551 |
-
* @param array $options New options to merge into defaults.
|
552 |
-
* @return void
|
553 |
-
*/
|
554 |
-
final protected function mergeDefaults ( $options )
|
555 |
-
{
|
556 |
-
$defaults = $this->cfg->getDefaults($this->ID);
|
557 |
-
$new_def = array_merge($defaults, $options);
|
558 |
-
$this->cfg->setDefaults($this->ID, $new_def);
|
559 |
-
}
|
560 |
-
|
561 |
-
/**
|
562 |
-
* Returns module data.
|
563 |
-
* This data is loaded from the main module file.
|
564 |
-
*
|
565 |
-
* @see akModuleAbstract::$mod_data
|
566 |
-
* @return mixed The parameter requested or an array wil all data.
|
567 |
-
*/
|
568 |
-
final public function getModData ( $name = '' )
|
569 |
-
{
|
570 |
-
if ( empty($name) ) {
|
571 |
-
return $this->mod_data;
|
572 |
-
} elseif ( isset( $this->mod_data[$name]) ) {
|
573 |
-
return $this->mod_data[$name];
|
574 |
-
} else {
|
575 |
-
return false;
|
576 |
-
}
|
577 |
-
}
|
578 |
-
|
579 |
-
/**
|
580 |
-
* Returns child module data.
|
581 |
-
* This data is loaded from the child module file.
|
582 |
-
*
|
583 |
-
* @see akModuleAbstract::$child_data
|
584 |
-
* @return mixed The parameter requested or an array wil all data.
|
585 |
-
*/
|
586 |
-
final public function getChildData ( $name = '' )
|
587 |
-
{
|
588 |
-
if ( empty($name) ) {
|
589 |
-
return $this->child_data;
|
590 |
-
} elseif ( isset( $this->child_data[$name]) ) {
|
591 |
-
return $this->child_data[$name];
|
592 |
-
} else {
|
593 |
-
return false;
|
594 |
-
}
|
595 |
-
}
|
596 |
-
|
597 |
-
/**
|
598 |
-
* Checks if an option can be maneged on settings page.
|
599 |
-
* Looks at the alkivia.ini file and if set there, the option will be disabled.
|
600 |
-
*
|
601 |
-
* @param string|array $options Options names.
|
602 |
-
* @param boolean $show_notice Show a notice if disabled.
|
603 |
-
* @return boolean If administration is allowed or not.
|
604 |
-
*/
|
605 |
-
final public function allowAdmin( $options, $show_notice = true )
|
606 |
-
{
|
607 |
-
foreach ( (array) $options as $option ) {
|
608 |
-
if ( ! $this->cfg->isForced($this->ID, $option) ) {
|
609 |
-
return true;
|
610 |
-
}
|
611 |
-
}
|
612 |
-
|
613 |
-
if ( $show_notice ) {
|
614 |
-
echo '<em>' . __('Option blocked by administrator.', 'akfw') . '</em>';
|
615 |
-
}
|
616 |
-
return false;
|
617 |
-
}
|
618 |
-
|
619 |
-
/**
|
620 |
-
* Loads module data and settings.
|
621 |
-
* Data is loaded from the module file headers. Settings from Database and alkivia.ini.
|
622 |
-
*
|
623 |
-
* @return void
|
624 |
-
*/
|
625 |
-
final private function loadModuleData ( $id )
|
626 |
-
{
|
627 |
-
$this->loadData();
|
628 |
-
switch ( $this->mod_type ) {
|
629 |
-
case self::PLUGIN :
|
630 |
-
$this->mod_url = plugins_url() . '/' . basename(dirname($this->mod_file));
|
631 |
-
$this->ID = ( empty($id) ) ? strtolower(basename($this->mod_file, '.php')) : trim($id) ;
|
632 |
-
break;
|
633 |
-
case self::THEME :
|
634 |
-
case self::CHILD_THEME :
|
635 |
-
$this->mod_url = get_stylesheet_directory_uri();
|
636 |
-
$this->ID = ( empty($id) ) ? strtolower(basename(TEMPLATEPATH)) : trim($id) ;
|
637 |
-
break;
|
638 |
-
case self::COMPONENT :
|
639 |
-
$this->mod_url = ak_get_object($this->PID)->getUrl() . 'components/' . basename(dirname($this->mod_file));
|
640 |
-
$this->ID = $this->PID . '_' . $this->child_data['Component'];
|
641 |
-
break;
|
642 |
-
}
|
643 |
-
$this->cfg->setDefaults($this->ID, $this->defaultOptions());
|
644 |
-
|
645 |
-
$old_version = get_option($this->ID . '_version');
|
646 |
-
if ( false === $old_version ) {
|
647 |
-
$this->installing = true;
|
648 |
-
} elseif ( version_compare($old_version, $this->version, 'ne') ) {
|
649 |
-
$this->needs_update = true;
|
650 |
-
}
|
651 |
-
}
|
652 |
-
|
653 |
-
/**
|
654 |
-
* Saves the current post state.
|
655 |
-
* Used if we are looping a new query to reset previous state.
|
656 |
-
*
|
657 |
-
* @return void
|
658 |
-
*/
|
659 |
-
final public function savePost()
|
660 |
-
{
|
661 |
-
global $post, $more;
|
662 |
-
|
663 |
-
$this->saved['post'] = $post;
|
664 |
-
$this->saved['more'] = $more;
|
665 |
-
}
|
666 |
-
|
667 |
-
/**
|
668 |
-
* Restores the current post state.
|
669 |
-
* Saved in savePost()
|
670 |
-
*
|
671 |
-
* @return void
|
672 |
-
*/
|
673 |
-
final public function restorePost()
|
674 |
-
{
|
675 |
-
global $post, $more;
|
676 |
-
|
677 |
-
$more = $this->saved['more'];
|
678 |
-
$post = $this->saved['post'];
|
679 |
-
if ( $post ) {
|
680 |
-
setup_postdata($post);
|
681 |
-
}
|
682 |
-
}
|
683 |
-
|
684 |
-
/**
|
685 |
-
* Returns the URL to the module folder.
|
686 |
-
*
|
687 |
-
* @return string Absolute URL to the module folder.
|
688 |
-
*/
|
689 |
-
final public function getURL()
|
690 |
-
{
|
691 |
-
return trailingslashit($this->mod_url);
|
692 |
-
}
|
693 |
-
|
694 |
-
/**
|
695 |
-
* Returns the absolute path to module direcotory.
|
696 |
-
*
|
697 |
-
* @since 0.7
|
698 |
-
*
|
699 |
-
* @return string Full absolute path to module directory.
|
700 |
-
*/
|
701 |
-
final public function getPath()
|
702 |
-
{
|
703 |
-
return trailingslashit(dirname($this->mod_file));
|
704 |
-
}
|
705 |
-
|
706 |
-
/**
|
707 |
-
* Returns the basename for the plugin folder.
|
708 |
-
*
|
709 |
-
* @since 0.7
|
710 |
-
*
|
711 |
-
* @return string Plugin folder name (Relative to wp-content/plugins or wp-content/themes.
|
712 |
-
*/
|
713 |
-
final public function getSlug()
|
714 |
-
{
|
715 |
-
$folder = basename(dirname($this->mod_file));
|
716 |
-
return $folder;
|
717 |
-
}
|
718 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/classes/abstract/plugin.php
CHANGED
@@ -26,31 +26,59 @@
|
|
26 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*/
|
28 |
|
29 |
-
require_once ( AK_CLASSES . '/abstract/module.php' );
|
30 |
-
|
31 |
/**
|
32 |
* Abtract class to be used as a plugin template.
|
33 |
* Must be implemented before using this class and it's recommended to prefix the class to prevent collissions.
|
34 |
* There are some special functions that have to be declared in implementations to perform main actions:
|
35 |
* - pluginActivate (Protected) Actions to run when activating the plugin.
|
36 |
-
* - pluginDeactivate (Protected) Actions to run when deactivating the plugin.
|
37 |
* - pluginUpdate (Protected) Actions to update the plugin to a new version. (Updating version on DB is done after this).
|
38 |
* Takes plugin running version as a parameter.
|
39 |
-
* - pluginsLoaded (Protected) Runs at 'plugins_loaded' action hook.
|
40 |
-
* - registerWidgets (Protected) Runs at 'widgets_init' action hook.
|
41 |
*
|
42 |
* @author Jordi Canals
|
43 |
* @package Alkivia
|
44 |
* @subpackage Framework
|
45 |
* @link http://wiki.alkivia.org/framework/classes/plugin
|
46 |
*/
|
47 |
-
abstract class akPluginAbstract
|
48 |
{
|
49 |
-
|
50 |
-
*
|
51 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
*/
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
/**
|
56 |
* Class constructor.
|
@@ -63,15 +91,25 @@ abstract class akPluginAbstract extends akModuleAbstract
|
|
63 |
*/
|
64 |
public function __construct( $mod_file, $ID = '' )
|
65 |
{
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
register_deactivation_hook($this->mod_file, array($this, 'deactivate'));
|
72 |
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -80,12 +118,6 @@ abstract class akPluginAbstract extends akModuleAbstract
|
|
80 |
*/
|
81 |
protected function pluginActivate () {}
|
82 |
|
83 |
-
/**
|
84 |
-
* Fires on plugin deactivation.
|
85 |
-
* @return void
|
86 |
-
*/
|
87 |
-
protected function pluginDeactivate () {}
|
88 |
-
|
89 |
/**
|
90 |
* Updates the plugin to a new version.
|
91 |
* @param string $version Old plugin version.
|
@@ -93,29 +125,6 @@ abstract class akPluginAbstract extends akModuleAbstract
|
|
93 |
*/
|
94 |
protected function pluginUpdate ( $version ) {}
|
95 |
|
96 |
-
/**
|
97 |
-
* Fires when plugins have been loaded.
|
98 |
-
* @return void
|
99 |
-
*/
|
100 |
-
protected function pluginsLoaded () {}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Fires on Widgets init.
|
104 |
-
* @return void
|
105 |
-
*/
|
106 |
-
protected function registerWidgets () {}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Allows to check if plugin is ready to load components on implementations.
|
110 |
-
* Overwrite this method and return true to load components, false to omit components load.
|
111 |
-
*
|
112 |
-
* @return boolean If components can be loaded or not.
|
113 |
-
*/
|
114 |
-
protected function readyForComponents ()
|
115 |
-
{
|
116 |
-
return false;
|
117 |
-
}
|
118 |
-
|
119 |
/**
|
120 |
* Activates the plugin. Only runs on first activation.
|
121 |
* Saves the plugin version in DB, and calls the 'pluginActivate' method.
|
@@ -130,47 +139,15 @@ abstract class akPluginAbstract extends akModuleAbstract
|
|
130 |
$this->pluginActivate();
|
131 |
|
132 |
// Save options and version
|
133 |
-
$this->cfg->saveOptions($this->ID);
|
134 |
add_option($this->ID . '_version', $this->version);
|
135 |
|
136 |
-
// Load and activate plugin components.
|
137 |
-
$this->components = ak_get_installed_components($this->componentsPath(), true);
|
138 |
-
if ( empty($this->components) ) {
|
139 |
-
$this->components = false;
|
140 |
-
} else {
|
141 |
-
foreach ( $this->components as $id => $component ) {
|
142 |
-
if ( $component['Core'] ) {
|
143 |
-
require_once( $component['File'] );
|
144 |
-
do_action('ak_activate_' . $this->ID . '_' . $id);
|
145 |
-
$this->components[$id]['active'] = 1;
|
146 |
-
} else {
|
147 |
-
$this->components[$id]['active'] = 0;
|
148 |
-
}
|
149 |
-
}
|
150 |
-
update_option($this->ID . '_components', $this->components);
|
151 |
-
}
|
152 |
-
|
153 |
// Do activated hook.
|
154 |
do_action('ak_activate_' . $this->ID . '_plugin');
|
155 |
}
|
156 |
|
157 |
-
/**
|
158 |
-
* Deactivates the plugin.
|
159 |
-
*
|
160 |
-
* @uses do_action() Calls 'ak_deactivate_<modID>_plugin' action hook.
|
161 |
-
* @hook register_deactivation_hook
|
162 |
-
* @access private
|
163 |
-
* @return void
|
164 |
-
*/
|
165 |
-
final function deactivate()
|
166 |
-
{
|
167 |
-
$this->pluginDeactivate();
|
168 |
-
do_action('ak_deactivate_' . $this->ID . '_plugin');
|
169 |
-
}
|
170 |
-
|
171 |
/**
|
172 |
* Init the plugin (In action 'plugins_loaded')
|
173 |
-
* Here whe call the 'pluginUpdate'
|
174 |
* Also the plugin version and settings are updated here.
|
175 |
*
|
176 |
* @hook action plugins_loaded
|
@@ -186,288 +163,102 @@ abstract class akPluginAbstract extends akModuleAbstract
|
|
186 |
$version = get_option($this->ID . '_version');
|
187 |
$this->pluginUpdate($version);
|
188 |
|
189 |
-
$this->cfg->saveOptions($this->ID);
|
190 |
update_option($this->ID . '_version', $this->version);
|
191 |
|
192 |
-
$this->searchNewComponents();
|
193 |
do_action('ak_' . $this->ID . '_updated');
|
194 |
}
|
195 |
-
|
196 |
-
$this->pluginsLoaded();
|
197 |
-
$this->loadComponents();
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Loads plugin components if found.
|
202 |
-
*
|
203 |
-
* @return void
|
204 |
-
*/
|
205 |
-
final function loadComponents()
|
206 |
-
{
|
207 |
-
if ( ! $this->readyForComponents() ) {
|
208 |
-
return;
|
209 |
-
}
|
210 |
-
|
211 |
-
$this->components = get_option($this->ID . '_components');
|
212 |
-
if ( ! is_array($this->components) ) {
|
213 |
-
return;
|
214 |
-
}
|
215 |
-
|
216 |
-
foreach ( $this->components as $component ) {
|
217 |
-
if ( $component['active'] ) {
|
218 |
-
require_once ( $component['File']);
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
do_action('ak_' . $this->ID . '_components_init');
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Reloads and updates installed components.
|
227 |
-
* If a new core component is found, it will be activated automatically.
|
228 |
-
*
|
229 |
-
* @return void
|
230 |
-
*/
|
231 |
-
private function searchNewComponents ()
|
232 |
-
{
|
233 |
-
$components = ak_get_installed_components($this->componentsPath(), true);
|
234 |
-
if ( empty($components) ) {
|
235 |
-
$this->components = false;
|
236 |
-
return;
|
237 |
-
}
|
238 |
-
|
239 |
-
$installed = array();
|
240 |
-
$core = array();
|
241 |
-
$optional = array();
|
242 |
-
|
243 |
-
// Sort components by core and optional. Then by name.
|
244 |
-
foreach ( $components as $id => $component ) {
|
245 |
-
if ( $component['Core'] ) {
|
246 |
-
$core[$id] = $component;
|
247 |
-
} else {
|
248 |
-
$optional[$id] = $component;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
ksort($core); ksort($optional); // Sort components by ID.
|
252 |
-
$components = array_merge($core, $optional);
|
253 |
-
|
254 |
-
// Now, activate new core components, and set activation for optional.
|
255 |
-
$this->components = get_option($this->ID . '_components');
|
256 |
-
foreach ( $components as $id => $component ) {
|
257 |
-
$installed[$id] = $component;
|
258 |
-
if ( $component['Core'] ) {
|
259 |
-
$installed[$id]['active'] = 1;
|
260 |
-
if ( ! isset($this->components[$id]) || ! $this->components[$id]['active'] ) {
|
261 |
-
require_once( $component['File']);
|
262 |
-
do_action('ak_activate_' . $this->ID . '_' . $id);
|
263 |
-
}
|
264 |
-
} else {
|
265 |
-
if ( isset($this->components[$id]['active']) ) {
|
266 |
-
$installed[$id]['active'] = $this->components[$id]['active'];
|
267 |
-
} else {
|
268 |
-
$installed[$id]['active'] = 0;
|
269 |
-
}
|
270 |
-
}
|
271 |
-
}
|
272 |
-
|
273 |
-
$this->components = $installed;
|
274 |
-
update_option($this->ID . '_components', $this->components);
|
275 |
}
|
276 |
|
277 |
/**
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
}
|
287 |
-
|
288 |
-
$name = strtolower($name);
|
289 |
-
if ( isset($this->components[$name]) && $this->components[$name]['active'] ) {
|
290 |
-
return true;
|
291 |
-
} else {
|
292 |
-
return false;
|
293 |
-
}
|
294 |
-
}
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
} else {
|
309 |
-
|
310 |
}
|
311 |
-
}
|
312 |
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
|
|
|
|
|
|
327 |
}
|
328 |
-
|
329 |
-
|
330 |
-
}
|
331 |
|
332 |
/**
|
333 |
-
*
|
334 |
-
*
|
335 |
*
|
336 |
-
* @hook action admin_notices
|
337 |
-
* @access private
|
338 |
* @return void
|
339 |
*/
|
340 |
-
final function
|
341 |
{
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
|
|
|
|
349 |
}
|
350 |
-
|
351 |
/**
|
352 |
-
*
|
353 |
-
* This is done by calling the action 'admin_notices' in isStandardSidebar()
|
354 |
*
|
355 |
-
* @hook action admin_notices
|
356 |
-
* @access private
|
357 |
* @return void
|
358 |
*/
|
359 |
-
|
360 |
-
{
|
361 |
-
$this->loadTranslations(); // We have not loaded translations yet.
|
362 |
-
|
363 |
-
echo '<div class="error"><p><strong>' . __('Warning:', $this->ID) . '</strong> '
|
364 |
-
. __('Standard sidebar functions are not present.', $this->ID) . '</p><p>'
|
365 |
-
. sprintf(__('It is required to use the standard sidebar to run %s', $this->ID),
|
366 |
-
'«' . $this->mod_data['Name'] . ' ' . $this->version . '»')
|
367 |
-
. '</p></div>';
|
368 |
-
}
|
369 |
|
370 |
/**
|
371 |
-
*
|
372 |
*
|
373 |
* @return void
|
374 |
*/
|
375 |
-
|
376 |
-
{
|
377 |
-
if ( empty($this->mod_data) ) {
|
378 |
-
if ( ! function_exists('get_plugin_data') ) {
|
379 |
-
require_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
|
380 |
-
}
|
381 |
-
|
382 |
-
$plugin_data = get_plugin_data($this->mod_file);
|
383 |
-
$readme_data = ak_module_readme_data($this->mod_file);
|
384 |
-
$this->mod_data = array_merge($readme_data, $plugin_data);
|
385 |
-
|
386 |
-
$this->version = $this->mod_data['Version'];
|
387 |
-
}
|
388 |
-
}
|
389 |
-
|
390 |
-
/**
|
391 |
-
* Returns the path to plugin components.
|
392 |
-
*
|
393 |
-
* @uses apply_filters() Applies the ak_<plugin>_components_path filter on default path.
|
394 |
-
* @return string Path to components directory.
|
395 |
-
*/
|
396 |
-
final protected function componentsPath ()
|
397 |
-
{
|
398 |
-
$path = dirname($this->mod_file) . '/components';
|
399 |
-
return apply_filters('ak_' . $this->ID . '_components_path', $path);
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Form part to activate/deactivate plugin components.
|
404 |
-
* To be included on other configuration or settings form.
|
405 |
-
* String for component name and description have to be included on plugin text_domain.
|
406 |
-
*
|
407 |
-
* @return void
|
408 |
-
*/
|
409 |
-
final protected function componentActivationForm ()
|
410 |
-
{
|
411 |
-
if ( $this->getOption('disable-components-activation') ) {
|
412 |
-
return;
|
413 |
-
}
|
414 |
-
|
415 |
-
$this->searchNewComponents();
|
416 |
-
?>
|
417 |
-
<dl>
|
418 |
-
<dt><?php _e('Activate Components', 'akfw'); ?></dt>
|
419 |
-
<dd>
|
420 |
-
<?php wp_nonce_field('ak-component-activation', '_aknonce', false); ?>
|
421 |
-
<table width="100%" class="form-table">
|
422 |
-
<?php foreach ( $this->components as $c) :
|
423 |
-
if ( ! $c['Core'] ) : ?>
|
424 |
-
<tr>
|
425 |
-
<th scope="row"><?php _e($c['Name'], $this->ID) ?>:</th>
|
426 |
-
<td>
|
427 |
-
<input type="radio" name="components[<?php echo $c['Component']; ?>]" value="1" <?php checked(1, $c['active']); ?> /> <?php _e('Yes', 'akfw'); ?>
|
428 |
-
<input type="radio" name="components[<?php echo $c['Component']; ?>]" value="0" <?php checked(0, $c['active']); ?> /> <?php _e('No', 'akfw'); ?>
|
429 |
-
<span class="setting-description"><?php _e($c['Description'], $this->ID); ?></span>
|
430 |
-
</td>
|
431 |
-
</tr>
|
432 |
-
<?php endif;
|
433 |
-
endforeach; ?>
|
434 |
-
</table>
|
435 |
-
</dd>
|
436 |
-
</dl>
|
437 |
-
<?php
|
438 |
-
}
|
439 |
-
|
440 |
-
/**
|
441 |
-
* Saves data from componets activation form.
|
442 |
-
* Activates or deactivates components as requested by user.
|
443 |
-
*
|
444 |
-
* @return void
|
445 |
-
*/
|
446 |
-
final protected function saveActivationForm ()
|
447 |
-
{
|
448 |
-
if ( $this->getOption('disable-components-activation') ) {
|
449 |
-
return;
|
450 |
-
}
|
451 |
-
|
452 |
-
check_admin_referer('ak-component-activation', '_aknonce');
|
453 |
-
if ( isset($_POST['action']) && 'update' == $_POST['action'] ) {
|
454 |
-
$post = stripslashes_deep($_POST['components'] );
|
455 |
-
$this->components = get_option($this->ID . '_components');
|
456 |
-
$this->searchNewComponents();
|
457 |
-
|
458 |
-
foreach ( $post as $name => $activate ) {
|
459 |
-
if ( $activate && ! $this->components[$name]['active'] ) {
|
460 |
-
require_once( $this->components[$name]['File']);
|
461 |
-
do_action('ak_activate_' . $this->ID . '_' . $name);
|
462 |
-
} elseif ( ! $activate && $this->components[$name]['active'] ) {
|
463 |
-
require_once( $this->components[$name]['File']);
|
464 |
-
do_action('ak_deactivate_' . $this->ID . '_' . $name);
|
465 |
-
}
|
466 |
-
$this->components[$name]['active'] = $activate;
|
467 |
-
}
|
468 |
-
update_option($this->ID . '_components', $this->components);
|
469 |
-
} else {
|
470 |
-
wp_die('Bad form received.', $this->ID);
|
471 |
-
}
|
472 |
-
}
|
473 |
}
|
26 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*/
|
28 |
|
|
|
|
|
29 |
/**
|
30 |
* Abtract class to be used as a plugin template.
|
31 |
* Must be implemented before using this class and it's recommended to prefix the class to prevent collissions.
|
32 |
* There are some special functions that have to be declared in implementations to perform main actions:
|
33 |
* - pluginActivate (Protected) Actions to run when activating the plugin.
|
|
|
34 |
* - pluginUpdate (Protected) Actions to update the plugin to a new version. (Updating version on DB is done after this).
|
35 |
* Takes plugin running version as a parameter.
|
|
|
|
|
36 |
*
|
37 |
* @author Jordi Canals
|
38 |
* @package Alkivia
|
39 |
* @subpackage Framework
|
40 |
* @link http://wiki.alkivia.org/framework/classes/plugin
|
41 |
*/
|
42 |
+
abstract class akPluginAbstract
|
43 |
{
|
44 |
+
/**
|
45 |
+
* Module ID. Is the module internal short name.
|
46 |
+
* Filled in constructor (as a constructor param). Used for translations textdomain.
|
47 |
+
*
|
48 |
+
* @var string
|
49 |
+
*/
|
50 |
+
public $ID;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Module version number.
|
54 |
+
*
|
55 |
+
* @since 0.8
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
*/
|
59 |
+
public $version;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Full path to module main file.
|
63 |
+
* Main file is 'style.css' for themes and the php file with data header for plugins and components.
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $mod_file;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* URL to the module folder.
|
71 |
+
*
|
72 |
+
* @var string
|
73 |
+
*/
|
74 |
+
protected $mod_url;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Flag to see if module needs to be updated.
|
78 |
+
*
|
79 |
+
* @var boolean
|
80 |
+
*/
|
81 |
+
protected $needs_update = false;
|
82 |
|
83 |
/**
|
84 |
* Class constructor.
|
91 |
*/
|
92 |
public function __construct( $mod_file, $ID = '' )
|
93 |
{
|
94 |
+
$this->mod_file = trim($mod_file);
|
95 |
|
96 |
+
$this->loadModuleData($ID);
|
97 |
+
|
98 |
+
add_action('plugins_loaded', array($this, 'pluginsInit'));
|
|
|
99 |
|
100 |
+
//if ( ! apply_filters('ak_' . $this->ID . '_disable_admin', $this->getOption('disable-admin-page')) ) {
|
101 |
+
add_action('admin_menu', array($this, 'adminMenus'), 5); // execute prior to PP, to use menu hook
|
102 |
+
//}
|
103 |
+
|
104 |
+
// Load styles
|
105 |
+
add_action('admin_print_styles', array($this, 'adminStyles'));
|
106 |
+
|
107 |
+
$this->moduleLoad();
|
108 |
+
|
109 |
+
// Activation and deactivation hooks.
|
110 |
+
register_activation_hook($this->mod_file, array($this, 'activate'));
|
111 |
+
|
112 |
+
add_action('plugins_loaded', array($this, 'init'));
|
113 |
}
|
114 |
|
115 |
/**
|
118 |
*/
|
119 |
protected function pluginActivate () {}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
/**
|
122 |
* Updates the plugin to a new version.
|
123 |
* @param string $version Old plugin version.
|
125 |
*/
|
126 |
protected function pluginUpdate ( $version ) {}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
/**
|
129 |
* Activates the plugin. Only runs on first activation.
|
130 |
* Saves the plugin version in DB, and calls the 'pluginActivate' method.
|
139 |
$this->pluginActivate();
|
140 |
|
141 |
// Save options and version
|
|
|
142 |
add_option($this->ID . '_version', $this->version);
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
// Do activated hook.
|
145 |
do_action('ak_activate_' . $this->ID . '_plugin');
|
146 |
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
/**
|
149 |
* Init the plugin (In action 'plugins_loaded')
|
150 |
+
* Here whe call the 'pluginUpdate' method.
|
151 |
* Also the plugin version and settings are updated here.
|
152 |
*
|
153 |
* @hook action plugins_loaded
|
163 |
$version = get_option($this->ID . '_version');
|
164 |
$this->pluginUpdate($version);
|
165 |
|
|
|
166 |
update_option($this->ID . '_version', $this->version);
|
167 |
|
|
|
168 |
do_action('ak_' . $this->ID . '_updated');
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
|
172 |
/**
|
173 |
+
* Functions to execute after loading plugins.
|
174 |
+
*
|
175 |
+
* @return void
|
176 |
+
*/
|
177 |
+
final function pluginsInit ()
|
178 |
+
{
|
179 |
+
load_plugin_textdomain($this->ID, false, basename(dirname($this->mod_file)) . '/lang');
|
180 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
/**
|
183 |
+
* Enqueues additional administration styles.
|
184 |
+
* Send the framework admin.css file and additionally any other admin.css file
|
185 |
+
* found on the module direcotry.
|
186 |
+
*
|
187 |
+
* @hook action 'admin_print_styles'
|
188 |
+
* @uses apply_filters() Calls the 'ak_framework_style_admin' filter on the framework style url.
|
189 |
+
* @uses apply_filters() Calls the 'ak_<Mod_ID>_style_admin' filter on the style url.
|
190 |
+
* @access private
|
191 |
+
*
|
192 |
+
* @return void
|
193 |
+
*/
|
194 |
+
final function adminStyles()
|
195 |
+
{
|
196 |
+
// FRAMEWORK admin styles.
|
197 |
+
$url = apply_filters('ak_framework_style_admin', AK_STYLES_URL . '/admin.css');
|
198 |
+
if ( ! empty($url) ) {
|
199 |
+
wp_register_style('ak_framework_admin', $url, false, get_option('ak_framework_version'));
|
200 |
+
wp_enqueue_style('ak_framework_admin');
|
201 |
+
}
|
202 |
+
|
203 |
+
// MODULE admin styles.
|
204 |
+
if ( file_exists(dirname($this->mod_file) . '/admin.css') ) {
|
205 |
+
$url = $this->mod_url . '/admin.css';
|
206 |
} else {
|
207 |
+
$url = '';
|
208 |
}
|
|
|
209 |
|
210 |
+
$url = apply_filters('ak_' . $this->ID . '_style_admin', $url);
|
211 |
+
if ( ! empty($url) ) {
|
212 |
+
wp_register_style('ak_' . $this->ID . '_admin', $url, array('ak_framework_admin'), $this->version);
|
213 |
+
wp_enqueue_style('ak_' . $this->ID . '_admin');
|
214 |
+
}
|
215 |
+
|
216 |
+
if ( file_exists(dirname($this->mod_file) . '/admin.js') ) {
|
217 |
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
|
218 |
+
$url = $this->mod_url . "/admin{$suffix}.js";
|
219 |
+
wp_enqueue_script( 'cme_admin', $url, array('jquery'), CAPSMAN_VERSION, true );
|
220 |
+
wp_localize_script( 'cme_admin', 'cmeAdmin', array(
|
221 |
+
'negationCaption' => __( 'Explicity negate this capability by storing as disabled', 'capsman' ),
|
222 |
+
'typeCapsNegationCaption' => __( 'Explicitly negate these capabilities by storing as disabled', 'capsman' ),
|
223 |
+
'typeCapUnregistered' => __( 'Post type registration does not define this capability distinctly', 'capsman' ),
|
224 |
+
'capNegated' => __( 'This capability is explicitly negated. Click to add/remove normally.', 'capsman' ),
|
225 |
+
'chkCaption' => __( 'Add or remove this capability from the WordPress role', 'capsman' ),
|
226 |
+
'switchableCaption' => __( 'Add or remove capability from the role normally', 'capsman' ) )
|
227 |
+
);
|
228 |
}
|
229 |
+
|
230 |
+
}
|
|
|
231 |
|
232 |
/**
|
233 |
+
* Loads module data and settings.
|
234 |
+
* Data is loaded from the module file headers. Settings from Database and alkivia.ini.
|
235 |
*
|
|
|
|
|
236 |
* @return void
|
237 |
*/
|
238 |
+
final private function loadModuleData ( $id )
|
239 |
{
|
240 |
+
$this->mod_url = plugins_url( '', CME_FILE );
|
241 |
+
|
242 |
+
if ( ! isset($this->ID) )
|
243 |
+
$this->ID = ( empty($id) ) ? strtolower(basename($this->mod_file, '.php')) : trim($id) ;
|
244 |
+
|
245 |
+
$old_version = get_option($this->ID . '_version');
|
246 |
+
if ( version_compare($old_version, $this->version, 'ne') ) {
|
247 |
+
$this->needs_update = true;
|
248 |
+
}
|
249 |
}
|
250 |
+
|
251 |
/**
|
252 |
+
* Executes as soon as module class is loaded.
|
|
|
253 |
*
|
|
|
|
|
254 |
* @return void
|
255 |
*/
|
256 |
+
protected function moduleLoad() {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
/**
|
259 |
+
* Fires at 'admin_menus' action hook.
|
260 |
*
|
261 |
* @return void
|
262 |
*/
|
263 |
+
public function adminMenus () {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
framework/classes/abstract/theme.php
DELETED
@@ -1,273 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class for Themes management.
|
4 |
-
*
|
5 |
-
* @version $Rev: 203758 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
require_once ( AK_CLASSES . '/abstract/module.php' );
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Abtract class to be used as a theme template.
|
33 |
-
* Must be implemented before using this class.
|
34 |
-
* There are some special functions that have to be declared in implementations to perform main actions:
|
35 |
-
* - themeInit (Protected) Runs as soon as theme has been loaded.
|
36 |
-
* - themeInstall (Protected) Runs at theme install time and fires on the 'init' action hook.
|
37 |
-
* - themeUpdate (Proetected) Runs at theme update and fires on the 'init' action hook.
|
38 |
-
* - themeSideBars (Protected) Runs at theme load time and used to register the theme sidebars.
|
39 |
-
*
|
40 |
-
* @author Jordi Canals
|
41 |
-
* @package Alkivia
|
42 |
-
* @subpackage Framework
|
43 |
-
* @link http://wiki.alkivia.org/framework/classes/theme
|
44 |
-
*
|
45 |
-
* @uses akSettings
|
46 |
-
*/
|
47 |
-
|
48 |
-
abstract class akThemeAbstract extends akModuleAbstract
|
49 |
-
{
|
50 |
-
/**
|
51 |
-
* Class constructor.
|
52 |
-
* Calls the implementated method 'startUp' if it exists. This is done at theme's loading time.
|
53 |
-
* Prepares admin menus by setting an action for the implemented method '_adminMenus' if it exists.
|
54 |
-
*
|
55 |
-
* @uses do_action() Calls the 'ak_theme_loaded' action hook.
|
56 |
-
* @param string $ID Theme internal short name (known as theme ID).
|
57 |
-
* @return akTheme
|
58 |
-
*/
|
59 |
-
public function __construct ( $ID = '' )
|
60 |
-
{
|
61 |
-
parent::__construct('theme', $ID);
|
62 |
-
|
63 |
-
if ( $this->installing ) {
|
64 |
-
$this->install();
|
65 |
-
}
|
66 |
-
|
67 |
-
if ( function_exists('register_sidebars') ) {
|
68 |
-
$this->themeSideBars();
|
69 |
-
}
|
70 |
-
|
71 |
-
$this->configureTheme();
|
72 |
-
do_action('ak_theme_loaded');
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Inits the theme at WordPress 'init' action hook
|
77 |
-
* @return void
|
78 |
-
*/
|
79 |
-
protected function themeInit () {}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Installs the theme.
|
83 |
-
* @return void
|
84 |
-
*/
|
85 |
-
protected function themeInstall () {}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Performs additional actions to update the theme.
|
89 |
-
* @param string $version Theme current installed version.
|
90 |
-
* @return void
|
91 |
-
*/
|
92 |
-
protected function themeUpdate ( $version ) {}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Registers and sets theme sidebars.
|
96 |
-
* @return void
|
97 |
-
*/
|
98 |
-
protected function themeSideBars () {}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Configure the theme based on theme settings.
|
102 |
-
*
|
103 |
-
* @uses do_action() Calls the 'ak_theme_options_set' action hook.
|
104 |
-
* @return void
|
105 |
-
*/
|
106 |
-
final private function configureTheme()
|
107 |
-
{
|
108 |
-
// Set metatags
|
109 |
-
add_action('wp_head', array($this, 'metaTags') );
|
110 |
-
|
111 |
-
// Set the theme favicon
|
112 |
-
if ( ! $this->getOption('disable-favicon') ) {
|
113 |
-
add_action('wp_head', array($this, 'favicon'));
|
114 |
-
add_action('admin_head', array($this, 'favicon'));
|
115 |
-
}
|
116 |
-
|
117 |
-
// Enable self ping.
|
118 |
-
if ( ! $this->getOption('enable-selfping') ) {
|
119 |
-
add_action('pre_ping', array($this, 'disableSelfPing'));
|
120 |
-
}
|
121 |
-
|
122 |
-
do_action('ak_theme_options_set');
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Installs the theme.
|
127 |
-
* Saves the theme version in DB, and calls the 'install' method.
|
128 |
-
*
|
129 |
-
* @uses do_action() Calls the 'ak_theme_installed' action hook.
|
130 |
-
* @return void
|
131 |
-
*/
|
132 |
-
final private function install ()
|
133 |
-
{
|
134 |
-
// If there is an additional function to perform on installation.
|
135 |
-
$this->themeInstall();
|
136 |
-
|
137 |
-
// Save options and version
|
138 |
-
$this->cfg->saveOptions($this->ID);
|
139 |
-
add_option($this->ID . '_version', $this->version);
|
140 |
-
|
141 |
-
do_action('ak_theme_installed');
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Init the theme (In action 'init')
|
146 |
-
* Here whe call the 'themeUpdate' and 'themeInit' methods. This is done after the plugins are loaded.
|
147 |
-
* Also the theme version and settings are updated here.
|
148 |
-
*
|
149 |
-
* @uses do_action() Calls the 'ak_theme_updated' action hook.
|
150 |
-
* @hook action 'init'
|
151 |
-
* @access private
|
152 |
-
* @return void
|
153 |
-
*/
|
154 |
-
final function wpInit ()
|
155 |
-
{
|
156 |
-
// Check if the module needs to be updated.
|
157 |
-
if ( $this->needs_update ) {
|
158 |
-
$version = get_option($this->ID . '_version');
|
159 |
-
$this->themeUpdate($version);
|
160 |
-
|
161 |
-
$this->cfg->saveOptions($this->ID);
|
162 |
-
update_option($this->ID . '_version', $this->version);
|
163 |
-
|
164 |
-
do_action('ak_theme_updated');
|
165 |
-
}
|
166 |
-
|
167 |
-
// Call the custom init for the theme when system is loaded.
|
168 |
-
$this->themeInit();
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Inits the widgets (In action 'widgets_init')
|
173 |
-
* In own themes standard sidebar always will be present (No check needed).
|
174 |
-
*
|
175 |
-
* @hook action 'widgets_init'
|
176 |
-
* @access private
|
177 |
-
* @return void
|
178 |
-
*/
|
179 |
-
final function widgetsInit ()
|
180 |
-
{
|
181 |
-
do_action('ak_theme_widgets_init');
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Disables self pings.
|
186 |
-
* This will disable sending pings to our own blog.
|
187 |
-
*
|
188 |
-
* @author Michael D. Adams
|
189 |
-
* @link http://blogwaffe.com/2006/10/04/421/
|
190 |
-
* @version 0.2
|
191 |
-
* @hook action 'pre_ping'
|
192 |
-
* @param array $links Link list of URLs to ping.
|
193 |
-
*/
|
194 |
-
final function disableSelfPing( &$links )
|
195 |
-
{
|
196 |
-
$home = get_option( 'home' );
|
197 |
-
foreach ( $links as $l => $link ) {
|
198 |
-
if ( 0 === strpos( $link, $home ) ) {
|
199 |
-
unset($links[$l]);
|
200 |
-
}
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Sets the favicon for the theme.
|
206 |
-
*
|
207 |
-
* @uses apply_filters() Calls apply_filters with the 'ak_theme_favicon' hook and the favicon url as content.
|
208 |
-
* @hook actions 'wp_head' and 'admin_head'
|
209 |
-
* @access private
|
210 |
-
* @return void
|
211 |
-
*/
|
212 |
-
final function favicon ()
|
213 |
-
{
|
214 |
-
$file = '/images/favicon.ico';
|
215 |
-
$favicon = $this->getOption('favicon-url');
|
216 |
-
|
217 |
-
if ( false === $favicon ) {
|
218 |
-
if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . $file) ) {
|
219 |
-
$favicon = get_stylesheet_directory_uri() . $file;
|
220 |
-
} elseif ( file_exists(TEMPLATEPATH . $file) ) {
|
221 |
-
$favicon = get_template_directory_uri() . $file;
|
222 |
-
} else {
|
223 |
-
$favicon = '';
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
$favicon = apply_filters('ak_theme_favicon', $favicon);
|
228 |
-
if ( ! empty($favicon) ) {
|
229 |
-
echo '<link rel="shortcut icon" href="' . $favicon . '" />' . PHP_EOL;
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Adds meta names for parent and child themes to head.
|
235 |
-
*
|
236 |
-
* @hook action 'wp_head'
|
237 |
-
* @access private
|
238 |
-
* @return void
|
239 |
-
*/
|
240 |
-
final function metaTags()
|
241 |
-
{
|
242 |
-
echo '<meta name="theme" content="'
|
243 |
-
. $this->getModData('Name') . ' ' . $this->getModData('Version') . '" />' . PHP_EOL;
|
244 |
-
|
245 |
-
if ( $this->isChildTheme() ) {
|
246 |
-
echo '<meta name="child_theme" content="'
|
247 |
-
. $this->getChildData('Name') . ' ' . $this->getChildData('Version') . '" />' . PHP_EOL;
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Loads theme (and child) data.
|
253 |
-
*
|
254 |
-
* @return void
|
255 |
-
*/
|
256 |
-
final protected function loadData()
|
257 |
-
{
|
258 |
-
$readme_data = ak_module_readme_data(TEMPLATEPATH . '/readme.txt');
|
259 |
-
if ( empty($this->mod_data) ) {
|
260 |
-
$theme_data = get_theme_data(TEMPLATEPATH . '/style.css');
|
261 |
-
$this->mod_data = array_merge($readme_data, $theme_data);
|
262 |
-
}
|
263 |
-
|
264 |
-
if ( TEMPLATEPATH !== STYLESHEETPATH && empty($this->child_data) ) {
|
265 |
-
$this->mod_type = self::CHILD_THEME;
|
266 |
-
$child_data = get_theme_data(STYLESHEETPATH . '/style.css');
|
267 |
-
$child_readme_data = ak_module_readme_data(STYLESHEETPATH . '/readme.txt');
|
268 |
-
$this->child_data = array_merge($readme_data, $child_readme_data, $child_data);
|
269 |
-
}
|
270 |
-
|
271 |
-
$this->version = $this->mod_data['Version'];
|
272 |
-
}
|
273 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/classes/admin-notices.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin notices (or warnings).
|
4 |
-
*
|
5 |
-
* @version $Rev: 198515 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Class to show admin warnings (or notices)
|
31 |
-
* Throws the hook 'admin_notices' to show the warning only on allowed places.
|
32 |
-
* To use the class, just have to instantiate it as new akcAdminNotice('message').
|
33 |
-
*
|
34 |
-
* @author Jordi Canals
|
35 |
-
* @package Alkivia
|
36 |
-
* @subpackage Framework
|
37 |
-
*
|
38 |
-
* @link http://wiki.alkivia.org/framework/classes/admin-notice
|
39 |
-
*/
|
40 |
-
class akAdminNotice
|
41 |
-
{
|
42 |
-
/**
|
43 |
-
* Warning message to be shown.
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
private $message;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Class constructor.
|
50 |
-
* Gets the message, and sets the admin_notices hook.
|
51 |
-
*
|
52 |
-
* @param $message Message to show.
|
53 |
-
* @return aocAdminNotice
|
54 |
-
*/
|
55 |
-
public function __construct( $message )
|
56 |
-
{
|
57 |
-
$this->message = $message;
|
58 |
-
add_action('admin_notices', array($this, '_showMessage') );
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The hook function to display the warning.
|
63 |
-
*
|
64 |
-
* @return void
|
65 |
-
*/
|
66 |
-
public function _showMessage()
|
67 |
-
{
|
68 |
-
echo '<div id="error" class="error"><p><strong>' . $this->message . '</strong></p></div>';
|
69 |
-
}
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/classes/settings.php
DELETED
@@ -1,330 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Alkivia Settings Manager
|
4 |
-
*
|
5 |
-
* @version $Rev: 203758 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Class to manage settings.
|
31 |
-
* It is expected to receive all settings properly filtered.
|
32 |
-
*
|
33 |
-
* @author Jordi Canals
|
34 |
-
* @package Alkivia
|
35 |
-
* @subpackage Framework
|
36 |
-
* @link http://wiki.alkivia.org/framework/classes/settings
|
37 |
-
*/
|
38 |
-
final class akSettings
|
39 |
-
{
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Settings from alkivia.ini file
|
43 |
-
* This settings will be forced and cannot be set on the admin panel.
|
44 |
-
*
|
45 |
-
* @var array
|
46 |
-
*/
|
47 |
-
private $forced = array();
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Global settings for all Alkivia modules.
|
51 |
-
* This is a merge from the settings on db and settings on the ini file.
|
52 |
-
*
|
53 |
-
* @var array
|
54 |
-
*/
|
55 |
-
private $settings = array();
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Options retrieved from database and merged with defaults.
|
59 |
-
* This is what needs to be saved to database at end.
|
60 |
-
*
|
61 |
-
* @var array
|
62 |
-
*/
|
63 |
-
private $options = array();
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Default settings for all alkivia modules.
|
67 |
-
* This options are set at module startup and used if no other setting is found.
|
68 |
-
*
|
69 |
-
* @var array
|
70 |
-
*/
|
71 |
-
private $defaults = array();
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Flags to know if a setting has been updated or not.
|
75 |
-
* This is an array of flags, one item per module.
|
76 |
-
*
|
77 |
-
* @var array
|
78 |
-
*/
|
79 |
-
private $updated = array();
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Settings prefix and sufix for database entry.
|
83 |
-
*/
|
84 |
-
const prefix = '';
|
85 |
-
const sufix = '_settings';
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Class constructor.
|
89 |
-
* Loads settings from ini file.
|
90 |
-
*
|
91 |
-
* @return akSettings
|
92 |
-
*/
|
93 |
-
public function __construct()
|
94 |
-
{
|
95 |
-
if ( defined('AK_INI_FILE') && file_exists(AK_INI_FILE) ) {
|
96 |
-
$this->forced = parse_ini_file(AK_INI_FILE, true);
|
97 |
-
}
|
98 |
-
|
99 |
-
add_action('shutdown', array($this, 'saveOptions'));
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Populates module settings array.
|
104 |
-
* Merges into settings array, defaults and options retrieved from DB.
|
105 |
-
*
|
106 |
-
* @param string $module Module name to load.
|
107 |
-
* @return void
|
108 |
-
*/
|
109 |
-
private function populateSettings ( $module )
|
110 |
-
{
|
111 |
-
if ( ! isset($this->defaults[$module]) ) {
|
112 |
-
$this->defaults[$module] = array();
|
113 |
-
}
|
114 |
-
|
115 |
-
if ( ! isset($this->options[$module]) ) {
|
116 |
-
$options = apply_filters('ak_' . $module . '_options', get_option(self::prefix . $module . self::sufix));
|
117 |
-
|
118 |
-
if ( is_array($options) ) {
|
119 |
-
$this->options[$module] = $options;
|
120 |
-
} else {
|
121 |
-
$this->options[$module] = array();
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
if ( ! isset($this->forced[$module]) ) {
|
126 |
-
$this->forced[$module] = array();
|
127 |
-
}
|
128 |
-
|
129 |
-
if ( ! isset($this->updated[$module]) ) {
|
130 |
-
$this->updated[$module] = false;
|
131 |
-
}
|
132 |
-
|
133 |
-
$this->options[$module] = array_merge(
|
134 |
-
$this->defaults[$module],
|
135 |
-
$this->options[$module]);
|
136 |
-
|
137 |
-
$this->settings[$module] = array_merge(
|
138 |
-
$this->options[$module],
|
139 |
-
$this->forced[$module]);
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Sets default values for a module and fills missing settings with them.
|
144 |
-
*
|
145 |
-
* @uses apply_filters() Calls the 'ak_<module>_defaults' filter on new defaults.
|
146 |
-
* @param string $module Module name.
|
147 |
-
* @param array $options Default settings array.
|
148 |
-
* @return void
|
149 |
-
*/
|
150 |
-
public function setDefaults ( $module, $options )
|
151 |
-
{
|
152 |
-
if ( ! is_array($options) ) { // Must be an array of options.
|
153 |
-
$options = array();
|
154 |
-
}
|
155 |
-
|
156 |
-
$this->defaults[$module] = apply_filters('ak_' . $module . '_defaults', $options);
|
157 |
-
$this->populateSettings($module);
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Returns an array with default values for a module.
|
162 |
-
*
|
163 |
-
* @param $module Module name
|
164 |
-
* @return array Default values for this module.
|
165 |
-
*/
|
166 |
-
public function getDefaults ( $module )
|
167 |
-
{
|
168 |
-
if ( isset($this->defaults[$module]) && is_array($this->defaults[$module]) ) {
|
169 |
-
return $this->defaults[$module];
|
170 |
-
} else {
|
171 |
-
return array();
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Gets a setting for a module.
|
177 |
-
* If $option is empty, will return all settings for a module in an array.
|
178 |
-
*
|
179 |
-
* @param string $module Module internal name.
|
180 |
-
* @param string $option Setting name.
|
181 |
-
* @param mixed $default Default value if setting not found.
|
182 |
-
* @return mixed Returns the setting value or $default if not defined.
|
183 |
-
*/
|
184 |
-
public function getSetting ( $module, $option = '', $default = false )
|
185 |
-
{
|
186 |
-
if ( ! isset($this->settings[$module]) ) {
|
187 |
-
$this->populateSettings($module);
|
188 |
-
}
|
189 |
-
|
190 |
-
if ( empty($option) ) {
|
191 |
-
return $this->settings[$module];
|
192 |
-
} elseif ( isset($this->settings[$module][$option]) ) {
|
193 |
-
return $this->settings[$module][$option];
|
194 |
-
} else {
|
195 |
-
return $default;
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Checks if an option is forced in the ini file.
|
201 |
-
* It is forced if it was defined on the ini file.
|
202 |
-
*
|
203 |
-
* @param string $module Module internal name.
|
204 |
-
* @param string $option Setting name.
|
205 |
-
* @return boolean
|
206 |
-
*/
|
207 |
-
public function isForced ( $module, $option )
|
208 |
-
{
|
209 |
-
if ( isset($this->forced[$module][$option]) ) {
|
210 |
-
return true;
|
211 |
-
} else {
|
212 |
-
return false;
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Adds a new module setting only if it does not exists.
|
218 |
-
* Does not save them to database. After adding all new settings, must call akSettings::saveSettings()
|
219 |
-
*
|
220 |
-
* @param string $module Module name.
|
221 |
-
* @param string $option Setting name.
|
222 |
-
* @param mixed $value Setting value
|
223 |
-
* @return boolean Returns true if settings has been added, false otherwise.
|
224 |
-
*/
|
225 |
-
public function addOption ( $module, $option, $value )
|
226 |
-
{
|
227 |
-
if ( ! isset($this->options[$module]) ) {
|
228 |
-
$this->populateSettings($module);
|
229 |
-
}
|
230 |
-
|
231 |
-
if ( isset($this->options[$module][$option]) ) {
|
232 |
-
return false;
|
233 |
-
} else {
|
234 |
-
$this->options[$module][$option] = $value;
|
235 |
-
}
|
236 |
-
|
237 |
-
$this->populateSettings($module);
|
238 |
-
$this->updated[$module] = true;
|
239 |
-
|
240 |
-
return true;
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Updates a module setting. If the setting does not exists, it is created.
|
245 |
-
* Does not save them to database. After adding all new settings, must call akSettings::saveSettings()
|
246 |
-
*
|
247 |
-
* @param string $module Module name.
|
248 |
-
* @param string $option Setting name.
|
249 |
-
* @param mixed $value Setting value
|
250 |
-
* @return void
|
251 |
-
*/
|
252 |
-
public function updateOption ( $module, $option, $value )
|
253 |
-
{
|
254 |
-
if ( ! isset($this->options[$module]) ) {
|
255 |
-
$this->populateSettings($module);
|
256 |
-
}
|
257 |
-
|
258 |
-
$this->options[$module][$option] = $value;
|
259 |
-
$this->populateSettings($module);
|
260 |
-
$this->updated[$module] = true;
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Deletes an option from a module.
|
265 |
-
* Only if the option existed.
|
266 |
-
*
|
267 |
-
* @param string $module Module name.
|
268 |
-
* @param string $option Setting name.
|
269 |
-
* @return void
|
270 |
-
*/
|
271 |
-
public function deleteOption ( $module, $option )
|
272 |
-
{
|
273 |
-
if ( ! isset($this->options[$module]) ) {
|
274 |
-
$this->populateSettings($module);
|
275 |
-
}
|
276 |
-
|
277 |
-
if ( isset($this->options[$module][$option]) ) {
|
278 |
-
unset($this->options[$module][$option]);
|
279 |
-
}
|
280 |
-
$this->populateSettings($module);
|
281 |
-
$this->updated[$module] = true;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Replaces all settings for a module and saves them to database.
|
286 |
-
* If settings does not exist, them are created.
|
287 |
-
*
|
288 |
-
* @uses apply_filters() Calls the 'ak_<module>_replace_options' filter on new options.
|
289 |
-
* @param string $module Module name.
|
290 |
-
* @param array $settings New module settings.
|
291 |
-
* @return boolean Returns true if settings have been replaced.
|
292 |
-
*/
|
293 |
-
public function replaceOptions ( $module, $settings )
|
294 |
-
{
|
295 |
-
if ( ! is_array($settings) ) {
|
296 |
-
return false;
|
297 |
-
}
|
298 |
-
|
299 |
-
$this->options[$module] = apply_filters('ak_' . $module . '_replace_options', $settings);
|
300 |
-
$this->populateSettings($module);
|
301 |
-
$this->updated[$module] = true;
|
302 |
-
|
303 |
-
return $this->saveOptions($module);
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* Saves settings to database.
|
308 |
-
* If a module name is provided saves only this module settings, if not, saves all settings.
|
309 |
-
*
|
310 |
-
* @param string $module Module name to save.
|
311 |
-
* @return boolean Returns true is settings have been saved, false otherwise.
|
312 |
-
*/
|
313 |
-
public function saveOptions ( $module = '' )
|
314 |
-
{
|
315 |
-
if ( empty($module) ) {
|
316 |
-
foreach ( $this->options as $module => $value ) {
|
317 |
-
if ( $this->updated[$module] ) {
|
318 |
-
update_option(self::prefix . $module . self::sufix, $value);
|
319 |
-
$this->updated[$module] = false;
|
320 |
-
}
|
321 |
-
}
|
322 |
-
return true;
|
323 |
-
} elseif ( isset($this->options[$module]) && $this->updated[$module]) {
|
324 |
-
update_option(self::prefix . $module . self::sufix, $this->options[$module]);
|
325 |
-
return true;
|
326 |
-
} else {
|
327 |
-
return false;
|
328 |
-
}
|
329 |
-
}
|
330 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/classes/template.php
DELETED
@@ -1,380 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class to manage simple templates for HTML output.
|
4 |
-
*
|
5 |
-
* @version $Rev: 203758 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* A very simple class for an easy tenplate management.
|
31 |
-
* This is an abstract class that have to be extended for use.
|
32 |
-
*
|
33 |
-
* TODO: Provide some sort of caching template contents.
|
34 |
-
*
|
35 |
-
* @package Alkivia
|
36 |
-
* @subpackage Framework
|
37 |
-
*/
|
38 |
-
class akTemplate
|
39 |
-
{
|
40 |
-
/**
|
41 |
-
* Templates folder (Slash ended).
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
protected $tpl_dir = array();
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Config files folder (Slah ended).
|
48 |
-
* @var string
|
49 |
-
*/
|
50 |
-
private $cfg_dir = array();
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Variables and values available to template.
|
54 |
-
* - 'var_name' => 'value'
|
55 |
-
* @var array
|
56 |
-
*/
|
57 |
-
protected $vars = array();
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Data readed from template config files.
|
61 |
-
* @var array
|
62 |
-
*/
|
63 |
-
private $config = array();
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Holds notice messages to be shown in output.
|
67 |
-
* On the template the method displayMessages() must be called.
|
68 |
-
* @var array
|
69 |
-
*/
|
70 |
-
private $notices = array();
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Holds error messages to be shown in output.
|
74 |
-
* On the template the method displayMessages() must be called.
|
75 |
-
* @var array
|
76 |
-
*/
|
77 |
-
private $errors = array();
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Class constructor.
|
81 |
-
*
|
82 |
-
* @param array|string $tpl_dir Full paths to template folders.
|
83 |
-
* @param string $cfg_dir Full path to config files.
|
84 |
-
* @return TemplateAbstract The class object or false if $tpl_dir is not a directory.
|
85 |
-
*/
|
86 |
-
public function __construct ( $tpl_dir, $cfg_dir = '' )
|
87 |
-
{
|
88 |
-
$this->tpl_dir = $this->checkDirectories($tpl_dir);
|
89 |
-
if ( empty($this->tpl_dir) ) {
|
90 |
-
wp_die(__('Template class: Received template paths are not valid directories.'));
|
91 |
-
}
|
92 |
-
|
93 |
-
if ( empty($cfg_dir) ) {
|
94 |
-
$this->cfg_dir = $this->tpl_dir;
|
95 |
-
} else {
|
96 |
-
$this->cfg_dir = $this->checkDirectories($cfg_dir);
|
97 |
-
if ( empty($this->tpl_dir) ) {
|
98 |
-
wp_die(__('Template class: Received config paths are not valid directories.'));
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Checks an array of paths are valid directories.
|
106 |
-
*
|
107 |
-
* @since 0.8
|
108 |
-
*
|
109 |
-
* @param array|string $directories Absolute paths array
|
110 |
-
* @return array An array with only valid directories, wrong directories are removed.
|
111 |
-
*/
|
112 |
-
private function checkDirectories ( $directories )
|
113 |
-
{
|
114 |
-
$valid = array();
|
115 |
-
foreach ( (array) $directories as $path ) {
|
116 |
-
if ( is_dir($path) ) {
|
117 |
-
$valid[] = trailingslashit($path);
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
return $valid;
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Assigns the translation textDomain as an available variable name.
|
126 |
-
* This will be available in template as $i18n.
|
127 |
-
*
|
128 |
-
* @param $context Translation context textDomain.
|
129 |
-
* @return void
|
130 |
-
*/
|
131 |
-
final public function textDomain ( $context )
|
132 |
-
{
|
133 |
-
$this->vars['i18n'] = $context;
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Assigns a variable name with it's value.
|
138 |
-
* Reserved vars names: i18n, tpl, cfg.
|
139 |
-
*
|
140 |
-
* @param $name Variable name.
|
141 |
-
* @param $value Value of the variable.
|
142 |
-
* @return void
|
143 |
-
*/
|
144 |
-
final public function assign ( $name, $value )
|
145 |
-
{
|
146 |
-
$this->checkReserved($name);
|
147 |
-
$this->vars[$name] = $value;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Assigns a variable name with it's value by reference.
|
152 |
-
*
|
153 |
-
* @param $name Variable name.
|
154 |
-
* @param $value Value of the variable, received by reference.
|
155 |
-
* @return void
|
156 |
-
*/
|
157 |
-
public function assignByRef( $name, &$value )
|
158 |
-
{
|
159 |
-
$this->checkReserved($name);
|
160 |
-
$this->vars[$name] =& $value;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Checks if a template var name is reserved and dies if yes.
|
165 |
-
*
|
166 |
-
* @since 0.8
|
167 |
-
*
|
168 |
-
* @param string $name Variable name to check.
|
169 |
-
* @return void
|
170 |
-
*/
|
171 |
-
private function checkReserved ( $name )
|
172 |
-
{
|
173 |
-
if ( in_array($name, array('i18n', '_template', '_default', '_config', '_filename')) ) {
|
174 |
-
wp_die( sprintf(__('Template class: %s is a reserved template variable.'), $name) );
|
175 |
-
}
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Loads an INI file from config folder, and merges the content with previous read files.
|
180 |
-
*
|
181 |
-
* @param $file File name (With no extension)
|
182 |
-
* @return void
|
183 |
-
*/
|
184 |
-
final public function loadConfig ( $file )
|
185 |
-
{
|
186 |
-
foreach ( $this->cfg_dir as $path ) {
|
187 |
-
$filename = $path . $name . '.ini';
|
188 |
-
if ( file_exists($filename) ) {
|
189 |
-
$config = parse_ini_file( $filename, true);
|
190 |
-
$this->config = array_merge($this->config, $config);
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Sets config values to empty.
|
197 |
-
* Can be used to start over loading new INI files.
|
198 |
-
*
|
199 |
-
* @return void
|
200 |
-
*/
|
201 |
-
final public function resetConfig ()
|
202 |
-
{
|
203 |
-
$this->config = array();
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Sets template vars to empty.
|
208 |
-
* Can be used to start over with a new template.
|
209 |
-
*
|
210 |
-
* @return void
|
211 |
-
*/
|
212 |
-
final public function resetVars ()
|
213 |
-
{
|
214 |
-
$this->vars = array();
|
215 |
-
}
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Sets config and vars to empty.
|
219 |
-
* Used to start a new clean template.
|
220 |
-
*
|
221 |
-
* @return void
|
222 |
-
*/
|
223 |
-
final public function resetAll ()
|
224 |
-
{
|
225 |
-
$this->config = array();
|
226 |
-
$this->vars = array();
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Adds an error to the erros queue.
|
231 |
-
* Only adds it if error does not already exists on errors queue.
|
232 |
-
*
|
233 |
-
* @param string $message Message to be added to the queue.
|
234 |
-
* @return void
|
235 |
-
*/
|
236 |
-
final public function addError ( $message )
|
237 |
-
{
|
238 |
-
if ( ! empty($message) && ! in_array($message, $this->errors)) {
|
239 |
-
$this->errors[] = $message;
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Chechs if errors were found and have to be displayed.
|
245 |
-
*
|
246 |
-
* @return boolean Found errors.
|
247 |
-
*/
|
248 |
-
final public function foundErrors()
|
249 |
-
{
|
250 |
-
return ! empty($this->errors);
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Adds a notice to the notices queue.
|
255 |
-
* Only adds the notice if it does not alredy exists on notices queue.
|
256 |
-
*
|
257 |
-
* @param string $message Message to be added to the queue.
|
258 |
-
* @return void
|
259 |
-
*/
|
260 |
-
final public function addNotice ( $message )
|
261 |
-
{
|
262 |
-
if ( ! empty($message) && ! in_array($message, $this->notices)) {
|
263 |
-
$this->notices[] = $message;
|
264 |
-
}
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* Empties all messages queues (notices and errors).
|
269 |
-
*
|
270 |
-
* @return void
|
271 |
-
*/
|
272 |
-
final public function resetMessages ()
|
273 |
-
{
|
274 |
-
$this->errors = array();
|
275 |
-
$this->notices = array();
|
276 |
-
}
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Displays notices and/or error messages and empties the messages queue.
|
280 |
-
* This function should only be called within a template.
|
281 |
-
*
|
282 |
-
* @return void
|
283 |
-
*/
|
284 |
-
final public function displayMessages ()
|
285 |
-
{
|
286 |
-
if ( ! empty($this->errors) ) {
|
287 |
-
$errors = implode('<br />' . PHP_EOL, $this->errors);
|
288 |
-
echo '<div id="message" class="error">' . $errors . '</div>' . PHP_EOL;
|
289 |
-
}
|
290 |
-
|
291 |
-
if ( ! empty($this->notices) ) {
|
292 |
-
$notices = implode('<br />' . PHP_EOL, $this->notices);
|
293 |
-
echo '<div id="message" class="notice">' . $notices . '</div>' . PHP_EOL;
|
294 |
-
}
|
295 |
-
|
296 |
-
$this->resetMessages();
|
297 |
-
}
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Checks if a template file is available.
|
301 |
-
*
|
302 |
-
* @since 0.8
|
303 |
-
*
|
304 |
-
* @param string $template Template name (With no .php extension)
|
305 |
-
* @return boolean If template file was found or not.
|
306 |
-
*/
|
307 |
-
final public function available( $template )
|
308 |
-
{
|
309 |
-
return ( false === $this->locateFile($template) ) ? false : true;
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Displays a template from the templates folder.
|
314 |
-
* Inside the template all assigned vars will be available.
|
315 |
-
* Also 'cfg' and 'tpl' vars will be available:
|
316 |
-
* - cfg is an array which cointains all config values.
|
317 |
-
* - tpl is an string cointaining template absolute name.
|
318 |
-
*
|
319 |
-
* TODO: Load config file with same name as template.
|
320 |
-
*
|
321 |
-
* @param string $_template Template name with no extension.
|
322 |
-
* @param string $_default Alternate default template name.
|
323 |
-
* @return void.
|
324 |
-
*/
|
325 |
-
final public function display ( $_template, $_default = '' )
|
326 |
-
{
|
327 |
-
$_filename = $this->locateFile($_template);
|
328 |
-
if ( false === $_filename && ! empty($_default) ) {
|
329 |
-
$_filename = $this->locateFile($_default);
|
330 |
-
}
|
331 |
-
|
332 |
-
if ( $_filename ) {
|
333 |
-
$_config =& $this->config;
|
334 |
-
extract($this->vars);
|
335 |
-
include ( $_filename );
|
336 |
-
|
337 |
-
} else {
|
338 |
-
wp_die(sprintf(__('Template file %1$s not found. Default template %2$s not found.'), $_template, $_default));
|
339 |
-
}
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Returns the template contents after processing it.
|
344 |
-
* Calls to TemplateAbstract::display() for template processing.
|
345 |
-
*
|
346 |
-
* @param string $template Template name with no extension.
|
347 |
-
* @param string $default Alternate default template name.
|
348 |
-
* @return string|false The template contents or false if failed processing.
|
349 |
-
*/
|
350 |
-
final public function getDisplay ( $template, $default = '' )
|
351 |
-
{
|
352 |
-
if ( ob_start() ) {
|
353 |
-
$this->display($template, $default);
|
354 |
-
$content = ob_get_contents();
|
355 |
-
ob_end_clean();
|
356 |
-
return $content;
|
357 |
-
} else {
|
358 |
-
return false;
|
359 |
-
}
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Locates the path for a template filename.
|
364 |
-
* If template is not found, returns false.
|
365 |
-
*
|
366 |
-
* @param string $name Template name (with no .php extension)
|
367 |
-
* @return string|false Absolute path to template file. False if not found.
|
368 |
-
*/
|
369 |
-
private function locateFile( $name )
|
370 |
-
{
|
371 |
-
foreach ( $this->tpl_dir as $path ) {
|
372 |
-
$template = $path . $name . '.php';
|
373 |
-
if ( file_exists($template) ) {
|
374 |
-
return $template;
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
return false;
|
379 |
-
}
|
380 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/init.php
CHANGED
@@ -35,7 +35,7 @@
|
|
35 |
function ak_styles_url ()
|
36 |
{
|
37 |
$dir = str_replace('\\', '/', WP_CONTENT_DIR);
|
38 |
-
$fmw = str_replace('\\', '/',
|
39 |
|
40 |
return str_replace($dir, content_url(), $fmw) . '/styles';
|
41 |
}
|
@@ -54,74 +54,19 @@ if ( ! defined('AK_INI_FILE') ) {
|
|
54 |
|
55 |
if ( ! defined('AK_CLASSES') ) {
|
56 |
/** Define the classes folder */
|
57 |
-
define ( 'AK_CLASSES',
|
58 |
}
|
59 |
-
|
60 |
if ( ! defined('AK_LIB') ) {
|
61 |
/** Library folder for functions files */
|
62 |
-
define ( 'AK_LIB',
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( ! defined('AK_VENDOR') ) {
|
66 |
-
/** Vendor classes and libs */
|
67 |
-
define ('AK_VENDOR', AK_FRAMEWORK . '/vendor');
|
68 |
-
}
|
69 |
-
|
70 |
-
$akf_uploads = wp_upload_dir();
|
71 |
-
if ( ! defined('AK_UPLOAD_DIR') ) {
|
72 |
-
/** Absolute path to upload folder */
|
73 |
-
define ( 'AK_UPLOAD_DIR', $akf_uploads['basedir'] . '/alkivia');
|
74 |
-
}
|
75 |
-
if ( ! defined('AK_UPLOAD_URL') ) {
|
76 |
-
/** URL to upload folder. This could be replaced by a download manager. */
|
77 |
-
define ( 'AK_UPLOAD_URL', $akf_uploads['baseurl'] . '/alkivia');
|
78 |
}
|
79 |
|
80 |
// ============================================== SET GLOBAL ACTION HOOKS =====
|
81 |
|
82 |
-
/**
|
83 |
-
* Adds meta name for Alkivia Framework to head.
|
84 |
-
*
|
85 |
-
* @hook action 'wp_head'
|
86 |
-
* @access private
|
87 |
-
* @return void
|
88 |
-
*/
|
89 |
-
function _ak_framework_meta_tags() {
|
90 |
-
echo '<meta name="framework" content="Alkivia Framework ' . get_option('ak_framework_version') . '" />' . PHP_EOL;
|
91 |
-
}
|
92 |
-
add_action('wp_head', '_ak_framework_meta_tags');
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Loads the framework translations.
|
96 |
-
* Sets the translation text domain to 'akvf'.
|
97 |
-
*
|
98 |
-
* @return bool true on success, false on failure
|
99 |
-
*/
|
100 |
-
function _ak_framework_translation()
|
101 |
-
{
|
102 |
-
$locale = get_locale();
|
103 |
-
$mofile = AK_FRAMEWORK . "/lang/$locale.mo";
|
104 |
-
|
105 |
-
return load_textdomain('akfw', $mofile);
|
106 |
-
}
|
107 |
-
add_action('init', '_ak_framework_translation');
|
108 |
|
109 |
// ================================================ INCLUDE ALL LIBRARIES =====
|
110 |
|
111 |
-
// Create the upload folder if does not exist.
|
112 |
-
if ( ! is_dir(AK_UPLOAD_DIR) ) {
|
113 |
-
wp_mkdir_p(AK_UPLOAD_DIR);
|
114 |
-
}
|
115 |
-
|
116 |
-
// Prepare the settings and objects libraries.
|
117 |
-
require_once ( AK_CLASSES . '/settings.php');
|
118 |
-
|
119 |
-
require_once ( AK_LIB . '/filesystem.php' );
|
120 |
require_once ( AK_LIB . '/formating.php' );
|
121 |
-
require_once ( AK_LIB . '/modules.php' );
|
122 |
-
require_once ( AK_LIB . '/objects.php' );
|
123 |
-
require_once ( AK_LIB . '/system.php' );
|
124 |
-
require_once ( AK_LIB . '/themes.php' );
|
125 |
-
require_once ( AK_LIB . '/users.php' );
|
126 |
|
127 |
-
|
|
35 |
function ak_styles_url ()
|
36 |
{
|
37 |
$dir = str_replace('\\', '/', WP_CONTENT_DIR);
|
38 |
+
$fmw = str_replace('\\', '/', AKK_FRAMEWORK);
|
39 |
|
40 |
return str_replace($dir, content_url(), $fmw) . '/styles';
|
41 |
}
|
54 |
|
55 |
if ( ! defined('AK_CLASSES') ) {
|
56 |
/** Define the classes folder */
|
57 |
+
define ( 'AK_CLASSES', AKK_FRAMEWORK . '/classes');
|
58 |
}
|
|
|
59 |
if ( ! defined('AK_LIB') ) {
|
60 |
/** Library folder for functions files */
|
61 |
+
define ( 'AK_LIB', AKK_FRAMEWORK . '/lib');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
// ============================================== SET GLOBAL ACTION HOOKS =====
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
// ================================================ INCLUDE ALL LIBRARIES =====
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
require_once ( AK_LIB . '/formating.php' );
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
+
require_once ( AK_LIB . '/themes-agapetry.php' );
|
72 |
+
require_once ( AK_LIB . '/users.php' );
|
framework/lang/bg_BG.mo
DELETED
Binary file
|
framework/lang/bg_BG.po
DELETED
@@ -1,352 +0,0 @@
|
|
1 |
-
# Petar Toushkov <pt.launchpad@gmail.com>, 2010.
|
2 |
-
msgid ""
|
3 |
-
msgstr ""
|
4 |
-
"Project-Id-Version: Alkivia SidePosts\n"
|
5 |
-
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2010-02-06 01:15+0100\n"
|
7 |
-
"PO-Revision-Date: 2010-02-06 01:15+0100\n"
|
8 |
-
"Last-Translator: Jordi Canals <devel@jcanals.cat>\n"
|
9 |
-
"Language-Team: Bulgarian <dict@fsa-bg.org>\n"
|
10 |
-
"MIME-Version: 1.0\n"
|
11 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
-
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_c\n"
|
16 |
-
"X-Poedit-Basepath: .\n"
|
17 |
-
"X-Generator: Lokalize 1.0\n"
|
18 |
-
"X-Poedit-SearchPath-0: ..\n"
|
19 |
-
|
20 |
-
#: ../classes/abstract/module.php:599
|
21 |
-
msgid "Option blocked by administrator."
|
22 |
-
msgstr "Опцията е блокирана от администратора."
|
23 |
-
|
24 |
-
#: ../classes/abstract/plugin.php:344
|
25 |
-
#: ../classes/abstract/plugin.php:363
|
26 |
-
msgid "Warning:"
|
27 |
-
msgstr "Предупреждение: "
|
28 |
-
|
29 |
-
#: ../classes/abstract/plugin.php:345
|
30 |
-
#, php-format
|
31 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
32 |
-
msgstr "Активната приставка %s е несъвместима с вашата версия на WordPress."
|
33 |
-
|
34 |
-
#: ../classes/abstract/plugin.php:347
|
35 |
-
#, php-format
|
36 |
-
msgid "WordPress %s is required to run this plugin."
|
37 |
-
msgstr "ЗА работата на тази приставка се изисква WordPress %s."
|
38 |
-
|
39 |
-
#: ../classes/abstract/plugin.php:364
|
40 |
-
msgid "Standard sidebar functions are not present."
|
41 |
-
msgstr "Стандартните функция за страничната лента не са налични."
|
42 |
-
|
43 |
-
#: ../classes/abstract/plugin.php:365
|
44 |
-
#, php-format
|
45 |
-
msgid "It is required to use the standard sidebar to run %s"
|
46 |
-
msgstr "За да работи %s трябва да работи стандартната странична лента."
|
47 |
-
|
48 |
-
#: ../classes/abstract/plugin.php:412
|
49 |
-
msgid "Activate Components"
|
50 |
-
msgstr ""
|
51 |
-
|
52 |
-
#: ../classes/abstract/plugin.php:421
|
53 |
-
msgid "Yes"
|
54 |
-
msgstr ""
|
55 |
-
|
56 |
-
#: ../classes/abstract/plugin.php:422
|
57 |
-
msgid "No"
|
58 |
-
msgstr ""
|
59 |
-
|
60 |
-
#: ../lib/formating.php:52
|
61 |
-
msgid "Settings saved."
|
62 |
-
msgstr "Настройките бяха запазени."
|
63 |
-
|
64 |
-
#: ../lib/formating.php:160
|
65 |
-
msgid "Just Now"
|
66 |
-
msgstr "Току-що"
|
67 |
-
|
68 |
-
#: ../lib/formating.php:163
|
69 |
-
#, php-format
|
70 |
-
msgid "1 minute ago"
|
71 |
-
msgid_plural "%d minutes ago"
|
72 |
-
msgstr[0] "преди 1 минута"
|
73 |
-
msgstr[1] "преди %d минути"
|
74 |
-
|
75 |
-
#: ../lib/formating.php:166
|
76 |
-
#, php-format
|
77 |
-
msgid "1 hour ago"
|
78 |
-
msgid_plural "%d hours ago"
|
79 |
-
msgstr[0] "преди един час"
|
80 |
-
msgstr[1] "преди %d часа"
|
81 |
-
|
82 |
-
#: ../lib/formating.php:170
|
83 |
-
#, php-format
|
84 |
-
msgid "Today at %s"
|
85 |
-
msgstr "Днес в %s"
|
86 |
-
|
87 |
-
#: ../lib/formating.php:170
|
88 |
-
#, php-format
|
89 |
-
msgid "Yesterday at %s"
|
90 |
-
msgstr "Вчера в %s"
|
91 |
-
|
92 |
-
#: ../lib/themes.php:160
|
93 |
-
msgid "Plugin Homepage"
|
94 |
-
msgstr ""
|
95 |
-
|
96 |
-
#: ../lib/themes.php:164
|
97 |
-
msgid "Theme Homepage"
|
98 |
-
msgstr ""
|
99 |
-
|
100 |
-
#: ../lib/themes.php:168
|
101 |
-
msgid "Documentation"
|
102 |
-
msgstr ""
|
103 |
-
|
104 |
-
#: ../lib/themes.php:172
|
105 |
-
msgid "Support Forum"
|
106 |
-
msgstr ""
|
107 |
-
|
108 |
-
#: ../lib/themes.php:176
|
109 |
-
msgid "Author Homepage"
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: ../lib/themes.php:180
|
113 |
-
msgid "Donate to project"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: ../vendor/upload/class.upload.php:2171
|
117 |
-
msgid "File error. Please try again."
|
118 |
-
msgstr "Грешка във файла. Моля, опитайте отново."
|
119 |
-
|
120 |
-
#: ../vendor/upload/class.upload.php:2172
|
121 |
-
msgid "Local file doesn't exist."
|
122 |
-
msgstr "Локалният файл не съществува."
|
123 |
-
|
124 |
-
#: ../vendor/upload/class.upload.php:2173
|
125 |
-
msgid "Local file is not readable."
|
126 |
-
msgstr "Локалният файл не може да бъде прочетен."
|
127 |
-
|
128 |
-
#: ../vendor/upload/class.upload.php:2174
|
129 |
-
msgid "File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)."
|
130 |
-
msgstr "Грешка при качването на файла (каченият файл надхвърля upload_max_filesize директивата в php.ini)."
|
131 |
-
|
132 |
-
#: ../vendor/upload/class.upload.php:2175
|
133 |
-
msgid "File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)."
|
134 |
-
msgstr "Грешка при качването на файла (каченият файл надхвърля MAX_FILE_SIZE директивата, указана в HTML формата)."
|
135 |
-
|
136 |
-
#: ../vendor/upload/class.upload.php:2176
|
137 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
138 |
-
msgstr "Грешка при качването на файла (файлът беше качен частично)."
|
139 |
-
|
140 |
-
#: ../vendor/upload/class.upload.php:2177
|
141 |
-
msgid "File upload error (no file was uploaded)."
|
142 |
-
msgstr "Грешка при качването на файла (не беше качен файл)."
|
143 |
-
|
144 |
-
#: ../vendor/upload/class.upload.php:2178
|
145 |
-
msgid "File upload error (missing a temporary folder)."
|
146 |
-
msgstr "Грешка при качването на файла (отсъства временна директория)."
|
147 |
-
|
148 |
-
#: ../vendor/upload/class.upload.php:2179
|
149 |
-
msgid "File upload error (failed to write file to disk)."
|
150 |
-
msgstr "Грешка при качването на файла (неуспех при запис върху диска)."
|
151 |
-
|
152 |
-
#: ../vendor/upload/class.upload.php:2180
|
153 |
-
msgid "File upload error (file upload stopped by extension)."
|
154 |
-
msgstr "Грешка при качването на файла (качването беше преустановено от приставката)."
|
155 |
-
|
156 |
-
#: ../vendor/upload/class.upload.php:2181
|
157 |
-
msgid "File upload error (unknown error code)."
|
158 |
-
msgstr "Грешка при качването на файла (неизвестен код за грешка)."
|
159 |
-
|
160 |
-
#: ../vendor/upload/class.upload.php:2182
|
161 |
-
msgid "File upload error. Please try again."
|
162 |
-
msgstr "Грешка при качването на файла. Моля, опитайте отново."
|
163 |
-
|
164 |
-
#: ../vendor/upload/class.upload.php:2183
|
165 |
-
msgid "File too big."
|
166 |
-
msgstr "Файлът е прекалено голям."
|
167 |
-
|
168 |
-
#: ../vendor/upload/class.upload.php:2184
|
169 |
-
msgid "MIME type can't be detected."
|
170 |
-
msgstr "Неустановен тип (MIME type)."
|
171 |
-
|
172 |
-
#: ../vendor/upload/class.upload.php:2185
|
173 |
-
msgid "Incorrect type of file."
|
174 |
-
msgstr "Неправилен файлов тип."
|
175 |
-
|
176 |
-
#: ../vendor/upload/class.upload.php:2186
|
177 |
-
msgid "Image too wide."
|
178 |
-
msgstr "Изображението е прекалено широко."
|
179 |
-
|
180 |
-
#: ../vendor/upload/class.upload.php:2187
|
181 |
-
msgid "Image too narrow."
|
182 |
-
msgstr "Изображението е прекалено тясно."
|
183 |
-
|
184 |
-
#: ../vendor/upload/class.upload.php:2188
|
185 |
-
msgid "Image too high."
|
186 |
-
msgstr "Изображението е прекалено високо."
|
187 |
-
|
188 |
-
#: ../vendor/upload/class.upload.php:2189
|
189 |
-
msgid "Image too short."
|
190 |
-
msgstr "Изображението е прекалено ниско."
|
191 |
-
|
192 |
-
#: ../vendor/upload/class.upload.php:2190
|
193 |
-
msgid "Image ratio too high (image too wide)."
|
194 |
-
msgstr "Съотношението на изображението е прекалено високо (изображението е прекалено широко)."
|
195 |
-
|
196 |
-
#: ../vendor/upload/class.upload.php:2191
|
197 |
-
msgid "Image ratio too low (image too high)."
|
198 |
-
msgstr "Съотношението на изображението е прекалено ниско (изображението е прекалено високо)."
|
199 |
-
|
200 |
-
#: ../vendor/upload/class.upload.php:2192
|
201 |
-
msgid "Image has too many pixels."
|
202 |
-
msgstr "Изображението има прекалено много пиксели."
|
203 |
-
|
204 |
-
#: ../vendor/upload/class.upload.php:2193
|
205 |
-
msgid "Image has not enough pixels."
|
206 |
-
msgstr "Изображението няма достатъчно пиксели."
|
207 |
-
|
208 |
-
#: ../vendor/upload/class.upload.php:2194
|
209 |
-
msgid "File not uploaded. Can't carry on a process."
|
210 |
-
msgstr "Файлът не беше качен. Процесът не може да продължи."
|
211 |
-
|
212 |
-
#: ../vendor/upload/class.upload.php:2195
|
213 |
-
#, php-format
|
214 |
-
msgid "%s already exists. Please change the file name."
|
215 |
-
msgstr "%s вече съществува. Моля, преименувайте."
|
216 |
-
|
217 |
-
#: ../vendor/upload/class.upload.php:2196
|
218 |
-
msgid "No correct temp source file. Can't carry on a process."
|
219 |
-
msgstr "Неправилен временен файлов източник. Процесът не може да продължи."
|
220 |
-
|
221 |
-
#: ../vendor/upload/class.upload.php:2197
|
222 |
-
msgid "No correct uploaded source file. Can't carry on a process."
|
223 |
-
msgstr "Неправилен файлов източник за качване. Процесът не може да продължи."
|
224 |
-
|
225 |
-
#: ../vendor/upload/class.upload.php:2198
|
226 |
-
msgid "Destination directory can't be created. Can't carry on a process."
|
227 |
-
msgstr "Целевата директория не може да бъде създадена. Процесът не може да продължи."
|
228 |
-
|
229 |
-
#: ../vendor/upload/class.upload.php:2199
|
230 |
-
msgid "Destination directory doesn't exist. Can't carry on a process."
|
231 |
-
msgstr "Целевата директория не съществува. Процесът не може да продължи."
|
232 |
-
|
233 |
-
#: ../vendor/upload/class.upload.php:2200
|
234 |
-
msgid "Destination path is not a directory. Can't carry on a process."
|
235 |
-
msgstr "Целевият път не е директория. Процесът не може да продължи."
|
236 |
-
|
237 |
-
#: ../vendor/upload/class.upload.php:2201
|
238 |
-
msgid "Destination directory can't be made writeable. Can't carry on a process."
|
239 |
-
msgstr "Целевата директория не може да получи права за запис. Процесът не може да продължи."
|
240 |
-
|
241 |
-
#: ../vendor/upload/class.upload.php:2202
|
242 |
-
msgid "Destination path is not a writeable. Can't carry on a process."
|
243 |
-
msgstr "Целевият път е недостъпен за запис. Процесът не може да продължи."
|
244 |
-
|
245 |
-
#: ../vendor/upload/class.upload.php:2203
|
246 |
-
msgid "Can't create the temporary file. Can't carry on a process."
|
247 |
-
msgstr "Неуспех при създаването на временния файл. Процесът не може да продължи."
|
248 |
-
|
249 |
-
#: ../vendor/upload/class.upload.php:2204
|
250 |
-
msgid "Source file is not readable. Can't carry on a process."
|
251 |
-
msgstr "Файловият източник не може да бъде прочетен. Процесът не може да продължи."
|
252 |
-
|
253 |
-
#: ../vendor/upload/class.upload.php:2205
|
254 |
-
#, php-format
|
255 |
-
msgid "No create from %s support."
|
256 |
-
msgstr "Няма поддръжка за създаване от %s."
|
257 |
-
|
258 |
-
#: ../vendor/upload/class.upload.php:2206
|
259 |
-
#, php-format
|
260 |
-
msgid "Error in creating %s image from source."
|
261 |
-
msgstr "Грешка при създаването на %s изображение от източника."
|
262 |
-
|
263 |
-
#: ../vendor/upload/class.upload.php:2207
|
264 |
-
msgid "Can't read image source. Not an image?."
|
265 |
-
msgstr "Неуспех при четенето на източника на изображението. Изображение ли е?"
|
266 |
-
|
267 |
-
#: ../vendor/upload/class.upload.php:2208
|
268 |
-
msgid "GD doesn't seem to be present."
|
269 |
-
msgstr "Изглежда, GD не е налично."
|
270 |
-
|
271 |
-
#: ../vendor/upload/class.upload.php:2209
|
272 |
-
#, php-format
|
273 |
-
msgid "No create from %s support, can't read watermark."
|
274 |
-
msgstr "Няма поддръжка за създаване от %s, неуспех при четенето на водния знак."
|
275 |
-
|
276 |
-
#: ../vendor/upload/class.upload.php:2210
|
277 |
-
#, php-format
|
278 |
-
msgid "No %s read support, can't create watermark."
|
279 |
-
msgstr "Няма поддръжка за четене на %s, неуспех при четенето на водния знак."
|
280 |
-
|
281 |
-
#: ../vendor/upload/class.upload.php:2211
|
282 |
-
msgid "Unknown image format, can't read watermark."
|
283 |
-
msgstr "Неизвестен формат на изображението, неуспех при четенето на водния знак."
|
284 |
-
|
285 |
-
#: ../vendor/upload/class.upload.php:2212
|
286 |
-
#, php-format
|
287 |
-
msgid "No %s create support."
|
288 |
-
msgstr "Няма поддръжка за създаване на %s."
|
289 |
-
|
290 |
-
#: ../vendor/upload/class.upload.php:2213
|
291 |
-
msgid "No conversion type defined."
|
292 |
-
msgstr "Няма дефиниран тип преобразуване."
|
293 |
-
|
294 |
-
#: ../vendor/upload/class.upload.php:2214
|
295 |
-
msgid "Error copying file on the server. copy() failed."
|
296 |
-
msgstr "Грешка при копирането на файла на сървъра. copy() failed."
|
297 |
-
|
298 |
-
#: ../vendor/upload/class.upload.php:2215
|
299 |
-
msgid "Error reading the file."
|
300 |
-
msgstr "Грешка при четенето на файла."
|
301 |
-
|
302 |
-
#~ msgid "The active plugin %s is not compatible with your PHP version."
|
303 |
-
#~ msgstr "Активната приставка %s е несъвместима с вашата PHP версия."
|
304 |
-
#~ msgid "%s is required for this plugin."
|
305 |
-
#~ msgstr "За тази приставка се изисква %s."
|
306 |
-
#~ msgid "A widget to move posts to the sidebar."
|
307 |
-
#~ msgstr "Джаджа за прехвърляне на публикации в страничната лента."
|
308 |
-
#~ msgid "Category not selected."
|
309 |
-
#~ msgstr "Не е избрана категория."
|
310 |
-
#~ msgid "Read more »"
|
311 |
-
#~ msgstr "Прочетете още »"
|
312 |
-
#~ msgid "No Comments"
|
313 |
-
#~ msgstr "Няма коментари"
|
314 |
-
#~ msgid "1 Comment"
|
315 |
-
#~ msgstr "1 коментар"
|
316 |
-
#~ msgid "% Comments"
|
317 |
-
#~ msgstr "% коментари"
|
318 |
-
#~ msgid "Comments closed"
|
319 |
-
#~ msgstr "Коментарите са забранени"
|
320 |
-
#~ msgid "Archive for"
|
321 |
-
#~ msgstr "Архив за"
|
322 |
-
#~ msgid "Title:"
|
323 |
-
#~ msgstr "Заглавие:"
|
324 |
-
#~ msgid "Category:"
|
325 |
-
#~ msgstr "Категория:"
|
326 |
-
#~ msgid "-- PRIVATE POSTS --"
|
327 |
-
#~ msgstr "-- ЛИЧНИ ПУБЛИКАЦИИ --"
|
328 |
-
#~ msgid "Number of posts:"
|
329 |
-
#~ msgstr "Брой на публикациите:"
|
330 |
-
#~ msgid "(At most %d)"
|
331 |
-
#~ msgstr "(Най-много %d)"
|
332 |
-
#~ msgid "Show:"
|
333 |
-
#~ msgstr "Показване:"
|
334 |
-
#~ msgid "Full Post"
|
335 |
-
#~ msgstr "Цялата публикация"
|
336 |
-
#~ msgid "Post Excerpt"
|
337 |
-
#~ msgstr "Извадка от публикацията"
|
338 |
-
#~ msgid "Excerpts with thumbnails"
|
339 |
-
#~ msgstr "Извадки с умалени изображения"
|
340 |
-
#~ msgid "Photo Blog"
|
341 |
-
#~ msgstr "Фото блог"
|
342 |
-
#~ msgid "Only Post Title"
|
343 |
-
#~ msgstr "Само заглавието на публикацията"
|
344 |
-
#~ msgid "Show category on all feeds"
|
345 |
-
#~ msgstr "Показване на категорията във всички емисии"
|
346 |
-
#~ msgid "Image width:"
|
347 |
-
#~ msgstr "Ширина на изображението:"
|
348 |
-
#~ msgid "pixels"
|
349 |
-
#~ msgstr "пиксела"
|
350 |
-
#~ msgid "Align thumbnail to right"
|
351 |
-
#~ msgstr "Подравняване на изображението надясно"
|
352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lang/ca.mo
DELETED
Binary file
|
framework/lang/ca.po
DELETED
@@ -1,315 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Alkivia Framework\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2010-02-08 13:50+0100\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Jordi Canals <devel@jcanals.cat>\n"
|
8 |
-
"Language-Team: Jordi Canals | http://alkivia.org <devel@jcanals.cat>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
-
"X-Poedit-Language: Catalan\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
|
16 |
-
#: ../classes/template.php:90
|
17 |
-
msgid "Template class: Received template paths are not valid directories."
|
18 |
-
msgstr "Classe 'Template': Les rutes de plantilla rebudes no són directoris vàlids."
|
19 |
-
|
20 |
-
#: ../classes/template.php:98
|
21 |
-
msgid "Template class: Received config paths are not valid directories."
|
22 |
-
msgstr "Classe 'Template': Les rutes de configuració rebudes no són directoris vàlids."
|
23 |
-
|
24 |
-
#: ../classes/template.php:174
|
25 |
-
#, php-format
|
26 |
-
msgid "Template class: %s is a reserved template variable."
|
27 |
-
msgstr "Classe 'Template': %s és una variable reservada."
|
28 |
-
|
29 |
-
#: ../classes/template.php:338
|
30 |
-
#, php-format
|
31 |
-
msgid "Template file %1$s not found. Default template %2$s not found."
|
32 |
-
msgstr "L'arxiu de plantilla %1$s no s'ha trobat. Tampoc s'ha trobat la plantilla predeterminada %2$s."
|
33 |
-
|
34 |
-
#: ../classes/abstract/module.php:614
|
35 |
-
msgid "Option blocked by administrator."
|
36 |
-
msgstr "Opció desactivada per l'administrador."
|
37 |
-
|
38 |
-
#: ../classes/abstract/plugin.php:344
|
39 |
-
#: ../classes/abstract/plugin.php:363
|
40 |
-
msgid "Warning:"
|
41 |
-
msgstr "Atenció:"
|
42 |
-
|
43 |
-
#: ../classes/abstract/plugin.php:345
|
44 |
-
#, php-format
|
45 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
46 |
-
msgstr "L'extensió activa %s no és compatible amb la vostra versió de WordPress."
|
47 |
-
|
48 |
-
#: ../classes/abstract/plugin.php:347
|
49 |
-
#, php-format
|
50 |
-
msgid "WordPress %s is required to run this plugin."
|
51 |
-
msgstr "Aquesta extensió requereix WordPress %s."
|
52 |
-
|
53 |
-
#: ../classes/abstract/plugin.php:364
|
54 |
-
msgid "Standard sidebar functions are not present."
|
55 |
-
msgstr "No s'han trobat les funcions necessàries de la barra lateral estàndard."
|
56 |
-
|
57 |
-
#: ../classes/abstract/plugin.php:365
|
58 |
-
#, php-format
|
59 |
-
msgid "It is required to use the standard sidebar to run %s"
|
60 |
-
msgstr "La barra lateral estàndard és necessària per executar %s."
|
61 |
-
|
62 |
-
#: ../classes/abstract/plugin.php:418
|
63 |
-
msgid "Activate Components"
|
64 |
-
msgstr "Activa Components"
|
65 |
-
|
66 |
-
#: ../classes/abstract/plugin.php:427
|
67 |
-
msgid "Yes"
|
68 |
-
msgstr "Sí"
|
69 |
-
|
70 |
-
#: ../classes/abstract/plugin.php:428
|
71 |
-
msgid "No"
|
72 |
-
msgstr "No"
|
73 |
-
|
74 |
-
#: ../lib/formating.php:52
|
75 |
-
msgid "Settings saved."
|
76 |
-
msgstr "Opcions desades."
|
77 |
-
|
78 |
-
#: ../lib/formating.php:160
|
79 |
-
msgid "Just Now"
|
80 |
-
msgstr "Ara mateix"
|
81 |
-
|
82 |
-
#: ../lib/formating.php:163
|
83 |
-
#, php-format
|
84 |
-
msgid "1 minute ago"
|
85 |
-
msgid_plural "%d minutes ago"
|
86 |
-
msgstr[0] "Fa 1 minut"
|
87 |
-
msgstr[1] "Fa %d minuts"
|
88 |
-
|
89 |
-
#: ../lib/formating.php:166
|
90 |
-
#, php-format
|
91 |
-
msgid "1 hour ago"
|
92 |
-
msgid_plural "%d hours ago"
|
93 |
-
msgstr[0] "Fa 1 hora"
|
94 |
-
msgstr[1] "Fa %d hores"
|
95 |
-
|
96 |
-
#: ../lib/formating.php:170
|
97 |
-
#, php-format
|
98 |
-
msgid "Today at %s"
|
99 |
-
msgstr "Avui a les %s"
|
100 |
-
|
101 |
-
#: ../lib/formating.php:170
|
102 |
-
#, php-format
|
103 |
-
msgid "Yesterday at %s"
|
104 |
-
msgstr "Ahir a les %s"
|
105 |
-
|
106 |
-
#: ../lib/themes.php:160
|
107 |
-
msgid "Plugin Homepage"
|
108 |
-
msgstr "Pàgina de l'extensió"
|
109 |
-
|
110 |
-
#: ../lib/themes.php:164
|
111 |
-
msgid "Theme Homepage"
|
112 |
-
msgstr "Pàgina web del tema"
|
113 |
-
|
114 |
-
#: ../lib/themes.php:168
|
115 |
-
msgid "Documentation"
|
116 |
-
msgstr "Documentació"
|
117 |
-
|
118 |
-
#: ../lib/themes.php:172
|
119 |
-
msgid "Support Forum"
|
120 |
-
msgstr "Fòrum d'Ajuda"
|
121 |
-
|
122 |
-
#: ../lib/themes.php:176
|
123 |
-
msgid "Author Homepage"
|
124 |
-
msgstr "Lloc web de l'autor"
|
125 |
-
|
126 |
-
#: ../lib/themes.php:180
|
127 |
-
msgid "Donate to project"
|
128 |
-
msgstr "Fes un donatiu"
|
129 |
-
|
130 |
-
#: ../vendor/upload/class.upload.php:2171
|
131 |
-
msgid "File error. Please try again."
|
132 |
-
msgstr "Error de fitxer. Si us plau, torneu-ho a provar."
|
133 |
-
|
134 |
-
#: ../vendor/upload/class.upload.php:2172
|
135 |
-
msgid "Local file doesn't exist."
|
136 |
-
msgstr "El fitxer local no existeix."
|
137 |
-
|
138 |
-
#: ../vendor/upload/class.upload.php:2173
|
139 |
-
msgid "Local file is not readable."
|
140 |
-
msgstr "El fitxer local no es pot llegir."
|
141 |
-
|
142 |
-
#: ../vendor/upload/class.upload.php:2174
|
143 |
-
msgid "File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)."
|
144 |
-
msgstr "Error de pujada de fitxer (El fitxer pujat excedeix de la directiva upload_max_filesize de php.ini)."
|
145 |
-
|
146 |
-
#: ../vendor/upload/class.upload.php:2175
|
147 |
-
msgid "File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)."
|
148 |
-
msgstr "Error pujant el fitxer (el fitxer pujat excedeix la directiva MAX_FILE_SIZE que s'ha especificat al formulari HTML)."
|
149 |
-
|
150 |
-
#: ../vendor/upload/class.upload.php:2176
|
151 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
152 |
-
msgstr "Error pujant el fitxer (El fitxer només s'ha rebut parcialment)."
|
153 |
-
|
154 |
-
#: ../vendor/upload/class.upload.php:2177
|
155 |
-
msgid "File upload error (no file was uploaded)."
|
156 |
-
msgstr "Error pujant el fitxer (No s'ha rebut cap fitxer)."
|
157 |
-
|
158 |
-
#: ../vendor/upload/class.upload.php:2178
|
159 |
-
msgid "File upload error (missing a temporary folder)."
|
160 |
-
msgstr "Error pujant el fitxer (manca la carpeta temporal)."
|
161 |
-
|
162 |
-
#: ../vendor/upload/class.upload.php:2179
|
163 |
-
msgid "File upload error (failed to write file to disk)."
|
164 |
-
msgstr "Error pujant el fitxer (No s'ha pogut escriure al disc)."
|
165 |
-
|
166 |
-
#: ../vendor/upload/class.upload.php:2180
|
167 |
-
msgid "File upload error (file upload stopped by extension)."
|
168 |
-
msgstr "Error pujant el fitxer (El fitxer s'ha bloquejat per extensió)."
|
169 |
-
|
170 |
-
#: ../vendor/upload/class.upload.php:2181
|
171 |
-
msgid "File upload error (unknown error code)."
|
172 |
-
msgstr "Error pujant el fitxer (Codi d'error desconegut)."
|
173 |
-
|
174 |
-
#: ../vendor/upload/class.upload.php:2182
|
175 |
-
msgid "File upload error. Please try again."
|
176 |
-
msgstr "S'ha produït un error pujant el fitxer. Torneu-ho a provar d'aquí una estona."
|
177 |
-
|
178 |
-
#: ../vendor/upload/class.upload.php:2183
|
179 |
-
msgid "File too big."
|
180 |
-
msgstr "Fitxer massa gran."
|
181 |
-
|
182 |
-
#: ../vendor/upload/class.upload.php:2184
|
183 |
-
msgid "MIME type can't be detected."
|
184 |
-
msgstr "No es pot detectar el tipus MIME."
|
185 |
-
|
186 |
-
#: ../vendor/upload/class.upload.php:2185
|
187 |
-
msgid "Incorrect type of file."
|
188 |
-
msgstr "Tipus d'arxiu invàlid"
|
189 |
-
|
190 |
-
#: ../vendor/upload/class.upload.php:2186
|
191 |
-
msgid "Image too wide."
|
192 |
-
msgstr "Imatge massa ample."
|
193 |
-
|
194 |
-
#: ../vendor/upload/class.upload.php:2187
|
195 |
-
msgid "Image too narrow."
|
196 |
-
msgstr "Imatge massa estreta."
|
197 |
-
|
198 |
-
#: ../vendor/upload/class.upload.php:2188
|
199 |
-
msgid "Image too high."
|
200 |
-
msgstr "Imatge massa alta."
|
201 |
-
|
202 |
-
#: ../vendor/upload/class.upload.php:2189
|
203 |
-
msgid "Image too short."
|
204 |
-
msgstr "Imatge massa baixa."
|
205 |
-
|
206 |
-
#: ../vendor/upload/class.upload.php:2190
|
207 |
-
msgid "Image ratio too high (image too wide)."
|
208 |
-
msgstr "Ratio d'imatge massa gran (Imatge massa ample)."
|
209 |
-
|
210 |
-
#: ../vendor/upload/class.upload.php:2191
|
211 |
-
msgid "Image ratio too low (image too high)."
|
212 |
-
msgstr "Ratio d'imatge massa baix (Imatge massa alta)."
|
213 |
-
|
214 |
-
#: ../vendor/upload/class.upload.php:2192
|
215 |
-
msgid "Image has too many pixels."
|
216 |
-
msgstr "La imatge té massa píxels."
|
217 |
-
|
218 |
-
#: ../vendor/upload/class.upload.php:2193
|
219 |
-
msgid "Image has not enough pixels."
|
220 |
-
msgstr "La imatge no té prou píxels."
|
221 |
-
|
222 |
-
#: ../vendor/upload/class.upload.php:2194
|
223 |
-
msgid "File not uploaded. Can't carry on a process."
|
224 |
-
msgstr "No s'ha pujat el fitxer. No s'ha pogut executar el procés."
|
225 |
-
|
226 |
-
#: ../vendor/upload/class.upload.php:2195
|
227 |
-
#, php-format
|
228 |
-
msgid "%s already exists. Please change the file name."
|
229 |
-
msgstr "El fitxer %s ja existeix. Si en plau canvieu-ne el nom."
|
230 |
-
|
231 |
-
#: ../vendor/upload/class.upload.php:2196
|
232 |
-
msgid "No correct temp source file. Can't carry on a process."
|
233 |
-
msgstr "El fitxer temporal no es correcte. No es pot executar el procés."
|
234 |
-
|
235 |
-
#: ../vendor/upload/class.upload.php:2197
|
236 |
-
msgid "No correct uploaded source file. Can't carry on a process."
|
237 |
-
msgstr "El fitxer original no es correcte. No es pot executar el procés."
|
238 |
-
|
239 |
-
#: ../vendor/upload/class.upload.php:2198
|
240 |
-
msgid "Destination directory can't be created. Can't carry on a process."
|
241 |
-
msgstr "No es pot crear el directori de destí. No es pot executar el procés."
|
242 |
-
|
243 |
-
#: ../vendor/upload/class.upload.php:2199
|
244 |
-
msgid "Destination directory doesn't exist. Can't carry on a process."
|
245 |
-
msgstr "El directori de destí no existeix. No es pot executar el procés."
|
246 |
-
|
247 |
-
#: ../vendor/upload/class.upload.php:2200
|
248 |
-
msgid "Destination path is not a directory. Can't carry on a process."
|
249 |
-
msgstr "La ruta de destí no és un directori. No es pot executar el procés."
|
250 |
-
|
251 |
-
#: ../vendor/upload/class.upload.php:2201
|
252 |
-
msgid "Destination directory can't be made writeable. Can't carry on a process."
|
253 |
-
msgstr "No es pot canviar a 'escriure' els drets del directori de destí. No es pot executar el procés."
|
254 |
-
|
255 |
-
#: ../vendor/upload/class.upload.php:2202
|
256 |
-
msgid "Destination path is not a writeable. Can't carry on a process."
|
257 |
-
msgstr "No es pot escriure en el directori de destí. No es pot executar el procés."
|
258 |
-
|
259 |
-
#: ../vendor/upload/class.upload.php:2203
|
260 |
-
msgid "Can't create the temporary file. Can't carry on a process."
|
261 |
-
msgstr "No es pot crear un fitxer temporal. No es pot executar el procés."
|
262 |
-
|
263 |
-
#: ../vendor/upload/class.upload.php:2204
|
264 |
-
msgid "Source file is not readable. Can't carry on a process."
|
265 |
-
msgstr "El fitxer d'origen no es pot llegir. No es pot executar el procés."
|
266 |
-
|
267 |
-
#: ../vendor/upload/class.upload.php:2205
|
268 |
-
#, php-format
|
269 |
-
msgid "No create from %s support."
|
270 |
-
msgstr "No hi ha funcions per crear des de %s."
|
271 |
-
|
272 |
-
#: ../vendor/upload/class.upload.php:2206
|
273 |
-
#, php-format
|
274 |
-
msgid "Error in creating %s image from source."
|
275 |
-
msgstr "Error creant la imatge %s des de l'original."
|
276 |
-
|
277 |
-
#: ../vendor/upload/class.upload.php:2207
|
278 |
-
msgid "Can't read image source. Not an image?."
|
279 |
-
msgstr "No es pot llegir la imatge original. És una imatge?"
|
280 |
-
|
281 |
-
#: ../vendor/upload/class.upload.php:2208
|
282 |
-
msgid "GD doesn't seem to be present."
|
283 |
-
msgstr "No sembla que la llibreria GD estigui present."
|
284 |
-
|
285 |
-
#: ../vendor/upload/class.upload.php:2209
|
286 |
-
#, php-format
|
287 |
-
msgid "No create from %s support, can't read watermark."
|
288 |
-
msgstr "No hi ha funcions per crear des de %s, no es pot llegir la marca a l'aigua."
|
289 |
-
|
290 |
-
#: ../vendor/upload/class.upload.php:2210
|
291 |
-
#, php-format
|
292 |
-
msgid "No %s read support, can't create watermark."
|
293 |
-
msgstr "No hi ha funcions per llegir %s, no es pot crear la marca a l'aigua."
|
294 |
-
|
295 |
-
#: ../vendor/upload/class.upload.php:2211
|
296 |
-
msgid "Unknown image format, can't read watermark."
|
297 |
-
msgstr "Format d'imatge desconegut, no es pot llegir la marca a l'aigua."
|
298 |
-
|
299 |
-
#: ../vendor/upload/class.upload.php:2212
|
300 |
-
#, php-format
|
301 |
-
msgid "No %s create support."
|
302 |
-
msgstr "No hi ha funcions per crear %s."
|
303 |
-
|
304 |
-
#: ../vendor/upload/class.upload.php:2213
|
305 |
-
msgid "No conversion type defined."
|
306 |
-
msgstr "No s'ha definit cap tipus de conversió."
|
307 |
-
|
308 |
-
#: ../vendor/upload/class.upload.php:2214
|
309 |
-
msgid "Error copying file on the server. copy() failed."
|
310 |
-
msgstr "Error copiant el fitxer al serivor. copy() ha fallat."
|
311 |
-
|
312 |
-
#: ../vendor/upload/class.upload.php:2215
|
313 |
-
msgid "Error reading the file."
|
314 |
-
msgstr "Error llegint el fitxer."
|
315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lang/es_ES.mo
DELETED
Binary file
|
framework/lang/es_ES.po
DELETED
@@ -1,316 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Alkivia Framework\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2010-02-08 13:50+0100\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Jordi Canals <devel@jcanals.cat>\n"
|
8 |
-
"Language-Team: Jordi Canals | http://alkivia.org <devel@jcanals.cat>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
-
"X-Poedit-Language: Spanish\n"
|
14 |
-
"X-Poedit-Country: SPAIN\n"
|
15 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
-
|
17 |
-
#: ../classes/template.php:90
|
18 |
-
msgid "Template class: Received template paths are not valid directories."
|
19 |
-
msgstr "Clase 'Template': Las rutas de platilla recibidas no son directorios válidos."
|
20 |
-
|
21 |
-
#: ../classes/template.php:98
|
22 |
-
msgid "Template class: Received config paths are not valid directories."
|
23 |
-
msgstr "Clase 'Template': Las rutas de configuración recibidas no son directorios válidos."
|
24 |
-
|
25 |
-
#: ../classes/template.php:174
|
26 |
-
#, php-format
|
27 |
-
msgid "Template class: %s is a reserved template variable."
|
28 |
-
msgstr "Clase 'Template': %s es una variable reservada."
|
29 |
-
|
30 |
-
#: ../classes/template.php:338
|
31 |
-
#, php-format
|
32 |
-
msgid "Template file %1$s not found. Default template %2$s not found."
|
33 |
-
msgstr "El archivo de plantilla %1$s no existe. Tampoco se encontró la plantilla predeterminada %2$s."
|
34 |
-
|
35 |
-
#: ../classes/abstract/module.php:614
|
36 |
-
msgid "Option blocked by administrator."
|
37 |
-
msgstr "Opción bloqueada por el administrador."
|
38 |
-
|
39 |
-
#: ../classes/abstract/plugin.php:344
|
40 |
-
#: ../classes/abstract/plugin.php:363
|
41 |
-
msgid "Warning:"
|
42 |
-
msgstr "Atención:"
|
43 |
-
|
44 |
-
#: ../classes/abstract/plugin.php:345
|
45 |
-
#, php-format
|
46 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
47 |
-
msgstr "El plugin activo %s no es compatible con tu versión de WordPress."
|
48 |
-
|
49 |
-
#: ../classes/abstract/plugin.php:347
|
50 |
-
#, php-format
|
51 |
-
msgid "WordPress %s is required to run this plugin."
|
52 |
-
msgstr "Para ejecutar este plugin se require WordPress %s."
|
53 |
-
|
54 |
-
#: ../classes/abstract/plugin.php:364
|
55 |
-
msgid "Standard sidebar functions are not present."
|
56 |
-
msgstr "No se encontraron las funciones de la barra lateral estandar."
|
57 |
-
|
58 |
-
#: ../classes/abstract/plugin.php:365
|
59 |
-
#, php-format
|
60 |
-
msgid "It is required to use the standard sidebar to run %s"
|
61 |
-
msgstr "Se requiere la barra lateral estandar para ejecutar %s"
|
62 |
-
|
63 |
-
#: ../classes/abstract/plugin.php:418
|
64 |
-
msgid "Activate Components"
|
65 |
-
msgstr "Activar Componentes"
|
66 |
-
|
67 |
-
#: ../classes/abstract/plugin.php:427
|
68 |
-
msgid "Yes"
|
69 |
-
msgstr "Si"
|
70 |
-
|
71 |
-
#: ../classes/abstract/plugin.php:428
|
72 |
-
msgid "No"
|
73 |
-
msgstr "No"
|
74 |
-
|
75 |
-
#: ../lib/formating.php:52
|
76 |
-
msgid "Settings saved."
|
77 |
-
msgstr "Parámetros guardados."
|
78 |
-
|
79 |
-
#: ../lib/formating.php:160
|
80 |
-
msgid "Just Now"
|
81 |
-
msgstr "Ahora mismo"
|
82 |
-
|
83 |
-
#: ../lib/formating.php:163
|
84 |
-
#, php-format
|
85 |
-
msgid "1 minute ago"
|
86 |
-
msgid_plural "%d minutes ago"
|
87 |
-
msgstr[0] "Hace 1 minuto"
|
88 |
-
msgstr[1] "Hace %d minutos"
|
89 |
-
|
90 |
-
#: ../lib/formating.php:166
|
91 |
-
#, php-format
|
92 |
-
msgid "1 hour ago"
|
93 |
-
msgid_plural "%d hours ago"
|
94 |
-
msgstr[0] "Hace una hora"
|
95 |
-
msgstr[1] "Hace %d horas"
|
96 |
-
|
97 |
-
#: ../lib/formating.php:170
|
98 |
-
#, php-format
|
99 |
-
msgid "Today at %s"
|
100 |
-
msgstr "Hoy a las %s"
|
101 |
-
|
102 |
-
#: ../lib/formating.php:170
|
103 |
-
#, php-format
|
104 |
-
msgid "Yesterday at %s"
|
105 |
-
msgstr "Ayer a las %s"
|
106 |
-
|
107 |
-
#: ../lib/themes.php:160
|
108 |
-
msgid "Plugin Homepage"
|
109 |
-
msgstr "Página del plugin"
|
110 |
-
|
111 |
-
#: ../lib/themes.php:164
|
112 |
-
msgid "Theme Homepage"
|
113 |
-
msgstr "Página del tema"
|
114 |
-
|
115 |
-
#: ../lib/themes.php:168
|
116 |
-
msgid "Documentation"
|
117 |
-
msgstr "Documentación"
|
118 |
-
|
119 |
-
#: ../lib/themes.php:172
|
120 |
-
msgid "Support Forum"
|
121 |
-
msgstr "Foro de soporte"
|
122 |
-
|
123 |
-
#: ../lib/themes.php:176
|
124 |
-
msgid "Author Homepage"
|
125 |
-
msgstr "Página del autor"
|
126 |
-
|
127 |
-
#: ../lib/themes.php:180
|
128 |
-
msgid "Donate to project"
|
129 |
-
msgstr "Haz un donativo"
|
130 |
-
|
131 |
-
#: ../vendor/upload/class.upload.php:2171
|
132 |
-
msgid "File error. Please try again."
|
133 |
-
msgstr "Error de archivo. Por favor, reintentalo de nuevo."
|
134 |
-
|
135 |
-
#: ../vendor/upload/class.upload.php:2172
|
136 |
-
msgid "Local file doesn't exist."
|
137 |
-
msgstr "El archivo local no existe."
|
138 |
-
|
139 |
-
#: ../vendor/upload/class.upload.php:2173
|
140 |
-
msgid "Local file is not readable."
|
141 |
-
msgstr "El archivo local no es legible."
|
142 |
-
|
143 |
-
#: ../vendor/upload/class.upload.php:2174
|
144 |
-
msgid "File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)."
|
145 |
-
msgstr "Error de carga de archivo (el archivo cargado excede la directiva UPLOAD_MAX_FILESIZE de PHP)."
|
146 |
-
|
147 |
-
#: ../vendor/upload/class.upload.php:2175
|
148 |
-
msgid "File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)."
|
149 |
-
msgstr "Error de carga de archivo (el archivo enviado excede la directiva MAX_FILE_SIZE especificada en el formulario)."
|
150 |
-
|
151 |
-
#: ../vendor/upload/class.upload.php:2176
|
152 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
153 |
-
msgstr "Error de carga de archivo (el archivo sólo se recibió parcialmente)."
|
154 |
-
|
155 |
-
#: ../vendor/upload/class.upload.php:2177
|
156 |
-
msgid "File upload error (no file was uploaded)."
|
157 |
-
msgstr "Error de carga de archivo (no se recibió archivo)."
|
158 |
-
|
159 |
-
#: ../vendor/upload/class.upload.php:2178
|
160 |
-
msgid "File upload error (missing a temporary folder)."
|
161 |
-
msgstr "Error de carga de archivo (falta la carpeta temporal)."
|
162 |
-
|
163 |
-
#: ../vendor/upload/class.upload.php:2179
|
164 |
-
msgid "File upload error (failed to write file to disk)."
|
165 |
-
msgstr "Error de carga de archivo (no se pudo escribir en el disco)."
|
166 |
-
|
167 |
-
#: ../vendor/upload/class.upload.php:2180
|
168 |
-
msgid "File upload error (file upload stopped by extension)."
|
169 |
-
msgstr "Error de carga de archivo (se ha bloquedao el archivo por extensión)."
|
170 |
-
|
171 |
-
#: ../vendor/upload/class.upload.php:2181
|
172 |
-
msgid "File upload error (unknown error code)."
|
173 |
-
msgstr "Error de carga de archivo (código de error desconocido)."
|
174 |
-
|
175 |
-
#: ../vendor/upload/class.upload.php:2182
|
176 |
-
msgid "File upload error. Please try again."
|
177 |
-
msgstr "Error de carga de archivo. Por favor, reinténtalo."
|
178 |
-
|
179 |
-
#: ../vendor/upload/class.upload.php:2183
|
180 |
-
msgid "File too big."
|
181 |
-
msgstr "Archivo demasiado grande."
|
182 |
-
|
183 |
-
#: ../vendor/upload/class.upload.php:2184
|
184 |
-
msgid "MIME type can't be detected."
|
185 |
-
msgstr "No se pudo detectar el tipo MIME."
|
186 |
-
|
187 |
-
#: ../vendor/upload/class.upload.php:2185
|
188 |
-
msgid "Incorrect type of file."
|
189 |
-
msgstr "Tipo de archivo incorrecto."
|
190 |
-
|
191 |
-
#: ../vendor/upload/class.upload.php:2186
|
192 |
-
msgid "Image too wide."
|
193 |
-
msgstr "Imagen demasiado ancha."
|
194 |
-
|
195 |
-
#: ../vendor/upload/class.upload.php:2187
|
196 |
-
msgid "Image too narrow."
|
197 |
-
msgstr "Imagen demasiado estrecha."
|
198 |
-
|
199 |
-
#: ../vendor/upload/class.upload.php:2188
|
200 |
-
msgid "Image too high."
|
201 |
-
msgstr "Imagen demasiado alta."
|
202 |
-
|
203 |
-
#: ../vendor/upload/class.upload.php:2189
|
204 |
-
msgid "Image too short."
|
205 |
-
msgstr "Imagen demasiado baja."
|
206 |
-
|
207 |
-
#: ../vendor/upload/class.upload.php:2190
|
208 |
-
msgid "Image ratio too high (image too wide)."
|
209 |
-
msgstr "Ratio de imagen demariado alto (imagen demasiado ancha)."
|
210 |
-
|
211 |
-
#: ../vendor/upload/class.upload.php:2191
|
212 |
-
msgid "Image ratio too low (image too high)."
|
213 |
-
msgstr "Ratio de imagen demasiado bajo (imagen demasiado alta)."
|
214 |
-
|
215 |
-
#: ../vendor/upload/class.upload.php:2192
|
216 |
-
msgid "Image has too many pixels."
|
217 |
-
msgstr "La imágen tiene demasiados píxeles."
|
218 |
-
|
219 |
-
#: ../vendor/upload/class.upload.php:2193
|
220 |
-
msgid "Image has not enough pixels."
|
221 |
-
msgstr "La imagen no tiene suficientes píxeles."
|
222 |
-
|
223 |
-
#: ../vendor/upload/class.upload.php:2194
|
224 |
-
msgid "File not uploaded. Can't carry on a process."
|
225 |
-
msgstr "No se ha cargado el archivo. No se puede ejecutar el proceso."
|
226 |
-
|
227 |
-
#: ../vendor/upload/class.upload.php:2195
|
228 |
-
#, php-format
|
229 |
-
msgid "%s already exists. Please change the file name."
|
230 |
-
msgstr "El archivo %s ya existe. Por favor, cambia el nombre de archivo."
|
231 |
-
|
232 |
-
#: ../vendor/upload/class.upload.php:2196
|
233 |
-
msgid "No correct temp source file. Can't carry on a process."
|
234 |
-
msgstr "El archivo temporal es incorrecto. No se puede ejecutar el proceso."
|
235 |
-
|
236 |
-
#: ../vendor/upload/class.upload.php:2197
|
237 |
-
msgid "No correct uploaded source file. Can't carry on a process."
|
238 |
-
msgstr "Archivo original incorrecto. No se puede ejecutar el proceso."
|
239 |
-
|
240 |
-
#: ../vendor/upload/class.upload.php:2198
|
241 |
-
msgid "Destination directory can't be created. Can't carry on a process."
|
242 |
-
msgstr "No se puede crear el directorio de destino. No se puede realizar el proceso."
|
243 |
-
|
244 |
-
#: ../vendor/upload/class.upload.php:2199
|
245 |
-
msgid "Destination directory doesn't exist. Can't carry on a process."
|
246 |
-
msgstr "El directorio de destino no existe. No se puede realizar el proceso."
|
247 |
-
|
248 |
-
#: ../vendor/upload/class.upload.php:2200
|
249 |
-
msgid "Destination path is not a directory. Can't carry on a process."
|
250 |
-
msgstr "La ruta de destino no es un directorio. No se puede realizar el proceso."
|
251 |
-
|
252 |
-
#: ../vendor/upload/class.upload.php:2201
|
253 |
-
msgid "Destination directory can't be made writeable. Can't carry on a process."
|
254 |
-
msgstr "El directorio de destino no se puede cambiar a escribible. No se puede realizar el proceso."
|
255 |
-
|
256 |
-
#: ../vendor/upload/class.upload.php:2202
|
257 |
-
msgid "Destination path is not a writeable. Can't carry on a process."
|
258 |
-
msgstr "No se puede escribir en la ruta de destino. No se puede realizar el proceso."
|
259 |
-
|
260 |
-
#: ../vendor/upload/class.upload.php:2203
|
261 |
-
msgid "Can't create the temporary file. Can't carry on a process."
|
262 |
-
msgstr "No se puede crar un archivo temporal. No se puede ejecutar el proceso."
|
263 |
-
|
264 |
-
#: ../vendor/upload/class.upload.php:2204
|
265 |
-
msgid "Source file is not readable. Can't carry on a process."
|
266 |
-
msgstr "No se puede leer el archivo original. No se puede ejecutar el proceso."
|
267 |
-
|
268 |
-
#: ../vendor/upload/class.upload.php:2205
|
269 |
-
#, php-format
|
270 |
-
msgid "No create from %s support."
|
271 |
-
msgstr "No hay soporte para crear desde %s."
|
272 |
-
|
273 |
-
#: ../vendor/upload/class.upload.php:2206
|
274 |
-
#, php-format
|
275 |
-
msgid "Error in creating %s image from source."
|
276 |
-
msgstr "Error creacdo la imagen %s desde el original."
|
277 |
-
|
278 |
-
#: ../vendor/upload/class.upload.php:2207
|
279 |
-
msgid "Can't read image source. Not an image?."
|
280 |
-
msgstr "No se puede leer la imagen orginal. ¿Es una imagen?"
|
281 |
-
|
282 |
-
#: ../vendor/upload/class.upload.php:2208
|
283 |
-
msgid "GD doesn't seem to be present."
|
284 |
-
msgstr "No se ha detectado la libreria GD."
|
285 |
-
|
286 |
-
#: ../vendor/upload/class.upload.php:2209
|
287 |
-
#, php-format
|
288 |
-
msgid "No create from %s support, can't read watermark."
|
289 |
-
msgstr "No hay soporte para crear desde %s. No se puede leer la marca de agua."
|
290 |
-
|
291 |
-
#: ../vendor/upload/class.upload.php:2210
|
292 |
-
#, php-format
|
293 |
-
msgid "No %s read support, can't create watermark."
|
294 |
-
msgstr "No hay soporte para leer %s. No se puede crear la marca de agua."
|
295 |
-
|
296 |
-
#: ../vendor/upload/class.upload.php:2211
|
297 |
-
msgid "Unknown image format, can't read watermark."
|
298 |
-
msgstr "Formato de imagen desconocido. No se puede leer la marca al agua."
|
299 |
-
|
300 |
-
#: ../vendor/upload/class.upload.php:2212
|
301 |
-
#, php-format
|
302 |
-
msgid "No %s create support."
|
303 |
-
msgstr "No hay soporte para crear %s."
|
304 |
-
|
305 |
-
#: ../vendor/upload/class.upload.php:2213
|
306 |
-
msgid "No conversion type defined."
|
307 |
-
msgstr "No se ha definido el tipo de conversión."
|
308 |
-
|
309 |
-
#: ../vendor/upload/class.upload.php:2214
|
310 |
-
msgid "Error copying file on the server. copy() failed."
|
311 |
-
msgstr "Error coipiando el archivo en el servidor. Ha fallado copy()."
|
312 |
-
|
313 |
-
#: ../vendor/upload/class.upload.php:2215
|
314 |
-
msgid "Error reading the file."
|
315 |
-
msgstr "Error leyendo el archivo."
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lang/framework.pot
DELETED
@@ -1,317 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Alkivia SidePosts\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2010-02-08 13:50+0100\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Jordi Canals <devel@jcanals.cat>\n"
|
8 |
-
"Language-Team: Jordi Canals | http://alkivia.org <devel@jcanals.cat>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
14 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_c;_x:2c,1\n"
|
15 |
-
"X-Poedit-Basepath: .\n"
|
16 |
-
"X-Poedit-SearchPath-0: ..\n"
|
17 |
-
|
18 |
-
#: ../classes/template.php:90
|
19 |
-
msgid "Template class: Received template paths are not valid directories."
|
20 |
-
msgstr ""
|
21 |
-
|
22 |
-
#: ../classes/template.php:98
|
23 |
-
msgid "Template class: Received config paths are not valid directories."
|
24 |
-
msgstr ""
|
25 |
-
|
26 |
-
#: ../classes/template.php:174
|
27 |
-
#, php-format
|
28 |
-
msgid "Template class: %s is a reserved template variable."
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: ../classes/template.php:338
|
32 |
-
#, php-format
|
33 |
-
msgid "Template file %1$s not found. Default template %2$s not found."
|
34 |
-
msgstr ""
|
35 |
-
|
36 |
-
#: ../classes/abstract/module.php:614
|
37 |
-
msgid "Option blocked by administrator."
|
38 |
-
msgstr ""
|
39 |
-
|
40 |
-
#: ../classes/abstract/plugin.php:344
|
41 |
-
#: ../classes/abstract/plugin.php:363
|
42 |
-
msgid "Warning:"
|
43 |
-
msgstr ""
|
44 |
-
|
45 |
-
#: ../classes/abstract/plugin.php:345
|
46 |
-
#, php-format
|
47 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: ../classes/abstract/plugin.php:347
|
51 |
-
#, php-format
|
52 |
-
msgid "WordPress %s is required to run this plugin."
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: ../classes/abstract/plugin.php:364
|
56 |
-
msgid "Standard sidebar functions are not present."
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: ../classes/abstract/plugin.php:365
|
60 |
-
#, php-format
|
61 |
-
msgid "It is required to use the standard sidebar to run %s"
|
62 |
-
msgstr ""
|
63 |
-
|
64 |
-
#: ../classes/abstract/plugin.php:418
|
65 |
-
msgid "Activate Components"
|
66 |
-
msgstr ""
|
67 |
-
|
68 |
-
#: ../classes/abstract/plugin.php:427
|
69 |
-
msgid "Yes"
|
70 |
-
msgstr ""
|
71 |
-
|
72 |
-
#: ../classes/abstract/plugin.php:428
|
73 |
-
msgid "No"
|
74 |
-
msgstr ""
|
75 |
-
|
76 |
-
#: ../lib/formating.php:52
|
77 |
-
msgid "Settings saved."
|
78 |
-
msgstr ""
|
79 |
-
|
80 |
-
#: ../lib/formating.php:160
|
81 |
-
msgid "Just Now"
|
82 |
-
msgstr ""
|
83 |
-
|
84 |
-
#: ../lib/formating.php:163
|
85 |
-
#, php-format
|
86 |
-
msgid "1 minute ago"
|
87 |
-
msgid_plural "%d minutes ago"
|
88 |
-
msgstr[0] ""
|
89 |
-
msgstr[1] ""
|
90 |
-
|
91 |
-
#: ../lib/formating.php:166
|
92 |
-
#, php-format
|
93 |
-
msgid "1 hour ago"
|
94 |
-
msgid_plural "%d hours ago"
|
95 |
-
msgstr[0] ""
|
96 |
-
msgstr[1] ""
|
97 |
-
|
98 |
-
#: ../lib/formating.php:170
|
99 |
-
#, php-format
|
100 |
-
msgid "Today at %s"
|
101 |
-
msgstr ""
|
102 |
-
|
103 |
-
#: ../lib/formating.php:170
|
104 |
-
#, php-format
|
105 |
-
msgid "Yesterday at %s"
|
106 |
-
msgstr ""
|
107 |
-
|
108 |
-
#: ../lib/themes.php:160
|
109 |
-
msgid "Plugin Homepage"
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: ../lib/themes.php:164
|
113 |
-
msgid "Theme Homepage"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: ../lib/themes.php:168
|
117 |
-
msgid "Documentation"
|
118 |
-
msgstr ""
|
119 |
-
|
120 |
-
#: ../lib/themes.php:172
|
121 |
-
msgid "Support Forum"
|
122 |
-
msgstr ""
|
123 |
-
|
124 |
-
#: ../lib/themes.php:176
|
125 |
-
msgid "Author Homepage"
|
126 |
-
msgstr ""
|
127 |
-
|
128 |
-
#: ../lib/themes.php:180
|
129 |
-
msgid "Donate to project"
|
130 |
-
msgstr ""
|
131 |
-
|
132 |
-
#: ../vendor/upload/class.upload.php:2171
|
133 |
-
msgid "File error. Please try again."
|
134 |
-
msgstr ""
|
135 |
-
|
136 |
-
#: ../vendor/upload/class.upload.php:2172
|
137 |
-
msgid "Local file doesn't exist."
|
138 |
-
msgstr ""
|
139 |
-
|
140 |
-
#: ../vendor/upload/class.upload.php:2173
|
141 |
-
msgid "Local file is not readable."
|
142 |
-
msgstr ""
|
143 |
-
|
144 |
-
#: ../vendor/upload/class.upload.php:2174
|
145 |
-
msgid "File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)."
|
146 |
-
msgstr ""
|
147 |
-
|
148 |
-
#: ../vendor/upload/class.upload.php:2175
|
149 |
-
msgid "File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)."
|
150 |
-
msgstr ""
|
151 |
-
|
152 |
-
#: ../vendor/upload/class.upload.php:2176
|
153 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
154 |
-
msgstr ""
|
155 |
-
|
156 |
-
#: ../vendor/upload/class.upload.php:2177
|
157 |
-
msgid "File upload error (no file was uploaded)."
|
158 |
-
msgstr ""
|
159 |
-
|
160 |
-
#: ../vendor/upload/class.upload.php:2178
|
161 |
-
msgid "File upload error (missing a temporary folder)."
|
162 |
-
msgstr ""
|
163 |
-
|
164 |
-
#: ../vendor/upload/class.upload.php:2179
|
165 |
-
msgid "File upload error (failed to write file to disk)."
|
166 |
-
msgstr ""
|
167 |
-
|
168 |
-
#: ../vendor/upload/class.upload.php:2180
|
169 |
-
msgid "File upload error (file upload stopped by extension)."
|
170 |
-
msgstr ""
|
171 |
-
|
172 |
-
#: ../vendor/upload/class.upload.php:2181
|
173 |
-
msgid "File upload error (unknown error code)."
|
174 |
-
msgstr ""
|
175 |
-
|
176 |
-
#: ../vendor/upload/class.upload.php:2182
|
177 |
-
msgid "File upload error. Please try again."
|
178 |
-
msgstr ""
|
179 |
-
|
180 |
-
#: ../vendor/upload/class.upload.php:2183
|
181 |
-
msgid "File too big."
|
182 |
-
msgstr ""
|
183 |
-
|
184 |
-
#: ../vendor/upload/class.upload.php:2184
|
185 |
-
msgid "MIME type can't be detected."
|
186 |
-
msgstr ""
|
187 |
-
|
188 |
-
#: ../vendor/upload/class.upload.php:2185
|
189 |
-
msgid "Incorrect type of file."
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: ../vendor/upload/class.upload.php:2186
|
193 |
-
msgid "Image too wide."
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
#: ../vendor/upload/class.upload.php:2187
|
197 |
-
msgid "Image too narrow."
|
198 |
-
msgstr ""
|
199 |
-
|
200 |
-
#: ../vendor/upload/class.upload.php:2188
|
201 |
-
msgid "Image too high."
|
202 |
-
msgstr ""
|
203 |
-
|
204 |
-
#: ../vendor/upload/class.upload.php:2189
|
205 |
-
msgid "Image too short."
|
206 |
-
msgstr ""
|
207 |
-
|
208 |
-
#: ../vendor/upload/class.upload.php:2190
|
209 |
-
msgid "Image ratio too high (image too wide)."
|
210 |
-
msgstr ""
|
211 |
-
|
212 |
-
#: ../vendor/upload/class.upload.php:2191
|
213 |
-
msgid "Image ratio too low (image too high)."
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
#: ../vendor/upload/class.upload.php:2192
|
217 |
-
msgid "Image has too many pixels."
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#: ../vendor/upload/class.upload.php:2193
|
221 |
-
msgid "Image has not enough pixels."
|
222 |
-
msgstr ""
|
223 |
-
|
224 |
-
#: ../vendor/upload/class.upload.php:2194
|
225 |
-
msgid "File not uploaded. Can't carry on a process."
|
226 |
-
msgstr ""
|
227 |
-
|
228 |
-
#: ../vendor/upload/class.upload.php:2195
|
229 |
-
#, php-format
|
230 |
-
msgid "%s already exists. Please change the file name."
|
231 |
-
msgstr ""
|
232 |
-
|
233 |
-
#: ../vendor/upload/class.upload.php:2196
|
234 |
-
msgid "No correct temp source file. Can't carry on a process."
|
235 |
-
msgstr ""
|
236 |
-
|
237 |
-
#: ../vendor/upload/class.upload.php:2197
|
238 |
-
msgid "No correct uploaded source file. Can't carry on a process."
|
239 |
-
msgstr ""
|
240 |
-
|
241 |
-
#: ../vendor/upload/class.upload.php:2198
|
242 |
-
msgid "Destination directory can't be created. Can't carry on a process."
|
243 |
-
msgstr ""
|
244 |
-
|
245 |
-
#: ../vendor/upload/class.upload.php:2199
|
246 |
-
msgid "Destination directory doesn't exist. Can't carry on a process."
|
247 |
-
msgstr ""
|
248 |
-
|
249 |
-
#: ../vendor/upload/class.upload.php:2200
|
250 |
-
msgid "Destination path is not a directory. Can't carry on a process."
|
251 |
-
msgstr ""
|
252 |
-
|
253 |
-
#: ../vendor/upload/class.upload.php:2201
|
254 |
-
msgid "Destination directory can't be made writeable. Can't carry on a process."
|
255 |
-
msgstr ""
|
256 |
-
|
257 |
-
#: ../vendor/upload/class.upload.php:2202
|
258 |
-
msgid "Destination path is not a writeable. Can't carry on a process."
|
259 |
-
msgstr ""
|
260 |
-
|
261 |
-
#: ../vendor/upload/class.upload.php:2203
|
262 |
-
msgid "Can't create the temporary file. Can't carry on a process."
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: ../vendor/upload/class.upload.php:2204
|
266 |
-
msgid "Source file is not readable. Can't carry on a process."
|
267 |
-
msgstr ""
|
268 |
-
|
269 |
-
#: ../vendor/upload/class.upload.php:2205
|
270 |
-
#, php-format
|
271 |
-
msgid "No create from %s support."
|
272 |
-
msgstr ""
|
273 |
-
|
274 |
-
#: ../vendor/upload/class.upload.php:2206
|
275 |
-
#, php-format
|
276 |
-
msgid "Error in creating %s image from source."
|
277 |
-
msgstr ""
|
278 |
-
|
279 |
-
#: ../vendor/upload/class.upload.php:2207
|
280 |
-
msgid "Can't read image source. Not an image?."
|
281 |
-
msgstr ""
|
282 |
-
|
283 |
-
#: ../vendor/upload/class.upload.php:2208
|
284 |
-
msgid "GD doesn't seem to be present."
|
285 |
-
msgstr ""
|
286 |
-
|
287 |
-
#: ../vendor/upload/class.upload.php:2209
|
288 |
-
#, php-format
|
289 |
-
msgid "No create from %s support, can't read watermark."
|
290 |
-
msgstr ""
|
291 |
-
|
292 |
-
#: ../vendor/upload/class.upload.php:2210
|
293 |
-
#, php-format
|
294 |
-
msgid "No %s read support, can't create watermark."
|
295 |
-
msgstr ""
|
296 |
-
|
297 |
-
#: ../vendor/upload/class.upload.php:2211
|
298 |
-
msgid "Unknown image format, can't read watermark."
|
299 |
-
msgstr ""
|
300 |
-
|
301 |
-
#: ../vendor/upload/class.upload.php:2212
|
302 |
-
#, php-format
|
303 |
-
msgid "No %s create support."
|
304 |
-
msgstr ""
|
305 |
-
|
306 |
-
#: ../vendor/upload/class.upload.php:2213
|
307 |
-
msgid "No conversion type defined."
|
308 |
-
msgstr ""
|
309 |
-
|
310 |
-
#: ../vendor/upload/class.upload.php:2214
|
311 |
-
msgid "Error copying file on the server. copy() failed."
|
312 |
-
msgstr ""
|
313 |
-
|
314 |
-
#: ../vendor/upload/class.upload.php:2215
|
315 |
-
msgid "Error reading the file."
|
316 |
-
msgstr ""
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lang/it_IT.mo
DELETED
Binary file
|
framework/lang/it_IT.po
DELETED
@@ -1,417 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: SidePosts WordPress Widget in italiano\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2010-02-06 01:15+0100\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Jordi Canals <devel@jcanals.cat>\n"
|
8 |
-
"Language-Team: Gianni Diurno | http://gidibao.net/ <gidibao@gmail.com>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
-
"X-Poedit-Language: Italian\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
"X-Poedit-KeywordsList: \n"
|
16 |
-
"X-Poedit-Basepath: .\n"
|
17 |
-
"X-Poedit-Country: ITALY\n"
|
18 |
-
"X-Poedit-SearchPath-0: \n"
|
19 |
-
|
20 |
-
#: ../classes/abstract/module.php:599
|
21 |
-
msgid "Option blocked by administrator."
|
22 |
-
msgstr "Opzione bloccata dall'amministratore"
|
23 |
-
|
24 |
-
#: ../classes/abstract/plugin.php:344
|
25 |
-
#: ../classes/abstract/plugin.php:363
|
26 |
-
msgid "Warning:"
|
27 |
-
msgstr "Avvertimento:"
|
28 |
-
|
29 |
-
#: ../classes/abstract/plugin.php:345
|
30 |
-
#, php-format
|
31 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
32 |
-
msgstr "Il plugin attivo %s non é compatibile con la tua versione WordPress."
|
33 |
-
|
34 |
-
#: ../classes/abstract/plugin.php:347
|
35 |
-
#, php-format
|
36 |
-
msgid "WordPress %s is required to run this plugin."
|
37 |
-
msgstr "E' necessario WordPress %s affinché questo plugin possa funzionare."
|
38 |
-
|
39 |
-
#: ../classes/abstract/plugin.php:364
|
40 |
-
msgid "Standard sidebar functions are not present."
|
41 |
-
msgstr "Non sono presenti le funzioni standard della sidebar."
|
42 |
-
|
43 |
-
#: ../classes/abstract/plugin.php:365
|
44 |
-
#, php-format
|
45 |
-
msgid "It is required to use the standard sidebar to run %s"
|
46 |
-
msgstr "E' necessario l'utilizzo della sidebar standard affinché funzioni %s"
|
47 |
-
|
48 |
-
#: ../classes/abstract/plugin.php:412
|
49 |
-
msgid "Activate Components"
|
50 |
-
msgstr ""
|
51 |
-
|
52 |
-
#: ../classes/abstract/plugin.php:421
|
53 |
-
msgid "Yes"
|
54 |
-
msgstr "Sí"
|
55 |
-
|
56 |
-
#: ../classes/abstract/plugin.php:422
|
57 |
-
msgid "No"
|
58 |
-
msgstr "No"
|
59 |
-
|
60 |
-
#: ../lib/formating.php:52
|
61 |
-
msgid "Settings saved."
|
62 |
-
msgstr "Le impostazioni sono state salvate"
|
63 |
-
|
64 |
-
#: ../lib/formating.php:160
|
65 |
-
msgid "Just Now"
|
66 |
-
msgstr "In questo momento"
|
67 |
-
|
68 |
-
#: ../lib/formating.php:163
|
69 |
-
#, php-format
|
70 |
-
msgid "1 minute ago"
|
71 |
-
msgid_plural "%d minutes ago"
|
72 |
-
msgstr[0] "1 minuto fa"
|
73 |
-
msgstr[1] "%d minuti fa"
|
74 |
-
|
75 |
-
#: ../lib/formating.php:166
|
76 |
-
#, php-format
|
77 |
-
msgid "1 hour ago"
|
78 |
-
msgid_plural "%d hours ago"
|
79 |
-
msgstr[0] "1 ora fa"
|
80 |
-
msgstr[1] "%d ore fa"
|
81 |
-
|
82 |
-
#: ../lib/formating.php:170
|
83 |
-
#, php-format
|
84 |
-
msgid "Today at %s"
|
85 |
-
msgstr "Oggi alle %s"
|
86 |
-
|
87 |
-
#: ../lib/formating.php:170
|
88 |
-
#, php-format
|
89 |
-
msgid "Yesterday at %s"
|
90 |
-
msgstr "Ieri alle %s"
|
91 |
-
|
92 |
-
#: ../lib/themes.php:160
|
93 |
-
msgid "Plugin Homepage"
|
94 |
-
msgstr ""
|
95 |
-
|
96 |
-
#: ../lib/themes.php:164
|
97 |
-
msgid "Theme Homepage"
|
98 |
-
msgstr ""
|
99 |
-
|
100 |
-
#: ../lib/themes.php:168
|
101 |
-
msgid "Documentation"
|
102 |
-
msgstr ""
|
103 |
-
|
104 |
-
#: ../lib/themes.php:172
|
105 |
-
msgid "Support Forum"
|
106 |
-
msgstr ""
|
107 |
-
|
108 |
-
#: ../lib/themes.php:176
|
109 |
-
msgid "Author Homepage"
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: ../lib/themes.php:180
|
113 |
-
msgid "Donate to project"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: ../vendor/upload/class.upload.php:2171
|
117 |
-
msgid "File error. Please try again."
|
118 |
-
msgstr "Errore file. Riprova."
|
119 |
-
|
120 |
-
#: ../vendor/upload/class.upload.php:2172
|
121 |
-
msgid "Local file doesn't exist."
|
122 |
-
msgstr "Il file locale non esiste."
|
123 |
-
|
124 |
-
#: ../vendor/upload/class.upload.php:2173
|
125 |
-
msgid "Local file is not readable."
|
126 |
-
msgstr "Il file locale non é leggibile."
|
127 |
-
|
128 |
-
#: ../vendor/upload/class.upload.php:2174
|
129 |
-
msgid "File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)."
|
130 |
-
msgstr "Errore caricamento file (il file eccede il limite fissato dalla direttiva upload_max_filesize impostato in php.ini)."
|
131 |
-
|
132 |
-
#: ../vendor/upload/class.upload.php:2175
|
133 |
-
msgid "File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)."
|
134 |
-
msgstr "Errore caricamento file (il file eccede il limite fissato dalla direttiva MAX_FILE_SIZE specificata nel modulo html)."
|
135 |
-
|
136 |
-
#: ../vendor/upload/class.upload.php:2176
|
137 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
138 |
-
msgstr "Errore caricamento file (il file é stato pazialmente caricato)."
|
139 |
-
|
140 |
-
#: ../vendor/upload/class.upload.php:2177
|
141 |
-
msgid "File upload error (no file was uploaded)."
|
142 |
-
msgstr "Errore caricamento file (nessun file é stato caricato)."
|
143 |
-
|
144 |
-
#: ../vendor/upload/class.upload.php:2178
|
145 |
-
msgid "File upload error (missing a temporary folder)."
|
146 |
-
msgstr "Errore caricamento file (cartella temporanea inesistente)."
|
147 |
-
|
148 |
-
#: ../vendor/upload/class.upload.php:2179
|
149 |
-
msgid "File upload error (failed to write file to disk)."
|
150 |
-
msgstr "Errore caricamento file (non é stato possibile scrivere il file nel disco)."
|
151 |
-
|
152 |
-
#: ../vendor/upload/class.upload.php:2180
|
153 |
-
msgid "File upload error (file upload stopped by extension)."
|
154 |
-
msgstr "Errore caricamento file (blocco caricamento file dovuto alla estensione)."
|
155 |
-
|
156 |
-
#: ../vendor/upload/class.upload.php:2181
|
157 |
-
msgid "File upload error (unknown error code)."
|
158 |
-
msgstr "Errore caricamento file (codice errore sconosciuto)."
|
159 |
-
|
160 |
-
#: ../vendor/upload/class.upload.php:2182
|
161 |
-
msgid "File upload error. Please try again."
|
162 |
-
msgstr "Errore caricamento file. Riprova."
|
163 |
-
|
164 |
-
#: ../vendor/upload/class.upload.php:2183
|
165 |
-
msgid "File too big."
|
166 |
-
msgstr "File troppo grande."
|
167 |
-
|
168 |
-
#: ../vendor/upload/class.upload.php:2184
|
169 |
-
msgid "MIME type can't be detected."
|
170 |
-
msgstr "Non é possibile rilevare il formato MIME."
|
171 |
-
|
172 |
-
#: ../vendor/upload/class.upload.php:2185
|
173 |
-
msgid "Incorrect type of file."
|
174 |
-
msgstr "Tipo di file non corretto."
|
175 |
-
|
176 |
-
#: ../vendor/upload/class.upload.php:2186
|
177 |
-
msgid "Image too wide."
|
178 |
-
msgstr "Immagine troppo larga."
|
179 |
-
|
180 |
-
#: ../vendor/upload/class.upload.php:2187
|
181 |
-
msgid "Image too narrow."
|
182 |
-
msgstr "Immagine troppo stretta."
|
183 |
-
|
184 |
-
#: ../vendor/upload/class.upload.php:2188
|
185 |
-
msgid "Image too high."
|
186 |
-
msgstr "Immagine troppo alta."
|
187 |
-
|
188 |
-
#: ../vendor/upload/class.upload.php:2189
|
189 |
-
msgid "Image too short."
|
190 |
-
msgstr "Immagine troppo piccola."
|
191 |
-
|
192 |
-
#: ../vendor/upload/class.upload.php:2190
|
193 |
-
msgid "Image ratio too high (image too wide)."
|
194 |
-
msgstr "Proporzione immagine troppo elevata (immagine eccessivamente larga)."
|
195 |
-
|
196 |
-
#: ../vendor/upload/class.upload.php:2191
|
197 |
-
msgid "Image ratio too low (image too high)."
|
198 |
-
msgstr "Proporzione immagine troppo bassa (immagine eccessivamente alta)."
|
199 |
-
|
200 |
-
#: ../vendor/upload/class.upload.php:2192
|
201 |
-
msgid "Image has too many pixels."
|
202 |
-
msgstr "Immagine con troppi pixel."
|
203 |
-
|
204 |
-
#: ../vendor/upload/class.upload.php:2193
|
205 |
-
msgid "Image has not enough pixels."
|
206 |
-
msgstr "Immagine con pochi pixel."
|
207 |
-
|
208 |
-
#: ../vendor/upload/class.upload.php:2194
|
209 |
-
msgid "File not uploaded. Can't carry on a process."
|
210 |
-
msgstr "Il file non é stato caricato. Non é possibile proseguire l'operazione."
|
211 |
-
|
212 |
-
#: ../vendor/upload/class.upload.php:2195
|
213 |
-
#, php-format
|
214 |
-
msgid "%s already exists. Please change the file name."
|
215 |
-
msgstr "%s già esiste. Modifica il nome del file."
|
216 |
-
|
217 |
-
#: ../vendor/upload/class.upload.php:2196
|
218 |
-
msgid "No correct temp source file. Can't carry on a process."
|
219 |
-
msgstr "File temporaneo sorgente non valido. Non é possibile proseguire l'operazione."
|
220 |
-
|
221 |
-
#: ../vendor/upload/class.upload.php:2197
|
222 |
-
msgid "No correct uploaded source file. Can't carry on a process."
|
223 |
-
msgstr "Il file sorgente che é stato caricato non è valido. Non é possibile proseguire l'operazione."
|
224 |
-
|
225 |
-
#: ../vendor/upload/class.upload.php:2198
|
226 |
-
msgid "Destination directory can't be created. Can't carry on a process."
|
227 |
-
msgstr "La cartella di destinazione non può essere creata. Non é possibile proseguire l'operazione."
|
228 |
-
|
229 |
-
#: ../vendor/upload/class.upload.php:2199
|
230 |
-
msgid "Destination directory doesn't exist. Can't carry on a process."
|
231 |
-
msgstr "La cartella di destinazione non esiste. Non é possibile proseguire l'operazione."
|
232 |
-
|
233 |
-
#: ../vendor/upload/class.upload.php:2200
|
234 |
-
msgid "Destination path is not a directory. Can't carry on a process."
|
235 |
-
msgstr "Il percorso di destinazione non conduce ad una cartella. Non é possibile proseguire l'operazione."
|
236 |
-
|
237 |
-
#: ../vendor/upload/class.upload.php:2201
|
238 |
-
msgid "Destination directory can't be made writeable. Can't carry on a process."
|
239 |
-
msgstr "La cartella di destinazione non può essere resa scrivibile. Non é possibile proseguire l'operazione."
|
240 |
-
|
241 |
-
#: ../vendor/upload/class.upload.php:2202
|
242 |
-
msgid "Destination path is not a writeable. Can't carry on a process."
|
243 |
-
msgstr "Il percorso di destinazione non é scrivibile. Non é possibile proseguire l'operazione."
|
244 |
-
|
245 |
-
#: ../vendor/upload/class.upload.php:2203
|
246 |
-
msgid "Can't create the temporary file. Can't carry on a process."
|
247 |
-
msgstr "Non é stato possibile creare un file temporaneo. Non é possibile proseguire l'operazione."
|
248 |
-
|
249 |
-
#: ../vendor/upload/class.upload.php:2204
|
250 |
-
msgid "Source file is not readable. Can't carry on a process."
|
251 |
-
msgstr "Il file sorgente non é leggibile. Non é possibile proseguire l'operazione."
|
252 |
-
|
253 |
-
#: ../vendor/upload/class.upload.php:2205
|
254 |
-
#, php-format
|
255 |
-
msgid "No create from %s support."
|
256 |
-
msgstr "Impossibile creare dal supporto %s."
|
257 |
-
|
258 |
-
#: ../vendor/upload/class.upload.php:2206
|
259 |
-
#, php-format
|
260 |
-
msgid "Error in creating %s image from source."
|
261 |
-
msgstr "Errore durante la creazione della immagine %s (via sorgente)."
|
262 |
-
|
263 |
-
#: ../vendor/upload/class.upload.php:2207
|
264 |
-
msgid "Can't read image source. Not an image?."
|
265 |
-
msgstr "Impossibile la lettura del sorgente immagine. Forse, non é una immagine!"
|
266 |
-
|
267 |
-
#: ../vendor/upload/class.upload.php:2208
|
268 |
-
msgid "GD doesn't seem to be present."
|
269 |
-
msgstr "Pare che la libreria GD non sia presente."
|
270 |
-
|
271 |
-
#: ../vendor/upload/class.upload.php:2209
|
272 |
-
#, php-format
|
273 |
-
msgid "No create from %s support, can't read watermark."
|
274 |
-
msgstr "Nessuna creazione dal supporto %s. Impossibile leggere la filigrana."
|
275 |
-
|
276 |
-
#: ../vendor/upload/class.upload.php:2210
|
277 |
-
#, php-format
|
278 |
-
msgid "No %s read support, can't create watermark."
|
279 |
-
msgstr "Nessun supporto di lettura %s. Impossibile creare la filigrana."
|
280 |
-
|
281 |
-
#: ../vendor/upload/class.upload.php:2211
|
282 |
-
msgid "Unknown image format, can't read watermark."
|
283 |
-
msgstr "Formato immagine sconosciuto. Impossibile leggere la filigrana."
|
284 |
-
|
285 |
-
#: ../vendor/upload/class.upload.php:2212
|
286 |
-
#, php-format
|
287 |
-
msgid "No %s create support."
|
288 |
-
msgstr "Nessuna creazione dal supporto %s."
|
289 |
-
|
290 |
-
#: ../vendor/upload/class.upload.php:2213
|
291 |
-
msgid "No conversion type defined."
|
292 |
-
msgstr "Non é stato definito alcun tipo di conversione."
|
293 |
-
|
294 |
-
#: ../vendor/upload/class.upload.php:2214
|
295 |
-
msgid "Error copying file on the server. copy() failed."
|
296 |
-
msgstr "Errore durante la copia del file sul server. copy() failed."
|
297 |
-
|
298 |
-
#: ../vendor/upload/class.upload.php:2215
|
299 |
-
msgid "Error reading the file."
|
300 |
-
msgstr "Errore nella lettura del file."
|
301 |
-
|
302 |
-
#~ msgid "The active plugin %s is not compatible with your PHP version."
|
303 |
-
#~ msgstr "Il plugin attivo %s non é compatibile con la tua versione PHP."
|
304 |
-
#~ msgid "%s is required for this plugin."
|
305 |
-
#~ msgstr "%s necessario per questo plugin."
|
306 |
-
#~ msgid "A widget to move posts to the sidebar."
|
307 |
-
#~ msgstr "Un widget per poter spostare gli articoli nella barra laterale."
|
308 |
-
#~ msgid "Category not selected."
|
309 |
-
#~ msgstr "La categoria non é stata selezionata."
|
310 |
-
#~ msgid "Read more »"
|
311 |
-
#~ msgstr "Prosegui la lettura »"
|
312 |
-
#~ msgid "No Comments"
|
313 |
-
#~ msgstr "Nessun commento"
|
314 |
-
#~ msgid "1 Comment"
|
315 |
-
#~ msgstr "1 Commento"
|
316 |
-
#~ msgid "% Comments"
|
317 |
-
#~ msgstr "% Commenti"
|
318 |
-
#~ msgid "Comments closed"
|
319 |
-
#~ msgstr "I commenti sono stati disattivati"
|
320 |
-
#~ msgid "Archive for"
|
321 |
-
#~ msgstr "Archivo per"
|
322 |
-
#~ msgid "Title:"
|
323 |
-
#~ msgstr "Titolo:"
|
324 |
-
#~ msgid "Category:"
|
325 |
-
#~ msgstr "Categoria:"
|
326 |
-
#~ msgid "-- PRIVATE POSTS --"
|
327 |
-
#~ msgstr "-- ARTICOLI PRIVATI --"
|
328 |
-
#~ msgid "Number of posts:"
|
329 |
-
#~ msgstr "Numero di articoli:"
|
330 |
-
#~ msgid "(At most %d)"
|
331 |
-
#~ msgstr "(massimo %d)"
|
332 |
-
#~ msgid "Show:"
|
333 |
-
#~ msgstr "Mostra:"
|
334 |
-
#~ msgid "Full Post"
|
335 |
-
#~ msgstr "Articolo completo"
|
336 |
-
#~ msgid "Post Excerpt"
|
337 |
-
#~ msgstr "Riassunto dell'articolo"
|
338 |
-
#~ msgid "Excerpts with thumbnails"
|
339 |
-
#~ msgstr "Riassunti con miniatura"
|
340 |
-
#~ msgid "Photo Blog"
|
341 |
-
#~ msgstr "Photo Blog"
|
342 |
-
#~ msgid "Only Post Title"
|
343 |
-
#~ msgstr "Solo il titolo del post"
|
344 |
-
#~ msgid "Show category on all feeds"
|
345 |
-
#~ msgstr "Mostra la categoria in tutti i feed"
|
346 |
-
#~ msgid "Image width:"
|
347 |
-
#~ msgstr "Larghezza immagine:"
|
348 |
-
#~ msgid "pixels"
|
349 |
-
#~ msgstr "pixel"
|
350 |
-
#~ msgid "Align thumbnail to right"
|
351 |
-
#~ msgstr "Allinea la miniatura a destra"
|
352 |
-
#~ msgid "Read full post »"
|
353 |
-
#~ msgstr "Leggi l'articolo completo »"
|
354 |
-
#~ msgid "No posts found"
|
355 |
-
#~ msgstr "Non é stato trovato alcun articolo"
|
356 |
-
#~ msgid "Incompatible System"
|
357 |
-
#~ msgstr "Sistema incompatibile"
|
358 |
-
#~ msgid "Read More..."
|
359 |
-
#~ msgstr "Continua..."
|
360 |
-
#~ msgid "DailyTube Plugin Settings"
|
361 |
-
#~ msgstr "Configuración de DailyTube"
|
362 |
-
#~ msgid ""
|
363 |
-
#~ "DailyTube plugin has been updated. Please, check your plugin settings."
|
364 |
-
#~ msgstr ""
|
365 |
-
#~ "La extensión DailyTube ha sido actualizada. Por favor, revisa la "
|
366 |
-
#~ "configuración de esta extensión."
|
367 |
-
#~ msgid ""
|
368 |
-
#~ "CAUTION: You updated from a version prior to 1.0. For this reason your "
|
369 |
-
#~ "settings have been reverted to defaults."
|
370 |
-
#~ msgstr ""
|
371 |
-
#~ "ATENCION: Has actualizado desde una versión anterior a 1.0. Por este "
|
372 |
-
#~ "motivo, las opciones se han revertido a valores por defecto."
|
373 |
-
#~ msgid "DailyTube Settings"
|
374 |
-
#~ msgstr "Configuración DailyTube"
|
375 |
-
#~ msgid "<strong>Note:</strong> All sizes must be entered as Width x Height"
|
376 |
-
#~ msgstr "<strong>Nota:</strong> Todos los tamaños son Ancho x Alto"
|
377 |
-
#~ msgid "Content tag:"
|
378 |
-
#~ msgstr "Etiqueta de contenido:"
|
379 |
-
#~ msgid "Video Size:"
|
380 |
-
#~ msgstr "Tamaño de vídeo:"
|
381 |
-
#~ msgid "Show Related Videos?"
|
382 |
-
#~ msgstr "¿Mostrar vídeos relacionados?"
|
383 |
-
#~ msgid "Player Color:"
|
384 |
-
#~ msgstr "Color del reproductor:"
|
385 |
-
#~ msgid "Show Border?"
|
386 |
-
#~ msgstr "¿Mostrar marco?"
|
387 |
-
#~ msgid "Enhanced Genie Menu?"
|
388 |
-
#~ msgstr "¿Utilizar menú \"Genie\"?"
|
389 |
-
#~ msgid "Wide format tag:"
|
390 |
-
#~ msgstr "Marcador formato panorámico:"
|
391 |
-
#~ msgid "Square format tag:"
|
392 |
-
#~ msgstr "Marcador de formato cuadrado:"
|
393 |
-
#~ msgid "Wide Video Size"
|
394 |
-
#~ msgstr "Tamaño de vídeo panorámico"
|
395 |
-
#~ msgid "Square Video Size"
|
396 |
-
#~ msgstr "Tamaño de vídeo cuadrado"
|
397 |
-
#~ msgid "Allow FullScreen?"
|
398 |
-
#~ msgstr "¿Permitir pantalla completa?"
|
399 |
-
#~ msgid "Global Settings"
|
400 |
-
#~ msgstr "Opciones Generales"
|
401 |
-
#~ msgid "Video Align:"
|
402 |
-
#~ msgstr "Alineación del vídeo:"
|
403 |
-
#~ msgid "None"
|
404 |
-
#~ msgstr "Ninguna"
|
405 |
-
#~ msgid "Left"
|
406 |
-
#~ msgstr "Izquierda"
|
407 |
-
#~ msgid "Center"
|
408 |
-
#~ msgstr "Centro"
|
409 |
-
#~ msgid "Right"
|
410 |
-
#~ msgstr "Derecha"
|
411 |
-
#~ msgid "Save Changes"
|
412 |
-
#~ msgstr "Guardar Cambios"
|
413 |
-
#~ msgid "YouTube & Google Video Size"
|
414 |
-
#~ msgstr "Tamaño de vídeo YouTube y Google"
|
415 |
-
#~ msgid "or"
|
416 |
-
#~ msgstr "o"
|
417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/filesystem.php
DELETED
@@ -1,198 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Functions related to the file system and system settings.
|
4 |
-
*
|
5 |
-
* @version $Rev: 203758 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Creates a subdirectory within the WordPress uploads folder.
|
31 |
-
*
|
32 |
-
* @uses apply_filters() Calls the 'ak_upload_dir' on the upload folder directory.
|
33 |
-
* @param string $name New subdirectory name.
|
34 |
-
* @return void
|
35 |
-
*/
|
36 |
-
function ak_create_upload_folder( $name )
|
37 |
-
{
|
38 |
-
if ( ! defined('AK_UPLOAD_DIR') ) {
|
39 |
-
$uploads = wp_upload_dir();
|
40 |
-
define ( 'AK_UPLOAD_DIR', $upload['basedir'] .'/alkivia' );
|
41 |
-
}
|
42 |
-
|
43 |
-
$folder = apply_filters('ak_upload_dir', AK_UPLOAD_DIR . '/' . $name);
|
44 |
-
wp_mkdir_p($folder);
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Returns the system max filesize for uploads.
|
49 |
-
* This depends on the directives upload_max_filesize, post_max_size and memory_limit. The lowest of them is the limit.
|
50 |
-
*
|
51 |
-
* @return int Max system filesize upload (in bytes).
|
52 |
-
*/
|
53 |
-
function ak_max_upload()
|
54 |
-
{
|
55 |
-
|
56 |
-
$file = ak_return_bytes(ini_get('upload_max_filesize'));
|
57 |
-
$post = ak_return_bytes(ini_get('post_max_size'));
|
58 |
-
$mem = ak_return_bytes(ini_get('memory_limit'));
|
59 |
-
|
60 |
-
return min($file, $post, $mem);
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Converts a PHP config value to bytes.
|
65 |
-
*
|
66 |
-
* @param $string PHP config value, as readed with ini_get()
|
67 |
-
* @return int Value in bytes.
|
68 |
-
*/
|
69 |
-
function ak_return_bytes( $value )
|
70 |
-
{
|
71 |
-
$val = trim($value);
|
72 |
-
$unit = strtoupper($val[strlen($val)-1]);
|
73 |
-
|
74 |
-
switch ( $unit ) {
|
75 |
-
case 'G': // GigaBytes
|
76 |
-
$val *= 1024;
|
77 |
-
case 'M': // MegaBytes
|
78 |
-
$val *= 1024;
|
79 |
-
case 'K': // KiloBytes
|
80 |
-
$val *= 1024;
|
81 |
-
}
|
82 |
-
|
83 |
-
return $val;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Formats a value in bytes to the bigger unit. (Gb, Mb, Kb).
|
88 |
-
*
|
89 |
-
* @param int $value Value to convert.
|
90 |
-
* @return string Formated value.
|
91 |
-
*/
|
92 |
-
function ak_return_units( $value, $max = 'G' )
|
93 |
-
{
|
94 |
-
$max = strtoupper($max);
|
95 |
-
$unit = 'bytes';
|
96 |
-
|
97 |
-
if ( $value >= 1024 ) {
|
98 |
-
$value /= 1024;
|
99 |
-
$unit = 'Kb';
|
100 |
-
}
|
101 |
-
if ( $value >= 1024 && ( 'M' == $max || 'G' == $max ) ){
|
102 |
-
$value /= 1024;
|
103 |
-
$unit = 'Mb';
|
104 |
-
}
|
105 |
-
if ( $value >= 1024 && ( 'G' == $max) ) {
|
106 |
-
$value /= 1024;
|
107 |
-
$unit = 'Gb';
|
108 |
-
}
|
109 |
-
|
110 |
-
$val = intval($value) . ' ' . $unit;
|
111 |
-
return $val;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Creates and returns an ordered list for files in a given directori.
|
116 |
-
* The function recurses into all directory tree.
|
117 |
-
*
|
118 |
-
* @param string $directory Directory where search for files. Absolute path.
|
119 |
-
* @param array $args Options array to select wich files to return. Options:
|
120 |
-
* - tree: recurses into subdirectories. 0 = No, 1 (default) = Yes
|
121 |
-
* - extensions: array or comma delimited list of wanted extensions (default all extensions).
|
122 |
-
* - with_ext: Return filename with extension. 0 = No, 1 (default) = Yes
|
123 |
-
* - prefix: A filename prefix for returned files (default = No prefix).
|
124 |
-
* @param boolean $withexst We want returned filenames with extension. Defaults true.
|
125 |
-
* @return array List of files found.
|
126 |
-
*/
|
127 |
-
function ak_dir_content($directory, $args='')
|
128 |
-
{
|
129 |
-
|
130 |
-
$directory = realpath($directory); // Be sure the directory path is well formed.
|
131 |
-
if ( ! is_dir($directory) ) { // Check if it is a directory.
|
132 |
-
return array(); // If not, return an ampty array.
|
133 |
-
}
|
134 |
-
|
135 |
-
$defaults = array(
|
136 |
-
'tree' => 1, // recurses into subdirectories (0 = No, 1 = Yes)
|
137 |
-
'extensions' => '', // array or comma delimited list of wanted extensions
|
138 |
-
'with_ext' => 1, // Return filename with extension (0 = No, 1 = Yes)
|
139 |
-
'prefix' => ''); // If we only want files with a custom prefix set the prefix option.
|
140 |
-
|
141 |
-
$options = wp_parse_args($args, $defaults);
|
142 |
-
extract($options, EXTR_SKIP);
|
143 |
-
|
144 |
-
if ( ! empty($extensions) && ! is_array($extensions) ) {
|
145 |
-
$extensions = explode(',', $extensions);
|
146 |
-
}
|
147 |
-
|
148 |
-
$dir_tree = array(); // Directory could be empty.
|
149 |
-
$d = dir($directory);
|
150 |
-
while ( false !== ( $filename = $d->read() ) ) {
|
151 |
-
if ( $prefix != substr($filename, 0, strlen($prefix)) || '.' == substr($filename, 0, 1) ) {
|
152 |
-
continue;
|
153 |
-
}
|
154 |
-
|
155 |
-
if ( is_dir($directory . DIRECTORY_SEPARATOR . $filename) && $tree ) {
|
156 |
-
$dir_tree[$filename] = ak_dir_content($directory . DIRECTORY_SEPARATOR . $filename, $options);
|
157 |
-
} else {
|
158 |
-
$fileinfo = pathinfo($directory . DIRECTORY_SEPARATOR . $filename);
|
159 |
-
if ( empty($extensions) || in_array($fileinfo['extension'], $extensions) ) {
|
160 |
-
if ( ! $with_ext ) {
|
161 |
-
$filename = substr($filename, 0, (strlen($fileinfo['extension']) + 1) * -1);
|
162 |
-
}
|
163 |
-
$dir_tree[] = $filename;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
$d->close();
|
168 |
-
asort($dir_tree);
|
169 |
-
|
170 |
-
return $dir_tree;
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Returns a list of templates found in an array of directories
|
175 |
-
*
|
176 |
-
* @param array|string $folders Array of folders to search in.
|
177 |
-
* @param string $prefix Templates prefix filter.
|
178 |
-
* @return array Found templates (all found php files).
|
179 |
-
*/
|
180 |
-
function ak_get_templates( $folders, $prefix = '' )
|
181 |
-
{
|
182 |
-
// Compatibility with a bug in Sideposts 3.0 and 3.0.1
|
183 |
-
if ( strpos($prefix, '&') ) $prefix = '';
|
184 |
-
|
185 |
-
$list = array();
|
186 |
-
foreach ( (array) $folders as $folder ) {
|
187 |
-
$found = ak_dir_content($folder, "tree=0&extensions=php&with_ext=0&prefix={$prefix}");
|
188 |
-
$list = array_merge($found, $list);
|
189 |
-
}
|
190 |
-
|
191 |
-
$start = strlen($prefix);
|
192 |
-
foreach ( $list as $item ) {
|
193 |
-
$name = substr($item, $start);
|
194 |
-
$templates[$name] = ucfirst(str_replace('_', ' ', $name));
|
195 |
-
}
|
196 |
-
|
197 |
-
return $templates;
|
198 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/formating.php
CHANGED
@@ -27,18 +27,6 @@
|
|
27 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
*/
|
29 |
|
30 |
-
/**
|
31 |
-
* Converts vars with values equivalent to zero (0) to an empty string.
|
32 |
-
* This is useful as an output filter, when we need and empty textbox.
|
33 |
-
*
|
34 |
-
* @param mixed $var Input value to convert.
|
35 |
-
* @return string Empty string if value is equivalent to zero.
|
36 |
-
*/
|
37 |
-
function ak_zero_clean( $var )
|
38 |
-
{
|
39 |
-
return ( 0 == intval($var) ) ? '' : $var;
|
40 |
-
}
|
41 |
-
|
42 |
/**
|
43 |
* Displays admin notices.
|
44 |
*
|
@@ -66,114 +54,4 @@ function ak_admin_error( $message )
|
|
66 |
if ( is_admin() ) {
|
67 |
echo '<div id="error" class="error"><p><strong>' . $message . '</strong></p></div>';
|
68 |
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Displays dashboard notices by setting the 'admin_notices' action hook.
|
73 |
-
* This is used for global warnings that have to show in all dashboard pages.
|
74 |
-
*
|
75 |
-
* @uses akAdminNotice
|
76 |
-
* @param $message Message to display.
|
77 |
-
* @return void
|
78 |
-
*/
|
79 |
-
function ak_dashboard_notice( $message )
|
80 |
-
{
|
81 |
-
if ( is_admin() ) {
|
82 |
-
require_once ( AK_CLASSES . '/admin-notices.php' );
|
83 |
-
new akAdminNotice($message);
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Generic pager.
|
89 |
-
*
|
90 |
-
* @param int $total Total elements to paginate.
|
91 |
-
* @param int $per_page Number of elements per page.
|
92 |
-
* @param $current Current page number.
|
93 |
-
* @param $url Base url for links. Only page numbers are appended.
|
94 |
-
* @return string Formated pager.
|
95 |
-
*/
|
96 |
-
function ak_pager( $total, $per_page, $url, $current = 0 )
|
97 |
-
{
|
98 |
-
if ( 0 == $current ) $current = 1;
|
99 |
-
|
100 |
-
$pages = $total / $per_page;
|
101 |
-
$pages = ( $pages == intval($pages) ) ? intval($pages) : intval($pages) + 1;
|
102 |
-
|
103 |
-
if ( $pages == 1 ) {
|
104 |
-
$out = '';
|
105 |
-
} else {
|
106 |
-
$out = "<div class='pager'>\n";
|
107 |
-
if ( $current != 1 ) {
|
108 |
-
$start = $current - 1;
|
109 |
-
$out .= '<a class="prev page-numbers" href="'. $url . $start .'">««</a>' . "\n";
|
110 |
-
}
|
111 |
-
|
112 |
-
for ( $i = 1; $i <= $pages; $i++ ) {
|
113 |
-
if ( $i == $current ) {
|
114 |
-
$out .= '<span class="page-numbers current">'. $i ."</span>\n";
|
115 |
-
} else {
|
116 |
-
$out .= '<a class="page-numbers" href="'. $url . $i .'">'. $i ."</a>\n";
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
if ( $current != $pages ) {
|
121 |
-
$start = $current + 1;
|
122 |
-
$out .= '<a class="next page-numbers" href="'. $url . $start .'">»»</a>' . "\n";
|
123 |
-
}
|
124 |
-
$out .= "</div>\n";
|
125 |
-
}
|
126 |
-
|
127 |
-
return $out;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Creates an string telling how many time ago
|
132 |
-
*
|
133 |
-
* @param $datetime Date Time in mySql Format.
|
134 |
-
* @return string The time from the date to now, just looks to yesterday.
|
135 |
-
*/
|
136 |
-
function ak_time_ago( $datetime )
|
137 |
-
{
|
138 |
-
$before = strtotime($datetime);
|
139 |
-
$is_today = ( date('Y-m-d') == substr($datetime, 0, 10) );
|
140 |
-
$now = time();
|
141 |
-
|
142 |
-
$times = array (
|
143 |
-
'd' => 43200, // 12 hours
|
144 |
-
'h' => 3600, // 1 hour
|
145 |
-
'm' => 60, // 1 minute
|
146 |
-
's' => 1 // 1 second
|
147 |
-
);
|
148 |
-
|
149 |
-
$diff = $now - $before;
|
150 |
-
foreach ( $times as $unit => $seconds ) {
|
151 |
-
if ( $diff >= $seconds ) {
|
152 |
-
$value = intval($diff / $seconds);
|
153 |
-
break;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
$format = get_option('date_format') . ' | ' . get_option('time_format'); // Date-Time format
|
158 |
-
switch ( $unit ) {
|
159 |
-
case 's':
|
160 |
-
$ago = __('Just Now', 'akfw');
|
161 |
-
break;
|
162 |
-
case 'm':
|
163 |
-
$ago = sprintf(_n('1 minute ago', '%d minutes ago', $value, 'akfw'), $value);
|
164 |
-
break;
|
165 |
-
case 'h' :
|
166 |
-
$ago = sprintf(_n('1 hour ago', '%d hours ago', $value, 'akfw'), $value);
|
167 |
-
break;
|
168 |
-
case 'd' :
|
169 |
-
if ( 1 == $value ) {
|
170 |
-
$literal = ( $is_today ) ? __('Today at %s', 'akfw') : __('Yesterday at %s', 'akfw');
|
171 |
-
$ago = sprintf($literal, date('H:i', $before));
|
172 |
-
} else {
|
173 |
-
$ago = mysql2date($format, $datetime);
|
174 |
-
}
|
175 |
-
break;
|
176 |
-
}
|
177 |
-
|
178 |
-
return $ago;
|
179 |
-
}
|
27 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
*/
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
/**
|
31 |
* Displays admin notices.
|
32 |
*
|
54 |
if ( is_admin() ) {
|
55 |
echo '<div id="error" class="error"><p><strong>' . $message . '</strong></p></div>';
|
56 |
}
|
57 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/modules.php
DELETED
@@ -1,207 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Modules related functions.
|
4 |
-
*
|
5 |
-
* @version $Rev: 203758 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Parse the plugin readme.txt file to retrieve plugin's metadata.
|
31 |
-
*
|
32 |
-
* The metadata of the plugin's readme searches for the following in the readme.txt
|
33 |
-
* header. All metadata must be on its own line. The below is formatted for printing.
|
34 |
-
*
|
35 |
-
* <code>
|
36 |
-
* Contributors: contributors nicknames, comma delimited
|
37 |
-
* Donate link: Link to plugin donate page
|
38 |
-
* Tags: Plugin tags, comma delimited
|
39 |
-
* Requires at least: Minimum WordPress version required
|
40 |
-
* Tested up to: Higher WordPress version the plugin has been tested.
|
41 |
-
* Stable tag: Latest stable tag in repository.
|
42 |
-
* </code>
|
43 |
-
*
|
44 |
-
* Readme data returned array cointains the following:
|
45 |
-
* - 'Contributors' - An array with all contributors nicknames.
|
46 |
-
* - 'Tags' - An array with all plugin tags.
|
47 |
-
* - 'DonateURI' - The donations page address.
|
48 |
-
* - 'HelpURI' - Link to the forum page.
|
49 |
-
* - 'DocsURI' - Link to module documentation.
|
50 |
-
* - 'Required' - Minimum required WordPress version.
|
51 |
-
* - 'Tested' - Higher WordPress version this plugin has been tested.
|
52 |
-
* - 'Stable' - Last stable tag when this was released.
|
53 |
-
*
|
54 |
-
* The first 8kiB of the file will be pulled in and if the readme data is not
|
55 |
-
* within that first 8kiB, then the plugin author should correct their plugin
|
56 |
-
* and move the plugin data headers to the top.
|
57 |
-
*
|
58 |
-
* The readme file is assumed to have permissions to allow for scripts to read
|
59 |
-
* the file. This is not checked however and the file is only opened for
|
60 |
-
* reading.
|
61 |
-
*
|
62 |
-
* @param string $mod_file Path to the plugin file (not the readme file)
|
63 |
-
* @return array See above for description.
|
64 |
-
*/
|
65 |
-
function ak_module_readme_data( $mod_file )
|
66 |
-
{
|
67 |
-
$file = dirname($mod_file) . '/readme.txt';
|
68 |
-
|
69 |
-
if ( is_readable($file) ) {
|
70 |
-
$fp = fopen($file, 'r'); // Open just for reading.
|
71 |
-
$data = fread( $fp, 8192 ); // Pull the first 8kiB of the file in.
|
72 |
-
fclose($fp); // Close the file.
|
73 |
-
|
74 |
-
preg_match( '|Contributors:(.*)$|mi', $data, $contributors );
|
75 |
-
preg_match( '|Donate link:(.*)$|mi', $data, $uri );
|
76 |
-
preg_match( '|Help link:(.*)$|mi', $data, $help ); // Not WP Standard
|
77 |
-
preg_match( '|Docs link:(.*)$|mi', $data, $docs ); // Not WP Standard
|
78 |
-
preg_match( '|Tags:(.*)|mi', $data, $tags );
|
79 |
-
preg_match( '|Requires at least:(.*)$|mi', $data, $required );
|
80 |
-
preg_match( '|Tested up to:(.*)$|mi', $data, $tested );
|
81 |
-
preg_match( '|Stable tag:(.*)$|mi', $data, $stable );
|
82 |
-
|
83 |
-
foreach ( array( 'contributors', 'uri', 'help', 'docs', 'tags', 'required', 'tested', 'stable' ) as $field ) {
|
84 |
-
if ( !empty( ${$field} ) ) {
|
85 |
-
${$field} = trim(${$field}[1]);
|
86 |
-
} else {
|
87 |
-
${$field} = '';
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
$readme_data = array(
|
92 |
-
'Contributors' => array_map('trim', explode(',', $contributors)),
|
93 |
-
'Tags' => array_map('trim', explode(',', $tags)),
|
94 |
-
'DonateURI' => trim($uri),
|
95 |
-
'HelpURI' => $help,
|
96 |
-
'DocsURI' => $docs,
|
97 |
-
'Requires' => trim($required),
|
98 |
-
'Tested' => trim($tested),
|
99 |
-
'Stable' => trim($stable) );
|
100 |
-
} else {
|
101 |
-
$readme_data = array();
|
102 |
-
}
|
103 |
-
|
104 |
-
return $readme_data;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Reads a component file header, and returns component data.
|
109 |
-
* Returned data is:
|
110 |
-
* - 'File' - The component filename, relative to the plugin folder.
|
111 |
-
* - 'Component' - The component short name or ID.
|
112 |
-
* - 'Name' - Descriptive name for the component.
|
113 |
-
* - 'Description' - A descriptive text about the component.
|
114 |
-
* - 'Author' - Component author name
|
115 |
-
* - 'URL' - Author homepage URL.
|
116 |
-
* - 'Link' - Author anchor to home page.
|
117 |
-
* - 'Core' - If this is a core compoment or not.
|
118 |
-
*
|
119 |
-
* @since 0.7
|
120 |
-
*
|
121 |
-
* @param string $file File name to read the header
|
122 |
-
* @param $is_core If will return data for core components or not.
|
123 |
-
* @return array Component data, see above.
|
124 |
-
*/
|
125 |
-
function ak_component_data ( $file, $is_core = false )
|
126 |
-
{
|
127 |
-
$fp = fopen($file, 'r'); // Open just for reading.
|
128 |
-
$data = fread( $fp, 8192 ); // Pull the first 8kiB of the file in.
|
129 |
-
fclose($fp); // Close the file.
|
130 |
-
|
131 |
-
preg_match( '|Module Component:(.*)$|mi', $data, $component );
|
132 |
-
if ( empty($component) && $is_core ) {
|
133 |
-
preg_match( '|Core Component:(.*)$|mi', $data, $component );
|
134 |
-
$core = 1;
|
135 |
-
} else {
|
136 |
-
$core = 0;
|
137 |
-
}
|
138 |
-
preg_match( '|Parent ID:(.*)$|mi', $data, $parent );
|
139 |
-
preg_match( '|Component Name:(.*)$|mi', $data, $name );
|
140 |
-
preg_match( '|Description:(.*)|mi', $data, $description );
|
141 |
-
preg_match( '|Version:(.*)|mi', $data, $version );
|
142 |
-
preg_match( '|Author:(.*)|mi', $data, $author );
|
143 |
-
preg_match( '|Link:(.*)|mi', $data, $url );
|
144 |
-
|
145 |
-
foreach ( array( 'component', 'parent', 'name', 'description', 'version', 'author', 'url' ) as $field ) {
|
146 |
-
if ( ! empty( ${$field} ) ) {
|
147 |
-
${$field} = trim(${$field}[1]);
|
148 |
-
} else {
|
149 |
-
${$field} = '';
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
if ( empty($component) ) {
|
154 |
-
$data = false;
|
155 |
-
} else {
|
156 |
-
$data = array(
|
157 |
-
'Component' => str_replace(' ', '_', strtolower($component)),
|
158 |
-
'File' => $file,
|
159 |
-
'Parent' => $parent,
|
160 |
-
'Name' => $name,
|
161 |
-
'Description' => $description,
|
162 |
-
'Version' => $version,
|
163 |
-
'Author' => $author,
|
164 |
-
'URL' => $url,
|
165 |
-
'Link' => "<a href='{$url}' target='_blank'>{$author}</a>",
|
166 |
-
'Core' => $core);
|
167 |
-
}
|
168 |
-
|
169 |
-
return $data;
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Gets information about all optional installed components.
|
174 |
-
* The function is recursive to find files in all directory levels.
|
175 |
-
*
|
176 |
-
* TODO: Path must be provided as AOC_PATH is only for community plugin.
|
177 |
-
* @since 0.7
|
178 |
-
*
|
179 |
-
* @param string $path Absolute path where to search for components.
|
180 |
-
* @param boolean $core If we want to include the core components or not.
|
181 |
-
* @param array $files An array with filenames to seach information in. If empty will search on $path.
|
182 |
-
* @return array Array with all found components information.
|
183 |
-
*/
|
184 |
-
function ak_get_installed_components( $path, $core = false, $files = array() )
|
185 |
-
{
|
186 |
-
if ( empty($files) ) {
|
187 |
-
$files = ak_dir_content($path, 'extensions=php');
|
188 |
-
}
|
189 |
-
|
190 |
-
$components = array();
|
191 |
-
foreach ( $files as $subdir => $file ) {
|
192 |
-
if ( is_array($file) ) {
|
193 |
-
$newdir = $path .'/'. $subdir;
|
194 |
-
$data = ak_get_installed_components( $newdir, $core, $file );
|
195 |
-
if ( is_array($data) ) {
|
196 |
-
$components = array_merge($components, $data);
|
197 |
-
}
|
198 |
-
} else {
|
199 |
-
$data = ak_component_data($path . '/' . $file, $core);
|
200 |
-
if ( is_array($data) ) {
|
201 |
-
$components[$data['Component']] = $data;
|
202 |
-
}
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
return $components;
|
207 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/objects.php
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Functions for objects management.
|
4 |
-
*
|
5 |
-
* @version $Rev: 198515 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
if ( ! isset($GLOBALS['_akv']) )
|
30 |
-
{
|
31 |
-
// Create the global $_akv. This holds all objects and settings.
|
32 |
-
$GLOBALS['_akv'] = array();
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Creates and stores an object in the $_akv global.
|
37 |
-
* Can be called at the same time we create the object: ak_store_object( 'obj_name', new objectName() );
|
38 |
-
*
|
39 |
-
* @param string $name Internal object name.
|
40 |
-
* @param object $object The object reference to store in the global.
|
41 |
-
* @return object The newly stored object reference.
|
42 |
-
*/
|
43 |
-
function & ak_create_object ( $name, $object )
|
44 |
-
{
|
45 |
-
$GLOBALS['_akv'][$name] =& $object;
|
46 |
-
return $object;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Gets an object stored in the $_akv global.
|
51 |
-
*
|
52 |
-
* @param string $name Object name.
|
53 |
-
* @return object|false Returns the requested object reference. If not found, or not an object, returns false.
|
54 |
-
*/
|
55 |
-
function & ak_get_object ( $name )
|
56 |
-
{
|
57 |
-
if ( is_object($GLOBALS['_akv'][$name]) ) {
|
58 |
-
return $GLOBALS['_akv'][$name];
|
59 |
-
} else {
|
60 |
-
return false;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Checks if an object exists in the $_akv global.
|
66 |
-
*
|
67 |
-
* @param string $name Object name to check.
|
68 |
-
* @return boolean If the object exists or not.
|
69 |
-
*/
|
70 |
-
function ak_object_exists ( $name )
|
71 |
-
{
|
72 |
-
global $_akv;
|
73 |
-
|
74 |
-
if ( isset($_akv[$name]) && is_object($_akv[$name]) ) {
|
75 |
-
return true;
|
76 |
-
} else {
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Returns the 'settings' object reference.
|
83 |
-
*
|
84 |
-
* @return object|false Returns the object reference, or false if not found.
|
85 |
-
*/
|
86 |
-
function & ak_settings_object ()
|
87 |
-
{
|
88 |
-
if ( ak_object_exists('settings') ) {
|
89 |
-
return ak_get_object('settings');
|
90 |
-
} else {
|
91 |
-
return ak_create_object('settings', new akSettings());
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Returns an object option/setting.
|
97 |
-
*
|
98 |
-
* @param string $object Object name to get options from.
|
99 |
-
* @param string $option Option name to return.
|
100 |
-
* @param mixed $default Default value if option not found.
|
101 |
-
* @return mixed The option value.
|
102 |
-
*/
|
103 |
-
function ak_get_option ( $object, $option = '', $default = false )
|
104 |
-
{
|
105 |
-
if ( is_object($GLOBALS['_akv'][$object]) && method_exists($GLOBALS['_akv'][$object], 'getOption') ) {
|
106 |
-
return $GLOBALS['_akv'][$object]->getOption($option, $default);
|
107 |
-
} else {
|
108 |
-
return $default;
|
109 |
-
}
|
110 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/plugins.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugins related functions.
|
4 |
-
* This file is deprecated and has been replaced by modules.php.
|
5 |
-
*
|
6 |
-
* @version $Rev: 198515 $
|
7 |
-
* @author Jordi Canals
|
8 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
9 |
-
* @license GNU General Public License version 2
|
10 |
-
* @link http://alkivia.org
|
11 |
-
* @package Alkivia
|
12 |
-
* @subpackage Framework
|
13 |
-
*
|
14 |
-
* @deprecated since 0.5
|
15 |
-
* @see modules.php
|
16 |
-
*
|
17 |
-
|
18 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
19 |
-
|
20 |
-
This program is free software; you can redistribute it and/or
|
21 |
-
modify it under the terms of the GNU General Public License
|
22 |
-
version 2 as published by the Free Software Foundation.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
31 |
-
*/
|
32 |
-
|
33 |
-
require_once ( 'AK_LIB' . '/modules.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/system.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Functions related to WordPress system.
|
4 |
-
*
|
5 |
-
* @version $Rev: 198515 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Checks is we are running on WordPress MU
|
31 |
-
* @return boolean
|
32 |
-
*/
|
33 |
-
function ak_is_mu()
|
34 |
-
{
|
35 |
-
return ( defined('VHOST') ) ? true : false;
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/themes-agapetry.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function agp_admin_authoring( $mod_id = '' ) {
|
3 |
+
return; // kevinB temp
|
4 |
+
?>
|
5 |
+
<dl>
|
6 |
+
<dt>Capability Manager</dt>
|
7 |
+
<dd>
|
8 |
+
<ul>
|
9 |
+
<li><a href="http://agapetry.com" class="capsman" target="_blank"><?php _e('Plugin Homepage', 'capsman'); ?></a></li>
|
10 |
+
<li><a href="http://presspermit.com" class="docs" target="_blank"><?php _e('Documentation', 'capsman'); ?></a></li>
|
11 |
+
<li><a href="http://agapetry.net/forum" class="help" target="_blank"><?php _e('Support Forum', 'capsman'); ?></a></li>
|
12 |
+
<li><a href="http://agapetry.com" class="home" target="_blank"><?php _e('Author Homepage', 'capsman')?></a></li>
|
13 |
+
<li><a href="http://agapetry.com" class="donate" target="_blank"><?php _e('Help donating', 'capsman')?></a></li>
|
14 |
+
</ul>
|
15 |
+
</dd>
|
16 |
+
</dl>
|
17 |
+
<?php
|
18 |
+
}
|
19 |
+
|
20 |
+
function agp_admin_footer( $mod_id = '' ) {
|
21 |
+
?>
|
22 |
+
<p class="footer">
|
23 |
+
<a href="http://wordpress.org/extend/plugins/capability-manager-enhanced"><?php printf( __( 'Capability Manager Enhanced %s', 'capsman' ), CAPSMAN_ENH_VERSION );?></a>
|
24 |
+
| © <?php _e( 'Copyright 2010 Jordi Canals', 'capsman' );?>
|
25 |
+
|
|
26 |
+
<?php
|
27 |
+
printf( __( 'Modifications © Copyright %1$s %2$s', 'capsman' ), '2012-2013', '<a href="http://agapetry.com">Kevin Behrens</a>' );?>
|
28 |
+
</p>
|
29 |
+
<?php
|
30 |
+
}
|
framework/lib/themes.php
DELETED
@@ -1,251 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Functions library for theme management.
|
4 |
-
*
|
5 |
-
* @version $Rev: 203758 $
|
6 |
-
* @author Jordi Canals
|
7 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
8 |
-
* @license GNU General Public License version 2
|
9 |
-
* @link http://alkivia.org
|
10 |
-
* @package Alkivia
|
11 |
-
* @subpackage Framework
|
12 |
-
*
|
13 |
-
|
14 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or
|
17 |
-
modify it under the terms of the GNU General Public License
|
18 |
-
version 2 as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
-
*/
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Creates and stores an object in the $_akv global.
|
31 |
-
* Can be called at the same time we create the object: ak_store_object( 'obj_name', new objectName() );
|
32 |
-
*
|
33 |
-
* @param string $name Internal object name.
|
34 |
-
* @param object $object The object reference to store in the global.
|
35 |
-
* @return object The newly stored object reference.
|
36 |
-
*/
|
37 |
-
function & ak_create_theme ( $theme )
|
38 |
-
{
|
39 |
-
$GLOBALS['_akv']['theme'] =& $theme;
|
40 |
-
return $theme;
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Gets and returns the theme object.
|
45 |
-
* @return akThemeAbstract
|
46 |
-
*/
|
47 |
-
function & ak_theme ()
|
48 |
-
{
|
49 |
-
return ak_get_object('theme');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Returns a theme option/setting.
|
54 |
-
*
|
55 |
-
* @param string $option Option name to return.
|
56 |
-
* @param mixed $default Default value if option not found.
|
57 |
-
* @return mixed The option value.
|
58 |
-
*/
|
59 |
-
function ak_theme_option ( $option = '', $default = false )
|
60 |
-
{
|
61 |
-
return ak_get_option ( 'theme', $option, $default );
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Returns parent theme data from style.css file.
|
66 |
-
*
|
67 |
-
* @param string $name Data name to return.
|
68 |
-
* @return mixed Data value.
|
69 |
-
*/
|
70 |
-
function ak_theme_data ( $name = '' )
|
71 |
-
{
|
72 |
-
if ( is_object($GLOBALS['_akv']['theme']) && method_exists($GLOBALS['_akv']['theme'], 'getModData') ) {
|
73 |
-
return $GLOBALS['_akv']['theme']->getModData($name);
|
74 |
-
} else {
|
75 |
-
return false;
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Returns child theme data from style.css file.
|
81 |
-
*
|
82 |
-
* @param string $name Data name to return.
|
83 |
-
* @return mixed Data value.
|
84 |
-
*/
|
85 |
-
function ak_child_theme_data ( $name = '' )
|
86 |
-
{
|
87 |
-
if ( is_object($GLOBALS['_akv']['theme']) && method_exists($GLOBALS['_akv']['theme'], 'getChildData') ) {
|
88 |
-
return $GLOBALS['_akv']['theme']->getChildData($name);
|
89 |
-
} else {
|
90 |
-
return false;
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Redirects user to a new page.
|
96 |
-
* This is done if the custom field 'redirect' is defined as:
|
97 |
-
* + Filed Name: redirect
|
98 |
-
* + Field Value: New target URL.
|
99 |
-
*
|
100 |
-
* @return void
|
101 |
-
*/
|
102 |
-
function ak_theme_redirect()
|
103 |
-
{
|
104 |
-
global $post;
|
105 |
-
|
106 |
-
if ( is_page() || is_single() ) {
|
107 |
-
if ( $meta = get_post_meta($post->ID, 'redirect', true) ) {
|
108 |
-
wp_redirect($meta, 301);
|
109 |
-
exit;
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Checks if the sidebar is used.
|
116 |
-
* Do it by checking if there is any widget on a sidebar number.
|
117 |
-
*
|
118 |
-
* @param int|string $index Sidebar number or id
|
119 |
-
* @return boolean True if this sidebar is used and contains any widget, false if not.
|
120 |
-
*/
|
121 |
-
function ak_theme_is_sidebar( $index )
|
122 |
-
{
|
123 |
-
$sidebar = wp_get_sidebars_widgets();
|
124 |
-
if ( is_numeric($index) ) {
|
125 |
-
$index = 'sidebar-' . $index;
|
126 |
-
}
|
127 |
-
|
128 |
-
if (isset($sidebar[$index]) && count($sidebar[$index]) ) {
|
129 |
-
return true;
|
130 |
-
} else {
|
131 |
-
return false;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Authoring widget for admin pages.
|
137 |
-
* You can add a readme.txt file for themes to add aditional links not found on style.css
|
138 |
-
* Additional strings searched at readme.txt are: 'Help link:' and 'Docs link'.
|
139 |
-
* All others follow plugins readme.txt guidelines.
|
140 |
-
*
|
141 |
-
* @since 0.5
|
142 |
-
*
|
143 |
-
* @param string $mod_id Module ID
|
144 |
-
* @return void
|
145 |
-
*/
|
146 |
-
function ak_admin_authoring ( $mod_id )
|
147 |
-
{
|
148 |
-
return; // kevinB temp
|
149 |
-
|
150 |
-
$mod = ak_get_object($mod_id);
|
151 |
-
if ( ! $mod ) {
|
152 |
-
return;
|
153 |
-
}
|
154 |
-
$data = $mod->getModData();
|
155 |
-
$class = ( $mod->isComponent() ) ? $mod->PID : $mod_id;
|
156 |
-
?>
|
157 |
-
|
158 |
-
<dl>
|
159 |
-
<dt><?php echo $data['Name']; ?></dt>
|
160 |
-
<dd>
|
161 |
-
<ul>
|
162 |
-
<li><a href="http://agapetry.com" class="capsman" target="_blank"><?php _e('Plugin Homepage', 'akfw'); ?></a></li>
|
163 |
-
<li><a href="http://presspermit.com" class="docs" target="_blank"><?php _e('Documentation', 'akfw'); ?></a></li>
|
164 |
-
<li><a href="http://agapetry.net/forum" class="help" target="_blank"><?php _e('Support Forum', 'akfw'); ?></a></li>
|
165 |
-
<li><a href="http://agapetry.com" class="h-ome" target="_blank"><?php _e('Author Homepage', 'akfw')?></a></li>
|
166 |
-
<li><a href="http://agapetry.com" class="donate" target="_blank"><?php _e('Help donating', 'akfw')?></a></li>
|
167 |
-
|
168 |
-
<!--
|
169 |
-
<?php if ( ! empty($data['PluginURI']) ) : ?>
|
170 |
-
<li><a href="<?php echo $data['PluginURI']; ?>" class="<?php echo $class; ?>" target="_blank"><?php _e('Plugin Homepage', 'akfw'); ?></a></li>
|
171 |
-
<?php endif; ?>
|
172 |
-
|
173 |
-
<?php if ( ! empty($data['URI']) ) : ?>
|
174 |
-
<li><a href="<?php echo $data['URI']; ?>" class="theme" target="_blank"><?php _e('Theme Homepage', 'akfw'); ?></a></li>
|
175 |
-
<?php endif; ?>
|
176 |
-
|
177 |
-
<?php if ( ! empty($data['DocsURI']) ) : ?>
|
178 |
-
<li><a href="<?php echo $data['DocsURI']; ?>" class="docs" target="_blank"><?php _e('Documentation', 'akfw'); ?></a></li>
|
179 |
-
<?php endif; ?>
|
180 |
-
|
181 |
-
<?php if ( ! empty($data['HelpURI']) ) : ?>
|
182 |
-
<li><a href="<?php echo $data['HelpURI']; ?>" class="help" target="_blank"><?php _e('Support Forum', 'akfw'); ?></a></li>
|
183 |
-
<?php endif; ?>
|
184 |
-
|
185 |
-
<?php if ( ! empty($data['AuthorURI']) ) : ?>
|
186 |
-
<li><a href="<?php echo $data['AuthorURI']; ?>" class="home" target="_blank"><?php _e('Author Homepage', 'akfw')?></a></li>
|
187 |
-
<?php endif; ?>
|
188 |
-
|
189 |
-
<?php if ( ! empty($data['DonateURI']) ) : ?>
|
190 |
-
<li><a href="<?php echo $data['DonateURI']; ?>" class="donate" target="_blank"><?php _e('Donate to project', 'akfw')?></a></li>
|
191 |
-
<?php endif; ?>
|
192 |
-
-->
|
193 |
-
</ul>
|
194 |
-
</dd>
|
195 |
-
</dl>
|
196 |
-
<?php
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Copyright, authoring and versions for admin pages footer.
|
201 |
-
*
|
202 |
-
* @since 0.5
|
203 |
-
*
|
204 |
-
* @param string $mod_id Module ID
|
205 |
-
* @param int $year First copyrigh year.
|
206 |
-
* @return void
|
207 |
-
*/
|
208 |
-
function ak_admin_footer ( $mod_id, $year = 2009 )
|
209 |
-
{
|
210 |
-
$mod = ak_get_object($mod_id);
|
211 |
-
if ( ! $mod ) {
|
212 |
-
return;
|
213 |
-
}
|
214 |
-
$data = $mod->getModData();
|
215 |
-
|
216 |
-
if ( $mod->isPlugin() || $mod->isComponent() ) {
|
217 |
-
echo '<p class="footer"><a href="' . $mod->getModData('PluginURI') . '">' . $mod->getModData('Name') . ' ' . $mod->getModData('Version') .
|
218 |
-
'</a> | © Copyright ';
|
219 |
-
if ( 2010 != $year ) {
|
220 |
-
echo $year . '-';
|
221 |
-
}
|
222 |
-
echo '2010 Jordi Canals';
|
223 |
-
echo ' | ';
|
224 |
-
|
225 |
-
$_year = '2013';
|
226 |
-
if ( 2013 != $year ) {
|
227 |
-
$_year . '-' . $year ;
|
228 |
-
}
|
229 |
-
|
230 |
-
echo 'Modifications © Copyright ' . $_year . ' <a href="http://agapetry.net">Kevin Behrens</a>'; // todo: translation, date formatting
|
231 |
-
|
232 |
-
} elseif ( $mod->isTheme() ) {
|
233 |
-
echo '<p class="footer"><a href="' . $mod->getModData('URI') . '">' . $mod->getModData('Name') . ' ' . $mod->getModData('Version') .
|
234 |
-
'</a> © Copyright ';
|
235 |
-
if ( 2010 != $year ) {
|
236 |
-
echo $year . '-';
|
237 |
-
}
|
238 |
-
echo date('Y') . ' ';
|
239 |
-
echo $mod->getModData('Author');
|
240 |
-
}
|
241 |
-
|
242 |
-
//echo ' | Framework Version: ' . get_option('ak_framework_version');
|
243 |
-
if ( $mod->isChildTheme() ) {
|
244 |
-
echo ' - Child theme: ' . $mod->getChildData('Name') . ' ' . $mod->getChildData('Version');
|
245 |
-
}
|
246 |
-
if ( $mod->isComponent() ) {
|
247 |
-
echo ' - Component: ' . $mod->getChildData('Name') . ' ' . $mod->getChildData('Version');
|
248 |
-
}
|
249 |
-
|
250 |
-
echo '</p>';
|
251 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/lib/users.php
CHANGED
@@ -26,17 +26,6 @@
|
|
26 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*/
|
28 |
|
29 |
-
/**
|
30 |
-
* Gets current user ID.
|
31 |
-
*
|
32 |
-
* @return int Current user ID or 0 if not logged in.
|
33 |
-
*/
|
34 |
-
function ak_current_user_id ()
|
35 |
-
{
|
36 |
-
$user = wp_get_current_user();
|
37 |
-
return $user->id;
|
38 |
-
}
|
39 |
-
|
40 |
/**
|
41 |
* Returns all valid roles.
|
42 |
* The returned list can be translated or not.
|
@@ -67,29 +56,6 @@ function ak_get_roles( $translate = false ) {
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
/**
|
71 |
-
* Return the user role. Taken from WordPress roles and Capabilities.
|
72 |
-
*
|
73 |
-
* @since 0.5
|
74 |
-
*
|
75 |
-
* @param int|object $user_ID User ID or the user object to find the role.
|
76 |
-
* @return string User role in this blog (key, not translated).
|
77 |
-
*/
|
78 |
-
function ak_get_user_role( $user ) {
|
79 |
-
global $wpdb, $wp_roles;
|
80 |
-
if ( ! isset( $wp_roles ) ) {
|
81 |
-
$wp_roles = new WP_Roles();
|
82 |
-
}
|
83 |
-
$caps_name = $wpdb->prefix . 'capabilities';
|
84 |
-
|
85 |
-
if ( ! is_object($user) ) {
|
86 |
-
$user = get_userdata($user);
|
87 |
-
}
|
88 |
-
$roles = array_filter( array_keys( (array) $user->$caps_name ), array( &$wp_roles, 'is_role' ) );
|
89 |
-
|
90 |
-
return array_pop($roles);
|
91 |
-
}
|
92 |
-
|
93 |
/**
|
94 |
* Generates the caps names from user level.
|
95 |
*
|
@@ -103,7 +69,7 @@ function ak_level2caps( $level ) {
|
|
103 |
$level = min(10, intval($level));
|
104 |
|
105 |
for ( $i = $level; $i >= 0; $i--) {
|
106 |
-
$caps["level_{$i}"] =
|
107 |
}
|
108 |
|
109 |
return $caps;
|
26 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*/
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Returns all valid roles.
|
31 |
* The returned list can be translated or not.
|
56 |
}
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* Generates the caps names from user level.
|
61 |
*
|
69 |
$level = min(10, intval($level));
|
70 |
|
71 |
for ( $i = $level; $i >= 0; $i--) {
|
72 |
+
$caps["level_{$i}"] = true;
|
73 |
}
|
74 |
|
75 |
return $caps;
|
framework/loader.php
CHANGED
@@ -27,45 +27,6 @@
|
|
27 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
*/
|
29 |
|
30 |
-
//
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$akf_version = '0.8';
|
35 |
-
|
36 |
-
if ( file_exists(WP_CONTENT_DIR . '/alkivia.php') ) {
|
37 |
-
/** Loads alkivia.php to override some default constants */
|
38 |
-
include_once( WP_CONTENT_DIR . '/alkivia.php');
|
39 |
-
}
|
40 |
-
|
41 |
-
// Check version for installs and updates.
|
42 |
-
$akf_current = get_option('ak_framework_version');
|
43 |
-
$akf_path = dirname(__FILE__);
|
44 |
-
|
45 |
-
if ( false === $akf_current ) {
|
46 |
-
// Install the framework. Save version and path.
|
47 |
-
add_option('ak_framework_version', $akf_version);
|
48 |
-
add_option('ak_framework_path', $akf_path);
|
49 |
-
} elseif ( version_compare($akf_version, $akf_current, '>') ) {
|
50 |
-
// Update framework if newer. Save version and path.
|
51 |
-
update_option('ak_framework_version', $akf_version);
|
52 |
-
update_option('ak_framework_path', $akf_path);
|
53 |
-
} else {
|
54 |
-
// Using installed version.
|
55 |
-
$akf_db_path = get_option('ak_framework_path');
|
56 |
-
if ( false !== $akf_db_path && is_dir($akf_db_path) ) {
|
57 |
-
// Only use current if still present. Could be from an uninstalled plugin.
|
58 |
-
$akf_path = $akf_db_path;
|
59 |
-
} else {
|
60 |
-
// If installed version not present, use current.
|
61 |
-
update_option('ak_framework_version', $akf_version);
|
62 |
-
update_option('ak_framework_path', $akf_path);
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
if ( ! defined('AK_FRAMEWORK') ) {
|
67 |
-
// Define the framework path.
|
68 |
-
define ('AK_FRAMEWORK', $akf_path );
|
69 |
-
}
|
70 |
-
|
71 |
-
include_once( AK_FRAMEWORK . '/init.php');
|
27 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
*/
|
29 |
|
30 |
+
// Define the framework path.
|
31 |
+
define ('AKK_FRAMEWORK', dirname(__FILE__) );
|
32 |
+
include_once( AKK_FRAMEWORK . '/init.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/samples/alkivia.ini
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
; $Id: alkivia.ini 203758 2010-02-10 19:01:07Z Txanny $
|
2 |
-
|
3 |
-
; If you set this file on your wp-content directory, it will override the module
|
4 |
-
; options, force to use this ones and disable them from the admin page.
|
5 |
-
|
6 |
-
; All alkivia plugins and themes share the same file. If you already have an
|
7 |
-
; alkivia.ini file in your wp-content directory, you can copy and paste this
|
8 |
-
; settings on it.
|
9 |
-
|
10 |
-
; The ini file is mostly used on WordPress MU, when we want to force all blogs to
|
11 |
-
; this settings and don't want to allow the blog administrators to change them.
|
12 |
-
|
13 |
-
; This settings are available to any theme or plugin that uses the framework,
|
14 |
-
; just have to write this settings on the plugin or theme section.
|
15 |
-
;
|
16 |
-
; More information at http://wiki.alkivia.org/framework/ini-file
|
17 |
-
;
|
18 |
-
|
19 |
-
[for_all]
|
20 |
-
|
21 |
-
; disable-admin-page = Off
|
22 |
-
|
23 |
-
[for_plugins]
|
24 |
-
|
25 |
-
; disable-module-styles = Off
|
26 |
-
; style-url = "http://example.com/styles/style.css"
|
27 |
-
; disable-components-activation = Off
|
28 |
-
|
29 |
-
[for_themes]
|
30 |
-
|
31 |
-
; disable-favicon = Off
|
32 |
-
; favicon-url = "http://sample.com/images/favicon.ico"
|
33 |
-
; enable-self-ping = Off
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/samples/alkivia.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Alkivia paths.
|
4 |
-
* You can locate this file on your wp-content directopry if you want to
|
5 |
-
* override the framework location or if you want to point to custom
|
6 |
-
* 'alkivia.ini' location.
|
7 |
-
*
|
8 |
-
* @version $Rev: 198515 $
|
9 |
-
* @author Jordi Canals
|
10 |
-
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
|
11 |
-
* @license GNU General Public License version 2
|
12 |
-
* @link http://alkivia.org
|
13 |
-
* @package Alkivia
|
14 |
-
* @subpackage Framework
|
15 |
-
*
|
16 |
-
|
17 |
-
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
18 |
-
|
19 |
-
This program is free software; you can redistribute it and/or
|
20 |
-
modify it under the terms of the GNU General Public License
|
21 |
-
version 2 as published by the Free Software Foundation.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
|
32 |
-
/** Override the absolute path to Alkivia Framework
|
33 |
-
* If you move the framework outside the wp_content folder,
|
34 |
-
* You will have to define AK_STYLES_URL and set the styles folder
|
35 |
-
* in a server public place.
|
36 |
-
*
|
37 |
-
* @link http://wiki.alkivia.org/framework/config-file
|
38 |
-
*/
|
39 |
-
// define ('AK_FRAMEWORK', '/home/my_user/my_root/wp_content/plugins/my_plugin/framework'
|
40 |
-
|
41 |
-
/** Overrides the default 'alkivia.ini' location. */
|
42 |
-
// define ( 'AK_INI_FILE', dirname(__FILE__) . '/alkivia.ini');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/styles/.htaccess
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
# Prevent running or accessing any file directly.
|
2 |
-
|
3 |
-
Order Deny,Allow
|
4 |
-
Allow from all
|
|
|
|
|
|
|
|
framework/styles/admin.css
CHANGED
@@ -117,13 +117,13 @@ table#akmin td.content {
|
|
117 |
|
118 |
table#akmin td.content dd {
|
119 |
margin: 0;
|
120 |
-
padding: 10px
|
121 |
}
|
122 |
|
123 |
/* ====================================================== ADMIN SIDEBAR */
|
124 |
|
125 |
table#akmin td.sidebar {
|
126 |
-
width:
|
127 |
padding: 0 0 0 8px;
|
128 |
}
|
129 |
|
@@ -163,11 +163,8 @@ td.sidebar a.help {
|
|
163 |
}
|
164 |
|
165 |
td.sidebar a.home {
|
166 |
-
background-image: url('images/alkivia.png');
|
167 |
-
}
|
168 |
|
169 |
-
td.sidebar a.donate {
|
170 |
-
background-image: url('images/paypal.png');
|
171 |
}
|
|
|
172 |
|
173 |
/* EOF */
|
117 |
|
118 |
table#akmin td.content dd {
|
119 |
margin: 0;
|
120 |
+
padding: 10px;
|
121 |
}
|
122 |
|
123 |
/* ====================================================== ADMIN SIDEBAR */
|
124 |
|
125 |
table#akmin td.sidebar {
|
126 |
+
width: 250px;
|
127 |
padding: 0 0 0 8px;
|
128 |
}
|
129 |
|
163 |
}
|
164 |
|
165 |
td.sidebar a.home {
|
|
|
|
|
166 |
|
|
|
|
|
167 |
}
|
168 |
+
|
169 |
|
170 |
/* EOF */
|
framework/styles/images/alkivia.png
DELETED
Binary file
|
framework/styles/images/paypal.png
DELETED
Binary file
|
framework/vendor/upload/class.upload.php
DELETED
@@ -1,4752 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// $Rev: 203758 $
|
4 |
-
|
5 |
-
// +------------------------------------------------------------------------+
|
6 |
-
// | class.upload.php |
|
7 |
-
// +------------------------------------------------------------------------+
|
8 |
-
// | Copyright (c) Colin Verot 2003-2009. All rights reserved. |
|
9 |
-
// | Version 0.29 |
|
10 |
-
// | Last modified 03/02/2010 |
|
11 |
-
// | Email colin@verot.net |
|
12 |
-
// | Web http://www.verot.net |
|
13 |
-
// +------------------------------------------------------------------------+
|
14 |
-
// | This program is free software; you can redistribute it and/or modify |
|
15 |
-
// | it under the terms of the GNU General Public License version 2 as |
|
16 |
-
// | published by the Free Software Foundation. |
|
17 |
-
// | |
|
18 |
-
// | This program is distributed in the hope that it will be useful, |
|
19 |
-
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
-
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
-
// | GNU General Public License for more details. |
|
22 |
-
// | |
|
23 |
-
// | You should have received a copy of the GNU General Public License |
|
24 |
-
// | along with this program; if not, write to the |
|
25 |
-
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
|
26 |
-
// | Boston, MA 02111-1307 USA |
|
27 |
-
// | |
|
28 |
-
// | Please give credit on sites that use class.upload and submit changes |
|
29 |
-
// | of the script so other people can use them as well. |
|
30 |
-
// | This script is free to use, don't abuse. |
|
31 |
-
// +------------------------------------------------------------------------+
|
32 |
-
//
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Class akUpload
|
36 |
-
*
|
37 |
-
* @version 0.29
|
38 |
-
* @author Colin Verot <colin@verot.net>
|
39 |
-
* @license GNU Public License version 2
|
40 |
-
* @copyright Colin Verot
|
41 |
-
* @package Alkivia
|
42 |
-
* @subpackage External
|
43 |
-
*/
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Class akUpload
|
47 |
-
*
|
48 |
-
* <b>What does it do?</b>
|
49 |
-
*
|
50 |
-
* It manages file uploads for you. In short, it manages the uploaded file,
|
51 |
-
* and allows you to do whatever you want with the file, especially if it
|
52 |
-
* is an image, and as many times as you want.
|
53 |
-
*
|
54 |
-
* It is the ideal class to quickly integrate file upload in your site.
|
55 |
-
* If the file is an image, you can convert, resize, crop it in many ways.
|
56 |
-
* You can also apply filters, add borders, text, watermarks, etc...
|
57 |
-
* That's all you need for a gallery script for instance. Supported formats
|
58 |
-
* are PNG, JPG, GIF and BMP.
|
59 |
-
*
|
60 |
-
* You can also use the class to work on local files, which is especially
|
61 |
-
* useful to use the image manipulation features. The class also supports
|
62 |
-
* Flash uploaders.
|
63 |
-
*
|
64 |
-
* The class works with PHP 4 and 5, and its error messages can
|
65 |
-
* be localized at will.
|
66 |
-
*
|
67 |
-
* <b>How does it work?</b>
|
68 |
-
*
|
69 |
-
* You instanciate the class with the $_FILES['my_field'] array
|
70 |
-
* where my_field is the field name from your upload form.
|
71 |
-
* The class will check if the original file has been uploaded
|
72 |
-
* to its temporary location (alternatively, you can instanciate
|
73 |
-
* the class with a local filename).
|
74 |
-
*
|
75 |
-
* You can then set a number of processing variables to act on the file.
|
76 |
-
* For instance, you can rename the file, and if it is an image,
|
77 |
-
* convert and resize it in many ways.
|
78 |
-
* You can also set what will the class do if the file already exists.
|
79 |
-
*
|
80 |
-
* Then you call the function {@link process} to actually perform the actions
|
81 |
-
* according to the processing parameters you set above.
|
82 |
-
* It will create new instances of the original file,
|
83 |
-
* so the original file remains the same between each process.
|
84 |
-
* The file will be manipulated, and copied to the given location.
|
85 |
-
* The processing variables will be reset once it is done.
|
86 |
-
*
|
87 |
-
* You can repeat setting up a new set of processing variables,
|
88 |
-
* and calling {@link process} again as many times as you want.
|
89 |
-
* When you have finished, you can call {@link clean} to delete
|
90 |
-
* the original uploaded file.
|
91 |
-
*
|
92 |
-
* If you don't set any processing parameters and call {@link process}
|
93 |
-
* just after instanciating the class. The uploaded file will be simply
|
94 |
-
* copied to the given location without any alteration or checks.
|
95 |
-
*
|
96 |
-
* Don't forget to add <i>enctype="multipart/form-data"</i> in your form
|
97 |
-
* tag <form> if you want your form to upload the file.
|
98 |
-
*
|
99 |
-
* <b>How to use it?</b><br>
|
100 |
-
* Create a simple HTML file, with a form such as:
|
101 |
-
* <pre>
|
102 |
-
* <form enctype="multipart/form-data" method="post" action="upload.php">
|
103 |
-
* <input type="file" size="32" name="image_field" value="">
|
104 |
-
* <input type="submit" name="Submit" value="upload">
|
105 |
-
* </form>
|
106 |
-
* </pre>
|
107 |
-
* Create a file called upload.php:
|
108 |
-
* <pre>
|
109 |
-
* $handle = new upload($_FILES['image_field']);
|
110 |
-
* if ($handle->uploaded) {
|
111 |
-
* $handle->file_new_name_body = 'image_resized';
|
112 |
-
* $handle->image_resize = true;
|
113 |
-
* $handle->image_x = 100;
|
114 |
-
* $handle->image_ratio_y = true;
|
115 |
-
* $handle->process('/home/user/files/');
|
116 |
-
* if ($handle->processed) {
|
117 |
-
* echo 'image resized';
|
118 |
-
* $handle->clean();
|
119 |
-
* } else {
|
120 |
-
* echo 'error : ' . $handle->error;
|
121 |
-
* }
|
122 |
-
* }
|
123 |
-
* </pre>
|
124 |
-
*
|
125 |
-
* <b>How to process local files?</b><br>
|
126 |
-
* Use the class as following, the rest being the same as above:
|
127 |
-
* <pre>
|
128 |
-
* $handle = new upload('/home/user/myfile.jpg');
|
129 |
-
* </pre>
|
130 |
-
*
|
131 |
-
* <b>How to set the language?</b><br>
|
132 |
-
* Instantiate the class with a second argument being the language code:
|
133 |
-
* <pre>
|
134 |
-
* $handle = new upload($_FILES['image_field'], 'fr_FR');
|
135 |
-
* $handle = new upload('/home/user/myfile.jpg', 'fr_FR');
|
136 |
-
* </pre>
|
137 |
-
*
|
138 |
-
* <b>How to output the resulting file or picture directly to the browser?</b><br>
|
139 |
-
* Simply call {@link process}() without an argument (or with null as first argument):
|
140 |
-
* <pre>
|
141 |
-
* $handle = new upload($_FILES['image_field']);
|
142 |
-
* header('Content-type: ' . $handle->file_src_mime);
|
143 |
-
* echo $handle->Process();
|
144 |
-
* die();
|
145 |
-
* </pre>
|
146 |
-
* Or if you want to force the download of the file:
|
147 |
-
* <pre>
|
148 |
-
* $handle = new upload($_FILES['image_field']);
|
149 |
-
* header('Content-type: ' . $handle->file_src_mime);
|
150 |
-
* header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";");
|
151 |
-
* echo $handle->Process();
|
152 |
-
* die();
|
153 |
-
* </pre>
|
154 |
-
*
|
155 |
-
* <b>Processing parameters</b> (reset after each process)
|
156 |
-
* <ul>
|
157 |
-
* <li><b>file_new_name_body</b> replaces the name body (default: '')<br>
|
158 |
-
* <pre>$handle->file_new_name_body = 'new name';</pre></li>
|
159 |
-
* <li><b>file_name_body_add</b> appends to the name body (default: '')<br>
|
160 |
-
* <pre>$handle->file_name_body_add = '_uploaded';</pre></li>
|
161 |
-
* <li><b>file_name_body_pre</b> prepends to the name body (default: '')<br>
|
162 |
-
* <pre>$handle->file_name_body_pre = 'thumb_';</pre></li>
|
163 |
-
* <li><b>file_new_name_ext</b> replaces the file extension (default: '')<br>
|
164 |
-
* <pre>$handle->file_new_name_ext = 'txt';</pre></li>
|
165 |
-
* <li><b>file_safe_name</b> formats the filename (spaces changed to _) (default: true)<br>
|
166 |
-
* <pre>$handle->file_safe_name = true;</pre></li>
|
167 |
-
* <li><b>file_overwrite</b> sets behaviour if file already exists (default: false)<br>
|
168 |
-
* <pre>$handle->file_overwrite = true;</pre></li>
|
169 |
-
* <li><b>file_auto_rename</b> automatically renames file if it already exists (default: true)<br>
|
170 |
-
* <pre>$handle->file_auto_rename = true;</pre></li>
|
171 |
-
* <li><b>auto_create_dir</b> automatically creates destination directory if missing (default: true)<br>
|
172 |
-
* <pre>$handle->auto_create_dir = true;</pre></li>
|
173 |
-
* <li><b>dir_auto_chmod</b> automatically attempts to chmod the destination directory if not writeable (default: true)<br>
|
174 |
-
* <pre>$handle->dir_auto_chmod = true;</pre></li>
|
175 |
-
* <li><b>dir_chmod</b> chmod used when creating directory or if directory not writeable (default: 0777)<br>
|
176 |
-
* <pre>$handle->dir_chmod = 0777;</pre></li>
|
177 |
-
* <li><b>file_max_size</b> sets maximum upload size (default: upload_max_filesize from php.ini)<br>
|
178 |
-
* <pre>$handle->file_max_size = '1024'; // 1KB</pre></li>
|
179 |
-
* <li><b>mime_check</b> sets if the class check the MIME against the {@link allowed} list (default: true)<br>
|
180 |
-
* <pre>$handle->mime_check = true;</pre></li>
|
181 |
-
* <li><b>no_script</b> sets if the class turns scripts into text files (default: true)<br>
|
182 |
-
* <pre>$handle->no_script = false;</pre></li>
|
183 |
-
* <li><b>allowed</b> array of allowed mime-types. wildcard accepted, as in image/* (default: check {@link Init})<br>
|
184 |
-
* <pre>$handle->allowed = array('application/pdf','application/msword', 'image/*');</pre></li>
|
185 |
-
* <li><b>forbidden</b> array of forbidden mime-types. wildcard accepted, as in image/* (default: check {@link Init})<br>
|
186 |
-
* <pre>$handle->forbidden = array('application/*');</pre></li>
|
187 |
-
* </ul>
|
188 |
-
* <ul>
|
189 |
-
* <li><b>image_convert</b> if set, image will be converted (possible values : ''|'png'|'jpeg'|'gif'|'bmp'; default: '')<br>
|
190 |
-
* <pre>$handle->image_convert = 'jpg';</pre></li>
|
191 |
-
* <li><b>image_background_color</b> if set, will forcibly fill transparent areas with the color, in hexadecimal (default: null)<br>
|
192 |
-
* <pre>$handle->image_background_color = '#FF00FF';</pre></li>
|
193 |
-
* <li><b>image_default_color</b> fallback color background color for non alpha-transparent output formats, such as JPEG or BMP, in hexadecimal (default: #FFFFFF)<br>
|
194 |
-
* <pre>$handle->image_default_color = '#FF00FF';</pre></li>
|
195 |
-
* <li><b>jpeg_quality</b> sets the compression quality for JPEG images (default: 85)<br>
|
196 |
-
* <pre>$handle->jpeg_quality = 50;</pre></li>
|
197 |
-
* <li><b>jpeg_size</b> if set to a size in bytes, will approximate {@link jpeg_quality} so the output image fits within the size (default: null)<br>
|
198 |
-
* <pre>$handle->jpeg_size = 3072;</pre></li>
|
199 |
-
* </ul>
|
200 |
-
* The following eight settings can be used to invalidate an upload if the file is an image (note that <i>open_basedir</i> restrictions prevent the use of these settings)
|
201 |
-
* <ul>
|
202 |
-
* <li><b>image_max_width</b> if set to a dimension in pixels, the upload will be invalid if the image width is greater (default: null)<br>
|
203 |
-
* <pre>$handle->image_max_width = 200;</pre></li>
|
204 |
-
* <li><b>image_max_height</b> if set to a dimension in pixels, the upload will be invalid if the image height is greater (default: null)<br>
|
205 |
-
* <pre>$handle->image_max_height = 100;</pre></li>
|
206 |
-
* <li><b>image_max_pixels</b> if set to a number of pixels, the upload will be invalid if the image number of pixels is greater (default: null)<br>
|
207 |
-
* <pre>$handle->image_max_pixels = 50000;</pre></li>
|
208 |
-
* <li><b>image_max_ratio</b> if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is greater (default: null)<br>
|
209 |
-
* <pre>$handle->image_max_ratio = 1.5;</pre></li>
|
210 |
-
* <li><b>image_min_width</b> if set to a dimension in pixels, the upload will be invalid if the image width is lower (default: null)<br>
|
211 |
-
* <pre>$handle->image_min_width = 100;</pre></li>
|
212 |
-
* <li><b>image_min_height</b> if set to a dimension in pixels, the upload will be invalid if the image height is lower (default: null)<br>
|
213 |
-
* <pre>$handle->image_min_height = 500;</pre></li>
|
214 |
-
* <li><b>image_min_pixels</b> if set to a number of pixels, the upload will be invalid if the image number of pixels is lower (default: null)<br>
|
215 |
-
* <pre>$handle->image_min_pixels = 20000;</pre></li>
|
216 |
-
* <li><b>image_min_ratio</b> if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is lower (default: null)<br>
|
217 |
-
* <pre>$handle->image_min_ratio = 0.5;</pre></li>
|
218 |
-
* </ul>
|
219 |
-
* <ul>
|
220 |
-
* <li><b>image_resize</b> determines is an image will be resized (default: false)<br>
|
221 |
-
* <pre>$handle->image_resize = true;</pre></li>
|
222 |
-
* </ul>
|
223 |
-
* The following variables are used only if {@link image_resize} == true
|
224 |
-
* <ul>
|
225 |
-
* <li><b>image_x</b> destination image width (default: 150)<br>
|
226 |
-
* <pre>$handle->image_x = 100;</pre></li>
|
227 |
-
* <li><b>image_y</b> destination image height (default: 150)<br>
|
228 |
-
* <pre>$handle->image_y = 200;</pre></li>
|
229 |
-
* </ul>
|
230 |
-
* Use either one of the following
|
231 |
-
* <ul>
|
232 |
-
* <li><b>image_ratio</b> if true, resize image conserving the original sizes ratio, using {@link image_x} AND {@link image_y} as max sizes if true (default: false)<br>
|
233 |
-
* <pre>$handle->image_ratio = true;</pre></li>
|
234 |
-
* <li><b>image_ratio_crop</b> if true, resize image conserving the original sizes ratio, using {@link image_x} AND {@link image_y} as max sizes, and cropping excedent to fill the space. setting can also be a string, with one or more from 'TBLR', indicating which side of the image will be kept while cropping (default: false)<br>
|
235 |
-
* <pre>$handle->image_ratio_crop = true;</pre></li>
|
236 |
-
* <li><b>image_ratio_fill</b> if true, resize image conserving the original sizes ratio, using {@link image_x} AND {@link image_y} as max sizes, fitting the image in the space and coloring the remaining space. setting can also be a string, with one or more from 'TBLR', indicating which side of the space the image will be in (default: false)<br>
|
237 |
-
* <pre>$handle->image_ratio_fill = true;</pre></li>
|
238 |
-
* <li><b>image_ratio_no_zoom_in</b> same as {@link image_ratio}, but won't resize if the source image is smaller than {@link image_x} x {@link image_y} (default: false)<br>
|
239 |
-
* <pre>$handle->image_ratio_no_zoom_in = true;</pre></li>
|
240 |
-
* <li><b>image_ratio_no_zoom_out</b> same as {@link image_ratio}, but won't resize if the source image is bigger than {@link image_x} x {@link image_y} (default: false)<br>
|
241 |
-
* <pre>$handle->image_ratio_no_zoom_out = true;</pre></li>
|
242 |
-
* <li><b>image_ratio_x</b> if true, resize image, calculating {@link image_x} from {@link image_y} and conserving the original sizes ratio (default: false)<br>
|
243 |
-
* <pre>$handle->image_ratio_x = true;</pre></li>
|
244 |
-
* <li><b>image_ratio_y</b> if true, resize image, calculating {@link image_y} from {@link image_x} and conserving the original sizes ratio (default: false)<br>
|
245 |
-
* <pre>$handle->image_ratio_y = true;</pre></li>
|
246 |
-
* <li><b>image_ratio_pixels</b> if set to a long integer, resize image, calculating {@link image_y} and {@link image_x} to match a the number of pixels (default: false)<br>
|
247 |
-
* <pre>$handle->image_ratio_pixels = 25000;</pre></li>
|
248 |
-
* </ul>
|
249 |
-
* The following image manipulations require GD2+
|
250 |
-
* <ul>
|
251 |
-
* <li><b>image_brightness</b> if set, corrects the brightness. value between -127 and 127 (default: null)<br>
|
252 |
-
* <pre>$handle->image_brightness = 40;</pre></li>
|
253 |
-
* <li><b>image_contrast</b> if set, corrects the contrast. value between -127 and 127 (default: null)<br>
|
254 |
-
* <pre>$handle->image_contrast = 50;</pre></li>
|
255 |
-
* <li><b>image_tint_color</b> if set, will tint the image with a color, value as hexadecimal #FFFFFF (default: null)<br>
|
256 |
-
* <pre>$handle->image_tint_color = '#FF0000';</pre></li>
|
257 |
-
* <li><b>image_overlay_color</b> if set, will add a colored overlay, value as hexadecimal #FFFFFF (default: null)<br>
|
258 |
-
* <pre>$handle->image_overlay_color = '#FF0000';</pre></li>
|
259 |
-
* <li><b>image_overlay_percent</b> used when {@link image_overlay_color} is set, determines the opacity (default: 50)<br>
|
260 |
-
* <pre>$handle->image_overlay_percent = 20;</pre></li>
|
261 |
-
* <li><b>image_negative</b> inverts the colors in the image (default: false)<br>
|
262 |
-
* <pre>$handle->image_negative = true;</pre></li>
|
263 |
-
* <li><b>image_greyscale</b> transforms an image into greyscale (default: false)<br>
|
264 |
-
* <pre>$handle->image_greyscale = true;</pre></li>
|
265 |
-
* <li><b>image_threshold</b> applies a threshold filter. value between -127 and 127 (default: null)<br>
|
266 |
-
* <pre>$handle->image_threshold = 20;</pre></li>
|
267 |
-
* </ul>
|
268 |
-
* <ul>
|
269 |
-
* <li><b>image_text</b> creates a text label on the image, value is a string, with eventual replacement tokens (default: null)<br>
|
270 |
-
* <pre>$handle->image_text = 'test';</pre></li>
|
271 |
-
* <li><b>image_text_direction</b> text label direction, either 'h' horizontal or 'v' vertical (default: 'h')<br>
|
272 |
-
* <pre>$handle->image_text_direction = 'v';</pre></li>
|
273 |
-
* <li><b>image_text_color</b> text color for the text label, in hexadecimal (default: #FFFFFF)<br>
|
274 |
-
* <pre>$handle->image_text_color = '#FF0000';</pre></li>
|
275 |
-
* <li><b>image_text_percent</b> text opacity on the text label, integer between 0 and 100 (default: 100)<br>
|
276 |
-
* <pre>$handle->image_text_percent = 50;</pre></li>
|
277 |
-
* <li><b>image_text_background</b> text label background color, in hexadecimal (default: null)<br>
|
278 |
-
* <pre>$handle->image_text_background = '#FFFFFF';</pre></li>
|
279 |
-
* <li><b>image_text_background_percent</b> text label background opacity, integer between 0 and 100 (default: 100)<br>
|
280 |
-
* <pre>$handle->image_text_background_percent = 50;</pre></li>
|
281 |
-
* <li><b>image_text_font</b> built-in font for the text label, from 1 to 5. 1 is the smallest (default: 5)<br>
|
282 |
-
* <pre>$handle->image_text_font = 4;</pre></li>
|
283 |
-
* <li><b>image_text_x</b> absolute text label position, in pixels from the left border. can be negative (default: null)<br>
|
284 |
-
* <pre>$handle->image_text_x = 5;</pre></li>
|
285 |
-
* <li><b>image_text_y</b> absolute text label position, in pixels from the top border. can be negative (default: null)<br>
|
286 |
-
* <pre>$handle->image_text_y = 5;</pre></li>
|
287 |
-
* <li><b>image_text_position</b> text label position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)<br>
|
288 |
-
* <pre>$handle->image_text_position = 'LR';</pre></li>
|
289 |
-
* <li><b>image_text_padding</b> text label padding, in pixels. can be overridden by {@link image_text_padding_x} and {@link image_text_padding_y} (default: 0)<br>
|
290 |
-
* <pre>$handle->image_text_padding = 5;</pre></li>
|
291 |
-
* <li><b>image_text_padding_x</b> text label horizontal padding (default: null)<br>
|
292 |
-
* <pre>$handle->image_text_padding_x = 2;</pre></li>
|
293 |
-
* <li><b>image_text_padding_y</b> text label vertical padding (default: null)<br>
|
294 |
-
* <pre>$handle->image_text_padding_y = 10;</pre></li>
|
295 |
-
* <li><b>image_text_alignment</b> text alignment when text has multiple lines, either 'L', 'C' or 'R' (default: 'C')<br>
|
296 |
-
* <pre>$handle->image_text_alignment = 'R';</pre></li>
|
297 |
-
* <li><b>image_text_line_spacing</b> space between lines in pixels, when text has multiple lines (default: 0)<br>
|
298 |
-
* <pre>$handle->image_text_line_spacing = 3;</pre></li>
|
299 |
-
* </ul>
|
300 |
-
* <ul>
|
301 |
-
* <li><b>image_flip</b> flips image, wither 'h' horizontal or 'v' vertical (default: null)<br>
|
302 |
-
* <pre>$handle->image_flip = 'h';</pre></li>
|
303 |
-
* <li><b>image_rotate</b> rotates image. possible values are 90, 180 and 270 (default: null)<br>
|
304 |
-
* <pre>$handle->image_rotate = 90;</pre></li>
|
305 |
-
* <li><b>image_crop</b> crops image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)<br>
|
306 |
-
* <pre>$handle->image_crop = array(50,40,30,20); OR '-20 20%'...</pre></li>
|
307 |
-
* <li><b>image_precrop</b> crops image, before an eventual resizing. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)<br>
|
308 |
-
* <pre>$handle->image_precrop = array(50,40,30,20); OR '-20 20%'...</pre></li>
|
309 |
-
* </ul>
|
310 |
-
* <ul>
|
311 |
-
* <li><b>image_bevel</b> adds a bevel border to the image. value is thickness in pixels (default: null)<br>
|
312 |
-
* <pre>$handle->image_bevel = 20;</pre></li>
|
313 |
-
* <li><b>image_bevel_color1</b> top and left bevel color, in hexadecimal (default: #FFFFFF)<br>
|
314 |
-
* <pre>$handle->image_bevel_color1 = '#FFFFFF';</pre></li>
|
315 |
-
* <li><b>image_bevel_color2</b> bottom and right bevel color, in hexadecimal (default: #000000)<br>
|
316 |
-
* <pre>$handle->image_bevel_color2 = '#000000';</pre></li>
|
317 |
-
* <li><b>image_border</b> adds a unicolor border to the image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)<br>
|
318 |
-
* <pre>$handle->image_border = '3px'; OR '-20 20%' OR array(3,2)...</pre></li>
|
319 |
-
* <li><b>image_border_color</b> border color, in hexadecimal (default: #FFFFFF)<br>
|
320 |
-
* <pre>$handle->image_border_color = '#FFFFFF';</pre></li>
|
321 |
-
* <li><b>image_frame</b> type of frame: 1=flat 2=crossed (default: null)<br>
|
322 |
-
* <pre>$handle->image_frame = 2;</pre></li>
|
323 |
-
* <li><b>image_frame_colors</b> list of hex colors, in an array or a space separated string (default: '#FFFFFF #999999 #666666 #000000')<br>
|
324 |
-
* <pre>$handle->image_frame_colors = array('#999999', '#FF0000', '#666666', '#333333', '#000000');</pre></li>
|
325 |
-
* </ul>
|
326 |
-
* <ul>
|
327 |
-
* <li><b>image_watermark</b> adds a watermark on the image, value is a local filename. accepted files are GIF, JPG, BMP, PNG and PNG alpha (default: null)<br>
|
328 |
-
* <pre>$handle->image_watermark = 'watermark.png';</pre></li>
|
329 |
-
* <li><b>image_watermark_x</b> absolute watermark position, in pixels from the left border. can be negative (default: null)<br>
|
330 |
-
* <pre>$handle->image_watermark_x = 5;</pre></li>
|
331 |
-
* <li><b>image_watermark_y</b> absolute watermark position, in pixels from the top border. can be negative (default: null)<br>
|
332 |
-
* <pre>$handle->image_watermark_y = 5;</pre></li>
|
333 |
-
* <li><b>image_watermark_position</b> watermark position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)<br>
|
334 |
-
* <pre>$handle->image_watermark_position = 'LR';</pre></li>
|
335 |
-
* </ul>
|
336 |
-
* <ul>
|
337 |
-
* <li><b>image_reflection_height</b> if set, a reflection will be added. Format is either in pixels or percentage, such as 40, '40', '40px' or '40%' (default: null)<br>
|
338 |
-
* <pre>$handle->image_reflection_height = '25%';</pre></li>
|
339 |
-
* <li><b>image_reflection_space</b> space in pixels between the source image and the reflection, can be negative (default: null)<br>
|
340 |
-
* <pre>$handle->image_reflection_space = 3;</pre></li>
|
341 |
-
* <li><b>image_reflection_color</b> reflection background color, in hexadecimal. Now deprecated in favor of {@link image_default_color} (default: #FFFFFF)<br>
|
342 |
-
* <pre>$handle->image_default_color = '#000000';</pre></li>
|
343 |
-
* <li><b>image_reflection_opacity</b> opacity level at which the reflection starts, integer between 0 and 100 (default: 60)<br>
|
344 |
-
* <pre>$handle->image_reflection_opacity = 60;</pre></li>
|
345 |
-
* </ul>
|
346 |
-
*
|
347 |
-
* <b>Values that can be read before calling {@link process}()</b>
|
348 |
-
* <ul>
|
349 |
-
* <li><b>file_src_name</b> Source file name</li>
|
350 |
-
* <li><b>file_src_name_body</b> Source file name body</li>
|
351 |
-
* <li><b>file_src_name_ext</b> Source file extension</li>
|
352 |
-
* <li><b>file_src_pathname</b> Source file complete path and name</li>
|
353 |
-
* <li><b>file_src_mime</b> Source file mime type</li>
|
354 |
-
* <li><b>file_src_size</b> Source file size in bytes</li>
|
355 |
-
* <li><b>file_src_error</b> Upload error code</li>
|
356 |
-
* <li><b>file_is_image</b> Boolean flag, true if the file is a supported image type</li>
|
357 |
-
* </ul>
|
358 |
-
* If the file is a supported image type (and <i>open_basedir</i> restrictions allow it)
|
359 |
-
* <ul>
|
360 |
-
* <li><b>image_src_x</b> Source file width in pixels</li>
|
361 |
-
* <li><b>image_src_y</b> Source file height in pixels</li>
|
362 |
-
* <li><b>image_src_pixels</b> Source file number of pixels</li>
|
363 |
-
* <li><b>image_src_type</b> Source file type (png, jpg, gif or bmp)</li>
|
364 |
-
* <li><b>image_src_bits</b> Source file color depth</li>
|
365 |
-
* </ul>
|
366 |
-
*
|
367 |
-
* <b>Values that can be read after calling {@link process}()</b>
|
368 |
-
* <ul>
|
369 |
-
* <li><b>file_dst_path</b> Destination file path</li>
|
370 |
-
* <li><b>file_dst_name_body</b> Destination file name body</li>
|
371 |
-
* <li><b>file_dst_name_ext</b> Destination file extension</li>
|
372 |
-
* <li><b>file_dst_name</b> Destination file name</li>
|
373 |
-
* <li><b>file_dst_pathname</b> Destination file complete path and name</li>
|
374 |
-
* </ul>
|
375 |
-
* If the file is a supported image type
|
376 |
-
* <ul>
|
377 |
-
* <li><b>image_dst_x</b> Destination file width</li>
|
378 |
-
* <li><b>image_dst_y</b> Destination file height</li>
|
379 |
-
* <li><b>image_convert</b> Destination file format</li>
|
380 |
-
* </ul>
|
381 |
-
*
|
382 |
-
* <b>Requirements</b>
|
383 |
-
*
|
384 |
-
* Most of the image operations require GD. GD2 is greatly recommended
|
385 |
-
*
|
386 |
-
* The class is compatible with PHP 4.3+, and compatible with PHP5
|
387 |
-
*
|
388 |
-
* <b>Changelog</b>
|
389 |
-
* <ul>
|
390 |
-
* <li><b>v 0.29</b> 03/02/2010<br>
|
391 |
-
* - added protection against malicious images<br>
|
392 |
-
* - added zip and torrent MIME type<br>
|
393 |
-
* - replaced split() with explode()<br>
|
394 |
-
* - initialise image_dst_x/y with image_src_x/y<br>
|
395 |
-
* - removed {@link mime_fileinfo}, {@link mime_file}, {@link mime_magic} and {@link mime_getimagesize} from the docs since they are used before {@link process}<br>
|
396 |
-
* - added more extensions and MIME types<br>
|
397 |
-
* - improved MIME type validation<br>
|
398 |
-
* - improved logging</li>
|
399 |
-
* <li><b>v 0.28</b> 10/08/2009<br>
|
400 |
-
* - replaced ereg functions to be compatible with PHP 5.3<br>
|
401 |
-
* - added flv MIME type<br>
|
402 |
-
* - improved MIME type detection<br>
|
403 |
-
* - added {@link file_name_body_pre} to prepend a string to the file name<br>
|
404 |
-
* - added {@link mime_fileinfo}, {@link mime_file}, {@link mime_magic} and {@link mime_getimagesize} so that it is possible to deactivate some MIME type checking method<br>
|
405 |
-
* - use exec() rather than shell_exec(), to play better with safe mode <br>
|
406 |
-
* - added some error messages<br>
|
407 |
-
* - fix bug when checking on conditions, {@link processed} wasn't propagated properly</li>
|
408 |
-
* <li><b>v 0.27</b> 14/05/2009<br>
|
409 |
-
* - look for the language files directory from __FILE__<br>
|
410 |
-
* - deactivate {@link file_auto_rename} if {@link file_overwrite} is set<br>
|
411 |
-
* - improved transparency replacement for true color images<br>
|
412 |
-
* - fixed calls to newer version of UNIX file utility<br>
|
413 |
-
* - fixed error when using PECL Fileinfo extension in SAFE MODE, and when using the finfo class<br>
|
414 |
-
* - added {@link image_precrop} to crop the image before an eventual resizing</li>
|
415 |
-
* <li><b>v 0.26</b> 13/11/2008<br>
|
416 |
-
* - rewrote conversion from palette to true color to handle transparency better<br>
|
417 |
-
* - fixed imagecopymergealpha() when the overlayed image is of wrong dimensions<br>
|
418 |
-
* - fixed imagecreatenew() when the image to create have less than 1 pixels width or height<br>
|
419 |
-
* - rewrote MIME type detection to be more secure and not rely on browser information; now using Fileinfo PECL extension, UNIX file() command, MIME magic, and getimagesize(), in that order<br>
|
420 |
-
* - added support for Flash uploaders<br>
|
421 |
-
* - some bug fixing and error handling</li>
|
422 |
-
* <li><b>v 0.25</b> 17/11/2007<br>
|
423 |
-
* - added translation files and mechanism to instantiate the class with a language different from English<br>
|
424 |
-
* - added {@link forbidden} to set an array of forbidden MIME types<br>
|
425 |
-
* - implemented support for simple wildcards in {@link allowed} and {@link forbidden}, such as image/*<br>
|
426 |
-
* - preset the file extension to the desired conversion format when converting an image<br>
|
427 |
-
* - added read and write support for BMP images<br>
|
428 |
-
* - added a flag {@link file_is_image} to determine if the file is a supported image type<br>
|
429 |
-
* - the class now provides some information about the image, before calling {@link process}(). Available are {@link image_src_x}, {@link image_src_y} and the newly introduced {@link image_src_bits}, {@link image_src_pixels} and {@link image_src_type}. Note that this will not work if <i>open_basedir</i> restrictions are in place<br>
|
430 |
-
* - improved logging; now provides useful system information<br>
|
431 |
-
* - added some more pre-processing checks for files that are images: {@link image_max_width}, {@link image_max_height}, {@link image_max_pixels}, {@link image_max_ratio}, {@link image_min_width}, {@link image_min_height}, {@link image_min_pixels} and {@link image_min_ratio}<br>
|
432 |
-
* - added {@link image_ratio_pixels} to resize an image to a number of pixels, keeping aspect ratio<br>
|
433 |
-
* - added {@link image_is_palette} and {@link image_is_transparent} and {@link image_transparent_color} for GIF images<br>
|
434 |
-
* - added {@link image_default_color} to define a fallback color for non alpha-transparent output formats, such as JPEG or BMP<br>
|
435 |
-
* - changed {@link image_background_color}, which now forces transparent areas to be painted<br>
|
436 |
-
* - improved reflections and color overlays so that it works with alpha transparent images<br>
|
437 |
-
* - {@link image_reflection_color} is now deprecated in favour of {@link image_default_color}<br />
|
438 |
-
* - transparent PNGs are now processed in true color, and fully preserving the alpha channel when doing merges<br>
|
439 |
-
* - transparent GIFs are now automatically detected. {@link preserve_transparency} is deprecated<br>
|
440 |
-
* - transparent true color images can be saved as GIF while retaining transparency, semi transparent areas being merged with {@link image_default_color}<br>
|
441 |
-
* - transparent true color images can be saved as JPG/BMP with the semi transparent areas being merged with {@link image_default_color}<br>
|
442 |
-
* - fixed conversion of images to true color<br>
|
443 |
-
* - the class can now output the uploaded files content as the return value of process() if the function is called with an empty or null argumenti, or no argument</li>
|
444 |
-
* <li><b>v 0.24</b> 25/05/2007<br>
|
445 |
-
* - added {@link image_background_color}, to set the default background color of an image<br>
|
446 |
-
* - added possibility of using replacement tokens in text labels<br>
|
447 |
-
* - changed default JPEG quality to 85<br>
|
448 |
-
* - fixed a small bug when using greyscale filter and associated filters<br>
|
449 |
-
* - added {@link image_ratio_fill} in order to fit an image within some dimensions and color the remaining space. Very similar to {@link image_ratio_crop}<br>
|
450 |
-
* - improved the recursive creation of directories<br>
|
451 |
-
* - the class now converts palette based images to true colors before doing graphic manipulations</li>
|
452 |
-
* <li><b>v 0.23</b> 23/12/2006<br>
|
453 |
-
* - fixed a bug when processing more than once the same uploaded file. If there is an open_basedir restriction, the class now creates a temporary file for the first call to process(). This file will be used for subsequent processes, and will be deleted upon calling clean()</li>
|
454 |
-
* <li><b>v 0.22</b> 16/12/2006<br>
|
455 |
-
* - added automatic creation of a temporary file if the upload directory is not within open_basedir<br>
|
456 |
-
* - fixed a bug which was preventing to work on a local file by overwriting it with its processed copy<br>
|
457 |
-
* - added MIME types video/x-ms-wmv and image/x-png and fixed PNG support for IE weird MIME types<br>
|
458 |
-
* - modified {@link image_ratio_crop} so it can accept one or more from string 'TBLR', determining which side of the image is kept while cropping<br>
|
459 |
-
* - added support for multiple lines in the text, using "\n" as a line break<br>
|
460 |
-
* - added {@link image_text_line_spacing} which allow to set the space between several lines of text<br>
|
461 |
-
* - added {@link image_text_alignment} which allow to set the alignment when text has several lines<br>
|
462 |
-
* - {@link image_text_font} can now be set to the path of a GDF font to load external fonts<br>
|
463 |
-
* - added {@link image_reflection_height} to create a reflection of the source image, which height is in pixels or percentage<br>
|
464 |
-
* - added {@link image_reflection_space} to set the space in pixels between the source image and the reflection<br>
|
465 |
-
* - added {@link image_reflection_color} to set the reflection background color<br>
|
466 |
-
* - added {@link image_reflection_opacity} to set the initial level of opacity of the reflection</li>
|
467 |
-
* <li><b>v 0.21</b> 30/09/2006<br>
|
468 |
-
* - added {@link image_ratio_crop} which resizes within {@link image_x} and {@link image_y}, keeping ratio, but filling the space by cropping excedent of image<br>
|
469 |
-
* - added {@link mime_check}, which default is true, to set checks against {@link allowed} MIME list<br>
|
470 |
-
* - if MIME is empty, the class now triggers an error<br>
|
471 |
-
* - color #000000 is OK for {@link image_text_color}, and related text transparency bug fixed<br>
|
472 |
-
* - {@link gd_version}() now uses gd_info(), or else phpinfo()<br>
|
473 |
-
* - fixed path issue when the destination path has no trailing slash on Windows systems <br>
|
474 |
-
* - removed inline functions to be fully PHP5 compatible </li>
|
475 |
-
* <li><b>v 0.20</b> 11/08/2006<br>
|
476 |
-
* - added some more error checking and messages (GD presence, permissions...)<br>
|
477 |
-
* - fix when uploading files without extension<br>
|
478 |
-
* - changed values for {@link image_brightness} and {@link image_contrast} to be between -127 and 127<br>
|
479 |
-
* - added {@link dir_auto_create} to automatically and recursively create destination directory if missing.<br>
|
480 |
-
* - added {@link dir_auto_chmod} to automatically chmod the destination directory if not writeable.<br>
|
481 |
-
* - added {@link dir_chmod} to set the default chmod to use.<br>
|
482 |
-
* - added {@link image_crop} to crop images<br>
|
483 |
-
* - added {@link image_negative} to invert the colors on the image<br>
|
484 |
-
* - added {@link image_greyscale} to turn the image into greyscale<br>
|
485 |
-
* - added {@link image_threshold} to apply a threshold filter on the image<br>
|
486 |
-
* - added {@link image_bevel}, {@link image_bevel_color1} and {@link image_bevel_color2} to add a bevel border<br>
|
487 |
-
* - added {@link image_border} and {@link image_border_color} to add a single color border<br>
|
488 |
-
* - added {@link image_frame} and {@link image_frame_colors} to add a multicolored frame</li>
|
489 |
-
* <li><b>v 0.19</b> 29/03/2006<br>
|
490 |
-
* - class is now compatible i18n (thanks Sylwester).<br>
|
491 |
-
* - the class can mow manipulate local files, not only uploaded files (instanciate the class with a local filename).<br>
|
492 |
-
* - {@link file_safe_name} has been improved a bit.<br>
|
493 |
-
* - added {@link image_brightness}, {@link image_contrast}, {@link image_tint_color}, {@link image_overlay_color} and {@link image_overlay_percent} to do color manipulation on the images.<br>
|
494 |
-
* - added {@link image_text} and all derivated settings to add a text label on the image.<br>
|
495 |
-
* - added {@link image_watermark} and all derivated settings to add a watermark image on the image.<br>
|
496 |
-
* - added {@link image_flip} and {@link image_rotate} for more image manipulations<br>
|
497 |
-
* - added {@link jpeg_size} to calculate the JPG compression quality in order to fit within one filesize.</li>
|
498 |
-
* <li><b>v 0.18</b> 02/02/2006<br>
|
499 |
-
* - added {@link no_script} to turn dangerous scripts into text files.<br>
|
500 |
-
* - added {@link mime_magic_check} to set the class to use mime_magic.<br>
|
501 |
-
* - added {@link preserve_transparency} *experimental*. Thanks Gregor.<br>
|
502 |
-
* - fixed size and mime checking, wasn't working :/ Thanks Willem.<br>
|
503 |
-
* - fixed memory leak when resizing images.<br>
|
504 |
-
* - when resizing, it is not necessary anymore to set {@link image_convert}.<br>
|
505 |
-
* - il is now possible to simply convert an image, with no resizing.<br>
|
506 |
-
* - sets the default {@link file_max_size} to upload_max_filesize from php.ini. Thanks Edward</li>
|
507 |
-
* <li><b>v 0.17</b> 28/05/2005<br>
|
508 |
-
* - the class can be used with any version of GD.<br>
|
509 |
-
* - added security check on the file with a list of mime-types.<br>
|
510 |
-
* - changed the license to GPL v2 only</li>
|
511 |
-
* <li><b>v 0.16</b> 19/05/2005<br>
|
512 |
-
* - added {@link file_auto_rename} automatic file renaming if the same filename already exists.<br>
|
513 |
-
* - added {@link file_safe_name} safe formatting of the filename (spaces to _underscores so far).<br>
|
514 |
-
* - added some more error reporting to avoid crash if GD is not present</li>
|
515 |
-
* <li><b>v 0.15</b> 16/04/2005<br>
|
516 |
-
* - added JPEG compression quality setting. Thanks Vad</li>
|
517 |
-
* <li><b>v 0.14</b> 14/03/2005<br>
|
518 |
-
* - reworked the class file to allow parsing with phpDocumentor</li>
|
519 |
-
* <li><b>v 0.13</b> 07/03/2005<br>
|
520 |
-
* - fixed a bug with {@link image_ratio}. Thanks Justin.<br>
|
521 |
-
* - added {@link image_ratio_no_zoom_in} and {@link image_ratio_no_zoom_out} </li>
|
522 |
-
* <li><b>v 0.12</b> 21/01/2005<br>
|
523 |
-
* - added {@link image_ratio} to resize within max values, keeping image ratio</li>
|
524 |
-
* <li><b>v 0.11</b> 22/08/2003<br>
|
525 |
-
* - update for GD2 (changed imageresized() into imagecopyresampled() and imagecreate() into imagecreatetruecolor())</li>
|
526 |
-
* </ul>
|
527 |
-
*
|
528 |
-
* @package Alkivia
|
529 |
-
* @subpackage External
|
530 |
-
*/
|
531 |
-
class akUpload {
|
532 |
-
|
533 |
-
|
534 |
-
/**
|
535 |
-
* Class version
|
536 |
-
*
|
537 |
-
* @access public
|
538 |
-
* @var string
|
539 |
-
*/
|
540 |
-
var $version;
|
541 |
-
|
542 |
-
/**
|
543 |
-
* Uploaded file name
|
544 |
-
*
|
545 |
-
* @access public
|
546 |
-
* @var string
|
547 |
-
*/
|
548 |
-
var $file_src_name;
|
549 |
-
|
550 |
-
/**
|
551 |
-
* Uploaded file name body (i.e. without extension)
|
552 |
-
*
|
553 |
-
* @access public
|
554 |
-
* @var string
|
555 |
-
*/
|
556 |
-
var $file_src_name_body;
|
557 |
-
|
558 |
-
/**
|
559 |
-
* Uploaded file name extension
|
560 |
-
*
|
561 |
-
* @access public
|
562 |
-
* @var string
|
563 |
-
*/
|
564 |
-
var $file_src_name_ext;
|
565 |
-
|
566 |
-
/**
|
567 |
-
* Uploaded file MIME type
|
568 |
-
*
|
569 |
-
* @access public
|
570 |
-
* @var string
|
571 |
-
*/
|
572 |
-
var $file_src_mime;
|
573 |
-
|
574 |
-
/**
|
575 |
-
* Uploaded file size, in bytes
|
576 |
-
*
|
577 |
-
* @access public
|
578 |
-
* @var double
|
579 |
-
*/
|
580 |
-
var $file_src_size;
|
581 |
-
|
582 |
-
/**
|
583 |
-
* Holds eventual PHP error code from $_FILES
|
584 |
-
*
|
585 |
-
* @access public
|
586 |
-
* @var string
|
587 |
-
*/
|
588 |
-
var $file_src_error;
|
589 |
-
|
590 |
-
/**
|
591 |
-
* Uloaded file name, including server path
|
592 |
-
*
|
593 |
-
* @access private
|
594 |
-
* @var string
|
595 |
-
*/
|
596 |
-
var $file_src_pathname;
|
597 |
-
|
598 |
-
/**
|
599 |
-
* Uloaded file name temporary copy
|
600 |
-
*
|
601 |
-
* @access private
|
602 |
-
* @var string
|
603 |
-
*/
|
604 |
-
var $file_src_temp;
|
605 |
-
|
606 |
-
/**
|
607 |
-
* Destination file name
|
608 |
-
*
|
609 |
-
* @access private
|
610 |
-
* @var string
|
611 |
-
*/
|
612 |
-
var $file_dst_path;
|
613 |
-
|
614 |
-
/**
|
615 |
-
* Destination file name
|
616 |
-
*
|
617 |
-
* @access public
|
618 |
-
* @var string
|
619 |
-
*/
|
620 |
-
var $file_dst_name;
|
621 |
-
|
622 |
-
/**
|
623 |
-
* Destination file name body (i.e. without extension)
|
624 |
-
*
|
625 |
-
* @access public
|
626 |
-
* @var string
|
627 |
-
*/
|
628 |
-
var $file_dst_name_body;
|
629 |
-
|
630 |
-
/**
|
631 |
-
* Destination file extension
|
632 |
-
*
|
633 |
-
* @access public
|
634 |
-
* @var string
|
635 |
-
*/
|
636 |
-
var $file_dst_name_ext;
|
637 |
-
|
638 |
-
/**
|
639 |
-
* Destination file name, including path
|
640 |
-
*
|
641 |
-
* @access private
|
642 |
-
* @var string
|
643 |
-
*/
|
644 |
-
var $file_dst_pathname;
|
645 |
-
|
646 |
-
/**
|
647 |
-
* Source image width
|
648 |
-
*
|
649 |
-
* @access private
|
650 |
-
* @var integer
|
651 |
-
*/
|
652 |
-
var $image_src_x;
|
653 |
-
|
654 |
-
/**
|
655 |
-
* Source image height
|
656 |
-
*
|
657 |
-
* @access private
|
658 |
-
* @var integer
|
659 |
-
*/
|
660 |
-
var $image_src_y;
|
661 |
-
|
662 |
-
/**
|
663 |
-
* Source image color depth
|
664 |
-
*
|
665 |
-
* @access private
|
666 |
-
* @var integer
|
667 |
-
*/
|
668 |
-
var $image_src_bits;
|
669 |
-
|
670 |
-
/**
|
671 |
-
* Number of pixels
|
672 |
-
*
|
673 |
-
* @access private
|
674 |
-
* @var long
|
675 |
-
*/
|
676 |
-
var $image_src_pixels;
|
677 |
-
|
678 |
-
/**
|
679 |
-
* Type of image (png, gif, jpg or bmp)
|
680 |
-
*
|
681 |
-
* @access private
|
682 |
-
* @var string
|
683 |
-
*/
|
684 |
-
var $image_src_type;
|
685 |
-
|
686 |
-
/**
|
687 |
-
* Destination image width
|
688 |
-
*
|
689 |
-
* @access private
|
690 |
-
* @var integer
|
691 |
-
*/
|
692 |
-
var $image_dst_x;
|
693 |
-
|
694 |
-
/**
|
695 |
-
* Destination image height
|
696 |
-
*
|
697 |
-
* @access private
|
698 |
-
* @var integer
|
699 |
-
*/
|
700 |
-
var $image_dst_y;
|
701 |
-
|
702 |
-
/**
|
703 |
-
* Supported image formats
|
704 |
-
*
|
705 |
-
* @access private
|
706 |
-
* @var array
|
707 |
-
*/
|
708 |
-
var $image_supported;
|
709 |
-
|
710 |
-
/**
|
711 |
-
* Flag to determine if the source file is an image
|
712 |
-
*
|
713 |
-
* @access private
|
714 |
-
* @var boolean
|
715 |
-
*/
|
716 |
-
var $file_is_image;
|
717 |
-
|
718 |
-
/**
|
719 |
-
* Flag set after instanciating the class
|
720 |
-
*
|
721 |
-
* Indicates if the file has been uploaded properly
|
722 |
-
*
|
723 |
-
* @access public
|
724 |
-
* @var bool
|
725 |
-
*/
|
726 |
-
var $uploaded;
|
727 |
-
|
728 |
-
/**
|
729 |
-
* Flag stopping PHP upload checks
|
730 |
-
*
|
731 |
-
* Indicates whether we instanciated the class with a filename, in which case
|
732 |
-
* we will not check on the validity of the PHP *upload*
|
733 |
-
*
|
734 |
-
* This flag is automatically set to true when working on a local file
|
735 |
-
*
|
736 |
-
* Warning: for uploads, this flag MUST be set to false for security reason
|
737 |
-
*
|
738 |
-
* @access public
|
739 |
-
* @var bool
|
740 |
-
*/
|
741 |
-
var $no_upload_check;
|
742 |
-
|
743 |
-
/**
|
744 |
-
* Flag set after calling a process
|
745 |
-
*
|
746 |
-
* Indicates if the processing, and copy of the resulting file went OK
|
747 |
-
*
|
748 |
-
* @access public
|
749 |
-
* @var bool
|
750 |
-
*/
|
751 |
-
var $processed;
|
752 |
-
|
753 |
-
/**
|
754 |
-
* Holds eventual error message in plain english
|
755 |
-
*
|
756 |
-
* @access public
|
757 |
-
* @var string
|
758 |
-
*/
|
759 |
-
var $error;
|
760 |
-
|
761 |
-
/**
|
762 |
-
* Holds an HTML formatted log
|
763 |
-
*
|
764 |
-
* @access public
|
765 |
-
* @var string
|
766 |
-
*/
|
767 |
-
var $log;
|
768 |
-
|
769 |
-
|
770 |
-
// overiddable processing variables
|
771 |
-
|
772 |
-
|
773 |
-
/**
|
774 |
-
* Set this variable to replace the name body (i.e. without extension)
|
775 |
-
*
|
776 |
-
* @access public
|
777 |
-
* @var string
|
778 |
-
*/
|
779 |
-
var $file_new_name_body;
|
780 |
-
|
781 |
-
/**
|
782 |
-
* Set this variable to append a string to the file name body
|
783 |
-
*
|
784 |
-
* @access public
|
785 |
-
* @var string
|
786 |
-
*/
|
787 |
-
var $file_name_body_add;
|
788 |
-
|
789 |
-
/**
|
790 |
-
* Set this variable to prepend a string to the file name body
|
791 |
-
*
|
792 |
-
* @access public
|
793 |
-
* @var string
|
794 |
-
*/
|
795 |
-
var $file_name_body_pre;
|
796 |
-
|
797 |
-
/**
|
798 |
-
* Set this variable to change the file extension
|
799 |
-
*
|
800 |
-
* @access public
|
801 |
-
* @var string
|
802 |
-
*/
|
803 |
-
var $file_new_name_ext;
|
804 |
-
|
805 |
-
/**
|
806 |
-
* Set this variable to format the filename (spaces changed to _)
|
807 |
-
*
|
808 |
-
* @access public
|
809 |
-
* @var boolean
|
810 |
-
*/
|
811 |
-
var $file_safe_name;
|
812 |
-
|
813 |
-
/**
|
814 |
-
* Set this variable to false if you don't want to check the MIME against the allowed list
|
815 |
-
*
|
816 |
-
* This variable is set to true by default for security reason
|
817 |
-
*
|
818 |
-
* @access public
|
819 |
-
* @var boolean
|
820 |
-
*/
|
821 |
-
var $mime_check;
|
822 |
-
|
823 |
-
/**
|
824 |
-
* Set this variable to false if you don't want to check the MIME with Fileinfo PECL extension
|
825 |
-
*
|
826 |
-
* You can also set it with the path of the magic database file.
|
827 |
-
* If set to true, the class will try to read the MAGIC environment variable
|
828 |
-
* and if it is empty, will default to '/usr/share/file/magic'
|
829 |
-
* If set to an empty string, it will call finfo_open without the path argument
|
830 |
-
*
|
831 |
-
* This variable is set to true by default for security reason
|
832 |
-
*
|
833 |
-
* @access public
|
834 |
-
* @var boolean
|
835 |
-
*/
|
836 |
-
var $mime_fileinfo;
|
837 |
-
|
838 |
-
/**
|
839 |
-
* Set this variable to false if you don't want to check the MIME with UNIX file() command
|
840 |
-
*
|
841 |
-
* This variable is set to true by default for security reason
|
842 |
-
*
|
843 |
-
* @access public
|
844 |
-
* @var boolean
|
845 |
-
*/
|
846 |
-
var $mime_file;
|
847 |
-
|
848 |
-
/**
|
849 |
-
* Set this variable to false if you don't want to check the MIME with the magic.mime file
|
850 |
-
*
|
851 |
-
* The function mime_content_type() will be deprecated,
|
852 |
-
* and this variable will be set to false in a future release
|
853 |
-
*
|
854 |
-
* This variable is set to true by default for security reason
|
855 |
-
*
|
856 |
-
* @access public
|
857 |
-
* @var boolean
|
858 |
-
*/
|
859 |
-
var $mime_magic;
|
860 |
-
|
861 |
-
/**
|
862 |
-
* Set this variable to false if you don't want to check the MIME with getimagesize()
|
863 |
-
*
|
864 |
-
* The class tries to get a MIME type from getimagesize()
|
865 |
-
* If no MIME is returned, it tries to guess the MIME type from the file type
|
866 |
-
*
|
867 |
-
* This variable is set to true by default for security reason
|
868 |
-
*
|
869 |
-
* @access public
|
870 |
-
* @var boolean
|
871 |
-
*/
|
872 |
-
var $mime_getimagesize;
|
873 |
-
|
874 |
-
/**
|
875 |
-
* Set this variable to false if you don't want to turn dangerous scripts into simple text files
|
876 |
-
*
|
877 |
-
* @access public
|
878 |
-
* @var boolean
|
879 |
-
*/
|
880 |
-
var $no_script;
|
881 |
-
|
882 |
-
/**
|
883 |
-
* Set this variable to true to allow automatic renaming of the file
|
884 |
-
* if the file already exists
|
885 |
-
*
|
886 |
-
* Default value is true
|
887 |
-
*
|
888 |
-
* For instance, on uploading foo.ext,<br>
|
889 |
-
* if foo.ext already exists, upload will be renamed foo_1.ext<br>
|
890 |
-
* and if foo_1.ext already exists, upload will be renamed foo_2.ext<br>
|
891 |
-
*
|
892 |
-
* Note that this option doesn't have any effect if {@link file_overwrite} is true
|
893 |
-
*
|
894 |
-
* @access public
|
895 |
-
* @var bool
|
896 |
-
*/
|
897 |
-
var $file_auto_rename;
|
898 |
-
|
899 |
-
/**
|
900 |
-
* Set this variable to true to allow automatic creation of the destination
|
901 |
-
* directory if it is missing (works recursively)
|
902 |
-
*
|
903 |
-
* Default value is true
|
904 |
-
*
|
905 |
-
* @access public
|
906 |
-
* @var bool
|
907 |
-
*/
|
908 |
-
var $dir_auto_create;
|
909 |
-
|
910 |
-
/**
|
911 |
-
* Set this variable to true to allow automatic chmod of the destination
|
912 |
-
* directory if it is not writeable
|
913 |
-
*
|
914 |
-
* Default value is true
|
915 |
-
*
|
916 |
-
* @access public
|
917 |
-
* @var bool
|
918 |
-
*/
|
919 |
-
var $dir_auto_chmod;
|
920 |
-
|
921 |
-
/**
|
922 |
-
* Set this variable to the default chmod you want the class to use
|
923 |
-
* when creating directories, or attempting to write in a directory
|
924 |
-
*
|
925 |
-
* Default value is 0777 (without quotes)
|
926 |
-
*
|
927 |
-
* @access public
|
928 |
-
* @var bool
|
929 |
-
*/
|
930 |
-
var $dir_chmod;
|
931 |
-
|
932 |
-
/**
|
933 |
-
* Set this variable tu true to allow overwriting of an existing file
|
934 |
-
*
|
935 |
-
* Default value is false, so no files will be overwritten
|
936 |
-
*
|
937 |
-
* @access public
|
938 |
-
* @var bool
|
939 |
-
*/
|
940 |
-
var $file_overwrite;
|
941 |
-
|
942 |
-
/**
|
943 |
-
* Set this variable to change the maximum size in bytes for an uploaded file
|
944 |
-
*
|
945 |
-
* Default value is the value <i>upload_max_filesize</i> from php.ini
|
946 |
-
*
|
947 |
-
* @access public
|
948 |
-
* @var double
|
949 |
-
*/
|
950 |
-
var $file_max_size;
|
951 |
-
|
952 |
-
/**
|
953 |
-
* Set this variable to true to resize the file if it is an image
|
954 |
-
*
|
955 |
-
* You will probably want to set {@link image_x} and {@link image_y}, and maybe one of the ratio variables
|
956 |
-
*
|
957 |
-
* Default value is false (no resizing)
|
958 |
-
*
|
959 |
-
* @access public
|
960 |
-
* @var bool
|
961 |
-
*/
|
962 |
-
var $image_resize;
|
963 |
-
|
964 |
-
/**
|
965 |
-
* Set this variable to convert the file if it is an image
|
966 |
-
*
|
967 |
-
* Possibles values are : ''; 'png'; 'jpeg'; 'gif'; 'bmp'
|
968 |
-
*
|
969 |
-
* Default value is '' (no conversion)<br>
|
970 |
-
* If {@link resize} is true, {@link convert} will be set to the source file extension
|
971 |
-
*
|
972 |
-
* @access public
|
973 |
-
* @var string
|
974 |
-
*/
|
975 |
-
var $image_convert;
|
976 |
-
|
977 |
-
/**
|
978 |
-
* Set this variable to the wanted (or maximum/minimum) width for the processed image, in pixels
|
979 |
-
*
|
980 |
-
* Default value is 150
|
981 |
-
*
|
982 |
-
* @access public
|
983 |
-
* @var integer
|
984 |
-
*/
|
985 |
-
var $image_x;
|
986 |
-
|
987 |
-
/**
|
988 |
-
* Set this variable to the wanted (or maximum/minimum) height for the processed image, in pixels
|
989 |
-
*
|
990 |
-
* Default value is 150
|
991 |
-
*
|
992 |
-
* @access public
|
993 |
-
* @var integer
|
994 |
-
*/
|
995 |
-
var $image_y;
|
996 |
-
|
997 |
-
/**
|
998 |
-
* Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y}
|
999 |
-
*
|
1000 |
-
* Default value is false
|
1001 |
-
*
|
1002 |
-
* @access public
|
1003 |
-
* @var bool
|
1004 |
-
*/
|
1005 |
-
var $image_ratio;
|
1006 |
-
|
1007 |
-
/**
|
1008 |
-
* Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y}
|
1009 |
-
*
|
1010 |
-
* The image will be resized as to fill the whole space, and excedent will be cropped
|
1011 |
-
*
|
1012 |
-
* Value can also be a string, one or more character from 'TBLR' (top, bottom, left and right)
|
1013 |
-
* If set as a string, it determines which side of the image is kept while cropping.
|
1014 |
-
* By default, the part of the image kept is in the center, i.e. it crops equally on both sides
|
1015 |
-
*
|
1016 |
-
* Default value is false
|
1017 |
-
*
|
1018 |
-
* @access public
|
1019 |
-
* @var mixed
|
1020 |
-
*/
|
1021 |
-
var $image_ratio_crop;
|
1022 |
-
|
1023 |
-
/**
|
1024 |
-
* Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y}
|
1025 |
-
*
|
1026 |
-
* The image will be resized to fit entirely in the space, and the rest will be colored.
|
1027 |
-
* The default color is white, but can be set with {@link image_default_color}
|
1028 |
-
*
|
1029 |
-
* Value can also be a string, one or more character from 'TBLR' (top, bottom, left and right)
|
1030 |
-
* If set as a string, it determines in which side of the space the image is displayed.
|
1031 |
-
* By default, the image is displayed in the center, i.e. it fills the remaining space equally on both sides
|
1032 |
-
*
|
1033 |
-
* Default value is false
|
1034 |
-
*
|
1035 |
-
* @access public
|
1036 |
-
* @var mixed
|
1037 |
-
*/
|
1038 |
-
var $image_ratio_fill;
|
1039 |
-
|
1040 |
-
/**
|
1041 |
-
* Set this variable to a number of pixels so that {@link image_x} and {@link image_y} are the best match possible
|
1042 |
-
*
|
1043 |
-
* The image will be resized to have approximatively the number of pixels
|
1044 |
-
* The aspect ratio wil be conserved
|
1045 |
-
*
|
1046 |
-
* Default value is false
|
1047 |
-
*
|
1048 |
-
* @access public
|
1049 |
-
* @var mixed
|
1050 |
-
*/
|
1051 |
-
var $image_ratio_pixels;
|
1052 |
-
|
1053 |
-
/**
|
1054 |
-
* Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y},
|
1055 |
-
* but only if original image is bigger
|
1056 |
-
*
|
1057 |
-
* Default value is false
|
1058 |
-
*
|
1059 |
-
* @access public
|
1060 |
-
* @var bool
|
1061 |
-
*/
|
1062 |
-
var $image_ratio_no_zoom_in;
|
1063 |
-
|
1064 |
-
/**
|
1065 |
-
* Set this variable to keep the original size ratio to fit within {@link image_x} x {@link image_y},
|
1066 |
-
* but only if original image is smaller
|
1067 |
-
*
|
1068 |
-
* Default value is false
|
1069 |
-
*
|
1070 |
-
* @access public
|
1071 |
-
* @var bool
|
1072 |
-
*/
|
1073 |
-
var $image_ratio_no_zoom_out;
|
1074 |
-
|
1075 |
-
/**
|
1076 |
-
* Set this variable to calculate {@link image_x} automatically , using {@link image_y} and conserving ratio
|
1077 |
-
*
|
1078 |
-
* Default value is false
|
1079 |
-
*
|
1080 |
-
* @access public
|
1081 |
-
* @var bool
|
1082 |
-
*/
|
1083 |
-
var $image_ratio_x;
|
1084 |
-
|
1085 |
-
/**
|
1086 |
-
* Set this variable to calculate {@link image_y} automatically , using {@link image_x} and conserving ratio
|
1087 |
-
*
|
1088 |
-
* Default value is false
|
1089 |
-
*
|
1090 |
-
* @access public
|
1091 |
-
* @var bool
|
1092 |
-
*/
|
1093 |
-
var $image_ratio_y;
|
1094 |
-
|
1095 |
-
/**
|
1096 |
-
* Set this variable to set a maximum image width, above which the upload will be invalid
|
1097 |
-
*
|
1098 |
-
* Default value is null
|
1099 |
-
*
|
1100 |
-
* @access public
|
1101 |
-
* @var integer
|
1102 |
-
*/
|
1103 |
-
var $image_max_width;
|
1104 |
-
|
1105 |
-
/**
|
1106 |
-
* Set this variable to set a maximum image height, above which the upload will be invalid
|
1107 |
-
*
|
1108 |
-
* Default value is null
|
1109 |
-
*
|
1110 |
-
* @access public
|
1111 |
-
* @var integer
|
1112 |
-
*/
|
1113 |
-
var $image_max_height;
|
1114 |
-
|
1115 |
-
/**
|
1116 |
-
* Set this variable to set a maximum number of pixels for an image, above which the upload will be invalid
|
1117 |
-
*
|
1118 |
-
* Default value is null
|
1119 |
-
*
|
1120 |
-
* @access public
|
1121 |
-
* @var long
|
1122 |
-
*/
|
1123 |
-
var $image_max_pixels;
|
1124 |
-
|
1125 |
-
/**
|
1126 |
-
* Set this variable to set a maximum image aspect ratio, above which the upload will be invalid
|
1127 |
-
*
|
1128 |
-
* Note that ratio = width / height
|
1129 |
-
*
|
1130 |
-
* Default value is null
|
1131 |
-
*
|
1132 |
-
* @access public
|
1133 |
-
* @var float
|
1134 |
-
*/
|
1135 |
-
var $image_max_ratio;
|
1136 |
-
|
1137 |
-
/**
|
1138 |
-
* Set this variable to set a minimum image width, below which the upload will be invalid
|
1139 |
-
*
|
1140 |
-
* Default value is null
|
1141 |
-
*
|
1142 |
-
* @access public
|
1143 |
-
* @var integer
|
1144 |
-
*/
|
1145 |
-
var $image_min_width;
|
1146 |
-
|
1147 |
-
/**
|
1148 |
-
* Set this variable to set a minimum image height, below which the upload will be invalid
|
1149 |
-
*
|
1150 |
-
* Default value is null
|
1151 |
-
*
|
1152 |
-
* @access public
|
1153 |
-
* @var integer
|
1154 |
-
*/
|
1155 |
-
var $image_min_height;
|
1156 |
-
|
1157 |
-
/**
|
1158 |
-
* Set this variable to set a minimum number of pixels for an image, below which the upload will be invalid
|
1159 |
-
*
|
1160 |
-
* Default value is null
|
1161 |
-
*
|
1162 |
-
* @access public
|
1163 |
-
* @var long
|
1164 |
-
*/
|
1165 |
-
var $image_min_pixels;
|
1166 |
-
|
1167 |
-
/**
|
1168 |
-
* Set this variable to set a minimum image aspect ratio, below which the upload will be invalid
|
1169 |
-
*
|
1170 |
-
* Note that ratio = width / height
|
1171 |
-
*
|
1172 |
-
* Default value is null
|
1173 |
-
*
|
1174 |
-
* @access public
|
1175 |
-
* @var float
|
1176 |
-
*/
|
1177 |
-
var $image_min_ratio;
|
1178 |
-
|
1179 |
-
/**
|
1180 |
-
* Quality of JPEG created/converted destination image
|
1181 |
-
*
|
1182 |
-
* Default value is 85
|
1183 |
-
*
|
1184 |
-
* @access public
|
1185 |
-
* @var integer
|
1186 |
-
*/
|
1187 |
-
var $jpeg_quality;
|
1188 |
-
|
1189 |
-
/**
|
1190 |
-
* Determines the quality of the JPG image to fit a desired file size
|
1191 |
-
*
|
1192 |
-
* Value is in bytes. The JPG quality will be set between 1 and 100%
|
1193 |
-
* The calculations are approximations.
|
1194 |
-
*
|
1195 |
-
* Default value is null (no calculations)
|
1196 |
-
*
|
1197 |
-
* @access public
|
1198 |
-
* @var integer
|
1199 |
-
*/
|
1200 |
-
var $jpeg_size;
|
1201 |
-
|
1202 |
-
/**
|
1203 |
-
* Preserve transparency when resizing or converting an image (deprecated)
|
1204 |
-
*
|
1205 |
-
* Default value is automatically set to true for transparent GIFs
|
1206 |
-
* This setting is now deprecated
|
1207 |
-
*
|
1208 |
-
* @access public
|
1209 |
-
* @var integer
|
1210 |
-
*/
|
1211 |
-
var $preserve_transparency;
|
1212 |
-
|
1213 |
-
/**
|
1214 |
-
* Flag set to true when the image is transparent
|
1215 |
-
*
|
1216 |
-
* This is actually used only for transparent GIFs
|
1217 |
-
*
|
1218 |
-
* @access public
|
1219 |
-
* @var boolean
|
1220 |
-
*/
|
1221 |
-
var $image_is_transparent;
|
1222 |
-
|
1223 |
-
/**
|
1224 |
-
* Transparent color in a palette
|
1225 |
-
*
|
1226 |
-
* This is actually used only for transparent GIFs
|
1227 |
-
*
|
1228 |
-
* @access public
|
1229 |
-
* @var boolean
|
1230 |
-
*/
|
1231 |
-
var $image_transparent_color;
|
1232 |
-
|
1233 |
-
/**
|
1234 |
-
* Background color, used to paint transparent areas with
|
1235 |
-
*
|
1236 |
-
* If set, it will forcibly remove transparency by painting transparent areas with the color
|
1237 |
-
* This setting will fill in all transparent areas in PNG and GIF, as opposed to {@link image_default_color}
|
1238 |
-
* which will do so only in BMP, JPEG, and alpha transparent areas in transparent GIFs
|
1239 |
-
* This setting overrides {@link image_default_color}
|
1240 |
-
*
|
1241 |
-
* Default value is null
|
1242 |
-
*
|
1243 |
-
* @access public
|
1244 |
-
* @var string
|
1245 |
-
*/
|
1246 |
-
var $image_background_color;
|
1247 |
-
|
1248 |
-
/**
|
1249 |
-
* Default color for non alpha-transparent images
|
1250 |
-
*
|
1251 |
-
* This setting is to be used to define a background color for semi transparent areas
|
1252 |
-
* of an alpha transparent when the output format doesn't support alpha transparency
|
1253 |
-
* This is useful when, from an alpha transparent PNG image, or an image with alpha transparent features
|
1254 |
-
* if you want to output it as a transparent GIFs for instance, you can set a blending color for transparent areas
|
1255 |
-
* If you output in JPEG or BMP, this color will be used to fill in the previously transparent areas
|
1256 |
-
*
|
1257 |
-
* The default color white
|
1258 |
-
*
|
1259 |
-
* @access public
|
1260 |
-
* @var boolean
|
1261 |
-
*/
|
1262 |
-
var $image_default_color;
|
1263 |
-
|
1264 |
-
/**
|
1265 |
-
* Flag set to true when the image is not true color
|
1266 |
-
*
|
1267 |
-
* @access public
|
1268 |
-
* @var boolean
|
1269 |
-
*/
|
1270 |
-
var $image_is_palette;
|
1271 |
-
|
1272 |
-
/**
|
1273 |
-
* Corrects the image brightness
|
1274 |
-
*
|
1275 |
-
* Value can range between -127 and 127
|
1276 |
-
*
|
1277 |
-
* Default value is null
|
1278 |
-
*
|
1279 |
-
* @access public
|
1280 |
-
* @var integer
|
1281 |
-
*/
|
1282 |
-
var $image_brightness;
|
1283 |
-
|
1284 |
-
/**
|
1285 |
-
* Corrects the image contrast
|
1286 |
-
*
|
1287 |
-
* Value can range between -127 and 127
|
1288 |
-
*
|
1289 |
-
* Default value is null
|
1290 |
-
*
|
1291 |
-
* @access public
|
1292 |
-
* @var integer
|
1293 |
-
*/
|
1294 |
-
var $image_contrast;
|
1295 |
-
|
1296 |
-
/**
|
1297 |
-
* Applies threshold filter
|
1298 |
-
*
|
1299 |
-
* Value can range between -127 and 127
|
1300 |
-
*
|
1301 |
-
* Default value is null
|
1302 |
-
*
|
1303 |
-
* @access public
|
1304 |
-
* @var integer
|
1305 |
-
*/
|
1306 |
-
var $image_threshold;
|
1307 |
-
|
1308 |
-
/**
|
1309 |
-
* Applies a tint on the image
|
1310 |
-
*
|
1311 |
-
* Value is an hexadecimal color, such as #FFFFFF
|
1312 |
-
*
|
1313 |
-
* Default value is null
|
1314 |
-
*
|
1315 |
-
* @access public
|
1316 |
-
* @var string;
|
1317 |
-
*/
|
1318 |
-
var $image_tint_color;
|
1319 |
-
|
1320 |
-
/**
|
1321 |
-
* Applies a colored overlay on the image
|
1322 |
-
*
|
1323 |
-
* Value is an hexadecimal color, such as #FFFFFF
|
1324 |
-
*
|
1325 |
-
* To use with {@link image_overlay_percent}
|
1326 |
-
*
|
1327 |
-
* Default value is null
|
1328 |
-
*
|
1329 |
-
* @access public
|
1330 |
-
* @var string;
|
1331 |
-
*/
|
1332 |
-
var $image_overlay_color;
|
1333 |
-
|
1334 |
-
/**
|
1335 |
-
* Sets the percentage for the colored overlay
|
1336 |
-
*
|
1337 |
-
* Value is a percentage, as an integer between 0 and 100
|
1338 |
-
*
|
1339 |
-
* Unless used with {@link image_overlay_color}, this setting has no effect
|
1340 |
-
*
|
1341 |
-
* Default value is 50
|
1342 |
-
*
|
1343 |
-
* @access public
|
1344 |
-
* @var integer
|
1345 |
-
*/
|
1346 |
-
var $image_overlay_percent;
|
1347 |
-
|
1348 |
-
/**
|
1349 |
-
* Inverts the color of an image
|
1350 |
-
*
|
1351 |
-
* Default value is FALSE
|
1352 |
-
*
|
1353 |
-
* @access public
|
1354 |
-
* @var boolean;
|
1355 |
-
*/
|
1356 |
-
var $image_negative;
|
1357 |
-
|
1358 |
-
/**
|
1359 |
-
* Turns the image into greyscale
|
1360 |
-
*
|
1361 |
-
* Default value is FALSE
|
1362 |
-
*
|
1363 |
-
* @access public
|
1364 |
-
* @var boolean;
|
1365 |
-
*/
|
1366 |
-
var $image_greyscale;
|
1367 |
-
|
1368 |
-
/**
|
1369 |
-
* Adds a text label on the image
|
1370 |
-
*
|
1371 |
-
* Value is a string, any text. Text will not word-wrap, although you can use breaklines in your text "\n"
|
1372 |
-
*
|
1373 |
-
* If set, this setting allow the use of all other settings starting with image_text_
|
1374 |
-
*
|
1375 |
-
* Replacement tokens can be used in the string:
|
1376 |
-
* <pre>
|
1377 |
-
* gd_version src_name src_name_body src_name_ext
|
1378 |
-
* src_pathname src_mime src_x src_y
|
1379 |
-
* src_type src_bits src_pixels
|
1380 |
-
* src_size src_size_kb src_size_mb src_size_human
|
1381 |
-
* dst_path dst_name_body dst_pathname
|
1382 |
-
* dst_name dst_name_ext dst_x dst_y
|
1383 |
-
* date time host server ip
|
1384 |
-
* </pre>
|
1385 |
-
* The tokens must be enclosed in square brackets: [dst_x] will be replaced by the width of the picture
|
1386 |
-
*
|
1387 |
-
* Default value is null
|
1388 |
-
*
|
1389 |
-
* @access public
|
1390 |
-
* @var string;
|
1391 |
-
*/
|
1392 |
-
var $image_text;
|
1393 |
-
|
1394 |
-
/**
|
1395 |
-
* Sets the text direction for the text label
|
1396 |
-
*
|
1397 |
-
* Value is either 'h' or 'v', as in horizontal and vertical
|
1398 |
-
*
|
1399 |
-
* Default value is h (horizontal)
|
1400 |
-
*
|
1401 |
-
* @access public
|
1402 |
-
* @var string;
|
1403 |
-
*/
|
1404 |
-
var $image_text_direction;
|
1405 |
-
|
1406 |
-
/**
|
1407 |
-
* Sets the text color for the text label
|
1408 |
-
*
|
1409 |
-
* Value is an hexadecimal color, such as #FFFFFF
|
1410 |
-
*
|
1411 |
-
* Default value is #FFFFFF (white)
|
1412 |
-
*
|
1413 |
-
* @access public
|
1414 |
-
* @var string;
|
1415 |
-
*/
|
1416 |
-
var $image_text_color;
|
1417 |
-
|
1418 |
-
/**
|
1419 |
-
* Sets the text visibility in the text label
|
1420 |
-
*
|
1421 |
-
* Value is a percentage, as an integer between 0 and 100
|
1422 |
-
*
|
1423 |
-
* Default value is 100
|
1424 |
-
*
|
1425 |
-
* @access public
|
1426 |
-
* @var integer
|
1427 |
-
*/
|
1428 |
-
var $image_text_percent;
|
1429 |
-
|
1430 |
-
/**
|
1431 |
-
* Sets the text background color for the text label
|
1432 |
-
*
|
1433 |
-
* Value is an hexadecimal color, such as #FFFFFF
|
1434 |
-
*
|
1435 |
-
* Default value is null (no background)
|
1436 |
-
*
|
1437 |
-
* @access public
|
1438 |
-
* @var string;
|
1439 |
-
*/
|
1440 |
-
var $image_text_background;
|
1441 |
-
|
1442 |
-
/**
|
1443 |
-
* Sets the text background visibility in the text label
|
1444 |
-
*
|
1445 |
-
* Value is a percentage, as an integer between 0 and 100
|
1446 |
-
*
|
1447 |
-
* Default value is 100
|
1448 |
-
*
|
1449 |
-
* @access public
|
1450 |
-
* @var integer
|
1451 |
-
*/
|
1452 |
-
var $image_text_background_percent;
|
1453 |
-
|
1454 |
-
/**
|
1455 |
-
* Sets the text font in the text label
|
1456 |
-
*
|
1457 |
-
* Value is a an integer between 1 and 5 for GD built-in fonts. 1 is the smallest font, 5 the biggest
|
1458 |
-
* Value can also be a string, which represents the path to a GDF font. The font will be loaded into GD, and used as a built-in font.
|
1459 |
-
*
|
1460 |
-
* Default value is 5
|
1461 |
-
*
|
1462 |
-
* @access public
|
1463 |
-
* @var mixed;
|
1464 |
-
*/
|
1465 |
-
var $image_text_font;
|
1466 |
-
|
1467 |
-
/**
|
1468 |
-
* Sets the text label position within the image
|
1469 |
-
*
|
1470 |
-
* Value is one or two out of 'TBLR' (top, bottom, left, right)
|
1471 |
-
*
|
1472 |
-
* The positions are as following:
|
1473 |
-
* <pre>
|
1474 |
-
* TL T TR
|
1475 |
-
* L R
|
1476 |
-
* BL B BR
|
1477 |
-
* </pre>
|
1478 |
-
*
|
1479 |
-
* Default value is null (centered, horizontal and vertical)
|
1480 |
-
*
|
1481 |
-
* Note that is {@link image_text_x} and {@link image_text_y} are used, this setting has no effect
|
1482 |
-
*
|
1483 |
-
* @access public
|
1484 |
-
* @var string;
|
1485 |
-
*/
|
1486 |
-
var $image_text_position;
|
1487 |
-
|
1488 |
-
/**
|
1489 |
-
* Sets the text label absolute X position within the image
|
1490 |
-
*
|
1491 |
-
* Value is in pixels, representing the distance between the left of the image and the label
|
1492 |
-
* If a negative value is used, it will represent the distance between the right of the image and the label
|
1493 |
-
*
|
1494 |
-
* Default value is null (so {@link image_text_position} is used)
|
1495 |
-
*
|
1496 |
-
* @access public
|
1497 |
-
* @var integer
|
1498 |
-
*/
|
1499 |
-
var $image_text_x;
|
1500 |
-
|
1501 |
-
/**
|
1502 |
-
* Sets the text label absolute Y position within the image
|
1503 |
-
*
|
1504 |
-
* Value is in pixels, representing the distance between the top of the image and the label
|
1505 |
-
* If a negative value is used, it will represent the distance between the bottom of the image and the label
|
1506 |
-
*
|
1507 |
-
* Default value is null (so {@link image_text_position} is used)
|
1508 |
-
*
|
1509 |
-
* @access public
|
1510 |
-
* @var integer
|
1511 |
-
*/
|
1512 |
-
var $image_text_y;
|
1513 |
-
|
1514 |
-
/**
|
1515 |
-
* Sets the text label padding
|
1516 |
-
*
|
1517 |
-
* Value is in pixels, representing the distance between the text and the label background border
|
1518 |
-
*
|
1519 |
-
* Default value is 0
|
1520 |
-
*
|
1521 |
-
* This setting can be overriden by {@link image_text_padding_x} and {@link image_text_padding_y}
|
1522 |
-
*
|
1523 |
-
* @access public
|
1524 |
-
* @var integer
|
1525 |
-
*/
|
1526 |
-
var $image_text_padding;
|
1527 |
-
|
1528 |
-
/**
|
1529 |
-
* Sets the text label horizontal padding
|
1530 |
-
*
|
1531 |
-
* Value is in pixels, representing the distance between the text and the left and right label background borders
|
1532 |
-
*
|
1533 |
-
* Default value is null
|
1534 |
-
*
|
1535 |
-
* If set, this setting overrides the horizontal part of {@link image_text_padding}
|
1536 |
-
*
|
1537 |
-
* @access public
|
1538 |
-
* @var integer
|
1539 |
-
*/
|
1540 |
-
var $image_text_padding_x;
|
1541 |
-
|
1542 |
-
/**
|
1543 |
-
* Sets the text label vertical padding
|
1544 |
-
*
|
1545 |
-
* Value is in pixels, representing the distance between the text and the top and bottom label background borders
|
1546 |
-
*
|
1547 |
-
* Default value is null
|
1548 |
-
*
|
1549 |
-
* If set, his setting overrides the vertical part of {@link image_text_padding}
|
1550 |
-
*
|
1551 |
-
* @access public
|
1552 |
-
* @var integer
|
1553 |
-
*/
|
1554 |
-
var $image_text_padding_y;
|
1555 |
-
|
1556 |
-
/**
|
1557 |
-
* Sets the text alignment
|
1558 |
-
*
|
1559 |
-
* Value is a string, which can be either 'L', 'C' or 'R'
|
1560 |
-
*
|
1561 |
-
* Default value is 'C'
|
1562 |
-
*
|
1563 |
-
* This setting is relevant only if the text has several lines.
|
1564 |
-
*
|
1565 |
-
* @access public
|
1566 |
-
* @var string;
|
1567 |
-
*/
|
1568 |
-
var $image_text_alignment;
|
1569 |
-
|
1570 |
-
/**
|
1571 |
-
* Sets the text line spacing
|
1572 |
-
*
|
1573 |
-
* Value is an integer, in pixels
|
1574 |
-
*
|
1575 |
-
* Default value is 0
|
1576 |
-
*
|
1577 |
-
* This setting is relevant only if the text has several lines.
|
1578 |
-
*
|
1579 |
-
* @access public
|
1580 |
-
* @var integer
|
1581 |
-
*/
|
1582 |
-
var $image_text_line_spacing;
|
1583 |
-
|
1584 |
-
/**
|
1585 |
-
* Sets the height of the reflection
|
1586 |
-
*
|
1587 |
-
* Value is an integer in pixels, or a string which format can be in pixels or percentage.
|
1588 |
-
* For instance, values can be : 40, '40', '40px' or '40%'
|
1589 |
-
*
|
1590 |
-
* Default value is null, no reflection
|
1591 |
-
*
|
1592 |
-
* @access public
|
1593 |
-
* @var mixed;
|
1594 |
-
*/
|
1595 |
-
var $image_reflection_height;
|
1596 |
-
|
1597 |
-
/**
|
1598 |
-
* Sets the space between the source image and its relection
|
1599 |
-
*
|
1600 |
-
* Value is an integer in pixels, which can be negative
|
1601 |
-
*
|
1602 |
-
* Default value is 2
|
1603 |
-
*
|
1604 |
-
* This setting is relevant only if {@link image_reflection_height} is set
|
1605 |
-
*
|
1606 |
-
* @access public
|
1607 |
-
* @var integer
|
1608 |
-
*/
|
1609 |
-
var $image_reflection_space;
|
1610 |
-
|
1611 |
-
/**
|
1612 |
-
* Sets the color of the reflection background (deprecated)
|
1613 |
-
*
|
1614 |
-
* Value is an hexadecimal color, such as #FFFFFF
|
1615 |
-
*
|
1616 |
-
* Default value is #FFFFFF
|
1617 |
-
*
|
1618 |
-
* This setting is relevant only if {@link image_reflection_height} is set
|
1619 |
-
*
|
1620 |
-
* This setting is now deprecated in favor of {@link image_default_color}
|
1621 |
-
*
|
1622 |
-
* @access public
|
1623 |
-
* @var string;
|
1624 |
-
*/
|
1625 |
-
var $image_reflection_color;
|
1626 |
-
|
1627 |
-
/**
|
1628 |
-
* Sets the initial opacity of the reflection
|
1629 |
-
*
|
1630 |
-
* Value is an integer between 0 (no opacity) and 100 (full opacity).
|
1631 |
-
* The reflection will start from {@link image_reflection_opacity} and end up at 0
|
1632 |
-
*
|
1633 |
-
* Default value is 60
|
1634 |
-
*
|
1635 |
-
* This setting is relevant only if {@link image_reflection_height} is set
|
1636 |
-
*
|
1637 |
-
* @access public
|
1638 |
-
* @var integer
|
1639 |
-
*/
|
1640 |
-
var $image_reflection_opacity;
|
1641 |
-
|
1642 |
-
/**
|
1643 |
-
* Flips the image vertically or horizontally
|
1644 |
-
*
|
1645 |
-
* Value is either 'h' or 'v', as in horizontal and vertical
|
1646 |
-
*
|
1647 |
-
* Default value is null (no flip)
|
1648 |
-
*
|
1649 |
-
* @access public
|
1650 |
-
* @var string;
|
1651 |
-
*/
|
1652 |
-
var $image_flip;
|
1653 |
-
|
1654 |
-
/**
|
1655 |
-
* Rotates the image by increments of 45 degrees
|
1656 |
-
*
|
1657 |
-
* Value is either 90, 180 or 270
|
1658 |
-
*
|
1659 |
-
* Default value is null (no rotation)
|
1660 |
-
*
|
1661 |
-
* @access public
|
1662 |
-
* @var string;
|
1663 |
-
*/
|
1664 |
-
var $image_rotate;
|
1665 |
-
|
1666 |
-
/**
|
1667 |
-
* Crops an image
|
1668 |
-
*
|
1669 |
-
* Values are four dimensions, or two, or one (CSS style)
|
1670 |
-
* They represent the amount cropped top, right, bottom and left.
|
1671 |
-
* These values can either be in an array, or a space separated string.
|
1672 |
-
* Each value can be in pixels (with or without 'px'), or percentage (of the source image)
|
1673 |
-
*
|
1674 |
-
* For instance, are valid:
|
1675 |
-
* <pre>
|
1676 |
-
* $foo->image_crop = 20 OR array(20);
|
1677 |
-
* $foo->image_crop = '20px' OR array('20px');
|
1678 |
-
* $foo->image_crop = '20 40' OR array('20', 40);
|
1679 |
-
* $foo->image_crop = '-20 25%' OR array(-20, '25%');
|
1680 |
-
* $foo->image_crop = '20px 25%' OR array('20px', '25%');
|
1681 |
-
* $foo->image_crop = '20% 25%' OR array('20%', '25%');
|
1682 |
-
* $foo->image_crop = '20% 25% 10% 30%' OR array('20%', '25%', '10%', '30%');
|
1683 |
-
* $foo->image_crop = '20px 25px 2px 2px' OR array('20px', '25%px', '2px', '2px');
|
1684 |
-
* $foo->image_crop = '20 25% 40px 10%' OR array(20, '25%', '40px', '10%');
|
1685 |
-
* </pre>
|
1686 |
-
*
|
1687 |
-
* If a value is negative, the image will be expanded, and the extra parts will be filled with black
|
1688 |
-
*
|
1689 |
-
* Default value is null (no cropping)
|
1690 |
-
*
|
1691 |
-
* @access public
|
1692 |
-
* @var string OR array;
|
1693 |
-
*/
|
1694 |
-
var $image_crop;
|
1695 |
-
|
1696 |
-
/**
|
1697 |
-
* Crops an image, before an eventual resizing
|
1698 |
-
*
|
1699 |
-
* See {@link image_crop} for valid formats
|
1700 |
-
*
|
1701 |
-
* Default value is null (no cropping)
|
1702 |
-
*
|
1703 |
-
* @access public
|
1704 |
-
* @var string OR array;
|
1705 |
-
*/
|
1706 |
-
var $image_precrop;
|
1707 |
-
|
1708 |
-
/**
|
1709 |
-
* Adds a bevel border on the image
|
1710 |
-
*
|
1711 |
-
* Value is a positive integer, representing the thickness of the bevel
|
1712 |
-
*
|
1713 |
-
* If the bevel colors are the same as the background, it makes a fade out effect
|
1714 |
-
*
|
1715 |
-
* Default value is null (no bevel)
|
1716 |
-
*
|
1717 |
-
* @access public
|
1718 |
-
* @var integer
|
1719 |
-
*/
|
1720 |
-
var $image_bevel;
|
1721 |
-
|
1722 |
-
/**
|
1723 |
-
* Top and left bevel color
|
1724 |
-
*
|
1725 |
-
* Value is a color, in hexadecimal format
|
1726 |
-
* This setting is used only if {@link image_bevel} is set
|
1727 |
-
*
|
1728 |
-
* Default value is #FFFFFF
|
1729 |
-
*
|
1730 |
-
* @access public
|
1731 |
-
* @var string;
|
1732 |
-
*/
|
1733 |
-
var $image_bevel_color1;
|
1734 |
-
|
1735 |
-
/**
|
1736 |
-
* Right and bottom bevel color
|
1737 |
-
*
|
1738 |
-
* Value is a color, in hexadecimal format
|
1739 |
-
* This setting is used only if {@link image_bevel} is set
|
1740 |
-
*
|
1741 |
-
* Default value is #000000
|
1742 |
-
*
|
1743 |
-
* @access public
|
1744 |
-
* @var string;
|
1745 |
-
*/
|
1746 |
-
var $image_bevel_color2;
|
1747 |
-
|
1748 |
-
/**
|
1749 |
-
* Adds a single-color border on the outer of the image
|
1750 |
-
*
|
1751 |
-
* Values are four dimensions, or two, or one (CSS style)
|
1752 |
-
* They represent the border thickness top, right, bottom and left.
|
1753 |
-
* These values can either be in an array, or a space separated string.
|
1754 |
-
* Each value can be in pixels (with or without 'px'), or percentage (of the source image)
|
1755 |
-
*
|
1756 |
-
* See {@link image_crop} for valid formats
|
1757 |
-
*
|
1758 |
-
* If a value is negative, the image will be cropped.
|
1759 |
-
* Note that the dimensions of the picture will be increased by the borders' thickness
|
1760 |
-
*
|
1761 |
-
* Default value is null (no border)
|
1762 |
-
*
|
1763 |
-
* @access public
|
1764 |
-
* @var integer
|
1765 |
-
*/
|
1766 |
-
var $image_border;
|
1767 |
-
|
1768 |
-
/**
|
1769 |
-
* Border color
|
1770 |
-
*
|
1771 |
-
* Value is a color, in hexadecimal format.
|
1772 |
-
* This setting is used only if {@link image_border} is set
|
1773 |
-
*
|
1774 |
-
* Default value is #FFFFFF
|
1775 |
-
*
|
1776 |
-
* @access public
|
1777 |
-
* @var string;
|
1778 |
-
*/
|
1779 |
-
var $image_border_color;
|
1780 |
-
|
1781 |
-
/**
|
1782 |
-
* Adds a multi-color frame on the outer of the image
|
1783 |
-
*
|
1784 |
-
* Value is an integer. Two values are possible for now:
|
1785 |
-
* 1 for flat border, meaning that the frame is mirrored horizontally and vertically
|
1786 |
-
* 2 for crossed border, meaning that the frame will be inversed, as in a bevel effect
|
1787 |
-
*
|
1788 |
-
* The frame will be composed of colored lines set in {@link image_frame_colors}
|
1789 |
-
*
|
1790 |
-
* Note that the dimensions of the picture will be increased by the borders' thickness
|
1791 |
-
*
|
1792 |
-
* Default value is null (no frame)
|
1793 |
-
*
|
1794 |
-
* @access public
|
1795 |
-
* @var integer
|
1796 |
-
*/
|
1797 |
-
var $image_frame;
|
1798 |
-
|
1799 |
-
/**
|
1800 |
-
* Sets the colors used to draw a frame
|
1801 |
-
*
|
1802 |
-
* Values is a list of n colors in hexadecimal format.
|
1803 |
-
* These values can either be in an array, or a space separated string.
|
1804 |
-
*
|
1805 |
-
* The colors are listed in the following order: from the outset of the image to its center
|
1806 |
-
*
|
1807 |
-
* For instance, are valid:
|
1808 |
-
* <pre>
|
1809 |
-
* $foo->image_frame_colors = '#FFFFFF #999999 #666666 #000000';
|
1810 |
-
* $foo->image_frame_colors = array('#FFFFFF', '#999999', '#666666', '#000000');
|
1811 |
-
* </pre>
|
1812 |
-
*
|
1813 |
-
* This setting is used only if {@link image_frame} is set
|
1814 |
-
*
|
1815 |
-
* Default value is '#FFFFFF #999999 #666666 #000000'
|
1816 |
-
*
|
1817 |
-
* @access public
|
1818 |
-
* @var string OR array;
|
1819 |
-
*/
|
1820 |
-
var $image_frame_colors;
|
1821 |
-
|
1822 |
-
/**
|
1823 |
-
* Adds a watermark on the image
|
1824 |
-
*
|
1825 |
-
* Value is a local image filename, relative or absolute. GIF, JPG, BMP and PNG are supported, as well as PNG alpha.
|
1826 |
-
*
|
1827 |
-
* If set, this setting allow the use of all other settings starting with image_watermark_
|
1828 |
-
*
|
1829 |
-
* Default value is null
|
1830 |
-
*
|
1831 |
-
* @access public
|
1832 |
-
* @var string;
|
1833 |
-
*/
|
1834 |
-
var $image_watermark;
|
1835 |
-
|
1836 |
-
/**
|
1837 |
-
* Sets the watermarkposition within the image
|
1838 |
-
*
|
1839 |
-
* Value is one or two out of 'TBLR' (top, bottom, left, right)
|
1840 |
-
*
|
1841 |
-
* The positions are as following: TL T TR
|
1842 |
-
* L R
|
1843 |
-
* BL B BR
|
1844 |
-
*
|
1845 |
-
* Default value is null (centered, horizontal and vertical)
|
1846 |
-
*
|
1847 |
-
* Note that is {@link image_watermark_x} and {@link image_watermark_y} are used, this setting has no effect
|
1848 |
-
*
|
1849 |
-
* @access public
|
1850 |
-
* @var string;
|
1851 |
-
*/
|
1852 |
-
var $image_watermark_position;
|
1853 |
-
|
1854 |
-
/**
|
1855 |
-
* Sets the watermark absolute X position within the image
|
1856 |
-
*
|
1857 |
-
* Value is in pixels, representing the distance between the top of the image and the watermark
|
1858 |
-
* If a negative value is used, it will represent the distance between the bottom of the image and the watermark
|
1859 |
-
*
|
1860 |
-
* Default value is null (so {@link image_watermark_position} is used)
|
1861 |
-
*
|
1862 |
-
* @access public
|
1863 |
-
* @var integer
|
1864 |
-
*/
|
1865 |
-
var $image_watermark_x;
|
1866 |
-
|
1867 |
-
/**
|
1868 |
-
* Sets the twatermark absolute Y position within the image
|
1869 |
-
*
|
1870 |
-
* Value is in pixels, representing the distance between the left of the image and the watermark
|
1871 |
-
* If a negative value is used, it will represent the distance between the right of the image and the watermark
|
1872 |
-
*
|
1873 |
-
* Default value is null (so {@link image_watermark_position} is used)
|
1874 |
-
*
|
1875 |
-
* @access public
|
1876 |
-
* @var integer
|
1877 |
-
*/
|
1878 |
-
var $image_watermark_y;
|
1879 |
-
|
1880 |
-
/**
|
1881 |
-
* Allowed MIME types
|
1882 |
-
*
|
1883 |
-
* Default is a selection of safe mime-types, but you might want to change it
|
1884 |
-
*
|
1885 |
-
* Simple wildcards are allowed, such as image/* or application/*
|
1886 |
-
*
|
1887 |
-
* @access public
|
1888 |
-
* @var array
|
1889 |
-
*/
|
1890 |
-
var $allowed;
|
1891 |
-
|
1892 |
-
/**
|
1893 |
-
* Forbidden MIME types
|
1894 |
-
*
|
1895 |
-
* Default is a selection of safe mime-types, but you might want to change it
|
1896 |
-
* To only check for forbidden MIME types, and allow everything else, set {@link allowed} to array('* / *') without the spaces
|
1897 |
-
*
|
1898 |
-
* Simple wildcards are allowed, such as image/* or application/*
|
1899 |
-
*
|
1900 |
-
* @access public
|
1901 |
-
* @var array
|
1902 |
-
*/
|
1903 |
-
var $forbidden;
|
1904 |
-
|
1905 |
-
/**
|
1906 |
-
* Array of translated error messages
|
1907 |
-
*
|
1908 |
-
* By default, the language is english (en_US)
|
1909 |
-
* Translations can be in separate files, in a lang/ subdirectory
|
1910 |
-
*
|
1911 |
-
* @access public
|
1912 |
-
* @var array
|
1913 |
-
*/
|
1914 |
-
var $translation;
|
1915 |
-
|
1916 |
-
/**
|
1917 |
-
* Language selected for the translations
|
1918 |
-
*
|
1919 |
-
* By default, the language is english (en_US)
|
1920 |
-
*
|
1921 |
-
* @access public
|
1922 |
-
* @var array
|
1923 |
-
*/
|
1924 |
-
var $language;
|
1925 |
-
|
1926 |
-
/**
|
1927 |
-
* Init or re-init all the processing variables to their default values
|
1928 |
-
*
|
1929 |
-
* This function is called in the constructor, and after each call of {@link process}
|
1930 |
-
*
|
1931 |
-
* @access private
|
1932 |
-
*/
|
1933 |
-
function init() {
|
1934 |
-
|
1935 |
-
// overiddable variables
|
1936 |
-
$this->file_new_name_body = ''; // replace the name body
|
1937 |
-
$this->file_name_body_add = ''; // append to the name body
|
1938 |
-
$this->file_name_body_pre = ''; // prepend to the name body
|
1939 |
-
$this->file_new_name_ext = ''; // replace the file extension
|
1940 |
-
$this->file_safe_name = true; // format safely the filename
|
1941 |
-
$this->file_overwrite = false; // allows overwritting if the file already exists
|
1942 |
-
$this->file_auto_rename = true; // auto-rename if the file already exists
|
1943 |
-
$this->dir_auto_create = true; // auto-creates directory if missing
|
1944 |
-
$this->dir_auto_chmod = true; // auto-chmod directory if not writeable
|
1945 |
-
$this->dir_chmod = 0777; // default chmod to use
|
1946 |
-
|
1947 |
-
$this->mime_check = true; // checks the mime type against the allowed list
|
1948 |
-
$this->mime_fileinfo = true; // MIME detection with Fileinfo PECL extension
|
1949 |
-
$this->mime_file = true; // MIME detection with UNIX file() command
|
1950 |
-
$this->mime_magic = true; // MIME detection with mime_magic (mime_content_type())
|
1951 |
-
$this->mime_getimagesize = true; // MIME detection with getimagesize()
|
1952 |
-
$this->no_script = true; // turns scripts into test files
|
1953 |
-
|
1954 |
-
$val = trim(ini_get('upload_max_filesize'));
|
1955 |
-
$last = strtolower($val{strlen($val)-1});
|
1956 |
-
switch($last) {
|
1957 |
-
case 'g':
|
1958 |
-
$val *= 1024;
|
1959 |
-
case 'm':
|
1960 |
-
$val *= 1024;
|
1961 |
-
case 'k':
|
1962 |
-
$val *= 1024;
|
1963 |
-
}
|
1964 |
-
$this->file_max_size = $val;
|
1965 |
-
|
1966 |
-
$this->image_resize = false; // resize the image
|
1967 |
-
$this->image_convert = ''; // convert. values :''; 'png'; 'jpeg'; 'gif'; 'bmp'
|
1968 |
-
|
1969 |
-
$this->image_x = 150;
|
1970 |
-
$this->image_y = 150;
|
1971 |
-
$this->image_ratio = false; // keeps aspect ratio with x and y dimensions
|
1972 |
-
$this->image_ratio_crop = false; // keeps aspect ratio with x and y dimensions, filling the space
|
1973 |
-
$this->image_ratio_fill = false; // keeps aspect ratio with x and y dimensions, fitting the image in the space, and coloring the rest
|
1974 |
-
$this->image_ratio_pixels = false; // keeps aspect ratio, calculating x and y so that the image is approx the set number of pixels
|
1975 |
-
$this->image_ratio_no_zoom_in = false;
|
1976 |
-
$this->image_ratio_no_zoom_out = false;
|
1977 |
-
$this->image_ratio_x = false; // calculate the $image_x if true
|
1978 |
-
$this->image_ratio_y = false; // calculate the $image_y if true
|
1979 |
-
$this->jpeg_quality = 85;
|
1980 |
-
$this->jpeg_size = null;
|
1981 |
-
$this->preserve_transparency = false;
|
1982 |
-
$this->image_is_transparent = false;
|
1983 |
-
$this->image_transparent_color = null;
|
1984 |
-
$this->image_background_color = null;
|
1985 |
-
$this->image_default_color = '#ffffff';
|
1986 |
-
$this->image_is_palette = false;
|
1987 |
-
|
1988 |
-
$this->image_max_width = null;
|
1989 |
-
$this->image_max_height = null;
|
1990 |
-
$this->image_max_pixels = null;
|
1991 |
-
$this->image_max_ratio = null;
|
1992 |
-
$this->image_min_width = null;
|
1993 |
-
$this->image_min_height = null;
|
1994 |
-
$this->image_min_pixels = null;
|
1995 |
-
$this->image_min_ratio = null;
|
1996 |
-
|
1997 |
-
$this->image_brightness = null;
|
1998 |
-
$this->image_contrast = null;
|
1999 |
-
$this->image_threshold = null;
|
2000 |
-
$this->image_tint_color = null;
|
2001 |
-
$this->image_overlay_color = null;
|
2002 |
-
$this->image_overlay_percent = null;
|
2003 |
-
$this->image_negative = false;
|
2004 |
-
$this->image_greyscale = false;
|
2005 |
-
|
2006 |
-
$this->image_text = null;
|
2007 |
-
$this->image_text_direction = null;
|
2008 |
-
$this->image_text_color = '#FFFFFF';
|
2009 |
-
$this->image_text_percent = 100;
|
2010 |
-
$this->image_text_background = null;
|
2011 |
-
$this->image_text_background_percent = 100;
|
2012 |
-
$this->image_text_font = 5;
|
2013 |
-
$this->image_text_x = null;
|
2014 |
-
$this->image_text_y = null;
|
2015 |
-
$this->image_text_position = null;
|
2016 |
-
$this->image_text_padding = 0;
|
2017 |
-
$this->image_text_padding_x = null;
|
2018 |
-
$this->image_text_padding_y = null;
|
2019 |
-
$this->image_text_alignment = 'C';
|
2020 |
-
$this->image_text_line_spacing = 0;
|
2021 |
-
|
2022 |
-
$this->image_reflection_height = null;
|
2023 |
-
$this->image_reflection_space = 2;
|
2024 |
-
$this->image_reflection_color = '#ffffff';
|
2025 |
-
$this->image_reflection_opacity = 60;
|
2026 |
-
|
2027 |
-
$this->image_watermark = null;
|
2028 |
-
$this->image_watermark_x = null;
|
2029 |
-
$this->image_watermark_y = null;
|
2030 |
-
$this->image_watermark_position = null;
|
2031 |
-
|
2032 |
-
$this->image_flip = null;
|
2033 |
-
$this->image_rotate = null;
|
2034 |
-
$this->image_crop = null;
|
2035 |
-
$this->image_precrop = null;
|
2036 |
-
|
2037 |
-
$this->image_bevel = null;
|
2038 |
-
$this->image_bevel_color1 = '#FFFFFF';
|
2039 |
-
$this->image_bevel_color2 = '#000000';
|
2040 |
-
$this->image_border = null;
|
2041 |
-
$this->image_border_color = '#FFFFFF';
|
2042 |
-
$this->image_frame = null;
|
2043 |
-
$this->image_frame_colors = '#FFFFFF #999999 #666666 #000000';
|
2044 |
-
|
2045 |
-
$this->forbidden = array();
|
2046 |
-
$this->allowed = array("application/arj",
|
2047 |
-
"application/excel",
|
2048 |
-
"application/gnutar",
|
2049 |
-
"application/mspowerpoint",
|
2050 |
-
"application/msword",
|
2051 |
-
"application/octet-stream",
|
2052 |
-
"application/onenote",
|
2053 |
-
"application/pdf",
|
2054 |
-
"application/plain",
|
2055 |
-
"application/postscript",
|
2056 |
-
"application/powerpoint",
|
2057 |
-
"application/rar",
|
2058 |
-
"application/rtf",
|
2059 |
-
"application/vnd.ms-excel",
|
2060 |
-
"application/vnd.ms-excel.addin.macroEnabled.12",
|
2061 |
-
"application/vnd.ms-excel.sheet.binary.macroEnabled.12",
|
2062 |
-
"application/vnd.ms-excel.sheet.macroEnabled.12",
|
2063 |
-
"application/vnd.ms-excel.template.macroEnabled.12",
|
2064 |
-
"application/vnd.ms-office",
|
2065 |
-
"application/vnd.ms-officetheme",
|
2066 |
-
"application/vnd.ms-powerpoint",
|
2067 |
-
"application/vnd.ms-powerpoint.addin.macroEnabled.12",
|
2068 |
-
"application/vnd.ms-powerpoint.presentation.macroEnabled.12",
|
2069 |
-
"application/vnd.ms-powerpoint.slide.macroEnabled.12",
|
2070 |
-
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12",
|
2071 |
-
"application/vnd.ms-powerpoint.template.macroEnabled.12",
|
2072 |
-
"application/vnd.ms-word",
|
2073 |
-
"application/vnd.ms-word.document.macroEnabled.12",
|
2074 |
-
"application/vnd.ms-word.template.macroEnabled.12",
|
2075 |
-
"application/vnd.oasis.opendocument.chart",
|
2076 |
-
"application/vnd.oasis.opendocument.database",
|
2077 |
-
"application/vnd.oasis.opendocument.formula",
|
2078 |
-
"application/vnd.oasis.opendocument.graphics",
|
2079 |
-
"application/vnd.oasis.opendocument.graphics-template",
|
2080 |
-
"application/vnd.oasis.opendocument.image",
|
2081 |
-
"application/vnd.oasis.opendocument.presentation",
|
2082 |
-
"application/vnd.oasis.opendocument.presentation-template",
|
2083 |
-
"application/vnd.oasis.opendocument.spreadsheet",
|
2084 |
-
"application/vnd.oasis.opendocument.spreadsheet-template",
|
2085 |
-
"application/vnd.oasis.opendocument.text",
|
2086 |
-
"application/vnd.oasis.opendocument.text-master",
|
2087 |
-
"application/vnd.oasis.opendocument.text-template",
|
2088 |
-
"application/vnd.oasis.opendocument.text-web",
|
2089 |
-
"application/vnd.openofficeorg.extension",
|
2090 |
-
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
2091 |
-
"application/vnd.openxmlformats-officedocument.presentationml.slide",
|
2092 |
-
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
2093 |
-
"application/vnd.openxmlformats-officedocument.presentationml.template",
|
2094 |
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
2095 |
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
2096 |
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
2097 |
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
2098 |
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
2099 |
-
"application/vocaltec-media-file",
|
2100 |
-
"application/wordperfect",
|
2101 |
-
"application/x-bittorrent",
|
2102 |
-
"application/x-bzip",
|
2103 |
-
"application/x-bzip2",
|
2104 |
-
"application/x-compressed",
|
2105 |
-
"application/x-excel",
|
2106 |
-
"application/x-gzip",
|
2107 |
-
"application/x-latex",
|
2108 |
-
"application/x-midi",
|
2109 |
-
"application/xml",
|
2110 |
-
"application/x-msexcel",
|
2111 |
-
"application/x-rar-compressed",
|
2112 |
-
"application/x-rtf",
|
2113 |
-
"application/x-shockwave-flash",
|
2114 |
-
"application/x-sit",
|
2115 |
-
"application/x-stuffit",
|
2116 |
-
"application/x-troff-msvideo",
|
2117 |
-
"application/x-zip",
|
2118 |
-
"application/x-zip-compressed",
|
2119 |
-
"application/zip",
|
2120 |
-
"audio/*",
|
2121 |
-
"image/*",
|
2122 |
-
"multipart/x-gzip",
|
2123 |
-
"multipart/x-zip",
|
2124 |
-
"text/plain",
|
2125 |
-
"text/richtext",
|
2126 |
-
"text/xml",
|
2127 |
-
"video/*");
|
2128 |
-
|
2129 |
-
}
|
2130 |
-
|
2131 |
-
/**
|
2132 |
-
* Constructor. Checks if the file has been uploaded
|
2133 |
-
*
|
2134 |
-
* The constructor takes $_FILES['form_field'] array as argument
|
2135 |
-
* where form_field is the form field name
|
2136 |
-
*
|
2137 |
-
* The constructor will check if the file has been uploaded in its temporary location, and
|
2138 |
-
* accordingly will set {@link uploaded} (and {@link error} is an error occurred)
|
2139 |
-
*
|
2140 |
-
* If the file has been uploaded, the constructor will populate all the variables holding the upload
|
2141 |
-
* information (none of the processing class variables are used here).
|
2142 |
-
* You can have access to information about the file (name, size, MIME type...).
|
2143 |
-
*
|
2144 |
-
*
|
2145 |
-
* Alternatively, you can set the first argument to be a local filename (string)
|
2146 |
-
* This allows processing of a local file, as if the file was uploaded
|
2147 |
-
*
|
2148 |
-
* The optional second argument allows you to set the language for the error messages
|
2149 |
-
*
|
2150 |
-
* @access private
|
2151 |
-
* @param array $file $_FILES['form_field']
|
2152 |
-
* or string $file Local filename
|
2153 |
-
*/
|
2154 |
-
function akUpload( $file ) {
|
2155 |
-
|
2156 |
-
$this->version = '0.29';
|
2157 |
-
$this->language = 'en_US'; // Not used.
|
2158 |
-
|
2159 |
-
$this->file_src_name = '';
|
2160 |
-
$this->file_src_name_body = '';
|
2161 |
-
$this->file_src_name_ext = '';
|
2162 |
-
$this->file_src_mime = '';
|
2163 |
-
$this->file_src_size = '';
|
2164 |
-
$this->file_src_error = '';
|
2165 |
-
$this->file_src_pathname = '';
|
2166 |
-
$this->file_src_temp = '';
|
2167 |
-
|
2168 |
-
$this->file_dst_path = '';
|
2169 |
-
$this->file_dst_name = '';
|
2170 |
-
$this->file_dst_name_body = '';
|
2171 |
-
$this->file_dst_name_ext = '';
|
2172 |
-
$this->file_dst_pathname = '';
|
2173 |
-
|
2174 |
-
$this->image_src_x = null;
|
2175 |
-
$this->image_src_y = null;
|
2176 |
-
$this->image_src_bits = null;
|
2177 |
-
$this->image_src_type = null;
|
2178 |
-
$this->image_src_pixels = null;
|
2179 |
-
$this->image_dst_x = 0;
|
2180 |
-
$this->image_dst_y = 0;
|
2181 |
-
|
2182 |
-
$this->uploaded = true;
|
2183 |
-
$this->no_upload_check = false;
|
2184 |
-
$this->processed = true;
|
2185 |
-
$this->error = '';
|
2186 |
-
$this->log = '';
|
2187 |
-
$this->allowed = array();
|
2188 |
-
$this->forbidden = array();
|
2189 |
-
$this->file_is_image = false;
|
2190 |
-
$this->init();
|
2191 |
-
$info = null;
|
2192 |
-
$mime_from_browser = null;
|
2193 |
-
|
2194 |
-
$this->translation = array();
|
2195 |
-
$this->translation['file_error'] = __('File error. Please try again.', 'akfw');
|
2196 |
-
$this->translation['local_file_missing'] = __('Local file doesn\'t exist.', 'akfw');
|
2197 |
-
$this->translation['local_file_not_readable'] = __('Local file is not readable.', 'akfw');
|
2198 |
-
$this->translation['uploaded_too_big_ini'] = __('File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini).', 'akfw');
|
2199 |
-
$this->translation['uploaded_too_big_html'] = __('File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form).', 'akfw');
|
2200 |
-
$this->translation['uploaded_partial'] = __('File upload error (the uploaded file was only partially uploaded).', 'akfw');
|
2201 |
-
$this->translation['uploaded_missing'] = __('File upload error (no file was uploaded).', 'akfw');
|
2202 |
-
$this->translation['uploaded_no_tmp_dir'] = __('File upload error (missing a temporary folder).', 'akfw');
|
2203 |
-
$this->translation['uploaded_cant_write'] = __('File upload error (failed to write file to disk).', 'akfw');
|
2204 |
-
$this->translation['uploaded_err_extension'] = __('File upload error (file upload stopped by extension).', 'akfw');
|
2205 |
-
$this->translation['uploaded_unknown'] = __('File upload error (unknown error code).', 'akfw');
|
2206 |
-
$this->translation['try_again'] = __('File upload error. Please try again.', 'akfw');
|
2207 |
-
$this->translation['file_too_big'] = __('File too big.', 'akfw');
|
2208 |
-
$this->translation['no_mime'] = __('MIME type can\'t be detected.', 'akfw');
|
2209 |
-
$this->translation['incorrect_file'] = __('Incorrect type of file.', 'akfw');
|
2210 |
-
$this->translation['image_too_wide'] = __('Image too wide.', 'akfw');
|
2211 |
-
$this->translation['image_too_narrow'] = __('Image too narrow.', 'akfw');
|
2212 |
-
$this->translation['image_too_high'] = __('Image too high.', 'akfw');
|
2213 |
-
$this->translation['image_too_short'] = __('Image too short.', 'akfw');
|
2214 |
-
$this->translation['ratio_too_high'] = __('Image ratio too high (image too wide).', 'akfw');
|
2215 |
-
$this->translation['ratio_too_low'] = __('Image ratio too low (image too high).', 'akfw');
|
2216 |
-
$this->translation['too_many_pixels'] = __('Image has too many pixels.', 'akfw');
|
2217 |
-
$this->translation['not_enough_pixels'] = __('Image has not enough pixels.', 'akfw');
|
2218 |
-
$this->translation['file_not_uploaded'] = __('File not uploaded. Can\'t carry on a process.', 'akfw');
|
2219 |
-
$this->translation['already_exists'] = __('%s already exists. Please change the file name.', 'akfw');
|
2220 |
-
$this->translation['temp_file_missing'] = __('No correct temp source file. Can\'t carry on a process.', 'akfw');
|
2221 |
-
$this->translation['source_missing'] = __('No correct uploaded source file. Can\'t carry on a process.', 'akfw');
|
2222 |
-
$this->translation['destination_dir'] = __('Destination directory can\'t be created. Can\'t carry on a process.', 'akfw');
|
2223 |
-
$this->translation['destination_dir_missing'] = __('Destination directory doesn\'t exist. Can\'t carry on a process.', 'akfw');
|
2224 |
-
$this->translation['destination_path_not_dir'] = __('Destination path is not a directory. Can\'t carry on a process.', 'akfw');
|
2225 |
-
$this->translation['destination_dir_write'] = __('Destination directory can\'t be made writeable. Can\'t carry on a process.', 'akfw');
|
2226 |
-
$this->translation['destination_path_write'] = __('Destination path is not a writeable. Can\'t carry on a process.', 'akfw');
|
2227 |
-
$this->translation['temp_file'] = __('Can\'t create the temporary file. Can\'t carry on a process.', 'akfw');
|
2228 |
-
$this->translation['source_not_readable'] = __('Source file is not readable. Can\'t carry on a process.', 'akfw');
|
2229 |
-
$this->translation['no_create_support'] = __('No create from %s support.', 'akfw');
|
2230 |
-
$this->translation['create_error'] = __('Error in creating %s image from source.', 'akfw');
|
2231 |
-
$this->translation['source_invalid'] = __('Can\'t read image source. Not an image?.', 'akfw');
|
2232 |
-
$this->translation['gd_missing'] = __('GD doesn\'t seem to be present.', 'akfw');
|
2233 |
-
$this->translation['watermark_no_create_support'] = __('No create from %s support, can\'t read watermark.', 'akfw');
|
2234 |
-
$this->translation['watermark_create_error'] = __('No %s read support, can\'t create watermark.', 'akfw');
|
2235 |
-
$this->translation['watermark_invalid'] = __('Unknown image format, can\'t read watermark.', 'akfw');
|
2236 |
-
$this->translation['file_create'] = __('No %s create support.', 'akfw');
|
2237 |
-
$this->translation['no_conversion_type'] = __('No conversion type defined.', 'akfw');
|
2238 |
-
$this->translation['copy_failed'] = __('Error copying file on the server. copy() failed.', 'akfw');
|
2239 |
-
$this->translation['reading_failed'] = __('Error reading the file.', 'akfw');
|
2240 |
-
|
2241 |
-
// determines the supported MIME types, and matching image format
|
2242 |
-
$this->image_supported = array();
|
2243 |
-
if ($this->gdversion()) {
|
2244 |
-
if (imagetypes() & IMG_GIF) {
|
2245 |
-
$this->image_supported['image/gif'] = 'gif';
|
2246 |
-
}
|
2247 |
-
if (imagetypes() & IMG_JPG) {
|
2248 |
-
$this->image_supported['image/jpg'] = 'jpg';
|
2249 |
-
$this->image_supported['image/jpeg'] = 'jpg';
|
2250 |
-
$this->image_supported['image/pjpeg'] = 'jpg';
|
2251 |
-
}
|
2252 |
-
if (imagetypes() & IMG_PNG) {
|
2253 |
-
$this->image_supported['image/png'] = 'png';
|
2254 |
-
$this->image_supported['image/x-png'] = 'png';
|
2255 |
-
}
|
2256 |
-
if (imagetypes() & IMG_WBMP) {
|
2257 |
-
$this->image_supported['image/bmp'] = 'bmp';
|
2258 |
-
$this->image_supported['image/x-ms-bmp'] = 'bmp';
|
2259 |
-
$this->image_supported['image/x-windows-bmp'] = 'bmp';
|
2260 |
-
}
|
2261 |
-
}
|
2262 |
-
|
2263 |
-
// display some system information
|
2264 |
-
if (empty($this->log)) {
|
2265 |
-
$this->log .= '<b>system information</b><br />';
|
2266 |
-
$inis = ini_get_all();
|
2267 |
-
$open_basedir = (array_key_exists('open_basedir', $inis) && array_key_exists('local_value', $inis['open_basedir']) && !empty($inis['open_basedir']['local_value'])) ? $inis['open_basedir']['local_value'] : false;
|
2268 |
-
$gd = $this->gdversion() ? $this->gdversion(true) : 'GD not present';
|
2269 |
-
$supported = trim((in_array('png', $this->image_supported) ? 'png' : '') . ' ' . (in_array('jpg', $this->image_supported) ? 'jpg' : '') . ' ' . (in_array('gif', $this->image_supported) ? 'gif' : '') . ' ' . (in_array('bmp', $this->image_supported) ? 'bmp' : ''));
|
2270 |
-
$this->log .= '- class version : ' . $this->version . '<br />';
|
2271 |
-
$this->log .= '- operating system : ' . PHP_OS . '<br />';
|
2272 |
-
$this->log .= '- PHP version : ' . PHP_VERSION . '<br />';
|
2273 |
-
$this->log .= '- GD version : ' . $gd . '<br />';
|
2274 |
-
$this->log .= '- supported image types : ' . (!empty($supported) ? $supported : 'none') . '<br />';
|
2275 |
-
$this->log .= '- open_basedir : ' . (!empty($open_basedir) ? $open_basedir : 'no restriction') . '<br />';
|
2276 |
-
$this->log .= '- language : ' . $this->language . '<br />';
|
2277 |
-
}
|
2278 |
-
|
2279 |
-
if (!$file) {
|
2280 |
-
$this->uploaded = false;
|
2281 |
-
$this->error = $this->translate('file_error');
|
2282 |
-
}
|
2283 |
-
|
2284 |
-
// check if we sent a local filename rather than a $_FILE element
|
2285 |
-
if (!is_array($file)) {
|
2286 |
-
if (empty($file)) {
|
2287 |
-
$this->uploaded = false;
|
2288 |
-
$this->error = $this->translate('file_error');
|
2289 |
-
} else {
|
2290 |
-
$this->no_upload_check = TRUE;
|
2291 |
-
// this is a local filename, i.e.not uploaded
|
2292 |
-
$this->log .= '<b>' . $this->translate("source is a local file") . ' ' . $file . '</b><br />';
|
2293 |
-
|
2294 |
-
if ($this->uploaded && !file_exists($file)) {
|
2295 |
-
$this->uploaded = false;
|
2296 |
-
$this->error = $this->translate('local_file_missing');
|
2297 |
-
}
|
2298 |
-
|
2299 |
-
if ($this->uploaded && !is_readable($file)) {
|
2300 |
-
$this->uploaded = false;
|
2301 |
-
$this->error = $this->translate('local_file_not_readable');
|
2302 |
-
}
|
2303 |
-
|
2304 |
-
if ($this->uploaded) {
|
2305 |
-
$this->file_src_pathname = $file;
|
2306 |
-
$this->file_src_name = basename($file);
|
2307 |
-
$this->log .= '- local file name OK<br />';
|
2308 |
-
preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);
|
2309 |
-
if (is_array($extension) && sizeof($extension) > 0) {
|
2310 |
-
$this->file_src_name_ext = strtolower($extension[1]);
|
2311 |
-
$this->file_src_name_body = substr($this->file_src_name, 0, ((strlen($this->file_src_name) - strlen($this->file_src_name_ext)))-1);
|
2312 |
-
} else {
|
2313 |
-
$this->file_src_name_ext = '';
|
2314 |
-
$this->file_src_name_body = $this->file_src_name;
|
2315 |
-
}
|
2316 |
-
$this->file_src_size = (file_exists($file) ? filesize($file) : 0);
|
2317 |
-
}
|
2318 |
-
$this->file_src_error = 0;
|
2319 |
-
}
|
2320 |
-
} else {
|
2321 |
-
// this is an element from $_FILE, i.e. an uploaded file
|
2322 |
-
$this->log .= '<b>source is an uploaded file</b><br />';
|
2323 |
-
if ($this->uploaded) {
|
2324 |
-
$this->file_src_error = trim($file['error']);
|
2325 |
-
switch($this->file_src_error) {
|
2326 |
-
case UPLOAD_ERR_OK:
|
2327 |
-
// all is OK
|
2328 |
-
$this->log .= '- upload OK<br />';
|
2329 |
-
break;
|
2330 |
-
case UPLOAD_ERR_INI_SIZE:
|
2331 |
-
$this->uploaded = false;
|
2332 |
-
$this->error = $this->translate('uploaded_too_big_ini');
|
2333 |
-
break;
|
2334 |
-
case UPLOAD_ERR_FORM_SIZE:
|
2335 |
-
$this->uploaded = false;
|
2336 |
-
$this->error = $this->translate('uploaded_too_big_html');
|
2337 |
-
break;
|
2338 |
-
case UPLOAD_ERR_PARTIAL:
|
2339 |
-
$this->uploaded = false;
|
2340 |
-
$this->error = $this->translate('uploaded_partial');
|
2341 |
-
break;
|
2342 |
-
case UPLOAD_ERR_NO_FILE:
|
2343 |
-
$this->uploaded = false;
|
2344 |
-
$this->error = $this->translate('uploaded_missing');
|
2345 |
-
break;
|
2346 |
-
case @UPLOAD_ERR_NO_TMP_DIR:
|
2347 |
-
$this->uploaded = false;
|
2348 |
-
$this->error = $this->translate('uploaded_no_tmp_dir');
|
2349 |
-
break;
|
2350 |
-
case @UPLOAD_ERR_CANT_WRITE:
|
2351 |
-
$this->uploaded = false;
|
2352 |
-
$this->error = $this->translate('uploaded_cant_write');
|
2353 |
-
break;
|
2354 |
-
case @UPLOAD_ERR_EXTENSION:
|
2355 |
-
$this->uploaded = false;
|
2356 |
-
$this->error = $this->translate('uploaded_err_extension');
|
2357 |
-
break;
|
2358 |
-
default:
|
2359 |
-
$this->uploaded = false;
|
2360 |
-
$this->error = $this->translate('uploaded_unknown') . ' ('.$this->file_src_error.')';
|
2361 |
-
}
|
2362 |
-
}
|
2363 |
-
|
2364 |
-
if ($this->uploaded) {
|
2365 |
-
$this->file_src_pathname = $file['tmp_name'];
|
2366 |
-
$this->file_src_name = $file['name'];
|
2367 |
-
if ($this->file_src_name == '') {
|
2368 |
-
$this->uploaded = false;
|
2369 |
-
$this->error = $this->translate('try_again');
|
2370 |
-
}
|
2371 |
-
}
|
2372 |
-
|
2373 |
-
if ($this->uploaded) {
|
2374 |
-
$this->log .= '- file name OK<br />';
|
2375 |
-
preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);
|
2376 |
-
if (is_array($extension) && sizeof($extension) > 0) {
|
2377 |
-
$this->file_src_name_ext = strtolower($extension[1]);
|
2378 |
-
$this->file_src_name_body = substr($this->file_src_name, 0, ((strlen($this->file_src_name) - strlen($this->file_src_name_ext)))-1);
|
2379 |
-
} else {
|
2380 |
-
$this->file_src_name_ext = '';
|
2381 |
-
$this->file_src_name_body = $this->file_src_name;
|
2382 |
-
}
|
2383 |
-
$this->file_src_size = $file['size'];
|
2384 |
-
$mime_from_browser = $file['type'];
|
2385 |
-
}
|
2386 |
-
}
|
2387 |
-
|
2388 |
-
if ($this->uploaded) {
|
2389 |
-
$this->log .= '<b>determining MIME type</b><br />';
|
2390 |
-
$this->file_src_mime = null;
|
2391 |
-
|
2392 |
-
// checks MIME type with Fileinfo PECL extension
|
2393 |
-
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
|
2394 |
-
if ($this->mime_fileinfo) {
|
2395 |
-
$this->log .= '- Checking MIME type with Fileinfo PECL extension<br />';
|
2396 |
-
if (function_exists('finfo_open')) {
|
2397 |
-
if ($this->mime_fileinfo !== '') {
|
2398 |
-
if ($this->mime_fileinfo === true) {
|
2399 |
-
if (getenv('MAGIC') === FALSE) {
|
2400 |
-
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
2401 |
-
$path = realpath(ini_get('extension_dir') . '/../') . 'extras/magic';
|
2402 |
-
} else {
|
2403 |
-
$path = '/usr/share/file/magic';
|
2404 |
-
}
|
2405 |
-
$this->log .= ' MAGIC path defaults to ' . $path . '<br />';
|
2406 |
-
} else {
|
2407 |
-
$path = getenv('MAGIC');
|
2408 |
-
$this->log .= ' MAGIC path is set to ' . $path . ' from MAGIC variable<br />';
|
2409 |
-
}
|
2410 |
-
} else {
|
2411 |
-
$path = $this->mime_fileinfo;
|
2412 |
-
$this->log .= ' MAGIC path is set to ' . $path . '<br />';
|
2413 |
-
}
|
2414 |
-
$f = @finfo_open(FILEINFO_MIME, $path);
|
2415 |
-
} else {
|
2416 |
-
$this->log .= ' MAGIC path will not be used<br />';
|
2417 |
-
$f = @finfo_open(FILEINFO_MIME);
|
2418 |
-
}
|
2419 |
-
if (is_resource($f)) {
|
2420 |
-
$mime = finfo_file($f, realpath($this->file_src_pathname));
|
2421 |
-
finfo_close($f);
|
2422 |
-
$this->file_src_mime = $mime;
|
2423 |
-
$this->log .= ' MIME type detected as ' . $this->file_src_mime . ' by Fileinfo PECL extension<br />';
|
2424 |
-
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
|
2425 |
-
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
|
2426 |
-
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
|
2427 |
-
} else {
|
2428 |
-
$this->file_src_mime = null;
|
2429 |
-
}
|
2430 |
-
} else {
|
2431 |
-
$this->log .= ' Fileinfo PECL extension failed (finfo_open)<br />';
|
2432 |
-
}
|
2433 |
-
} elseif (class_exists('finfo')) {
|
2434 |
-
$f = new finfo( FILEINFO_MIME );
|
2435 |
-
if ($f) {
|
2436 |
-
$this->file_src_mime = $f->file(realpath($this->file_src_pathname));
|
2437 |
-
$this->log .= '- MIME type detected as ' . $this->file_src_mime . ' by Fileinfo PECL extension<br />';
|
2438 |
-
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
|
2439 |
-
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
|
2440 |
-
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
|
2441 |
-
} else {
|
2442 |
-
$this->file_src_mime = null;
|
2443 |
-
}
|
2444 |
-
} else {
|
2445 |
-
$this->log .= ' Fileinfo PECL extension failed (finfo)<br />';
|
2446 |
-
}
|
2447 |
-
} else {
|
2448 |
-
$this->log .= ' Fileinfo PECL extension not available<br />';
|
2449 |
-
}
|
2450 |
-
} else {
|
2451 |
-
$this->log .= '- Fileinfo PECL extension deactivated<br />';
|
2452 |
-
}
|
2453 |
-
}
|
2454 |
-
|
2455 |
-
// checks MIME type with shell if unix access is authorized
|
2456 |
-
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
|
2457 |
-
if ($this->mime_file) {
|
2458 |
-
$this->log .= '- Checking MIME type with UNIX file() command<br />';
|
2459 |
-
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
2460 |
-
if (strlen($mime = @exec("file -bi ".escapeshellarg($this->file_src_pathname))) != 0) {
|
2461 |
-
$this->file_src_mime = trim($mime);
|
2462 |
-
$this->log .= ' MIME type detected as ' . $this->file_src_mime . ' by UNIX file() command<br />';
|
2463 |
-
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
|
2464 |
-
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
|
2465 |
-
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
|
2466 |
-
} else {
|
2467 |
-
$this->file_src_mime = null;
|
2468 |
-
}
|
2469 |
-
} else {
|
2470 |
-
$this->log .= ' UNIX file() command failed<br />';
|
2471 |
-
}
|
2472 |
-
} else {
|
2473 |
-
$this->log .= ' UNIX file() command not availabled<br />';
|
2474 |
-
}
|
2475 |
-
} else {
|
2476 |
-
$this->log .= '- UNIX file() command is deactivated<br />';
|
2477 |
-
}
|
2478 |
-
}
|
2479 |
-
|
2480 |
-
// checks MIME type with mime_magic
|
2481 |
-
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
|
2482 |
-
if ($this->mime_magic) {
|
2483 |
-
$this->log .= '- Checking MIME type with mime.magic file (mime_content_type())<br />';
|
2484 |
-
if (function_exists('mime_content_type')) {
|
2485 |
-
$this->file_src_mime = mime_content_type($this->file_src_pathname);
|
2486 |
-
$this->log .= ' MIME type detected as ' . $this->file_src_mime . ' by mime_content_type()<br />';
|
2487 |
-
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
|
2488 |
-
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
|
2489 |
-
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
|
2490 |
-
} else {
|
2491 |
-
$this->file_src_mime = null;
|
2492 |
-
}
|
2493 |
-
} else {
|
2494 |
-
$this->log .= ' mime_content_type() is not available<br />';
|
2495 |
-
}
|
2496 |
-
} else {
|
2497 |
-
$this->log .= '- mime.magic file (mime_content_type()) is deactivated<br />';
|
2498 |
-
}
|
2499 |
-
}
|
2500 |
-
|
2501 |
-
// checks MIME type with getimagesize()
|
2502 |
-
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
|
2503 |
-
if ($this->mime_getimagesize) {
|
2504 |
-
$this->log .= '- Checking MIME type with getimagesize()<br />';
|
2505 |
-
$info = getimagesize($this->file_src_pathname);
|
2506 |
-
if (is_array($info) && array_key_exists('mime', $info)) {
|
2507 |
-
$this->file_src_mime = trim($info['mime']);
|
2508 |
-
if (empty($this->file_src_mime)) {
|
2509 |
-
$this->log .= ' MIME empty, guessing from type<br />';
|
2510 |
-
$mime = (is_array($info) && array_key_exists(2, $info) ? $info[2] : null); // 1 = GIF, 2 = JPG, 3 = PNG
|
2511 |
-
$this->file_src_mime = ($mime==IMAGETYPE_GIF ? 'image/gif' : ($mime==IMAGETYPE_JPEG ? 'image/jpeg' : ($mime==IMAGETYPE_PNG ? 'image/png' : ($mime==IMAGETYPE_BMP ? 'image/bmp' : null))));
|
2512 |
-
}
|
2513 |
-
$this->log .= ' MIME type detected as ' . $this->file_src_mime . ' by PHP getimagesize() function<br />';
|
2514 |
-
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
|
2515 |
-
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
|
2516 |
-
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
|
2517 |
-
} else {
|
2518 |
-
$this->file_src_mime = null;
|
2519 |
-
}
|
2520 |
-
} else {
|
2521 |
-
$this->log .= ' getimagesize() failed<br />';
|
2522 |
-
}
|
2523 |
-
} else {
|
2524 |
-
$this->log .= '- getimagesize() is deactivated<br />';
|
2525 |
-
}
|
2526 |
-
}
|
2527 |
-
|
2528 |
-
// default to MIME from browser (or Flash)
|
2529 |
-
if (!empty($mime_from_browser) && !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime)) {
|
2530 |
-
$this->file_src_mime =$mime_from_browser;
|
2531 |
-
$this->log .= '- MIME type detected as ' . $this->file_src_mime . ' by browser<br />';
|
2532 |
-
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
|
2533 |
-
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
|
2534 |
-
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
|
2535 |
-
} else {
|
2536 |
-
$this->file_src_mime = null;
|
2537 |
-
}
|
2538 |
-
}
|
2539 |
-
|
2540 |
-
// we need to work some magic if we upload via Flash
|
2541 |
-
if ($this->file_src_mime == 'application/octet-stream' || !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
|
2542 |
-
if ($this->file_src_mime == 'application/octet-stream') $this->log .= '- Flash may be rewriting MIME as application/octet-stream<br />';
|
2543 |
-
$this->log .= '- Try to guess MIME type from file extension (' . $this->file_src_name_ext . '): ';
|
2544 |
-
switch($this->file_src_name_ext) {
|
2545 |
-
case 'jpg':
|
2546 |
-
case 'jpeg':
|
2547 |
-
case 'jpe':
|
2548 |
-
$this->file_src_mime = 'image/jpeg';
|
2549 |
-
break;
|
2550 |
-
case 'gif':
|
2551 |
-
$this->file_src_mime = 'image/gif';
|
2552 |
-
break;
|
2553 |
-
case 'png':
|
2554 |
-
$this->file_src_mime = 'image/png';
|
2555 |
-
break;
|
2556 |
-
case 'bmp':
|
2557 |
-
$this->file_src_mime = 'image/bmp';
|
2558 |
-
break;
|
2559 |
-
case 'flv':
|
2560 |
-
$this->file_src_mime = 'video/x-flv';
|
2561 |
-
break;
|
2562 |
-
case 'js' :
|
2563 |
-
$this->file_src_mime = 'application/x-javascript';
|
2564 |
-
break;
|
2565 |
-
case 'json' :
|
2566 |
-
$this->file_src_mime = 'application/json';
|
2567 |
-
break;
|
2568 |
-
case 'tiff' :
|
2569 |
-
$this->file_src_mime = 'image/tiff';
|
2570 |
-
break;
|
2571 |
-
case 'css' :
|
2572 |
-
$this->file_src_mime = 'text/css';
|
2573 |
-
break;
|
2574 |
-
case 'xml' :
|
2575 |
-
$this->file_src_mime = 'application/xml';
|
2576 |
-
break;
|
2577 |
-
case 'doc' :
|
2578 |
-
case 'docx' :
|
2579 |
-
$this->file_src_mime = 'application/msword';
|
2580 |
-
break;
|
2581 |
-
case 'xls' :
|
2582 |
-
case 'xlt' :
|
2583 |
-
case 'xlm' :
|
2584 |
-
case 'xld' :
|
2585 |
-
case 'xla' :
|
2586 |
-
case 'xlc' :
|
2587 |
-
case 'xlw' :
|
2588 |
-
case 'xll' :
|
2589 |
-
$this->file_src_mime = 'application/vnd.ms-excel';
|
2590 |
-
break;
|
2591 |
-
case 'ppt' :
|
2592 |
-
case 'pps' :
|
2593 |
-
$this->file_src_mime = 'application/vnd.ms-powerpoint';
|
2594 |
-
break;
|
2595 |
-
case 'rtf' :
|
2596 |
-
$this->file_src_mime = 'application/rtf';
|
2597 |
-
break;
|
2598 |
-
case 'pdf' :
|
2599 |
-
$this->file_src_mime = 'application/pdf';
|
2600 |
-
break;
|
2601 |
-
case 'html' :
|
2602 |
-
case 'htm' :
|
2603 |
-
case 'php' :
|
2604 |
-
$this->file_src_mime = 'text/html';
|
2605 |
-
break;
|
2606 |
-
case 'txt' :
|
2607 |
-
$this->file_src_mime = 'text/plain';
|
2608 |
-
break;
|
2609 |
-
case 'mpeg' :
|
2610 |
-
case 'mpg' :
|
2611 |
-
case 'mpe' :
|
2612 |
-
$this->file_src_mime = 'video/mpeg';
|
2613 |
-
break;
|
2614 |
-
case 'mp3' :
|
2615 |
-
$this->file_src_mime = 'audio/mpeg3';
|
2616 |
-
break;
|
2617 |
-
case 'wav' :
|
2618 |
-
$this->file_src_mime = 'audio/wav';
|
2619 |
-
break;
|
2620 |
-
case 'aiff' :
|
2621 |
-
case 'aif' :
|
2622 |
-
$this->file_src_mime = 'audio/aiff';
|
2623 |
-
break;
|
2624 |
-
case 'avi' :
|
2625 |
-
$this->file_src_mime = 'video/msvideo';
|
2626 |
-
break;
|
2627 |
-
case 'wmv' :
|
2628 |
-
$this->file_src_mime = 'video/x-ms-wmv';
|
2629 |
-
break;
|
2630 |
-
case 'mov' :
|
2631 |
-
$this->file_src_mime = 'video/quicktime';
|
2632 |
-
break;
|
2633 |
-
case 'zip' :
|
2634 |
-
$this->file_src_mime = 'application/zip';
|
2635 |
-
break;
|
2636 |
-
case 'tar' :
|
2637 |
-
$this->file_src_mime = 'application/x-tar';
|
2638 |
-
break;
|
2639 |
-
case 'swf' :
|
2640 |
-
$this->file_src_mime = 'application/x-shockwave-flash';
|
2641 |
-
break;
|
2642 |
-
case 'odt':
|
2643 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.text';
|
2644 |
-
break;
|
2645 |
-
case 'ott':
|
2646 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.text-template';
|
2647 |
-
break;
|
2648 |
-
case 'oth':
|
2649 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.text-web';
|
2650 |
-
break;
|
2651 |
-
case 'odm':
|
2652 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.text-master';
|
2653 |
-
break;
|
2654 |
-
case 'odg':
|
2655 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.graphics';
|
2656 |
-
break;
|
2657 |
-
case 'otg':
|
2658 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.graphics-template';
|
2659 |
-
break;
|
2660 |
-
case 'odp':
|
2661 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.presentation';
|
2662 |
-
break;
|
2663 |
-
case 'otp':
|
2664 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.presentation-template';
|
2665 |
-
break;
|
2666 |
-
case 'ods':
|
2667 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.spreadsheet';
|
2668 |
-
break;
|
2669 |
-
case 'ots':
|
2670 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.spreadsheet-template';
|
2671 |
-
break;
|
2672 |
-
case 'odc':
|
2673 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.chart';
|
2674 |
-
break;
|
2675 |
-
case 'odf':
|
2676 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.formula';
|
2677 |
-
break;
|
2678 |
-
case 'odb':
|
2679 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.database';
|
2680 |
-
break;
|
2681 |
-
case 'odi':
|
2682 |
-
$this->file_src_mime = 'application/vnd.oasis.opendocument.image';
|
2683 |
-
break;
|
2684 |
-
case 'oxt':
|
2685 |
-
$this->file_src_mime = 'application/vnd.openofficeorg.extension';
|
2686 |
-
break;
|
2687 |
-
case 'docx':
|
2688 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
2689 |
-
break;
|
2690 |
-
case 'docm':
|
2691 |
-
$this->file_src_mime = 'application/vnd.ms-word.document.macroEnabled.12';
|
2692 |
-
break;
|
2693 |
-
case 'dotx':
|
2694 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template';
|
2695 |
-
break;
|
2696 |
-
case 'dotm':
|
2697 |
-
$this->file_src_mime = 'application/vnd.ms-word.template.macroEnabled.12';
|
2698 |
-
break;
|
2699 |
-
case 'xlsx':
|
2700 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
2701 |
-
break;
|
2702 |
-
case 'xlsm':
|
2703 |
-
$this->file_src_mime = 'application/vnd.ms-excel.sheet.macroEnabled.12';
|
2704 |
-
break;
|
2705 |
-
case 'xltx':
|
2706 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template';
|
2707 |
-
break;
|
2708 |
-
case 'xltm':
|
2709 |
-
$this->file_src_mime = 'application/vnd.ms-excel.template.macroEnabled.12';
|
2710 |
-
break;
|
2711 |
-
case 'xlsb':
|
2712 |
-
$this->file_src_mime = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12';
|
2713 |
-
break;
|
2714 |
-
case 'xlam':
|
2715 |
-
$this->file_src_mime = 'application/vnd.ms-excel.addin.macroEnabled.12';
|
2716 |
-
break;
|
2717 |
-
case 'pptx':
|
2718 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
|
2719 |
-
break;
|
2720 |
-
case 'pptm':
|
2721 |
-
$this->file_src_mime = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12';
|
2722 |
-
break;
|
2723 |
-
case 'ppsx':
|
2724 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';
|
2725 |
-
break;
|
2726 |
-
case 'ppsm':
|
2727 |
-
$this->file_src_mime = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12';
|
2728 |
-
break;
|
2729 |
-
case 'potx':
|
2730 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.template';
|
2731 |
-
break;
|
2732 |
-
case 'potm':
|
2733 |
-
$this->file_src_mime = 'application/vnd.ms-powerpoint.template.macroEnabled.12';
|
2734 |
-
break;
|
2735 |
-
case 'ppam':
|
2736 |
-
$this->file_src_mime = 'application/vnd.ms-powerpoint.addin.macroEnabled.12';
|
2737 |
-
break;
|
2738 |
-
case 'sldx':
|
2739 |
-
$this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.slide';
|
2740 |
-
break;
|
2741 |
-
case 'sldm':
|
2742 |
-
$this->file_src_mime = 'application/vnd.ms-powerpoint.slide.macroEnabled.12';
|
2743 |
-
break;
|
2744 |
-
case 'thmx':
|
2745 |
-
$this->file_src_mime = 'application/vnd.ms-officetheme';
|
2746 |
-
break;
|
2747 |
-
case 'onetoc':
|
2748 |
-
case 'onetoc2':
|
2749 |
-
case 'onetmp':
|
2750 |
-
case 'onepkg':
|
2751 |
-
$this->file_src_mime = 'application/onenote';
|
2752 |
-
break;
|
2753 |
-
}
|
2754 |
-
if ($this->file_src_mime == 'application/octet-stream') {
|
2755 |
-
$this->log .= 'doesn\'t look like anything known<br />';
|
2756 |
-
} else {
|
2757 |
-
$this->log .= 'MIME type set to ' . $this->file_src_mime . '<br />';
|
2758 |
-
}
|
2759 |
-
}
|
2760 |
-
|
2761 |
-
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === FALSE) {
|
2762 |
-
$this->log .= '- MIME type couldn\'t be detected! (' . (string) $this->file_src_mime . ')<br />';
|
2763 |
-
}
|
2764 |
-
|
2765 |
-
// determine whether the file is an image
|
2766 |
-
if ($this->file_src_mime && is_string($this->file_src_mime) && !empty($this->file_src_mime) && array_key_exists($this->file_src_mime, $this->image_supported)) {
|
2767 |
-
$this->file_is_image = true;
|
2768 |
-
$this->image_src_type = $this->image_supported[$this->file_src_mime];
|
2769 |
-
}
|
2770 |
-
|
2771 |
-
// if the file is an image, we gather some useful data
|
2772 |
-
if ($this->file_is_image) {
|
2773 |
-
if ($h = fopen($this->file_src_pathname, 'r')) {
|
2774 |
-
fclose($h);
|
2775 |
-
$info = getimagesize($this->file_src_pathname);
|
2776 |
-
if (is_array($info)) {
|
2777 |
-
$this->image_src_x = $info[0];
|
2778 |
-
$this->image_src_y = $info[1];
|
2779 |
-
$this->image_dst_x = $this->image_src_x;
|
2780 |
-
$this->image_dst_y = $this->image_src_y;
|
2781 |
-
$this->image_src_pixels = $this->image_src_x * $this->image_src_y;
|
2782 |
-
$this->image_src_bits = array_key_exists('bits', $info) ? $info['bits'] : null;
|
2783 |
-
} else {
|
2784 |
-
$this->file_is_image = false;
|
2785 |
-
$this->uploaded = false;
|
2786 |
-
$this->log .= '- can\'t retrieve image information, image may have been tampered with<br />';
|
2787 |
-
$this->error = $this->translate('incorrect_file');
|
2788 |
-
}
|
2789 |
-
} else {
|
2790 |
-
$this->log .= '- can\'t read source file directly. open_basedir restriction in place?<br />';
|
2791 |
-
}
|
2792 |
-
}
|
2793 |
-
|
2794 |
-
$this->log .= '<b>source variables</b><br />';
|
2795 |
-
$this->log .= '- You can use all these before calling process()<br />';
|
2796 |
-
$this->log .= ' file_src_name : ' . $this->file_src_name . '<br />';
|
2797 |
-
$this->log .= ' file_src_name_body : ' . $this->file_src_name_body . '<br />';
|
2798 |
-
$this->log .= ' file_src_name_ext : ' . $this->file_src_name_ext . '<br />';
|
2799 |
-
$this->log .= ' file_src_pathname : ' . $this->file_src_pathname . '<br />';
|
2800 |
-
$this->log .= ' file_src_mime : ' . $this->file_src_mime . '<br />';
|
2801 |
-
$this->log .= ' file_src_size : ' . $this->file_src_size . ' (max= ' . $this->file_max_size . ')<br />';
|
2802 |
-
$this->log .= ' file_src_error : ' . $this->file_src_error . '<br />';
|
2803 |
-
|
2804 |
-
if ($this->file_is_image) {
|
2805 |
-
$this->log .= '- source file is an image<br />';
|
2806 |
-
$this->log .= ' image_src_x : ' . $this->image_src_x . '<br />';
|
2807 |
-
$this->log .= ' image_src_y : ' . $this->image_src_y . '<br />';
|
2808 |
-
$this->log .= ' image_src_pixels : ' . $this->image_src_pixels . '<br />';
|
2809 |
-
$this->log .= ' image_src_type : ' . $this->image_src_type . '<br />';
|
2810 |
-
$this->log .= ' image_src_bits : ' . $this->image_src_bits . '<br />';
|
2811 |
-
}
|
2812 |
-
}
|
2813 |
-
|
2814 |
-
}
|
2815 |
-
|
2816 |
-
/**
|
2817 |
-
* Returns the version of GD
|
2818 |
-
*
|
2819 |
-
* @access public
|
2820 |
-
* @param boolean $full Optional flag to get precise version
|
2821 |
-
* @return float GD version
|
2822 |
-
*/
|
2823 |
-
function gdversion($full = false) {
|
2824 |
-
static $gd_version = null;
|
2825 |
-
static $gd_full_version = null;
|
2826 |
-
if ($gd_version === null) {
|
2827 |
-
if (function_exists('gd_info')) {
|
2828 |
-
$gd = gd_info();
|
2829 |
-
$gd = $gd["GD Version"];
|
2830 |
-
$regex = "/([\d\.]+)/i";
|
2831 |
-
} else {
|
2832 |
-
ob_start();
|
2833 |
-
phpinfo(8);
|
2834 |
-
$gd = ob_get_contents();
|
2835 |
-
ob_end_clean();
|
2836 |
-
$regex = "/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i";
|
2837 |
-
}
|
2838 |
-
if (preg_match($regex, $gd, $m)) {
|
2839 |
-
$gd_full_version = (string) $m[1];
|
2840 |
-
$gd_version = (float) $m[1];
|
2841 |
-
} else {
|
2842 |
-
$gd_full_version = 'none';
|
2843 |
-
$gd_version = 0;
|
2844 |
-
}
|
2845 |
-
}
|
2846 |
-
if ($full) {
|
2847 |
-
return $gd_full_version;
|
2848 |
-
} else {
|
2849 |
-
return $gd_version;
|
2850 |
-
}
|
2851 |
-
}
|
2852 |
-
|
2853 |
-
|
2854 |
-
/**
|
2855 |
-
* Creates directories recursively
|
2856 |
-
*
|
2857 |
-
* @access private
|
2858 |
-
* @param string $path Path to create
|
2859 |
-
* @param integer $mode Optional permissions
|
2860 |
-
* @return boolean Success
|
2861 |
-
*/
|
2862 |
-
function rmkdir($path, $mode = 0777) {
|
2863 |
-
return is_dir($path) || ( $this->rmkdir(dirname($path), $mode) && $this->_mkdir($path, $mode) );
|
2864 |
-
}
|
2865 |
-
|
2866 |
-
|
2867 |
-
/**
|
2868 |
-
* Creates directory
|
2869 |
-
*
|
2870 |
-
* @access private
|
2871 |
-
* @param string $path Path to create
|
2872 |
-
* @param integer $mode Optional permissions
|
2873 |
-
* @return boolean Success
|
2874 |
-
*/
|
2875 |
-
function _mkdir($path, $mode = 0777) {
|
2876 |
-
$old = umask(0);
|
2877 |
-
$res = @mkdir($path, $mode);
|
2878 |
-
umask($old);
|
2879 |
-
return $res;
|
2880 |
-
}
|
2881 |
-
|
2882 |
-
|
2883 |
-
/**
|
2884 |
-
* Translate error messages
|
2885 |
-
*
|
2886 |
-
* @access private
|
2887 |
-
* @param string $str Message to translate
|
2888 |
-
* @param array $tokens Optional token values
|
2889 |
-
* @return string Translated string
|
2890 |
-
*/
|
2891 |
-
function translate($str, $tokens = array()) {
|
2892 |
-
if (array_key_exists($str, $this->translation)) $str = $this->translation[$str];
|
2893 |
-
if (is_array($tokens) && sizeof($tokens) > 0) $str = vsprintf($str, $tokens);
|
2894 |
-
return $str;
|
2895 |
-
}
|
2896 |
-
|
2897 |
-
/**
|
2898 |
-
* Decodes colors
|
2899 |
-
*
|
2900 |
-
* @access private
|
2901 |
-
* @param string $color Color string
|
2902 |
-
* @return array RGB colors
|
2903 |
-
*/
|
2904 |
-
function getcolors($color) {
|
2905 |
-
$r = sscanf($color, "#%2x%2x%2x");
|
2906 |
-
$red = (array_key_exists(0, $r) && is_numeric($r[0]) ? $r[0] : 0);
|
2907 |
-
$green = (array_key_exists(1, $r) && is_numeric($r[1]) ? $r[1] : 0);
|
2908 |
-
$blue = (array_key_exists(2, $r) && is_numeric($r[2]) ? $r[2] : 0);
|
2909 |
-
return array($red, $green, $blue);
|
2910 |
-
}
|
2911 |
-
|
2912 |
-
/**
|
2913 |
-
* Creates a container image
|
2914 |
-
*
|
2915 |
-
* @access private
|
2916 |
-
* @param integer $x Width
|
2917 |
-
* @param integer $y Height
|
2918 |
-
* @param boolean $fill Optional flag to draw the background color or not
|
2919 |
-
* @param boolean $trsp Optional flag to set the background to be transparent
|
2920 |
-
* @return resource Container image
|
2921 |
-
*/
|
2922 |
-
function imagecreatenew($x, $y, $fill = true, $trsp = false) {
|
2923 |
-
if ($x < 1) $x = 1; if ($y < 1) $y = 1;
|
2924 |
-
if ($this->gdversion() >= 2 && !$this->image_is_palette) {
|
2925 |
-
// create a true color image
|
2926 |
-
$dst_im = imagecreatetruecolor($x, $y);
|
2927 |
-
// this preserves transparency in PNGs, in true color
|
2928 |
-
if (empty($this->image_background_color) || $trsp) {
|
2929 |
-
imagealphablending($dst_im, false );
|
2930 |
-
imagefilledrectangle($dst_im, 0, 0, $x, $y, imagecolorallocatealpha($dst_im, 0, 0, 0, 127));
|
2931 |
-
}
|
2932 |
-
} else {
|
2933 |
-
// creates a palette image
|
2934 |
-
$dst_im = imagecreate($x, $y);
|
2935 |
-
// preserves transparency for palette images, if the original image has transparency
|
2936 |
-
if (($fill && $this->image_is_transparent && empty($this->image_background_color)) || $trsp) {
|
2937 |
-
imagefilledrectangle($dst_im, 0, 0, $x, $y, $this->image_transparent_color);
|
2938 |
-
imagecolortransparent($dst_im, $this->image_transparent_color);
|
2939 |
-
}
|
2940 |
-
}
|
2941 |
-
// fills with background color if any is set
|
2942 |
-
if ($fill && !empty($this->image_background_color) && !$trsp) {
|
2943 |
-
list($red, $green, $blue) = $this->getcolors($this->image_background_color);
|
2944 |
-
$background_color = imagecolorallocate($dst_im, $red, $green, $blue);
|
2945 |
-
imagefilledrectangle($dst_im, 0, 0, $x, $y, $background_color);
|
2946 |
-
}
|
2947 |
-
return $dst_im;
|
2948 |
-
}
|
2949 |
-
|
2950 |
-
|
2951 |
-
/**
|
2952 |
-
* Transfers an image from the container to the destination image
|
2953 |
-
*
|
2954 |
-
* @access private
|
2955 |
-
* @param resource $src_im Container image
|
2956 |
-
* @param resource $dst_im Destination image
|
2957 |
-
* @return resource Destination image
|
2958 |
-
*/
|
2959 |
-
function imagetransfer($src_im, $dst_im) {
|
2960 |
-
if (is_resource($dst_im)) imagedestroy($dst_im);
|
2961 |
-
$dst_im = & $src_im;
|
2962 |
-
return $dst_im;
|
2963 |
-
}
|
2964 |
-
|
2965 |
-
/**
|
2966 |
-
* Merges two images
|
2967 |
-
*
|
2968 |
-
* If the output format is PNG, then we do it pixel per pixel to retain the alpha channel
|
2969 |
-
*
|
2970 |
-
* @access private
|
2971 |
-
* @param resource $dst_img Destination image
|
2972 |
-
* @param resource $src_img Overlay image
|
2973 |
-
* @param int $dst_x x-coordinate of destination point
|
2974 |
-
* @param int $dst_y y-coordinate of destination point
|
2975 |
-
* @param int $src_x x-coordinate of source point
|
2976 |
-
* @param int $src_y y-coordinate of source point
|
2977 |
-
* @param int $src_w Source width
|
2978 |
-
* @param int $src_h Source height
|
2979 |
-
* @param int $pct Optional percentage of the overlay, between 0 and 100 (default: 100)
|
2980 |
-
* @return resource Destination image
|
2981 |
-
*/
|
2982 |
-
function imagecopymergealpha(&$dst_im, &$src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct = 0) {
|
2983 |
-
$dst_x = (int) $dst_x;
|
2984 |
-
$dst_y = (int) $dst_y;
|
2985 |
-
$src_x = (int) $src_x;
|
2986 |
-
$src_y = (int) $src_y;
|
2987 |
-
$src_w = (int) $src_w;
|
2988 |
-
$src_h = (int) $src_h;
|
2989 |
-
$pct = (int) $pct;
|
2990 |
-
$dst_w = imagesx($dst_im);
|
2991 |
-
$dst_h = imagesy($dst_im);
|
2992 |
-
|
2993 |
-
for ($y = $src_y; $y < $src_h; $y++) {
|
2994 |
-
for ($x = $src_x; $x < $src_w; $x++) {
|
2995 |
-
|
2996 |
-
if ($x + $dst_x >= 0 && $x + $dst_x < $dst_w && $x + $src_x >= 0 && $x + $src_x < $src_w
|
2997 |
-
&& $y + $dst_y >= 0 && $y + $dst_y < $dst_h && $y + $src_y >= 0 && $y + $src_y < $src_h) {
|
2998 |
-
|
2999 |
-
$dst_pixel = imagecolorsforindex($dst_im, imagecolorat($dst_im, $x + $dst_x, $y + $dst_y));
|
3000 |
-
$src_pixel = imagecolorsforindex($src_im, imagecolorat($src_im, $x + $src_x, $y + $src_y));
|
3001 |
-
|
3002 |
-
$src_alpha = 1 - ($src_pixel['alpha'] / 127);
|
3003 |
-
$dst_alpha = 1 - ($dst_pixel['alpha'] / 127);
|
3004 |
-
$opacity = $src_alpha * $pct / 100;
|
3005 |
-
if ($dst_alpha >= $opacity) $alpha = $dst_alpha;
|
3006 |
-
if ($dst_alpha < $opacity) $alpha = $opacity;
|
3007 |
-
if ($alpha > 1) $alpha = 1;
|
3008 |
-
|
3009 |
-
if ($opacity > 0) {
|
3010 |
-
$dst_red = round(( ($dst_pixel['red'] * $dst_alpha * (1 - $opacity)) ) );
|
3011 |
-
$dst_green = round(( ($dst_pixel['green'] * $dst_alpha * (1 - $opacity)) ) );
|
3012 |
-
$dst_blue = round(( ($dst_pixel['blue'] * $dst_alpha * (1 - $opacity)) ) );
|
3013 |
-
$src_red = round((($src_pixel['red'] * $opacity)) );
|
3014 |
-
$src_green = round((($src_pixel['green'] * $opacity)) );
|
3015 |
-
$src_blue = round((($src_pixel['blue'] * $opacity)) );
|
3016 |
-
$red = round(($dst_red + $src_red ) / ($dst_alpha * (1 - $opacity) + $opacity));
|
3017 |
-
$green = round(($dst_green + $src_green) / ($dst_alpha * (1 - $opacity) + $opacity));
|
3018 |
-
$blue = round(($dst_blue + $src_blue ) / ($dst_alpha * (1 - $opacity) + $opacity));
|
3019 |
-
if ($red > 255) $red = 255;
|
3020 |
-
if ($green > 255) $green = 255;
|
3021 |
-
if ($blue > 255) $blue = 255;
|
3022 |
-
$alpha = round((1 - $alpha) * 127);
|
3023 |
-
$color = imagecolorallocatealpha($dst_im, $red, $green, $blue, $alpha);
|
3024 |
-
imagesetpixel($dst_im, $x + $dst_x, $y + $dst_y, $color);
|
3025 |
-
}
|
3026 |
-
}
|
3027 |
-
}
|
3028 |
-
}
|
3029 |
-
return true;
|
3030 |
-
}
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
/**
|
3035 |
-
* Actually uploads the file, and act on it according to the set processing class variables
|
3036 |
-
*
|
3037 |
-
* This function copies the uploaded file to the given location, eventually performing actions on it.
|
3038 |
-
* Typically, you can call {@link process} several times for the same file,
|
3039 |
-
* for instance to create a resized image and a thumbnail of the same file.
|
3040 |
-
* The original uploaded file remains intact in its temporary location, so you can use {@link process} several times.
|
3041 |
-
* You will be able to delete the uploaded file with {@link clean} when you have finished all your {@link process} calls.
|
3042 |
-
*
|
3043 |
-
* According to the processing class variables set in the calling file, the file can be renamed,
|
3044 |
-
* and if it is an image, can be resized or converted.
|
3045 |
-
*
|
3046 |
-
* When the processing is completed, and the file copied to its new location, the
|
3047 |
-
* processing class variables will be reset to their default value.
|
3048 |
-
* This allows you to set new properties, and perform another {@link process} on the same uploaded file
|
3049 |
-
*
|
3050 |
-
* If the function is called with a null or empty argument, then it will return the content of the picture
|
3051 |
-
*
|
3052 |
-
* It will set {@link processed} (and {@link error} is an error occurred)
|
3053 |
-
*
|
3054 |
-
* @access public
|
3055 |
-
* @param string $server_path Optional path location of the uploaded file, with an ending slash
|
3056 |
-
* @return string Optional content of the image
|
3057 |
-
*/
|
3058 |
-
function process($server_path = null) {
|
3059 |
-
|
3060 |
-
$this->error = '';
|
3061 |
-
$this->processed = true;
|
3062 |
-
$return_mode = false;
|
3063 |
-
$return_content = null;
|
3064 |
-
|
3065 |
-
if (!$this->uploaded) {
|
3066 |
-
$this->error = $this->translate('file_not_uploaded');
|
3067 |
-
$this->processed = false;
|
3068 |
-
}
|
3069 |
-
|
3070 |
-
if ($this->processed) {
|
3071 |
-
if (empty($server_path) || is_null($server_path)) {
|
3072 |
-
$this->log .= '<b>process file and return the content</b><br />';
|
3073 |
-
$return_mode = true;
|
3074 |
-
} else {
|
3075 |
-
if(strtolower(substr(PHP_OS, 0, 3)) === 'win') {
|
3076 |
-
if (substr($server_path, -1, 1) != '\\') $server_path = $server_path . '\\';
|
3077 |
-
} else {
|
3078 |
-
if (substr($server_path, -1, 1) != '/') $server_path = $server_path . '/';
|
3079 |
-
}
|
3080 |
-
$this->log .= '<b>process file to ' . $server_path . '</b><br />';
|
3081 |
-
}
|
3082 |
-
}
|
3083 |
-
|
3084 |
-
if ($this->processed) {
|
3085 |
-
// checks file max size
|
3086 |
-
if ($this->file_src_size > $this->file_max_size ) {
|
3087 |
-
$this->processed = false;
|
3088 |
-
$this->error = $this->translate('file_too_big');
|
3089 |
-
} else {
|
3090 |
-
$this->log .= '- file size OK<br />';
|
3091 |
-
}
|
3092 |
-
}
|
3093 |
-
|
3094 |
-
if ($this->processed) {
|
3095 |
-
// turn dangerous scripts into text files
|
3096 |
-
if ($this->no_script) {
|
3097 |
-
if (((substr($this->file_src_mime, 0, 5) == 'text/' || strpos($this->file_src_mime, 'javascript') !== false) && (substr($this->file_src_name, -4) != '.txt'))
|
3098 |
-
|| preg_match('/\.(php|pl|py|cgi|asp)$/i', $this->file_src_name) || empty($this->file_src_name_ext)) {
|
3099 |
-
$this->file_src_mime = 'text/plain';
|
3100 |
-
$this->log .= '- script ' . $this->file_src_name . ' renamed as ' . $this->file_src_name . '.txt!<br />';
|
3101 |
-
$this->file_src_name_ext .= (empty($this->file_src_name_ext) ? 'txt' : '.txt');
|
3102 |
-
}
|
3103 |
-
}
|
3104 |
-
|
3105 |
-
if ($this->mime_check && empty($this->file_src_mime)) {
|
3106 |
-
$this->processed = false;
|
3107 |
-
$this->error = $this->translate('no_mime');
|
3108 |
-
} else if ($this->mime_check && !empty($this->file_src_mime) && strpos($this->file_src_mime, '/') !== false) {
|
3109 |
-
list($m1, $m2) = explode('/', $this->file_src_mime);
|
3110 |
-
$allowed = false;
|
3111 |
-
// check wether the mime type is allowed
|
3112 |
-
foreach($this->allowed as $k => $v) {
|
3113 |
-
list($v1, $v2) = explode('/', $v);
|
3114 |
-
if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
|
3115 |
-
$allowed = true;
|
3116 |
-
break;
|
3117 |
-
}
|
3118 |
-
}
|
3119 |
-
// check wether the mime type is forbidden
|
3120 |
-
foreach($this->forbidden as $k => $v) {
|
3121 |
-
list($v1, $v2) = explode('/', $v);
|
3122 |
-
if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
|
3123 |
-
$allowed = false;
|
3124 |
-
break;
|
3125 |
-
}
|
3126 |
-
}
|
3127 |
-
if (!$allowed) {
|
3128 |
-
$this->processed = false;
|
3129 |
-
$this->error = $this->translate('incorrect_file');
|
3130 |
-
} else {
|
3131 |
-
$this->log .= '- file mime OK : ' . $this->file_src_mime . '<br />';
|
3132 |
-
}
|
3133 |
-
} else {
|
3134 |
-
$this->log .= '- file mime (not checked) : ' . $this->file_src_mime . '<br />';
|
3135 |
-
}
|
3136 |
-
|
3137 |
-
// if the file is an image, we can check on its dimensions
|
3138 |
-
// these checks are not available if open_basedir restrictions are in place
|
3139 |
-
if ($this->file_is_image) {
|
3140 |
-
if (is_numeric($this->image_src_x) && is_numeric($this->image_src_y)) {
|
3141 |
-
$ratio = $this->image_src_x / $this->image_src_y;
|
3142 |
-
if (!is_null($this->image_max_width) && $this->image_src_x > $this->image_max_width) {
|
3143 |
-
$this->processed = false;
|
3144 |
-
$this->error = $this->translate('image_too_wide');
|
3145 |
-
}
|
3146 |
-
if (!is_null($this->image_min_width) && $this->image_src_x < $this->image_min_width) {
|
3147 |
-
$this->processed = false;
|
3148 |
-
$this->error = $this->translate('image_too_narrow');
|
3149 |
-
}
|
3150 |
-
if (!is_null($this->image_max_height) && $this->image_src_y > $this->image_max_height) {
|
3151 |
-
$this->processed = false;
|
3152 |
-
$this->error = $this->translate('image_too_high');
|
3153 |
-
}
|
3154 |
-
if (!is_null($this->image_min_height) && $this->image_src_y < $this->image_min_height) {
|
3155 |
-
$this->processed = false;
|
3156 |
-
$this->error = $this->translate('image_too_short');
|
3157 |
-
}
|
3158 |
-
if (!is_null($this->image_max_ratio) && $ratio > $this->image_max_ratio) {
|
3159 |
-
$this->processed = false;
|
3160 |
-
$this->error = $this->translate('ratio_too_high');
|
3161 |
-
}
|
3162 |
-
if (!is_null($this->image_min_ratio) && $ratio < $this->image_min_ratio) {
|
3163 |
-
$this->processed = false;
|
3164 |
-
$this->error = $this->translate('ratio_too_low');
|
3165 |
-
}
|
3166 |
-
if (!is_null($this->image_max_pixels) && $this->image_src_pixels > $this->image_max_pixels) {
|
3167 |
-
$this->processed = false;
|
3168 |
-
$this->error = $this->translate('too_many_pixels');
|
3169 |
-
}
|
3170 |
-
if (!is_null($this->image_min_pixels) && $this->image_src_pixels < $this->image_min_pixels) {
|
3171 |
-
$this->processed = false;
|
3172 |
-
$this->error = $this->translate('not_enough_pixels');
|
3173 |
-
}
|
3174 |
-
} else {
|
3175 |
-
$this->log .= '- no image properties available, can\'t enforce dimension checks : ' . $this->file_src_mime . '<br />';
|
3176 |
-
}
|
3177 |
-
}
|
3178 |
-
}
|
3179 |
-
|
3180 |
-
if ($this->processed) {
|
3181 |
-
$this->file_dst_path = $server_path;
|
3182 |
-
|
3183 |
-
// repopulate dst variables from src
|
3184 |
-
$this->file_dst_name = $this->file_src_name;
|
3185 |
-
$this->file_dst_name_body = $this->file_src_name_body;
|
3186 |
-
$this->file_dst_name_ext = $this->file_src_name_ext;
|
3187 |
-
if ($this->file_overwrite) $this->file_auto_rename = false;
|
3188 |
-
|
3189 |
-
if ($this->image_convert != '') { // if we convert as an image
|
3190 |
-
$this->file_dst_name_ext = $this->image_convert;
|
3191 |
-
$this->log .= '- new file name ext : ' . $this->image_convert . '<br />';
|
3192 |
-
}
|
3193 |
-
if ($this->file_new_name_body != '') { // rename file body
|
3194 |
-
$this->file_dst_name_body = $this->file_new_name_body;
|
3195 |
-
$this->log .= '- new file name body : ' . $this->file_new_name_body . '<br />';
|
3196 |
-
}
|
3197 |
-
if ($this->file_new_name_ext != '') { // rename file ext
|
3198 |
-
$this->file_dst_name_ext = $this->file_new_name_ext;
|
3199 |
-
$this->log .= '- new file name ext : ' . $this->file_new_name_ext . '<br />';
|
3200 |
-
}
|
3201 |
-
if ($this->file_name_body_add != '') { // append a string to the name
|
3202 |
-
$this->file_dst_name_body = $this->file_dst_name_body . $this->file_name_body_add;
|
3203 |
-
$this->log .= '- file name body append : ' . $this->file_name_body_add . '<br />';
|
3204 |
-
}
|
3205 |
-
if ($this->file_name_body_pre != '') { // prepend a string to the name
|
3206 |
-
$this->file_dst_name_body = $this->file_name_body_pre . $this->file_dst_name_body;
|
3207 |
-
$this->log .= '- file name body prepend : ' . $this->file_name_body_pre . '<br />';
|
3208 |
-
}
|
3209 |
-
if ($this->file_safe_name) { // formats the name
|
3210 |
-
$this->file_dst_name_body = str_replace(array(' ', '-'), array('_','_'), $this->file_dst_name_body) ;
|
3211 |
-
$this->file_dst_name_body = preg_replace('/[^A-Za-z0-9_]/', '', $this->file_dst_name_body) ;
|
3212 |
-
$this->log .= '- file name safe format<br />';
|
3213 |
-
}
|
3214 |
-
|
3215 |
-
$this->log .= '- destination variables<br />';
|
3216 |
-
if (empty($this->file_dst_path) || is_null($this->file_dst_path)) {
|
3217 |
-
$this->log .= ' file_dst_path : n/a<br />';
|
3218 |
-
} else {
|
3219 |
-
$this->log .= ' file_dst_path : ' . $this->file_dst_path . '<br />';
|
3220 |
-
}
|
3221 |
-
$this->log .= ' file_dst_name_body : ' . $this->file_dst_name_body . '<br />';
|
3222 |
-
$this->log .= ' file_dst_name_ext : ' . $this->file_dst_name_ext . '<br />';
|
3223 |
-
|
3224 |
-
// do we do some image manipulation?
|
3225 |
-
$image_manipulation = ($this->file_is_image && (
|
3226 |
-
$this->image_resize
|
3227 |
-
|| $this->image_convert != ''
|
3228 |
-
|| is_numeric($this->image_brightness)
|
3229 |
-
|| is_numeric($this->image_contrast)
|
3230 |
-
|| is_numeric($this->image_threshold)
|
3231 |
-
|| !empty($this->image_tint_color)
|
3232 |
-
|| !empty($this->image_overlay_color)
|
3233 |
-
|| !empty($this->image_text)
|
3234 |
-
|| $this->image_greyscale
|
3235 |
-
|| $this->image_negative
|
3236 |
-
|| !empty($this->image_watermark)
|
3237 |
-
|| is_numeric($this->image_rotate)
|
3238 |
-
|| is_numeric($this->jpeg_size)
|
3239 |
-
|| !empty($this->image_flip)
|
3240 |
-
|| !empty($this->image_crop)
|
3241 |
-
|| !empty($this->image_precrop)
|
3242 |
-
|| !empty($this->image_border)
|
3243 |
-
|| $this->image_frame > 0
|
3244 |
-
|| $this->image_bevel > 0
|
3245 |
-
|| $this->image_reflection_height));
|
3246 |
-
|
3247 |
-
if ($image_manipulation) {
|
3248 |
-
if ($this->image_convert=='') {
|
3249 |
-
$this->file_dst_name = $this->file_dst_name_body . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : '');
|
3250 |
-
$this->log .= '- image operation, keep extension<br />';
|
3251 |
-
} else {
|
3252 |
-
$this->file_dst_name = $this->file_dst_name_body . '.' . $this->image_convert;
|
3253 |
-
$this->log .= '- image operation, change extension for conversion type<br />';
|
3254 |
-
}
|
3255 |
-
} else {
|
3256 |
-
$this->file_dst_name = $this->file_dst_name_body . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : '');
|
3257 |
-
$this->log .= '- no image operation, keep extension<br />';
|
3258 |
-
}
|
3259 |
-
|
3260 |
-
if (!$return_mode) {
|
3261 |
-
if (!$this->file_auto_rename) {
|
3262 |
-
$this->log .= '- no auto_rename if same filename exists<br />';
|
3263 |
-
$this->file_dst_pathname = $this->file_dst_path . $this->file_dst_name;
|
3264 |
-
} else {
|
3265 |
-
$this->log .= '- checking for auto_rename<br />';
|
3266 |
-
$this->file_dst_pathname = $this->file_dst_path . $this->file_dst_name;
|
3267 |
-
$body = $this->file_dst_name_body;
|
3268 |
-
$cpt = 1;
|
3269 |
-
while (@file_exists($this->file_dst_pathname)) {
|
3270 |
-
$this->file_dst_name_body = $body . '_' . $cpt;
|
3271 |
-
$this->file_dst_name = $this->file_dst_name_body . (!empty($this->file_dst_name_ext) ? '.' . $this->file_dst_name_ext : '');
|
3272 |
-
$cpt++;
|
3273 |
-
$this->file_dst_pathname = $this->file_dst_path . $this->file_dst_name;
|
3274 |
-
}
|
3275 |
-
if ($cpt>1) $this->log .= ' auto_rename to ' . $this->file_dst_name . '<br />';
|
3276 |
-
}
|
3277 |
-
|
3278 |
-
$this->log .= '- destination file details<br />';
|
3279 |
-
$this->log .= ' file_dst_name : ' . $this->file_dst_name . '<br />';
|
3280 |
-
$this->log .= ' file_dst_pathname : ' . $this->file_dst_pathname . '<br />';
|
3281 |
-
|
3282 |
-
if ($this->file_overwrite) {
|
3283 |
-
$this->log .= '- no overwrite checking<br />';
|
3284 |
-
} else {
|
3285 |
-
if (@file_exists($this->file_dst_pathname)) {
|
3286 |
-
$this->processed = false;
|
3287 |
-
$this->error = $this->translate('already_exists', array($this->file_dst_name));
|
3288 |
-
} else {
|
3289 |
-
$this->log .= '- ' . $this->file_dst_name . ' doesn\'t exist already<br />';
|
3290 |
-
}
|
3291 |
-
}
|
3292 |
-
}
|
3293 |
-
}
|
3294 |
-
|
3295 |
-
if ($this->processed) {
|
3296 |
-
// if we have already moved the uploaded file, we use the temporary copy as source file, and check if it exists
|
3297 |
-
if (!empty($this->file_src_temp)) {
|
3298 |
-
$this->log .= '- use the temp file instead of the original file since it is a second process<br />';
|
3299 |
-
$this->file_src_pathname = $this->file_src_temp;
|
3300 |
-
if (!file_exists($this->file_src_pathname)) {
|
3301 |
-
$this->processed = false;
|
3302 |
-
$this->error = $this->translate('temp_file_missing');
|
3303 |
-
}
|
3304 |
-
// if we haven't a temp file, and that we do check on uploads, we use is_uploaded_file()
|
3305 |
-
} else if (!$this->no_upload_check) {
|
3306 |
-
if (!is_uploaded_file($this->file_src_pathname)) {
|
3307 |
-
$this->processed = false;
|
3308 |
-
$this->error = $this->translate('source_missing');
|
3309 |
-
}
|
3310 |
-
// otherwise, if we don't check on uploaded files (local file for instance), we use file_exists()
|
3311 |
-
} else {
|
3312 |
-
if (!file_exists($this->file_src_pathname)) {
|
3313 |
-
$this->processed = false;
|
3314 |
-
$this->error = $this->translate('source_missing');
|
3315 |
-
}
|
3316 |
-
}
|
3317 |
-
|
3318 |
-
// checks if the destination directory exists, and attempt to create it
|
3319 |
-
if (!$return_mode) {
|
3320 |
-
if ($this->processed && !file_exists($this->file_dst_path)) {
|
3321 |
-
if ($this->dir_auto_create) {
|
3322 |
-
$this->log .= '- ' . $this->file_dst_path . ' doesn\'t exist. Attempting creation:';
|
3323 |
-
if (!$this->rmkdir($this->file_dst_path, $this->dir_chmod)) {
|
3324 |
-
$this->log .= ' failed<br />';
|
3325 |
-
$this->processed = false;
|
3326 |
-
$this->error = $this->translate('destination_dir');
|
3327 |
-
} else {
|
3328 |
-
$this->log .= ' success<br />';
|
3329 |
-
}
|
3330 |
-
} else {
|
3331 |
-
$this->error = $this->translate('destination_dir_missing');
|
3332 |
-
}
|
3333 |
-
}
|
3334 |
-
|
3335 |
-
if ($this->processed && !is_dir($this->file_dst_path)) {
|
3336 |
-
$this->processed = false;
|
3337 |
-
$this->error = $this->translate('destination_path_not_dir');
|
3338 |
-
}
|
3339 |
-
|
3340 |
-
// checks if the destination directory is writeable, and attempt to make it writeable
|
3341 |
-
$hash = md5($this->file_dst_name_body . rand(1, 1000));
|
3342 |
-
if ($this->processed && !($f = @fopen($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext, 'a+'))) {
|
3343 |
-
if ($this->dir_auto_chmod) {
|
3344 |
-
$this->log .= '- ' . $this->file_dst_path . ' is not writeable. Attempting chmod:';
|
3345 |
-
if (!@chmod($this->file_dst_path, $this->dir_chmod)) {
|
3346 |
-
$this->log .= ' failed<br />';
|
3347 |
-
$this->processed = false;
|
3348 |
-
$this->error = $this->translate('destination_dir_write');
|
3349 |
-
} else {
|
3350 |
-
$this->log .= ' success<br />';
|
3351 |
-
if (!($f = @fopen($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext, 'a+'))) { // we re-check
|
3352 |
-
$this->processed = false;
|
3353 |
-
$this->error = $this->translate('destination_dir_write');
|
3354 |
-
} else {
|
3355 |
-
@fclose($f);
|
3356 |
-
}
|
3357 |
-
}
|
3358 |
-
} else {
|
3359 |
-
$this->processed = false;
|
3360 |
-
$this->error = $this->translate('destination_path_write');
|
3361 |
-
}
|
3362 |
-
} else {
|
3363 |
-
if ($this->processed) @fclose($f);
|
3364 |
-
@unlink($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext);
|
3365 |
-
}
|
3366 |
-
|
3367 |
-
|
3368 |
-
// if we have an uploaded file, and if it is the first process, and if we can't access the file directly (open_basedir restriction)
|
3369 |
-
// then we create a temp file that will be used as the source file in subsequent processes
|
3370 |
-
// the third condition is there to check if the file is not accessible *directly* (it already has positively gone through is_uploaded_file(), so it exists)
|
3371 |
-
if (!$this->no_upload_check && empty($this->file_src_temp) && !@file_exists($this->file_src_pathname)) {
|
3372 |
-
$this->log .= '- attempting to use a temp file:';
|
3373 |
-
$hash = md5($this->file_dst_name_body . rand(1, 1000));
|
3374 |
-
if (move_uploaded_file($this->file_src_pathname, $this->file_dst_path . $hash . '.' . $this->file_dst_name_ext)) {
|
3375 |
-
$this->file_src_pathname = $this->file_dst_path . $hash . '.' . $this->file_dst_name_ext;
|
3376 |
-
$this->file_src_temp = $this->file_src_pathname;
|
3377 |
-
$this->log .= ' file created<br />';
|
3378 |
-
$this->log .= ' temp file is: ' . $this->file_src_temp . '<br />';
|
3379 |
-
} else {
|
3380 |
-
$this->log .= ' failed<br />';
|
3381 |
-
$this->processed = false;
|
3382 |
-
$this->error = $this->translate('temp_file');
|
3383 |
-
}
|
3384 |
-
}
|
3385 |
-
}
|
3386 |
-
}
|
3387 |
-
|
3388 |
-
if ($this->processed) {
|
3389 |
-
|
3390 |
-
// we do a quick check to ensure the file is really an image
|
3391 |
-
// we can do this only now, as it would have failed before in case of open_basedir
|
3392 |
-
if ($image_manipulation && !@getimagesize($this->file_src_pathname)) {
|
3393 |
-
$this->log .= '- the file is not an image!<br />';
|
3394 |
-
$image_manipulation = false;
|
3395 |
-
}
|
3396 |
-
|
3397 |
-
if ($image_manipulation) {
|
3398 |
-
|
3399 |
-
// checks if the source file is readable
|
3400 |
-
if ($this->processed && !($f = @fopen($this->file_src_pathname, 'r'))) {
|
3401 |
-
$this->processed = false;
|
3402 |
-
$this->error = $this->translate('source_not_readable');
|
3403 |
-
} else {
|
3404 |
-
@fclose($f);
|
3405 |
-
}
|
3406 |
-
|
3407 |
-
// we now do all the image manipulations
|
3408 |
-
$this->log .= '- image resizing or conversion wanted<br />';
|
3409 |
-
if ($this->gdversion()) {
|
3410 |
-
switch($this->image_src_type) {
|
3411 |
-
case 'jpg':
|
3412 |
-
if (!function_exists('imagecreatefromjpeg')) {
|
3413 |
-
$this->processed = false;
|
3414 |
-
$this->error = $this->translate('no_create_support', array('JPEG'));
|
3415 |
-
} else {
|
3416 |
-
$image_src = @imagecreatefromjpeg($this->file_src_pathname);
|
3417 |
-
if (!$image_src) {
|
3418 |
-
$this->processed = false;
|
3419 |
-
$this->error = $this->translate('create_error', array('JPEG'));
|
3420 |
-
} else {
|
3421 |
-
$this->log .= '- source image is JPEG<br />';
|
3422 |
-
}
|
3423 |
-
}
|
3424 |
-
break;
|
3425 |
-
case 'png':
|
3426 |
-
if (!function_exists('imagecreatefrompng')) {
|
3427 |
-
$this->processed = false;
|
3428 |
-
$this->error = $this->translate('no_create_support', array('PNG'));
|
3429 |
-
} else {
|
3430 |
-
$image_src = @imagecreatefrompng($this->file_src_pathname);
|
3431 |
-
if (!$image_src) {
|
3432 |
-
$this->processed = false;
|
3433 |
-
$this->error = $this->translate('create_error', array('PNG'));
|
3434 |
-
} else {
|
3435 |
-
$this->log .= '- source image is PNG<br />';
|
3436 |
-
}
|
3437 |
-
}
|
3438 |
-
break;
|
3439 |
-
case 'gif':
|
3440 |
-
if (!function_exists('imagecreatefromgif')) {
|
3441 |
-
$this->processed = false;
|
3442 |
-
$this->error = $this->translate('no_create_support', array('GIF'));
|
3443 |
-
} else {
|
3444 |
-
$image_src = @imagecreatefromgif($this->file_src_pathname);
|
3445 |
-
if (!$image_src) {
|
3446 |
-
$this->processed = false;
|
3447 |
-
$this->error = $this->translate('create_error', array('GIF'));
|
3448 |
-
} else {
|
3449 |
-
$this->log .= '- source image is GIF<br />';
|
3450 |
-
}
|
3451 |
-
}
|
3452 |
-
break;
|
3453 |
-
case 'bmp':
|
3454 |
-
if (!method_exists($this, 'imagecreatefrombmp')) {
|
3455 |
-
$this->processed = false;
|
3456 |
-
$this->error = $this->translate('no_create_support', array('BMP'));
|
3457 |
-
} else {
|
3458 |
-
$image_src = @$this->imagecreatefrombmp($this->file_src_pathname);
|
3459 |
-
if (!$image_src) {
|
3460 |
-
$this->processed = false;
|
3461 |
-
$this->error = $this->translate('create_error', array('BMP'));
|
3462 |
-
} else {
|
3463 |
-
$this->log .= '- source image is BMP<br />';
|
3464 |
-
}
|
3465 |
-
}
|
3466 |
-
break;
|
3467 |
-
default:
|
3468 |
-
$this->processed = false;
|
3469 |
-
$this->error = $this->translate('source_invalid');
|
3470 |
-
}
|
3471 |
-
} else {
|
3472 |
-
$this->processed = false;
|
3473 |
-
$this->error = $this->translate('gd_missing');
|
3474 |
-
}
|
3475 |
-
|
3476 |
-
if ($this->processed && $image_src) {
|
3477 |
-
|
3478 |
-
// we have to set image_convert if it is not already
|
3479 |
-
if (empty($this->image_convert)) {
|
3480 |
-
$this->log .= '- setting destination file type to ' . $this->file_src_name_ext . '<br />';
|
3481 |
-
$this->image_convert = $this->file_src_name_ext;
|
3482 |
-
}
|
3483 |
-
|
3484 |
-
if (!in_array($this->image_convert, $this->image_supported)) {
|
3485 |
-
$this->image_convert = 'jpg';
|
3486 |
-
}
|
3487 |
-
|
3488 |
-
// we set the default color to be the background color if we don't output in a transparent format
|
3489 |
-
if ($this->image_convert != 'png' && $this->image_convert != 'gif' && !empty($this->image_default_color) && empty($this->image_background_color)) $this->image_background_color = $this->image_default_color;
|
3490 |
-
if (!empty($this->image_background_color)) $this->image_default_color = $this->image_background_color;
|
3491 |
-
if (empty($this->image_default_color)) $this->image_default_color = '#FFFFFF';
|
3492 |
-
|
3493 |
-
$this->image_src_x = imagesx($image_src);
|
3494 |
-
$this->image_src_y = imagesy($image_src);
|
3495 |
-
$gd_version = $this->gdversion();
|
3496 |
-
$ratio_crop = null;
|
3497 |
-
|
3498 |
-
if (!imageistruecolor($image_src)) { // $this->image_src_type == 'gif'
|
3499 |
-
$this->log .= '- image is detected as having a palette<br />';
|
3500 |
-
$this->image_is_palette = true;
|
3501 |
-
$this->image_transparent_color = imagecolortransparent($image_src);
|
3502 |
-
if ($this->image_transparent_color >= 0 && imagecolorstotal($image_src) > $this->image_transparent_color) {
|
3503 |
-
$this->image_is_transparent = true;
|
3504 |
-
$this->log .= ' palette image is detected as transparent<br />';
|
3505 |
-
}
|
3506 |
-
// if the image has a palette (GIF), we convert it to true color, preserving transparency
|
3507 |
-
$this->log .= ' convert palette image to true color<br />';
|
3508 |
-
$true_color = imagecreatetruecolor($this->image_src_x, $this->image_src_y);
|
3509 |
-
imagealphablending($true_color, false);
|
3510 |
-
imagesavealpha($true_color, true);
|
3511 |
-
for ($x = 0; $x < $this->image_src_x; $x++) {
|
3512 |
-
for ($y = 0; $y < $this->image_src_y; $y++) {
|
3513 |
-
if ($this->image_transparent_color >= 0 && imagecolorat($image_src, $x, $y) == $this->image_transparent_color) {
|
3514 |
-
imagesetpixel($true_color, $x, $y, 127 << 24);
|
3515 |
-
} else {
|
3516 |
-
$rgb = imagecolorsforindex($image_src, imagecolorat($image_src, $x, $y));
|
3517 |
-
imagesetpixel($true_color, $x, $y, ($rgb['alpha'] << 24) | ($rgb['red'] << 16) | ($rgb['green'] << 8) | $rgb['blue']);
|
3518 |
-
}
|
3519 |
-
}
|
3520 |
-
}
|
3521 |
-
$image_src = $this->imagetransfer($true_color, $image_src);
|
3522 |
-
imagealphablending($image_src, false);
|
3523 |
-
imagesavealpha($image_src, true);
|
3524 |
-
$this->image_is_palette = false;
|
3525 |
-
}
|
3526 |
-
|
3527 |
-
|
3528 |
-
$image_dst = & $image_src;
|
3529 |
-
|
3530 |
-
// pre-crop image, before resizing
|
3531 |
-
if ((!empty($this->image_precrop))) {
|
3532 |
-
if (is_array($this->image_precrop)) {
|
3533 |
-
$vars = $this->image_precrop;
|
3534 |
-
} else {
|
3535 |
-
$vars = explode(' ', $this->image_precrop);
|
3536 |
-
}
|
3537 |
-
if (sizeof($vars) == 4) {
|
3538 |
-
$ct = $vars[0]; $cr = $vars[1]; $cb = $vars[2]; $cl = $vars[3];
|
3539 |
-
} else if (sizeof($vars) == 2) {
|
3540 |
-
$ct = $vars[0]; $cr = $vars[1]; $cb = $vars[0]; $cl = $vars[1];
|
3541 |
-
} else {
|
3542 |
-
$ct = $vars[0]; $cr = $vars[0]; $cb = $vars[0]; $cl = $vars[0];
|
3543 |
-
}
|
3544 |
-
if (strpos($ct, '%')>0) $ct = $this->image_src_y * (str_replace('%','',$ct) / 100);
|
3545 |
-
if (strpos($cr, '%')>0) $cr = $this->image_src_x * (str_replace('%','',$cr) / 100);
|
3546 |
-
if (strpos($cb, '%')>0) $cb = $this->image_src_y * (str_replace('%','',$cb) / 100);
|
3547 |
-
if (strpos($cl, '%')>0) $cl = $this->image_src_x * (str_replace('%','',$cl) / 100);
|
3548 |
-
if (strpos($ct, 'px')>0) $ct = str_replace('px','',$ct);
|
3549 |
-
if (strpos($cr, 'px')>0) $cr = str_replace('px','',$cr);
|
3550 |
-
if (strpos($cb, 'px')>0) $cb = str_replace('px','',$cb);
|
3551 |
-
if (strpos($cl, 'px')>0) $cl = str_replace('px','',$cl);
|
3552 |
-
$ct = (int) $ct;
|
3553 |
-
$cr = (int) $cr;
|
3554 |
-
$cb = (int) $cb;
|
3555 |
-
$cl = (int) $cl;
|
3556 |
-
$this->log .= '- pre-crop image : ' . $ct . ' ' . $cr . ' ' . $cb . ' ' . $cl . ' <br />';
|
3557 |
-
$this->image_src_x = $this->image_src_x - $cl - $cr;
|
3558 |
-
$this->image_src_y = $this->image_src_y - $ct - $cb;
|
3559 |
-
if ($this->image_src_x < 1) $this->image_src_x = 1;
|
3560 |
-
if ($this->image_src_y < 1) $this->image_src_y = 1;
|
3561 |
-
$tmp = $this->imagecreatenew($this->image_src_x, $this->image_src_y);
|
3562 |
-
|
3563 |
-
// we copy the image into the recieving image
|
3564 |
-
imagecopy($tmp, $image_dst, 0, 0, $cl, $ct, $this->image_src_x, $this->image_src_y);
|
3565 |
-
|
3566 |
-
// if we crop with negative margins, we have to make sure the extra bits are the right color, or transparent
|
3567 |
-
if ($ct < 0 || $cr < 0 || $cb < 0 || $cl < 0 ) {
|
3568 |
-
// use the background color if present
|
3569 |
-
if (!empty($this->image_background_color)) {
|
3570 |
-
list($red, $green, $blue) = $this->getcolors($this->image_background_color);
|
3571 |
-
$fill = imagecolorallocate($tmp, $red, $green, $blue);
|
3572 |
-
} else {
|
3573 |
-
$fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127);
|
3574 |
-
}
|
3575 |
-
// fills eventual negative margins
|
3576 |
-
if ($ct < 0) imagefilledrectangle($tmp, 0, 0, $this->image_src_x, -$ct, $fill);
|
3577 |
-
if ($cr < 0) imagefilledrectangle($tmp, $this->image_src_x + $cr, 0, $this->image_src_x, $this->image_src_y, $fill);
|
3578 |
-
if ($cb < 0) imagefilledrectangle($tmp, 0, $this->image_src_y + $cb, $this->image_src_x, $this->image_src_y, $fill);
|
3579 |
-
if ($cl < 0) imagefilledrectangle($tmp, 0, 0, -$cl, $this->image_src_y, $fill);
|
3580 |
-
}
|
3581 |
-
|
3582 |
-
// we transfert tmp into image_dst
|
3583 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3584 |
-
}
|
3585 |
-
|
3586 |
-
// resize image (and move image_src_x, image_src_y dimensions into image_dst_x, image_dst_y)
|
3587 |
-
if ($this->image_resize) {
|
3588 |
-
$this->log .= '- resizing...<br />';
|
3589 |
-
|
3590 |
-
if ($this->image_ratio_x) {
|
3591 |
-
$this->log .= ' calculate x size<br />';
|
3592 |
-
$this->image_dst_x = round(($this->image_src_x * $this->image_y) / $this->image_src_y);
|
3593 |
-
$this->image_dst_y = $this->image_y;
|
3594 |
-
} else if ($this->image_ratio_y) {
|
3595 |
-
$this->log .= ' calculate y size<br />';
|
3596 |
-
$this->image_dst_x = $this->image_x;
|
3597 |
-
$this->image_dst_y = round(($this->image_src_y * $this->image_x) / $this->image_src_x);
|
3598 |
-
} else if (is_numeric($this->image_ratio_pixels)) {
|
3599 |
-
$this->log .= ' calculate x/y size to match a number of pixels<br />';
|
3600 |
-
$pixels = $this->image_src_y * $this->image_src_x;
|
3601 |
-
$diff = sqrt($this->image_ratio_pixels / $pixels);
|
3602 |
-
$this->image_dst_x = round($this->image_src_x * $diff);
|
3603 |
-
$this->image_dst_y = round($this->image_src_y * $diff);
|
3604 |
-
} else if ($this->image_ratio || $this->image_ratio_crop || $this->image_ratio_fill || $this->image_ratio_no_zoom_in || $this->image_ratio_no_zoom_out) {
|
3605 |
-
$this->log .= ' check x/y sizes<br />';
|
3606 |
-
if ((!$this->image_ratio_no_zoom_in && !$this->image_ratio_no_zoom_out)
|
3607 |
-
|| ($this->image_ratio_no_zoom_in && ($this->image_src_x > $this->image_x || $this->image_src_y > $this->image_y))
|
3608 |
-
|| ($this->image_ratio_no_zoom_out && $this->image_src_x < $this->image_x && $this->image_src_y < $this->image_y)) {
|
3609 |
-
$this->image_dst_x = $this->image_x;
|
3610 |
-
$this->image_dst_y = $this->image_y;
|
3611 |
-
if ($this->image_ratio_crop) {
|
3612 |
-
if (!is_string($this->image_ratio_crop)) $this->image_ratio_crop = '';
|
3613 |
-
$this->image_ratio_crop = strtolower($this->image_ratio_crop);
|
3614 |
-
if (($this->image_src_x/$this->image_x) > ($this->image_src_y/$this->image_y)) {
|
3615 |
-
$this->image_dst_y = $this->image_y;
|
3616 |
-
$this->image_dst_x = intval($this->image_src_x*($this->image_y / $this->image_src_y));
|
3617 |
-
$ratio_crop = array();
|
3618 |
-
$ratio_crop['x'] = $this->image_dst_x - $this->image_x;
|
3619 |
-
if (strpos($this->image_ratio_crop, 'l') !== false) {
|
3620 |
-
$ratio_crop['l'] = 0;
|
3621 |
-
$ratio_crop['r'] = $ratio_crop['x'];
|
3622 |
-
} else if (strpos($this->image_ratio_crop, 'r') !== false) {
|
3623 |
-
$ratio_crop['l'] = $ratio_crop['x'];
|
3624 |
-
$ratio_crop['r'] = 0;
|
3625 |
-
} else {
|
3626 |
-
$ratio_crop['l'] = round($ratio_crop['x']/2);
|
3627 |
-
$ratio_crop['r'] = $ratio_crop['x'] - $ratio_crop['l'];
|
3628 |
-
}
|
3629 |
-
$this->log .= ' ratio_crop_x : ' . $ratio_crop['x'] . ' (' . $ratio_crop['l'] . ';' . $ratio_crop['r'] . ')<br />';
|
3630 |
-
if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0);
|
3631 |
-
} else {
|
3632 |
-
$this->image_dst_x = $this->image_x;
|
3633 |
-
$this->image_dst_y = intval($this->image_src_y*($this->image_x / $this->image_src_x));
|
3634 |
-
$ratio_crop = array();
|
3635 |
-
$ratio_crop['y'] = $this->image_dst_y - $this->image_y;
|
3636 |
-
if (strpos($this->image_ratio_crop, 't') !== false) {
|
3637 |
-
$ratio_crop['t'] = 0;
|
3638 |
-
$ratio_crop['b'] = $ratio_crop['y'];
|
3639 |
-
} else if (strpos($this->image_ratio_crop, 'b') !== false) {
|
3640 |
-
$ratio_crop['t'] = $ratio_crop['y'];
|
3641 |
-
$ratio_crop['b'] = 0;
|
3642 |
-
} else {
|
3643 |
-
$ratio_crop['t'] = round($ratio_crop['y']/2);
|
3644 |
-
$ratio_crop['b'] = $ratio_crop['y'] - $ratio_crop['t'];
|
3645 |
-
}
|
3646 |
-
$this->log .= ' ratio_crop_y : ' . $ratio_crop['y'] . ' (' . $ratio_crop['t'] . ';' . $ratio_crop['b'] . ')<br />';
|
3647 |
-
if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0);
|
3648 |
-
}
|
3649 |
-
} else if ($this->image_ratio_fill) {
|
3650 |
-
if (!is_string($this->image_ratio_fill)) $this->image_ratio_fill = '';
|
3651 |
-
$this->image_ratio_fill = strtolower($this->image_ratio_fill);
|
3652 |
-
if (($this->image_src_x/$this->image_x) < ($this->image_src_y/$this->image_y)) {
|
3653 |
-
$this->image_dst_y = $this->image_y;
|
3654 |
-
$this->image_dst_x = intval($this->image_src_x*($this->image_y / $this->image_src_y));
|
3655 |
-
$ratio_crop = array();
|
3656 |
-
$ratio_crop['x'] = $this->image_dst_x - $this->image_x;
|
3657 |
-
if (strpos($this->image_ratio_fill, 'l') !== false) {
|
3658 |
-
$ratio_crop['l'] = 0;
|
3659 |
-
$ratio_crop['r'] = $ratio_crop['x'];
|
3660 |
-
} else if (strpos($this->image_ratio_fill, 'r') !== false) {
|
3661 |
-
$ratio_crop['l'] = $ratio_crop['x'];
|
3662 |
-
$ratio_crop['r'] = 0;
|
3663 |
-
} else {
|
3664 |
-
$ratio_crop['l'] = round($ratio_crop['x']/2);
|
3665 |
-
$ratio_crop['r'] = $ratio_crop['x'] - $ratio_crop['l'];
|
3666 |
-
}
|
3667 |
-
$this->log .= ' ratio_fill_x : ' . $ratio_crop['x'] . ' (' . $ratio_crop['l'] . ';' . $ratio_crop['r'] . ')<br />';
|
3668 |
-
if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0);
|
3669 |
-
} else {
|
3670 |
-
$this->image_dst_x = $this->image_x;
|
3671 |
-
$this->image_dst_y = intval($this->image_src_y*($this->image_x / $this->image_src_x));
|
3672 |
-
$ratio_crop = array();
|
3673 |
-
$ratio_crop['y'] = $this->image_dst_y - $this->image_y;
|
3674 |
-
if (strpos($this->image_ratio_fill, 't') !== false) {
|
3675 |
-
$ratio_crop['t'] = 0;
|
3676 |
-
$ratio_crop['b'] = $ratio_crop['y'];
|
3677 |
-
} else if (strpos($this->image_ratio_fill, 'b') !== false) {
|
3678 |
-
$ratio_crop['t'] = $ratio_crop['y'];
|
3679 |
-
$ratio_crop['b'] = 0;
|
3680 |
-
} else {
|
3681 |
-
$ratio_crop['t'] = round($ratio_crop['y']/2);
|
3682 |
-
$ratio_crop['b'] = $ratio_crop['y'] - $ratio_crop['t'];
|
3683 |
-
}
|
3684 |
-
$this->log .= ' ratio_fill_y : ' . $ratio_crop['y'] . ' (' . $ratio_crop['t'] . ';' . $ratio_crop['b'] . ')<br />';
|
3685 |
-
if (is_null($this->image_crop)) $this->image_crop = array(0, 0, 0, 0);
|
3686 |
-
}
|
3687 |
-
} else {
|
3688 |
-
if (($this->image_src_x/$this->image_x) > ($this->image_src_y/$this->image_y)) {
|
3689 |
-
$this->image_dst_x = $this->image_x;
|
3690 |
-
$this->image_dst_y = intval($this->image_src_y*($this->image_x / $this->image_src_x));
|
3691 |
-
} else {
|
3692 |
-
$this->image_dst_y = $this->image_y;
|
3693 |
-
$this->image_dst_x = intval($this->image_src_x*($this->image_y / $this->image_src_y));
|
3694 |
-
}
|
3695 |
-
}
|
3696 |
-
} else {
|
3697 |
-
$this->log .= ' doesn\'t calculate x/y sizes<br />';
|
3698 |
-
$this->image_dst_x = $this->image_src_x;
|
3699 |
-
$this->image_dst_y = $this->image_src_y;
|
3700 |
-
}
|
3701 |
-
} else {
|
3702 |
-
$this->log .= ' use plain sizes<br />';
|
3703 |
-
$this->image_dst_x = $this->image_x;
|
3704 |
-
$this->image_dst_y = $this->image_y;
|
3705 |
-
}
|
3706 |
-
|
3707 |
-
if ($this->image_dst_x < 1) $this->image_dst_x = 1;
|
3708 |
-
if ($this->image_dst_y < 1) $this->image_dst_y = 1;
|
3709 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3710 |
-
|
3711 |
-
if ($gd_version >= 2) {
|
3712 |
-
$res = imagecopyresampled($tmp, $image_src, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, $this->image_src_x, $this->image_src_y);
|
3713 |
-
} else {
|
3714 |
-
$res = imagecopyresized($tmp, $image_src, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, $this->image_src_x, $this->image_src_y);
|
3715 |
-
}
|
3716 |
-
|
3717 |
-
$this->log .= ' resized image object created<br />';
|
3718 |
-
$this->log .= ' image_src_x y : ' . $this->image_src_x . ' x ' . $this->image_src_y . '<br />';
|
3719 |
-
$this->log .= ' image_dst_x y : ' . $this->image_dst_x . ' x ' . $this->image_dst_y . '<br />';
|
3720 |
-
// we transfert tmp into image_dst
|
3721 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3722 |
-
|
3723 |
-
} else {
|
3724 |
-
$this->image_dst_x = $this->image_src_x;
|
3725 |
-
$this->image_dst_y = $this->image_src_y;
|
3726 |
-
}
|
3727 |
-
|
3728 |
-
// crop image (and also crops if image_ratio_crop is used)
|
3729 |
-
if ((!empty($this->image_crop) || !is_null($ratio_crop))) {
|
3730 |
-
if (is_array($this->image_crop)) {
|
3731 |
-
$vars = $this->image_crop;
|
3732 |
-
} else {
|
3733 |
-
$vars = explode(' ', $this->image_crop);
|
3734 |
-
}
|
3735 |
-
if (sizeof($vars) == 4) {
|
3736 |
-
$ct = $vars[0]; $cr = $vars[1]; $cb = $vars[2]; $cl = $vars[3];
|
3737 |
-
} else if (sizeof($vars) == 2) {
|
3738 |
-
$ct = $vars[0]; $cr = $vars[1]; $cb = $vars[0]; $cl = $vars[1];
|
3739 |
-
} else {
|
3740 |
-
$ct = $vars[0]; $cr = $vars[0]; $cb = $vars[0]; $cl = $vars[0];
|
3741 |
-
}
|
3742 |
-
if (strpos($ct, '%')>0) $ct = $this->image_dst_y * (str_replace('%','',$ct) / 100);
|
3743 |
-
if (strpos($cr, '%')>0) $cr = $this->image_dst_x * (str_replace('%','',$cr) / 100);
|
3744 |
-
if (strpos($cb, '%')>0) $cb = $this->image_dst_y * (str_replace('%','',$cb) / 100);
|
3745 |
-
if (strpos($cl, '%')>0) $cl = $this->image_dst_x * (str_replace('%','',$cl) / 100);
|
3746 |
-
if (strpos($ct, 'px')>0) $ct = str_replace('px','',$ct);
|
3747 |
-
if (strpos($cr, 'px')>0) $cr = str_replace('px','',$cr);
|
3748 |
-
if (strpos($cb, 'px')>0) $cb = str_replace('px','',$cb);
|
3749 |
-
if (strpos($cl, 'px')>0) $cl = str_replace('px','',$cl);
|
3750 |
-
$ct = (int) $ct;
|
3751 |
-
$cr = (int) $cr;
|
3752 |
-
$cb = (int) $cb;
|
3753 |
-
$cl = (int) $cl;
|
3754 |
-
// we adjust the cropping if we use image_ratio_crop
|
3755 |
-
if (!is_null($ratio_crop)) {
|
3756 |
-
if (array_key_exists('t', $ratio_crop)) $ct += $ratio_crop['t'];
|
3757 |
-
if (array_key_exists('r', $ratio_crop)) $cr += $ratio_crop['r'];
|
3758 |
-
if (array_key_exists('b', $ratio_crop)) $cb += $ratio_crop['b'];
|
3759 |
-
if (array_key_exists('l', $ratio_crop)) $cl += $ratio_crop['l'];
|
3760 |
-
}
|
3761 |
-
$this->log .= '- crop image : ' . $ct . ' ' . $cr . ' ' . $cb . ' ' . $cl . ' <br />';
|
3762 |
-
$this->image_dst_x = $this->image_dst_x - $cl - $cr;
|
3763 |
-
$this->image_dst_y = $this->image_dst_y - $ct - $cb;
|
3764 |
-
if ($this->image_dst_x < 1) $this->image_dst_x = 1;
|
3765 |
-
if ($this->image_dst_y < 1) $this->image_dst_y = 1;
|
3766 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3767 |
-
|
3768 |
-
// we copy the image into the recieving image
|
3769 |
-
imagecopy($tmp, $image_dst, 0, 0, $cl, $ct, $this->image_dst_x, $this->image_dst_y);
|
3770 |
-
|
3771 |
-
// if we crop with negative margins, we have to make sure the extra bits are the right color, or transparent
|
3772 |
-
if ($ct < 0 || $cr < 0 || $cb < 0 || $cl < 0 ) {
|
3773 |
-
// use the background color if present
|
3774 |
-
if (!empty($this->image_background_color)) {
|
3775 |
-
list($red, $green, $blue) = $this->getcolors($this->image_background_color);
|
3776 |
-
$fill = imagecolorallocate($tmp, $red, $green, $blue);
|
3777 |
-
} else {
|
3778 |
-
$fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127);
|
3779 |
-
}
|
3780 |
-
// fills eventual negative margins
|
3781 |
-
if ($ct < 0) imagefilledrectangle($tmp, 0, 0, $this->image_dst_x, -$ct, $fill);
|
3782 |
-
if ($cr < 0) imagefilledrectangle($tmp, $this->image_dst_x + $cr, 0, $this->image_dst_x, $this->image_dst_y, $fill);
|
3783 |
-
if ($cb < 0) imagefilledrectangle($tmp, 0, $this->image_dst_y + $cb, $this->image_dst_x, $this->image_dst_y, $fill);
|
3784 |
-
if ($cl < 0) imagefilledrectangle($tmp, 0, 0, -$cl, $this->image_dst_y, $fill);
|
3785 |
-
}
|
3786 |
-
|
3787 |
-
// we transfert tmp into image_dst
|
3788 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3789 |
-
}
|
3790 |
-
|
3791 |
-
// flip image
|
3792 |
-
if ($gd_version >= 2 && !empty($this->image_flip)) {
|
3793 |
-
$this->image_flip = strtolower($this->image_flip);
|
3794 |
-
$this->log .= '- flip image : ' . $this->image_flip . '<br />';
|
3795 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3796 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
3797 |
-
for ($y = 0; $y < $this->image_dst_y; $y++){
|
3798 |
-
if (strpos($this->image_flip, 'v') !== false) {
|
3799 |
-
imagecopy($tmp, $image_dst, $this->image_dst_x - $x - 1, $y, $x, $y, 1, 1);
|
3800 |
-
} else {
|
3801 |
-
imagecopy($tmp, $image_dst, $x, $this->image_dst_y - $y - 1, $x, $y, 1, 1);
|
3802 |
-
}
|
3803 |
-
}
|
3804 |
-
}
|
3805 |
-
// we transfert tmp into image_dst
|
3806 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3807 |
-
}
|
3808 |
-
|
3809 |
-
// rotate image
|
3810 |
-
if ($gd_version >= 2 && is_numeric($this->image_rotate)) {
|
3811 |
-
if (!in_array($this->image_rotate, array(0, 90, 180, 270))) $this->image_rotate = 0;
|
3812 |
-
if ($this->image_rotate != 0) {
|
3813 |
-
if ($this->image_rotate == 90 || $this->image_rotate == 270) {
|
3814 |
-
$tmp = $this->imagecreatenew($this->image_dst_y, $this->image_dst_x);
|
3815 |
-
} else {
|
3816 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3817 |
-
}
|
3818 |
-
$this->log .= '- rotate image : ' . $this->image_rotate . '<br />';
|
3819 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
3820 |
-
for ($y = 0; $y < $this->image_dst_y; $y++){
|
3821 |
-
if ($this->image_rotate == 90) {
|
3822 |
-
imagecopy($tmp, $image_dst, $y, $x, $x, $this->image_dst_y - $y - 1, 1, 1);
|
3823 |
-
} else if ($this->image_rotate == 180) {
|
3824 |
-
imagecopy($tmp, $image_dst, $x, $y, $this->image_dst_x - $x - 1, $this->image_dst_y - $y - 1, 1, 1);
|
3825 |
-
} else if ($this->image_rotate == 270) {
|
3826 |
-
imagecopy($tmp, $image_dst, $y, $x, $this->image_dst_x - $x - 1, $y, 1, 1);
|
3827 |
-
} else {
|
3828 |
-
imagecopy($tmp, $image_dst, $x, $y, $x, $y, 1, 1);
|
3829 |
-
}
|
3830 |
-
}
|
3831 |
-
}
|
3832 |
-
if ($this->image_rotate == 90 || $this->image_rotate == 270) {
|
3833 |
-
$t = $this->image_dst_y;
|
3834 |
-
$this->image_dst_y = $this->image_dst_x;
|
3835 |
-
$this->image_dst_x = $t;
|
3836 |
-
}
|
3837 |
-
// we transfert tmp into image_dst
|
3838 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3839 |
-
}
|
3840 |
-
}
|
3841 |
-
|
3842 |
-
// add color overlay
|
3843 |
-
if ($gd_version >= 2 && (is_numeric($this->image_overlay_percent) && $this->image_overlay_percent > 0 && !empty($this->image_overlay_color))) {
|
3844 |
-
$this->log .= '- apply color overlay<br />';
|
3845 |
-
list($red, $green, $blue) = $this->getcolors($this->image_overlay_color);
|
3846 |
-
$filter = imagecreatetruecolor($this->image_dst_x, $this->image_dst_y);
|
3847 |
-
$color = imagecolorallocate($filter, $red, $green, $blue);
|
3848 |
-
imagefilledrectangle($filter, 0, 0, $this->image_dst_x, $this->image_dst_y, $color);
|
3849 |
-
$this->imagecopymergealpha($image_dst, $filter, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y, $this->image_overlay_percent);
|
3850 |
-
imagedestroy($filter);
|
3851 |
-
}
|
3852 |
-
|
3853 |
-
// add brightness, contrast and tint, turns to greyscale and inverts colors
|
3854 |
-
if ($gd_version >= 2 && ($this->image_negative || $this->image_greyscale || is_numeric($this->image_threshold)|| is_numeric($this->image_brightness) || is_numeric($this->image_contrast) || !empty($this->image_tint_color))) {
|
3855 |
-
$this->log .= '- apply tint, light, contrast correction, negative, greyscale and threshold<br />';
|
3856 |
-
if (!empty($this->image_tint_color)) list($tint_red, $tint_green, $tint_blue) = $this->getcolors($this->image_tint_color);
|
3857 |
-
imagealphablending($image_dst, true);
|
3858 |
-
for($y=0; $y < $this->image_dst_y; $y++) {
|
3859 |
-
for($x=0; $x < $this->image_dst_x; $x++) {
|
3860 |
-
if ($this->image_greyscale) {
|
3861 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
3862 |
-
$r = $g = $b = round((0.2125 * $pixel['red']) + (0.7154 * $pixel['green']) + (0.0721 * $pixel['blue']));
|
3863 |
-
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
|
3864 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
3865 |
-
}
|
3866 |
-
if (is_numeric($this->image_threshold)) {
|
3867 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
3868 |
-
$c = (round($pixel['red'] + $pixel['green'] + $pixel['blue']) / 3) - 127;
|
3869 |
-
$r = $g = $b = ($c > $this->image_threshold ? 255 : 0);
|
3870 |
-
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
|
3871 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
3872 |
-
}
|
3873 |
-
if (is_numeric($this->image_brightness)) {
|
3874 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
3875 |
-
$r = max(min(round($pixel['red'] + (($this->image_brightness * 2))), 255), 0);
|
3876 |
-
$g = max(min(round($pixel['green'] + (($this->image_brightness * 2))), 255), 0);
|
3877 |
-
$b = max(min(round($pixel['blue'] + (($this->image_brightness * 2))), 255), 0);
|
3878 |
-
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
|
3879 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
3880 |
-
}
|
3881 |
-
if (is_numeric($this->image_contrast)) {
|
3882 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
3883 |
-
$r = max(min(round(($this->image_contrast + 128) * $pixel['red'] / 128), 255), 0);
|
3884 |
-
$g = max(min(round(($this->image_contrast + 128) * $pixel['green'] / 128), 255), 0);
|
3885 |
-
$b = max(min(round(($this->image_contrast + 128) * $pixel['blue'] / 128), 255), 0);
|
3886 |
-
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
|
3887 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
3888 |
-
}
|
3889 |
-
if (!empty($this->image_tint_color)) {
|
3890 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
3891 |
-
$r = min(round($tint_red * $pixel['red'] / 169), 255);
|
3892 |
-
$g = min(round($tint_green * $pixel['green'] / 169), 255);
|
3893 |
-
$b = min(round($tint_blue * $pixel['blue'] / 169), 255);
|
3894 |
-
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
|
3895 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
3896 |
-
}
|
3897 |
-
if (!empty($this->image_negative)) {
|
3898 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
3899 |
-
$r = round(255 - $pixel['red']);
|
3900 |
-
$g = round(255 - $pixel['green']);
|
3901 |
-
$b = round(255 - $pixel['blue']);
|
3902 |
-
$color = imagecolorallocatealpha($image_dst, $r, $g, $b, $pixel['alpha']);
|
3903 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
3904 |
-
}
|
3905 |
-
}
|
3906 |
-
}
|
3907 |
-
}
|
3908 |
-
|
3909 |
-
// adds a border
|
3910 |
-
if ($gd_version >= 2 && !empty($this->image_border)) {
|
3911 |
-
if (is_array($this->image_border)) {
|
3912 |
-
$vars = $this->image_border;
|
3913 |
-
$this->log .= '- add border : ' . implode(' ', $this->image_border) . '<br />';
|
3914 |
-
} else {
|
3915 |
-
$this->log .= '- add border : ' . $this->image_border . '<br />';
|
3916 |
-
$vars = explode(' ', $this->image_border);
|
3917 |
-
}
|
3918 |
-
if (sizeof($vars) == 4) {
|
3919 |
-
$ct = $vars[0]; $cr = $vars[1]; $cb = $vars[2]; $cl = $vars[3];
|
3920 |
-
} else if (sizeof($vars) == 2) {
|
3921 |
-
$ct = $vars[0]; $cr = $vars[1]; $cb = $vars[0]; $cl = $vars[1];
|
3922 |
-
} else {
|
3923 |
-
$ct = $vars[0]; $cr = $vars[0]; $cb = $vars[0]; $cl = $vars[0];
|
3924 |
-
}
|
3925 |
-
if (strpos($ct, '%')>0) $ct = $this->image_dst_y * (str_replace('%','',$ct) / 100);
|
3926 |
-
if (strpos($cr, '%')>0) $cr = $this->image_dst_x * (str_replace('%','',$cr) / 100);
|
3927 |
-
if (strpos($cb, '%')>0) $cb = $this->image_dst_y * (str_replace('%','',$cb) / 100);
|
3928 |
-
if (strpos($cl, '%')>0) $cl = $this->image_dst_x * (str_replace('%','',$cl) / 100);
|
3929 |
-
if (strpos($ct, 'px')>0) $ct = str_replace('px','',$ct);
|
3930 |
-
if (strpos($cr, 'px')>0) $cr = str_replace('px','',$cr);
|
3931 |
-
if (strpos($cb, 'px')>0) $cb = str_replace('px','',$cb);
|
3932 |
-
if (strpos($cl, 'px')>0) $cl = str_replace('px','',$cl);
|
3933 |
-
$ct = (int) $ct;
|
3934 |
-
$cr = (int) $cr;
|
3935 |
-
$cb = (int) $cb;
|
3936 |
-
$cl = (int) $cl;
|
3937 |
-
$this->image_dst_x = $this->image_dst_x + $cl + $cr;
|
3938 |
-
$this->image_dst_y = $this->image_dst_y + $ct + $cb;
|
3939 |
-
if (!empty($this->image_border_color)) list($red, $green, $blue) = $this->getcolors($this->image_border_color);
|
3940 |
-
// we now create an image, that we fill with the border color
|
3941 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3942 |
-
$background = imagecolorallocatealpha($tmp, $red, $green, $blue, 0);
|
3943 |
-
imagefilledrectangle($tmp, 0, 0, $this->image_dst_x, $this->image_dst_y, $background);
|
3944 |
-
// we then copy the source image into the new image, without merging so that only the border is actually kept
|
3945 |
-
imagecopy($tmp, $image_dst, $cl, $ct, 0, 0, $this->image_dst_x - $cr - $cl, $this->image_dst_y - $cb - $ct);
|
3946 |
-
// we transfert tmp into image_dst
|
3947 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3948 |
-
}
|
3949 |
-
|
3950 |
-
// add frame border
|
3951 |
-
if (is_numeric($this->image_frame)) {
|
3952 |
-
if (is_array($this->image_frame_colors)) {
|
3953 |
-
$vars = $this->image_frame_colors;
|
3954 |
-
$this->log .= '- add frame : ' . implode(' ', $this->image_frame_colors) . '<br />';
|
3955 |
-
} else {
|
3956 |
-
$this->log .= '- add frame : ' . $this->image_frame_colors . '<br />';
|
3957 |
-
$vars = explode(' ', $this->image_frame_colors);
|
3958 |
-
}
|
3959 |
-
$nb = sizeof($vars);
|
3960 |
-
$this->image_dst_x = $this->image_dst_x + ($nb * 2);
|
3961 |
-
$this->image_dst_y = $this->image_dst_y + ($nb * 2);
|
3962 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3963 |
-
imagecopy($tmp, $image_dst, $nb, $nb, 0, 0, $this->image_dst_x - ($nb * 2), $this->image_dst_y - ($nb * 2));
|
3964 |
-
for ($i=0; $i<$nb; $i++) {
|
3965 |
-
list($red, $green, $blue) = $this->getcolors($vars[$i]);
|
3966 |
-
$c = imagecolorallocate($tmp, $red, $green, $blue);
|
3967 |
-
if ($this->image_frame == 1) {
|
3968 |
-
imageline($tmp, $i, $i, $this->image_dst_x - $i -1, $i, $c);
|
3969 |
-
imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i -1, $this->image_dst_x - $i -1, $i, $c);
|
3970 |
-
imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i -1, $i, $this->image_dst_y - $i -1, $c);
|
3971 |
-
imageline($tmp, $i, $i, $i, $this->image_dst_y - $i -1, $c);
|
3972 |
-
} else {
|
3973 |
-
imageline($tmp, $i, $i, $this->image_dst_x - $i -1, $i, $c);
|
3974 |
-
imageline($tmp, $this->image_dst_x - $nb + $i, $this->image_dst_y - $nb + $i, $this->image_dst_x - $nb + $i, $nb - $i, $c);
|
3975 |
-
imageline($tmp, $this->image_dst_x - $nb + $i, $this->image_dst_y - $nb + $i, $nb - $i, $this->image_dst_y - $nb + $i, $c);
|
3976 |
-
imageline($tmp, $i, $i, $i, $this->image_dst_y - $i -1, $c);
|
3977 |
-
}
|
3978 |
-
}
|
3979 |
-
// we transfert tmp into image_dst
|
3980 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
3981 |
-
}
|
3982 |
-
|
3983 |
-
// add bevel border
|
3984 |
-
if ($this->image_bevel > 0) {
|
3985 |
-
if (empty($this->image_bevel_color1)) $this->image_bevel_color1 = '#FFFFFF';
|
3986 |
-
if (empty($this->image_bevel_color2)) $this->image_bevel_color2 = '#000000';
|
3987 |
-
list($red1, $green1, $blue1) = $this->getcolors($this->image_bevel_color1);
|
3988 |
-
list($red2, $green2, $blue2) = $this->getcolors($this->image_bevel_color2);
|
3989 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y);
|
3990 |
-
imagecopy($tmp, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y);
|
3991 |
-
imagealphablending($tmp, true);
|
3992 |
-
for ($i=0; $i<$this->image_bevel; $i++) {
|
3993 |
-
$alpha = round(($i / $this->image_bevel) * 127);
|
3994 |
-
$c1 = imagecolorallocatealpha($tmp, $red1, $green1, $blue1, $alpha);
|
3995 |
-
$c2 = imagecolorallocatealpha($tmp, $red2, $green2, $blue2, $alpha);
|
3996 |
-
imageline($tmp, $i, $i, $this->image_dst_x - $i -1, $i, $c1);
|
3997 |
-
imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i, $this->image_dst_x - $i -1, $i, $c2);
|
3998 |
-
imageline($tmp, $this->image_dst_x - $i -1, $this->image_dst_y - $i -1, $i, $this->image_dst_y - $i -1, $c2);
|
3999 |
-
imageline($tmp, $i, $i, $i, $this->image_dst_y - $i -1, $c1);
|
4000 |
-
}
|
4001 |
-
// we transfert tmp into image_dst
|
4002 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
4003 |
-
}
|
4004 |
-
|
4005 |
-
// add watermark image
|
4006 |
-
if ($this->image_watermark!='' && file_exists($this->image_watermark)) {
|
4007 |
-
$this->log .= '- add watermark<br />';
|
4008 |
-
$this->image_watermark_position = strtolower($this->image_watermark_position);
|
4009 |
-
$watermark_info = getimagesize($this->image_watermark);
|
4010 |
-
$watermark_type = (array_key_exists(2, $watermark_info) ? $watermark_info[2] : null); // 1 = GIF, 2 = JPG, 3 = PNG
|
4011 |
-
$watermark_checked = false;
|
4012 |
-
if ($watermark_type == IMAGETYPE_GIF) {
|
4013 |
-
if (!function_exists('imagecreatefromgif')) {
|
4014 |
-
$this->error = $this->translate('watermark_no_create_support', array('GIF'));
|
4015 |
-
} else {
|
4016 |
-
$filter = @imagecreatefromgif($this->image_watermark);
|
4017 |
-
if (!$filter) {
|
4018 |
-
$this->error = $this->translate('watermark_create_error', array('GIF'));
|
4019 |
-
} else {
|
4020 |
-
$this->log .= ' watermark source image is GIF<br />';
|
4021 |
-
$watermark_checked = true;
|
4022 |
-
}
|
4023 |
-
}
|
4024 |
-
} else if ($watermark_type == IMAGETYPE_JPEG) {
|
4025 |
-
if (!function_exists('imagecreatefromjpeg')) {
|
4026 |
-
$this->error = $this->translate('watermark_no_create_support', array('JPEG'));
|
4027 |
-
} else {
|
4028 |
-
$filter = @imagecreatefromjpeg($this->image_watermark);
|
4029 |
-
if (!$filter) {
|
4030 |
-
$this->error = $this->translate('watermark_create_error', array('JPEG'));
|
4031 |
-
} else {
|
4032 |
-
$this->log .= ' watermark source image is JPEG<br />';
|
4033 |
-
$watermark_checked = true;
|
4034 |
-
}
|
4035 |
-
}
|
4036 |
-
} else if ($watermark_type == IMAGETYPE_PNG) {
|
4037 |
-
if (!function_exists('imagecreatefrompng')) {
|
4038 |
-
$this->error = $this->translate('watermark_no_create_support', array('PNG'));
|
4039 |
-
} else {
|
4040 |
-
$filter = @imagecreatefrompng($this->image_watermark);
|
4041 |
-
if (!$filter) {
|
4042 |
-
$this->error = $this->translate('watermark_create_error', array('PNG'));
|
4043 |
-
} else {
|
4044 |
-
$this->log .= ' watermark source image is PNG<br />';
|
4045 |
-
$watermark_checked = true;
|
4046 |
-
}
|
4047 |
-
}
|
4048 |
-
} else if ($watermark_type == IMAGETYPE_BMP) {
|
4049 |
-
if (!method_exists($this, 'imagecreatefrombmp')) {
|
4050 |
-
$this->error = $this->translate('watermark_no_create_support', array('BMP'));
|
4051 |
-
} else {
|
4052 |
-
$filter = @$this->imagecreatefrombmp($this->image_watermark);
|
4053 |
-
if (!$filter) {
|
4054 |
-
$this->error = $this->translate('watermark_create_error', array('BMP'));
|
4055 |
-
} else {
|
4056 |
-
$this->log .= ' watermark source image is BMP<br />';
|
4057 |
-
$watermark_checked = true;
|
4058 |
-
}
|
4059 |
-
}
|
4060 |
-
} else {
|
4061 |
-
$this->error = $this->translate('watermark_invalid');
|
4062 |
-
}
|
4063 |
-
if ($watermark_checked) {
|
4064 |
-
$watermark_width = imagesx($filter);
|
4065 |
-
$watermark_height = imagesy($filter);
|
4066 |
-
$watermark_x = 0;
|
4067 |
-
$watermark_y = 0;
|
4068 |
-
if (is_numeric($this->image_watermark_x)) {
|
4069 |
-
if ($this->image_watermark_x < 0) {
|
4070 |
-
$watermark_x = $this->image_dst_x - $watermark_width + $this->image_watermark_x;
|
4071 |
-
} else {
|
4072 |
-
$watermark_x = $this->image_watermark_x;
|
4073 |
-
}
|
4074 |
-
} else {
|
4075 |
-
if (strpos($this->image_watermark_position, 'r') !== false) {
|
4076 |
-
$watermark_x = $this->image_dst_x - $watermark_width;
|
4077 |
-
} else if (strpos($this->image_watermark_position, 'l') !== false) {
|
4078 |
-
$watermark_x = 0;
|
4079 |
-
} else {
|
4080 |
-
$watermark_x = ($this->image_dst_x - $watermark_width) / 2;
|
4081 |
-
}
|
4082 |
-
}
|
4083 |
-
if (is_numeric($this->image_watermark_y)) {
|
4084 |
-
if ($this->image_watermark_y < 0) {
|
4085 |
-
$watermark_y = $this->image_dst_y - $watermark_height + $this->image_watermark_y;
|
4086 |
-
} else {
|
4087 |
-
$watermark_y = $this->image_watermark_y;
|
4088 |
-
}
|
4089 |
-
} else {
|
4090 |
-
if (strpos($this->image_watermark_position, 'b') !== false) {
|
4091 |
-
$watermark_y = $this->image_dst_y - $watermark_height;
|
4092 |
-
} else if (strpos($this->image_watermark_position, 't') !== false) {
|
4093 |
-
$watermark_y = 0;
|
4094 |
-
} else {
|
4095 |
-
$watermark_y = ($this->image_dst_y - $watermark_height) / 2;
|
4096 |
-
}
|
4097 |
-
}
|
4098 |
-
imagecopyresampled ($image_dst, $filter, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height);
|
4099 |
-
} else {
|
4100 |
-
$this->error = $this->translate('watermark_invalid');
|
4101 |
-
}
|
4102 |
-
}
|
4103 |
-
|
4104 |
-
// add text
|
4105 |
-
if (!empty($this->image_text)) {
|
4106 |
-
$this->log .= '- add text<br />';
|
4107 |
-
|
4108 |
-
// calculate sizes in human readable format
|
4109 |
-
$src_size = $this->file_src_size / 1024;
|
4110 |
-
$src_size_mb = number_format($src_size / 1024, 1, ".", " ");
|
4111 |
-
$src_size_kb = number_format($src_size, 1, ".", " ");
|
4112 |
-
$src_size_human = ($src_size > 1024 ? $src_size_mb . " MB" : $src_size_kb . " kb");
|
4113 |
-
|
4114 |
-
$this->image_text = str_replace(
|
4115 |
-
array('[src_name]',
|
4116 |
-
'[src_name_body]',
|
4117 |
-
'[src_name_ext]',
|
4118 |
-
'[src_pathname]',
|
4119 |
-
'[src_mime]',
|
4120 |
-
'[src_size]',
|
4121 |
-
'[src_size_kb]',
|
4122 |
-
'[src_size_mb]',
|
4123 |
-
'[src_size_human]',
|
4124 |
-
'[src_x]',
|
4125 |
-
'[src_y]',
|
4126 |
-
'[src_pixels]',
|
4127 |
-
'[src_type]',
|
4128 |
-
'[src_bits]',
|
4129 |
-
'[dst_path]',
|
4130 |
-
'[dst_name_body]',
|
4131 |
-
'[dst_name_ext]',
|
4132 |
-
'[dst_name]',
|
4133 |
-
'[dst_pathname]',
|
4134 |
-
'[dst_x]',
|
4135 |
-
'[dst_y]',
|
4136 |
-
'[date]',
|
4137 |
-
'[time]',
|
4138 |
-
'[host]',
|
4139 |
-
'[server]',
|
4140 |
-
'[ip]',
|
4141 |
-
'[gd_version]'),
|
4142 |
-
array($this->file_src_name,
|
4143 |
-
$this->file_src_name_body,
|
4144 |
-
$this->file_src_name_ext,
|
4145 |
-
$this->file_src_pathname,
|
4146 |
-
$this->file_src_mime,
|
4147 |
-
$this->file_src_size,
|
4148 |
-
$src_size_kb,
|
4149 |
-
$src_size_mb,
|
4150 |
-
$src_size_human,
|
4151 |
-
$this->image_src_x,
|
4152 |
-
$this->image_src_y,
|
4153 |
-
$this->image_src_pixels,
|
4154 |
-
$this->image_src_type,
|
4155 |
-
$this->image_src_bits,
|
4156 |
-
$this->file_dst_path,
|
4157 |
-
$this->file_dst_name_body,
|
4158 |
-
$this->file_dst_name_ext,
|
4159 |
-
$this->file_dst_name,
|
4160 |
-
$this->file_dst_pathname,
|
4161 |
-
$this->image_dst_x,
|
4162 |
-
$this->image_dst_y,
|
4163 |
-
date('Y-m-d'),
|
4164 |
-
date('H:i:s'),
|
4165 |
-
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'n/a'),
|
4166 |
-
(isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'n/a'),
|
4167 |
-
(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'n/a'),
|
4168 |
-
$this->gdversion(true)),
|
4169 |
-
$this->image_text);
|
4170 |
-
|
4171 |
-
if (!is_numeric($this->image_text_padding)) $this->image_text_padding = 0;
|
4172 |
-
if (!is_numeric($this->image_text_line_spacing)) $this->image_text_line_spacing = 0;
|
4173 |
-
if (!is_numeric($this->image_text_padding_x)) $this->image_text_padding_x = $this->image_text_padding;
|
4174 |
-
if (!is_numeric($this->image_text_padding_y)) $this->image_text_padding_y = $this->image_text_padding;
|
4175 |
-
$this->image_text_position = strtolower($this->image_text_position);
|
4176 |
-
$this->image_text_direction = strtolower($this->image_text_direction);
|
4177 |
-
$this->image_text_alignment = strtolower($this->image_text_alignment);
|
4178 |
-
|
4179 |
-
// if the font is a string, we assume that we might want to load a font
|
4180 |
-
if (!is_numeric($this->image_text_font) && strlen($this->image_text_font) > 4 && substr(strtolower($this->image_text_font), -4) == '.gdf') {
|
4181 |
-
$this->log .= ' try to load font ' . $this->image_text_font . '... ';
|
4182 |
-
if ($this->image_text_font = @imageloadfont($this->image_text_font)) {
|
4183 |
-
$this->log .= 'success<br />';
|
4184 |
-
} else {
|
4185 |
-
$this->log .= 'error<br />';
|
4186 |
-
$this->image_text_font = 5;
|
4187 |
-
}
|
4188 |
-
}
|
4189 |
-
|
4190 |
-
$text = explode("\n", $this->image_text);
|
4191 |
-
$char_width = imagefontwidth($this->image_text_font);
|
4192 |
-
$char_height = imagefontheight($this->image_text_font);
|
4193 |
-
$text_height = 0;
|
4194 |
-
$text_width = 0;
|
4195 |
-
$line_height = 0;
|
4196 |
-
$line_width = 0;
|
4197 |
-
|
4198 |
-
foreach ($text as $k => $v) {
|
4199 |
-
if ($this->image_text_direction == 'v') {
|
4200 |
-
$h = ($char_width * strlen($v));
|
4201 |
-
if ($h > $text_height) $text_height = $h;
|
4202 |
-
$line_width = $char_height;
|
4203 |
-
$text_width += $line_width + ($k < (sizeof($text)-1) ? $this->image_text_line_spacing : 0);
|
4204 |
-
} else {
|
4205 |
-
$w = ($char_width * strlen($v));
|
4206 |
-
if ($w > $text_width) $text_width = $w;
|
4207 |
-
$line_height = $char_height;
|
4208 |
-
$text_height += $line_height + ($k < (sizeof($text)-1) ? $this->image_text_line_spacing : 0);
|
4209 |
-
}
|
4210 |
-
}
|
4211 |
-
$text_width += (2 * $this->image_text_padding_x);
|
4212 |
-
$text_height += (2 * $this->image_text_padding_y);
|
4213 |
-
$text_x = 0;
|
4214 |
-
$text_y = 0;
|
4215 |
-
if (is_numeric($this->image_text_x)) {
|
4216 |
-
if ($this->image_text_x < 0) {
|
4217 |
-
$text_x = $this->image_dst_x - $text_width + $this->image_text_x;
|
4218 |
-
} else {
|
4219 |
-
$text_x = $this->image_text_x;
|
4220 |
-
}
|
4221 |
-
} else {
|
4222 |
-
if (strpos($this->image_text_position, 'r') !== false) {
|
4223 |
-
$text_x = $this->image_dst_x - $text_width;
|
4224 |
-
} else if (strpos($this->image_text_position, 'l') !== false) {
|
4225 |
-
$text_x = 0;
|
4226 |
-
} else {
|
4227 |
-
$text_x = ($this->image_dst_x - $text_width) / 2;
|
4228 |
-
}
|
4229 |
-
}
|
4230 |
-
if (is_numeric($this->image_text_y)) {
|
4231 |
-
if ($this->image_text_y < 0) {
|
4232 |
-
$text_y = $this->image_dst_y - $text_height + $this->image_text_y;
|
4233 |
-
} else {
|
4234 |
-
$text_y = $this->image_text_y;
|
4235 |
-
}
|
4236 |
-
} else {
|
4237 |
-
if (strpos($this->image_text_position, 'b') !== false) {
|
4238 |
-
$text_y = $this->image_dst_y - $text_height;
|
4239 |
-
} else if (strpos($this->image_text_position, 't') !== false) {
|
4240 |
-
$text_y = 0;
|
4241 |
-
} else {
|
4242 |
-
$text_y = ($this->image_dst_y - $text_height) / 2;
|
4243 |
-
}
|
4244 |
-
}
|
4245 |
-
|
4246 |
-
// add a background, maybe transparent
|
4247 |
-
if (!empty($this->image_text_background)) {
|
4248 |
-
list($red, $green, $blue) = $this->getcolors($this->image_text_background);
|
4249 |
-
if ($gd_version >= 2 && (is_numeric($this->image_text_background_percent)) && $this->image_text_background_percent >= 0 && $this->image_text_background_percent <= 100) {
|
4250 |
-
$filter = imagecreatetruecolor($text_width, $text_height);
|
4251 |
-
$background_color = imagecolorallocate($filter, $red, $green, $blue);
|
4252 |
-
imagefilledrectangle($filter, 0, 0, $text_width, $text_height, $background_color);
|
4253 |
-
$this->imagecopymergealpha($image_dst, $filter, $text_x, $text_y, 0, 0, $text_width, $text_height, $this->image_text_background_percent);
|
4254 |
-
imagedestroy($filter);
|
4255 |
-
} else {
|
4256 |
-
$background_color = imagecolorallocate($image_dst ,$red, $green, $blue);
|
4257 |
-
imagefilledrectangle($image_dst, $text_x, $text_y, $text_x + $text_width, $text_y + $text_height, $background_color);
|
4258 |
-
}
|
4259 |
-
}
|
4260 |
-
|
4261 |
-
$text_x += $this->image_text_padding_x;
|
4262 |
-
$text_y += $this->image_text_padding_y;
|
4263 |
-
$t_width = $text_width - (2 * $this->image_text_padding_x);
|
4264 |
-
$t_height = $text_height - (2 * $this->image_text_padding_y);
|
4265 |
-
list($red, $green, $blue) = $this->getcolors($this->image_text_color);
|
4266 |
-
|
4267 |
-
// add the text, maybe transparent
|
4268 |
-
if ($gd_version >= 2 && (is_numeric($this->image_text_percent)) && $this->image_text_percent >= 0 && $this->image_text_percent <= 100) {
|
4269 |
-
if ($t_width < 0) $t_width = 0;
|
4270 |
-
if ($t_height < 0) $t_height = 0;
|
4271 |
-
$filter = $this->imagecreatenew($t_width, $t_height, false, true);
|
4272 |
-
$text_color = imagecolorallocate($filter ,$red, $green, $blue);
|
4273 |
-
|
4274 |
-
foreach ($text as $k => $v) {
|
4275 |
-
if ($this->image_text_direction == 'v') {
|
4276 |
-
imagestringup($filter,
|
4277 |
-
$this->image_text_font,
|
4278 |
-
$k * ($line_width + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)),
|
4279 |
-
$text_height - (2 * $this->image_text_padding_y) - ($this->image_text_alignment == 'l' ? 0 : (($t_height - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))) ,
|
4280 |
-
$v,
|
4281 |
-
$text_color);
|
4282 |
-
} else {
|
4283 |
-
imagestring($filter,
|
4284 |
-
$this->image_text_font,
|
4285 |
-
($this->image_text_alignment == 'l' ? 0 : (($t_width - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))),
|
4286 |
-
$k * ($line_height + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)),
|
4287 |
-
$v,
|
4288 |
-
$text_color);
|
4289 |
-
}
|
4290 |
-
}
|
4291 |
-
$this->imagecopymergealpha($image_dst, $filter, $text_x, $text_y, 0, 0, $t_width, $t_height, $this->image_text_percent);
|
4292 |
-
imagedestroy($filter);
|
4293 |
-
|
4294 |
-
} else {
|
4295 |
-
$text_color = imageColorAllocate($image_dst ,$red, $green, $blue);
|
4296 |
-
foreach ($text as $k => $v) {
|
4297 |
-
if ($this->image_text_direction == 'v') {
|
4298 |
-
imagestringup($image_dst,
|
4299 |
-
$this->image_text_font,
|
4300 |
-
$text_x + $k * ($line_width + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)),
|
4301 |
-
$text_y + $text_height - (2 * $this->image_text_padding_y) - ($this->image_text_alignment == 'l' ? 0 : (($t_height - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))),
|
4302 |
-
$v,
|
4303 |
-
$text_color);
|
4304 |
-
} else {
|
4305 |
-
imagestring($image_dst,
|
4306 |
-
$this->image_text_font,
|
4307 |
-
$text_x + ($this->image_text_alignment == 'l' ? 0 : (($t_width - strlen($v) * $char_width) / ($this->image_text_alignment == 'r' ? 1 : 2))),
|
4308 |
-
$text_y + $k * ($line_height + ($k > 0 && $k < (sizeof($text)) ? $this->image_text_line_spacing : 0)),
|
4309 |
-
$v,
|
4310 |
-
$text_color);
|
4311 |
-
}
|
4312 |
-
}
|
4313 |
-
}
|
4314 |
-
}
|
4315 |
-
|
4316 |
-
// add a reflection
|
4317 |
-
if ($this->image_reflection_height) {
|
4318 |
-
$this->log .= '- add reflection : ' . $this->image_reflection_height . '<br />';
|
4319 |
-
// we decode image_reflection_height, which can be a integer, a string in pixels or percentage
|
4320 |
-
$image_reflection_height = $this->image_reflection_height;
|
4321 |
-
if (strpos($image_reflection_height, '%')>0) $image_reflection_height = $this->image_dst_y * (str_replace('%','',$image_reflection_height / 100));
|
4322 |
-
if (strpos($image_reflection_height, 'px')>0) $image_reflection_height = str_replace('px','',$image_reflection_height);
|
4323 |
-
$image_reflection_height = (int) $image_reflection_height;
|
4324 |
-
if ($image_reflection_height > $this->image_dst_y) $image_reflection_height = $this->image_dst_y;
|
4325 |
-
if (empty($this->image_reflection_opacity)) $this->image_reflection_opacity = 60;
|
4326 |
-
// create the new destination image
|
4327 |
-
$tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y + $image_reflection_height + $this->image_reflection_space, true);
|
4328 |
-
$transparency = $this->image_reflection_opacity;
|
4329 |
-
|
4330 |
-
// copy the original image
|
4331 |
-
imagecopy($tmp, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y + ($this->image_reflection_space < 0 ? $this->image_reflection_space : 0));
|
4332 |
-
|
4333 |
-
// we have to make sure the extra bit is the right color, or transparent
|
4334 |
-
if ($image_reflection_height + $this->image_reflection_space > 0) {
|
4335 |
-
// use the background color if present
|
4336 |
-
if (!empty($this->image_background_color)) {
|
4337 |
-
list($red, $green, $blue) = $this->getcolors($this->image_background_color);
|
4338 |
-
$fill = imagecolorallocate($tmp, $red, $green, $blue);
|
4339 |
-
} else {
|
4340 |
-
$fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127);
|
4341 |
-
}
|
4342 |
-
// fill in from the edge of the extra bit
|
4343 |
-
imagefill($tmp, round($this->image_dst_x / 2), $this->image_dst_y + $image_reflection_height + $this->image_reflection_space - 1, $fill);
|
4344 |
-
}
|
4345 |
-
|
4346 |
-
// copy the reflection
|
4347 |
-
for ($y = 0; $y < $image_reflection_height; $y++) {
|
4348 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
4349 |
-
$pixel_b = imagecolorsforindex($tmp, imagecolorat($tmp, $x, $y + $this->image_dst_y + $this->image_reflection_space));
|
4350 |
-
$pixel_o = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $this->image_dst_y - $y - 1 + ($this->image_reflection_space < 0 ? $this->image_reflection_space : 0)));
|
4351 |
-
$alpha_o = 1 - ($pixel_o['alpha'] / 127);
|
4352 |
-
$alpha_b = 1 - ($pixel_b['alpha'] / 127);
|
4353 |
-
$opacity = $alpha_o * $transparency / 100;
|
4354 |
-
if ($opacity > 0) {
|
4355 |
-
$red = round((($pixel_o['red'] * $opacity) + ($pixel_b['red'] ) * $alpha_b) / ($alpha_b + $opacity));
|
4356 |
-
$green = round((($pixel_o['green'] * $opacity) + ($pixel_b['green']) * $alpha_b) / ($alpha_b + $opacity));
|
4357 |
-
$blue = round((($pixel_o['blue'] * $opacity) + ($pixel_b['blue'] ) * $alpha_b) / ($alpha_b + $opacity));
|
4358 |
-
$alpha = ($opacity + $alpha_b);
|
4359 |
-
if ($alpha > 1) $alpha = 1;
|
4360 |
-
$alpha = round((1 - $alpha) * 127);
|
4361 |
-
$color = imagecolorallocatealpha($tmp, $red, $green, $blue, $alpha);
|
4362 |
-
imagesetpixel($tmp, $x, $y + $this->image_dst_y + $this->image_reflection_space, $color);
|
4363 |
-
}
|
4364 |
-
}
|
4365 |
-
if ($transparency > 0) $transparency = $transparency - ($this->image_reflection_opacity / $image_reflection_height);
|
4366 |
-
}
|
4367 |
-
|
4368 |
-
// copy the resulting image into the destination image
|
4369 |
-
$this->image_dst_y = $this->image_dst_y + $image_reflection_height + $this->image_reflection_space;
|
4370 |
-
$image_dst = $this->imagetransfer($tmp, $image_dst);
|
4371 |
-
}
|
4372 |
-
|
4373 |
-
// reduce the JPEG image to a set desired size
|
4374 |
-
if (is_numeric($this->jpeg_size) && $this->jpeg_size > 0 && ($this->image_convert == 'jpeg' || $this->image_convert == 'jpg')) {
|
4375 |
-
// inspired by: JPEGReducer class version 1, 25 November 2004, Author: Huda M ElMatsani, justhuda at netscape dot net
|
4376 |
-
$this->log .= '- JPEG desired file size : ' . $this->jpeg_size . '<br />';
|
4377 |
-
// calculate size of each image. 75%, 50%, and 25% quality
|
4378 |
-
ob_start(); imagejpeg($image_dst,'',75); $buffer = ob_get_contents(); ob_end_clean();
|
4379 |
-
$size75 = strlen($buffer);
|
4380 |
-
ob_start(); imagejpeg($image_dst,'',50); $buffer = ob_get_contents(); ob_end_clean();
|
4381 |
-
$size50 = strlen($buffer);
|
4382 |
-
ob_start(); imagejpeg($image_dst,'',25); $buffer = ob_get_contents(); ob_end_clean();
|
4383 |
-
$size25 = strlen($buffer);
|
4384 |
-
|
4385 |
-
// calculate gradient of size reduction by quality
|
4386 |
-
$mgrad1 = 25 / ($size50-$size25);
|
4387 |
-
$mgrad2 = 25 / ($size75-$size50);
|
4388 |
-
$mgrad3 = 50 / ($size75-$size25);
|
4389 |
-
$mgrad = ($mgrad1 + $mgrad2 + $mgrad3) / 3;
|
4390 |
-
// result of approx. quality factor for expected size
|
4391 |
-
$q_factor = round($mgrad * ($this->jpeg_size - $size50) + 50);
|
4392 |
-
|
4393 |
-
if ($q_factor<1) {
|
4394 |
-
$this->jpeg_quality=1;
|
4395 |
-
} elseif ($q_factor>100) {
|
4396 |
-
$this->jpeg_quality=100;
|
4397 |
-
} else {
|
4398 |
-
$this->jpeg_quality=$q_factor;
|
4399 |
-
}
|
4400 |
-
$this->log .= ' JPEG quality factor set to ' . $this->jpeg_quality . '<br />';
|
4401 |
-
}
|
4402 |
-
|
4403 |
-
// converts image from true color, and fix transparency if needed
|
4404 |
-
$this->log .= '- converting...<br />';
|
4405 |
-
switch($this->image_convert) {
|
4406 |
-
case 'gif':
|
4407 |
-
// if the image is true color, we convert it to a palette
|
4408 |
-
if (imageistruecolor($image_dst)) {
|
4409 |
-
$this->log .= ' true color to palette<br />';
|
4410 |
-
// creates a black and white mask
|
4411 |
-
$mask = array(array());
|
4412 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
4413 |
-
for ($y = 0; $y < $this->image_dst_y; $y++) {
|
4414 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
4415 |
-
$mask[$x][$y] = $pixel['alpha'];
|
4416 |
-
}
|
4417 |
-
}
|
4418 |
-
list($red, $green, $blue) = $this->getcolors($this->image_default_color);
|
4419 |
-
// first, we merge the image with the background color, so we know which colors we will have
|
4420 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
4421 |
-
for ($y = 0; $y < $this->image_dst_y; $y++) {
|
4422 |
-
if ($mask[$x][$y] > 0){
|
4423 |
-
// we have some transparency. we combine the color with the default color
|
4424 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
4425 |
-
$alpha = ($mask[$x][$y] / 127);
|
4426 |
-
$pixel['red'] = round(($pixel['red'] * (1 -$alpha) + $red * ($alpha)));
|
4427 |
-
$pixel['green'] = round(($pixel['green'] * (1 -$alpha) + $green * ($alpha)));
|
4428 |
-
$pixel['blue'] = round(($pixel['blue'] * (1 -$alpha) + $blue * ($alpha)));
|
4429 |
-
$color = imagecolorallocate($image_dst, $pixel['red'], $pixel['green'], $pixel['blue']);
|
4430 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
4431 |
-
}
|
4432 |
-
}
|
4433 |
-
}
|
4434 |
-
// transfrom the true color image into palette, with it merged default color in
|
4435 |
-
// we will have the best color possible, including the background
|
4436 |
-
if (empty($this->image_background_color)) {
|
4437 |
-
imagetruecolortopalette($image_dst, true, 255);
|
4438 |
-
$transparency = imagecolorallocate($image_dst, 254, 1, 253);
|
4439 |
-
imagecolortransparent($image_dst, $transparency);
|
4440 |
-
// make the transparent areas transparent
|
4441 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
4442 |
-
for ($y = 0; $y < $this->image_dst_y; $y++) {
|
4443 |
-
// we test wether we have enough opacity to justify keeping the color
|
4444 |
-
if ($mask[$x][$y] > 120) imagesetpixel($image_dst, $x, $y, $transparency);
|
4445 |
-
}
|
4446 |
-
}
|
4447 |
-
}
|
4448 |
-
unset($mask);
|
4449 |
-
}
|
4450 |
-
break;
|
4451 |
-
case 'jpg':
|
4452 |
-
case 'bmp':
|
4453 |
-
// if the image doesn't support any transparency, then we merge it with the default color
|
4454 |
-
$this->log .= ' fills in transparency with default color<br />';
|
4455 |
-
list($red, $green, $blue) = $this->getcolors($this->image_default_color);
|
4456 |
-
$transparency = imagecolorallocate($image_dst, $red, $green, $blue);
|
4457 |
-
// make the transaparent areas transparent
|
4458 |
-
for ($x = 0; $x < $this->image_dst_x; $x++) {
|
4459 |
-
for ($y = 0; $y < $this->image_dst_y; $y++) {
|
4460 |
-
// we test wether we have some transparency, in which case we will merge the colors
|
4461 |
-
if (imageistruecolor($image_dst)) {
|
4462 |
-
$rgba = imagecolorat($image_dst, $x, $y);
|
4463 |
-
$pixel = array('red' => ($rgba >> 16) & 0xFF,
|
4464 |
-
'green' => ($rgba >> 8) & 0xFF,
|
4465 |
-
'blue' => $rgba & 0xFF,
|
4466 |
-
'alpha' => ($rgba & 0x7F000000) >> 24);
|
4467 |
-
} else {
|
4468 |
-
$pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y));
|
4469 |
-
}
|
4470 |
-
if ($pixel['alpha'] == 127) {
|
4471 |
-
// we have full transparency. we make the pixel transparent
|
4472 |
-
imagesetpixel($image_dst, $x, $y, $transparency);
|
4473 |
-
} else if ($pixel['alpha'] > 0) {
|
4474 |
-
// we have some transparency. we combine the color with the default color
|
4475 |
-
$alpha = ($pixel['alpha'] / 127);
|
4476 |
-
$pixel['red'] = round(($pixel['red'] * (1 -$alpha) + $red * ($alpha)));
|
4477 |
-
$pixel['green'] = round(($pixel['green'] * (1 -$alpha) + $green * ($alpha)));
|
4478 |
-
$pixel['blue'] = round(($pixel['blue'] * (1 -$alpha) + $blue * ($alpha)));
|
4479 |
-
$color = imagecolorclosest($image_dst, $pixel['red'], $pixel['green'], $pixel['blue']);
|
4480 |
-
imagesetpixel($image_dst, $x, $y, $color);
|
4481 |
-
}
|
4482 |
-
}
|
4483 |
-
}
|
4484 |
-
|
4485 |
-
break;
|
4486 |
-
default:
|
4487 |
-
break;
|
4488 |
-
}
|
4489 |
-
|
4490 |
-
// outputs image
|
4491 |
-
$this->log .= '- saving image...<br />';
|
4492 |
-
switch($this->image_convert) {
|
4493 |
-
case 'jpeg':
|
4494 |
-
case 'jpg':
|
4495 |
-
if (!$return_mode) {
|
4496 |
-
$result = @imagejpeg($image_dst, $this->file_dst_pathname, $this->jpeg_quality);
|
4497 |
-
} else {
|
4498 |
-
ob_start();
|
4499 |
-
$result = @imagejpeg($image_dst, '', $this->jpeg_quality);
|
4500 |
-
$return_content = ob_get_contents();
|
4501 |
-
ob_end_clean();
|
4502 |
-
}
|
4503 |
-
if (!$result) {
|
4504 |
-
$this->processed = false;
|
4505 |
-
$this->error = $this->translate('file_create', array('JPEG'));
|
4506 |
-
} else {
|
4507 |
-
$this->log .= ' JPEG image created<br />';
|
4508 |
-
}
|
4509 |
-
break;
|
4510 |
-
case 'png':
|
4511 |
-
imagealphablending( $image_dst, false );
|
4512 |
-
imagesavealpha( $image_dst, true );
|
4513 |
-
if (!$return_mode) {
|
4514 |
-
$result = @imagepng($image_dst, $this->file_dst_pathname);
|
4515 |
-
} else {
|
4516 |
-
ob_start();
|
4517 |
-
$result = @imagepng($image_dst);
|
4518 |
-
$return_content = ob_get_contents();
|
4519 |
-
ob_end_clean();
|
4520 |
-
}
|
4521 |
-
if (!$result) {
|
4522 |
-
$this->processed = false;
|
4523 |
-
$this->error = $this->translate('file_create', array('PNG'));
|
4524 |
-
} else {
|
4525 |
-
$this->log .= ' PNG image created<br />';
|
4526 |
-
}
|
4527 |
-
break;
|
4528 |
-
case 'gif':
|
4529 |
-
if (!$return_mode) {
|
4530 |
-
$result = @imagegif($image_dst, $this->file_dst_pathname);
|
4531 |
-
} else {
|
4532 |
-
ob_start();
|
4533 |
-
$result = @imagegif($image_dst);
|
4534 |
-
$return_content = ob_get_contents();
|
4535 |
-
ob_end_clean();
|
4536 |
-
}
|
4537 |
-
if (!$result) {
|
4538 |
-
$this->processed = false;
|
4539 |
-
$this->error = $this->translate('file_create', array('GIF'));
|
4540 |
-
} else {
|
4541 |
-
$this->log .= ' GIF image created<br />';
|
4542 |
-
}
|
4543 |
-
break;
|
4544 |
-
case 'bmp':
|
4545 |
-
if (!$return_mode) {
|
4546 |
-
$result = $this->imagebmp($image_dst, $this->file_dst_pathname);
|
4547 |
-
} else {
|
4548 |
-
ob_start();
|
4549 |
-
$result = $this->imagebmp($image_dst);
|
4550 |
-
$return_content = ob_get_contents();
|
4551 |
-
ob_end_clean();
|
4552 |
-
}
|
4553 |
-
if (!$result) {
|
4554 |
-
$this->processed = false;
|
4555 |
-
$this->error = $this->translate('file_create', array('BMP'));
|
4556 |
-
} else {
|
4557 |
-
$this->log .= ' BMP image created<br />';
|
4558 |
-
}
|
4559 |
-
break;
|
4560 |
-
|
4561 |
-
default:
|
4562 |
-
$this->processed = false;
|
4563 |
-
$this->error = $this->translate('no_conversion_type');
|
4564 |
-
}
|
4565 |
-
if ($this->processed) {
|
4566 |
-
if (is_resource($image_src)) imagedestroy($image_src);
|
4567 |
-
if (is_resource($image_dst)) imagedestroy($image_dst);
|
4568 |
-
$this->log .= ' image objects destroyed<br />';
|
4569 |
-
}
|
4570 |
-
}
|
4571 |
-
|
4572 |
-
} else {
|
4573 |
-
$this->log .= '- no image processing wanted<br />';
|
4574 |
-
|
4575 |
-
if (!$return_mode) {
|
4576 |
-
// copy the file to its final destination. we don't use move_uploaded_file here
|
4577 |
-
// if we happen to have open_basedir restrictions, it is a temp file that we copy, not the original uploaded file
|
4578 |
-
if (!copy($this->file_src_pathname, $this->file_dst_pathname)) {
|
4579 |
-
$this->processed = false;
|
4580 |
-
$this->error = $this->translate('copy_failed');
|
4581 |
-
}
|
4582 |
-
} else {
|
4583 |
-
// returns the file, so that its content can be received by the caller
|
4584 |
-
$return_content = @file_get_contents($this->file_src_pathname);
|
4585 |
-
if ($return_content === FALSE) {
|
4586 |
-
$this->processed = false;
|
4587 |
-
$this->error = $this->translate('reading_failed');
|
4588 |
-
}
|
4589 |
-
}
|
4590 |
-
}
|
4591 |
-
}
|
4592 |
-
|
4593 |
-
if ($this->processed) {
|
4594 |
-
$this->log .= '- <b>process OK</b><br />';
|
4595 |
-
} else {
|
4596 |
-
$this->log .= '- <b>error</b>: ' . $this->error . '<br />';
|
4597 |
-
}
|
4598 |
-
|
4599 |
-
// we reinit all the vars
|
4600 |
-
$this->init();
|
4601 |
-
|
4602 |
-
// we may return the image content
|
4603 |
-
if ($return_mode) return $return_content;
|
4604 |
-
|
4605 |
-
}
|
4606 |
-
|
4607 |
-
/**
|
4608 |
-
* Deletes the uploaded file from its temporary location
|
4609 |
-
*
|
4610 |
-
* When PHP uploads a file, it stores it in a temporary location.
|
4611 |
-
* When you {@link process} the file, you actually copy the resulting file to the given location, it doesn't alter the original file.
|
4612 |
-
* Once you have processed the file as many times as you wanted, you can delete the uploaded file.
|
4613 |
-
* If there is open_basedir restrictions, the uploaded file is in fact a temporary file
|
4614 |
-
*
|
4615 |
-
* You might want not to use this function if you work on local files, as it will delete the source file
|
4616 |
-
*
|
4617 |
-
* @access public
|
4618 |
-
*/
|
4619 |
-
function clean() {
|
4620 |
-
$this->log .= '<b>cleanup</b><br />';
|
4621 |
-
$this->log .= '- delete temp file ' . $this->file_src_pathname . '<br />';
|
4622 |
-
@unlink($this->file_src_pathname);
|
4623 |
-
}
|
4624 |
-
|
4625 |
-
|
4626 |
-
/**
|
4627 |
-
* Opens a BMP image
|
4628 |
-
*
|
4629 |
-
* This function has been written by DHKold, and is used with permission of the author
|
4630 |
-
*
|
4631 |
-
* @access public
|
4632 |
-
*/
|
4633 |
-
function imagecreatefrombmp($filename) {
|
4634 |
-
if (! $f1 = fopen($filename,"rb")) return false;
|
4635 |
-
|
4636 |
-
$file = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14));
|
4637 |
-
if ($file['file_type'] != 19778) return false;
|
4638 |
-
|
4639 |
-
$bmp = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'.
|
4640 |
-
'/Vcompression/Vsize_bitmap/Vhoriz_resolution'.
|
4641 |
-
'/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40));
|
4642 |
-
$bmp['colors'] = pow(2,$bmp['bits_per_pixel']);
|
4643 |
-
if ($bmp['size_bitmap'] == 0) $bmp['size_bitmap'] = $file['file_size'] - $file['bitmap_offset'];
|
4644 |
-
$bmp['bytes_per_pixel'] = $bmp['bits_per_pixel']/8;
|
4645 |
-
$bmp['bytes_per_pixel2'] = ceil($bmp['bytes_per_pixel']);
|
4646 |
-
$bmp['decal'] = ($bmp['width']*$bmp['bytes_per_pixel']/4);
|
4647 |
-
$bmp['decal'] -= floor($bmp['width']*$bmp['bytes_per_pixel']/4);
|
4648 |
-
$bmp['decal'] = 4-(4*$bmp['decal']);
|
4649 |
-
if ($bmp['decal'] == 4) $bmp['decal'] = 0;
|
4650 |
-
|
4651 |
-
$palette = array();
|
4652 |
-
if ($bmp['colors'] < 16777216) {
|
4653 |
-
$palette = unpack('V'.$bmp['colors'], fread($f1,$bmp['colors']*4));
|
4654 |
-
}
|
4655 |
-
|
4656 |
-
$im = fread($f1,$bmp['size_bitmap']);
|
4657 |
-
$vide = chr(0);
|
4658 |
-
|
4659 |
-
$res = imagecreatetruecolor($bmp['width'],$bmp['height']);
|
4660 |
-
$P = 0;
|
4661 |
-
$Y = $bmp['height']-1;
|
4662 |
-
while ($Y >= 0) {
|
4663 |
-
$X=0;
|
4664 |
-
while ($X < $bmp['width']) {
|
4665 |
-
if ($bmp['bits_per_pixel'] == 24)
|
4666 |
-
$color = unpack("V",substr($im,$P,3).$vide);
|
4667 |
-
elseif ($bmp['bits_per_pixel'] == 16) {
|
4668 |
-
$color = unpack("n",substr($im,$P,2));
|
4669 |
-
$color[1] = $palette[$color[1]+1];
|
4670 |
-
} elseif ($bmp['bits_per_pixel'] == 8) {
|
4671 |
-
$color = unpack("n",$vide.substr($im,$P,1));
|
4672 |
-
$color[1] = $palette[$color[1]+1];
|
4673 |
-
} elseif ($bmp['bits_per_pixel'] == 4) {
|
4674 |
-
$color = unpack("n",$vide.substr($im,floor($P),1));
|
4675 |
-
if (($P*2)%2 == 0) $color[1] = ($color[1] >> 4) ; else $color[1] = ($color[1] & 0x0F);
|
4676 |
-
$color[1] = $palette[$color[1]+1];
|
4677 |
-
} elseif ($bmp['bits_per_pixel'] == 1) {
|
4678 |
-
$color = unpack("n",$vide.substr($im,floor($P),1));
|
4679 |
-
if (($P*8)%8 == 0) $color[1] = $color[1] >>7;
|
4680 |
-
elseif (($P*8)%8 == 1) $color[1] = ($color[1] & 0x40)>>6;
|
4681 |
-
elseif (($P*8)%8 == 2) $color[1] = ($color[1] & 0x20)>>5;
|
4682 |
-
elseif (($P*8)%8 == 3) $color[1] = ($color[1] & 0x10)>>4;
|
4683 |
-
elseif (($P*8)%8 == 4) $color[1] = ($color[1] & 0x8)>>3;
|
4684 |
-
elseif (($P*8)%8 == 5) $color[1] = ($color[1] & 0x4)>>2;
|
4685 |
-
elseif (($P*8)%8 == 6) $color[1] = ($color[1] & 0x2)>>1;
|
4686 |
-
elseif (($P*8)%8 == 7) $color[1] = ($color[1] & 0x1);
|
4687 |
-
$color[1] = $palette[$color[1]+1];
|
4688 |
-
} else
|
4689 |
-
return FALSE;
|
4690 |
-
imagesetpixel($res,$X,$Y,$color[1]);
|
4691 |
-
$X++;
|
4692 |
-
$P += $bmp['bytes_per_pixel'];
|
4693 |
-
}
|
4694 |
-
$Y--;
|
4695 |
-
$P+=$bmp['decal'];
|
4696 |
-
}
|
4697 |
-
fclose($f1);
|
4698 |
-
return $res;
|
4699 |
-
}
|
4700 |
-
|
4701 |
-
/**
|
4702 |
-
* Saves a BMP image
|
4703 |
-
*
|
4704 |
-
* This function has been published on the PHP website, and can be used freely
|
4705 |
-
*
|
4706 |
-
* @access public
|
4707 |
-
*/
|
4708 |
-
function imagebmp(&$im, $filename = "") {
|
4709 |
-
|
4710 |
-
if (!$im) return false;
|
4711 |
-
$w = imagesx($im);
|
4712 |
-
$h = imagesy($im);
|
4713 |
-
$result = '';
|
4714 |
-
|
4715 |
-
// if the image is not true color, we convert it first
|
4716 |
-
if (!imageistruecolor($im)) {
|
4717 |
-
$tmp = imagecreatetruecolor($w, $h);
|
4718 |
-
imagecopy($tmp, $im, 0, 0, 0, 0, $w, $h);
|
4719 |
-
imagedestroy($im);
|
4720 |
-
$im = & $tmp;
|
4721 |
-
}
|
4722 |
-
|
4723 |
-
$biBPLine = $w * 3;
|
4724 |
-
$biStride = ($biBPLine + 3) & ~3;
|
4725 |
-
$biSizeImage = $biStride * $h;
|
4726 |
-
$bfOffBits = 54;
|
4727 |
-
$bfSize = $bfOffBits + $biSizeImage;
|
4728 |
-
|
4729 |
-
$result .= substr('BM', 0, 2);
|
4730 |
-
$result .= pack ('VvvV', $bfSize, 0, 0, $bfOffBits);
|
4731 |
-
$result .= pack ('VVVvvVVVVVV', 40, $w, $h, 1, 24, 0, $biSizeImage, 0, 0, 0, 0);
|
4732 |
-
|
4733 |
-
$numpad = $biStride - $biBPLine;
|
4734 |
-
for ($y = $h - 1; $y >= 0; --$y) {
|
4735 |
-
for ($x = 0; $x < $w; ++$x) {
|
4736 |
-
$col = imagecolorat ($im, $x, $y);
|
4737 |
-
$result .= substr(pack ('V', $col), 0, 3);
|
4738 |
-
}
|
4739 |
-
for ($i = 0; $i < $numpad; ++$i)
|
4740 |
-
$result .= pack ('C', 0);
|
4741 |
-
}
|
4742 |
-
|
4743 |
-
if($filename==""){
|
4744 |
-
echo $result;
|
4745 |
-
} else {
|
4746 |
-
$file = fopen($filename, "wb");
|
4747 |
-
fwrite($file, $result);
|
4748 |
-
fclose($file);
|
4749 |
-
}
|
4750 |
-
return true;
|
4751 |
-
}
|
4752 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
images/play.png
ADDED
Binary file
|
images/pp-logo.png
ADDED
Binary file
|
includes/admin.php
CHANGED
@@ -30,30 +30,11 @@ $roles = $this->roles;
|
|
30 |
$default = $this->current;
|
31 |
|
32 |
if( defined('PP_ACTIVE') ) {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
else
|
38 |
-
$pp_supplemental_roles = $wpdb->get_col( "SELECT role_name FROM $wpdb->pp_roles AS r INNER JOIN $wpdb->pp_groups AS g ON g.ID = r.group_id AND r.group_type = 'pp_group' AND r.scope = 'site' WHERE g.metagroup_type = 'wp_role' AND g.metagroup_id = '$default'" );
|
39 |
-
|
40 |
-
$pp_filtered_types = pp_get_enabled_types('post');
|
41 |
-
$pp_metagroup_caps = array();
|
42 |
-
$pp_cap_caster = pp_init_cap_caster();
|
43 |
-
|
44 |
-
foreach( $pp_supplemental_roles as $_role_name ) {
|
45 |
-
$role_specs = explode( ':', $_role_name );
|
46 |
-
if ( empty($role_specs[2]) || ! in_array( $role_specs[2], $pp_filtered_types ) )
|
47 |
-
continue;
|
48 |
-
|
49 |
-
// add all type-specific caps whose base property cap is included in this pattern role
|
50 |
-
// i.e. If 'edit_posts' is in the pattern role, grant $type_obj->cap->edit_posts
|
51 |
-
$pp_metagroup_caps = array_merge( $pp_metagroup_caps, array_fill_keys( $pp_cap_caster->get_typecast_caps( $_role_name, 'site' ), true ) );
|
52 |
-
}
|
53 |
-
} else {
|
54 |
$pp_metagroup_caps = array();
|
55 |
-
}
|
56 |
-
|
57 |
?>
|
58 |
<div class="wrap">
|
59 |
<?php if( defined('PP_ACTIVE') ) :
|
@@ -77,27 +58,20 @@ if( defined('PP_ACTIVE') ) {
|
|
77 |
<dl>
|
78 |
<dt><?php printf(__('Capabilities for %s', $this->ID), $roles[$default]); ?></dt>
|
79 |
<dd>
|
|
|
|
|
|
|
|
|
80 |
<?php
|
81 |
if ( defined( 'PP_ACTIVE' ) ) {
|
82 |
-
|
83 |
-
echo '<div>';
|
84 |
-
_e( 'Use this form to view and modify the capabilities WordPress natively associates with each role. Note:', $this->ID );
|
85 |
-
echo '</div><br />';
|
86 |
-
echo '<ul class="ul-disc"><li>';
|
87 |
-
|
88 |
-
if ( pp_get_option( 'advanced_options' ) )
|
89 |
-
$parenthetical = sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'pp' ), "<a href='" . admin_url('admin.php?page=pp-role-usage') . "'>", '</a>' );
|
90 |
-
else
|
91 |
-
$parenthetical = sprintf( __( 'activate %1$sAdvanced settings%2$s, see Role Usage', 'pp' ), "<a href='" . admin_url('admin.php?page=pp-settings&pp_tab=advanced') . "'>", '</a>' );
|
92 |
-
|
93 |
-
printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permit Groups (%s).', $this->ID ), $parenthetical ) ;
|
94 |
-
echo '</li><li>';
|
95 |
-
printf( __( 'Capabilities for custom statuses can be manually added to a role here (see Conditions > Capability Mapping for applicable names). However, it is usually more convenient to use Permit Groups to assign a supplemental status-specific role.', $this->ID ), "<a href='" . admin_url('?page=pp-role-usage') . "'>", '</a>' ) ;
|
96 |
-
echo '</li></ul>';
|
97 |
-
}
|
98 |
} else {
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
101 |
echo '</div>';
|
102 |
?>
|
103 |
<script type="text/javascript">
|
@@ -114,50 +88,103 @@ if( defined('PP_ACTIVE') ) {
|
|
114 |
});
|
115 |
/* ]]> */
|
116 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<?php
|
118 |
-
echo '<
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
echo '
|
123 |
-
|
124 |
-
echo '</li>';
|
125 |
-
echo '<li>';
|
126 |
-
_e( "Custom Visibility statuses (require read_member_posts, read_premium_posts, etc.)", $this->ID );
|
127 |
-
echo '</li>';
|
128 |
-
echo '<li>';
|
129 |
-
_e( 'Custom Editability "statuses" - set alongside Visibility in Post and Category edit forms', $this->ID );
|
130 |
-
echo '</li>';
|
131 |
-
echo '<li>';
|
132 |
-
_e( "Custom Moderation statuses, enabling access-limited three tier moderation (Pending / Approved / Published)", $this->ID );
|
133 |
-
echo '</li>';
|
134 |
-
echo '<li>';
|
135 |
-
_e( "Grant Participant or Moderator access to specific bbPress forums or topics", $this->ID );
|
136 |
-
echo '</li>';
|
137 |
-
echo '<li>';
|
138 |
-
_e( "Grant supplemental page or category access to all members of a BuddyPress group", $this->ID );
|
139 |
-
echo '</li>';
|
140 |
-
echo '<li>';
|
141 |
-
_e( "WPML integration to mirror permissions to translations", $this->ID );
|
142 |
-
echo '</li>';
|
143 |
-
echo '<li>';
|
144 |
-
_e( "Professional support available", $this->ID );
|
145 |
-
echo '</li>';
|
146 |
-
echo '</ul><div>';
|
147 |
-
echo '<a href="http://presspermit.com">http://presspermit.com</a> • <a href="#pp-hide">hide</a>';
|
148 |
echo '</div></div>';
|
149 |
}
|
150 |
|
151 |
if ( MULTISITE ) {
|
152 |
global $wp_roles;
|
153 |
-
if ( method_exists( $wp_roles, 'reinit' ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
$wp_roles->reinit();
|
|
|
155 |
}
|
156 |
|
157 |
-
$capsman
|
158 |
$capsman->reinstate_db_roles();
|
159 |
|
160 |
$current = get_role($default);
|
|
|
|
|
|
|
161 |
$rcaps = $current->capabilities;
|
162 |
|
163 |
// ========= Begin Kevin B mod ===========
|
@@ -170,6 +197,8 @@ if( defined('PP_ACTIVE') ) {
|
|
170 |
$defined['type'] = get_post_types( array( 'public' => true ), 'object' );
|
171 |
$defined['taxonomy'] = get_taxonomies( array( 'public' => true ), 'object' );
|
172 |
|
|
|
|
|
173 |
/*
|
174 |
if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) {
|
175 |
$cap_properties[''] = array();
|
@@ -240,8 +269,8 @@ if( defined('PP_ACTIVE') ) {
|
|
240 |
);
|
241 |
$type_caps = array();
|
242 |
|
243 |
-
//
|
244 |
-
if ( defined( 'PP_ACTIVE' )
|
245 |
unset( $defined['type']['attachment'] );
|
246 |
|
247 |
echo '<ul class="cme-listhoriz">';
|
@@ -253,8 +282,21 @@ if( defined('PP_ACTIVE') ) {
|
|
253 |
echo '<table class="cme-typecaps">';
|
254 |
|
255 |
foreach( array_keys($defined) as $item_type ) {
|
256 |
-
if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) )
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
//if ( ! $cap_type ) {
|
260 |
|
@@ -271,37 +313,53 @@ if( defined('PP_ACTIVE') ) {
|
|
271 |
$prop = str_replace( '_terms', '', $prop );
|
272 |
$tip = ( isset( $cap_tips[$prop] ) ) ? "title='{$cap_tips[$prop]}'" : '';
|
273 |
$prop = str_replace( '_', '<br />', $prop );
|
274 |
-
|
|
|
275 |
echo ucwords($prop);
|
276 |
echo '</th>';
|
277 |
}
|
278 |
|
279 |
foreach( $defined[$item_type] as $key => $type_obj ) {
|
280 |
-
$
|
|
|
|
|
|
|
281 |
|
282 |
if ( $cap_type ) {
|
283 |
if ( empty($force_distinct_ui) && empty( $cap_properties[$cap_type][$item_type] ) )
|
284 |
continue;
|
285 |
|
286 |
-
$row .= "<td><a class='cap_type' href='#toggle_type_caps'>" . $type_obj->labels->name . '</a
|
|
|
|
|
287 |
|
288 |
$display_row = ! empty($force_distinct_ui);
|
289 |
-
|
290 |
foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
|
291 |
-
$
|
|
|
|
|
292 |
if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
|
293 |
|| ! in_array( $type_obj->cap->$prop, $default_caps )
|
294 |
|| ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
|
295 |
-
|
296 |
// if edit_published or edit_private cap is same as edit_posts cap, don't display a checkbox for it
|
297 |
if ( ( ! in_array( $prop, array( 'edit_published_posts', 'edit_private_posts', 'create_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->edit_posts ) )
|
298 |
&& ( ! in_array( $prop, array( 'delete_published_posts', 'delete_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->delete_posts ) )
|
299 |
) {
|
300 |
$cap_name = $type_obj->cap->$prop;
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
if ( $is_administrator || current_user_can($cap_name) ) {
|
303 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
304 |
-
$title_text = sprintf( __( '%s: assigned by
|
305 |
} else {
|
306 |
$title_text = $cap_name;
|
307 |
}
|
@@ -309,13 +367,26 @@ if( defined('PP_ACTIVE') ) {
|
|
309 |
$disabled = '';
|
310 |
$checked = checked(1, ! empty($rcaps[$cap_name]), false );
|
311 |
|
312 |
-
$
|
313 |
$type_caps [$cap_name] = true;
|
314 |
$display_row = true;
|
315 |
-
}
|
316 |
-
}
|
317 |
-
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
}
|
320 |
}
|
321 |
|
@@ -342,7 +413,7 @@ if( defined('PP_ACTIVE') ) {
|
|
342 |
jQuery(document).ready( function($) {
|
343 |
$('a[href="#toggle_type_caps"]').click( function() {
|
344 |
var chks = $(this).closest('tr').find('input');
|
345 |
-
$(chks).
|
346 |
return false;
|
347 |
});
|
348 |
});
|
@@ -358,11 +429,11 @@ if( defined('PP_ACTIVE') ) {
|
|
358 |
ksort( $core_caps );
|
359 |
|
360 |
echo '<p> </p><h3>' . __( 'Other WordPress Core Capabilities', $this->ID ) . '</h3>';
|
361 |
-
echo '<table width="100%" class="form-table"><tr>';
|
362 |
|
363 |
|
364 |
-
$checks_per_row =
|
365 |
-
$i = 0;
|
366 |
|
367 |
foreach( array_keys($core_caps) as $cap_name ) {
|
368 |
if ( ! $is_administrator && ! current_user_can($cap_name) )
|
@@ -373,31 +444,62 @@ if( defined('PP_ACTIVE') ) {
|
|
373 |
$i = 0;
|
374 |
}
|
375 |
|
|
|
|
|
|
|
|
|
|
|
376 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
377 |
-
$
|
|
|
378 |
} else {
|
379 |
$title_text = $cap_name;
|
380 |
}
|
381 |
|
382 |
$disabled = '';
|
383 |
$checked = checked(1, ! empty($rcaps[$cap_name]), false );
|
384 |
-
|
385 |
-
$class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
|
386 |
-
|
387 |
?>
|
388 |
-
<td class="<?php echo $class; ?>"><label for="caps[<?php echo $cap_name; ?>]" title="<?php echo $title_text;?>"><input id=caps[<?php echo $cap_name; ?>] type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
|
|
|
389 |
<?php
|
390 |
echo str_replace( '_', ' ', $cap_name );
|
391 |
-
|
392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
394 |
|
395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
echo '<p> </p><h3>' . __( 'Additional Capabilities', $this->ID ) . '</h3>';
|
398 |
|
399 |
?>
|
400 |
-
<table width='100%' class="form-table">
|
401 |
<tr>
|
402 |
<?php
|
403 |
$i = 0; $first_row = true;
|
@@ -420,10 +522,15 @@ if( defined('PP_ACTIVE') ) {
|
|
420 |
echo '</tr><tr>';
|
421 |
$i = 0; $first_row = false;
|
422 |
}
|
423 |
-
|
|
|
|
|
|
|
|
|
424 |
|
425 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
426 |
-
$
|
|
|
427 |
} else {
|
428 |
$title_text = $cap_name;
|
429 |
}
|
@@ -435,15 +542,22 @@ if( defined('PP_ACTIVE') ) {
|
|
435 |
if ( ! current_user_can('administrator') ) {
|
436 |
continue;
|
437 |
} elseif ( 'administrator' == $default ) {
|
|
|
438 |
$lock_manage_caps_capability = true;
|
439 |
$disabled = 'disabled="disabled"';
|
440 |
}
|
441 |
}
|
442 |
?>
|
443 |
-
<td class="<?php echo $class; ?>"><label for="caps[<?php echo $cap_name; ?>]" title="<?php echo $title_text;?>"><input id=caps[<?php echo $cap_name; ?>] type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
|
444 |
-
|
445 |
-
|
446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
<?php
|
448 |
$i++;
|
449 |
endforeach;
|
@@ -455,26 +569,36 @@ if( defined('PP_ACTIVE') ) {
|
|
455 |
if ( $i == $checks_per_row ) {
|
456 |
echo '</tr><tr>';
|
457 |
$i = 0;
|
458 |
-
}
|
459 |
-
|
460 |
-
$level = ak_caps2level($rcaps);
|
461 |
-
?>
|
462 |
-
<td><?php _e('Level:', $this->ID) ;?><select name="level">
|
463 |
-
<?php for ( $l = $this->max_level; $l >= 0; $l-- ) {?>
|
464 |
-
<option value="<?php echo $l; ?>" style="text-align:right;"<?php selected($level, $l); ?>> <?php echo $l; ?> </option>
|
465 |
-
<?php }
|
466 |
-
++$i;
|
467 |
-
|
468 |
if ( ! $first_row ) {
|
469 |
// Now close a wellformed table
|
470 |
for ( $i; $i < $checks_per_row; $i++ ){
|
471 |
echo '<td> </td>';
|
472 |
}
|
|
|
473 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
?>
|
475 |
</select>
|
476 |
-
|
477 |
-
|
|
|
|
|
|
|
|
|
|
|
478 |
</table>
|
479 |
|
480 |
<br />
|
@@ -488,21 +612,11 @@ if( defined('PP_ACTIVE') ) {
|
|
488 |
</dd>
|
489 |
</dl>
|
490 |
|
491 |
-
<?php
|
492 |
-
$support_pp_only_roles = defined('PP_ACTIVE')
|
|
|
493 |
?>
|
494 |
|
495 |
-
<?php if ( $support_pp_only_roles && ! in_array( $default, array( 'subscriber', 'contributor', 'author', 'editor', 'administrator' ) ) ) : ?>
|
496 |
-
<div style="float:right">
|
497 |
-
<?php
|
498 |
-
pp_refresh_options();
|
499 |
-
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
500 |
-
$checked = ( in_array( $default, $pp_only ) ) ? 'checked="checked"': '';
|
501 |
-
?>
|
502 |
-
<label for="pp_only_role" title="<?php _e('Make role available for supplemental assignment to Permit Groups only', 'pp');?>"><input type="checkbox" name="pp_only_role" id="pp_only_role" value="1" <?php echo $checked;?>> <?php _e('supplemental assignment only', 'pp'); ?> </label>
|
503 |
-
</div>
|
504 |
-
<?php endif; ?>
|
505 |
-
|
506 |
<p class="submit">
|
507 |
<input type="hidden" name="action" value="update" />
|
508 |
<input type="hidden" name="current" value="<?php echo $default; ?>" />
|
@@ -514,14 +628,15 @@ if( defined('PP_ACTIVE') ) {
|
|
514 |
</p>
|
515 |
|
516 |
<br />
|
517 |
-
<?php
|
|
|
518 |
|
519 |
</td>
|
520 |
<td class="sidebar">
|
521 |
-
<?php
|
522 |
|
523 |
<dl>
|
524 |
-
<dt><?php defined('WPLANG') && WPLANG
|
525 |
<dd style="text-align:center;">
|
526 |
<p><select name="role">
|
527 |
<?php
|
@@ -529,7 +644,7 @@ if( defined('PP_ACTIVE') ) {
|
|
529 |
echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' </option>';
|
530 |
}
|
531 |
?>
|
532 |
-
</select><span style="margin-left:20px"><input type="submit" name="LoadRole" value="<?php defined('WPLANG') && WPLANG
|
533 |
</dd>
|
534 |
</dl>
|
535 |
|
@@ -540,7 +655,7 @@ if( defined('PP_ACTIVE') ) {
|
|
540 |
<p><input type="text" name="create-name"" class="<?php echo $class;?>" placeholder="<?php _e('Name of new role', $this->ID) ?>" />
|
541 |
|
542 |
<?php if( $support_pp_only_roles ) : ?>
|
543 |
-
<label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to
|
544 |
<?php endif; ?>
|
545 |
|
546 |
<br />
|
@@ -550,13 +665,13 @@ if( defined('PP_ACTIVE') ) {
|
|
550 |
</dl>
|
551 |
|
552 |
<dl>
|
553 |
-
<dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', $this->ID) : printf(
|
554 |
<dd style="text-align:center;">
|
555 |
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
|
556 |
<p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Name of copied role', $this->ID) ?>" />
|
557 |
|
558 |
<?php if( $support_pp_only_roles ) : ?>
|
559 |
-
<label for="copy_role_pp_only" title="<?php _e('Make role available for supplemental assignment to
|
560 |
<?php endif; ?>
|
561 |
|
562 |
<br />
|
@@ -573,74 +688,41 @@ if( defined('PP_ACTIVE') ) {
|
|
573 |
</dd>
|
574 |
</dl>
|
575 |
|
576 |
-
<?php if ( defined('PP_ACTIVE')
|
577 |
-
|
578 |
-
|
579 |
-
<dd style="text-align:center;">
|
580 |
-
<?php
|
581 |
-
$caption = __( 'Force unique capability names for:', 'pp' );
|
582 |
-
echo "<p>$caption</p><table style='width:100%'><tr>";
|
583 |
-
|
584 |
-
foreach( array_keys($defined) as $item_type ) {
|
585 |
-
echo '<td style="width:50%">';
|
586 |
-
$option_name = ( 'taxonomy' == $item_type ) ? 'enabled_taxonomies' : 'enabled_post_types';
|
587 |
-
|
588 |
-
$enabled = pp_get_option( $option_name );
|
589 |
-
|
590 |
-
foreach( $defined[$item_type] as $key => $type_obj ) {
|
591 |
-
if ( ! $key )
|
592 |
-
continue;
|
593 |
-
|
594 |
-
$id = "$option_name-" . $key;
|
595 |
-
?>
|
596 |
-
<div style="text-align:left">
|
597 |
-
<?php if ( 'nav_menu' == $key ) :?>
|
598 |
-
<input name="<?php echo($id);?>" type="hidden" id="<?php echo($id);?>" value="1" />
|
599 |
-
<input name="<?php echo("{$option_name}-options[]");?>" type="hidden" value="<?php echo($key)?>" />
|
600 |
-
|
601 |
-
<?php else: ?>
|
602 |
-
<div class="agp-vspaced_input">
|
603 |
-
<label for="<?php echo($id);?>" title="<?php echo($key);?>">
|
604 |
-
<input name="<?php echo("{$option_name}-options[]");?>" type="hidden" value="<?php echo($key)?>" />
|
605 |
-
<input name="<?php echo($id);?>" type="checkbox" id="<?php echo($id);?>" value="1" <?php checked('1', isset($enabled[$key]) );?> /> <?php echo($type_obj->label);?>
|
606 |
-
|
607 |
-
<?php
|
608 |
-
echo ('</label></div>');
|
609 |
-
|
610 |
-
endif; // displaying checkbox UI
|
611 |
-
|
612 |
-
echo '</div>';
|
613 |
-
}
|
614 |
-
echo '</td>';
|
615 |
-
}
|
616 |
-
?>
|
617 |
-
</tr></table>
|
618 |
-
|
619 |
-
<?php if( pp_wp_ver( '3.5' ) ) :
|
620 |
-
$define_create_posts_cap = pp_get_option( 'define_create_posts_cap' );
|
621 |
-
?>
|
622 |
-
<div>
|
623 |
-
<label for="pp_define_create_posts_cap">
|
624 |
-
<input name="pp_define_create_posts_cap" type="checkbox" id="pp_define_create_posts_cap" value="1" <?php checked('1', $define_create_posts_cap );?> /> <?php _e('Use create_posts capability');?>
|
625 |
-
</label>
|
626 |
-
</div>
|
627 |
-
<?php endif; ?>
|
628 |
-
|
629 |
-
<div class="cme-subtext">
|
630 |
-
<?php
|
631 |
-
if ( pp_get_option( 'display_hints' ) ) {
|
632 |
-
_e( '(PP Filtered Post Types, Taxonomies)', 'pp' );
|
633 |
-
}
|
634 |
-
?>
|
635 |
-
</div>
|
636 |
-
|
637 |
-
<input type="submit" name="update_filtered_types" value="<?php _e('Update', $this->ID) ?>" class="button" />
|
638 |
-
</dd>
|
639 |
-
</dl>
|
640 |
-
<?php endif;?>
|
641 |
</td>
|
642 |
</tr>
|
643 |
</table>
|
644 |
</fieldset>
|
645 |
</form>
|
646 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
$default = $this->current;
|
31 |
|
32 |
if( defined('PP_ACTIVE') ) {
|
33 |
+
require_once( dirname(__FILE__).'/pp-ui.php' );
|
34 |
+
$pp_ui = new Capsman_PP_UI();
|
35 |
+
$pp_metagroup_caps = $pp_ui->get_metagroup_caps( $default );
|
36 |
+
} else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
$pp_metagroup_caps = array();
|
|
|
|
|
38 |
?>
|
39 |
<div class="wrap">
|
40 |
<?php if( defined('PP_ACTIVE') ) :
|
58 |
<dl>
|
59 |
<dt><?php printf(__('Capabilities for %s', $this->ID), $roles[$default]); ?></dt>
|
60 |
<dd>
|
61 |
+
<div>
|
62 |
+
<?php _e( 'View and modify capabilities WordPress associates with each role. Changes <strong>remain in the database</strong> even if you deactivate this plugin.', $this->ID ); ?>
|
63 |
+
</div>
|
64 |
+
|
65 |
<?php
|
66 |
if ( defined( 'PP_ACTIVE' ) ) {
|
67 |
+
$pp_ui->show_capability_hints( $default );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
} else {
|
69 |
+
global $capsman;
|
70 |
+
$img_url = $capsman->mod_url . '/images/';
|
71 |
+
$lang_id = $this->ID;
|
72 |
+
|
73 |
+
echo '<div style="margin-top:5px">';
|
74 |
+
_e( "To further customize editing or viewing access, consider stepping up to <a href='#pp-more'>Press Permit</a>.", $this->ID );
|
75 |
echo '</div>';
|
76 |
?>
|
77 |
<script type="text/javascript">
|
88 |
});
|
89 |
/* ]]> */
|
90 |
</script>
|
91 |
+
<style>
|
92 |
+
#pp_features {display:none;border:1px solid #eee;padding:5px;text-align:center;min-width:600px}
|
93 |
+
div.pp-logo { text-align: center }
|
94 |
+
div.features-wrap { margin-left: auto; margin-right: auto; text-align: center; width: 540px; }
|
95 |
+
ul.pp-features { list-style: none; padding-top:10px; text-align:left; margin-left: auto }
|
96 |
+
ul.pp-features li:before { content: "\2713\0020"; }
|
97 |
+
ul.pp-features li { padding-bottom: 5px }
|
98 |
+
img.cme-play { margin-bottom: -3px; margin-left: 5px;}
|
99 |
+
</style>
|
100 |
+
|
101 |
+
<?php /* play.png icon by Pavel: http://kde-look.org/usermanager/search.php?username=InFeRnODeMoN */ ?>
|
102 |
+
|
103 |
+
<br /><div id="pp_features"><div class="pp-logo"><a href="http://presspermit.com"><img src="<?php echo $img_url;?>pp-logo.png" /></a></div><div class="features-wrap"><ul class="pp-features">
|
104 |
+
<li>
|
105 |
+
<?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", $lang_id );?>
|
106 |
+
<a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
107 |
+
|
108 |
+
<li>
|
109 |
+
<?php _e( "Assign standard WP roles supplementally for a specific post type", $lang_id );?>
|
110 |
+
<a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
111 |
+
|
112 |
+
<li>
|
113 |
+
<?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", $lang_id );?>
|
114 |
+
<a href="http://presspermit.com/tutorial/custom-role-usage" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
115 |
+
|
116 |
+
<li>
|
117 |
+
<?php _e( "Customize reading permissions per-category or per-post", $lang_id );?>
|
118 |
+
<a href="http://presspermit.com/tutorial/category-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
119 |
+
|
120 |
+
<li>
|
121 |
+
<?php _e( "Customize editing permissions per-category or per-post <em>(Pro)</em>", $lang_id );?>
|
122 |
+
<a href="http://presspermit.com/tutorial/page-editing-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
123 |
+
|
124 |
+
<li>
|
125 |
+
<?php _e( "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>", $lang_id );?>
|
126 |
+
<a href="http://presspermit.com/tutorial/custom-post-visibility" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
127 |
+
|
128 |
+
<li>
|
129 |
+
<?php _e( "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>", $lang_id );?>
|
130 |
+
<a href="http://presspermit.com/tutorial/multi-step-moderation" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
131 |
+
|
132 |
+
<li>
|
133 |
+
<?php _e( "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>", $lang_id );?>
|
134 |
+
<a href="http://presspermit.com/tutorial/edit-flow-integration" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
135 |
+
|
136 |
+
<li>
|
137 |
+
<?php _e( "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>", $lang_id );?>
|
138 |
+
<a href="http://presspermit.com/tutorial/published-content-revision" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
139 |
+
|
140 |
+
<li>
|
141 |
+
<?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", $lang_id );?>
|
142 |
+
<a href="http://presspermit.com/tutorial/bbpress-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
143 |
+
|
144 |
+
<li>
|
145 |
+
<?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", $lang_id );?>
|
146 |
+
<a href="http://presspermit.com/tutorial/buddypress-content-permissions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
147 |
+
|
148 |
+
<li>
|
149 |
+
<?php _e( "WPML integration to mirror permissions to translations <em>(Pro)</em>", $lang_id );?>
|
150 |
+
</li>
|
151 |
+
|
152 |
+
<li>
|
153 |
+
<?php _e( "Member support forum", $lang_id );?>
|
154 |
+
</li>
|
155 |
+
|
156 |
+
</ul></div>
|
157 |
<?php
|
158 |
+
echo '<div>';
|
159 |
+
printf( __('%1$sgrab%2$s %3$s', 'capsman'), '<strong>', '</strong>', '<span class="plugins update-message"><a href="' . cme_plugin_info_url('press-permit-core') . '" class="thickbox" title="' . sprintf( __('%s (free install)', 'capsman'), 'Press Permit Core' ) . '">Press Permit Core</a></span>' );
|
160 |
+
echo ' • ';
|
161 |
+
printf( __('%1$sbuy%2$s %3$s', 'capsman'), '<strong>', '</strong>', '<a href="http://presspermit.com" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman'), 'Press Permit Pro' ) . '">Press Permit Pro</a>' );
|
162 |
+
echo ' • ';
|
163 |
+
echo '<a href="#pp-hide">hide</a>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
echo '</div></div>';
|
165 |
}
|
166 |
|
167 |
if ( MULTISITE ) {
|
168 |
global $wp_roles;
|
169 |
+
if ( method_exists( $wp_roles, 'reinit' ) ) {
|
170 |
+
global $wpdb;
|
171 |
+
|
172 |
+
if ( ! empty($_REQUEST['cme_net_sync_role'] ) ) {
|
173 |
+
switch_to_blog(1);
|
174 |
+
wp_cache_delete( $wpdb->prefix . 'user_roles', 'options' );
|
175 |
+
}
|
176 |
+
|
177 |
$wp_roles->reinit();
|
178 |
+
}
|
179 |
}
|
180 |
|
181 |
+
global $capsman;
|
182 |
$capsman->reinstate_db_roles();
|
183 |
|
184 |
$current = get_role($default);
|
185 |
+
|
186 |
+
//print_r($current);
|
187 |
+
|
188 |
$rcaps = $current->capabilities;
|
189 |
|
190 |
// ========= Begin Kevin B mod ===========
|
197 |
$defined['type'] = get_post_types( array( 'public' => true ), 'object' );
|
198 |
$defined['taxonomy'] = get_taxonomies( array( 'public' => true ), 'object' );
|
199 |
|
200 |
+
$unfiltered['type'] = apply_filters( 'pp_unfiltered_post_types', array('forum','topic','reply') ); // bbPress' dynamic role def requires additional code to enforce stored caps
|
201 |
+
$unfiltered['taxonomy'] = apply_filters( 'pp_unfiltered_taxonomies', array( 'post_status', 'topic-tag' ) ); // avoid confusion with Edit Flow administrative taxonomy
|
202 |
/*
|
203 |
if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) {
|
204 |
$cap_properties[''] = array();
|
269 |
);
|
270 |
$type_caps = array();
|
271 |
|
272 |
+
// Role Scoper and PP1 adjust attachment access based only on user's capabilities for the parent post
|
273 |
+
if ( defined('SCOPER_VERSION') || ( defined( 'PP_ACTIVE' ) && ! defined( 'PPC_VERSION' ) ) )
|
274 |
unset( $defined['type']['attachment'] );
|
275 |
|
276 |
echo '<ul class="cme-listhoriz">';
|
282 |
echo '<table class="cme-typecaps">';
|
283 |
|
284 |
foreach( array_keys($defined) as $item_type ) {
|
285 |
+
if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) ) {
|
286 |
+
if ( defined('SCOPER_VERSION') || defined('PP_ACTIVE') )
|
287 |
+
continue;
|
288 |
+
|
289 |
+
$any_term_deletion_caps = false;
|
290 |
+
foreach( array_keys($defined['taxonomy']) as $_tax ) {
|
291 |
+
if ( isset( $defined['taxonomy'][$_tax]->cap->delete_terms ) && ( 'manage_categories' != $defined['taxonomy'][$_tax]->cap->delete_terms ) && ! in_array( $_tax, $unfiltered['taxonomy'] ) ) {
|
292 |
+
$any_term_deletion_caps = true;
|
293 |
+
break;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( ! $any_term_deletion_caps )
|
298 |
+
continue;
|
299 |
+
}
|
300 |
|
301 |
//if ( ! $cap_type ) {
|
302 |
|
313 |
$prop = str_replace( '_terms', '', $prop );
|
314 |
$tip = ( isset( $cap_tips[$prop] ) ) ? "title='{$cap_tips[$prop]}'" : '';
|
315 |
$prop = str_replace( '_', '<br />', $prop );
|
316 |
+
$th_class = ( 'taxonomy' == $item_type ) ? ' class="term-cap"' : ' class="post-cap"';
|
317 |
+
echo "<th $tip{$th_class}>";
|
318 |
echo ucwords($prop);
|
319 |
echo '</th>';
|
320 |
}
|
321 |
|
322 |
foreach( $defined[$item_type] as $key => $type_obj ) {
|
323 |
+
if ( in_array( $key, $unfiltered[$item_type] ) )
|
324 |
+
continue;
|
325 |
+
|
326 |
+
$row = "<tr class='cme_type_{$key}'>";
|
327 |
|
328 |
if ( $cap_type ) {
|
329 |
if ( empty($force_distinct_ui) && empty( $cap_properties[$cap_type][$item_type] ) )
|
330 |
continue;
|
331 |
|
332 |
+
$row .= "<td><a class='cap_type' href='#toggle_type_caps'>" . $type_obj->labels->name . '</a>';
|
333 |
+
$row .= '<a href="#" class="neg-type-caps"> x </a>';
|
334 |
+
$row .= '</td>';
|
335 |
|
336 |
$display_row = ! empty($force_distinct_ui);
|
337 |
+
|
338 |
foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
|
339 |
+
$td_classes = array();
|
340 |
+
$checkbox = '';
|
341 |
+
|
342 |
if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
|
343 |
|| ! in_array( $type_obj->cap->$prop, $default_caps )
|
344 |
|| ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
|
345 |
+
|
346 |
// if edit_published or edit_private cap is same as edit_posts cap, don't display a checkbox for it
|
347 |
if ( ( ! in_array( $prop, array( 'edit_published_posts', 'edit_private_posts', 'create_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->edit_posts ) )
|
348 |
&& ( ! in_array( $prop, array( 'delete_published_posts', 'delete_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->delete_posts ) )
|
349 |
) {
|
350 |
$cap_name = $type_obj->cap->$prop;
|
351 |
|
352 |
+
if ( 'taxonomy' == $item_type )
|
353 |
+
$td_classes []= "term-cap";
|
354 |
+
else
|
355 |
+
$td_classes []= "post-cap";
|
356 |
+
|
357 |
+
if ( ! empty($pp_metagroup_caps[$cap_name]) )
|
358 |
+
$td_classes []='cm-has-via-pp';
|
359 |
+
|
360 |
if ( $is_administrator || current_user_can($cap_name) ) {
|
361 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
362 |
+
$title_text = sprintf( __( '%s: assigned by Permission Group', 'pp' ), $cap_name );
|
363 |
} else {
|
364 |
$title_text = $cap_name;
|
365 |
}
|
367 |
$disabled = '';
|
368 |
$checked = checked(1, ! empty($rcaps[$cap_name]), false );
|
369 |
|
370 |
+
$checkbox = '<input id=caps[' . $cap_name . '] type="checkbox" title="' . $title_text . '" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
|
371 |
$type_caps [$cap_name] = true;
|
372 |
$display_row = true;
|
373 |
+
}
|
374 |
+
} else
|
375 |
+
$td_classes []= "cap-unreg";
|
376 |
+
|
377 |
+
if ( isset($rcaps[$cap_name]) && empty($rcaps[$cap_name]) )
|
378 |
+
$td_classes []= "cap-neg";
|
379 |
+
} else
|
380 |
+
$td_classes []= "cap-unreg";
|
381 |
+
|
382 |
+
$td_class = ( $td_classes ) ? 'class="' . implode(' ', $td_classes) . '"' : '';
|
383 |
+
|
384 |
+
$row .= "<td $td_class><span class='cap-x'>X</span>$checkbox";
|
385 |
+
|
386 |
+
if ( false !== strpos( $td_class, 'cap-neg' ) )
|
387 |
+
$row .= '<input type="hidden" class="cme-negation-input" name="caps[' . $cap_name . ']" value="" />';
|
388 |
+
|
389 |
+
$row .= "</td>";
|
390 |
}
|
391 |
}
|
392 |
|
413 |
jQuery(document).ready( function($) {
|
414 |
$('a[href="#toggle_type_caps"]').click( function() {
|
415 |
var chks = $(this).closest('tr').find('input');
|
416 |
+
$(chks).prop( 'checked', ! $(chks).first().is(':checked') );
|
417 |
return false;
|
418 |
});
|
419 |
});
|
429 |
ksort( $core_caps );
|
430 |
|
431 |
echo '<p> </p><h3>' . __( 'Other WordPress Core Capabilities', $this->ID ) . '</h3>';
|
432 |
+
echo '<table width="100%" class="form-table cme-checklist"><tr>';
|
433 |
|
434 |
|
435 |
+
$checks_per_row = get_option( 'cme_form-rows', 5 );
|
436 |
+
$i = 0; $first_row = true;
|
437 |
|
438 |
foreach( array_keys($core_caps) as $cap_name ) {
|
439 |
if ( ! $is_administrator && ! current_user_can($cap_name) )
|
444 |
$i = 0;
|
445 |
}
|
446 |
|
447 |
+
if ( ! isset( $rcaps[$cap_name] ) )
|
448 |
+
$class = 'cap-no';
|
449 |
+
else
|
450 |
+
$class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
|
451 |
+
|
452 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
453 |
+
$class .= ' cap-metagroup';
|
454 |
+
$title_text = sprintf( __( '%s: assigned by Permission Group', 'pp' ), $cap_name );
|
455 |
} else {
|
456 |
$title_text = $cap_name;
|
457 |
}
|
458 |
|
459 |
$disabled = '';
|
460 |
$checked = checked(1, ! empty($rcaps[$cap_name]), false );
|
|
|
|
|
|
|
461 |
?>
|
462 |
+
<td class="<?php echo $class; ?>"><span class="cap-x">X</span><label for="caps[<?php echo $cap_name; ?>]" title="<?php echo $title_text;?>"><input id=caps[<?php echo $cap_name; ?>] type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
|
463 |
+
<span>
|
464 |
<?php
|
465 |
echo str_replace( '_', ' ', $cap_name );
|
466 |
+
?>
|
467 |
+
</span></label><a href="#" class="neg-cap"> x </a>
|
468 |
+
<?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
|
469 |
+
<input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
|
470 |
+
<?php endif; ?>
|
471 |
+
</td>
|
472 |
+
|
473 |
+
<?php
|
474 |
+
++$i;
|
475 |
}
|
476 |
|
477 |
+
if ( $i == $checks_per_row ) {
|
478 |
+
echo '</tr><tr>';
|
479 |
+
$i = 0;
|
480 |
+
} elseif ( ! $first_row ) {
|
481 |
+
// Now close a wellformed table
|
482 |
+
for ( $i; $i < $checks_per_row; $i++ ){
|
483 |
+
echo '<td> </td>';
|
484 |
+
}
|
485 |
+
echo '</tr>';
|
486 |
+
}
|
487 |
+
?>
|
488 |
|
489 |
+
<tr class="cme-bulk-select">
|
490 |
+
<td colspan="<?php echo $checks_per_row;?>">
|
491 |
+
<span style="float:right">
|
492 |
+
<input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman');?>"> <a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman');?>">X</a>
|
493 |
+
</span>
|
494 |
+
</td></tr>
|
495 |
+
|
496 |
+
</table>
|
497 |
+
|
498 |
+
<?php
|
499 |
echo '<p> </p><h3>' . __( 'Additional Capabilities', $this->ID ) . '</h3>';
|
500 |
|
501 |
?>
|
502 |
+
<table width='100%' class="form-table cme-checklist">
|
503 |
<tr>
|
504 |
<?php
|
505 |
$i = 0; $first_row = true;
|
522 |
echo '</tr><tr>';
|
523 |
$i = 0; $first_row = false;
|
524 |
}
|
525 |
+
|
526 |
+
if ( ! isset( $rcaps[$cap_name] ) )
|
527 |
+
$class = 'cap-no';
|
528 |
+
else
|
529 |
+
$class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
|
530 |
|
531 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
532 |
+
$class .= ' cap-metagroup';
|
533 |
+
$title_text = sprintf( __( '%s: assigned by Permission Group', 'pp' ), $cap_name );
|
534 |
} else {
|
535 |
$title_text = $cap_name;
|
536 |
}
|
542 |
if ( ! current_user_can('administrator') ) {
|
543 |
continue;
|
544 |
} elseif ( 'administrator' == $default ) {
|
545 |
+
$class .= ' cap-locked';
|
546 |
$lock_manage_caps_capability = true;
|
547 |
$disabled = 'disabled="disabled"';
|
548 |
}
|
549 |
}
|
550 |
?>
|
551 |
+
<td class="<?php echo $class; ?>"><span class="cap-x">X</span><label for="caps[<?php echo $cap_name; ?>]" title="<?php echo $title_text;?>"><input id=caps[<?php echo $cap_name; ?>] type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
|
552 |
+
<span>
|
553 |
+
<?php
|
554 |
+
echo str_replace( '_', ' ', $cap );
|
555 |
+
?>
|
556 |
+
</span></label><a href="#" class="neg-cap"> x </a>
|
557 |
+
<?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
|
558 |
+
<input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
|
559 |
+
<?php endif; ?>
|
560 |
+
</td>
|
561 |
<?php
|
562 |
$i++;
|
563 |
endforeach;
|
569 |
if ( $i == $checks_per_row ) {
|
570 |
echo '</tr><tr>';
|
571 |
$i = 0;
|
572 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
if ( ! $first_row ) {
|
574 |
// Now close a wellformed table
|
575 |
for ( $i; $i < $checks_per_row; $i++ ){
|
576 |
echo '<td> </td>';
|
577 |
}
|
578 |
+
echo '</tr>';
|
579 |
}
|
580 |
+
}
|
581 |
+
?>
|
582 |
+
|
583 |
+
<tr class="cme-bulk-select">
|
584 |
+
<td colspan="<?php echo $checks_per_row;?>">
|
585 |
+
<span>
|
586 |
+
<?php
|
587 |
+
$level = ak_caps2level($rcaps);
|
588 |
+
?>
|
589 |
+
<?php _e('Level:', $this->ID) ;?><select name="level">
|
590 |
+
<?php for ( $l = $this->max_level; $l >= 0; $l-- ) {?>
|
591 |
+
<option value="<?php echo $l; ?>" style="text-align:right;"<?php selected($level, $l); ?>> <?php echo $l; ?> </option>
|
592 |
+
<?php }
|
593 |
?>
|
594 |
</select>
|
595 |
+
</span>
|
596 |
+
|
597 |
+
<span style="float:right">
|
598 |
+
<input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman');?>"> <a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman');?>">X</a>
|
599 |
+
</span>
|
600 |
+
</td></tr>
|
601 |
+
|
602 |
</table>
|
603 |
|
604 |
<br />
|
612 |
</dd>
|
613 |
</dl>
|
614 |
|
615 |
+
<?php
|
616 |
+
$support_pp_only_roles = ( defined('PP_ACTIVE') ) ? $pp_ui->pp_only_roles_ui( $default ) : false;
|
617 |
+
cme_network_role_ui( $default );
|
618 |
?>
|
619 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
<p class="submit">
|
621 |
<input type="hidden" name="action" value="update" />
|
622 |
<input type="hidden" name="current" value="<?php echo $default; ?>" />
|
628 |
</p>
|
629 |
|
630 |
<br />
|
631 |
+
<?php agp_admin_footer(); ?>
|
632 |
+
<br />
|
633 |
|
634 |
</td>
|
635 |
<td class="sidebar">
|
636 |
+
<?php agp_admin_authoring($this->ID); ?>
|
637 |
|
638 |
<dl>
|
639 |
+
<dt><?php if ( defined('WPLANG') && WPLANG ) _e('Select New Role', $this->ID); else echo('Select Role to View / Edit'); ?></dt>
|
640 |
<dd style="text-align:center;">
|
641 |
<p><select name="role">
|
642 |
<?php
|
644 |
echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' </option>';
|
645 |
}
|
646 |
?>
|
647 |
+
</select><span style="margin-left:20px"><input type="submit" name="LoadRole" value="<?php if ( defined('WPLANG') && WPLANG ) _e('Change', $this->ID); else echo('Load'); ?>" class="button" /></span></p>
|
648 |
</dd>
|
649 |
</dl>
|
650 |
|
655 |
<p><input type="text" name="create-name"" class="<?php echo $class;?>" placeholder="<?php _e('Name of new role', $this->ID) ?>" />
|
656 |
|
657 |
<?php if( $support_pp_only_roles ) : ?>
|
658 |
+
<label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'pp');?>"> <input type="checkbox" name="new_role_pp_only" id="new_role_pp_only" value="1"> <?php _e('hidden', 'pp'); ?> </label>
|
659 |
<?php endif; ?>
|
660 |
|
661 |
<br />
|
665 |
</dl>
|
666 |
|
667 |
<dl>
|
668 |
+
<dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', $this->ID) : printf( 'Copy %s Role', $roles[$default] ); ?></dt>
|
669 |
<dd style="text-align:center;">
|
670 |
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
|
671 |
<p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Name of copied role', $this->ID) ?>" />
|
672 |
|
673 |
<?php if( $support_pp_only_roles ) : ?>
|
674 |
+
<label for="copy_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'pp');?>"> <input type="checkbox" name="copy_role_pp_only" id="copy_role_pp_only" value="1"> <?php _e('hidden', 'pp'); ?> </label>
|
675 |
<?php endif; ?>
|
676 |
|
677 |
<br />
|
688 |
</dd>
|
689 |
</dl>
|
690 |
|
691 |
+
<?php if ( defined('PP_ACTIVE') )
|
692 |
+
$pp_ui->pp_types_ui( $defined );
|
693 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
</td>
|
695 |
</tr>
|
696 |
</table>
|
697 |
</fieldset>
|
698 |
</form>
|
699 |
</div>
|
700 |
+
|
701 |
+
<?php
|
702 |
+
function cme_network_role_ui( $default ) {
|
703 |
+
if ( ! is_multisite() || ! is_super_admin() || ( 1 != get_current_blog_id() ) )
|
704 |
+
return false;
|
705 |
+
?>
|
706 |
+
|
707 |
+
<div style="float:right;margin:left:10px;margin-right:10px">
|
708 |
+
<?php
|
709 |
+
if ( ! $autocreate_roles = get_site_option( 'cme_autocreate_roles' ) )
|
710 |
+
$autocreate_roles = array();
|
711 |
+
|
712 |
+
$checked = ( in_array( $default, $autocreate_roles ) ) ? 'checked="checked"': '';
|
713 |
+
?>
|
714 |
+
<div style="margin-bottom: 5px">
|
715 |
+
<label for="cme_autocreate_role" title="<?php _e('Create this role definition in new (future) sites', 'capsman');?>"><input type="checkbox" name="cme_autocreate_role" id="cme_autocreate_role" value="1" <?php echo $checked;?>> <?php _e('include in new sites', 'capsman'); ?> </label>
|
716 |
+
</div>
|
717 |
+
<div>
|
718 |
+
<label for="cme_net_sync_role" title="<?php echo esc_attr(__('Copy / update this role definition to all sites now', 'capsman'));?>"><input type="checkbox" name="cme_net_sync_role" id="cme_net_sync_role" value="1"> <?php _e('sync role to all sites now', 'capsman'); ?> </label>
|
719 |
+
</div>
|
720 |
+
</div>
|
721 |
+
<?php
|
722 |
+
return true;
|
723 |
+
}
|
724 |
+
|
725 |
+
function cme_plugin_info_url( $plugin_slug ) {
|
726 |
+
return self_admin_url( "plugin-install.php?tab=plugin-information&plugin=$plugin_slug&TB_iframe=true&width=640&height=678" );
|
727 |
+
}
|
728 |
+
?>
|
includes/author-widget.php
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Pages Quthoring widget.
|
4 |
-
*
|
5 |
-
* @author Jordi Canals, Kevin Behrens
|
6 |
-
* @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2012-2013 Kevin Behrens
|
7 |
-
* @license GNU General Public License version 2
|
8 |
-
* @link http://agapetry.net
|
9 |
-
* @package Alkivia
|
10 |
-
* @subpackage CapsMan
|
11 |
-
*
|
12 |
-
|
13 |
-
Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
|
14 |
-
|
15 |
-
This program is free software; you can redistribute it and/or
|
16 |
-
modify it under the terms of the GNU General Public License
|
17 |
-
version 2 as published by the Free Software Foundation.
|
18 |
-
|
19 |
-
This program is distributed in the hope that it will be useful,
|
20 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
GNU General Public License for more details.
|
23 |
-
|
24 |
-
You should have received a copy of the GNU General Public License
|
25 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
|
29 |
-
<dl>
|
30 |
-
<dt>Capability Manager</dt>
|
31 |
-
<dd>
|
32 |
-
<ul>
|
33 |
-
<li><a href="http://agapetry.com" class="capsman" target="_blank"><?php _e('Plugin Homepage', $this->ID); ?></a></li>
|
34 |
-
<li><a href="http://presspermit.com" class="docs" target="_blank"><?php _e('Documentation', $this->ID); ?></a></li>
|
35 |
-
<li><a href="http://agapetry.net/forum" class="help" target="_blank"><?php _e('Support Forum', $this->ID); ?></a></li>
|
36 |
-
<li><a href="http://agapetry.com" class="h-ome" target="_blank"><?php _e('Author Homepage', $this->ID)?></a></li>
|
37 |
-
<li><a href="http://agapetry.com" class="donate" target="_blank"><?php _e('Help donating', $this->ID)?></a></li>
|
38 |
-
</ul>
|
39 |
-
</dd>
|
40 |
-
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/backup-handler.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Capsman_BackupHandler
|
4 |
+
{
|
5 |
+
var $cm;
|
6 |
+
|
7 |
+
function __construct( $manager_obj ) {
|
8 |
+
if ( ! is_super_admin() && ! current_user_can( 'restore_roles' ) )
|
9 |
+
wp_die( __( 'You do not have permission to restore roles.', 'capsman' ) );
|
10 |
+
|
11 |
+
$this->cm = $manager_obj;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Processes backups and restores.
|
16 |
+
*
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
function processBackupTool ()
|
20 |
+
{
|
21 |
+
if ( isset($_POST['Perform']) ) {
|
22 |
+
check_admin_referer('capsman-backup-tool');
|
23 |
+
|
24 |
+
global $wpdb;
|
25 |
+
$wp_roles = $wpdb->prefix . 'user_roles';
|
26 |
+
$cm_roles = $this->cm->ID . '_backup';
|
27 |
+
|
28 |
+
switch ( $_POST['action'] ) {
|
29 |
+
case 'backup':
|
30 |
+
$roles = get_option($wp_roles);
|
31 |
+
update_option($cm_roles, $roles);
|
32 |
+
ak_admin_notify(__('New backup saved.', $this->cm->ID));
|
33 |
+
break;
|
34 |
+
case 'restore':
|
35 |
+
$roles = get_option($cm_roles);
|
36 |
+
if ( $roles ) {
|
37 |
+
update_option($wp_roles, $roles);
|
38 |
+
ak_admin_notify(__('Roles and Capabilities restored from last backup.', $this->cm->ID));
|
39 |
+
} else {
|
40 |
+
ak_admin_error(__('Restore failed. No backup found.', $this->cm->ID));
|
41 |
+
}
|
42 |
+
break;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Resets roles to WordPress defaults.
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
function backupToolReset ()
|
53 |
+
{
|
54 |
+
check_admin_referer('capsman-reset-defaults');
|
55 |
+
|
56 |
+
require_once(ABSPATH . 'wp-admin/includes/schema.php');
|
57 |
+
|
58 |
+
if ( ! function_exists('populate_roles') ) {
|
59 |
+
ak_admin_error(__('Needed function to create default roles not found!', $this->cm->ID));
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
$roles = array_keys( ak_get_roles(true) );
|
64 |
+
|
65 |
+
foreach ( $roles as $role) {
|
66 |
+
remove_role($role);
|
67 |
+
}
|
68 |
+
|
69 |
+
populate_roles();
|
70 |
+
$this->cm->setAdminCapability();
|
71 |
+
|
72 |
+
$msg = __('Roles and Capabilities reset to WordPress defaults', $this->cm->ID);
|
73 |
+
|
74 |
+
if ( function_exists( 'pp_populate_roles' ) ) {
|
75 |
+
pp_populate_roles();
|
76 |
+
} else {
|
77 |
+
// force PP to repopulate roles
|
78 |
+
if ( $pp_ver = get_option( 'pp_version', true ) ) {
|
79 |
+
$pp_ver['version'] = ( preg_match( "/dev|alpha|beta|rc/i", $pp_ver['version'] ) ) ? '0.1-beta' : 0.1;
|
80 |
+
} else {
|
81 |
+
$pp_ver = array( 'version' => '0.1', 'db_version' => '1.0' );
|
82 |
+
}
|
83 |
+
|
84 |
+
update_option( 'pp_version', $pp_ver );
|
85 |
+
delete_option( 'ppperm_added_role_caps_10beta' );
|
86 |
+
}
|
87 |
+
|
88 |
+
ak_admin_notify($msg);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
?>
|
includes/backup.php
CHANGED
@@ -57,22 +57,24 @@
|
|
57 |
</dl>
|
58 |
|
59 |
<dl>
|
60 |
-
<dt><?php _e('Reset WordPress Defaults', $this->ID)
|
61 |
<dd>
|
62 |
-
<p style="text-align:center;"><strong><span style="color:red;"><?php _e('WARNING:', $this->ID); ?></span> <?php _e('Reseting default Roles and Capabilities will set them to the WordPress install defaults.', $this->ID); ?></strong><br />
|
63 |
-
|
64 |
-
|
|
|
|
|
65 |
<p style="text-align:center;"><a class="ak-delete" title="<?php echo esc_attr(__('Reset Roles and Capabilities to WordPress defaults', $this->ID)) ?>" href="<?php echo wp_nonce_url("tools.php?page={$this->ID}-tool&action=reset-defaults", 'capsman-reset-defaults'); ?>" onclick="if ( confirm('<?php echo esc_js(__("You are about to reset Roles and Capabilities to WordPress defaults.\n 'Cancel' to stop, 'OK' to reset.", $this->ID)); ?>') ) { return true;}return false;"><?php _e('Reset to WordPress defaults', $this->ID)?></a>
|
66 |
|
67 |
</dd>
|
68 |
</dl>
|
69 |
|
70 |
-
<?php
|
71 |
|
72 |
</td>
|
73 |
|
74 |
<td class="sidebar">
|
75 |
-
<?php
|
76 |
</td>
|
77 |
</tr>
|
78 |
</table>
|
57 |
</dl>
|
58 |
|
59 |
<dl>
|
60 |
+
<dt><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reset WordPress Defaults', $this->ID); else echo 'Reset Roles to WordPress Defaults';?></dt>
|
61 |
<dd>
|
62 |
+
<p style="text-align:center;"><strong><span style="color:red;"><?php _e('WARNING:', $this->ID); ?></span> <?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reseting default Roles and Capabilities will set them to the WordPress install defaults.', $this->ID); else echo 'This will delete and/or modify stored role definitions.'; ?></strong><br />
|
63 |
+
<br />
|
64 |
+
<?php
|
65 |
+
_e('If you have installed any plugin that adds new roles or capabilities, these will be lost.', $this->ID)?><br />
|
66 |
+
<strong><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('It is recommended to use this only as a last resource!'); else echo('It is recommended to use this only as a last resort!');?></strong></p>
|
67 |
<p style="text-align:center;"><a class="ak-delete" title="<?php echo esc_attr(__('Reset Roles and Capabilities to WordPress defaults', $this->ID)) ?>" href="<?php echo wp_nonce_url("tools.php?page={$this->ID}-tool&action=reset-defaults", 'capsman-reset-defaults'); ?>" onclick="if ( confirm('<?php echo esc_js(__("You are about to reset Roles and Capabilities to WordPress defaults.\n 'Cancel' to stop, 'OK' to reset.", $this->ID)); ?>') ) { return true;}return false;"><?php _e('Reset to WordPress defaults', $this->ID)?></a>
|
68 |
|
69 |
</dd>
|
70 |
</dl>
|
71 |
|
72 |
+
<?php agp_admin_footer(); ?>
|
73 |
|
74 |
</td>
|
75 |
|
76 |
<td class="sidebar">
|
77 |
+
<?php agp_admin_authoring($this->ID); ?>
|
78 |
</td>
|
79 |
</tr>
|
80 |
</table>
|
includes/handler.php
ADDED
@@ -0,0 +1,351 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class CapsmanHandler
|
3 |
+
{
|
4 |
+
var $cm;
|
5 |
+
|
6 |
+
function __construct( $manager_obj ) {
|
7 |
+
$this->cm = $manager_obj;
|
8 |
+
}
|
9 |
+
|
10 |
+
function processAdminGeneral( $post ) {
|
11 |
+
global $wp_roles;
|
12 |
+
|
13 |
+
// Create a new role.
|
14 |
+
if ( ! empty($post['CreateRole']) ) {
|
15 |
+
if ( $newrole = $this->createRole($post['create-name']) ) {
|
16 |
+
ak_admin_notify(__('New role created.', $this->cm->ID));
|
17 |
+
$this->cm->current = $newrole;
|
18 |
+
} else {
|
19 |
+
if ( empty($post['create-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
20 |
+
ak_admin_error( 'Error: No role name specified.', $this->cm->ID );
|
21 |
+
else
|
22 |
+
ak_admin_error(__('Error: Failed creating the new role.', $this->cm->ID));
|
23 |
+
}
|
24 |
+
|
25 |
+
// Copy current role to a new one.
|
26 |
+
} elseif ( ! empty($post['CopyRole']) ) {
|
27 |
+
$current = get_role($post['current']);
|
28 |
+
if ( $newrole = $this->createRole($post['copy-name'], $current->capabilities) ) {
|
29 |
+
ak_admin_notify(__('New role created.', $this->cm->ID));
|
30 |
+
$this->cm->current = $newrole;
|
31 |
+
} else {
|
32 |
+
if ( empty($post['copy-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
33 |
+
ak_admin_error( 'Error: No role name specified.', $this->cm->ID );
|
34 |
+
else
|
35 |
+
ak_admin_error(__('Error: Failed creating the new role.', $this->cm->ID));
|
36 |
+
}
|
37 |
+
|
38 |
+
// Save role changes. Already saved at start with self::saveRoleCapabilities().
|
39 |
+
} elseif ( ! empty($post['SaveRole']) ) {
|
40 |
+
if ( MULTISITE ) {
|
41 |
+
global $wp_roles;
|
42 |
+
if ( method_exists( $wp_roles, 'reinit' ) )
|
43 |
+
$wp_roles->reinit();
|
44 |
+
}
|
45 |
+
|
46 |
+
$this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
|
47 |
+
|
48 |
+
if ( defined( 'PP_ACTIVE' ) ) { // log customized role caps for subsequent restoration
|
49 |
+
// for bbPress < 2.2, need to log customization of roles following bbPress activation
|
50 |
+
$plugins = ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) ? array( 'bbpress.php' ) : array(); // back compat
|
51 |
+
|
52 |
+
if ( ! $customized_roles = get_option( 'pp_customized_roles' ) )
|
53 |
+
$customized_roles = array();
|
54 |
+
|
55 |
+
$customized_roles[$post['role']] = (object) array( 'caps' => array_map( 'boolval', $post['caps'] ), 'plugins' => $plugins );
|
56 |
+
update_option( 'pp_customized_roles', $customized_roles );
|
57 |
+
|
58 |
+
global $wpdb;
|
59 |
+
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
|
60 |
+
}
|
61 |
+
// Create New Capability and adds it to current role.
|
62 |
+
} elseif ( ! empty($post['AddCap']) ) {
|
63 |
+
if ( MULTISITE ) {
|
64 |
+
global $wp_roles;
|
65 |
+
if ( method_exists( $wp_roles, 'reinit' ) )
|
66 |
+
$wp_roles->reinit();
|
67 |
+
}
|
68 |
+
|
69 |
+
$role = get_role($post['current']);
|
70 |
+
$role->name = $post['current']; // bbPress workaround
|
71 |
+
|
72 |
+
if ( $newname = $this->createNewName($post['capability-name']) ) {
|
73 |
+
$role->add_cap($newname['name']);
|
74 |
+
$this->cm->message = __('New capability added to role.');
|
75 |
+
|
76 |
+
// for bbPress < 2.2, need to log customization of roles following bbPress activation
|
77 |
+
$plugins = ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) ? array( 'bbpress.php' ) : array(); // back compat
|
78 |
+
|
79 |
+
if ( ! $customized_roles = get_option( 'pp_customized_roles' ) )
|
80 |
+
$customized_roles = array();
|
81 |
+
|
82 |
+
$customized_roles[$post['role']] = (object) array( 'caps' => array_merge( $role->capabilities, array( $newname['name'] => 1 ) ), 'plugins' => $plugins );
|
83 |
+
update_option( 'pp_customized_roles', $customized_roles );
|
84 |
+
|
85 |
+
global $wpdb;
|
86 |
+
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
|
87 |
+
} else {
|
88 |
+
$this->cm->message = __('Incorrect capability name.');
|
89 |
+
}
|
90 |
+
|
91 |
+
} elseif ( ! empty($post['update_filtered_types']) ) {
|
92 |
+
if ( cme_update_pp_usage() ) {
|
93 |
+
ak_admin_notify(__('Capability settings saved.', $this->cm->ID));
|
94 |
+
} else {
|
95 |
+
ak_admin_error(__('Error saving capability settings.', $this->cm->ID));
|
96 |
+
}
|
97 |
+
} else {
|
98 |
+
// TODO: Implement exceptions. This must be a fatal error.
|
99 |
+
ak_admin_error(__('Bad form received.', $this->cm->ID));
|
100 |
+
}
|
101 |
+
|
102 |
+
if ( ! empty($newrole) && defined('PP_ACTIVE') ) {
|
103 |
+
if ( ( ! empty($post['CreateRole']) && ! empty( $_REQUEST['new_role_pp_only'] ) ) || ( ! empty($post['CopyRole']) && ! empty( $_REQUEST['copy_role_pp_only'] ) ) ) {
|
104 |
+
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
105 |
+
$pp_only[]= $newrole;
|
106 |
+
pp_update_option( 'supplemental_role_defs', $pp_only );
|
107 |
+
_cme_pp_default_pattern_role( $newrole );
|
108 |
+
pp_refresh_options();
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Creates a new role/capability name from user input name.
|
116 |
+
* Name rules are:
|
117 |
+
* - 2-40 charachers lenght.
|
118 |
+
* - Only letters, digits, spaces and underscores.
|
119 |
+
* - Must to start with a letter.
|
120 |
+
*
|
121 |
+
* @param string $name Name from user input.
|
122 |
+
* @return array|false An array with the name and display_name, or false if not valid $name.
|
123 |
+
*/
|
124 |
+
private function createNewName( $name ) {
|
125 |
+
// Allow max 40 characters, letters, digits and spaces
|
126 |
+
$name = trim(substr($name, 0, 40));
|
127 |
+
$pattern = '/^[a-zA-Z][a-zA-Z0-9 _]+$/';
|
128 |
+
|
129 |
+
if ( preg_match($pattern, $name) ) {
|
130 |
+
$roles = ak_get_roles();
|
131 |
+
|
132 |
+
$name = strtolower($name);
|
133 |
+
$name = str_replace(' ', '_', $name);
|
134 |
+
if ( in_array($name, $roles) || array_key_exists($name, $this->cm->capabilities) ) {
|
135 |
+
return false; // Already a role or capability with this name.
|
136 |
+
}
|
137 |
+
|
138 |
+
$display = explode('_', $name);
|
139 |
+
$display = array_map('ucfirst', $display);
|
140 |
+
$display = implode(' ', $display);
|
141 |
+
|
142 |
+
return compact('name', 'display');
|
143 |
+
} else {
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Creates a new role.
|
150 |
+
*
|
151 |
+
* @param string $name Role name to create.
|
152 |
+
* @param array $caps Role capabilities.
|
153 |
+
* @return string|false Returns the name of the new role created or false if failed.
|
154 |
+
*/
|
155 |
+
private function createRole( $name, $caps = array() ) {
|
156 |
+
if ( ! is_array($caps) )
|
157 |
+
$caps = array();
|
158 |
+
|
159 |
+
$role = $this->createNewName($name);
|
160 |
+
if ( ! is_array($role) ) {
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
|
164 |
+
$new_role = add_role($role['name'], $role['display'], $caps);
|
165 |
+
if ( is_object($new_role) ) {
|
166 |
+
return $role['name'];
|
167 |
+
} else {
|
168 |
+
return false;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Saves capability changes to roles.
|
174 |
+
*
|
175 |
+
* @param string $role_name Role name to change its capabilities
|
176 |
+
* @param array $caps New capabilities for the role.
|
177 |
+
* @return void
|
178 |
+
*/
|
179 |
+
private function saveRoleCapabilities( $role_name, $caps, $level ) {
|
180 |
+
$this->cm->generateNames();
|
181 |
+
$role = get_role($role_name);
|
182 |
+
|
183 |
+
// workaround to ensure db storage of customizations to bbp dynamic roles
|
184 |
+
$role->name = $role_name;
|
185 |
+
|
186 |
+
$stored_role_caps = ( ! empty($role->capabilities) && is_array($role->capabilities) ) ? array_intersect( $role->capabilities, array(true, 1) ) : array();
|
187 |
+
|
188 |
+
$old_caps = array_intersect_key( $stored_role_caps, $this->cm->capabilities);
|
189 |
+
$new_caps = ( is_array($caps) ) ? array_map('boolval', $caps) : array();
|
190 |
+
$new_caps = array_merge($new_caps, ak_level2caps($level));
|
191 |
+
|
192 |
+
// Find caps to add and remove
|
193 |
+
$add_caps = array_diff_key($new_caps, $old_caps);
|
194 |
+
$del_caps = array_diff_key($old_caps, $new_caps);
|
195 |
+
|
196 |
+
$changed_caps = array();
|
197 |
+
foreach( array_intersect_key( $new_caps, $old_caps ) as $cap_name => $cap_val ) {
|
198 |
+
if ( $new_caps[$cap_name] != $old_caps[$cap_name] )
|
199 |
+
$changed_caps[$cap_name] = $cap_val;
|
200 |
+
}
|
201 |
+
|
202 |
+
$add_caps = array_merge( $add_caps, $changed_caps );
|
203 |
+
|
204 |
+
if ( ! $is_administrator = current_user_can('administrator') ) {
|
205 |
+
unset($add_caps['manage_capabilities']);
|
206 |
+
unset($del_caps['manage_capabilities']);
|
207 |
+
}
|
208 |
+
|
209 |
+
if ( 'administrator' == $role_name && isset($del_caps['manage_capabilities']) ) {
|
210 |
+
unset($del_caps['manage_capabilities']);
|
211 |
+
ak_admin_error(__('You cannot remove Manage Capabilities from Administrators', $this->cm->ID));
|
212 |
+
}
|
213 |
+
// Add new capabilities to role
|
214 |
+
foreach ( $add_caps as $cap => $grant ) {
|
215 |
+
if ( $is_administrator || current_user_can($cap) )
|
216 |
+
$role->add_cap( $cap, $grant );
|
217 |
+
}
|
218 |
+
|
219 |
+
// Remove capabilities from role
|
220 |
+
foreach ( $del_caps as $cap => $grant) {
|
221 |
+
if ( $is_administrator || current_user_can($cap) )
|
222 |
+
$role->remove_cap($cap);
|
223 |
+
}
|
224 |
+
|
225 |
+
if ( is_multisite() && is_super_admin() && ( 1 == get_current_blog_id() ) ) {
|
226 |
+
if ( ! $autocreate_roles = get_site_option( 'cme_autocreate_roles' ) )
|
227 |
+
$autocreate_roles = array();
|
228 |
+
|
229 |
+
$this_role_autocreate = ! empty($_REQUEST['cme_autocreate_role']);
|
230 |
+
|
231 |
+
if ( $this_role_autocreate && ! in_array( $role_name, $autocreate_roles ) ) {
|
232 |
+
$autocreate_roles []= $role_name;
|
233 |
+
update_site_option( 'cme_autocreate_roles', $autocreate_roles );
|
234 |
+
}
|
235 |
+
|
236 |
+
if ( ! $this_role_autocreate && in_array( $role_name, $autocreate_roles ) ) {
|
237 |
+
$autocreate_roles = array_diff( $autocreate_roles, array( $role_name ) );
|
238 |
+
update_site_option( 'cme_autocreate_roles', $autocreate_roles );
|
239 |
+
}
|
240 |
+
|
241 |
+
if ( ! empty($_REQUEST['cme_net_sync_role']) ) {
|
242 |
+
// loop through all sites on network, creating or updating role def
|
243 |
+
|
244 |
+
global $wpdb, $wp_roles, $blog_id;
|
245 |
+
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id" );
|
246 |
+
$orig_blog_id = $blog_id;
|
247 |
+
|
248 |
+
$role_caption = $wp_roles->role_names[$role_name];
|
249 |
+
|
250 |
+
$new_caps = ( is_array($caps) ) ? array_map('boolval', $caps) : array();
|
251 |
+
$new_caps = array_merge($new_caps, ak_level2caps($level) );
|
252 |
+
|
253 |
+
$admin_role = $wp_roles->get_role('administrator');
|
254 |
+
$main_admin_caps = array_merge( $admin_role->capabilities, ak_level2caps(10) );
|
255 |
+
|
256 |
+
foreach ( $blog_ids as $id ) {
|
257 |
+
if ( 1 == $id )
|
258 |
+
continue;
|
259 |
+
|
260 |
+
switch_to_blog( $id );
|
261 |
+
$wp_roles->reinit();
|
262 |
+
|
263 |
+
if ( $blog_role = $wp_roles->get_role( $role_name ) ) {
|
264 |
+
$stored_role_caps = ( ! empty($blog_role->capabilities) && is_array($blog_role->capabilities) ) ? array_intersect( $blog_role->capabilities, array(true, 1) ) : array();
|
265 |
+
|
266 |
+
$old_caps = array_intersect_key( $stored_role_caps, $this->cm->capabilities);
|
267 |
+
|
268 |
+
// Find caps to add and remove
|
269 |
+
$add_caps = array_diff_key($new_caps, $old_caps);
|
270 |
+
$del_caps = array_intersect_key( array_diff_key($old_caps, $new_caps), $main_admin_caps ); // don't mess with caps that are totally unused on main site
|
271 |
+
|
272 |
+
// Add new capabilities to role
|
273 |
+
foreach ( $add_caps as $cap => $grant ) {
|
274 |
+
$blog_role->add_cap( $cap, $grant );
|
275 |
+
}
|
276 |
+
|
277 |
+
// Remove capabilities from role
|
278 |
+
foreach ( $del_caps as $cap => $grant) {
|
279 |
+
$blog_role->remove_cap($cap);
|
280 |
+
}
|
281 |
+
|
282 |
+
} else {
|
283 |
+
$wp_roles->add_role( $role_name, $role_caption, $new_caps );
|
284 |
+
}
|
285 |
+
|
286 |
+
restore_current_blog();
|
287 |
+
}
|
288 |
+
|
289 |
+
$wp_roles->reinit();
|
290 |
+
}
|
291 |
+
} // endif multisite installation with super admin editing a main site role
|
292 |
+
}
|
293 |
+
|
294 |
+
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Deletes a role.
|
298 |
+
* The role comes from the $_GET['role'] var and the nonce has already been checked.
|
299 |
+
* Default WordPress role cannot be deleted and if trying to do it, throws an error.
|
300 |
+
* Users with the deleted role, are moved to the WordPress default role.
|
301 |
+
*
|
302 |
+
* @return void
|
303 |
+
*/
|
304 |
+
function adminDeleteRole ()
|
305 |
+
{
|
306 |
+
global $wpdb;
|
307 |
+
|
308 |
+
check_admin_referer('delete-role_' . $_GET['role']);
|
309 |
+
|
310 |
+
$this->cm->current = $_GET['role'];
|
311 |
+
$default = get_option('default_role');
|
312 |
+
if ( $default == $this->cm->current ) {
|
313 |
+
ak_admin_error(sprintf(__('Cannot delete default role. You <a href="%s">have to change it first</a>.', $this->cm->ID), 'options-general.php'));
|
314 |
+
return;
|
315 |
+
}
|
316 |
+
|
317 |
+
$query = "SELECT ID FROM {$wpdb->usermeta} INNER JOIN {$wpdb->users} "
|
318 |
+
. "ON {$wpdb->usermeta}.user_id = {$wpdb->users}.ID "
|
319 |
+
. "WHERE meta_key='{$wpdb->prefix}capabilities' AND meta_value LIKE '%{$this->cm->current}%';";
|
320 |
+
|
321 |
+
$users = $wpdb->get_results($query);
|
322 |
+
$count = count($users);
|
323 |
+
|
324 |
+
foreach ( $users as $u ) {
|
325 |
+
$user = new WP_User($u->ID);
|
326 |
+
if ( $user->has_cap($this->cm->current) ) { // Check again the user has the deleting role
|
327 |
+
$user->set_role($default);
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
remove_role($this->cm->current);
|
332 |
+
unset($this->cm->roles[$this->cm->current]);
|
333 |
+
|
334 |
+
if ( $customized_roles = get_option( 'pp_customized_roles' ) ) {
|
335 |
+
if ( isset( $customized_roles[$this->cm->current] ) ) {
|
336 |
+
unset( $customized_roles[$this->cm->current] );
|
337 |
+
update_option( 'pp_customized_roles', $customized_roles );
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
ak_admin_notify(sprintf(__('Role has been deleted. %1$d users moved to default role %2$s.', $this->cm->ID), $count, $this->cm->roles[$default]));
|
342 |
+
$this->cm->current = $default;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
if ( ! function_exists('boolval') ) {
|
347 |
+
function boolval( $val ) {
|
348 |
+
return (bool) $val;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
?>
|
includes/manager.php
CHANGED
@@ -31,61 +31,9 @@ include_once ( AK_CLASSES . '/abstract/plugin.php' );
|
|
31 |
add_action( 'init', 'cme_update_pp_usage' ); // update early so resulting post type cap changes are applied for this request's UI construction
|
32 |
|
33 |
function cme_update_pp_usage() {
|
34 |
-
if ( defined( 'PP_ACTIVE' ) &&
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
if ( ! empty( $_REQUEST['update_filtered_types']) ) {
|
39 |
-
// update Press Permit "Filtered Post Types". This determines whether type-specific capability definitions are forced
|
40 |
-
$options = array( 'enabled_post_types', 'enabled_taxonomies' );
|
41 |
-
|
42 |
-
foreach( $options as $option_basename ) {
|
43 |
-
if ( ! isset( $_POST["{$option_basename}-options"] ) )
|
44 |
-
continue;
|
45 |
-
|
46 |
-
$unselected = $value = array();
|
47 |
-
|
48 |
-
foreach( $_POST["{$option_basename}-options"] as $key ) {
|
49 |
-
if ( empty( $_POST["{$option_basename}-$key"] ) )
|
50 |
-
$unselected[$key] = true;
|
51 |
-
else
|
52 |
-
$value[$key] = true;
|
53 |
-
}
|
54 |
-
|
55 |
-
if ( $current = pp_get_option( $option_basename ) ) {
|
56 |
-
if ( $current = array_diff_key( $current, $unselected ) )
|
57 |
-
$value = array_merge( $value, $current ); // retain setting for any types which were previously enabled for filtering but are currently not registered
|
58 |
-
}
|
59 |
-
|
60 |
-
$value = stripslashes_deep($value);
|
61 |
-
pp_update_option( $option_basename, $value );
|
62 |
-
|
63 |
-
$updated = true;
|
64 |
-
}
|
65 |
-
|
66 |
-
if ( pp_wp_ver( '3.5' ) ) {
|
67 |
-
pp_update_option( 'define_create_posts_cap', $_REQUEST['pp_define_create_posts_cap'] );
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
if ( ! empty( $_REQUEST['SaveRole']) ) {
|
72 |
-
if ( ! empty( $_REQUEST['role'] ) ) {
|
73 |
-
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
74 |
-
|
75 |
-
if ( empty($_REQUEST['pp_only_role']) )
|
76 |
-
$pp_only = array_diff( $pp_only, array($_REQUEST['role']) );
|
77 |
-
else
|
78 |
-
$pp_only[]= $_REQUEST['role'];
|
79 |
-
|
80 |
-
pp_update_option( 'supplemental_role_defs', $pp_only );
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( $updated ) {
|
85 |
-
pp_refresh_options();
|
86 |
-
}
|
87 |
-
|
88 |
-
return $updated;
|
89 |
}
|
90 |
}
|
91 |
|
@@ -104,20 +52,20 @@ class CapabilityManager extends akPluginAbstract
|
|
104 |
* The array keys are the capability, the value is its screen name.
|
105 |
* @var array
|
106 |
*/
|
107 |
-
|
108 |
|
109 |
/**
|
110 |
* Array with roles that can be managed. (Depends on user roles).
|
111 |
* The array keys are the role name, the value is its translated name.
|
112 |
* @var array
|
113 |
*/
|
114 |
-
|
115 |
|
116 |
/**
|
117 |
* Current role we are managing
|
118 |
* @var string
|
119 |
*/
|
120 |
-
|
121 |
|
122 |
/**
|
123 |
* Maximum level current manager can assign to a user.
|
@@ -127,12 +75,18 @@ class CapabilityManager extends akPluginAbstract
|
|
127 |
|
128 |
private $log_db_role_objects = array();
|
129 |
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
/**
|
133 |
* Creates some filters at module load time.
|
134 |
*
|
135 |
-
* @see
|
136 |
*
|
137 |
* @return void
|
138 |
*/
|
@@ -156,7 +110,8 @@ class CapabilityManager extends akPluginAbstract
|
|
156 |
function log_db_roles( $passthru_roles ) {
|
157 |
global $wp_roles;
|
158 |
|
159 |
-
|
|
|
160 |
|
161 |
return $passthru_roles;
|
162 |
}
|
@@ -175,21 +130,6 @@ class CapabilityManager extends akPluginAbstract
|
|
175 |
|
176 |
return $passthru_roles;
|
177 |
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Sets default settings values.
|
181 |
-
*
|
182 |
-
* @return void
|
183 |
-
*/
|
184 |
-
protected function defaultOptions ()
|
185 |
-
{
|
186 |
-
$this->generateSysNames();
|
187 |
-
|
188 |
-
return array(
|
189 |
-
'form-rows' => 5,
|
190 |
-
'syscaps' => $this->capabilities
|
191 |
-
);
|
192 |
-
}
|
193 |
|
194 |
/**
|
195 |
* Activates the plugin and sets the new capability 'Manage Capabilities'
|
@@ -237,12 +177,14 @@ class CapabilityManager extends akPluginAbstract
|
|
237 |
add_users_page( __('Capability Manager', $this->ID), __('Capabilities', $this->ID), 'manage_capabilities', $this->ID, array($this, 'generalManager'));
|
238 |
}
|
239 |
|
240 |
-
|
|
|
241 |
}
|
242 |
|
243 |
public function pp_menu() {
|
244 |
-
|
245 |
-
|
|
|
246 |
}
|
247 |
|
248 |
/**
|
@@ -250,7 +192,7 @@ class CapabilityManager extends akPluginAbstract
|
|
250 |
*
|
251 |
* @return void
|
252 |
*/
|
253 |
-
|
254 |
{
|
255 |
$admin = get_role('administrator');
|
256 |
$admin->add_cap('manage_capabilities');
|
@@ -294,7 +236,7 @@ class CapabilityManager extends akPluginAbstract
|
|
294 |
*/
|
295 |
function filterUserEdit ( $caps, $cap, $user_id, $args )
|
296 |
{
|
297 |
-
if ( ( 'edit_user'
|
298 |
return $caps;
|
299 |
}
|
300 |
|
@@ -355,8 +297,9 @@ class CapabilityManager extends akPluginAbstract
|
|
355 |
$roles = array_keys($this->roles);
|
356 |
|
357 |
if ( isset($_GET['action']) && 'delete' == $_GET['action']) {
|
358 |
-
|
359 |
-
$this
|
|
|
360 |
}
|
361 |
|
362 |
if ( ! in_array($this->current, $roles) ) { // Current role has been deleted.
|
@@ -366,32 +309,6 @@ class CapabilityManager extends akPluginAbstract
|
|
366 |
include ( AK_CMAN_LIB . '/admin.php' );
|
367 |
}
|
368 |
|
369 |
-
/**
|
370 |
-
* Manages backup, restore and resset roles and capabilities
|
371 |
-
*
|
372 |
-
* @hook add_management_page
|
373 |
-
* @return void
|
374 |
-
*/
|
375 |
-
function backupTool ()
|
376 |
-
{
|
377 |
-
if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
|
378 |
-
// TODO: Implement exceptions.
|
379 |
-
wp_die('<strong>' .__('What do you think you\'re doing?!?', $this->ID) . '</strong>');
|
380 |
-
}
|
381 |
-
|
382 |
-
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
383 |
-
check_admin_referer('capsman-backup-tool');
|
384 |
-
$this->processBackupTool();
|
385 |
-
}
|
386 |
-
|
387 |
-
if ( isset($_GET['action']) && 'reset-defaults' == $_GET['action']) {
|
388 |
-
check_admin_referer('capsman-reset-defaults');
|
389 |
-
$this->backupToolReset();
|
390 |
-
}
|
391 |
-
|
392 |
-
include ( AK_CMAN_LIB . '/backup.php' );
|
393 |
-
}
|
394 |
-
|
395 |
/**
|
396 |
* Processes and saves the changes in the general capabilities form.
|
397 |
*
|
@@ -399,8 +316,6 @@ class CapabilityManager extends akPluginAbstract
|
|
399 |
*/
|
400 |
private function processAdminGeneral ()
|
401 |
{
|
402 |
-
global $wp_roles;
|
403 |
-
|
404 |
if (! isset($_POST['action']) || 'update' != $_POST['action'] ) {
|
405 |
// TODO: Implement exceptions. This must be a fatal error.
|
406 |
ak_admin_error(__('Bad form Received', $this->ID));
|
@@ -417,230 +332,13 @@ class CapabilityManager extends akPluginAbstract
|
|
417 |
// Select a new role.
|
418 |
if ( ! empty($post['LoadRole']) ) {
|
419 |
$this->current = $post['role'];
|
420 |
-
|
421 |
-
// Create a new role.
|
422 |
-
} elseif ( ! empty($post['CreateRole']) ) {
|
423 |
-
if ( $newrole = $this->createRole($post['create-name']) ) {
|
424 |
-
ak_admin_notify(__('New role created.', $this->ID));
|
425 |
-
$this->current = $newrole;
|
426 |
-
} else {
|
427 |
-
if ( empty($post['create-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
428 |
-
ak_admin_error(__('Error: No role name specified.', $this->ID));
|
429 |
-
else
|
430 |
-
ak_admin_error(__('Error: Failed creating the new role.', $this->ID));
|
431 |
-
}
|
432 |
-
|
433 |
-
// Copy current role to a new one.
|
434 |
-
} elseif ( ! empty($post['CopyRole']) ) {
|
435 |
-
$current = get_role($post['current']);
|
436 |
-
if ( $newrole = $this->createRole($post['copy-name'], $current->capabilities) ) {
|
437 |
-
ak_admin_notify(__('New role created.', $this->ID));
|
438 |
-
$this->current = $newrole;
|
439 |
-
} else {
|
440 |
-
if ( empty($post['copy-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
441 |
-
ak_admin_error(__('Error: No role name specified.', $this->ID));
|
442 |
-
else
|
443 |
-
ak_admin_error(__('Error: Failed creating the new role.', $this->ID));
|
444 |
-
}
|
445 |
-
|
446 |
-
// Save role changes. Already saved at start with self::saveRoleCapabilities().
|
447 |
-
} elseif ( ! empty($post['SaveRole']) ) {
|
448 |
-
if ( MULTISITE ) {
|
449 |
-
global $wp_roles;
|
450 |
-
if ( method_exists( $wp_roles, 'reinit' ) )
|
451 |
-
$wp_roles->reinit();
|
452 |
-
}
|
453 |
-
|
454 |
-
$this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
|
455 |
-
|
456 |
-
if ( defined( 'PP_ACTIVE' ) ) { // log customized role caps for subsequent restoration
|
457 |
-
if ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) {
|
458 |
-
// for bbPress < 2.2, need to log customization of roles following bbPress activation
|
459 |
-
$plugins = get_option('active_plugins');
|
460 |
-
foreach( $plugins as $key => $plugin ) {
|
461 |
-
if ( false === strpos($plugin, 'bbpress.php' ) )
|
462 |
-
unset( $plugins[$key] ); // reduce storage size
|
463 |
-
}
|
464 |
-
} else {
|
465 |
-
$plugins = array(); // back compat
|
466 |
-
}
|
467 |
-
|
468 |
-
if ( ! $customized_roles = get_option( 'pp_customized_roles' ) )
|
469 |
-
$customized_roles = array();
|
470 |
-
|
471 |
-
$customized_roles[$post['role']] = (object) array( 'caps' => $post['caps'], 'plugins' => $plugins );
|
472 |
-
update_option( 'pp_customized_roles', $customized_roles );
|
473 |
-
|
474 |
-
global $wpdb;
|
475 |
-
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
|
476 |
-
}
|
477 |
-
// Create New Capability and adds it to current role.
|
478 |
-
} elseif ( ! empty($post['AddCap']) ) {
|
479 |
-
if ( MULTISITE ) {
|
480 |
-
global $wp_roles;
|
481 |
-
if ( method_exists( $wp_roles, 'reinit' ) )
|
482 |
-
$wp_roles->reinit();
|
483 |
-
}
|
484 |
-
|
485 |
-
$role = get_role($post['current']);
|
486 |
-
$role->name = $post['current']; // bbPress workaround
|
487 |
-
|
488 |
-
if ( $newname = $this->createNewName($post['capability-name']) ) {
|
489 |
-
$role->add_cap($newname['name']);
|
490 |
-
$this->message = __('New capability added to role.');
|
491 |
-
|
492 |
-
if ( ! $customized_roles = get_option( 'pp_customized_roles' ) )
|
493 |
-
$customized_roles = array();
|
494 |
-
|
495 |
-
$customized_roles[$post['role']] = (object) array( 'caps' => array_merge( $role->capabilities, array( $newname['name'] => 1 ) ), 'plugins' => $plugins );
|
496 |
-
update_option( 'pp_customized_roles', $customized_roles );
|
497 |
-
|
498 |
-
global $wpdb;
|
499 |
-
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
|
500 |
-
} else {
|
501 |
-
$this->message = __('Incorrect capability name.');
|
502 |
-
}
|
503 |
-
|
504 |
-
} elseif ( ! empty($post['update_filtered_types']) ) {
|
505 |
-
if ( cme_update_pp_usage() ) {
|
506 |
-
ak_admin_notify(__('Capability settings saved.', $this->ID));
|
507 |
-
} else {
|
508 |
-
ak_admin_error(__('Error saving capability settings.', $this->ID));
|
509 |
-
}
|
510 |
} else {
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
if ( ! empty($newrole) && defined('PP_ACTIVE') ) {
|
516 |
-
if ( ( ! empty($post['CreateRole']) && ! empty( $_REQUEST['new_role_pp_only'] ) ) || ( ! empty($post['CopyRole']) && ! empty( $_REQUEST['copy_role_pp_only'] ) ) ) {
|
517 |
-
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
518 |
-
$pp_only[]= $newrole;
|
519 |
-
pp_update_option( 'supplemental_role_defs', $pp_only );
|
520 |
-
pp_refresh_options();
|
521 |
-
}
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
/**
|
526 |
-
* Processes backups and restores.
|
527 |
-
*
|
528 |
-
* @return void
|
529 |
-
*/
|
530 |
-
private function processBackupTool ()
|
531 |
-
{
|
532 |
-
if ( isset($_POST['Perform']) ) {
|
533 |
-
global $wpdb;
|
534 |
-
$wp_roles = $wpdb->prefix . 'user_roles';
|
535 |
-
$cm_roles = $this->ID . '_backup';
|
536 |
-
|
537 |
-
switch ( $_POST['action'] ) {
|
538 |
-
case 'backup':
|
539 |
-
$roles = get_option($wp_roles);
|
540 |
-
update_option($cm_roles, $roles);
|
541 |
-
ak_admin_notify(__('New backup saved.', $this->ID));
|
542 |
-
break;
|
543 |
-
case 'restore':
|
544 |
-
$roles = get_option($cm_roles);
|
545 |
-
if ( $roles ) {
|
546 |
-
update_option($wp_roles, $roles);
|
547 |
-
ak_admin_notify(__('Roles and Capabilities restored from last backup.', $this->ID));
|
548 |
-
} else {
|
549 |
-
ak_admin_error(__('Restore failed. No backup found.', $this->ID));
|
550 |
-
}
|
551 |
-
break;
|
552 |
-
}
|
553 |
}
|
554 |
}
|
555 |
-
|
556 |
-
/**
|
557 |
-
* Deletes a role.
|
558 |
-
* The role comes from the $_GET['role'] var and the nonce has already been checked.
|
559 |
-
* Default WordPress role cannot be deleted and if trying to do it, throws an error.
|
560 |
-
* Users with the deleted role, are moved to the WordPress default role.
|
561 |
-
*
|
562 |
-
* @return void
|
563 |
-
*/
|
564 |
-
private function adminDeleteRole ()
|
565 |
-
{
|
566 |
-
global $wpdb;
|
567 |
-
|
568 |
-
$this->current = $_GET['role'];
|
569 |
-
$default = get_option('default_role');
|
570 |
-
if ( $default == $this->current ) {
|
571 |
-
ak_admin_error(sprintf(__('Cannot delete default role. You <a href="%s">have to change it first</a>.', $this->ID), 'options-general.php'));
|
572 |
-
return;
|
573 |
-
}
|
574 |
-
|
575 |
-
$query = "SELECT ID FROM {$wpdb->usermeta} INNER JOIN {$wpdb->users} "
|
576 |
-
. "ON {$wpdb->usermeta}.user_id = {$wpdb->users}.ID "
|
577 |
-
. "WHERE meta_key='{$wpdb->prefix}capabilities' AND meta_value LIKE '%{$this->current}%';";
|
578 |
-
|
579 |
-
$users = $wpdb->get_results($query);
|
580 |
-
$count = count($users);
|
581 |
-
|
582 |
-
foreach ( $users as $u ) {
|
583 |
-
$user = new WP_User($u->ID);
|
584 |
-
if ( $user->has_cap($this->current) ) { // Check again the user has the deleting role
|
585 |
-
$user->set_role($default);
|
586 |
-
}
|
587 |
-
}
|
588 |
-
|
589 |
-
remove_role($this->current);
|
590 |
-
unset($this->roles[$this->current]);
|
591 |
-
|
592 |
-
if ( $customized_roles = get_option( 'pp_customized_roles' ) ) {
|
593 |
-
if ( isset( $customized_roles[$this->current] ) ) {
|
594 |
-
unset( $customized_roles[$this->current] );
|
595 |
-
update_option( 'pp_customized_roles', $customized_roles );
|
596 |
-
}
|
597 |
-
}
|
598 |
-
|
599 |
-
ak_admin_notify(sprintf(__('Role has been deleted. %1$d users moved to default role %2$s.', $this->ID), $count, $this->roles[$default]));
|
600 |
-
$this->current = $default;
|
601 |
-
}
|
602 |
-
|
603 |
-
/**
|
604 |
-
* Resets roles to WordPress defaults.
|
605 |
-
*
|
606 |
-
* @return void
|
607 |
-
*/
|
608 |
-
private function backupToolReset ()
|
609 |
-
{
|
610 |
-
require_once(ABSPATH . 'wp-admin/includes/schema.php');
|
611 |
-
|
612 |
-
if ( ! function_exists('populate_roles') ) {
|
613 |
-
ak_admin_error(__('Needed function to create default roles not found!', $this->ID));
|
614 |
-
return;
|
615 |
-
}
|
616 |
-
|
617 |
-
$roles = array_keys($this->roles);
|
618 |
-
foreach ( $roles as $role) {
|
619 |
-
remove_role($role);
|
620 |
-
}
|
621 |
-
|
622 |
-
populate_roles();
|
623 |
-
$this->setAdminCapability();
|
624 |
-
|
625 |
-
$msg = __('Roles and Capabilities reset to WordPress defaults', $this->ID);
|
626 |
-
|
627 |
-
if ( function_exists( 'pp_populate_roles' ) ) {
|
628 |
-
pp_populate_roles();
|
629 |
-
} else {
|
630 |
-
// force PP to repopulate roles
|
631 |
-
if ( $pp_ver = get_option( 'pp_version', true ) ) {
|
632 |
-
$pp_ver['version'] = ( preg_match( "/dev|alpha|beta|rc/i", $pp_ver['version'] ) ) ? '0.1-beta' : 0.1;
|
633 |
-
} else {
|
634 |
-
$pp_ver = array( 'version' => '0.1', 'db_version' => '1.0' );
|
635 |
-
}
|
636 |
-
|
637 |
-
update_option( 'pp_version', $pp_ver );
|
638 |
-
delete_option( 'ppperm_added_role_caps_10beta' );
|
639 |
-
}
|
640 |
-
|
641 |
-
ak_admin_notify($msg);
|
642 |
-
}
|
643 |
-
|
644 |
/**
|
645 |
* Callback function to create names.
|
646 |
* Replaces underscores by spaces and uppercases the first letter.
|
@@ -664,7 +362,7 @@ class CapabilityManager extends akPluginAbstract
|
|
664 |
* @uses self::_capNamesCB()
|
665 |
* @return void
|
666 |
*/
|
667 |
-
|
668 |
{
|
669 |
$this->max_level = 10;
|
670 |
$this->roles = ak_get_roles(true);
|
@@ -672,18 +370,13 @@ class CapabilityManager extends akPluginAbstract
|
|
672 |
|
673 |
foreach ( array_keys($this->roles) as $role ) {
|
674 |
$role_caps = get_role($role);
|
675 |
-
$caps = array_merge( $caps, $role_caps->capabilities ); // user reported PHP 5.3.3 error without array cast
|
676 |
}
|
677 |
|
678 |
$keys = array_keys($caps);
|
679 |
$names = array_map(array($this, '_capNamesCB'), $keys);
|
680 |
$this->capabilities = array_combine($keys, $names);
|
681 |
|
682 |
-
$sys_caps = $this->getOption('syscaps');
|
683 |
-
if ( is_array($sys_caps) ) {
|
684 |
-
$this->capabilities = array_merge($sys_caps, $this->capabilities);
|
685 |
-
}
|
686 |
-
|
687 |
asort($this->capabilities);
|
688 |
}
|
689 |
|
@@ -696,7 +389,7 @@ class CapabilityManager extends akPluginAbstract
|
|
696 |
* @uses self::_capNamesCB()
|
697 |
* @return void
|
698 |
*/
|
699 |
-
|
700 |
{
|
701 |
if ( current_user_can('administrator') ) {
|
702 |
$this->generateSysNames();
|
@@ -704,10 +397,11 @@ class CapabilityManager extends akPluginAbstract
|
|
704 |
global $user_ID;
|
705 |
$user = new WP_User($user_ID);
|
706 |
$this->max_level = ak_caps2level($user->allcaps);
|
707 |
-
|
708 |
$keys = array_keys($user->allcaps);
|
709 |
$names = array_map(array($this, '_capNamesCB'), $keys);
|
710 |
-
|
|
|
711 |
|
712 |
$roles = ak_get_roles(true);
|
713 |
unset($roles['administrator']);
|
@@ -732,111 +426,30 @@ class CapabilityManager extends akPluginAbstract
|
|
732 |
}
|
733 |
|
734 |
/**
|
735 |
-
*
|
736 |
-
* Name rules are:
|
737 |
-
* - 2-40 charachers lenght.
|
738 |
-
* - Only letters, digits, spaces and underscores.
|
739 |
-
* - Must to start with a letter.
|
740 |
-
*
|
741 |
-
* @param string $name Name from user input.
|
742 |
-
* @return array|false An array with the name and display_name, or false if not valid $name.
|
743 |
-
*/
|
744 |
-
private function createNewName( $name ) {
|
745 |
-
// Allow max 40 characters, letters, digits and spaces
|
746 |
-
$name = trim(substr($name, 0, 40));
|
747 |
-
$pattern = '/^[a-zA-Z][a-zA-Z0-9 _]+$/';
|
748 |
-
|
749 |
-
if ( preg_match($pattern, $name) ) {
|
750 |
-
$roles = ak_get_roles();
|
751 |
-
|
752 |
-
$name = strtolower($name);
|
753 |
-
$name = str_replace(' ', '_', $name);
|
754 |
-
if ( in_array($name, $roles) || array_key_exists($name, $this->capabilities) ) {
|
755 |
-
return false; // Already a role or capability with this name.
|
756 |
-
}
|
757 |
-
|
758 |
-
$display = explode('_', $name);
|
759 |
-
$display = array_map('ucfirst', $display);
|
760 |
-
$display = implode(' ', $display);
|
761 |
-
|
762 |
-
return compact('name', 'display');
|
763 |
-
} else {
|
764 |
-
return false;
|
765 |
-
}
|
766 |
-
}
|
767 |
-
|
768 |
-
/**
|
769 |
-
* Creates a new role.
|
770 |
*
|
771 |
-
* @
|
772 |
-
* @
|
773 |
-
* @return string|false Returns the name of the new role created or false if failed.
|
774 |
*/
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
if ( ! is_array($role) ) {
|
781 |
-
return false;
|
782 |
-
}
|
783 |
-
|
784 |
-
$new_role = add_role($role['name'], $role['display'], $caps);
|
785 |
-
if ( is_object($new_role) ) {
|
786 |
-
return $role['name'];
|
787 |
-
} else {
|
788 |
-
return false;
|
789 |
}
|
790 |
-
}
|
791 |
-
|
792 |
-
/**
|
793 |
-
* Saves capability changes to roles.
|
794 |
-
*
|
795 |
-
* @param string $role_name Role name to change its capabilities
|
796 |
-
* @param array $caps New capabilities for the role.
|
797 |
-
* @return void
|
798 |
-
*/
|
799 |
-
private function saveRoleCapabilities( $role_name, $caps, $level ) {
|
800 |
-
$this->generateNames();
|
801 |
-
$role = get_role($role_name);
|
802 |
-
|
803 |
-
// workaround to ensure db storage of customizations to bbp dynamic roles
|
804 |
-
$role->name = $role_name;
|
805 |
-
|
806 |
-
$stored_role_caps = ( ! empty($role->capabilities) && is_array($role->capabilities) ) ? array_intersect( $role->capabilities, array(true, 1) ) : array();
|
807 |
-
|
808 |
-
$old_caps = array_intersect_key( $stored_role_caps, $this->capabilities);
|
809 |
-
$new_caps = ( is_array($caps) ) ? array_map('intval', $caps) : array();
|
810 |
-
$new_caps = array_merge($new_caps, ak_level2caps($level));
|
811 |
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
if ( ! $is_administrator = current_user_can('administrator') ) {
|
817 |
-
unset($add_caps['manage_capabilities']);
|
818 |
-
unset($del_caps['manage_capabilities']);
|
819 |
}
|
820 |
|
821 |
-
if ( '
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
// Add new capabilities to role
|
826 |
-
foreach ( $add_caps as $cap => $grant ) {
|
827 |
-
if ( $is_administrator || current_user_can($cap) )
|
828 |
-
$role->add_cap($cap);
|
829 |
}
|
830 |
|
831 |
-
|
832 |
-
foreach ( $del_caps as $cap => $grant) {
|
833 |
-
if ( $is_administrator || current_user_can($cap) )
|
834 |
-
$role->remove_cap($cap);
|
835 |
-
}
|
836 |
}
|
837 |
-
|
838 |
-
protected function pluginDeactivate() {}
|
839 |
-
protected function pluginsLoaded() {}
|
840 |
-
protected function registerWidgets() {}
|
841 |
-
public function wpInit() {}
|
842 |
}
|
31 |
add_action( 'init', 'cme_update_pp_usage' ); // update early so resulting post type cap changes are applied for this request's UI construction
|
32 |
|
33 |
function cme_update_pp_usage() {
|
34 |
+
if ( defined( 'PP_ACTIVE' ) && ( ! empty($_REQUEST['update_filtered_types']) || ! empty($_REQUEST['SaveRole']) ) ) {
|
35 |
+
require_once( dirname(__FILE__).'/pp-handler.php' );
|
36 |
+
return _cme_update_pp_usage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
}
|
39 |
|
52 |
* The array keys are the capability, the value is its screen name.
|
53 |
* @var array
|
54 |
*/
|
55 |
+
var $capabilities = array();
|
56 |
|
57 |
/**
|
58 |
* Array with roles that can be managed. (Depends on user roles).
|
59 |
* The array keys are the role name, the value is its translated name.
|
60 |
* @var array
|
61 |
*/
|
62 |
+
var $roles = array();
|
63 |
|
64 |
/**
|
65 |
* Current role we are managing
|
66 |
* @var string
|
67 |
*/
|
68 |
+
var $current;
|
69 |
|
70 |
/**
|
71 |
* Maximum level current manager can assign to a user.
|
75 |
|
76 |
private $log_db_role_objects = array();
|
77 |
|
78 |
+
var $message;
|
79 |
+
|
80 |
+
function __construct( $mod_file, $ID = '' ) {
|
81 |
+
$this->ID = 'capsman';
|
82 |
+
|
83 |
+
parent::__construct( $mod_file, $ID );
|
84 |
+
}
|
85 |
|
86 |
/**
|
87 |
* Creates some filters at module load time.
|
88 |
*
|
89 |
+
* @see akPluginAbstract#moduleLoad()
|
90 |
*
|
91 |
* @return void
|
92 |
*/
|
110 |
function log_db_roles( $passthru_roles ) {
|
111 |
global $wp_roles;
|
112 |
|
113 |
+
if ( isset($wp_roles) )
|
114 |
+
$this->log_db_role_objects = $wp_roles->role_objects;
|
115 |
|
116 |
return $passthru_roles;
|
117 |
}
|
130 |
|
131 |
return $passthru_roles;
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
/**
|
135 |
* Activates the plugin and sets the new capability 'Manage Capabilities'
|
177 |
add_users_page( __('Capability Manager', $this->ID), __('Capabilities', $this->ID), 'manage_capabilities', $this->ID, array($this, 'generalManager'));
|
178 |
}
|
179 |
|
180 |
+
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
|
181 |
+
add_management_page(__('Capability Manager', $this->ID), __('Capability Manager', $this->ID), $cap_name, $this->ID . '-tool', array($this, 'backupTool'));
|
182 |
}
|
183 |
|
184 |
public function pp_menu() {
|
185 |
+
global $pp_admin;
|
186 |
+
$menu_caption = ( defined('WPLANG') && WPLANG ) ? __('Capabilities', $this->ID) : 'Role Capabilities';
|
187 |
+
add_submenu_page( $pp_admin->get_menu('options'), __('Capability Manager', $this->ID), $menu_caption, 'manage_capabilities', $this->ID, array($this, 'generalManager') );
|
188 |
}
|
189 |
|
190 |
/**
|
192 |
*
|
193 |
* @return void
|
194 |
*/
|
195 |
+
public function setAdminCapability ()
|
196 |
{
|
197 |
$admin = get_role('administrator');
|
198 |
$admin->add_cap('manage_capabilities');
|
236 |
*/
|
237 |
function filterUserEdit ( $caps, $cap, $user_id, $args )
|
238 |
{
|
239 |
+
if ( ! in_array( $cap, array( 'edit_user', 'delete_user' ) ) || ( ! isset($args[0]) ) || $user_id == (int) $args[0] ) {
|
240 |
return $caps;
|
241 |
}
|
242 |
|
297 |
$roles = array_keys($this->roles);
|
298 |
|
299 |
if ( isset($_GET['action']) && 'delete' == $_GET['action']) {
|
300 |
+
require_once( dirname(__FILE__).'/handler.php' );
|
301 |
+
$capsman_modify = new CapsmanHandler( $this );
|
302 |
+
$capsman_modify->adminDeleteRole();
|
303 |
}
|
304 |
|
305 |
if ( ! in_array($this->current, $roles) ) { // Current role has been deleted.
|
309 |
include ( AK_CMAN_LIB . '/admin.php' );
|
310 |
}
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
/**
|
313 |
* Processes and saves the changes in the general capabilities form.
|
314 |
*
|
316 |
*/
|
317 |
private function processAdminGeneral ()
|
318 |
{
|
|
|
|
|
319 |
if (! isset($_POST['action']) || 'update' != $_POST['action'] ) {
|
320 |
// TODO: Implement exceptions. This must be a fatal error.
|
321 |
ak_admin_error(__('Bad form Received', $this->ID));
|
332 |
// Select a new role.
|
333 |
if ( ! empty($post['LoadRole']) ) {
|
334 |
$this->current = $post['role'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
} else {
|
336 |
+
require_once( dirname(__FILE__).'/handler.php' );
|
337 |
+
$capsman_modify = new CapsmanHandler( $this );
|
338 |
+
$capsman_modify->processAdminGeneral( $post );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
340 |
}
|
341 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
/**
|
343 |
* Callback function to create names.
|
344 |
* Replaces underscores by spaces and uppercases the first letter.
|
362 |
* @uses self::_capNamesCB()
|
363 |
* @return void
|
364 |
*/
|
365 |
+
function generateSysNames ()
|
366 |
{
|
367 |
$this->max_level = 10;
|
368 |
$this->roles = ak_get_roles(true);
|
370 |
|
371 |
foreach ( array_keys($this->roles) as $role ) {
|
372 |
$role_caps = get_role($role);
|
373 |
+
$caps = array_merge( $caps, (array) $role_caps->capabilities ); // user reported PHP 5.3.3 error without array cast
|
374 |
}
|
375 |
|
376 |
$keys = array_keys($caps);
|
377 |
$names = array_map(array($this, '_capNamesCB'), $keys);
|
378 |
$this->capabilities = array_combine($keys, $names);
|
379 |
|
|
|
|
|
|
|
|
|
|
|
380 |
asort($this->capabilities);
|
381 |
}
|
382 |
|
389 |
* @uses self::_capNamesCB()
|
390 |
* @return void
|
391 |
*/
|
392 |
+
function generateNames ()
|
393 |
{
|
394 |
if ( current_user_can('administrator') ) {
|
395 |
$this->generateSysNames();
|
397 |
global $user_ID;
|
398 |
$user = new WP_User($user_ID);
|
399 |
$this->max_level = ak_caps2level($user->allcaps);
|
400 |
+
|
401 |
$keys = array_keys($user->allcaps);
|
402 |
$names = array_map(array($this, '_capNamesCB'), $keys);
|
403 |
+
|
404 |
+
$this->capabilities = ( $keys ) ? array_combine($keys, $names) : array();
|
405 |
|
406 |
$roles = ak_get_roles(true);
|
407 |
unset($roles['administrator']);
|
426 |
}
|
427 |
|
428 |
/**
|
429 |
+
* Manages backup, restore and resset roles and capabilities
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
*
|
431 |
+
* @hook add_management_page
|
432 |
+
* @return void
|
|
|
433 |
*/
|
434 |
+
function backupTool ()
|
435 |
+
{
|
436 |
+
if ( ! current_user_can('restore_roles') && ! is_super_admin() ) {
|
437 |
+
// TODO: Implement exceptions.
|
438 |
+
wp_die('<strong>' .__('What do you think you\'re doing?!?', $this->ID) . '</strong>');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
+
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
442 |
+
require_once( dirname(__FILE__).'/backup-handler.php' );
|
443 |
+
$cme_backup_handler = new Capsman_BackupHandler( $this );
|
444 |
+
$cme_backup_handler->processBackupTool();
|
|
|
|
|
|
|
445 |
}
|
446 |
|
447 |
+
if ( isset($_GET['action']) && 'reset-defaults' == $_GET['action']) {
|
448 |
+
require_once( dirname(__FILE__).'/backup-handler.php' );
|
449 |
+
$cme_backup_handler = new Capsman_BackupHandler( $this );
|
450 |
+
$cme_backup_handler->backupToolReset();
|
|
|
|
|
|
|
|
|
451 |
}
|
452 |
|
453 |
+
include ( AK_CMAN_LIB . '/backup.php' );
|
|
|
|
|
|
|
|
|
454 |
}
|
|
|
|
|
|
|
|
|
|
|
455 |
}
|
includes/modify.php
ADDED
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class CapsmanHandler
|
4 |
+
{
|
5 |
+
var $cm;
|
6 |
+
|
7 |
+
function __construct( $manager_obj, $post ) {
|
8 |
+
global $wp_roles;
|
9 |
+
|
10 |
+
// Create a new role.
|
11 |
+
if ( ! empty($post['CreateRole']) ) {
|
12 |
+
if ( $newrole = $this->createRole($post['create-name']) ) {
|
13 |
+
ak_admin_notify(__('New role created.', $this->ID));
|
14 |
+
$this->current = $newrole;
|
15 |
+
} else {
|
16 |
+
if ( empty($post['create-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
17 |
+
ak_admin_error( 'Error: No role name specified.', $this->ID );
|
18 |
+
else
|
19 |
+
ak_admin_error(__('Error: Failed creating the new role.', $this->ID));
|
20 |
+
}
|
21 |
+
|
22 |
+
// Copy current role to a new one.
|
23 |
+
} elseif ( ! empty($post['CopyRole']) ) {
|
24 |
+
$current = get_role($post['current']);
|
25 |
+
if ( $newrole = $this->createRole($post['copy-name'], $current->capabilities) ) {
|
26 |
+
ak_admin_notify(__('New role created.', $this->ID));
|
27 |
+
$this->current = $newrole;
|
28 |
+
} else {
|
29 |
+
if ( empty($post['copy-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
30 |
+
ak_admin_error( 'Error: No role name specified.', $this->ID );
|
31 |
+
else
|
32 |
+
ak_admin_error(__('Error: Failed creating the new role.', $this->ID));
|
33 |
+
}
|
34 |
+
|
35 |
+
// Save role changes. Already saved at start with self::saveRoleCapabilities().
|
36 |
+
} elseif ( ! empty($post['SaveRole']) ) {
|
37 |
+
if ( MULTISITE ) {
|
38 |
+
global $wp_roles;
|
39 |
+
if ( method_exists( $wp_roles, 'reinit' ) )
|
40 |
+
$wp_roles->reinit();
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
|
44 |
+
|
45 |
+
if ( defined( 'PP_ACTIVE' ) ) { // log customized role caps for subsequent restoration
|
46 |
+
// for bbPress < 2.2, need to log customization of roles following bbPress activation
|
47 |
+
$plugins = ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) ? array( 'bbpress.php' ) : array(); // back compat
|
48 |
+
|
49 |
+
if ( ! $customized_roles = get_option( 'pp_customized_roles' ) )
|
50 |
+
$customized_roles = array();
|
51 |
+
|
52 |
+
$customized_roles[$post['role']] = (object) array( 'caps' => $post['caps'], 'plugins' => $plugins );
|
53 |
+
update_option( 'pp_customized_roles', $customized_roles );
|
54 |
+
|
55 |
+
global $wpdb;
|
56 |
+
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
|
57 |
+
}
|
58 |
+
// Create New Capability and adds it to current role.
|
59 |
+
} elseif ( ! empty($post['AddCap']) ) {
|
60 |
+
if ( MULTISITE ) {
|
61 |
+
global $wp_roles;
|
62 |
+
if ( method_exists( $wp_roles, 'reinit' ) )
|
63 |
+
$wp_roles->reinit();
|
64 |
+
}
|
65 |
+
|
66 |
+
$role = get_role($post['current']);
|
67 |
+
$role->name = $post['current']; // bbPress workaround
|
68 |
+
|
69 |
+
if ( $newname = $this->createNewName($post['capability-name']) ) {
|
70 |
+
$role->add_cap($newname['name']);
|
71 |
+
$this->message = __('New capability added to role.');
|
72 |
+
|
73 |
+
// for bbPress < 2.2, need to log customization of roles following bbPress activation
|
74 |
+
$plugins = ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) ? array( 'bbpress.php' ) : array(); // back compat
|
75 |
+
|
76 |
+
if ( ! $customized_roles = get_option( 'pp_customized_roles' ) )
|
77 |
+
$customized_roles = array();
|
78 |
+
|
79 |
+
$customized_roles[$post['role']] = (object) array( 'caps' => array_merge( $role->capabilities, array( $newname['name'] => 1 ) ), 'plugins' => $plugins );
|
80 |
+
update_option( 'pp_customized_roles', $customized_roles );
|
81 |
+
|
82 |
+
global $wpdb;
|
83 |
+
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
|
84 |
+
} else {
|
85 |
+
$this->message = __('Incorrect capability name.');
|
86 |
+
}
|
87 |
+
|
88 |
+
} elseif ( ! empty($post['update_filtered_types']) ) {
|
89 |
+
if ( cme_update_pp_usage() ) {
|
90 |
+
ak_admin_notify(__('Capability settings saved.', $this->ID));
|
91 |
+
} else {
|
92 |
+
ak_admin_error(__('Error saving capability settings.', $this->ID));
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
// TODO: Implement exceptions. This must be a fatal error.
|
96 |
+
ak_admin_error(__('Bad form received.', $this->ID));
|
97 |
+
}
|
98 |
+
|
99 |
+
if ( ! empty($newrole) && defined('PP_ACTIVE') ) {
|
100 |
+
if ( ( ! empty($post['CreateRole']) && ! empty( $_REQUEST['new_role_pp_only'] ) ) || ( ! empty($post['CopyRole']) && ! empty( $_REQUEST['copy_role_pp_only'] ) ) ) {
|
101 |
+
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
102 |
+
$pp_only[]= $newrole;
|
103 |
+
pp_update_option( 'supplemental_role_defs', $pp_only );
|
104 |
+
_cme_pp_default_pattern_role( $newrole );
|
105 |
+
pp_refresh_options();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Creates a new role/capability name from user input name.
|
113 |
+
* Name rules are:
|
114 |
+
* - 2-40 charachers lenght.
|
115 |
+
* - Only letters, digits, spaces and underscores.
|
116 |
+
* - Must to start with a letter.
|
117 |
+
*
|
118 |
+
* @param string $name Name from user input.
|
119 |
+
* @return array|false An array with the name and display_name, or false if not valid $name.
|
120 |
+
*/
|
121 |
+
private function createNewName( $name ) {
|
122 |
+
// Allow max 40 characters, letters, digits and spaces
|
123 |
+
$name = trim(substr($name, 0, 40));
|
124 |
+
$pattern = '/^[a-zA-Z][a-zA-Z0-9 _]+$/';
|
125 |
+
|
126 |
+
if ( preg_match($pattern, $name) ) {
|
127 |
+
$roles = ak_get_roles();
|
128 |
+
|
129 |
+
$name = strtolower($name);
|
130 |
+
$name = str_replace(' ', '_', $name);
|
131 |
+
if ( in_array($name, $roles) || array_key_exists($name, $this->capabilities) ) {
|
132 |
+
return false; // Already a role or capability with this name.
|
133 |
+
}
|
134 |
+
|
135 |
+
$display = explode('_', $name);
|
136 |
+
$display = array_map('ucfirst', $display);
|
137 |
+
$display = implode(' ', $display);
|
138 |
+
|
139 |
+
return compact('name', 'display');
|
140 |
+
} else {
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Creates a new role.
|
147 |
+
*
|
148 |
+
* @param string $name Role name to create.
|
149 |
+
* @param array $caps Role capabilities.
|
150 |
+
* @return string|false Returns the name of the new role created or false if failed.
|
151 |
+
*/
|
152 |
+
private function createRole( $name, $caps = array() ) {
|
153 |
+
if ( ! is_array($caps) )
|
154 |
+
$caps = array();
|
155 |
+
|
156 |
+
$role = $this->createNewName($name);
|
157 |
+
if ( ! is_array($role) ) {
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
|
161 |
+
$new_role = add_role($role['name'], $role['display'], $caps);
|
162 |
+
if ( is_object($new_role) ) {
|
163 |
+
return $role['name'];
|
164 |
+
} else {
|
165 |
+
return false;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Saves capability changes to roles.
|
171 |
+
*
|
172 |
+
* @param string $role_name Role name to change its capabilities
|
173 |
+
* @param array $caps New capabilities for the role.
|
174 |
+
* @return void
|
175 |
+
*/
|
176 |
+
private function saveRoleCapabilities( $role_name, $caps, $level ) {
|
177 |
+
$this->generateNames();
|
178 |
+
$role = get_role($role_name);
|
179 |
+
|
180 |
+
// workaround to ensure db storage of customizations to bbp dynamic roles
|
181 |
+
$role->name = $role_name;
|
182 |
+
|
183 |
+
$stored_role_caps = ( ! empty($role->capabilities) && is_array($role->capabilities) ) ? array_intersect( $role->capabilities, array(true, 1) ) : array();
|
184 |
+
|
185 |
+
$old_caps = array_intersect_key( $stored_role_caps, $this->capabilities);
|
186 |
+
$new_caps = ( is_array($caps) ) ? array_map('intval', $caps) : array();
|
187 |
+
$new_caps = array_merge($new_caps, ak_level2caps($level));
|
188 |
+
|
189 |
+
// Find caps to add and remove
|
190 |
+
$add_caps = array_diff_key($new_caps, $old_caps);
|
191 |
+
$del_caps = array_diff_key($old_caps, $new_caps);
|
192 |
+
|
193 |
+
if ( ! $is_administrator = current_user_can('administrator') ) {
|
194 |
+
unset($add_caps['manage_capabilities']);
|
195 |
+
unset($del_caps['manage_capabilities']);
|
196 |
+
}
|
197 |
+
|
198 |
+
if ( 'administrator' == $role_name && isset($del_caps['manage_capabilities']) ) {
|
199 |
+
unset($del_caps['manage_capabilities']);
|
200 |
+
ak_admin_error(__('You cannot remove Manage Capabilities from Administrators', $this->ID));
|
201 |
+
}
|
202 |
+
// Add new capabilities to role
|
203 |
+
foreach ( $add_caps as $cap => $grant ) {
|
204 |
+
if ( $is_administrator || current_user_can($cap) )
|
205 |
+
$role->add_cap($cap);
|
206 |
+
}
|
207 |
+
|
208 |
+
// Remove capabilities from role
|
209 |
+
foreach ( $del_caps as $cap => $grant) {
|
210 |
+
if ( $is_administrator || current_user_can($cap) )
|
211 |
+
$role->remove_cap($cap);
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Deletes a role.
|
219 |
+
* The role comes from the $_GET['role'] var and the nonce has already been checked.
|
220 |
+
* Default WordPress role cannot be deleted and if trying to do it, throws an error.
|
221 |
+
* Users with the deleted role, are moved to the WordPress default role.
|
222 |
+
*
|
223 |
+
* @return void
|
224 |
+
*/
|
225 |
+
private function adminDeleteRole ()
|
226 |
+
{
|
227 |
+
global $wpdb;
|
228 |
+
|
229 |
+
$this->current = $_GET['role'];
|
230 |
+
$default = get_option('default_role');
|
231 |
+
if ( $default == $this->current ) {
|
232 |
+
ak_admin_error(sprintf(__('Cannot delete default role. You <a href="%s">have to change it first</a>.', $this->ID), 'options-general.php'));
|
233 |
+
return;
|
234 |
+
}
|
235 |
+
|
236 |
+
$query = "SELECT ID FROM {$wpdb->usermeta} INNER JOIN {$wpdb->users} "
|
237 |
+
. "ON {$wpdb->usermeta}.user_id = {$wpdb->users}.ID "
|
238 |
+
. "WHERE meta_key='{$wpdb->prefix}capabilities' AND meta_value LIKE '%{$this->current}%';";
|
239 |
+
|
240 |
+
$users = $wpdb->get_results($query);
|
241 |
+
$count = count($users);
|
242 |
+
|
243 |
+
foreach ( $users as $u ) {
|
244 |
+
$user = new WP_User($u->ID);
|
245 |
+
if ( $user->has_cap($this->current) ) { // Check again the user has the deleting role
|
246 |
+
$user->set_role($default);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
remove_role($this->current);
|
251 |
+
unset($this->roles[$this->current]);
|
252 |
+
|
253 |
+
if ( $customized_roles = get_option( 'pp_customized_roles' ) ) {
|
254 |
+
if ( isset( $customized_roles[$this->current] ) ) {
|
255 |
+
unset( $customized_roles[$this->current] );
|
256 |
+
update_option( 'pp_customized_roles', $customized_roles );
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
ak_admin_notify(sprintf(__('Role has been deleted. %1$d users moved to default role %2$s.', $this->ID), $count, $this->roles[$default]));
|
261 |
+
$this->current = $default;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
?>
|
includes/network.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
add_action( 'wpmu_new_blog', '_cme_new_blog' );
|
3 |
+
function _cme_new_blog( $new_blog_id ) {
|
4 |
+
if ( $autocreate_roles = get_site_option( 'cme_autocreate_roles' ) ) {
|
5 |
+
global $wp_roles, $blog_id;
|
6 |
+
|
7 |
+
$restore_blog_id = $blog_id;
|
8 |
+
|
9 |
+
switch_to_blog( 1 );
|
10 |
+
$wp_roles->reinit();
|
11 |
+
|
12 |
+
$main_site_caps = array();
|
13 |
+
$role_captions = array();
|
14 |
+
|
15 |
+
$admin_role = $wp_roles->get_role('administrator');
|
16 |
+
$main_admin_caps = $admin_role->capabilities;
|
17 |
+
|
18 |
+
if ( defined('PP_ACTIVE') )
|
19 |
+
$main_pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
20 |
+
//$pp_only[]= $newrole;
|
21 |
+
|
22 |
+
foreach( $autocreate_roles as $role_name ) {
|
23 |
+
if ( $role = get_role( $role_name ) ) {
|
24 |
+
$main_site_caps[$role_name] = $role->capabilities;
|
25 |
+
$role_captions[$role_name] = $wp_roles->role_names[$role_name];
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
switch_to_blog($new_blog_id);
|
30 |
+
$wp_roles->reinit();
|
31 |
+
|
32 |
+
if ( defined('PP_ACTIVE') ) {
|
33 |
+
pp_refresh_options();
|
34 |
+
$blog_pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
35 |
+
}
|
36 |
+
|
37 |
+
foreach( $main_site_caps as $role_name => $caps ) {
|
38 |
+
if ( $blog_role = $wp_roles->get_role( $role_name ) ) {
|
39 |
+
$stored_role_caps = ( ! empty($blog_role->capabilities) && is_array($blog_role->capabilities) ) ? array_intersect( $blog_role->capabilities, array(true, 1) ) : array();
|
40 |
+
|
41 |
+
// Find caps to add and remove
|
42 |
+
$add_caps = array_diff_key($caps, $stored_role_caps);
|
43 |
+
$del_caps = array_intersect_key( array_diff_key($stored_role_caps, $caps), $main_admin_caps ); // don't mess with caps that are totally unused on main site
|
44 |
+
|
45 |
+
// Add new capabilities to role
|
46 |
+
foreach ( $add_caps as $cap => $grant )
|
47 |
+
$blog_role->add_cap($cap);
|
48 |
+
|
49 |
+
// Remove capabilities from role
|
50 |
+
foreach ( $del_caps as $cap => $grant)
|
51 |
+
$blog_role->remove_cap($cap);
|
52 |
+
} else {
|
53 |
+
$wp_roles->add_role( $role_name, $role_captions[$role_name], $caps );
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( in_array( $role_name, $main_pp_only ) ) {
|
57 |
+
_cme_pp_default_pattern_role( $role_name );
|
58 |
+
$blog_pp_only []= $role_name;
|
59 |
+
} else
|
60 |
+
array_diff( $blog_pp_only, array( $role_name ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( defined('PP_ACTIVE') )
|
64 |
+
pp_update_option( 'supplemental_role_defs', $blog_pp_only );
|
65 |
+
|
66 |
+
switch_to_blog($restore_blog_id);
|
67 |
+
$wp_roles->reinit();
|
68 |
+
|
69 |
+
if ( defined('PP_ACTIVE') )
|
70 |
+
pp_refresh_options();
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
?>
|
includes/pp-handler.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function _cme_update_pp_usage() {
|
4 |
+
static $updated;
|
5 |
+
if ( ! empty($updated) ) { return true; }
|
6 |
+
|
7 |
+
if ( ! current_user_can( 'pp_manage_settings' ) )
|
8 |
+
return false;
|
9 |
+
|
10 |
+
if ( ! empty( $_REQUEST['update_filtered_types']) ) {
|
11 |
+
// update Press Permit "Filtered Post Types". This determines whether type-specific capability definitions are forced
|
12 |
+
$options = array( 'enabled_post_types', 'enabled_taxonomies' );
|
13 |
+
|
14 |
+
foreach( $options as $option_basename ) {
|
15 |
+
if ( ! isset( $_POST["{$option_basename}-options"] ) )
|
16 |
+
continue;
|
17 |
+
|
18 |
+
$unselected = array();
|
19 |
+
$value = array();
|
20 |
+
|
21 |
+
foreach( $_POST["{$option_basename}-options"] as $key ) {
|
22 |
+
if ( empty( $_POST["{$option_basename}-$key"] ) )
|
23 |
+
$unselected[$key] = true;
|
24 |
+
else
|
25 |
+
$value[$key] = true;
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( $current = pp_get_option( $option_basename ) ) {
|
29 |
+
if ( $current = array_diff_key( $current, $unselected ) )
|
30 |
+
$value = array_merge( $current, $value ); // retain setting for any types which were previously enabled for filtering but are currently not registered
|
31 |
+
}
|
32 |
+
|
33 |
+
$value = stripslashes_deep($value);
|
34 |
+
pp_update_option( $option_basename, $value );
|
35 |
+
|
36 |
+
$updated = true;
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( pp_wp_ver( '3.5' ) ) {
|
40 |
+
pp_update_option( 'define_create_posts_cap', ! empty($_REQUEST['pp_define_create_posts_cap']) );
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( ! empty( $_REQUEST['SaveRole']) ) {
|
45 |
+
if ( ! empty( $_REQUEST['role'] ) ) {
|
46 |
+
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
47 |
+
|
48 |
+
if ( empty($_REQUEST['pp_only_role']) )
|
49 |
+
$pp_only = array_diff( $pp_only, array($_REQUEST['role']) );
|
50 |
+
else
|
51 |
+
$pp_only[]= $_REQUEST['role'];
|
52 |
+
|
53 |
+
pp_update_option( 'supplemental_role_defs', array_unique($pp_only) );
|
54 |
+
_cme_pp_default_pattern_role( $_REQUEST['role'] );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( $updated ) {
|
59 |
+
pp_refresh_options();
|
60 |
+
}
|
61 |
+
|
62 |
+
return $updated;
|
63 |
+
}
|
64 |
+
|
65 |
+
?>
|
includes/pp-ui.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Capsman_PP_UI {
|
4 |
+
|
5 |
+
function __construct() {
|
6 |
+
|
7 |
+
}
|
8 |
+
|
9 |
+
function get_metagroup_caps( $default ) {
|
10 |
+
global $wpdb;
|
11 |
+
|
12 |
+
if ( defined( 'PPC_VERSION' ) )
|
13 |
+
$pp_supplemental_roles = $wpdb->get_col( "SELECT role_name FROM $wpdb->ppc_roles AS r INNER JOIN $wpdb->pp_groups AS g ON g.ID = r.agent_id AND r.agent_type = 'pp_group' WHERE g.metagroup_type = 'wp_role' AND g.metagroup_id = '$default'" );
|
14 |
+
else
|
15 |
+
$pp_supplemental_roles = $wpdb->get_col( "SELECT role_name FROM $wpdb->pp_roles AS r INNER JOIN $wpdb->pp_groups AS g ON g.ID = r.group_id AND r.group_type = 'pp_group' AND r.scope = 'site' WHERE g.metagroup_type = 'wp_role' AND g.metagroup_id = '$default'" );
|
16 |
+
|
17 |
+
$pp_filtered_types = pp_get_enabled_types('post');
|
18 |
+
$pp_metagroup_caps = array();
|
19 |
+
$pp_cap_caster = pp_init_cap_caster();
|
20 |
+
|
21 |
+
foreach( $pp_supplemental_roles as $_role_name ) {
|
22 |
+
$role_specs = explode( ':', $_role_name );
|
23 |
+
if ( empty($role_specs[2]) || ! in_array( $role_specs[2], $pp_filtered_types ) )
|
24 |
+
continue;
|
25 |
+
|
26 |
+
// add all type-specific caps whose base property cap is included in this pattern role
|
27 |
+
// i.e. If 'edit_posts' is in the pattern role, grant $type_obj->cap->edit_posts
|
28 |
+
$pp_metagroup_caps = array_merge( $pp_metagroup_caps, array_fill_keys( $pp_cap_caster->get_typecast_caps( $_role_name, 'site' ), true ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
return $pp_metagroup_caps;
|
32 |
+
}
|
33 |
+
|
34 |
+
function show_capability_hints( $default ) {
|
35 |
+
if ( pp_get_option('display_hints') ) {
|
36 |
+
$cme_id = 'capsman';
|
37 |
+
|
38 |
+
echo '<ul class="ul-disc" style="margin-top:10px"><li>';
|
39 |
+
|
40 |
+
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PPC_VERSION' ) || in_array( $default, array( 'subscriber', 'contributor', 'author', 'editor' ) ) ) {
|
41 |
+
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PPC_VERSION' ) ) {
|
42 |
+
if ( pp_get_option( 'advanced_options' ) )
|
43 |
+
$parenthetical = ' (' . sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'pp' ), "<a href='" . admin_url('admin.php?page=pp-role-usage') . "'>", '</a>' ) . ')';
|
44 |
+
else
|
45 |
+
$parenthetical = ' (' . sprintf( __( 'activate %1$sAdvanced settings%2$s, see Role Usage', 'pp' ), "<a href='" . admin_url('admin.php?page=pp-settings&pp_tab=advanced') . "'>", '</a>' ). ')';
|
46 |
+
} else
|
47 |
+
$parenthetical = '';
|
48 |
+
|
49 |
+
if ( defined( 'PPC_VERSION' ) )
|
50 |
+
printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permission Groups%s.', $cme_id ), $parenthetical ) ;
|
51 |
+
else
|
52 |
+
printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permit Groups%s.', $cme_id ), $parenthetical ) ;
|
53 |
+
echo '</li>';
|
54 |
+
}
|
55 |
+
|
56 |
+
$status_hint = '';
|
57 |
+
if ( defined( 'PPC_VERSION' ) )
|
58 |
+
if ( defined( 'PPS_VERSION' ) )
|
59 |
+
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added here (see Post Statuses > Status > Capability Mapping for applicable names). However, it is usually more convenient to use Permission Groups to assign a supplemental status-specific role.', $cme_id ), "<a href='" . admin_url('?page=pp-role-usage') . "'>", '</a>' ) ;
|
60 |
+
elseif ( pp_get_option( 'display_extension_hints' ) )
|
61 |
+
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added here. Or activate the PP Custom Post Statuses extension to assign status-specific supplemental roles.', $cme_id ), "<a href='" . admin_url('?page=pp-role-usage') . "'>", '</a>' ) ;
|
62 |
+
|
63 |
+
elseif ( defined( 'PP_VERSION' ) )
|
64 |
+
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added to a role here (see Conditions > Status > Capability Mapping for applicable names). However, it is usually more convenient to use Permit Groups to assign a supplemental status-specific role.', $cme_id ), "<a href='" . admin_url('?page=pp-role-usage') . "'>", '</a>' ) ;
|
65 |
+
|
66 |
+
if ( $status_hint )
|
67 |
+
echo "<li>$status_hint</li>";
|
68 |
+
|
69 |
+
echo '</ul>';
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
function pp_only_roles_ui( $default ) {
|
74 |
+
$support_pp_only_roles = defined('PPC_VERSION') || version_compare( PP_VERSION, '1.0-beta1.4', '>=');
|
75 |
+
?>
|
76 |
+
|
77 |
+
<?php if ( $support_pp_only_roles && ! in_array( $default, array( /*'subscriber', 'contributor', 'author', 'editor',*/ 'administrator' ) ) ) : ?>
|
78 |
+
<div style="float:right">
|
79 |
+
<?php
|
80 |
+
pp_refresh_options();
|
81 |
+
$pp_only = (array) pp_get_option( 'supplemental_role_defs' );
|
82 |
+
$checked = ( in_array( $default, $pp_only ) ) ? 'checked="checked"': '';
|
83 |
+
?>
|
84 |
+
<label for="pp_only_role" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'pp');?>"><input type="checkbox" name="pp_only_role" id="pp_only_role" value="1" <?php echo $checked;?>> <?php _e('hidden role', 'pp'); ?> </label>
|
85 |
+
</div>
|
86 |
+
<?php endif; ?>
|
87 |
+
<?php
|
88 |
+
return $support_pp_only_roles;
|
89 |
+
}
|
90 |
+
|
91 |
+
function pp_types_ui( $defined ) {
|
92 |
+
if ( current_user_can( 'pp_manage_settings' ) ) :?>
|
93 |
+
<dl>
|
94 |
+
<dt><?php _e('Force Type-Specific Capabilities', 'capsman'); ?></dt>
|
95 |
+
<dd style="text-align:center;">
|
96 |
+
<?php
|
97 |
+
$caption = __( 'Force unique capability names for:', 'capsman' );
|
98 |
+
echo "<p>$caption</p>";
|
99 |
+
|
100 |
+
if ( pp_get_option( 'display_hints' ) ) :?>
|
101 |
+
<div class="cme-subtext" style="margin-top:0">
|
102 |
+
<?php _e( '(PP Filtered Post Types, Taxonomies)', 'capsman' );?>
|
103 |
+
</div>
|
104 |
+
<?php endif;
|
105 |
+
|
106 |
+
echo "<table style='width:100%'><tr>";
|
107 |
+
|
108 |
+
$unfiltered['type'] = apply_filters( 'pp_unfiltered_post_types', array('forum','topic','reply') ); // bbPress' dynamic role def requires additional code to enforce stored caps
|
109 |
+
$unfiltered['taxonomy'] = apply_filters( 'pp_unfiltered_taxonomies', array( 'post_status', 'topic-tag' ) ); // avoid confusion with Edit Flow administrative taxonomy
|
110 |
+
$hidden['type'] = apply_filters( 'pp_hidden_post_types', array() );
|
111 |
+
$hidden['taxonomy'] = apply_filters( 'pp_hidden_taxonomies', array() );
|
112 |
+
|
113 |
+
foreach( array_keys($defined) as $item_type ) {
|
114 |
+
echo '<td style="width:50%">';
|
115 |
+
$option_name = ( 'taxonomy' == $item_type ) ? 'enabled_taxonomies' : 'enabled_post_types';
|
116 |
+
|
117 |
+
$enabled = pp_get_option( $option_name );
|
118 |
+
|
119 |
+
foreach( $defined[$item_type] as $key => $type_obj ) {
|
120 |
+
if ( ! $key )
|
121 |
+
continue;
|
122 |
+
|
123 |
+
if ( in_array( $key, $unfiltered[$item_type] ) )
|
124 |
+
continue;
|
125 |
+
|
126 |
+
$id = "$option_name-" . $key;
|
127 |
+
?>
|
128 |
+
<div style="text-align:left">
|
129 |
+
<?php if ( ! empty( $hidden[$item_type][$key] ) ) :?>
|
130 |
+
<input name="<?php echo($id);?>" type="hidden" id="<?php echo($id);?>" value="1" />
|
131 |
+
<input name="<?php echo("{$option_name}-options[]");?>" type="hidden" value="<?php echo($key)?>" />
|
132 |
+
|
133 |
+
<?php else: ?>
|
134 |
+
<div class="agp-vspaced_input">
|
135 |
+
<label for="<?php echo($id);?>" title="<?php echo($key);?>">
|
136 |
+
<input name="<?php echo("{$option_name}-options[]");?>" type="hidden" value="<?php echo($key)?>" />
|
137 |
+
<input name="<?php echo($id);?>" type="checkbox" id="<?php echo($id);?>" value="1" <?php checked('1', ! empty($enabled[$key]) );?> /> <?php echo($type_obj->label);?>
|
138 |
+
|
139 |
+
<?php
|
140 |
+
echo ('</label></div>');
|
141 |
+
|
142 |
+
endif; // displaying checkbox UI
|
143 |
+
|
144 |
+
echo '</div>';
|
145 |
+
}
|
146 |
+
echo '</td>';
|
147 |
+
}
|
148 |
+
?>
|
149 |
+
</tr>
|
150 |
+
</table>
|
151 |
+
|
152 |
+
<?php if( pp_wp_ver( '3.5' ) ) :
|
153 |
+
$define_create_posts_cap = pp_get_option( 'define_create_posts_cap' );
|
154 |
+
?>
|
155 |
+
<div>
|
156 |
+
<label for="pp_define_create_posts_cap">
|
157 |
+
<input name="pp_define_create_posts_cap" type="checkbox" id="pp_define_create_posts_cap" value="1" <?php checked('1', $define_create_posts_cap );?> /> <?php _e('Use create_posts capability');?>
|
158 |
+
</label>
|
159 |
+
</div>
|
160 |
+
<?php endif; ?>
|
161 |
+
|
162 |
+
<input type="submit" name="update_filtered_types" value="<?php _e('Update', 'capsman') ?>" class="button" />
|
163 |
+
</dd>
|
164 |
+
</dl>
|
165 |
+
<?php endif;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
?>
|
lang/capsman.mo
CHANGED
Binary file
|
lang/capsman.po
CHANGED
@@ -2,876 +2,598 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Capability Manager Enhanced\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date:
|
6 |
-
"PO-Revision-Date:
|
7 |
"Last-Translator: Kevin Behrens <kevin@agapetry.net>\n"
|
8 |
"Language-Team: Agapetry Creations LLC <kevin@agapetry.net>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"X-Poedit-KeywordsList: __;_e;_c;__ngettext;_n;pp_po_trigger;_x\n"
|
13 |
-
"X-Poedit-Basepath: E:\\www\\
|
14 |
"X-Poedit-Language: English\n"
|
15 |
"X-Poedit-Country: UNITED STATES\n"
|
16 |
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
-
"X-Poedit-SearchPath-0: E:\\www\\
|
18 |
-
"X-Poedit-SearchPath-1: E:\\www\\
|
19 |
|
20 |
-
#: E:\www\
|
21 |
msgid "<strong>Error:</strong> Capability Manager Extended cannot function because another copy of Capability Manager is active."
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: E:\www\
|
25 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:344
|
26 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:363
|
27 |
msgid "Warning:"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: E:\www\
|
31 |
#, php-format
|
32 |
msgid "The active plugin %s is not compatible with your PHP version."
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: E:\www\
|
36 |
#, php-format
|
37 |
msgid "%s is required for this plugin."
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: E:\www\
|
41 |
-
#: E:\www\
|
42 |
-
#: E:\www\
|
43 |
-
msgid "
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:88
|
47 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:94
|
48 |
-
msgid "Role Capabilities"
|
49 |
-
msgstr ""
|
50 |
-
|
51 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/classes/template.php:90
|
52 |
-
msgid "Template class: Received template paths are not valid directories."
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/classes/template.php:98
|
56 |
-
msgid "Template class: Received config paths are not valid directories."
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/classes/template.php:174
|
60 |
-
#, php-format
|
61 |
-
msgid "Template class: %s is a reserved template variable."
|
62 |
-
msgstr ""
|
63 |
-
|
64 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/classes/template.php:338
|
65 |
-
#, php-format
|
66 |
-
msgid "Template file %1$s not found. Default template %2$s not found."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: E:\www\
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: E:\www\
|
74 |
-
|
75 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: E:\www\
|
79 |
-
|
80 |
-
msgid "WordPress %s is required to run this plugin."
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: E:\www\
|
84 |
-
msgid "
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: E:\www\
|
88 |
-
|
89 |
-
msgid "It is required to use the standard sidebar to run %s"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: E:\www\
|
93 |
-
msgid "
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: E:\www\
|
97 |
-
msgid "
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: E:\www\
|
101 |
-
msgid "
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: E:\www\
|
105 |
msgid "Settings saved."
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: E:\www\
|
109 |
-
msgid "Just Now"
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/formating.php:163
|
113 |
-
msgid "1 minute ago"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/formating.php:166
|
117 |
-
msgid "1 hour ago"
|
118 |
-
msgstr ""
|
119 |
-
|
120 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/formating.php:170
|
121 |
-
#, php-format
|
122 |
-
msgid "Today at %s"
|
123 |
-
msgstr ""
|
124 |
-
|
125 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/formating.php:170
|
126 |
-
#, php-format
|
127 |
-
msgid "Yesterday at %s"
|
128 |
-
msgstr ""
|
129 |
-
|
130 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/themes.php:162
|
131 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/themes.php:170
|
132 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/author-widget.php:33
|
133 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/author-widget.php:33
|
134 |
msgid "Plugin Homepage"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: E:\www\
|
138 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/themes.php:178
|
139 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/author-widget.php:34
|
140 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/author-widget.php:34
|
141 |
msgid "Documentation"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: E:\www\
|
145 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/themes.php:182
|
146 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/author-widget.php:35
|
147 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/author-widget.php:35
|
148 |
msgid "Support Forum"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: E:\www\
|
152 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/themes.php:186
|
153 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/author-widget.php:36
|
154 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/author-widget.php:36
|
155 |
msgid "Author Homepage"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: E:\www\
|
159 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/author-widget.php:37
|
160 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/author-widget.php:37
|
161 |
msgid "Help donating"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: E:\www\
|
165 |
-
msgid "Theme Homepage"
|
166 |
-
msgstr ""
|
167 |
-
|
168 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/lib/themes.php:190
|
169 |
-
msgid "Donate to project"
|
170 |
-
msgstr ""
|
171 |
-
|
172 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2195
|
173 |
-
msgid "File error. Please try again."
|
174 |
-
msgstr ""
|
175 |
-
|
176 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2196
|
177 |
-
msgid "Local file doesn't exist."
|
178 |
-
msgstr ""
|
179 |
-
|
180 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2197
|
181 |
-
msgid "Local file is not readable."
|
182 |
-
msgstr ""
|
183 |
-
|
184 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2198
|
185 |
-
msgid "File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)."
|
186 |
-
msgstr ""
|
187 |
-
|
188 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2199
|
189 |
-
msgid "File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)."
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2200
|
193 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2201
|
197 |
-
msgid "File upload error (no file was uploaded)."
|
198 |
-
msgstr ""
|
199 |
-
|
200 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2202
|
201 |
-
msgid "File upload error (missing a temporary folder)."
|
202 |
-
msgstr ""
|
203 |
-
|
204 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2203
|
205 |
-
msgid "File upload error (failed to write file to disk)."
|
206 |
-
msgstr ""
|
207 |
-
|
208 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2204
|
209 |
-
msgid "File upload error (file upload stopped by extension)."
|
210 |
-
msgstr ""
|
211 |
-
|
212 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2205
|
213 |
-
msgid "File upload error (unknown error code)."
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2206
|
217 |
-
msgid "File upload error. Please try again."
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2207
|
221 |
-
msgid "File too big."
|
222 |
-
msgstr ""
|
223 |
-
|
224 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2208
|
225 |
-
msgid "MIME type can't be detected."
|
226 |
-
msgstr ""
|
227 |
-
|
228 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2209
|
229 |
-
msgid "Incorrect type of file."
|
230 |
-
msgstr ""
|
231 |
-
|
232 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2210
|
233 |
-
msgid "Image too wide."
|
234 |
-
msgstr ""
|
235 |
-
|
236 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2211
|
237 |
-
msgid "Image too narrow."
|
238 |
-
msgstr ""
|
239 |
-
|
240 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2212
|
241 |
-
msgid "Image too high."
|
242 |
-
msgstr ""
|
243 |
-
|
244 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2213
|
245 |
-
msgid "Image too short."
|
246 |
-
msgstr ""
|
247 |
-
|
248 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2214
|
249 |
-
msgid "Image ratio too high (image too wide)."
|
250 |
-
msgstr ""
|
251 |
-
|
252 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2215
|
253 |
-
msgid "Image ratio too low (image too high)."
|
254 |
-
msgstr ""
|
255 |
-
|
256 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2216
|
257 |
-
msgid "Image has too many pixels."
|
258 |
-
msgstr ""
|
259 |
-
|
260 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2217
|
261 |
-
msgid "Image has not enough pixels."
|
262 |
-
msgstr ""
|
263 |
-
|
264 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2218
|
265 |
-
msgid "File not uploaded. Can't carry on a process."
|
266 |
-
msgstr ""
|
267 |
-
|
268 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2219
|
269 |
#, php-format
|
270 |
-
msgid "
|
271 |
-
msgstr ""
|
272 |
-
|
273 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/framework/vendor/upload/class.upload.php:2220
|
274 |
-
msgid "No correct temp source file. Can't carry on a process."
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: E:\www\
|
278 |
-
msgid "
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: E:\www\
|
282 |
-
|
|
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: E:\www\
|
286 |
-
msgid "
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: E:\www\
|
290 |
-
|
|
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: E:\www\
|
294 |
-
msgid "
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: E:\www\
|
298 |
-
msgid "
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: E:\www\
|
302 |
-
msgid "
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: E:\www\
|
306 |
-
msgid "
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: E:\www\
|
310 |
-
|
311 |
-
msgid "No create from %s support."
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: E:\www\
|
315 |
-
|
316 |
-
msgid "Error in creating %s image from source."
|
317 |
msgstr ""
|
318 |
|
319 |
-
#: E:\www\
|
320 |
-
msgid "
|
321 |
msgstr ""
|
322 |
|
323 |
-
#: E:\www\
|
324 |
-
msgid "
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: E:\www\
|
328 |
-
|
329 |
-
msgid "No create from %s support, can't read watermark."
|
330 |
msgstr ""
|
331 |
|
332 |
-
#: E:\www\
|
333 |
-
|
334 |
-
msgid "No %s read support, can't create watermark."
|
335 |
msgstr ""
|
336 |
|
337 |
-
#: E:\www\
|
338 |
-
msgid "
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: E:\www\
|
342 |
-
|
343 |
-
msgid "No %s create support."
|
344 |
msgstr ""
|
345 |
|
346 |
-
#: E:\www\
|
347 |
-
msgid "
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: E:\www\
|
351 |
-
msgid "
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: E:\www\
|
355 |
-
msgid "
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: E:\www\
|
359 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:67
|
360 |
-
msgid "Roles and Capabilities"
|
361 |
-
msgstr ""
|
362 |
-
|
363 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:76
|
364 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:76
|
365 |
#, php-format
|
366 |
-
msgid "
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: E:\www\
|
370 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:82
|
371 |
-
msgid "Use this form to view and modify the capabilities WordPress natively associates with each role. Note:"
|
372 |
-
msgstr ""
|
373 |
-
|
374 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:87
|
375 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:87
|
376 |
#, php-format
|
377 |
-
msgid "
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: E:\www\
|
381 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:89
|
382 |
#, php-format
|
383 |
-
msgid "
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: E:\www\
|
387 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:91
|
388 |
#, php-format
|
389 |
-
msgid "
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: E:\www\
|
393 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:93
|
394 |
-
msgid "Capabilities for custom statuses can be manually added to a role here (see Conditions > Capability Mapping for applicable names). However, it is usually more convenient to use Permit Groups to assign a supplemental status-specific role."
|
395 |
-
msgstr ""
|
396 |
-
|
397 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:98
|
398 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:98
|
399 |
-
msgid "Interested in further customizing editing or viewing access? Consider stepping up to <a href='#pp-more'>Press Permit</a>."
|
400 |
-
msgstr ""
|
401 |
-
|
402 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:118
|
403 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:118
|
404 |
-
msgid "Automatically define type-specific capabilities for your custom post types and taxonomies"
|
405 |
-
msgstr ""
|
406 |
-
|
407 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:121
|
408 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:121
|
409 |
-
msgid "Supplemental per-type, per-category or per-page role assignments"
|
410 |
-
msgstr ""
|
411 |
-
|
412 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:124
|
413 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:124
|
414 |
-
msgid "Custom Visibility statuses (require read_member_posts, read_premium_posts, etc.)"
|
415 |
-
msgstr ""
|
416 |
-
|
417 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:127
|
418 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:127
|
419 |
-
msgid "Custom Editability \"statuses\" - set alongside Visibility in Post and Category edit forms"
|
420 |
-
msgstr ""
|
421 |
-
|
422 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:130
|
423 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:130
|
424 |
-
msgid "Custom Moderation statuses, enabling access-limited three tier moderation (Pending / Approved / Published)"
|
425 |
-
msgstr ""
|
426 |
-
|
427 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:133
|
428 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:133
|
429 |
-
msgid "Grant Participant or Moderator access to specific bbPress forums or topics"
|
430 |
-
msgstr ""
|
431 |
-
|
432 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:136
|
433 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:136
|
434 |
-
msgid "Grant supplemental page or category access to all members of a BuddyPress group"
|
435 |
-
msgstr ""
|
436 |
-
|
437 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:139
|
438 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:139
|
439 |
-
msgid "WPML integration to mirror permissions to translations"
|
440 |
-
msgstr ""
|
441 |
-
|
442 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:142
|
443 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:142
|
444 |
-
msgid "Professional support available"
|
445 |
-
msgstr ""
|
446 |
-
|
447 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:188
|
448 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:188
|
449 |
msgid " "
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: E:\www\
|
453 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:189
|
454 |
msgid "Reading"
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: E:\www\
|
458 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:190
|
459 |
msgid "Editing Capabilities"
|
460 |
msgstr ""
|
461 |
|
462 |
-
#: E:\www\
|
463 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:191
|
464 |
msgid "Deletion Capabilities"
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: E:\www\
|
468 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:199
|
469 |
msgid "can read posts which are currently published with private visibility"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: E:\www\
|
473 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:200
|
474 |
msgid "has basic editing capability (but may need other capabilities based on post status and ownership)"
|
475 |
msgstr ""
|
476 |
|
477 |
-
#: E:\www\
|
478 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:201
|
479 |
msgid "can edit posts which were created by other users"
|
480 |
msgstr ""
|
481 |
|
482 |
-
#: E:\www\
|
483 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:202
|
484 |
msgid "can edit posts which are currently published"
|
485 |
msgstr ""
|
486 |
|
487 |
-
#: E:\www\
|
488 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:203
|
489 |
msgid "can edit posts which are currently published with private visibility"
|
490 |
msgstr ""
|
491 |
|
492 |
-
#: E:\www\
|
493 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:204
|
494 |
msgid "can make a post publicly visible"
|
495 |
msgstr ""
|
496 |
|
497 |
-
#: E:\www\
|
498 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:205
|
499 |
msgid "has basic deletion capability (but may need other capabilities based on post status and ownership)"
|
500 |
msgstr ""
|
501 |
|
502 |
-
#: E:\www\
|
503 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:206
|
504 |
msgid "can delete posts which were created by other users"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: E:\www\
|
508 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:207
|
509 |
msgid "can delete posts which are currently published"
|
510 |
msgstr ""
|
511 |
|
512 |
-
#: E:\www\
|
513 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:208
|
514 |
msgid "can delete posts which are currently published with private visibility"
|
515 |
msgstr ""
|
516 |
|
517 |
-
#: E:\www\
|
518 |
-
#: E:\www\
|
519 |
-
#: E:\www\
|
520 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:282
|
521 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:356
|
522 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:405
|
523 |
#, php-format
|
524 |
-
msgid "%s: assigned by
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: E:\www\
|
528 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:339
|
529 |
msgid "Other WordPress Core Capabilities"
|
530 |
msgstr ""
|
531 |
|
532 |
-
#: E:\www\
|
533 |
-
#: E:\www\
|
534 |
-
msgid "
|
535 |
msgstr ""
|
536 |
|
537 |
-
#: E:\www\
|
538 |
-
#: E:\www\
|
539 |
-
msgid "
|
540 |
msgstr ""
|
541 |
|
542 |
-
#: E:\www\
|
543 |
-
#: E:\www\
|
544 |
-
msgid "
|
|
|
|
|
|
|
|
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: E:\www\
|
548 |
-
|
549 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:538
|
550 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:481
|
551 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:522
|
552 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:538
|
553 |
-
msgid "Make role available for supplemental assignment to Permit Groups only"
|
554 |
msgstr ""
|
555 |
|
556 |
-
#: E:\www\
|
557 |
-
|
558 |
-
msgid "supplemental assignment only"
|
559 |
msgstr ""
|
560 |
|
561 |
-
#: E:\www\
|
562 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/manager.php:403
|
563 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:488
|
564 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:403
|
565 |
msgid "Save Changes"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: E:\www\
|
569 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:491
|
570 |
msgid "Delete this role"
|
571 |
msgstr ""
|
572 |
|
573 |
-
#: E:\www\
|
574 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:491
|
575 |
#, php-format
|
576 |
msgid ""
|
577 |
"You are about to delete the %s role.\n"
|
578 |
" 'Cancel' to stop, 'OK' to delete."
|
579 |
msgstr ""
|
580 |
|
581 |
-
#: E:\www\
|
582 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:491
|
583 |
msgid "Delete Role"
|
584 |
msgstr ""
|
585 |
|
586 |
-
#: E:\www\
|
587 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:503
|
588 |
msgid "Select New Role"
|
589 |
msgstr ""
|
590 |
|
591 |
-
#: E:\www\
|
592 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:503
|
593 |
-
msgid "Select Role to View / Edit"
|
594 |
-
msgstr ""
|
595 |
-
|
596 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:511
|
597 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:511
|
598 |
msgid "Change"
|
599 |
msgstr ""
|
600 |
|
601 |
-
#: E:\www\
|
602 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/manager.php:357
|
603 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/manager.php:374
|
604 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:511
|
605 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:357
|
606 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:374
|
607 |
-
msgid "Load"
|
608 |
-
msgstr ""
|
609 |
-
|
610 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/admin.php:516
|
611 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:516
|
612 |
msgid "Create New Role"
|
613 |
msgstr ""
|
614 |
|
615 |
-
#: E:\www\
|
616 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:519
|
617 |
msgid "Name of new role"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: E:\www\
|
621 |
-
#: E:\www\
|
622 |
-
#: E:\www\
|
623 |
-
|
624 |
-
msgid "supplemental"
|
625 |
msgstr ""
|
626 |
|
627 |
-
#: E:\www\
|
628 |
-
#: E:\www\
|
629 |
-
|
630 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:378
|
631 |
-
msgid "Create"
|
632 |
msgstr ""
|
633 |
|
634 |
-
#: E:\www\
|
635 |
-
|
636 |
-
msgid "Copy this role to"
|
637 |
msgstr ""
|
638 |
|
639 |
-
#: E:\www\
|
640 |
-
|
641 |
-
#, php-format
|
642 |
-
msgid "Copy %s Role"
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: E:\www\
|
646 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:535
|
647 |
msgid "Name of copied role"
|
648 |
msgstr ""
|
649 |
|
650 |
-
#: E:\www\
|
651 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/manager.php:390
|
652 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:542
|
653 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:390
|
654 |
msgid "Copy"
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: E:\www\
|
658 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:548
|
659 |
msgid "Add Capability"
|
660 |
msgstr ""
|
661 |
|
662 |
-
#: E:\www\
|
663 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:550
|
664 |
msgid "capability name"
|
665 |
msgstr ""
|
666 |
|
667 |
-
#: E:\www\
|
668 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced/includes/manager.php:407
|
669 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/admin.php:551
|
670 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:407
|
671 |
msgid "Add to role"
|
672 |
msgstr ""
|
673 |
|
674 |
-
#: E:\www\
|
675 |
-
|
676 |
-
msgid "Force Type-Specific Capabilities"
|
677 |
msgstr ""
|
678 |
|
679 |
-
#: E:\www\
|
680 |
-
|
681 |
-
msgid "Force unique capability names for:"
|
682 |
msgstr ""
|
683 |
|
684 |
-
#: E:\www\
|
685 |
-
|
686 |
-
msgid "(PP Filtered Post Types, Taxonomies)"
|
687 |
msgstr ""
|
688 |
|
689 |
-
#: E:\www\
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
msgstr ""
|
695 |
|
696 |
-
#: E:\www\
|
697 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:33
|
698 |
msgid "Backup Tool for Capability Manager"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: E:\www\
|
702 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:42
|
703 |
msgid "Backup and Restore"
|
704 |
msgstr ""
|
705 |
|
706 |
-
#: E:\www\
|
707 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:46
|
708 |
msgid "Select action:"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: E:\www\
|
712 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:49
|
713 |
msgid "Backup roles and capabilities"
|
714 |
msgstr ""
|
715 |
|
716 |
-
#: E:\www\
|
717 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:50
|
718 |
msgid "Restore last saved backup"
|
719 |
msgstr ""
|
720 |
|
721 |
-
#: E:\www\
|
722 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:52
|
723 |
msgid "Do Action"
|
724 |
msgstr ""
|
725 |
|
726 |
-
#: E:\www\
|
727 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:60
|
728 |
msgid "Reset WordPress Defaults"
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: E:\www\
|
732 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:62
|
733 |
msgid "WARNING:"
|
734 |
msgstr ""
|
735 |
|
736 |
-
#: E:\www\
|
737 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:62
|
738 |
msgid "Reseting default Roles and Capabilities will set them to the WordPress install defaults."
|
739 |
msgstr ""
|
740 |
|
741 |
-
#: E:\www\
|
742 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:63
|
743 |
msgid "If you have installed any plugin that adds new roles or capabilities, these will be lost."
|
744 |
msgstr ""
|
745 |
|
746 |
-
#: E:\www\
|
747 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:64
|
748 |
msgid "It is recommended to use this only as a last resource!"
|
749 |
msgstr ""
|
750 |
|
751 |
-
#: E:\www\
|
752 |
-
|
|
|
|
|
|
|
753 |
msgid "Reset Roles and Capabilities to WordPress defaults"
|
754 |
msgstr ""
|
755 |
|
756 |
-
#: E:\www\
|
757 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:65
|
758 |
msgid ""
|
759 |
"You are about to reset Roles and Capabilities to WordPress defaults.\n"
|
760 |
" 'Cancel' to stop, 'OK' to reset."
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: E:\www\
|
764 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/backup.php:65
|
765 |
msgid "Reset to WordPress defaults"
|
766 |
msgstr ""
|
767 |
|
768 |
-
#: E:\www\
|
769 |
-
#: E:\www\
|
770 |
-
|
|
|
|
|
771 |
msgstr ""
|
772 |
|
773 |
-
#: E:\www\
|
774 |
-
#: E:\www\
|
775 |
-
#: E:\www\
|
776 |
-
#: E:\www\
|
777 |
-
msgid "
|
778 |
msgstr ""
|
779 |
|
780 |
-
#: E:\www\
|
781 |
-
#: E:\www\
|
782 |
-
msgid "
|
783 |
msgstr ""
|
784 |
|
785 |
-
#: E:\www\
|
786 |
-
#: E:\www\
|
787 |
-
|
788 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:393
|
789 |
-
msgid "New role created."
|
790 |
msgstr ""
|
791 |
|
792 |
-
#: E:\www\
|
793 |
-
#: E:\www\
|
794 |
-
|
795 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:397
|
796 |
-
msgid "Error: No role name specified."
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: E:\www\
|
800 |
-
#: E:\www\
|
801 |
-
|
802 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:399
|
803 |
-
msgid "Error: Failed creating the new role."
|
804 |
msgstr ""
|
805 |
|
806 |
-
#: E:\www\
|
807 |
-
#: E:\www\
|
808 |
-
msgid "
|
809 |
msgstr ""
|
810 |
|
811 |
-
#: E:\www\
|
812 |
-
#: E:\www\
|
813 |
-
msgid "
|
814 |
msgstr ""
|
815 |
|
816 |
-
#: E:\www\
|
817 |
-
#: E:\www\
|
818 |
-
|
|
|
819 |
msgstr ""
|
820 |
|
821 |
-
#: E:\www\
|
822 |
-
#: E:\www\
|
823 |
-
|
|
|
824 |
msgstr ""
|
825 |
|
826 |
-
#: E:\www\
|
827 |
-
#: E:\www\
|
828 |
-
|
|
|
829 |
msgstr ""
|
830 |
|
831 |
-
#: E:\www\
|
832 |
-
|
833 |
-
msgid "Bad form received."
|
834 |
msgstr ""
|
835 |
|
836 |
-
#: E:\www\
|
837 |
-
|
838 |
-
msgid "
|
839 |
msgstr ""
|
840 |
|
841 |
-
#: E:\www\
|
842 |
-
|
843 |
-
msgid "
|
844 |
msgstr ""
|
845 |
|
846 |
-
#: E:\www\
|
847 |
-
|
848 |
-
msgid "
|
849 |
msgstr ""
|
850 |
|
851 |
-
#: E:\www\
|
852 |
-
#: E:\www\wp34\wp-content\plugins\capsman-enhanced\includes/manager.php:482
|
853 |
#, php-format
|
854 |
-
msgid "
|
855 |
msgstr ""
|
856 |
|
857 |
-
#: E:\www\
|
858 |
-
|
859 |
-
#, php-format
|
860 |
-
msgid "Role has been deleted. %1$d users moved to default role %2$s."
|
861 |
msgstr ""
|
862 |
|
863 |
-
#: E:\www\
|
864 |
-
|
865 |
-
msgid "Needed function to create default roles not found!"
|
866 |
msgstr ""
|
867 |
|
868 |
-
#: E:\www\
|
869 |
-
|
870 |
-
msgid "Roles and Capabilities reset to WordPress defaults"
|
871 |
msgstr ""
|
872 |
|
873 |
-
#: E:\www\
|
874 |
-
|
875 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
876 |
msgstr ""
|
877 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Capability Manager Enhanced\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-09-21 01:35-0500\n"
|
6 |
+
"PO-Revision-Date: 2013-09-21 01:35-0500\n"
|
7 |
"Last-Translator: Kevin Behrens <kevin@agapetry.net>\n"
|
8 |
"Language-Team: Agapetry Creations LLC <kevin@agapetry.net>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"X-Poedit-KeywordsList: __;_e;_c;__ngettext;_n;pp_po_trigger;_x\n"
|
13 |
+
"X-Poedit-Basepath: E:\\www\\wp35\\wp-content\\plugins\\capsman-enhanced\n"
|
14 |
"X-Poedit-Language: English\n"
|
15 |
"X-Poedit-Country: UNITED STATES\n"
|
16 |
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: E:\\www\\wp35\\wp-content\\plugins\\capsman-enhanced\n"
|
18 |
+
"X-Poedit-SearchPath-1: E:\\www\\wp35\\wp-content\\plugins\\capsman-enhanced\\includes\n"
|
19 |
|
20 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:40
|
21 |
msgid "<strong>Error:</strong> Capability Manager Extended cannot function because another copy of Capability Manager is active."
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:58
|
|
|
|
|
25 |
msgid "Warning:"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:59
|
29 |
#, php-format
|
30 |
msgid "The active plugin %s is not compatible with your PHP version."
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:61
|
34 |
#, php-format
|
35 |
msgid "%s is required for this plugin."
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:115
|
39 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:177
|
40 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:186
|
41 |
+
msgid "Capabilities"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:116
|
45 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:120
|
46 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:125
|
47 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:177
|
48 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:181
|
49 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:187
|
50 |
+
msgid "Capability Manager"
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/capsman-enhanced.php:125
|
54 |
+
msgid "Role Capabilities"
|
|
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:221
|
58 |
+
msgid "Explicity negate this capability by storing as disabled"
|
|
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:222
|
62 |
+
msgid "Explicitly negate these capabilities by storing as disabled"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:223
|
66 |
+
msgid "Post type registration does not define this capability distinctly"
|
|
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:224
|
70 |
+
msgid "This capability is explicitly negated. Click to add/remove normally."
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:225
|
74 |
+
msgid "Add or remove this capability from the WordPress role"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/classes/abstract/plugin.php:226
|
78 |
+
msgid "Add or remove capability from the role normally"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/formating.php:40
|
82 |
msgid "Settings saved."
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
msgid "Plugin Homepage"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:10
|
|
|
|
|
|
|
90 |
msgid "Documentation"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:11
|
|
|
|
|
|
|
94 |
msgid "Support Forum"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:12
|
|
|
|
|
|
|
98 |
msgid "Author Homepage"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:13
|
|
|
|
|
102 |
msgid "Help donating"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:23
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
#, php-format
|
107 |
+
msgid "Capability Manager Enhanced %s"
|
|
|
|
|
|
|
|
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:24
|
111 |
+
msgid "Copyright 2010 Jordi Canals"
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/framework/lib/themes-agapetry.php:27
|
115 |
+
#, php-format
|
116 |
+
msgid "Modifications © Copyright %1$s %2$s"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:50
|
120 |
+
msgid "Roles and Capabilities"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:59
|
124 |
+
#, php-format
|
125 |
+
msgid "Capabilities for %s"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:62
|
129 |
+
msgid "Use this form to view and modify the capabilities WordPress natively associates with each role. Changes <strong>will remain in your database</strong> even if you deactivate the plugin."
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:74
|
133 |
+
msgid "To further customize editing or viewing access, consider stepping up to <a href='#pp-more'>Press Permit</a>."
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:105
|
137 |
+
msgid "Automatically define type-specific capabilities for your custom post types and taxonomies"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:109
|
141 |
+
msgid "Assign standard WP roles supplementally for a specific post type"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:113
|
145 |
+
msgid "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>"
|
|
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:117
|
149 |
+
msgid "Customize reading permissions per-category or per-post"
|
|
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:121
|
153 |
+
msgid "Customize editing permissions per-category or per-post <em>(Pro)</em>"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:125
|
157 |
+
msgid "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:129
|
161 |
+
msgid "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>"
|
|
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:133
|
165 |
+
msgid "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>"
|
|
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:137
|
169 |
+
msgid "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:141
|
173 |
+
msgid "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>"
|
|
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:145
|
177 |
+
msgid "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:149
|
181 |
+
msgid "WPML integration to mirror permissions to translations <em>(Pro)</em>"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:153
|
185 |
+
msgid "Member support forum"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:159
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
#, php-format
|
190 |
+
msgid "%1$sgrab%2$s %3$s"
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:159
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
#, php-format
|
195 |
+
msgid "%s (free install)"
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:161
|
|
|
199 |
#, php-format
|
200 |
+
msgid "%1$sbuy%2$s %3$s"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:161
|
|
|
204 |
#, php-format
|
205 |
+
msgid "%s info/purchase"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:244
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
msgid " "
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:245
|
|
|
213 |
msgid "Reading"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:246
|
|
|
217 |
msgid "Editing Capabilities"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:247
|
|
|
221 |
msgid "Deletion Capabilities"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:255
|
|
|
225 |
msgid "can read posts which are currently published with private visibility"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:256
|
|
|
229 |
msgid "has basic editing capability (but may need other capabilities based on post status and ownership)"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:257
|
|
|
233 |
msgid "can edit posts which were created by other users"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:258
|
|
|
237 |
msgid "can edit posts which are currently published"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:259
|
|
|
241 |
msgid "can edit posts which are currently published with private visibility"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:260
|
|
|
245 |
msgid "can make a post publicly visible"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:261
|
|
|
249 |
msgid "has basic deletion capability (but may need other capabilities based on post status and ownership)"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:262
|
|
|
253 |
msgid "can delete posts which were created by other users"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:263
|
|
|
257 |
msgid "can delete posts which are currently published"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:264
|
|
|
261 |
msgid "can delete posts which are currently published with private visibility"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:350
|
265 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:442
|
266 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:521
|
|
|
|
|
|
|
267 |
#, php-format
|
268 |
+
msgid "%s: assigned by Permission Group"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:419
|
|
|
272 |
msgid "Other WordPress Core Capabilities"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:480
|
276 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:586
|
277 |
+
msgid "check/uncheck all"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:480
|
281 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:586
|
282 |
+
msgid "negate all (storing as disabled capabilities)"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:480
|
286 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:586
|
287 |
+
msgid "negate none (add/remove all capabilities normally)"
|
288 |
+
msgstr ""
|
289 |
+
|
290 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:487
|
291 |
+
msgid "Additional Capabilities"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:577
|
295 |
+
msgid "Level:"
|
|
|
|
|
|
|
|
|
|
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:595
|
299 |
+
msgid "Note: Underscores replace spaces in stored capability name (\"edit users\" => \"edit_users\")."
|
|
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:611
|
|
|
|
|
|
|
303 |
msgid "Save Changes"
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:614
|
|
|
307 |
msgid "Delete this role"
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:614
|
|
|
311 |
#, php-format
|
312 |
msgid ""
|
313 |
"You are about to delete the %s role.\n"
|
314 |
" 'Cancel' to stop, 'OK' to delete."
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:614
|
|
|
318 |
msgid "Delete Role"
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:626
|
|
|
322 |
msgid "Select New Role"
|
323 |
msgstr ""
|
324 |
|
325 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:634
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
msgid "Change"
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:639
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
msgid "Create New Role"
|
331 |
msgstr ""
|
332 |
|
333 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:642
|
|
|
334 |
msgid "Name of new role"
|
335 |
msgstr ""
|
336 |
|
337 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:645
|
338 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:661
|
339 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:79
|
340 |
+
msgid "Make role available for supplemental assignment to Permission Groups only"
|
|
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:645
|
344 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:661
|
345 |
+
msgid "hidden"
|
|
|
|
|
346 |
msgstr ""
|
347 |
|
348 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:649
|
349 |
+
msgid "Create"
|
|
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:655
|
353 |
+
msgid "Copy this role to"
|
|
|
|
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:658
|
|
|
357 |
msgid "Name of copied role"
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:665
|
|
|
|
|
|
|
361 |
msgid "Copy"
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:671
|
|
|
365 |
msgid "Add Capability"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:673
|
|
|
369 |
msgid "capability name"
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:674
|
|
|
|
|
|
|
373 |
msgid "Add to role"
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:702
|
377 |
+
msgid "Create this role definition in new (future) sites"
|
|
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:702
|
381 |
+
msgid "include in new sites"
|
|
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:705
|
385 |
+
msgid "Copy / update this role definition to all sites now"
|
|
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/admin.php:705
|
389 |
+
msgid "sync role to all sites now"
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup-handler.php:9
|
393 |
+
msgid "You do not have permission to restore roles."
|
394 |
+
msgstr ""
|
395 |
+
|
396 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup-handler.php:32
|
397 |
+
msgid "New backup saved."
|
398 |
+
msgstr ""
|
399 |
+
|
400 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup-handler.php:38
|
401 |
+
msgid "Roles and Capabilities restored from last backup."
|
402 |
+
msgstr ""
|
403 |
+
|
404 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup-handler.php:40
|
405 |
+
msgid "Restore failed. No backup found."
|
406 |
+
msgstr ""
|
407 |
+
|
408 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup-handler.php:59
|
409 |
+
msgid "Needed function to create default roles not found!"
|
410 |
+
msgstr ""
|
411 |
+
|
412 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup-handler.php:72
|
413 |
+
msgid "Roles and Capabilities reset to WordPress defaults"
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:33
|
|
|
417 |
msgid "Backup Tool for Capability Manager"
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:42
|
|
|
421 |
msgid "Backup and Restore"
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:46
|
|
|
425 |
msgid "Select action:"
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:49
|
|
|
429 |
msgid "Backup roles and capabilities"
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:50
|
|
|
433 |
msgid "Restore last saved backup"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:52
|
|
|
437 |
msgid "Do Action"
|
438 |
msgstr ""
|
439 |
|
440 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:60
|
|
|
441 |
msgid "Reset WordPress Defaults"
|
442 |
msgstr ""
|
443 |
|
444 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:62
|
|
|
445 |
msgid "WARNING:"
|
446 |
msgstr ""
|
447 |
|
448 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:62
|
|
|
449 |
msgid "Reseting default Roles and Capabilities will set them to the WordPress install defaults."
|
450 |
msgstr ""
|
451 |
|
452 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:63
|
|
|
453 |
msgid "If you have installed any plugin that adds new roles or capabilities, these will be lost."
|
454 |
msgstr ""
|
455 |
|
456 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:64
|
|
|
457 |
msgid "It is recommended to use this only as a last resource!"
|
458 |
msgstr ""
|
459 |
|
460 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:64
|
461 |
+
msgid "It is recommended to use this only as a last resort!"
|
462 |
+
msgstr ""
|
463 |
+
|
464 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:65
|
465 |
msgid "Reset Roles and Capabilities to WordPress defaults"
|
466 |
msgstr ""
|
467 |
|
468 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:65
|
|
|
469 |
msgid ""
|
470 |
"You are about to reset Roles and Capabilities to WordPress defaults.\n"
|
471 |
" 'Cancel' to stop, 'OK' to reset."
|
472 |
msgstr ""
|
473 |
|
474 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/backup.php:65
|
|
|
475 |
msgid "Reset to WordPress defaults"
|
476 |
msgstr ""
|
477 |
|
478 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:16
|
479 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:29
|
480 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:13
|
481 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:26
|
482 |
+
msgid "New role created."
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:22
|
486 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:35
|
487 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:19
|
488 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:32
|
489 |
+
msgid "Error: Failed creating the new role."
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:74
|
493 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:71
|
494 |
+
msgid "New capability added to role."
|
495 |
msgstr ""
|
496 |
|
497 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:88
|
498 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:85
|
499 |
+
msgid "Incorrect capability name."
|
|
|
|
|
500 |
msgstr ""
|
501 |
|
502 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:93
|
503 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:90
|
504 |
+
msgid "Capability settings saved."
|
|
|
|
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:95
|
508 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:92
|
509 |
+
msgid "Error saving capability settings."
|
|
|
|
|
510 |
msgstr ""
|
511 |
|
512 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:99
|
513 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:96
|
514 |
+
msgid "Bad form received."
|
515 |
msgstr ""
|
516 |
|
517 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:211
|
518 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:200
|
519 |
+
msgid "You cannot remove Manage Capabilities from Administrators"
|
520 |
msgstr ""
|
521 |
|
522 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:313
|
523 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:232
|
524 |
+
#, php-format
|
525 |
+
msgid "Cannot delete default role. You <a href=\"%s\">have to change it first</a>."
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/handler.php:341
|
529 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/modify.php:260
|
530 |
+
#, php-format
|
531 |
+
msgid "Role has been deleted. %1$d users moved to default role %2$s."
|
532 |
msgstr ""
|
533 |
|
534 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:263
|
535 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:282
|
536 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:438
|
537 |
+
msgid "What do you think you're doing?!?"
|
538 |
msgstr ""
|
539 |
|
540 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/manager.php:321
|
541 |
+
msgid "Bad form Received"
|
|
|
542 |
msgstr ""
|
543 |
|
544 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:43
|
545 |
+
#, php-format
|
546 |
+
msgid "see %1$sRole Usage%2$s: \"Pattern Roles\""
|
547 |
msgstr ""
|
548 |
|
549 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:45
|
550 |
+
#, php-format
|
551 |
+
msgid "activate %1$sAdvanced settings%2$s, see Role Usage"
|
552 |
msgstr ""
|
553 |
|
554 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:50
|
555 |
+
#, php-format
|
556 |
+
msgid "\"Posts\" capabilities selected here also define type-specific role assignment for Permission Groups%s."
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:52
|
|
|
560 |
#, php-format
|
561 |
+
msgid "\"Posts\" capabilities selected here also define type-specific role assignment for Permit Groups%s."
|
562 |
msgstr ""
|
563 |
|
564 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:58
|
565 |
+
msgid "Capabilities for custom statuses can be manually added to a role here (see Post Statuses > Status > Capability Mapping for applicable names). However, it is usually more convenient to use Permission Groups to assign a supplemental status-specific role."
|
|
|
|
|
566 |
msgstr ""
|
567 |
|
568 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:60
|
569 |
+
msgid "Capabilities for custom statuses can be manually added to a role here (see Post Statuses > Status > Capability Mapping for applicable names). However, by activating the PP Custom Post Statuses extension, you can assign a supplemental status-specific role easily using Permission Groups."
|
|
|
570 |
msgstr ""
|
571 |
|
572 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:62
|
573 |
+
msgid "Capabilities for custom statuses can be manually added to a role here (see Conditions > Status > Capability Mapping for applicable names). However, it is usually more convenient to use Permit Groups to assign a supplemental status-specific role."
|
|
|
574 |
msgstr ""
|
575 |
|
576 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:79
|
577 |
+
msgid "hidden role"
|
578 |
+
msgstr ""
|
579 |
+
|
580 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:89
|
581 |
+
msgid "Force Type-Specific Capabilities"
|
582 |
+
msgstr ""
|
583 |
+
|
584 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:92
|
585 |
+
msgid "Force unique capability names for:"
|
586 |
+
msgstr ""
|
587 |
+
|
588 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:143
|
589 |
+
msgid "Use create_posts capability"
|
590 |
+
msgstr ""
|
591 |
+
|
592 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:151
|
593 |
+
msgid "(PP Filtered Post Types, Taxonomies)"
|
594 |
+
msgstr ""
|
595 |
+
|
596 |
+
#: E:\www\wp35\wp-content\plugins\capsman-enhanced/includes/pp-ui.php:156
|
597 |
+
msgid "Update"
|
598 |
msgstr ""
|
599 |
|
lang/capsman.pot
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: \n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/capability-manager-enhanced\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
@@ -18,8 +18,7 @@ msgid ""
|
|
18 |
"another copy of Capability Manager is active."
|
19 |
msgstr ""
|
20 |
|
21 |
-
#: capsman-enhanced.php:57
|
22 |
-
#: framework/classes/abstract/plugin.php:363
|
23 |
msgid "Warning:"
|
24 |
msgstr ""
|
25 |
|
@@ -31,394 +30,120 @@ msgstr ""
|
|
31 |
msgid "%s is required for this plugin."
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: capsman-enhanced.php:
|
35 |
-
|
36 |
-
msgid "Capability Manager"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: capsman-enhanced.php:88 capsman-enhanced.php:94 includes/manager.php:190
|
40 |
-
msgid "Role Capabilities"
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
#: framework/classes/abstract/module.php:614
|
44 |
-
msgid "Option blocked by administrator."
|
45 |
-
msgstr ""
|
46 |
-
|
47 |
-
#: framework/classes/abstract/plugin.php:345
|
48 |
-
msgid "The active plugin %s is not compatible with your WordPress version."
|
49 |
-
msgstr ""
|
50 |
-
|
51 |
-
#: framework/classes/abstract/plugin.php:347
|
52 |
-
msgid "WordPress %s is required to run this plugin."
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: framework/classes/abstract/plugin.php:364
|
56 |
-
msgid "Standard sidebar functions are not present."
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: framework/classes/abstract/plugin.php:365
|
60 |
-
msgid "It is required to use the standard sidebar to run %s"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: framework/classes/abstract/plugin.php:418
|
64 |
-
msgid "Activate Components"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: framework/classes/abstract/plugin.php:427
|
68 |
-
msgid "Yes"
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: framework/classes/abstract/plugin.php:428
|
72 |
-
msgid "No"
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: framework/classes/template.php:90
|
76 |
-
msgid "Template class: Received template paths are not valid directories."
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: framework/classes/template.php:98
|
80 |
-
msgid "Template class: Received config paths are not valid directories."
|
81 |
msgstr ""
|
82 |
|
83 |
-
#:
|
84 |
-
|
|
|
85 |
msgstr ""
|
86 |
|
87 |
-
#:
|
88 |
-
msgid "
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: framework/lib/formating.php:
|
92 |
msgid "Settings saved."
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: framework/lib/
|
96 |
-
msgid "Just Now"
|
97 |
-
msgstr ""
|
98 |
-
|
99 |
-
#: framework/lib/formating.php:163
|
100 |
-
msgid "1 minute ago"
|
101 |
-
msgid_plural "%d minutes ago"
|
102 |
-
msgstr[0] ""
|
103 |
-
msgstr[1] ""
|
104 |
-
|
105 |
-
#: framework/lib/formating.php:166
|
106 |
-
msgid "1 hour ago"
|
107 |
-
msgid_plural "%d hours ago"
|
108 |
-
msgstr[0] ""
|
109 |
-
msgstr[1] ""
|
110 |
-
|
111 |
-
#: framework/lib/formating.php:170
|
112 |
-
msgid "Today at %s"
|
113 |
-
msgstr ""
|
114 |
-
|
115 |
-
#: framework/lib/formating.php:170
|
116 |
-
msgid "Yesterday at %s"
|
117 |
-
msgstr ""
|
118 |
-
|
119 |
-
#: framework/lib/themes.php:162 framework/lib/themes.php:170
|
120 |
-
#: includes/author-widget.php:33
|
121 |
msgid "Plugin Homepage"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: framework/lib/themes.php:
|
125 |
-
#: includes/author-widget.php:34
|
126 |
msgid "Documentation"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: framework/lib/themes.php:
|
130 |
-
#: includes/author-widget.php:35
|
131 |
msgid "Support Forum"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: framework/lib/themes.php:
|
135 |
-
#: includes/author-widget.php:36
|
136 |
msgid "Author Homepage"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: framework/lib/themes
|
140 |
msgid "Help donating"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: framework/lib/themes.php:
|
144 |
-
msgid "
|
145 |
-
msgstr ""
|
146 |
-
|
147 |
-
#: framework/lib/themes.php:190
|
148 |
-
msgid "Donate to project"
|
149 |
-
msgstr ""
|
150 |
-
|
151 |
-
#: framework/vendor/upload/class.upload.php:2195
|
152 |
-
msgid "File error. Please try again."
|
153 |
-
msgstr ""
|
154 |
-
|
155 |
-
#: framework/vendor/upload/class.upload.php:2196
|
156 |
-
msgid "Local file doesn't exist."
|
157 |
-
msgstr ""
|
158 |
-
|
159 |
-
#: framework/vendor/upload/class.upload.php:2197
|
160 |
-
msgid "Local file is not readable."
|
161 |
-
msgstr ""
|
162 |
-
|
163 |
-
#: framework/vendor/upload/class.upload.php:2198
|
164 |
-
msgid ""
|
165 |
-
"File upload error (the uploaded file exceeds the upload_max_filesize "
|
166 |
-
"directive in php.ini)."
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: framework/vendor/upload/class.upload.php:2199
|
170 |
-
msgid ""
|
171 |
-
"File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive "
|
172 |
-
"that was specified in the html form)."
|
173 |
-
msgstr ""
|
174 |
-
|
175 |
-
#: framework/vendor/upload/class.upload.php:2200
|
176 |
-
msgid "File upload error (the uploaded file was only partially uploaded)."
|
177 |
-
msgstr ""
|
178 |
-
|
179 |
-
#: framework/vendor/upload/class.upload.php:2201
|
180 |
-
msgid "File upload error (no file was uploaded)."
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: framework/vendor/upload/class.upload.php:2202
|
184 |
-
msgid "File upload error (missing a temporary folder)."
|
185 |
-
msgstr ""
|
186 |
-
|
187 |
-
#: framework/vendor/upload/class.upload.php:2203
|
188 |
-
msgid "File upload error (failed to write file to disk)."
|
189 |
-
msgstr ""
|
190 |
-
|
191 |
-
#: framework/vendor/upload/class.upload.php:2204
|
192 |
-
msgid "File upload error (file upload stopped by extension)."
|
193 |
-
msgstr ""
|
194 |
-
|
195 |
-
#: framework/vendor/upload/class.upload.php:2205
|
196 |
-
msgid "File upload error (unknown error code)."
|
197 |
-
msgstr ""
|
198 |
-
|
199 |
-
#: framework/vendor/upload/class.upload.php:2206
|
200 |
-
msgid "File upload error. Please try again."
|
201 |
-
msgstr ""
|
202 |
-
|
203 |
-
#: framework/vendor/upload/class.upload.php:2207
|
204 |
-
msgid "File too big."
|
205 |
-
msgstr ""
|
206 |
-
|
207 |
-
#: framework/vendor/upload/class.upload.php:2208
|
208 |
-
msgid "MIME type can't be detected."
|
209 |
-
msgstr ""
|
210 |
-
|
211 |
-
#: framework/vendor/upload/class.upload.php:2209
|
212 |
-
msgid "Incorrect type of file."
|
213 |
-
msgstr ""
|
214 |
-
|
215 |
-
#: framework/vendor/upload/class.upload.php:2210
|
216 |
-
msgid "Image too wide."
|
217 |
-
msgstr ""
|
218 |
-
|
219 |
-
#: framework/vendor/upload/class.upload.php:2211
|
220 |
-
msgid "Image too narrow."
|
221 |
-
msgstr ""
|
222 |
-
|
223 |
-
#: framework/vendor/upload/class.upload.php:2212
|
224 |
-
msgid "Image too high."
|
225 |
-
msgstr ""
|
226 |
-
|
227 |
-
#: framework/vendor/upload/class.upload.php:2213
|
228 |
-
msgid "Image too short."
|
229 |
-
msgstr ""
|
230 |
-
|
231 |
-
#: framework/vendor/upload/class.upload.php:2214
|
232 |
-
msgid "Image ratio too high (image too wide)."
|
233 |
-
msgstr ""
|
234 |
-
|
235 |
-
#: framework/vendor/upload/class.upload.php:2215
|
236 |
-
msgid "Image ratio too low (image too high)."
|
237 |
-
msgstr ""
|
238 |
-
|
239 |
-
#: framework/vendor/upload/class.upload.php:2216
|
240 |
-
msgid "Image has too many pixels."
|
241 |
-
msgstr ""
|
242 |
-
|
243 |
-
#: framework/vendor/upload/class.upload.php:2217
|
244 |
-
msgid "Image has not enough pixels."
|
245 |
-
msgstr ""
|
246 |
-
|
247 |
-
#: framework/vendor/upload/class.upload.php:2218
|
248 |
-
msgid "File not uploaded. Can't carry on a process."
|
249 |
-
msgstr ""
|
250 |
-
|
251 |
-
#: framework/vendor/upload/class.upload.php:2219
|
252 |
-
msgid "%s already exists. Please change the file name."
|
253 |
-
msgstr ""
|
254 |
-
|
255 |
-
#: framework/vendor/upload/class.upload.php:2220
|
256 |
-
msgid "No correct temp source file. Can't carry on a process."
|
257 |
-
msgstr ""
|
258 |
-
|
259 |
-
#: framework/vendor/upload/class.upload.php:2221
|
260 |
-
msgid "No correct uploaded source file. Can't carry on a process."
|
261 |
-
msgstr ""
|
262 |
-
|
263 |
-
#: framework/vendor/upload/class.upload.php:2222
|
264 |
-
msgid "Destination directory can't be created. Can't carry on a process."
|
265 |
-
msgstr ""
|
266 |
-
|
267 |
-
#: framework/vendor/upload/class.upload.php:2223
|
268 |
-
msgid "Destination directory doesn't exist. Can't carry on a process."
|
269 |
-
msgstr ""
|
270 |
-
|
271 |
-
#: framework/vendor/upload/class.upload.php:2224
|
272 |
-
msgid "Destination path is not a directory. Can't carry on a process."
|
273 |
-
msgstr ""
|
274 |
-
|
275 |
-
#: framework/vendor/upload/class.upload.php:2225
|
276 |
-
msgid ""
|
277 |
-
"Destination directory can't be made writeable. Can't carry on a process."
|
278 |
-
msgstr ""
|
279 |
-
|
280 |
-
#: framework/vendor/upload/class.upload.php:2226
|
281 |
-
msgid "Destination path is not a writeable. Can't carry on a process."
|
282 |
-
msgstr ""
|
283 |
-
|
284 |
-
#: framework/vendor/upload/class.upload.php:2227
|
285 |
-
msgid "Can't create the temporary file. Can't carry on a process."
|
286 |
-
msgstr ""
|
287 |
-
|
288 |
-
#: framework/vendor/upload/class.upload.php:2228
|
289 |
-
msgid "Source file is not readable. Can't carry on a process."
|
290 |
-
msgstr ""
|
291 |
-
|
292 |
-
#: framework/vendor/upload/class.upload.php:2229
|
293 |
-
msgid "No create from %s support."
|
294 |
-
msgstr ""
|
295 |
-
|
296 |
-
#: framework/vendor/upload/class.upload.php:2230
|
297 |
-
msgid "Error in creating %s image from source."
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: framework/
|
301 |
-
msgid "
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: framework/
|
305 |
-
msgid "
|
306 |
msgstr ""
|
307 |
|
308 |
-
#:
|
309 |
-
msgid "No create from %s support, can't read watermark."
|
310 |
-
msgstr ""
|
311 |
-
|
312 |
-
#: framework/vendor/upload/class.upload.php:2234
|
313 |
-
msgid "No %s read support, can't create watermark."
|
314 |
-
msgstr ""
|
315 |
-
|
316 |
-
#: framework/vendor/upload/class.upload.php:2235
|
317 |
-
msgid "Unknown image format, can't read watermark."
|
318 |
-
msgstr ""
|
319 |
-
|
320 |
-
#: framework/vendor/upload/class.upload.php:2236
|
321 |
-
msgid "No %s create support."
|
322 |
-
msgstr ""
|
323 |
-
|
324 |
-
#: framework/vendor/upload/class.upload.php:2237
|
325 |
-
msgid "No conversion type defined."
|
326 |
-
msgstr ""
|
327 |
-
|
328 |
-
#: framework/vendor/upload/class.upload.php:2238
|
329 |
-
msgid "Error copying file on the server. copy() failed."
|
330 |
-
msgstr ""
|
331 |
-
|
332 |
-
#: framework/vendor/upload/class.upload.php:2239
|
333 |
-
msgid "Error reading the file."
|
334 |
-
msgstr ""
|
335 |
-
|
336 |
-
#: includes/admin.php:67
|
337 |
msgid "Roles and Capabilities"
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: includes/admin.php:
|
341 |
msgid "Capabilities for %s"
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: includes/admin.php:
|
345 |
msgid ""
|
346 |
"Use this form to view and modify the capabilities WordPress natively "
|
347 |
-
"associates with each role.
|
348 |
-
|
349 |
-
|
350 |
-
#: includes/admin.php:87
|
351 |
-
msgid "see %1$sRole Usage%2$s: \"Pattern Roles\""
|
352 |
-
msgstr ""
|
353 |
-
|
354 |
-
#: includes/admin.php:89
|
355 |
-
msgid "activate %1$sAdvanced settings%2$s, see Role Usage"
|
356 |
-
msgstr ""
|
357 |
-
|
358 |
-
#: includes/admin.php:91
|
359 |
-
msgid ""
|
360 |
-
"\"Posts\" capabilities selected here also define type-specific role "
|
361 |
-
"assignment for Permit Groups (%s)."
|
362 |
-
msgstr ""
|
363 |
-
|
364 |
-
#: includes/admin.php:93
|
365 |
-
msgid ""
|
366 |
-
"Capabilities for custom statuses can be manually added to a role here (see "
|
367 |
-
"Conditions > Capability Mapping for applicable names). However, it is "
|
368 |
-
"usually more convenient to use Permit Groups to assign a supplemental status-"
|
369 |
-
"specific role."
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: includes/admin.php:
|
373 |
msgid ""
|
374 |
"Interested in further customizing editing or viewing access? Consider "
|
375 |
"stepping up to <a href='#pp-more'>Press Permit</a>."
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: includes/admin.php:
|
379 |
msgid ""
|
380 |
"Automatically define type-specific capabilities for your custom post types "
|
381 |
"and taxonomies"
|
382 |
msgstr ""
|
383 |
|
384 |
-
#: includes/admin.php:
|
385 |
msgid "Supplemental per-type, per-category or per-page role assignments"
|
386 |
msgstr ""
|
387 |
|
388 |
-
#: includes/admin.php:
|
389 |
msgid ""
|
390 |
"Custom Visibility statuses (require read_member_posts, read_premium_posts, "
|
391 |
"etc.)"
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: includes/admin.php:
|
395 |
msgid ""
|
396 |
"Custom Editability \"statuses\" - set alongside Visibility in Post and "
|
397 |
"Category edit forms"
|
398 |
msgstr ""
|
399 |
|
400 |
-
#: includes/admin.php:
|
401 |
msgid ""
|
402 |
"Custom Moderation statuses, enabling access-limited three tier moderation "
|
403 |
"(Pending / Approved / Published)"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: includes/admin.php:
|
407 |
msgid ""
|
408 |
"Grant Participant or Moderator access to specific bbPress forums or topics"
|
409 |
msgstr ""
|
410 |
|
411 |
-
#: includes/admin.php:
|
412 |
msgid ""
|
413 |
"Grant supplemental page or category access to all members of a BuddyPress "
|
414 |
"group"
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: includes/admin.php:
|
418 |
msgid "WPML integration to mirror permissions to translations"
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: includes/admin.php:
|
422 |
msgid "Professional support available"
|
423 |
msgstr ""
|
424 |
|
@@ -482,116 +207,116 @@ msgstr ""
|
|
482 |
msgid "can delete posts which are currently published with private visibility"
|
483 |
msgstr ""
|
484 |
|
485 |
-
#: includes/admin.php:
|
486 |
-
msgid "%s: assigned by
|
487 |
msgstr ""
|
488 |
|
489 |
-
#: includes/admin.php:
|
490 |
msgid "Other WordPress Core Capabilities"
|
491 |
msgstr ""
|
492 |
|
493 |
-
#: includes/admin.php:
|
494 |
msgid "Additional Capabilities"
|
495 |
msgstr ""
|
496 |
|
497 |
-
#: includes/admin.php:
|
498 |
msgid "Level:"
|
499 |
msgstr ""
|
500 |
|
501 |
-
#: includes/admin.php:
|
502 |
msgid ""
|
503 |
"Note: Underscores replace spaces in stored capability name (\"edit users\" "
|
504 |
"=> \"edit_users\")."
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: includes/admin.php:
|
508 |
msgid "Save Changes"
|
509 |
msgstr ""
|
510 |
|
511 |
-
#: includes/admin.php:
|
512 |
msgid "Delete this role"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: includes/admin.php:
|
516 |
msgid ""
|
517 |
"You are about to delete the %s role.\n"
|
518 |
" 'Cancel' to stop, 'OK' to delete."
|
519 |
msgstr ""
|
520 |
|
521 |
-
#: includes/admin.php:
|
522 |
msgid "Delete Role"
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: includes/admin.php:
|
526 |
msgid "Select New Role"
|
527 |
msgstr ""
|
528 |
|
529 |
-
#: includes/admin.php:
|
530 |
-
msgid "
|
531 |
msgstr ""
|
532 |
|
533 |
-
#: includes/admin.php:
|
534 |
-
msgid "
|
535 |
msgstr ""
|
536 |
|
537 |
-
#: includes/admin.php:
|
538 |
-
msgid "
|
539 |
msgstr ""
|
540 |
|
541 |
-
#: includes/admin.php:
|
542 |
-
msgid "
|
543 |
msgstr ""
|
544 |
|
545 |
-
#: includes/admin.php:
|
546 |
-
msgid "
|
547 |
msgstr ""
|
548 |
|
549 |
-
#: includes/admin.php:
|
550 |
msgid "Create"
|
551 |
msgstr ""
|
552 |
|
553 |
-
#: includes/admin.php:
|
554 |
msgid "Copy this role to"
|
555 |
msgstr ""
|
556 |
|
557 |
-
#: includes/admin.php:
|
558 |
-
msgid "Copy %s Role"
|
559 |
-
msgstr ""
|
560 |
-
|
561 |
-
#: includes/admin.php:505
|
562 |
msgid "Name of copied role"
|
563 |
msgstr ""
|
564 |
|
565 |
-
#: includes/admin.php:
|
566 |
msgid "Copy"
|
567 |
msgstr ""
|
568 |
|
569 |
-
#: includes/admin.php:
|
570 |
msgid "Add Capability"
|
571 |
msgstr ""
|
572 |
|
573 |
-
#: includes/admin.php:
|
574 |
msgid "capability name"
|
575 |
msgstr ""
|
576 |
|
577 |
-
#: includes/admin.php:
|
578 |
msgid "Add to role"
|
579 |
msgstr ""
|
580 |
|
581 |
-
#: includes/
|
582 |
-
msgid "
|
583 |
msgstr ""
|
584 |
|
585 |
-
#: includes/
|
586 |
-
msgid "
|
587 |
msgstr ""
|
588 |
|
589 |
-
#: includes/
|
590 |
-
msgid "
|
591 |
msgstr ""
|
592 |
|
593 |
-
#: includes/
|
594 |
-
msgid "
|
|
|
|
|
|
|
|
|
595 |
msgstr ""
|
596 |
|
597 |
#: includes/backup.php:33
|
@@ -656,83 +381,121 @@ msgstr ""
|
|
656 |
msgid "Reset to WordPress defaults"
|
657 |
msgstr ""
|
658 |
|
659 |
-
#: includes/
|
660 |
-
|
|
|
661 |
msgstr ""
|
662 |
|
663 |
-
#: includes/
|
664 |
-
|
|
|
665 |
msgstr ""
|
666 |
|
667 |
-
#: includes/
|
668 |
-
msgid "
|
669 |
msgstr ""
|
670 |
|
671 |
-
#: includes/
|
672 |
-
msgid "
|
673 |
msgstr ""
|
674 |
|
675 |
-
#: includes/
|
676 |
-
msgid "
|
677 |
msgstr ""
|
678 |
|
679 |
-
#: includes/
|
680 |
-
msgid "Error
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: includes/
|
684 |
-
msgid "
|
685 |
msgstr ""
|
686 |
|
687 |
-
#: includes/
|
688 |
-
msgid "
|
689 |
msgstr ""
|
690 |
|
691 |
-
#: includes/
|
692 |
-
msgid "
|
|
|
693 |
msgstr ""
|
694 |
|
695 |
-
#: includes/
|
696 |
-
msgid "
|
697 |
msgstr ""
|
698 |
|
699 |
-
#: includes/manager.php:
|
700 |
-
msgid "
|
701 |
msgstr ""
|
702 |
|
703 |
-
#: includes/manager.php:
|
704 |
-
msgid "Bad form
|
705 |
msgstr ""
|
706 |
|
707 |
-
#: includes/
|
708 |
-
msgid "
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: includes/
|
712 |
-
msgid "
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: includes/
|
716 |
-
msgid "
|
|
|
|
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: includes/
|
720 |
msgid ""
|
721 |
-
"
|
|
|
722 |
msgstr ""
|
723 |
|
724 |
-
#: includes/
|
725 |
-
msgid "
|
|
|
|
|
|
|
|
|
726 |
msgstr ""
|
727 |
|
728 |
-
#: includes/
|
729 |
-
msgid "
|
|
|
|
|
|
|
|
|
730 |
msgstr ""
|
731 |
|
732 |
-
#: includes/
|
733 |
-
msgid "
|
|
|
|
|
|
|
|
|
734 |
msgstr ""
|
735 |
|
736 |
-
#: includes/
|
737 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
msgstr ""
|
1 |
+
# Copyright (C) 2013
|
2 |
# This file is distributed under the same license as the package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: \n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/capability-manager-enhanced\n"
|
7 |
+
"POT-Creation-Date: 2013-08-20 19:31:31+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
18 |
"another copy of Capability Manager is active."
|
19 |
msgstr ""
|
20 |
|
21 |
+
#: capsman-enhanced.php:57
|
|
|
22 |
msgid "Warning:"
|
23 |
msgstr ""
|
24 |
|
30 |
msgid "%s is required for this plugin."
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: capsman-enhanced.php:104 includes/manager.php:177 includes/manager.php:185
|
34 |
+
msgid "Capabilities"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: capsman-enhanced.php:105 capsman-enhanced.php:108 capsman-enhanced.php:113
|
38 |
+
#: includes/manager.php:177 includes/manager.php:180 includes/manager.php:186
|
39 |
+
msgid "Capability Manager"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: capsman-enhanced.php:113
|
43 |
+
msgid "Role Capabilities"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: framework/lib/formating.php:40
|
47 |
msgid "Settings saved."
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: framework/lib/themes-agapetry.php:9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
msgid "Plugin Homepage"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: framework/lib/themes-agapetry.php:10
|
|
|
55 |
msgid "Documentation"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: framework/lib/themes-agapetry.php:11
|
|
|
59 |
msgid "Support Forum"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: framework/lib/themes-agapetry.php:12
|
|
|
63 |
msgid "Author Homepage"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: framework/lib/themes-agapetry.php:13
|
67 |
msgid "Help donating"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: framework/lib/themes-agapetry.php:23
|
71 |
+
msgid "Capability Manager Enhanced %s"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: framework/lib/themes-agapetry.php:24
|
75 |
+
msgid "Copyright 2010 Jordi Canals"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: framework/lib/themes-agapetry.php:27
|
79 |
+
msgid "Modifications © Copyright %1$s %2$s"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: includes/admin.php:51
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
msgid "Roles and Capabilities"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: includes/admin.php:60
|
87 |
msgid "Capabilities for %s"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: includes/admin.php:63
|
91 |
msgid ""
|
92 |
"Use this form to view and modify the capabilities WordPress natively "
|
93 |
+
"associates with each role. Changes <strong>will remain in your database</"
|
94 |
+
"strong> even if you deactivate the plugin."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/admin.php:71
|
98 |
msgid ""
|
99 |
"Interested in further customizing editing or viewing access? Consider "
|
100 |
"stepping up to <a href='#pp-more'>Press Permit</a>."
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: includes/admin.php:91
|
104 |
msgid ""
|
105 |
"Automatically define type-specific capabilities for your custom post types "
|
106 |
"and taxonomies"
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: includes/admin.php:94
|
110 |
msgid "Supplemental per-type, per-category or per-page role assignments"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: includes/admin.php:97
|
114 |
msgid ""
|
115 |
"Custom Visibility statuses (require read_member_posts, read_premium_posts, "
|
116 |
"etc.)"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: includes/admin.php:100
|
120 |
msgid ""
|
121 |
"Custom Editability \"statuses\" - set alongside Visibility in Post and "
|
122 |
"Category edit forms"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: includes/admin.php:103
|
126 |
msgid ""
|
127 |
"Custom Moderation statuses, enabling access-limited three tier moderation "
|
128 |
"(Pending / Approved / Published)"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: includes/admin.php:106
|
132 |
msgid ""
|
133 |
"Grant Participant or Moderator access to specific bbPress forums or topics"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: includes/admin.php:109
|
137 |
msgid ""
|
138 |
"Grant supplemental page or category access to all members of a BuddyPress "
|
139 |
"group"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: includes/admin.php:112
|
143 |
msgid "WPML integration to mirror permissions to translations"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: includes/admin.php:115
|
147 |
msgid "Professional support available"
|
148 |
msgstr ""
|
149 |
|
207 |
msgid "can delete posts which are currently published with private visibility"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: includes/admin.php:286 includes/admin.php:359 includes/admin.php:408
|
211 |
+
msgid "%s: assigned by Permission Group"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: includes/admin.php:342
|
215 |
msgid "Other WordPress Core Capabilities"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: includes/admin.php:379
|
219 |
msgid "Additional Capabilities"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: includes/admin.php:444
|
223 |
msgid "Level:"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: includes/admin.php:465
|
227 |
msgid ""
|
228 |
"Note: Underscores replace spaces in stored capability name (\"edit users\" "
|
229 |
"=> \"edit_users\")."
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: includes/admin.php:480
|
233 |
msgid "Save Changes"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: includes/admin.php:483
|
237 |
msgid "Delete this role"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: includes/admin.php:483
|
241 |
msgid ""
|
242 |
"You are about to delete the %s role.\n"
|
243 |
" 'Cancel' to stop, 'OK' to delete."
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: includes/admin.php:483
|
247 |
msgid "Delete Role"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: includes/admin.php:495
|
251 |
msgid "Select New Role"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: includes/admin.php:503
|
255 |
+
msgid "Change"
|
256 |
msgstr ""
|
257 |
|
258 |
+
#: includes/admin.php:508
|
259 |
+
msgid "Create New Role"
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: includes/admin.php:511
|
263 |
+
msgid "Name of new role"
|
264 |
msgstr ""
|
265 |
|
266 |
+
#: includes/admin.php:514 includes/admin.php:530 includes/pp-ui.php:79
|
267 |
+
msgid "Make role available for supplemental assignment to Permit Groups only"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: includes/admin.php:514 includes/admin.php:530
|
271 |
+
msgid "supplemental"
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: includes/admin.php:518
|
275 |
msgid "Create"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: includes/admin.php:524
|
279 |
msgid "Copy this role to"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: includes/admin.php:527
|
|
|
|
|
|
|
|
|
283 |
msgid "Name of copied role"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: includes/admin.php:534
|
287 |
msgid "Copy"
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: includes/admin.php:540
|
291 |
msgid "Add Capability"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: includes/admin.php:542
|
295 |
msgid "capability name"
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: includes/admin.php:543
|
299 |
msgid "Add to role"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: includes/backup-handler.php:29
|
303 |
+
msgid "New backup saved."
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: includes/backup-handler.php:35
|
307 |
+
msgid "Roles and Capabilities restored from last backup."
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: includes/backup-handler.php:37
|
311 |
+
msgid "Restore failed. No backup found."
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: includes/backup-handler.php:56
|
315 |
+
msgid "Needed function to create default roles not found!"
|
316 |
+
msgstr ""
|
317 |
+
|
318 |
+
#: includes/backup-handler.php:68
|
319 |
+
msgid "Roles and Capabilities reset to WordPress defaults"
|
320 |
msgstr ""
|
321 |
|
322 |
#: includes/backup.php:33
|
381 |
msgid "Reset to WordPress defaults"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: includes/handler.php:16 includes/handler.php:29 includes/modify.php:13
|
385 |
+
#: includes/modify.php:26
|
386 |
+
msgid "New role created."
|
387 |
msgstr ""
|
388 |
|
389 |
+
#: includes/handler.php:22 includes/handler.php:35 includes/modify.php:19
|
390 |
+
#: includes/modify.php:32
|
391 |
+
msgid "Error: Failed creating the new role."
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: includes/handler.php:74 includes/modify.php:71
|
395 |
+
msgid "New capability added to role."
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: includes/handler.php:88 includes/modify.php:85
|
399 |
+
msgid "Incorrect capability name."
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: includes/handler.php:93 includes/modify.php:90
|
403 |
+
msgid "Capability settings saved."
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: includes/handler.php:95 includes/modify.php:92
|
407 |
+
msgid "Error saving capability settings."
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: includes/handler.php:99 includes/modify.php:96
|
411 |
+
msgid "Bad form received."
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: includes/handler.php:202 includes/modify.php:199
|
415 |
+
msgid "You cannot remove Manage Capabilities from Administrators"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: includes/handler.php:236 includes/modify.php:231
|
419 |
+
msgid ""
|
420 |
+
"Cannot delete default role. You <a href=\"%s\">have to change it first</a>."
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: includes/handler.php:264 includes/modify.php:259
|
424 |
+
msgid "Role has been deleted. %1$d users moved to default role %2$s."
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: includes/manager.php:262 includes/manager.php:281 includes/manager.php:437
|
428 |
+
msgid "What do you think you're doing?!?"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: includes/manager.php:320
|
432 |
+
msgid "Bad form Received"
|
433 |
msgstr ""
|
434 |
|
435 |
+
#: includes/pp-ui.php:43
|
436 |
+
msgid "see %1$sRole Usage%2$s: \"Pattern Roles\""
|
437 |
msgstr ""
|
438 |
|
439 |
+
#: includes/pp-ui.php:45
|
440 |
+
msgid "activate %1$sAdvanced settings%2$s, see Role Usage"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: includes/pp-ui.php:50
|
444 |
+
msgid ""
|
445 |
+
"\"Posts\" capabilities selected here also define type-specific role "
|
446 |
+
"assignment for Permission Groups%s."
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: includes/pp-ui.php:52
|
450 |
msgid ""
|
451 |
+
"\"Posts\" capabilities selected here also define type-specific role "
|
452 |
+
"assignment for Permit Groups%s."
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: includes/pp-ui.php:58
|
456 |
+
msgid ""
|
457 |
+
"Capabilities for custom statuses can be manually added to a role here (see "
|
458 |
+
"Post Statuses > Status > Capability Mapping for applicable names). However, "
|
459 |
+
"it is usually more convenient to use Permission Groups to assign a "
|
460 |
+
"supplemental status-specific role."
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: includes/pp-ui.php:60
|
464 |
+
msgid ""
|
465 |
+
"Capabilities for custom statuses can be manually added to a role here (see "
|
466 |
+
"Post Statuses > Status > Capability Mapping for applicable names). However, "
|
467 |
+
"by activating the PP Custom Post Statuses extension, you can assign a "
|
468 |
+
"supplemental status-specific role easily using Permission Groups."
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: includes/pp-ui.php:62
|
472 |
+
msgid ""
|
473 |
+
"Capabilities for custom statuses can be manually added to a role here (see "
|
474 |
+
"Conditions > Status > Capability Mapping for applicable names). However, it "
|
475 |
+
"is usually more convenient to use Permit Groups to assign a supplemental "
|
476 |
+
"status-specific role."
|
477 |
msgstr ""
|
478 |
|
479 |
+
#: includes/pp-ui.php:79
|
480 |
+
msgid "supplemental assignment only"
|
481 |
+
msgstr ""
|
482 |
+
|
483 |
+
#: includes/pp-ui.php:89
|
484 |
+
msgid "Force Type-Specific Capabilities"
|
485 |
+
msgstr ""
|
486 |
+
|
487 |
+
#: includes/pp-ui.php:92
|
488 |
+
msgid "Force unique capability names for:"
|
489 |
+
msgstr ""
|
490 |
+
|
491 |
+
#: includes/pp-ui.php:143
|
492 |
+
msgid "Use create_posts capability"
|
493 |
+
msgstr ""
|
494 |
+
|
495 |
+
#: includes/pp-ui.php:151
|
496 |
+
msgid "(PP Filtered Post Types, Taxonomies)"
|
497 |
+
msgstr ""
|
498 |
+
|
499 |
+
#: includes/pp-ui.php:156
|
500 |
+
msgid "Update"
|
501 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,45 +1,46 @@
|
|
1 |
=== Capability Manager Enhanced===
|
2 |
Contributors: txanny, kevinB
|
3 |
-
|
4 |
Tags: roles, capabilities, manager, editor, rights, role, capability, types, taxonomies
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
-
A simple way to manage WordPress roles and capabilities.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
Capability Manager
|
14 |
-
You can also delegate capabilities management to other users. In this case, some restrictions apply to this users, as they can only set/unset the capabilities they have.
|
15 |
-
With the Backup/Restore tool, you can save your Roles and Capabilities before making changes and revert them if something goes wrong. You'll find it on the Tools menu.
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
Enhanced and supported by <a href="http://agapetry.net">Kevin Behrens</a> since July 2012. The original Capability Manager author, Jordi Canals, has not updated the plugin since early 2010. Since he was unreachable by web or email, I decided to take on the project myself.
|
23 |
|
24 |
The main change from the original plugin is an improved UI which organizes capabilities:
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
Capability Manager Enhanced also adds <a href="http://
|
31 |
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
= Features: =
|
36 |
-
|
37 |
-
* Manage role capabilities.
|
38 |
-
* Create new roles or delete existing ones.
|
39 |
-
* Add new capabilities to any existing role.
|
40 |
-
* Backup and restore Roles and Capabilities to revert your last changes.
|
41 |
-
* Revert Roles and Capabilities to WordPress defaults.
|
42 |
-
|
43 |
= Languages included: =
|
44 |
|
45 |
* English
|
@@ -71,11 +72,12 @@ Capability Manager Enhanced also adds <a href="http://presspermit.com">Press Per
|
|
71 |
|
72 |
1. Users Menu.
|
73 |
2. View or Modify capabilities for a role.
|
74 |
-
3.
|
75 |
-
4.
|
76 |
-
5.
|
77 |
-
6.
|
78 |
-
7.
|
|
|
79 |
|
80 |
== Frequently Asked Questions ==
|
81 |
|
@@ -103,6 +105,32 @@ You should have received a copy of the GNU General Public License along with thi
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 1.4.9 =
|
107 |
* Fixed : Role capabilities were not updated / refreshed properly on multisite installations
|
108 |
* Feature : If create_posts capabilities are defined, organize checkboxes into a column alongside edit_posts
|
@@ -198,6 +226,9 @@ You should have received a copy of the GNU General Public License along with thi
|
|
198 |
|
199 |
== Upgrade Notice ==
|
200 |
|
|
|
|
|
|
|
201 |
= 1.3.2 =
|
202 |
Only Swedish translation.
|
203 |
|
1 |
=== Capability Manager Enhanced===
|
2 |
Contributors: txanny, kevinB
|
3 |
+
Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JWZVFUDLLYQBA
|
4 |
Tags: roles, capabilities, manager, editor, rights, role, capability, types, taxonomies
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.7
|
7 |
+
Stable tag: 1.5.1
|
8 |
|
9 |
+
A simple way to manage WordPress roles and capabilities.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
Capability Manager Enhanced provides a simple way to manage WordPress role definitions (Subscriber, Editor, etc.). View or change the capabilities of any role, add new roles, copy existing roles into new ones, and add new capabilities to existing roles. Now supports capability negation and role networking.
|
|
|
|
|
14 |
|
15 |
+
= Features: =
|
16 |
+
|
17 |
+
* Create roles
|
18 |
+
* Manage role capabilities
|
19 |
+
* Supports negation: set any capability to granted, not granted, or blocked
|
20 |
+
* Copy any role all network sites
|
21 |
+
* Mark any role for auto-copy to future network sites
|
22 |
+
* Backup and restore Roles and Capabilities to revert your last changes.
|
23 |
+
* Revert Roles and Capabilities to WordPress defaults.
|
24 |
+
|
25 |
+
Role management can also be delegated:
|
26 |
+
|
27 |
+
* Only users with 'manage_capabilities' can manage them. This capability is created at install time and assigned to Administrators.
|
28 |
+
* Administrator role cannot be deleted.
|
29 |
+
* Non-administrators can only manage roles or users with same or lower capabilities.
|
30 |
|
31 |
Enhanced and supported by <a href="http://agapetry.net">Kevin Behrens</a> since July 2012. The original Capability Manager author, Jordi Canals, has not updated the plugin since early 2010. Since he was unreachable by web or email, I decided to take on the project myself.
|
32 |
|
33 |
The main change from the original plugin is an improved UI which organizes capabilities:
|
34 |
|
35 |
+
* by post type
|
36 |
+
* by operation (read/edit/delete)
|
37 |
+
* by origin (WP core or plugin)
|
38 |
|
39 |
+
Capability Manager Enhanced also adds <a href="http://wordpress.org/plugins/press-permit-core">Press Permit</a> plugin integration:
|
40 |
|
41 |
+
* easily specify which post types require type-specific capability definitions
|
42 |
+
* show capabilities which Press Permit adds to the role by supplemental type-specific role assignment
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= Languages included: =
|
45 |
|
46 |
* English
|
72 |
|
73 |
1. Users Menu.
|
74 |
2. View or Modify capabilities for a role.
|
75 |
+
3. Network: copy role to existing or future sites.
|
76 |
+
4. Actions on roles.
|
77 |
+
5. Permissions Menu (Press Permit integration).
|
78 |
+
6. View or Modify capabilities for a role (with Press Permit Pro).
|
79 |
+
7. Force type-specific capabilities (Press Permit integration).
|
80 |
+
8. Backup/Restore tool.
|
81 |
|
82 |
== Frequently Asked Questions ==
|
83 |
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 1.5.1 =
|
109 |
+
* Fixed : Non-administrators with user editing capabilities could give new users a role with a higher level than their own (including Administrator)
|
110 |
+
|
111 |
+
= 1.5 =
|
112 |
+
* Feature : Support negative capabilities (storage to wp_roles array with false value)
|
113 |
+
* Feature : Multisite - Copy a role definition to all current sites on a network
|
114 |
+
* Feature : Multisite - Copy a role definition to new (future) sites on a network
|
115 |
+
* Feature : Backup / Restore tool requires "restore_roles" capability or super admin status
|
116 |
+
* Fixed : Role reset to WP defaults did not work, caused a PHP error / white screen
|
117 |
+
* Change : Clarified English captions on Backup Tool screen
|
118 |
+
* Fixed : Term deletion capability was not included in taxonomies grid even if defined
|
119 |
+
* Fixed : jQuery notices for deprecated methods on Edit Role screen
|
120 |
+
* Compat : Press Permit - if a role is marked as hidden, also default it for use by PP Pro as a Pattern Role (when PP Collaborative Editing is activated and Advanced Settings enabled)
|
121 |
+
* Change : Press Permit promotional message includes link to display further info
|
122 |
+
|
123 |
+
= 1.4.10 =
|
124 |
+
* Perf : Eliminated unused framework code (reduced typical wp-admin memory usage by 0.6 MB)
|
125 |
+
* Fixed : Failure to save capability changes, on some versions of PHP
|
126 |
+
* Compat : Press Permit - PHP Warning on role save
|
127 |
+
* Compat : Press Permit - PHP Warning on "Force Type-Specific Capabilities" settings update
|
128 |
+
* Compat : Press Permit - "supplemental only" option stored redundant entries
|
129 |
+
* Compat : Press Permit - green background around capabilities which
|
130 |
+
* Compat : Press Permit - PHP Warning on "Force Type-Specific Capabilities" settings update
|
131 |
+
* Maint : Stop using $GLOBALS superglobal
|
132 |
+
* Change : Reduced download size by moving screenshots to assets folder of project folder
|
133 |
+
|
134 |
= 1.4.9 =
|
135 |
* Fixed : Role capabilities were not updated / refreshed properly on multisite installations
|
136 |
* Feature : If create_posts capabilities are defined, organize checkboxes into a column alongside edit_posts
|
226 |
|
227 |
== Upgrade Notice ==
|
228 |
|
229 |
+
= 1.5.1 =
|
230 |
+
Fixed : Non-administrators with user editing capabilities could add new Administrators
|
231 |
+
|
232 |
= 1.3.2 =
|
233 |
Only Swedish translation.
|
234 |
|
samples/alkivia.ini
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
; $Id: alkivia.ini 203758 2010-02-10 19:01:07Z Txanny $
|
2 |
-
|
3 |
-
; If you set this file on your wp-content directory, it will override the plugin
|
4 |
-
; options, force to use this ones and disable them from the admin page.
|
5 |
-
|
6 |
-
; All alkivia plugins and themes share the same file. If you already have an
|
7 |
-
; alkivia.ini file in your wp-content directory, you can copy and paste this
|
8 |
-
; settings on it.
|
9 |
-
|
10 |
-
; The ini file is mostly used on WordPress MU, when we want to force all blogs to
|
11 |
-
; this settings and don't want to allow the blog administrators to change them.
|
12 |
-
|
13 |
-
; More information at http://wiki.alkivia.org/capsman/config
|
14 |
-
; SEE ALSO THE alkivia.ini FILE ON THE framework/samples folder.
|
15 |
-
|
16 |
-
|
17 |
-
[capsman]
|
18 |
-
; form-rows = 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screenshot-1.jpg
DELETED
Binary file
|
screenshot-2.jpg
DELETED
Binary file
|
screenshot-3.jpg
DELETED
Binary file
|
screenshot-4.jpg
DELETED
Binary file
|
screenshot-5.jpg
DELETED
Binary file
|
screenshot-6.jpg
DELETED
Binary file
|