Changeset 1461229
- Timestamp:
- 07/27/2016 08:03:15 AM (9 years ago)
- Location:
- kopatheme/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
kopatheme/trunk/assets/css/widget.css
r1428092 r1461229 1053 1053 color: #999; 1054 1054 } 1055 1056 .kf-ui-gallery ul { 1057 margin: 0px; 1058 padding: 0px; 1059 } 1060 .kf-ui-gallery ul li { 1061 display: inline-block; 1062 *display: inline-block; 1063 zoom: 1; 1064 margin: 0px 6px 6px 0px; 1065 position: relative; 1066 padding: 2px; 1067 border: 1px solid #e5e5e5; 1068 background-color: #fafafa; 1069 width: 90px; 1070 height: 90px; 1071 } 1072 .kf-ui-gallery ul li:hover .kf-ui-gallery__remove { 1073 display: block; 1074 background-color: #F9A825; 1075 } 1076 .kf-ui-gallery ul li img { 1077 display: block; 1078 width: 100%; 1079 height: 100%; 1080 } 1081 .kf-ui-gallery .kf-ui-gallery__remove { 1082 display: none; 1083 position: absolute; 1084 top: 50%; 1085 right: 50%; 1086 margin-top: -12px; 1087 margin-right: -12px; 1088 width: 24px; 1089 height: 24px; 1090 line-height: 24px; 1091 border: 1px solid #F9A825; 1092 background-color: #FBC02D; 1093 color: #fff; 1094 font-size: 13px; 1095 -webkit-border-radius: 5px; 1096 -moz-border-radius: 5px; 1097 border-radius: 5px; 1098 cursor: pointer; 1099 } -
kopatheme/trunk/assets/css/widget.scss
r1428092 r1461229 1037 1037 color: #999; 1038 1038 } 1039 1040 .kf-ui-gallery{ 1041 ul{ 1042 margin: 0px; 1043 padding: 0px; 1044 li{ 1045 display: inline-block; 1046 *display: inline-block; 1047 zoom: 1; 1048 margin: 0px 6px 6px 0px; 1049 position: relative; 1050 padding: 2px; 1051 border: 1px solid #e5e5e5; 1052 background-color: #fafafa; 1053 width: 90px; 1054 height: 90px; 1055 1056 &:hover{ 1057 .kf-ui-gallery__remove{ 1058 display: block; 1059 background-color: #F9A825; 1060 } 1061 } 1062 1063 img{ 1064 display: block; 1065 width: 100%; 1066 height: 100%; 1067 } 1068 } 1069 } 1070 1071 .kf-ui-gallery__remove{ 1072 display: none; 1073 position: absolute; 1074 top: 50%; 1075 right: 50%; 1076 margin-top: -12px; 1077 margin-right: -12px; 1078 width: 24px; 1079 height: 24px; 1080 line-height: 24px; 1081 border: 1px solid #F9A825; 1082 background-color: #FBC02D; 1083 color: #fff; 1084 font-size: 13px; 1085 -webkit-border-radius: 5px; 1086 -moz-border-radius: 5px; 1087 border-radius: 5px; 1088 cursor: pointer; 1089 } 1090 1091 } -
kopatheme/trunk/assets/js/custom-advanced-fields.js
r1353276 r1461229 3 3 4 4 /* gallery */ 5 var FK_Gallery, kf_gallery_iframe, kf_gallery_button;5 var KF_UI_Gallery, kf_gallery_iframe, kf_gallery_button; 6 6 kf_gallery_iframe = ''; 7 7 kf_gallery_button = ''; … … 15 15 KF_Datetime_Js.init_field_datetime(); 16 16 17 FK_Gallery.init();17 KF_UI_Gallery.init(); 18 18 19 19 KF_Icon_Picker.init(); … … 23 23 KF_Datetime_Js.init_field_datetime(); 24 24 25 FK_Gallery.init();25 KF_UI_Gallery.init(); 26 26 27 27 KF_Icon_Picker.init(); … … 61 61 }; 62 62 63 FK_Gallery = {63 KF_UI_Gallery = { 64 64 init: function() { 65 65 jQuery('.kopa-framework-gallery-box').on('click', '.kopa-framework-gallery-config', function(event) { -
kopatheme/trunk/assets/js/custom-advanced-fields.min.js
r1353276 r1461229 1 /* datetime */ 2 var KF_Datetime_Js; 3 4 /* gallery */ 5 var FK_Gallery, kf_gallery_iframe, kf_gallery_button; 6 kf_gallery_iframe = ''; 7 kf_gallery_button = ''; 8 9 /* icon picker */ 10 var KF_Icon_Picker; 1 var KF_Icon_Picker, KF_Datetime_Js, KF_UI_Gallery, kf_gallery_iframe, kf_gallery_button; 2 3 var kf_gallery_sortable_uploader; 4 var kf_gallery_iframe; 5 var kf_gallery_button; 11 6 var kf_lighbox_icons_id = '#kf_advanced_field_lighbox_icons'; 12 7 13 14 jQuery(document).ready(function() { 15 KF_Datetime_Js.init_field_datetime(); 16 17 FK_Gallery.init(); 18 19 KF_Icon_Picker.init(); 8 jQuery( document ).ready( function() { 9 KF_UI.init(); 20 10 }); 21 11 22 jQuery(document).ajaxSuccess(function() { 23 KF_Datetime_Js.init_field_datetime(); 24 25 FK_Gallery.init(); 26 27 KF_Icon_Picker.init(); 12 jQuery( document ).ajaxSuccess( function() { 13 KF_UI.init(); 28 14 }); 29 15 30 KF_Datetime_Js = { 16 var KF_UI = { 17 init: function (){ 18 KF_Datetime_Js.init_field_datetime(); 19 KF_UI_Gallery.init(); 20 KF_UI_Gallery_Sortable.init(); 21 KF_Icon_Picker.init(); 22 } 23 } 24 25 var KF_Datetime_Js = { 31 26 init_field_datetime: function() { 32 27 if (jQuery('.kopa-framework-datetime').length > 0) { … … 61 56 }; 62 57 63 FK_Gallery = {58 var KF_UI_Gallery = { 64 59 init: function() { 65 60 jQuery('.kopa-framework-gallery-box').on('click', '.kopa-framework-gallery-config', function(event) { … … 112 107 }; 113 108 114 KF_Icon_Picker = {109 var KF_Icon_Picker = { 115 110 init: function() { 116 /*if (jQuery('.upside-icon-picker-select').length > 0) {117 jQuery('.upside-icon-picker-select').change(function(event){118 var btn = jQuery(this);119 var icon = btn.val();120 console.log(icon);121 btn.parent().find('.upside-icon-picker-preview i').attr('class', icon);122 });123 }*/124 125 111 if (jQuery('.kf-icon-picker').length > 0) { 126 112 jQuery('.kf-icon-picker').click(function(event) { … … 201 187 } 202 188 }; 189 190 var KF_UI_Gallery_Sortable = { 191 init: function() { 192 $galleries = jQuery( 'div.kf-ui-gallery' ); 193 if( $galleries.length ) { 194 195 $galleries.map( function( $gallery ) { 196 KF_UI_Gallery_Sortable._init_sortable( jQuery(this).find('ul').first() ); 197 } ); 198 199 $galleries.on( 'click', '.kf-ui-gallery__upload', function( $event ) { 200 KF_UI_Gallery_Sortable._edit( $event, jQuery(this) ); 201 } ); 202 203 $galleries.on( 'click', '.kf-ui-gallery__remove', function( $event ) { 204 KF_UI_Gallery_Sortable._remove( $event, jQuery(this) ); 205 } ); 206 } 207 }, 208 _edit: function( $event, $button ) { 209 $event.preventDefault(); 210 211 $wrap = $button.parents('.kf-ui-gallery'); 212 $sortable = $wrap.find( 'ul' ).first(); 213 $inputs = $wrap.find( 'input[type="hidden"]' ); 214 $previews = $wrap.find( 'img' ); 215 $gallery_name = $wrap.attr( 'data-name' ); 216 217 if (kf_gallery_sortable_uploader) { 218 kf_gallery_sortable_uploader.open(); 219 return; 220 } 221 222 kf_gallery_sortable_uploader = wp.media.frames.kf_gallery_sortable_uploader = wp.media({ 223 title: 'Uploader', 224 $button: { 225 text: 'Select' 226 }, 227 library: { type: 'image' }, 228 multiple: true 229 }); 230 231 kf_gallery_sortable_uploader.on( 'open', function() { 232 233 if( $inputs.length ) { 234 235 selection = kf_gallery_sortable_uploader.state().get('selection'); 236 jQuery.each( $inputs, function(){ 237 var attachment = wp.media.attachment( parseInt( jQuery(this).val() ) ); 238 attachment.fetch(); 239 selection.add( attachment ); 240 } ); 241 242 } 243 }); 244 245 kf_gallery_sortable_uploader.on( 'select', function() { 246 247 var $results = []; 248 var selection = kf_gallery_sortable_uploader.state().get('selection'); 249 250 selection.map( function( $attachment ) { 251 $attachment = $attachment.toJSON(); 252 $results.push( [ $attachment.id, $attachment.sizes.thumbnail.url] ); 253 }); 254 console.log($results); 255 if ( $results.length ) { 256 $sortable.html( '' ); 257 258 $results.map( function( $image ) { 259 $html = KF_UI_Gallery_Sortable._build_single( $gallery_name, $image[0], $image[1] ); 260 $sortable.append( jQuery( $html ) ); 261 } ); 262 } 263 264 }); 265 266 kf_gallery_sortable_uploader.open(); 267 }, 268 _remove: function( $event, $button ) { 269 $event.preventDefault(); 270 $button.closest('.kf-ui-gallery__image').remove(); 271 }, 272 _build_single: function( $gallery_name, $image_id, $image_src ){ 273 274 $html = '<li class="kf-ui-gallery__image">'; 275 $html += '<input type="hidden" value="' + $image_id + '" name="' + $gallery_name + '[]">'; 276 $html += '<img alt="" src="' + $image_src + '">'; 277 $html += '<span class="kf-ui-gallery__remove dashicons dashicons-trash">'; 278 $html += '</span>'; 279 $html += '</li>'; 280 281 return $html; 282 }, 283 _init_sortable: function( $sortable ) { 284 $sortable.sortable({ 285 containment: 'parent' 286 }); 287 $sortable.disableSelection(); 288 } 289 } -
kopatheme/trunk/includes/admin/class-kopa-admin-assets.php
r1353276 r1461229 52 52 wp_register_style( 'kopa_widget', KF()->framework_url() . '/assets/css/widget.css', array(), KOPA_FRAMEWORK_VERSION ); 53 53 54 // Advanced field 55 $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false); 56 if ( $advanced_field ) { 57 wp_register_style( 'kopa_datetimepicker', KF()->framework_url() . '/assets/css/jquery.datetimepicker.css', array(), KOPA_FRAMEWORK_VERSION ); 58 wp_register_style( 'kopa_font_flaticon', KF()->framework_url() . '/assets/css/flaticon.css', array(), KOPA_FRAMEWORK_VERSION ); 59 60 wp_register_style('kopa_jquery_ui', KF()->framework_url() . "/assets/css/jquery-ui/jquery-ui.css", array(), NULL); 61 wp_register_style('kopa_jquery_ui_structure', KF()->framework_url() . "/assets/css/jquery-ui/jquery-ui.structure.css", array(), NULL); 62 wp_register_style('kopa_jquery_ui_theme', KF()->framework_url() . "/assets/css/jquery-ui/jquery-ui.theme.css", array(), NULL); 63 } 64 54 // Advanced field 55 $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false); 56 if ( $advanced_field ) { 57 wp_register_style( 'kopa_datetimepicker', KF()->framework_url() . '/assets/css/jquery.datetimepicker.css', array(), KOPA_FRAMEWORK_VERSION ); 58 wp_register_style( 'kopa_font_flaticon', KF()->framework_url() . '/assets/css/flaticon.css', array(), KOPA_FRAMEWORK_VERSION ); 59 } 65 60 66 61 if(in_array($hook, array('widgets.php', 'post.php', 'post-new.php'))){ 67 62 wp_enqueue_style( 'kopa_widget' ); 68 if ( $advanced_field ) { 69 wp_enqueue_style( 'kopa_datetimepicker' ); 70 wp_enqueue_style( 'kopa_font_awesome' ); 71 wp_enqueue_style( 'kopa_font_flaticon' ); 72 wp_enqueue_style( 'kopa_jquery_ui' ); 73 wp_enqueue_style( 'kopa_jquery_ui_structure' ); 74 wp_enqueue_style( 'kopa_jquery_ui_theme' ); 75 wp_enqueue_script('jquery-ui-core'); 76 wp_enqueue_script('jquery-ui-dialog'); 77 wp_enqueue_script('jquery-ui-position'); 78 wp_enqueue_script('jquery-ui-droppable'); 79 wp_enqueue_script('jquery-ui-draggable'); 80 } 63 if ( $advanced_field ) { 64 wp_enqueue_style( 'kopa_datetimepicker' ); 65 wp_enqueue_style( 'kopa_font_awesome' ); 66 wp_enqueue_style( 'kopa_font_flaticon' ); 67 wp_enqueue_style( 'kopa_jquery_ui' ); 68 wp_enqueue_style( 'kopa_jquery_ui_structure' ); 69 wp_enqueue_style( 'kopa_jquery_ui_theme' ); 70 71 wp_enqueue_script( 'jquery-ui-core' ); 72 wp_enqueue_script( 'jquery-ui-dialog' ); 73 wp_enqueue_script( 'jquery-ui-position' ); 74 wp_enqueue_script( 'jquery-ui-droppable' ); 75 wp_enqueue_script( 'jquery-ui-draggable' ); 76 } 81 77 } 82 78 … … 102 98 global $wp_query, $post; 103 99 104 $screen = get_current_screen(); 105 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 106 // $suffix = false ? '' : '.min'; 100 $screen = get_current_screen(); 101 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 107 102 108 103 // Register scripts … … 118 113 wp_register_script( 'kopa_media_uploader', KF()->framework_url() . '/assets/js/media-uploader'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION ); 119 114 120 121 122 123 124 125 126 127 115 // script for advanced fields 116 $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false); 117 if ( $advanced_field ) { 118 wp_register_script( 'kopa_datetimepicker', KF()->framework_url() . '/assets/js/jquery.datetimepicker'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION ); 119 wp_register_script( 'kopa_custom_advanced_fields', KF()->framework_url() . '/assets/js/custom-advanced-fields'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION ); 120 wp_register_script( 'kopa_custom_advanced_fields_gallery', KF()->framework_url() . '/assets/js/gallery'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION ); 121 wp_register_script( 'kopa_custom_advanced_fields_icon_picker', KF()->framework_url() . '/assets/js/icon_picker'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION ); 122 } 128 123 129 124 // KopaFramework admin pages -
kopatheme/trunk/includes/admin/class-kopa-admin-meta-box.php
r1456755 r1461229 15 15 if ( ! class_exists( 'Kopa_Admin_Meta_Box' ) ) { 16 16 17 /**18 * Kopa_Admin_Meta_Box Class19 */20 class Kopa_Admin_Meta_Box {21 22 17 /** 23 * @access private 24 * @var array meta boxes settings 18 * Kopa_Admin_Meta_Box Class 25 19 */ 26 private $settings = array(); 27 28 /** 29 * Constructor 30 * 31 * @since 1.0.5 32 * @access public 33 */ 34 public function __construct( $settings ) { 35 $this->settings = $settings; 36 37 add_action( 'admin_enqueue_scripts', array( $this, 'meta_box_scripts' ) ); 38 add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); 39 add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 ); 40 } 41 42 /** 43 * Metabox scripts 44 * 45 * @since 1.0.5 46 * @access public 47 */ 48 public function meta_box_scripts() { 49 $screen = get_current_screen(); 50 $metabox = $this->settings; 51 52 if ( in_array( $screen->id, (array) $metabox['pages'] ) ) { 53 wp_enqueue_script( 'kopa_media_uploader' ); 20 class Kopa_Admin_Meta_Box { 21 22 /** 23 * @access private 24 * @var array meta boxes settings 25 */ 26 private $settings = array(); 27 28 /** 29 * Constructor 30 * 31 * @since 1.0.5 32 * @access public 33 */ 34 public function __construct( $settings ) { 35 $this->settings = $settings; 36 37 add_action( 'admin_enqueue_scripts', array( $this, 'meta_box_scripts' ) ); 38 add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); 39 add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 ); 54 40 } 55 } 56 57 /** 58 * Add metaboxes 59 * 60 * @since 1.0.5 61 * @access public 62 */ 63 public function add_meta_boxes() { 64 $metabox = $this->settings; 65 66 foreach ( (array) $metabox['pages'] as $page ) { 67 add_meta_box( $metabox['id'], $metabox['title'], array( $this, 'output' ), $page, $metabox['context'], $metabox['priority'], $metabox['fields'] ); 68 } 69 } 70 71 /** 72 * Check if we're saving, the trigger an action based on the post type 73 * 74 * @param int $post_id 75 * @param object $post 76 * 77 * @since 1.0.5 78 * @access public 79 */ 80 public function save_meta_boxes( $post_id, $post ) { 81 $metabox = $this->settings; 82 83 /* don't save if $_POST is empty */ 84 if ( empty( $_POST ) ) 85 return $post_id; 86 87 /* don't save during autosave */ 88 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 89 return $post_id; 90 91 /* verify nonce */ 92 if ( ! isset( $_POST[ $metabox['id'] . '_nonce'] ) || ! wp_verify_nonce( $_POST[ $metabox['id'] . '_nonce'], $metabox['id'] ) ) 93 return $post_id; 94 95 /* check permissions */ 96 if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { 97 if ( ! current_user_can( 'edit_page', $post_id ) ) 98 return $post_id; 99 } else { 100 if ( ! current_user_can( 'edit_post', $post_id ) ) 101 return $post_id; 102 } 103 104 // Options to update will be stored here 105 $update_options = array(); 106 107 foreach ( $metabox['fields'] as $value ) { 108 if ( ! isset( $value['id'] ) ) { 109 continue; 110 } 111 112 $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; 113 114 // Get the option name 115 $option_value = null; 116 117 if ( isset( $_POST[ $value['id'] ] ) ) { 118 $option_value = $_POST[ $value['id'] ]; 119 } 120 121 // For a value to be submitted to database it must pass through a sanitization filter 122 if ( has_filter( 'kopa_sanitize_option_' . $type ) ) { 123 $option_value = apply_filters( 'kopa_sanitize_option_' . $type, $option_value, $value ); 124 } 125 126 if ( ! is_null( $option_value ) ) { 127 $update_options[ $value['id'] ] = $option_value; 41 42 /** 43 * Metabox scripts 44 * 45 * @since 1.0.5 46 * @access public 47 */ 48 public function meta_box_scripts() { 49 $screen = get_current_screen(); 50 $metabox = $this->settings; 51 52 if ( in_array( $screen->id, (array) $metabox['pages'] ) ) { 53 wp_enqueue_script( 'kopa_media_uploader' ); 128 54 } 129 55 } 130 56 131 // Now save the options 132 foreach( $update_options as $name => $value ) { 133 update_post_meta( $post_id, $name, $value ); 134 } 135 136 do_action( sprintf( 'kf_%s_saved', $metabox['id'] ), $post_id, $post ); 137 138 return true; 139 } 140 141 /** 142 * Output meta box fields 143 * 144 * @since 1.0.5 145 * @access public 146 */ 147 public function output( $post, $args ) { 148 $metabox = $this->settings; 149 150 $option_wrap_start = ''; 151 $option_wrap_end = ''; 152 $output = ''; 153 154 $output .= '<div class="kopa-metabox-wrapper">'; 155 156 /* Use nonce for verification */ 157 $output .= '<input type="hidden" name="' . $metabox['id'] . '_nonce" value="' . wp_create_nonce( $metabox['id'] ) . '">'; 158 159 /* meta box description */ 160 if ( isset( $metabox['desc'] ) && ! empty( $metabox['desc'] ) ) { 161 $allowed_tags = array( 162 'abbr' => array( 'title' => true ), 163 'acronym' => array( 'title' => true ), 164 'code' => true, 165 'em' => true, 166 'strong' => true, 167 'a' => array( 168 'href' => true, 169 'title' => true, 170 ), 171 ); 172 $metabox['desc'] = wp_kses( $metabox['desc'], $allowed_tags ); 173 $output .= '<p>' . $metabox['desc'] . '</p>'; 174 } 175 176 $_loop_index = 0; 177 178 foreach ( $metabox['fields'] as $value ) { 179 180 if ( ! isset( $value['type'] ) ) continue; 181 182 $value = Kopa_Admin_Settings::sanitize_option_arguments( $value ); 183 184 $option_wrap_start = '<p>'; 185 if ( $value['title'] ) { 186 $option_wrap_start .= '<strong>'.esc_html( $value['title'] ).'</strong>'; 187 $option_wrap_start .= '<br>'; 57 /** 58 * Add metaboxes 59 * 60 * @since 1.0.5 61 * @access public 62 */ 63 public function add_meta_boxes() { 64 $metabox = $this->settings; 65 66 foreach ( (array) $metabox['pages'] as $page ) { 67 add_meta_box( $metabox['id'], $metabox['title'], array( $this, 'output' ), $page, $metabox['context'], $metabox['priority'], $metabox['fields'] ); 68 } 69 } 70 71 /** 72 * Check if we're saving, the trigger an action based on the post type 73 * 74 * @param int $post_id 75 * @param object $post 76 * 77 * @since 1.0.5 78 * @access public 79 */ 80 public function save_meta_boxes( $post_id, $post ) { 81 $metabox = $this->settings; 82 83 /* don't save if $_POST is empty */ 84 if ( empty( $_POST ) ) 85 return $post_id; 86 87 /* don't save during autosave */ 88 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 89 return $post_id; 90 91 /* verify nonce */ 92 if ( ! isset( $_POST[ $metabox['id'] . '_nonce'] ) || ! wp_verify_nonce( $_POST[ $metabox['id'] . '_nonce'], $metabox['id'] ) ) 93 return $post_id; 94 95 /* check permissions */ 96 if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { 97 if ( ! current_user_can( 'edit_page', $post_id ) ) 98 return $post_id; 99 } else { 100 if ( ! current_user_can( 'edit_post', $post_id ) ) 101 return $post_id; 188 102 } 189 if ( $value['desc'] ) { 190 $option_wrap_start .= '<span>'.$value['desc'].'</span>'; 191 $option_wrap_start .= '<br>'; 103 104 // Options to update will be stored here 105 $update_options = array(); 106 107 foreach ( $metabox['fields'] as $value ) { 108 if ( ! isset( $value['id'] ) ) { 109 continue; 110 } 111 112 $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; 113 114 // Get the option name 115 $option_value = null; 116 117 if ( isset( $_POST[ $value['id'] ] ) ) { 118 $option_value = $_POST[ $value['id'] ]; 119 } 120 121 // For a value to be submitted to database it must pass through a sanitization filter 122 if ( has_filter( 'kopa_sanitize_option_' . $type ) ) { 123 $option_value = apply_filters( 'kopa_sanitize_option_' . $type, $option_value, $value ); 124 } 125 126 if ( ! is_null( $option_value ) ) { 127 $update_options[ $value['id'] ] = $option_value; 128 } 192 129 } 193 130 194 $option_wrap_end = '</p>'; 195 196 $option_wrap_start = apply_filters('kopa_admin_meta_box_wrap_start', $option_wrap_start, $value, $_loop_index); 197 $option_wrap_end = apply_filters('kopa_admin_meta_box_wrap_end', $option_wrap_end, $value, $_loop_index); 198 199 // get option value 200 $option_value = get_post_meta( $post->ID, $value['id'] ); 201 202 $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false); 203 204 if ( empty( $option_value ) ) { 205 $option_value = $value['default']; 206 } elseif ( isset( $option_value[0] ) ) { 207 $option_value = $option_value[0]; 208 } else { 209 $option_value = ''; 210 } 211 212 switch( $value['type'] ) { 213 case 'text': 214 case 'email': 215 case 'number': 216 case 'password': 217 case 'url': 218 if ( $value['type'] != 'password' ) { 219 $value['type'] = 'text'; 220 } 221 $class = 'large-text'; 222 if( isset( $value['class'] ) && !empty( $value['class'] )){ 223 $class = esc_attr( $value['class'] ); 224 } 225 226 $output .= $option_wrap_start; 227 $output .= '<input 228 class="' . esc_attr( $class ) . '" 229 type="'.esc_attr( $value['type'] ).'" 230 name="'.esc_attr( $value['id'] ).'" 231 id="'.esc_attr( $value['id'] ).'" 232 value="'.esc_attr( $option_value ).'">'; 233 $output .= $option_wrap_end; 234 break; 235 236 case 'textarea': 237 $value = wp_parse_args( $value, array( 238 'rows' => '', 239 ) ); 240 241 $output .= $option_wrap_start; 242 $output .= '<textarea 243 class="large-text" 244 rows="'.esc_attr( $value['rows'] ).'" 245 name="'.esc_attr( $value['id'] ).'" 246 id="'.esc_attr( $value['id'] ).'">'. 247 esc_textarea( $option_value ). 248 '</textarea>'; 249 $output .= $option_wrap_end; 250 break; 251 252 case 'select': 253 case 'multiselect': 254 $value = wp_parse_args( $value, array( 255 'size' => '', 256 ) ); 257 258 $output .= $option_wrap_start; 259 260 $output .= '<select 261 class="large-text widefat" 262 size="'.esc_attr( $value['size'] ).'" 263 name="'.esc_attr( $value['id'] ).( 'multiselect' === $value['type'] ? '[]' : '' ).'" 264 id="'.esc_attr( $value['id'] ).'"'. 265 ( 'multiselect' === $value['type'] ? ' multiple="multiple"' : '' ). 266 '>'; 267 268 foreach ( $value['options'] as $key => $val ) { 269 $output .= '<option value="'.esc_attr( $key ).'" '; 270 if ( is_array( $option_value ) ) { 271 $output .= selected( in_array( $key, $option_value ), true, false ); 272 } else { 273 $output .= selected( $key, $option_value, false ); 131 // Now save the options 132 foreach( $update_options as $name => $value ) { 133 update_post_meta( $post_id, $name, $value ); 134 } 135 136 do_action( sprintf( 'kf_%s_saved', $metabox['id'] ), $post_id, $post ); 137 138 return true; 139 } 140 141 /** 142 * Output meta box fields 143 * 144 * @since 1.0.5 145 * @access public 146 */ 147 public function output( $post, $args ) { 148 $metabox = $this->settings; 149 150 $option_wrap_start = ''; 151 $option_wrap_end = ''; 152 $output = ''; 153 154 $output .= '<div class="kopa-metabox-wrapper">'; 155 156 /* Use nonce for verification */ 157 $output .= '<input type="hidden" name="' . $metabox['id'] . '_nonce" value="' . wp_create_nonce( $metabox['id'] ) . '">'; 158 159 /* meta box description */ 160 if ( isset( $metabox['desc'] ) && ! empty( $metabox['desc'] ) ) { 161 $allowed_tags = array( 162 'abbr' => array( 'title' => true ), 163 'acronym' => array( 'title' => true ), 164 'code' => true, 165 'em' => true, 166 'strong' => true, 167 'a' => array( 168 'href' => true, 169 'title' => true, 170 ), 171 ); 172 $metabox['desc'] = wp_kses( $metabox['desc'], $allowed_tags ); 173 $output .= '<p>' . $metabox['desc'] . '</p>'; 174 } 175 176 $_loop_index = 0; 177 178 foreach ( $metabox['fields'] as $value ) { 179 180 if ( ! isset( $value['type'] ) ) continue; 181 182 $value = Kopa_Admin_Settings::sanitize_option_arguments( $value ); 183 184 $option_wrap_start = '<p>'; 185 if ( $value['title'] ) { 186 $option_wrap_start .= '<strong>'.esc_html( $value['title'] ).'</strong>'; 187 $option_wrap_start .= '<br>'; 188 } 189 if ( $value['desc'] ) { 190 $option_wrap_start .= '<span>'.$value['desc'].'</span>'; 191 $option_wrap_start .= '<br>'; 192 } 193 194 $option_wrap_end = '</p>'; 195 196 $option_wrap_start = apply_filters('kopa_admin_meta_box_wrap_start', $option_wrap_start, $value, $_loop_index); 197 $option_wrap_end = apply_filters('kopa_admin_meta_box_wrap_end', $option_wrap_end, $value, $_loop_index); 198 199 // get option value 200 $option_value = get_post_meta( $post->ID, $value['id'] ); 201 202 $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false); 203 204 if ( empty( $option_value ) ) { 205 $option_value = $value['default']; 206 } elseif ( isset( $option_value[0] ) ) { 207 $option_value = $option_value[0]; 208 } else { 209 $option_value = ''; 210 } 211 212 switch( $value['type'] ) { 213 case 'text': 214 case 'email': 215 case 'number': 216 case 'password': 217 case 'url': 218 if ( $value['type'] != 'password' ) { 219 $value['type'] = 'text'; 220 } 221 $class = 'large-text'; 222 if( isset( $value['class'] ) && !empty( $value['class'] )){ 223 $class = esc_attr( $value['class'] ); 224 } 225 226 $output .= $option_wrap_start; 227 $output .= '<input 228 class="' . esc_attr( $class ) . '" 229 type="'.esc_attr( $value['type'] ).'" 230 name="'.esc_attr( $value['id'] ).'" 231 id="'.esc_attr( $value['id'] ).'" 232 value="'.esc_attr( $option_value ).'">'; 233 $output .= $option_wrap_end; 234 break; 235 236 case 'textarea': 237 $value = wp_parse_args( $value, array( 238 'rows' => '', 239 ) ); 240 241 $output .= $option_wrap_start; 242 $output .= '<textarea 243 class="large-text" 244 rows="'.esc_attr( $value['rows'] ).'" 245 name="'.esc_attr( $value['id'] ).'" 246 id="'.esc_attr( $value['id'] ).'">'. 247 esc_textarea( $option_value ). 248 '</textarea>'; 249 $output .= $option_wrap_end; 250 break; 251 252 case 'select': 253 case 'multiselect': 254 $value = wp_parse_args( $value, array( 255 'size' => '', 256 ) ); 257 258 $output .= $option_wrap_start; 259 260 $output .= '<select 261 class="large-text widefat" 262 size="'.esc_attr( $value['size'] ).'" 263 name="'.esc_attr( $value['id'] ).( 'multiselect' === $value['type'] ? '[]' : '' ).'" 264 id="'.esc_attr( $value['id'] ).'"'. 265 ( 'multiselect' === $value['type'] ? ' multiple="multiple"' : '' ). 266 '>'; 267 268 foreach ( $value['options'] as $key => $val ) { 269 $output .= '<option value="'.esc_attr( $key ).'" '; 270 if ( is_array( $option_value ) ) { 271 $output .= selected( in_array( $key, $option_value ), true, false ); 272 } else { 273 $output .= selected( $key, $option_value, false ); 274 } 275 $output .= '>'.esc_html( $val ).'</option>'; 274 276 } 275 $output .= '>'.esc_html( $val ).'</option>'; 276 } 277 278 $output .= '</select>'; 279 280 $output .= $option_wrap_end; 281 break; 282 283 case 'checkbox': 284 $value = wp_parse_args( $value, array( 285 'label' => '', 286 ) ); 287 288 if ( ! isset( $value['checkboxgroup'] ) || 289 ( isset( $value['checkboxgroup'] ) && 'start' == $value['checkboxgroup'] ) ) { 290 $output .= $option_wrap_start; 291 } 292 293 $output .= '<label>'; 294 $output .= '<input 295 type="'.esc_attr( $value['type'] ).'" 296 name="'.esc_attr( $value['id'] ) .'" 297 id="'.esc_attr( $value['id'] ).'" value="1"'. 298 ( checked( $option_value, 1, false ) ). 299 '>'; 300 $output .= ' '.esc_html( $value['label'] ).'</label>'; 301 $output .= '<br>'; 302 303 if ( ! isset( $value['checkboxgroup'] ) || 304 ( isset( $value['checkboxgroup'] ) && 'end' == $value['checkboxgroup'] ) ) { 277 278 $output .= '</select>'; 279 305 280 $output .= $option_wrap_end; 306 } 307 break; 308 309 case 'multicheck': 310 $output .= $option_wrap_start; 311 312 foreach ( $value['options'] as $key => $val ) { 313 $name = $value['id'].'['.$key.']'; 314 $checked = isset( $option_value[ $key ] ) ? checked( $option_value[ $key ], 1, false ) : ''; 315 316 $output .= '<label>'; 317 $output .= '<input 318 type="checkbox" 319 name="'.esc_attr( $name ).'" 320 id="'.esc_attr( $value['id'] ).'" 321 value="1" '.$checked. 322 '>'; 323 $output .= ' '.esc_html( $val ).'</label>'; 324 $output .= '<br>'; 325 } 326 327 $output .= $option_wrap_end; 328 break; 329 330 case 'radio': 331 $output .= $option_wrap_start; 332 333 foreach ( $value['options'] as $key => $val ) { 281 break; 282 283 case 'checkbox': 284 $value = wp_parse_args( $value, array( 285 'label' => '', 286 ) ); 287 288 if ( ! isset( $value['checkboxgroup'] ) || 289 ( isset( $value['checkboxgroup'] ) && 'start' == $value['checkboxgroup'] ) ) { 290 $output .= $option_wrap_start; 291 } 292 334 293 $output .= '<label>'; 335 294 $output .= '<input 336 295 type="'.esc_attr( $value['type'] ).'" 296 name="'.esc_attr( $value['id'] ) .'" 297 id="'.esc_attr( $value['id'] ).'" value="1"'. 298 ( checked( $option_value, 1, false ) ). 299 '>'; 300 $output .= ' '.esc_html( $value['label'] ).'</label>'; 301 $output .= '<br>'; 302 303 if ( ! isset( $value['checkboxgroup'] ) || 304 ( isset( $value['checkboxgroup'] ) && 'end' == $value['checkboxgroup'] ) ) { 305 $output .= $option_wrap_end; 306 } 307 break; 308 309 case 'multicheck': 310 $output .= $option_wrap_start; 311 312 foreach ( $value['options'] as $key => $val ) { 313 $name = $value['id'].'['.$key.']'; 314 $checked = isset( $option_value[ $key ] ) ? checked( $option_value[ $key ], 1, false ) : ''; 315 316 $output .= '<label>'; 317 $output .= '<input 318 type="checkbox" 319 name="'.esc_attr( $name ).'" 320 id="'.esc_attr( $value['id'] ).'" 321 value="1" '.$checked. 322 '>'; 323 $output .= ' '.esc_html( $val ).'</label>'; 324 $output .= '<br>'; 325 } 326 327 $output .= $option_wrap_end; 328 break; 329 330 case 'radio': 331 $output .= $option_wrap_start; 332 333 foreach ( $value['options'] as $key => $val ) { 334 $output .= '<label>'; 335 $output .= '<input 336 type="'.esc_attr( $value['type'] ).'" 337 name="'.esc_attr( $value['id'] ).'" 338 id="'.esc_attr( $value['id'].'_'.$key ).'" 339 value="'.esc_attr( $key ).'" '. 340 checked( $key, $option_value, false ).'>'; 341 $output .= ' '.esc_html( $val ).'</label>'; 342 $output .= '<br>'; 343 } 344 345 $output .= $option_wrap_end; 346 break; 347 348 case 'upload': 349 // make sure mimes key is set 350 $value = wp_parse_args( $value, array( 351 'mimes' => '', 352 ) ); 353 354 $output .= '<div class="kopa_section">'; 355 $output .= $option_wrap_start; 356 357 $output .= '<input type="text" 358 class="large-text kopa_upload" 337 359 name="'.esc_attr( $value['id'] ).'" 338 id="'.esc_attr( $value['id'] .'_'.$key).'"339 value="'.esc_attr( $ key ).'" '.340 checked( $key, $option_value, false ).'>';341 $output .= ' '.esc_html( $val ).'</label>'; 360 id="'.esc_attr( $value['id'] ).'" 361 value="'.esc_attr( $option_value ).'" 362 data-type="'.esc_attr( $value['mimes'] ).'">'; 363 342 364 $output .= '<br>'; 343 } 344 345 $output .= $option_wrap_end; 346 break; 347 348 case 'upload': 349 // make sure mimes key is set 350 $value = wp_parse_args( $value, array( 351 'mimes' => '', 352 ) ); 353 354 $output .= '<div class="kopa_section">'; 355 $output .= $option_wrap_start; 356 357 $output .= '<input type="text" 358 class="large-text kopa_upload" 359 name="'.esc_attr( $value['id'] ).'" 360 id="'.esc_attr( $value['id'] ).'" 361 value="'.esc_attr( $option_value ).'" 362 data-type="'.esc_attr( $value['mimes'] ).'">'; 363 364 $output .= '<br>'; 365 366 if ( function_exists( 'wp_enqueue_media' ) ) { 367 if ( $option_value == '' ) { 368 $output .= '<a style="margin-top: 3px" class="kopa_upload_button button">'.esc_html__( 'Upload', 'kopa-framework' ).'</a>'; 365 366 if ( function_exists( 'wp_enqueue_media' ) ) { 367 if ( $option_value == '' ) { 368 $output .= '<a style="margin-top: 3px" class="kopa_upload_button button">'.esc_html__( 'Upload', 'kopa-framework' ).'</a>'; 369 } else { 370 $output .= '<a style="margin-top: 3px" class="kopa_remove_file button">'.esc_html__( 'Remove', 'kopa-framework' ).'</a>'; 371 } 369 372 } else { 370 $output .= '< a style="margin-top: 3px" class="kopa_remove_file button">'.esc_html__( 'Remove', 'kopa-framework' ).'</a>';373 $output .= '<small class="kopa_upload_notice">'.esc_html__( 'Upgrade your version of WordPress for full media support.', 'kopa-framework' ).'</small>'; 371 374 } 372 } else { 373 $output .= '<small class="kopa_upload_notice">'.esc_html__( 'Upgrade your version of WordPress for full media support.', 'kopa-framework' ).'</small>'; 374 } 375 $output .= $option_wrap_end; 376 377 $output .= '<p class="kopa_screenshot">'; 378 379 if ( $option_value ) { 380 $remove = '<a class="button kopa_remove_image">'.esc_html__( 'Remove', 'kopa-framework' ).'</a>'; 381 $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $option_value ); 382 if ( $image ) { 383 $output .= '<img style="max-width: 300px" src="' . esc_attr( $option_value ) . '" alt=""><br>' . $remove; 375 $output .= $option_wrap_end; 376 377 $output .= '<p class="kopa_screenshot">'; 378 379 if ( $option_value ) { 380 $remove = '<a class="button kopa_remove_image">'.esc_html__( 'Remove', 'kopa-framework' ).'</a>'; 381 $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $option_value ); 382 if ( $image ) { 383 $output .= '<img style="max-width: 300px" src="' . esc_attr( $option_value ) . '" alt=""><br>' . $remove; 384 } 384 385 } 385 } 386 387 $output .= '</p>'; 388 $output .= '</div>'; 389 break; 390 391 case 'datetime': 392 if ( $advanced_field ) { 393 $date_value_time = ''; 394 if ( isset($value['format']) && ! empty($option_value) && is_numeric($option_value) ) { 395 $date_value_time = date($value['format'],$option_value); 396 } else { 397 $date_value_time = $option_value; 398 } 399 if ( ! isset($value['timepicker']) || empty($value['timepicker']) ) { 400 $value['timepicker'] = "0"; 401 } 402 if ( ! isset($value['datepicker']) || empty($value['datepicker']) ) { 403 $value['datepicker'] = "0"; 404 } 405 406 $output .= $option_wrap_start; 407 $output .= '<input 408 class="medium-text kopa-framework-datetime" 409 type="'.esc_attr( $value['type'] ).'" 410 name="'.esc_attr( $value['id'] ).'" 411 id="'.esc_attr( $value['id'] ).'" 412 value="'. esc_attr( $date_value_time ).'" 413 data-timepicker="' . esc_attr($value['timepicker']) . '" 414 data-datepicker="' . esc_attr($value['datepicker']) . '" 415 data-format="' . wp_kses_post($value['format']) . '" 416 autocomplete="off">'; 417 $output .= $option_wrap_end; 418 } 419 420 break; 421 422 case 'gallery': 423 if ( $advanced_field ) { 424 $output .= $option_wrap_start; 425 $output .= '<div class="kopa-framework-gallery-box">'; 426 $output .= '<input 427 class="medium-text kopa-framework-gallery" 428 type="text" 429 name="'.esc_attr( $value['id'] ).'" 430 id="'.esc_attr( $value['id'] ).'" 431 value="'.esc_attr( $option_value ).'" 432 autocomplete="off">'; 433 434 $output .= ' 435 <a href="#" class="kopa-framework-gallery-config button button-secondary"> 436 ' . esc_html__('Config', 'kopa-framework') . ' 437 </a> 438 '; 439 $output .= '</div>'; 440 $output .= $option_wrap_end; 441 } 442 break; 443 case 'icon': 444 if ( $advanced_field ) { 445 $output .= $option_wrap_start; 446 $output .= '<div class="kf-row">'; 447 $output .= '<div class="kf-col-xs-12">'; 448 $output .= '<a class="kf-icon-picker" href="#">' . esc_html__('Select icon', 'kopa-framework') . '</a>'; 449 $output .= ' 450 <input type="hidden" 451 name="'.esc_attr( $value['id'] ).'" 452 id="'.esc_attr( $value['id'] ).'" 453 value="'.esc_attr( $option_value ).'" 454 autocomplete="off" 455 class="large-text kf-icon-picker-value"/> 456 '; 457 458 $output .= '<span class="kf-icon-picker-preview"><i class="'.esc_attr( $option_value ).'"></i></span>'; 459 460 $output .= '</div>'; 461 $output .= '</div>'; 462 $output .= $option_wrap_end; 463 } 464 break; 465 466 case 'color': 467 if ( $advanced_field ) { 468 $default_color = ''; 469 $field_class = ''; 470 471 if ( 'color' === $value['type'] ) { 472 $field_class = ' kopa_color'; 473 474 if ( $value['default'] ) { 475 $default_color = ' data-default-color="' .esc_attr( $value['default'] ) . '" '; 476 } // end check empty option value 477 } // end check color type 478 479 $output .= $option_wrap_start; 480 $output .= '<input 481 class="'.esc_attr( $field_class ).'" 482 style="'.esc_attr( $value['css'] ).'" 483 type="'.esc_attr( $value['type'] ).'" 484 name="'.esc_attr( $value['id'] ).'" 485 id="'.esc_attr( $value['id'] ).'" 486 value="'.esc_attr( $option_value ).'"'. 487 $default_color.'>'; 488 $output .= $option_wrap_end; 489 } 490 break; 491 default: 492 $output .= apply_filters( 'kopa_admin_meta_box_field_' . $value['type'], '', $option_wrap_start, $option_wrap_end, $value, $option_value); 493 break; 494 } 495 496 $_loop_index++; 497 } // end foreach 498 499 $output .= '</div>'; // .kopa-metabox-wrapper 500 501 // finally, output fields 502 echo $output; 503 } 504 505 } // end class Kopa_Admin_Meta_Box 386 387 $output .= '</p>'; 388 $output .= '</div>'; 389 break; 390 391 case 'datetime': 392 if ( $advanced_field ) { 393 $date_value_time = ''; 394 if ( isset($value['format']) && ! empty($option_value) && is_numeric($option_value) ) { 395 $date_value_time = date($value['format'],$option_value); 396 } else { 397 $date_value_time = $option_value; 398 } 399 if ( ! isset($value['timepicker']) || empty($value['timepicker']) ) { 400 $value['timepicker'] = "0"; 401 } 402 if ( ! isset($value['datepicker']) || empty($value['datepicker']) ) { 403 $value['datepicker'] = "0"; 404 } 405 406 $output .= $option_wrap_start; 407 $output .= '<input 408 class="medium-text kopa-framework-datetime" 409 type="'.esc_attr( $value['type'] ).'" 410 name="'.esc_attr( $value['id'] ).'" 411 id="'.esc_attr( $value['id'] ).'" 412 value="'. esc_attr( $date_value_time ).'" 413 data-timepicker="' . esc_attr($value['timepicker']) . '" 414 data-datepicker="' . esc_attr($value['datepicker']) . '" 415 data-format="' . wp_kses_post($value['format']) . '" 416 autocomplete="off">'; 417 $output .= $option_wrap_end; 418 } 419 420 break; 421 422 case 'gallery': 423 if ( $advanced_field ) { 424 $output .= $option_wrap_start; 425 $output .= '<div class="kopa-framework-gallery-box">'; 426 $output .= '<input 427 class="medium-text kopa-framework-gallery" 428 type="text" 429 name="'.esc_attr( $value['id'] ).'" 430 id="'.esc_attr( $value['id'] ).'" 431 value="'.esc_attr( $option_value ).'" 432 autocomplete="off">'; 433 434 $output .= '<a href="#" class="kopa-framework-gallery-config button button-secondary">' . esc_html__('Config', 'kopa-framework') . '</a>'; 435 $output .= '</div>'; 436 $output .= $option_wrap_end; 437 } 438 break; 439 440 case 'gallery_sortable': 441 442 $html = '<div class="kf-ui-gallery" data-name="' . esc_attr( $value['id'] ) . '">'; 443 $html .= '<ul>'; 444 445 $thumbnail_size = isset( $value['thumbnail_size'] ) ? $value['thumbnail_size'] : 'thumbnail'; 446 447 if( is_array( $option_value ) && $option_value ) { 448 449 foreach( $option_value as $image_id ) { 450 451 $thumb = ''; 452 if( $image_id ) { 453 $image = wp_get_attachment_image_src( $image_id, $thumbnail_size ); 454 if( isset( $image[0] ) ) { 455 $thumb = $image[0]; 456 } 457 } 458 459 460 $html .= '<li class="kf-ui-gallery__image">'; 461 $html .= '<input type="hidden" name="' . esc_attr( $value['id'] ) . '[]" value="' . esc_attr( $image_id ) . '">'; 462 $html .= '<img src="' . esc_url( $thumb ) . '" alt="">'; 463 $html .= '<span class="kf-ui-gallery__remove dashicons dashicons-trash"></span>'; 464 $html .= '</li>'; 465 466 } 467 } 468 469 $html .= '</ul>'; 470 471 $html .= '<p class="kf-ui-gallery__placehold">'; 472 $html .= '<span class="kf-ui-gallery__upload button button-secondary">' . esc_html__( 'Add new image', 'kopa-framework' ) . '</span>'; 473 $html .= '</p>'; 474 475 $html .= '</div>'; 476 477 $output .= $option_wrap_start . $html . $option_wrap_end; 478 479 break; 480 481 case 'icon': 482 if ( $advanced_field ) { 483 $output .= $option_wrap_start; 484 $output .= '<div class="kf-row">'; 485 $output .= '<div class="kf-col-xs-12">'; 486 $output .= '<a class="kf-icon-picker" href="#">' . esc_html__('Select icon', 'kopa-framework') . '</a>'; 487 $output .= ' 488 <input type="hidden" 489 name="'.esc_attr( $value['id'] ).'" 490 id="'.esc_attr( $value['id'] ).'" 491 value="'.esc_attr( $option_value ).'" 492 autocomplete="off" 493 class="large-text kf-icon-picker-value"/> 494 '; 495 496 $output .= '<span class="kf-icon-picker-preview"><i class="'.esc_attr( $option_value ).'"></i></span>'; 497 498 $output .= '</div>'; 499 $output .= '</div>'; 500 $output .= $option_wrap_end; 501 } 502 break; 503 504 case 'color': 505 if ( $advanced_field ) { 506 $default_color = ''; 507 $field_class = ''; 508 509 if ( 'color' === $value['type'] ) { 510 $field_class = ' kopa_color'; 511 512 if ( $value['default'] ) { 513 $default_color = ' data-default-color="' .esc_attr( $value['default'] ) . '" '; 514 } // end check empty option value 515 } // end check color type 516 517 $output .= $option_wrap_start; 518 $output .= '<input 519 class="'.esc_attr( $field_class ).'" 520 style="'.esc_attr( $value['css'] ).'" 521 type="'.esc_attr( $value['type'] ).'" 522 name="'.esc_attr( $value['id'] ).'" 523 id="'.esc_attr( $value['id'] ).'" 524 value="'.esc_attr( $option_value ).'"'. 525 $default_color.'>'; 526 $output .= $option_wrap_end; 527 } 528 break; 529 530 default: 531 $output .= apply_filters( 'kopa_admin_meta_box_field_' . $value['type'], '', $option_wrap_start, $option_wrap_end, $value, $option_value); 532 break; 533 } 534 535 $_loop_index++; 536 537 } // end foreach 538 539 $output .= '</div>'; // .kopa-metabox-wrapper 540 541 // finally, output fields 542 echo $output; 543 } 544 545 } // end class Kopa_Admin_Meta_Box 506 546 507 547 } -
kopatheme/trunk/includes/admin/class-kopa-admin-settings.php
r1428092 r1461229 1066 1066 1067 1067 $output .= $option_wrap_end; 1068 break;1068 break; 1069 1069 1070 1070 // Default: run an action 1071 1072 1073 1071 default: 1072 $output .= apply_filters( 'kopa_admin_field_' . $value['type'], '', $option_wrap_start, $option_wrap_end, $value ); 1073 break; 1074 1074 1075 1075 } // end switch option type -
kopatheme/trunk/includes/admin/class-kopa-admin-term-meta.php
r1353276 r1461229 43 43 $this->settings = $settings; 44 44 $this->add_meta_boxes(); 45 add_action( 'admin_enqueue_scripts', array( $this, 'meta_box_scripts' ) ); 46 //add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); 45 add_action( 'admin_enqueue_scripts', array( $this, 'meta_box_scripts' ) ); 47 46 } 48 47 -
kopatheme/trunk/kopa-framework.php
r1456755 r1461229 3 3 * Plugin Name: Kopa Framework 4 4 * Description: A WordPress framework by Kopatheme. 5 * Version: 1.1. 45 * Version: 1.1.5 6 6 * Author: Kopa Theme 7 7 * Author URI: http://kopatheme.com 8 8 * License: GPLv2 or later 9 9 * Requires at least: 3.8 10 * Tested up to: 4.5. 110 * Tested up to: 4.5.3 11 11 * 12 12 * Text Domain: kopa-framework -
kopatheme/trunk/languages/kopa-framework-en_US.pot
r1353276 r1461229 1 #, fuzzy 1 2 msgid "" 2 3 msgstr "" 3 4 "Project-Id-Version: Kopa Framework\n" 4 5 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 201 5-05-17 23:17+0700\n"6 "POT-Creation-Date: 2016-07-26 16:30+0700\n" 6 7 "PO-Revision-Date: 2015-05-17 23:17+0700\n" 7 8 "Last-Translator: thanh4890 <[email protected]>\n" … … 12 13 "Content-Transfer-Encoding: 8bit\n" 13 14 "Plural-Forms: nplurals=2; plural=n != 1;\n" 14 "X-Generator: Poedit 1. 7.6\n"15 "X-Generator: Poedit 1.8.7\n" 15 16 "X-Poedit-SourceCharset: UTF-8\n" 16 17 "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 17 18 "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n" 18 "X-Poedit-Basepath: .. /\n"19 "X-Poedit-Basepath: ..\n" 19 20 "X-Textdomain-Support: yes\n" 20 21 "X-Poedit-SearchPath-0: .\n" 21 22 22 #: includes/admin/class-kopa-admin-assets.php:1 0523 #: includes/admin/class-kopa-admin-settings.php:7 1123 #: includes/admin/class-kopa-admin-assets.php:135 24 #: includes/admin/class-kopa-admin-settings.php:737 24 25 msgid "Enter font name" 25 26 msgstr "" 26 27 27 #: includes/admin/class-kopa-admin-assets.php:1 0728 #: includes/admin/class-kopa-admin-assets.php:137 28 29 msgid "Custom font" 29 30 msgstr "" 30 31 31 #: includes/admin/class-kopa-admin-assets.php:1 1132 #: includes/admin/class-kopa-admin-settings.php:7 1632 #: includes/admin/class-kopa-admin-assets.php:141 33 #: includes/admin/class-kopa-admin-settings.php:742 33 34 msgid "Upload .woff font file" 34 35 msgstr "" 35 36 36 #: includes/admin/class-kopa-admin-assets.php:1 1637 #: includes/admin/class-kopa-admin-settings.php:7 2137 #: includes/admin/class-kopa-admin-assets.php:146 38 #: includes/admin/class-kopa-admin-settings.php:747 38 39 msgid "Upload .ttf font file" 39 40 msgstr "" 40 41 41 #: includes/admin/class-kopa-admin-assets.php:1 2142 #: includes/admin/class-kopa-admin-settings.php:7 2642 #: includes/admin/class-kopa-admin-assets.php:151 43 #: includes/admin/class-kopa-admin-settings.php:752 43 44 msgid "Upload .eot font file" 44 45 msgstr "" 45 46 46 #: includes/admin/class-kopa-admin-assets.php:1 2647 #: includes/admin/class-kopa-admin-settings.php:7 3147 #: includes/admin/class-kopa-admin-assets.php:156 48 #: includes/admin/class-kopa-admin-settings.php:757 48 49 msgid "Upload .svg font file" 49 50 msgstr "" 50 51 51 #: includes/admin/class-kopa-admin-assets.php:131 52 #: includes/admin/class-kopa-admin-assets.php:161 53 #: includes/admin/class-kopa-admin-assets.php:219 54 msgid "Upload" 55 msgstr "" 56 57 #: includes/admin/class-kopa-admin-assets.php:162 58 #: includes/admin/class-kopa-admin-assets.php:220 59 #: includes/admin/class-kopa-admin-settings.php:653 60 msgid "Remove" 61 msgstr "" 62 63 #: includes/admin/class-kopa-admin-assets.php:163 64 msgid "Click OK to reset. Any selected settings will be lost!" 65 msgstr "" 66 67 #: includes/admin/class-kopa-admin-assets.php:164 68 msgid "Click OK to import. Any selected settings will be lost!" 69 msgstr "" 70 71 #: includes/admin/class-kopa-admin-assets.php:165 72 #: includes/admin/class-kopa-admin-assets.php:178 73 msgid "Are you sure you want to delete?" 74 msgstr "" 75 76 #: includes/admin/class-kopa-admin-assets.php:175 77 msgid "Warning" 78 msgstr "" 79 80 #: includes/admin/class-kopa-admin-assets.php:176 81 msgid "Error" 82 msgstr "" 83 52 84 #: includes/admin/class-kopa-admin-assets.php:177 53 msgid "Upload"54 msgstr ""55 56 #: includes/admin/class-kopa-admin-assets.php:13257 #: includes/admin/class-kopa-admin-assets.php:17858 #: includes/admin/class-kopa-admin-settings.php:62759 msgid "Remove"60 msgstr ""61 62 #: includes/admin/class-kopa-admin-assets.php:13363 msgid "Click OK to reset. Any selected settings will be lost!"64 msgstr ""65 66 #: includes/admin/class-kopa-admin-assets.php:13467 msgid "Click OK to import. Any selected settings will be lost!"68 msgstr ""69 70 #: includes/admin/class-kopa-admin-assets.php:13571 #: includes/admin/class-kopa-admin-assets.php:14872 msgid "Are you sure you want to delete?"73 msgstr ""74 75 #: includes/admin/class-kopa-admin-assets.php:14576 msgid "Warning"77 msgstr ""78 79 #: includes/admin/class-kopa-admin-assets.php:14680 msgid "Error"81 msgstr ""82 83 #: includes/admin/class-kopa-admin-assets.php:14784 85 msgid "Info" 85 86 msgstr "" 86 87 87 #: includes/admin/class-kopa-admin-assets.php:1 4988 #: includes/admin/class-kopa-admin-assets.php:179 88 89 msgid "Close" 89 90 msgstr "" 90 91 91 #: includes/admin/class-kopa-admin-assets.php:1 5092 #: includes/admin/class-kopa-admin-assets.php:180 92 93 msgid "Delete" 93 94 msgstr "" 94 95 95 #: includes/admin/class-kopa-admin-assets.php:1 5196 #: includes/admin/class-kopa-admin-assets.php:181 96 97 msgid "Advanced Settings" 97 98 msgstr "" 98 99 99 #: includes/admin/class-kopa-admin-assets.php:1 53100 #: includes/admin/class-kopa-admin-settings.php:8 54100 #: includes/admin/class-kopa-admin-assets.php:183 101 #: includes/admin/class-kopa-admin-settings.php:880 101 102 msgid "Name" 102 103 msgstr "" 103 104 104 #: includes/admin/class-kopa-admin-assets.php:1 54105 #: includes/admin/class-kopa-admin-settings.php:8 55105 #: includes/admin/class-kopa-admin-assets.php:184 106 #: includes/admin/class-kopa-admin-settings.php:881 106 107 msgid "Description" 107 108 msgstr "" 108 109 109 #: includes/admin/class-kopa-admin-assets.php:1 55110 #: includes/admin/class-kopa-admin-settings.php:8 56110 #: includes/admin/class-kopa-admin-assets.php:185 111 #: includes/admin/class-kopa-admin-settings.php:882 111 112 msgid "Before Widget" 112 113 msgstr "" 113 114 114 #: includes/admin/class-kopa-admin-assets.php:1 56115 #: includes/admin/class-kopa-admin-settings.php:8 57115 #: includes/admin/class-kopa-admin-assets.php:186 116 #: includes/admin/class-kopa-admin-settings.php:883 116 117 msgid "After Widget" 117 118 msgstr "" 118 119 119 #: includes/admin/class-kopa-admin-assets.php:1 57120 #: includes/admin/class-kopa-admin-settings.php:8 58120 #: includes/admin/class-kopa-admin-assets.php:187 121 #: includes/admin/class-kopa-admin-settings.php:884 121 122 msgid "Before Title" 122 123 msgstr "" 123 124 124 #: includes/admin/class-kopa-admin-assets.php:1 58125 #: includes/admin/class-kopa-admin-settings.php:8 59125 #: includes/admin/class-kopa-admin-assets.php:188 126 #: includes/admin/class-kopa-admin-settings.php:885 126 127 msgid "After Title" 127 128 msgstr "" … … 218 219 msgstr "" 219 220 220 #: includes/admin/class-kopa-admin-settings.php: 99221 #: includes/admin/class-kopa-admin-settings.php:117 221 222 msgid "Action failed. Please refresh the page and retry." 222 223 msgstr "" 223 224 224 #: includes/admin/class-kopa-admin-settings.php:1 15225 #: includes/admin/class-kopa-admin-settings.php:133 225 226 msgid "Default options restored." 226 227 msgstr "" 227 228 228 #: includes/admin/class-kopa-admin-settings.php:1 20229 #: includes/admin/class-kopa-admin-settings.php:138 229 230 msgid "Your settings have been saved." 230 231 msgstr "" 231 232 232 #: includes/admin/class-kopa-admin-settings.php:6 41233 #: includes/admin/class-kopa-admin-settings.php:667 233 234 msgid "View File" 234 235 msgstr "" 235 236 236 #: includes/admin/class-kopa-admin-settings.php:6 59237 #: includes/admin/class-kopa-admin-settings.php:685 237 238 msgid "preview text" 238 239 msgstr "" 239 240 240 #: includes/admin/layouts/class-kopa-layout-box.php:5 3241 #: includes/admin/layouts/class-kopa-layout-box.php:56 241 242 msgid "Check if you would like to use custom setting" 242 243 msgstr "" 243 244 244 #: includes/admin/layouts/class-kopa-layout-box.php:6 5245 #: includes/admin/layouts/class-kopa-layout-box.php:68 245 246 msgid "Select layout" 246 247 msgstr "" 247 248 248 #: includes/admin/layouts/class-kopa-layout-box.php:9 1249 #: includes/admin/layouts/class-kopa-layout-box.php:96 249 250 msgid "—Select sidebar—" 250 251 msgstr "" 251 252 252 #: includes/admin/layouts/class-kopa-layout-box.php:12 0253 #: includes/admin/layouts/class-kopa-layout-post-type.php: 49253 #: includes/admin/layouts/class-kopa-layout-box.php:125 254 #: includes/admin/layouts/class-kopa-layout-post-type.php:53 254 255 msgid "Custom Layout" 255 256 msgstr "" -
kopatheme/trunk/readme.txt
r1456755 r1461229 5 5 Requires at least: 3.8 6 6 Tested up to: 4.5.3 7 Stable tag: 1.1. 47 Stable tag: 1.1.5 8 8 License: GPLv2 or later 9 9 … … 21 21 22 22 == Changelog == 23 24 = 1.1.5 = 25 * Add new metabox-field: gallery_sortable 23 26 24 27 = 1.1.4 =
Note: See TracChangeset
for help on using the changeset viewer.