アマゾンの設定画面・グッズメモ アフィリエイト

グッズメモ アフィリエイト・WordPressプラグインのソースコード記事の目次WordPress

AmazonSettingSection.php

アマゾンの設定画面を表示します。


namespace goodsmemo\option\amazon;

use goodsmemo\option\AbstractSettingSection;
use goodsmemo\option\PageInfo;
use goodsmemo\option\SettingSection;
use goodsmemo\option\SectionInfo;
use goodsmemo\option\paragraph\URLParagraph;
use goodsmemo\option\paragraph\ItemHTMLParagraph;
use goodsmemo\option\paragraph\ReviewParagraph;
use goodsmemo\option\amazon\URLParagraphUtils;
use goodsmemo\option\amazon\CommonRESTParagraph;
use goodsmemo\option\amazon\CommonRESTParagraphUtils;
use goodsmemo\option\amazon\ItemHTMLParagraphUtils;
use goodsmemo\option\amazon\ReviewParagraphUtils;
use goodsmemo\option\amazon\ProductTypeParagraph;
use goodsmemo\option\amazon\ProductTypeParagraphUtils;
use goodsmemo\option\amazon\RESTParagraph;
use goodsmemo\option\amazon\RESTParagraphUtils;
use goodsmemo\option\amazon\SearchWidgetParagraph;
use goodsmemo\option\amazon\SearchWidgetParagraphUtils;

require_once GOODS_MEMO_DIR . "option/AbstractSettingSection.php";
require_once GOODS_MEMO_DIR . "option/PageInfo.php";
require_once GOODS_MEMO_DIR . "option/SettingSection.php";
require_once GOODS_MEMO_DIR . "option/SectionInfo.php";
require_once GOODS_MEMO_DIR . "option/paragraph/URLParagraph.php";
require_once GOODS_MEMO_DIR . "option/paragraph/ItemHTMLParagraph.php";
require_once GOODS_MEMO_DIR . "option/paragraph/ReviewParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/URLParagraphUtils.php";
require_once GOODS_MEMO_DIR . "option/amazon/CommonRESTParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/CommonRESTParagraphUtils.php";
require_once GOODS_MEMO_DIR . "option/amazon/ItemHTMLParagraphUtils.php";
require_once GOODS_MEMO_DIR . "option/amazon/ReviewParagraphUtils.php";
require_once GOODS_MEMO_DIR . "option/amazon/ProductTypeParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/ProductTypeParagraphUtils.php";
require_once GOODS_MEMO_DIR . "option/amazon/RESTParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/RESTParagraphUtils.php";
require_once GOODS_MEMO_DIR . "option/amazon/SearchWidgetParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/SearchWidgetParagraphUtils.php";

/**
 * Description of AmazonSettionSection
 *
 * @author Goods Memo
 */
class AmazonSettingSection extends AbstractSettingSection {

	const ID_PREFIX = "amazon";

