Пример #1
0
 public static function adjust_mail_headers($data)
 {
     if (!empty(self::$subscription_id)) {
         $recipients = Karma_Subscriber::get_subscribers(self::$subscription_id);
         $data['headers'] .= "BCC: " . implode(",", $recipients) . '\\r\\n';
     }
     return $data;
 }
Пример #2
0
 public static function init()
 {
     global $wpdb;
     self::$table = $wpdb->prefix . self::$table;
     self::$cookie = $_SERVER['SERVER_NAME'] . '_' . self::$cookie;
     self::refresh_cookie();
     // Reset the cookie's expiry date.
     add_action('widgets_init', array(__CLASS__, 'register_widget'));
     add_action('wp_ajax_karma_update_email', array(__CLASS__, 'change_email'));
     add_action('wp_ajax_nopriv_karma_update_email', array(__CLASS__, 'change_email'));
     add_action('wp_ajax_karma_event_subscribe', array(__CLASS__, 'set_event_subscription'));
     add_action('wp_ajax_nopriv_karma_event_subscribe', array(__CLASS__, 'set_event_subscription'));
     add_action('wp_enqueue_scripts', array(__CLASS__, 'register_public_scripts_and_styles'));
     add_action("after_switch_theme", array(__CLASS__, 'create_table'));
 }
Пример #3
0
<?php

global $post;
$startdate = Karma_Events::get_startdate();
$enddate = Karma_Events::get_enddate();
$class = strtolower(date("M", $startdate));
$class .= has_post_thumbnail() ? " img" : "";
$class .= Karma_Events::$hero_slug == $post->post_name ? " hero" : "";
$subscribed = Karma_Subscriber::is_subscribed($post->ID);
$subscriber_count = Karma_Subscriber::get_subscriber_count($post->ID);
?>
<article id="<?php 
echo $post->post_name;
?>
" class="event event-<?php 
the_ID();
?>
 <?php 
echo $class;
?>
" data-permalink="<?php 
the_permalink();
?>
">
	<header>
		<?php 
the_post_thumbnail();
?>
		<div class="date">
			<div class="startdate">
				<div class="month"><?php 
Пример #4
0
    public static function render_metadata_form($post)
    {
        wp_enqueue_script('karma-events-admin');
        wp_nonce_field(self::$nonce_key . '_str', self::$nonce_key);
        if ($post->post_status !== 'publish') {
            $subscription_count = Karma_Subscriber::get_subscriber_count();
            ?>
			<small>
				<strong>Note</strong>: when this event is published, <?php 
            echo $subscription_count == 1 ? "1 subscriber" : $subscription_count . " subscribers";
            ?>
 will be notified via email.
			</small>
			<?php 
        }
        ?>
		<table class="karma-metadata">
			<tr class="karma-startdate">
				<th>
					<label for="karma_metadata_startdate">Start Date</label>
				</th>
				<td>
					<input id="karma_metadata_startdate" type="date" name="<?php 
        echo self::$startdate_key;
        ?>
" value="<?php 
        echo date('Y-m-d', self::get_startdate());
        ?>
"></input>
				</td>
			</tr>
			<tr class="karma-enddate">
				<th>
					<label for="karma_metadata_enddate">End Date</label>
				</th>
				<td>
					<input id="karma_metadata_enddate" type="date" name="<?php 
        echo self::$enddate_key;
        ?>
" value="<?php 
        echo date('Y-m-d', self::get_enddate());
        ?>
"></input>
				</td>
			</tr>
			<tr class="karma-contacts">
				<th>
					<label>Links</label>
				</th>
				<td class="karma-contacts-list">
					<?php 
        $contacts = self::get_contacts($post->ID);
        if (!empty($contacts)) {
            foreach ($contacts as $index => $contact) {
                self::render_contact_block($contact);
            }
        }
        self::render_contact_block();
        ?>
				</td>
			</tr>
		</table>
		<style>
		.karma-metadata th,
		.karma-metadata td {
			display: block;
			text-align: left;
		}

		.karma-metadata input {
			width: 100%;
		}

		.karma-contact input {
			width: calc(50% - 4px);
		}
		</style>
		<?php 
    }