Changeset 2681832
- Timestamp:
- 02/19/2022 07:44:32 PM (4 years ago)
- Location:
- custom-help/trunk
- Files:
-
- 2 added
- 4 edited
-
assets/css/custom-help-admin.css (modified) (2 diffs)
-
assets/css/custom-help-admin.min.css (added)
-
assets/scripts/custom-help-admin.js (modified) (1 diff)
-
assets/scripts/custom-help-admin.min.js (added)
-
includes/class-custom-help-admin.php (modified) (6 diffs)
-
templates/help_tab_content.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
custom-help/trunk/assets/css/custom-help-admin.css
r2681551 r2681832 80 80 display: inline-block; 81 81 background-color: #00afa4; 82 border -color: #00afa4;82 border: 1px solid rgba(0, 0, 0, .25); 83 83 color: #fff; 84 84 text-decoration: none; … … 95 95 display: block; 96 96 } 97 #custom-help-content-last-edition { 98 margin-top: 1rem; 99 font-size: .75rem; 100 opacity: .5; 101 font-style: italic; 102 } 103 #custom-help-content-last-edition[data-hidden="true"] { 104 display: none; 105 } 106 #custom-help-content-last-edition > span { 107 font-weight: bold; 108 } -
custom-help/trunk/assets/scripts/custom-help-admin.js
r2681551 r2681832 55 55 document.querySelector('#custom-help-content').innerHTML = response.data.content; 56 56 document.querySelector('#custom-help-form [name="id"]').value = response.data.id; 57 document.querySelector('#custom-help-content-last-edition').setAttribute('data-hidden', 'false'); 58 document.querySelector('#custom-help-content-last-edition span:first-of-type').innerHTML = response.data.editor; 59 document.querySelector('#custom-help-content-last-edition span:last-of-type').innerHTML = response.data.date_updated; 57 60 }).catch((error) => { 58 61 document.querySelector('#custom-help-form').setAttribute('data-loading', 'false'); -
custom-help/trunk/includes/class-custom-help-admin.php
r2681551 r2681832 16 16 17 17 public function enqueue_scripts() { 18 wp_register_script($this->name, plugin_dir_url(__FILE__) . '../assets/scripts/custom-help-admin. js', array(), $this->version, false);18 wp_register_script($this->name, plugin_dir_url(__FILE__) . '../assets/scripts/custom-help-admin.min.js', array(), $this->version, false); 19 19 wp_localize_script($this->name, $this->short_term, array( 20 20 'ajaxurl' => site_url() . '/wp-admin/admin-ajax.php', … … 25 25 26 26 public function enqueue_styles() { 27 wp_enqueue_style($this->name, plugin_dir_url(__FILE__) . '../assets/css/custom-help-admin. css', array(), $this->version, 'all');27 wp_enqueue_style($this->name, plugin_dir_url(__FILE__) . '../assets/css/custom-help-admin.min.css', array(), $this->version, 'all'); 28 28 } 29 29 … … 36 36 $content = $documentation['content']; 37 37 $content_parsed = $this->format_content($documentation['content'], $is_markdown); 38 $date_created = $documentation['date_created'];39 38 $date_updated = $documentation['date_updated']; 40 $ author = $documentation['author'];41 $editor = $documentation['editor'];39 $editor = get_user_by('id', $documentation['editor']) 40 ? get_user_by('id', $documentation['editor'])->display_name : ''; 42 41 } 43 42 ob_start(); … … 52 51 'CONTENT' => isset($content) ? $content : '', 53 52 'CONTENT_PARSED' => isset($content_parsed) ? $content_parsed : '', 54 'DATE_CREATED' => isset($date_created) ? $date_created : '', 55 'DATE_UPDATED' => isset($date_updated) ? $date_updated : '', 56 'AUTHOR' => isset($author) ? $author : '', 57 'EDITOR' => isset($editor) ? $editor : '', 53 'LAST_EDITION' => sprintf( 54 __('Last edition by <span>%s</span> at <span>%s</span>.', $this->slug), 55 isset($editor) ? $editor : '', 56 isset($date_updated) ? $date_updated : '', 57 ), 58 'HIDE_LAST_EDITION' => !isset($id) || !$id ? 'true' : 'false', 58 59 'DOCUMENTATION_NOT_FOUND' => __('No documentation found related to this page.', $this->slug), 59 60 'DOCUMENTATION_EMPTY' => __('Documentation found is empty.', $this->slug), … … 126 127 $id = isset($_POST['id']) ? sanitize_text_field($_POST['id']) : null; 127 128 $is_markdown = isset($_POST['is_markdown']) && $_POST['is_markdown'] === 'true'; 128 $content = isset($_POST['content']) ? wp_kses_post($_POST['content']) : '';129 $content = isset($_POST['content']) ? stripslashes($_POST['content']) : ''; 129 130 $params = array( 130 131 'is_markdown' => $is_markdown, … … 149 150 wp_send_json_success(array( 150 151 'content' => $this->format_content($content, $is_markdown), 151 'id' => $id ? $id : $wpdb->insert_id 152 'id' => $id ? $id : $wpdb->insert_id, 153 'date_updated' => current_time('mysql'), 154 'editor' => wp_get_current_user()->display_name 152 155 )); 153 156 } else { -
custom-help/trunk/templates/help_tab_content.php
r2681551 r2681832 62 62 <?php } ?> 63 63 </div> 64 <div id="custom-help-content-last-edition" data-hidden="<?php echo esc_attr($template_vars['HIDE_LAST_EDITION']); ?>"> 65 <?php echo wp_kses_post($template_vars['LAST_EDITION']); ?> 66 </div> 64 67 </div> 65 68 </div>
Note: See TracChangeset
for help on using the changeset viewer.