Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
3c4bb773
authored
2010-06-22 21:09:22 +0000
by
Chris Boden
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Implemented namespaces
1 parent
943a8b83
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
303 additions
and
298 deletions
com/Auth/Auth.php
com/Branding/Branding.php
com/ClientSettings/ClientSettings.php
com/PagePermissions/PagePermissions.php
com/PagePermissions/views/form.php
com/PagePermissions/views/page_meta_box.php
com/PagePermissions/views/settings.php
com/ShortCodes/ShortCodes.php
lib/Ajaxdata.php
lib/Validation.php
lib/WP_Option.php
tz-tools.php
wp_functions.php
com/Auth/Auth.php
View file @
3c4bb77
<?php
class
Auth
{
const
REG_METH_AUTO_REG
=
1
;
const
REG_METH_VALID_EMAIL
=
2
;
const
FORGOT_METH_VALID_EMAIL
=
1
;
const
FORGOT_METH_RAND_PASS
=
2
;
namespace
Tz\WordPress\Tools\Auth
;
const
ACTION_ACTIVATE
=
'activate_account'
;
use
\Exception
,
\LogicException
,
\InvalidArgumentException
,
\BadMethodCallException
;
public
static
function
make
()
{
static
$made
=
false
;
if
(
true
===
$made
)
{
throw
new
Exception
(
'Auth has already been instantiated'
);
}
$made
=
true
;
const
REG_METH_AUTO_REG
=
1
;
const
REG_METH_VALID_EMAIL
=
2
;
// if _GET activate self::activate()
;
}
const
FORGOT_METH_VALID_EMAIL
=
1
;
const
FORGOT_METH_RAND_PASS
=
2
;
/**
const
ACTION_ACTIVATE
=
'activate_account'
;
/**
* Attempts to login the user
* @param {String} $username
* @param {String} $password
...
...
@@ -27,7 +21,7 @@ class Auth {
* @throws LogicException If headers have already been passed
* @throws InvalidArgumentException If the authentication is invalid
*/
public
static
function
login
(
$username
,
$password
,
$remember
=
true
)
{
function
login
(
$username
,
$password
,
$remember
=
true
)
{
if
(
headers_sent
())
{
throw
new
LogicException
(
'Unable to login because headers have been sent'
);
}
...
...
@@ -38,21 +32,20 @@ class Auth {
,
'remember'
=>
$remember
));
$ref
=
new
ReflectionObject
(
$auth
);
if
(
$ref
->
name
==
'WP_User'
)
{
if
(
get_class
(
$auth
)
==
'WP_User'
)
{
return
$auth
;
}
throw
new
InvalidArgumentException
(
'Invalid username/password'
);
//$auth->get_error_message()); this would be nice except it links to a wp-page
}
}
/**
/**
* Attempts to log the user out
* @returns Boolean
* @throws LogicException If HTTP headers have already been sent
*/
public
static
function
logout
()
{
function
logout
()
{
if
(
headers_sent
())
{
throw
new
LogicException
(
'Unable to logout because headers have been sent'
);
}
...
...
@@ -60,12 +53,12 @@ class Auth {
_logout
();
return
true
;
}
}
public
static
function
register
(
$user_data
=
Array
(),
$registration_method
)
{
function
register
(
$user_data
=
Array
(),
$registration_method
)
{
require_once
(
ABSPATH
.
WPINC
.
DIRECTORY_SEPARATOR
.
'registration.php'
);
$valid
=
new
Auth_
Validation
(
$user_data
);
$valid
=
new
Validation
(
$user_data
);
if
(
count
(
$valid
->
errors
)
>
0
)
{
throw
new
BadMethodCallException
(
implode
(
"
\n
"
,
$valid
->
errors
));
}
...
...
@@ -77,18 +70,17 @@ class Auth {
$wpdb
->
query
(
"UPDATE `
{
$wpdb
->
users
}
` SET `user_status` = 1 WHERE `ID` =
{
$id
}
"
);
return
$id
;
}
}
public
static
function
activate
(
$username
,
$activation_key
)
{
do_action
(
self
::
ACTION_ACTIVATE
,
$user_id
);
}
function
activate
(
$username
,
$activation_key
)
{
do_action
(
ACTION_ACTIVATE
,
$user_id
);
}
public
static
function
forgot_password
(
$username
,
$forgot_method
)
{
function
forgot_password
(
$username
,
$forgot_method
)
{
}
}
class
Auth_Validation
extends
Validation
{
class
Validation
extends
\Tz\
Validation
{
/**
* @rule Not blank
* @rule Valid WordPress username
...
...
com/Branding/Branding.php
View file @
3c4bb77
<?php
class
Branding
{
public
static
function
make
()
{
add_actions
(
'Branding_Actions'
);
}
}
class
Branding_Actions
{
namespace
Tz\WordPress\Tools\Branding
;
use
Tz\WordPress\Tools
;
class
Actions
{
public
static
function
admin_print_styles
()
{
_enqueue_style
(
'branding-style'
,
T
zTools
::
tools_
url
(
'css/tenzing.css'
,
__FILE__
));
_enqueue_style
(
'branding-style'
,
T
ools\
url
(
'css/tenzing.css'
,
__FILE__
));
}
public
static
function
admin_head
()
{
...
...
@@ -22,10 +20,9 @@ class Branding_Actions {
}
public
static
function
login_head
()
{
echo
'<link rel="stylesheet" type="text/css" href="'
.
T
zTools
::
tools_
url
(
'css/tz_login.css'
,
__FILE__
)
.
'" />'
;
echo
'<link rel="stylesheet" type="text/css" href="'
.
T
ools\
url
(
'css/tz_login.css'
,
__FILE__
)
.
'" />'
;
}
}
Branding
::
make
();
Tools\add_actions
(
__NAMESPACE__
.
'\Actions'
);
?>
\ No newline at end of file
...
...
com/ClientSettings/ClientSettings.php
View file @
3c4bb77
<?php
class
ClientSettings
{
const
CAPABILITY
=
'edit_client_settings'
;
const
ADMIN_PAGE
=
'client-settings'
;
public
static
function
make
()
{
static
$made
=
false
;
if
(
$made
)
{
throw
new
OverflowException
(
'ClientSettings has already been initialized'
);
}
$made
=
true
;
namespace
Tz\WordPress\Tools\ClientSettings
;
use
Tz\WordPress\Tools
;
const
CAPABILITY
=
'edit_client_settings'
;
const
ADMIN_PAGE
=
'client-settings'
;
$role
=
get_role
(
'administrator'
);
$role
->
add_cap
(
self
::
CAPABILITY
);
$role
->
add_cap
(
CAPABILITY
);
add_actions
(
'ClientSettings_Actions'
);
}
Tools\add_actions
(
__NAMESPACE__
.
'\Actions'
);
public
static
function
viewOptionsPage
()
{
}
function
viewOptionsPage
()
{
}
// register_setting()
...
...
@@ -29,13 +24,11 @@ class ClientSettings {
// do_settings_section()
class
ClientSettings_
Actions
{
class
Actions
{
public
static
function
admin_menu
()
{
$display
=
(
current_user_can
(
'manage_options'
)
?
'Client Settings'
:
'Settings'
);
add_utility_page
(
$display
,
$display
,
C
lientSettings
::
CAPABILITY
,
ClientSettings
::
ADMIN_PAGE
,
Array
(
'ClientSettings'
,
'viewOptionsPage'
)
);
add_utility_page
(
$display
,
$display
,
C
APABILITY
,
ADMIN_PAGE
,
__NAMESPACE__
.
'\viewOptionsPage'
);
}
}
ClientSettings
::
make
();
?>
\ No newline at end of file
...
...
com/PagePermissions/PagePermissions.php
View file @
3c4bb77
<?php
namespace
Tz\WordPress\Tools\PagePermissions
;
use
Tz\WordPress\Tools
,
Tz\WordPress\Tools\ClientSettings
;
use
\ReflectionClass
,
\ReflectionException
;
use
\WP_Option
;
use
\WP_User
;
/**
* Public API
*/
class
PagePermissions
{
/**
* The name of the custom field stored in a post/page
* @type String
*/
const
META
=
'accessible_to_roles'
;
const
OPT
=
''
;
const
META
=
'accessible_to_roles'
;
const
OPT
=
''
;
const
ELE_SEL
=
'general_access'
;
const
ELE_CUST
=
'roles'
;
const
ELE_AUTH
=
'message_auth'
;
const
ELE_CUST_AUTH
=
'message_cust_auth'
;
const
ELE_DENIED
=
'message_cust_denied'
;
const
ELE_SEL
=
'general_access'
;
const
ELE_CUST
=
'roles'
;
const
ELE_AUTH
=
'message_auth'
;
const
ELE_CUST_AUTH
=
'message_cust_auth'
;
const
ELE_DENIED
=
'message_cust_denied'
;
/**
/**
* Lookup value for ELE_SEL for all users
* @type Integer
*/
const
OPT_ALL
=
0
;
/**
const
OPT_ALL
=
0
;
/**
* Lookup value for ELE_SEL for login required
* @type Integer
*/
const
OPT_AUTH
=
1
;
/**
const
OPT_AUTH
=
1
;
/**
* Lookup value for ELE_SEL for custom roles
* @type Integer
*/
const
OPT_CUST
=
2
;
const
OPT_CUST
=
2
;
class
Vars
{
/**
* WP current user data
* @type Array
*/
private
static
$current_user
=
false
;
public
static
function
init
()
{
if
(
false
!==
self
::
$current_user
)
{
throw
new
OverflowException
(
'PagePermissions already initialized'
);
}
public
static
$current_user
=
false
;
}
self
::
$current_user
=
_get_current_user
();
}
function
make
()
{
Vars
::
$current_user
=
_get_current_user
();
}
public
static
function
initAjax
()
{
function
initAjax
()
{
$selected
=
unserialize
(
$_POST
[
'string_value'
]);
include
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'form.php'
);
}
include
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'form.php'
);
}
/**
/**
* The key function in all of this; called by the Theme,
* this determines if the user is able to view the page.
* @param {Integer} $post_id
* @returns {Boolean|String} true if user can view, error message if not
* @throw InvalidArgumentException
*/
public
static
function
current_user_can_view
(
$post_id
=
false
)
{
function
current_user_can_view
(
$post_id
=
false
)
{
static
$settings
=
false
;
if
(
false
===
$settings
)
{
$settings
=
new
WP_Option
(
PagePermissionsAdmin
::
SETTING_NS
);
$settings
=
new
WP_Option
(
SETTING_NS
);
}
if
(
false
===
$post_id
)
{
...
...
@@ -70,17 +73,17 @@ class PagePermissions {
}
// Meta value hasn't been set, getting settings defaults
if
(
NULL
===
$data
=
array_shift
(
get_post_meta
(
$post_id
,
self
::
META
)))
{
$data
=
Array
(
self
::
ELE_SEL
=>
$settings
[
self
::
ELE_SEL
],
self
::
ELE_CUST
=>
$settings
[
self
::
ELE_CUST
]);
if
(
NULL
===
$data
=
array_shift
(
get_post_meta
(
$post_id
,
META
)))
{
$data
=
Array
(
ELE_SEL
=>
$settings
[
ELE_SEL
],
ELE_CUST
=>
$settings
[
ELE_CUST
]);
}
// Anyone has access, God has no limitations
if
(
$data
[
self
::
ELE_SEL
]
==
self
::
OPT_ALL
||
self
::
is_admin
())
{
if
(
$data
[
ELE_SEL
]
==
OPT_ALL
||
is_admin
())
{
return
true
;
}
// Login required
if
(
$data
[
self
::
ELE_SEL
]
==
self
::
OPT_AUTH
)
{
if
(
$data
[
ELE_SEL
]
==
OPT_AUTH
)
{
// User is logged in
if
(
is_user_logged_in
())
{
return
true
;
...
...
@@ -91,32 +94,32 @@ class PagePermissions {
}
// Specific role required
if
(
$data
[
self
::
ELE_SEL
]
==
self
::
OPT_CUST
)
{
if
(
$data
[
ELE_SEL
]
==
OPT_CUST
)
{
// User isn't even logged in; send message
if
(
!
is_user_logged_in
())
{
return
$settings
[
self
::
ELE_CUST_AUTH
];
return
$settings
[
ELE_CUST_AUTH
];
}
// User meets role required
if
(
isset
(
$data
[
self
::
ELE_CUST
][
self
::
get_user_role
()]))
{
if
(
isset
(
$data
[
ELE_CUST
][
get_user_role
()]))
{
return
true
;
}
// User is logged in, but doesn't have sufficient privileges, return message
return
$settings
[
self
::
ELE_DENIED
];
return
$settings
[
ELE_DENIED
];
}
// This shouldn't happend; but just in case
return
'An unknown permission error has occurred'
;
}
}
/**
/**
* @param {Integer|String} $user Username or ID of user to lookup (or false for current user)
* @returns {String} $role The key of the users' role
*/
public
static
function
get_user_role
(
$user
=
false
)
{
function
get_user_role
(
$user
=
false
)
{
if
(
false
===
$user
)
{
$user_data
=
self
::
$current_user
;
$user_data
=
Vars
::
$current_user
;
}
else
{
$user_data
=
new
WP_User
(
$user
);
}
...
...
@@ -130,30 +133,41 @@ class PagePermissions {
$user_role
=
array_shift
(
$user_roles
);
return
$user_role
;
}
}
/**
/**
* Determine if a user is a site administrator
* @param {Integer|String} $user Username or ID of user to lookup (or false for current user)
* @returns {Boolean}
*/
public
static
function
is_admin
(
$user
=
false
)
{
return
(
self
::
get_user_role
(
$user
)
==
'administrator'
?
true
:
false
);
}
function
is_admin
(
$user
=
false
)
{
return
(
get_user_role
(
$user
)
==
'administrator'
?
true
:
false
);
}
/**
/**
* Get a lookup of all the forum elements
* @returns {Array} An associative array of the forum elemnts name/values
*/
public
static
function
getFieldNames
()
{
function
getFieldNames
()
{
static
$fields
=
false
;
if
(
false
!==
$fields
)
{
return
$fields
;
}
$fields
=
Array
();
/*
$ref = new ReflectionClass(__CLASS__);
$consts = $ref->getConstants();
*/
// Need to do this since 5.3, namespace instead of Class, can't reflect namespaces
$consts
=
Array
(
'ELE_SEL'
=>
'general_access'
,
'ELE_CUST'
=>
'roles'
,
'ELE_AUTH'
=>
'message_auth'
,
'ELE_CUST_AUTH'
=>
'message_cust_auth'
,
'ELE_DENIED'
=>
'message_cust_denied'
);
foreach
(
$consts
as
$const
=>
$value
)
{
if
(
substr
(
$const
,
0
,
4
)
==
'ELE_'
)
{
$fields
[
$const
]
=
$value
;
...
...
@@ -161,105 +175,95 @@ class PagePermissions {
}
return
$fields
;
}
}
/**
* Aministration control
*/
class
PagePermissionsAdmin
{
const
CAPABILITY
=
'manage_page_permissions'
;
const
ADMIN_PAGE
=
'page-permission-settings'
;
const
SUBMIT_HOOK
=
'update_def_page_permissions'
;
const
SETTING_NS
=
'page_permission_defaults'
;
namespace
Tz\WordPress\Tools\PagePermissions\Admin
;
public
static
function
make
()
{
static
$made
=
false
;
if
(
$made
)
{
throw
new
OverflowException
(
'make has already beed called'
);
}
$made
=
true
;
use
Tz\WordPress\Tools
;
use
Tz\WordPress\Tools\PagePermissions
;
use
Tz\WordPress\Tools\ClientSettings
;
TzTools
::
import
(
'ClientSettings'
);
use
\WP_Option
;
const
CAPABILITY
=
'manage_page_permissions'
;
const
ADMIN_PAGE
=
'page-permission-settings'
;
const
SUBMIT_HOOK
=
'update_def_page_permissions'
;
const
SETTING_NS
=
'page_permission_defaults'
;
function
make
()
{
Tools\import
(
'ClientSettings'
);
$role
=
get_role
(
'administrator'
);
$role
->
add_cap
(
self
::
CAPABILITY
);
$role
->
add_cap
(
CAPABILITY
);
add_filters
(
'PagePermissionsAdmin_
Filters'
);
Tools\add_filters
(
__NAMESPACE__
.
'\
Filters'
);
if
(
isset
(
$_POST
[
self
::
SUBMIT_HOOK
])
&&
current_user_can
(
self
::
CAPABILITY
))
{
self
::
submit
();
if
(
isset
(
$_POST
[
SUBMIT_HOOK
])
&&
current_user_can
(
CAPABILITY
))
{
submit
();
}
add_actions
(
'PagePermissions_
Actions'
);
}
Tools\add_actions
(
__NAMESPACE__
.
'\
Actions'
);
}
public
static
function
viewOptionsPage
()
{
$selected
=
self
::
getOptions
();
function
viewOptionsPage
()
{
$selected
=
getOptions
();
include
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'settings.php'
);
}
include
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'settings.php'
);
}
public
static
function
viewMetaBox
(
$post
,
$box_info
)
{
$selected
=
(
$post
->
ID
==
0
?
self
::
getOptions
()
:
array_shift
(
get_post_meta
(
$post
->
ID
,
PagePermissions
::
META
)));
function
viewMetaBox
(
$post
,
$box_info
)
{
$selected
=
(
$post
->
ID
==
0
?
getOptions
()
:
array_shift
(
get_post_meta
(
$post
->
ID
,
PagePermissions\
META
)));
// If the post doesn't have the field saved get defaults
if
(
is_null
(
$selected
))
{
$selected
=
self
::
getOptions
();
$selected
=
getOptions
();
}
include
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'form.php'
);
}
include
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'form.php'
);
}
/**
/**
* Handles saving data when a post/page is saved
*/
public
static
function
submit
()
{
unset
(
$_POST
[
self
::
SUBMIT_HOOK
]);
function
submit
()
{
unset
(
$_POST
[
SUBMIT_HOOK
]);
$options
=
self
::
getOptions
();
$fields
=
PagePermissions
::
getFieldNames
();
$options
=
getOptions
();
$fields
=
PagePermissions\
getFieldNames
();
foreach
(
$fields
as
$field
)
{
if
(
isset
(
$_POST
[
$field
]))
{
// This should probably be done via a recursive fn call or array_walk or something
if
(
is_array
(
$_POST
[
$field
]))
{
$options
[
$field
]
=
Array
();
foreach
(
$_POST
[
$field
]
as
$key
=>
$val
)
{
$options
[
$field
][
$key
]
=
stripslashes
(
$_POST
[
$field
]);
}
}
else
{
// not sure if stripslashes should go here or in WP_Options
$options
[
$field
]
=
stripslashes
(
$_POST
[
$field
]);
}
$options
[
$field
]
=
array_stripslashes
(
$_POST
[
$field
]);
}
else
{
$options
[
$field
]
=
''
;
}
}
$options
->
save
();
}
}
public
static
function
getOptions
()
{
function
array_stripslashes
(
$value
)
{
return
(
is_array
(
$value
)
?
array_map
(
__FUNCTION__
,
$value
)
:
stripslashes
(
$value
));
}
function
getOptions
()
{
static
$options
=
false
;
if
(
false
!==
$options
)
{
return
$options
;
}
$options
=
new
WP_Option
(
self
::
SETTING_NS
);
$options
=
new
WP_Option
(
SETTING_NS
);
return
$options
;
}
}
/**
* Each method is a handler for it's WordPress `add_action` namesake
*/
class
PagePermissions_
Actions
{
class
Actions
{
public
static
function
init
()
{
register_taxonomy
(
PagePermissions
::
META
,
'attachment'
,
Array
(
'hierarachical'
=>
false
,
'label'
=>
'Page Permissions'
,
'query_var'
=>
false
));
register_taxonomy
(
PagePermissions
\
META
,
'attachment'
,
Array
(
'hierarachical'
=>
false
,
'label'
=>
'Page Permissions'
,
'query_var'
=>
false
));
$file
=
$_SERVER
[
'REQUEST_URI'
];
if
(
$file
==
'/wp-admin/media-new.php'
&&
!
PagePermissions
::
is_admin
())
{
if
(
$file
==
'/wp-admin/media-new.php'
&&
!
PagePermissions
\
is_admin
())
{
header
(
"Location: "
.
$file
.
"?flash=0"
);
}
...
...
@@ -267,49 +271,49 @@ class PagePermissions_Actions {
// Ideally this is in its own `edit_attachment` method...but that isn't working
if
(
isset
(
$_POST
[
'action'
])
&&
$_POST
[
'action'
]
==
'editattachment'
)
{
$real_id
=
$_POST
[
'attachment_id'
];
$current
=
array_shift
(
get_post_meta
(
$real_id
,
PagePermissions
::
META
));
$current
=
array_shift
(
get_post_meta
(
$real_id
,
PagePermissions
\
META
));
$new
=
Array
();
$new
[
PagePermissions
::
ELE_SEL
]
=
$_POST
[
PagePermissions
::
ELE_SEL
];
if
(
isset
(
$_POST
[
PagePermissions
::
ELE_CUST
]))
{
$new
[
PagePermissions
::
ELE_CUST
]
=
$_POST
[
PagePermissions
::
ELE_CUST
];
$new
[
PagePermissions
\ELE_SEL
]
=
$_POST
[
PagePermissions\
ELE_SEL
];
if
(
isset
(
$_POST
[
PagePermissions
\
ELE_CUST
]))
{
$new
[
PagePermissions
\ELE_CUST
]
=
$_POST
[
PagePermissions\
ELE_CUST
];
}
else
{
$new
[
PagePermissions
::
ELE_CUST
]
=
Array
();
$new
[
PagePermissions
\
ELE_CUST
]
=
Array
();
}
if
(
is_null
(
$current
))
{
add_post_meta
(
$real_id
,
PagePermissions
::
META
,
$new
,
true
);
add_post_meta
(
$real_id
,
PagePermissions
\
META
,
$new
,
true
);
}
else
{
update_post_meta
(
$real_id
,
PagePermissions
::
META
,
$new
);
update_post_meta
(
$real_id
,
PagePermissions
\
META
,
$new
);
}
}
}
public
static
function
admin_menu
()
{
if
(
current_user_can
(
ClientSettings
::
CAPABILITY
))
{
add_submenu_page
(
ClientSettings
::
ADMIN_PAGE
,
'Permission Defaults'
,
'Permission Defaults'
,
PagePermissionsAdmin
::
CAPABILITY
,
PagePermissionsAdmin
::
ADMIN_PAGE
,
Array
(
'PagePermissionsAdmin'
,
'viewOptionsPage'
)
);
add_meta_box
(
'page_permissions'
,
'Page Permissions'
,
Array
(
'PagePermissionsAdmin'
,
'viewMetaBox'
)
,
'page'
,
'side'
,
'low'
);
if
(
current_user_can
(
ClientSettings
\
CAPABILITY
))
{
add_submenu_page
(
ClientSettings
\ADMIN_PAGE
,
'Permission Defaults'
,
'Permission Defaults'
,
CAPABILITY
,
ADMIN_PAGE
,
__NAMESPACE__
.
'\viewOptionsPage'
);
add_meta_box
(
'page_permissions'
,
'Page Permissions'
,
__NAMESPACE__
.
'\viewMetaBox'
,
'page'
,
'side'
,
'low'
);
}
}
public
static
function
admin_print_scripts
()
{
$innerhtml
=
''
;
if
(
'0'
!==
(
$change_field
=
(
isset
(
$_GET
[
'attachment_id'
])
?
'attachments['
.
$_GET
[
'attachment_id'
]
.
']['
.
PagePermissions
::
META
.
']'
:
'0'
)))
{
$selected
=
array_shift
(
get_post_meta
(
$_GET
[
'attachment_id'
],
PagePermissions
::
META
));
if
(
'0'
!==
(
$change_field
=
(
isset
(
$_GET
[
'attachment_id'
])
?
'attachments['
.
$_GET
[
'attachment_id'
]
.
']['
.
PagePermissions
\
META
.
']'
:
'0'
)))
{
$selected
=
array_shift
(
get_post_meta
(
$_GET
[
'attachment_id'
],
PagePermissions
\
META
));
if
(
is_null
(
$selected
))
{
$selected
=
PagePermissionsAdmin
::
getOptions
();
$selected
=
getOptions
();
}
ob_start
();
require
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'form.php'
);
require
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
'form.php'
);
$innerhtml
=
ob_get_contents
();
ob_end_clean
();
}
_enqueue_script
(
'page-permissions'
,
T
zTools
::
tools_
url
(
'PagePermissions.js'
,
__FILE__
));
_enqueue_script
(
'page-permissions'
,
T
ools\
url
(
'PagePermissions.js'
,
__FILE__
));
_localize_script
(
'page-permissions'
,
'TzPagePermissionsData'
,
Array
(
'trigger'
=>
PagePermissions
::
ELE_SEL
,
'focus'
=>
PagePermissions
::
OPT_CUST
'trigger'
=>
PagePermissions
\
ELE_SEL
,
'focus'
=>
PagePermissions
\
OPT_CUST
,
'change_field'
=>
$change_field
,
'innerHTML'
=>
rawurlencode
(
$innerhtml
)
));
...
...
@@ -323,42 +327,34 @@ class PagePermissions_Actions {
if
(
false
===
(
$real_id
=
_is_post_revision
(
$post_id
)))
{
$real_id
=
$post_id
;
}
$current
=
array_shift
(
get_post_meta
(
$real_id
,
PagePermissions
::
META
));
$current
=
array_shift
(
get_post_meta
(
$real_id
,
PagePermissions
\
META
));
$new
=
Array
();
$new
[
PagePermissions
::
ELE_SEL
]
=
$_POST
[
PagePermissions
::
ELE_SEL
];
if
(
isset
(
$_POST
[
PagePermissions
::
ELE_CUST
]))
{
$new
[
PagePermissions
::
ELE_CUST
]
=
$_POST
[
PagePermissions
::
ELE_CUST
];
$new
[
PagePermissions
\ELE_SEL
]
=
$_POST
[
PagePermissions\
ELE_SEL
];
if
(
isset
(
$_POST
[
PagePermissions
\
ELE_CUST
]))
{
$new
[
PagePermissions
\ELE_CUST
]
=
$_POST
[
PagePermissions\
ELE_CUST
];
}
else
{
$new
[
PagePermissions
::
ELE_CUST
]
=
Array
();
$new
[
PagePermissions
\
ELE_CUST
]
=
Array
();
}
if
(
is_null
(
$current
))
{
add_post_meta
(
$real_id
,
PagePermissions
::
META
,
$new
,
true
);
add_post_meta
(
$real_id
,
PagePermissions
\
META
,
$new
,
true
);
}
else
{
update_post_meta
(
$real_id
,
PagePermissions
::
META
,
$new
);
update_post_meta
(
$real_id
,
PagePermissions
\
META
,
$new
);
}
}
}
class
PagePermissionsAdmin_Filters
{
public
static
function
image_upload_iframe_src
(
$result
)
{
return
$result
.
'&flash=0'
;
}
public
static
function
video_upload_iframe_src
(
$result
)
{
return
$result
.
'&flash=0'
;
}
public
static
function
audio_upload_iframe_src
(
$result
)
{
return
$result
.
'&flash=0'
;
class
Filters
{
public
static
function
flash_uploader
()
{
return
false
;
}
}
if
(
isset
(
$_POST
[
'tz_pp_ajax'
]))
{
PagePermissions
::
initAjax
();
PagePermissions
\
initAjax
();
}
else
{
PagePermissions
::
init
();
PagePermissionsAdmin
::
make
();
PagePermissions
\make
();
make
();
}
?>
\ No newline at end of file
...
...
com/PagePermissions/views/form.php
View file @
3c4bb77
<?php
namespace
Tz\WordPress\Tools\PagePermissions
;
use
\WP_Roles
;
use
\UnderflowException
;
if
(
!
isset
(
$selected
))
{
throw
new
UnderflowException
(
'Current Page Permission settings not provided'
);
}
$opt_selected
=
$selected
[
PagePermissions
::
ELE_SEL
];
$opt_selected
=
$selected
[
ELE_SEL
];
?>
<select
id=
"
<?php
echo
PagePermissions
::
ELE_SEL
;
?>
"
name=
"
<?php
echo
PagePermissions
::
ELE_SEL
;
?>
"
>
<option
value=
"
<?php
echo
PagePermissions
::
OPT_ALL
.
'"'
.
(
PagePermissions
::
OPT_ALL
==
$opt_selected
?
' selected'
:
''
);
?>
>Anyone</option>
<option value="
<?php
echo
PagePermissions
::
OPT_AUTH
.
'"'
.
(
PagePermissions
::
OPT_AUTH
==
$opt_selected
?
' selected'
:
''
);
?>
>
Must be Logged In
</option>
<option
value=
"
<?php
echo
PagePermissions
::
OPT_CUST
.
'"'
.
(
PagePermissions
::
OPT_CUST
==
$opt_selected
?
' selected'
:
''
);
?>
>Specific Roles</option>
<select
id=
"
<?php
echo
ELE_SEL
;
?>
"
name=
"
<?php
echo
ELE_SEL
;
?>
"
>
<option
value=
"
<?php
echo
OPT_ALL
.
'"'
.
(
OPT_ALL
==
$opt_selected
?
' selected'
:
''
);
?>
>Anyone</option>
<option value="
<?php
echo
OPT_AUTH
.
'"'
.
(
OPT_AUTH
==
$opt_selected
?
' selected'
:
''
);
?>
>
Must be Logged In
</option>
<option
value=
"
<?php
echo
OPT_CUST
.
'"'
.
(
OPT_CUST
==
$opt_selected
?
' selected'
:
''
);
?>
>Specific Roles</option>
</select>
<div id="
TzSpecific
"
>
...
...
@@ -20,8 +26,8 @@
unset
(
$rc
,
$roles
[
'administrator'
]);
foreach
(
$roles
as
$key
=>
$display
)
{
$checked
=
(
isset
(
$selected
[
PagePermissions
::
ELE_CUST
][
$key
])
?
' checked'
:
''
);
echo
'<br /><input type="checkbox" id="'
.
$key
.
'" name="'
.
PagePermissions
::
ELE_CUST
.
'['
.
$key
.
']" value="1"'
.
$checked
.
' />'
;
$checked
=
(
isset
(
$selected
[
ELE_CUST
][
$key
])
?
' checked'
:
''
);
echo
'<br /><input type="checkbox" id="'
.
$key
.
'" name="'
.
ELE_CUST
.
'['
.
$key
.
']" value="1"'
.
$checked
.
' />'
;
echo
'<label for="'
.
$key
.
'">'
.
$display
.
'</label>'
;
}
?>
...
...
com/PagePermissions/views/page_meta_box.php
View file @
3c4bb77
<?php
require
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'form.php'
);
?>
\ No newline at end of file
<?php
require
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'form.php'
);
?>
\ No newline at end of file
...
...
com/PagePermissions/views/settings.php
View file @
3c4bb77
<?php
/*
<?php
namespace
Tz\WordPress\Tools\PagePermissions
;
use
Tz\WordPress\Tools\PagePermissions\Admin
;
/*
Idea: Checkbox beside each textarea with option to include registration forum or not
*/
?>
<div
class=
"wrap"
>
<?php
screen_icon
();
?>
<h2>
Permission Defaults
</h2>
<form
method=
"post"
>
<input
type=
"hidden"
name=
"
<?php
echo
PagePermissionsAdmin
::
SUBMIT_HOOK
;
?>
"
value=
"1"
/>
<input
type=
"hidden"
name=
"
<?php
echo
Admin\
SUBMIT_HOOK
;
?>
"
value=
"1"
/>
<h3>
Default Option
</h3>
<?php
require
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'form.php'
);
?>
<?php
require
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'form.php'
);
?>
<hr
/>
...
...
@@ -19,18 +24,18 @@ Idea: Checkbox beside each textarea with option to include registration forum or
<h6>
(Messages are displayed for given criteria when page permission is not met)
</h6>
<p>
<label
for=
"
<?php
echo
PagePermissions
::
ELE_AUTH
;
?>
"
/>
"Must be Logged In" message for un-authenticated visitors
</label>
<br
/><textarea
id=
"
<?php
echo
PagePermissions
::
ELE_AUTH
;
?>
"
name=
"
<?php
echo
PagePermissions
::
ELE_AUTH
;
?>
"
>
<?php
echo
$selected
[
PagePermissions
::
ELE_AUTH
];
?>
</textarea>
<label
for=
"
<?php
echo
ELE_AUTH
;
?>
"
/>
"Must be Logged In" message for un-authenticated visitors
</label>
<br
/><textarea
id=
"
<?php
echo
ELE_AUTH
;
?>
"
name=
"
<?php
echo
ELE_AUTH
;
?>
"
>
<?php
echo
$selected
[
ELE_AUTH
];
?>
</textarea>
</p>
<p>
<label
for=
"
<?php
echo
PagePermissions
::
ELE_CUST_AUTH
;
?>
"
/>
"Only Specific Roles" message for un-authenticated visitors
</label>
<br
/><textarea
id=
"
<?php
echo
PagePermissions
::
ELE_CUST_AUTH
;
?>
"
name=
"
<?php
echo
PagePermissions
::
ELE_CUST_AUTH
;
?>
"
>
<?php
echo
$selected
[
PagePermissions
::
ELE_CUST_AUTH
];
?>
</textarea>
<label
for=
"
<?php
echo
ELE_CUST_AUTH
;
?>
"
/>
"Only Specific Roles" message for un-authenticated visitors
</label>
<br
/><textarea
id=
"
<?php
echo
ELE_CUST_AUTH
;
?>
"
name=
"
<?php
echo
ELE_CUST_AUTH
;
?>
"
>
<?php
echo
$selected
[
ELE_CUST_AUTH
];
?>
</textarea>
</p>
<p>
<label
for=
"
<?php
echo
PagePermissions
::
ELE_DENIED
;
?>
"
/>
"Only Specific Roles" message for authenticated users without sufficient privelages
</label>
<br
/><textarea
id=
"
<?php
echo
PagePermissions
::
ELE_DENIED
;
?>
"
name=
"
<?php
echo
PagePermissions
::
ELE_DENIED
;
?>
"
>
<?php
echo
$selected
[
PagePermissions
::
ELE_DENIED
];
?>
</textarea>
<label
for=
"
<?php
echo
ELE_DENIED
;
?>
"
/>
"Only Specific Roles" message for authenticated users without sufficient privelages
</label>
<br
/><textarea
id=
"
<?php
echo
ELE_DENIED
;
?>
"
name=
"
<?php
echo
ELE_DENIED
;
?>
"
>
<?php
echo
$selected
[
ELE_DENIED
];
?>
</textarea>
</p>
<p
class=
"submit"
><input
type=
"submit"
class=
"button-primary"
value=
"Save Changes"
/></p>
...
...
com/ShortCodes/ShortCodes.php
View file @
3c4bb77
<?php
class
ShortCodes
extends
Singleton
{
private
static
$registered
=
Array
();
private
static
$private
=
Array
();
public
static
function
make
()
{
add_actions
(
'ShortCodes_Actions'
);
namespace
Tz\WordPress\Tools\ShortCodes
;
use
Tz\WordPress\Tools
;
use
\ReflectionClass
,
\ReflectionMethod
,
\ReflectionFunction
;
use
\Exception
;
Tools\add_actions
(
__NAMESPACE__
.
'\Actions'
);
if
(
function_exists
(
'rename_function'
))
{
rename_function
(
'add_shortcode'
,
'wp_add_shortcode'
);
function
add_shortcode
()
{
$args
=
func_get_args
();
call_user_func_array
(
'add'
,
$args
);
}
}
public
static
function
registerClas
s
(
$class
)
{
function
add_shortcode
s
(
$class
)
{
if
(
!
class_exists
(
$class
))
{
throw
new
Exception
(
"
$class
does not exist"
);
}
...
...
@@ -15,16 +26,20 @@ class ShortCodes extends Singleton {
$ref
=
new
ReflectionClass
(
$class
);
$methods
=
$ref
->
getMethods
(
ReflectionMethod
::
IS_STATIC
);
foreach
(
$methods
as
$method
)
{
self
::
add
(
$method
->
name
,
Array
(
$class
,
$method
->
name
));
}
add
(
$method
->
name
,
Array
(
$class
,
$method
->
name
));
}
}
function
registerClass
(
$class
)
{
call_user_func
(
'add_shortcodes'
,
$class
);
}
public
static
function
add
(
$code
,
$callback
)
{
function
add
(
$code
,
$callback
)
{
$fn
=
(
function_exists
(
'wp_add_shortcode'
)
?
'wp_add_shortcode'
:
'add_shortcode'
);
call_user_func
(
$fn
,
$code
,
$callback
);
if
(
is_admin
())
{
self
::
$registered
[
$code
]
=
Array
(
'code'
=>
$code
,
'title'
=>
$code
,
'params'
=>
Array
(),
'uses_content'
=>
0
);
if
(
is_admin
())
{
// I may want to remove this condition...
Vars
::
$registered
[
$code
]
=
Array
(
'code'
=>
$code
,
'title'
=>
$code
,
'params'
=>
Array
(),
'uses_content'
=>
0
);
if
(
is_array
(
$callback
))
{
$ref
=
new
ReflectionMethod
(
$callback
[
0
],
$callback
[
1
]);
...
...
@@ -45,49 +60,49 @@ class ShortCodes extends Singleton {
$tag
=
trim
(
$comment
,
'@'
);
}
if
(
method_exists
(
__CLASS__
,
'parseTag_'
.
$tag
))
{
call_user_func_array
(
Array
(
__CLASS__
,
'parseTag_'
.
$tag
),
Array
(
$code
,
$comment
));
}
if
(
function_exists
(
'parseTag_'
.
$tag
))
{
call_user_func_array
(
'parseTag_'
.
$tag
,
Array
(
$code
,
$comment
));
}
}
}
}
}
public
static
function
parseTag_display
(
$code
,
$string
)
{
function
parseTag_display
(
$code
,
$string
)
{
$string
=
trim
(
str_replace
(
'@display'
,
''
,
$string
));
self
::
$registered
[
$code
][
'title'
]
=
$string
;
}
Vars
::
$registered
[
$code
][
'title'
]
=
$string
;
}
public
static
function
parseTag_param
(
$code
,
$string
)
{
function
parseTag_param
(
$code
,
$string
)
{
$regex
=
'.*?@param {((?:[a-z][a-z]+))(\\(.*?\\))?} (.*?) (.*?)$'
;
// Awww yeah!
if
(
$num
=
preg_match_all
(
"/"
.
$regex
.
"/is"
,
$string
,
$matches
))
{
self
::
$registered
[
$code
][
'params'
][]
=
Array
(
'name'
=>
$matches
[
3
][
0
],
'type'
=>
$matches
[
1
][
0
],
'options'
=>
explode
(
','
,
trim
(
$matches
[
2
][
0
],
')('
)),
'desc'
=>
$matches
[
4
][
0
]);
}
Vars
::
$registered
[
$code
][
'params'
][]
=
Array
(
'name'
=>
$matches
[
3
][
0
],
'type'
=>
$matches
[
1
][
0
],
'options'
=>
explode
(
','
,
trim
(
$matches
[
2
][
0
],
')('
)),
'desc'
=>
$matches
[
4
][
0
]);
}
}
public
static
function
parseTag_private
(
$code
,
$string
)
{
self
::
$private
[
$code
]
=
1
;
}
function
parseTag_private
(
$code
,
$string
)
{
Vars
::
$private
[
$code
]
=
1
;
}
public
static
function
uses_content
(
$code
)
{
self
::
$registered
[
$code
][
'uses_content'
]
=
1
;
}
function
uses_content
(
$code
)
{
Vars
::
$registered
[
$code
][
'uses_content'
]
=
1
;
}
public
static
function
getRegistered
()
{
$return
=
self
::
$registered
;
foreach
(
self
::
$private
as
$key
=>
$one
)
{
function
getRegistered
()
{
$return
=
Vars
::
$registered
;
foreach
(
Vars
::
$private
as
$key
=>
$one
)
{
unset
(
$return
[
$key
]);
}
return
$return
;
}
}
public
static
function
drawMetaBox
()
{
function
drawMetaBox
()
{
?>
<label
for=
"TzShortCodeList"
>
Tag:
</label>
<select
id=
"TzShortCodeList"
name=
"TzShortCodeList"
>
<?php
$options
=
ShortCodes
::
getRegistered
();
$options
=
getRegistered
();
ksort
(
$options
);
foreach
(
$options
as
$tag
=>
$data
)
{
echo
'<option value="'
.
$tag
.
'">'
.
$data
[
'title'
]
.
'</option>'
;
...
...
@@ -99,42 +114,27 @@ class ShortCodes extends Singleton {
<input
type=
"button"
id=
"TzInsertSC"
value=
"
<?php
_e
(
'Insert into post'
);
?>
"
/>
</p>
<?php
}
}
class
ShortCodes_
Actions
{
class
Actions
{
public
static
function
admin_menu
()
{
add_meta_box
(
'TzShortCodes'
,
'Code Helper'
,
Array
(
'ShortCodes'
,
'drawMetaBox'
)
,
'post'
,
'normal'
);
add_meta_box
(
'TzShortCodes'
,
'Code Helper'
,
Array
(
'ShortCodes'
,
'drawMetaBox'
)
,
'page'
,
'normal'
);
add_meta_box
(
'TzShortCodes'
,
'Code Helper'
,
__NAMESPACE__
.
'\drawMetaBox'
,
'post'
,
'normal'
);
add_meta_box
(
'TzShortCodes'
,
'Code Helper'
,
__NAMESPACE__
.
'\drawMetaBox'
,
'page'
,
'normal'
);
}
public
static
function
admin_print_scripts
()
{
if
(
$GLOBALS
[
'editing'
])
{
_enqueue_script
(
'shortcoder'
,
T
zTools
::
tools_
url
(
'shortcoder.js'
,
__FILE__
),
Array
(
'jquery'
));
_enqueue_script
(
'shortcoder'
,
T
ools\
url
(
'shortcoder.js'
,
__FILE__
),
Array
(
'jquery'
));
echo
"<script type=
\"
text/javascript
\"
>
\n
/* <![CDATA[ */
\n
"
;
echo
'var TzRegisteredShortCodes = '
.
json_encode
(
ShortCodes
::
getRegistered
());
echo
'var TzRegisteredShortCodes = '
.
json_encode
(
getRegistered
());
echo
"
\n
/* ]]> */</script>
\n
"
;
}
}
}
/**
* @deprecated
*/
function
add_shortcodes
(
$class
)
{
call_user_func
(
Array
(
'ShortCodes'
,
'registerClass'
),
$class
);
class
Vars
{
public
static
$registered
=
Array
();
public
static
$private
=
Array
();
}
if
(
function_exists
(
'rename_function'
))
{
rename_function
(
'add_shortcode'
,
'wp_add_shortcode'
);
function
add_shortcode
()
{
$args
=
func_get_args
();
call_user_func_array
(
Array
(
'ShortCodes'
,
'add'
),
$args
);
}
}
ShortCodes
::
make
();
?>
\ No newline at end of file
...
...
lib/Ajaxdata.php
View file @
3c4bb77
<?php
namespace
Tz
;
use
Exception
;
/**
* Handles data preparation for XMLHTTP responses to xmlhttpHandler script
*
...
...
lib/Validation.php
View file @
3c4bb77
<?php
namespace
Tz
;
use
\Exception
;
abstract
class
Validation
{
/**
* Associative array of valid fields
...
...
lib/WP_Option.php
View file @
3c4bb77
tz-tools.php
View file @
3c4bb77
<?php
/*
Plugin Name: Tenzing Tools
Version: 0.
3
b
Version: 0.
4
b
Description: Various classes and functions to help out with stuff
Author: Tenzing
*/
TzTools
::
make
()
;
namespace
Tz\WordPress\Tools
;
class
TzTools
{
public
static
function
make
()
{
spl_autoload_register
(
Array
(
__CLASS__
,
'autoloader'
));
use
\ReflectionClass
,
\ReflectionMethod
;
use
\Exception
;
require_once
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'wp_functions.php
'
);
spl_autoload_register
(
__NAMESPACE__
.
'\autoloader
'
);
_register_script
(
'addEvent'
,
self
::
tools_url
(
'scripts/addEvent.js'
,
__FILE__
));
_register_script
(
'xmlhttpHandler'
,
self
::
tools_url
(
'scripts/xmlhttpHandler.js'
,
__FILE__
));
_register_script
(
'fireEvent'
,
self
::
tools_url
(
'scripts/fireEvent.js'
,
__FILE__
));
require_once
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'wp_functions.php'
);
// This is (hopefully) getting canned in 3.0
add_action
(
'widgets_init'
,
Array
(
'MenuWidget'
,
'init'
));
_register_script
(
'addEvent'
,
url
(
'scripts/addEvent.js'
,
__FILE__
));
_register_script
(
'xmlhttpHandler'
,
url
(
'scripts/xmlhttpHandler.js'
,
__FILE__
));
_register_script
(
'fireEvent'
,
url
(
'scripts/fireEvent.js'
,
__FILE__
));
self
::
import
(
'ShortCodes'
);
import
(
'ShortCodes'
);
if
(
defined
(
'TZ_DEBUG'
)
&&
TZ_DEBUG
===
true
)
{
self
::
import
(
'Debug'
);
}
import
(
'Debug'
);
}
public
static
function
import
(
$com
)
{
$dir
=
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'com'
.
DIRECTORY_SEPARATOR
.
$com
.
DIRECTORY_SEPARATOR
;
function
import
(
$com
)
{
$dir
=
__DIR__
.
DIRECTORY_SEPARATOR
.
'com'
.
DIRECTORY_SEPARATOR
.
$com
.
DIRECTORY_SEPARATOR
;
$file
=
$dir
.
$com
.
'.php'
;
if
(
is_dir
(
$dir
)
&&
is_file
(
$file
))
{
require_once
(
$file
);
}
}
}
function
autoloader
(
$class
)
{
$a
=
explode
(
'\\'
,
$class
);
$class
=
array_pop
(
$a
);
public
static
function
autoloader
(
$class
)
{
$file
=
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'lib'
.
DIRECTORY_SEPARATOR
.
$class
.
'.php'
;
$file
=
__DIR__
.
DIRECTORY_SEPARATOR
.
'lib'
.
DIRECTORY_SEPARATOR
.
$class
.
'.php'
;
if
(
is_file
(
$file
))
{
include
(
$file
);
}
}
}
public
static
function
tools_
url
(
$script
,
$base_file
=
false
)
{
$base_dir
=
(
false
===
$base_file
?
dirname
(
__FILE__
)
:
dirname
(
$base_file
));
function
url
(
$script
,
$base_file
=
false
)
{
$base_dir
=
(
false
===
$base_file
?
__DIR__
:
dirname
(
$base_file
));
$rel_path
=
str_replace
(
ABSPATH
,
''
,
$base_dir
);
$script
=
site_url
()
.
'/'
.
$rel_path
.
'/'
.
$script
;
return
$script
;
}
}
function
tools_url
()
{
$args
=
func_get_args
();
call_user_func_array
(
__NAMESPACE__
.
'\url'
,
$args
);
}
function
add_actions
(
$class
)
{
...
...
wp_functions.php
View file @
3c4bb77
<?php
/**
* WordPress strongly advises against using functions that start with "wp_"
* as they are reserved for the core of WordPress and can change with any
...
...
Please
register
or
sign in
to post a comment