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-quick-button.php

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

189 lines 7.9 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
8 if (!$is_activated) {
9 wp_redirect(admin_url('admin.php?page=presslearn-settings'));
10 exit;
11 }
12
13 if (isset($_POST['presslearn_toggle_quick_button']) && isset($_POST['enable'])) {
14 check_admin_referer('presslearn_toggle_quick_button_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_quick_button_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_quick_button_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 === 'quick_button' && ($enable === 'yes' || $enable === 'no')) {
35 update_option('presslearn_quick_button_enabled', $enable);
36 $updated = true;
37 }
38 }
39
40 if (isset($_POST['save_quick_button_settings'])) {
41 check_admin_referer('presslearn_save_quick_button_settings_nonce');
42
43 if (current_user_can('manage_options')) {
44 $button_transition = isset($_POST['button_transition']) ? sanitize_text_field(wp_unslash($_POST['button_transition'])) : 'no';
45 if ($button_transition === 'yes' || $button_transition === 'no') {
46 update_option('presslearn_button_transition_enabled', $button_transition);
47 }
48
49 $settings_updated = true;
50 }
51 }
52
53 $quick_button_enabled = get_option('presslearn_quick_button_enabled', 'no');
54 $button_transition_enabled = get_option('presslearn_button_transition_enabled', 'no');
55 $saved_preset = get_option('presslearn_button_preset', array());
56
57 ?>
58 <div class="presslearn-header">
59 <div class="presslearn-header-logo">
60 <img src="<?php echo esc_url(PRESSLEARN_PLUGIN_URL); ?>assets/images/logo.png" alt="PressLearn Logo">
61 <h1>빠른 버튼 생성</h1>
62 </div>
63 <div class="presslearn-header-status">
64 <?php if ($quick_button_enabled === 'yes'): ?>
65 <div class="presslearn-header-status-item status-activate">
66 <p>기능이 활성화 되었습니다.</p>
67 </div>
68 <?php else: ?>
69 <div class="presslearn-header-status-item status-deactivate">
70 <p>기능이 비활성화 되었습니다.</p>
71 </div>
72 <?php endif; ?>
73 </div>
74 </div>
75
76 <div class="wrap">
77 <div class="presslearn-breadcrumbs-wrap">
78 <div class="presslearn-breadcrumbs">
79 <span>대시보드</span>
80 <span class="divider">/</span>
81 <span class="active">빠른 버튼 생성</span>
82 </div>
83 </div>
84
85 <?php if (isset($settings_updated) && $settings_updated): ?>
86 <div class="notice notice-success inline">
87 <p>설정 정보가 성공적으로 저장되었습니다.</p>
88 </div>
89 <?php endif; ?>
90
91 <div class="presslearn-card">
92 <div class="presslearn-card-header">
93 <h2>빠른 버튼 생성</h2>
94 <p> 쓰기 화면에서 빠르게 버튼 생성 기능을 설정할 있습니다.</p>
95 </div>
96 <div class="presslearn-card-body">
97 <div class="presslearn-card-body-row">
98 <div class="presslearn-card-body-row-item grid-left">
99 <h3>플러그인 기능 활성화</h3>
100 </div>
101 <div class="presslearn-card-body-row-item grid-right">
102 <form method="post" action="" id="quick-button-toggle-form">
103 <?php wp_nonce_field('presslearn_toggle_quick_button_nonce'); ?>
104 <input type="hidden" name="presslearn_toggle_quick_button" value="1">
105 <input type="hidden" name="enable" id="quick-button-enable-value" value="<?php echo esc_attr($quick_button_enabled === 'yes' ? 'no' : 'yes'); ?>">
106
107 <label class="switch">
108 <input type="checkbox" <?php echo esc_attr($quick_button_enabled === 'yes' ? 'checked' : ''); ?> onchange="document.getElementById('quick-button-enable-value').value = this.checked ? 'yes' : 'no'; document.getElementById('quick-button-toggle-form').submit();">
109 <span class="slider round"></span>
110 </label>
111 </form>
112 </div>
113 </div>
114 <form method="post" action="" id="quick-button-settings-form">
115 <?php wp_nonce_field('presslearn_save_quick_button_settings_nonce'); ?>
116 <input type="hidden" name="save_quick_button_settings" value="1">
117 <div class="presslearn-card-body-row">
118 <div class="presslearn-card-body-row-item grid-left">
119 <h3>버튼 애니메이�
120 � 무한 반복</h3>
121 </div>
122 <div class="presslearn-card-body-row-item grid-right">
123 <select name="button_transition">
124 <option value="yes" <?php selected($button_transition_enabled, 'yes'); ?>>활성화</option>
125 <option value="no" <?php selected($button_transition_enabled, 'no'); ?>>비활성화</option>
126 </select>
127 </div>
128 </div>
129 <div class="presslearn-card-body-row">
130 <div class="presslearn-card-body-row-item grid-left">
131 <h3>버튼 프리�
132 � 초기화</h3>
133 </div>
134 <div class="presslearn-card-body-row-item grid-right">
135 <button type="button" id="reset-preset-button" class="point-btn" <?php echo empty($saved_preset) ? 'disabled' : ''; ?>>
136 프리�
137 � 초기화
138 </button>
139 <?php if (empty($saved_preset)): ?>
140 <p style="margin-top: 10px; color: #666; font-size: 13px;">저장된 프리�
141 �이 없습니다.</p>
142 <?php endif; ?>
143 </div>
144 </div>
145 </form>
146 </div>
147 <div class="presslearn-card-footer">
148 <div class="presslearn-card-footer-item grid-left">
149 <span class="tip_button"> 작성 페이지의 메타박스를 확인해 보세요.</span>
150 </div>
151 <div class="presslearn-card-footer-item grid-right">
152 <button type="submit" class="point-btn" form="quick-button-settings-form">저장하기</button>
153 </div>
154 </div>
155 </div>
156 </div>
157
158 <script type="text/javascript">
159 jQuery(document).ready(function($) {
160 $('#reset-preset-button').on('click', function() {
161 if (confirm('저장된 버튼 프리�
162 �을 초기화하시겠습니까?')) {
163 $.ajax({
164 url: ajaxurl,
165 type: 'POST',
166 data: {
167 action: 'presslearn_delete_button_preset',
168 nonce: '<?php echo wp_create_nonce('presslearn_button_preset'); ?>'
169 },
170 success: function(response) {
171 if (response.success) {
172 alert('프리�
173 �이 초기화되었습니다.');
174 location.reload();
175 } else {
176 alert('프리�
177 � 초기화에 실패했습니다.');
178 }
179 },
180 error: function() {
181 alert('프리�
182 � 초기화 중 오류가 발생했습니다.');
183 }
184 });
185 }
186 });
187 });
188 </script>
189