Example #1
0
 private function translate($object)
 {
     $properties = array('id' => awpcp_get_property($object, 'id', null), 'ad_id' => awpcp_get_property($object, 'ad_id', null), 'name' => awpcp_get_property($object, 'name', null), 'path' => awpcp_get_property($object, 'path', null), 'mime_type' => awpcp_get_property($object, 'mime_type', null), 'enabled' => awpcp_get_property($object, 'enabled', null), 'status' => awpcp_get_property($object, 'status', null), 'is_primary' => awpcp_get_property($object, 'is_primary', null));
     $data = array();
     foreach ($properties as $name => $value) {
         if (!is_null($value)) {
             $data[$name] = $value;
         }
     }
     return $data;
 }
</a>
                </span>

                <div class="cat-checklist category-checklist">
                <?php 
    $params = array('selected' => awpcp_get_property($fee, 'categories', array()));
    echo awpcp_categories_checkbox_list_renderer()->render($params);
    ?>
                </div>
        <?php 
}
?>

                <label class="alignleft">
                    <?php 
$private = awpcp_get_property($fee, 'private', 0);
?>
                    <input type="checkbox" value="1" <?php 
echo $private ? 'checked="checked"' : '';
?>
 name="private">
                    <span class="checkbox-title"><?php 
_e('Hide Fee Plan from public?', 'AWPCP');
?>
</span>
                </label>

            </div>
        </fieldset>

        <p class="submit inline-edit-save">
Example #3
0
 public function get_images_config($ad)
 {
     $payment_term = awpcp_payments_api()->get_ad_payment_term($ad);
     $images_allowed = awpcp_get_property($payment_term, 'images', get_awpcp_option('imagesallowedfree', 0));
     $images_uploaded = $ad->count_image_files();
     return array('images_allowed' => $images_allowed, 'images_uploaded' => $images_uploaded);
 }
Example #4
0
 protected function get_user_info($user_id = false)
 {
     $data = awpcp_users_collection()->find_by_id($user_id);
     $translations = array('first_name' => 'first_name', 'last_name' => 'last_name', 'email' => 'email', 'city' => 'city', 'address_1' => 'address');
     foreach ($translations as $field => $key) {
         $info[$field] = awpcp_get_property($data, $key);
     }
     return $info;
 }
Example #5
0
/**
 * Returns information about the number of files uplaoded to an Ad, and
 * the number of files that can still be added to that same Ad.
 *
 * @since 3.0.2
 * @deprecated 3.4
 */
function awpcp_get_ad_uploaded_files_stats($ad)
{
    $payment_term = awpcp_payments_api()->get_ad_payment_term($ad);
    $images_allowed = get_awpcp_option('imagesallowedfree', 0);
    $images_allowed = awpcp_get_property($payment_term, 'images', $images_allowed);
    $images_uploaded = $ad->count_image_files();
    $images_left = max($images_allowed - $images_uploaded, 0);
    return apply_filters('awpcp-ad-uploaded-files-stats', array('images_allowed' => $images_allowed, 'images_uploaded' => $images_uploaded, 'images_left' => $images_left), $ad);
}
Example #6
0
 /**
  * @since 3.0.2
  */
 public function check_compatibility_with_premium_modules()
 {
     $this->errors = awpcp_get_property($this, 'errors', array());
     $modules = $this->get_premium_modules_information();
     foreach ($modules as $module => $params) {
         if (!$params['installed']) {
             continue;
         }
         if (defined($params['version'])) {
             $version = constant($params['version']);
         } else {
             $version = '0.0.1';
         }
         if (version_compare($version, $params['required']) < 0) {
             $message = __('The %1$s module you have installed is outdated and not compatible with this version of AWPCP. Please get %1$s %2$s or newer.', 'AWPCP');
             $name = "<strong>{$params['name']}</strong>";
             $required = "<strong>{$params['required']}</strong>";
             $this->errors[] = sprintf($message, $name, $required);
         }
     }
 }
