/** * Constructor. * * @param string $pluginFile The that contains data */ public function __construct($data = array()) { if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $tm = new TemplateManager($this); $bootFile = dirname($this->getRootPath()) . DIRECTORY_SEPARATOR . 'boot.php'; $datas = get_plugin_data($bootFile, false); if ($datas) { $this->ptd = $datas['TextDomain']; load_plugin_textdomain($this->ptd, false, plugin_basename($this->getRootPath()) . '/Resources/translations'); $this->title = $tm->_($datas['Name']); $this->slug = preg_replace('/ /', '', strtolower($this->title)); $this->version = $datas['Version']; $this->description = $tm->_($datas['Description']); $this->author = $datas['Author']; $this->authorUrl = $datas['AuthorURI']; $this->pluginUrl = $datas['PluginURI']; $data = array_merge(array('wp_data' => $datas), $data); } parent::__construct($data); //set the template manager after the parent construct (dataHolder not yet ready) $this->set('services.template_manager', $tm); //everything is ready we can boot plugins if ($this->getParent()) { add_action($this->getParent() . '_register_plugins', array($this, 'boot')); } else { add_action('plugins_loaded', array($this, 'boot')); } }