本文整理汇总了PHP中Theme_My_Login类的典型用法代码示例。如果您正苦于以下问题:PHP Theme_My_Login类的具体用法?PHP Theme_My_Login怎么用?PHP Theme_My_Login使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Theme_My_Login类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: activate
/**
* Activates the module
*
* Callback for "tml_activate_themed-profiles/themed-profiles.php" hook in method Theme_My_Login_Modules_Admin::activate_module()
*
* @see Theme_My_Login_Modules_Admin::activate_module()
* @since 6.0
* @access public
*/
public function activate()
{
if (!($page_id = Theme_My_Login::get_page_id('profile'))) {
$page_id = wp_insert_post(array('post_title' => __('Your Profile'), 'post_status' => 'publish', 'post_type' => 'page', 'post_content' => '[theme-my-login]', 'comment_status' => 'closed', 'ping_status' => 'closed'));
update_post_meta($page_id, '_tml_action', 'profile');
}
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:16,代码来源:themed-profiles-admin.php
示例2: widget
/**
* Displays the widget
*
* @since 6.0
* @access public
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
public function widget($args, $instance)
{
$theme_my_login = Theme_My_Login::get_object();
$instance = wp_parse_args($instance, array('default_action' => 'login', 'logged_in_widget' => true, 'logged_out_widget' => true, 'show_title' => true, 'show_log_link' => true, 'show_reg_link' => true, 'show_pass_link' => true, 'show_gravatar' => true, 'gravatar_size' => 50));
// Show if logged in?
if (is_user_logged_in() && !$instance['logged_in_widget']) {
return;
}
// Show if logged out?
if (!is_user_logged_in() && !$instance['logged_out_widget']) {
return;
}
$args = array_merge($args, $instance);
echo $theme_my_login->shortcode($args);
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:24,代码来源:class-theme-my-login-widget.php
示例3: login_form
/**
* Adds "_wp_original_referer" field to login form
*
* Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display()
*
* @see Theme_My_Login_Template::display()
* @since 6.0
* @access public
*/
public function login_form()
{
if (!empty($_REQUEST['redirect_to'])) {
$referer = wp_unslash($_REQUEST['redirect_to']);
} elseif (wp_get_original_referer()) {
$referer = wp_get_original_referer();
} else {
$referer = Theme_My_Login::is_tml_page() ? wp_get_referer() : wp_unslash($_SERVER['REQUEST_URI']);
}
echo '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr($referer) . '" />';
}
开发者ID:paulcherrypipka,项目名称:wptest,代码行数:20,代码来源:custom-redirection.php
示例4: wp_setup_nav_menu_item
/**
* Hide Profile link if user is not logged in
*
* Callback for "wp_setup_nav_menu_item" hook in wp_setup_nav_menu_item()
*
* @see wp_setup_nav_menu_item()
* @since 6.4
* @access public
*
* @param object $menu_item The menu item
* @return object The (possibly) modified menu item
*/
public function wp_setup_nav_menu_item($menu_item)
{
if (is_admin()) {
return $menu_item;
}
if ('page' != $menu_item->object) {
return $menu_item;
}
// User is not logged in
if (!is_user_logged_in()) {
// Hide Profile
if (Theme_My_Login::is_tml_page('profile', $menu_item->object_id)) {
$menu_item->_invalid = true;
}
}
return $menu_item;
}
开发者ID:doobas,项目名称:kazinopaslaptys,代码行数:29,代码来源:themed-profiles.php
示例5: get_redirect_url
/**
* Returns the proper redirect URL according to action
*
* @since 6.0
* @access public
*
* @param string $action The action
* @return string The redirect URL
*/
function get_redirect_url($action = '')
{
if (empty($action)) {
$action = $this->action;
}
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
switch ($action) {
case 'lostpassword':
case 'retrievepassword':
$url = apply_filters('lostpassword_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_current_url('checkemail=confirm'));
break;
case 'register':
$url = apply_filters('registration_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_current_url('checkemail=registered'));
break;
case 'login':
default:
$url = apply_filters('login_redirect', !empty($redirect_to) ? $redirect_to : admin_url(), $redirect_to, null);
}
return apply_filters('tml_redirect_url', $url, $action);
}
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:29,代码来源:class-theme-my-login-template.php
示例6: site_url
/**
* Changes links from "profile.php" to themed profile page
*
* Callback for "site_url" hook
*
* @see site_url()
* @since 6.0
* @access public
*
* @param string $url The generated link
* @param string $path The specified path
* @param string $orig_scheme The original connection scheme
* @return string The filtered link
*/
public function site_url($url, $path, $orig_scheme = '')
{
global $current_user, $pagenow;
if ('profile.php' != $pagenow && strpos($url, 'profile.php') !== false) {
$user_role = reset($current_user->roles);
if (is_multisite() && empty($user_role)) {
$user_role = 'subscriber';
}
if ($user_role && !$this->get_option(array($user_role, 'theme_profile'))) {
return $url;
}
$parsed_url = parse_url($url);
$url = Theme_My_Login::get_page_link('profile');
if (isset($parsed_url['query'])) {
$url = add_query_arg(array_map('rawurlencode', wp_parse_args($parsed_url['query'])), $url);
}
}
return $url;
}
开发者ID:dot2006,项目名称:jobify,代码行数:33,代码来源:themed-profiles.php
示例7: wp_setup_nav_menu_item
/**
* Adds CSS class to TML pages
*
* @since 6.3
* @access public
*
* @param object $menu_item Nav menu item
* @return object Nav menu item
*/
public function wp_setup_nav_menu_item($menu_item)
{
if ('tml_page' == $menu_item->object && Theme_My_Login::is_tml_page('', $menu_item->object_id)) {
if (!is_user_logged_in()) {
$menu_item->classes[] = 'tml_ajax_link';
}
}
return $menu_item;
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:18,代码来源:ajax.php
示例8: install
/**
* Installs TML
*
* @since 6.0
* @access public
*/
public function install()
{
global $wpdb;
// Current version
$version = $this->get_option('version', Theme_My_Login::version);
// Check if legacy page exists
if ($page_id = $this->get_option('page_id')) {
$page = get_post($page_id);
} else {
$page = get_page_by_title('Login');
}
// 4.4 upgrade
if (version_compare($version, '4.4', '<')) {
remove_role('denied');
}
// 6.0 upgrade
if (version_compare($version, '6.0', '<')) {
// Replace shortcode
if ($page) {
$page->post_content = str_replace('[theme-my-login-page]', '[theme-my-login]', $page->post_content);
wp_update_post($page);
}
}
// 6.3 upgrade
if (version_compare($version, '6.3.3', '<')) {
// Delete obsolete options
$this->delete_option('page_id');
$this->delete_option('show_page');
$this->delete_option('initial_nag');
$this->delete_option('permalinks');
$this->delete_option('flush_rules');
// Move options to their own rows
foreach ($this->get_options() as $key => $value) {
if (in_array($key, array('active_modules'))) {
continue;
}
if (!is_array($value)) {
continue;
}
update_option("theme_my_login_{$key}", $value);
$this->delete_option($key);
}
// Maybe create login page?
if ($page) {
// Make sure the page is not in the trash
if ('trash' == $page->post_status) {
wp_untrash_post($page->ID);
}
update_post_meta($page->ID, '_tml_action', 'login');
}
}
// 6.3.7 upgrade
if (version_compare($version, '6.3.7', '<')) {
// Convert TML pages to regular pages
$wpdb->update($wpdb->posts, array('post_type' => 'page'), array('post_type' => 'tml_page'));
// Get rid of stale rewrite rules
flush_rewrite_rules(false);
}
// 6.4 upgrade
if (version_compare($version, '6.4', '<')) {
// Convert e-mail login option
if ($this->get_option('email_login')) {
$this->set_option('login_type', 'both');
}
$this->delete_option('email_login');
}
// Setup default pages
foreach (Theme_My_Login::default_pages() as $action => $title) {
if (!($page_id = Theme_My_Login::get_page_id($action))) {
$page_id = wp_insert_post(array('post_title' => $title, 'post_name' => $action, 'post_status' => 'publish', 'post_type' => 'page', 'post_content' => '[theme-my-login]', 'comment_status' => 'closed', 'ping_status' => 'closed'));
update_post_meta($page_id, '_tml_action', $action);
}
}
// Activate modules
foreach ($this->get_option('active_modules', array()) as $module) {
if (file_exists(WP_PLUGIN_DIR . '/theme-my-login/modules/' . $module)) {
include_once WP_PLUGIN_DIR . '/theme-my-login/modules/' . $module;
}
do_action('tml_activate_' . $module);
}
$this->set_option('version', Theme_My_Login::version);
$this->save_options();
}
开发者ID:andywgarcia,项目名称:campuslifeohs,代码行数:89,代码来源:class-theme-my-login-admin.php
示例9: network_site_url
/**
* Rewrites URL's created by network_site_url
*
* @since 6.3
* @access public
*
* @param string $url The URL
* @param string $path The path specified
* @param string $orig_scheme The current connection scheme (HTTP/HTTPS)
* @return string The modified URL
*/
public function network_site_url($url, $path, $orig_scheme)
{
global $current_site;
$url = $this->site_url($url, $path, $orig_scheme);
switch_to_blog(1);
$url = Theme_My_Login::get_object()->site_url($url, $path, $orig_scheme, $current_site->blog_id);
restore_current_blog();
return $url;
}
开发者ID:tkxhoa,项目名称:movie,代码行数:20,代码来源:class-theme-my-login-ms-signup.php
示例10: user_approval_notification_message_filter
/**
* Changes the user approval e-mail message
*
* Callback for "user_approval_notification_message" hook in Theme_My_Login_User_Moderation_Admin::approve_user()
*
* @see Theme_My_Login_User_Moderation_Admin::approve_user()
* @since 6.1
* @access public
*
* @param string $title The default message
* @param string $key The user's reset key
* @param int $user_id The user's ID
* @return string The filtered message
*/
public function user_approval_notification_message_filter($message, $key, $user_id)
{
$_message = $this->get_option(array('user_approval', 'message'));
if (!empty($_message)) {
$user = get_user_by('id', $user_id);
$message = Theme_My_Login_Common::replace_vars($_message, $user_id, array('%loginurl%' => Theme_My_Login::get_object()->get_page_link('login'), '%reseturl%' => site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user->user_login), 'login')));
}
return $message;
}
开发者ID:andyUA,项目名称:kabmin-new,代码行数:23,代码来源:custom-email.php
示例11: array_merge_recursive
/**
* Merges arrays recursively, replacing duplicate string keys
*
* @since 6.0
* @access public
*/
function array_merge_recursive()
{
$args = func_get_args();
$result = array_shift($args);
foreach ($args as $arg) {
foreach ($arg as $key => $value) {
// Renumber numeric keys as array_merge() does.
if (is_numeric($key)) {
if (!in_array($value, $result)) {
$result[] = $value;
}
} elseif (array_key_exists($key, $result) && is_array($result[$key]) && is_array($value)) {
$result[$key] = Theme_My_Login::array_merge_recursive($result[$key], $value);
} else {
$result[$key] = $value;
}
}
}
return $result;
}
开发者ID:Alesviosic,项目名称:Theme-MY-login,代码行数:26,代码来源:class-theme-my-login.php
示例12: send_activation
/**
* Handles "send_activation" action for login page
*
* Callback for "tml_request_send_activation" hook in method Theme_My_Login::the_request();
*
* @see Theme_My_Login::the_request();
* @since 6.0
* @access public
*/
function send_activation()
{
global $theme_my_login, $wpdb;
$login = isset($_GET['login']) ? trim($_GET['login']) : '';
if (!($user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->users} WHERE user_login = %s", $login)))) {
$redirect_to = Theme_My_Login::get_current_url('sendactivation=failed');
if (!empty($theme_my_login->request_instance)) {
$redirect_to = add_query_arg('instance', $theme_my_login->request_instance, $redirect_to);
}
wp_redirect($redirect_to);
exit;
}
$user = new WP_User($user_id);
if (in_array('pending', (array) $user->roles)) {
// Send activation e-mail
$this->new_user_activation_notification($user->ID);
// Now redirect them
$redirect_to = Theme_My_Login::get_current_url('sendactivation=sent');
wp_redirect($redirect_to);
exit;
}
}
开发者ID:moscarar,项目名称:cityhow,代码行数:31,代码来源:user-moderation.php
示例13: cimy_uef_is_theme_my_login_register_page
/**
* @since 2.5.2
* @return true on Themed My Login - Themed Registration page
*/
function cimy_uef_is_theme_my_login_register_page()
{
// Theme My Login <= v6.2.x
if (!empty($GLOBALS['theme_my_login']) && $GLOBALS['theme_my_login']->is_login_page()) {
return true;
}
// Theme My Login >= v6.3.0
if (function_exists('Theme_My_Login') && Theme_My_Login::is_tml_page('register')) {
return true;
}
return false;
}
开发者ID:johangas,项目名称:moped,代码行数:16,代码来源:cimy_uef_functions.php
示例14: login_form
/**
* Adds "_wp_original_referer" field to login form
*
* Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display()
*
* @see Theme_My_Login_Template::display()
* @since 6.0
* @access public
*/
public function login_form()
{
echo wp_original_referer_field(false, Theme_My_Login::is_tml_page() ? 'previous' : 'current') . "\n";
}
开发者ID:nikwin333,项目名称:pcu_project,代码行数:13,代码来源:custom-redirection.php
示例15: login_form
/**
* Adds "_wp_original_referer" field to login form
*
* Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display()
*
* @see Theme_My_Login_Template::display()
* @since 6.0
* @access public
*/
public function login_form()
{
$template = Theme_My_Login::get_object()->get_active_instance();
echo wp_original_referer_field(false, $template->get_option('instance') ? 'current' : 'previous') . "\n";
}
开发者ID:jsdesarrolloweb,项目名称:Plugin-Theme-My-Login-Spanish,代码行数:14,代码来源:custom-redirection.php
示例16: authenticate
/**
* Blocks "pending" users from loggin in
*
* Callback for "authenticate" hook in function wp_authenticate()
*
* @see wp_authenticate()
* @since 6.0
* @access public
*
* @param WP_User $user WP_User object
* @param string $username Username posted
* @param string $password Password posted
* @return WP_User|WP_Error WP_User if the user can login, WP_Error otherwise
*/
public function authenticate($user, $username, $password)
{
global $wpdb;
$cap_key = $wpdb->prefix . 'capabilities';
if ($userdata = get_user_by('login', $username)) {
if (array_key_exists('pending', (array) $userdata->{$cap_key})) {
if ('email' == $this->get_option('type')) {
return new WP_Error('pending', sprintf(__('<strong>ERROR</strong>: You have not yet confirmed your e-mail address. <a href="%s">Resend activation</a>?', 'theme-my-login'), Theme_My_Login::get_page_link('login', array('action' => 'sendactivation', 'login' => $username))));
} else {
return new WP_Error('pending', __('<strong>ERROR</strong>: Your registration has not yet been approved.', 'theme-my-login'));
}
}
}
return $user;
}
开发者ID:jsdesarrolloweb,项目名称:Plugin-Theme-My-Login-Spanish,代码行数:29,代码来源:user-moderation.php
示例17: template_redirect
/**
* Blocks entire site if user is not logged in and private site is enabled
*
* Callback for "template_redirect" hook in the file wp-settings.php
*
* @since 6.2
* @access public
*/
public function template_redirect()
{
if ($this->get_option('private_site')) {
if (!(is_user_logged_in() || Theme_My_Login::is_tml_page())) {
$redirect_to = apply_filters('tml_security_private_site_redirect', wp_login_url($_SERVER['REQUEST_URI'], true));
wp_safe_redirect($redirect_to);
exit;
}
}
}
开发者ID:adnandot,项目名称:intenseburn,代码行数:18,代码来源:security.php
示例18: pmpro_login_head
function pmpro_login_head()
{
$login_redirect = apply_filters("pmpro_login_redirect", true);
if ((pmpro_is_login_page() || is_page("login") || class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0 && (Theme_My_Login::is_tml_page("register") || Theme_My_Login::is_tml_page("login"))) && $login_redirect) {
//redirect registration page to levels page
if (isset($_REQUEST['action']) && $_REQUEST['action'] == "register" || isset($_REQUEST['registration']) && $_REQUEST['registration'] == "disabled" || !is_admin() && class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0 && Theme_My_Login::is_tml_page("register")) {
//redirect to levels page unless filter is set.
$link = apply_filters("pmpro_register_redirect", pmpro_url("levels"));
if (!empty($link)) {
wp_redirect($link);
exit;
} else {
return;
}
//don't redirect if pmpro_register_redirect filter returns false or a blank URL
}
//if theme my login is installed, redirect all logins to the login page
if (pmpro_is_plugin_active("theme-my-login/theme-my-login.php")) {
//check for the login page id and redirect there if we're not there already
global $post;
if (!empty($GLOBALS['theme_my_login']) && is_array($GLOBALS['theme_my_login']->options)) {
//an older version of TML stores it this way
if ($GLOBALS['theme_my_login']->options['page_id'] !== $post->ID) {
//redirect to the real login page
$link = get_permalink($GLOBALS['theme_my_login']->options['page_id']);
if ($_SERVER['QUERY_STRING']) {
$link .= "?" . $_SERVER['QUERY_STRING'];
}
wp_redirect($link);
exit;
}
} elseif (!empty($GLOBALS['theme_my_login']->options)) {
//another older version of TML stores it this way
if ($GLOBALS['theme_my_login']->options->options['page_id'] !== $post->ID) {
//redirect to the real login page
$link = get_permalink($GLOBALS['theme_my_login']->options->options['page_id']);
if ($_SERVER['QUERY_STRING']) {
$link .= "?" . $_SERVER['QUERY_STRING'];
}
wp_redirect($link);
exit;
}
} elseif (class_exists("Theme_My_Login") && defined('Theme_My_Login::version') && version_compare(Theme_My_Login::version, "6.3") >= 0) {
//TML > 6.3
$link = Theme_My_Login::get_page_link("login");
if (!empty($link)) {
//redirect if !is_page(), i.e. we're on wp-login.php
if (!Theme_My_Login::is_tml_page()) {
wp_redirect($link);
exit;
}
}
}
//make sure users are only getting to the profile when logged in
global $current_user;
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "profile" && !$current_user->ID) {
$link = get_permalink($GLOBALS['theme_my_login']->options->options['page_id']);
wp_redirect($link);
exit;
}
}
}
}
开发者ID:Tanya-atsocial,项目名称:paid-memberships-pro,代码行数:63,代码来源:login.php
示例19: save_settings
/**
* Sanitizes TML settings
*
* This is the callback for register_setting()
*
* @since 6.0
* @access public
*
* @param string|array $settings Settings passed in from filter
* @return string|array Sanitized settings
*/
function save_settings($settings)
{
global $theme_my_login;
// Sanitize new settings
$settings['page_id'] = absint($settings['page_id']);
$settings['show_page'] = isset($settings['show_page']);
$settings['enable_css'] = isset($settings['enable_css']);
$settings['email_login'] = isset($settings['email_login']);
$modules = isset($_POST['theme_my_login_modules']) ? $_POST['theme_my_login_modules'] : array();
// If we have modules to activate
if ($activate = array_diff((array) $modules, (array) $theme_my_login->options->get_option('active_modules'))) {
// Attempt to activate them
$result = $this->activate_modules($activate);
// Check for WP_Error
if (is_wp_error($result)) {
// Loop through each module in the WP_Error object
foreach ($result->get_error_data('modules_invalid') as $module => $wp_error) {
// Store the module and error message to a temporary array which will be passed to 'admin_notices'
if (is_wp_error($wp_error)) {
$theme_my_login->options->options['module_errors'][$module] = $wp_error->get_error_message();
}
}
}
}
// If we have modules to deactivate
if ($deactivate = array_diff((array) $theme_my_login->options->get_option('active_modules'), $modules)) {
// Deactive them
$this->deactivate_modules($deactivate);
}
// Flush permalinks if they have changed
if (isset($settings['permalinks'])) {
foreach ($settings['permalinks'] as $action => $slug) {
if ($slug !== $theme_my_login->options->get_option(array('permalinks', $action))) {
$settings['flush_rules'] = true;
break;
}
}
}
// Merge current settings
$settings = Theme_My_Login::array_merge_recursive($theme_my_login->options->options, $settings);
// Allow plugins/modules to add/modify settings
$settings = apply_filters('tml_save_settings', $settings);
return $settings;
}
开发者ID:moscarar,项目名称:cityhow,代码行数:55,代码来源:class-theme-my-login-admin.php
示例20: get_redirect_url
/**
* Returns the proper redirect URL according to action
*
* @since 6.0
* @access public
*
* @param string $action The action
* @return string The redirect URL
*/
public function get_redirect_url($action = '')
{
$theme_my_login = Theme_My_Login::get_object();
if (empty($action)) {
$action = $this->get_option('default_action');
}
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
switch ($action) {
case 'lostpassword':
case 'retrievepassword':
$url = apply_filters('lostpassword_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_page_link('login', 'checkemail=confirm'));
break;
case 'register':
$url = apply_filters('registration_redirect', !empty($redirect_to) ? $redirect_to : Theme_My_Login::get_page_link('login', 'checkemail=registered'));
break;
case 'login':
default:
$url = apply_filters('login_redirect', !empty($redirect_to) ? $redirect_to : admin_url(), $redirect_to, null);
}
return apply_filters('tml_redirect_url', $url, $action);
}
开发者ID:doobas,项目名称:kazinopaslaptys,代码行数:30,代码来源:class-theme-my-login-template.php
注:本文中的Theme_My_Login类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论