| 1 |
<?php |
| 2 |
/** |
| 3 |
* Set up config object, store plugin URL and path there |
| 4 |
* along with various other items |
| 5 |
*/ |
| 6 |
|
| 7 |
\Codelight\GDPR\Container::getInstance()->bindIf('config', function () { |
| 8 |
return new \Codelight\GDPR\Config([ |
| 9 |
'plugin' => [ |
| 10 |
'url' => plugin_dir_url(__FILE__), |
| 11 |
'path' => plugin_dir_path(__FILE__), |
| 12 |
'template_path' => plugin_dir_path(__FILE__) . 'views/', |
| 13 |
], |
| 14 |
'help' => [ |
| 15 |
'url' => 'https://www.data443.com/gdpr-framework/', |
| 16 |
], |
| 17 |
]); |
| 18 |
}, true); |
| 19 |
|
| 20 |
/** |
| 21 |
* Set up the application container |
| 22 |
* |
| 23 |
* @param string $abstract |
| 24 |
* @param array $parameters |
| 25 |
* @param Codelight\GDPR\Container $container |
| 26 |
* |
| 27 |
* @return Codelight\GDPR\Container|mixed |
| 28 |
*/ |
| 29 |
function gdpr($abstract = null, $parameters = [], Codelight\GDPR\Container $container = null) |
| 30 |
{ |
| 31 |
$container = $container ?: Codelight\GDPR\Container::getInstance(); |
| 32 |
|
| 33 |
if ( ! $abstract) { |
| 34 |
return $container; |
| 35 |
} |
| 36 |
|
| 37 |
return $container->bound($abstract) |
| 38 |
? $container->makeWith($abstract, $parameters) |
| 39 |
: $container->makeWith("gdpr.{$abstract}", $parameters); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Start the plugin on plugins_loaded at priority 0. |
| 44 |
*/ |
| 45 |
add_action('plugins_loaded', function () use ($gdpr_error) { |
| 46 |
|
| 47 |
load_plugin_textdomain('gdpr-framework', false, basename( dirname( __FILE__ ) ) . '/languages/'); |
| 48 |
|
| 49 |
$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
| 50 |
|
| 51 |
$locale = apply_filters( 'plugin_locale', $locale, 'gdpr-framework' ); |
| 52 |
|
| 53 |
unload_textdomain( 'gdpr-framework' ); |
| 54 |
|
| 55 |
load_textdomain( 'gdpr-framework', get_stylesheet_directory().'/gdpr-framework/languages/'.'gdpr-framework'.'-'.$locale.'.mo' ); |
| 56 |
|
| 57 |
new \Codelight\GDPR\Updater\Updater(); |
| 58 |
|
| 59 |
new \Codelight\GDPR\Setup(); |
| 60 |
|
| 61 |
}, 0); |
| 62 |
|