Exemplo n.º 1
0
function _dp_resize_logo()
{
    $dp_resize_message = array('error' => true, 'message' => '');
    //値をチェック
    $ratio = intval($_REQUEST['dp_resize_ratio']);
    if (!($ratio > 0 && $ratio <= 100)) {
        $ratio = 100;
    }
    $orignal_to_display_ratio = (double) $_REQUEST['dp_logo_to_resize_ratio'];
    $width = round($_REQUEST['dp_logo_resize_width'] / $orignal_to_display_ratio);
    $height = round($_REQUEST['dp_logo_resize_height'] / $orignal_to_display_ratio);
    $top = round($_REQUEST['dp_logo_resize_top'] / $orignal_to_display_ratio);
    $left = round($_REQUEST['dp_logo_resize_left'] / $orignal_to_display_ratio);
    $new_width = round($width * $ratio / 100);
    $new_height = round($height * $ratio / 100);
    //画像を読み込んでみる
    $info = dp_logo_info();
    if (!$info) {
        $dp_resize_message['message'] = __('Logo file not exists.', 'tcd-w');
        return $dp_resize_message;
    }
    // 保存ファイル名を決める
    $path = preg_replace("/logo\\.(png|gif|jpe?g)\$/i", "logo-resized.\$1", $info['path']);
    // 3.5以前と以降で処理を分岐
    try {
        // 3.5以降はwp_get_image_editorが存在する
        if (function_exists('wp_get_image_editor')) {
            // 新APIを利用
            $orig_image = wp_get_image_editor($info['path']);
            // 読み込み失敗ならエラー
            if (is_wp_error($orig_image)) {
                throw new Exception(__('Logo file not exists.', 'tcd-w'));
            }
            // リサイズしてダメだったらエラー
            $size = $orig_image->get_size();
            $resize_result = $orig_image->resize(round($size['width'] * $ratio / 100), round($size['height'] * $ratio / 100));
            if (is_wp_error($resize_result)) {
                // WordPressが返すエラーメッセージを利用
                // 適宜変更してください。
                throw new Exception($resize_result->get_error_message());
            }
            // 切り抜きしてダメだったらエラー
            $crop_result = $orig_image->crop(round($left * $ratio / 100), round($top * $ratio / 100), $new_width, $new_height);
            if (is_wp_error($crop_result)) {
                // WordPressが返すエラーメッセージを利用
                // 適宜変更してください。
                throw new Exception($crop_result->get_error_message());
            }
            // 保存してダメだったらエラー
            // 基本は上書きOK.
            $save_result = $orig_image->save($path);
            if (is_wp_error($save_result)) {
                // WordPressが返すエラーメッセージを利用
                // 適宜変更してください。
                throw new Exception($save_result->get_error_message());
            }
        } else {
            // それ以前は昔の方法で行う
            $orig_image = wp_load_image($info['path']);
            // 画像を読み込めなかったらエラー
            if (!is_resource($orig_image)) {
                throw new Exception(__('Logo file not exists.', 'tcd-w'));
            }
            $newimage = wp_imagecreatetruecolor($new_width, $new_height);
            imagecopyresampled($newimage, $orig_image, 0, 0, $left, $top, $new_width, $new_height, $width, $height);
            if (IMAGETYPE_PNG == $info['mime'] && function_exists('imageistruecolor')) {
                @imagetruecolortopalette($newimage, false, imagecolorstotal($orig_image));
            }
            imagedestroy($orig_image);
            //ファイルを保存する前に削除
            $dest_path = dp_logo_exists(true);
            if ($dest_path && !@unlink($dest_path)) {
                throw new Exception('Cannot delete existing resized logo.', 'tcd-w');
            }
            //名前を決めて保存
            $result = null;
            if (IMAGETYPE_GIF == $info['mime']) {
                $result = imagegif($newimage, $path);
            } elseif (IMAGETYPE_PNG == $info['mime']) {
                $result = imagepng($newimage, $path);
            } else {
                $result = imagejpeg($newimage, $path, 100);
            }
            imagedestroy($newimage);
            if (!$result) {
                throw new Exception(sprintf(__('Failed to save resized logo. Please check permission of <code>%s</code>', 'tcd-w'), dp_logo_basedir()));
            }
        }
    } catch (Exception $e) {
        // 上記処理中で一回でも例外が発生したら、エラーを返す
        $dp_resize_message['message'] = $e->getMessage();
        return $dp_resize_message;
    }
    // ここまで来たということはエラーなし
    $dp_resize_message['error'] = false;
    $dp_resize_message['message'] = __('Logo image is successfully resized.', 'tcd-w');
    return $dp_resize_message;
}
function theme_options_do_page()
{
    global $color_options, $single_post_list_options, $bg_type1_options, $bg_type2_options, $dp_upload_error;
    $options = get_desing_plus_option();
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>

<div class="wrap">
 <?php 
    screen_icon();
    echo "<h2>" . __('Theme Options', 'tcd-w') . "</h2>";
    ?>

 <?php 
    // 更新時のメッセージ
    if (false !== $_REQUEST['settings-updated']) {
        ?>
 <div class="updated fade"><p><strong><?php 
        _e('Updated', 'tcd-w');
        ?>
</strong></p></div>
 <?php 
    }
    ?>

 <?php 
    /* ファイルアップロード時のメッセージ */
    if (!empty($dp_upload_error['message'])) {
        ?>
  <?php 
        if ($dp_upload_error['error']) {
            ?>
   <div id="error" class="error"><p><?php 
            echo $dp_upload_error['message'];
            ?>
</p></div>
  <?php 
        } else {
            ?>
   <div id="message" class="updated fade"><p><?php 
            echo $dp_upload_error['message'];
            ?>
</p></div>
  <?php 
        }
        ?>
 <?php 
    }
    ?>
 
 <script type="text/javascript">
  jQuery(document).ready(function($){
   $('#my_theme_option').cookieTab({
    tabMenuElm: '#theme_tab',
    tabPanelElm: '#tab-panel'
   });
  });
 </script>

 <div id="my_theme_option">

 <div id="theme_tab_wrap">
  <ul id="theme_tab" class="cf">
   <li><a href="#tab-content1"><?php 
    _e('Basic Setup', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content2"><?php 
    _e('Slider Setup', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content3"><?php 
    _e('Logo', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content4"><?php 
    _e('Adsence Setup', 'tcd-w');
    ?>
</a></li>
  </ul>
 </div>

<form method="post" action="options.php" enctype="multipart/form-data">
 <?php 
    settings_fields('design_plus_options');
    ?>

 <div id="tab-panel">

  <!-- #tab-content1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content1">

   <?php 
    // フォントサイズ
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Font size', 'tcd-w');
    ?>
</h3>
    <p><?php 
    _e('Font size of single page and wp-page.', 'tcd-w');
    ?>
</p>
    <div class="theme_option_input">
     <input id="dp_options[content_font_size]" class="font_size" type="text" name="dp_options[content_font_size]" value="<?php 
    esc_attr_e($options['content_font_size']);
    ?>
" /><span>px</span>
    </div>
   </div>

   <?php 
    // 投稿者名・タグ・コメント
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Display Setup', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <ul>
      <li><label><input id="dp_options[show_author]" name="dp_options[show_author]" type="checkbox" value="1" <?php 
    checked('1', $options['show_author']);
    ?>
 /> <?php 
    _e('Display author', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_comment]" name="dp_options[show_comment]" type="checkbox" value="1" <?php 
    checked('1', $options['show_comment']);
    ?>
 /> <?php 
    _e('Display comment', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_trackback]" name="dp_options[show_trackback]" type="checkbox" value="1" <?php 
    checked('1', $options['show_trackback']);
    ?>
 /> <?php 
    _e('Display trackbacks', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_bookmark]" name="dp_options[show_bookmark]" type="checkbox" value="1" <?php 
    checked('1', $options['show_bookmark']);
    ?>
 /> <?php 
    _e('Display social bookmark', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_next_post]" name="dp_options[show_next_post]" type="checkbox" value="1" <?php 
    checked('1', $options['show_next_post']);
    ?>
 /> <?php 
    _e('Display next previous post link', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_related_post]" name="dp_options[show_related_post]" type="checkbox" value="1" <?php 
    checked('1', $options['show_related_post']);
    ?>
 /> <?php 
    _e('Display Related post', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_rss]" name="dp_options[show_rss]" type="checkbox" value="1" <?php 
    checked('1', $options['show_rss']);
    ?>
 /> <?php 
    _e('Display RSS button at left sidebar', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_search]" name="dp_options[show_search]" type="checkbox" value="1" <?php 
    checked('1', $options['show_search']);
    ?>
 /> <?php 
    _e('Display search box at left sidebar', 'tcd-w');
    ?>
</label></li>
     </ul>
    </div>
   </div>

   <?php 
    // 色の設定
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Basic color setting', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input layout_option color_type_list">
     <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Color type', 'tcd-w');
    ?>
</span></legend>
     <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($color_options as $option) {
        $color_setting = $options['color_type'];
        if ('' != $color_setting) {
            if ($options['color_type'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
      <label class="description">
       <input type="radio" id="input_<?php 
        esc_attr_e($option['value']);
        ?>
" name="dp_options[color_type]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
       <img src="<?php 
        bloginfo('template_url');
        ?>
/admin/color/<?php 
        echo $option['img'];
        ?>
.gif" alt="" title="" />
       <?php 
        echo $option['label'];
        ?>
      </label>
     <?php 
    }
    ?>
     </fieldset>
    </div>
   </div>


 <script type="text/javascript">
  jQuery(document).ready(function($){

   if($("#input_type3:checked").val()) {
    $('#background_pattern').show();
   } else {
    $('#background_pattern').hide();
   };

   $("#input_type3").click(function () {
    $('#background_pattern').show();
   });

   $("#bg_type1 input").not('#input_type3').click(function () {
    $('#background_pattern').hide();
   });

   if($("#input_type4:checked").val()) {
    $('#original_pattern').show();
   } else {
    $('#original_pattern').hide();
   };

   $("#input_type4").click(function () {
    $('#original_pattern').show();
   });

   $("#bg_type1 input").not('#input_type4').click(function () {
    $('#original_pattern').hide();
   });

  });
 </script>


   <?php 
    // 背景色の設定
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Background color setting', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input" id="bg_type1">
     <p><?php 
    _e('Select background type', 'tcd-w');
    ?>
</p>
     <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Background type', 'tcd-w');
    ?>
</span></legend>
     <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($bg_type1_options as $option) {
        $bg_type1_setting = $options['bg_type1'];
        if ('' != $bg_type1_setting) {
            if ($options['bg_type1'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
      <label class="description">
       <input id="input_<?php 
        esc_attr_e($option['value']);
        ?>
" type="radio" name="dp_options[bg_type1]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
       <?php 
        echo $option['label'];
        ?>
      </label>
     <?php 
    }
    ?>
     </fieldset>
    </div>
   </div>

   <div id="background_pattern" style="display:none;">
    <?php 
    // 背景画像の設定
    ?>
    <div class="theme_option_field cf">
     <p><?php 
    _e('Background image type', 'tcd-w');
    ?>
</p>
     <div class="theme_option_input layout_option" id="bg_type2">
      <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Background image type', 'tcd-w');
    ?>
</span></legend>
      <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($bg_type2_options as $option) {
        $bg_type2_setting = $options['bg_type2'];
        if ('' != $bg_type2_setting) {
            if ($options['bg_type2'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
       <label class="description">
        <input type="radio" id="input_<?php 
        esc_attr_e($option['value']);
        ?>
" name="dp_options[bg_type2]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
        <img src="<?php 
        bloginfo('template_url');
        ?>
/admin/background/<?php 
        echo $option['img'];
        ?>
.gif" alt="" title="" />
        <?php 
        echo $option['label'];
        ?>
       </label>
      <?php 
    }
    ?>
      </fieldset>
     </div>
    </div>
   </div>

   <div id="original_pattern" style="display:none;">
    <div class="theme_option_field cf">
     <p><?php 
    _e('Register original pattern.', 'tcd-w');
    ?>
</p>
     <div class="image_box cf">
      <div class="upload_banner_button_area">
       <div style="display:none;"><input type="text" size="36" name="dp_options[original_pattern]" value="<?php 
    esc_attr_e($options['original_pattern']);
    ?>
" /></div>
       <input type="file" name="original_pattern_file" id="original_pattern_file" />
       <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
      </div>
      <?php 
    if ($options['original_pattern']) {
        ?>
       <div class="uploaded_banner_image">
        <img src="<?php 
        esc_attr_e($options['original_pattern']);
        ?>
" alt="" title="" />
       </div>
       <?php 
        if (dp_is_uploaded_img($options['original_pattern'])) {
            ?>
       <div class="delete_uploaded_banner_image">
        <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_original_pattern');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
       </div>
      <?php 
        }
        ?>
      <?php 
    }
    ?>
     </div>
    </div>
   </div>

   <?php 
    // 左サイドのメニューの設定
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Side menu setup', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <ul id="side_menu_setting">
      <li>
       <label><input id="dp_options[show_side_category]" name="dp_options[show_side_category]" type="checkbox" value="1" <?php 
    checked('1', $options['show_side_category']);
    ?>
 /> <?php 
    _e('Display side category', 'tcd-w');
    ?>
</label>
       <input id="dp_options[headline_side_category]" class="regular-text" type="text" name="dp_options[headline_side_category]" value="<?php 
    esc_attr_e($options['headline_side_category']);
    ?>
" />
      </li>
      <li>
       <label><input id="dp_options[show_side_archive]" name="dp_options[show_side_archive]" type="checkbox" value="1" <?php 
    checked('1', $options['show_side_archive']);
    ?>
 /> <?php 
    _e('Display side archive', 'tcd-w');
    ?>
</label>
       <input id="dp_options[headline_side_archive]" class="regular-text" type="text" name="dp_options[headline_side_archive]" value="<?php 
    esc_attr_e($options['headline_side_archive']);
    ?>
" />
      </li>
      <li>
       <label><input id="dp_options[show_side_menu]" name="dp_options[show_side_menu]" type="checkbox" value="1" <?php 
    checked('1', $options['show_side_menu']);
    ?>
 /> <?php 
    _e('Display side menu', 'tcd-w');
    ?>
</label>
       <input id="dp_options[headline_side_menu]" class="regular-text" type="text" name="dp_options[headline_side_menu]" value="<?php 
    esc_attr_e($options['headline_side_menu']);
    ?>
" />
      </li>
     </ul>
    </div>
   </div>

   <?php 
    // 詳細記事ページの記事一覧の設定
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Single page post list setting', 'tcd-w');
    ?>
</h3>
    <div id="single_post_list_num_area" class="cf">
     <p><?php 
    _e('Number of post.', 'tcd-w');
    ?>
</p>
     <input id="dp_options[single_post_list_num]" class="font_size" type="text" name="dp_options[single_post_list_num]" value="<?php 
    esc_attr_e($options['single_post_list_num']);
    ?>
" />
    </div>
    <div class="theme_option_input" id="single_post_list_area">
     <p><?php 
    _e('Select post type', 'tcd-w');
    ?>
</p>
     <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Post list type', 'tcd-w');
    ?>
</span></legend>
     <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($single_post_list_options as $option) {
        $single_post_list_setting = $options['single_post_list'];
        if ('' != $single_post_list_setting) {
            if ($options['single_post_list'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
      <label class="description">
       <input type="radio" name="dp_options[single_post_list]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
       <?php 
        echo $option['label'];
        ?>
      </label>
     <?php 
    }
    ?>
     </fieldset>
    </div>
   </div>

   <?php 
    // facebook twitter
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('twitter and facebook setup', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
    _e('When it is blank, twitter and facebook icon will not displayed on a site.', 'tcd-w');
    ?>
</p>
     <ul>
      <li>
       <label style="display:inline-block; min-width:140px;"><?php 
    _e('your twitter URL', 'tcd-w');
    ?>
</label>
       <input id="dp_options[twitter_url]" class="regular-text" type="text" name="dp_options[twitter_url]" value="<?php 
    esc_attr_e($options['twitter_url']);
    ?>
" />
      </li>
      <li>
       <label style="display:inline-block; min-width:140px;"><?php 
    _e('your facebook URL', 'tcd-w');
    ?>
</label>
       <input id="dp_options[facebook_url]" class="regular-text" type="text" name="dp_options[facebook_url]" value="<?php 
    esc_attr_e($options['facebook_url']);
    ?>
" />
      </li>
     </ul>
    </div>
   </div>

   <?php 
    // 検索の設定
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Using Google custom search', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
    _e('If you wan\'t to use google custom search for your wordpress, enter your google custom search ID.<br /><a href="http://www.google.com/cse/" target="_blank">Read more about Google custom search page.</a>', 'tcd-w');
    ?>
</p>
     <label style="display:inline-block; margin:0 20px 0 0;"><?php 
    _e('Google custom search ID', 'tcd-w');
    ?>
</label>
     <input id="dp_options[custom_search_id]" class="regular-text" type="text" name="dp_options[custom_search_id]" value="<?php 
    esc_attr_e($options['custom_search_id']);
    ?>
" />
    </div>
   </div>

   <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content1 -->




  <!-- #tab-content2 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content2">

  <p><label><input id="dp_options[show_slider]" name="dp_options[show_slider]" type="checkbox" value="1" <?php 
    checked('1', $options['show_slider']);
    ?>
 /> <?php 
    _e('Display slider', 'tcd-w');
    ?>
</label></p>

  <?php 
    for ($i = 1; $i <= 10; $i++) {
        ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
        _e('Slider image setup', 'tcd-w');
        echo $i;
        ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">
     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
        _e('Register slider image (width:616px height:300px)', 'tcd-w');
        ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[slider_image<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['slider_image' . $i]);
        ?>
" /></div>
        <input type="file" name="slider_image_file<?php 
        echo $i;
        ?>
" id="slider_image_file<?php 
        echo $i;
        ?>
" />
        <input type="submit" class="button-primary" value="<?php 
        echo __('Save Image', 'tcd-w');
        ?>
" />
       </div>
       <?php 
        if ($options['slider_image' . $i]) {
            ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
            esc_attr_e($options['slider_image' . $i]);
            ?>
" alt="" title="" />
        </div>
        <?php 
            if (dp_is_uploaded_img($options['slider_image' . $i])) {
                ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
                echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_slider_image' . $i);
                ?>
" class="button" onclick="if(!confirm('<?php 
                _e('Are you sure to delete this image?', 'tcd-w');
                ?>
')) return false;"><?php 
                _e('Delete Image', 'tcd-w');
                ?>
</a>
        </div>
       <?php 
            }
            ?>
       <?php 
        }
        ?>
      </div>
     </div>
     <div class="sub_box">
      <h4><?php 
        _e('Register url for this image', 'tcd-w');
        ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[slider_url<?php 
        echo $i;
        ?>
]" class="regular-text" type="text" name="dp_options[slider_url<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['slider_url' . $i]);
        ?>
" />
      </div>
     </div>
    </div>
   </div>
  </div>
  <?php 
    }
    ?>

  <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content2 -->




  <!-- #tab-content3 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content3">

   <?php 
    // ステップ1
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Step 1 : Upload image to use for logo.', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
    _e('Upload image to use for logo from your computer.<br />You can resize your logo image in step 2 and adjust position in step 3.', 'tcd-w');
    ?>
</p>
     <div class="button_area">
      <label for="dp_image"><?php 
    _e('Select image to use for logo from your computer.', 'tcd-w');
    ?>
</label>
      <input type="file" name="dp_image" id="dp_image" value="" />
      <input type="submit" class="button" value="<?php 
    _e('Upload', 'tcd-w');
    ?>
" />
     </div>
     <?php 
    if (dp_logo_exists()) {
        $info = dp_logo_info();
        ?>
     <div class="uploaded_logo">
      <h4><?php 
        _e('Uploaded image.', 'tcd-w');
        ?>
</h4>
      <div class="uploaded_logo_image" id="original_logo_size">
       <?php 
        dp_logo_img_tag(false, '', '', 9999);
        ?>
      </div>
      <p><?php 
        printf(__('Original image size : width %1$dpx, height %2$dpx', 'tcd-w'), $info['width'], $info['height']);
        ?>
</p>
     </div>
     <?php 
    } else {
        ?>
     <div class="uploaded_logo">
      <h4><?php 
        _e('The image has not been uploaded yet.<br />A normal text will be used for a site logo.', 'tcd-w');
        ?>
</h4>
     </div>
     <?php 
    }
    ?>
    </div>
   </div>

   <?php 
    // ステップ2
    ?>
   <?php 
    if (dp_logo_exists()) {
        ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
        _e('Step 2 : Resize uploaded image.', 'tcd-w');
        ?>
</h3>
    <div class="theme_option_input">
    <?php 
        if (dp_logo_exists()) {
            ?>
     <p><?php 
            _e('You can resize uploaded image.<br />If you don\'t need to resize, go to step 3.', 'tcd-w');
            ?>
</p>
     <div class="uploaded_logo">
      <h4><?php 
            _e('Please drag the range to cut off.', 'tcd-w');
            ?>
</h4>
      <div class="uploaded_logo_image">
       <?php 
            dp_logo_resize_base(9999);
            ?>
      </div>
      <div class="resize_amount">
       <label><?php 
            _e('Ratio', 'tcd-w');
            ?>
: <input type="text" name="dp_resize_ratio" id="dp_resize_ratio" value="100" />%</label>
       <label><?php 
            _e('Width', 'tcd-w');
            ?>
: <input type="text" name="dp_resized_width" id="dp_resized_width" />px</label>
       <label><?php 
            _e('Height', 'tcd-w');
            ?>
: <input type="text" name="dp_resized_height" id="dp_resized_height" />px</label>
      </div>
      <div id="resize_button_area">
       <input type="submit" class="button-primary" value="<?php 
            _e('Resize', 'tcd-w');
            ?>
" />
      </div>
     </div>
     <?php 
            if ($info = dp_logo_info(true)) {
                ?>
     <div class="uploaded_logo">
      <h4><?php 
                printf(__('Resized image : width %1$dpx, height %2$dpx', 'tcd-w'), $info['width'], $info['height']);
                ?>
</h4>
      <div class="uploaded_logo_image">
       <?php 
                dp_logo_img_tag(true, '', '', 9999);
                ?>
      </div>
     </div>
     <?php 
            }
            ?>
    <?php 
        }
        ?>
    </div>
   </div>
   <?php 
    }
    ?>

   <?php 
    // ステップ3
    ?>
   <?php 
    if (dp_logo_exists()) {
        ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
        _e('Step 3 : Adjust position of logo.', 'tcd-w');
        ?>
</h3>
    <div class="theme_option_input">
    <?php 
        if (dp_logo_exists()) {
            ?>
     <p><?php 
            _e('Drag the logo image and adjust the position.', 'tcd-w');
            ?>
</p>
     <div id="tcd-w-logo-adjuster" class="ratio-<?php 
            echo '760-760';
            ?>
">
      <?php 
            if (dp_logo_resize_tag(760, 760, $options['logotop'], $options['logoleft'])) {
                ?>
      <?php 
            } else {
                ?>
      <span><?php 
                _e('Logo size is too big. Please resize your logo image.', 'tcd-w');
                ?>
</span>
      <?php 
            }
            ?>
     </div>
     <div class="hide">
      <label><?php 
            _e('Top', 'tcd-w');
            ?>
: <input type="text" name="dp_options[logotop]" id="dp-options-logotop" value="<?php 
            esc_attr_e($options['logotop']);
            ?>
" />px </label>
      <label><?php 
            _e('Left', 'tcd-w');
            ?>
: <input type="text" name="dp_options[logoleft]" id="dp-options-logoleft" value="<?php 
            esc_attr_e($options['logoleft']);
            ?>
" />px </label>
      <input type="button" class="button" id="dp-adjust-realvalue" value="adjust" />
     </div>
     <p><input type="submit" class="button" value="<?php 
            _e('Save the position', 'tcd-w');
            ?>
" /></p>
    <?php 
        }
        ?>
    </div>
   </div>
   <?php 
    }
    ?>

   <?php 
    // 画像の削除
    ?>
   <?php 
    if (dp_logo_exists()) {
        ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
        _e('Delete logo image.', 'tcd-w');
        ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
        _e('If you delete the logo image, normal text will be used for a site logo.', 'tcd-w');
        ?>
</p>
     <p><a class="button" href="<?php 
        echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_image_' . get_current_user_id());
        ?>
" onclick="if(!confirm('<?php 
        _e('Are you sure to delete logo image?', 'tcd-w');
        ?>
')) return false;"><?php 
        _e('Delete Image', 'tcd-w');
        ?>
</a></p>
    </div>
   </div>
   <?php 
    }
    ?>

  </div><!-- END #tab-content2 -->




  <!-- #tab-content4 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content4">

  <?php 
    for ($i = 1; $i <= 3; $i++) {
        ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
        _e('Adsense banner setup', 'tcd-w');
        echo $i;
        ?>
</h3>
   <?php 
        if ($i == 2) {
            ?>
   <p class="tab_desc"><?php 
            _e('<strong>This Adsense will not be displayed if you set post number less than 4 at Reading Settings page.</strong>', 'tcd-w');
            ?>
</p>
   <?php 
        } elseif ($i == 3) {
            ?>
   <p class="tab_desc"><?php 
            _e('<strong>This Adsense will not be displayed if you set post number less than 8 at Reading Settings page.</strong>', 'tcd-w');
            ?>
</p>
   <?php 
        }
        ?>
   <p class="tab_desc"><?php 
        _e('This Adsense will be displayed at front page, archive page, and search result page.', 'tcd-w');
        ?>
</p>
   <div class="theme_option_field cf">
    <div class="theme_option_input">
     <div class="sub_box">
      <h4><?php 
        _e('Banner code', 'tcd-w');
        ?>
</h4>
      <p><?php 
        _e('If you are using google adsense, enter all code below.', 'tcd-w');
        ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[post_ad<?php 
        echo $i;
        ?>
]" class="large-text" cols="50" rows="10" name="dp_options[post_ad<?php 
        echo $i;
        ?>
]"><?php 
        echo esc_textarea($options['post_ad' . $i]);
        ?>
</textarea>
      </div>
     </div>
     <p><?php 
        _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
        ?>
</p>
     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
        _e('Register banner image', 'tcd-w');
        ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[post_ad_image<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['post_ad_image' . $i]);
        ?>
" /></div>
        <input type="file" name="post_ad_image_file_<?php 
        echo $i;
        ?>
" id="post_ad_image_file_<?php 
        echo $i;
        ?>
" />
        <input type="submit" class="button-primary" value="<?php 
        echo __('Save Image', 'tcd-w');
        ?>
" />
       </div>
       <?php 
        if ($options['post_ad_image' . $i]) {
            ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
            esc_attr_e($options['post_ad_image' . $i]);
            ?>
" alt="" title="" />
        </div>
        <?php 
            if (dp_is_uploaded_img($options['post_ad_image' . $i])) {
                ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
                echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_post_ad_' . $i);
                ?>
" class="button" onclick="if(!confirm('<?php 
                _e('Are you sure to delete this image?', 'tcd-w');
                ?>
')) return false;"><?php 
                _e('Delete Image', 'tcd-w');
                ?>
</a>
        </div>
       <?php 
            }
            ?>
       <?php 
        }
        ?>
      </div>
     </div>
     <div class="sub_box">
      <h4><?php 
        _e('Register affiliate code', 'tcd-w');
        ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[post_ad_url<?php 
        echo $i;
        ?>
]" class="regular-text" type="text" name="dp_options[post_ad_url<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['post_ad_url' . $i]);
        ?>
" />
      </div>
     </div>
    </div>
   </div>
  </div>
  <?php 
    }
    ?>

  <?php 
    // 詳細ページの広告1 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Single post page banner setup1.', 'tcd-w');
    ?>
</h3>
   <p class="tab_desc"><?php 
    _e('This Adsense will be displayed at right column top in single post page.', 'tcd-w');
    ?>
</p>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[single_ad_code1]" class="large-text" cols="50" rows="10" name="dp_options[single_ad_code1]"><?php 
    echo esc_textarea($options['single_ad_code1']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[single_ad_image1]" value="<?php 
    esc_attr_e($options['single_ad_image1']);
    ?>
" /></div>
        <input type="file" name="single_ad_image_file1" id="single_ad_image_file1" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['single_ad_image1']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['single_ad_image1']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['single_ad_image1'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_single_ad_image1');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[single_ad_url1]" class="regular-text" type="text" name="dp_options[single_ad_url1]" value="<?php 
    esc_attr_e($options['single_ad_url1']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>

  <?php 
    // 詳細ページの広告2 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Single post page banner setup2.', 'tcd-w');
    ?>
</h3>
   <p class="tab_desc"><?php 
    _e('This Adsense will be displayed at right column bottom in single post page.', 'tcd-w');
    ?>
</p>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[single_ad_code2]" class="large-text" cols="50" rows="10" name="dp_options[single_ad_code2]"><?php 
    echo esc_textarea($options['single_ad_code2']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[single_ad_image2]" value="<?php 
    esc_attr_e($options['single_ad_image2']);
    ?>
" /></div>
        <input type="file" name="single_ad_image_file2" id="single_ad_image_file2" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['single_ad_image2']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['single_ad_image2']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['single_ad_image2'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_single_ad_image2');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[single_ad_url2]" class="regular-text" type="text" name="dp_options[single_ad_url2]" value="<?php 
    esc_attr_e($options['single_ad_url2']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>


  <?php 
    // 詳細ページの広告3 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Single post page banner setup3.', 'tcd-w');
    ?>
</h3>
   <p class="tab_desc"><?php 
    _e('This Adsense will be displayed before the post.', 'tcd-w');
    ?>
</p>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[single_ad_code3]" class="large-text" cols="50" rows="10" name="dp_options[single_ad_code3]"><?php 
    echo esc_textarea($options['single_ad_code3']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[single_ad_image3]" value="<?php 
    esc_attr_e($options['single_ad_image3']);
    ?>
" /></div>
        <input type="file" name="single_ad_image_file3" id="single_ad_image_file3" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['single_ad_image3']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['single_ad_image3']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['single_ad_image3'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_single_ad_image3');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[single_ad_url3]" class="regular-text" type="text" name="dp_options[single_ad_url3]" value="<?php 
    esc_attr_e($options['single_ad_url3']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>



  <?php 
    // 詳細ページの広告4 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Single post page banner setup4.', 'tcd-w');
    ?>
</h3>
   <p class="tab_desc"><?php 
    _e('This Adsense will be displayed after the post.', 'tcd-w');
    ?>
</p>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[single_ad_code4]" class="large-text" cols="50" rows="10" name="dp_options[single_ad_code4]"><?php 
    echo esc_textarea($options['single_ad_code4']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[single_ad_image4]" value="<?php 
    esc_attr_e($options['single_ad_image4']);
    ?>
" /></div>
        <input type="file" name="single_ad_image_file4" id="single_ad_image_file4" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['single_ad_image4']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['single_ad_image4']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['single_ad_image4'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_single_ad_image4');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[single_ad_url4]" class="regular-text" type="text" name="dp_options[single_ad_url4]" value="<?php 
    esc_attr_e($options['single_ad_url4']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>



  <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content4 -->




  </div><!-- END #tab-panel -->

 </form>

</div>

</div>

<?php 
}
Exemplo n.º 3
0
function theme_options_do_page()
{
    global $layout_options, $header_layout_options, $color_type_options, $dp_upload_error;
    $options = get_desing_plus_option();
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>

<div class="wrap">
 <?php 
    screen_icon();
    echo "<h2>" . __('Theme Options', 'tcd-w') . "</h2>";
    ?>

 <?php 
    // 更新時のメッセージ
    if (false !== $_REQUEST['settings-updated']) {
        ?>
 <div class="updated fade"><p><strong><?php 
        _e('Updated', 'tcd-w');
        ?>
</strong></p></div>
 <?php 
    }
    ?>

 <?php 
    /* ファイルアップロード時のメッセージ */
    if (!empty($dp_upload_error['message'])) {
        ?>
  <?php 
        if ($dp_upload_error['error']) {
            ?>
   <div id="error" class="error"><p><?php 
            echo $dp_upload_error['message'];
            ?>
</p></div>
  <?php 
        } else {
            ?>
   <div id="message" class="updated fade"><p><?php 
            echo $dp_upload_error['message'];
            ?>
</p></div>
  <?php 
        }
        ?>
 <?php 
    }
    ?>
 
 <script type="text/javascript">
  jQuery(document).ready(function($){
   $('#my_theme_option').cookieTab({
    tabMenuElm: '#theme_tab',
    tabPanelElm: '#tab-panel'
   });
  });
 </script>

 <div id="my_theme_option">

 <div id="theme_tab_wrap">
  <ul id="theme_tab" class="cf">
   <li><a href="#tab-content1"><?php 
    _e('Basic Setup', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content2"><?php 
    _e('Logo', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content3"><?php 
    _e('Adsence widget1', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content4"><?php 
    _e('Adsence widget2', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content5"><?php 
    _e('Other Adsense', 'tcd-w');
    ?>
</a></li>
   <li><a href="#tab-content6"><?php 
    _e('Smartphone Adsense', 'tcd-w');
    ?>
</a></li>
  </ul>
 </div>

<form method="post" action="options.php" enctype="multipart/form-data">
 <?php 
    settings_fields('design_plus_options');
    ?>

 <div id="tab-panel">

  <!-- #tab-content1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content1">

   <?php 
    // 色の設定
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Color setting', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input" id="color_type">
     <p><?php 
    _e('Select color type', 'tcd-w');
    ?>
</p>
     <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Color type', 'tcd-w');
    ?>
</span></legend>
     <ul class="cf">
     <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($color_type_options as $option) {
        $color_type_setting = $options['color_type'];
        if ('' != $color_type_setting) {
            if ($options['color_type'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
      <li>
       <label>
       <input id="input_<?php 
        esc_attr_e($option['value']);
        ?>
" type="radio" name="dp_options[color_type]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
       <?php 
        echo $option['label'];
        ?>
       </label>
      </li>
     <?php 
    }
    ?>
     </ul>
     </fieldset>
    </div>
   </div>

 <script type="text/javascript">
  jQuery(document).ready(function($){

   if($("#input_type3:checked").val()) {
    $('#color_pattern').show();
   } else {
    $('#color_pattern').hide();
   };

   $("#input_type3").click(function () {
    $('#color_pattern').show();
   });

   $("#color_type input").not('#input_type3').click(function () {
    $('#color_pattern').hide();
   });

  });
 </script>

   <?php 
    // サイトカラー
    ?>
   <div id="color_pattern" style="display:none;">
    <div class="theme_option_field cf">
     <h3 class="theme_option_headline"><?php 
    _e('Custom color setting', 'tcd-w');
    ?>
</h3>
     <p><?php 
    _e('Set primary color.', 'tcd-w');
    ?>
</p>
     <div class="theme_option_input">
      <input type="text" class="color" name="dp_options[pickedcolor]" value="<?php 
    esc_attr_e($options['pickedcolor']);
    ?>
" />
      <input type="submit" class="button-primary" value="<?php 
    echo __('Save Color', 'tcd-w');
    ?>
" />
     </div>
     <p><?php 
    _e('Set secondary color.', 'tcd-w');
    ?>
</p>
     <div class="theme_option_input">
      <input type="text" class="color" name="dp_options[pickedcolor2]" value="<?php 
    esc_attr_e($options['pickedcolor2']);
    ?>
" />
      <input type="submit" class="button-primary" value="<?php 
    echo __('Save Color', 'tcd-w');
    ?>
" />
     </div>
     <p><?php 
    _e('Color to use for gradation.', 'tcd-w');
    ?>
</p>
     <div class="theme_option_input">
      <input type="text" class="color" name="dp_options[pickedcolor3]" value="<?php 
    esc_attr_e($options['pickedcolor3']);
    ?>
" />
      <input type="submit" class="button-primary" value="<?php 
    echo __('Save Color', 'tcd-w');
    ?>
" />
     </div>
    </div>
   </div>

   <?php 
    // フォントサイズ
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Font size', 'tcd-w');
    ?>
</h3>
    <p><?php 
    _e('Font size of single page and wp-page.', 'tcd-w');
    ?>
</p>
    <div class="theme_option_input">
     <input id="dp_options[content_font_size]" class="font_size" type="text" name="dp_options[content_font_size]" value="<?php 
    esc_attr_e($options['content_font_size']);
    ?>
" /><span>px</span>
    </div>
   </div>

   <?php 
    // 投稿者名・タグ・コメント
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Display Setup', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <ul>
      <li><label><input id="dp_options[show_author]" name="dp_options[show_author]" type="checkbox" value="1" <?php 
    checked('1', $options['show_author']);
    ?>
 /> <?php 
    _e('Display author', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_comment]" name="dp_options[show_comment]" type="checkbox" value="1" <?php 
    checked('1', $options['show_comment']);
    ?>
 /> <?php 
    _e('Display comment', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_trackback]" name="dp_options[show_trackback]" type="checkbox" value="1" <?php 
    checked('1', $options['show_trackback']);
    ?>
 /> <?php 
    _e('Display trackbacks', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_bookmark]" name="dp_options[show_bookmark]" type="checkbox" value="1" <?php 
    checked('1', $options['show_bookmark']);
    ?>
 /> <?php 
    _e('Display social bookmark', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_related_post]" name="dp_options[show_related_post]" type="checkbox" value="1" <?php 
    checked('1', $options['show_related_post']);
    ?>
 /> <?php 
    _e('Display related post at single post page', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_next_post]" name="dp_options[show_next_post]" type="checkbox" value="1" <?php 
    checked('1', $options['show_next_post']);
    ?>
 /> <?php 
    _e('Display next previous post link', 'tcd-w');
    ?>
</label></li>
      <li><label><input id="dp_options[show_rss]" name="dp_options[show_rss]" type="checkbox" value="1" <?php 
    checked('1', $options['show_rss']);
    ?>
 /> <?php 
    _e('Display RSS button at header', 'tcd-w');
    ?>
</label></li>
     </ul>
    </div>
   </div>

   <?php 
    // サイドコンテンツの表示位置
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Layout', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input layout_option">
     <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Layout', 'tcd-w');
    ?>
</span></legend>
     <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($layout_options as $option) {
        $layout_setting = $options['layout'];
        if ('' != $layout_setting) {
            if ($options['layout'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
      <label class="description">
       <input type="radio" name="dp_options[layout]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
       <img src="<?php 
        bloginfo('template_url');
        ?>
/admin/<?php 
        echo $option['img'];
        ?>
.gif" alt="" title="" />
       <?php 
        echo $option['label'];
        ?>
      </label>
     <?php 
    }
    ?>
     </fieldset>
    </div>
   </div>

   <?php 
    // ヘッダーのレイアウト
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Header style', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input layout_option2">
     <fieldset class="cf"><legend class="screen-reader-text"><span><?php 
    _e('Header style', 'tcd-w');
    ?>
</span></legend>
     <?php 
    if (!isset($checked)) {
        $checked = '';
    }
    foreach ($header_layout_options as $option) {
        $header_layout_setting = $options['header_layout'];
        if ('' != $header_layout_setting) {
            if ($options['header_layout'] == $option['value']) {
                $checked = "checked=\"checked\"";
            } else {
                $checked = '';
            }
        }
        ?>
      <label class="description">
       <input type="radio" name="dp_options[header_layout]" value="<?php 
        esc_attr_e($option['value']);
        ?>
" <?php 
        echo $checked;
        ?>
 />
       <?php 
        echo $option['label'];
        ?>
      </label>
     <?php 
    }
    ?>
     </fieldset>
    </div>
   </div>

   <?php 
    // facebook twitter
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('twitter and facebook setup', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
    _e('When it is blank, twitter and facebook icon will not displayed on a site.', 'tcd-w');
    ?>
</p>
     <ul>
      <li>
       <label style="display:inline-block; min-width:140px;"><?php 
    _e('your twitter URL', 'tcd-w');
    ?>
</label>
       <input id="dp_options[twitter_url]" class="regular-text" type="text" name="dp_options[twitter_url]" value="<?php 
    echo esc_url($options['twitter_url']);
    ?>
" />
      </li>
      <li>
       <label style="display:inline-block; min-width:140px;"><?php 
    _e('your facebook URL', 'tcd-w');
    ?>
</label>
       <input id="dp_options[facebook_url]" class="regular-text" type="text" name="dp_options[facebook_url]" value="<?php 
    echo esc_url($options['facebook_url']);
    ?>
" />
      </li>
     </ul>
    </div>
   </div>

   <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content1 -->




  <!-- #tab-content2 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content2">

   <?php 
    // ステップ1
    ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
    _e('Step 1 : Upload image to use for logo.', 'tcd-w');
    ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
    _e('Upload image to use for logo from your computer.<br />You can resize your logo image in step 2 and adjust position in step 3.', 'tcd-w');
    ?>
</p>
     <div class="button_area">
      <label for="dp_image"><?php 
    _e('Select image to use for logo from your computer.', 'tcd-w');
    ?>
</label>
      <input type="file" name="dp_image" id="dp_image" value="" />
      <input type="submit" class="button" value="<?php 
    _e('Upload', 'tcd-w');
    ?>
" />
     </div>
     <?php 
    if (dp_logo_exists()) {
        $info = dp_logo_info();
        ?>
     <div class="uploaded_logo">
      <h4><?php 
        _e('Uploaded image.', 'tcd-w');
        ?>
</h4>
      <div class="uploaded_logo_image" id="original_logo_size">
       <?php 
        dp_logo_img_tag(false, '', '', 9999);
        ?>
      </div>
      <p><?php 
        printf(__('Original image size : width %1$dpx, height %2$dpx', 'tcd-w'), $info['width'], $info['height']);
        ?>
</p>
     </div>
     <?php 
    } else {
        ?>
     <div class="uploaded_logo">
      <h4><?php 
        _e('The image has not been uploaded yet.<br />A normal text will be used for a site logo.', 'tcd-w');
        ?>
</h4>
     </div>
     <?php 
    }
    ?>
    </div>
   </div>

   <?php 
    // ステップ2
    ?>
   <?php 
    if (dp_logo_exists()) {
        ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
        _e('Step 2 : Resize uploaded image.', 'tcd-w');
        ?>
</h3>
    <div class="theme_option_input">
    <?php 
        if (dp_logo_exists()) {
            ?>
     <p><?php 
            _e('You can resize uploaded image.<br />If you don\'t need to resize, go to step 3.', 'tcd-w');
            ?>
</p>
     <div class="uploaded_logo">
      <h4><?php 
            _e('Please drag the range to cut off.', 'tcd-w');
            ?>
</h4>
      <div class="uploaded_logo_image">
       <?php 
            dp_logo_resize_base(9999);
            ?>
      </div>
      <div class="resize_amount">
       <label><?php 
            _e('Ratio', 'tcd-w');
            ?>
: <input type="text" name="dp_resize_ratio" id="dp_resize_ratio" value="100" />%</label>
       <label><?php 
            _e('Width', 'tcd-w');
            ?>
: <input type="text" name="dp_resized_width" id="dp_resized_width" />px</label>
       <label><?php 
            _e('Height', 'tcd-w');
            ?>
: <input type="text" name="dp_resized_height" id="dp_resized_height" />px</label>
      </div>
      <div id="resize_button_area">
       <input type="submit" class="button-primary" value="<?php 
            _e('Resize', 'tcd-w');
            ?>
" />
      </div>
     </div>
     <?php 
            if ($info = dp_logo_info(true)) {
                ?>
     <div class="uploaded_logo">
      <h4><?php 
                printf(__('Resized image : width %1$dpx, height %2$dpx', 'tcd-w'), $info['width'], $info['height']);
                ?>
</h4>
      <div class="uploaded_logo_image">
       <?php 
                dp_logo_img_tag(true, '', '', 9999);
                ?>
      </div>
     </div>
     <?php 
            }
            ?>
    <?php 
        }
        ?>
    </div>
   </div>
   <?php 
    }
    ?>

   <?php 
    // ステップ3
    ?>
   <?php 
    if (dp_logo_exists()) {
        ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
        _e('Step 3 : Adjust position of logo.', 'tcd-w');
        ?>
</h3>
    <div class="theme_option_input">
    <?php 
        if (dp_logo_exists()) {
            ?>
     <p><?php 
            _e('Drag the logo image and adjust the position.', 'tcd-w');
            ?>
</p>
     <div id="tcd-w-logo-adjuster" class="ratio-<?php 
            echo '760-760';
            ?>
">
      <?php 
            if (dp_logo_resize_tag(760, 760, $options['logotop'], $options['logoleft'])) {
                ?>
      <?php 
            } else {
                ?>
      <span><?php 
                _e('Logo size is too big. Please resize your logo image.', 'tcd-w');
                ?>
</span>
      <?php 
            }
            ?>
     </div>
     <div class="hide">
      <label><?php 
            _e('Top', 'tcd-w');
            ?>
: <input type="text" name="dp_options[logotop]" id="dp-options-logotop" value="<?php 
            esc_attr_e($options['logotop']);
            ?>
" />px </label>
      <label><?php 
            _e('Left', 'tcd-w');
            ?>
: <input type="text" name="dp_options[logoleft]" id="dp-options-logoleft" value="<?php 
            esc_attr_e($options['logoleft']);
            ?>
" />px </label>
      <input type="button" class="button" id="dp-adjust-realvalue" value="adjust" />
     </div>
     <p><input type="submit" class="button" value="<?php 
            _e('Save the position', 'tcd-w');
            ?>
" /></p>
    <?php 
        }
        ?>
    </div>
   </div>
   <?php 
    }
    ?>

   <?php 
    // 画像の削除
    ?>
   <?php 
    if (dp_logo_exists()) {
        ?>
   <div class="theme_option_field cf">
    <h3 class="theme_option_headline"><?php 
        _e('Delete logo image.', 'tcd-w');
        ?>
</h3>
    <div class="theme_option_input">
     <p><?php 
        _e('If you delete the logo image, normal text will be used for a site logo.', 'tcd-w');
        ?>
</p>
     <p><a class="button" href="<?php 
        echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_image_' . get_current_user_id());
        ?>
" onclick="if(!confirm('<?php 
        _e('Are you sure to delete logo image?', 'tcd-w');
        ?>
')) return false;"><?php 
        _e('Delete Image', 'tcd-w');
        ?>
</a></p>
    </div>
   </div>
   <?php 
    }
    ?>

  </div><!-- END #tab-content2 -->




  <!-- #tab-content3 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content3">

  <p class="tab_desc"><?php 
    _e('Adsense will be displayed at random in front page.<br />Don\'t forget to set the Adsense banner Widget1 from widget page.', 'tcd-w');
    ?>
</p>
  <p class="tab_desc"><?php 
    _e('Please read about Adsense terms of use before you use this checkbox option.', 'tcd-w');
    ?>
</p>
  <p class="tab_desc"><label><input id="dp_options[fix_ad]" name="dp_options[fix_ad]" type="checkbox" value="1" <?php 
    checked('1', $options['fix_ad']);
    ?>
 /> <?php 
    _e('Fix position of adsense', 'tcd-w');
    ?>
</label></p>

  <?php 
    // ウィジェット広告1 --------------------------------------------------------------------------------------------
    ?>
  <?php 
    for ($i = 1; $i <= 3; $i++) {
        ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
        _e('Adsense banner setup', 'tcd-w');
        echo $i;
        ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">
     <div class="sub_box">
      <h4><?php 
        _e('Banner code', 'tcd-w');
        ?>
</h4>
      <p><?php 
        _e('If you are using google adsense, enter all code below.', 'tcd-w');
        ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[side_ad_top_code<?php 
        echo $i;
        ?>
]" class="large-text" cols="50" rows="10" name="dp_options[side_ad_top_code<?php 
        echo $i;
        ?>
]"><?php 
        echo esc_textarea($options['side_ad_top_code' . $i]);
        ?>
</textarea>
      </div>
     </div>
     <p><?php 
        _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
        ?>
</p>
     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
        _e('Register banner image', 'tcd-w');
        ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[side_ad_top_image<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['side_ad_top_image' . $i]);
        ?>
" /></div>
        <input type="file" name="side_ad_top_image_file_<?php 
        echo $i;
        ?>
" id="side_ad_top_image_file_<?php 
        echo $i;
        ?>
" />
        <input type="submit" class="button-primary" value="<?php 
        echo __('Save Image', 'tcd-w');
        ?>
" />
       </div>
       <?php 
        if ($options['side_ad_top_image' . $i]) {
            ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
            esc_attr_e($options['side_ad_top_image' . $i]);
            ?>
" alt="" title="" />
        </div>
        <?php 
            if (dp_is_uploaded_img($options['side_ad_top_image' . $i])) {
                ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
                echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_side_ad_top_image' . $i);
                ?>
" class="button" onclick="if(!confirm('<?php 
                _e('Are you sure to delete this image?', 'tcd-w');
                ?>
')) return false;"><?php 
                _e('Delete Image', 'tcd-w');
                ?>
</a>
        </div>
       <?php 
            }
            ?>
       <?php 
        }
        ?>
      </div>
     </div>
     <div class="sub_box">
      <h4><?php 
        _e('Register affiliate code', 'tcd-w');
        ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[side_ad_top_url<?php 
        echo $i;
        ?>
]" class="regular-text" type="text" name="dp_options[side_ad_top_url<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['side_ad_top_url' . $i]);
        ?>
" />
      </div>
     </div>
    </div>
   </div>
  </div>
  <?php 
    }
    ?>

  <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content3 -->



  <!-- #tab-content4 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content4">

  <p class="tab_desc"><?php 
    _e('Adsense will be displayed at random in front page.<br />Don\'t forget to set the Adsense banner Widget2 from widget page.', 'tcd-w');
    ?>
</p>

  <?php 
    // ウィジェット広告2 --------------------------------------------------------------------------------------------
    ?>
  <?php 
    for ($i = 1; $i <= 3; $i++) {
        ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
        _e('Adsense banner setup', 'tcd-w');
        echo $i;
        ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">
     <div class="sub_box">
      <h4><?php 
        _e('Banner code', 'tcd-w');
        ?>
</h4>
      <p><?php 
        _e('If you are using google adsense, enter all code below.', 'tcd-w');
        ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[side_ad_bottom_code<?php 
        echo $i;
        ?>
]" class="large-text" cols="50" rows="10" name="dp_options[side_ad_bottom_code<?php 
        echo $i;
        ?>
]"><?php 
        echo esc_textarea($options['side_ad_bottom_code' . $i]);
        ?>
</textarea>
      </div>
     </div>
     <p><?php 
        _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
        ?>
</p>
     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
        _e('Register banner image', 'tcd-w');
        ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[side_ad_bottom_image<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['side_ad_bottom_image' . $i]);
        ?>
" /></div>
        <input type="file" name="side_ad_bottom_image_file_<?php 
        echo $i;
        ?>
" id="side_ad_bottom_image_file_<?php 
        echo $i;
        ?>
" />
        <input type="submit" class="button-primary" value="<?php 
        echo __('Save Image', 'tcd-w');
        ?>
" />
       </div>
       <?php 
        if ($options['side_ad_bottom_image' . $i]) {
            ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
            esc_attr_e($options['side_ad_bottom_image' . $i]);
            ?>
" alt="" title="" />
        </div>
        <?php 
            if (dp_is_uploaded_img($options['side_ad_bottom_image' . $i])) {
                ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
                echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_side_ad_bottom_image' . $i);
                ?>
" class="button" onclick="if(!confirm('<?php 
                _e('Are you sure to delete this image?', 'tcd-w');
                ?>
')) return false;"><?php 
                _e('Delete Image', 'tcd-w');
                ?>
</a>
        </div>
       <?php 
            }
            ?>
       <?php 
        }
        ?>
      </div>
     </div>
     <div class="sub_box">
      <h4><?php 
        _e('Register affiliate code', 'tcd-w');
        ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[side_ad_bottom_url<?php 
        echo $i;
        ?>
]" class="regular-text" type="text" name="dp_options[side_ad_bottom_url<?php 
        echo $i;
        ?>
]" value="<?php 
        esc_attr_e($options['side_ad_bottom_url' . $i]);
        ?>
" />
      </div>
     </div>
    </div>
   </div>
  </div>
  <?php 
    }
    ?>

  <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content4 -->




  <!-- #tab-content5 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content5">


  <?php 
    // ヘッダー広告の登録 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Header banner setup.', 'tcd-w');
    ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[header_ad_code1]" class="large-text" cols="50" rows="10" name="dp_options[header_ad_code1]"><?php 
    echo esc_textarea($options['header_ad_code1']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.(Size width:728px height:90px;)', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[header_ad_image1]" value="<?php 
    esc_attr_e($options['header_ad_image1']);
    ?>
" /></div>
        <input type="file" name="header_ad_image_file1" id="header_ad_image_file1" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['header_ad_image1']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['header_ad_image1']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['header_ad_image1'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_header_ad_image1');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[header_ad_url1]" class="regular-text" type="text" name="dp_options[header_ad_url1]" value="<?php 
    esc_attr_e($options['header_ad_url1']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>


  <?php 
    // 詳細ページの広告1 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Single post page banner setup1.(Show on top of the post.)', 'tcd-w');
    ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[single_ad_code1]" class="large-text" cols="50" rows="10" name="dp_options[single_ad_code1]"><?php 
    echo esc_textarea($options['single_ad_code1']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[single_ad_image1]" value="<?php 
    esc_attr_e($options['single_ad_image1']);
    ?>
" /></div>
        <input type="file" name="single_ad_image_file1" id="single_ad_image_file1" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['single_ad_image1']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['single_ad_image1']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['single_ad_image1'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_single_ad_image1');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[single_ad_url1]" class="regular-text" type="text" name="dp_options[single_ad_url1]" value="<?php 
    esc_attr_e($options['single_ad_url1']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>


  <?php 
    // 詳細ページの広告2 --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Single post page banner setup2.(Show on bottom of the post.)', 'tcd-w');
    ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[single_ad_code2]" class="large-text" cols="50" rows="10" name="dp_options[single_ad_code2]"><?php 
    echo esc_textarea($options['single_ad_code2']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[single_ad_image2]" value="<?php 
    esc_attr_e($options['single_ad_image2']);
    ?>
" /></div>
        <input type="file" name="single_ad_image_file2" id="single_ad_image_file2" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['single_ad_image2']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['single_ad_image2']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['single_ad_image2'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_single_ad_image2');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[single_ad_url2]" class="regular-text" type="text" name="dp_options[single_ad_url2]" value="<?php 
    esc_attr_e($options['single_ad_url2']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>

  <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content5 -->




  <!-- #tab-content6 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
  <div id="tab-content6">

  <p class="tab_desc"><?php 
    _e('This Adsense is displayed only on the user who accessed the site with the smartphone.', 'tcd-w');
    ?>
</p>

  <?php 
    // モバイル広告の登録(ページ上部) --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Smartphone banner setup1. (Display on the top of a page)', 'tcd-w');
    ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[mobile_ad_code1]" class="large-text" cols="50" rows="10" name="dp_options[mobile_ad_code1]"><?php 
    echo esc_textarea($options['mobile_ad_code1']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[mobile_ad_image1]" value="<?php 
    esc_attr_e($options['mobile_ad_image1']);
    ?>
" /></div>
        <input type="file" name="mobile_ad_image_file1" id="mobile_ad_image_file1" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['mobile_ad_image1']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['mobile_ad_image1']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['mobile_ad_image1'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_mobile_ad_image1');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[mobile_ad_url1]" class="regular-text" type="text" name="dp_options[mobile_ad_url1]" value="<?php 
    esc_attr_e($options['mobile_ad_url1']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>

  <?php 
    // モバイル広告の登録(ページ下部) --------------------------------------------------------------------------------------------
    ?>
  <div class="banner_wrapper">
   <h3 class="banner_headline"><?php 
    _e('Smartphone banner setup2. (Display on the bottom of a page)', 'tcd-w');
    ?>
</h3>
   <div class="theme_option_field cf">
    <div class="theme_option_input">

     <div class="sub_box">
      <h4><?php 
    _e('Banner code', 'tcd-w');
    ?>
</h4>
      <p><?php 
    _e('If you are using google adsense, enter all code below.', 'tcd-w');
    ?>
</p>
      <div class="theme_option_input">
       <textarea id="dp_options[mobile_ad_code2]" class="large-text" cols="50" rows="10" name="dp_options[mobile_ad_code2]"><?php 
    echo esc_textarea($options['mobile_ad_code2']);
    ?>
</textarea>
      </div>
     </div>
     <p><?php 
    _e('If you are not using google adsense, you can register your banner image and affiliate code individually.', 'tcd-w');
    ?>
</p>

     <div class="sub_box cf" style="margin:0 0 10px 0;">
      <h4><?php 
    _e('Register banner image.', 'tcd-w');
    ?>
</h4>
      <div class="image_box cf">
       <div class="upload_banner_button_area">
        <div class="hide"><input type="text" size="36" name="dp_options[mobile_ad_image2]" value="<?php 
    esc_attr_e($options['mobile_ad_image2']);
    ?>
" /></div>
        <input type="file" name="mobile_ad_image_file2" id="mobile_ad_image_file2" />
        <input type="submit" class="button-primary" value="<?php 
    echo __('Save Image', 'tcd-w');
    ?>
" />
       </div>
       <?php 
    if ($options['mobile_ad_image2']) {
        ?>
        <div class="uploaded_banner_image">
         <img src="<?php 
        esc_attr_e($options['mobile_ad_image2']);
        ?>
" alt="" title="" />
        </div>
        <?php 
        if (dp_is_uploaded_img($options['mobile_ad_image2'])) {
            ?>
        <div class="delete_uploaded_banner_image">
         <a href="<?php 
            echo wp_nonce_url(admin_url('themes.php?page=theme_options'), 'dp_delete_mobile_ad_image2');
            ?>
" class="button" onclick="if(!confirm('<?php 
            _e('Are you sure to delete this image?', 'tcd-w');
            ?>
')) return false;"><?php 
            _e('Delete Image', 'tcd-w');
            ?>
</a>
        </div>
       <?php 
        }
        ?>
       <?php 
    }
    ?>
      </div>
     </div>

     <div class="sub_box">
      <h4><?php 
    _e('Register affiliate code', 'tcd-w');
    ?>
</h4>
      <div class="theme_option_input">
       <input id="dp_options[mobile_ad_url2]" class="regular-text" type="text" name="dp_options[mobile_ad_url2]" value="<?php 
    esc_attr_e($options['mobile_ad_url2']);
    ?>
" />
      </div>
     </div>

    </div>
   </div>
  </div>

  <p class="submit"><input type="submit" class="button-primary" value="<?php 
    echo __('Save Changes', 'tcd-w');
    ?>
" /></p>

  </div><!-- END #tab-content6 -->




  </div><!-- END #tab-panel -->

 </form>

</div>

</div>

<?php 
}
function _dp_resize_logo()
{
    $dp_resize_message = array('error' => true, 'message' => '');
    //値をチェック
    $ratio = intval($_REQUEST['dp_resize_ratio']);
    if (!($ratio > 0 && $ratio <= 100)) {
        $ratio = 100;
    }
    $orignal_to_display_ratio = (double) $_REQUEST['dp_logo_to_resize_ratio'];
    $width = round($_REQUEST['dp_logo_resize_width'] / $orignal_to_display_ratio);
    $height = round($_REQUEST['dp_logo_resize_height'] / $orignal_to_display_ratio);
    $top = round($_REQUEST['dp_logo_resize_top'] / $orignal_to_display_ratio);
    $left = round($_REQUEST['dp_logo_resize_left'] / $orignal_to_display_ratio);
    //画像を読み込んでみる
    $info = dp_logo_info();
    if (!$info) {
        $dp_resize_message['message'] = __('Logo file not exists.', 'tcd-w');
        return $dp_resize_message;
    }
    $orig_image = wp_load_image($info['path']);
    if (!is_resource($orig_image)) {
        $dp_resize_message['message'] = __('Logo file not exists.', 'tcd-w');
        return $dp_resize_message;
    }
    $new_width = round($width * $ratio / 100);
    $new_height = round($height * $ratio / 100);
    $newimage = wp_imagecreatetruecolor($new_width, $new_height);
    imagecopyresampled($newimage, $orig_image, 0, 0, $left, $top, $new_width, $new_height, $width, $height);
    if (IMAGETYPE_PNG == $info['mime'] && function_exists('imageistruecolor')) {
        @imagetruecolortopalette($newimage, false, imagecolorstotal($orig_image));
    }
    imagedestroy($orig_image);
    //ファイルを保存する前に削除
    $dest_path = dp_logo_exists(true);
    if ($dest_path && !@unlink($dest_path)) {
        $dp_resize_message['message'] = __('Cannot delete existing resized logo.', 'tcd-w');
        return $dp_resize_message;
    }
    //名前を決めて保存
    $path = preg_replace("/logo\\.(png|gif|jpe?g)\$/i", "logo-resized.\$1", $info['path']);
    $result = null;
    if (IMAGETYPE_GIF == $info['mime']) {
        $result = imagegif($newimage, $path);
    } elseif (IMAGETYPE_PNG == $info['mime']) {
        $result = imagepng($newimage, $path);
    } else {
        $result = imagejpeg($newimage, $path, 100);
    }
    imagedestroy($newimage);
    if ($result) {
        $dp_resize_message['error'] = false;
        $dp_resize_message['message'] = __('Logo image is successfully resized.', 'tcd-w');
    } else {
        $dp_resize_message['message'] = sprintf(__('Failed to save resized logo. Please check permission of <code>%s</code>', 'tcd-w'), dp_logo_basedir());
    }
    return $dp_resize_message;
}