function trigger_all() { QMCV_IO::trigger_hooks(); if (class_exists('QueryMonitor') && Check_Variables_Options::get_query_monitor() === true) { // Set Query Monitor Collector include_once QMCV_CLASS_DIR . 'query_monitor/collector.php'; QMCV_Collector_Variable_Checking::initialize(); } }
public static function is_user_allowed() { $user_allowed = false; $current_user = wp_get_current_user(); $get_capability = Check_Variables_Options::get_capability(); if (!$get_capability) { $user_allowed = true; } else { foreach ($current_user->caps as $key => $val) { if (in_array($key, $get_capability)) { $user_allowed = true; break; } } } if ($user_allowed === false) { $users = self::get_users(); $users = str_replace(' ', '', $users); if (!empty($users) && in_array($current_user->ID, explode(',', $users))) { $user_allowed = true; } } return $user_allowed; }
?> <label for="capability-<?php echo $key; ?> "> <input type="checkbox" id="capability-guest" name="capability[guest]" <?php if (is_array(Check_Variables_Options::get_capability()) && in_array('guest', Check_Variables_Options::get_capability())) { echo 'checked="checked"'; } ?> /> Guest </label> <div class="clear"> </div> </td> </tr> <tr> <th scope="row"><label for="users">Users </label></th> <td> <input type="text" name="users" id="users" class="regular-text" value="<?php echo Check_Variables_Options::get_users(); ?> " /> <p class="description">Input User ID (number) separated by comma(,).</p> </td> </tr> </tbody> </table>
static function echo_debug($query_monitor = false) { $hide = Check_Variables_Options::get_hide() && !$query_monitor ? ' hidden' : ''; foreach (self::$message as $key => $message) { $title = $message['type']; switch ($message['type']) { case 'object': case 'array': self::$message_sandbox = array(); self::$message_stack = explode(PHP_EOL, $message['message']); $title = self::$message_stack[0]; unset(self::$message_stack[0]); unset(self::$message_stack[1]); self::txt2structure(self::$message_stack, self::$message_sandbox); $message_key = $message['key']; $html_value = sprintf('<dl data-id="%s">', $key); ob_start(); self::structure2html(self::$message_sandbox); $html_value .= ob_get_contents(); ob_end_clean(); $html_value .= '</dl>'; self::structure2json(self::$message_sandbox, self::$json_sandbox); $json = str_replace("'", "\\'", json_encode(self::$json_sandbox)); break; case 'boolean': case 'NULL': $message['message'] = $message['type'] == "boolean" ? $message['message'] ? 'true' : 'false' : "NULL"; default: $html_value = sprintf('<div class="QMCV_value" data-id="%s">%s</div>', $key, $message['message']); $jskey = str_replace("\"", "'", $message['key']); $jskey = str_replace("'", "\\'", $jskey); $json = sprintf('{"%s":"%s"}', $jskey, $message['message']); break; } # HTML if (Check_Variables_Options::get_footer()) { printf('<div class="QMCV_IO %s">', $hide); printf('<h3 data-id="%s">%s <span>%s</span></h3>', $key, $message['key'], $title); printf('<div class="file">%s <span>( Line %s )</span></div>', $message['file'], $message['line']); echo $html_value; echo '</div>'; } // Query Monitor if ($query_monitor) { printf('<tr>'); printf('<td><strong>%s</strong><br /><span class="file">%s::<span>%s</span></span></td>', $message['key'], $message['file'], $message['line']); printf('<td>%s</td>', $message['type']); printf('<td><pre>%s</pre></td>', $message['message']); printf('</tr>'); } # JS Console if (Check_Variables_Options::get_console() && !$query_monitor) { ?> <script type="text/javascript"> QMCV_Data = '<?php echo $json; ?> '; QMCV_Data = JSON.parse( QMCV_Data ); console.log( QMCV_Data ); </script> <?php } } }