esc_url_raw( rest_url( Hidexo_Lite_REST_API::NS . '/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'cssUrl' => esc_url_raw( HIDEXO_LITE_URL . 'assets/css/picker.css?ver=' . HIDEXO_LITE_VERSION ), 'dashboardUrl' => esc_url_raw( admin_url( 'admin.php?page=hidexo-lite-all-hider' ) ), 'adminOrigin' => $admin_origin, 'pagePath' => Hidexo_Lite_Rules::current_path(), 'pageTitle' => wp_strip_all_tags( wp_get_document_title() ), ); wp_add_inline_script( 'hidexo-lite-core', 'window.HidexoPicker = ' . wp_json_encode( $config ) . ';', 'before' ); } /** * Scheme + host (+port) of a URL. * * @param string $url URL. * @return string */ public static function origin( $url ) { $p = wp_parse_url( $url ); if ( empty( $p['scheme'] ) || empty( $p['host'] ) ) { return ''; } return $p['scheme'] . '://' . $p['host'] . ( ! empty( $p['port'] ) ? ':' . $p['port'] : '' ); } }