/**
  * trigger function.
  */
 function trigger($booking_id)
 {
     if ($booking_id) {
         $this->object = get_wc_booking($booking_id);
         if ($this->object->has_status('in-cart')) {
             return;
         }
         $this->find[] = '{product_title}';
         $this->replace[] = $this->object->get_product()->get_title();
         if ($this->object->get_order()) {
             $this->find[] = '{order_date}';
             $this->replace[] = date_i18n(wc_date_format(), strtotime($this->object->get_order()->order_date));
             $this->find[] = '{order_number}';
             $this->replace[] = $this->object->get_order()->get_order_number();
         } else {
             $this->find[] = '{order_date}';
             $this->replace[] = date_i18n(wc_date_format(), strtotime($this->object->booking_date));
             $this->find[] = '{order_number}';
             $this->replace[] = __('N/A', 'woocommerce-bookings');
         }
         if (!$this->is_enabled() || !$this->get_recipient()) {
             return;
         }
         $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
     }
 }
Example #2
0
 function column_default($item, $column_name)
 {
     global $mspdb;
     switch ($column_name) {
         case 'shortcode':
             return sprintf('[masterslider id="%s"]', $item['ID']);
         case 'date_modified':
             $orig_time = isset($item['date_modified']) ? strtotime($item['date_modified']) : '';
             $time = date_i18n('Y/m/d @ g:i:s A', $orig_time);
             $human = human_time_diff($orig_time);
             return sprintf('<abbr title="%s">%s</abbr>', $time, $human . __(' ago', 'master-slider'));
         case 'date_created':
             $orig_time = isset($item['date_created']) ? strtotime($item['date_created']) : '';
             $date = date_i18n('Y/m/d', $orig_time);
             $time = date_i18n('Y/m/d @ g:i:s A', $orig_time);
             return sprintf('<abbr title="%s">%s</abbr>', $time, $date);
         case 'slides_num':
             global $mspdb;
             return $mspdb->get_slider_field_val($item['ID'], 'slides_num');
         case 'ID':
         case 'title':
             return $item[$column_name];
         default:
             return;
             //return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
     }
 }
Example #3
0
 function mk_header_toolbar_date()
 {
     global $mk_options;
     if ($mk_options['enable_header_date'] == 'true') {
         echo '<span class="mk-header-date"><i class="mk-moon-clock"></i>' . date_i18n("F j, Y") . '</span>';
     }
 }
Example #4
0
 /**
  * Coupon list table column values
  *
  * @param  string $column_name
  * @param  int $post_ID
  * @return void
  */
 function coupon_columns_content($column_name, $post_ID)
 {
     switch ($column_name) {
         case 'coupon_type':
             $price = get_post_meta($post_ID, '_type', true);
             if ($price == 'amount') {
                 _e('Fixed Price', 'wpuf');
             } else {
                 _e('Percentage', 'wpuf');
             }
             break;
         case 'amount':
             $type = get_post_meta($post_ID, '_type', true);
             $currency = $type != 'percent' ? wpuf_get_option('currency_symbol', 'wpuf_payment') : '';
             $symbol = $type == 'percent' ? '%' : '';
             echo $currency . get_post_meta($post_ID, '_amount', true) . $symbol;
             break;
         case 'usage_limit':
             $usage_limit = get_post_meta($post_ID, '_usage_limit', true);
             if (intval($usage_limit) == 0) {
                 $usage_limit = __('&infin;', 'wpuf');
             }
             $use = intval(get_post_meta($post_ID, '_coupon_used', true));
             echo $use . '/' . $usage_limit;
             break;
         case 'expire_date':
             $start_date = get_post_meta($post_ID, '_start_date', true);
             $end_date = get_post_meta($post_ID, '_end_date', true);
             $start_date = !empty($start_date) ? date_i18n('M j, Y', strtotime($start_date)) : '';
             $end_date = !empty($end_date) ? date_i18n('M j, Y', strtotime($end_date)) : '';
             echo $start_date . ' to ' . $end_date;
             break;
     }
 }
Example #5
0
 public static function please_rate_si($footer_text)
 {
     if (self::is_si_admin()) {
         $footer_text = sprintf(self::__('Please support the future of <strong>Sprout Invoices</strong> by rating the free version <a href="%1$s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href="%1$s" target="_blank">WordPress.org</a>. Have an awesome %2$s!'), 'http://wordpress.org/support/view/plugin-reviews/sprout-invoices?filter=5', date_i18n('l'));
     }
     return $footer_text;
 }
