Changeset 3267218
- Timestamp:
- 04/05/2025 10:19:23 AM (11 months ago)
- Location:
- hippoo-popup/trunk
- Files:
-
- 1 added
- 3 edited
-
app/web-api-auth.php (added)
-
app/web-api.php (modified) (1 diff)
-
hippoo-popup.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hippoo-popup/trunk/app/web-api.php
r3203303 r3267218 2 2 if ( ! defined( 'ABSPATH' ) ) exit; 3 3 4 // Get the settings via REST API5 function hippoo_popup_admin_page_get_settings() {6 $settings = get_option( 'hippoo_popup_settings', array() );7 return rest_ensure_response( $settings );8 }9 4 10 // Update the settings via REST API 11 function hippoo_popup_admin_page_update_settings( $request ) { 12 $datas = $request->get_json_params(); 13 if ( ! empty( $datas ) ) { 14 $settings = get_option( 'hippoo_popup_settings', array() ); 15 foreach ( $datas as $k => $v ) { 16 $settings[ $k ] = sanitize_text_field( wp_unslash( $v ) ); 17 } 18 update_option( 'hippoo_popup_settings', $settings ); 19 return rest_ensure_response( __( 'Settings updated successfully.', 'hippoo-popup' ) ); 20 } else { 21 return rest_ensure_response( __( 'Nothing changed.', 'hippoo-popup' ) ); 22 } 23 } 5 -
hippoo-popup/trunk/hippoo-popup.php
r3203303 r3267218 2 2 /** 3 3 * Plugin Name: Hippoo Popup 4 * Version: 1.0. 04 * Version: 1.0.1 5 5 * Plugin URI: https://Hippoo.app 6 6 * Description: The ultimate extension to elevate your store's engagement! With Hippoo Popup, seamlessly integrate captivating popups directly within the Hippoo app, boosting interaction and driving results like never before. … … 15 15 define( 'HIPPOO_POPUP_URL', plugins_url( 'hippoo-popup' ) . '/assets' ); 16 16 include_once( plugin_dir_path( __FILE__ ) . 'app' . DIRECTORY_SEPARATOR . 'web-api.php' ); 17 include_once( plugin_dir_path( __FILE__ ) . 'app' . DIRECTORY_SEPARATOR . 'web-api-auth.php' ); 17 18 18 19 // Load translation files … … 163 164 add_action( 'wp_footer', 'hippoo_popup_hook_popup_to_footer', 10 ); 164 165 165 // Register REST API routes166 function hippoo_popup_admin_page_register_rest_routes() {167 register_rest_route(168 'wc/hippoo-popup/v1',169 '/settings',170 array(171 'methods' => 'GET',172 'callback' => 'hippoo_popup_admin_page_get_settings',173 'permission_callback' => function () {174 return current_user_can( 'manage_options' );175 },176 )177 );178 179 register_rest_route(180 'wc/hippoo-popup/v1',181 '/settings',182 array(183 'methods' => 'PUT',184 'callback' => 'hippoo_popup_admin_page_update_settings',185 'permission_callback' => function () {186 return current_user_can( 'manage_options' );187 },188 )189 );190 }191 add_action( 'rest_api_init', 'hippoo_popup_admin_page_register_rest_routes' ); -
hippoo-popup/trunk/readme.txt
r3203303 r3267218 5 5 Requires at least: 5.3 6 6 Tested up to: 6.7 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 Text Domain: hippoo-popup 9 9 License: GPL3 … … 35 35 == Changelog == 36 36 37 = 1.0.1 = 38 * Minor updates 39 37 40 = 1.0.0 = 38 41 * Initial release.
Note: See TracChangeset
for help on using the changeset viewer.