function tpg_update_notice() { if (!class_exists("tpg_get_posts")) { require_once plugin_dir_path(__FILE__) . "inc/class-tpg-get-posts.php"; } //get plugin options & set paths $gp = new tpg_get_posts(plugin_dir_url(__FILE__), plugin_dir_path(__FILE__), plugin_basename(__FILE__)); //get class factory if (!class_exists("tpg_gp_factory")) { require_once $gp->gp_paths["dir"] . "inc/class-tpg-gp-factory.php"; } $tpg_gp_admin = tpg_gp_factory::create_admin($gp->gp_opts, $gp->gp_paths, true); $updt_msg = $tpg_gp_admin->check_for_update(); if ($updt_msg) { echo '<div id="message" class="updated"><p><strong>' . sprintf(__('An update to ver %s for the tpg-get-posts extension is available. Go to Settings tab to update.', 'tpg-get-posts'), $tpg_gp_admin->v_store) . '</strong></p></div>'; } }
/** * curl_json_req * * send a request to the api * * @param void * @return void */ function curl_json_req($data, $url = '') { if ($url == '') { $url = $this->api_url; } $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FORBID_REUSE, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array("parms" => $data))); curl_setopt($ch, CURLOPT_POST, true); $_res = curl_exec($ch); //res false error, res true chk for json fmt if ($_res) { $_r = json_decode($_res); //if (is_null($_r)) {$_r = $_res;} } else { //get curl error $_r = tpg_gp_factory::create_resp_obj(); $_r->success = false; $_r->add_errmsg(curl_errno($ch), curl_error($ch)); } curl_close($ch); return $_r; }
function gp_admin_load_inc() { //enque css style $tgp_css = "tpg-get-posts-admin.css"; //check if file exists with path if (file_exists($this->gp_paths['css'] . $tgp_css)) { wp_enqueue_style('tpg_get_posts_admin_css', $this->gp_paths['css_url'] . $tgp_css); } if (file_exists($this->gp_paths['css'] . "user-get-posts-style.css")) { wp_enqueue_style('user_get_posts_css', $this->gp_paths['css_url'] . "user-get-posts-style.css"); } //get jquery tabs code wp_enqueue_script('jquery-ui-tabs'); //load admin js code if (file_exists($this->gp_paths['js'] . "tpg-get-posts-admin.js")) { wp_enqueue_script('tpg_get-posts_admin_js', $this->gp_paths['js_url'] . "tpg-get-posts-admin.js"); } //generate pp donate button $ppb = tpg_gp_factory::create_paypal_button(); $ask = "<p>" . __('If this plugin helps you build a website, please consider a small donation of $5 or $10 to continue the support of open source software. Taking one hour‘s fee and spreading it across multiple plugins is an investment that generates amazing returns.', 'tpg-get-posts') . "</p><p>" . __('Thank you for supporting open source software.', 'tpg-get-posts') . "</p>"; $ppb->set_var("for_text", "wordpress plugin tpg-get-posts"); $ppb->set_var("desc", $ask); $this->pp_btn = $ppb->gen_donate_button(); }