/** * Echoes or returns the output of Amazon product links. * @since 1 * @since 3 Added the second parameter to let the user choose whether it should echo or return the output. */ function AmazonAutoLinks($aArguments, $bEcho = true) { if ($bEcho) { AmazonAutoLinks_Output::getInstance($aArguments)->render(); return; } return AmazonAutoLinks_Output::getInstance($aArguments)->get(); }
/** * Prints out the fetched product links. * * @remark Used for the post type single page that functions as preview the result. * @since 3 Changed the name from `_replytToPrintPreviewProductLinks()`. * */ public function content($sContent) { $_oOption = AmazonAutoLinks_Option::getInstance(); if (!$_oOption->isPreviewVisible()) { return $sContent; } $_sUnitType = get_post_meta($GLOBALS['post']->ID, 'unit_type', true); $_sUnitType = $_sUnitType ? $_sUnitType : 'category'; $_sUnitOptionClassName = "AmazonAutoLinks_UnitOption_" . $_sUnitType; $_oUnitOptions = new $_sUnitOptionClassName($GLOBALS['post']->ID); $_aUnitOptions = $_oUnitOptions->get(); return $sContent . AmazonAutoLinks_Output::getInstance($_aUnitOptions)->get(); }
/** * * @callback action aal_action_unit_prefetch */ public function doAction() { $_aParams = func_get_args() + array(null); $iUnitID = $_aParams[0]; $_sUnitType = get_post_meta($iUnitID, 'unit_type', true); if (!$_sUnitType) { return; } // Just call the output. $_sUnitOptionClassName = "AmazonAutoLinks_UnitOption_" . $_sUnitType; $_oUnitOptions = new $_sUnitOptionClassName($iUnitID); $_aUnitOptions = $_oUnitOptions->get(); AmazonAutoLinks_Output::getInstance($_aUnitOptions)->get(); }