__( 'Ad before the first H tag' , AAIH__TEXT_DOMAIN ),
'h_tag' => __( 'Ad before H tag', AAIH__TEXT_DOMAIN ),
'after_content' => __( 'Ad end of article', AAIH__TEXT_DOMAIN ),
);
$class = array(
'first_h_tag' => 'first-h-tag',
'h_tag' => 'h-tag',
'after_content' => 'after-content',
);
$supplement = array(
'first_h_tag' => __( 'Always insert an ad code before the first H tag.' , AAIH__TEXT_DOMAIN ) , //先頭のHタグの前に必ず広告コードを入れる。
'h_tag' => __( 'Insert an ad code before H tags in the article.' , AAIH__TEXT_DOMAIN ), //記事内のHタグの前に広告コードを入れる。
'after_content' => __( 'Always insert an ad code at the end of the article.' , AAIH__TEXT_DOMAIN ), // 記事の下に必ず広告コードを入れる。
);
?>
$item_label ) {
$ad_select_item = 'ad_select__' . $item_name;
$selectbox__attr_name = AAIH__SETTINGS . '[' . $ad_select_item . ']'; // セレクトボックスの name 属性
$selected_ad_nth = $settings[ $ad_select_item ];
$onoff_item_name = $item_name . '_ad_onoff';
$onoff = $settings[ $onoff_item_name ];
?>
value='on'>
>
>
>
>
>
>
>
' . esc_attr( $supplement2 ); ?>
pub-
value=""
value=""
maxlength=""
>
';
aaih__check_which_ad_settings_used ( $ad_nth, $settings );
echo '';
/* -----------------------------------
*
* 広告ユニット・広告ユニットID
*
* ----------------------------------- */
$title = __( 'Select ad unit', AAIH__TEXT_DOMAIN ); // 広告ユニットの選択
// 広告ユニット(ディスプレイ広告選択時に 広告の形状選択を表示するために使用)
$ad_unit_select = $settings[ $ad_nth ]['ad_unit_select']; // 'in_article' 記事内広告 , 'display' ディスプレイ広告 , 'multiplex' Multiplex 広告
?>
$ad_unit_name ) {
?>
>
'passive',
'display' => 'passive',
'multiplex' => 'passive',
);
$class[ $ad_unit_select ] = 'active';
?>
__( 'In-article ads : native ads that appear in editorial content, designed to fit neatly inside the user\'s path through your site.' , AAIH__TEXT_DOMAIN ), // 記事内広告
'display' => __( 'Display ads : all-rounder, these ads work well anywhere.' , AAIH__TEXT_DOMAIN ), // ディスプレイ広告
'multiplex' => __( 'Multiplex ads : Grid-based ad unit that shows content recommendation-style native ads, designed to fit neatly inside the user\'s path through your site.' , AAIH__TEXT_DOMAIN ),
// 記事内広告 : 記事コンテンツ内に表示されるネイティブ広告(コンテンツに自然に溶け込むように表示される広告)。
// ディスプレイ広告 : どこにでも使えるオールラウンドな広告。
// Multiplex 広告 : 広告ユニット内のグリッドに複数の広告を表示する、ネイティブ広告(コンテンツに自然に溶け込むように表示される広告)フォーマット。
);
$explanation_class = array (
'in_article' => ' passive',
'display' => ' passive',
'multiplex' => ' passive',
);
$explanation_class[ $ad_unit_select ] = ' active';
?>
'ad-unit-id ' . 'in-article' . '-id',
'display' => 'ad-unit-id ' . 'display' . '-id',
'multiplex' => 'ad-unit-id ' . 'multiplex' . '-id',
);
$item_name = array(
'in_article' => 'ad_unit_id__in_article',
'display' => 'ad_unit_id__display',
'multiplex' => 'ad_unit_id__multiplex',
);
$item_value = array(
'in_article' => $settings[ $ad_nth ][ $item_name['in_article'] ], // 記事内広告
'display' => $settings[ $ad_nth ][ $item_name['display'] ], // ディスプレイ広告
'multiplex' => $settings[ $ad_nth ][ $item_name['multiplex'] ], // Multiplex 広告
);
$label = __( 'Ad unit ID' , AAIH__TEXT_DOMAIN ) ;
$language = $settings['language'];
?>
$name_str__auto,
'rectangle' => $name_str__rectangle,
'vertical' => $name_str__vertical,
'horizontal' => $name_str__horizontal,
);
$supplement = __( 'Ad Shape can be selected only for display ads.', AAIH__TEXT_DOMAIN ); // 広告の形状は、ディスプレイ広告のみ選択できます。
?>
$value ) {
?>
>
'passive' ,
'display' => 'passive' ,
'multiplex' => 'passive',
);
$show_code_class[ $ad_unit ] = 'active';
// ディスプレイ広告の表示
echo '';
aaih__adsense_code ( 'show' , $settings ); // アドセンスコードの表示
aaih__adsense_unit_code__display_ad ( $ad_nth , 'show' , $settings );
echo '
';
// 記事内広告の表示
echo '';
aaih__adsense_code ( 'show' , $settings ); // アドセンスコードの表示
aaih__adsense_unit_code__in_article_ad ( $ad_nth , 'show' , $settings );
echo '
';
// Multiplex 広告の表示
echo '';
aaih__adsense_code ( 'show' , $settings ); // アドセンスコードの表示
aaih__adsense_unit_code__multiplex_ad ( $ad_nth , 'show' , $settings );
echo '
';
}
/**
* 広告上下のマージン入力
*
* デフォルトは上下共通。
* 高度な設定中の設定により、上下別々に設定もできる。
*
* 文字数カウントの単位は高度な設定中で em / px を選択できることから、
* その設定を見て表示切り替えを行う。
* 選択されてない単位の値は hidden で保持する。
*
* @param string $ad_nth Ad1, Ad2, ...
* @param array $settings 全ての設定値のキーと値の配列
* @return void
*/
function aaih__ad_code_input_margin( $ad_nth , $settings ) {
$updown_margin_separate_onoff = $settings['updown_margin_separate_onoff']; // 広告の上下余白を上側、下側個別に設定するか
$space_unit = $settings['space_unit']; // スペースの単位
$ad_code_updown_margin_em = $settings[ $ad_nth ]['updown_margin_em']; // 上下マージン:広告の上下のマージン(em)
$ad_code_updown_margin_px = $settings[ $ad_nth ]['updown_margin_px']; // 上下マージン:広告の上下のマージン(px)
$ad_code_updown_margin_down_em = $settings[ $ad_nth ]['updown_margin_down_em']; // 上下マージン:広告の下のマージン(em)上下個別に設定する場合
$ad_code_updown_margin_down_px = $settings[ $ad_nth ]['updown_margin_down_px']; // 上下マージン:広告の下のマージン(px)上下個別に設定する場合
// 上下の余白 em/px 切り替え
// 上下個別の場合
if ( 'em' === $space_unit ) {
$name = 'updown_margin_em';
$name_down = 'updown_margin_down_em';
$value = $ad_code_updown_margin_em;
$value_down = $ad_code_updown_margin_down_em;
$step = AAIH__AD_CODE_UPDOWN__STEP_EM;
$min = AAIH__AD_CODE_UPDOWN__MARGIN_EM_MIN;
$max = AAIH__AD_CODE_UPDOWN__MARGIN_EM_MAX;
$unit = __( 'chars (em)' , AAIH__TEXT_DOMAIN ); // 文字分(em)
// px の値を保持するために hidden で用意
$hidden__name = 'updown_margin_px';
$hidden__value = $ad_code_updown_margin_px;
$hidden__name_down = 'updown_margin_down_px';
$hidden__value_down = $ad_code_updown_margin_down_px;
}
else { //px
$name = 'updown_margin_px';
$name_down = 'updown_margin_down_px';
$value = $ad_code_updown_margin_px;
$value_down = $ad_code_updown_margin_down_px;
$step = AAIH__AD_CODE_UPDOWN__STEP_PX;
$min = AAIH__AD_CODE_UPDOWN__MARGIN_PX_MIN;
$max = AAIH__AD_CODE_UPDOWN__MARGIN_PX_MAX;
$unit = __( ' dots (px)' , AAIH__TEXT_DOMAIN ); // ドット(px)
// em の値を保持するために hidden で用意
$hidden__name = 'updown_margin_em';
$hidden__value = $ad_code_updown_margin_em;
$hidden__name_down = 'updown_margin_down_em';
$hidden__value_down = $ad_code_updown_margin_down_em;
}
// 上下余白を個別に設定する場合
if ( 'on' === $updown_margin_separate_onoff ) {
$prefix = __( 'Top ' , AAIH__TEXT_DOMAIN ) ; // 上側
$prefix_down = __( 'Bottom ' , AAIH__TEXT_DOMAIN ) ; // 下側
$type_down = 'number'; // input type
$unit_down = $unit;
$supplement = '';
}else {
// 上下余白:上下共通の場合
$prefix = ''; // 上側 の表示なし
$prefix_down = ''; // 下側 の表示なし
$type_down = 'hidden'; // 共通の場合: 下側余白は hidden で値を保持
$unit_down = ''; // 共通の場合: 下側に対する 単位の表示はなし
$supplement = __( 'Top & bottom margins outside of the ad' , AAIH__TEXT_DOMAIN ) ;
// (広告外側の上下余白(スペース))
}
?>
value="on">
' . esc_attr( $shortcode ) . '' . "\n";
echo '' . esc_attr( $msg_copy ) . '
' . "\n";
echo '' . esc_attr( $supplement ) . '
' . "\n";
echo '' . esc_attr( $shortcode ) . ' ' . esc_attr( $msg_copied ) . '
' . "\n";
echo '' . esc_attr( $msg_copied_error ) . '
' . "\n";
}
/* -----------------------------------
* 文字数カウント関連
* ----------------------------------- */
/**
* コールバック)文字数カウントの単位
*
* @param array $args : string $class , array $settings の配列($class は基本使わない)
* @return void
*/
function aaih__fc__character_width_unit( $args ) {
$character_width_unit = $args['settings']['character_width_unit'];
$supplement1 = __( 'Select the unit to count the number of characters: full-width or half-width.', AAIH__TEXT_DOMAIN ); // カウントする文字数の単位は全角か半角かの選択
$supplement2 = __( 'Half-width: so-called 1-byte characters ( normal alphanumeric characters )', AAIH__TEXT_DOMAIN ); // 全角:日本語など(いわゆる2バイトコードの文字)
$supplement3 = __( 'Full-width: so-called 2-byte characters ( such as Japanese )', AAIH__TEXT_DOMAIN ); // 半角:(半角の)英数字(いわゆる1バイトコードの文字)
?>
>
>
' .esc_attr( $supplement2 ) . ' ' . esc_attr( $supplement3 ); ?>
value='on'>
>
>
value='on'>
value='on'>
value='on'>
value='on'>
value='on'>
value='on'>
value='on'>
>
と の間)に挿入する
?>
と の間)に挿入する
?>
'
maxlength=''
/>
$language_code ) {
?>
>
$file_name ) {
// ファイル名から Language Code 以外は削除
$pattern = '/' . AAIH__MENU_SLUG . '-/'; // /ad-auto-insert-h-/
$lan = preg_replace( $pattern , '' , $file_name );
// 取得ファイルを配列に追加
$translation_files[] = $lan;
}
return $translation_files;
}
/**
* 言語コードに対する 国名を返す
*
* @param string $lan_code
* @return string (翻訳された)国名
*/
function aaih__get_country_language_name ( $lan_code ) {
// 中国語では、zh-CN など大文字が使われる可能性があるため
// 念のために 大文字を小文字に戻しておく
$lan_code = strtolower( $lan_code );
// 主要言語 翻訳用
// 適当に抜粋(ここにないもの使いたい場合には po ファイルに直接翻訳を入れて翻訳ファイル mo を作る )
// 言語コードについては以下参照
// https://ja.wordpress.org/support/article/installing-wordpress-in-your-language/
// http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/gettext.html#Language-Codes
$language_name = array(
'ar' => __( 'Arabic' , AAIH__TEXT_DOMAIN ), // アラビア語
'en' => __( 'English' , AAIH__TEXT_DOMAIN ), // 英語
'de' => __( 'German' , AAIH__TEXT_DOMAIN ), // ドイツ語
'es' => __( 'Spanish' , AAIH__TEXT_DOMAIN ), // スペイン語
'fr' => __( 'French' , AAIH__TEXT_DOMAIN ), // フランス語
'hi' => __( 'Hindi' , AAIH__TEXT_DOMAIN ), // ヒンディー語
'id' => __( 'Indonesian' , AAIH__TEXT_DOMAIN ), // インドネシア語
'it' => __( 'Italian' , AAIH__TEXT_DOMAIN ), // イタリア語
'ja' => __( 'Japanese' , AAIH__TEXT_DOMAIN ), // 日本語
'ko' => __( 'Korean' , AAIH__TEXT_DOMAIN ), // 韓国語
'nl' => __( 'Dutch' , AAIH__TEXT_DOMAIN ), // オランダ語
'pl' => __( 'Polish' , AAIH__TEXT_DOMAIN ), // ポーランド語
'pt' => __( 'Portuguese' , AAIH__TEXT_DOMAIN ), // ポルトガル語
'ru' => __( 'Russian' , AAIH__TEXT_DOMAIN ), // ロシア語
'th' => __( 'Thai' , AAIH__TEXT_DOMAIN ), // タイ語
'tl' => __( 'Tagalog' , AAIH__TEXT_DOMAIN ), // タガログ語
'tr' => __( 'Turkish' , AAIH__TEXT_DOMAIN ), // トルコ語
'vi' => __( 'Vietnamese' , AAIH__TEXT_DOMAIN ), // ベトナム語
'zh' => __( 'Chinese' , AAIH__TEXT_DOMAIN ), // 中国語
'zh-cn' => __( 'Chinese (Simplified)' , AAIH__TEXT_DOMAIN ), // 中国語 (簡体字)
'zh-tw' => __( 'Chinese (Traditional)' , AAIH__TEXT_DOMAIN ), // 中国語 (繁体字)
);
// 配列にあれば、(翻訳された)国名を返す
if( isset ( $language_name[ $lan_code]) ){
return $language_name[ $lan_code];
}
// 配列になければ、言語コードを翻訳したとして返す
// ( po ファイルに追加して mo にすれば翻訳表示される )
else{
return __( $lan_code , AAIH__TEXT_DOMAIN );
}
}
/* -----------------------------------
* デバッグ関連
* ----------------------------------- */
/**
* コールバック)デバッグモード(on/off)
*
* @param array $args : string $class , array $settings の配列($class は基本使わない)
* @return void
*/
function aaih__fc__debug_mode_onoff( $args ) {
$settings = $args['settings']; // 設定値全体
// デバッグモード on/off checkbox 表示
aaih__debug_mode_enable_checkbox( $settings );
// デバッグモード オプション表示
aaih__debug_mode_options( $settings );
}
/**
* デバッグモード on/off checkbox 表示
*
* @param array $settings 設定全体の配列
* @return void
*/
function aaih__debug_mode_enable_checkbox( $settings ){
$item_label = __( 'Debug mode', AAIH__TEXT_DOMAIN );
$debug_mode_onoff = $settings['debug_mode_onoff'];
$supplement1 = __( 'Display setting values only when an article is previewed. ( For operation confirmation )', AAIH__TEXT_DOMAIN );
$supplement2 = __( 'The display of actual post or page does not change.', AAIH__TEXT_DOMAIN );
// プレビュー時でのみ各種設定の数値を表示する。動作確認用の設定。
// 実際の投稿や固定ページの表示は変化しない。
?>
value='on'>