author | hurons@caf4f556-3d62-0410-8435-a86758001935 |
Tue, 02 Feb 2010 15:44:16 +0000 | |
branch | wordpress |
changeset 132 | 4d4862461b8d |
parent 123 | 561aa6d282f6 |
permissions | -rw-r--r-- |
123
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
1 |
<?php |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
2 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
3 |
require_once(dirname(__FILE__).'/cache.php'); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
4 |
require_once(dirname(__FILE__).'/const.php'); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
5 |
require_once(dirname(__FILE__).'/l10n.php'); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
6 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
7 |
// ----------------------------------------------------------------------------- |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
8 |
// the ExecPhp_UserUi class shows user specific settings in the user profile |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
9 |
// ----------------------------------------------------------------------------- |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
10 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
11 |
// use this guard to avoid error messages in WP admin panel if plugin |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
12 |
// is disabled because of a version conflict but you still try to reload |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
13 |
// the plugins config interface |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
14 |
if (!class_exists('ExecPhp_UserUi')) : |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
15 |
class ExecPhp_UserUi |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
16 |
{ |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
17 |
var $m_cache = NULL; |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
18 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
19 |
// --------------------------------------------------------------------------- |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
20 |
// init |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
21 |
// --------------------------------------------------------------------------- |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
22 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
23 |
function ExecPhp_UserUi(&$cache) |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
24 |
{ |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
25 |
$this->m_cache =& $cache; |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
26 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
27 |
add_action('show_user_profile', array(&$this, 'action_user_profile')); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
28 |
add_action('edit_user_profile', array(&$this, 'action_user_profile')); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
29 |
add_action('profile_update', array(&$this, 'action_profile_update')); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
30 |
} |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
31 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
32 |
// --------------------------------------------------------------------------- |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
33 |
// hooks |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
34 |
// --------------------------------------------------------------------------- |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
35 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
36 |
function action_user_profile() |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
37 |
{ |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
38 |
global $profileuser; |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
39 |
global $wp_version; |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
40 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
41 |
if ($profileuser->has_cap(ExecPhp_CAPABILITY_EXECUTE_ARTICLES)) |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
42 |
{ |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
43 |
$usermeta =& $this->m_cache->get_usermeta($profileuser->ID); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
44 |
?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
45 |
<?php if (version_compare($wp_version, '2.5.dev') >= 0) : ?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
46 |
<h3><?php _es('Exec-PHP Settings', ExecPhp_PLUGIN_ID); ?></h3> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
47 |
<?php else : ?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
48 |
<fieldset><legend><?php _es('Exec-PHP Settings', ExecPhp_PLUGIN_ID); ?></legend> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
49 |
<?php endif; ?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
50 |
<table class="form-table"> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
51 |
<tr valign="top"> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
52 |
<th scope="row"><?php _es('Disable WYSIWYG Conversion Warning', ExecPhp_PLUGIN_ID); ?></th> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
53 |
<td> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
54 |
<label for="<?php echo ExecPhp_POST_WYSIWYG_WARNING; ?>"> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
55 |
<input style="width: auto;" type="checkbox" name="<?php echo ExecPhp_POST_WYSIWYG_WARNING; ?>" id="<?php echo ExecPhp_POST_WYSIWYG_WARNING; ?>" value="true" <?php if ($usermeta->hide_wysiwyg_warning()) : ?>checked="checked" <?php endif; ?>/> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
56 |
<?php _es('Select this option to turn off the WYSIWYG Conversion Warning in the Write menu. Nevertheless the recommended way is to switch off the WYSIWYG editor so you can be sure not to break existing PHP code by accident.', ExecPhp_PLUGIN_ID); ?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
57 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
58 |
</label> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
59 |
</td> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
60 |
</tr> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
61 |
</table> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
62 |
<?php if (version_compare($wp_version, '2.5.dev') < 0) : ?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
63 |
</fieldset> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
64 |
<?php endif; ?> |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
65 |
<?php |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
66 |
} |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
67 |
} |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
68 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
69 |
function action_profile_update($user_id) |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
70 |
{ |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
71 |
$user = new WP_User($user_id); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
72 |
if ($user->has_cap(ExecPhp_CAPABILITY_EXECUTE_ARTICLES)) |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
73 |
{ |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
74 |
$usermeta =& $this->m_cache->get_usermeta($user_id); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
75 |
$usermeta->set_from_POST(); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
76 |
$usermeta->save(); |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
77 |
} |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
78 |
} |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
79 |
} |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
80 |
endif; |
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
81 |
|
561aa6d282f6
pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff
changeset
|
82 |
?> |