/** * Sets up form fields. */ public function setUp() { $_oFields = new AmazonAutoLinks_FormFields_Unit_Template(); $_aFields = $_oFields->get('', 'category'); foreach ($_aFields as $_aField) { $this->addSettingFields($_aField); } }
/** * 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()); }