Changeset 1153459
- Timestamp:
- 05/05/2015 04:31:41 AM (11 years ago)
- Location:
- scripted-api
- Files:
-
- 3 edited
- 8 copied
-
tags/0.1.3/admin/create_job.php (modified) (8 diffs)
-
tags/1.2 (copied) (copied from scripted-api/trunk)
-
tags/1.2/admin (copied) (copied from scripted-api/tags/0.1.3/admin)
-
tags/1.2/admin/create_job.php (copied) (copied from scripted-api/tags/0.1.3/admin/create_job.php) (8 diffs)
-
tags/1.2/admin/current_jobs.php (copied) (copied from scripted-api/tags/0.1.3/admin/current_jobs.php)
-
tags/1.2/admin/settings.php (copied) (copied from scripted-api/tags/0.1.3/admin/settings.php)
-
tags/1.2/images (copied) (copied from scripted-api/tags/0.1.3/images)
-
tags/1.2/readme.txt (copied) (copied from scripted-api/trunk/readme.txt) (1 diff)
-
tags/1.2/scripted.php (copied) (copied from scripted-api/trunk/scripted.php) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/scripted.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
scripted-api/tags/0.1.3/admin/create_job.php
r1043140 r1153459 6 6 .form-table select { 7 7 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; 8 16 } 9 17 </style> … … 32 40 33 41 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 } 40 56 41 57 if($industry_ids!= '') … … 52 68 $ch = curl_init(); 53 69 curl_setopt($ch, CURLOPT_HTTPHEADER, array('authorization: Token token='.$accessToken)); 54 curl_setopt($ch, CURLOPT_HEADER, 1);70 curl_setopt($ch, CURLOPT_HEADER, false); 55 71 curl_setopt($ch, CURLOPT_URL, SCRIPTED_END_POINT.'/'.$ID.'/v1/jobs'); 56 72 curl_setopt($ch,CURLOPT_POST,$fieldslength); … … 62 78 curl_close($ch); 63 79 80 $response = json_decode($result); 81 64 82 if ($result === false) { 65 83 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>'; 66 84 } else { 67 85 68 list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', $result, 2 );69 $response = json_decode($contents);70 71 86 if($response != '' and isset($response->data)) { 72 87 $success = true; … … 108 123 </tr> 109 124 <tr valign="top"> 110 <t d colspan="2" id="formfieldsplace">'.@$fields.'</td>125 <th colspan="2" scope="row" id="formfieldsplace">'.@$fields.'</th> 111 126 </tr> 112 127 <tr valign="top"> … … 146 161 if($selected !='' and $selected == $jobT->id) 147 162 $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>'; 149 164 } 150 165 $out .='</select>'; … … 202 217 function validateCreateProject($posted) { 203 218 $error = ''; 204 if(isset($posted['topic']) and $posted['topic'] =='') {205 $error .= '<p>Topic field can not be empty.</p>';206 }207 219 if(isset($posted['topic']) and $posted['topic'] =='') { 208 220 $error .= '<p>Topic field can not be empty.</p>'; … … 256 268 $out .= '<ul>'; 257 269 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">'; 259 271 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 } 262 274 $out .='</select></li>'; 263 275 //$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>'; 264 276 265 277 $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 268 322 } 269 323 -
scripted-api/tags/1.2/admin/create_job.php
r1043140 r1153459 6 6 .form-table select { 7 7 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; 8 16 } 9 17 </style> … … 32 40 33 41 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 } 40 56 41 57 if($industry_ids!= '') … … 52 68 $ch = curl_init(); 53 69 curl_setopt($ch, CURLOPT_HTTPHEADER, array('authorization: Token token='.$accessToken)); 54 curl_setopt($ch, CURLOPT_HEADER, 1);70 curl_setopt($ch, CURLOPT_HEADER, false); 55 71 curl_setopt($ch, CURLOPT_URL, SCRIPTED_END_POINT.'/'.$ID.'/v1/jobs'); 56 72 curl_setopt($ch,CURLOPT_POST,$fieldslength); … … 62 78 curl_close($ch); 63 79 80 $response = json_decode($result); 81 64 82 if ($result === false) { 65 83 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>'; 66 84 } else { 67 85 68 list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', $result, 2 );69 $response = json_decode($contents);70 71 86 if($response != '' and isset($response->data)) { 72 87 $success = true; … … 108 123 </tr> 109 124 <tr valign="top"> 110 <t d colspan="2" id="formfieldsplace">'.@$fields.'</td>125 <th colspan="2" scope="row" id="formfieldsplace">'.@$fields.'</th> 111 126 </tr> 112 127 <tr valign="top"> … … 146 161 if($selected !='' and $selected == $jobT->id) 147 162 $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>'; 149 164 } 150 165 $out .='</select>'; … … 202 217 function validateCreateProject($posted) { 203 218 $error = ''; 204 if(isset($posted['topic']) and $posted['topic'] =='') {205 $error .= '<p>Topic field can not be empty.</p>';206 }207 219 if(isset($posted['topic']) and $posted['topic'] =='') { 208 220 $error .= '<p>Topic field can not be empty.</p>'; … … 256 268 $out .= '<ul>'; 257 269 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">'; 259 271 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 } 262 274 $out .='</select></li>'; 263 275 //$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>'; 264 276 265 277 $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 268 322 } 269 323 -
scripted-api/tags/1.2/readme.txt
r1043140 r1153459 2 2 Contributors: rbucks 3 3 Donate link: 4 Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted 4 Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted, freelance writer 5 5 Requires at least: 3.3 6 Tested up to: 4. 0.17 Stable tag: 1. 16 Tested up to: 4.2.1 7 Stable tag: 1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
scripted-api/tags/1.2/scripted.php
r1043140 r1153459 5 5 Description: Manage your Scripted account from WordPress! 6 6 Author: Scripted.com 7 Version: 1. 17 Version: 1.2 8 8 Author URI: https://Scripted.com/ 9 9 */ -
scripted-api/trunk/readme.txt
r1043140 r1153459 2 2 Contributors: rbucks 3 3 Donate link: 4 Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted 4 Tags: writing, blog posts, twitter, tweet, hire blogger, hire writer, custom content, scripted.com, expert writer, scripted, freelance writer 5 5 Requires at least: 3.3 6 Tested up to: 4. 0.17 Stable tag: 1. 16 Tested up to: 4.2.1 7 Stable tag: 1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
scripted-api/trunk/scripted.php
r1043140 r1153459 5 5 Description: Manage your Scripted account from WordPress! 6 6 Author: Scripted.com 7 Version: 1. 17 Version: 1.2 8 8 Author URI: https://Scripted.com/ 9 9 */
Note: See TracChangeset
for help on using the changeset viewer.