	public function initSection(PageInfo $pageInfo) {

		$sectionInfo = new SectionInfo();
		$sectionInfo->setSectionID("amazon_section_id");
		$sectionInfo->setSectionTitle("アマゾンの設定");

		add_settings_section(
			$sectionInfo->getSectionID(), // ID
			$sectionInfo->getSectionTitle(), // Title
			array($this, SettingSection::PRINT_SECTION_INFO_FUNCTION_NAME), // Callback
			$pageInfo->getSettingMenuSlug() //設定ページのslug。メニューのslugと同じもの。
		);

		$urlParagraph = new URLParagraph();
		$urlFieldInfoArray = URLParagraphUtils::makeFieldInfoArray();
		$urlParagraph->initParagraph($pageInfo, $sectionInfo, $urlFieldInfoArray);
		parent::addParagraph($urlParagraph);

		$commonRESTParagraph = new CommonRESTParagraph();
		$commonRESTFieldInfoArray = CommonRESTParagraphUtils::makeFieldInfoArray();
		$commonRESTParagraph->initParagraph($pageInfo, $sectionInfo, $commonRESTFieldInfoArray);
		parent::addParagraph($commonRESTParagraph);

		$itemHTMLParagraph = new ItemHTMLParagraph();
		$itemHTMLFieldInfoArray = ItemHTMLParagraphUtils::makeFieldInfoArray();
		$itemHTMLParagraph->initParagraph($pageInfo, $sectionInfo, $itemHTMLFieldInfoArray);
		parent::addParagraph($itemHTMLParagraph);

		$reviewParagraph = new ReviewParagraph();
		$reviewFieldInfoArray = ReviewParagraphUtils::makeFieldInfoArray();
		$reviewParagraph->initParagraph($pageInfo, $sectionInfo, $reviewFieldInfoArray);
		parent::addParagraph($reviewParagraph);

		$productTypeParagraph = new ProductTypeParagraph();
		$productTypeFieldInfoArray = ProductTypeParagraphUtils::makeFieldInfoArray();
		$productTypeParagraph->initParagraph($pageInfo, $sectionInfo, $productTypeFieldInfoArray);
		parent::addParagraph($productTypeParagraph);

		$restParagraph = new RESTParagraph();
		$restFieldInfoArray = RESTParagraphUtils::makeFieldInfoArray();
		$restParagraph->initParagraph($pageInfo, $sectionInfo, $restFieldInfoArray);
		parent::addParagraph($restParagraph);

		$searchWidgetParagraph = new SearchWidgetParagraph();
		$searchWidgetFieldInfoArray = SearchWidgetParagraphUtils::makeFieldInfoArray();
		$searchWidgetParagraph->initParagraph($pageInfo, $sectionInfo, $searchWidgetFieldInfoArray);
		parent::addParagraph($searchWidgetParagraph);
	}

	public function printSectionInfo() {
		print 'アマゾンアフィリエイトの設定を入力してください。未入力だった場合、初期値を表示します。';
	}

}

CommonRESTParagraph.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\paragraph\AbstractParagraph;
use goodsmemo\option\paragraph\AbstractTextParagraph;
use goodsmemo\option\PageInfo;
use goodsmemo\option\SectionInfo;
use goodsmemo\option\field\TextField;

require_once GOODS_MEMO_DIR . "option/paragraph/AbstractParagraph.php";
require_once GOODS_MEMO_DIR . "option/paragraph/AbstractTextParagraph.php";
require_once GOODS_MEMO_DIR . "option/PageInfo.php";
require_once GOODS_MEMO_DIR . "option/SectionInfo.php";
require_once GOODS_MEMO_DIR . "option/field/TextField.php";

/**
 * Description of CommonRESTParagraph
 *
 * @author Goods Memo
 */
class CommonRESTParagraph extends AbstractParagraph {

	use AbstractTextParagraph;

	public function initParagraph(PageInfo $pageInfo, SectionInfo $sectionInfo, $fieldInfoArray) {

		parent::setOptionGroup($pageInfo->getOptionGroup());
		parent::setSectionTitle($sectionInfo->getSectionTitle());
		parent::setFieldInfoArray($fieldInfoArray);

		$paaAccessKeyTextField = new TextField($pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[0]);
		parent::addField($pageInfo, $sectionInfo, $paaAccessKeyTextField);

		$paaAssociateTagTextField = new TextField($pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[1]);
		parent::addField($pageInfo, $sectionInfo, $paaAssociateTagTextField);

		$paaSecretKeyTextField = new TextField($pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[2]);
		parent::addField($pageInfo, $sectionInfo, $paaSecretKeyTextField);

		$paaRegionTextField = new TextField($pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[3]);
		parent::addField($pageInfo, $sectionInfo, $paaRegionTextField);
	}

