<?php 
}
?>

        <?php 
if ($ui['captcha']) {
    ?>
        <div class='awpcp-form-spacer'>
            <?php 
    $captcha = awpcp_create_captcha(get_awpcp_option('captcha-provider'));
    ?>
            <?php 
    echo $captcha->render();
    ?>
            <?php 
    echo awpcp_form_error('captcha', $errors);
    ?>
        </div>
        <?php 
}
?>

        <?php 
if ($preview) {
    ?>
        <input type="submit" class="button" value="<?php 
    echo esc_attr(__('Preview Ad', 'AWPCP'));
    ?>
" />
        <?php 
} else {
<p class="awpcp-form-spacer">
    <label for="<?php 
echo esc_attr($html['id']);
?>
"><?php 
echo esc_html($label);
echo $required ? '*' : '';
?>
</label>
    <?php 
echo awpcp_form_error($html['name'], $errors);
?>
    <?php 
if (!empty($help_text)) {
    ?>
<label for="<?php 
    echo esc_attr($html['id']);
    ?>
" class="helptext"><?php 
    echo $help_text;
    ?>
</label><?php 
}
?>
    <label for="<?php 
echo esc_attr($html['id']);
?>
" class="characters-left"><span class="characters-left-placeholder"><?php 
echo esc_html($remaining_characters_text);
?>
</span>&nbsp;<?php 
            <?php 
echo awpcp_form_error('postal_code', $errors);
?>
        </div>

        <div class="awpcp-form-spacer clearfix">
            <label for="awpcp-billing-email"><?php 
_e('Email', 'AWPCP');
?>
</label>
            <input class="textfield required" id="awpcp-billing-email" type="text" size="50" name="email" value="<?php 
echo esc_attr(awpcp_array_data('email', '', $data));
?>
" data-bind="value: email">
            <?php 
echo awpcp_form_error('email', $errors);
?>
        </div>
    </fieldset>

    <p class="form-submit">
        <?php 
foreach ($hidden as $name => $value) {
    ?>
        <input type="hidden" value="<?php 
    echo esc_attr($value);
    ?>
" name="<?php 
    echo esc_attr($name);
    ?>
">
            echo $input_class;
            ?>
" size="35" type="text" name="<?php 
            echo esc_attr($field['name']);
            ?>
" value="<?php 
            echo awpcp_esc_attr($field['value']);
            ?>
" />

            <?php 
        }
        ?>

            <?php 
        echo awpcp_form_error($field['name'], $errors);
        ?>
        </p>
        <?php 
    } else {
        ?>
        <p class="awpcp-form-spacer <?php 
        echo $container_class;
        ?>
">
            <?php 
        $value = $field['entries'][0]->region_name;
        ?>
            <?php 
        echo $field['label'];
        ?>
 function awpcp_extra_fields_render_field($field, $value, $category, $context, $errors = array())
 {
     $label = stripslashes_deep($field->field_label);
     $name = "awpcp-{$field->field_name}";
     $type = $field->field_input_type;
     $id = $name;
     $classes = array_filter(array('awpcp-form-spacer', 'awpcp-extra-field', "awpcp-extra-field-{$field->field_name}"));
     foreach ($field->field_category as $category_id) {
         $classes[] = "awpcp-extra-field-category-{$category_id}";
     }
     $all_categories = awpcp_get_categories_ids();
     // always show field if no category is selected or all categories are selected
     if (empty($field->field_category) || count(array_diff($all_categories, $field->field_category)) == 0) {
         $classes[] = 'awpcp-extra-field-always-visible';
         // hide fields that belong to a different category
     } else {
         if (!empty($category) && !in_array($category, $field->field_category)) {
             $classes[] = 'awpcp-extra-field-hidden';
         }
     }
     $validators = array();
     switch ($field->field_validation) {
         case 'email':
             $validators[] = 'email';
             break;
         case 'url':
             $validators[] = 'url';
             break;
         case 'currency':
             $validators[] = 'money';
             break;
         case 'missing':
             $validators[] = 'required';
             break;
         case 'numericdeci':
             $validators[] = 'number';
             break;
         case 'numericnodeci':
             $validators[] = 'integer';
             break;
     }
     if ($context != 'search' && $field->required && $field->field_validation != 'missing') {
         $validators[] = 'required';
     }
     $validator = join(' ', $validators);
     /* Range Search support */
     $has_numeric_data_type = in_array($field->field_mysql_data_type, array('INT', 'FLOAT'));
     $has_numeric_validator = in_array($field->field_validation, array('numericdeci', 'numericnodeci'));
     $is_single_valued = in_array($type, array('Input Box', 'Select', 'Radio Button'));
     // TODO: pass min and max values
     if ($context == 'search' && $is_single_valued && ($has_numeric_validator || $has_numeric_data_type)) {
         $id = "awpcp-extra-field-{$name}-min";
         $body = '<span class="awpcp-range-search">';
         $body .= '<label for="%1$s-min">' . __('Min', 'awpcp-extra-fields') . '</label>';
         $body .= '<input id="%1$s-min" class="inputbox %2$s" type="text" name="%3$s-min" value="%4$s">';
         $body .= '<label for="%1$s-max">' . __('Max', 'awpcp-extra-fields') . '</label>';
         $body .= '<input id="%1$s-max" class="inputbox %2$s" type="text" name="%3$s-max" value="%5$s">';
         $body .= '</span>';
         if (!is_array($value)) {
             $value = stripslashes_deep(array('min' => $value, 'max' => $value));
         }
         $body = sprintf($body, "awpcp-extra-field-{$name}", $validator, $name, $value['min'], $value['max']);
         /* Normal Input */
     } else {
         if ($type == 'Input Box') {
             $body = '<input id="%s" class="inputbox %s" type="text" name="%s" value="%s">';
             $body = sprintf($body, $name, $validator, $name, stripslashes($value));
         } else {
             if ($type == 'Select') {
                 $options = array(sprintf('<option value="">%s</option>', __('Select One', 'awpcp-extra-fields')));
                 foreach ($field->field_options as $option) {
                     $option = trim($option);
                     $_html = '<option %s value="%s">%s</option>';
                     $_html = sprintf($_html, $value == $option ? 'selected' : '', awpcp_esc_attr($option), stripslashes($option));
                     $options[] = $_html;
                 }
                 $body = sprintf('<select id="%s" class="%s" name="%s">%s</select>', $name, $validator, $name, join('', $options));
             } else {
                 if ($type == 'Textarea Input') {
                     $body = '<textarea id="%s" class="awpcp-textarea textareainput %s" name="%s" rows="10" cols="50">%s</textarea>';
                     $body = sprintf($body, $name, $validator, $name, awpcp_esc_textarea($value));
                 } else {
                     if ($type == 'Radio Button') {
                         $options = array();
                         foreach ($field->field_options as $option) {
                             $_html = '<label class="secondary-label"><input class="%s" type="radio" %s name="%s" value="%s">%s</label><br>';
                             $_html = sprintf($_html, $validator, $value == $option ? 'checked' : '', $name, awpcp_esc_attr($option), stripslashes($option));
                             $options[] = $_html;
                         }
                         $body = join('', $options);
                     } else {
                         if ($type == 'Select Multiple') {
                             $value = is_array($value) ? $value : explode(',', $value);
                             $options = array();
                             foreach ($field->field_options as $option) {
                                 $option = trim($option);
                                 $_html = '<option %s value="%s">%s</option>';
                                 $options[] = sprintf($_html, in_array($option, $value) ? 'selected' : '', awpcp_esc_attr($option), stripslashes($option));
                             }
                             $body = '<select id="%s" class="%s" name="%s[]" multiple style="width:25%%;height:100px">%s</select>';
                             $body = sprintf($body, $name, $validator, $name, join('', $options));
                         } else {
                             if ($type == 'Checkbox') {
                                 $value = is_array($value) ? $value : explode(',', $value);
                                 $options = array();
                                 foreach ($field->field_options as $option) {
                                     $_html = '<label class="secondary-label"><input class="%s" type="checkbox" %s name="%s[]" value="%s">%s</label><br>';
                                     $options[] = sprintf($_html, $validator, in_array($option, $value) ? 'checked' : '', $name, awpcp_esc_attr($option), stripslashes($option));
                                 }
                                 $body = join('', $options);
                             }
                         }
                     }
                 }
             }
         }
     }
     $error = awpcp_form_error($field->field_name, $errors);
     $html = '<p class="%s" data-category="%s"><label for="%s">%s</label>%s %s</p>';
     return sprintf($html, join(' ', $classes), join(',', $field->field_category), $id, $label, $body, $error);
 }
								<label for="awpcp-importer-user"><?php 
echo esc_html(__('Default user', 'AWPCP'));
?>
</label>
							</th>
							<td>
                                <?php 
echo awpcp_users_field()->render(array('selected' => empty($assigned_user) ? null : $assigned_user, 'label' => false, 'default' => __('use spreadsheet information', 'AWPCP'), 'id' => 'awpcp-importer-user', 'name' => 'user', 'include-full-user-information' => false));
?>
<br/>
								<span class="description"><?php 
echo esc_html(_x("Any value other than 'use spreadsheet information' means the Ads will be associated to the selected user if: the username column is not present in the CSV file, there is no user with that username and we couldn't find a user with the contact_email address specified in the CSV file.", 'csv-importer', 'AWPCP'));
?>
</span>
								<br/><br/><?php 
echo awpcp_form_error('user', $form_errors);
?>
							</td>
						</tr>
					</tbody>
				</table>

				<p class="submit">
					<input type="submit" class="button" name="do_test_import" value="<?php 
echo esc_html(__('Test Import', 'AWPCP'));
?>
"></input>
					<input type="submit" class="button-primary button" name="do_import" value="<?php 
echo esc_html(__('Import', 'AWPCP'));
?>
"></input>
                        <span class="loading-message" data-bind="visible: loading"><?php 
echo esc_html(_x('loading...', 'loading region options', 'AWPCP'));
?>
</span>

                        <input type="hidden" data-bind="attr: { name: param }, value: selected" />
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr data-bind="visible: error">
                    <td colspan="2">
                        <span class="awpcp-error" data-bind="text: error"></span>
                    </td>
                </tr>
                <tr data-bind="visible: $root.showRemoveRegionButton">
                    <td colspan="2">
                        <a class="button remove-region" href="#" data-bind="click: $root.onRemoveRegion(), text: $root.getLocalizedText('remove-region')"></a>
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>

    <a class="button add-region" href="#" data-bind="click: onAddRegion, visible: showAddRegionButton, text: $root.getLocalizedText('add-region')"></a>
    <?php 
echo awpcp_form_error('regions', $errors);
?>
</div>
<?php

if ($show_payment_terms) {
    ?>
    <h3><?php 
    _e('Please select a payment term for your Ad', 'AWPCP');
    ?>
</h3>

    <?php 
    echo awpcp_form_error('payment-term', $form_errors);
    ?>
    <?php 
    echo $table->render();
    ?>

    <?php 
    echo $this->render_credit_plans_table($transaction);
} else {
    ?>
    <?php 
    $items = $table->get_items();
    ?>
    <?php 
    $value = $table->item_id($items[0], array_shift($accepted_payment_types));
    ?>
    <?php 
    $attrs = array('type' => 'hidden', 'name' => 'payment_term', 'value' => $value);
    ?>
    <?php 
    echo sprintf('<input %s>', awpcp_render_attributes($attrs));
            <?php 
echo awpcp_form_error('ad_email', $errors);
?>
        </p>

        <p class="awpcp-form-spacer">
            <label for="ad-key"><?php 
echo esc_html(__('Enter your Ad access key', 'AWPCP'));
?>
</label>
            <input class="inputbox" id="ad-key" type="text" size="50" name="ad_key" value="<?php 
echo awpcp_esc_attr($form['ad_key']);
?>
" />
            <?php 
echo awpcp_form_error('ad_key', $errors);
?>
            <br><a href="<?php 
echo esc_attr($send_access_key_url);
?>
"><?php 
echo esc_html(__('Click here to have your Ad access keys sent to you.', 'AWPCP'));
?>
</a>
        </p>

        <input type="submit" class="button" value="<?php 
echo esc_attr(_x("Continue", 'ad details form', "AWPCP"));
?>
" />
	</form>
Пример #10
0
    ?>
">
            <label for="max-price"><?php 
    _e("Max", "AWPCP");
    ?>
</label>
            <input id="max-price" class="inputbox money" type="text" name="searchpricemax" value="<?php 
    echo esc_attr($form['max_price']);
    ?>
">
        </label>
        <?php 
    echo awpcp_form_error('min_price', $errors);
    ?>
        <?php 
    echo awpcp_form_error('max_price', $errors);
    ?>
    </p>
    <?php 
}
?>

    <?php 
$options = array('showTextField' => true, 'maxRegions' => $ui['allow-user-to-search-in-multiple-regions'] ? 10 : 1);
$selector = awpcp_multiple_region_selector($form['regions'], $options);
echo $selector->render('search', array(), $errors);
?>

    <?php 
echo awpcp_form_fields()->render_fields($form, $errors, null, array('category' => 0, 'action' => 'search'));
?>