Example #6
0
 /**
  * Save the Import
  */
 private function saveImport()
 {
     $title = __('Import on ', 'wpsimplelocator') . date_i18n('Y-m-d H:m:s', time());
     $importpost = array('post_title' => $title, 'post_status' => 'publish', 'post_type' => 'wpslimport');
     $post_id = wp_insert_post($importpost);
     add_post_meta($post_id, 'wpsl_import_data', $this->transient);
 }
 /**
  * Return the month to show in the widget
  *
  * @return string
  * @since 3.0
  * @author Jessica Yazbek
  **/
 public function get_month()
 {
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return isset($_POST["eventDate"]) ? $_POST["eventDate"] : date_i18n(TribeDateUtils::DBDATEFORMAT);
     }
     return date_i18n(TribeDateUtils::DBDATEFORMAT);
 }
    /**
     * Output an export link
     */
    public function get_export_button()
    {
        $current_range = !empty($_GET['range']) ? $_GET['range'] : '7day';
        ?>
		<a
			href="#"
			download="report-<?php 
        echo $current_range;
        ?>
-<?php 
        echo date_i18n('Y-m-d', current_time('timestamp'));
        ?>
.csv"
			class="export_csv"
			data-export="chart"
			data-xaxes="<?php 
        _e('Date', 'woocommerce');
        ?>
"
			data-exclude_series="2"
			data-groupby="<?php 
        echo $this->chart_groupby;
        ?>
"
		>
			<?php 
        _e('Export CSV', 'woocommerce');
        ?>
		</a>
		<?php 
    }
Example #9
0
function icl_populate_translations_pickup_box()
{
    if (!wpml_is_action_authenticated('icl_populate_translations_pickup_box')) {
        die('Wrong Nonce');
    }
    global $ICL_Pro_Translation, $sitepress;
    $last_picked_up = $sitepress->get_setting('last_picked_up');
    $translation_offset = strtotime(current_time('mysql')) - @intval($last_picked_up) - 5 * 60;
    if (WP_DEBUG == false && $translation_offset < 0) {
        $time_left = floor(abs($translation_offset) / 60);
        if ($time_left == 0) {
            $time_left = abs($translation_offset);
            $wait_text = '<p><i>' . sprintf(__('You can check again in %s seconds.', 'sitepress'), '<span id="icl_sec_tic">' . $time_left . '</span>') . '</i></p>';
        } else {
            $wait_text = sprintf(__('You can check again in %s minutes.', 'sitepress'), '<span id="icl_sec_tic">' . $time_left . '</span>') . '</i></p>';
        }
        $result = array('wait_text' => $wait_text);
    } else {
        /** @var WPML_Pro_Translation $ICL_Pro_Translation */
        $job_in_progress = $ICL_Pro_Translation->get_total_jobs_in_progress();
        $button_text = __('Get completed translations', 'sitepress');
        if ($job_in_progress == 1) {
            $jobs_in_progress_text = __('1 job has been sent to the translation service.', 'sitepress');
        } else {
            $jobs_in_progress_text = sprintf(__('%d jobs have been sent to the translation service.', 'sitepress'), $job_in_progress);
        }
        $last_picked_up = $sitepress->get_setting('last_picked_up');
        $last_time_picked_up = !empty($last_picked_up) ? date_i18n('Y, F jS @g:i a', $last_picked_up) : __('never', 'sitepress');
        $last_pickup_text = sprintf(__('Last time translations were picked up: %s', 'sitepress'), $last_time_picked_up);
        $result = array('jobs_in_progress_text' => $jobs_in_progress_text, 'button_text' => $button_text, 'last_pickup_text' => $last_pickup_text);
    }
    wp_send_json_success($result);
}
 /**
  * trigger function.
  *
  * @access public
  * @return void
  *
  * @param unknown $order_id
  */
 function trigger($order_id)
 {
     global $woocommerce;
     if ($order_id) {
         $this->object = new WC_Order($order_id);
         $this->find[] = '{order_date}';
         $this->replace[] = date_i18n(woocommerce_date_format(), strtotime($this->object->order_date));
         $this->find[] = '{order_number}';
         $this->replace[] = $this->object->get_order_number();
     }
     if (!$this->is_enabled()) {
         return;
     }
     $vendors = $this->get_vendors($this->object);
     if (empty($vendors)) {
         return;
     }
     add_filter('woocommerce_order_get_items', array($this, 'check_items'), 10, 2);
     add_filter('woocommerce_get_order_item_totals', array($this, 'check_order_totals'), 10, 2);
     foreach ($vendors as $user_id => $user_email) {
         $this->current_vendor = $user_id;
         $this->send($user_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
     }
     remove_filter('woocommerce_get_order_item_totals', array($this, 'check_order_totals'), 10, 2);
     remove_filter('woocommerce_order_get_items', array($this, 'check_items'), 10, 2);
 }
 /**
  * Customize post type updated messages.
  * @param $messages
  * @return mixed
  */
 function cpt_updated_messages($messages)
 {
     global $post, $post_ID;
     $view = get_permalink($post_ID);
     $messages[$this->slug] = array(0 => '', 1 => sprintf(__('%s updated. <a href="%s">View %s</a>.', 'themify'), $this->name, esc_url($view), $this->name), 2 => __('Custom field updated.', 'themify'), 3 => __('Custom field deleted.', 'themify'), 4 => sprintf(__('%s updated.', 'themify'), $this->name), 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'themify'), $this->name, wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('%s published.', 'themify'), $this->name), 7 => sprintf(__('%s saved.', 'themify'), $this->name), 8 => sprintf(__('%s submitted.', 'themify'), $this->name), 9 => sprintf(__('%s scheduled for: <strong>%s</strong>.', 'themify'), $this->name, date_i18n(__('M j, Y @ G:i', 'themify'), strtotime($post->post_date))), 10 => sprintf(__('%s draft updated.', 'themify'), $this->name));
     return $messages;
 }
