当前位置: 首页>>代码示例>>PHP>>正文


PHP appthemes_clean函数代码示例

本文整理汇总了PHP中appthemes_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP appthemes_clean函数的具体用法?PHP appthemes_clean怎么用?PHP appthemes_clean使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了appthemes_clean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cp_process_paypal_transaction

function cp_process_paypal_transaction()
{
    global $wpdb;
    if ($_POST['txn_id']) {
        // since paypal sends over the date as a string, we need to convert it
        // into a mysql date format. There will be a time difference due to PayPal's
        // US pacific time zone and your server time zone
        $payment_date = strtotime($_POST['payment_date']);
        $payment_date = strftime('%Y-%m-%d %H:%M:%S', $payment_date);
        //setup some values that are not always sent
        if (isset($_REQUEST['aid'])) {
            $aid = $_REQUEST['aid'];
        } else {
            $aid = '';
        }
        if (isset($_POST['reason_code'])) {
            $reason_code = $_POST['reason_code'];
        } else {
            $reason_code = '';
        }
        // check and make sure this transaction hasn't already been added
        $results = $wpdb->get_var($wpdb->prepare("SELECT txn_id FROM {$wpdb->cp_order_info} WHERE txn_id = %s LIMIT 1", appthemes_clean($_POST['txn_id'])));
        if (!$results) {
            // @todo Change to Insert
            $sql = $wpdb->prepare("INSERT INTO {$wpdb->cp_order_info}" . " (ad_id, first_name, last_name, payer_email, residence_country, transaction_subject, item_name,\r\n                       item_number, payment_type, payer_status, payer_id, receiver_id, parent_txn_id, txn_id, mc_gross, mc_fee, payment_status,\r\n                       pending_reason, txn_type, tax, mc_currency, reason_code, custom, test_ipn, payment_date, create_date\r\n                    ) " . "VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", appthemes_clean($aid), appthemes_clean($_POST['first_name']), appthemes_clean($_POST['last_name']), appthemes_clean($_POST['payer_email']), appthemes_clean($_POST['residence_country']), appthemes_clean($_POST['transaction_subject']), appthemes_clean($_POST['item_name']), appthemes_clean($_POST['item_number']), appthemes_clean($_POST['payment_type']), appthemes_clean($_POST['payer_status']), appthemes_clean($_POST['payer_id']), appthemes_clean($_POST['receiver_id']), appthemes_clean($_POST['parent_txn_id']), appthemes_clean($_POST['txn_id']), appthemes_clean($_POST['mc_gross']), appthemes_clean($_POST['mc_fee']), appthemes_clean($_POST['payment_status']), appthemes_clean($_POST['pending_reason']), appthemes_clean($_POST['txn_type']), appthemes_clean($_POST['tax']), appthemes_clean($_POST['mc_currency']), appthemes_clean($reason_code), appthemes_clean($_POST['custom']), appthemes_clean($_POST['test_ipn']), $payment_date, current_time('mysql'));
            $results = $wpdb->query($sql);
            // ad transaction already exists so it must be an update via PayPal IPN (refund, etc)
            // @todo send through prepare
        } else {
            $update = "UPDATE {$wpdb->cp_order_info} SET" . " payment_status = '" . $wpdb->escape(appthemes_clean($_POST['payment_status'])) . "'," . " mc_gross = '" . $wpdb->escape(appthemes_clean($_POST['mc_gross'])) . "'," . " txn_type = '" . $wpdb->escape(appthemes_clean($_POST['txn_type'])) . "'," . " reason_code = '" . $wpdb->escape(appthemes_clean($reason_code)) . "'," . " mc_currency = '" . $wpdb->escape(appthemes_clean($_POST['mc_currency'])) . "'," . " test_ipn = '" . $wpdb->escape(appthemes_clean($_POST['test_ipn'])) . "'," . " create_date = '" . $wpdb->escape($payment_date) . "'" . " WHERE txn_id ='" . $wpdb->escape($_POST['txn_id']) . "'";
            //Updating transaction that was already found
            $results = $wpdb->query($update);
        }
    }
}
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:35,代码来源:process.php

示例2: cp_process_paypal_transaction

