Changeset 2009447
- Timestamp:
- 01/09/2019 08:56:54 PM (7 years ago)
- File:
-
- 1 edited
-
company-presentation/trunk/careerpagesplugin.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
company-presentation/trunk/careerpagesplugin.php
r1978534 r2009447 9 9 Description: With the Prodii WP-plugin, you can create a profile section on your wordpress homepage showcasing your professional accomplishments. On https://prodii.com you build professional profiles (web pages) by collecting data about your work life. The Prodii plugin integrates information from your prodii account into your wordpress homepage. 10 10 11 Version: 5.0. 011 Version: 5.0.1 12 12 Author: Prodii by Ralph Rezende Larsen 13 13 Author URI: https://prodii.com/view/ralphrezendelarsen … … 64 64 self::$templateini["ini"] = CareerpagesTemplate::getIni(); 65 65 } else { 66 $cp_info = array( 66 $request = new WP_Http; 67 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php'; 68 $httpResult = $request->request( $httpUrl, array( 69 'methoddd' => 'POST', 70 'body' => array( 71 'action' => 'getIni', 72 'key' => self::$templateini["key"], 73 'template' => self::$templateini["template"] 74 ), 75 'sslverify' => false 76 )); 77 78 $httpResponse = null; 79 $httpErrors = null; 80 if(is_wp_error($httpResult)) { 81 $httpErrors = $httpResult->get_error_messages(); 82 } else { 83 $httpResponse = json_decode($httpResult["body"], true); 84 self::$templateini["ini"] = $httpResponse; 85 } 86 87 if(is_wp_error($httpResult)) { 88 foreach ($httpErrors as $error) { 89 self::$templateini["errors"][] = 'Get template initialisation error - '.$error; 90 } 91 } elseif (self::$templateini["ini"] == '') { 92 self::$templateini["errors"][] = 'No template initialisation returned'; 93 } elseif (isset($httpResponse["error"])) { 94 //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]); 95 self::$templateini["errors"][] = $httpResponse["error"]; 96 } 97 98 /*$cp_info = array( 67 99 'action' => 'getIni', 68 100 'key' => self::$templateini["key"], … … 81 113 self::$templateini["errors"][] = "No template initialisation returned from cURL"; 82 114 } 83 curl_close($ch); 115 curl_close($ch);*/ 84 116 } 85 117 } … … 87 119 if (empty(self::$templateini["errors"])) { 88 120 //Get data(Template on local server) or html(Template on Prodii server) 89 $cp_data = array( 121 $request = new WP_Http; 122 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php'; 123 $httpResult = $request->request( $httpUrl, array( 124 'methoddd' => 'POST', 125 'body' => array( 126 'action' => 'get'.self::$templateini["level"].(self::$templateini["local"] ? 'Data' : 'Html'), 127 'key' => self::$templateini["key"], 128 strtolower(self::$templateini["level"]) => self::$templateini["ids"], 129 'template' => self::$templateini["template"], 130 'locale' => self::$templateini["locale"], 131 'local' => self::$templateini["local"], 132 'subdir' => self::$templateini["subdir"], 133 'css' => isset($css) && $css ? $css : '', 134 'googlemapkey' => self::$templateini["googlemapkey"] 135 ), 136 'sslverify' => false 137 )); 138 139 $httpResponse = null; 140 $httpErrors = null; 141 if(is_wp_error($httpResult)) { 142 $httpErrors = $httpResult->get_error_messages(); 143 } else { 144 $httpResponse = json_decode($httpResult["body"], true); 145 } 146 147 if(is_wp_error($httpResult)) { 148 foreach ($httpErrors as $error) { 149 self::$templateini["errors"][] = 'Get '.(self::$templateini["local"] ? 'data' : 'html').' error - '.$error; 150 } 151 } elseif ($httpResponse == '') { 152 self::$templateini["errors"][] = 'No '.(self::$templateini["local"] ? 'data' : 'html').' returned'; 153 } elseif (isset($httpResponse["error"])) { 154 //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]); 155 self::$templateini["errors"][] = $httpResponse["error"]; 156 } elseif (isset($httpResponse["error_message"])) { 157 self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error_message"]); 158 } 159 160 /*$cp_data = array( 90 161 'action' => 'get'.self::$templateini["level"].(self::$templateini["local"] ? 'Data' : 'Html'), 91 162 'key' => self::$templateini["key"], … … 120 191 } 121 192 122 curl_close($ch); 193 curl_close($ch);*/ 123 194 } 124 195 125 196 if (empty(self::$templateini["errors"])) { 126 197 //Set server data 127 $cp_data = array( 198 $request = new WP_Http; 199 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodiiiii.com/common/careerpages/php/careerpageshandler.php'; 200 $httpResult = $request->request( $httpUrl, array( 201 'methoddd' => 'POST', 202 'body' => array( 203 'action' => 'setLogistics', 204 'level' => self::$templateini["level"], 205 'ids' => self::$templateini["ids"], 206 'method' => 'wpplugin', 207 'template' => self::$templateini["template"], 208 'locale' => str_replace("-", "_", self::$templateini["locale"]), 209 'key' => self::$templateini["key"], 210 'clientip' => CareerpagesLibrary::get_client_ip(), 211 'server' => json_encode($_SERVER) 212 ), 213 'sslverify' => false 214 )); 215 216 if(is_wp_error($httpResult)) { 217 $httpErrors = $httpResult->get_error_messages(); 218 219 foreach ($httpErrors as $error) { 220 //self::$templateini["errors"][] = 'Get '.(self::$templateini["local"] ? 'data' : 'html').' error - '.$error; 221 // There is no reason to show this error to the user 222 } 223 } 224 225 /*$cp_data = array( 128 226 'action' => 'setLogistics', 129 227 'level' => self::$templateini["level"], … … 144 242 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 145 243 curl_exec($ch); 146 curl_close($ch); 244 curl_close($ch);*/ 147 245 } 148 246 … … 150 248 if (self::$templateini["local"]) { 151 249 global $skilllevels; 152 if (isset($ response['skilllevels'])) $skilllevels = $response['skilllevels'];250 if (isset($httpResponse['skilllevels'])) $skilllevels = $httpResponse['skilllevels']; 153 251 global $languagelevels; 154 if (isset($ response['languagelevels'])) $languagelevels = $response['languagelevels'];252 if (isset($httpResponse['languagelevels'])) $languagelevels = $httpResponse['languagelevels']; 155 253 156 254 switch (self::$templateini["level"]) { 157 255 case "Company": 158 self::$templateini["gui"] = CareerpagesTemplate::getCompany($ response);256 self::$templateini["gui"] = CareerpagesTemplate::getCompany($httpResponse); 159 257 break; 160 258 case "Network": 161 self::$templateini["gui"] = CareerpagesTemplate::getCompany($ response);259 self::$templateini["gui"] = CareerpagesTemplate::getCompany($httpResponse); 162 260 break; 163 261 case "Team": 164 self::$templateini["gui"] = CareerpagesTemplate::getTeam($ response);262 self::$templateini["gui"] = CareerpagesTemplate::getTeam($httpResponse); 165 263 break; 166 264 case "Profile": 167 self::$templateini["gui"] = CareerpagesTemplate::getProfile($ response);265 self::$templateini["gui"] = CareerpagesTemplate::getProfile($httpResponse); 168 266 break; 169 267 } 170 268 } else { 171 self::$templateini["gui"] = $ response;269 self::$templateini["gui"] = $httpResponse; 172 270 } 173 271 } … … 216 314 217 315 // Get permissions 218 $cp_info = array( 316 $request = new WP_Http; 317 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php'; 318 $httpResult = $request->request( $httpUrl, array( 319 'methoddd' => 'POST', 320 'body' => array( 321 'action' => 'getPermissions', 322 'key' => self::$templateini["key"] 323 ), 324 'sslverify' => false 325 )); 326 327 $httpResponse = null; 328 $httpErrors = null; 329 if(is_wp_error($httpResult)) { 330 $httpErrors = $httpResult->get_error_messages(); 331 } else { 332 $httpResponse = json_decode($httpResult["body"], true); 333 } 334 335 if(is_wp_error($httpResult)) { 336 foreach ($httpErrors as $error) { 337 self::$templateini["errors"][] = 'Permission error - '.$error; 338 } 339 } elseif ($httpResponse == '') { 340 self::$templateini["errors"][] = 'No permissions, the key in the shortcode must be missspelled or wrong'; 341 } elseif (isset($httpResponse["error"])) { 342 //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]); 343 self::$templateini["errors"][] = $httpResponse["error"]; 344 } 345 346 $permissions = $httpResponse; 347 348 /*$cp_info = array( 219 349 'action' => 'getPermissions', 220 350 'key' => self::$templateini["key"] … … 233 363 self::$templateini["errors"][] = "No permissions, the key in the shortcode must be missspelled or wrong"; 234 364 } 235 curl_close($ch); 365 curl_close($ch);*/ 366 236 367 // Template 237 368 if (isset($permissions["premium"]) && $permissions["premium"] && stripos($content, ' template="') !== false) { … … 377 508 break; 378 509 default: 379 echo '¤¤¤ Came here #4 ¤¤¤';380 510 $gui = self::$templateini["gui"]["error"]; 381 511 $content = CareerpagesMain::getErrorGui('Following error was detected', $gui); … … 411 541 } 412 542 543 if( !class_exists( 'WP_Http' ) ) 544 include_once( ABSPATH . WPINC. '/class-http.php' ); 545 413 546 if (class_exists("CareerpagesMain")) { 414 547 $careerpagesMain = new CareerpagesMain(); … … 439 572 function set_admin_statistics($page) { 440 573 //Set server data 441 $cp_data = array( 574 $request = new WP_Http; 575 $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php'; 576 $httpResult = $request->request( $httpUrl, array( 577 'methoddd' => 'POST', 578 'body' => array( 579 'action' => 'setLogistics', 580 'key' => get_option("prodii_key"), 581 'method' => 'wppluginadmin', 582 'page' => $page, 583 'clientip' => CareerpagesLibrary::get_client_ip(), 584 'server' => json_encode($_SERVER) 585 ), 586 'sslverify' => false 587 )); 588 589 if(is_wp_error($httpResult)) { 590 echo $httpResult->get_error_messages(); 591 } else { 592 $httpResponse = json_decode($httpResult["body"], true); 593 } 594 595 /*$cp_data = array( 442 596 'action' => 'setLogistics', 443 597 'key' => get_option("prodii_key"), … … 455 609 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 456 610 curl_exec($ch); 457 curl_close($ch); 611 curl_close($ch);*/ 458 612 } 459 613 … … 567 721 self::set_admin_statistics('settings'); 568 722 569 $cp_data = array( 723 $request = new WP_Http; 724 $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php'; 725 $httpResult = $request->request( $httpUrl, array( 726 'methoddd' => 'POST', 727 'body' => array( 728 'action' => 'getKeyData', 729 'key' => get_option("prodii_key") 730 ), 731 'sslverify' => false 732 )); 733 734 if(is_wp_error($httpResult)) { 735 echo $httpResult->get_error_messages(); 736 } else { 737 $data = json_decode($httpResult["body"], true); 738 } 739 740 /*$cp_data = array( 570 741 'action' => 'getKeyData', 571 742 'key' => get_option("prodii_key") … … 579 750 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 580 751 $data = json_decode(curl_exec($ch), true); 581 curl_close($ch); 752 curl_close($ch);*/ 582 753 583 754 echo ' … … 663 834 function prodii_shortcode_content() { 664 835 //if (is_array($_REQUEST)) $content = "From prodii_shortcode_content <pre>".print_r($_REQUEST, true)."</pre>"; 836 $request = new WP_Http; 837 $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php'; 838 $httpResult = $request->request( $httpUrl, array( 839 'methoddd' => 'POST', 840 'body' => array( 841 'action' => 'getShortcodeHtml', 842 'key' => get_option("prodii_key"), 843 'templateid' => isset($_REQUEST["prodii_templateid"]) ? $_REQUEST["prodii_templateid"] : '', 844 'locale' => isset($_REQUEST["prodii_locale"]) ? $_REQUEST["prodii_locale"] : '', 845 'css' => isset($_REQUEST["prodii_css"]) ? $_REQUEST["prodii_css"] : '', 846 'companyid' => isset($_REQUEST["prodii_companyid"]) ? $_REQUEST["prodii_companyid"] : 0, 847 'teamids' => isset($_REQUEST["prodii_teamids"]) ? $_REQUEST["prodii_teamids"] : '', 848 'teamid' => isset($_REQUEST["prodii_teamid"]) ? $_REQUEST["prodii_teamid"] : 0, 849 'memberid' => isset($_REQUEST["prodii_memberid"]) ? $_REQUEST["prodii_memberid"] : 0, 850 'view' => isset($_REQUEST["prodii_view"]) ? $_REQUEST["prodii_view"] : 'tab-company' 851 ), 852 'sslverify' => false 853 )); 854 855 if(is_wp_error($httpResult)) { 856 echo $httpResult->get_error_messages(); 857 } else { 858 $content = json_decode($httpResult["body"], true); 859 } 860 665 861 $cp_data = array( 666 862 'action' => 'getShortcodeHtml', … … 676 872 ); 677 873 678 $ch = curl_init();874 /*$ch = curl_init(); 679 875 curl_setopt($ch, CURLOPT_URL, 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php'); 680 876 curl_setopt($ch, CURLOPT_POST, count($cp_data)); … … 688 884 $content = json_decode('cURL error ({$errno}):\n {$error_message}'); 689 885 } 690 curl_close($ch); 886 curl_close($ch);*/ 691 887 692 888 return $content;
Note: See TracChangeset
for help on using the changeset viewer.