| @@ -63,12 +63,11 @@ | ||
| 63 | 63 | wp_enqueue_style('select2'); |
| 64 | 64 | break; |
| 65 | 65 | case "toplevel_page_vimeography-edit-galleries": |
| 66 | 66 | if (defined('VIMEOGRAPHY_DEV') && VIMEOGRAPHY_DEV) { |
| 67 | - $devserver_path = defined('VIMEOGRAPHY_ADMIN_JS_URL') ? VIMEOGRAPHY_ADMIN_JS_URL : 'http://localhost:8024'; | |
| 68 | 67 | wp_enqueue_script( |
| 69 | 68 | 'vimeography_admin_react', |
| 70 | - $devserver_path . '/index.js', | |
| 69 | + 'https://localhost:8024/index.js', | |
| 71 | 70 | [], |
| 72 | 71 | "1.0", |
| 73 | 72 | true |
| 74 | 73 | ); |
| @@ -78,53 +77,30 @@ | ||
| 78 | 77 | $manifest = (array) json_decode($manifest); |
| 79 | 78 | |
| 80 | 79 | $script_url = |
| 81 | 80 | VIMEOGRAPHY_URL . 'lib/admin/app/dist/' . $manifest['index.js']; |
| 82 | - | |
| 83 | - // There was a bug introduced in Vimeography Pro 2.1 where Pro JS mistakenly depended | |
| 84 | - // on `vimeography_admin_react` to be loaded before itself, which led to a | |
| 85 | - // race condition of scripts loading as expected. We've corrected this | |
| 86 | - // issue in Pro 2.1.1, so let's check to see if the user has the corrected | |
| 87 | - // version, and if so, we can safely avoid a circular dependency loop | |
| 88 | - // Otherwise, the user will have to live with the race condition bug | |
| 89 | - // until they update to 2.1.1 | |
| 90 | - | |
| 91 | - // Ref: https://github.com/davekiss/vimeography-pro/commit/08099c072928df96a7df6cc5b4050fe9390b35b3 | |
| 92 | - if ( | |
| 93 | - is_plugin_active('vimeography-pro/vimeography-pro.php') && | |
| 94 | - defined('VIMEOGRAPHY_PRO_VERSION') && | |
| 95 | - version_compare(VIMEOGRAPHY_PRO_VERSION, '2.1.1', '>=') | |
| 96 | - ) { | |
| 97 | - $deps = array('vimeography_pro_admin'); | |
| 98 | - } else { | |
| 99 | - $deps = array(); | |
| 100 | - } | |
| 101 | - | |
| 102 | 81 | wp_enqueue_script( |
| 103 | 82 | 'vimeography_admin_react', |
| 104 | 83 | $script_url, |
| 105 | - $deps, | |
| 84 | + [], | |
| 106 | 85 | "1.0", |
| 107 | 86 | true |
| 108 | 87 | ); |
| 109 | 88 | } |
| 110 | 89 | |
| 111 | - wp_add_inline_script( | |
| 112 | - 'vimeography_admin_react', | |
| 113 | - 'var vimeographyThemeNonce = "' . | |
| 114 | - wp_create_nonce("vimeography-theme-action") . | |
| 115 | - '";', | |
| 116 | - 'before' | |
| 90 | + wp_localize_script( | |
| 91 | + "vimeography_admin_react", | |
| 92 | + "vimeographyThemeNonce", | |
| 93 | + wp_create_nonce("vimeography-theme-action") | |
| 117 | 94 | ); |
| 118 | 95 | |
| 119 | - wp_add_inline_script( | |
| 96 | + wp_localize_script( | |
| 120 | 97 | 'vimeography_admin_react', |
| 121 | - 'var vimeographyApiSettings = ' . | |
| 122 | - json_encode(array( | |
| 123 | - 'root' => esc_url_raw(rest_url()), | |
| 124 | - 'nonce' => wp_create_nonce('wp_rest') | |
| 125 | - )), | |
| 126 | - 'before' | |
| 98 | + 'vimeographyApiSettings', | |
| 99 | + array( | |
| 100 | + 'root' => esc_url_raw(rest_url()), | |
| 101 | + 'nonce' => wp_create_nonce('wp_rest') | |
| 102 | + ) | |
| 127 | 103 | ); |
| 128 | 104 | |
| 129 | 105 | break; |
| 130 | 106 | default: |