	public function sanitizeParagraphValue($inputedValueMap, &$sanitizedValueMap) {
		//sanitizedValueMap:変更するため、配列の参照渡しとする。

		$this->validateExistence($inputedValueMap);
		parent::sanitizeParagraphValue($inputedValueMap, $sanitizedValueMap);
	}

}

CommonRESTParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of CommonRESTParagraphUtils
 *
 * @author Goods Memo
 */
class CommonRESTParagraphUtils {

	const PAA_ACCESS_KEY_ID = AmazonSettingSection::ID_PREFIX . "_paa_access_key_id";
	const PAA_ASSOCIATE_TAG_ID = AmazonSettingSection::ID_PREFIX . "_paa_associate_tag_id";
	const PAA_SECRET_KEY_ID = AmazonSettingSection::ID_PREFIX . "_paa_secret_key_id";
	const PAA_REGION_ID = AmazonSettingSection::ID_PREFIX . "_paa_region_id";

	public static function makeFieldInfoArray() {

		$fieldInfoArray = array();

		$paaAccessKeyFieldInfo = new FieldInfo();
		$paaAccessKeyFieldInfo->setFieldID(CommonRESTParagraphUtils::PAA_ACCESS_KEY_ID);
		$paaAccessKeyFieldInfo->setFieldLabel('Product Advertising API アクセスキー');
		$paaAccessKeyFieldInfo->setDefaultFieldValue("");
		array_push($fieldInfoArray, $paaAccessKeyFieldInfo);

		$paaAssociateTagFieldInfo = new FieldInfo();
		$paaAssociateTagFieldInfo->setFieldID(CommonRESTParagraphUtils::PAA_ASSOCIATE_TAG_ID);
		$paaAssociateTagFieldInfo->setFieldLabel('Product Advertising API アソシエイトタグ');
		$paaAssociateTagFieldInfo->setDefaultFieldValue("");
		array_push($fieldInfoArray, $paaAssociateTagFieldInfo);

		$paaSecretKeyFieldInfo = new FieldInfo();
		$paaSecretKeyFieldInfo->setFieldID(CommonRESTParagraphUtils::PAA_SECRET_KEY_ID);
		$paaSecretKeyFieldInfo->setFieldLabel('Product Advertising API シークレットキー');
		$paaSecretKeyFieldInfo->setDefaultFieldValue("");
		array_push($fieldInfoArray, $paaSecretKeyFieldInfo);

		$paaRegionFieldInfo = new FieldInfo();
		$paaRegionFieldInfo->setFieldID(CommonRESTParagraphUtils::PAA_REGION_ID);
		$paaRegionFieldInfo->setFieldLabel('Product Advertising API リージョン(例:Japanの場合 us-west-2)');
		$paaRegionFieldInfo->setDefaultFieldValue("us-west-2");
		array_push($fieldInfoArray, $paaRegionFieldInfo);

		return $fieldInfoArray;
	}

}

ItemHTMLParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\paragraph\ItemHTMLParagraph;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/paragraph/ItemHTMLParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of ItemHTMLParagraphUtils
 *
 * @author Goods Memo
 */
class ItemHTMLParagraphUtils {

	const DEFAULT_NUMBER_TO_DISPLAY = 1;
	//
	const TITLE_LENGTH_ID = AmazonSettingSection::ID_PREFIX . "_title_length_id";
	const CACHE_EXPIRATION_IN_SECONDS_ID = AmazonSettingSection::ID_PREFIX . "_cache_expiration_in_seconds_id";

