?>

							    <div class="pad5 dotted"></div>

                                <div class="bigright"<?php 
        if (get_option($GLOBALS['app_abbr'] . '_ad_images') == 'no') {
            echo 'style="float:none;"';
        }
        ?>
>

                                    <ul>

                                        <?php 
        // grab the category id for the functions below
        $cat_id = appthemes_get_custom_taxonomy($post->ID, APP_TAX_CAT, 'term_id');
        // check to see if ad is legacy or not
        if (get_post_meta($post->ID, 'expires', true)) {
            ?>

                                            <li><span><?php 
            _e('Location:', 'appthemes');
            ?>
</span> <?php 
            echo get_post_meta($post->ID, 'location', true);
            ?>
</li>
                                            <li><span><?php 
            _e('Phone:', 'appthemes');
            ?>
</span> <?php 
Example #2
0
function cp_custom_fields_meta_box()
{
    global $wpdb, $post, $meta_boxes, $key;
    // use nonce for verification
    wp_nonce_field(basename(__FILE__), $key . '_wpnonce', false, true);
    // get the ad category id
    $ad_cat_id = appthemes_get_custom_taxonomy($post->ID, APP_TAX_CAT, 'term_id');
    // get the form id
    $fid = cp_get_form_id($ad_cat_id);
    // if there's no form id it must mean the default form is being used so let's go grab those fields
    if (!$fid) {
        // use this if there's no custom form being used and give us the default form
        $sql = $wpdb->prepare("SELECT field_label, field_name, field_type, field_values, field_tooltip, field_req " . "FROM " . $wpdb->prefix . "cp_ad_fields " . "WHERE field_core = '1' " . "ORDER BY field_id asc");
    } else {
        // now we should have the formid so show the form layout based on the category selected
        $sql = $wpdb->prepare("SELECT f.field_label, f.field_name, f.field_type, f.field_values, f.field_perm, f.field_tooltip, m.meta_id, m.field_pos, m.field_req, m.form_id " . "FROM " . $wpdb->prefix . "cp_ad_fields f " . "INNER JOIN " . $wpdb->prefix . "cp_ad_meta m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $fid);
    }
    $results = $wpdb->get_results($sql);
    // display the write panel for the custom fields
    if ($results) {
        ?>
	

	<script type="text/javascript">
		//<![CDATA[	
		/* initialize the datepicker feature */
		jQuery(document).ready(function($) {		   
			$('table input#datepicker').datetimepicker({
				showSecond: true,
				timeFormat: 'hh:mm:ss',
				showOn: 'button',
				dateFormat: 'mm/dd/yy',				
				minDate: 0,
				buttonImageOnly: true,
				buttonText: '',
				buttonImage: '../wp-includes/images/blank.gif' // calling the real calendar image in the admin-style.css. need a blank placeholder image b/c of IE.
			});
		});	
		//]]>
	</script>	

		<table class="form-table ad-meta-table">
		
			<tr>
				<th style="width:20%"><label for="cp_sys_ad_conf_id"><?php 
        _e('Ad Info', 'appthemes');
        ?>
:</label></th>
				<td class="ad-conf-id">
					<div id="ad-id"><div id="keyico"></div><?php 
        _e('Ad ID', 'appthemes');
        ?>
: <span><?php 
        echo esc_html(get_post_meta($post->ID, 'cp_sys_ad_conf_id', true));
        ?>
</span></div>
					<div id="ad-stats"><div id="statsico"></div><?php 
        _e('Views Today', 'appthemes');
        ?>
: <strong><?php 
        echo esc_html(get_post_meta($post->ID, 'cp_daily_count', true));
        ?>
</strong> | <?php 
        _e('Views Total:', 'appthemes');
        ?>
 <strong><?php 
        echo esc_html(get_post_meta($post->ID, 'cp_total_count', true));
        ?>
</strong></div>
				</td>
			</tr>

			<tr>
				<th style="width:20%"><label for="cp_sys_ad_conf_id"><?php 
        _e('Submitted By', 'appthemes');
        ?>
:</label></th>
				<td style="line-height:3.4em;">
					<?php 
        // show the gravatar for the author
        echo get_avatar($post->post_author, $size = '48', $default = '');
        // show the author drop-down box
        wp_dropdown_users(array('who' => 'authors', 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author, 'include_selected' => true));
        // display the author display name
        $author = get_userdata($post->post_author);
        echo '<br/><a href="user-edit.php?user_id=' . $author->ID . '">' . $author->display_name . '</a>';
        ?>
				</td>
			</tr>

			<tr>
				<th style="width:20%"><label for="cp_sys_ad_conf_id"><?php 
        _e('Ad Terms', 'appthemes');
        ?>
:</label></th>
				<td><?php 
        echo cp_get_price($post->ID, 'cp_sys_total_ad_cost');
        ?>
 <?php 
        _e('for', 'appthemes');
        ?>
 <?php 
        echo esc_html(get_post_meta($post->ID, 'cp_sys_ad_duration', true));
        ?>
 <?php 
        _e('days', 'appthemes');
        ?>
</td>
			</tr>

			<tr>
				<th style="width:20%"><label for="cp_sys_expire_date"><?php 
        _e('Ad Expires', 'appthemes');
        ?>
:</label></th>
				<td><input readonly type="text" name="cp_sys_expire_date" class="text" id="datepicker" value="<?php 
        echo esc_html(get_post_meta($post->ID, 'cp_sys_expire_date', true));
        ?>
" /></td>
			</tr>			
				
			<tr>	
				<th colspan="2" style="padding:0px;">&nbsp;</th>
			</tr>		
			
			<?php 
        cp_edit_ad_fields($results, $post->ID);
        // build the edit ad meta box
        ?>
			
		
			<tr>
				<th style="width:20%"><label for="cp_sys_userIP"><?php 
        _e('Submitted from IP', 'appthemes');
        ?>
:</label></th>
				<td><?php 
        echo esc_html(get_post_meta($post->ID, 'cp_sys_userIP', true));
        ?>
</td>
			</tr>	
			
		</table>	
		
	<?php 
    }
    ?>

<?php 
}
Example #3
0
 public function get_custom_form_fields()
 {
     // get the ad category ID
     $category_id = appthemes_get_custom_taxonomy($this->get_post_id(), APP_TAX_CAT, 'term_id');
     // get the form id based on category ID
     $form_id = !empty($category_id) ? cp_get_form_id($category_id) : false;
     $form_fields = cp_get_custom_form_fields($form_id);
     return $form_fields;
 }
Example #4
0
function app_report_post($post_id)
{
    // get the post values
    $the_ad = get_post($post_id);
    $category = appthemes_get_custom_taxonomy($post_id, APP_TAX_CAT, 'name');
    $ad_title = stripslashes($the_ad->post_title);
    $ad_cat = stripslashes($category);
    $ad_author = stripslashes(get_the_author_meta('user_login', $the_ad->post_author));
    $ad_slug = get_option('siteurl') . '/?post_type=' . APP_POST_TYPE . '&p=' . $post_id;
    //$ad_content = appthemes_filter(stripslashes($the_ad->post_content));
    $adminurl = get_option('siteurl') . '/wp-admin/post.php?action=edit&post=' . $post_id;
    $mailto = get_option('admin_email');
    //$mailto = 'tester@127.0.0.1'; // USED FOR TESTING
    $subject = __('Post Reported', 'appthemes');
    $headers = 'From: ' . __('ClassiPress Admin', 'appthemes') . ' <' . get_option('admin_email') . '>' . "\r\n";
    // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    // we want to reverse this for the plain text arena of emails.
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $message = __('Dear Admin,', 'appthemes') . "\r\n\r\n";
    $message .= sprintf(__('The following ad listing has just been reported on your %s website.', 'appthemes'), $blogname) . "\r\n\r\n";
    $message .= __('Ad Details', 'appthemes') . "\r\n";
    $message .= __('-----------------') . "\r\n";
    $message .= __('Title: ', 'appthemes') . $ad_title . "\r\n";
    $message .= __('Category: ', 'appthemes') . $ad_cat . "\r\n";
    $message .= __('Author: ', 'appthemes') . $ad_author . "\r\n";
    //$message .= __('Description: ', 'appthemes') . $ad_content . "\r\n";
    $message .= __('-----------------') . "\r\n\r\n";
    $message .= __('Preview Ad: ', 'appthemes') . $ad_slug . "\r\n";
    $message .= sprintf(__('Edit Ad: %s', 'appthemes'), $adminurl) . "\r\n\r\n\r\n";
    $message .= __('Regards,', 'appthemes') . "\r\n\r\n";
    $message .= __('ClassiPress', 'appthemes') . "\r\n\r\n";
    // ok let's send the email
    wp_mail($mailto, $subject, $message, $headers);
}
Example #5
0
function app_report_post($post_id)
{
    // get the post values
    $the_ad = get_post($post_id);
    $category = appthemes_get_custom_taxonomy($post_id, APP_TAX_CAT, 'name');
    $ad_title = stripslashes($the_ad->post_title);
    $ad_cat = stripslashes($category);
    $ad_author = stripslashes(cp_get_user_name($the_ad->post_author));
    $ad_slug = get_permalink($post_id);
    $adminurl = get_edit_post_link($post_id, '');
    $mailto = get_option('admin_email');
    $subject = __('Post Reported', APP_TD);
    // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    // we want to reverse this for the plain text arena of emails.
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $message = __('Dear Admin,', APP_TD) . "\r\n\r\n";
    $message .= sprintf(__('The following ad listing has just been reported on your %s website.', APP_TD), $blogname) . "\r\n\r\n";
    $message .= __('Ad Details', APP_TD) . "\r\n";
    $message .= __('-----------------', APP_TD) . "\r\n";
    $message .= __('Title: ', APP_TD) . $ad_title . "\r\n";
    $message .= __('Category: ', APP_TD) . $ad_cat . "\r\n";
    $message .= __('Author: ', APP_TD) . $ad_author . "\r\n";
    $message .= __('-----------------', APP_TD) . "\r\n\r\n";
    $message .= __('Preview Ad: ', APP_TD) . $ad_slug . "\r\n";
    $message .= sprintf(__('Edit Ad: %s', APP_TD), $adminurl) . "\r\n\r\n\r\n";
    $message .= __('Regards,', APP_TD) . "\r\n\r\n";
    $message .= __('ClassiPress', APP_TD) . "\r\n\r\n";
    wp_mail($mailto, $subject, $message);
}
Example #6
0
/**
 * Sends email to ad owner when an ad is approved or expires.
 *
 * @param string $new_status
 * @param string $old_status
 * @param object $post
 *
 * @return void
 */
function cp_notify_ad_owner_email($new_status, $old_status, $post)
{
    global $current_user, $cp_options;
    if ($post->post_type != APP_POST_TYPE) {
        return;
    }
    $title = $post->post_title;
    $category = appthemes_get_custom_taxonomy($post->ID, APP_TAX_CAT, 'name');
    $author = stripslashes(cp_get_user_name($post->post_author));
    $author_email = stripslashes(get_the_author_meta('user_email', $post->post_author));
    $post_status = cp_get_status_i18n($post->post_status);
    $site_url = home_url('/');
    $dashboard_url = trailingslashit(CP_DASHBOARD_URL);
    $blogname = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
    // make sure the admin wants to send emails
    $send_approved_email = $cp_options->new_ad_email_owner;
    $send_expired_email = $cp_options->expired_ad_email_owner;
    // if the ad has been approved send email to ad owner only if owner is not equal to approver
    // admin approving own ads or ad owner pausing and reactivating ad on his dashboard don't need to send email
    if ($old_status == 'pending' && $new_status == 'publish' && $current_user->ID != $post->post_author && $send_approved_email) {
        $subject = __('Your ad has been approved', APP_TD);
        $message = html('p', sprintf(__('Hi %s,', APP_TD), $author)) . PHP_EOL;
        $message .= html('p', sprintf(__('Your ad listing, "%s" has been approved and is now live on our site.', APP_TD), $title)) . PHP_EOL;
        $message .= html('p', __('You can view your ad by clicking on the following link:', APP_TD) . '<br />' . html_link(get_permalink($post->ID))) . PHP_EOL;
        $message .= html('p', __('Regards,', APP_TD) . '<br />' . sprintf(__('Your %s Team', APP_TD), $blogname)) . PHP_EOL;
        $message .= html('p', html_link($site_url)) . PHP_EOL;
        $email = array('to' => $author_email, 'subject' => $subject, 'message' => $message);
        $email = apply_filters('cp_email_user_ad_approved', $email, $post);
        appthemes_send_email($email['to'], $email['subject'], $email['message']);
        // if the ad has expired, send an email to the ad owner only if owner is not equal to approver
    } elseif ($old_status == 'publish' && $new_status == 'draft' && $current_user->ID != $post->post_author && $send_expired_email) {
        $subject = __('Your ad has expired', APP_TD);
        $message = html('p', sprintf(__('Hi %s,', APP_TD), $author)) . PHP_EOL;
        $message .= html('p', sprintf(__('Your ad listing, "%s" has expired.', APP_TD), $title)) . PHP_EOL;
        if ($cp_options->allow_relist) {
            $message .= html('p', __('If you would like to relist your ad, please visit your dashboard and click the "relist" link.', APP_TD) . '<br />' . html_link($dashboard_url)) . PHP_EOL;
        }
        $message .= html('p', __('Regards,', APP_TD) . '<br />' . sprintf(__('Your %s Team', APP_TD), $blogname)) . PHP_EOL;
        $message .= html('p', html_link($site_url)) . PHP_EOL;
        $email = array('to' => $author_email, 'subject' => $subject, 'message' => $message);
        $email = apply_filters('cp_email_user_ad_expired', $email, $post);
        appthemes_send_email($email['to'], $email['subject'], $email['message']);
    }
}
Example #7
0
function junkie_get_store_image_url($id, $type = 'post_id', $width = 110)
{
    $store_url = false;
    $store_image_id = false;
    $sizes = array(75 => 'thumb-med', 110 => 'post-thumbnail', 150 => 'thumb-store', 160 => 'thumb-featured', 250 => 'thumb-large-preview');
    $sizes = apply_filters('junkie_store_image_sizes', $sizes);
    if (!array_key_exists($width, $sizes)) {
        $width = 110;
    }
    if (!isset($sizes[$width])) {
        $sizes[$width] = 'post-thumbnail';
    }
    if ($type == 'term_id' && $id) {
        $store_url = get_metadata('coupon_store', $id, 'junkie_store_url', true);
        $store_image_id = get_metadata('coupon_store', $id, 'junkie_store_image_id', true);
    }
    if ($type == 'post_id' && $id) {
        $term_id = appthemes_get_custom_taxonomy($id, 'coupon_store', 'term_id');
        $store_url = get_metadata('coupon_store', $term_id, 'junkie_store_url', true);
        $store_image_id = get_metadata('coupon_store', $term_id, 'junkie_store_image_id', true);
    }
    if (is_numeric($store_image_id)) {
        $store_image_src = wp_get_attachment_image_src($store_image_id, $sizes[$width]);
        if ($store_image_src) {
            return $store_image_src[0];
        }
    } else {
        $store_image_url = get_template_directory_uri() . '/images/store-default.png';
        return apply_filters('junkie_store_default_image', $store_image_url, $width);
    }
    /*
    
    if ( ! empty( $store_url ) ) {
    	$store_image_url = "http://s.wordpress.com/mshots/v1/" . urlencode($store_url) . "?w=" . $width;
    	return apply_filters( 'junkie_store_image', $store_image_url, $width, $store_url );
    } 
    */
}