function cp_process_paypal_transaction()
{
    global $wpdb;
    if (isset($_POST['txn_id'])) {
        // since paypal sends over the date as a string, we need to convert it
        // into a mysql date format. There will be a time difference due to PayPal's
        // US pacific time zone and your server time zone
        $payment_date = strtotime($_POST['payment_date']);
        $payment_date = strftime('%Y-%m-%d %H:%M:%S', $payment_date);
        //setup some values that are not always sent
        if (isset($_REQUEST['aid'])) {
            $aid = trim($_REQUEST['aid']);
            $the_ad = get_post($aid);
            $user_id = $the_ad->post_author;
        } else {
            $aid = '';
            $user_id = trim($_REQUEST['uid']);
        }
        $reason_code = isset($_POST['reason_code']) ? $_POST['reason_code'] : '';
        $pending_reason = isset($_POST['pending_reason']) ? $_POST['pending_reason'] : '';
        $parent_txn_id = isset($_POST['parent_txn_id']) ? $_POST['parent_txn_id'] : '';
        $test_ipn = isset($_POST['test_ipn']) ? $_POST['test_ipn'] : '';
        // check and make sure this transaction hasn't already been added
        $results = $wpdb->get_var($wpdb->prepare("SELECT txn_id FROM {$wpdb->cp_order_info} WHERE txn_id = %s LIMIT 1", appthemes_clean($_POST['txn_id'])));
        if (!$results) {
            $data = array('ad_id' => appthemes_clean($aid), 'user_id' => appthemes_clean($user_id), 'first_name' => appthemes_clean($_POST['first_name']), 'last_name' => appthemes_clean($_POST['last_name']), 'payer_email' => appthemes_clean($_POST['payer_email']), 'residence_country' => appthemes_clean($_POST['residence_country']), 'transaction_subject' => appthemes_clean($_POST['transaction_subject']), 'item_name' => appthemes_clean($_POST['item_name']), 'item_number' => appthemes_clean($_POST['item_number']), 'payment_type' => appthemes_clean($_POST['payment_type']), 'payer_status' => appthemes_clean($_POST['payer_status']), 'payer_id' => appthemes_clean($_POST['payer_id']), 'receiver_id' => appthemes_clean($_POST['receiver_id']), 'parent_txn_id' => appthemes_clean($parent_txn_id), 'txn_id' => appthemes_clean($_POST['txn_id']), 'mc_gross' => appthemes_clean($_POST['mc_gross']), 'mc_fee' => appthemes_clean($_POST['mc_fee']), 'payment_status' => appthemes_clean($_POST['payment_status']), 'pending_reason' => appthemes_clean($pending_reason), 'txn_type' => appthemes_clean($_POST['txn_type']), 'tax' => appthemes_clean($_POST['tax']), 'mc_currency' => appthemes_clean($_POST['mc_currency']), 'reason_code' => appthemes_clean($reason_code), 'custom' => appthemes_clean($_POST['custom']), 'test_ipn' => appthemes_clean($test_ipn), 'payment_date' => $payment_date, 'create_date' => current_time('mysql'));
            $wpdb->insert($wpdb->cp_order_info, $data);
            // ad transaction already exists so it must be an update via PayPal IPN (refund, etc)
        } else {
            //Updating transaction that was already found
            $data = array('payment_status' => appthemes_clean($_POST['payment_status']), 'mc_gross' => appthemes_clean($_POST['mc_gross']), 'txn_type' => appthemes_clean($_POST['txn_type']), 'reason_code' => appthemes_clean($reason_code), 'mc_currency' => appthemes_clean($_POST['mc_currency']), 'test_ipn' => appthemes_clean($_POST['test_ipn']), 'create_date' => $payment_date);
            $wpdb->update($wpdb->cp_order_info, $data, array('txn_id' => $_POST['txn_id']));
        }
    }
}
开发者ID:kalushta,项目名称:darom,代码行数:35,代码来源:process.php

示例3: get_attachment

 public function get_attachment()
 {
     if ('POST' != $_SERVER['REQUEST_METHOD']) {
         die(json_encode(array('success' => false, 'message' => __('Error: only post method allowed.', APP_TD))));
     }
     $required = array('ID', 'url', 'title');
     foreach ($required as $key) {
         if (!isset($_POST[$key])) {
             die(json_encode(array('success' => false, 'message' => __('Error: missing required post data.', APP_TD))));
         }
     }
     $post_id = absint($_POST['ID']);
     $url = appthemes_clean($_POST['url']);
     $title = wp_kses_data($_POST['title']);
     $attachment = $this->_get_attachment($post_id, $url);
     if (!$attachment) {
         $attachment = $this->alt_attachment($url, $post_id, $title);
     }
     if ($attachment) {
         $attachment->thumbnail_html = $this->display_attachment_thumbnail($attachment);
         $attachment->upload_date = appthemes_display_date($attachment->post_date, 'date');
         $attachment->dimensions = $this->display_attachment_dimensions($attachment);
         die(json_encode($attachment));
     }
     die(json_encode(array('success' => false, 'message' => __('Error: attachment not found.', APP_TD))));
 }
