LearnPress – WordPress LMS Plugin - Version 3.0.11.1

Version Description

= 0.9.19 = In this version, we have changed a little bit about LearnPress Plugin directory structure and moved all add-ons to become independence plugins. If you face any problems relate to add-ons, please completely remove old version and re-install LearnPress. It does not affect your current data. Thank you.

Download this release

Release Info

Developer tunnhn
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 3.0.11.1
Comparing to
See all releases

Code changes from version 3.0.10 to 3.0.11.1

inc/admin/helpers/class-lp-plugins-helper.php CHANGED
@@ -161,8 +161,11 @@ class LP_Plugins_Helper {
161
  * @return array|mixed
162
  */
163
  public static function get_related_themes( $type = '', $args = array() ) {
 
164
 
165
- $themes = array_filter( self::$themes );
 
 
166
 
167
  if ( ! $themes ) {
168
  self::$themes = LP_Background_Query_Items::instance()->get_related_themes();
161
  * @return array|mixed
162
  */
163
  public static function get_related_themes( $type = '', $args = array() ) {
164
+ $themes = array();
165
 
166
+ if ( self::$themes ) {
167
+ $themes = array_filter( self::$themes );
168
+ }
169
 
170
  if ( ! $themes ) {
171
  self::$themes = LP_Background_Query_Items::instance()->get_related_themes();
inc/background-process/class-lp-background-installer.php CHANGED
@@ -36,7 +36,7 @@ if ( ! class_exists( 'LP_Background_Installer' ) ) {
36
  array(
37
  'check_tables' => 'yes'
38
  )
39
- );
40
  }
41
 
42
  /**
36
  array(
37
  'check_tables' => 'yes'
38
  )
39
+ )->save()->dispatch();
40
  }
41
 
42
  /**
inc/background-process/class-lp-background-query-items.php CHANGED
@@ -255,6 +255,9 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
255
  * @return array|bool
256
  */
257
  public function query_related_themes() {
 
 
 
258
  $themes = array();
259
  $url = 'https://api.envato.com/v1/discovery/search/search/item?site=themeforest.net&username=thimpress';
260
  $args = array(
@@ -265,6 +268,8 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
265
  $response = wp_remote_request( $url, $args );
266
 
267
  if ( is_wp_error( $response ) ) {
 
 
268
  return false;
269
  }
270
 
@@ -284,6 +289,8 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
284
  $themes['other'] = $all_themes;
285
  }
286
  set_transient( 'lp_related_themes', $themes, $this->transient_time );
 
 
287
  }
288
 
289
  return $themes;
@@ -292,7 +299,7 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
292
  /**
293
  * @return LP_Background_Query_Items
294
  */
295
- public static function instance(){
296
  return parent::instance();
297
  }
298
  }
255
  * @return array|bool
256
  */
257
  public function query_related_themes() {
258
+
259
+ set_transient( 'lp_related_themes', __( 'There is no item found!', 'learnpress' ), $this->transient_time );
260
+
261
  $themes = array();
262
  $url = 'https://api.envato.com/v1/discovery/search/search/item?site=themeforest.net&username=thimpress';
263
  $args = array(
268
  $response = wp_remote_request( $url, $args );
269
 
270
  if ( is_wp_error( $response ) ) {
271
+ error_log( $response->get_error_message() );
272
+
273
  return false;
274
  }
275
 
289
  $themes['other'] = $all_themes;
290
  }
291
  set_transient( 'lp_related_themes', $themes, $this->transient_time );
292
+ } elseif ( ! empty( $response['message'] ) ) {
293
+ set_transient( 'lp_related_themes', $response['message'], $this->transient_time );
294
  }
295
 
296
  return $themes;
299
  /**
300
  * @return LP_Background_Query_Items
301
  */
302
+ public static function instance() {
303
  return parent::instance();
304
  }
305
  }
inc/class-lp-debug.php CHANGED
@@ -113,21 +113,37 @@ class LP_Debug {
113
  return true;
114
  }
115
 
116
- $path = learn_press_get_log_file_path( $handle );
117
- if ( ! file_exists( $path ) ) {
118
- $f = fopen( $path, 'w' );
119
- fclose( $f );
120
- }
121
- $f = @fopen( $path, 'r+' );
122
 
123
- if ( $f ) {
124
- // 3M
125
- if ( filesize( $path ) >= 1024 * 1024 * 3 ) {
126
- ftruncate( $f, 0 );
127
  }
128
- $this->_handles[ $handle ] = $f;
129
 
130
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
 
133
  return false;
113
  return true;
114
  }
115
 
116
+ try {
117
+ $path = learn_press_get_log_file_path( $handle );
118
+ $dir = dirname( $path );
 
 
 
119
 
120
+ // Try to create path
121
+ if ( ! is_writeable( $dir ) ) {
122
+ @mkdir( $dir, 0777, true );
 
123
  }
 
124
 
125
+ // Create file if does not exists
126
+ if ( ! file_exists( $path ) ) {
127
+ $f = @fopen( $path, 'w' );
128
+ fclose( $f );
129
+ }
130
+
131
+ // Open to read/write
132
+ $f = @fopen( $path, 'r+' );
133
+
134
+ if ( $f ) {
135
+ // 3M
136
+ if ( filesize( $path ) >= 1024 * 1024 * 3 ) {
137
+ ftruncate( $f, 0 );
138
+ }
139
+
140
+ $this->_handles[ $handle ] = $f;
141
+
142
+ return true;
143
+ }
144
+ }
145
+ catch ( Exception $ex ) {
146
+ error_log( $ex->getMessage() );
147
  }
148
 
149
  return false;
inc/libraries/wp-background-process.php CHANGED
@@ -98,8 +98,6 @@ abstract class WP_Background_Process extends WP_Async_Request {
98
 
99
  if ( ! empty( $this->data ) ) {
100
  update_site_option( $key, $this->data );
101
- LP_Debug::instance()->add(debug_backtrace(), 'yyyy', false, true);
102
-
103
  }
104
 
105
  return $this;
98
 
99
  if ( ! empty( $this->data ) ) {
100
  update_site_option( $key, $this->data );
 
 
101
  }
102
 
103
  return $this;
inc/lp-constants.php CHANGED
@@ -4,7 +4,7 @@
4
  */
5
  $upload_dir = wp_upload_dir();
6
  // version
7
- define( 'LEARNPRESS_VERSION', '3.0.10' );
8
 
9
  define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
10
 
4
  */
5
  $upload_dir = wp_upload_dir();
6
  // version
7
+ define( 'LEARNPRESS_VERSION', '3.0.11.1' );
8
 
9
  define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
10
 
inc/lp-template-functions.php CHANGED
@@ -1564,6 +1564,8 @@ if ( ! function_exists( 'learn_press_content_single_item' ) ) {
1564
  function learn_press_content_single_item() {
1565
 
1566
  if ( $course_item = LP_Global::course_item() ) {
 
 
1567
  learn_press_get_template( 'content-single-item.php' );
1568
  }
1569
  }
@@ -3047,6 +3049,15 @@ function learn_press_disable_course_comment_form() {
3047
  add_filter( 'comments_template', 'learn_press_blank_comments_template', 999 );
3048
  }
3049
 
 
 
 
 
 
 
 
 
 
3050
  if ( ! function_exists( 'learn_press_profile_mobile_menu' ) ) {
3051
  function learn_press_profile_mobile_menu() {
3052
  learn_press_get_template( 'profile/mobile-menu.php' );
1564
  function learn_press_content_single_item() {
1565
 
1566
  if ( $course_item = LP_Global::course_item() ) {
1567
+ // remove course comment form on singler item
1568
+ add_filter( 'comments_open', 'learn_press_course_comments_open', 10, 2 );
1569
  learn_press_get_template( 'content-single-item.php' );
1570
  }
1571
  }
3049
  add_filter( 'comments_template', 'learn_press_blank_comments_template', 999 );
3050
  }
3051
 
3052
+ function learn_press_course_comments_open( $open, $post_id ) {
3053
+ $post = get_post( $post_id );
3054
+ if ( LP_COURSE_CPT == $post->post_type ) {
3055
+ $open = false;
3056
+ }
3057
+ return $open;
3058
+ }
3059
+
3060
+
3061
  if ( ! function_exists( 'learn_press_profile_mobile_menu' ) ) {
3062
  function learn_press_profile_mobile_menu() {
3063
  learn_press_get_template( 'profile/mobile-menu.php' );
learnpress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: LearnPress
4
  Plugin URI: http://thimpress.com/learnpress
5
  Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6
  Author: ThimPress
7
- Version: 3.0.10
8
  Author URI: http://thimpress.com
9
  Requires at least: 3.8
10
  Tested up to: 4.9.6
4
  Plugin URI: http://thimpress.com/learnpress
5
  Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6
  Author: ThimPress
7
+ Version: 3.0.11.1
8
  Author URI: http://thimpress.com
9
  Requires at least: 3.8
10
  Tested up to: 4.9.6
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: WordPress LMS, LMS, eLearning, e-Learning, Learning Management System, LMS WordPress, Course, Courses, Quiz, Quizzes, Training, Guru, Sell Courses
5
  Requires at least: 3.8
6
  Tested up to: 4.9.5
7
- Stable tag: 3.0.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
4
  Tags: WordPress LMS, LMS, eLearning, e-Learning, Learning Management System, LMS WordPress, Course, Courses, Quiz, Quizzes, Training, Guru, Sell Courses
5
  Requires at least: 3.8
6
  Tested up to: 4.9.5
7
+ Stable tag: 3.0.11.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10