PluginProbe
AL Pack / trunk
AL Pack vtrunk
1.3.13 trunk 1.0.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.11 1.3.12
alpack / templates / admin-settings.php

admin-settings.php in AL Pack trunk, at templates/admin-settings.php

378 lines 20.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5
6 $is_activated = presslearn_plugin()->is_plugin_activated();
7 $kakao_login_url = presslearn_plugin()->get_kakao_login_url();
8
9 $ai_contents_enabled = get_option('presslearn_ai_contents_enabled', 'no');
10 $scroll_depth_enabled = get_option('presslearn_scroll_depth_enabled', 'no');
11 $analytics_enabled = get_option('presslearn_analytics_enabled', 'no');
12 $click_protection_enabled = get_option('presslearn_click_protection_enabled', 'no');
13 $ad_clicker_enabled = get_option('presslearn_ad_clicker_enabled', 'no');
14 $dynamic_banner_enabled = get_option('presslearn_dynamic_banner_enabled', 'no');
15 $social_share_enabled = get_option('presslearn_social_share_enabled', 'no');
16 $quick_button_enabled = get_option('presslearn_quick_button_enabled', 'no');
17 $auto_index_enabled = get_option('presslearn_auto_index_enabled', 'no');
18 $header_footer_enabled = get_option('presslearn_header_footer_enabled', 'no');
19 ?>
20 <div class="presslearn-header">
21 <div class="presslearn-header-logo">
22 <img src="<?php echo esc_url(PRESSLEARN_PLUGIN_URL); ?>assets/images/logo.png" alt="PressLearn Logo">
23 <h1>AL Pack 플러그인 설정</h1>
24 </div>
25 <div class="presslearn-header-status">
26 <?php if ($is_activated): ?>
27 <div class="presslearn-header-status-item status-activate">
28 <p>플러그인이 활성화되었습니다.</p>
29 </div>
30 <?php else: ?>
31 <div class="presslearn-header-status-item status-deactivate">
32 <p>플러그인이 비활성화 상태�
33 니다.</p>
34 </div>
35 <?php endif; ?>
36 </div>
37 </div>
38
39 <div id="presslearn-banner-container" class="presslearn-banner-container">
40 <div id="presslearn-banner" class="presslearn-banner">
41 <a href="#" id="presslearn-banner-link" target="_blank" class="presslearn-banner-link">
42 <img src="" id="presslearn-banner-image" class="presslearn-banner-image">
43 </a>
44 </div>
45 <div id="presslearn-banner-skeleton" class="presslearn-banner-skeleton">
46 <div class="presslearn-banner-skeleton-content"></div>
47 </div>
48 </div>
49
50 <div class="presslearn-notice-banner" id="presslearn-notice-banner">
51 <a href="#" id="presslearn-notice-link" target="_blank" class="presslearn-notice-link">
52 <span class="presslearn-notice-skeleton"></span>
53 </a>
54 </div>
55
56 <div class="wrap">
57 <?php
58 $show_updated_notice = false;
59 if (current_user_can('manage_options') && is_admin() && isset($_GET['updated'])) {
60 $updated_value = sanitize_text_field(wp_unslash($_GET['updated']));
61 if ($updated_value === 'true') {
62 $show_updated_notice = true;
63 }
64 }
65 ?>
66 <?php if ($show_updated_notice): ?>
67 <div class="notice notice-success is-dismissible">
68 <p>설정이 성공적으로 저장되었습니다.</p>
69 </div>
70 <?php endif; ?>
71
72 <?php if ($is_activated): ?>
73 <?php else: ?>
74 <div class="card">
75 <h2>플러그인 활성화 상태</h2>
76
77 <div class="presslearn-status-section">
78 <?php
79 $permalink_structure = get_option('permalink_structure');
80 $is_default_permalink = empty($permalink_structure);
81 ?>
82
83 <?php if ($is_default_permalink): ?>
84 <div class="notice notice-error inline">
85 <p><strong>⚠️ 고유주소 설정을 수정해 주세요</strong></p>
86 <p>현재 고유주소 설정이 기본 설정으로 되어 있어 안전한 인증이 되지 않습니다. 다음 단계를 따라 고유주소 설정을 변경해주세요.</p>
87 <ol style="margin-left: 20px;">
88 <li>워드프레스 관리자 <strong>설정</strong> <strong>고유주소</strong> 이동</li>
89 <li><strong>기본형</strong> 대신 <strong>포스트�
90 </strong> 또는 다른 옵�
91 �을 선택</li>
92 <li><strong>변경사항 저장</strong> 버튼 클릭</li>
93 <li> 페이지로 다시 돌아와서 인증 진행</li>
94 </ol>
95 <p>
96 <a href="<?php echo esc_url(admin_url('options-permalink.php')); ?>" class="button button-secondary">
97 고유주소 설정 페이지 열기
98 </a>
99 </p>
100 </div>
101
102 <p>
103 <button type="button" class="button button-primary kakao-login-button" disabled style="opacity: 0.5;">
104 카카오톡으로 로그인하기
105 </button>
106 </p>
107 <p class="description">
108 <small>* 고유주소 설정을 변경한 인증이 가능합니다.</small>
109 </p>
110 <?php else: ?>
111 <div class="notice notice-warning inline">
112 <p>⚠️ 플러그인이 활성화되지 않았습니다. 아래 버튼을 클릭하여 프레스런 계정으로 로그인하세요.</p>
113 </div>
114
115 <p>
116 <a href="<?php echo esc_url($kakao_login_url); ?>" class="button button-primary kakao-login-button" id="presslearn-login-button">
117 카카오톡으로 로그인하기
118 </a>
119 </p>
120 <p class="description">
121 <small>* 프레스런 로그인이 되어있다면, 로그아웃 로그인 버튼을 클릭해주세요.</small>
122 </p>
123 <?php endif; ?>
124 </div>
125 </div>
126 <?php endif; ?>
127
128 <div class="presslearn-activated-content"<?php if (!$is_activated): ?> style="display:none"<?php endif; ?>>
129 <?php if ($analytics_enabled === 'yes'): ?>
130 <div class="row-title">
131 <p>최근 7 통계</p>
132 </div>
133 <div class="pl-analytics-highlight">
134 <div class="pl-analytics-highlight-header">
135 <h2> 애널리틱스 하이라이트 <span class="highlight-period">최근 7</span></h2>
136 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-analytics&tab=statistics')); ?>" class="view-stats-link">전체 통계 보기</a>
137 </div>
138
139 <?php
140 function alpack_get_week_stats() {
141 $cached = get_transient('presslearn_dashboard_stats');
142 if (is_array($cached)) {
143 return $cached;
144 }
145
146 return presslearn_build_dashboard_stats();
147 }
148
149 $week_stats = alpack_get_week_stats();
150
151 function alpack_calculate_change($current, $previous) {
152 if ($previous == 0) {
153 return [
154 'percentage' => 0,
155 'show' => false
156 ];
157 }
158
159 $change = $current - $previous;
160 $percentage = round(($change / $previous) * 100);
161
162 return [
163 'change' => $change,
164 'percentage' => $percentage,
165 'show' => true,
166 'is_increase' => $change > 0
167 ];
168 }
169
170 $pageviews_change = alpack_calculate_change($week_stats['pageviews'], $week_stats['prev_pageviews']);
171 $visitors_change = alpack_calculate_change($week_stats['visitors'], $week_stats['prev_visitors']);
172 $ip_visitors_change = alpack_calculate_change($week_stats['ip_visitors'], $week_stats['prev_ip_visitors']);
173 ?>
174
175 <div class="pl-analytics-highlight-stats">
176 <div class="pl-analytics-highlight-stat">
177 <span class="stat-label">조회</span>
178 <span class="stat-value"><?php echo esc_html(number_format($week_stats['pageviews'])); ?></span>
179 <?php if ($pageviews_change['show']): ?>
180 <span class="stat-change <?php echo esc_attr($pageviews_change['is_increase'] ? 'increase' : 'decrease'); ?>">
181 <?php echo esc_html($pageviews_change['is_increase'] ? '' : ''); ?>
182 <?php echo esc_html(number_format(abs($pageviews_change['change']))); ?>
183 (<?php echo esc_html(abs($pageviews_change['percentage'])); ?>%)
184 </span>
185 <?php endif; ?>
186 </div>
187 <div class="pl-analytics-highlight-stat">
188 <span class="stat-label">방문자 (IP 기준)</span>
189 <span class="stat-value"><?php echo esc_html(number_format($week_stats['ip_visitors'])); ?></span>
190 <?php if ($ip_visitors_change['show']): ?>
191 <span class="stat-change <?php echo esc_attr($ip_visitors_change['is_increase'] ? 'increase' : 'decrease'); ?>">
192 <?php echo esc_html($ip_visitors_change['is_increase'] ? '' : ''); ?>
193 <?php echo esc_html(number_format(abs($ip_visitors_change['change']))); ?>
194 (<?php echo esc_html(abs($ip_visitors_change['percentage'])); ?>%)
195 </span>
196 <?php endif; ?>
197 </div>
198 <div class="pl-analytics-highlight-stat">
199 <span class="stat-label">방문자 (브라우저 기준)</span>
200 <span class="stat-value"><?php echo esc_html(number_format($week_stats['visitors'])); ?></span>
201 <?php if ($visitors_change['show']): ?>
202 <span class="stat-change <?php echo esc_attr($visitors_change['is_increase'] ? 'increase' : 'decrease'); ?>">
203 <?php echo esc_html($visitors_change['is_increase'] ? '' : ''); ?>
204 <?php echo esc_html(number_format(abs($visitors_change['change']))); ?>
205 (<?php echo esc_html(abs($visitors_change['percentage'])); ?>%)
206 </span>
207 <?php endif; ?>
208 </div>
209 </div>
210 </div>
211 <?php endif; ?>
212 <div class="row-title">
213 <p>플러그인 설정</p>
214 </div>
215 <div class="pl-grid">
216 <div class="pl-grid-item">
217 <header>
218 <p><span class="status-badge inactive">비활성화됨</span></p>
219 <h3>AI 블로그 포스�
220 </h3>
221 <p>Gemini Flash 모델을 활용한 콘�
222 �츠 자동 생성 기능�
223 니다. 여러가지 콘�
224 �츠를 생성하실 수 있습니다. *해당 기능은 프레스런 통합 강의 수강생만 사용 가능합니다.</p>
225 </header>
226 <div class="pl-grid-item-footer">
227 <button type="button" class="restricted-btn" title="프레스런 통합 강의 수강생 전용 기능" aria-label="사용 제한: 프레스런 통합 강의 수강생 전용 기능" disabled>사용 제한</button>
228 </div>
229 </div>
230 <div class="pl-grid-item">
231 <header>
232 <p><span class="status-badge <?php echo ($scroll_depth_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($scroll_depth_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
233 <h3>스마트 스크롤</h3>
234 <p>스크롤에 따라서 자동으로 팝�
235 을 띄워줄 수 있는 기능�
236 니다.</p>
237 </header>
238 <div class="pl-grid-item-footer">
239 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-scroll-depth')); ?>" class="secondary-btn">설정</a>
240 </div>
241 </div>
242 <div class="pl-grid-item">
243 <header>
244 <p><span class="status-badge <?php echo ($analytics_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($analytics_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
245 <h3> 애널리틱스</h3>
246 <p>페이지 별 애널리틱스 기능이 포함되어 있는 경량 애널리틱스 기능�
247 니다.</p>
248 </header>
249 <div class="pl-grid-item-footer">
250 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-analytics&tab=statistics')); ?>" class="point-btn">통계</a>
251 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-analytics&tab=settings')); ?>" class="secondary-btn">설정</a>
252 </div>
253 </div>
254 <div class="pl-grid-item">
255 <header>
256 <p><span class="status-badge <?php echo ($click_protection_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($click_protection_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
257 <h3>애드 프로�
258 �터</h3>
259 <p>구글 애드센스 광고를 �
260 의적인 공격으로부터 어느정도 보호할 수 있는 플러그인�
261 니다. 다양한 방식으로 차단 관리가 가능합니다.</p>
262 </header>
263 <div class="pl-grid-item-footer">
264 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-click-protection')); ?>" class="secondary-btn">설정</a>
265 </div>
266 </div>
267 <div class="pl-grid-item">
268 <header>
269 <p><span class="status-badge <?php echo ($ad_clicker_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($ad_clicker_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
270 <h3>애드클리커</h3>
271 <p>다양한 방식으로 자체 광고 및 어필리에이트 광고 세�
272 도와줍니다.</p>
273 </header>
274 <div class="pl-grid-item-footer">
275 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-ad-clicker')); ?>" class="secondary-btn">설정</a>
276 </div>
277 </div>
278 <div class="pl-grid-item">
279 <header>
280 <p><span class="status-badge <?php echo ($dynamic_banner_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($dynamic_banner_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
281 <h3>다이나믹 배너</h3>
282 <p>다양한 방식으로 자체 광고 및 어필리에이트 광고 세�
283 도와줍니다.</p>
284 </header>
285 <div class="pl-grid-item-footer">
286 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-dynamic-banner')); ?>" class="secondary-btn">설정</a>
287 </div>
288 </div>
289 <div class="pl-grid-item">
290 <header>
291 <p><span class="status-badge <?php echo ($social_share_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($social_share_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
292 <h3>소�
293 � 공유</h3>
294 <p>다양한 소�
295 � 미디어 매체에 간편하게 나의 게시물을 공유할 수 있도록 도와줍니다.</p>
296 </header>
297 <div class="pl-grid-item-footer">
298 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-social-share')); ?>" class="secondary-btn">설정</a>
299 </div>
300 </div>
301 <div class="pl-grid-item">
302 <header>
303 <p><span class="status-badge <?php echo ($quick_button_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($quick_button_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
304 <h3>빠른 버튼 생성</h3>
305 <p>다양한 용도로 활용 가능한 커스�
306 � 버튼을 손 쉽게 생성할 수 있도록 도와줍니다.</p>
307 </header>
308 <div class="pl-grid-item-footer">
309 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-quick-button')); ?>" class="secondary-btn">설정</a>
310 </div>
311 </div>
312 <div class="pl-grid-item">
313 <header>
314 <p><span class="status-badge active">활성화됨</span></p>
315 <h3>Ads 매니저</h3>
316 <p>Google AdSense 기타 광고 네트워크를 위한 ads.txt 파일을 관리합니다.</p>
317 </header>
318 <div class="pl-grid-item-footer">
319 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-ads')); ?>" class="secondary-btn">설정</a>
320 </div>
321 </div>
322 <div class="pl-grid-item">
323 <header>
324 <p><span class="status-badge <?php echo ($auto_index_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($auto_index_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
325 <h3>자동 인덱싱</h3>
326 <p>자동으로 포스트를 인덱싱하여 검색 엔진에 �
327 �출되도록 도와줍니다.</p>
328 </header>
329 <div class="pl-grid-item-footer">
330 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-auto-index')); ?>" class="secondary-btn">설정</a>
331 </div>
332 </div>
333 <div class="pl-grid-item">
334 <header>
335 <p><span class="status-badge <?php echo ($header_footer_enabled === 'yes') ? esc_attr('active') : esc_attr('inactive'); ?>"><?php echo ($header_footer_enabled === 'yes') ? esc_html('활성화됨') : esc_html('비활성화됨'); ?></span></p>
336 <h3>헤더 & 푸터</h3>
337 <p>웹사이트의 헤더와 푸터에 HTML, CSS, JavaScript 코드를 삽�
338 있습니다.</p>
339 </header>
340 <div class="pl-grid-item-footer">
341 <a href="<?php echo esc_url(admin_url('admin.php?page=presslearn-header-footer')); ?>" class="secondary-btn">설정</a>
342 </div>
343 </div>
344 </div>
345 </div>
346 </div>
347
348
349 <script>
350 document.addEventListener('DOMContentLoaded', function() {
351 const noticeLink = document.getElementById('presslearn-notice-link');
352 const noticeBanner = document.getElementById('presslearn-notice-banner');
353
354 if (noticeLink && noticeBanner) {
355 fetch('<?php echo esc_url(rest_url('presslearn/v1/notice')); ?>', {
356 method: 'GET',
357 headers: {
358 'Content-Type': 'application/json',
359 'X-WP-Nonce': '<?php echo esc_attr(wp_create_nonce('wp_rest')); ?>'
360 }
361 })
362 .then(response => response.json())
363 .then(data => {
364 if (data.success && data.data) {
365 noticeLink.innerHTML = '<strong>공지사항</strong> ' + data.data.title;
366 noticeLink.href = data.data.link;
367 } else {
368 noticeBanner.classList.add('error');
369 }
370 })
371 .catch(error => {
372 console.error('Error fetching notice:', error);
373 noticeBanner.classList.add('error');
374 });
375 }
376 });
377 </script>
378