/**
  * 
  * @callback        filter      validation + _ + page slug
  */
 public function validate($aInput, $aOldInput, $oFactory, $aSubmitInfo)
 {
     $_bVerified = true;
     $_aErrors = array();
     $_oOption = AmazonAutoLinks_Option::getInstance();
     $_oTemplateOption = AmazonAutoLinks_TemplateOption::getInstance();
     $_oUtil = new AmazonAutoLinks_PluginUtility();
     // Check the limitation.
     if ($_oOption->isUnitLimitReached()) {
         $oFactory->setSettingNotice(sprintf(__('Please upgrade to <A href="%1$s">Pro</a> to add more units! Make sure to empty the <a href="%2$s">trash box</a> to delete the units completely!', 'amazon-auto-links'), 'http://en.michaeluno.jp/amazon-auto-links-pro/', admin_url('edit.php?post_status=trash&post_type=' . AmazonAutoLinks_Registry::$aPostTypes['unit'])));
         return $aOldInput;
     }
     // Check if a url iset.
     $aInput['urls'] = $_oUtil->getAsArray($aInput['urls']);
     if (empty($aInput['urls'])) {
         $_aErrors['urls'] = __('Please set a url.', 'amazon-auto-links');
         $_bVerified = false;
     }
     if (empty($aInput['associate_id'])) {
         $_aErrors['associate_id'] = __('The associate ID cannot be empty.', 'amazon-auto-links');
         $_bVerified = false;
     }
     // An invalid value is found.
     if (!$_bVerified) {
         // Set the error array for the input fields.
         $oFactory->setFieldErrors($_aErrors);
         $oFactory->setSettingNotice(__('There was an error in your input.', 'amazon-auto-links'));
         return $aInput;
     }
     $_bDoAutoInsert = $aInput['auto_insert'];
     // Format the unit options to sanitize the data.
     $_oUnitOptions = new AmazonAutoLinks_UnitOption_url(null, $aInput);
     $aInput = $_oUnitOptions->get();
     $aInput['template_id'] = $_oTemplateOption->getDefaultTemplateIDByUnitType('url');
     // Create a unit post
     $_iNewPostID = $_oUtil->insertPost($aInput, AmazonAutoLinks_Registry::$aPostTypes['unit']);
     // Create an auto insert
     if ($_bDoAutoInsert) {
         $_oUtil->createAutoInsert($_iNewPostID);
     }
     // Clean the temporary form options data.
     $_oUtil->deleteTransient($GLOBALS['aal_transient_id']);
     // Schedule pre-fetching the unit feed in the background
     // so that by the time the user opens the unit page, the cache will be ready.
     AmazonAutoLinks_Event_Scheduler::prefetch($_iNewPostID);
     // Store the inputs for the next time.
     update_option(AmazonAutoLinks_Registry::$aOptionKeys['last_input'], $aInput, false);
     // Go to the post editing page and exit. This way the framework won't create a new form transient row.
     $_oUtil->goToPostDefinitionPage($_iNewPostID, AmazonAutoLinks_Registry::$aPostTypes['unit']);
     // This won't be reached.
     return $aInput;
 }
 /**
  * @return      array
  */
 private function _getActiveButtonLabels()
 {
     $_aButtonIDs = AmazonAutoLinks_PluginUtility::getActiveButtonIDs();
     $_aLabels = array();
     foreach ($_aButtonIDs as $_iButtonID) {
         $_aLabels[$_iButtonID] = get_the_title($_iButtonID) . ' - ' . get_post_meta($_iButtonID, 'button_label', true);
     }
     return $_aLabels;
 }
 private function _checkAPIKeys()
 {
     $_oOption = AmazonAutoLinks_Option::getInstance();
     if ($_oOption->isAPIConnected()) {
         return;
     }
     $this->oFactory->setSettingNotice(__('You need to set API keys first to create a Search unit', 'amazon-auto-links'), 'updated');
     // Go to the Authentication tab of the Settings page.
     AmazonAutoLinks_PluginUtility::goToAPIAuthenticationPage();
 }
 /**
  * Creates a search unit type
  * 
  * @since       2.0.2
  * @return      integer     A newly created post id.
  */
 protected function _createSearchUnit($aInput)
 {
     $_oOption = AmazonAutoLinks_Option::getInstance();
     $_oTemplateOption = AmazonAutoLinks_TemplateOption::getInstance();
     $_oUtil = new AmazonAutoLinks_PluginUtility();
     $_bDoAutoInsert = $aInput['auto_insert'];
     // Sanitize the unit options
     $_sClassName = "AmazonAutoLinks_UnitOption_{$aInput['unit_type']}";
     $_oUnitOptions = new $_sClassName(null, $aInput);
     $aInput = $_oUnitOptions->get();
     // will format the options.
     $aInput['template_id'] = $_oTemplateOption->getDefaultTemplateIDByUnitType($aInput['unit_type']);
     // Create a post.
     $_iNewPostID = $_oUtil->insertPost($aInput, AmazonAutoLinks_Registry::$aPostTypes['unit']);
     // Create an auto insert
     if ($_bDoAutoInsert) {
         $this->_createAutoInsert($_iNewPostID);
     }
     return $_iNewPostID;
 }
 /**
  * @return      array
  */
 private function _getActiveButtonLabels()
 {
     $_aButtonIDs = AmazonAutoLinks_PluginUtility::getActiveButtonIDs();
     $_aLabels = array();
     foreach ($_aButtonIDs as $_iButtonID) {
         $_sButtonLabel = get_post_meta($_iButtonID, 'button_label', true);
         $_sButtonLabel = $_sButtonLabel ? $_sButtonLabel : __('Buy Now', 'amazon-auto-links');
         $_aLabels[$_iButtonID] = $_sButtonLabel;
     }
     return $_aLabels;
 }
 /**
  * Adds form fields.
  * @since       3
  * @return      void
  */
 public function addFields($oFactory, $sSectionID)
 {
     $_oOption = AmazonAutoLinks_Option::getInstance();
     $_aTasks = AmazonAutoLinks_WPUtility::getScheduledCronTasksByActionName('aal_action_event_convert_template_options');
     $oFactory->addSettingFields($sSectionID, array('field_id' => '_show_unit_counts', 'type' => '_show_unit_counts', 'title' => __('Number of Units', 'amazon-auto-links'), 'after_fields' => '<p>' . $this->_getUnitCount() . "</p>"), array('field_id' => '_scheduled_tasks', 'type' => '_scheduled_tasks', 'title' => __('Remaining Scheduled Tasks', 'amazon-auto-links'), 'after_fields' => '<p>' . count($_aTasks) . "</p>"), array('field_id' => '_separator', 'type' => '_separator', 'show_title_column' => false, 'after_fields' => '<hr />'), array('field_id' => 'unit_types', 'type' => 'checkbox', 'title' => __('Unit Types', 'amazon-auto-links'), 'label' => AmazonAutoLinks_PluginUtility::getUnitTypeLabels(), 'select_all_button' => true, 'select_none_button' => true, 'default' => array_fill_keys(array_keys(AmazonAutoLinks_PluginUtility::getUnitTypeLabels()), true)), array());
     $_oFields = new AmazonAutoLinks_FormFields_Unit_Template();
     $_aFields = $_oFields->get();
     foreach ($_aFields as $_aField) {
         $oFactory->addSettingFields($sSectionID, $_aField);
     }
     $oFactory->addSettingFields($sSectionID, array('field_id' => '_submit_convert', 'type' => 'submit', 'value' => __('Convert', 'amazon-auto-links'), 'label_min_width' => '', 'attributes' => array('field' => array('style' => 'float:right;'), 'disabled' => $_oOption->isAdvancedAllowed() ? null : 'disabled', 'title' => $_oOption->isAdvancedAllowed() ? __('Convert Options', 'amazon-auto-links') : __('Get Pro!', 'amazon-auto-links')), 'after_fieldset' => $_oOption->isAdvancedAllowed() ? '' : "<p>" . sprintf(__('In order to use this feature, please consider purchasing <a href="%1$s" target="_blank">Pro</a>.', 'amazon-auto-links'), 'http://en.michaeluno.jp/amazon-auto-links-pro/') . "</p>"), array());
 }
 /**
  * Triggers event actions.
  */
 public function __construct()
 {
     // @todo check the count of posts of the button post type.
     $_oPostCount = wp_count_posts(AmazonAutoLinks_Registry::$aPostTypes['button']);
     if (!is_object($_oPostCount)) {
         return;
     }
     // If a button exists, return
     if (isset($_oPostCount->publish) && $_oPostCount->publish <= 0) {
         // Otherwise, create one.
         $this->_createDefaultButton();
     }
     // Update the button CSS option.
     update_option(AmazonAutoLinks_Registry::$aOptionKeys['button_css'], AmazonAutoLinks_PluginUtility::getCSSRulesOfActiveButtons());
 }
 /**
  * Validates submitted form data.
  */
 public function validate($aInput, $aOriginal, $oFactory)
 {
     $_oOption = AmazonAutoLinks_Option::getInstance();
     $_oUtil = new AmazonAutoLinks_WPUtility();
     add_filter('safe_style_css', array($this, 'replyToAddAllowedInlineCSSProperties'));
     $_aAllowedHTMLTags = $_oUtil->convertStringToArray($_oOption->get('form_options', 'allowed_html_tags'), ',');
     $aInput['item_format'] = $_oUtil->escapeKSESFilter($aInput['item_format'], $_aAllowedHTMLTags);
     $aInput['image_format'] = $_oUtil->escapeKSESFilter($aInput['image_format'], $_aAllowedHTMLTags);
     $aInput['title_format'] = $_oUtil->escapeKSESFilter($aInput['title_format'], $_aAllowedHTMLTags);
     remove_filter('safe_style_css', array($this, 'replyToAddAllowedInlineCSSProperties'));
     // Schedule pre-fetch for the unit if the options have been changed.
     if ($aInput !== $aOriginal) {
         AmazonAutoLinks_Event_Scheduler::prefetch(AmazonAutoLinks_PluginUtility::getCurrentPostID());
     }
     return $aInput;
 }
 /**
  * Validates submitted form data.
  */
 public function validate($aInput, $aOriginal, $oFactory)
 {
     // Formats the options
     $_oUnitOption = new AmazonAutoLinks_UnitOption_search(null, $aInput);
     $_aFormatted = $_oUnitOption->get();
     // Drop unsent keys.
     foreach ($_aFormatted as $_sKey => $_mValue) {
         if (!array_key_exists($_sKey, $aInput)) {
             unset($_aFormatted[$_sKey]);
         }
     }
     // Schedule pre-fetch for the unit if the options have been changed.
     if ($aInput !== $aOriginal) {
         AmazonAutoLinks_Event_Scheduler::prefetch(AmazonAutoLinks_PluginUtility::getCurrentPostID());
     }
     return $_aFormatted + $aInput;
 }
 /**
  * Returns field definition arrays.
  * 
  * Pass an empty string to the parameter for meta box options. 
  * 
  * @return      array
  */
 public function get($sFieldIDPrefix = '', $sUnitType = 'category')
 {
     $_oOption = $this->oOption;
     $_bAPIConnected = $this->oOption->isAPIConnected();
     $_sDel = $_bAPIConnected ? '' : "delete-line";
     $_iMaxCol = $this->oOption->getMaxSupportedColumnNumber();
     $_aItemFormat = AmazonAutoLinks_UnitOption_Base::getDefaultItemFormat();
     $_aFields = array(array('field_id' => $sFieldIDPrefix . 'template_id', 'type' => 'select', 'title' => __('Template Name', 'amazon-auto-links'), 'tip' => __('Sets a default template for this unit.', 'amazon-auto-links'), 'label' => $this->oTemplateOption->getActiveTemplateLabels(), 'default' => $this->oTemplateOption->getDefaultTemplateIDByUnitType($sUnitType)), array('field_id' => $sFieldIDPrefix . 'column', 'title' => __('Number of Columns', 'amazon-auto-links'), 'type' => 'number', 'attributes' => array('class' => $_iMaxCol > 1 ? '' : 'disabled', 'disabled' => $_iMaxCol > 1 ? null : 'disabled', 'max' => $_iMaxCol), 'after_input' => "<div style='margin:auto; width:100%; clear: both;'><img src='" . AmazonAutoLinks_Registry::getPluginURL('asset/image/columns.gif') . "' title='" . __('The number of columns', 'amazon-auto-links') . "' style='width:220px; margin-top: 8px;' /></div>", 'tip' => __('This option requires a column supported template to be activated.'), 'description' => $_iMaxCol > 1 ? '' : ' ' . sprintf(__('Get one <a href="%1$s" target="_blank">here</a>!'), 'http://en.michaeluno.jp/amazon-auto-links-pro/'), 'default' => 4, 'delimiter' => ''), array('field_id' => $sFieldIDPrefix . 'item_format', 'type' => 'textarea', 'title' => __('Item Format', 'amazon-auto-links'), 'attributes' => array('class' => $_oOption->isAdvancedAllowed() ? '' : 'read-only', 'readonly' => $_oOption->isAdvancedAllowed() ? null : 'raedonly', 'rows' => 6, 'style' => 'width: 96%'), 'default' => $_aItemFormat['item_format'], 'description' => __('Sets the layout of the product. The following variables are available.', 'amazon-auto-links') . '<br />' . "<code>%href%</code> - " . __('product link url', 'amazon-auto-links') . '<br />' . "<code>%title%</code> - " . __('title with HTML tags defined in the Title Format option', 'amazon-auto-links') . '<br />' . "<code>%title_text%</code> - " . __('title without HTML tags', 'amazon-auto-links') . '<br />' . "<code>%image%</code> - " . __('thumbnail with HTML tags defined in the Image Format option', 'amazon-auto-links') . '<br />' . "<code class='{$_sDel}'>%image_set%</code> - " . __('sub-images.', 'amazon-auto-links') . '<br />' . "<code>%description%</code> - " . __('description with HTML tags', 'amazon-auto-links') . '<br />' . "<code>%description_text%</code> - " . __('description without HTML tags', 'amazon-auto-links') . '<br />' . "<code class='{$_sDel}'>%price%</code> - " . __('product price.', 'amazon-auto-links') . '<br />' . "<code class='{$_sDel}'>%rating%</code> - " . __('user rating.', 'amazon-auto-links') . '<br />' . "<code class='{$_sDel}'>%review%</code> - " . __('customer review.', 'amazon-auto-links') . '<br />' . "<code>%button%</code> - " . __('store link button.', 'amazon-auto-links') . '<br />' . "<code>%disclaimer%</code> - " . __('disclaimer for the product information.', 'amazon-auto-links') . '<br />' . ($_bAPIConnected ? null : sprintf('* <span class="warning">' . __('Some items need <a href="%1$s">API</a> to be set up.', 'amazon-auto-links') . "</span>", AmazonAutoLinks_PluginUtility::getAPIAuthenticationPageURL()))), array('field_id' => $sFieldIDPrefix . 'title_format', 'title' => __('Title Format', 'amazon-auto-links'), 'type' => 'textarea', 'default' => $_aItemFormat['title_format'], 'attributes' => array('rows' => 6, 'class' => $_oOption->isAdvancedAllowed() ? '' : 'read-only', 'readonly' => $_oOption->isAdvancedAllowed() ? null : 'readonly', 'style' => 'width: 96%'), 'description' => __('Sets the layout of the title.', 'amazon-auto-links') . '<br />' . '<code>%href%</code> - ' . __('product link url', 'amazon-auto-links') . '<br />' . '<code>%title_text%</code> - ' . __('title', 'amazon-auto-links') . '<br />' . '<code>%description_text%</code> - ' . __('description without HTML tags', 'amazon-auto-links')), array('field_id' => $sFieldIDPrefix . 'image_format', 'title' => __('Image Format', 'amazon-auto-links'), 'type' => 'textarea', 'attributes' => array('rows' => 6, 'class' => $_oOption->isAdvancedAllowed() ? '' : 'read-only', 'readonly' => $_oOption->isAdvancedAllowed() ? null : 'readonly', 'style' => 'width: 96%'), 'default' => $_aItemFormat['image_format'], 'description' => __('Sets the layout of the image.', 'amazon-auto-links') . '<br />' . '<code>%href%</code> - ' . __('product link url', 'amazon-auto-links') . '<br />' . '<code>%title_text%</code> - ' . __('title', 'amazon-auto-links') . '<br />' . '<code>%src%</code> - ' . __('image url', 'amazon-auto-links') . '<br />' . '<code>%max_width%</code> - ' . __('image size', 'amazon-auto-links') . '<br />' . '<code>%description_text%</code> - ' . __('description without HTML tags', 'amazon-auto-links')));
     // Insert common field arguments.
     $_bIsDisabled = !$_oOption->isAdvancedAllowed();
     if (!$_bIsDisabled) {
         return $_aFields;
     }
     $_sOpeningTag = $_bIsDisabled ? "<div class='upgrade-to-pro' style='margin:0; padding:0; display: inline-block;' title='" . __('Please consider upgrading to Pro to use this feature!', 'amazon-auto-links') . "'>" : "";
     $_sClosingTag = $_bIsDisabled ? "</div>" : "";
     foreach ($_aFields as &$_aField) {
         if ($sFieldIDPrefix . 'template_id' === $_aField['field_id']) {
             continue;
         }
         $_aField = array('before_fieldset' => $_sOpeningTag, 'after_fieldset' => $_sClosingTag) + $_aField;
     }
     return $_aFields;
 }
 /**
  * Validates submitted form data.
  */
 public function validate($aInput, $aOriginal, $oFactory)
 {
     $_aErrors = array();
     $_bVerified = true;
     // Formats the options
     $_oUnitOption = new AmazonAutoLinks_UnitOption_url(null, $aInput);
     $_aFormatted = $_oUnitOption->get();
     // Check if a url iset.
     $aInput['urls'] = $this->oUtil->getAsArray($aInput['urls']);
     if (empty($aInput['urls'])) {
         $_aErrors['urls'] = __('Please set a url.', 'amazon-auto-links');
         $_bVerified = false;
     }
     // An invalid value is found.
     if (!$_bVerified) {
         // Set the error array for the input fields.
         $oFactory->setFieldErrors($_aErrors);
         $oFactory->setSettingNotice(__('There was an error in your input.', 'amazon-auto-links'));
         return $aInput;
     }
     // Sanitize
     foreach ($aInput['urls'] as $_iIndex => $_sURL) {
         $aInput['urls'][$_iIndex] = trim($_sURL);
     }
     // Drop unsent keys.
     foreach ($_aFormatted as $_sKey => $_mValue) {
         if (!array_key_exists($_sKey, $aInput)) {
             unset($_aFormatted[$_sKey]);
         }
     }
     // Schedule pre-fetch for the unit if the options have been changed.
     if ($aInput !== $aOriginal) {
         AmazonAutoLinks_Event_Scheduler::prefetch(AmazonAutoLinks_PluginUtility::getCurrentPostID());
     }
     return $_aFormatted + $aInput;
 }
 /**
  * 
  * @callback        filter      cell_{post type slug}_{column slug}
  */
 public function cell_aal_button_preview($sCell, $iPostID)
 {
     return $sCell . AmazonAutoLinks_PluginUtility::getButton($iPostID);
 }
