Author: Inpsyde GmbH, toscho
Inheritance: implements Inpsyde_Property_List_Interface
/**
 * Initialize the plugin.
 *
 * @wp-hook plugins_loaded
 *
 * @return void
 */
function mlp_init()
{
    global $pagenow, $wp_version, $wpdb;
    $plugin_path = plugin_dir_path(__FILE__);
    $plugin_url = plugins_url('/', __FILE__);
    $assets_base = 'assets';
    if (!class_exists('Mlp_Load_Controller')) {
        require $plugin_path . 'inc/autoload/Mlp_Load_Controller.php';
    }
    $loader = new Mlp_Load_Controller($plugin_path . 'inc');
    $data = new Mlp_Plugin_Properties();
    $data->set('loader', $loader->get_loader());
    $locations = new Mlp_Internal_Locations();
    $locations->add_dir($plugin_path, $plugin_url, 'plugin');
    $assets_locations = array('css' => 'css', 'js' => 'js', 'images' => 'images', 'flags' => 'images/flags');
    foreach ($assets_locations as $type => $dir) {
        $locations->add_dir($plugin_path . $assets_base . '/' . $dir, $plugin_url . $assets_base . '/' . $dir, $type);
    }
    $data->set('locations', $locations);
    $data->set('plugin_file_path', __FILE__);
    $data->set('plugin_base_name', plugin_basename(__FILE__));
    $headers = get_file_data(__FILE__, array('text_domain_path' => 'Domain Path', 'plugin_uri' => 'Plugin URI', 'plugin_name' => 'Plugin Name', 'version' => 'Version'));
    foreach ($headers as $name => $value) {
        $data->set($name, $value);
    }
    if (!mlp_pre_run_test($pagenow, $data, $wp_version, $wpdb)) {
        return;
    }
    $mlp = new Multilingual_Press($data, $wpdb);
    $mlp->setup();
}
 /**
  * @return void
  */
 public function prepare_plugin_data()
 {
     $site_relations = $this->container['multilingualpress.site_relations'];
     $content_relations = $this->container['multilingualpress.content_relations'];
     $type_factory = $this->container['multilingualpress.type_factory'];
     $language_api = new Mlp_Language_Api($this->plugin_data, 'mlp_languages', $site_relations, $content_relations, $this->wpdb, $type_factory, $this->container['multilingualpress.request']);
     $this->plugin_data->set('module_manager', $this->container['multilingualpress.module_manager']);
     $this->plugin_data->set('site_relations', $site_relations);
     $this->plugin_data->set('type_factory', $type_factory);
     $this->plugin_data->set('link_table', $this->container['multilingualpress.content_relations_table']->name());
     $this->plugin_data->set('content_relations', $content_relations);
     $this->plugin_data->set('language_api', $language_api);
     // TODO: Remove as soon as the whole Assets structures have been refactored (Locations -> Assets\Locator).
     $this->plugin_data->set('assets', $this->container['multilingualpress.asset_manager']);
     $this->plugin_data->set('languages', $this->container['multilingualpress.languages']);
     $this->plugin_data->set('locations', $this->container['multilingualpress.internal_locations']);
     $this->plugin_data->set('nonce_factory', $this->container['multilingualpress.nonce_factory']);
     Mlp_Helpers::insert_dependency('language_api', $this->plugin_data->get('language_api'));
 }