-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-multilang-extend.php
67 lines (49 loc) · 1.93 KB
/
wp-multilang-extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
* Plugin Name: Multilang Extend
* Version: 3.1.0
* Plugin URI: https://cs50.com.ua/resheniya/wordpress-plugins/multilang-extend
* Description: developer plugin.
* Author: Gerasart
* Author URI: https://www.facebook.com/gerasymenkoart
*/
if ( !defined( 'ABSPATH' ) ) exit;
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder;
define('MULTI_PATH', plugin_dir_path( __FILE__ ));
define('MULTI_URL', plugin_dir_url( __FILE__ ));
class MultilangExtend {
private static $basedir;
private static $namespace = 'WplExtend';
public function __construct() {
self::$basedir = plugin_dir_path( __FILE__ ) . 'inc/classes/';
self::cc_autoload();
}
private static function cc_autoload() {
$namespaces = self::getDefinedNamespaces();
foreach ($namespaces as $namespace => $path) {
$clear = substr($namespace, 0, strlen($namespace) - 1);
ClassFinder::setAppRoot( MULTI_PATH);
$level = error_reporting(E_ERROR);
$classes = ClassFinder::getClassesInNamespace( $clear );
error_reporting($level);
foreach ( $classes as $class ) {
new $class();
}
}
}
private static function getDefinedNamespaces()
{
$composerJsonPath = dirname( __FILE__ ) . '/composer.json';
$composerConfig = json_decode(file_get_contents($composerJsonPath));
$psr4 = "psr-4";
return (array) $composerConfig->autoload->$psr4;
}
}
new MultilangExtend();
/** @class github updater */
//require 'vendor/updater/plugin-update-checker.php';
//$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker('https://github.com/gerasart/developer-helper/',__FILE__,'developer-helper');
//$myUpdateChecker->setAuthentication('a283aeca2b507dd9d43b8e5b0cf8f6a3e8be50ad');
//$myUpdateChecker->setBranch('master');
//$myUpdateChecker->getVcsApi()->enableReleaseAssets();