本文整理汇总了PHP中ThemexCore::getURL方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemexCore::getURL方法的具体用法?PHP ThemexCore::getURL怎么用?PHP ThemexCore::getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemexCore
的用法示例。
在下文中一共展示了ThemexCore::getURL方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: completeCourse
/**
* Completes course
*
* @access public
* @return void
*/
public static function completeCourse()
{
if (self::isMember() && self::$data['progress'] == 100) {
ThemexCore::addUserRelation(get_current_user_id(), self::$data['ID'], 'certificate', current_time('timestamp'));
$message = ThemexCore::getOption('email_certificate');
if (!empty($message)) {
$data = wp_get_current_user();
if (self::hasCertificate()) {
$link = ThemexCore::getURL('certificate', themex_encode(self::$data['ID'], get_current_user_id()));
} else {
$link = get_permalink(self::$data['ID']);
}
$keywords = array('username' => $data->user_login, 'title' => get_the_title(self::$data['ID']), 'link' => $link);
themex_mail($data->user_email, __('Course Completed', 'academy'), themex_keywords($message, $keywords));
}
}
}
示例2: getAttachments
/**
* Gets lesson attachments
*
* @access public
* @param int $ID
* @return array
*/
public static function getAttachments($ID)
{
$attachments = array_values(themex_filter(ThemexCore::getPostMeta($ID, 'lesson_attachments')));
foreach ($attachments as $index => &$attachment) {
$attachment['redirect'] = ThemexCore::getURL('file', themex_encode($index, $ID));
}
return $attachments;
}
示例3: _e
<?php
if (!ThemexCore::checkOption('course_retake')) {
?>
<a href="#" class="element-button secondary medium submit-button left"><?php
_e('Unsubscribe Now', 'academy');
?>
</a>
<input type="hidden" name="course_action" value="remove_user" />
<?php
}
?>
<?php
if (ThemexCourse::hasCertificate()) {
?>
<a href="<?php
echo ThemexCore::getURL('certificate', themex_encode(ThemexCourse::$data['ID'], ThemexUser::$data['user']['ID']));
?>
" target="_blank" class="element-button medium certificate-button"><?php
_e('View Certificate', 'academy');
?>
</a>
<?php
}
?>
<?php
}
}
?>
<input type="hidden" name="course_id" value="<?php
echo ThemexCourse::$data['ID'];
?>
示例4: loginUser
/**
* Logins Facebook user
*
* @access public
* @return void
*/
public static function loginUser()
{
if (isset($_GET['facebook_login']) && !is_user_logged_in() && isset($_COOKIE['fbsr_' . ThemexCore::getOption('facebook_id')])) {
$cookie = self::decodeCookie();
if (isset($cookie['code'])) {
$profile = self::getProfile($cookie['user_id'], array('fields' => 'first_name,last_name,email', 'code' => $cookie['code'], 'sslverify' => 0));
if (isset($profile['email'])) {
$user = get_user_by('email', sanitize_email($profile['email']));
if ($user !== false) {
$ID = $user->ID;
wp_set_auth_cookie($user->ID, true);
} else {
if (isset($profile['first_name'])) {
$profile['username'] = $profile['first_name'];
} else {
if (isset($profile['last_name'])) {
$profile['username'] = $profile['last_name'];
}
}
$profile['username'] = sanitize_user($profile['username']);
$profile['password'] = wp_generate_password(8);
while (username_exists($profile['username'])) {
$profile['username'] .= rand(0, 9);
}
$ID = wp_create_user($profile['username'], $profile['password'], $profile['email']);
if (!is_wp_error($ID)) {
wp_new_user_notification($ID);
add_user_meta($ID, 'facebook_id', $profile['id'], true);
self::updateImage($profile['id'], $ID);
if (isset($profile['first_name'])) {
update_user_meta($ID, 'first_name', $profile['first_name']);
}
if (isset($profile['last_name'])) {
update_user_meta($ID, 'last_name', $profile['last_name']);
}
$subject = __('Registration Complete', 'academy');
$message = ThemexCore::getOption('email_registration', 'Hi, %username%! Welcome to ' . get_bloginfo('name') . '. ');
$keywords = array('username' => $profile['username'], 'password' => $profile['password'], 'link' => home_url());
wp_set_auth_cookie($ID, true);
themex_mail($profile['email'], $subject, themex_keywords($message, $keywords));
} else {
self::logoutUser();
}
}
//redirect here
if (isset($_GET['user_redirect']) && !empty($_GET['user_redirect'])) {
$redirect = ThemexCore::getURL('redirect', intval($_GET['user_redirect']));
} else {
$redirect = get_author_posts_url($ID);
}
wp_redirect($redirect);
exit;
}
}
wp_redirect(SITE_URL);
exit;
}
}
示例5: _e
<a href="#" title="<?php
_e('Add to Favorites', 'makery');
?>
" class="element-submit primary" data-title="<?php
_e('Remove from Favorites', 'makery');
?>
"><span class="fa fa-heart small"></span></a>
<input type="hidden" name="user_action" class="toggle" value="add_relation" data-value="remove_relation" />
<?php
}
?>
<?php
} else {
?>
<a href="<?php
echo ThemexCore::getURL('register');
?>
" title="<?php
_e('Add to Favorites', 'makery');
?>
" class="primary"><span class="fa fa-heart small"></span></a>
<?php
}
?>
<?php
}
?>
<input type="hidden" name="relation_type" value="product" />
<input type="hidden" name="relation_id" value="<?php
echo $product->id;
?>
示例6: registerUser
/**
* Registers user
*
* @access public
* @param array $data
* @return void
*/
public static function registerUser($data)
{
if (ThemexCore::checkOption('user_captcha')) {
session_start();
if (isset($data['captcha']) && isset($_SESSION['captcha'])) {
$posted_code = md5($data['captcha']);
$session_code = $_SESSION['captcha'];
if ($session_code != $posted_code) {
ThemexInterface::$messages[] = __('Verification code is incorrect', 'makery');
}
} else {
ThemexInterface::$messages[] = __('Verification code is empty', 'makery');
}
}
if (empty($data['user_email']) || empty($data['user_login']) || empty($data['user_password']) || empty($data['user_password_repeat'])) {
ThemexInterface::$messages[] = __('Please fill in all fields', 'makery');
} else {
if (!is_email($data['user_email'])) {
ThemexInterface::$messages[] = __('Invalid email address', 'makery');
} else {
if (email_exists($data['user_email'])) {
ThemexInterface::$messages[] = __('This email is already in use', 'makery');
}
}
if (!validate_username($data['user_login']) || is_email($data['user_login']) || preg_match('/\\s/', $data['user_login'])) {
ThemexInterface::$messages[] = __('Invalid character used in username', 'makery');
} else {
if (username_exists($data['user_login'])) {
ThemexInterface::$messages[] = __('This username is already taken', 'makery');
}
}
if (strlen($data['user_password']) < 4) {
ThemexInterface::$messages[] = __('Password must be at least 4 characters long', 'makery');
} else {
if (strlen($data['user_password']) > 16) {
ThemexInterface::$messages[] = __('Password must be not more than 16 characters long', 'makery');
} else {
if (preg_match("/^([a-zA-Z0-9@#-_\$%^&+=!?]{1,20})\$/", $data['user_password']) == 0) {
ThemexInterface::$messages[] = __('Password contains invalid characters', 'makery');
} else {
if ($data['user_password'] != $data['user_password_repeat']) {
ThemexInterface::$messages[] = __('Passwords do not match', 'makery');
}
}
}
}
}
if (empty(ThemexInterface::$messages)) {
$user = wp_create_user($data['user_login'], $data['user_password'], $data['user_email']);
$content = ThemexCore::getOption('email_registration', 'Hi, %username%! Welcome to ' . get_bloginfo('name') . '.');
wp_new_user_notification($user);
$keywords = array('username' => $data['user_login'], 'password' => $data['user_password']);
if (ThemexCore::checkOption('user_activation')) {
ThemexInterface::$messages[] = __('Registration complete! Check your mailbox to activate the account', 'makery');
$subject = __('Account Confirmation', 'makery');
$activation_key = md5(uniqid(rand(), 1));
$user = new WP_User($user);
$user->remove_role(get_option('default_role'));
$user->add_role('inactive');
ThemexCore::updateUserMeta($user->ID, 'activation_key', $activation_key);
if (strpos($content, '%link%') === false) {
$content .= ' Click this link to activate your account %link%';
}
$link = ThemexCore::getURL('register');
if (intval(substr($link, -1)) == 1) {
$link .= '&';
} else {
$link .= '?';
}
$keywords['link'] = $link . 'activate=' . urlencode($activation_key) . '&user=' . $user->ID;
} else {
$object = new WP_User($user);
$object->remove_role(get_option('default_role'));
$object->add_role('contributor');
wp_signon($data, false);
$subject = __('Registration Complete', 'makery');
ThemexInterface::$messages[] = '<a href="' . get_author_posts_url($user) . '" class="redirect"></a>';
}
$content = themex_keywords($content, $keywords);
themex_mail($data['user_email'], $subject, $content);
ThemexInterface::renderMessages(true);
} else {
ThemexInterface::renderMessages();
}
die;
}
示例7: loginUser
/**
* Logins user
*
* @access public
* @param array $data
* @return void
*/
public static function loginUser($data)
{
$data['remember'] = true;
$user = wp_signon($data, false);
if (is_wp_error($user) || empty($data['user_login']) || empty($data['user_password'])) {
ThemexInterface::$messages[] = __('Incorrect username or password', 'academy');
} else {
$role = array_shift($user->roles);
if ($role == 'inactive') {
ThemexInterface::$messages[] = __('This account is not activated', 'academy');
} else {
if (self::filterUser($user->ID)) {
ThemexInterface::$messages[] = __('This account is already in use', 'academy');
}
}
}
if (empty(ThemexInterface::$messages)) {
if (isset($data['user_redirect']) && !empty($data['user_redirect'])) {
$redirect = ThemexCore::getURL('redirect', intval($data['user_redirect']));
} else {
$redirect = get_author_posts_url($user->ID);
}
ThemexInterface::$messages[] = '<a href="' . $redirect . '" class="redirect"></a>';
} else {
wp_logout();
}
ThemexInterface::renderMessages();
die;
}
示例8:
<span class="fa fa-eye"></span>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
}
}
?>
<?php
if (ThemexShop::$data['status'] == 'publish') {
?>
<a href="<?php
echo ThemexCore::getURL('shop-product');
?>
" class="element-button primary"><?php
_e('Add Item', 'makery');
?>
</a>
<?php
}
?>
</div>
<?php
get_sidebar('profile-right');
get_footer();
示例9: date_i18n
"><?php
echo date_i18n(get_option('date_format'), strtotime($order['date']));
?>
</time>
</td>
<td><?php
echo $order['condition'];
?>
</td>
<td><?php
echo $order['total'];
?>
</td>
<td class="textright">
<a href="<?php
echo ThemexCore::getURL('shop-order', $order['ID']);
?>
" title="<?php
_e('Edit', 'makery');
?>
" class="element-button small square secondary">
<span class="fa fa-pencil"></span>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
示例10: updateImage
/**
* Updates product image
*
* @access public
* @param int $ID
* @param array $file
* @return void
*/
public static function updateImage($ID, $file)
{
if (empty($ID)) {
$ID = self::addProduct();
}
ThemexCore::updateImage($ID, $file);
wp_redirect(ThemexCore::getURL('shop-product', $ID));
exit;
}
示例11: updateProfile
/**
* Updates shop profile
*
* @access public
* @param int $ID
* @param array $data
* @return void
*/
public static function updateProfile($ID, $data)
{
$redirect = false;
if (empty($ID)) {
$ID = self::addShop();
$redirect = true;
}
$args = array('ID' => $ID);
//title
$title = trim(themex_value('title', $data));
if (empty($title)) {
ThemexInterface::$messages[] = __('Shop name field is required', 'makery');
} else {
$args['post_title'] = $title;
}
//category
if (themex_taxonomy('shop_category')) {
$category = intval(themex_value('category', $data));
if (empty($category)) {
ThemexInterface::$messages[] = __('Shop category field is required', 'makery');
} else {
$term = get_term($category, 'shop_category');
if (empty($term)) {
ThemexInterface::$messages[] = __('This shop category does not exist', 'makery');
} else {
wp_set_object_terms($ID, $term->name, 'shop_category');
}
}
}
//content
$content = trim(themex_value('content', $data));
if (empty($content)) {
ThemexInterface::$messages[] = __('Shop description field is required', 'makery');
} else {
$args['post_content'] = wp_kses($content, array('strong' => array(), 'em' => array(), 'a' => array('href' => array(), 'title' => array(), 'target' => array()), 'p' => array(), 'br' => array()));
}
ThemexCore::updatePostMeta($ID, 'about', themex_value('about', $data));
ThemexCore::updatePostMeta($ID, 'policy', themex_value('policy', $data));
if (empty(ThemexInterface::$messages)) {
$status = get_post_status($ID);
if ($status == 'draft') {
$args['post_status'] = 'pending';
if (ThemexCore::checkOption('shop_approve')) {
$args['post_status'] = 'publish';
}
$redirect = true;
} else {
ThemexInterface::$messages[] = __('Shop has been successfully saved', 'makery');
$_POST['success'] = true;
}
}
//update post
wp_update_post($args);
if ($redirect && empty(ThemexInterface::$messages)) {
wp_redirect(ThemexCore::getURL('shop-settings'));
exit;
}
}
示例12: _e
?>
"><?php
_e('My Links', 'academy');
?>
</a></li>
<?php
}
?>
<li <?php
if (get_query_var('profile-settings')) {
?>
class="current"<?php
}
?>
><a href="<?php
echo ThemexCore::getURL('profile-settings');
?>
"><?php
_e('My Settings', 'academy');
?>
</a></li>
<?php
if (ThemexWoo::isActive()) {
?>
<li <?php
if (get_the_ID() == get_option('woocommerce_myaccount_page_id')) {
?>
class="current"<?php
}
?>
><a href="<?php
示例13: renderTemplate
/**
* Renders page template
*
* @access public
* @param string $template
* @return string
*/
public static function renderTemplate($template)
{
foreach (ThemexCore::$components['rewrite_rules'] as $key => $rule) {
if (get_query_var($rule['name'])) {
if (isset($rule['private'])) {
if ($rule['private'] && !is_user_logged_in()) {
$redirect = ThemexCore::getURL('register');
if (empty($redirect)) {
$redirect = SITE_URL;
}
wp_redirect($redirect);
exit;
} else {
if (!$rule['private'] && is_user_logged_in()) {
wp_redirect(get_author_posts_url(get_current_user_id()));
exit;
}
}
}
$path = THEME_PATH;
if (file_exists(CHILD_PATH . 'template-' . $key . '.php')) {
$path = CHILD_PATH;
}
$template = $path . 'template-' . $key . '.php';
}
}
return $template;
}
示例14: the_content
</div>
<?php
}
?>
<div class="plan-description">
<?php
the_content();
?>
</div>
<?php
if (!ThemexWoo::isCheckout()) {
?>
<footer class="plan-footer">
<form action="<?php
echo themex_url(true, ThemexCore::getURL('register'));
?>
" method="POST">
<a href="#" class="element-button submit-button <?php
if ($post->menu_order != 1) {
?>
secondary<?php
}
?>
"><?php
_e('Subscribe Now', 'academy');
?>
</a>
<input type="hidden" name="course_action" value="subscribe_user" />
<input type="hidden" name="plan_id" value="<?php
echo $post->ID;