Plugin Directory

Changeset 2611979


Ignore:
Timestamp:
10/10/2021 01:50:19 AM (4 years ago)
Author:
hellobeebee
Message:

处理图文社1.0.0的错误

Location:
beebee-mini/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • beebee-mini/trunk/bee-content/themes/_beebee_booker/theme_meta.php

    r2607393 r2611979  
    12911291                'choices' => array(
    12921292                    1 => '语音合成',
    1293                     2 => '自定义输入',
     1293                    2 => '音频文件',
    12941294                ),
    12951295                'allow_null' => 0,
     
    1066910669                                'instructions' => '',
    1067010670                                'required' => 0,
    10671                                 'conditional_logic' => array(
    10672                                     array(
    10673                                         array(
    10674                                             'field' => 'field_611b3a4a2009b',
    10675                                             'operator' => '==',
    10676                                             'value' => 'beebee_mode_custom_link_page',
    10677                                         ),
    10678                                     ),
    10679                                 ),
     10671                                'conditional_logic' => 0,
    1068010672                                'wrapper' => array(
    1068110673                                    'width' => '',
     
    1069110683                                'return_format' => 'id',
    1069210684                                'save_custom' => 0,
    10693                                 'save_post_type' => 'post',
    1069410685                                'save_post_status' => 'publish',
    1069510686                                'acfe_bidirectional' => array(
    1069610687                                    'acfe_bidirectional_enabled' => '0',
    10697                                     'acfe_bidirectional_related' => '',
    1069810688                                ),
    1069910689                                'ui' => 1,
     10690                            ),
     10691                            array(
     10692                                'key' => 'field_615ed83c95d5b',
     10693                                'label' => '页面标题',
     10694                                'name' => 'title',
     10695                                'type' => 'text',
     10696                                'instructions' => '',
     10697                                'required' => 0,
     10698                                'conditional_logic' => 0,
     10699                                'wrapper' => array(
     10700                                    'width' => '',
     10701                                    'class' => '',
     10702                                    'id' => '',
     10703                                ),
     10704                                'default_value' => '',
     10705                                'placeholder' => '',
     10706                                'prepend' => '',
     10707                                'append' => '',
     10708                                'maxlength' => '',
    1070010709                            ),
    1070110710                        ),
  • beebee-mini/trunk/bee-content/themes/_beebee_gallery/theme_meta.php

    r2607393 r2611979  
    303303                'label' => '合辑页显示素材列表',
    304304                'name' => 'bee_topic_library_show',
    305                 'type' => 'button_group',
     305                'type' => 'true_false',
    306306                'instructions' => '',
    307307                'required' => 0,
     
    319319                    'id' => '',
    320320                ),
    321                 'choices' => array(
    322                     1 => '显示',
    323                     0 => '隐藏',
    324                 ),
    325                 'allow_null' => 0,
     321                'message' => '',
    326322                'default_value' => 1,
    327                 'layout' => 'horizontal',
    328                 'return_format' => 'value',
     323                'ui' => 1,
     324                'ui_on_text' => '显示',
     325                'ui_off_text' => '隐藏',
    329326            ),
    330327            array(
     
    1017910176                                'instructions' => '',
    1018010177                                'required' => 0,
    10181                                 'conditional_logic' => array(
    10182                                     array(
    10183                                         array(
    10184                                             'field' => 'field_611b3a4a2009b',
    10185                                             'operator' => '==',
    10186                                             'value' => 'beebee_mode_custom_link_page',
    10187                                         ),
    10188                                     ),
    10189                                 ),
     10178                                'conditional_logic' => 0,
    1019010179                                'wrapper' => array(
    1019110180                                    'width' => '',
     
    1020110190                                'return_format' => 'id',
    1020210191                                'save_custom' => 0,
    10203                                 'save_post_type' => 'post',
    1020410192                                'save_post_status' => 'publish',
    1020510193                                'acfe_bidirectional' => array(
    1020610194                                    'acfe_bidirectional_enabled' => '0',
    10207                                     'acfe_bidirectional_related' => '',
    1020810195                                ),
    1020910196                                'ui' => 1,
  • beebee-mini/trunk/bee-content/themes/_beebee_gallery/theme_terms.php

    r2607393 r2611979  
    1 <?php 
     1<?php
    22function cptui_register_my_taxes() {
    33
    4 /**
    5  * Taxonomy: 素材分类.
    6  */
    7 
    8 $labels = [
    9     "name" => __( "素材分类", "appbeebee" ),
    10     "singular_name" => __( "素材分类", "appbeebee" ),
    11 ];
    12 
    13 $args = [
    14     "label" => __( "素材分类", "appbeebee" ),
    15     "labels" => $labels,
    16     "public" => true,
    17     "publicly_queryable" => true,
    18     "hierarchical" => true,
    19     "show_ui" => true,
    20     "show_in_menu" => true,
    21     "show_in_nav_menus" => true,
    22     "query_var" => true,
    23     "rewrite" => [ 'slug' => 'beebee_library_cats', 'with_front' => true, ],
    24     "show_admin_column" => false,
    25     "show_in_rest" => true,
    26     "rest_base" => "beebee_library_cats",
    27     "rest_controller_class" => "WP_REST_Terms_Controller",
    28     "show_in_quick_edit" => false,
    29         ];
    30 register_taxonomy( "beebee_library_cats", [ "beebee_library" ], $args );
    31 
    32 /**
    33  * Taxonomy: 素材状态.
    34  */
    35 
    36 $labels = [
    37     "name" => __( "素材状态", "appbeebee" ),
    38     "singular_name" => __( "素材状态", "appbeebee" ),
    39 ];
    40 
    41 $args = [
    42     "label" => __( "素材状态", "appbeebee" ),
    43     "labels" => $labels,
    44     "public" => true,
    45     "publicly_queryable" => true,
    46     "hierarchical" => true,
    47     "show_ui" => true,
    48     "show_in_menu" => true,
    49     "show_in_nav_menus" => true,
    50     "query_var" => true,
    51     "rewrite" => [ 'slug' => 'beebee_library_state', 'with_front' => true, ],
    52     "show_admin_column" => false,
    53     "show_in_rest" => true,
    54     "rest_base" => "beebee_library_state",
    55     "rest_controller_class" => "WP_REST_Terms_Controller",
    56     "show_in_quick_edit" => false,
    57         ];
    58 register_taxonomy( "beebee_library_state", [ "beebee_library" ], $args );
    59 
    60 /**
    61  * Taxonomy: 专题分类.
    62  */
    63 
    64 $labels = [
    65     "name" => __( "专题分类", "appbeebee" ),
    66     "singular_name" => __( "专题分类", "appbeebee" ),
    67 ];
    68 
    69 $args = [
    70     "label" => __( "专题分类", "appbeebee" ),
    71     "labels" => $labels,
    72     "public" => true,
    73     "publicly_queryable" => true,
    74     "hierarchical" => false,
    75     "show_ui" => true,
    76     "show_in_menu" => true,
    77     "show_in_nav_menus" => true,
    78     "query_var" => true,
    79     "rewrite" => [ 'slug' => 'beebee_topic_cats', 'with_front' => true, ],
    80     "show_admin_column" => false,
    81     "show_in_rest" => true,
    82     "rest_base" => "beebee_topic_cats",
    83     "rest_controller_class" => "WP_REST_Terms_Controller",
    84     "show_in_quick_edit" => false,
    85         ];
    86 register_taxonomy( "beebee_topic_cats", [ "beebee_topic" ], $args );
    87 }
    88 add_action( 'init', 'cptui_register_my_taxes' );
     4    /**
     5     * Taxonomy: 素材分类.
     6     */
     7   
     8    $labels = [
     9        "name" => __( "素材分类", "appbeebee" ),
     10        "singular_name" => __( "素材分类", "appbeebee" ),
     11    ];
     12   
     13    $args = [
     14        "label" => __( "素材分类", "appbeebee" ),
     15        "labels" => $labels,
     16        "public" => true,
     17        "publicly_queryable" => true,
     18        "hierarchical" => true,
     19        "show_ui" => true,
     20        "show_in_menu" => true,
     21        "show_in_nav_menus" => true,
     22        "query_var" => true,
     23        "rewrite" => [ 'slug' => 'beebee_library_cats', 'with_front' => true, ],
     24        "show_admin_column" => false,
     25        "show_in_rest" => true,
     26        "rest_base" => "beebee_library_cats",
     27        "rest_controller_class" => "WP_REST_Terms_Controller",
     28        "show_in_quick_edit" => false,
     29            ];
     30    register_taxonomy( "beebee_library_cats", [ "beebee_library" ], $args );
     31   
     32    /**
     33     * Taxonomy: 素材状态.
     34     */
     35   
     36    $labels = [
     37        "name" => __( "素材状态", "appbeebee" ),
     38        "singular_name" => __( "素材状态", "appbeebee" ),
     39    ];
     40   
     41    $args = [
     42        "label" => __( "素材状态", "appbeebee" ),
     43        "labels" => $labels,
     44        "public" => true,
     45        "publicly_queryable" => true,
     46        "hierarchical" => true,
     47        "show_ui" => true,
     48        "show_in_menu" => true,
     49        "show_in_nav_menus" => true,
     50        "query_var" => true,
     51        "rewrite" => [ 'slug' => 'beebee_library_state', 'with_front' => true, ],
     52        "show_admin_column" => false,
     53        "show_in_rest" => true,
     54        "rest_base" => "beebee_library_state",
     55        "rest_controller_class" => "WP_REST_Terms_Controller",
     56        "show_in_quick_edit" => false,
     57            ];
     58    register_taxonomy( "beebee_library_state", [ "beebee_library" ], $args );
     59   
     60    /**
     61     * Taxonomy: 合辑分类.
     62     */
     63   
     64    $labels = [
     65        "name" => __( "合辑分类", "appbeebee" ),
     66        "singular_name" => __( "合辑分类", "appbeebee" ),
     67    ];
     68   
     69    $args = [
     70        "label" => __( "合辑分类", "appbeebee" ),
     71        "labels" => $labels,
     72        "public" => true,
     73        "publicly_queryable" => true,
     74        "hierarchical" => true,
     75        "show_ui" => true,
     76        "show_in_menu" => true,
     77        "show_in_nav_menus" => true,
     78        "query_var" => true,
     79        "rewrite" => [ 'slug' => 'beebee_topic_cats', 'with_front' => true, ],
     80        "show_admin_column" => false,
     81        "show_in_rest" => true,
     82        "rest_base" => "beebee_topic_cats",
     83        "rest_controller_class" => "WP_REST_Terms_Controller",
     84        "show_in_quick_edit" => false,
     85            ];
     86    register_taxonomy( "beebee_topic_cats", [ "beebee_topic" ], $args );
     87    }
     88    add_action( 'init', 'cptui_register_my_taxes' );
     89   
  • beebee-mini/trunk/bee-include/include/hooks.php

    r2607393 r2611979  
    88        $post_date = $post->post_date;
    99        $_data["newdate"] = datetime_before($post_date);
    10     }
    11     $data->data = $_data;
    12     return $data;
    13 }, 10, 3);
    14 
    15 
    16 if (defined('LLMS_PLUGIN_FILE')) {
    17     add_filter('llms_rest_prepare_course_object_response', function ($data, $course, $request) {
    18 
    19         $course_id = $course->get('id');
    20         $course    = new LLMS_Course($course_id);
    21         $sections  = $course->get_sections();
    22         $courses_lessons = $course->get_lessons('ids');
    23         // array_unshift( $courses_lessons, '' );
    24         //              unset( $courses_lessons[0] );
    25         $all_lesson_count  = 0;
    26 
    27         $current_lesson    = 0;
    28         if (!empty($courses_lessons)) {
    29             $all_lesson_count = count($courses_lessons);
    30         }
    31 
    32         if ($sections) {
    33             $coursea = array();
    34             foreach ($sections as $section) {
    35                 $sectiona = array();
    36                 $sectiona['id'] = $section->get('id');
    37                 $sectiona['title'] = get_the_title($section->get('id'));
    38                 $sectiona['order'] = $section->order;
    39                 $lessons = $section->get_lessons();
    40                 foreach ($lessons as $lesson) {
    41                     $lessona = array();
    42 
    43                     $lessona['id'] = $lesson->id;
    44                     $lessona['title'] = $lesson->title;
    45                     $lessona['thumbnail'] = apply_filters('post_thumbnail', $lesson->id);
    46                     $lessona['type'] = $lesson->type;
    47                     $lessona['free_lesson'] = $lesson->free_lesson;
    48                     $lessona['order'] = $lesson->order;
    49 
    50                     $lessona['views'] = (int)get_post_meta($lesson->id, "views", true);
    51 
    52                     $number_of_lessons = 1;
    53                     foreach ($courses_lessons as $courses_lesson) {
    54 
    55                         if ($lessona['id'] == $courses_lesson) {
    56                             $current_lesson = $number_of_lessons;
    57                         }
    58                         $number_of_lessons++;
    59                     }
    60 
    61                     $lessona['current'] = $current_lesson;
    62 
    63                     $sectiona['lessons'][] = $lessona;
    64                     $sectiona['total_lessons'] = count($lessons);
    65                 }
    66                 $coursea['sections'][] = $sectiona;
    67                 $coursea['total_sections'] = count($sections);
    68             }
    69         }
    70         $data['content']['rendered'] = $coursea;
    71         $data['content']['library_id'] = get_field('bee_to_library', $course_id);
    72         $data['content']['course_state'] = get_field('state', $course_id);
    73         $data['content']['all_lesson_count'] = $all_lesson_count;
    74         $data['content']['showsectionmsg'] = get_field('showsectionmsg', $course_id);
    75 
    76         $data['content']['section_name'] = get_field('section_name', $course_id);
    77         $data['content']['lesson_name'] = get_field('lesson_name', $course_id);
    78         $data['content']['showthumb'] = get_field('showthumb', $course_id);
    79         $data['content']['showname'] = get_field('showname', $course_id);
    80         $data['content']['showtitle'] = get_field('showtitle', $course_id);
    81         return $data;
    82     }, 10, 3);
    83 
    84     add_filter('llms_rest_prepare_lesson_object_response', function ($data, $lesson, $request) {
    85         $lesson_id = $lesson->get('id');
    86 
    87         $lesson    = new LLMS_Lesson($lesson_id);
    88         $course_id = $lesson->get_parent_course();
    89         $course    = new LLMS_Course($course_id);
    90         $sections  = $course->get_sections();
    91         $section_id = $lesson->get_parent_section();
    92         $section    = new LLMS_Course($section_id);
    93         // $lesson_id = get_the_ID();
    94         $prev_id = $lesson->get_previous_lesson();
    95         $next_id = $lesson->get_next_lesson();
    96 
    97         $prevlesson = new LLMS_Lesson($prev_id);
    98         $nextlesson = new LLMS_Lesson($next_id);
    99 
    100         $prev_section_id = $prevlesson->get_parent_section();
    101         $next_section_id = $nextlesson->get_parent_section();
    102         $prevsectionlesson = new LLMS_Lesson($prev_section_id);
    103         $nextsectionlesson = new LLMS_Lesson($next_section_id);
    104 
    105         $prevlast = false;
    106         $nextlast = false;
    107 
    108 
    109         $courses_lessons = $course->get_lessons('ids');
    110         array_unshift($courses_lessons, '');
    111         unset($courses_lessons[0]);
    112         $all_lesson_count  = 0;
    113         $number_of_lessons = 1;
    114         $current_lesson    = 0;
    115         if (!empty($courses_lessons)) {
    116 
    117             $all_lesson_count = count($courses_lessons);
    118 
    119             foreach ($courses_lessons as $courses_lesson) {
    120 
    121                 if ($lesson_id == $courses_lesson) {
    122                     $current_lesson = $number_of_lessons;
    123                 }
    124                 $number_of_lessons++;
    125             }
    126         }
    127 
    128         $library_id = get_field('bee_to_library', $course_id)[0] ? get_field('bee_to_library', $course_id)[0] : 0;
    129        
    130 
    131         if ($prev_id) {
    132             $data['content']['prev_current_lesson'] = ($current_lesson - 1);
    133         } else {
    134             $prev_id = $library_id;
    135             $prevlast = true;
    136         }
    137 
    138         if ($next_id) {
    139             $data['content']['next_current_lesson'] = ($current_lesson + 1);
    140         } else {
    141             $next_id = $library_id;
    142             $nextlast = true;
    143         }
    144         $data['content']['prevlast'] = $prevlast;
    145         $data['content']['nextlast'] = $nextlast;
    146         $data['content']['course_id'] = $course_id;
    147         if ($library_id != 0) {
    148             $data['content']['library']['id']  = $library_id;
    149             $data['content']['library']['thumbnail']  = apply_filters('post_thumbnail', $library_id);
    150             $data['content']['library']['title']  = html_entity_decode(get_post($library_id)->post_title);
    151             $data['content']['library']['excerpt']  = html_entity_decode(get_post($library_id)->post_excerpt);
    152         }
    153         $data['content']['previous_id'] = $prev_id;
    154         $data['content']['prev_lesson_order'] = $prevlesson->order;
    155         $data['content']['prev_section_order'] = $prevsectionlesson->order;
    156         // $data['content']['prev_current_lesson'] = $prev_current_lesson;
    157         $data['content']['prev_lesson_title'] = $prevlesson->title;
    158         $data['content']['next_id'] = $next_id;
    159         $data['content']['next_lesson_order'] = $nextlesson->order;
    160         $data['content']['next_section_order'] = $nextsectionlesson->order;
    161         // $data['content']['next_current_lesson'] = $next_current_lesson;
    162         $data['content']['next_lesson_title'] = $nextlesson->title;
    163         $data['content']['lesson_order'] = $lesson->order;
    164         $data['content']['section_order'] = $section->order;
    165         $data['content']['free_lesson'] = $lesson->free_lesson;
    166         $data['content']['all_lesson_count'] = $all_lesson_count;
    167         $data['content']['current_lesson'] = $current_lesson;
    168         $data['content']['showsectionmsg'] = get_field('showsectionmsg', $course_id);
    169         $data['content']['section_name'] = get_field('section_name', $course_id);
    170         $data['content']['lesson_name'] = get_field('lesson_name', $course_id);
    171         $data['content']['showthumb'] = get_field('showthumb', $course_id);
    172         $data['content']['showname'] = get_field('showname', $course_id);
    173         $data['content']['showtitle'] = get_field('showtitle', $course_id);
    174         $data['content']['acf']["cntctrl"] = get_field('cntctrl', $lesson_id);
    175         $data['content']['acf']["before_entry"] = get_field('before_entry', $lesson_id);
    176         $data['content']['acf']["after_entry"] = get_field('after_entry', $lesson_id);
    177         $session = isset($request['access_token']) ? $request['access_token'] : '';
    178         if ($session) {
    179             $access_token = base64_decode($session);
    180             $users = MP_Auth::login($access_token);
    181             if ($users) {
    182                 $user_id = $users->ID;
    183             } else {
    184                 $user_id = 0;
    185             }
    186         } else {
    187             $user_id = 0;
    188         }
    189         $data['content']["islike"] = apply_filters('miniprogram_commented', $lesson_id, $user_id, 'like');
    190         $data['content']["likes"] = apply_filters('comment_type_count', $lesson_id, 'like');
    191         $data['content']["post_likes"] = apply_filters('comment_type_list', $lesson_id, 'like');
    192 
    193 
    194         return $data;
    195     }, 10, 3);
    196 }
    197 
    198 function rest_prepare_fields($data, $post, $request)
    199 {
    200     $isinclude = '';
    201     $options = apply_filters('getmiss', $isinclude);
    202     if (!defined($options)) {
    203         return;
    204     }
    205     $_data = $data->data;
    206     $post_id = $post->ID;
    207     if (is_miniprogram() || is_debug()) {
    208         $post_date = $post->post_date;
    209         $post_modified = $post->post_modified;
    210         $post_type = $post->post_type;
    211         $author_id = $post->post_author;
    212         $author_avatar = get_user_meta($author_id, 'avatar', true);
    213         $taxonomies = get_object_taxonomies($_data['type']);
    214         $post_title = $post->post_title;
    215         $post_views = (int)get_post_meta($post_id, "views", true);
    216         $post_excerpt = $post->post_excerpt;
    217         $post_content = $post->post_content;
    218         $session = isset($request['access_token']) ? $request['access_token'] : '';
    219         if ($session) {
    220             $access_token = base64_decode($session);
    221             $users = MP_Auth::login($access_token);
    222             if ($users) {
    223                 $user_id = $users->ID;
    224             } else {
    225                 $user_id = 0;
    226             }
    227         } else {
    228             $user_id = 0;
    229         }
    230         $_data["id"]  = $post_id;
    231         $_data["options"] = $options;
    232         $_data["date"] = $post_date;
    233         $_data["modified"] = $post_modified;
    234         $_data["newdate"] = datetime_before($post_date);
    235         $_data["week"] = get_wp_post_week($post_date);
    236         unset($_data['author']);
    237         $_data["author"]["id"] = $author_id;
    238         $_data["author"]["name"] = get_the_author_meta('nickname', $author_id);
    239         if ($author_avatar) {
    240             $_data["author"]["avatar"] = $author_avatar;
    241         } else {
    242             $_data["author"]["avatar"] = get_avatar_url($author_id);
    243         }
    244         $_data["author"]["description"] = get_the_author_meta('description', $author_id);
    245         if (get_post_meta($post_id, "source", true)) {
    246             $_data["meta"]["source"] = get_post_meta($post_id, "source", true);
    247         }
    248         $_data["meta"]["thumbnail"] = apply_filters('post_thumbnail', $post_id);
    249         $_data["meta"]["views"] = $post_views;
    250         $_data["meta"]["count"] = mp_count_post_content_text_length(wp_strip_all_tags($post_content));
    251         $_data["comments"] = apply_filters('comment_type_count', $post_id, 'comment');
    252         $_data["isfav"] = apply_filters('miniprogram_commented', $post_id, $user_id, 'fav');
    253         $_data["favs"] = apply_filters('comment_type_count', $post_id, 'fav');
    254         $_data["islike"] = apply_filters('miniprogram_commented', $post_id, $user_id, 'like');
    255         $_data["likes"] = apply_filters('comment_type_count', $post_id, 'like');
    256 
    25710        $bee_to_library = get_field('bee_to_library', $post_id);
    25811        if ($bee_to_library) {
     
    29346            $_data['acf']["bee_to_library"] = $__bee_to_library;
    29447        }
     48    }
     49    $data->data = $_data;
     50    return $data;
     51}, 10, 3);
     52
     53
     54if (defined('LLMS_PLUGIN_FILE')) {
     55    add_filter('llms_rest_prepare_course_object_response', function ($data, $course, $request) {
     56
     57        $course_id = $course->get('id');
     58        $course    = new LLMS_Course($course_id);
     59        $sections  = $course->get_sections();
     60        $courses_lessons = $course->get_lessons('ids');
     61        // array_unshift( $courses_lessons, '' );
     62        //              unset( $courses_lessons[0] );
     63        $all_lesson_count  = 0;
     64
     65        $current_lesson    = 0;
     66        if (!empty($courses_lessons)) {
     67            $all_lesson_count = count($courses_lessons);
     68        }
     69
     70        if ($sections) {
     71            $coursea = array();
     72            foreach ($sections as $section) {
     73                $sectiona = array();
     74                $sectiona['id'] = $section->get('id');
     75                $sectiona['title'] = get_the_title($section->get('id'));
     76                $sectiona['order'] = $section->order;
     77                $lessons = $section->get_lessons();
     78                foreach ($lessons as $lesson) {
     79                    $lessona = array();
     80
     81                    $lessona['id'] = $lesson->id;
     82                    $lessona['title'] = $lesson->title;
     83                    $lessona['thumbnail'] = apply_filters('post_thumbnail', $lesson->id);
     84                    $lessona['type'] = $lesson->type;
     85                    $lessona['free_lesson'] = $lesson->free_lesson;
     86                    $lessona['order'] = $lesson->order;
     87
     88                    $lessona['views'] = (int)get_post_meta($lesson->id, "views", true);
     89
     90                    $number_of_lessons = 1;
     91                    foreach ($courses_lessons as $courses_lesson) {
     92
     93                        if ($lessona['id'] == $courses_lesson) {
     94                            $current_lesson = $number_of_lessons;
     95                        }
     96                        $number_of_lessons++;
     97                    }
     98
     99                    $lessona['current'] = $current_lesson;
     100
     101                    $sectiona['lessons'][] = $lessona;
     102                    $sectiona['total_lessons'] = count($lessons);
     103                }
     104                $coursea['sections'][] = $sectiona;
     105                $coursea['total_sections'] = count($sections);
     106            }
     107        }
     108        $data['content']['rendered'] = $coursea;
     109        $data['content']['library_id'] = get_field('bee_to_library', $course_id);
     110        $data['content']['course_state'] = get_field('state', $course_id);
     111        $data['content']['all_lesson_count'] = $all_lesson_count;
     112        $data['content']['showsectionmsg'] = get_field('showsectionmsg', $course_id);
     113
     114        $data['content']['section_name'] = get_field('section_name', $course_id);
     115        $data['content']['lesson_name'] = get_field('lesson_name', $course_id);
     116        $data['content']['showthumb'] = get_field('showthumb', $course_id);
     117        $data['content']['showname'] = get_field('showname', $course_id);
     118        $data['content']['showtitle'] = get_field('showtitle', $course_id);
     119        return $data;
     120    }, 10, 3);
     121
     122    add_filter('llms_rest_prepare_lesson_object_response', function ($data, $lesson, $request) {
     123        $lesson_id = $lesson->get('id');
     124
     125        $lesson    = new LLMS_Lesson($lesson_id);
     126        $course_id = $lesson->get_parent_course();
     127        $course    = new LLMS_Course($course_id);
     128        $sections  = $course->get_sections();
     129        $section_id = $lesson->get_parent_section();
     130        $section    = new LLMS_Course($section_id);
     131        // $lesson_id = get_the_ID();
     132        $prev_id = $lesson->get_previous_lesson();
     133        $next_id = $lesson->get_next_lesson();
     134
     135        $prevlesson = new LLMS_Lesson($prev_id);
     136        $nextlesson = new LLMS_Lesson($next_id);
     137
     138        $prev_section_id = $prevlesson->get_parent_section();
     139        $next_section_id = $nextlesson->get_parent_section();
     140        $prevsectionlesson = new LLMS_Lesson($prev_section_id);
     141        $nextsectionlesson = new LLMS_Lesson($next_section_id);
     142
     143        $prevlast = false;
     144        $nextlast = false;
     145
     146
     147        $courses_lessons = $course->get_lessons('ids');
     148        array_unshift($courses_lessons, '');
     149        unset($courses_lessons[0]);
     150        $all_lesson_count  = 0;
     151        $number_of_lessons = 1;
     152        $current_lesson    = 0;
     153        if (!empty($courses_lessons)) {
     154
     155            $all_lesson_count = count($courses_lessons);
     156
     157            foreach ($courses_lessons as $courses_lesson) {
     158
     159                if ($lesson_id == $courses_lesson) {
     160                    $current_lesson = $number_of_lessons;
     161                }
     162                $number_of_lessons++;
     163            }
     164        }
     165
     166        $library_id = get_field('bee_to_library', $course_id)[0] ? get_field('bee_to_library', $course_id)[0] : 0;
     167       
     168
     169        if ($prev_id) {
     170            $data['content']['prev_current_lesson'] = ($current_lesson - 1);
     171        } else {
     172            $prev_id = $library_id;
     173            $prevlast = true;
     174        }
     175
     176        if ($next_id) {
     177            $data['content']['next_current_lesson'] = ($current_lesson + 1);
     178        } else {
     179            $next_id = $library_id;
     180            $nextlast = true;
     181        }
     182        $data['content']['prevlast'] = $prevlast;
     183        $data['content']['nextlast'] = $nextlast;
     184        $data['content']['course_id'] = $course_id;
     185        if ($library_id != 0) {
     186            $data['content']['library']['id']  = $library_id;
     187            $data['content']['library']['thumbnail']  = apply_filters('post_thumbnail', $library_id);
     188            $data['content']['library']['title']  = html_entity_decode(get_post($library_id)->post_title);
     189            $data['content']['library']['excerpt']  = html_entity_decode(get_post($library_id)->post_excerpt);
     190        }
     191        $data['content']['previous_id'] = $prev_id;
     192        $data['content']['prev_lesson_order'] = $prevlesson->order;
     193        $data['content']['prev_section_order'] = $prevsectionlesson->order;
     194        // $data['content']['prev_current_lesson'] = $prev_current_lesson;
     195        $data['content']['prev_lesson_title'] = $prevlesson->title;
     196        $data['content']['next_id'] = $next_id;
     197        $data['content']['next_lesson_order'] = $nextlesson->order;
     198        $data['content']['next_section_order'] = $nextsectionlesson->order;
     199        // $data['content']['next_current_lesson'] = $next_current_lesson;
     200        $data['content']['next_lesson_title'] = $nextlesson->title;
     201        $data['content']['lesson_order'] = $lesson->order;
     202        $data['content']['section_order'] = $section->order;
     203        $data['content']['free_lesson'] = $lesson->free_lesson;
     204        $data['content']['all_lesson_count'] = $all_lesson_count;
     205        $data['content']['current_lesson'] = $current_lesson;
     206        $data['content']['showsectionmsg'] = get_field('showsectionmsg', $course_id);
     207        $data['content']['section_name'] = get_field('section_name', $course_id);
     208        $data['content']['lesson_name'] = get_field('lesson_name', $course_id);
     209        $data['content']['showthumb'] = get_field('showthumb', $course_id);
     210        $data['content']['showname'] = get_field('showname', $course_id);
     211        $data['content']['showtitle'] = get_field('showtitle', $course_id);
     212        $data['content']['acf']["cntctrl"] = get_field('cntctrl', $lesson_id);
     213        $data['content']['acf']["before_entry"] = get_field('before_entry', $lesson_id);
     214        $data['content']['acf']["after_entry"] = get_field('after_entry', $lesson_id);
     215        $session = isset($request['access_token']) ? $request['access_token'] : '';
     216        if ($session) {
     217            $access_token = base64_decode($session);
     218            $users = MP_Auth::login($access_token);
     219            if ($users) {
     220                $user_id = $users->ID;
     221            } else {
     222                $user_id = 0;
     223            }
     224        } else {
     225            $user_id = 0;
     226        }
     227        $data['content']["islike"] = apply_filters('miniprogram_commented', $lesson_id, $user_id, 'like');
     228        $data['content']["likes"] = apply_filters('comment_type_count', $lesson_id, 'like');
     229        $data['content']["post_likes"] = apply_filters('comment_type_list', $lesson_id, 'like');
     230
     231
     232        return $data;
     233    }, 10, 3);
     234}
     235
     236function rest_prepare_fields($data, $post, $request)
     237{
     238    $isinclude = '';
     239    $options = apply_filters('getmiss', $isinclude);
     240    if (!defined($options)) {
     241        return;
     242    }
     243    $_data = $data->data;
     244    $post_id = $post->ID;
     245    if (is_miniprogram() || is_debug()) {
     246        $post_date = $post->post_date;
     247        $post_modified = $post->post_modified;
     248        $post_type = $post->post_type;
     249        $author_id = $post->post_author;
     250        $author_avatar = get_user_meta($author_id, 'avatar', true);
     251        $taxonomies = get_object_taxonomies($_data['type']);
     252        $post_title = $post->post_title;
     253        $post_views = (int)get_post_meta($post_id, "views", true);
     254        $post_excerpt = $post->post_excerpt;
     255        $post_content = $post->post_content;
     256        $session = isset($request['access_token']) ? $request['access_token'] : '';
     257        if ($session) {
     258            $access_token = base64_decode($session);
     259            $users = MP_Auth::login($access_token);
     260            if ($users) {
     261                $user_id = $users->ID;
     262            } else {
     263                $user_id = 0;
     264            }
     265        } else {
     266            $user_id = 0;
     267        }
     268        $_data["id"]  = $post_id;
     269        $_data["options"] = $options;
     270        $_data["date"] = $post_date;
     271        $_data["modified"] = $post_modified;
     272        $_data["newdate"] = datetime_before($post_date);
     273        $_data["week"] = get_wp_post_week($post_date);
     274        unset($_data['author']);
     275        $_data["author"]["id"] = $author_id;
     276        $_data["author"]["name"] = get_the_author_meta('nickname', $author_id);
     277        if ($author_avatar) {
     278            $_data["author"]["avatar"] = $author_avatar;
     279        } else {
     280            $_data["author"]["avatar"] = get_avatar_url($author_id);
     281        }
     282        $_data["author"]["description"] = get_the_author_meta('description', $author_id);
     283        if (get_post_meta($post_id, "source", true)) {
     284            $_data["meta"]["source"] = get_post_meta($post_id, "source", true);
     285        }
     286        $_data["meta"]["thumbnail"] = apply_filters('post_thumbnail', $post_id);
     287        $_data["meta"]["views"] = $post_views;
     288        $_data["meta"]["count"] = mp_count_post_content_text_length(wp_strip_all_tags($post_content));
     289        $_data["comments"] = apply_filters('comment_type_count', $post_id, 'comment');
     290        $_data["isfav"] = apply_filters('miniprogram_commented', $post_id, $user_id, 'fav');
     291        $_data["favs"] = apply_filters('comment_type_count', $post_id, 'fav');
     292        $_data["islike"] = apply_filters('miniprogram_commented', $post_id, $user_id, 'like');
     293        $_data["likes"] = apply_filters('comment_type_count', $post_id, 'like');
     294
     295        $bee_to_library = get_field('bee_to_library', $post_id);
     296        if ($bee_to_library) {
     297            $__bee_to_library = array();
     298            foreach ($bee_to_library as $key => $app_k) {
     299                // if ($key >= 5) break;
     300                if (have_rows('bee_book_msggroup', $app_k)) :
     301                    while (have_rows('bee_book_msggroup', $app_k)) : the_row();
     302                        $bee_book_author =  get_sub_field('bee_book_author');
     303                    // Do something...
     304                    endwhile;
     305                else :
     306                // no rows found
     307                endif;
     308                $__bee_to_library[] = array(
     309                    "bee_library_id" => $app_k,
     310                    "bee_library_thumb" => wp_get_attachment_image_src(get_post_thumbnail_id($app_k), 'medium')[0],
     311                    "bee_library_title" => get_the_title($app_k),
     312                    "bee_library_pagestyle" => get_field('bee_book_pagestyle', $app_k),
     313                    "bee_library_background" => get_field('bee_book_background', $app_k),
     314                    "bee_library_type" => 'beebee_library',
     315                    "type" => 'beebee_library',
     316                    "title" => array(
     317                        "rendered" => html_entity_decode(get_the_title($app_k)),
     318                    ),
     319                    "excerpt" => array(
     320                        "rendered" => html_entity_decode(wp_strip_all_tags(get_the_excerpt($app_k)))
     321                    ),
     322                    "meta" => array(
     323                        "thumbnail" => wp_get_attachment_image_src(get_post_thumbnail_id($app_k), 'medium')[0]
     324                    ),
     325                    "id" => $app_k,
     326                    "beebee_library_cats_value" => get_the_terms($app_k, 'beebee_library_cats'),
     327                    "beebee_library_state_value" => get_the_terms($app_k, 'beebee_library_state'),
     328                    "bee_library_author" => $bee_book_author
     329                );
     330            }
     331            $_data['acf']["bee_to_library"] = $__bee_to_library;
     332        }
    295333
    296334        if (have_rows('page_single', 'option')) :
  • beebee-mini/trunk/readme.txt

    r2607393 r2611979  
    55Requires at least: 5.5
    66Tested up to: 5.8.1
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    1818Beebee 比比小程序提供一系列支持个人资质学习的原创小程序主题。您可以使用这些主题打造支持流量主广告的微信小程序。
    1919
    20 我们计划输出5款主流功能的小程序主题。上线进度请关注公众号【APP比比】
    21 - 爱书者
     20我们计划输出以下小程序主题。上线进度请关注公众号【APP比比】
     21- 爱书者(已上线)
    2222(书籍租借+书籍下载+书籍交易+书籍阅读+语录+活动+资讯+流量主广告+用户交互/基于Wordpress)
    2323
    24 - 图文社
     24- 图文社(已上线)
    2525(图片下载+商品管理+小程序跳转+淘宝客跳转+内容资讯+流量主广告+用户交互/基于Wordpress)
    2626
    27 - 恋爱生
     27- 小睡眠(11月10日上线)
     28(音频管理+小程序跳转+内容资讯+流量主广告+用户交互/基于Wordpress)
     29
     30- 卖室友(计划中)
     31(交友图文管理+校园管理+活动管理+内容资讯+流量主广告+用户交互/基于Wordpress)
     32
     33- 恋爱生(计划中)
    2834(美图管理+表情包管理+聊天文字管理+恋爱教程管理+流量主广告+用户交互/基于Wordpress)
    2935
    30 - 大学饭
    31 (代跑腿管理+客服管理+交友图文管理+活动管理+内容资讯+流量主广告+用户交互/基于Wordpress)
    32 
    33 - 观察家
     36- 轻语录(计划中)
     37(内容资讯+流量主广告+用户交互/基于Wordpress)
     38
     39- 观察家(计划中)
    3440(纯内容资讯管理+流量主广告+用户交互/基于Wordpress)
    3541
     
    5460
    5561** 公众号【APP比比】是小程序的唯一发行渠道,任何其他渠道需要你付费购买的均为盗版。
     62
     63= 1.0.6 - 2021-10-10 =
     64完成插件对比比图文社1.0.1的支持
     65完成插件对比比爱书者4.1.3的支持
     66
     67比比图文社1.0.1:
     68- 调整音乐播放器标题过长被撑开
     69- 调整素材标题过长导致页面被撑开
     70- 调整播放器播放背景
     71- 音乐增加播放进度时间显示和宽度
     72- 专题分类是标签样式
     73- 搜索多了个栏目
     74- 主页分享会出现不能加载内容的情况
     75- 图片还能点击?测试无问题
     76- 天气不显示?未复现
     77- 固定导航隐藏栏目会出现白条
     78- 添加了全局详情积木
     79- 文章无法滑动
     80- 更多评论一直加载
     81- 积木跳转单页面不出现id
     82- 素材没图会导致瀑布流不加载
     83- 音乐顺序播放
     84- 素材详情按钮变小了
     85- 跳转小商品详情出错
     86- 发现页多了个语录换掉
     87- 我的收藏多了个
     88- 瀑布流加载会出现归零闪现
     89
     90比比爱书者4.1.3
     91- 修复语录不显示的问题
    5692
    5793= 1.0.5 - 2021-09-20 =
  • beebee-mini/trunk/wp-mini-beebee.php

    r2607393 r2611979  
    44Plugin URI: https://demo.appbeebee.com/
    55Description: 这里有很多漂亮的原创的微信小程序模板,完全基于开源的程序打造。关注公众号【APP比比】进行配置教程的学习。
    6 Version: 1.0.5
     6Version: 1.0.6
    77Author:  hellobeebee
    88Author URI: https://www.appbeebee.com/
Note: See TracChangeset for help on using the changeset viewer.