	public static function makeFieldInfoArray() {

		$fieldInfoArray = array();

		$titleLengthFieldInfo = new FieldInfo();
		$titleLengthFieldInfo->setFieldID(ItemHTMLParagraphUtils::TITLE_LENGTH_ID);
		$titleLengthFieldInfo->setFieldLabel(ItemHTMLParagraph::DEFAULT_TITLE_LENGTH_LABEL);
		$titleLengthFieldInfo->setDefaultFieldValue(ItemHTMLParagraph::DEFAULT_TITLE_LENGTH_VALUE);
		$titleLengthFieldInfo->setNumericalVerificationEnabled(true);
		array_push($fieldInfoArray, $titleLengthFieldInfo);

		$cacheExpirationInSecondsFieldInfo = new FieldInfo();
		$cacheExpirationInSecondsFieldInfo->setFieldID(ItemHTMLParagraphUtils::CACHE_EXPIRATION_IN_SECONDS_ID);
		$cacheExpirationInSecondsFieldInfo->setFieldLabel(
				ItemHTMLParagraph::DEFAULT_CACHE_EXPIRATION_IN_SECONDS_LABEL);
		//Product Advertising APIの場合、初期リクエスト可能数 : 1日あたり 8,640リクエスト
		$cacheExpirationInSecondsFieldInfo->setDefaultFieldValue(
				ItemHTMLParagraph::DEFAULT_CACHE_EXPIRATION_IN_SECONDS_VALUE);
		$cacheExpirationInSecondsFieldInfo->setNumericalVerificationEnabled(true);
		array_push($fieldInfoArray, $cacheExpirationInSecondsFieldInfo);

		return $fieldInfoArray;
	}

}

PriceParagraphUtils.php


namespace goodsmemo\option\amazon;

/**
 * Description of PriceParagraphUtils
 *
 * @author Goods Memo
 */
class PriceParagraphUtils {

    const DEFAULT_PRICE_TIME_LINK_VISIBLE = true;
    const DEFAULT_PRICE_TIME_FOOTER_TEXT = "価格の詳細:価格および発送可能時期は表示された日付/時刻の時点のものであり、変更される場合があります。本商品の購入においては、購入の時点でAmazon.co.jpに表示されている価格および発送可能時期の情報が適用されます。";

}

ProductTypeParagraph.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\paragraph\AbstractParagraph;
use goodsmemo\option\PageInfo;
use goodsmemo\option\SectionInfo;
use goodsmemo\option\field\CheckboxField;

require_once GOODS_MEMO_DIR . "option/paragraph/AbstractParagraph.php";
require_once GOODS_MEMO_DIR . "option/PageInfo.php";
require_once GOODS_MEMO_DIR . "option/SectionInfo.php";
require_once GOODS_MEMO_DIR . "option/field/CheckboxField.php";

/**
 * Description of ProductTypeParagraph
 *
 * @author Goods Memo
 */
class ProductTypeParagraph extends AbstractParagraph {

    const ADULT_PRODUCT_CHECKED_VALUE = "adultProductChecked";
    const ADULT_PRODUCT_LABEL_FOR_CHECKBOX = "表示する";

    public function initParagraph(PageInfo $pageInfo, SectionInfo $sectionInfo, $fieldInfoArray) {

	parent::setOptionGroup($pageInfo->getOptionGroup());
	parent::setSectionTitle($sectionInfo->getSectionTitle());
	parent::setFieldInfoArray($fieldInfoArray);

	$adultProductCheckboxField = new CheckboxField(
		$pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[0], //
		ProductTypeParagraph::ADULT_PRODUCT_CHECKED_VALUE, //
		ProductTypeParagraph::ADULT_PRODUCT_LABEL_FOR_CHECKBOX
	);
	parent::addField($pageInfo, $sectionInfo, $adultProductCheckboxField);
    }

}

ProductTypeParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of ProductTypeFieldUtils
 *
 * @author Goods Memo
 */
class ProductTypeParagraphUtils {

	const ADULT_PRODUCT_ID = AmazonSettingSection::ID_PREFIX . "_adult_product_id";