Example #7
0
 public function save()
 {
     global $wpdb;
     $data = array('ad_id' => awpcp_get_property($this, 'ad_id'), 'adterm_id' => awpcp_get_property($this, 'adterm_id'), 'payment_term_type' => awpcp_get_property($this, 'payment_term_type'), 'ad_fee_paid' => awpcp_get_property($this, 'ad_fee_paid'), 'ad_category_id' => awpcp_get_property($this, 'ad_category_id'), 'ad_category_parent_id' => awpcp_get_property($this, 'ad_category_parent_id'), 'ad_title' => awpcp_get_property($this, 'ad_title'), 'ad_details' => awpcp_get_property($this, 'ad_details'), 'ad_contact_name' => awpcp_get_property($this, 'ad_contact_name'), 'ad_contact_phone' => awpcp_get_property($this, 'ad_contact_phone'), 'ad_contact_email' => awpcp_get_property($this, 'ad_contact_email'), 'ad_city' => awpcp_get_property($this, 'ad_city'), 'ad_state' => awpcp_get_property($this, 'ad_state'), 'ad_country' => awpcp_get_property($this, 'ad_country'), 'ad_county_village' => awpcp_get_property($this, 'ad_county_village'), 'ad_item_price' => awpcp_get_property($this, 'ad_item_price'), 'ad_views' => awpcp_get_property($this, 'ad_views'), 'ad_postdate' => awpcp_get_property($this, 'ad_postdate'), 'ad_last_updated' => awpcp_get_property($this, 'ad_last_updated'), 'ad_startdate' => awpcp_get_property($this, 'ad_startdate'), 'ad_enddate' => awpcp_get_property($this, 'ad_enddate'), 'ad_key' => awpcp_get_property($this, 'ad_key'), 'ad_transaction_id' => awpcp_get_property($this, 'ad_transaction_id'), 'user_id' => awpcp_get_property($this, 'user_id'), 'payment_gateway' => awpcp_get_property($this, 'payment_gateway'), 'payment_status' => awpcp_get_property($this, 'payment_status'), 'payer_email' => awpcp_get_property($this, 'payer_email'), 'is_featured_ad' => awpcp_get_property($this, 'is_featured_ad'), 'flagged' => awpcp_get_property($this, 'flagged'), 'disabled' => awpcp_get_property($this, 'disabled'), 'disabled_date' => awpcp_get_property($this, 'disabled_date'), 'renew_email_sent' => awpcp_get_property($this, 'renew_email_sent'), 'renewed_date' => awpcp_get_property($this, 'renewed_date'), 'verified' => awpcp_get_property($this, 'verified'), 'verified_at' => awpcp_get_property($this, 'verified_at'), 'websiteurl' => awpcp_get_property($this, 'websiteurl'), 'posterip' => awpcp_get_property($this, 'posterip'));
     $data = $this->sanitize($data);
     if (empty($this->ad_id)) {
         $result = $wpdb->insert(AWPCP_TABLE_ADS, $data);
         $this->ad_id = $wpdb->insert_id;
     } else {
         $result = $wpdb->update(AWPCP_TABLE_ADS, $data, array('ad_id' => $this->ad_id));
     }
     return $result === false ? false : true;
 }
?>
</span>
                    <span class="input-text-wrap formatted-field"><input type="text" value="<?php 
echo esc_attr($plan ? $plan->price : '');
?>
" name="price"></span>
                </label>
        </fieldset>

        <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
                <label><span class="title"><?php 
echo esc_html(__('Description', 'AWPCP'));
?>
</span></label>
                <textarea name="description" cols="54" rows="6"><?php 
echo stripslashes(awpcp_get_property($plan, 'description'));
?>
</textarea>
        </fieldset>

        <p class="submit inline-edit-save">
            <?php 
$label = $id ? __('Update', 'AWPCP') : __('Add', 'AWPCP');
?>
            <?php 
$cancel = __('Cancel', 'AWPCP');
?>
            <a class="button-secondary cancel alignleft" title="<?php 
echo esc_attr($cancel);
?>
" href="#inline-edit" accesskey="c"><?php 
Example #9
0
 public static function create_from_object($object)
 {
     return new AWPCP_Category($object->category_id, $object->category_name, awpcp_get_property($object, 'category_icon', ''), awpcp_get_property($object, 'category_order', ''), $object->category_parent_id);
 }
Example #10
0
function awpcp_get_object_property_from_alternatives($object, $alternatives, $default = '')
{
    foreach ((array) $alternatives as $key) {
        $value = awpcp_get_property($object, $key);
        if (strlen($value) == 0) {
            continue;
        }
        return $value;
    }
    return $default;
}
Example #11
0
 private function upgrade_to_3_0_6($version)
 {
     global $wpdb;
     $fields = $wpdb->get_results('SELECT * FROM ' . AWPCP_TABLE_EXTRA_FIELDS);
     $properties = array('field_options', 'field_category');
     foreach ($fields as $field) {
         $data = array();
         foreach ($properties as $property) {
             $value = maybe_unserialize(trim(awpcp_get_property($field, $property)));
             if (!is_array($value) && strlen($value) === 0) {
                 $value = array();
             } else {
                 if (!is_array($value)) {
                     $value = array($value);
                 }
             }
             // remove empty strings from array
             $value = array_filter($value, 'strlen');
             $data[$property] = maybe_serialize($value);
         }
         $wpdb->update(AWPCP_TABLE_EXTRA_FIELDS, $data, array('field_id' => $field->field_id));
     }
 }