Example #12
0
/**
 * Discography update messages.
 *
 * @since 1.0.0
 * @see /wp-admin/edit-form-advanced.php
 *
 * @param array $messages The array of existing post update messages.
 * @return array
 */
function audiotheme_discography_post_updated_messages($messages)
{
    global $post;
    $messages['audiotheme_record'] = array(0 => '', 1 => sprintf(__('Record updated. <a href="%s">View Record</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 2 => __('Custom field updated.', 'audiotheme'), 3 => __('Custom field deleted.', 'audiotheme'), 4 => __('Record updated.', 'audiotheme'), 5 => isset($_GET['revision']) ? sprintf(__('Record restored to revision from %s', 'audiotheme'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Record published. <a href="%s">View Record</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 7 => __('Record saved.', 'audiotheme'), 8 => sprintf(__('Record submitted. <a target="_blank" href="%s">Preview Record</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))), 9 => sprintf(__('Record scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Record</a>', 'audiotheme'), date_i18n(__('M j, Y @ G:i', 'audiotheme'), strtotime($post->post_date)), esc_url(get_permalink($post->ID))), 10 => sprintf(__('Record draft updated. <a target="_blank" href="%s">Preview Record</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))));
    $messages['audiotheme_track'] = array(0 => '', 1 => sprintf(__('Track updated. <a href="%s">View Track</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 2 => __('Custom field updated.', 'audiotheme'), 3 => __('Custom field deleted.', 'audiotheme'), 4 => __('Track updated.', 'audiotheme'), 5 => isset($_GET['revision']) ? sprintf(__('Track restored to revision from %s', 'audiotheme'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Track published. <a href="%s">View Track</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 7 => __('Track saved.', 'audiotheme'), 8 => sprintf(__('Track submitted. <a target="_blank" href="%s">Preview Track</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))), 9 => sprintf(__('Track scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Track</a>', 'audiotheme'), date_i18n(__('M j, Y @ G:i', 'audiotheme'), strtotime($post->post_date)), esc_url(get_permalink($post->ID))), 10 => sprintf(__('Track draft updated. <a target="_blank" href="%s">Preview Track</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))));
    return $messages;
}
Example #13
0
 /**
  * 
  */
 public function index()
 {
     global $wpdb;
     $schedule = new Bbpp_ThankMeLater_Schedule();
     // get the total number of messages which are sent
     $total_num_sent = $schedule->findNum(1);
     $total_num_opened = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}bbpp_thankmelater_opens`");
     $total_num_scheduled = $schedule->findNum(0);
     $day_stats = array("data" => array(), "labels" => array());
     $ind = 0;
     $day_start = mktime(0, 0, 0, date("m"), date("d") - 30, date("Y"));
     $day_start_last = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
     while ($day_start <= $day_start_last) {
         $day_start_gmt = gmdate("Y-m-d H:i:s", $day_start);
         $day_end_gmt = gmdate("Y-m-d H:i:s", $day_start + 86400 - 1);
         $day_stats["data"][] = array($ind, $schedule->findSentBetween($day_start_gmt, $day_end_gmt));
         $day_stats["labels"][] = array($ind, date_i18n("d", $day_start, false));
         $day_start += 86400;
         $ind++;
     }
     $open_stats = array("data" => array(), "labels" => array());
     $ind = 0;
     $day_start = mktime(0, 0, 0, date("m"), date("d") - 30, date("Y"));
     $day_start_last = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
     while ($day_start <= $day_start_last) {
         $day_start_gmt = gmdate("Y-m-d H:i:s", $day_start);
         $day_end_gmt = gmdate("Y-m-d H:i:s", $day_start + 86400 - 1);
         $open_stats["data"][] = array($ind, (int) $wpdb->get_var($wpdb->prepare("\r\n\t\t\t\tSELECT COUNT(*) FROM `{$wpdb->prefix}bbpp_thankmelater_opens`\r\n\t\t\t\tWHERE `date_gmt` >= %s\r\n\t\t\t\tAND `date_gmt` <= %s\r\n\t\t\t", $day_start_gmt, $day_end_gmt)));
         $open_stats["labels"][] = array($ind, date_i18n("d", $day_start, false));
         $day_start += 86400;
         $ind++;
     }
     require_once BBPP_THANKMELATER_PLUGIN_PATH . "admin/statistics/index.php";
 }
Example #14
0
 public static function format_date_time_gmt($timestamp)
 {
     if (empty($timestamp)) {
         return 0;
     }
     return date_i18n("Y-m-d H:i:s", $timestamp, true);
 }
function cpt_savedsearch_messages($messages)
{
    //http://codex.wordpress.org/Function_Reference/register_post_type
    global $post, $post_ID;
    $messages['savedsearch'] = array(0 => '', 1 => sprintf(__('Saved search Post updated.', 'your_text_domain'), esc_url(get_permalink($post_ID))), 2 => __('Saved searche updated.', 'your_text_domain'), 3 => __('Saved search deleted.', 'your_text_domain'), 4 => __('Saved search Post updated.', 'your_text_domain'), 5 => isset($_GET['revision']) ? sprintf(__('Saved search Post restored to revision from %s', 'your_text_domain'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Saved search Post published. <a href="%s">View Saved search Post</a>', 'your_text_domain'), esc_url(get_permalink($post_ID))), 7 => __('Saved search Post saved.', 'your_text_domain'), 8 => sprintf(__('Saved search Post submitted. <a target="_blank" href="%s">Preview Saved search Post</a>', 'your_text_domain'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))), 9 => sprintf(__('Saved search Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Saved search Post</a>', 'your_text_domain'), date_i18n(__('M j, Y @ G:i', 'tn_'), strtotime($post->post_date)), esc_url(get_permalink($post_ID))), 10 => sprintf(__('Saved search Post draft updated. <a target="_blank" href="%s">Preview Saved search Post</a>', 'your_text_domain'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))));
    return $messages;
}
 /**
  * trigger function.
  *
  * We need to override WC_Email_Customer_Invoice's trigger method because it expects to be run only once
  * per request (but multiple subscription renewal orders can be generated per request).
  *
  * @access public
  * @return void
  */
 function trigger($order)
 {
     if (!is_object($order)) {
         $order = new WC_Order(absint($order));
     }
     if ($order) {
         $this->object = $order;
         $this->recipient = $this->object->billing_email;
         $order_date_index = array_search('{order_date}', $this->find);
         if (false === $order_date_index) {
             $this->find[] = '{order_date}';
             $this->replace[] = date_i18n(woocommerce_date_format(), strtotime($this->object->order_date));
         } else {
             $this->replace[$order_date_index] = date_i18n(woocommerce_date_format(), strtotime($this->object->order_date));
         }
         $order_number_index = array_search('{order_number}', $this->find);
         if (false === $order_number_index) {
             $this->find[] = '{order_number}';
             $this->replace[] = $this->object->get_order_number();
         } else {
             $this->replace[$order_number_index] = $this->object->get_order_number();
         }
     }
     if (!$this->is_enabled() || !$this->get_recipient()) {
         return;
     }
     $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
 }
 /**
  * TODO: This is just generic from the wp-cli scaffold, make it work
  *
  * @author caseypatrickdriscoll
  *
  * @created 2015-07-18 15:07:07
  *
  * @param $messages
  *
  * @return mixed
  */
 public static function updated_messages($messages)
 {
     global $post;
     $permalink = get_permalink($post);
     $messages['patchchat'] = array(0 => '', 1 => sprintf(__('Patchchat updated. <a target="_blank" href="%s">View patchchat</a>', 'patchworks'), esc_url($permalink)), 2 => __('Custom field updated.', 'patchworks'), 3 => __('Custom field deleted.', 'patchworks'), 4 => __('Patchchat updated.', 'patchworks'), 5 => isset($_GET['revision']) ? sprintf(__('Patchchat restored to revision from %s', 'patchworks'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Patchchat published. <a href="%s">View patchchat</a>', 'patchworks'), esc_url($permalink)), 7 => __('Patchchat saved.', 'patchworks'), 8 => sprintf(__('Patchchat submitted. <a target="_blank" href="%s">Preview patchchat</a>', 'patchworks'), esc_url(add_query_arg('preview', 'true', $permalink))), 9 => sprintf(__('Patchchat scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview patchchat</a>', 'patchworks'), date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url($permalink)), 10 => sprintf(__('Patchchat draft updated. <a target="_blank" href="%s">Preview patchchat</a>', 'patchworks'), esc_url(add_query_arg('preview', 'true', $permalink))));
     return $messages;
 }
Example #18
0
function acf_repeater_population($form)
{
    GFCommon::log_debug("acf_repeater_population() function called for form {$form['id']}");
    // filters are applied only to form ID 4.  Change to your form ID
    foreach ($form['fields'] as &$field) {
        // if the field is not a radio button type or it does not have the CSS Class Name required, continue
        if ('radio' != $field->type || false === strpos($field->cssClass, 'dates_from_acf')) {
            continue;
        }
        // start with an empty choices array
        $field->choices = array();
        // need the ID of the current post
        global $post;
        GFCommon::log_debug("global post =>" . print_r($post, true));
        $rows = get_field('coursedates');
        if ($rows) {
            GFCommon::log_debug("get_field() for coursedates: \$rows => " . print_r($rows, 1));
            foreach ($rows as $row) {
                $city = $row['city'];
                $text = date_i18n('l j. F Y', strtotime($row['startdate'])) . " - " . $city;
                $field->choices[] = array('text' => $text, 'value' => $row['startdate'] . " - " . $city);
            }
        } else {
            $field->choices[] = array('text' => 'Ingen ledige datoer', 'value' => 'Ingen ledige datoer');
        }
        break;
    }
    // always return the form
    return $form;
}
Example #19
0
 public static function save_event_meta($post_id)
 {
     if (!isset($_POST['xi_event_meta_nonce']) || !wp_verify_nonce($_POST['xi_event_meta_nonce'], 'save_event_meta')) {
         return;
     }
     // example of how we'll throw errors
     // Set up an associative array to save later (if validations check out)
     $full_start_time = $_POST['event_start_date'] . ' ' . $_POST['event_start_time']['hours'] . ':' . $_POST['event_start_time']['minutes'] . ' ' . $_POST['event_start_time']['ampm'];
     $full_end_time = $_POST['event_end_date'] . ' ' . $_POST['event_end_time']['hours'] . ':' . $_POST['event_end_time']['minutes'] . ' ' . $_POST['event_end_time']['ampm'];
     $full_address = $_POST['event_venue_address_1'] . ' ' . $_POST['event_venue_address_2'] . ',' . $_POST['event_venue_city'] . ' ' . $_POST['event_venue_state'] . ',' . $_POST['event_venue_postal_code'];
     $save_meta = array('xi_event_all_day' => intval($_POST['event_all_day']), 'xi_event_start_date' => XiUtilities::format_date_time(strtotime($_POST['event_start_date'])), 'xi_event_start_date_raw' => $_POST['event_start_date'], 'xi_event_start_time' => XiUtilities::json_encode($_POST['event_start_time']), 'xi_event_start_formatted' => XiUtilities::format_date_time(strtotime($full_start_time)), 'xi_event_start_raw' => $full_start_time, 'xi_event_start_formatted_gmt' => XiUtilities::format_date_time_gmt(strtotime($full_start_time)), 'xi_event_start_query_friendly' => date_i18n('Y-m-d', strtotime($full_start_time)), 'xi_event_start_time_hours' => $_POST['event_start_time']['hours'], 'xi_event_start_time_minutes' => $_POST['event_start_time']['minutes'], 'xi_event_start_time_ampm' => $_POST['event_start_time']['ampm'], 'xi_event_end_date' => XiUtilities::format_date_time(strtotime($_POST['event_end_date'])), 'xi_event_end_date_raw' => $_POST['event_end_date'], 'xi_event_end_time' => XiUtilities::json_encode($_POST['event_end_time']), 'xi_event_end_formatted' => XiUtilities::format_date_time(strtotime($full_end_time)), 'xi_event_end_raw' => $full_end_time, 'xi_event_end_formatted_gmt' => XiUtilities::format_date_time_gmt(strtotime($full_end_time)), 'xi_event_end_query_friendly' => date_i18n('Y-m-d', strtotime($full_end_time)), 'xi_event_end_time_hours' => $_POST['event_end_time']['hours'], 'xi_event_end_time_minutes' => $_POST['event_end_time']['minutes'], 'xi_event_end_time_ampm' => $_POST['event_end_time']['ampm'], 'xi_event_recurrence' => $_POST['event_recurrence'], 'xi_weekly_recurrence_days' => XiUtilities::json_encode($_POST['weekly_recurrence_days']), 'xi_recurrence_monthly_type' => $_POST['recurrence_monthly_type'], 'xi_recurrence_monthly_weeknum' => $_POST['recurrence_monthly_weeknum'], 'xi_recurrence_monthly_weekday' => $_POST['recurrence_monthly_weekday'], 'xi_recurrence_yearly_type' => $_POST['recurrence_yearly_type'], 'xi_recurrence_yearly_weeknum' => $_POST['recurrence_yearly_weeknum'], 'xi_recurrence_yearly_weekday' => $_POST['recurrence_yearly_weekday'], 'xi_recurrence_yearly_month' => $_POST['recurrence_yearly_month'], 'xi_custom_recurrence_dates' => $_POST['custom_recurrence_dates'], 'xi_recurrence_exceptions' => $_POST['recurrence_exceptions'], 'xi_recurrence_end' => $_POST['recurrence_end'], 'xi_event_venue_name' => $_POST['event_venue_name'], 'xi_event_venue_address_1' => $_POST['event_venue_address_1'], 'xi_event_venue_address_2' => $_POST['event_venue_address_2'], 'xi_event_venue_city' => $_POST['event_venue_city'], 'xi_event_venue_state' => $_POST['event_venue_state'], 'xi_event_venue_country' => $_POST['event_venue_country'], 'xi_event_venue_postal_code' => $_POST['event_venue_postal_code'], 'xi_event_venue_phone' => $_POST['event_venue_phone'], 'xi_event_venue_website' => $_POST['event_venue_website'], 'xi_event_venue_google_map' => $_POST['event_venue_google_map']);
     // Only put in geocoded information if the event has an address
     if (!empty($_POST['event_venue_address_1'])) {
         $geocoded_information = XiUtilities::geocode_address($full_address);
         $geocoded_save_meta = array('xi_event_venue_formatted_address' => $geocoded_information->formatted_address, 'xi_evenut_venue_lat' => $geocoded_information->geometry->location->lat, 'xi_evenut_venue_lng' => $geocoded_information->geometry->location->lng, 'xi_event_venue_full_geocode' => XiUtilities::json_encode($geocoded_information));
         $save_meta = array_merge($save_meta, $geocoded_save_meta);
     }
     $valid = XiMetaboxes::validate_event($save_meta);
     // Save the contents of the array
     if ($valid === true) {
         foreach ($save_meta as $meta_key => $meta_value) {
             update_post_meta($post_id, $meta_key, $meta_value);
         }
         XiEventMeta::create_recurrence($post_id, $save_meta);
     } else {
         global $xi_error;
         $xi_error->throw_error($valid);
     }
 }
Example #20
0
    function column_default($item, $name)
    {
        global $wpdb;
        switch ($name) {
            case 'created_at':
                $timestamp = $item->{$name} / 1000 + $this->gmt_offset * 3600;
                return date_i18n('d/m/Y H:i', $timestamp);
                // return get_date_from_gmt( date( 'Y-m-d H:i:s', $item->$name / 1000 ), 'd/m/Y H:i' );
            // return get_date_from_gmt( date( 'Y-m-d H:i:s', $item->$name / 1000 ), 'd/m/Y H:i' );
            case 'total_msgs':
                // Total messages
                return $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . CX_PX . 'chat_logs 
							WHERE cnv_id = %s', $item->cnv_id));
            case 'ip':
                return long2ip($item->{$name});
            case 'email':
                if (!empty($item->{$name})) {
                    return '<a href="mailto:' . $item->{$name} . '">' . $item->{$name} . '</a>';
                } else {
                    return '<span style="color:silver">' . __('N/A', 'cx') . '</span>';
                }
                // return $item->$column_name;
            // return $item->$column_name;
            default:
                return print_r($item, true);
                // Show the whole array for troubleshooting purposes
        }
    }
 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         /* case 'firstname':
         			case 'lastname':
         				return $item->$column_name;
         			case 'status':
         			   return $item->$column_name;
         		   
         		   */
         case 'subject':
             $sub = get_post_meta($item->ID, "_sendpress_subject", true);
             return $sub;
         case 'type':
             $type = get_post_meta($item->ID, "_system_email_type", true);
             return $type === "manage_subscriptions" ? "Manage Subscription" : "Double Opt-in";
         case 'created':
             return date_i18n(get_option('date_format'), strtotime($item->post_date));
         case 'actions':
             $a = '<div class="inline-buttons">';
             $a .= '<a class="btn btn-default view-btn" title="' . get_post_meta($item->ID, "_sendpress_subject", true) . '" href="' . get_permalink($item->ID) . '"><span class="glyphicon  glyphicon-eye-open"></span></a> ';
             $editwindow = 'style';
             if (get_post_meta($item->ID, '_sendpress_system', true) == 'new') {
                 $editwindow = 'systememailedit';
             }
             $a .= '<a class="btn btn-primary" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=' . $editwindow . '&emailID=' . $item->ID . '"><span class="glyphicon glyphicon-edit"></span> ' . __('Edit', 'sendpress') . '</a> ';
             //$a = apply_filters('sendpress_email_table', $a, $item);
             //$a .= '<a class="btn  btn-success " href="'. SendPress_Admin::link('Emails_Autoedit').'&emailID='. $item->ID .'"><span class="glyphicon glyphicon-cog"></span> Settings</a>';
             $a .= '</div>';
             return $a;
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
 /**
  * trigger function.
  *
  * We need to override WC_Email_New_Order's trigger method because it expects to be run only once
  * per request.
  *
  * @access public
  * @return void
  */
 function trigger($order_id)
 {
     if ($order_id) {
         $this->object = new WC_Order($order_id);
         $order_date_index = array_search('{order_date}', $this->find);
         if (false === $order_date_index) {
             $this->find[] = '{order_date}';
             $this->replace[] = date_i18n(wc_date_format(), strtotime($this->object->order_date));
         } else {
             $this->replace[$order_date_index] = date_i18n(wc_date_format(), strtotime($this->object->order_date));
         }
         $order_number_index = array_search('{order_number}', $this->find);
         if (false === $order_number_index) {
             $this->find[] = '{order_number}';
             $this->replace[] = $this->object->get_order_number();
         } else {
             $this->replace[$order_number_index] = $this->object->get_order_number();
         }
         $this->subscriptions = wcs_get_subscriptions_for_switch_order($this->object);
     }
     if (!$this->is_enabled() || !$this->get_recipient()) {
         return;
     }
     $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
 }
/**
 * Create timestamps and unique identifiers for each cron.
 * @param  int $post_id
 * @return array
 */
function ppp_get_timestamps($post_id)
{
    // Make the timestamp in the users' timezone, b/c that makes more sense
    $offset = (int) -get_option('gmt_offset');
    $ppp_tweets = get_post_meta($post_id, '_ppp_tweets', true);
    if (empty($ppp_tweets)) {
        $ppp_tweets = array();
    }
    $times = array();
    foreach ($ppp_tweets as $key => $data) {
        if (!array_filter($data)) {
            continue;
        }
        $share_time = explode(':', $data['time']);
        $hours = (int) $share_time[0];
        $minutes = (int) substr($share_time[1], 0, 2);
        $ampm = strtolower(substr($share_time[1], -2));
        if ($ampm == 'pm' && $hours != 12) {
            $hours = $hours + 12;
        }
        if ($ampm == 'am' && $hours == 12) {
            $hours = 00;
        }
        $hours = $hours + $offset;
        $date = explode('/', $data['date']);
        $timestamp = mktime($hours, $minutes, 0, $date[0], $date[1], $date[2]);
        if ($timestamp > current_time('timestamp', 1)) {
            // Make sure the timestamp we're getting is in the future
            $times[strtotime(date_i18n('d-m-Y H:i:s', $timestamp, true))] = 'sharedate_' . $key . '_' . $post_id;
        }
    }
    return apply_filters('ppp_get_timestamps', $times);
}
Example #24
0
 public function get_modified_date()
 {
     if (!$this->id) {
         return '';
     }
     return date_i18n(get_option('date_format'), get_post_modified_time('U', false, $this->id));
 }
Example #25
0
 /**
  * Date translation.
  *
  * @param string $format Date format.
  * @param int    $time   Optional timestamp (UTC always).
  * @param bool   $utc    Defaults to `false` (recommended).
  *
  * @return string Date translation (in local time, unless `$utc` is true).
  */
 public function i18n(string $format = '', int $time = 0, bool $utc = false) : string
 {
     if (!$format) {
         $format = get_option('date_format');
         $format .= ' ' . get_option('time_format');
         $format = $this->c::mbTrim($format);
     }
     $time = $time ? abs($time) : time();
     // UTC time.
     // If UTC enabled, leave `$time` as-is.
     // Otherwise, convert it to a local timestamp.
     // This is necessary because `date_i18n()` doesn't do the conversion.
     // The `date_i18n()` function only works w/UTC (by default), if no `$time` is given.
     $time = $utc ? $time : $this->toLocal($time);
     // Adjusted time, based on `$utc` param.
     if ($utc && preg_match('/(?<!\\\\)[PIOTZe]/u', $format)) {
         // If UTC is enabled and the date format includes a TZ char.
         // Necessary, because `date_i18n()` doesn't handle this properly.
         // `date_i18n()` translates TZ chars into a local timezone regardless.
         // So here, we escape TZ chars and then apply them in UTC.
         $format = preg_replace('/(?<!\\\\)([PIOTZe])/u', '#\\\\${1}', $format);
         return preg_replace_callback('/(#)([PIOTZe])/u', function ($m) use($time) {
             return gmdate($m[2], $time);
             // UTC-based TZ chars.
         }, date_i18n($format, $time, $utc));
     }
     return date_i18n($format, $time, $utc);
 }
 /**
  * Return the month to show in the widget
  *
  * @param string $format
  *
  * @return string
  */
 public function get_month($format = Tribe__Events__Date_Utils::DBDATETIMEFORMAT)
 {
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return isset($_POST['eventDate']) ? $_POST['eventDate'] : date_i18n($format);
     }
     return date_i18n($format);
 }
 function add_expiration_date()
 {
     global $post;
     if ($post->post_type !== $this->post_type) {
         return;
     }
     $cur_time = get_post_meta($post->ID, '_cbp_expiration_timestamp', true);
     $datef = __('M j, Y @ H:i');
     if (!empty($cur_time)) {
         // TODO: change the wording of $stamp to "Expired on" if date is in the past
         $stamp = __('Expires: <b>%1$s</b>');
         $date = date_i18n($datef, strtotime($cur_time));
     } else {
         $stamp = __('Expires: <b>Never</b>');
         $date = date_i18n($datef, strtotime(current_time('mysql')));
     }
     echo '<div class="misc-pub-section curtime">';
     echo '<span id="cbp-expiration-timestamp">&nbsp;';
     printf($stamp, $date);
     echo '</span>' . "\n";
     echo '<a class="edit-expiration-timestamp hide-if-no-js" href="#edit_expiration_timestamp"><span aria-hidden="true">Edit</span> <span class="screen-reader-text">Edit date and time</span></a>';
     echo '<div id="cbp-expiration-timestampdiv" class="hide-if-js">';
     $this->expiration_time_input($cur_time);
     echo '</div>';
     echo '</div>';
 }
 /**
  * Mange column data
  *
  * Default Column for listing table
  */
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'seller_store':
             return $item[$column_name];
         case 'curr_user_name':
             return $item[$column_name];
         case 'curr_user_email':
             return $item[$column_name];
         case 'user_rating':
             return $item[$column_name] . ' / 5';
         case 'user_comment':
             return $item[$column_name];
         case 'post_status':
             $seller_review_params = array('seller_review_id' => $item['ID'], 'seller_review_status' => $item['post_status']);
             $seller_review_query = add_query_arg($seller_review_params, admin_url());
             return '<a class="button" href="' . $seller_review_query . '">' . ucwords($item[$column_name]) . '</a>';
         case 'post_date':
             $format = get_option('date_format') . ' ' . get_option('time_format');
             $datetime = !empty($item[$column_name]) ? date_i18n($format, strtotime($item[$column_name])) : '';
             return $datetime;
         default:
             return $item[$column_name];
     }
 }
 public static function payment_fields(SI_Invoice $invoice)
 {
     $fields = array('payment_amount' => array('type' => 'text', 'weight' => 1, 'label' => self::__('Amount'), 'attributes' => array()), 'payment_transaction_id' => array('type' => 'text', 'weight' => 5, 'label' => self::__('ID'), 'attributes' => array()), 'payment_date' => array('type' => 'date', 'weight' => 10, 'label' => self::__('Date Received'), 'attributes' => array('autocomplete' => 'off'), 'default' => date_i18n(get_option('date_format'))), 'payment_notes' => array('type' => 'textarea', 'weight' => 15, 'label' => self::__('Notes'), 'attributes' => array()), 'invoice_id' => array('type' => 'hidden', 'value' => $invoice->get_id(), 'weight' => 10000), 'payments_nonce' => array('type' => 'hidden', 'value' => wp_create_nonce(SI_Controller::NONCE), 'weight' => 10001));
     $fields = apply_filters('si_admin_payment_fields_fields', $fields);
     uasort($fields, array(__CLASS__, 'sort_by_weight'));
     return $fields;
 }