public function ajax_response($status, $notice, $item_id, $redirect_url = '')
 {
     ob_start();
     appthemes_display_notice($status, $notice);
     $notice = ob_get_clean();
     $result = array('html' => '', 'status' => $status, 'notice' => $notice);
     die(json_encode($result));
 }
Exemple #2
0
 function show_notice()
 {
     if (!empty($this->error)) {
         appthemes_display_notice('error', $this->error);
     } elseif (isset($_GET['updated'])) {
         appthemes_display_notice('success', __('Your profile has been updated.', APP_TD));
     }
 }
 /**
  * Iterates though all the enqueued notices groups and displays them by type using appthemes_display_notice()
  *
  * @param string $type (optional) The notices type to be displayed. If empty, displays all enqueued notice types
  */
 static function display($type = '')
 {
     $notices = array();
     foreach (self::$notices->get_error_codes() as $error) {
         $error_data = self::$notices->get_error_data($error);
         $notices[$error_data['type']][] = self::$notices->get_error_message($error);
     }
     if (!$type) {
         foreach ($notices as $type => $messages) {
             appthemes_display_notice($type, $messages);
         }
     } elseif (isset($notices[$type])) {
         appthemes_display_notice($type, $notices[$type]);
     }
     // clear the messages arrays
     unset(self::$notices->errors);
     unset(self::$notices->error_data);
 }
 function notices()
 {
     if (isset($this->error->errors) && sizeof($this->error->errors) > 0 && $this->error->get_error_code()) {
         $error_html = '<ul class="errors">';
         foreach ($this->error->errors as $error) {
             $error_html .= '<li>' . $error[0] . '</li>';
         }
         $error_html .= '</ul>';
         appthemes_display_notice('error', $error_html);
     }
 }
Exemple #5
0
 /**
  * Displays notices.
  *
  * @return void
  */
 function notices()
 {
     $post = get_queried_object();
     if ($post->post_status == 'pending') {
         if (cp_have_pending_payment($post->ID)) {
             appthemes_display_notice('warning', __('This ad listing is currently pending and awaiting payment.', APP_TD));
         } else {
             appthemes_display_notice('warning', __('This ad listing is currently pending and must be approved by an administrator.', APP_TD));
         }
     } else {
         if ($post->post_status == 'draft') {
             $expire_time = strtotime(get_post_meta($post->ID, 'cp_sys_expire_date', true));
             if (current_time('timestamp') > $expire_time) {
                 appthemes_display_notice('success', __('This ad listing is expired.', APP_TD));
             } else {
                 appthemes_display_notice('success', __('This ad listing is paused.', APP_TD));
             }
         }
     }
     parent::notices();
 }
 function notices()
 {
     if ($this->errors->get_error_codes()) {
         appthemes_display_notice('checkout-error', $this->errors);
     }
 }
Exemple #7
0
 private function fail_order($message)
 {
     appthemes_display_notice('error', $message);
 }
Exemple #8
0
 /**
  * Output response
  *
  * @param type $status
  * @param type $notice
  * @param type $item_id
  * @param type $redirect_url
  */
 public function ajax_response($status, $notice, $item_id, $redirect_url = '')
 {
     ob_start();
     appthemes_display_notice($status, $notice);
     $notice = ob_get_clean();
     // allows theme or plugins to replace generic renderer with custom one
     $renderer = apply_filters($this->ajax_action . '_ajax_renderer', array($this, 'render'));
     // the context of calling function, used to vary outputting html
     $context = isset($_POST['context']) ? $_POST['context'] : 'default';
     // prevent outputting html here
     ob_start();
     $html = call_user_func($renderer, $item_id, $context, $this);
     $buffer = ob_get_clean();
     if (!empty($buffer)) {
         $html = $buffer;
     }
     $result = array('html' => $html, 'status' => $status, 'notice' => $notice, 'redirect' => $redirect_url);
     die(json_encode($result));
 }
Exemple #9
0
        }
        $msg = array('error', $error_html);
    } else {
        $msg = array('success', __('Your message has been sent!', APP_TD));
    }
}
?>


<form name="mainform" id="mainform" class="form_contact" action="#priceblock2" method="post" enctype="multipart/form-data">

	<?php 
if (!empty($msg)) {
    ?>
		<?php 
    appthemes_display_notice($msg[0], array($msg[1]));
    ?>
	<?php 
}
?>

	<p class="dashicons-before contact_msg"><?php 
_e('To inquire about this ad listing, complete the form below to send a message to the ad poster.', APP_TD);
?>
</p>

	<ol>
		<li>
			<label><?php 
_e('Name', APP_TD);
?>
 /**
  * Displays an error for the user
  * @param  string $message Message to display
  * @return void
  */
 protected function fail_order($message)
 {
     appthemes_display_notice('error', $message);
 }
Exemple #11
0
 /**
  * Displays extra notices.
  *
  * return void
  */
 public function display_extra_messages()
 {
     global $current_user;
     $package = cp_get_membership_package($this->package_id);
     $current_membership = $this->get_current_membership();
     if ($current_membership && $current_membership->ID != $package->ID) {
         $days_remining = appthemes_days_between_dates($current_user->membership_expires);
         $message = sprintf(__('Your Current Membership (%1$s) will be canceled upon purchase. This membership still has %2$s days remaining.', APP_TD), $current_membership->pack_name, $days_remining);
         appthemes_display_notice('error', $message);
     }
 }
Exemple #12
0
 function show_notice()
 {
     if (isset($_GET['paused'])) {
         appthemes_display_notice('success', __('Ad has been paused.', APP_TD));
     } elseif (isset($_GET['restarted'])) {
         appthemes_display_notice('success', __('Ad has been published.', APP_TD));
     } elseif (isset($_GET['deleted'])) {
         appthemes_display_notice('success', __('Ad has been deleted.', APP_TD));
     } elseif (isset($_GET['freerenewed'])) {
         appthemes_display_notice('success', __('Ad has been relisted.', APP_TD));
     } elseif (isset($_GET['markedsold'])) {
         appthemes_display_notice('success', __('Ad has been marked as sold.', APP_TD));
     } elseif (isset($_GET['unmarkedsold'])) {
         appthemes_display_notice('success', __('Ad has been unmarked as sold.', APP_TD));
     } elseif (isset($_GET['renew-disabled'])) {
         appthemes_display_notice('error', __('You can not relist this ad. Relisting is currently disabled.', APP_TD));
     } elseif (isset($_GET['renew-invalid-id'])) {
         appthemes_display_notice('error', __('You can not relist this ad. Invalid ID of an ad.', APP_TD));
     } elseif (isset($_GET['renew-not-expired'])) {
         appthemes_display_notice('error', __('You can not relist this ad. Ad is not expired.', APP_TD));
     }
 }