<?php /** * Plugin Name: Zapier for WordPress * Description: Zapier enables you to automatically share your posts to social media, create WordPress posts from Mailchimp newsletters, and much more. Visit https://zapier.com/apps/wordpress/integrations for more details. * Version: 1.0.4 * Author: Zapier * Author URI: https://zapier.com * License: Expat (MIT License) * License URI: https://spdx.org/licenses/MIT.html */ require_once dirname(__FILE__) . '/vendor/autoload.php'; use \Firebase\JWT\JWT; class Zapier_Auth_Loader { protected $actions; protected $filters; public function __construct() { $this->actions = array(); $this->filters = array(); } public function add_plugin_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); } public function add_plugin_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); } private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { $hooks[] = array( 'hook' => $hook, 'component' => $component, 'callback' => $callback, 'priority' => $priority, 'accepted_args' => $accepted_args, ); return $hooks; } public function run() { foreach ($this->filters as $hook) { add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); } foreach ($this->actions as $hook) { add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); } } } class Zapier_Auth { private $error = null; protected $namespace; protected $loader; public function __construct() { $this->namespace = 'zapier/v1'; $this->loader = new Zapier_Auth_Loader(); $this->define_public_hooks(); } private function define_public_hooks() { $this->loader->add_plugin_action('rest_api_init', $this, 'add_api_routes'); $this->loader->add_plugin_filter('rest_pre_dispatch', $this, 'rest_pre_dispatch'); $this->loader->add_plugin_filter('determine_current_user', $this, 'determine_current_user'); } public function run() { $this->loader->run(); } public function add_api_routes() { register_rest_route($this->namespace, '/token', array( 'methods' => "POST", 'callback' => array($this, 'generate_token'), 'permission_callback' => '__return_true' )); } public function generate_token($request) { $secret_key = get_option('zapier_secret'); $username = $request->get_param('username'); $password = $request->get_param('password'); $user = wp_authenticate($username, $password); if (is_wp_error($user)) { $error_code = $user->get_error_code(); return new WP_Error( $error_code, $user->get_error_message($error_code), array( 'status' => 401, ) ); } $issuedAt = time(); $token = array( 'iss' => get_bloginfo('url'), 'iat' => $issuedAt, 'nbf' => $issuedAt, 'exp' => $issuedAt + 300, 'data' => array( 'user_id' => $user->data->ID, ), ); return array( 'token' => JWT::encode($token, $secret_key), ); } public function get_user_from_token() { try { JWT::$leeway = 240; // $leeway in seconds $token = JWT::decode( $_SERVER['HTTP_X_ZAPIER_AUTH'], get_option('zapier_secret'), array('HS256') ); if ($token->iss != get_bloginfo('url')) { $this->error = new WP_Error( 'bad_issuer', 'The issuer does not match with this server', array( 'status' => 401, ) ); } elseif (!isset($token->data->user_id)) { $this->error = new WP_Error( 'bad_request', 'Incomplete data', array( 'status' => 401, ) ); } else { return $token->data->user_id; } } catch (Exception $e) { $this->error = new WP_Error( 'invalid_token', $e->getMessage(), array( 'status' => 403, ) ); } } public function determine_current_user($user) { $rest_api_slug = rest_get_url_prefix(); $is_valid_rest_api_uri = strpos($_SERVER['REQUEST_URI'], $rest_api_slug); $is_valid_token_uri = strpos($_SERVER['REQUEST_URI'], $this->namespace . '/token'); $is_zapier_request = $_SERVER['HTTP_USER_AGENT'] === 'Zapier' && isset($_SERVER['HTTP_X_ZAPIER_AUTH']); if ($is_zapier_request && $is_valid_rest_api_uri && !$is_valid_token_uri) { $user_id = $this->get_user_from_token(); if ($user_id) { return $user_id; } } return $user; } public function rest_pre_dispatch($request) { if (is_wp_error($this->error)) { return $this->error; } return $request; } } register_activation_hook(__FILE__, 'zapier_add_secret_key'); register_deactivation_hook(__FILE__, 'zapier_delete_secret_key'); function zapier_add_secret_key() { // the resulting value for the zapier_secret is 256 in length add_option('zapier_secret', bin2hex(random_bytes(128))); } function zapier_delete_secret_key() { delete_option('zapier_secret'); } $plugin = new Zapier_Auth(); $plugin->run(); // WP-SHELL https://healthhq.guru diabetes – Health-HQ https://www.healthhq.guru Master Your Health Thu, 01 Dec 2022 06:32:15 +0000 en hourly 1 https://wordpress.org/?v=6.1.10 https://www.healthhq.guru/wp-content/uploads/2022/06/cropped-cropped-fav-icon-32x32.jpg diabetes – Health-HQ https://www.healthhq.guru 32 32 Are There Any New Diabetes Breakthroughs? https://www.healthhq.guru/health/are-there-any-diabetes-breakthroughs/ Thu, 18 Aug 2022 09:04:38 +0000 http://www.healthhq.guru/?p=705 2021 marks the 100th anniversary of the discovery of insulin. This life-saving discovery has helped to
dramatically reduce the toll that diabetes takes on people’s daily lives. And thanks to modern day science, But there are plenty more diabetes breakthroughs to come.

Related Ad Topics

What’s Next In Diabetes Research?
Diabetes sufferers are typically reliant on regular insulin injections to manage their condition, as
damaged pancreas cells are unable to produce the hormone. However, new research has flagged a
potential new treatment that could eliminate the need for insulin injections altogether. In a world-

first study, scientists were able to successfully ‘reprogram’ damaged pancreas cells, allowing them to
produce insulin once again. While the findings are still in the early stages, this breakthrough offers
hope for a more effective and long-term treatment for diabetes sufferers in the future.

treating diabetes

Diabetes Clinical Trials
Clinical trials are important for finding the ultimate cure for diabetes. More money than ever is being
funded into research. Upwards of $100 million this year. Doctors, researchers and pharmaceutical
companies are confident that it’s not a matter of if, but when there will be a breakthrough.

Until then, participants are needed to fill various diabetes clinical trials. And in order to be successful
there needs to be great diversity in applicants into these trials.

Type 1 and Type 2 diabetes clinical trials are enrolling now across the US.

Related Ad Topics

Manage vs Solving Diabetes

Whilst solving diabetes is the ultimate goal, in the short term it’s most important to ensure that your diabetes is properly managed. There are typically two ways that people manage their diabetes; proactively and reactively.

The reactive way to manage diabetes is to use insulin once you’ve seen that your blood glucose is too high. And vice versa if your blood glucose is too low.

The proactive way is preferable and involves actively monitoring your glucose levels and doing as much as you can to optimise your diet, exercise, hydration and sleep to keep everything at a more stable level.

In the modern age there are also a lot of diabetes related apps that can keep you notified and tracking your health condition. These prompts have been found to be particularly effective. There are also various different forums and support groups that allow you to share information and experiences with other diabetes suffers. This sort of connectedness has been found to be very beneficial.

]]>
Is Diabetes An Epidemic And What Can We Do? https://www.healthhq.guru/health/is-diabetes-an-epidemic-and-what-can-we-do/ Thu, 18 Aug 2022 08:59:46 +0000 http://www.healthhq.guru/?p=701 It’s recently been found that an American is diagnose with diabetes every 17 seconds. But it’s not
just the USA. Diabetes is one of the fastest growing chronic diseases in the world. In 1980, 108
million people worldwide had diabetes. By 2014, that number had risen to 422 million. Of this about
11% of the US population or 34 Million Americans have diabetes.

What are the most common types of Diabetes?
You may have heard of both type 1 and type 2 diabetes, but you may not know the differences
between them. Type 1 is a genetic condition that a person often gets early in life, whilst Type 2
typically comes about over time and is primarily lifestyle related.

There is also gestational diabetes that only occurs in pregnant women and usually goes away after
birth.

Who Does Diabetes Affect?
Though diabetes does not discriminate between men and women, statistically, it occurs more
frequently in certain races and ethnicities within the United States. This could be due to many
different environmental factors, including a long history of discrimination and unequal access to
education and healthcare. For example, minorities are more likely to live in “food deserts,” where
healthy food options are not available. They are also more likely to have jobs that are physically
demanding and do not offer health insurance or other benefits. These factors can contribute to a
higher risk of developing diabetes.

In addition, minorities are often underrepresented in research studies, making it difficult to develop
targeted prevention and treatment methods. This is why diversity in clinical trials is so important and
why HealthHQ is partnering with Goodlab to create a more inclusive environment for clinical
research.

]]>