/** * Handles options presetting on first install / activation * @param IfwPsn_Wp_Plugin_Manager $pm */ protected function _presetOptions(IfwPsn_Wp_Plugin_Manager $pm) { if (!$pm->hasOption('selftest_timestamp')) { // on first install (no selftest timestam could be found) $pm->getOptions()->updateOption('psn_ignore_status_inherit', true); } }
/** * @param $id * @return mixed|null */ public function getOption($id) { if ($this->hasOption($id)) { $options = IfwPsn_Wp_Proxy::getOption($this->_pm->getOptions()->getPageId()); return $options[$this->_pm->getOptions()->getOptionRealId($id)]; } return null; }
/** * @param IfwPsn_Wp_Plugin_Manager|null $pm * @return mixed|void */ public static function execute($pm) { if (!$pm instanceof IfwPsn_Wp_Plugin_Manager) { return; } if (IfwPsn_Wp_Proxy_Blog::isMultisite()) { // multisite installation $currentBlogId = IfwPsn_Wp_Proxy_Blog::getBlogId(); foreach (IfwPsn_Wp_Proxy_Blog::getMultisiteBlogIds() as $blogId) { IfwPsn_Wp_Proxy_Blog::switchToBlog($blogId); $pm->getOptions()->reset(); } IfwPsn_Wp_Proxy_Blog::switchToBlog($currentBlogId); } else { // single blog installation $pm->getOptions()->reset(); } }