Changeset 2026632
- Timestamp:
- 02/07/2019 03:26:31 PM (7 years ago)
- Location:
- company-presentation
- Files:
-
- 19 added
- 4 edited
-
tags/5.1.0 (added)
-
tags/5.1.0/careerpagesplugin.php (added)
-
tags/5.1.0/css (added)
-
tags/5.1.0/css/prettify.css (added)
-
tags/5.1.0/img (added)
-
tags/5.1.0/img/menu-logo.png (added)
-
tags/5.1.0/js (added)
-
tags/5.1.0/js/careerpages.js (added)
-
tags/5.1.0/js/careerpagesadmin.js (added)
-
tags/5.1.0/js/ie10-viewport-bug-workaround.js (added)
-
tags/5.1.0/js/infobox.js (added)
-
tags/5.1.0/js/library.js (added)
-
tags/5.1.0/js/prettify.js (added)
-
tags/5.1.0/php (added)
-
tags/5.1.0/php/careerpageslibrary.php (added)
-
tags/5.1.0/php/careerpagespluginhandler.php (added)
-
tags/5.1.0/php/careerpagespluginlibrary.php (added)
-
tags/5.1.0/readme.txt (added)
-
tags/5.1.0/templates (added)
-
trunk/careerpagesplugin.php (modified) (28 diffs)
-
trunk/php/careerpageslibrary.php (modified) (8 diffs)
-
trunk/php/careerpagespluginlibrary.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
company-presentation/trunk/careerpagesplugin.php
r2009447 r2026632 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.111 Version: 5.1.0 12 12 Author: Prodii by Ralph Rezende Larsen 13 13 Author URI: https://prodii.com/view/ralphrezendelarsen … … 20 20 21 21 function __construct() { 22 include(plugin_dir_path(__FILE__).'php/careerpagespluginlibrary.php'); 23 22 24 } 23 25 … … 34 36 if (empty(self::$templateini["errors"])) { 35 37 self::$templateini["templatedata"]["php"] = CareerpagesMain::webItemExists(plugins_url('templates/'.self::$templateini["template"].'/php/careerpagestemplate.php' , __FILE__ ), array()); 36 //self::$templateini["templatedata"]["js"] = CareerpagesMain::webItemExists(plugins_url('templates/'.self::$templateini["template"].'/js/careerpagestemplate.js' , __FILE__ ), array());37 //self::$templateini["templatedata"]["css"] = CareerpagesMain::webItemExists(self::$templateini["css"] ? self::$templateini["css"] : plugins_url('templates/'.self::$templateini["template"].'/css/careerpagestemplatedefault.css' , __FILE__ ), array());38 38 self::$templateini["pluginurl"] = plugins_url('', __FILE__).'/'; 39 39 self::$templateini["pluginpath"] = plugin_dir_path(__FILE__); 40 //if (self::$templateini["templatedata"]["php"]["status"] && self::$templateini["templatedata"]["js"]["status"] && self::$templateini["templatedata"]["css"]["status"]) {41 40 if (self::$templateini["templatedata"]["php"]["status"]) { 42 41 self::$templateini["local"] = 1; … … 48 47 if (self::$templateini["remote"]["status"]) { 49 48 self::$templateini["local"] = 0; 50 self::$templateini["templateurl"] = 'https://'.(self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.self::$templateini["urlencodedtemplate"].'/';49 self::$templateini["templateurl"] = self::$templateini["prodiiurl"].'/common/careerpages/templates/'.self::$templateini["urlencodedtemplate"].'/'; 51 50 self::$templateini["templatepath"] = ''; 52 51 } else { … … 57 56 58 57 if (empty(self::$templateini["errors"])) { 59 require_once(self::$templateini["pluginpath"].'/php/careerpagespluginlibrary.php');60 61 58 // Get template ini 62 59 if (self::$templateini["local"]) { … … 65 62 } else { 66 63 $request = new WP_Http; 67 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php';64 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpageshandler.php'; 68 65 $httpResult = $request->request( $httpUrl, array( 69 'method dd' => 'POST',66 'method' => 'POST', 70 67 'body' => array( 71 68 'action' => 'getIni', … … 75 72 'sslverify' => false 76 73 )); 77 78 74 $httpResponse = null; 79 75 $httpErrors = null; … … 92 88 self::$templateini["errors"][] = 'No template initialisation returned'; 93 89 } elseif (isset($httpResponse["error"])) { 94 //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]);95 90 self::$templateini["errors"][] = $httpResponse["error"]; 96 91 } 97 98 /*$cp_info = array(99 'action' => 'getIni',100 'key' => self::$templateini["key"],101 'template' => self::$templateini["template"]102 );103 $ch = curl_init();104 curl_setopt($ch, CURLOPT_URL, 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php');105 curl_setopt($ch, CURLOPT_POST, count($cp_info));106 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_info));107 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);108 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);109 self::$templateini["ini"] = json_decode(curl_exec($ch), true);110 if($errno = curl_errno($ch)) {111 self::$templateini["errors"][] = "Get template initialisation cURL error ({$errno}):\n {$error_message}";112 } elseif (self::$templateini["ini"] == '') {113 self::$templateini["errors"][] = "No template initialisation returned from cURL";114 }115 curl_close($ch);*/116 92 } 117 93 } … … 120 96 //Get data(Template on local server) or html(Template on Prodii server) 121 97 $request = new WP_Http; 122 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php'; 98 // Example of url to call to test: http://prodii.local/common/careerpages/php/careerpageshandler.php?action=getTeamData&key=WjEK4UWFcApDLsFR&team=56&template=dublin&locale=en_GB&local=1 99 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpageshandler.php'; 123 100 $httpResult = $request->request( $httpUrl, array( 124 'method dd' => 'POST',101 'method' => 'POST', 125 102 'body' => array( 126 103 'action' => 'get'.self::$templateini["level"].(self::$templateini["local"] ? 'Data' : 'Html'), … … 139 116 $httpResponse = null; 140 117 $httpErrors = null; 118 141 119 if(is_wp_error($httpResult)) { 142 120 $httpErrors = $httpResult->get_error_messages(); 143 121 } else { 144 122 $httpResponse = json_decode($httpResult["body"], true); 123 if (json_last_error()) { 124 $httpResponse = $httpResult["body"]; 125 } 145 126 } 146 127 … … 152 133 self::$templateini["errors"][] = 'No '.(self::$templateini["local"] ? 'data' : 'html').' returned'; 153 134 } elseif (isset($httpResponse["error"])) { 154 //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]);155 135 self::$templateini["errors"][] = $httpResponse["error"]; 156 136 } elseif (isset($httpResponse["error_message"])) { 157 137 self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error_message"]); 158 138 } 159 160 /*$cp_data = array(161 'action' => 'get'.self::$templateini["level"].(self::$templateini["local"] ? 'Data' : 'Html'),162 'key' => self::$templateini["key"],163 strtolower(self::$templateini["level"]) => self::$templateini["ids"],164 'template' => self::$templateini["template"],165 'locale' => self::$templateini["locale"],166 'local' => self::$templateini["local"],167 'subdir' => self::$templateini["subdir"],168 'css' => isset($css) && $css ? $css : '',169 'googlemapkey' => self::$templateini["googlemapkey"]170 );171 172 //echo '<pre>'.print_r($cp_data, true).'</pre>';173 174 // If I will see the URL called by this curl.175 //echo 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php';176 //echo '<pre>'.print_r($cp_data, true).'</pre>';177 $ch = curl_init();178 curl_setopt($ch, CURLOPT_URL, 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php');179 curl_setopt($ch, CURLOPT_POST, count($cp_data));180 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_data));181 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);182 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);183 $response = json_decode(curl_exec($ch), true);184 185 if($errno = curl_errno($ch)) {186 self::$templateini["errors"][] = 'Get '.(self::$templateini["local"] ? 'data' : 'html').' cURL error ({$errno}):\n {$error_message}';187 } elseif ($response == '') {188 self::$templateini["errors"][] = 'No '.(self::$templateini["local"] ? 'data' : 'html').' returned from cURL';189 } elseif (isset($response["error_message"])) {190 self::$templateini["errors"] = array_merge(self::$templateini["errors"], $response["error_message"]);191 }192 193 curl_close($ch);*/194 139 } 195 140 … … 197 142 //Set server data 198 143 $request = new WP_Http; 199 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodiiiii.com/common/careerpages/php/careerpageshandler.php';144 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpageshandler.php'; 200 145 $httpResult = $request->request( $httpUrl, array( 201 'method dd' => 'POST',146 'method' => 'POST', 202 147 '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 ),148 'action' => 'setLogistics', 149 'level' => self::$templateini["level"], 150 'ids' => self::$templateini["ids"], 151 'method' => 'wpplugin', 152 'template' => self::$templateini["template"], 153 'locale' => str_replace("-", "_", self::$templateini["locale"]), 154 'key' => self::$templateini["key"], 155 'clientip' => CareerpagesLibrary::get_client_ip(), 156 'server' => json_encode($_SERVER) 157 ), 213 158 'sslverify' => false 214 159 )); … … 222 167 } 223 168 } 224 225 /*$cp_data = array(226 'action' => 'setLogistics',227 'level' => self::$templateini["level"],228 'ids' => self::$templateini["ids"],229 'method' => 'wpplugin',230 'template' => self::$templateini["template"],231 'locale' => str_replace("-", "_", self::$templateini["locale"]),232 'key' => self::$templateini["key"],233 'clientip' => CareerpagesLibrary::get_client_ip(),234 'server' => json_encode($_SERVER)235 );236 237 $ch = curl_init();238 curl_setopt($ch, CURLOPT_URL, 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php');239 curl_setopt($ch, CURLOPT_POST, count($cp_data));240 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_data));241 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);242 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);243 curl_exec($ch);244 curl_close($ch);*/245 169 } 246 170 247 171 if (empty(self::$templateini["errors"])) { 248 172 if (self::$templateini["local"]) { 173 global $templateini; 174 $templateini = self::$templateini; 175 249 176 global $skilllevels; 250 177 if (isset($httpResponse['skilllevels'])) $skilllevels = $httpResponse['skilllevels']; 178 251 179 global $languagelevels; 252 180 if (isset($httpResponse['languagelevels'])) $languagelevels = $httpResponse['languagelevels']; … … 276 204 self::$templateini = array(); 277 205 self::$templateini["errors"] = array(); 206 self::$templateini["prodiiurl"] = CareerpagesLibrary::getProdiiUrl(); 278 207 279 208 $error = array(); … … 315 244 // Get permissions 316 245 $request = new WP_Http; 317 $httpUrl = 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php';246 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpageshandler.php'; 318 247 $httpResult = $request->request( $httpUrl, array( 319 'method dd' => 'POST',248 'method' => 'POST', 320 249 'body' => array( 321 250 'action' => 'getPermissions', … … 324 253 'sslverify' => false 325 254 )); 326 255 327 256 $httpResponse = null; 328 257 $httpErrors = null; … … 346 275 $permissions = $httpResponse; 347 276 348 /*$cp_info = array(349 'action' => 'getPermissions',350 'key' => self::$templateini["key"]351 );352 $ch = curl_init();353 curl_setopt($ch, CURLOPT_URL, 'https://'.(isset(self::$templateini["subdir"]) && self::$templateini["subdir"] ? self::$templateini["subdir"].'.' : '').'prodii.com/common/careerpages/php/careerpageshandler.php');354 curl_setopt($ch, CURLOPT_POST, count($cp_info));355 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_info));356 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);357 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);358 $permissions = json_decode(curl_exec($ch), true);359 360 if($errno = curl_errno($ch)) {361 self::$templateini["errors"][] = "Permission error ({$errno}):\n {$error_message}";362 } elseif ($permissions == '') {363 self::$templateini["errors"][] = "No permissions, the key in the shortcode must be missspelled or wrong";364 }365 curl_close($ch);*/366 367 277 // Template 368 if (isset($permissions["premium"]) && $permissions["premium"] && stripos($content, ' template="') !== false) { 278 //if (isset($permissions["premium"]) && $permissions["premium"] && stripos($content, ' template="') !== false) { 279 if (stripos($content, ' template="') !== false) { 369 280 $startpos = stripos($content, ' template="') + 11; 370 281 self::$templateini["template"] = substr($content, $startpos, stripos($content, '"', $startpos) - $startpos); … … 376 287 377 288 // Locale 378 if (isset($permissions["locales"]) && $permissions["locales"] && stripos($content, ' locale="') !== false) { 289 //if (isset($permissions["locales"]) && $permissions["locales"] && stripos($content, ' locale="') !== false) { 290 if (stripos($content, ' locale="') !== false) { 379 291 $startpos = stripos($content, ' locale="') + 9; 380 292 self::$templateini["locale"] = substr($content, $startpos, stripos($content, '"', $startpos) - $startpos); … … 512 424 break; 513 425 } 514 //$content = '<h2>Sorry for the inconvenience</h2><br>'.$content;515 426 } elseif (!empty(self::$templateini["errors"])) { 516 427 $gui = ' <ul style="margin-left:1.25em;margin-bottom: 0;">'; … … 522 433 } else { 523 434 $content = ' 524 <input id="handler" type="hidden" value="'.plugins_url('php/careerpagespluginhandler.php' , __FILE__ ).'"/>525 <input id="local" type="hidden" value="'.(isset(self::$templateini["local"]) ? self::$templateini["local"] : "").'"/>526 <input id="subdir" type="hidden" value="'.(isset($atts["subdir"]) && $atts["subdir"] ? $atts["subdir"] : "").'"/>527 <input id="template" type="hidden" value="'.$atts["template"].'"/>528 <input id="locale" type="hidden" value="'.(isset($atts["locale"]) && $atts["locale"] ? $atts["locale"] : 'en_GB').'"/>529 <input id="key" type="hidden" value="'.$atts["key"].'"/>530 <input id="companyids" type="hidden" value="'.($atts["level"] == "Company" || $atts["level"] == "Network" ? $atts["ids"] : "0").'"/>531 <input id="teamid" type="hidden" value="'.($atts["level"] == "Team" ? $atts["ids"] : "0").'"/>532 <input id="profileid" type="hidden" value="'.($atts["level"] == "Profile" ? $atts["ids"] : "0").'"/>533 '.(isset($atts["css"]) && $atts["css"] ? '<input id="css" type="hidden" value="'.$atts["css"].'"/>' : '<input id="css" type="hidden" value="careerpagestemplatedefault.css"/>').'534 <div id="careerpagescontent" class="prd-body">'.(isset(self::$templateini["gui"]) ? self::$templateini["gui"] : '').'</div>535 ';435 <input id="handler" type="hidden" value="'.plugins_url('php/careerpagespluginhandler.php' , __FILE__ ).'"/> 436 <input id="local" type="hidden" value="'.(isset(self::$templateini["local"]) ? self::$templateini["local"] : "").'"/> 437 <input id="subdir" type="hidden" value="'.(isset($atts["subdir"]) && $atts["subdir"] ? $atts["subdir"] : "").'"/> 438 <input id="template" type="hidden" value="'.$atts["template"].'"/> 439 <input id="locale" type="hidden" value="'.(isset($atts["locale"]) && $atts["locale"] ? $atts["locale"] : 'en_GB').'"/> 440 <input id="key" type="hidden" value="'.$atts["key"].'"/> 441 <input id="companyids" type="hidden" value="'.($atts["level"] == "Company" || $atts["level"] == "Network" ? $atts["ids"] : "0").'"/> 442 <input id="teamid" type="hidden" value="'.($atts["level"] == "Team" ? $atts["ids"] : "0").'"/> 443 <input id="profileid" type="hidden" value="'.($atts["level"] == "Profile" ? $atts["ids"] : "0").'"/> 444 '.(isset($atts["css"]) && $atts["css"] ? '<input id="css" type="hidden" value="'.$atts["css"].'"/>' : '<input id="css" type="hidden" value="careerpagestemplatedefault.css"/>').' 445 <div id="careerpagescontent" class="prd-body">'.(isset(self::$templateini["gui"]) ? self::$templateini["gui"] : '').'</div> 446 '; 536 447 } 537 448 … … 567 478 //require_once(self::$templateini["pluginpath"].'/php/careerpagespluginlibrary.php'); 568 479 //require_once(plugins_url('php/careerpagespluginlibrary.php' , __FILE__ )); 569 include(plugin_dir_path(__FILE__).'php/careerpagespluginlibrary.php');480 //include(plugin_dir_path(__FILE__).'php/careerpagespluginlibrary.php'); 570 481 } 571 482 … … 573 484 //Set server data 574 485 $request = new WP_Http; 575 $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php';486 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpagesadminhandler.php'; 576 487 $httpResult = $request->request( $httpUrl, array( 577 'method dd' => 'POST',488 'method' => 'POST', 578 489 'body' => array( 579 490 'action' => 'setLogistics', … … 592 503 $httpResponse = json_decode($httpResult["body"], true); 593 504 } 594 595 /*$cp_data = array(596 'action' => 'setLogistics',597 'key' => get_option("prodii_key"),598 'method' => 'wppluginadmin',599 'page' => $page,600 'clientip' => CareerpagesLibrary::get_client_ip(),601 'server' => json_encode($_SERVER)602 );603 604 $ch = curl_init();605 curl_setopt($ch, CURLOPT_URL, 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php');606 curl_setopt($ch, CURLOPT_POST, count($cp_data));607 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_data));608 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);609 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);610 curl_exec($ch);611 curl_close($ch);*/612 505 } 613 506 … … 722 615 723 616 $request = new WP_Http; 724 $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php';617 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpagesadminhandler.php'; 725 618 $httpResult = $request->request( $httpUrl, array( 726 'method dd' => 'POST',619 'method' => 'POST', 727 620 'body' => array( 728 621 'action' => 'getKeyData', … … 737 630 $data = json_decode($httpResult["body"], true); 738 631 } 739 740 /*$cp_data = array(741 'action' => 'getKeyData',742 'key' => get_option("prodii_key")743 );744 745 $ch = curl_init();746 curl_setopt($ch, CURLOPT_URL, 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php');747 curl_setopt($ch, CURLOPT_POST, count($cp_data));748 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_data));749 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);750 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);751 $data = json_decode(curl_exec($ch), true);752 curl_close($ch);*/753 632 754 633 echo ' … … 835 714 //if (is_array($_REQUEST)) $content = "From prodii_shortcode_content <pre>".print_r($_REQUEST, true)."</pre>"; 836 715 $request = new WP_Http; 837 $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php';716 $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpagesadminhandler.php'; 838 717 $httpResult = $request->request( $httpUrl, array( 839 'method dd' => 'POST',718 'method' => 'POST', 840 719 'body' => array( 841 720 'action' => 'getShortcodeHtml', … … 858 737 $content = json_decode($httpResult["body"], true); 859 738 } 860 861 $cp_data = array(862 'action' => 'getShortcodeHtml',863 'key' => get_option("prodii_key"),864 'templateid' => isset($_REQUEST["prodii_templateid"]) ? $_REQUEST["prodii_templateid"] : '',865 'locale' => isset($_REQUEST["prodii_locale"]) ? $_REQUEST["prodii_locale"] : '',866 'css' => isset($_REQUEST["prodii_css"]) ? $_REQUEST["prodii_css"] : '',867 'companyid' => isset($_REQUEST["prodii_companyid"]) ? $_REQUEST["prodii_companyid"] : 0,868 'teamids' => isset($_REQUEST["prodii_teamids"]) ? $_REQUEST["prodii_teamids"] : '',869 'teamid' => isset($_REQUEST["prodii_teamid"]) ? $_REQUEST["prodii_teamid"] : 0,870 'memberid' => isset($_REQUEST["prodii_memberid"]) ? $_REQUEST["prodii_memberid"] : 0,871 'view' => isset($_REQUEST["prodii_view"]) ? $_REQUEST["prodii_view"] : 'tab-company'872 );873 874 /*$ch = curl_init();875 curl_setopt($ch, CURLOPT_URL, 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php');876 curl_setopt($ch, CURLOPT_POST, count($cp_data));877 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cp_data));878 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);879 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);880 curl_setopt($ch, CURLOPT_FAILONERROR, true);881 $content = json_decode(curl_exec($ch), true);882 883 if(curl_errno($ch)) {884 $content = json_decode('cURL error ({$errno}):\n {$error_message}');885 }886 curl_close($ch);*/887 739 888 740 return $content; … … 892 744 if (!isset($_POST["prodii_nonce"]) || !wp_verify_nonce($_POST["prodii_nonce"], 'prodii_nonce')) die('Permissions check failed'); 893 745 894 //echo "From ajax_prodii_shortcode_content <pre>".print_r($_POST, true)."</pre>";895 746 echo self::prodii_shortcode_content(); 896 747 -
company-presentation/trunk/php/careerpageslibrary.php
r1978534 r2026632 1 1 <?php 2 // careerpagespluginlibrary.php must always be identical with careerpageslibrary.php in all locations 3 // It holds the same classname 'CareerpagesLibrary' and is called from various places 4 // 5 // The class 'CareerpagesLibrary' are located in following files and places: 6 // - plugin: trunk\php\careerpageslibrary.php 7 // - plugin: trunk\php\careerpagespluginlibrary.php 8 // - prodii: common\careerpages\php\careerpageslibrary.php 9 // - prodii: common\careerpages\plugin\php\careerpagespluginlibrary.php 10 2 11 class CareerpagesLibrary { 3 12 … … 20 29 $textdomain = textdomain($domain); 21 30 $setlocale2 = setlocale(LC_ALL, "0"); 22 23 /*if (true) {24 $templateini["infogui"] = '25 <br>26 setlocale1: '.$setlocale1.'<br>27 locale: '.$locale.'<br>28 putenv: '.$putenv.'<br>29 setlocale: '.$setlocale.'<br>30 domain: '.$domain.'<br>31 localesurl: '.$localesurl.'<br>32 bindtextdomain: '.$bindtextdomain.'<br>33 bind_textdomain_codeset: '.$bind_textdomain_codeset.'<br>34 textdomain: '.$textdomain.'<br>35 gettext(Phone): '.gettext("Phone").'<br>36 time(): '.time().'<br>37 setlocale2: '.$setlocale2.'38 <br>39 <br>40 ';41 }*/42 31 } else { 43 32 $templateini["infogui"] = "<br>You do not have the gettext library installed with PHP.<br><br>"; … … 281 270 return $address; 282 271 } 283 284 /*// Gets the url to an uploaded image, if no image is present returns an image placeholder 285 public static function getCareerpagesImage($filename, $template) { 286 return $filename ? self::getUploadimageurl($filename) : self::getCareerpagesImageurl('image-placeholder900x600.png', $template); 287 } 288 289 // Gets an the url to a profile image, if no image is present returns an image placeholder 290 public static function getCareerpagesProfileimage($filename, $mediaid, $template) { 291 return $filename ? ($mediaid ? $filename : self::getSiteUrl()."/common/uploadimages/".$filename) : self::getCareerpagesImageurl('image-placeholder310x310.png', $template); 292 } 293 294 // Gets an the url to an template image, if no image is present returns an image placeholder 295 public static function getCareerpagesImageurl($filename, $template) { 296 return self::getSiteUrl().'/common/careerpages/templates/'.$template.'/images/'.$filename; 297 } 298 299 public static function getUploadimageurl($filename) { 300 return self::getSiteUrl().'/common/uploadimages/'.$filename; 301 }*/ 302 303 public static function getImageurl($filename) { 304 global $templateini; 305 306 if ($filename) { 272 273 public static function getImageurl($image) { 274 global $templateini; 275 276 if ($image["url"]) { 307 277 if($templateini["local"]) { 308 $url = $templateini["templateurl"].'images/'.$ filename;309 } else { 310 $url = Library::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$filename;278 $url = $templateini["templateurl"].'images/'.$image["url"]; 279 } else { 280 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$image["url"]; 311 281 } 312 282 } … … 315 285 } 316 286 317 public static function getProfileimageurl($templateimages, $imageurl, $mediaid) { 318 global $templateini; 319 320 if ($imageurl) { 321 if($mediaid) { 322 $url = $imageurl; 323 } else { 324 //$url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/uploadimages/'.$imageurl; 325 $url = Library::getSiteUrl().'/common/uploadimages/'.$imageurl; 287 public static function getProfileimageurl($templateimages, $image) { 288 global $templateini; 289 290 if ($image["url"]) { 291 if($image["mediasid"]) { 292 $url = $image["url"]; 293 } else { 294 $url = self::getProdiiUrl().'/common/uploadimages/'.$image["url"]; 326 295 } 327 296 } else { … … 329 298 $url = $templateini["templateurl"].'images/'.$templateimages["profile_image_placeholder"]; 330 299 } else { 331 //$url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["profile_image_placeholder"]; 332 $url = Library::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["profile_image_placeholder"]; 300 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["profile_image_placeholder"]; 333 301 } 334 302 } … … 337 305 } 338 306 339 public static function getTeamimageurl($templateimages, $filename) { 340 global $templateini; 341 342 if ($filename) { 343 //$url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/uploadimages/'.$filename; 344 $url = Library::getSiteUrl().'/common/uploadimages/'.$filename; 307 public static function getTeamimageurl($templateimages, $image) { 308 global $templateini; 309 310 if ($image["url"]) { 311 $url = self::getProdiiUrl().'/common/uploadimages/'.$image["url"]; 345 312 } else { 346 313 if($templateini["local"]) { 347 314 $url = $templateini["templateurl"].'images/'.$templateimages["team_image_placeholder"]; 348 315 } else { 349 //$url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["team_image_placeholder"]; 350 $url = Library::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["team_image_placeholder"]; 316 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["team_image_placeholder"]; 351 317 } 352 318 } … … 355 321 } 356 322 357 public static function getCompanyimageurl($templateimages, $filename) { 358 global $templateini; 359 360 if ($filename) { 361 //$url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/uploadimages/'.$filename; 362 $url = Library::getSiteUrl().'/common/uploadimages/'.$filename; 323 public static function getCompanyimageurl($templateimages, $image) { 324 global $templateini; 325 326 if ($image["url"]) { 327 $url = self::getProdiiUrl().'/common/uploadimages/'.$image["url"]; 363 328 } else { 364 329 if($templateini["local"]) { 365 330 $url = $templateini["templateurl"].'images/'.$templateimages["company_image_placeholder"]; 366 331 } else { 367 //$url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["company_image_placeholder"]; 368 $url = Library::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["company_image_placeholder"]; 332 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["company_image_placeholder"]; 369 333 } 370 334 } … … 381 345 return $uri; 382 346 } 347 348 public static function getProdiiUrl() { 349 if(strpos($_SERVER["SERVER_NAME"], '.local') === true) { 350 $name = 'prodii.local'; 351 } else { 352 $name = $_SERVER["SERVER_NAME"]; 353 } 354 $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; 355 $protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")) . $s; 356 $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); 357 $uri = $protocol . "://" . $name; // . $port; 358 359 return $uri; 360 } 383 361 } 384 362 ?> -
company-presentation/trunk/php/careerpagespluginlibrary.php
r1978534 r2026632 1 1 <?php 2 // careerpagespluginlibrary.php must always be identical with careerpageslibrary.php in all locations 3 // It holds the same classname 'CareerpagesLibrary' and is called from various places 4 // 5 // The class 'CareerpagesLibrary' are located in following files and places: 6 // - plugin: trunk\php\careerpageslibrary.php 7 // - plugin: trunk\php\careerpagespluginlibrary.php 8 // - prodii: common\careerpages\php\careerpageslibrary.php 9 // - prodii: common\careerpages\plugin\php\careerpagespluginlibrary.php 10 2 11 class CareerpagesLibrary { 3 12 13 // Do not change the initiate function 14 public static function initiateLocale() { 15 global $templateini; 16 17 //$templateimages = self::getImages(); 18 19 clearstatcache(); 20 if (true === function_exists('gettext')) { 21 $setlocale1 = setlocale(LC_ALL, "0"); 22 $locale = setlocale(LC_ALL, str_replace("_", "-", $templateini["locale"]), str_replace("-", "_", $templateini["locale"]), 'en-GB'); //self::fitLocaletoserver($templateini["locale"]); 23 $putenv = putenv("LANG=".$locale); 24 $setlocale = setlocale(LC_ALL, $locale); 25 $domain = $templateini["template"].'-'.str_replace("-", "_", $templateini["locale"]); 26 $localesurl = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT'].'/common/careerpages/templates/'.$templateini["template"].'/locales'); 27 $bindtextdomain = bindtextdomain($domain, str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT'].'/common/careerpages/templates/'.$templateini["template"].'/locales')); 28 $bind_textdomain_codeset = bind_textdomain_codeset($domain, 'utf8'); 29 $textdomain = textdomain($domain); 30 $setlocale2 = setlocale(LC_ALL, "0"); 31 } else { 32 $templateini["infogui"] = "<br>You do not have the gettext library installed with PHP.<br><br>"; 33 } 34 } 4 35 5 36 public static function testEmail($email) { … … 20 51 21 52 public static function getStaticmap($latitude, $longitude, $zoom, $w, $h, $marker) { 22 return '//maps.googleapis.com/maps/api/staticmap?center='.$latitude.','.$longitude.'&zoom='.$zoom.'&size='.$w.'x'.$h.'&maptype=roadmap&markers=color:'.$marker.'%7Ccolor:'.$marker.'%7C'.$latitude.','.$longitude .'&sensor=false';53 return '//maps.googleapis.com/maps/api/staticmap?center='.$latitude.','.$longitude.'&zoom='.$zoom.'&size='.$w.'x'.$h.'&maptype=roadmap&markers=color:'.$marker.'%7Ccolor:'.$marker.'%7C'.$latitude.','.$longitude; 23 54 } 24 55 … … 239 270 return $address; 240 271 } 241 242 /*// Gets the url to an uploaded image, if no image is present returns an image placeholder 243 public static function getCareerpagesImage($filename, $template) { 244 return $filename ? self::getUploadimageurl($filename) : self::getCareerpagesImageurl('image-placeholder900x600.png', $template); 245 } 246 247 // Gets an the url to a profile image, if no image is present returns an image placeholder 248 public static function getCareerpagesProfileimage($filename, $mediaid, $template) { 249 return $filename ? ($mediaid ? $filename : self::getSiteUrl()."/common/uploadimages/".$filename) : self::getCareerpagesImageurl('image-placeholder310x310.png', $template); 250 } 251 252 // Gets an the url to an template image, if no image is present returns an image placeholder 253 public static function getCareerpagesImageurl($filename, $template) { 254 return self::getSiteUrl().'/common/careerpages/templates/'.$template.'/images/'.$filename; 255 } 256 257 public static function getUploadimageurl($filename) { 258 return self::getSiteUrl().'/common/uploadimages/'.$filename; 259 }*/ 260 261 public static function getImageurl($filename) { 262 global $templateini; 263 264 if ($filename) { 272 273 public static function getImageurl($image) { 274 global $templateini; 275 276 if ($image["url"]) { 265 277 if($templateini["local"]) { 266 $url = $templateini["templateurl"].'images/'.$ filename;267 } else { 268 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$filename;278 $url = $templateini["templateurl"].'images/'.$image["url"]; 279 } else { 280 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$image["url"]; 269 281 } 270 282 } … … 273 285 } 274 286 275 public static function getProfileimageurl($templateimages, $image url, $mediaid) {276 global $templateini; 277 278 if ($image url) {279 if($ mediaid) {280 $url = $image url;281 } else { 282 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/uploadimages/'.$imageurl;287 public static function getProfileimageurl($templateimages, $image) { 288 global $templateini; 289 290 if ($image["url"]) { 291 if($image["mediasid"]) { 292 $url = $image["url"]; 293 } else { 294 $url = self::getProdiiUrl().'/common/uploadimages/'.$image["url"]; 283 295 } 284 296 } else { … … 286 298 $url = $templateini["templateurl"].'images/'.$templateimages["profile_image_placeholder"]; 287 299 } else { 288 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["profile_image_placeholder"];300 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["profile_image_placeholder"]; 289 301 } 290 302 } … … 293 305 } 294 306 295 public static function getTeamimageurl($templateimages, $ filename) {296 global $templateini; 297 298 if ($ filename) {299 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/uploadimages/'.$filename;307 public static function getTeamimageurl($templateimages, $image) { 308 global $templateini; 309 310 if ($image["url"]) { 311 $url = self::getProdiiUrl().'/common/uploadimages/'.$image["url"]; 300 312 } else { 301 313 if($templateini["local"]) { 302 314 $url = $templateini["templateurl"].'images/'.$templateimages["team_image_placeholder"]; 303 315 } else { 304 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["team_image_placeholder"];316 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["team_image_placeholder"]; 305 317 } 306 318 } … … 309 321 } 310 322 311 public static function getCompanyimageurl($templateimages, $ filename) {312 global $templateini; 313 314 if ($ filename) {315 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/uploadimages/'.$filename;323 public static function getCompanyimageurl($templateimages, $image) { 324 global $templateini; 325 326 if ($image["url"]) { 327 $url = self::getProdiiUrl().'/common/uploadimages/'.$image["url"]; 316 328 } else { 317 329 if($templateini["local"]) { 318 330 $url = $templateini["templateurl"].'images/'.$templateimages["company_image_placeholder"]; 319 331 } else { 320 $url = 'https://'.(isset($templateini["subdir"]) && $templateini["subdir"] ? $templateini["subdir"].'.' : '').'prodii.com/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["company_image_placeholder"];332 $url = self::getSiteUrl().'/common/careerpages/templates/'.$templateini["template"].'/images/'.$templateimages["company_image_placeholder"]; 321 333 } 322 334 } … … 333 345 return $uri; 334 346 } 347 348 public static function getProdiiUrl() { 349 if(strpos($_SERVER["SERVER_NAME"], '.local') === true) { 350 $name = 'prodii.local'; 351 } else { 352 $name = $_SERVER["SERVER_NAME"]; 353 } 354 $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; 355 $protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")) . $s; 356 $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); 357 $uri = $protocol . "://" . $name; // . $port; 358 359 return $uri; 360 } 335 361 } 336 362 ?> -
company-presentation/trunk/readme.txt
r2009446 r2026632 4 4 Requires at least: 4.0 5 5 Tested up to: 5.0.3 6 Stable tag: 5. 0.16 Stable tag: 5.1.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 197 197 198 198 == Changelog == 199 200 = 5.1.0 = 201 * Modification - The old data structure were designed to specific elements, but now we are introducing a new and more generic data structure. 202 * Modification - The media icons from Awesome Fonts is no longer used. Instead we hold all the icons from the media that we supports on prodii.com. The new icons is in colors, so if you are the developer of a Prodii template, you are free to show them as you like. With pure css you can choose to style the icon to show them in colors, white or any other color just as you like. 199 203 200 204 = 5.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.