File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -26,24 +26,36 @@ public static function post($hook, $invokeable)
2626
2727 public static function request ($ method , $ hook , $ invokeable )
2828 {
29- if ((isset ($ _SERVER ['REQUEST_METHOD ' ]) && sanitize_text_field ($ _SERVER ['REQUEST_METHOD ' ]) != $ method ) || !isset ($ _REQUEST ['action ' ]) || (isset ($ _REQUEST ['action ' ]) && strpos (sanitize_text_field ($ _REQUEST ['action ' ]), $ hook ) === false )) {
29+ $ action = $ _REQUEST ['action ' ] ?? $ _POST ['action ' ] ?? $ _GET ['action ' ];
30+
31+ if (
32+ (isset ($ _SERVER ['REQUEST_METHOD ' ]) && sanitize_text_field ($ _SERVER ['REQUEST_METHOD ' ]) != $ method )
33+ || empty ($ action )
34+ || (!empty ($ action ) && strpos (sanitize_text_field ($ action ), $ hook ) === false )
35+ ) {
3036 if (static ::$ _no_auth ) {
3137 static ::$ _no_auth = false ;
3238 }
39+
3340 if (static ::$ _ignore_token ) {
3441 static ::$ _ignore_token = false ;
3542 }
3643
3744 return ;
3845 }
46+
3947 if (static ::$ _ignore_token ) {
4048 static ::$ _ignore_token = false ;
4149 static ::$ _invokeable [static ::$ _prefix . $ hook ][$ method . '_ignore_token ' ] = true ;
4250 }
51+
4352 static ::$ _invokeable [static ::$ _prefix . $ hook ][$ method ] = $ invokeable ;
53+
4454 Hooks::add ('wp_ajax_ ' . static ::$ _prefix . $ hook , [__CLASS__ , 'action ' ]);
55+
4556 if (static ::$ _no_auth ) {
4657 static ::$ _no_auth = false ;
58+
4759 Hooks::add ('wp_ajax_nopriv_ ' . static ::$ _prefix . $ hook , [__CLASS__ , 'action ' ]);
4860 }
4961 }
You can’t perform that action at this time.
0 commit comments