';
261 | }
262 | });
263 | }
264 | return $php_classname;
265 | }
266 | /**
267 | * Save product meta.
268 | *
269 | * @access public
270 | * @param int $post_id
271 | * @return void
272 | */
273 | public function save_product_meta_data($post_id) {
274 | // Security check
275 | if (!filter_input(INPUT_POST, 'product_meta_nonce', FILTER_DEFAULT) === null || !wp_verify_nonce(filter_input(INPUT_POST, 'product_meta_nonce', FILTER_DEFAULT)) || !current_user_can('edit_product', $post_id)) {
276 | return $post_id;
277 | }
278 | $course_id = filter_input(INPUT_POST, 'course_id', FILTER_DEFAULT);
279 | if ($course_id) {
280 | update_post_meta($post_id, 'linked_course_id', wp_kses_post($course_id));
281 | update_post_meta($post_id, '_sku', 'course-' . get_post_meta($course_id, '_sku', true));
282 | update_post_meta($post_id, 'moodle_course_id', get_post_meta($course_id, 'moodle_course_id', true));
283 | }
284 | }
285 | /**
286 | * Get All Caurse data.
287 | * @return \WP_Error| \WP_REST_Response
288 | */
289 | public function fetch_all_courses( $args = [] ) {
290 | // get courses from post
291 | $courses = $this->get_courses($args);
292 | $formatted_courses = [];
293 | foreach ($courses as $course_id) {
294 | // get course all post meta.
295 | $course_meta = array_map('current', get_post_meta($course_id,'',true));
296 | $course_enddate = $course_meta['_course_enddate'];
297 | //get term object by course category id.
298 | $term = MooWoodle()->Category->get_category($course_meta['_category_id'], 'course_cat');
299 | $moodle_course_id = $course_meta['moodle_course_id'];
300 | $synced_products = [];
301 | // get all products lincked with course.
302 | $products = get_posts(['post_type' => 'product', 'numberposts' => -1, 'post_status' => 'publish', 'meta_key' => 'linked_course_id', 'meta_value' => $course_id]);
303 | $count_enrolment = 0;
304 | foreach ($products as $product) {
305 | $synced_products[esc_html(get_the_title($product))] = add_query_arg( [ 'post' => $product->ID , 'action' => 'edit'],admin_url('post.php'));
306 | $count_enrolment = $count_enrolment + (int) get_post_meta($product->ID, 'total_sales', true);
307 | }
308 | $date = wp_date('M j, Y', $course_meta['_course_startdate']);
309 | if ($course_enddate) {
310 | $date .= ' - ' . wp_date('M j, Y ', $course_enddate);
311 | }
312 | $formatted_courses[] = [
313 | 'id' => $course_id,
314 | 'moodle_course_id' => $moodle_course_id,
315 | 'moodle_url' => esc_url(get_option('moowoodle_general_settings')["moodle_url"]) . 'course/edit.php?id=' . $moodle_course_id,
316 | 'course_name' => esc_html(get_the_title($course_id)),
317 | 'course_short_name' => $course_meta['_course_short_name'],
318 | 'product' => $synced_products,
319 | 'catagory_name' => esc_html($term->name),
320 | 'catagory_url' => add_query_arg(['course_cat' => $term->slug, 'post_type' => 'course'], admin_url('edit.php')),
321 | 'enroled_user' => $count_enrolment,
322 | 'date' => $date,
323 | ];
324 | }
325 | return $formatted_courses;
326 | }
327 | }
328 |
--------------------------------------------------------------------------------
/vendor/composer/InstalledVersions.php:
--------------------------------------------------------------------------------
1 |
7 | * Jordi Boggiano
8 | *
9 | * For the full copyright and license information, please view the LICENSE
10 | * file that was distributed with this source code.
11 | */
12 |
13 | namespace Composer;
14 |
15 | use Composer\Autoload\ClassLoader;
16 | use Composer\Semver\VersionParser;
17 |
18 | /**
19 | * This class is copied in every Composer installed project and available to all
20 | *
21 | * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22 | *
23 | * To require its presence, you can require `composer-runtime-api ^2.0`
24 | *
25 | * @final
26 | */
27 | class InstalledVersions
28 | {
29 | /**
30 | * @var mixed[]|null
31 | * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null
32 | */
33 | private static $installed;
34 |
35 | /**
36 | * @var bool|null
37 | */
38 | private static $canGetVendors;
39 |
40 | /**
41 | * @var array[]
42 | * @psalm-var array}>
43 | */
44 | private static $installedByVendor = array();
45 |
46 | /**
47 | * Returns a list of all package names which are present, either by being installed, replaced or provided
48 | *
49 | * @return string[]
50 | * @psalm-return list
51 | */
52 | public static function getInstalledPackages()
53 | {
54 | $packages = array();
55 | foreach (self::getInstalled() as $installed) {
56 | $packages[] = array_keys($installed['versions']);
57 | }
58 |
59 | if (1 === \count($packages)) {
60 | return $packages[0];
61 | }
62 |
63 | return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
64 | }
65 |
66 | /**
67 | * Returns a list of all package names with a specific type e.g. 'library'
68 | *
69 | * @param string $type
70 | * @return string[]
71 | * @psalm-return list
72 | */
73 | public static function getInstalledPackagesByType($type)
74 | {
75 | $packagesByType = array();
76 |
77 | foreach (self::getInstalled() as $installed) {
78 | foreach ($installed['versions'] as $name => $package) {
79 | if (isset($package['type']) && $package['type'] === $type) {
80 | $packagesByType[] = $name;
81 | }
82 | }
83 | }
84 |
85 | return $packagesByType;
86 | }
87 |
88 | /**
89 | * Checks whether the given package is installed
90 | *
91 | * This also returns true if the package name is provided or replaced by another package
92 | *
93 | * @param string $packageName
94 | * @param bool $includeDevRequirements
95 | * @return bool
96 | */
97 | public static function isInstalled($packageName, $includeDevRequirements = true)
98 | {
99 | foreach (self::getInstalled() as $installed) {
100 | if (isset($installed['versions'][$packageName])) {
101 | return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
102 | }
103 | }
104 |
105 | return false;
106 | }
107 |
108 | /**
109 | * Checks whether the given package satisfies a version constraint
110 | *
111 | * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
112 | *
113 | * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
114 | *
115 | * @param VersionParser $parser Install composer/semver to have access to this class and functionality
116 | * @param string $packageName
117 | * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
118 | * @return bool
119 | */
120 | public static function satisfies(VersionParser $parser, $packageName, $constraint)
121 | {
122 | $constraint = $parser->parseConstraints((string) $constraint);
123 | $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
124 |
125 | return $provided->matches($constraint);
126 | }
127 |
128 | /**
129 | * Returns a version constraint representing all the range(s) which are installed for a given package
130 | *
131 | * It is easier to use this via isInstalled() with the $constraint argument if you need to check
132 | * whether a given version of a package is installed, and not just whether it exists
133 | *
134 | * @param string $packageName
135 | * @return string Version constraint usable with composer/semver
136 | */
137 | public static function getVersionRanges($packageName)
138 | {
139 | foreach (self::getInstalled() as $installed) {
140 | if (!isset($installed['versions'][$packageName])) {
141 | continue;
142 | }
143 |
144 | $ranges = array();
145 | if (isset($installed['versions'][$packageName]['pretty_version'])) {
146 | $ranges[] = $installed['versions'][$packageName]['pretty_version'];
147 | }
148 | if (array_key_exists('aliases', $installed['versions'][$packageName])) {
149 | $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
150 | }
151 | if (array_key_exists('replaced', $installed['versions'][$packageName])) {
152 | $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
153 | }
154 | if (array_key_exists('provided', $installed['versions'][$packageName])) {
155 | $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
156 | }
157 |
158 | return implode(' || ', $ranges);
159 | }
160 |
161 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
162 | }
163 |
164 | /**
165 | * @param string $packageName
166 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
167 | */
168 | public static function getVersion($packageName)
169 | {
170 | foreach (self::getInstalled() as $installed) {
171 | if (!isset($installed['versions'][$packageName])) {
172 | continue;
173 | }
174 |
175 | if (!isset($installed['versions'][$packageName]['version'])) {
176 | return null;
177 | }
178 |
179 | return $installed['versions'][$packageName]['version'];
180 | }
181 |
182 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
183 | }
184 |
185 | /**
186 | * @param string $packageName
187 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
188 | */
189 | public static function getPrettyVersion($packageName)
190 | {
191 | foreach (self::getInstalled() as $installed) {
192 | if (!isset($installed['versions'][$packageName])) {
193 | continue;
194 | }
195 |
196 | if (!isset($installed['versions'][$packageName]['pretty_version'])) {
197 | return null;
198 | }
199 |
200 | return $installed['versions'][$packageName]['pretty_version'];
201 | }
202 |
203 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
204 | }
205 |
206 | /**
207 | * @param string $packageName
208 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
209 | */
210 | public static function getReference($packageName)
211 | {
212 | foreach (self::getInstalled() as $installed) {
213 | if (!isset($installed['versions'][$packageName])) {
214 | continue;
215 | }
216 |
217 | if (!isset($installed['versions'][$packageName]['reference'])) {
218 | return null;
219 | }
220 |
221 | return $installed['versions'][$packageName]['reference'];
222 | }
223 |
224 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
225 | }
226 |
227 | /**
228 | * @param string $packageName
229 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
230 | */
231 | public static function getInstallPath($packageName)
232 | {
233 | foreach (self::getInstalled() as $installed) {
234 | if (!isset($installed['versions'][$packageName])) {
235 | continue;
236 | }
237 |
238 | return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239 | }
240 |
241 | throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
242 | }
243 |
244 | /**
245 | * @return array
246 | * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
247 | */
248 | public static function getRootPackage()
249 | {
250 | $installed = self::getInstalled();
251 |
252 | return $installed[0]['root'];
253 | }
254 |
255 | /**
256 | * Returns the raw installed.php data for custom implementations
257 | *
258 | * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259 | * @return array[]
260 | * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}
261 | */
262 | public static function getRawData()
263 | {
264 | @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
265 |
266 | if (null === self::$installed) {
267 | // only require the installed.php file if this file is loaded from its dumped location,
268 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269 | if (substr(__DIR__, -8, 1) !== 'C') {
270 | self::$installed = include __DIR__ . '/installed.php';
271 | } else {
272 | self::$installed = array();
273 | }
274 | }
275 |
276 | return self::$installed;
277 | }
278 |
279 | /**
280 | * Returns the raw data of all installed.php which are currently loaded for custom implementations
281 | *
282 | * @return array[]
283 | * @psalm-return list}>
284 | */
285 | public static function getAllRawData()
286 | {
287 | return self::getInstalled();
288 | }
289 |
290 | /**
291 | * Lets you reload the static array from another file
292 | *
293 | * This is only useful for complex integrations in which a project needs to use
294 | * this class but then also needs to execute another project's autoloader in process,
295 | * and wants to ensure both projects have access to their version of installed.php.
296 | *
297 | * A typical case would be PHPUnit, where it would need to make sure it reads all
298 | * the data it needs from this class, then call reload() with
299 | * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
300 | * the project in which it runs can then also use this class safely, without
301 | * interference between PHPUnit's dependencies and the project's dependencies.
302 | *
303 | * @param array[] $data A vendor/composer/installed.php data set
304 | * @return void
305 | *
306 | * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data
307 | */
308 | public static function reload($data)
309 | {
310 | self::$installed = $data;
311 | self::$installedByVendor = array();
312 | }
313 |
314 | /**
315 | * @return array[]
316 | * @psalm-return list}>
317 | */
318 | private static function getInstalled()
319 | {
320 | if (null === self::$canGetVendors) {
321 | self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
322 | }
323 |
324 | $installed = array();
325 |
326 | if (self::$canGetVendors) {
327 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
328 | if (isset(self::$installedByVendor[$vendorDir])) {
329 | $installed[] = self::$installedByVendor[$vendorDir];
330 | } elseif (is_file($vendorDir.'/composer/installed.php')) {
331 | /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
332 | $required = require $vendorDir.'/composer/installed.php';
333 | $installed[] = self::$installedByVendor[$vendorDir] = $required;
334 | if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335 | self::$installed = $installed[count($installed) - 1];
336 | }
337 | }
338 | }
339 | }
340 |
341 | if (null === self::$installed) {
342 | // only require the installed.php file if this file is loaded from its dumped location,
343 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
344 | if (substr(__DIR__, -8, 1) !== 'C') {
345 | /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
346 | $required = require __DIR__ . '/installed.php';
347 | self::$installed = $required;
348 | } else {
349 | self::$installed = array();
350 | }
351 | }
352 |
353 | if (self::$installed !== array()) {
354 | $installed[] = self::$installed;
355 | }
356 |
357 | return $installed;
358 | }
359 | }
360 |
--------------------------------------------------------------------------------
/vendor/composer/ClassLoader.php:
--------------------------------------------------------------------------------
1 |
7 | * Jordi Boggiano
8 | *
9 | * For the full copyright and license information, please view the LICENSE
10 | * file that was distributed with this source code.
11 | */
12 |
13 | namespace Composer\Autoload;
14 |
15 | /**
16 | * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17 | *
18 | * $loader = new \Composer\Autoload\ClassLoader();
19 | *
20 | * // register classes with namespaces
21 | * $loader->add('Symfony\Component', __DIR__.'/component');
22 | * $loader->add('Symfony', __DIR__.'/framework');
23 | *
24 | * // activate the autoloader
25 | * $loader->register();
26 | *
27 | * // to enable searching the include path (eg. for PEAR packages)
28 | * $loader->setUseIncludePath(true);
29 | *
30 | * In this example, if you try to use a class in the Symfony\Component
31 | * namespace or one of its children (Symfony\Component\Console for instance),
32 | * the autoloader will first look for the class under the component/
33 | * directory, and it will then fallback to the framework/ directory if not
34 | * found before giving up.
35 | *
36 | * This class is loosely based on the Symfony UniversalClassLoader.
37 | *
38 | * @author Fabien Potencier
39 | * @author Jordi Boggiano
40 | * @see https://www.php-fig.org/psr/psr-0/
41 | * @see https://www.php-fig.org/psr/psr-4/
42 | */
43 | class ClassLoader
44 | {
45 | /** @var \Closure(string):void */
46 | private static $includeFile;
47 |
48 | /** @var string|null */
49 | private $vendorDir;
50 |
51 | // PSR-4
52 | /**
53 | * @var array>
54 | */
55 | private $prefixLengthsPsr4 = array();
56 | /**
57 | * @var array>
58 | */
59 | private $prefixDirsPsr4 = array();
60 | /**
61 | * @var list
62 | */
63 | private $fallbackDirsPsr4 = array();
64 |
65 | // PSR-0
66 | /**
67 | * List of PSR-0 prefixes
68 | *
69 | * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
70 | *
71 | * @var array>>
72 | */
73 | private $prefixesPsr0 = array();
74 | /**
75 | * @var list
76 | */
77 | private $fallbackDirsPsr0 = array();
78 |
79 | /** @var bool */
80 | private $useIncludePath = false;
81 |
82 | /**
83 | * @var array
84 | */
85 | private $classMap = array();
86 |
87 | /** @var bool */
88 | private $classMapAuthoritative = false;
89 |
90 | /**
91 | * @var array
92 | */
93 | private $missingClasses = array();
94 |
95 | /** @var string|null */
96 | private $apcuPrefix;
97 |
98 | /**
99 | * @var array
100 | */
101 | private static $registeredLoaders = array();
102 |
103 | /**
104 | * @param string|null $vendorDir
105 | */
106 | public function __construct($vendorDir = null)
107 | {
108 | $this->vendorDir = $vendorDir;
109 | self::initializeIncludeClosure();
110 | }
111 |
112 | /**
113 | * @return array>
114 | */
115 | public function getPrefixes()
116 | {
117 | if (!empty($this->prefixesPsr0)) {
118 | return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
119 | }
120 |
121 | return array();
122 | }
123 |
124 | /**
125 | * @return array>
126 | */
127 | public function getPrefixesPsr4()
128 | {
129 | return $this->prefixDirsPsr4;
130 | }
131 |
132 | /**
133 | * @return list
134 | */
135 | public function getFallbackDirs()
136 | {
137 | return $this->fallbackDirsPsr0;
138 | }
139 |
140 | /**
141 | * @return list
142 | */
143 | public function getFallbackDirsPsr4()
144 | {
145 | return $this->fallbackDirsPsr4;
146 | }
147 |
148 | /**
149 | * @return array Array of classname => path
150 | */
151 | public function getClassMap()
152 | {
153 | return $this->classMap;
154 | }
155 |
156 | /**
157 | * @param array $classMap Class to filename map
158 | *
159 | * @return void
160 | */
161 | public function addClassMap(array $classMap)
162 | {
163 | if ($this->classMap) {
164 | $this->classMap = array_merge($this->classMap, $classMap);
165 | } else {
166 | $this->classMap = $classMap;
167 | }
168 | }
169 |
170 | /**
171 | * Registers a set of PSR-0 directories for a given prefix, either
172 | * appending or prepending to the ones previously set for this prefix.
173 | *
174 | * @param string $prefix The prefix
175 | * @param list|string $paths The PSR-0 root directories
176 | * @param bool $prepend Whether to prepend the directories
177 | *
178 | * @return void
179 | */
180 | public function add($prefix, $paths, $prepend = false)
181 | {
182 | $paths = (array) $paths;
183 | if (!$prefix) {
184 | if ($prepend) {
185 | $this->fallbackDirsPsr0 = array_merge(
186 | $paths,
187 | $this->fallbackDirsPsr0
188 | );
189 | } else {
190 | $this->fallbackDirsPsr0 = array_merge(
191 | $this->fallbackDirsPsr0,
192 | $paths
193 | );
194 | }
195 |
196 | return;
197 | }
198 |
199 | $first = $prefix[0];
200 | if (!isset($this->prefixesPsr0[$first][$prefix])) {
201 | $this->prefixesPsr0[$first][$prefix] = $paths;
202 |
203 | return;
204 | }
205 | if ($prepend) {
206 | $this->prefixesPsr0[$first][$prefix] = array_merge(
207 | $paths,
208 | $this->prefixesPsr0[$first][$prefix]
209 | );
210 | } else {
211 | $this->prefixesPsr0[$first][$prefix] = array_merge(
212 | $this->prefixesPsr0[$first][$prefix],
213 | $paths
214 | );
215 | }
216 | }
217 |
218 | /**
219 | * Registers a set of PSR-4 directories for a given namespace, either
220 | * appending or prepending to the ones previously set for this namespace.
221 | *
222 | * @param string $prefix The prefix/namespace, with trailing '\\'
223 | * @param list|string $paths The PSR-4 base directories
224 | * @param bool $prepend Whether to prepend the directories
225 | *
226 | * @throws \InvalidArgumentException
227 | *
228 | * @return void
229 | */
230 | public function addPsr4($prefix, $paths, $prepend = false)
231 | {
232 | $paths = (array) $paths;
233 | if (!$prefix) {
234 | // Register directories for the root namespace.
235 | if ($prepend) {
236 | $this->fallbackDirsPsr4 = array_merge(
237 | $paths,
238 | $this->fallbackDirsPsr4
239 | );
240 | } else {
241 | $this->fallbackDirsPsr4 = array_merge(
242 | $this->fallbackDirsPsr4,
243 | $paths
244 | );
245 | }
246 | } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
247 | // Register directories for a new namespace.
248 | $length = strlen($prefix);
249 | if ('\\' !== $prefix[$length - 1]) {
250 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
251 | }
252 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
253 | $this->prefixDirsPsr4[$prefix] = $paths;
254 | } elseif ($prepend) {
255 | // Prepend directories for an already registered namespace.
256 | $this->prefixDirsPsr4[$prefix] = array_merge(
257 | $paths,
258 | $this->prefixDirsPsr4[$prefix]
259 | );
260 | } else {
261 | // Append directories for an already registered namespace.
262 | $this->prefixDirsPsr4[$prefix] = array_merge(
263 | $this->prefixDirsPsr4[$prefix],
264 | $paths
265 | );
266 | }
267 | }
268 |
269 | /**
270 | * Registers a set of PSR-0 directories for a given prefix,
271 | * replacing any others previously set for this prefix.
272 | *
273 | * @param string $prefix The prefix
274 | * @param list|string $paths The PSR-0 base directories
275 | *
276 | * @return void
277 | */
278 | public function set($prefix, $paths)
279 | {
280 | if (!$prefix) {
281 | $this->fallbackDirsPsr0 = (array) $paths;
282 | } else {
283 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
284 | }
285 | }
286 |
287 | /**
288 | * Registers a set of PSR-4 directories for a given namespace,
289 | * replacing any others previously set for this namespace.
290 | *
291 | * @param string $prefix The prefix/namespace, with trailing '\\'
292 | * @param list|string $paths The PSR-4 base directories
293 | *
294 | * @throws \InvalidArgumentException
295 | *
296 | * @return void
297 | */
298 | public function setPsr4($prefix, $paths)
299 | {
300 | if (!$prefix) {
301 | $this->fallbackDirsPsr4 = (array) $paths;
302 | } else {
303 | $length = strlen($prefix);
304 | if ('\\' !== $prefix[$length - 1]) {
305 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
306 | }
307 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
308 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
309 | }
310 | }
311 |
312 | /**
313 | * Turns on searching the include path for class files.
314 | *
315 | * @param bool $useIncludePath
316 | *
317 | * @return void
318 | */
319 | public function setUseIncludePath($useIncludePath)
320 | {
321 | $this->useIncludePath = $useIncludePath;
322 | }
323 |
324 | /**
325 | * Can be used to check if the autoloader uses the include path to check
326 | * for classes.
327 | *
328 | * @return bool
329 | */
330 | public function getUseIncludePath()
331 | {
332 | return $this->useIncludePath;
333 | }
334 |
335 | /**
336 | * Turns off searching the prefix and fallback directories for classes
337 | * that have not been registered with the class map.
338 | *
339 | * @param bool $classMapAuthoritative
340 | *
341 | * @return void
342 | */
343 | public function setClassMapAuthoritative($classMapAuthoritative)
344 | {
345 | $this->classMapAuthoritative = $classMapAuthoritative;
346 | }
347 |
348 | /**
349 | * Should class lookup fail if not found in the current class map?
350 | *
351 | * @return bool
352 | */
353 | public function isClassMapAuthoritative()
354 | {
355 | return $this->classMapAuthoritative;
356 | }
357 |
358 | /**
359 | * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
360 | *
361 | * @param string|null $apcuPrefix
362 | *
363 | * @return void
364 | */
365 | public function setApcuPrefix($apcuPrefix)
366 | {
367 | $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
368 | }
369 |
370 | /**
371 | * The APCu prefix in use, or null if APCu caching is not enabled.
372 | *
373 | * @return string|null
374 | */
375 | public function getApcuPrefix()
376 | {
377 | return $this->apcuPrefix;
378 | }
379 |
380 | /**
381 | * Registers this instance as an autoloader.
382 | *
383 | * @param bool $prepend Whether to prepend the autoloader or not
384 | *
385 | * @return void
386 | */
387 | public function register($prepend = false)
388 | {
389 | spl_autoload_register(array($this, 'loadClass'), true, $prepend);
390 |
391 | if (null === $this->vendorDir) {
392 | return;
393 | }
394 |
395 | if ($prepend) {
396 | self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
397 | } else {
398 | unset(self::$registeredLoaders[$this->vendorDir]);
399 | self::$registeredLoaders[$this->vendorDir] = $this;
400 | }
401 | }
402 |
403 | /**
404 | * Unregisters this instance as an autoloader.
405 | *
406 | * @return void
407 | */
408 | public function unregister()
409 | {
410 | spl_autoload_unregister(array($this, 'loadClass'));
411 |
412 | if (null !== $this->vendorDir) {
413 | unset(self::$registeredLoaders[$this->vendorDir]);
414 | }
415 | }
416 |
417 | /**
418 | * Loads the given class or interface.
419 | *
420 | * @param string $class The name of the class
421 | * @return true|null True if loaded, null otherwise
422 | */
423 | public function loadClass($class)
424 | {
425 | if ($file = $this->findFile($class)) {
426 | $includeFile = self::$includeFile;
427 | $includeFile($file);
428 |
429 | return true;
430 | }
431 |
432 | return null;
433 | }
434 |
435 | /**
436 | * Finds the path to the file where the class is defined.
437 | *
438 | * @param string $class The name of the class
439 | *
440 | * @return string|false The path if found, false otherwise
441 | */
442 | public function findFile($class)
443 | {
444 | // class map lookup
445 | if (isset($this->classMap[$class])) {
446 | return $this->classMap[$class];
447 | }
448 | if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
449 | return false;
450 | }
451 | if (null !== $this->apcuPrefix) {
452 | $file = apcu_fetch($this->apcuPrefix.$class, $hit);
453 | if ($hit) {
454 | return $file;
455 | }
456 | }
457 |
458 | $file = $this->findFileWithExtension($class, '.php');
459 |
460 | // Search for Hack files if we are running on HHVM
461 | if (false === $file && defined('HHVM_VERSION')) {
462 | $file = $this->findFileWithExtension($class, '.hh');
463 | }
464 |
465 | if (null !== $this->apcuPrefix) {
466 | apcu_add($this->apcuPrefix.$class, $file);
467 | }
468 |
469 | if (false === $file) {
470 | // Remember that this class does not exist.
471 | $this->missingClasses[$class] = true;
472 | }
473 |
474 | return $file;
475 | }
476 |
477 | /**
478 | * Returns the currently registered loaders keyed by their corresponding vendor directories.
479 | *
480 | * @return array
481 | */
482 | public static function getRegisteredLoaders()
483 | {
484 | return self::$registeredLoaders;
485 | }
486 |
487 | /**
488 | * @param string $class
489 | * @param string $ext
490 | * @return string|false
491 | */
492 | private function findFileWithExtension($class, $ext)
493 | {
494 | // PSR-4 lookup
495 | $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496 |
497 | $first = $class[0];
498 | if (isset($this->prefixLengthsPsr4[$first])) {
499 | $subPath = $class;
500 | while (false !== $lastPos = strrpos($subPath, '\\')) {
501 | $subPath = substr($subPath, 0, $lastPos);
502 | $search = $subPath . '\\';
503 | if (isset($this->prefixDirsPsr4[$search])) {
504 | $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
505 | foreach ($this->prefixDirsPsr4[$search] as $dir) {
506 | if (file_exists($file = $dir . $pathEnd)) {
507 | return $file;
508 | }
509 | }
510 | }
511 | }
512 | }
513 |
514 | // PSR-4 fallback dirs
515 | foreach ($this->fallbackDirsPsr4 as $dir) {
516 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
517 | return $file;
518 | }
519 | }
520 |
521 | // PSR-0 lookup
522 | if (false !== $pos = strrpos($class, '\\')) {
523 | // namespaced class name
524 | $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
525 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
526 | } else {
527 | // PEAR-like class name
528 | $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529 | }
530 |
531 | if (isset($this->prefixesPsr0[$first])) {
532 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
533 | if (0 === strpos($class, $prefix)) {
534 | foreach ($dirs as $dir) {
535 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
536 | return $file;
537 | }
538 | }
539 | }
540 | }
541 | }
542 |
543 | // PSR-0 fallback dirs
544 | foreach ($this->fallbackDirsPsr0 as $dir) {
545 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
546 | return $file;
547 | }
548 | }
549 |
550 | // PSR-0 include paths.
551 | if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
552 | return $file;
553 | }
554 |
555 | return false;
556 | }
557 |
558 | /**
559 | * @return void
560 | */
561 | private static function initializeIncludeClosure()
562 | {
563 | if (self::$includeFile !== null) {
564 | return;
565 | }
566 |
567 | /**
568 | * Scope isolated include.
569 | *
570 | * Prevents access to $this/self from included files.
571 | *
572 | * @param string $file
573 | * @return void
574 | */
575 | self::$includeFile = \Closure::bind(static function($file) {
576 | include $file;
577 | }, null, null);
578 | }
579 | }
580 |
--------------------------------------------------------------------------------
/classes/Library.php:
--------------------------------------------------------------------------------
1 | Pro' : '' ;
5 | public static function get_settings_menu() {
6 | $moowoodle_menu = [
7 | "moowoodle-all-courses" => ['name' => __("All Courses", 'moowoodle'), 'default_tab' => 'moowoodle-linked-courses'],
8 | "moowoodle-manage-enrolment" => ['name' => __("Manage Enrolment", 'moowoodle') . MOOWOOLE_PRO_STICKER, 'default_tab' => 'moowoodle-manage-enrolment'],
9 | "moowoodle-settings" => ['name' => __("Settings", 'moowoodle'), 'default_tab' => 'moowoodle-general'],
10 | "moowoodle-synchronization" => ['name' => __("Synchronization", 'moowoodle'), 'default_tab' => 'moowoodle-sync-options'],
11 | ];
12 | return $moowoodle_menu;
13 | }
14 | public static function moowoodle_get_options() {
15 | $user_sync_running_cron_batch = apply_filters('moowoodle_sync_user_corn_info', '');
16 | $sync_wordpress_users = apply_filters('add_moowoodle_sync_wordpress_users_roles','');
17 | $conn_settings = get_option('moowoodle_general_settings');
18 | $url = isset($conn_settings['moodle_url']) ? $conn_settings['moodle_url'] : '';
19 | $woocom_new_user_mail = 'here!';
20 | if ($url != null) {
21 | $moodle_tokens_url = ' ' . __('Manage tokens', 'moowoodle') . '';
22 | $moodle_sso_url = ' ' . __('Moodle', 'moowoodle') . '';
23 | $moowoodle_sync_setting_url = ' ' . __('Synchronization Settings', 'moowoodle') . '';
24 | } else {
25 | $moodle_tokens_url = __('Manage tokens', 'moowoodle');
26 | $moodle_sso_url = __('Moodle', 'moowoodle');
27 | $moowoodle_sync_setting_url = __('Moodle', 'moowoodle');
28 | }
29 | $account_menu_array = array();
30 | $i = 0;
31 | foreach ( wc_get_account_menu_items() as $key => $value) {
32 | $account_menu_array[$i] = $value;
33 | $i++;
34 | }
35 | $moowoodle_options = array(
36 | "moowoodle-all-courses" => array(
37 | "moowoodle-linked-courses" => array(
38 | "label" => __("Moodle Courses", 'moowoodle'),
39 | "font_class" => "dashicons-welcome-learn-more",
40 | "setting" => "moowoodle_course_settings",
41 | "field_types" => array(
42 | "moowoodle-link-course-table" => array(
43 | "type" => "section",
44 | "label" => __("Courses", 'moowoodle'),
45 | ),
46 | "all_course_nolabel" => array(
47 | "type" => "all-course-nolabel",
48 | "label" => __("", 'moowoodle'),
49 | "desc" => __("", 'moowoodle'),
50 | "option_values" => array(
51 | 'Enable' => __('', 'moowoodle'),
52 | ),
53 | ),
54 | ),
55 | ),
56 | ),
57 | "moowoodle-manage-enrolment" => array(
58 | "moowoodle-manage-enrolment" => array(
59 | "label" => __("Enrolment", 'moowoodle'),
60 | "font_class" => "dashicons-analytics",
61 | "setting" => "manage_enrolmente_settings",
62 | "field_types" => array(
63 | "moowoodle-manage-enrolment" => array(
64 | "type" => "section",
65 | "label" => __("All Enrolments", 'moowoodle'),
66 | ),
67 | "manage_enrolment_nolabel" => array(
68 | "type" => "manage-enrolment-nolabel",
69 | "is_pro" => true,
70 | "label" => __("", 'moowoodle'),
71 | "desc" => __("", 'moowoodle'),
72 | "option_values" => array(
73 | 'Enable' => __('', 'moowoodle'),
74 | ),
75 | ),
76 | ),
77 | ),
78 | ),
79 | "moowoodle-settings" => array(
80 | "moowoodle-general" => array(
81 | "label" => __("General", 'moowoodle'),
82 | "font_class" => "dashicons-admin-generic",
83 | "setting" => "moowoodle_general_settings",
84 | "field_types" => array(
85 | "moowoodle-connection" => array(
86 | "type" => "section",
87 | "label" => __("Connection Settings", 'moowoodle'),
88 | ),
89 | "moodle-url" => array(
90 | "type" => "textbox",
91 | 'name' => "moodle_url",
92 | "label" => __("Moodle Site URL", 'moowoodle'),
93 | "desc" => __('Enter the Moodle Site URL', 'moowoodle'),
94 | ),
95 | "moodle-access-token" => array(
96 | "type" => "textbox",
97 | "name" => "moodle_access_token",
98 | "label" => __("Moodle Access Token", 'moowoodle'),
99 | "desc" => __('Enter Moodle Access Token. You can generate the Access Token from - Dashboard => Site administration => Server => Web services => ' . $moodle_tokens_url, 'moowoodle'),
100 | ),
101 | "test-connection" => array(
102 | "type" => "empty-div",
103 | "desc_posi" => "up",
104 | "name" => "test_connection",
105 | "submit_btn_value" => __('Test Connection', 'moowoodle'),
106 | "label" => __("Mooowoodle Test Connection", 'moowoodle'),
107 | "desc" => __("Refer to the", 'moowoodle') . ' ' . esc_html__('setup guide', 'moowoodle') . ' ' . esc_html__('to complete all necessary configurations on the Moodle site, and subsequently, perform a Test Connection to verify the functionality of all services.', 'moowoodle'),
108 | "option_values" => array(
109 | 'Enable' => __('', 'moowoodle'),
110 | ),
111 | ),
112 | "moowoodle-user-information" => array(
113 | "type" => "section",
114 | "label" => __("User Information Exchange Settings", 'moowoodle'),
115 | ),
116 | "update-moodle-user" => array(
117 | "type" => "toggle-checkbox",
118 | "name" => "update_moodle_user",
119 | "label" => __("Force Override Moodle User Profile", 'moowoodle'),
120 | "desc" => __('If enabled, all moodle user\'s profile data (first name, last name, city, address, etc.) will be updated as per their wordpress profile data. Explicitly, for existing user, their data will be overwritten on moodle.', 'moowoodle'),
121 | "option_values" => array(
122 | 'Enable' => __('', 'moowoodle'),
123 | ),
124 | ),
125 | "moowoodle-system-settings" => array(
126 | "type" => "section",
127 | "label" => __("System Settings", 'moowoodle'),
128 | ),
129 | "moodle-timeout" => array(
130 | "type" => "textbox",
131 | "name" => "moodle_timeout",
132 | "label" => __("Timeout", 'moowoodle'),
133 | "desc" => __('Set Curl connection time out in sec.', 'moowoodle'),
134 | ),
135 | "moowoodle-adv-log" => array(
136 | "type" => "toggle-checkbox",
137 | "name" => "moowoodle_adv_log",
138 | "label" => __("Advance Log", 'moowoodle'),
139 | "desc" => __('These setting will record all advanced error informations. Please don\'t Enable it if not required, because it will create a large log file.', 'moowoodle'),
140 | "option_values" => array(
141 | 'Enable' => __('', 'moowoodle'),
142 | ),
143 | ),
144 | ),
145 | ),
146 | "moowoodle-display" => array(
147 | "id" => "moowoodle-display",
148 | "label" => __("Display", 'moowoodle'),
149 | "font_class" => "dashicons-welcome-view-site",
150 | "setting" => "moowoodle_display_settings",
151 | "field_types" => array(
152 | "moowoodle-display" => array(
153 | "type" => "section",
154 | "label" => __("Display Settings", 'moowoodle'),
155 | ),
156 | "start-end-date" => array(
157 | "type" => "toggle-checkbox",
158 | "name" => "start_end_date",
159 | "label" => __("Display Start Date and End Date in Shop Page", 'moowoodle'),
160 | "desc" => __('If enabled display start date and end date in shop page.', 'moowoodle'),
161 | "option_values" => array(
162 | 'Enable' => __('', 'moowoodle'),
163 | ),
164 | ),
165 | "my-courses-priority" => array(
166 | "type" => "select",
167 | "name" => "my_courses_priority",
168 | "label" => __("My Courses Menu Position", 'moowoodle'),
169 | "desc" => __('Select below which menu the My Courses Menu will be displayed', 'moowoodle'),
170 | "option_values" => $account_menu_array,
171 | ),
172 | ),
173 | ),
174 | "moowoodle-SSO" => array(
175 | "is_pro" => true,
176 | "label" => __("SSO ", 'moowoodle'),
177 | "font_class" => "dashicons-admin-multisite",
178 | "setting" => "moowoodle_sso_settings",
179 | "field_types" => array(
180 | "moowoodle-sso" => array(
181 | "type" => "section",
182 | "label" => __("Single Sing On Settings", 'moowoodle'),
183 | ),
184 | "moowoodle-sso-eneble" => array(
185 | "type" => "toggle-checkbox",
186 | 'name' => "moowoodle_sso_eneble",
187 | "is_pro" => true,
188 | "label" => __("Single Sing On", 'moowoodle'),
189 | "desc" => __('If enabled Moodle user\'s will login by WordPress user', 'moowoodle'),
190 | "option_values" => array(
191 | 'Enable' => __('', 'moowoodle'),
192 | ),
193 | ),
194 | "moowoodle-sso-secret-key" => array(
195 | "type" => "textbox",
196 | "name" => "moowoodle_sso_secret_key",
197 | "is_pro" => true,
198 | "copy_text" => "copy",
199 | "label" => __("SSO Secret Key", 'moowoodle'),
200 | "desc" => __('Enter SSO Secret Key it should be same as ' . $moodle_sso_url . ' SSO Secret Key', 'moowoodle'),
201 | ),
202 | ),
203 | ),
204 | "moowoodle-notification" => array(
205 | "is_pro" => true,
206 | "label" => __("Notification ", 'moowoodle'),
207 | "font_class" => "dashicons-bell",
208 | "setting" => "moowoodle_notification_settings",
209 | "field_types" => array(
210 | "moowoodle-notification" => array(
211 | "type" => "section",
212 | "label" => __("Manage Notification", 'moowoodle'),
213 | ),
214 | "moowoodle-create-user-custom-mail-eneble" => array(
215 | "type" => "toggle-checkbox",
216 | 'name' => "moowoodle_create_user_custom_mail",
217 | "is_pro" => true,
218 | "label" => __("Customize New User Registration Email", 'moowoodle'),
219 | "desc" => __('If this option is enabled, default WordPress new user registration emails will be disabled for both admin and user. Our custom New User Registration email will be sent to the newly registered user. You can personalize the content of the MooWoodle New User email from ', 'moowoodle') . $woocom_new_user_mail,
220 | "option_values" => array(
221 | 'Enable' => __('', 'moowoodle'),
222 | ),
223 | ),
224 | ),
225 | ),
226 | "moowoodle-log" => array(
227 | "id" => "moowoodle-log",
228 | "label" => __("Log", 'moowoodle'),
229 | "font_class" => "dashicons-welcome-write-blog",
230 | "setting" => "moowoodle_log",
231 | "field_types" => array(
232 | "moowoodle-log-table" => array(
233 | "type" => "section",
234 | "label" => __("Log", 'moowoodle'),
235 | ),
236 | "log" => array(
237 | "type" => "log",
238 | "label" => __("", 'moowoodle'),
239 | "desc" => __("", 'moowoodle'),
240 | "option_values" => array(
241 | 'Enable' => __('', 'moowoodle'),
242 | ),
243 | ),
244 | ),
245 | ),
246 | ),
247 | "moowoodle-synchronization" => array(
248 | "moowoodle-sync-options" => array(
249 | "label" => __("Synchronization Settings", 'moowoodle'),
250 | "font_class" => "dashicons-admin-links",
251 | "setting" => "moowoodle_synchronize_settings",
252 | "field_types" => array(
253 | "moowoodle-sync-settings" => array(
254 | "type" => "section",
255 | "label" => __("Synchronization Options", 'moowoodle'),
256 | ),
257 | "sync-real-time-user-options" => array(
258 | "type" => "multiple-checkboxs",
259 | "label" => __("Realtime User Sync", 'moowoodle'),
260 | "desc" => __("Activate this feature for effortless user synchronization between Moodle and WordPress. As soon as a new user is added on one platform, our system dynamically syncs their profile to the other, accompanied by email notifications. This ensures users are promptly informed, creating a seamlessly unified experience across both platforms.", 'moowoodle') ,
261 | "option_values" => array(
262 | 'Moodle ⇒ WordPress' => array(
263 | "id" => "realtime-sync-moodle-users",
264 | "name" => "realtime_sync_moodle_users",
265 | "desc" => __("", 'moowoodle'),
266 | "is_pro" => true,
267 | ),
268 | 'WordPress ⇒ Moodle' => array(
269 | "id" => "realtime-sync-wordpress-users",
270 | "name" => "realtime_sync_wordpress_users",
271 | "desc" => __("", 'moowoodle'),
272 | "is_pro" => true,
273 | ),
274 | ),
275 | ),
276 | "sync-user-options" => array(
277 | "type" => "multiple-checkboxs",
278 | "label" => __("User Information", 'moowoodle'),
279 | "desc" => __("Determine User Information to Synchronize in Moodle-WordPress User synchronization. Please be aware that this setting does not apply to newly created users.", 'moowoodle'),
280 | "desc_posi" => "up",
281 | "note" => "Note: We're updating the WordPress password hashing method to ensure compatibility with Moodle. Rest assured, no user data is compromised, and this won't impact the login procedure on your site.",
282 | "option_values" => array(
283 | 'First Name' => array(
284 | "id" => "sync-user-first-name",
285 | "name" => "sync_user_first_name",
286 | "desc" => __("", 'moowoodle'),
287 | "is_pro" => true,
288 | ),
289 | 'Last Name' => array(
290 | "id" => "sync-user-last-name",
291 | "name" => "sync_user_last_name",
292 | "desc" => __("", 'moowoodle'),
293 | "is_pro" => true,
294 | ),
295 | 'Username' => array(
296 | "id" => "sync-username",
297 | "name" => "sync_username",
298 | "desc" => __("", 'moowoodle'),
299 | "is_pro" => true,
300 | ),
301 | 'Password' => array(
302 | "id" => "sync-password",
303 | "name" => "sync_password",
304 | "desc" => __("", 'moowoodle'),
305 | "is_pro" => true,
306 | ),
307 |
308 | ),
309 | ),
310 | ),
311 | ),
312 | "moowoodle-sync-now" => array(
313 | "label" => __("Synchronize Now", 'moowoodle'),
314 | "font_class" => "dashicons-admin-links",
315 | "setting" => "moowoodle_synchronize_now",
316 | "field_types" => array(
317 | "moowoodle-sync-now" => array(
318 | "type" => "section",
319 | "label" => __("Synchronize Option", 'moowoodle'),
320 | ),
321 | "sync-all-user-options" => array(
322 | "type" => "select",
323 | "name" => "sync_users_now",
324 | "submit_btn_value" => __('Sync All Users Now', 'moowoodle'),
325 | "label" => __("Existing Users", 'moowoodle'),
326 | "desc" => __("Prior to updating existing user info, you must select the user info to be synchronized at ", 'moowoodle') . $moowoodle_sync_setting_url . __("
While synchronizing user information, we use the email address as the unique identifier for each user. We check the username associated with that email address, and if we find the same username in the other instance but with a different email address, the user's information cannot be synchronized.", 'moowoodle') ,
327 | "desc_posi" => "up",
328 | "is_pro" => true,
329 | "option_values" => array(
330 | 'Moodle ⇒ WordPress' => array(
331 | "id" => "sync-moodle-users",
332 | "name" => "sync_moodle_users",
333 | "desc" =>$user_sync_running_cron_batch . __("", 'moowoodle'),
334 | ),
335 | 'WordPress ⇒ Moodle' => array(
336 | "id" => "sync-wordpress-users",
337 | "name" => "sync_wordpress_users",
338 | "desc" => $user_sync_running_cron_batch . $sync_wordpress_users . __(" To update passwords for users created before activating the plugin, they must log into WorPress site to migrate their passwords to the new hashing method. After this step, it will synchronize their passwords from WordPress to Moodle.If the user doesn't log in, all other fields will be synchronized except for the password.", 'moowoodle'),
339 | ),
340 | ),
341 | ),
342 | "sync-course-options" => array(
343 | "type" => "multiple-checkboxs",
344 | "label" => __("Courses", 'moowoodle'),
345 | "name" => "sync_course_now",
346 | "submit_btn_value" => __('Sync Courses Now', 'moowoodle'),
347 | "desc" => __("Choose the category you wish to synchronize from Moodle to your WordPress site. During synchronization, if a course is found deleted in Moodle, it will likewise remove the corresponding course and product data from WordPress.", 'moowoodle'),
348 | "option_values" => array(
349 | 'Moodle Courses' => array(
350 | "id" => "sync-courses",
351 | "name" => "sync_courses",
352 | "desc" => __("This function will retrieve all Moodle course data and synchronize it with the courses listed in WordPress.", 'moowoodle'),
353 | "checked" => "forced",
354 | ),
355 | 'Moodle Course Categories' => array(
356 | "id" => "sync-course-category",
357 | "name" => "sync_courses_category",
358 | "desc" => __("This feature will scan the entire Moodle course category structure and synchronize it with the WordPress category listings.", 'moowoodle'),
359 | ),
360 | 'Create and Update Products' => array(
361 | "id" => "sync-all-product",
362 | "name" => "sync_all_product",
363 | "desc" => __("This feature allows you to update previously created product information using Moodle course data. NOTE: This action will overwrite all existing product details with those from Moodle course details.", 'moowoodle'),
364 | ),
365 | 'Create New Products' => array(
366 | "id" => "sync-new-products",
367 | "name" => "sync_new_products",
368 | "desc" => __("This functionality enables automatic creation of new products based on Moodle course data if they do not already exist in WordPress.", 'moowoodle'),
369 | "is_pro" => true,
370 | ),
371 | 'Update Existing Products' => array(
372 | "id" => "sync-exist-product",
373 | "name" => "sync_exist_product",
374 | "desc" => __("This feature allows you to update previously created product information using Moodle course data. NOTE: This action will overwrite all existing product details with those from Moodle course details.", 'moowoodle'),
375 | "is_pro" => true,
376 | ),
377 | 'Course Images' => array(
378 | "id" => "sync-image",
379 | "name" => "sync_image",
380 | "desc" => __("This function copies course images and sets them as WooCommerce product images.", 'moowoodle'),
381 | "is_pro" => true,
382 | ),
383 | ),
384 | ),
385 | ),
386 | ),
387 | ),
388 | );
389 | return apply_filters('moowoodle_fileds_options', $moowoodle_options);
390 | }
391 | }
392 |
--------------------------------------------------------------------------------