	public static function makeFieldInfoArray() {

		$fieldInfoArray = array();

		$adultProductFieldInfo = new FieldInfo();
		$adultProductFieldInfo->setFieldID(ProductTypeParagraphUtils::ADULT_PRODUCT_ID);
		$adultProductFieldInfo->setFieldLabel('アダルト商品(ItemInfo の ProductInfo の IsAdultProductで判断)');
		$adultProductFieldInfo->setDefaultFieldValue("");
		array_push($fieldInfoArray, $adultProductFieldInfo);

		return $fieldInfoArray;
	}

}

RESTParagraph.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\paragraph\AbstractParagraph;
use goodsmemo\option\paragraph\AbstractTextParagraph;
use goodsmemo\option\PageInfo;
use goodsmemo\option\SectionInfo;
use goodsmemo\option\field\TextareaField;

require_once GOODS_MEMO_DIR . "option/paragraph/AbstractParagraph.php";
require_once GOODS_MEMO_DIR . "option/paragraph/AbstractTextParagraph.php";
require_once GOODS_MEMO_DIR . "option/PageInfo.php";
require_once GOODS_MEMO_DIR . "option/SectionInfo.php";
require_once GOODS_MEMO_DIR . "option/field/TextareaField.php";

/**
 * Description of RESTParagraph
 *
 * @author Goods Memo
 */
class RESTParagraph extends AbstractParagraph {

	use AbstractTextParagraph;

	public function initParagraph(PageInfo $pageInfo, SectionInfo $sectionInfo, $fieldInfoArray) {

		parent::setOptionGroup($pageInfo->getOptionGroup());
		parent::setSectionTitle($sectionInfo->getSectionTitle());
		parent::setFieldInfoArray($fieldInfoArray);

		$searchItemsResourcesTextarea = new TextareaField($pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[0]);
		parent::addField($pageInfo, $sectionInfo, $searchItemsResourcesTextarea);
	}

	public function sanitizeParagraphValue($inputedValueMap, &$sanitizedValueMap) {
		//sanitizedValueMap:変更するため、配列の参照渡しとする。

		$this->validateExistence($inputedValueMap);
		parent::sanitizeParagraphValue($inputedValueMap, $sanitizedValueMap);
	}

}

RESTParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of RESTParagraphUtils
 *
 * @author Goods Memo
 */
class RESTParagraphUtils {

	const ITEM_SEARCH_OPERATION = "ItemSearch"; //TODO Choice部品
	const ALL_SEARCH_INDEX = "All"; //TODO Choice部品
	//
	const SEARCH_ITEMS_RESOURCES_ID = AmazonSettingSection::ID_PREFIX . "_search_items_resources_id";

	public static function makeFieldInfoArray() {

		$fieldInfoArray = array();

		$searchItemsResourcesFieldInfo = new FieldInfo();
		$searchItemsResourcesFieldInfo->setFieldID(RESTParagraphUtils::SEARCH_ITEMS_RESOURCES_ID);
		$searchItemsResourcesFieldInfo->setFieldLabel("SearchItems の Resources Parameter(開発用:JSON配列。空の配列[])");
		//参考:Amazon\ProductAdvertisingAPI\v1\com\amazon\paapi5\v1\SearchItemsResource;
		/*
		  $searchItemsResources = [
		  "Images.Primary.Large", //例:Image Large
		  "Images.Primary.Medium", //例:Image Medium
		  "Images.Primary.Small", //例:Image Small
		  //
		  "ItemInfo.ByLineInfo", //例:Contributors(Author)
		  "ItemInfo.Classifications", //例:Binding
		  "ItemInfo.Features", //例:Features
		  "ItemInfo.ProductInfo", //例:IsAdultProduct
		  "ItemInfo.Title", //例:Title
		  //
		  "Offers.Listings.MerchantInfo", //例:shop名
		  "Offers.Listings.Price", //例:Price
		  "Offers.Summaries.LowestPrice"//例:LowestPrice
		  ];
		 */
		//JSON ではダブルクォーテーションのみ使える。
		$searchItemsResources = '[
"Images.Primary.Large",
"Images.Primary.Medium",
"Images.Primary.Small",
"ItemInfo.ByLineInfo",
"ItemInfo.Classifications",
"ItemInfo.Features",
"ItemInfo.ProductInfo",
"ItemInfo.Title",
"Offers.Listings.MerchantInfo",
"Offers.Listings.Price",
"Offers.Summaries.LowestPrice"
]';
		$searchItemsResourcesFieldInfo->setDefaultFieldValue($searchItemsResources);
		array_push($fieldInfoArray, $searchItemsResourcesFieldInfo);

