当前位置: 首页>>代码示例>>PHP>>正文


PHP Unit::get_unit_id_by_name方法代码示例

本文整理汇总了PHP中Unit::get_unit_id_by_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::get_unit_id_by_name方法的具体用法?PHP Unit::get_unit_id_by_name怎么用?PHP Unit::get_unit_id_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Unit的用法示例。


在下文中一共展示了Unit::get_unit_id_by_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Unit

 function unit_discussion($atts)
 {
     global $wp;
     if (array_key_exists('unitname', $wp->query_vars)) {
         $unit = new Unit();
         $unit_id = $unit->get_unit_id_by_name($wp->query_vars['unitname']);
     } else {
         $unit_id = 0;
     }
     $comments_args = array('label_submit' => 'Send', 'title_reply' => 'Write a Reply or Comment', 'comment_notes_after' => '', 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x('Comment', 'noun') . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>');
     ob_start();
     comment_form($comments_args, $unit_id);
     $content = ob_get_clean();
     return $content;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:15,代码来源:class.shortcodes.php

示例2: array


//.........这里部分代码省略.........
                 exit;
             } else {
                 $course_id = do_shortcode('[get_parent_course_id]');
                 // NOTIFICATIONS
                 $args = array('slug' => $wp->request, 'title' => get_the_title($course_id), 'content' => $this->get_template_details($this->plugin_dir . 'includes/templates/course-notifications-archive.php', $vars), 'type' => 'notifications', 'is_page' => true, 'is_singular' => true, 'is_archive' => false);
                 $pg = new CoursePress_Virtual_Page($args);
                 do_shortcode('[course_notifications_loop]');
             }
         }
         if ($units_archive_page) {
             $this->units_archive_subpage = 'units';
             $theme_file = locate_template(array('archive-unit.php'));
             if ($theme_file != '') {
                 do_shortcode('[course_units_loop]');
                 require_once $theme_file;
                 exit;
             } else {
                 $course_id = do_shortcode('[get_parent_course_id]');
                 // COURSE UNITS
                 $args = array('slug' => $wp->request, 'title' => get_the_title($course_id), 'content' => $this->get_template_details($this->plugin_dir . 'includes/templates/course-units-archive.php', $vars), 'type' => 'unit', 'is_page' => true, 'is_singular' => true, 'is_archive' => false);
                 $pg = new CoursePress_Virtual_Page($args);
                 do_shortcode('[course_units_loop]');
             }
             $user_id = get_current_user_id();
             $this->set_latest_activity($user_id);
             $this->upgrade_user_meta($user_id, $course_id);
         }
         if ($units_archive_grades_page) {
             $this->units_archive_subpage = 'grades';
             $theme_file = locate_template(array('archive-unit-grades.php'));
             if ($theme_file != '') {
                 do_shortcode('[course_units_loop]');
                 require_once $theme_file;
                 exit;
             } else {
                 $course_id = do_shortcode('[get_parent_course_id]');
                 // COURSE GRADES
                 $args = array('slug' => $wp->request, 'title' => get_the_title($course_id), 'content' => $this->get_template_details($this->plugin_dir . 'includes/templates/course-units-archive-grades.php', $vars), 'type' => 'unit', 'is_page' => true, 'is_singular' => true, 'is_archive' => false);
                 $pg = new CoursePress_Virtual_Page($args);
                 do_shortcode('[course_units_loop]');
             }
             $this->set_latest_activity(get_current_user_id());
         }
         if ($units_workbook_page) {
             $this->units_archive_subpage = 'workbook';
             $theme_file = locate_template(array('archive-unit-workbook.php'));
             if ($theme_file != '') {
                 do_shortcode('[course_units_loop]');
                 require_once $theme_file;
                 exit;
             } else {
                 $course_id = do_shortcode('[get_parent_course_id]');
                 // WORKBOOK
                 do_shortcode('[course_units_loop]');
                 $args = array('slug' => $wp->request, 'title' => get_the_title($course_id), 'content' => $this->get_template_details($this->plugin_dir . 'includes/templates/archive-unit-workbook.php', $vars), 'type' => 'unit', 'is_page' => true, 'is_singular' => true, 'is_archive' => false);
                 $pg = new CoursePress_Virtual_Page($args);
                 do_shortcode('[course_units_loop]');
             }
             $this->set_latest_activity(get_current_user_id());
         }
     }
     /* Show Unit single template */
     if (array_key_exists('coursename', $wp->query_vars) && array_key_exists('unitname', $wp->query_vars)) {
         $this->remove_pre_next_post();
         $vars = array();
         $unit = new Unit();
         $vars['course_id'] = Course::get_course_id_by_name($wp->query_vars['coursename']);
         $vars['unit_id'] = $unit->get_unit_id_by_name($wp->query_vars['unitname'], $vars['course_id']);
         //$this->set_course_visited( get_current_user_id(), Course::get_course_id_by_name( $wp->query_vars['coursename'] ) );
         $unit = new Unit($vars['unit_id']);
         $this->set_unit_visited(get_current_user_id(), $vars['unit_id']);
         $theme_file = locate_template(array('single-unit.php'));
         $forced_previous_completion_template = locate_template(array('single-previous-unit.php'));
         if (!Unit::is_unit_available($vars['unit_id']) && (!current_user_can('manage_options') && !CoursePress_Capabilities::can_update_course($vars['course_id']))) {
             if ($forced_previous_completion_template != '') {
                 do_shortcode('[course_unit_single]');
                 //required for getting unit results
                 require_once $forced_previous_completion_template;
                 exit;
             } else {
                 $args = array('slug' => $wp->request, 'title' => $unit->details->post_title, 'content' => __('This Unit is not available at the moment. Please check back later.', 'cp'), 'type' => 'page', 'is_page' => true, 'is_singular' => false, 'is_archive' => false);
                 $pg = new CoursePress_Virtual_Page($args);
             }
         } else {
             if ($theme_file != '') {
                 global $wp;
                 do_shortcode('[course_unit_single unit_id="' . $vars['unit_id'] . '"]');
                 //required for getting unit results
                 require_once $theme_file;
                 do_action('wp');
                 //fix for gravity
                 exit;
             } else {
                 $args = array('slug' => $wp->request, 'title' => isset($unit->details) ? get_the_title($unit->details->post_parent) : '', 'content' => $this->get_template_details($this->plugin_dir . 'includes/templates/course-units-single.php', $vars), 'type' => 'unit', 'is_page' => true, 'is_singular' => true, 'is_archive' => false);
                 $pg = new CoursePress_Virtual_Page($args);
             }
             $this->set_latest_activity(get_current_user_id());
         }
     }
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:101,代码来源:coursepress.php


注:本文中的Unit::get_unit_id_by_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。