/** * Sets the default option values for the setting form. * @callback filter `options_{class name}` * @return array The options array. */ public function setOptions($aOptions) { $_oUtil = new AmazonAutoLinks_WPUtility(); $_iPostID = $_oUtil->getCurrentPostID(); $_aUnitOptions = $_iPostID ? $_oUtil->getPostMeta($_GET['post']) : array(); return $aOptions + $_aUnitOptions + self::$aStructure_AutoInsertDefaultOptions; }
/** * Checks whether the meta box should be registered or not in the loading page. */ public function _isInThePage() { if (!parent::_isInThePage()) { return false; } // Register custom filed type. new AmazonAutoLinks_RevealerCustomFieldType($this->oProp->sClassName); // At this point, it is TRUE evaluated by the framework. // but we need to evaluate it for the plugin. // Get the post ID. $_iPostID = AmazonAutoLinks_WPUtility::getCurrentPostID(); // Maybe post-new.php if (!$_iPostID) { return true; } $_sUnitType = get_post_meta($_iPostID, 'unit_type', true); return in_array($_sUnitType, $this->aUnitTypes); }