Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor-pro/addons/tutor-weglot/tutor-weglot.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + /**
3 + * Plugin Name: Tutor Weglot
4 + * Description: Translate & manage multilingual courses for global reach with full edit control.
5 + * Author: Themeum
6 + * Version: 1.0.0
7 + * Author URI: http://themeum.com
8 + * Requires at least: 5.3
9 + * Tested up to: 6.1
10 + *
11 + * @package TutorPro\GoogleMeet
12 + */
13 +
14 + namespace TutorPro\Weglot;
15 +
16 + if ( ! class_exists( 'Weglot' ) ) {
17 +
18 + /**
19 + * PluginStarter main class that trigger the plugin
20 + */
21 + final class Weglot {
22 +
23 + /**
24 + * Plugin meta data
25 + *
26 + * @since 1.0.0
27 + *
28 + * @var $plugin_data
29 + */
30 + private static $meta_data = array();
31 +
32 + /**
33 + * Plugin instance
34 + *
35 + * @since 1.0.0
36 + *
37 + * @var $instance
38 + */
39 + public static $instance = null;
40 +
41 + /**
42 + * Register hooks and load dependent files
43 + *
44 + * @since 1.0.0
45 + *
46 + * @return void
47 + */
48 + public function __construct() {
49 + add_filter( 'tutor_addons_lists_config', __CLASS__ . '::register_addon' );
50 + }
51 +
52 + /**
53 + * Plugin meta data
54 + *
55 + * @since 1.0.0
56 + *
57 + * @return array contains plugin meta data
58 + */
59 + public static function meta_data(): array {
60 + self::$meta_data['url'] = plugin_dir_url( __FILE__ );
61 + self::$meta_data['path'] = plugin_dir_path( __FILE__ );
62 + self::$meta_data['basename'] = plugin_basename( __FILE__ );
63 + self::$meta_data['templates'] = trailingslashit( plugin_dir_path( __FILE__ ) . 'templates' );
64 + self::$meta_data['views'] = trailingslashit( plugin_dir_path( __FILE__ ) . 'views' );
65 + self::$meta_data['assets'] = trailingslashit( plugin_dir_url( __FILE__ ) . 'assets' );
66 +
67 + // set ENV DEV | PROD.
68 + self::$meta_data['env'] = 'DEV';
69 + return self::$meta_data;
70 + }
71 +
72 + /**
73 + * Create and return instance of this plugin
74 + *
75 + * @return self instance of plugin
76 + */
77 + public static function instance() {
78 + // If tutor is not active then return.
79 + if ( ! function_exists( 'tutor' ) ) {
80 + return;
81 + }
82 +
83 + if ( null === self::$instance ) {
84 + self::$instance = new self();
85 + }
86 + return self::$instance;
87 + }
88 +
89 + /**
90 + * Register on the Addon list
91 + *
92 + * @since 1.0.0
93 + *
94 + * @param array $addons available addons.
95 + *
96 + * @return array addons list
97 + */
98 + public static function register_addon( array $addons ): array {
99 + $new_addon = array(
100 + 'name' => __( 'Weglot', 'tutor-pro' ),
101 + 'description' => __( 'Translate & manage multilingual courses for global reach.', 'tutor-pro' ),
102 + 'depend_plugins' => array( 'weglot/weglot.php' => 'Weglot' ),
103 + 'disable_on_off' => true,
104 + );
105 +
106 + $meta_data = self::meta_data();
107 + $meta_data = array_merge( $new_addon, $meta_data );
108 +
109 + $addons[ $meta_data['basename'] ] = $meta_data;
110 + return $addons;
111 + }
112 + }
113 + // trigger.
114 + Weglot::instance();
115 + }
116 +