| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
$is_activated = presslearn_plugin()->is_plugin_activated(); |
| 7 |
|
| 8 |
if (!$is_activated) { |
| 9 |
wp_redirect(admin_url('admin.php?page=presslearn-settings')); |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
if (isset($_POST['presslearn_toggle_adclicker']) && isset($_POST['enable'])) { |
| 14 |
check_admin_referer('presslearn_toggle_adclicker_nonce'); |
| 15 |
|
| 16 |
if (current_user_can('manage_options')) { |
| 17 |
$enable = sanitize_text_field(wp_unslash($_POST['enable'])); |
| 18 |
if ($enable === 'yes' || $enable === 'no') { |
| 19 |
update_option('presslearn_ad_clicker_enabled', $enable); |
| 20 |
$updated = true; |
| 21 |
} |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
if (current_user_can('manage_options') && is_admin() && isset($_GET['action']) && isset($_GET['enable']) && isset($_GET['feature'])) { |
| 26 |
if (!isset($_GET['_wpnonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['_wpnonce'])), 'presslearn_toggle_adclicker_action')) { |
| 27 |
wp_die('보안 검증에 실패했습니다.'); |
| 28 |
} |
| 29 |
|
| 30 |
$action = sanitize_text_field(wp_unslash($_GET['action'])); |
| 31 |
$enable = sanitize_text_field(wp_unslash($_GET['enable'])); |
| 32 |
$feature = sanitize_text_field(wp_unslash($_GET['feature'])); |
| 33 |
|
| 34 |
if ($action === 'toggle' && $feature === 'ad_clicker' && ($enable === 'yes' || $enable === 'no')) { |
| 35 |
update_option('presslearn_ad_clicker_enabled', $enable); |
| 36 |
$updated = true; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if (isset($_POST['save_adclicker_settings'])) { |
| 41 |
check_admin_referer('presslearn_save_adclicker_settings_nonce'); |
| 42 |
|
| 43 |
if (current_user_can('manage_options')) { |
| 44 |
$adclicker_frequency = isset($_POST['adclicker_frequency']) ? sanitize_text_field(wp_unslash($_POST['adclicker_frequency'])) : 'once'; |
| 45 |
$adclicker_overlay_color = isset($_POST['adclicker_overlay_color']) ? sanitize_hex_color(wp_unslash($_POST['adclicker_overlay_color'])) : '#000000'; |
| 46 |
$adclicker_overlay_range = isset($_POST['adclicker_overlay_range']) ? intval(wp_unslash($_POST['adclicker_overlay_range'])) : 50; |
| 47 |
$adclicker_display_time = isset($_POST['adclicker_display_time']) ? sanitize_text_field(wp_unslash($_POST['adclicker_display_time'])) : 'null'; |
| 48 |
$adclicker_button_color = isset($_POST['adclicker_button_color']) ? sanitize_hex_color(wp_unslash($_POST['adclicker_button_color'])) : '#2196F3'; |
| 49 |
$adclicker_button_text_color = isset($_POST['adclicker_button_text_color']) ? sanitize_hex_color(wp_unslash($_POST['adclicker_button_text_color'])) : '#ffffff'; |
| 50 |
$adclicker_global_enabled = isset($_POST['adclicker_global_enabled']) ? sanitize_text_field(wp_unslash($_POST['adclicker_global_enabled'])) : 'no'; |
| 51 |
|
| 52 |
$adclicker_overlay_range = max(1, min(100, $adclicker_overlay_range)); |
| 53 |
|
| 54 |
update_option('presslearn_adclicker_frequency', $adclicker_frequency); |
| 55 |
update_option('presslearn_adclicker_overlay_color', $adclicker_overlay_color); |
| 56 |
update_option('presslearn_adclicker_overlay_range', $adclicker_overlay_range); |
| 57 |
update_option('presslearn_adclicker_display_time', $adclicker_display_time); |
| 58 |
update_option('presslearn_adclicker_button_color', $adclicker_button_color); |
| 59 |
update_option('presslearn_adclicker_button_text_color', $adclicker_button_text_color); |
| 60 |
update_option('presslearn_adclicker_global_enabled', $adclicker_global_enabled); |
| 61 |
|
| 62 |
$settings_updated = true; |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
$adclicker_enabled = get_option('presslearn_ad_clicker_enabled', 'no'); |
| 67 |
$adclicker_frequency = get_option('presslearn_adclicker_frequency', 'once'); |
| 68 |
$adclicker_overlay_color = get_option('presslearn_adclicker_overlay_color', '#000000'); |
| 69 |
$adclicker_overlay_range = get_option('presslearn_adclicker_overlay_range', 100); |
| 70 |
$adclicker_display_time = get_option('presslearn_adclicker_display_time', 'null'); |
| 71 |
$adclicker_button_color = get_option('presslearn_adclicker_button_color', '#2196F3'); |
| 72 |
$adclicker_button_text_color = get_option('presslearn_adclicker_button_text_color', '#ffffff'); |
| 73 |
$adclicker_global_enabled = get_option('presslearn_adclicker_global_enabled', 'no'); |
| 74 |
|
| 75 |
?> |
| 76 |
<div class="presslearn-header"> |
| 77 |
<div class="presslearn-header-logo"> |
| 78 |
<img src="<?php echo esc_url(PRESSLEARN_PLUGIN_URL); ?>assets/images/logo.png" alt="PressLearn Logo"> |
| 79 |
<h1>애드클리커</h1> |
| 80 |
</div> |
| 81 |
<div class="presslearn-header-status"> |
| 82 |
<?php if ($adclicker_enabled === 'yes'): ?> |
| 83 |
<div class="presslearn-header-status-item status-activate"> |
| 84 |
<p>기능이 활성화되었습니다.</p> |
| 85 |
</div> |
| 86 |
<?php else: ?> |
| 87 |
<div class="presslearn-header-status-item status-deactivate"> |
| 88 |
<p>기능이 비활성화 상태� |
| 89 |
니다.</p> |
| 90 |
</div> |
| 91 |
<?php endif; ?> |
| 92 |
</div> |
| 93 |
</div> |
| 94 |
|
| 95 |
<div class="wrap"> |
| 96 |
<div class="presslearn-breadcrumbs-wrap"> |
| 97 |
<div class="presslearn-breadcrumbs"> |
| 98 |
<span>대시보드</span> |
| 99 |
<span class="divider">/</span> |
| 100 |
<span class="active">애드클리커</span> |
| 101 |
</div> |
| 102 |
</div> |
| 103 |
|
| 104 |
<?php if (isset($settings_updated) && $settings_updated): ?> |
| 105 |
<div class="notice notice-success inline"> |
| 106 |
<p>설정 정보가 성공적으로 저장되었습니다.</p> |
| 107 |
</div> |
| 108 |
<?php endif; ?> |
| 109 |
|
| 110 |
<div class="presslearn-card"> |
| 111 |
<div class="presslearn-card-header"> |
| 112 |
<h2>애드클리커</h2> |
| 113 |
<p>애드클리커는 다양한 방식으로 자체 광고 및 어필리에이트 광고 세� |
| 114 |
을 도와줍니다.</p> |
| 115 |
</div> |
| 116 |
<div class="presslearn-card-body"> |
| 117 |
<div class="presslearn-card-body-row"> |
| 118 |
<div class="presslearn-card-body-row-item grid-left"> |
| 119 |
<h3>플러그인 기능 활성화</h3> |
| 120 |
</div> |
| 121 |
<div class="presslearn-card-body-row-item grid-right"> |
| 122 |
<form method="post" action="" id="adclicker-toggle-form"> |
| 123 |
<?php wp_nonce_field('presslearn_toggle_adclicker_nonce'); ?> |
| 124 |
<input type="hidden" name="presslearn_toggle_adclicker" value="1"> |
| 125 |
<input type="hidden" name="enable" id="adclicker-enable-value" value="<?php echo esc_attr($adclicker_enabled === 'yes' ? 'no' : 'yes'); ?>"> |
| 126 |
|
| 127 |
<label class="switch"> |
| 128 |
<input type="checkbox" <?php echo esc_attr($adclicker_enabled === 'yes' ? 'checked' : ''); ?> onchange="document.getElementById('adclicker-enable-value').value = this.checked ? 'yes' : 'no'; document.getElementById('adclicker-toggle-form').submit();"> |
| 129 |
<span class="slider round"></span> |
| 130 |
</label> |
| 131 |
</form> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
<form method="post" action="" id="adclicker-settings-form"> |
| 135 |
<?php wp_nonce_field('presslearn_save_adclicker_settings_nonce'); ?> |
| 136 |
<input type="hidden" name="save_adclicker_settings" value="1"> |
| 137 |
<div class="presslearn-card-body-row"> |
| 138 |
<div class="presslearn-card-body-row-item grid-left"> |
| 139 |
<h3>전체 글 강제 활성화 적용 여부</h3> |
| 140 |
</div> |
| 141 |
<div class="presslearn-card-body-row-item grid-right"> |
| 142 |
<label class="switch"> |
| 143 |
<input type="checkbox" name="adclicker_global_enabled" value="yes" <?php echo esc_attr($adclicker_global_enabled === 'yes' ? 'checked' : ''); ?>> |
| 144 |
<span class="slider round"></span> |
| 145 |
</label> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
<div class="presslearn-card-body-row"> |
| 149 |
<div class="presslearn-card-body-row-item grid-left"> |
| 150 |
<h3>애드클리커 빈도 설정</h3> |
| 151 |
</div> |
| 152 |
<div class="presslearn-card-body-row-item grid-right"> |
| 153 |
<select name="adclicker_frequency"> |
| 154 |
<option value="once" <?php selected($adclicker_frequency, 'once'); ?>>세� |
| 155 |
� 당 한 번만</option> |
| 156 |
<option value="5min" <?php selected($adclicker_frequency, '5min'); ?>>5분 당 한 번만</option> |
| 157 |
<option value="loop" <?php selected($adclicker_frequency, 'loop'); ?>>반복 표시</option> |
| 158 |
</select> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
<div class="presslearn-card-body-row"> |
| 162 |
<div class="presslearn-card-body-row-item grid-left"> |
| 163 |
<h3>애드클리커 오버레이 색상 설정</h3> |
| 164 |
</div> |
| 165 |
<div class="presslearn-card-body-row-item grid-right"> |
| 166 |
<input type="color" name="adclicker_overlay_color" value="<?php echo esc_attr($adclicker_overlay_color); ?>"> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
<div class="presslearn-card-body-row"> |
| 170 |
<div class="presslearn-card-body-row-item grid-left"> |
| 171 |
<h3>애드클리커 오버레이 범위 설정</h3> |
| 172 |
</div> |
| 173 |
<div class="presslearn-card-body-row-item grid-right"> |
| 174 |
<div class="input-with-suffix"> |
| 175 |
<input type="number" name="adclicker_overlay_range" value="<?php echo esc_attr($adclicker_overlay_range); ?>" min="1" max="100" step="1"> |
| 176 |
<span class="input-suffix">%</span> |
| 177 |
</div> |
| 178 |
</div> |
| 179 |
</div> |
| 180 |
<div class="presslearn-card-body-row"> |
| 181 |
<div class="presslearn-card-body-row-item grid-left"> |
| 182 |
<h3>애드클리커 표시 시간 설정</h3> |
| 183 |
</div> |
| 184 |
<div class="presslearn-card-body-row-item grid-right"> |
| 185 |
<select name="adclicker_display_time"> |
| 186 |
<option value="null" <?php selected($adclicker_display_time, 'null'); ?>>제한 없음</option> |
| 187 |
<option value="5" <?php selected($adclicker_display_time, '5'); ?>>5초</option> |
| 188 |
<option value="10" <?php selected($adclicker_display_time, '10'); ?>>10초</option> |
| 189 |
<option value="15" <?php selected($adclicker_display_time, '15'); ?>>15초</option> |
| 190 |
</select> |
| 191 |
</div> |
| 192 |
</div> |
| 193 |
<div class="presslearn-card-body-row"> |
| 194 |
<div class="presslearn-card-body-row-item grid-left"> |
| 195 |
<h3>애드클리커 버튼 색상 설정</h3> |
| 196 |
</div> |
| 197 |
<div class="presslearn-card-body-row-item grid-right"> |
| 198 |
<input type="color" name="adclicker_button_color" value="<?php echo esc_attr($adclicker_button_color); ?>"> |
| 199 |
</div> |
| 200 |
</div> |
| 201 |
<div class="presslearn-card-body-row"> |
| 202 |
<div class="presslearn-card-body-row-item grid-left"> |
| 203 |
<h3>애드클리커 버튼 � |
| 204 |
�스트 색상 설정</h3> |
| 205 |
</div> |
| 206 |
<div class="presslearn-card-body-row-item grid-right"> |
| 207 |
<input type="color" name="adclicker_button_text_color" value="<?php echo esc_attr($adclicker_button_text_color); ?>"> |
| 208 |
</div> |
| 209 |
</div> |
| 210 |
<div class="presslearn-card-body-row"> |
| 211 |
<div class="presslearn-card-body-row-item grid-left"> |
| 212 |
<h3>애드클리커 미리보기</h3> |
| 213 |
</div> |
| 214 |
<div class="presslearn-card-body-row-item grid-right"> |
| 215 |
<button type="button" id="preview-adclicker" class="secondary-btn">미리보기</button> |
| 216 |
</div> |
| 217 |
</div> |
| 218 |
</form> |
| 219 |
</div> |
| 220 |
<div class="presslearn-card-footer"> |
| 221 |
<div class="presslearn-card-footer-item grid-left"> |
| 222 |
<span class="tip_button">쿠팡파트너스 정� |
| 223 |
을 확인해 주세요. 무분별한 광고 유도는 정� |
| 224 |
위반� |
| 225 |
니다.</span> |
| 226 |
</div> |
| 227 |
<div class="presslearn-card-footer-item grid-right"> |
| 228 |
<button type="submit" class="point-btn" form="adclicker-settings-form">저장하기</button> |
| 229 |
</div> |
| 230 |
</div> |
| 231 |
</div> |
| 232 |
</div> |
| 233 |
|
| 234 |
|