234 | function save_post( $post_id ) {
235 | if ( 'content_ad_widget' == get_post_type( $post_id ) ) {
236 | if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
237 | return $post_id;
238 | }
239 | if( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
240 | contentAd_append_to_log( 'AJAX ""QUICK EDIT"" SAVE' );
241 | if( isset( $_POST['action'] ) && isset( $_POST['screen'] ) && 'inline-save' == $_POST['action'] && 'edit-content_ad_
242 |
243 | // If Template Tag or Shortcode placements are selected, then all other placement options are reset since they may
244 | if( isset( $_POST['placement'] ) && ( $_POST['placement'] == 'in_function' || $_POST['placement'] == 'in_shortcode'
245 | $_POST['_ca_display_home'] = 1;
246 | $_POST['_ca_display_cat_tag'] = 1;
247 | unset($_POST['post_category']); $_POST['post_category'] = array();
248 | unset($_POST['post_tag']); $_POST['post_tag'] = array();
249 |
250 | }
251 |
252 | if ( isset( $_POST['_ca_display_home'] ) ) {
253 | contentAd_append_to_log( ' UPDATING _ca_display_home FOR POST ('.$post_id.') TO: ' . $_POST['_ca_display_home']
254 | update_post_meta( $post_id, '_ca_display_home', strip_tags( $_POST['_ca_display_home'] ) );
255 | } else {
256 | contentAd_append_to_log( ' UPDATING _ca_display_home FOR POST ('.$post_id.') TO: 0' );
257 | delete_post_meta( $post_id, '_ca_display_home' );
258 | }
259 |
260 | if ( isset( $_POST['_ca_display_cat_tag'] ) ) {
261 | contentAd_append_to_log( ' UPDATING _ca_display_cat_tag PLACEMENT FOR POST ('.$post_id.') TO: ' . $_POST['_ca_d
262 | update_post_meta( $post_id, '_ca_display_cat_tag', strip_tags( $_POST['_ca_display_cat_tag'] ) );
263 | } else {
264 | contentAd_append_to_log( ' UPDATING _ca_display_cat_tag FOR POST ('.$post_id.') TO: 0' );
265 | delete_post_meta( $post_id, '_ca_display_cat_tag' );
266 | }
267 |
268 | if ( isset( $_POST['placement'] ) ) {
269 | contentAd_append_to_log( ' UPDATING PLACEMENT FOR POST ('.$post_id.') TO: ' . $_POST['placement'] );
270 | update_post_meta( $post_id, 'placement', strip_tags( $_POST['placement'] ) );
271 | }
272 |
273 | if( isset( $_POST['post_category'] ) && is_array( $_POST['post_category'] ) ) {
274 | foreach( $_POST['post_category'] as $key => $cat_id ) {
275 | if( empty( $cat_id ) ) {
276 | unset( $_POST['post_category'][$key] );
277 | } else {
278 | $_POST['post_category'][$key] = (int) $cat_id;
279 | }
280 | }
281 | contentAd_append_to_log( ' UPDATING EXCLUSION CATEGORIES FOR POST ('.$post_id.') TO: ' . join(', ', $_POST['pos
282 | update_post_meta( $post_id, '_excluded_categories', $_POST['post_category'] );
283 | }
284 |