public static function currentScreenHook($screen) { if ($screen->post_type !== '') { CocoPostMetaStore::$isPostContext = true; add_action('pre_get_posts', array('CocoPostMetaStore', 'loadFallbackPostId')); } }
public function __construct($prefix = '', $autoForm = true, $autoNonce = true, $useStore = 'auto') { $this->autoForm = $autoForm; if ($useStore === 'auto') { $storeClass = CocoPostMetaStore::isPostContext() ? 'CocoPostMetaStore' : 'CocoOptionStore'; } else { $storeClass = $useStore; } //@TODO : check if custom store implements store interface $this->store = new $storeClass(); $this->store->setPrefix($prefix); if ($this->autoForm) { $this->startWrapper('form'); } if ($autoNonce) { $this->nonce(); } }