		return $fieldInfoArray;
	}

}

ReviewParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\paragraph\ReviewParagraph;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/paragraph/ReviewParagraph.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of ReviewParagraphUtils
 *
 * @author Goods Memo
 */
class ReviewParagraphUtils {

    const EDITORIAL_REVIEW_LENGTH_ID = AmazonSettingSection::ID_PREFIX . "_editorial_review_length_id";
    const ARRAY_OF_STRING_TO_DELETE_ID = AmazonSettingSection::ID_PREFIX . "_array_of_string_to_delete_id";
    const ARRAY_OF_STRING_TO_BREAK_ID = AmazonSettingSection::ID_PREFIX . "_array_of_string_to_break_id";

    public static function makeFieldInfoArray() {

	$fieldInfoArray = array();

	$editorialReviewLengthFieldInfo = new FieldInfo();
	$editorialReviewLengthFieldInfo->setFieldID(ReviewParagraphUtils::EDITORIAL_REVIEW_LENGTH_ID);
	$editorialReviewLengthFieldInfo->setFieldLabel(ReviewParagraph::DEFAULT_EDITORIAL_REVIEW_LENGTH_LABEL);
	$editorialReviewLengthFieldInfo->setDefaultFieldValue(ReviewParagraph::DEFAULT_EDITORIAL_REVIEW_LENGTH_VALUE);
	$editorialReviewLengthFieldInfo->setNumericalVerificationEnabled(true);
	array_push($fieldInfoArray, $editorialReviewLengthFieldInfo);

	$arrayOfStringToDeleteFieldInfo = new FieldInfo();
	$arrayOfStringToDeleteFieldInfo->setFieldID(ReviewParagraphUtils::ARRAY_OF_STRING_TO_DELETE_ID);
	$arrayOfStringToDeleteFieldInfo->setFieldLabel(ReviewParagraph::DEFAULT_ARRAY_OF_STRING_TO_DELETE_LABEL);
	$arrayOfStringToDeleteFieldInfo->setDefaultFieldValue(ReviewParagraph::DEFAULT_ARRAY_OF_STRING_TO_DELETE_VALUE); //削除する文字列の配列
	array_push($fieldInfoArray, $arrayOfStringToDeleteFieldInfo);

	$arrayOfStringToBreakFieldInfo = new FieldInfo();
	$arrayOfStringToBreakFieldInfo->setFieldID(ReviewParagraphUtils::ARRAY_OF_STRING_TO_BREAK_ID);
	$arrayOfStringToBreakFieldInfo->setFieldLabel(ReviewParagraph::DEFAULT_ARRAY_OF_STRING_TO_BREAK_LABEL);
	$arrayOfStringToBreakFieldInfo->setDefaultFieldValue(ReviewParagraph::DEFAULT_ARRAY_OF_STRING_TO_BREAK_VALUE); //改行する文字列の配列
	array_push($fieldInfoArray, $arrayOfStringToBreakFieldInfo);

	return $fieldInfoArray;
    }

}

SearchWidgetParagraph.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\paragraph\AbstractParagraph;
use goodsmemo\option\PageInfo;
use goodsmemo\option\SectionInfo;
use goodsmemo\option\field\CheckboxField;

require_once GOODS_MEMO_DIR . "option/paragraph/AbstractParagraph.php";
require_once GOODS_MEMO_DIR . "option/PageInfo.php";
require_once GOODS_MEMO_DIR . "option/SectionInfo.php";
require_once GOODS_MEMO_DIR . "option/field/CheckboxField.php";

