Plugin Directory

Changeset 1588187


Ignore:
Timestamp:
02/03/2017 01:18:42 PM (9 years ago)
Author:
zartis
Message:

Added more information to solve potential errors

Option to add token with a form

Location:
zartis-job-plugin
Files:
17 added
4 edited

Legend:

Unmodified
Added
Removed
  • zartis-job-plugin/trunk/Zartis_Job_Plugin.php

    r1588130 r1588187  
    44Plugin URI: http://hirehive.io
    55Description: (Formerly Zartis ATS) Easily add your own secure jobs and careers page to your WordPress site. Includes full access to professional candidate management and posting to twitter, facebook and free job aggregation sites.
    6 Version: 2.3.0
     6Version: 2.3.1
    77Author: HireHive
    88Author URI: http://hirehive.io
     
    3434    if (!defined('Zartis_Url'))
    3535        define('Zartis_Url', WP_PLUGIN_URL . '/' . HireHive_Folder);
    36    
     36
    3737    // Add jquery core and our css styles
    3838    if (is_admin()) {
     
    4040        wp_enqueue_style('zartis_wp', Zartis_Url . '/css/zartis_wp.css');
    4141        wp_enqueue_script('zartis_functions', Zartis_Url . '/js/zartis_functions.js');
    42        
     42
    4343        // The styles for the widget
    4444        wp_enqueue_style('hirehive_wp_widget', Zartis_Url . '/css/hirehive-widget-styles.css');
     
    8383    global $wpdb;
    8484    $zartis_page_ID = get_option('Zartis_Page_ID');
    85    
     85
    8686    // Clean up DB fields
    8787    HireHive_CleanUp_DB();
    88    
     88
    8989    //  the id of our page...
    9090    $page_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE ID = '" . $zartis_page_ID . "'");
     
    114114    add_action('admin_menu', 'Add_HireHive_Admin_Menu');
    115115    $Zartis_Notice = get_option('Zartis_Notice');
    116    
     116
    117117    //checks if this is an activation and then displays the zartis message
    118118    if ($Zartis_Notice == "False") {
     
    133133function Display_HireHive_Widget( $atts ) {
    134134    $category = '';
    135    
     135
    136136    if( isset( $atts['category'] ) && $atts['category']) {
    137137        $category = $atts['category'];
    138138    }
    139    
     139
    140140    $Company_Zartis_ID = get_option('Zartis_Unique_ID');
    141    
     141
    142142    $Zartis_Group = get_option('Zartis_Group');
    143    
     143
    144144    if ($Zartis_Group == null){
    145145        $Zartis_Group = 1;
    146146    }
    147    
     147
    148148    if ($Company_Zartis_ID != "False") {
    149149        try {
    150            
     150
    151151            if ($category !=null){
    152152                $url = 'https://my.hirehive.io/api/v2/public/search?cname='.$Company_Zartis_ID.'&groupBy='.$Zartis_Group.'&category='.$category;
     
    155155                $url = 'https://my.hirehive.io/api/v2/public/search?cname='.$Company_Zartis_ID.'&groupBy='.$Zartis_Group;
    156156            }
    157            
     157
    158158            $jsondata = file_get_contents($url);
    159159            //$jsonString = stripslashes($jsondata);
    160160            $decodedJSON = json_decode($jsondata, true);
    161            
     161
    162162            $decodeError = '';
    163163            switch (json_last_error()) {
    164                
     164
    165165                case JSON_ERROR_NONE:
    166166                    break;
     
    184184                    break;
    185185        }
    186        
     186
    187187        if (strlen($decodeError) > 0) {
    188188            $emailBody = "JSON Decode failed: " .$Company_Zartis_ID;
     
    192192            $emailBody .= '<br><br>';
    193193            $emailBody .= '<pre>' .print_r($decodeError, 1). '</pre>';
    194            
     194
    195195            $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    196            
     196
    197197            error_log($emailBody, 1, '[email protected]', $headers);
    198            
     198
    199199            throw new Exception('JSON version failed, fallback to JS widget');
    200200        }
    201        
     201
    202202        //$obj = json_decode(preg_replace('/\p{Cc}+/u', '', $jsondata), true); //json_decode(preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $jsondata), true);
    203        
     203
    204204        //$groups =  $obj;
    205205        $groups =  $decodedJSON;
    206206        $jobTemplate = '<a class="hh-list-row" href="{{Link}}"><span class="hh-list-title">{{Title}}</span> <span class="hh-list-location">{{Location}}, {{Country}}</span> <span class="hh-list-type">{{Type}}</span></a>';
    207        
     207
    208208        $jobsHTML = "<div id='jobs_iframe' class='hh-list'>";
     209        $jobsHTML .= '<!-- Jobs for - ' .$Company_Zartis_ID. ' -->';
     210            $jobsHTML .= '<!-- Chosen group - ' .$Zartis_Group. ' -->';
     211        $jobsHTML .= '<!-- Category - ' .$category. ' -->';
     212
    209213        foreach ($groups as $group) {
    210214            if ($Zartis_Group > 1){
    211215                $jobsHTML .= '<h3 class="hh-list-cat">'.$group["name"].'</h3>';
    212216            }
    213            
     217
    214218            if ($category !=null){
    215219                $jobsHTML .= Compile_Job_Template($jobTemplate, $group);
     
    221225            }
    222226        }
     227
    223228        $jobsHTML .= "</div>";
    224        
     229
    225230        return $jobsHTML;
    226231    }
     
    228233        // If we have an exception using the API to get the jobs then we fallback to the old JS Version
    229234        $script = '<script type="text/javascript"src="https://my.hirehive.io/' . $Company_Zartis_ID . '/getwidget"></script><script type="text/javascript"charset="utf-8">function getParam(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)return"";else return results[1];}function updateIFrame(height){var iframe=document.getElementById("jobs_iframe");iframe.setAttribute("height",height);}var height=getParam("height");if(height==""){var zartis_options={};zartis_options.display="iframe";zartis_options.company="' . $Company_Zartis_ID . '";zartis_options.placement="left";zartis_options.type="widget";zartis_options.color="#222";zartis_options.width="' . $Zartis_Width . '%";zartis_options.style="idea";zartis_options.url=document.URL;var zartis_widget=new ZARTIS.jobs_widget(zartis_options);}else{window.top.updateIFrame(height);}</script>';
    230        
     235
     236        $script .= '<!-- Jobs for - ' .$Company_Zartis_ID. ' -->';
     237        $script .= '<!-- Chosen group - ' .$Zartis_Group. ' -->';
     238        $script .= '<!-- Category - ' .$category. ' -->';
     239        $script .= '<!--' .$e.message. '-->';
     240
    231241        return $script;
    232242    }
    233    
     243
    234244} else {
    235245    return false;
     
    238248
    239249function Compile_Job_Template($template, &$job){
    240    
     250
    241251    $template = str_replace("{{Title}}",$job["title"],$template);
    242252    $template = str_replace("{{Link}}",$job["jobUrl"],$template);
     
    244254    $template = str_replace("{{Country}}",$job["countryName"],$template);
    245255    $template = str_replace("{{Type}}",$job["type"],$template);
    246    
     256
    247257    return $template;
    248258}
  • zartis-job-plugin/trunk/Zartis_Job_Token.php

    r1571917 r1588187  
    3232
    3333
    34           <?php if(!isset($_GET["WordPressURL"])) : ?>
    35           <div class="cent">
    36             <a href="https://my.hirehive.io/Register/WordPress" class="btn save buttons a">
    37               <span>Sign up and get token now</span>
    38             </a><br><br>
    39             <a href="https://my.hirehive.io/#/settings/wordpress">Already have an account? Get token here.</a>
     34          <?php if(!isset($_GET["WordPressURL"])) : ?>
     35            <div class="cent">
     36              <a href="https://my.hirehive.io/Register/WordPress" class="btn save buttons a">
     37                <span>Sign up and get token now</span>
     38              </a>
     39              <br>
     40              <br>
     41              <a href="https://my.hirehive.io/#/settings/wordpress">Already have an account? Get token here.</a>
    4042
    41           </div>
    42           <!-- END OF cent -->
    43           <?php endif; ?>
     43            </div>
     44            <!-- END OF cent -->
     45            <?php endif; ?>
    4446
    4547        </div>
    4648        <!-- END OF content -->
    47         <?php if(isset($_GET["WordPressURL"])) : ?>
    48         <form method="post" action="options.php">
    49           <?php wp_nonce_field('update-options'); ?>
    50             <fieldset class="default fieldset">
    51               <ol class="ol">
    52                 <!-- Email Input  -->
    53                 <li>
    54                   <label class='label' for="email">
    55                     Your token
    56                   </label>
    57                   <input class="token-input" id="Zartis_Unique_ID" name="Zartis_Unique_ID" type="text" class="input text-box" value="<?php if (isset($_GET["WordPressURL"])){echo $_GET["WordPressURL"]; } ?>" required="required" />
    58                   <div class="hint hide" style="display: none;">
    59                     Your token is required
    60                   </div>
    61                 </li>
    62               </ol>
    63               <input type="hidden" name="action" value="update" />
    64               <input type="hidden" name="page_options" value="Zartis_Unique_ID" />
    65               <div class="cent">
    66                 <button type="submit" class="btn save buttons a zar_next">Save and get started</button>
    67               </div>
    6849
    69             </fieldset>
    70         </form>
    71         <?php endif; ?>
     50        <div style="margin-top:35px">
     51          <h3>Enter HireHive WordPress Token</h3>
     52          <p>Already have an account? <a href="https://my.hirehive.io/#/Settings/Careerpage" target="_blank">Get token here.</a></p>
     53          <form method="post" action="options.php">
     54            <?php wp_nonce_field('update-options'); ?>
     55              <fieldset class="default fieldset">
     56                <ol class="ol">
     57                  <!-- Email Input  -->
     58                  <li>
     59                    <label class='label' for="email">
     60                      Your token
     61                    </label>
     62                    <input class="token-input" id="Zartis_Unique_ID" name="Zartis_Unique_ID" type="text" class="input text-box" value="<?php if (isset($_GET["WordPressURL"])){echo $_GET["WordPressURL"]; } ?>" required="required" />
     63                    <div class="hint hide" style="display: none;">
     64                      Your token is required
     65                    </div>
     66                  </li>
     67                </ol>
     68                <input type="hidden" name="action" value="update" />
     69                <input type="hidden" name="page_options" value="Zartis_Unique_ID" />
     70                <div class="cent">
     71                  <button type="submit" class="btn save buttons a zar_next">Save and get started</button>
     72                </div>
     73
     74              </fieldset>
     75          </form>
     76        </div>
     77
    7278      </div>
    7379      <!-- END OF c8 -->
    7480
    7581      <div class="c8">
    76         <div class="callout">
    77         <h3>How your jobs should look</h3>
    78         <p> This is how your jobs listing should look on your Wordpress site, when your HireHive account is setup and
    79           <strong>shortcode is added to your jobs page</strong>. The styling of jobs will also depend on the installed theme.</p>
    80             <img src="https://zartis.blob.core.windows.net/public-screens/Wordpress-Jobs-Listing.png"/>
    81           </div>
     82        <div class="callout">
     83          <h3>How your jobs should look</h3>
     84          <p> This is how your jobs listing should look on your Wordpress site, when your HireHive account is setup and
     85            <strong>shortcode is added to your jobs page</strong>. The styling of jobs will also depend on the installed theme.</p>
     86          <img src="https://zartis.blob.core.windows.net/public-screens/Wordpress-Jobs-Listing.png" />
     87        </div>
    8288      </div>
    8389      <!-- END OF c8 -->
  • zartis-job-plugin/trunk/css/zartis_wp.css

    r1481678 r1588187  
    5757
    5858.zar_body .content {
    59     position: relative;
    60     float: left;
     59    position: relative;
    6160    width: 100%;
    62 
    6361}
    6462
  • zartis-job-plugin/trunk/readme.txt

    r1588130 r1588187  
    55Requires at least: 2.9
    66Tested up to: 4.7.2
    7 Stable tag: 2.3.0
     7Stable tag: 2.3.1
    88
    99Easily add job listings and secure candidate management to your Wordpress site.
     
    9494= 2.2.2 =
    9595* Minor text change
     96
     97= 2.3.0 =
     98* Added more exception handling
     99* Added a fallback if JSON fails
     100
     101= 2.3.1 =
     102* Added informational output to page when rendering
     103* Can add a HireHive token using an input box
Note: See TracChangeset for help on using the changeset viewer.