开发者ID:kalushta,项目名称:darom,代码行数:26,代码来源:class-attachments-metabox.php

示例4: report_options_clean

 /**
  * Cleaning report options
  *
  * @param string $string
  *
  * @return string
  */
 public function report_options_clean($string)
 {
     $string = str_replace(array("\r\n", "\r"), "\n", $string);
     $string = str_replace("\t", "", $string);
     $string = appthemes_clean($string);
     return $string;
 }
开发者ID:kalushta,项目名称:darom,代码行数:14,代码来源:settings.php

示例5: cp_cat_base

 function cp_cat_base()
 {
     _deprecated_function(__FUNCTION__, '3.0.5');
     if (appthemes_clean(get_option('category_base')) == '') {
         $cat_base = home_url('/') . 'category';
     } else {
         $cat_base = home_url('/') . get_option('category_base');
     }
     return $cat_base;
 }
开发者ID:kalushta,项目名称:darom,代码行数:10,代码来源:deprecated.php

示例6: appthemes_update_options

function appthemes_update_options($options)
{
    if (isset($_POST['submitted']) && $_POST['submitted'] == 'yes') {
        foreach ($options as $value) {
            if (isset($value['id']) && isset($_POST[$value['id']])) {
                // echo $value['id'] . '<-- value ID | ' . $_POST[$value['id']] . '<-- $_POST value ID <br/><br/>'; // FOR DEBUGGING
                update_option($value['id'], appthemes_clean($_POST[$value['id']]));
            } else {
                @delete_option($value['id']);
            }
        }
        echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'appthemes') . '</strong></p></div>';
    }
}
开发者ID:besimhu,项目名称:legacy,代码行数:14,代码来源:admin-options.php

示例7: get_user_orders

$order = get_user_orders($current_user->ID, $_REQUEST['oid']);
//if the order was found by OID, setup the order details into the $order variable
if (isset($order) && $order) {
    $order = get_option($order);
}
//make sure the order sent from payment gateway is logged in the database and that the current user created it
if (isset($order['order_id']) && $order['order_id'] == $_REQUEST['oid'] && $order['user_id'] == $current_user->ID) {
    $order_processed = appthemes_process_membership_order($current_user, $order);
    //send email to user
    if ($order_processed) {
        cp_owner_activated_membership_email($current_user, $order_processed);
    }
} else {
    $order_processed = false;
    // check and make sure this transaction hasn't already been added
    $sql = "SELECT * " . "FROM {$wpdb->cp_order_info} " . "WHERE custom = '" . $wpdb->escape(appthemes_clean($_REQUEST['oid'])) . "' LIMIT 1";
    $results = $wpdb->get_row($sql);
    if ($results) {
        $order_processed = 'IPN';
    }
}
?>

<?php 
get_header();
?>

<!-- CONTENT -->
  <div class="content">

    <div class="content_botbg">
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:31,代码来源:tpl-membership-confirm.php

示例8: cp_upgrade_310

/**
 * Execute changes made in ClassiPress 3.1.0.
 *
 * @since 3.1.0
 */
