Changeset 2712012
- Timestamp:
- 04/20/2022 08:28:32 AM (4 years ago)
- Location:
- kernel-video-sharing/trunk
- Files:
-
- 6 edited
-
README.txt (modified) (2 diffs)
-
admin/class-kvs-admin.php (modified) (4 diffs)
-
admin/css/kvs-admin.css (modified) (1 diff)
-
admin/partials/settings/post.php (modified) (2 diffs)
-
includes/class-kvs.php (modified) (2 diffs)
-
kvs.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel-video-sharing/trunk/README.txt
r2668122 r2712012 4 4 Tags: video, player, tube, videoplayer 5 5 Requires at least: 3.0.1 6 Tested up to: 5.9. 07 Stable tag: 1.0. 76 Tested up to: 5.9.3 7 Stable tag: 1.0.8 8 8 Requires PHP: 7.1 9 9 License: GPLv2 or later … … 57 57 = 1.0.7 = 58 58 * Consmetical changes 59 60 = 1.0.8 = 61 * Added support for post status (draft, published, pending). 62 * Added support for up to 3 custom fields to be populated with KVS data. -
kernel-video-sharing/trunk/admin/class-kvs-admin.php
r2667866 r2712012 510 510 $taxonomy_model = get_option( 'kvs_taxonomy_model' ); 511 511 $taxonomy_source = get_option( 'kvs_taxonomy_source' ); 512 513 $custom_fields = []; 514 for ($i = 1; $i <= 3; $i++) { 515 if (!empty(get_option( "kvs_custom{$i}_name" )) && !empty(get_option( "kvs_custom{$i}_value" ))) { 516 $custom_fields[get_option( "kvs_custom{$i}_name" )] = get_option( "kvs_custom{$i}_value" ); 517 } 518 } 512 519 513 520 $kernel_video_sharing->logger->log( … … 621 628 ), 622 629 ); 623 630 624 631 $replacements = array( 625 632 '{%id%}' => $row['id'], … … 636 643 $contentTemplate = get_option( 'kvs_post_body_template' ) ?: '{%description%}'; 637 644 $video['post_content'] = strtr( $contentTemplate, $replacements); 645 646 foreach ($custom_fields as $custom_field_name => $custom_field_value) { 647 $video['meta_input'][$custom_field_name] = strtr($custom_field_value, $replacements); 648 } 638 649 639 650 if( !empty( $row['screenshot_main'] ) && … … 667 678 } 668 679 } else { 669 $video['post_status'] = 'publish'; // ToDo: Move that initial state setting to options680 $video['post_status'] = get_option( 'kvs_post_status' ) == 'draft' ? 'draft' : (get_option( 'kvs_post_status' ) == 'pending' ? 'pending' : 'publish'); 670 681 $video['post_author'] = 1; // ToDo: Try to find corresponding WP user by $row['user'] 671 682 $post_id = wp_insert_post( $video, $wp_error = true ); -
kernel-video-sharing/trunk/admin/css/kvs-admin.css
r2667866 r2712012 80 80 } 81 81 .hint code { 82 cursor: pointer;83 82 display: inline-block; 84 83 } -
kernel-video-sharing/trunk/admin/partials/settings/post.php
r2667866 r2712012 62 62 </label> 63 63 <p class="description">Choose which post type you want KVS videos to be imported to</p> 64 </td> 65 </tr> 66 67 <tr valign="top"> 68 <th scope="row"><?php _e( 'Post status', 'kvs' ); ?></th> 69 <td> 70 <select name="kvs_post_status"> 71 <option value="published" <?php if( get_option( 'kvs_post_status' ) == 'published' ){echo ' selected';} ?>><?php _e( 'Published', 'kvs' ); ?></option> 72 <option value="pending" <?php if( get_option( 'kvs_post_status' ) == 'pending' ){echo ' selected';} ?>><?php _e( 'Pending Review', 'kvs' ); ?></option> 73 <option value="draft" <?php if( get_option( 'kvs_post_status' ) == 'draft' ){echo ' selected';} ?>><?php _e( 'Draft', 'kvs' ); ?></option> 74 </select> 75 <p class="description">Status of the created posts</p> 64 76 </td> 65 77 </tr> … … 182 194 </tr> 183 195 </table> 196 197 <h3>Custom fields</h3> 198 <table class="form-table"> 199 <tr valign="top"> 200 <th scope="row"><?php _e( 'Custom 1', 'kvs' ); ?></th> 201 <td> 202 <input type="text" name="kvs_custom1_name" value="<?php echo esc_attr( get_option( 'kvs_custom1_name' )); ?>" /> 203 = 204 <input type="text" name="kvs_custom1_value" value="<?php echo esc_attr( get_option( 'kvs_custom1_value' )); ?>" /> 205 <p class="description">Specify custom field name and value (see <b>Template elements</b> above)</p> 206 </td> 207 </tr> 208 <tr valign="top"> 209 <th scope="row"><?php _e( 'Custom 2', 'kvs' ); ?></th> 210 <td> 211 <input type="text" name="kvs_custom2_name" value="<?php echo esc_attr( get_option( 'kvs_custom2_name' )); ?>" /> 212 = 213 <input type="text" name="kvs_custom2_value" value="<?php echo esc_attr( get_option( 'kvs_custom2_value' )); ?>" /> 214 <p class="description">Specify custom field name and value (see <b>Template elements</b> above)</p> 215 </td> 216 </tr> 217 <tr valign="top"> 218 <th scope="row"><?php _e( 'Custom 3', 'kvs' ); ?></th> 219 <td> 220 <input type="text" name="kvs_custom3_name" value="<?php echo esc_attr( get_option( 'kvs_custom3_name' )); ?>" /> 221 = 222 <input type="text" name="kvs_custom3_value" value="<?php echo esc_attr( get_option( 'kvs_custom3_value' )); ?>" /> 223 <p class="description">Specify custom field name and value (see <b>Template elements</b> above)</p> 224 </td> 225 </tr> 226 </table> 184 227 <?php submit_button( __( 'Save Changes', 'kvs' ) ); ?> 185 228 </form> 186 229 </div> 187 <script>188 jQuery(document).ready(function() {189 jQuery('code').on('click', function() {190 var templatetext = jQuery("#kvs_post_body_template");191 var position = templatetext.getCursorPosition();192 templatetext.val(193 templatetext.val().substr(0, position) +194 this.innerText +195 templatetext.val().substr(position)196 );197 });198 });199 (function ($, undefined) {200 $.fn.getCursorPosition = function () {201 var el = $(this).get(0);202 var pos = 0;203 if ('selectionStart' in el) {204 pos = el.selectionStart;205 } else if ('selection' in document) {206 el.focus();207 var Sel = document.selection.createRange();208 var SelLength = document.selection.createRange().text.length;209 Sel.moveStart('character', -el.value.length);210 pos = Sel.text.length - SelLength;211 }212 return pos;213 }214 })(jQuery);215 </script> -
kernel-video-sharing/trunk/includes/class-kvs.php
r2667866 r2712012 314 314 315 315 register_setting( 'kvs-settings-group-post', 'kvs_post_type' ); 316 register_setting( 'kvs-settings-group-post', 'kvs_post_status' ); 316 317 register_setting( 'kvs-settings-group-post', 'kvs_post_import_featured_image' ); 317 318 register_setting( 'kvs-settings-group-post', 'kvs_post_body_template' ); … … 320 321 register_setting( 'kvs-settings-group-post', 'kvs_taxonomy_model' ); 321 322 register_setting( 'kvs-settings-group-post', 'kvs_taxonomy_source' ); 323 register_setting( 'kvs-settings-group-post', 'kvs_custom1_name' ); 324 register_setting( 'kvs-settings-group-post', 'kvs_custom1_value' ); 325 register_setting( 'kvs-settings-group-post', 'kvs_custom2_name' ); 326 register_setting( 'kvs-settings-group-post', 'kvs_custom2_value' ); 327 register_setting( 'kvs-settings-group-post', 'kvs_custom3_name' ); 328 register_setting( 'kvs-settings-group-post', 'kvs_custom3_value' ); 322 329 323 330 register_setting( 'kvs-settings-group-advanced', 'kvs_feed_last_id' ); -
kernel-video-sharing/trunk/kvs.php
r2668122 r2712012 12 12 * Plugin URI: https://www.kernel-video-sharing.com/en/wordpress/ 13 13 * Description: Kernel Video Sharing plugin for WordPress. Provides integration with KVS video content manager and automates video import from KVS into your Wordpress projects. 14 * Version: 1.0. 714 * Version: 1.0.8 15 15 * Requires at least: 5.0 16 16 * Requires PHP: 5.6 … … 29 29 30 30 define( 'KVS_WEBSITE', 'https://www.kernel-video-sharing.com/' ); 31 define( 'KVS_VERSION', '1.0. 7' );31 define( 'KVS_VERSION', '1.0.8' ); 32 32 define( 'KVS_PREFIX', 'kvs' ); 33 33 define( 'KVS_DIRPATH', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.