Plugin Directory

Changeset 2026632


Ignore:
Timestamp:
02/07/2019 03:26:31 PM (7 years ago)
Author:
Ralph Rezende
Message:

New version 5.1.0

Location:
company-presentation
Files:
19 added
4 edited

Legend:

Unmodified
Added
Removed
  • company-presentation/trunk/careerpagesplugin.php

    r2009447 r2026632  
    99Description: 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.
    1010
    11 Version: 5.0.1
     11Version: 5.1.0
    1212Author: Prodii by Ralph Rezende Larsen
    1313Author URI: https://prodii.com/view/ralphrezendelarsen
     
    2020
    2121        function __construct() {
     22            include(plugin_dir_path(__FILE__).'php/careerpagespluginlibrary.php');
     23
    2224        }
    2325       
     
    3436            if (empty(self::$templateini["errors"])) {
    3537                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());
    3838                self::$templateini["pluginurl"] = plugins_url('', __FILE__).'/';
    3939                self::$templateini["pluginpath"] = plugin_dir_path(__FILE__);
    40                 //if (self::$templateini["templatedata"]["php"]["status"] && self::$templateini["templatedata"]["js"]["status"] && self::$templateini["templatedata"]["css"]["status"]) {
    4140                if (self::$templateini["templatedata"]["php"]["status"]) {
    4241                    self::$templateini["local"] = 1;
     
    4847                    if (self::$templateini["remote"]["status"]) {
    4948                        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"].'/';
    5150                        self::$templateini["templatepath"] = '';
    5251                    } else {
     
    5756
    5857            if (empty(self::$templateini["errors"])) {
    59                 require_once(self::$templateini["pluginpath"].'/php/careerpagespluginlibrary.php');
    60                
    6158                // Get template ini
    6259                if (self::$templateini["local"]) {
     
    6562                } else {
    6663                    $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';
    6865                    $httpResult = $request->request( $httpUrl, array(
    69                         'methoddd' => 'POST',
     66                        'method' => 'POST',
    7067                        'body' =>   array(
    7168                                        'action' => 'getIni',
     
    7572                        'sslverify' => false
    7673                    ));
    77 
    7874                    $httpResponse = null;
    7975                    $httpErrors = null;
     
    9288                        self::$templateini["errors"][] = 'No template initialisation returned';
    9389                    } elseif (isset($httpResponse["error"])) {
    94                         //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]);
    9590                        self::$templateini["errors"][] = $httpResponse["error"];
    9691                    }
    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);*/
    11692                }
    11793            }
     
    12096                //Get data(Template on local server) or html(Template on Prodii server)
    12197                $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';
    123100                $httpResult = $request->request( $httpUrl, array(
    124                     'methoddd' => 'POST',
     101                    'method' => 'POST',
    125102                    'body' =>   array(
    126103                                    'action' => 'get'.self::$templateini["level"].(self::$templateini["local"] ? 'Data' : 'Html'),
     
    139116                $httpResponse = null;
    140117                $httpErrors = null;
     118
    141119                if(is_wp_error($httpResult)) {
    142120                    $httpErrors = $httpResult->get_error_messages();
    143121                } else {
    144122                    $httpResponse = json_decode($httpResult["body"], true);
     123                    if (json_last_error()) {
     124                        $httpResponse = $httpResult["body"];
     125                    }
    145126                }
    146127
     
    152133                    self::$templateini["errors"][] = 'No '.(self::$templateini["local"] ? 'data' : 'html').' returned';
    153134                } elseif (isset($httpResponse["error"])) {
    154                     //self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error"]);
    155135                    self::$templateini["errors"][] = $httpResponse["error"];
    156136                } elseif (isset($httpResponse["error_message"])) {
    157137                    self::$templateini["errors"] = array_merge(self::$templateini["errors"], $httpResponse["error_message"]);
    158138                }
    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);*/
    194139            }
    195140
     
    197142                //Set server data
    198143                $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';
    200145                $httpResult = $request->request( $httpUrl, array(
    201                     'methoddd' => 'POST',
     146                    'method' => 'POST',
    202147                    '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                    ),
    213158                    'sslverify' => false
    214159                ));
     
    222167                    }
    223168                }
    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);*/
    245169            }
    246170           
    247171            if (empty(self::$templateini["errors"])) {
    248172                if (self::$templateini["local"]) {
     173                    global $templateini;
     174                    $templateini = self::$templateini;
     175                   
    249176                    global $skilllevels;
    250177                    if (isset($httpResponse['skilllevels'])) $skilllevels = $httpResponse['skilllevels'];
     178                   
    251179                    global $languagelevels;
    252180                    if (isset($httpResponse['languagelevels'])) $languagelevels = $httpResponse['languagelevels'];
     
    276204                self::$templateini = array();
    277205                self::$templateini["errors"] = array();
     206                self::$templateini["prodiiurl"] = CareerpagesLibrary::getProdiiUrl();
    278207
    279208                $error = array();
     
    315244                    // Get permissions
    316245                    $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';
    318247                    $httpResult = $request->request( $httpUrl, array(
    319                         'methoddd' => 'POST',
     248                        'method' => 'POST',
    320249                        'body' =>   array(
    321250                                        'action' => 'getPermissions',
     
    324253                        'sslverify' => false
    325254                    ));
    326 
     255                   
    327256                    $httpResponse = null;
    328257                    $httpErrors = null;
     
    346275                    $permissions = $httpResponse;
    347276                   
    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                    
    367277                    // 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) {
    369280                        $startpos = stripos($content, ' template="') + 11;
    370281                        self::$templateini["template"] = substr($content, $startpos, stripos($content, '"', $startpos) - $startpos);
     
    376287
    377288                    // 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) {
    379291                        $startpos = stripos($content, ' locale="') + 9;
    380292                        self::$templateini["locale"] = substr($content, $startpos, stripos($content, '"', $startpos) - $startpos);
     
    512424                        break;
    513425                }           
    514                 //$content = '<h2>Sorry for the inconvenience</h2><br>'.$content;
    515426            } elseif (!empty(self::$templateini["errors"])) {
    516427                $gui =  '   <ul style="margin-left:1.25em;margin-bottom: 0;">';
     
    522433            } else {
    523434                $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                            ';
    536447            }
    537448           
     
    567478            //require_once(self::$templateini["pluginpath"].'/php/careerpagespluginlibrary.php');
    568479            //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');
    570481        }
    571482
     
    573484            //Set server data
    574485            $request = new WP_Http;
    575             $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php';
     486            $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpagesadminhandler.php';
    576487            $httpResult = $request->request( $httpUrl, array(
    577                 'methoddd' => 'POST',
     488                'method' => 'POST',
    578489                'body' =>   array(
    579490                                'action' => 'setLogistics',
     
    592503                $httpResponse = json_decode($httpResult["body"], true);
    593504            }
    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);*/
    612505        }
    613506
     
    722615
    723616            $request = new WP_Http;
    724             $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php';
     617            $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpagesadminhandler.php';
    725618            $httpResult = $request->request( $httpUrl, array(
    726                 'methoddd' => 'POST',
     619                'method' => 'POST',
    727620                'body' =>   array(
    728621                                'action' => 'getKeyData',
     
    737630                $data = json_decode($httpResult["body"], true);
    738631            }
    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);*/
    753632           
    754633            echo    '
     
    835714            //if (is_array($_REQUEST)) $content = "From prodii_shortcode_content <pre>".print_r($_REQUEST, true)."</pre>";
    836715            $request = new WP_Http;
    837             $httpUrl = 'https://prodii.com/common/careerpages/php/careerpagesadminhandler.php';
     716            $httpUrl = self::$templateini["prodiiurl"].'/common/careerpages/php/careerpagesadminhandler.php';
    838717            $httpResult = $request->request( $httpUrl, array(
    839                 'methoddd' => 'POST',
     718                'method' => 'POST',
    840719                'body' =>   array(
    841720                                'action' => 'getShortcodeHtml',
     
    858737                $content = json_decode($httpResult["body"], true);
    859738            }
    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);*/
    887739           
    888740            return $content;
     
    892744            if (!isset($_POST["prodii_nonce"]) || !wp_verify_nonce($_POST["prodii_nonce"], 'prodii_nonce')) die('Permissions check failed');
    893745           
    894             //echo "From ajax_prodii_shortcode_content <pre>".print_r($_POST, true)."</pre>";
    895746            echo self::prodii_shortcode_content();
    896747           
  • company-presentation/trunk/php/careerpageslibrary.php

    r1978534 r2026632  
    11<?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
    211class CareerpagesLibrary {
    312
     
    2029            $textdomain = textdomain($domain);
    2130            $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             }*/
    4231        } else {
    4332            $templateini["infogui"] = "<br>You do not have the gettext library installed with PHP.<br><br>";
     
    281270        return $address;
    282271    }
    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"]) {
    307277            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"];
    311281            }
    312282        }
     
    315285    }
    316286
    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"];
    326295            }
    327296        } else {
     
    329298                $url = $templateini["templateurl"].'images/'.$templateimages["profile_image_placeholder"];
    330299            } 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"];
    333301            }
    334302        }
     
    337305    }
    338306
    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"];
    345312        } else {
    346313            if($templateini["local"]) {
    347314                $url = $templateini["templateurl"].'images/'.$templateimages["team_image_placeholder"];
    348315            } 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"];
    351317            }
    352318        }
     
    355321    }
    356322
    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"];
    363328        } else {
    364329            if($templateini["local"]) {
    365330                $url = $templateini["templateurl"].'images/'.$templateimages["company_image_placeholder"];
    366331            } 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"];
    369333            }
    370334        }
     
    381345        return $uri;
    382346    }
     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    }
    383361}
    384362?>
  • company-presentation/trunk/php/careerpagespluginlibrary.php

    r1978534 r2026632  
    11<?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
    211class CareerpagesLibrary {
    312
     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    }
    435
    536    public static function testEmail($email) {
     
    2051   
    2152    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;
    2354    }
    2455
     
    239270        return $address;
    240271    }
    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"]) {
    265277            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"];
    269281            }
    270282        }
     
    273285    }
    274286
    275     public static function getProfileimageurl($templateimages, $imageurl, $mediaid) {
    276         global $templateini;
    277 
    278         if ($imageurl) {
    279             if($mediaid) {
    280                 $url = $imageurl;
    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"];
    283295            }
    284296        } else {
     
    286298                $url = $templateini["templateurl"].'images/'.$templateimages["profile_image_placeholder"];
    287299            } 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"];
    289301            }
    290302        }
     
    293305    }
    294306
    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"];
    300312        } else {
    301313            if($templateini["local"]) {
    302314                $url = $templateini["templateurl"].'images/'.$templateimages["team_image_placeholder"];
    303315            } 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"];
    305317            }
    306318        }
     
    309321    }
    310322
    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"];
    316328        } else {
    317329            if($templateini["local"]) {
    318330                $url = $templateini["templateurl"].'images/'.$templateimages["company_image_placeholder"];
    319331            } 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"];
    321333            }
    322334        }
     
    333345        return $uri;
    334346    }
     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    }
    335361}
    336362?>
  • company-presentation/trunk/readme.txt

    r2009446 r2026632  
    44Requires at least: 4.0
    55Tested up to: 5.0.3
    6 Stable tag: 5.0.1
     6Stable tag: 5.1.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    197197
    198198== 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.
    199203
    200204= 5.0.1 =
Note: See TracChangeset for help on using the changeset viewer.