function cp_upgrade_310()
{
    global $wpdb, $app_abbr, $app_version;
    $wpdb->query("ALTER TABLE " . $wpdb->prefix . "cp_ad_meta ADD `field_search` int(10) NOT NULL");
    $wpdb->query("ALTER TABLE " . $wpdb->prefix . "cp_ad_fields ADD `field_min_length` int(11) NOT NULL");
    $wpdb->query("ALTER TABLE " . $wpdb->prefix . "cp_ad_fields ADD `field_validation` LONGTEXT NULL");
    $wpdb->query("ALTER TABLE " . $wpdb->prefix . "cp_ad_packs ADD `pack_type` VARCHAR(255) NOT NULL");
    $wpdb->query("ALTER TABLE " . $wpdb->prefix . "cp_ad_packs ADD `pack_membership_price` DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT '0'");
    if (get_option($app_abbr . '_distance_unit') == false) {
        update_option($app_abbr . '_distance_unit', 'mi');
    }
    if (get_option('embed_size_w') == false) {
        update_option('embed_size_w', 500);
    }
    // set the WP maximum embed size width
    if (get_option($app_abbr . '_membership_purchase_url') == false) {
        update_option($app_abbr . '_membership_purchase_url', 'membership');
    }
    if (get_option($app_abbr . '_membership_purchase_confirm_url') == false) {
        update_option($app_abbr . '_membership_purchase_confirm_url', 'membership-confirm');
    }
    /**
     * create and set new membership page templates
     */
    $cur_ex_pages = array();
    $wpdb->get_results("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'membership' LIMIT 1");
    if ($wpdb->num_rows == 0) {
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'membership', 'post_title' => 'Memberships');
        $page_id = wp_insert_post($my_page);
        update_post_meta($page_id, '_wp_page_template', 'tpl-membership-purchase.php');
        $cur_ex_pages[] = $page_id;
    }
    $wpdb->get_results("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'membership-confirm' LIMIT 1");
    if ($wpdb->num_rows == 0) {
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'membership-confirm', 'post_title' => 'Membership Confirmation');
        $page_id = wp_insert_post($my_page);
        update_post_meta($page_id, '_wp_page_template', 'tpl-membership-confirm.php');
        $cur_ex_pages[] = $page_id;
    }
    // check to see if array of page ids is empty
    // if not, add them to the pages to be excluded from the nav meta option.
    if (!empty($cur_ex_pages)) {
        $all_ex_pages = array();
        // get all excluded pages
        $ex_pages = get_option($app_abbr . '_excluded_pages');
        if ($ex_pages == true) {
            // put page ids into an array
            $ex_pages = explode(',', $ex_pages);
            // merge them with the new page ids
            $all_ex_pages = array_merge($ex_pages, $cur_ex_pages);
            // convert back to a comma separated string for saving
            $all_ex_pages = implode(',', $all_ex_pages);
        } else {
            // option doesn't exist so no existing page ids
            $all_ex_pages = implode(',', $cur_ex_pages);
        }
        // update with the new list of excluded page ids
        update_option($app_abbr . '_excluded_pages', appthemes_clean($all_ex_pages));
    }
    update_option('cp_db_version', 1200);
    update_option($app_abbr . '_version', $app_version);
}
开发者ID:joaosigno,项目名称:dazake-job,代码行数:67,代码来源:admin-updates.php

示例9: cp_custom_fields

/**
 * Handles form fields admin page.
 *
 * @return void
 */