Beispiel #13
0
</language>
    <sy:updatePeriod><?php 
echo apply_filters('rss_update_period', 'hourly');
?>
</sy:updatePeriod>
    <sy:updateFrequency><?php 
echo apply_filters('rss_update_frequency', '1');
?>
</sy:updateFrequency>
    <?php 
do_action('rss2_head');
if (isset($aProducts['Error']['Message'], $aProducts['Error']['Code'])) {
    $aProducts = array();
}
foreach ($aProducts as $_aProduct) {
    $sLabels = empty($aArguments['_labels']) ? AmazonAutoLinks_PluginUtility::getReadableLabelsByUnitID($aArguments['id']) : AmazonAutoLinks_PluginUtility::getReadableLabelsByLabelID($aArguments['_labels']);
    $_sGUID = $aArguments['unit_type'] . '_' . $_aProduct['ASIN'] . '_' . $aArguments['country'];
    ?>
    
    <item>
        <title><![CDATA[<?php 
    echo $_aProduct['title'];
    ?>
]]></title>
        <link><?php 
    echo $_aProduct['product_url'];
    ?>
</link>
        <comments></comments>
        <pubDate><?php 
    // echo date( 'D, d M Y H:i:s +0000', $_aProduct[ 'created_at' ] );
Beispiel #14
0
<?php

/*
 * Available variables:
 * 
 * $aOptions   - the plugin options
 * $aProducts  - the fetched product links
 * $aArguments - the user defined arguments such as image size and count etc.
 */
$_aStructure_Product = array('product_url' => '', 'title' => '', 'text_description' => '', 'description' => '', 'image_size' => '', 'product_url' => '', 'thumbnail_url' => '');
$sClassAttributes_ProductsContainer = 'amazon-products-container' . ' amazon-unit-' . $aArguments['id'];
$sClassAttributes_ProductsContainer .= empty($aArguments['_labels']) ? '' : ' amazon-label-' . implode(' amazon-label-', $aArguments['_labels']);
$_sWidth = AmazonAutoLinks_PluginUtility::getDegree('width', $aArguments);
$_sWidth = $_sWidth ? "width: {$_sWidth};" : '';
$_sHeight = AmazonAutoLinks_PluginUtility::getDegree('height', $aArguments);
$_sHeight = $_sHeight ? "height: {$_sHeight};" : '';
$_sInlineStyle = $_sWidth . $_sHeight;
if (empty($aProducts)) {
    ?>
    <div><p><?php 
    _e('No products found.', 'amazon-auto-links');
    ?>
</p></div>  
    <?php 
    return true;
}
?>
    

<?php 
if (isset($aProducts['Error']['Message'], $aProducts['Error']['Code'])) {
 /**
  * Updates the active button CSS rules.
  * @callback    action  shutdown
  */
 public function replyToUpdateButtonCSSOnShutdown()
 {
     update_option(AmazonAutoLinks_Registry::$aOptionKeys['button_css'], AmazonAutoLinks_PluginUtility::getCSSRulesOfActiveButtons());
 }
 /**
  * 
  * @remark      Will redirect the user to the next page and exits the script.
  */
 private function _goToNextPage($aInput)
 {
     // Set the unit type based on the chosen one.
     // Redirect to the appropriate page by the search type.
     switch ($aInput['Operation']) {
         default:
         case 'ItemSearch':
             $_sTabSlug = 'search_products';
             break;
         case 'ItemLookup':
             $_sTabSlug = 'item_lookup';
             break;
         case 'SimilarityLookup':
             $_sTabSlug = 'similarity_lookup';
             break;
     }
     AmazonAutoLinks_PluginUtility::setTransient($aInput['transient_id'], $aInput, 60 * 10 * 6 * 24);
     // Go to the next page.
     exit(wp_redirect(add_query_arg(array('tab' => $_sTabSlug, 'transient_id' => $aInput['transient_id']) + $_GET, $aInput['bounce_url'])));
 }
 /**
  * Creates a post of amazon_auto_links custom post type with unit option meta fields.
  * 
  * @return      integer     the post(unit) id.
  */
 private function _postUnitByCategory($aUnitOptions, $aOptions)
 {
     $_iPostID = 0;
     // Create a custom post if it's a new unit.
     if (!isset($_GET['post']) || !$_GET['post']) {
         $_iPostID = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => $GLOBALS['user_ID'], 'post_title' => $aOptions['unit_title'], 'post_status' => 'publish', 'post_type' => AmazonAutoLinks_Registry::$aPostTypes['unit']));
     }
     // Add meta fields.
     $_iPostID = 1 == $aOptions['mode'] ? $_iPostID : $_GET['post'];
     // Remove unnecessary items.
     // The unit title was converted to post_title above.
     unset($aUnitOptions['unit_title'], $aUnitOptions['is_preview']);
     $_oOption = AmazonAutoLinks_Option::getInstance();
     $_oTemplateOption = AmazonAutoLinks_TemplateOption::getInstance();
     $aUnitOptions['template_id'] = $_oTemplateOption->getDefaultTemplateIDByUnitType('category');
     AmazonAutoLinks_WPUtility::updatePostMeta($_iPostID, $aUnitOptions);
     // Create an auto insert - the 'auto_insert' key will be removed when creating a post.s
     if (isset($aOptions['auto_insert']) && $aOptions['auto_insert'] && 1 == $aOptions['mode']) {
         AmazonAutoLinks_PluginUtility::createAutoInsert($_iPostID);
     }
     return $_iPostID;
 }
 /**
  * Print out the contents in the front-end.
  * 
  * Alternatively you may use the content_{instantiated class name} method.
  */
 public function content($sContent, $aArguments, $aFormData)
 {
     $aFormData = $this->_getFormattedFormData($aFormData);
     if (!in_array(AmazonAutoLinks_PluginUtility::getCurrentPageType(), $aFormData['available_page_types'])) {
         $this->oProp->bShowWidgetTitle = false;
         return $sContent;
     }
     return $sContent . AmazonAutoLinks($aFormData, false);
 }
 /**
  * @since       3.1.0
  */
 public function replyToRemoveCredit($sUnitOutput)
 {
     return str_replace(AmazonAutoLinks_PluginUtility::getCommentCredit(), '', $sUnitOutput);
 }
 /**
  * Returns field definition arrays.
  * 
  * Pass an empty string to the parameter for meta box options. 
  * 
  * @return      array
  */
 public function get($sFieldIDPrefix = '', $sUnitType = 'category')
 {
     $_aFields = array(array('field_id' => $sFieldIDPrefix . 'button_preview', 'type' => '_preview_button', 'show_title_column' => false, 'attributes' => array('name' => ''), 'before_field' => "<div style='margin: 3em 3em 3em 0; width:100%;'>" . "<div style='margin-left: auto; margin-right: auto; '>" . AmazonAutoLinks_PluginUtility::getButton(isset($_GET['post']) ? $_GET['post'] : 0) . "</div>" . "</div>"));
     return $_aFields;
 }
 /**
  * Print out the contents in the front-end.
  * 
  * @callback        filter      content_{instantiated class name}
  */
 public function content($sContent, $aArguments, $aFormData)
 {
     $aFormData = $this->_getFormattedFormData($aFormData);
     if (!in_array(AmazonAutoLinks_PluginUtility::getCurrentPageType(), $aFormData['available_page_types'])) {
         $this->oProp->bShowWidgetTitle = false;
         return $sContent;
     }
     $_sOutput = $this->_getOutput($aFormData, $aArguments);
     if (!$_sOutput && !$aFormData['show_title_on_no_result']) {
         $this->oProp->bShowWidgetTitle = false;
     }
     return $sContent . $_sOutput;
 }
 /**
  * @callback        filter      cell_{post type slug}_{column key}
  * @return          string
  */
 public function cell_amazon_auto_links_unit_type($sCell, $iPostID)
 {
     $_sUnitType = get_post_meta($iPostID, 'unit_type', true);
     $_aUnitTypeLabels = AmazonAutoLinks_PluginUtility::getUnitTypeLabels();
     return isset($_aUnitTypeLabels[$_sUnitType]) ? $_aUnitTypeLabels[$_sUnitType] : __('Category', 'amazon-auto-links');
 }