本文整理汇总了PHP中Course::get_permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::get_permalink方法的具体用法?PHP Course::get_permalink怎么用?PHP Course::get_permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::get_permalink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cp_mp_order_notification_body
public static function cp_mp_order_notification_body($content, $order)
{
if ('3.0' === self::get_base() && !is_object($order) && !empty($order)) {
$order = new MP_Order($order);
}
if (cp_get_order_course_id($order->ID)) {
$course_id = cp_get_order_course_id($order->ID);
$course = new Course($course_id);
$tags = array('CUSTOMER_NAME', 'BLOG_NAME', 'LOGIN_ADDRESS', 'WEBSITE_ADDRESS', 'COURSE_ADDRESS', 'COURSE_TITLE', 'ORDER_ID', 'ORDER_STATUS_URL');
$course_title = '';
$course_address = '';
$order_name = '';
$tracking_url = '';
switch (self::get_base()) {
case '3.0':
$cart = $order->get_cart();
$items = $cart->get_items();
$order_post = get_post($order->ID);
$course_title = '';
$course_address = '';
$order_name = $order->get_meta('mp_billing_info->first_name') . ' ' . $order->get_meta('mp_billing_info->last_name');
$counter = 0;
foreach ($items as $product_id => $qty) {
$counter += 1;
$course_id = (int) get_post_meta($product_id, 'course_id', true);
$course_title .= get_post_field('post_title', $course_id);
$course_address .= get_permalink($course_id);
if (count($items) > 0 && $counter !== count($items)) {
$course_title .= ', ';
$course_address .= ', ';
}
}
$tracking_url = apply_filters('wpml_marketpress_tracking_url', mp_orderstatus_link(false, true) . $order_post->post_title . '/');
break;
case '2.0':
$order_name = $order->mp_shipping_info['name'];
$course_address = $course->get_permalink();
$course_title = $course->details->post_title;
$tracking_url = apply_filters('wpml_marketpress_tracking_url', mp_orderstatus_link(false, true) . $order->post_title . '/');
break;
}
$tags_replaces = array($order_name, get_bloginfo(), cp_student_login_address(), home_url(), $course_address, $course_title, $order->ID, $tracking_url);
$message = coursepress_get_mp_order_content_email();
$message = str_replace($tags, $tags_replaces, $message);
add_filter('wp_mail_from', 'my_mail_from_function', 99);
if (!function_exists('my_mail_from_function')) {
function my_mail_from_function($email)
{
return coursepress_get_mp_order_from_email();
}
}
add_filter('wp_mail_from_name', 'my_mail_from_name_function', 99);
if (!function_exists('my_mail_from_name_function')) {
function my_mail_from_name_function($name)
{
return coursepress_get_mp_order_from_name();
}
}
return $message;
} else {
return $content;
}
}
示例2: array
//.........这里部分代码省略.........
$form_errors++;
}
if (isset($_POST['tos_agree'])) {
if ($_POST['tos_agree'] == '0') {
$form_message = __('You must agree to the Terms of Service in order to signup.', 'cp');
$form_message_class = 'red';
$form_errors++;
}
}
if ($form_errors == 0) {
if ($student_id = $student->add_student($student_data) !== 0) {
//$form_message = __( 'Account created successfully! You may now <a href="' . ( get_option( 'use_custom_login_form', 1 ) ? trailingslashit( site_url() . '/' . $this->get_login_slug() ) : wp_login_url() ) . '">log into your account</a>.', 'cp' );
//$form_message_class = 'regular';
$email_args['email_type'] = 'student_registration';
$email_args['student_id'] = $student_id;
$email_args['student_email'] = $student_data['user_email'];
$email_args['student_first_name'] = $student_data['first_name'];
$email_args['student_last_name'] = $student_data['last_name'];
$email_args['student_username'] = $student_data['user_login'];
$email_args['student_password'] = $student_data['user_pass'];
coursepress_send_email($email_args);
$creds = array();
$creds['user_login'] = $student_data['user_login'];
$creds['user_password'] = $student_data['user_pass'];
$creds['remember'] = true;
$user = wp_signon($creds, false);
if (is_wp_error($user)) {
$form_message = $user->get_error_message();
$form_message_class = 'red';
}
// if( defined('DOING_AJAX') && DOING_AJAX ) { cp_write_log('doing ajax'); }
if (isset($_POST['course_id']) && is_numeric($_POST['course_id'])) {
$course = new Course($_POST['course_id']);
wp_redirect($course->get_permalink());
} else {
if (!empty($redirect_url)) {
wp_redirect(apply_filters('coursepress_redirect_after_signup_redirect_url', $redirect_url));
} else {
wp_redirect(apply_filters('coursepress_redirect_after_signup_url', CoursePress::instance()->get_student_dashboard_slug(true)));
}
}
exit;
} else {
$form_message = __('An error occurred while creating the account. Please check the form and try again.', 'cp');
$form_message_class = 'red';
}
}
} else {
$form_message = __('Sorry, that email address is already used!', 'cp');
$form_message_class = 'error';
}
} else {
$form_message = __('Username already exists. Please choose another one.', 'cp');
$form_message_class = 'red';
}
} else {
$form_message = __('All fields are required.', 'cp');
$form_message_class = 'red';
}
} else {
$form_message = __('All fields are required.', 'cp');
}
?>
<?php
//ob_start();
if (!empty($signup_title)) {
示例3: Course
function virtual_page_template()
{
global $post, $wp_query;
if (isset($post) && $post->post_type == 'virtual_page') {
$theme_file = locate_template(array('page.php'));
if ($theme_file != '') {
include TEMPLATEPATH . "/page.php";
exit;
}
}
if (cp_use_woo() && cp_redirect_woo_to_course()) {
if (isset($post) && $post->post_type == 'product') {
if (isset($post->post_parent)) {
//parent course
if ($post->post_parent !== 0 && get_post_type($post->post_parent) == 'course') {
$course = new Course($post->post_parent);
wp_redirect($course->get_permalink());
exit;
}
}
}
} else {
if (isset($post) && $post->post_type == 'product' && $wp_query->is_page) {
if (isset($post->post_parent)) {
//parent course
if ($post->post_parent !== 0 && get_post_type($post->post_parent) == 'course') {
$course = new Course($post->post_parent);
wp_redirect($course->get_permalink());
exit;
}
}
}
}
}
示例4: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
echo $before_widget;
$course_id = $instance['course'];
$course = new Course($course_id);
$selected_type = isset($instance['type']) ? $instance['type'] : 'image';
$selected_priority = isset($instance['priority']) ? $instance['priority'] : 'image';
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
?>
<div class=fcp_featured_widget cp_featured_widget-course-<?php
echo $course_id;
?>
">
<h3 class="cp_featured_widget_title"><?php
echo esc_html($course->details->post_title);
?>
</h3>
<?php
echo do_shortcode('[course_media type="' . $selected_type . '" priority="' . $selected_priority . '" course_id="' . $course_id . '"]');
?>
<div class="cp_featured_widget_course_summary">
<?php
echo do_shortcode('[course_summary course_id="' . $course_id . '" length="30"]');
?>
</div>
<div class="cp_featured_widget_course_link">
<button data-link="<?php
echo esc_url($course->get_permalink($course_id));
?>
"><?php
echo esc_html($instance['button_title']);
?>
</button>
</div>
</div>
<?php
echo $after_widget;
}
示例5: printf
printf(__('Congratulations, you have successfully enrolled in "%s" course! Check your %s for more info.', 'cp'), '<strong>' . $course->details->post_title . '</strong>', '<a href="' . $this->get_student_dashboard_slug(true) . '">' . __('Dashboard', 'cp') . '</a>');
} else {
_e('Something went wrong during the enrollment process. Please try again later.', 'cp');
}
} else {
if ($course->is_user_purchased_course($course->details->marketpress_product, get_current_user_ID())) {
//Enroll student in
if ($student->enroll_in_course($course_id)) {
printf(__('Congratulations, you have successfully enrolled in "%s" course! Check your %s for more info.', 'cp'), '<strong>' . $course->details->post_title . '</strong>', '<a href="' . $this->get_student_dashboard_slug(true) . '">' . __('Dashboard', 'cp') . '</a>');
} else {
_e('Something went wrong during the enrollment process. Please try again later.', 'cp');
}
} else {
$course->show_purchase_form($course->details->marketpress_product);
}
}
} else {
printf(__('Passcode is not valid. Please %s and try again.', 'cp'), '<a href="' . esc_url($course->get_permalink()) . '">' . __('go back', 'cp') . '</a>');
}
} else {
// if( defined('DOING_AJAX') && DOING_AJAX ) { cp_write_log('doing ajax'); }
// _e( 'You have already enrolled in the course.', 'cp' ); //can't enroll more than once to the same course at the time
wp_redirect(trailingslashit($course->get_permalink()) . 'units');
exit;
}
} else {
_e('Please select a course first you want to enroll in.', 'cp');
}
} else {
_e('You must be logged in in order to complete the action', 'cp');
}
示例6: coursepress_send_email
function coursepress_send_email($email_args = array())
{
if ($email_args['email_type'] == 'student_registration') {
global $course_slug;
$email_address = $email_args['student_email'];
$subject = coursepress_get_registration_email_subject();
$courses_address = trailingslashit(home_url()) . trailingslashit($course_slug);
$tags = array('STUDENT_FIRST_NAME', 'STUDENT_LAST_NAME', 'STUDENT_USERNAME', 'STUDENT_PASSWORD', 'BLOG_NAME', 'LOGIN_ADDRESS', 'COURSES_ADDRESS', 'WEBSITE_ADDRESS');
$tags_replaces = array($email_args['student_first_name'], $email_args['student_last_name'], $email_args['student_username'], $email_args['student_password'], get_bloginfo(), cp_student_login_address(), $courses_address, home_url());
$message = coursepress_get_registration_content_email();
$message = str_replace($tags, $tags_replaces, $message);
add_filter('wp_mail_from', 'my_registration_from_function');
if (!function_exists('my_registration_from_function')) {
function my_registration_from_function($email)
{
return coursepress_get_registration_from_email();
}
}
add_filter('wp_mail_from_name', 'my_registration_from_name_function');
if (!function_exists('my_registration_from_name_function')) {
function my_registration_from_name_function($name)
{
return coursepress_get_registration_from_name();
}
}
}
if ($email_args['email_type'] == 'enrollment_confirmation') {
global $course_slug;
$email_address = $email_args['student_email'];
$dashboard_address = $email_args['dashboard_address'];
$subject = coursepress_get_enrollment_email_subject();
$courses_address = trailingslashit(home_url()) . trailingslashit($course_slug);
$course = new Course($email_args['course_id']);
$tags = array('STUDENT_FIRST_NAME', 'STUDENT_LAST_NAME', 'BLOG_NAME', 'LOGIN_ADDRESS', 'COURSES_ADDRESS', 'WEBSITE_ADDRESS', 'COURSE_ADDRESS', 'COURSE_TITLE', 'STUDENT_DASHBOARD');
$tags_replaces = array($email_args['student_first_name'], $email_args['student_last_name'], get_bloginfo(), cp_student_login_address(), $courses_address, home_url(), $course->get_permalink(), $course->details->post_title, $email_args['dashboard_address']);
$message = coursepress_get_enrollment_content_email();
$message = str_replace($tags, $tags_replaces, $message);
add_filter('wp_mail_from', 'my_enrollment_from_function');
if (!function_exists('my_enrollment_from_function')) {
function my_enrollment_from_function($email)
{
return coursepress_get_enrollment_from_email();
}
}
add_filter('wp_mail_from_name', 'my_enrollment_from_name_function');
if (!function_exists('my_enrollment_from_name_function')) {
function my_enrollment_from_name_function($name)
{
return coursepress_get_enrollment_from_name();
}
}
}
if ($email_args['email_type'] == 'student_invitation') {
global $course_slug;
$email_address = $email_args['student_email'];
if (isset($email_args['course_id'])) {
$course = new Course($email_args['course_id']);
}
$tags = array('STUDENT_FIRST_NAME', 'STUDENT_LAST_NAME', 'COURSE_NAME', 'COURSE_EXCERPT', 'COURSE_ADDRESS', 'WEBSITE_ADDRESS', 'PASSCODE');
$tags_replaces = array($email_args['student_first_name'], $email_args['student_last_name'], $course->details->post_title, $course->details->post_excerpt, $course->get_permalink(), home_url(), $course->details->passcode);
if ($email_args['enroll_type'] == 'passcode') {
$message = coursepress_get_invitation_content_passcode_email();
$subject = coursepress_get_invitation_passcode_email_subject();
} else {
$message = coursepress_get_invitation_content_email();
$subject = coursepress_get_invitation_email_subject();
}
$message = str_replace($tags, $tags_replaces, $message);
add_filter('wp_mail_from', 'my_passcode_from_function');
if (!function_exists('my_passcode_from_function')) {
function my_passcode_from_function($email)
{
return coursepress_get_invitation_passcode_from_email();
}
}
add_filter('wp_mail_from_name', 'my_passcode_from_name_function');
if (!function_exists('my_passcode_from_name_function')) {
function my_passcode_from_name_function($name)
{
return coursepress_get_invitation_passcode_from_name();
}
}
}
if ('instructor_invitation' == $email_args['email_type']) {
global $course_slug;
$course = '';
$course_summary = '';
$course_name = '';
$courses_address = trailingslashit(home_url()) . trailingslashit($course_slug);
$bugfix = false;
if (isset($email_args['course_id'])) {
$course = new Course($email_args['course_id']);
$course_name = $course->details->post_title;
$course_summary = $course->details->post_excerpt;
// For unpublished courses.
$permalink = '';
if (in_array($course->details->post_status, array('draft', 'pending', 'auto-draft'))) {
$permalink = CoursePress::instance()->get_course_slug(true) . '/' . $course->details->post_name . '/';
} else {
$permalink = get_permalink($email_args['course_id']);
//.........这里部分代码省略.........