function cp_custom_fields()
{
    global $options_new_field, $wpdb, $current_user;
    $current_user = wp_get_current_user();
    ?>

	<!-- show/hide the dropdown field values tr -->
	<script type="text/javascript">
	/* <![CDATA[ */
		jQuery(document).ready(function() {
			jQuery("#mainform").validate({errorClass: "invalid"});
		});

		function show(o){
			if(o){switch(o.value){
				case 'drop-down': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
				case 'radio': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
				case 'checkbox': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
				case 'text box': jQuery('#field_min_length_row').show(); jQuery('#field_values_row').hide(); break;
				default: jQuery('#field_values_row').hide(); jQuery('#field_min_length_row').hide();
			}}
		}

		//show/hide immediately on document load
		jQuery(document).ready(function() {
			show(jQuery('#field_type').get(0));
		});

		//hide unwanted options for cp_currency field
		jQuery(document).ready(function() {
			var field_name = jQuery('#field_name').val();
			if(field_name == 'cp_currency'){
				jQuery("#field_type option[value='text box']").attr("disabled", "disabled");
				jQuery("#field_type option[value='text area']").attr("disabled", "disabled");
				jQuery("#field_type option[value='checkbox']").attr("disabled", "disabled");
			}
		});
	/* ]]> */
	</script>

	<?php 
    $theswitch = isset($_GET['action']) ? $_GET['action'] : '';
    $admin_fields_url = get_admin_url('', 'edit.php?post_type=' . APP_POST_TYPE . '&amp;page=fields');
    switch ($theswitch) {
        case 'addfield':
            ?>
			<div class="wrap">
				<h2><?php 
            _e('New Custom Field', APP_TD);
            ?>
</h2>

				<?php 
            // check and make sure the form was submitted
            if (isset($_POST['submitted'])) {
                $_POST['field_search'] = '';
                // we aren't using this field so set it to blank for now to prevent notice
                $data = array('field_name' => cp_make_custom_name($_POST['field_label'], 'fields'), 'field_label' => appthemes_clean($_POST['field_label']), 'field_desc' => appthemes_clean($_POST['field_desc']), 'field_tooltip' => appthemes_clean($_POST['field_tooltip']), 'field_type' => appthemes_clean($_POST['field_type']), 'field_values' => appthemes_clean($_POST['field_values']), 'field_search' => appthemes_clean($_POST['field_search']), 'field_owner' => appthemes_clean($_POST['field_owner']), 'field_created' => current_time('mysql'), 'field_modified' => current_time('mysql'));
                $insert = $wpdb->insert($wpdb->cp_ad_fields, $data);
                if ($insert) {
                    do_action('cp_custom_fields', 'addfield', $wpdb->insert_id);
                    ?>
						<p style="text-align:center;padding-top:50px;font-size:22px;"><?php 
                    _e('Creating your field.....', APP_TD);
                    ?>
							<br/><br/><img src="<?php 
                    echo get_template_directory_uri();
                    ?>
/images/loader.gif" alt="" />
						</p>
						<meta http-equiv="refresh" content="0; URL=<?php 
                    echo $admin_fields_url;
                    ?>
" >
					<?php 
                }
                die;
            } else {
                ?>
					<form method="post" id="mainform" action="">

						<?php 
                cp_admin_db_fields($options_new_field);
                ?>

						<p class="submit">
							<input class="btn button-primary" name="save" type="submit" value="<?php 
                esc_attr_e('Create New Field', APP_TD);
                ?>
" />&nbsp;&nbsp;&nbsp;
							<input class="btn button-secondary" name="cancel" type="button" onClick="location.href='<?php 
                echo $admin_fields_url;
                ?>
'" value="<?php 
                _e('Cancel', APP_TD);
//.........这里部分代码省略.........
开发者ID:kalushta,项目名称:darom,代码行数:101,代码来源:options.php

示例10: cp_cat_base

function cp_cat_base()
{
    if (appthemes_clean(get_option('category_base')) == '') {
        $cat_base = trailingslashit(get_bloginfo('url')) . 'category';
    } else {
        $cat_base = trailingslashit(get_bloginfo('url')) . get_option('category_base');
    }
    return $cat_base;
}
开发者ID:kalushta,项目名称:darom,代码行数:9,代码来源:theme-functions.php

示例11: cp_custom_fields

function cp_custom_fields()
{
    global $options_new_field, $wpdb, $current_user;
    $current_user = wp_get_current_user();
    ?>

	<!-- show/hide the dropdown field values tr -->
	<script type="text/javascript">
	/* <![CDATA[ */
		jQuery(document).ready(function() {
			jQuery("#mainform").validate({errorClass: "invalid"});
		});

		function show(o){
			if(o){switch(o.value){
				case 'drop-down': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
				case 'radio': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
				case 'checkbox': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
				case 'text box': jQuery('#field_min_length_row').show(); jQuery('#field_values_row').hide(); break;
				default: jQuery('#field_values_row').hide(); jQuery('#field_min_length_row').hide();
			}}
		}

		//show/hide immediately on document load
		jQuery(document).ready(function() {
			show(jQuery('#field_type').get(0));
		});

		//hide unwanted options for cp_currency field
		jQuery(document).ready(function() {
			var field_name = jQuery('#field_name').val();
			if(field_name == 'cp_currency'){
				jQuery("#field_type option[value='text box']").attr("disabled", "disabled");
				jQuery("#field_type option[value='text area']").attr("disabled", "disabled");
				jQuery("#field_type option[value='checkbox']").attr("disabled", "disabled");
			}
		});
	/* ]]> */
	</script>

	<?php 
    // check to prevent php "notice: undefined index" msg when php strict warnings is on
    if (isset($_GET['action'])) {
        $theswitch = $_GET['action'];
    } else {
        $theswitch = '';
    }
    switch ($theswitch) {
        case 'addfield':
            ?>

			<div class="wrap">
				<div class="icon32" id="icon-themes"><br /></div>
				<h2><?php 
            _e('New Custom Field', APP_TD);
            ?>
</h2>

				<?php 
            cp_admin_info_box();
            ?>

				<?php 
            // check and make sure the form was submitted
            if (isset($_POST['submitted'])) {
                $_POST['field_search'] = '';
                // we aren't using this field so set it to blank for now to prevent notice
                $data = array('field_name' => appthemes_clean(cp_make_custom_name($_POST['field_label'])), 'field_label' => appthemes_clean($_POST['field_label']), 'field_desc' => appthemes_clean($_POST['field_desc']), 'field_tooltip' => esc_attr(appthemes_clean($_POST['field_tooltip'])), 'field_type' => appthemes_clean($_POST['field_type']), 'field_values' => appthemes_clean($_POST['field_values']), 'field_search' => appthemes_clean($_POST['field_search']), 'field_owner' => appthemes_clean($_POST['field_owner']), 'field_created' => current_time('mysql'), 'field_modified' => current_time('mysql'));
                $insert = $wpdb->insert($wpdb->cp_ad_fields, $data);
                if ($insert) {
                    ?>

						<p style="text-align:center;padding-top:50px;font-size:22px;"><?php 
                    _e('Creating your field.....', APP_TD);
                    ?>
<br /><br /><img src="<?php 
                    bloginfo('template_directory');
                    ?>
/images/loader.gif" alt="" /></p>
						<meta http-equiv="refresh" content="0; URL=?page=fields">

					<?php 
                }
                die;
            } else {
                ?>

            <form method="post" id="mainform" action="">

                <?php 
                cp_admin_fields($options_new_field);
                ?>

                <p class="submit"><input class="btn button-primary" name="save" type="submit" value="<?php 
                _e('Create New Field', APP_TD);
                ?>
" />&nbsp;&nbsp;&nbsp;
                    <input name="cancel" type="button" onClick="location.href='?page=fields'" value="<?php 
                _e('Cancel', APP_TD);
                ?>
//.........这里部分代码省略.........
开发者ID:kalushta,项目名称:darom,代码行数:101,代码来源:admin-options.php

示例12: cp_contact_ad_owner_email

/**
 * Sends email to ad author from contact form.
 *
 * @param int $post_id
 *
 * @return object
 */
function cp_contact_ad_owner_email($post_id)
{
    $errors = new WP_Error();
    // check for required post data
    $expected = array('from_name', 'from_email', 'subject', 'message');
    foreach ($expected as $field_name) {
        if (empty($_POST[$field_name])) {
            $errors->add('empty_field', __('ERROR: All fields are required.', APP_TD));
            return $errors;
        }
    }
    // check for required anti-spam post data
    $expected_numbers = array('rand_total', 'rand_num', 'rand_num2');
    foreach ($expected_numbers as $field_name) {
        if (!isset($_POST[$field_name]) || !is_numeric($_POST[$field_name])) {
            $errors->add('invalid_captcha', __('ERROR: Incorrect captcha answer.', APP_TD));
            return $errors;
        }
    }
    // verify captcha answer
    $rand_post_total = (int) $_POST['rand_total'];
    $rand_total = (int) $_POST['rand_num'] + (int) $_POST['rand_num2'];
    if ($rand_total != $rand_post_total) {
        $errors->add('invalid_captcha', __('ERROR: Incorrect captcha answer.', APP_TD));
    }
    // verify email
    if (!is_email($_POST['from_email'])) {
        $errors->add('invalid_email', __('ERROR: Incorrect email address.', APP_TD));
    }
    // verify post
    $post = get_post($post_id);
    if (!$post) {
        $errors->add('invalid_post', __('ERROR: Ad does not exist.', APP_TD));
    }
    if ($errors->get_error_code()) {
        return $errors;
    }
    $author_email = get_the_author_meta('user_email', $post->post_author);
    $from_name = appthemes_filter(appthemes_clean($_POST['from_name']));
    $from_email = appthemes_clean($_POST['from_email']);
    $subject = appthemes_filter(appthemes_clean($_POST['subject']));
    $posted_message = appthemes_filter(appthemes_clean($_POST['message']));
    $blogname = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
    $site_url = home_url('/');
    $permalink = get_permalink($post_id);
    $message = html('p', sprintf(__('Someone is interested in your ad listing: %s', APP_TD), html_link($permalink))) . PHP_EOL;
    $message .= html('p', '"' . wordwrap(nl2br($posted_message), 70) . '"') . PHP_EOL;
    $message .= html('p', sprintf(__('Name: %s', APP_TD), $from_name) . '<br />' . sprintf(__('E-mail: %s', APP_TD), $from_email)) . PHP_EOL;
    $message .= html('p', __('-----------------', APP_TD) . '<br />' . sprintf(__('This message was sent from %s', APP_TD), $blogname) . '<br />' . html_link($site_url)) . PHP_EOL;
    $message .= html('p', sprintf(__('Sent from IP Address: %s', APP_TD), appthemes_get_ip())) . PHP_EOL;
    $email = array('to' => $author_email, 'subject' => $subject, 'message' => $message, 'from' => $from_email, 'from_name' => $from_name);
    $email = apply_filters('cp_email_user_ad_contact', $email, $post_id);
    APP_Mail_From::apply_once(array('email' => $email['from'], 'name' => $email['from_name'], 'reply' => true));
    appthemes_send_email($email['to'], $email['subject'], $email['message']);
    return $errors;
}
开发者ID:kalushta,项目名称:darom,代码行数:63,代码来源:emails.php

示例13: cp_custom_fields

function cp_custom_fields()
{
    global $options_new_field, $wpdb, $current_user;
    $current_user = wp_get_current_user();
    ?>

    <!-- show/hide the dropdown field values tr -->
    <script type="text/javascript">
		/* <![CDATA[ */
			jQuery(document).ready(function() {
				jQuery("#mainform").validate({errorClass: "invalid"});
			});

			function show(o){
				if(o){switch(o.value){
					case 'drop-down': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
					case 'radio': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
					case 'checkbox': jQuery('#field_values_row').show(); jQuery('#field_min_length_row').hide(); break;
					case 'text box': jQuery('#field_min_length_row').show(); jQuery('#field_values_row').hide(); break;
					default: jQuery('#field_values_row').hide();jQuery('#field_min_length_row').hide();
				}}
			}

			//show/hide immediately on document load
			jQuery(document).ready(function() {
				show(jQuery('#field_type').get(0));
			});

			//hide unwanted options for cp_currency field
			jQuery(document).ready(function() {
				var field_name = jQuery('#field_name').val();
				if(field_name == 'cp_currency'){
					jQuery("#field_type option[value='text box']").attr("disabled","disabled");
					jQuery("#field_type option[value='text area']").attr("disabled","disabled");
					jQuery("#field_type option[value='checkbox']").attr("disabled","disabled");
				}
			});
		/* ]]> */
    </script>

    <?php 
    // check to prevent php "notice: undefined index" msg when php strict warnings is on
    if (isset($_GET['action'])) {
        $theswitch = $_GET['action'];
    } else {
        $theswitch = '';
    }
    switch ($theswitch) {
        // Adds a new AV form filed to DB
        case 'addfield':
            ?>

        <div class="wrap">
            <div class="icon32" id="icon-themes"><br /></div>
            <h2><?php 
            _e('New Custom Field', 'appthemes');
            ?>
</h2>

            <?php 
            cp_admin_info_box();
            ?>

        <?php 
            // check and make sure the form was submitted
            if (isset($_POST['submitted'])) {
                $_POST['field_search'] = '';
                // we aren't using this field so set it to blank for now to prevent notice
                $insert = "INSERT INTO {$wpdb->cp_ad_fields} ( field_name, field_label, field_desc, field_tooltip, field_type, field_values, field_search, field_owner, field_max_value, field_min_value, field_created, field_modified ) VALUES ( '" . $wpdb->escape(appthemes_clean(cp_make_custom_name($_POST['field_label']))) . "','" . $wpdb->escape(appthemes_clean($_POST['field_label'])) . "','" . $wpdb->escape(appthemes_clean($_POST['field_desc'])) . "','" . $wpdb->escape(esc_attr(appthemes_clean($_POST['field_tooltip']))) . "','" . $wpdb->escape(appthemes_clean($_POST['field_type'])) . "','" . $wpdb->escape(appthemes_clean($_POST['field_values'])) . "','" . $wpdb->escape(appthemes_clean($_POST['field_search'])) . "','" . $wpdb->escape(appthemes_clean($_POST['field_owner'])) . "','" . $wpdb->escape(appthemes_clean($_POST['field_max_value'])) . "','" . $wpdb->escape(appthemes_clean($_POST['field_min_value'])) . "','" . current_time('mysql') . "','" . current_time('mysql') . "' )";
                $results = $wpdb->query($insert);
                if ($results) {
                    //$lastid = $wpdb->insert_id;
                    //echo $lastid;
                    ?>

                <p style="text-align:center;padding-top:50px;font-size:22px;"><?php 
                    _e('Creating your field.....', 'appthemes');
                    ?>
<br /><br /><img src="<?php 
                    echo bloginfo('template_directory');
                    ?>
/images/loader.gif" alt="" /></p>
                <meta http-equiv="refresh" content="0; URL=?page=fields">

            <?php 
                }
                die;
            } else {
                ?>

            <form method="post" id="mainform" action="">

                <?php 
                cp_admin_fields($options_new_field);
                ?>

                <p class="submit"><input class="btn button-primary" name="save" type="submit" value="<?php 
                _e('Create New Field', 'appthemes');
                ?>
" />&nbsp;&nbsp;&nbsp;
//.........这里部分代码省略.........
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:101,代码来源:admin-options.php

示例14: cp_create_pages

function cp_create_pages()
{
    global $wpdb, $app_abbr;
    $out = array();
    // first check and make sure this page doesn't already exist
    $sql = "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'dashboard' LIMIT 1";
    $wpdb->get_results($sql);
    if ($wpdb->num_rows == 0) {
        // first create the dashboard page
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'dashboard', 'post_title' => 'Dashboard');
        // Insert the page into the database
        $page_id = wp_insert_post($my_page);
        // Assign the page template to the new page
        update_post_meta($page_id, '_wp_page_template', 'tpl-dashboard.php');
        $out[] = $page_id;
    }
    // first check and make sure this page doesn't already exist
    $sql = "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'profile' LIMIT 1";
    $wpdb->get_results($sql);
    if ($wpdb->num_rows == 0) {
        // next create the profile page
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'profile', 'post_title' => 'Profile');
        // Insert the page into the database
        $page_id = wp_insert_post($my_page);
        // Assign the page template to the new page
        update_post_meta($page_id, '_wp_page_template', 'tpl-profile.php');
        $out[] = $page_id;
    }
    // first check and make sure this page doesn't already exist
    $sql = "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'edit-item' LIMIT 1";
    $wpdb->get_results($sql);
    if ($wpdb->num_rows == 0) {
        // then create the edit item page
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'edit-item', 'post_title' => 'Edit Item');
        // Insert the page into the database
        $page_id = wp_insert_post($my_page);
        // Assign the page template to the new page
        update_post_meta($page_id, '_wp_page_template', 'tpl-edit-item.php');
        $out[] = $page_id;
    }
    // first check and make sure this page doesn't already exist
    $sql = "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'add-new' LIMIT 1";
    $wpdb->get_results($sql);
    if ($wpdb->num_rows == 0) {
        // then create the edit item page
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'add-new', 'post_title' => 'Add New');
        // Insert the page into the database
        $page_id = wp_insert_post($my_page);
        // Assign the page template to the new page
        update_post_meta($page_id, '_wp_page_template', 'tpl-add-new.php');
        $out[] = $page_id;
    }
    // first check and make sure this page doesn't already exist
    $wpdb->get_results("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'add-new-confirm' LIMIT 1");
    if ($wpdb->num_rows == 0) {
        // then create the edit item page
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'add-new-confirm', 'post_title' => 'Add New Confirm');
        // Insert the page into the database
        $page_id = wp_insert_post($my_page);
        // Assign the page template to the new page
        update_post_meta($page_id, '_wp_page_template', 'tpl-add-new-confirm.php');
        $out[] = $page_id;
    }
    // first check and make sure this page doesn't already exist
    $wpdb->get_results("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = 'blog' LIMIT 1");
    if ($wpdb->num_rows == 0) {
        // then create the edit item page
        $my_page = array('post_status' => 'publish', 'post_type' => 'page', 'post_author' => 1, 'post_name' => 'blog', 'post_title' => 'Blog');
        // Insert the page into the database
        $page_id = wp_insert_post($my_page);
        // Assign the page template to the new page
        update_post_meta($page_id, '_wp_page_template', 'tpl-blog.php');
        // the blog page is different since we don't want to exclude it.
        // instead we need to insert the blog page id into an option field
        // it's used for pulling values into the breadcrumb
        if (get_option($app_abbr . '_blog_page_id') == false) {
            update_option($app_abbr . '_blog_page_id', $page_id);
        }
    }
    // check to see if array of page ids is empty
    // if not, add them to the pages to be excluded from the nav meta option.
    if (!empty($out)) {
        // take the array and put elements into a comma separated string
        $exclude_pages = implode(',', $out);
        // now insert the excluded pages meta option and the values if the option doesn't already exist
        if (get_option($app_abbr . '_excluded_pages') == false) {
            update_option($app_abbr . '_excluded_pages', appthemes_clean($exclude_pages));
        }
    }
}
开发者ID:joaosigno,项目名称:dazake-job,代码行数:90,代码来源:install-script.php

示例15: clean_expected_fields

 /**
  * Returns cleaned fields that we expect.
  *
  * return array
  */
 protected function clean_expected_fields()
 {
     global $cp_options;
     $posted = array();
     foreach ($this->expected_fields() as $field) {
         $posted[$field] = isset($_POST[$field]) ? $_POST[$field] : '';
         if (!is_array($posted[$field])) {
             $posted[$field] = appthemes_clean($posted[$field]);
             if (appthemes_str_starts_with($field, 'cp_')) {
                 $posted[$field] = wp_kses_post($posted[$field]);
             }
         } else {
             $posted[$field] = array_map('appthemes_clean', $posted[$field]);
             if (appthemes_str_starts_with($field, 'cp_')) {
                 $posted[$field] = array_map('wp_kses_post', $posted[$field]);
             }
         }
         if ($field == 'cp_price') {
             $posted[$field] = appthemes_clean_price($posted[$field]);
         }
         if ($field == 'tags_input') {
             $posted[$field] = appthemes_clean_tags($posted[$field]);
             $posted[$field] = wp_kses_post($posted[$field]);
         }
         if ($field == 'post_content') {
             // check to see if html is allowed
             if (!$cp_options->allow_html) {
                 $posted[$field] = appthemes_filter($posted[$field]);
             } else {
                 $posted[$field] = wp_kses_post($posted[$field]);
             }
         }
         if ($field == 'post_title') {
             $posted[$field] = appthemes_filter($posted[$field]);
         }
     }
     return $posted;
 }
开发者ID:kalushta,项目名称:darom,代码行数:43,代码来源:views-checkout.php


注:本文中的appthemes_clean函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。