diff --git a/config.php b/config.php index dec9b94..8553d78 100755 --- a/config.php +++ b/config.php @@ -38,7 +38,7 @@ $parameters = [ 'name' => 'skyroom', - 'version' => '1.4.7', + 'version' => '1.5.0', 'plugin.path' => plugin_dir_path(__FILE__), 'plugin.url' => plugin_dir_url(__FILE__), 'plugin.path.languages' => 'skyroom/languages', diff --git a/languages/skyroom-fa_IR.mo b/languages/skyroom-fa_IR.mo index 97578d1..530887c 100644 Binary files a/languages/skyroom-fa_IR.mo and b/languages/skyroom-fa_IR.mo differ diff --git a/languages/skyroom-fa_IR.po b/languages/skyroom-fa_IR.po index 2a6af7b..06ef0c9 100644 --- a/languages/skyroom-fa_IR.po +++ b/languages/skyroom-fa_IR.po @@ -5,7 +5,7 @@ msgstr "" "Project-Id-Version: Skyroom 1.0.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/skyroom\n" "POT-Creation-Date: 2020-06-19 21:05+0430\n" -"PO-Revision-Date: 2020-07-28 10:25+0430\n" +"PO-Revision-Date: 2020-08-15 12:35+0430\n" "Last-Translator: \n" "Language-Team: \n" "Language: fa_IR\n" @@ -596,6 +596,22 @@ msgstr "خطای نوع محصول" msgid "This product is not skyroom type." msgstr "نوع این محصول برای اسکای روم نیست." +#: src/Skyroom/Entity/SkyroomWidget.php:13 +msgid "Skyroom wplms widget" +msgstr "ابزارک اسکای روم برای WPLMS" + +#: src/Skyroom/Entity/SkyroomWidget.php:15 +msgid "" +"This widget skyroom for wplms courses and and it does not work in any other " +"plugins" +msgstr "" +"این ابزارک اسکای روم برای WPLMS است و برای افزونه های دیگر کاربردی ندارد و فقط " +"برای دوره های WPLMS قابل استفاده است" + +#: src/Skyroom/Entity/SkyroomWidget.php:53 +msgid "Join to course room" +msgstr "ورود به اتاق دوره" + #: views/woocommerce-skyroom-order.php:3 msgid "" "You successfully enrolled in purchased courses. To attend classes, on announced " diff --git a/languages/skyroom.pot b/languages/skyroom.pot index d5e79cf..90edfda 100644 --- a/languages/skyroom.pot +++ b/languages/skyroom.pot @@ -591,6 +591,18 @@ msgstr "" msgid "This product is not skyroom type." msgstr "" +#: src/Skyroom/Entity/SkyroomWidget.php:13 +msgid "Skyroom wplms widget" +msgstr "" + +#: src/Skyroom/Entity/SkyroomWidget.php:15 +msgid "This widget skyroom for wplms courses and and it does not work in any other plugins" +msgstr "" + +#: src/Skyroom/Entity/SkyroomWidget.php:53 +msgid "Join to course room" +msgstr "" + #: views/woocommerce-skyroom-order.php:3 msgid "" "You successfully enrolled in purchased courses. To attend classes, on " diff --git a/skyroom.php b/skyroom.php index e279965..c620428 100755 --- a/skyroom.php +++ b/skyroom.php @@ -6,7 +6,7 @@ * Plugin Name: Skyroom * Plugin URI: https://skyroom.online/pages/wordpress-integration * Description: A plugin to integrate skyroom with your wordpress site - * Version: 1.4.7 + * Version: 1.5.0 * Author: Skyroom * Author URI: https://skyroom.online/ * License: GPL-2.0+ @@ -27,6 +27,7 @@ // Boot plugin add_action('plugins_loaded', [new Skyroom\Plugin(), 'boot']); +//load languages function Skyroom_load_plugin_textdomain() { load_plugin_textdomain( 'skyroom', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); } diff --git a/src/Skyroom/Entity/SkyroomWidget.php b/src/Skyroom/Entity/SkyroomWidget.php new file mode 100644 index 0000000..298d7d5 --- /dev/null +++ b/src/Skyroom/Entity/SkyroomWidget.php @@ -0,0 +1,97 @@ + __('This widget skyroom for wplms courses and and it does not work in any other plugins', 'skyroom'), + 'classname' => 'skyroom widget', + 'customize_selective_refresh' => true, + ) + ); + } + + /** + * Skyroom idget register + */ + public function register_widget(){ + register_widget(new \Skyroom\Entity\SkyroomWidget()); + } + + /** + * @param $args + * @param $instance + */ + public function widget($args, $instance) + { + $title = isset($instance['title']) ? $instance['title'] : ''; + + if ( function_exists('bp_course_get_ID') ) { + + $title = apply_filters('widget_title', $title, $instance, $this->id_base); + $product_id = get_post_meta(bp_course_get_ID(), 'vibe_product', true); + echo $args['before_widget']; + if (isset($product_id)) { + $skyroom_id = get_post_meta($product_id, '_skyroom_id', true); + if (!empty($skyroom_id)) { + $user_id = get_current_user_id(); + $purchased = wc_customer_bought_product(null, $user_id, $product_id); + + echo $args['before_title'] . $title . $args['after_title']; + if ($purchased) { + echo ""; + echo _e('Enter room', 'skyroom'); + echo ""; + } + } + } + echo $args['after_widget']; + + } + } + + /** + * @param $instance + */ + public function form($instance) + { + if (!empty($instance['title'])) { + $title = $instance['title']; + } else { + $title = __('Join to course room', 'skyroom'); + } + ?> +
+