Skip to content

Commit 9ae2912

Browse files
author
Timi-Artturi Mäkelä
committed
Optimization for the hash check
1 parent b87e719 commit 9ae2912

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

plugin.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,18 @@ public static function set_hash( $data ) {
106106
// For example if dustpress()->render() will be called multiple times 'dustpress/data' will run multiple times.
107107
// The hash cannot change so we need to check if the value has been set already.
108108
if ( empty( self::$hash ) ) {
109+
109110
self::$hash = md5( $_SERVER['REQUEST_URI'] . microtime() );
110-
}
111111

112-
$data_array = array(
113-
'ajaxurl' => admin_url('admin-ajax.php'),
114-
'hash' => self::$hash
115-
);
112+
$data_array = array(
113+
'ajaxurl' => admin_url('admin-ajax.php'),
114+
'hash' => self::$hash
115+
);
116116

117-
wp_localize_script( 'dustpress_debugger', 'dustpress_debugger', $data_array );
117+
wp_localize_script( 'dustpress_debugger', 'dustpress_debugger', $data_array );
118118

119-
wp_enqueue_script( 'dustpress_debugger' );
119+
wp_enqueue_script( 'dustpress_debugger' );
120+
}
120121

121122
return $data;
122123
}

0 commit comments

Comments
 (0)