/**
 * Description of SearchWidgetParagraph
 *
 * @author Goods Memo
 */
class SearchWidgetParagraph extends AbstractParagraph {

	const SEARCH_WIDGET_CHECKED_VALUE = "searchWidgetChecked";
	const SEARCH_WIDGET_LABEL_FOR_CHECKBOX = "常に表示する。Product Advertising API を、常に使用しない場合(アクセス制限のため利用できない場合)";

	public function initParagraph(PageInfo $pageInfo, SectionInfo $sectionInfo, $fieldInfoArray) {

		parent::setOptionGroup($pageInfo->getOptionGroup());
		parent::setSectionTitle($sectionInfo->getSectionTitle());
		parent::setFieldInfoArray($fieldInfoArray);

		$searchWidgetCheckboxField = new CheckboxField(
			$pageInfo->getOptionNameOfDatabase(), $fieldInfoArray[0], //
			SearchWidgetParagraph::SEARCH_WIDGET_CHECKED_VALUE, //
			SearchWidgetParagraph::SEARCH_WIDGET_LABEL_FOR_CHECKBOX
		);
		parent::addField($pageInfo, $sectionInfo, $searchWidgetCheckboxField);
	}

}

SearchWidgetParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of SearchWidgetParagraphUtils
 *
 * @author Goods Memo
 */
class SearchWidgetParagraphUtils {

	const SEARCH_WIDGET_ID = AmazonSettingSection::ID_PREFIX . "_search_widget_id";

	public static function makeFieldInfoArray() {

		$fieldInfoArray = array();

		$searchWidgetFieldInfo = new FieldInfo();
		$searchWidgetFieldInfo->setFieldID(SearchWidgetParagraphUtils::SEARCH_WIDGET_ID);
		$searchWidgetFieldInfo->setFieldLabel('サーチウィジェットJavascript(上記項目の「Product Advertising API アソシエイトタグ」を利用する)');
		$searchWidgetFieldInfo->setDefaultFieldValue("");
		array_push($fieldInfoArray, $searchWidgetFieldInfo);

		return $fieldInfoArray;
	}

}

URLParagraphUtils.php


namespace goodsmemo\option\amazon;

use goodsmemo\option\field\FieldInfo;
use goodsmemo\option\amazon\AmazonSettingSection;

require_once GOODS_MEMO_DIR . "option/field/FieldInfo.php";
require_once GOODS_MEMO_DIR . "option/amazon/AmazonSettingSection.php";

/**
 * Description of URLParagraphUtils
 *
 * @author Goods Memo
 */
class URLParagraphUtils {

	const HOSTNAME_ID = AmazonSettingSection::ID_PREFIX . "_hostname_id";

	public static function makeFieldInfoArray() {

		$fieldInfoArray = array();

		$hostnameFieldInfo = new FieldInfo();
		$hostnameFieldInfo->setFieldID(URLParagraphUtils::HOSTNAME_ID);
		$hostnameFieldInfo->setFieldLabel('Product Advertising API ホスト');
		$hostnameFieldInfo->setDefaultFieldValue("webservices.amazon.co.jp");
		array_push($fieldInfoArray, $hostnameFieldInfo);

		return $fieldInfoArray;
	}

	/*
	  //const PATH_ID = AmazonSettingSection::ID_PREFIX . "_path_id";
	 *
	  //		$pathFieldInfo = new FieldInfo();
	  //		$pathFieldInfo->setFieldID(URLParagraphUtils::PATH_ID);
	  //		$pathFieldInfo->setFieldLabel('Product Advertising API URI(パス部分)');
	  //		$pathFieldInfo->setDefaultFieldValue("/onca/xml");
	  //		array_push($fieldInfoArray, $pathFieldInfo);
	 *
	 */
}