Changeset 2973378
- Timestamp:
- 09/30/2023 08:46:34 PM (3 years ago)
- Location:
- image-editor-by-pixo/branches/2.4-beta1
- Files:
-
- 8 copied
-
. (copied) (copied from image-editor-by-pixo/trunk)
-
admin.css (copied) (copied from image-editor-by-pixo/trunk/admin.css)
-
admin.js (copied) (copied from image-editor-by-pixo/trunk/admin.js) (2 diffs)
-
frontend.php (copied) (copied from image-editor-by-pixo/trunk/frontend.php)
-
get-custom-stickers.php (copied) (copied from image-editor-by-pixo/trunk/get-custom-stickers.php)
-
pixo.php (copied) (copied from image-editor-by-pixo/trunk/pixo.php) (7 diffs)
-
post-types.php (copied) (copied from image-editor-by-pixo/trunk/post-types.php)
-
readme.txt (copied) (copied from image-editor-by-pixo/trunk/readme.txt)
Legend:
- Unmodified
- Added
- Removed
-
image-editor-by-pixo/branches/2.4-beta1/admin.js
r2812513 r2973378 34 34 theme : 'wordpress', 35 35 alert : true, 36 sessions : Pixo.SESSIONS, 36 37 actions : [{ 37 38 caption : 'Save', … … 64 65 filterStickers: function (stickers) { 65 66 return Pixo.STICKERS && Pixo.STICKERS.length ? Pixo.STICKERS : stickers; 67 }, 68 69 onClose: function (sessions) { 70 if (sessions) { 71 Pixo.SESSIONS = sessions; 72 73 const xhr = new XMLHttpRequest(); 74 xhr.open('PUT', '/wp-json/pixo-editor/v1/sessions'); 75 xhr.setRequestHeader('Content-type', 'application/json'); 76 xhr.send(JSON.stringify(sessions)); 77 } 66 78 }, 67 79 }); -
image-editor-by-pixo/branches/2.4-beta1/pixo.php
r2891508 r2973378 4 4 Plugin URI: https://pixoeditor.com 5 5 Description: Provides Pixo as a replacement of the default image editor in your WordPress installation, as well as integrates to your website front-end 6 Version: 2. 3.16 Version: 2.4-beta1 7 7 */ 8 8 … … 22 22 define( 'PIXOEDITOR_OPTION_IMAGE_SIZE', '__pixoeditor_image_size' ); 23 23 define( 'PIXOEDITOR_OPTION_STICKERS', '__pixoeditor_stickers' ); 24 define( 'PIXOEDITOR_OPTION_SESSIONS', '__pixoeditor_sessions' ); 25 define( 'PIXOEDITOR_OPTION_SESSIONS_ENABLED', '__pixoeditor_sessions_enabled' ); 24 26 define( 'PIXOEDITOR_OPTION_FRONTEND_CONFIG', '__pixoeditor_frontend_config' ); 25 27 define( 'PIXOEDITOR_OPTION_FRONTEND_GLOBAL', '__pixoeditor_frontend_is_global' ); … … 47 49 include( dirname( __FILE__ ) . '/get-custom-stickers.php' ); 48 50 include( dirname( __FILE__ ) . '/frontend.php' ); 51 52 53 /********************************************************* REST API ENDPOINTS */ 54 55 add_action('rest_api_init', 'pixoeditor__initRESTAPI'); 56 function pixoeditor__initRESTAPI() { 57 register_rest_route('pixo-editor/v1', '/sessions', array( 58 'methods' => 'PUT', 59 'callback' => 'pixoeditor__updateSessions', 60 'permission_callback' => '__return_true', 61 )); 62 register_rest_route('pixo-editor/v1', '/sessions', array( 63 'methods' => 'GET', 64 'callback' => 'pixoeditor__getSessions', 65 'permission_callback' => '__return_true', 66 )); 67 }; 68 69 function pixoeditor__updateSessions($request) { 70 $sessions = $request->get_body(); 71 return update_option(PIXOEDITOR_OPTION_SESSIONS, $sessions); 72 } 73 74 function pixoeditor__getSessions() { 75 return 'not implemented'; 76 } 49 77 50 78 … … 111 139 } 112 140 wp_enqueue_script( 'pixoeditor__bridge', 'https://pixoeditor.com/editor/scripts/bridge.m.js' ); 113 wp_enqueue_script( 'pixoeditor__admin', plugin_dir_url( __FILE__ ) . 'admin.js', array( 'media-models', 'jquery-ui-dialog' ), '2. 2.1' );141 wp_enqueue_script( 'pixoeditor__admin', plugin_dir_url( __FILE__ ) . 'admin.js', array( 'media-models', 'jquery-ui-dialog' ), '2.4-beta1' ); 114 142 } 115 143 … … 148 176 '" . pixoeditor__getCustomStickers( explode( ',', get_option( PIXOEDITOR_OPTION_STICKERS ) ) ) . "' || '[]' 149 177 ); 178 Pixo.SESSIONS = " . (get_option( PIXOEDITOR_OPTION_SESSIONS_ENABLED ) == '1' ? (get_option( PIXOEDITOR_OPTION_SESSIONS ) ?: 'null') : 'undefined') . "; 150 179 151 180 (function () { … … 671 700 <?php endif ?> 672 701 702 <h2>Sessions</h2> 703 <label> 704 <input type="checkbox" name="<?php echo PIXOEDITOR_OPTION_SESSIONS_ENABLED ?>" value="1" <?php echo pixoeditor__getOption( PIXOEDITOR_OPTION_SESSIONS_ENABLED ) == '1' ? ' checked="checked"' : '' ?>" /> Enable cross-browser sessions 705 </label> 706 <p>This enables session restore between different browsers and computers. For example, edit and save image from your laptop, then open the saved image from your desktop computer. All changes will be editable/revertable!</p> 707 <p><i>Warning! This feature may increase the size of your database</i></p> 708 709 <p class="submit"> 710 <input type="submit" name="save-settings" id="submit" class="button button-primary" value="Update Sessions"> 711 </p> 712 673 713 <input type="hidden" name="<?php echo PIXOEDITOR_KEY_NONCE ?>" value="<?php echo wp_create_nonce( PIXOEDITOR_KEY_NONCE ) ?>" /> 674 714 <?php … … 699 739 sanitize_text_field( json_encode( $_POST[ PIXOEDITOR_OPTION_CONFIG ] ) ) 700 740 ); 741 if (isset( $_POST[ PIXOEDITOR_OPTION_SESSIONS_ENABLED ] )) { 742 pixoeditor__updateOption( 743 PIXOEDITOR_OPTION_SESSIONS_ENABLED, 744 sanitize_text_field( $_POST[ PIXOEDITOR_OPTION_SESSIONS_ENABLED ] ) 745 ); 746 } else { 747 pixoeditor__updateOption( PIXOEDITOR_OPTION_SESSIONS_ENABLED, '' ); 748 } 701 749 isset( $_POST[ PIXOEDITOR_OPTION_FRONTEND_CONFIG ] ) && pixoeditor__updateOption( 702 750 PIXOEDITOR_OPTION_FRONTEND_CONFIG,
Note: See TracChangeset
for help on using the changeset viewer.