Plugin Directory

Changeset 1153459


Ignore:
Timestamp:
05/05/2015 04:31:41 AM (11 years ago)
Author:
rbucks
Message:

tagging 1.2

Location:
scripted-api
Files:
3 edited
8 copied

Legend:

Unmodified
Added
Removed
  • scripted-api/tags/0.1.3/admin/create_job.php

    r1043140 r1153459  
    66           .form-table select {
    77               width: 300px;
     8           }
     9           label.left_label {
     10                float: left;
     11                width: 218px;
     12           }
     13           p.help_text{
     14                  font-size: 10px;
     15                  margin-left: 218px;
    816           }
    917       </style>
     
    3240           
    3341           if(is_array($formFields)) {
    34                foreach($formFields as $key => $value) {
    35                    $value   = sanitize_text_field($value);
    36                    $fields  .= '&job_template[prompts][][id]='.$key;
    37                    $fields  .= '&job_template[prompts][][value]='.urlencode($value);
    38                }
    39            }
     42                foreach($formFields as $key => $value) {
     43                    $value   = $value;
     44
     45                    if(is_array($value)) {
     46                        foreach ($value as $sub) {   
     47                            $fields  .= '&job_template[prompts][][id]='.$key;
     48                            $fields  .= '&job_template[prompts][][value][]='.urlencode($sub);
     49                        }                           
     50                    } else {
     51                        $fields  .= '&job_template[prompts][][id]='.$key;
     52                        $fields  .= '&job_template[prompts][][value]='.urlencode($value);
     53                    }
     54                }
     55            } 
    4056           
    4157           if($industry_ids!= '')
     
    5268            $ch = curl_init();
    5369            curl_setopt($ch, CURLOPT_HTTPHEADER, array('authorization: Token token='.$accessToken));   
    54             curl_setopt($ch, CURLOPT_HEADER, 1);   
     70            curl_setopt($ch, CURLOPT_HEADER, false);   
    5571            curl_setopt($ch, CURLOPT_URL, SCRIPTED_END_POINT.'/'.$ID.'/v1/jobs');     
    5672            curl_setopt($ch,CURLOPT_POST,$fieldslength);
     
    6278            curl_close($ch);
    6379           
     80            $response = json_decode($result);
     81           
    6482            if ($result === false) {       
    6583                echo '<div class="updated" id="message"><p>Sorry, we found an error and your Scripted job was not created! Please confirm your ID and Access Token are correct and try again.</p></div>';
    6684            } else { 
    6785               
    68                     list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', $result, 2 );   
    69                     $response = json_decode($contents);
    70                    
    7186                    if($response != '' and isset($response->data)) {
    7287                        $success = true;
     
    108123        </tr>
    109124        <tr valign="top">
    110         <td colspan="2" id="formfieldsplace">'.@$fields.'</td>
     125        <th colspan="2" scope="row" id="formfieldsplace">'.@$fields.'</th>
    111126        </tr>
    112127        <tr valign="top">
     
    146161            if($selected !='' and $selected == $jobT->id)
    147162                $class = 'selected="selected"';
    148             $out .='<option value="'.$jobT->id.'" '.$class.'>'.$jobT->name.' for $'.$jobT->content_format->price.'</option>';
     163            $out .='<option value="'.$jobT->id.'" '.$class.'>'.$jobT->name.' for $'.($jobT->pricing->base/100).'</option>';
    149164        }
    150165        $out .='</select>';
     
    202217function validateCreateProject($posted) {
    203218    $error = '';
    204     if(isset($posted['topic']) and $posted['topic'] =='') {
    205         $error .= '<p>Topic field can not be empty.</p>';
    206     }
    207219    if(isset($posted['topic']) and $posted['topic'] =='') {
    208220        $error .= '<p>Topic field can not be empty.</p>';
     
    256268            $out .= '<ul>';
    257269           
    258             $out .='<li><label style="width:220px; float:left;">Quantity</label><select name="quantity_order" class="span3">';
     270            $out .='<li><label class="left_label">Quantity</label><select name="quantity_order" class="span3">';
    259271            foreach($dataFields->content_format->quantity_options as $key => $value) {
    260                 $out .='<option value="'.$value.'">'.$value.'</option>';
    261             }
     272                    $out .='<option value="'.$value.'">'.$value.'</option>';
     273                }
    262274            $out .='</select></li>';
    263275            //$out .='<li><label style="width:220px; float:left;">Quantity</label><input style="width:50px;" class="regular-text" type="text" name="quantity_order" value="'.((isset($_POST['quantity_order']) and $_POST['quantity_order'] !='') ? $_POST['quantity_order'] : $dataFields->content_format->min_quantity).'" /><p style="margin-left:220px; font-size:10px;">Minimum Quantity: '.$dataFields->content_format->min_quantity.'</p></li>';
    264276           
    265277            $fields = $dataFields->prompts;
    266             foreach($fields as $field) {               
    267                     $out .='<li><label style="width:220px; float:left;">'.$field->label.'</label><textarea name="form_fields['.$field->id.']" cols="48" rows="5" class="span3">'.@$_POST['form_fields'][$field->id].'</textarea><p style="margin-left:220px; font-size:10px;">'.$field->description.'</p></li>';               
     278            foreach($fields as $field) {
     279               
     280                    $required = (isset($field->answer_required) and $field->answer_required == 1) ? '*':'';
     281               
     282                    if($field->kind == 'checkbox') {   
     283                        $oldValue = (isset($_POST['form_fields'][$field->id])) ? $_POST['form_fields'][$field->id] : array();   
     284                        $out .='<li><label class="left_label">'.$field->label.$required.'</label><div style="float:left">';
     285                        foreach ($field->value_options as $optionValue) {
     286                                $class = '';
     287                                if(in_array($optionValue, $oldValue))
     288                                    $class = 'checked';
     289                            $out .='<label><input '.$class.' name="form_fields['.$field->id.'][]" type="checkbox" value="'.$optionValue.'">'.$optionValue.'</label><br />';
     290                        }
     291                       
     292                        $out .='</div><div style="clear:both"></div><p class="help_text">'.$field->description.'</p></li>';
     293                       
     294                    } else if($field->kind == 'radio') {
     295                        $oldValue = (isset($_POST['form_fields'][$field->id])) ? $_POST['form_fields'][$field->id] : '';   
     296                        $out .='<li><label class="left_label">'.$field->label.$required.'</label><div style="float:left">';
     297                        foreach ($field->value_options as $optionValue) {
     298                            $class = '';
     299                                if($optionValue == $oldValue)
     300                                    $class = 'checked';
     301                            $out .='<label><input '.$class.' name="form_fields['.$field->id.']" type="radio" value="'.$optionValue.'">'.$optionValue.'</label><br />';
     302                        }
     303                       
     304                        $out .='</div><div style="clear:both"></div><p class="help_text">'.$field->description.'</p></li>';
     305                       
     306                    } else if(strpos($field->kind, 'string[255]') !== false) {
     307                        $out .='<li><label class="left_label">'.$field->label.$required.'</label>'
     308                           . '<input name="form_fields['.$field->id.']" type="text" class="span3" value="'.@$_POST['form_fields'][$field->id].'">'
     309                           . '<p class="help_text">'.$field->description.'</p></li>';
     310                       
     311                    } else if(strpos($field->kind, 'string[1024]') !== false) {
     312                        $out .='<li><label class="left_label">'.$field->label.$required.'</label>'
     313                           . '<textarea name="form_fields['.$field->id.']" cols="48" rows="5" class="span3">'.@$_POST['form_fields'][$field->id].'</textarea>'
     314                           . '<p class="help_text">'.$field->description.'</p></li>';             
     315                    } else if(strpos($field->kind, 'array') !== false) {
     316                        $out .='<li><label class="left_label">'.$field->label.$required.'</label>'
     317                           . '<textarea name="form_fields['.$field->id.']" cols="48" rows="5" class="span3">'.@$_POST['form_fields'][$field->id].'</textarea>'
     318                           . '<p class="help_text">'.$field->description.'</p></li>';             
     319                    }
     320                   
     321                       
    268322            }
    269323           
  • scripted-api/tags/1.2/admin/create_job.php

    r1043140 r1153459  
    66           .form-table select {
    77               width: 300px;
     8           }
     9           label.left_label {
     10                float: left;
     11                width: 218px;
     12           }
     13           p.help_text{
     14                  font-size: 10px;
     15                  margin-left: 218px;
    816           }
    917       </style>
     
    3240           
    3341           if(is_array($formFields)) {
    34                foreach($formFields as $key => $value) {
    35                    $value   = sanitize_text_field($value);
    36                    $fields  .= '&job_template[prompts][][id]='.$key;
    37                    $fields  .= '&job_template[prompts][][value]='.urlencode($value);
    38                }
    39            }
     42                foreach($formFields as $key => $value) {
     43                    $value   = $value;
     44
     45                    if(is_array($value)) {
     46                        foreach ($value as $sub) {   
     47                            $fields  .= '&job_template[prompts][][id]='.$key;
     48                            $fields  .= '&job_template[prompts][][value][]='.urlencode($sub);
     49                        }                           
     50                    } else {
     51                        $fields  .= '&job_template[prompts][][id]='.$key;
     52                        $fields  .= '&job_template[prompts][][value]='.urlencode($value);
     53                    }
     54                }
     55            } 
    4056           
    4157           if($industry_ids!= '')
     
    5268            $ch = curl_init();
    5369            curl_setopt($ch, CURLOPT_HTTPHEADER, array('authorization: Token token='.$accessToken));   
    54             curl_setopt($ch, CURLOPT_HEADER, 1);   
     70            curl_setopt($ch, CURLOPT_HEADER, false);   
    5571            curl_setopt($ch, CURLOPT_URL, SCRIPTED_END_POINT.'/'.$ID.'/v1/jobs');     
    5672            curl_setopt($ch,CURLOPT_POST,$fieldslength);
     
    6278            curl_close($ch);
    6379           
     80            $response = json_decode($result);
     81           
    6482            if ($result === false) {       
    6583                echo '<div class="updated" id="message"><p>Sorry, we found an error and your Scripted job was not created! Please confirm your ID and Access Token are correct and try again.</p></div>';
    6684            } else { 
    6785               
    68                     list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', $result, 2 );   
    69                     $response = json_decode($contents);
    70                    
    7186                    if($response != '' and isset($response->data)) {
    7287                        $success = true;
     
    108123        </tr>
    109124        <tr valign="top">
    110         <td colspan="2" id="formfieldsplace">'.@$fields.'</td>
     125        <th colspan="2" scope="row" id="formfieldsplace">'.@$fields.'</th>
    111126        </tr>
    112127        <tr valign="top">
     
    146161            if($selected !='' and $selected == $jobT->id)
    147162                $class = 'selected="selected"';
    148             $out .='<option value="'.$jobT->id.'" '.$class.'>'.$jobT->name.' for $'.$jobT->content_format->price.'</option>';
     163            $out .='<option value="'.$jobT->id.'" '.$class.'>'.$jobT->name.' for $'.($jobT->pricing->base/100).'</option>';
    149164        }
    150165        $out .='</select>';
     
    202217function validateCreateProject($posted) {
    203218    $error = '';
    204     if(isset($posted['topic']) and $posted['topic'] =='') {
    205         $error .= '<p>Topic field can not be empty.</p>';
    206     }
    207219    if(isset($posted['topic']) and $posted['topic'] =='') {
    208220        $error .= '<p>Topic field can not be empty.</p>';
     
    256268            $out .= '<ul>';
    257269           
    258             $out .='<li><label style="width:220px; float:left;">Quantity</label><select name="quantity_order" class="span3">';
     270            $out .='<li><label class="left_label">Quantity</label><select name="quantity_order" class="span3">';
    259271            foreach($dataFields->content_format->quantity_options as $key => $value) {
    260                 $out .='<option value="'.$value.'">'.$value.'</option>';
    261             }
     272                    $out .='<option value="'.$value.'">'.$value.'</option>';
     273                }
    262274            $out .='</select></li>';
    263275            //$out .='<li><label style="width:220px; float:left;">Quantity</label><input style="width:50px;" class="regular-text" type="text" name="quantity_order" value="'.((isset($_POST['quantity_order']) and $_POST['quantity_order'] !='') ? $_POST['quantity_order'] : $dataFields->content_format->min_quantity).'" /><p style="margin-left:220px; font-size:10px;">Minimum Quantity: '.$dataFields->content_format->min_quantity.'</p></li>';
    264276           
    265277            $fields = $dataFields->prompts;
    266             foreach($fields as $field) {               
    267                     $out .='<li><label style="width:220px; float:left;">'.$field->label.'</label><textarea name="form_fields['.$field->id.']" cols="48" rows="5" class="span3">'.@$_POST['form_fields'][$field->id].'</textarea><p style="margin-left:220px; font-size:10px;">'.$field->description.'</p></li>';               
     278            foreach($fields as $field) {
     279               
     280                    $required = (isset($field->answer_required) and $field->answer_required == 1) ? '*':'';
     281               
     282                    if($field->kind == 'checkbox') {   
     283                        $oldValue = (isset($_POST['form_fields'][$field->id])) ? $_POST['form_fields'][$field->id] : array();   
     284                        $out .='<li><label class="left_label">'.$field->label.$required.'</label><div style="float:left">';
     285                        foreach ($field->value_options as $optionValue) {
     286                                $class = '';
     287                                if(in_array($optionValue, $oldValue))
     288                                    $class = 'checked';
     289                            $out .='<label><input '.$class.' name="form_fields['.$field->id.'][]" type="checkbox" value="'.$optionValue.'">'.$optionValue.'</label><br />';
     290                        }
     291                       
     292                        $out .='</div><div style="clear:both"></div><p class="help_text">'.$field->description.'</p></li>';
     293                       
     294                    } else if($field->kind == 'radio') {
     295                        $oldValue = (isset($_POST['form_fields'][$field->id])) ? $_POST['form_fields'][$field->id] : '';   
     296                        $out .='<li><label class="left_label">'.$field->label.$required.'</label><div style="float:left">';
     297                        foreach ($field->value_options as $optionValue) {
     298                            $class = '';
     299                                if($optionValue == $oldValue)
     300                                    $class = 'checked';
     301                            $out .='<label><input '.$class.' name="form_fields['.$field->id.']" type="radio" value="'.$optionValue.'">'.$optionValue.'</label><br />';
     302                        }
     303                       
     304                        $out .='</div><div style="clear:both"></div><p class="help_text">'.$field->description.'</p></li>';
     305                       
     306                    } else if(strpos($field->kind, 'string[255]') !== false) {
     307                        $out .='<li><label class="left_label">'.$field->label.$required.'</label>'
     308                           . '<input name="form_fields['.$field->id.']" type="text" class="span3" value="'.@$_POST['form_fields'][$field->id].'">'
     309                           . '<p class="help_text">'.$field->description.'</p></li>';
     310                       
     311                    } else if(strpos($field->kind, 'string[1024]') !== false) {
     312                        $out .='<li><label class="left_label">'.$field->label.$required.'</label>'
     313                           . '<textarea name="form_fields['.$field->id.']" cols="48" rows="5" class="span3">'.@$_POST['form_fields'][$field->id].'</textarea>'
     314                           . '<p class="help_text">'.$field->description.'</p></li>';             
     315                    } else if(strpos($field->kind, 'array') !== false) {
     316                        $out .='<li><label class="left_label">'.$field->label.$required.'</label>'
     317                           . '<textarea name="form_fields['.$field->id.']" cols="48" rows="5" class="span3">'.@$_POST['form_fields'][$field->id].'</textarea>'
     318                           . '<p class="help_text">'.$field->description.'</p></li>';             
     319                    }
     320                   
     321                       
    268322            }
    269323           
  • scripted-api/tags/1.2/readme.txt

    r1043140 r1153459  
    22Contributors: rbucks
    33Donate link:
    4 Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted
     4Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted, freelance writer
    55Requires at least: 3.3
    6 Tested up to: 4.0.1
    7 Stable tag: 1.1
     6Tested up to: 4.2.1
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • scripted-api/tags/1.2/scripted.php

    r1043140 r1153459  
    55Description: Manage your Scripted account from WordPress!
    66Author: Scripted.com
    7 Version: 1.1
     7Version: 1.2
    88Author URI: https://Scripted.com/
    99*/
  • scripted-api/trunk/readme.txt

    r1043140 r1153459  
    22Contributors: rbucks
    33Donate link:
    4 Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted
     4Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted, freelance writer
    55Requires at least: 3.3
    6 Tested up to: 4.0.1
    7 Stable tag: 1.1
     6Tested up to: 4.2.1
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • scripted-api/trunk/scripted.php

    r1043140 r1153459  
    55Description: Manage your Scripted account from WordPress!
    66Author: Scripted.com
    7 Version: 1.1
     7Version: 1.2
    88Author URI: https://Scripted.com/
    99*/
Note: See TracChangeset for help on using the changeset viewer.