Exemplo n.º 1
0
</p><p>
Support is available <a href="http://www.yourmembers.co.uk/">Here</a>
</p>
';
if (!defined('DISABLE_VERSIONING')) {
    // manual version check
    echo '
<form action="" method="post" id="ym_manual_version_check">
<input type="hidden" name="ym_do_version_check" value="true" />
<p>You can perform a <a href="#nowhere" onclick="jQuery(\'#ym_manual_version_check\').submit()">manual version check</a></p>
</form>
<form action="" method="post" id="ym_beta_enable">
<input type="hidden" name="ym_do_toggle_beta" value="true" />
<p><a href="#nowhere" onclick="jQuery(\'#ym_beta_enable\').submit()">
';
    $beta_enable = get_option('ym_beta_notify');
    if ($beta_enable) {
        echo 'You will be notified of Betas, Click to Disable';
    } else {
        echo 'You will not be notified of Betas, Click to Enable';
    }
    echo '
</a></p>
</form>
';
}
echo '
<p>You can <a href="' . YM_ADMIN_URL . '&wizard=0">reset the Set Up Wizard</a></p>
';
ym_box_bottom();
echo '</div>';
	<th>' . __('URL to link to, leave blank to disable and / for HomePage', 'ym') . '</th>
	<td>' . site_url() . '
		<input class="ym_input" name="wp_login_header_url" value="' . $ym_sys->wp_login_header_url . '" style="width: 400px;" />
	</td>
</tr>
';
echo '
<tr>
	<th>' . __('Logo to use, leave blank to use WordPress logo, the dimensions should match 326px wide and 67px tall', 'ym') . '</th>
	<td>' . site_url() . '
		<input class="ym_input" name="wp_login_header_logo" value="' . $ym_sys->wp_login_header_logo . '" style="width: 400px;" />
	</td>
</tr>
';
echo '</table>';
echo ym_box_bottom();
?>
<p class="submit" style="text-align: right;">
	<input type="submit" name="settings_update" value="<?php 
_e('Save Settings', 'ym');
?>
 &raquo;" class="button-primary" style="float: right;" />
</p>
<?php 
echo ym_box_top(__('Default Redirects', 'ym'));
echo '<p>' . __('When a User triggers a redirect, a pack specfic redirect will be used or one of these defaults', 'ym') . '</p>';
echo '<table class="form-table">';
echo $ym_formgen->render_form_table_url_row(__('Redirect on login', 'ym'), 'login_redirect_url', $ym_sys->login_redirect_url, __('URL to redirect Member on login (leave blank for wp-admin)', 'ym'));
echo $ym_formgen->render_form_table_url_row(__('No WP Admin URL', 'ym'), 'wpadmin_disable_redirect_url', $ym_sys->wpadmin_disable_redirect_url, __('URL to redirect Member from wp-admin (leave blank if you wish members to have access to wp-admin)', 'ym'));
echo $ym_formgen->render_form_table_url_row(__('Redirect on Logout', 'ym'), 'logout_redirect_url', $ym_sys->logout_redirect_url, __('URL to redirect Member to when they logout, (redirect_to as a $_REQUEST var overrides (from wp_logout_url))', 'ym'));
echo $ym_formgen->render_form_table_radio_row(__('Hide the membership content page?', 'ym'), 'hide_membership_content', $ym_sys->hide_membership_content);
Exemplo n.º 3
0
    private function scheduling($c_id)
    {
        global $mm, $ym_formgen;
        $email_id = $_POST['email_id'];
        $time = $_POST['email_time'];
        if ($time) {
            if ($time == 'test') {
                $test_email = $_POST['test_email'];
                $r = $this->mailchimp->campaignSendTest($email_id, array($test_email));
                if ($this->mailchimp->error == 'ok') {
                    echo '<div id="message" class="updated"><p>' . __('A Test email has been sent') . '</p></div>';
                } else {
                    echo '<div id="message" class="error"><p>' . $this->mailchimp->error_message . '</p></div>';
                }
            } else {
                if ($time == 'now') {
                    $r = $this->mailchimp->campaignSendNow($email_id);
                    if ($this->mailchimp->error == 'ok') {
                        echo '<div id="message" class="updated"><p>' . __('Campaign has been scheduled') . '</p></div>';
                        unset($_POST);
                        $this->view_emails();
                        return;
                    } else {
                        echo '<div id="message" class="error"><p>' . $this->mailchimp->error_message . '</p></div>';
                    }
                } else {
                    $ym_month_email_date = $_POST['month'];
                    $ym_date_email_date = $_POST['date'];
                    $ym_year_email_date = $_POST['year'];
                    $ym_hour_email_date = $_POST['hour'];
                    $ym_min_email_date = $_POST['min'];
                    $time = array($ym_month_email_date, $ym_date_email_date, $ym_year_email_date, $ym_hour_email_date, $ym_min_email_date);
                    $value = array();
                    $value['month'] = array_shift($time);
                    $value['date'] = array_shift($time);
                    $value['year'] = array_shift($time);
                    $value['hour'] = array_shift($time);
                    $value['min'] = array_shift($time);
                    $time = mktime($value['hour'], $value['min'], 0, $value['month'], $value['date'], $value['year']);
                    // adjust for idiots
                    if ($time < time() + 60) {
                        $time = time() + 60;
                    }
                    $r = $this->mailchimp->campaignSchedule($email_id, $time);
                    if ($this->mailchimp->error == 'ok') {
                        echo '<div id="message" class="updated"><p>' . __('Campaign has been scheduled') . '</p></div>';
                        unset($_POST);
                        $this->view_emails();
                        return;
                    } else {
                        echo '<div id="message" class="error"><p>' . $this->mailchimp->error_message . '</p></div>';
                    }
                }
            }
        }
        // use tab # hash as a url to ajax load
        // just css screw us up
        // os sand box
        echo '
<form action="" method="post" class="mailmanager_schedule_sendnow" style="float: right;">
	<fieldset>
		<input type="hidden" name="action" value="schedule" />
		<input type="hidden" name="email_id" value="' . $c_id . '" />
		<input type="hidden" name="email_time" value="now" />
		<p class="submit">' . __('Or you can:') . '</p>
		<input type="submit" value="' . __('Send Now!') . '" /></p>
	</fieldset>
</form>
';
        echo '<p>' . __('You can now preview, test and schedule your email now') . '</p>';
        echo '
<div id="mailmanager_post_create" style="clear: both;">
	<ul>
		<li><a href="#mailmanager_preview">Email Preview</a></li>
		<li><a href="#mailmanager_test">Send Test Email</a></li>
		<li><a href="#mailmanager_schedule">Schedule</a></li>
	</ul>
	
	<div id="mailmanager_preview">
		<iframe style="width: 950px; height: 600px;" src="' . $mm->page_root . '&mm_action=preview&iframe_preview=' . $c_id . '"></iframe>
	</div>
	<div id="mailmanager_test">
		<form action="" method="post" id="testform">
			<fieldset>
				<input type="hidden" name="action" value="schedule" />
				<input type="hidden" name="email_id" value="' . $c_id . '" />
				<input type="hidden" name="email_time" value="test" />
				<label for="test_email">' . __('Email Address to send the test to:') . '
					<input type="text" name="test_email" id="test_email" value="' . $this->options->from_email . '" style="width: 250px;" />
				</label>
				<input type="submit" value="' . __('Send Test Email') . '" />
			</fieldset>
		</form>
	</div>
	<div id="mailmanager_schedule">
		<form action="" method="post">
			<fieldset>
				<input type="hidden" name="action" value="schedule" />
				<input type="hidden" name="email_id" value="' . $c_id . '" />
				<input type="hidden" name="email_time" value="atime" />
				<table class="form-table">
					';
        $ym_formgen->render_form_table_datetime_picker_row('Send At', 'email_date', $time, __('Date/Time to send Message'));
        echo '
				</table>
				<p class="submit"><input type="submit" value="' . __('Schedule Message') . '" /><p>
			</fieldset>
		</form>
		<form action="" method="post">
			<fieldset>
				<input type="hidden" name="action" value="schedule" />
				<input type="hidden" name="email_id" value="' . $c_id . '" />
				<input type="hidden" name="email_time" value="now" />
				<p>' . __('Or you can:') . '</p>
				<p class="submit"><input type="submit" value="' . __('Send Now!') . '" /></p>
			</fieldset>
		</form>
	</div>
</div>

<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery(\'#mailmanager_post_create\').tabs({
			selected: 0
		});
	});
</script>';
        ym_box_bottom();
    }
Exemplo n.º 4
0
function yss_s3_distribution($type, $id)
{
    global $ym_formgen, $yss_cloudfront, $yss_db, $wpdb;
    // file details
    $s3file = yss_get($id);
    if ($_POST) {
        // here we go
        $distro = $_POST['distro'];
        list($can, $oai, $bucket, $file, $domain, $type) = explode('|', $distro);
        $packet = array('type' => 'CanonicalUser', 'id' => $can, 'name' => 'CloudFront Origin Access Identity ' . $oai, 'permission' => 'READ');
        $acp = array();
        require_once YSS_CLASSES_DIR . 'S3.php';
        $s3 = new S3();
        $s3->setAuth(get_option('yss_user_key'), get_option('yss_secret_key'));
        //get existing and merge
        $acp = $s3->getAccessControlPolicy($bucket, $file);
        $acp['acl'][] = $packet;
        if ($s3->setAccessControlPolicy($bucket, $file, $acp)) {
            $acp = $s3->getAccessControlPolicy($bucket, $file);
            // store
            $distribution = json_decode($s3file->distribution);
            if ($type == 'stream') {
                $distribution->streaming = $domain;
            } else {
                $distribution->download = $domain;
            }
            $distribution = json_encode($distribution);
            $sql = 'UPDATE ' . $yss_db . ' SET
						distribution = \'' . $distribution . '\'
					WHERE id = ' . $id;
            $wpdb->query($sql);
            echo '<div id="message" class="updated"><p>Permissions updated</p></div>';
            yss_s3_list();
            return;
        } else {
            echo '<div id="message" class="error"><p>Permissions update failed</p></div>';
        }
    }
    if ($type == 'stream') {
        $data = $yss_cloudfront->get_streaming();
    } else {
        $data = $yss_cloudfront->get_distribution();
    }
    if (is_array($data)) {
        $test = array_keys($data);
        if ($test[0] != '0') {
            $data = array($data);
        }
    }
    if (is_array($data)) {
        echo ym_box_top('Deploy');
        echo '
<form action="" method="post">
	<fieldset>
		<p>You can select a distribution to expose the file, ' . $s3file->bucket . '/' . $s3file->resource_path . ' onto</p>
		<table class="form-table">
			';
        $items = array('blank' => 'Select');
        foreach ($data as $item) {
            $bucket = $item['S3Origin']['DNSName']['value'];
            list($bucket, $null) = explode('.', $bucket, 2);
            $enabled = $item['Enabled']['value'];
            if ($enabled == 'true' && $s3file->bucket == $bucket) {
                // Distribution is enabled and is for this bucket matches
                $status = $item['Status']['value'];
                $domain = $item['DomainName']['value'];
                $oai = $item['S3Origin']['OriginAccessIdentity']['value'];
                list($null, $nulm, $oai) = explode('/', $oai);
                // oai needs canonical
                $canonical = $yss_cloudfront->get_oai_canonical($oai);
                $value = $canonical . '|' . $oai . '|' . $bucket . '|' . $s3file->resource_path . '|' . $domain . '|' . $type;
                //echo '<option value="' . $value . '">' . $domain . '</option>';
                $items[$value] = $domain;
            }
        }
        $ym_formgen->render_combo_from_array_row('Distribution', 'distro', $items, '', 'Which Distribution to expose this file on');
        echo '
		</table>
		<p class="submit">
			<input type="submit" value="Deploy!" />
		</p>
	</fieldset>
</form>
';
        echo ym_box_bottom();
    } else {
        echo '<div id="message" class="error"><p>Failed to load Distributions or none available</p></div>';
    }
}
Exemplo n.º 5
0
    function invoice_tab()
    {
        $invoice = new ym_invoice();
        global $wpdb;
        if (ym_post('user_id')) {
            $user_id = ym_post('user_id');
            $op = ym_post('op', '');
            $undo = ym_post('undo', FALSE);
            $user = new YourMember_User($user_id);
            if ($undo) {
                $data = array('status' => YM_STATUS_PENDING, 'status_str' => __('Invoice Undo', 'ym'));
                $user->update($data);
                $user->save();
                $packet = array('user_id' => $user_id, 'status' => FALSE);
                do_action('ym_invoice_status_update', $packet);
            } else {
                if ($op == 'resend') {
                    $invoice->generate_invoice($user, $invoice);
                    echo '<div id="message" class="updated"><p>' . __('Inovice Resent', 'ym') . '</p></div>';
                    @ym_log_transaction(YM_USER_STATUS_UPDATE, __('Invoice Resent', 'ym'), $user_id);
                } else {
                    if ($op == 'active') {
                        $data = array('status' => YM_STATUS_ACTIVE, 'status_str' => __('Invoice Paid', 'ym'), 'amount' => intval(ym_post('amount', 0)), 'last_pay_date' => time());
                        $current_status = $user->status;
                        if ($current_status == YM_STATUS_GRACE) {
                            $extend = $user->last_pay_date;
                            $packdata = ym_get_pack_by_id($user->pack_id);
                            $data['expire_date'] = $user->expiry_time($packdata['duration'], $packdata['duration_type'], $extend);
                        }
                        // check for force end
                        if (isset($packdata['force_end_date'])) {
                            $force_end_date = $packdata['force_end_date'];
                            if ($force_end_date > time()) {
                                // greater than now
                                @ym_log_transaction(YM_ACCESS_EXTENSION, 'Adjustment (Force End Date): ' . $force_end_date, $user_id);
                                $data['expire_date'] = $force_end_date;
                            }
                        }
                        $data['amount'] = preg_replace('/[^\\d\\.]/', '', $data['amount']);
                        $data['amount'] = number_format($data['amount'], 2, '.', '');
                        $user->update($data, TRUE);
                        $optional = ym_post('optional');
                        if (!$optional) {
                            $optional = __('Invoice Paid', 'ym');
                        }
                        @ym_log_transaction(YM_IPN, $optional, $user_id);
                        @ym_log_transaction(YM_PAYMENT, $data['amount'], $user_id);
                        @ym_log_transaction(YM_USER_STATUS_UPDATE, $data['status'] . ' - ' . $data['status_str'], $user_id);
                        echo '<div id="message" class="updated"><p>' . __('Updated and Activated the User', 'ym') . '</p></div>';
                        $packet = array('user_id' => $user_id, 'pack_id' => $user->pack_id, 'status' => TRUE);
                        $invoice = new ym_invoice();
                        $invoice->notify_user($packet);
                        do_action('ym_invoice_status_update', $packet);
                    }
                }
            }
        }
        echo '<div id="poststuff" class="wrap">';
        ym_box_top(__('Invoice Management', 'ym'));
        $search = ym_post('ym_invoice_search', false);
        if ($search) {
            $query = 'SELECT u.user_id AS ID FROM ' . $wpdb->usermeta . ' u
				LEFT JOIN ' . $wpdb->usermeta . ' s ON s.user_id = u.user_id
				LEFT JOIN ' . $wpdb->users . ' us ON us.id = u.user_id
				WHERE
				u.meta_key = \'ym_payment_type\' AND u.meta_value = \'invoice\' 
				AND s.meta_key = \'ym_status\'
				AND (
					us.user_login LIKE \'%' . $search . '%\'
					OR
					us.user_email LIKE \'%' . $search . '%\'
				)
				ORDER BY ID DESC
				';
        } else {
            $query = 'SELECT u.user_id AS ID FROM ' . $wpdb->prefix . 'usermeta u
				LEFT JOIN ' . $wpdb->prefix . 'usermeta s ON s.user_id = u.user_id
				WHERE
				u.meta_key = \'ym_payment_type\' AND u.meta_value = \'invoice\' 
				AND s.meta_key = \'ym_status\'
				ORDER BY ID DESC
				';
        }
        $results = $wpdb->get_results($query);
        // quick search
        if ($wpdb->num_rows != 0 || $search) {
            // render search form
            echo '
<form action="" method="post" style="float: right;">
<fieldset>
	' . __('Username/Email Search:', 'ym') . '
	<input type="text" name="ym_invoice_search" value="' . $search . '" />
	<input type="submit" value="' . __('Search', 'ym') . '" />
</fieldset>
</form>';
        }
        echo '<p>' . __('Here you can update users based on the honouring of their invoice, you can use the Info to store field to store extra IPN style info such as a Cheque Number', 'ym') . '</p>';
        if ($wpdb->num_rows == 0) {
            echo ym_display_message(__('No Users are Invoice Pending', 'ym'), 'error');
        } else {
            echo '<table class="widefat">';
            echo '<tr>
				<th>' . __('Member', 'ym') . '</th>
				<th>' . __('Invoice Ref', 'ym') . '</th>
				<th>' . __('Purchasing', 'ym') . '</th>
				<th>' . __('Paid/Invoiced On Date', 'ym') . '</th>
				<th>' . __('Member Status', 'ym') . '</th>
				<th>' . __('Payment', 'ym') . '</th>
			</tr>';
            foreach ($results as $row) {
                $user = new YourMember_User($row->ID);
                echo '<tr>';
                echo '<td>(' . $row->ID . ') ' . $user->data->user_email;
                echo '<br />';
                if ($user->data->user_email != $user->data->user_login) {
                    echo $user->data->user_login . ' ';
                }
                echo $user->data->display_name;
                echo '</td>';
                echo '<td>#' . $user->invoice_id . '</td>';
                echo '<td>' . ym_get_pack_label($user->pack_id) . '</td>';
                echo '<td nowrap="nowrap" style="';
                // go red if overdue
                $limit = $user->invoiced_date + 86400 * $invoice->invoice_limit;
                // last pay date is invoiced on date
                // limit is due date for this invoice
                if (time() > $limit && $user->status != YM_STATUS_ACTIVE) {
                    echo 'background: red;';
                } else {
                    if (time() < $limit && $user->status != YM_STATUS_ACTIVE) {
                        echo 'background: #EFEFEF;';
                    }
                }
                echo '">';
                if ($user->status != YM_STATUS_ACTIVE) {
                    echo __('Invoiced', 'ym') . ' ' . date(YM_DATE, $user->invoiced_date);
                    echo '<br />' . __('Due', 'ym') . ' ' . date(YM_DATE, $limit);
                } else {
                    echo date(YM_DATE, $user->last_pay_date);
                }
                echo '</td>';
                echo '<td>' . $user->status . ' - ' . $user->status_str . '</td>';
                echo '<td>
				<form action="" method="post">
				<table><tr><td nowrap="nowrap">
					<input type="hidden" name="search" value="' . $search . '" />
					<input type="hidden" name="user_id" value="' . $row->ID . '" />
					';
                if ($user->status == YM_STATUS_ACTIVE) {
                    echo $user->amount;
                    // last ipn
                    $query = 'SELECT data FROM ' . $wpdb->prefix . 'ym_transaction WHERE action_id = ' . YM_IPN . ' AND user_id = ' . $row->ID . ' ORDER BY id DESC LIMIT 1';
                    $data = $wpdb->get_var($query);
                    if (substr($data, 0, 2) != 'a:') {
                        echo ' - ';
                        echo $data;
                    }
                    echo '</td><td>';
                    echo '</td><td>';
                    echo '
					<input type="hidden" name="undo" value="1" />
					<input type="submit" class="button-secondary deletelink" style="float: right;" value="' . __('Undo Active', 'ym') . '" />
					';
                } else {
                    echo '
					<label for="amount">' . __('Payment Amount', 'ym') . '</label> 
					<br />
					<label for="optional">' . __('Info to Store', 'ym') . ' 
					</td><td>
					<input type="text" name="amount" id="amount" value="" size="4" />
					<br />
					<input type="text" name="optional" id="optional" value="" size="4" /></label> 
					';
                    echo '</td><td>';
                    echo '
					<input type="submit" class="button-secondary deletelink" style="float: right;" value="' . __('Payment Recieved - Make Active', 'ym') . '" onclick="jQuery(\'#op_' . $row->ID . '\').val(\'active\');" />
					';
                    echo '</td><td>';
                    echo '
					<input type="submit" class="button-secondary" style="float: right;" value="' . __('Resend Invoice', 'ym') . '" onclick="jQuery(\'#op_' . $row->ID . '\').val(\'resend\');" />
					';
                }
                echo '
					<input type="hidden" name="op" id="op_' . $row->ID . '" value="" />
				</td></tr></table>
				</form>
					</td>';
                echo '</tr>';
            }
            echo '</table>';
        }
        ym_box_bottom();
        echo '</div>';
    }
Exemplo n.º 6
0
 function series_precontent()
 {
     ym_box_top('Message');
     echo '<p>' . __('Series are being kept synced with Aweber.') . '</p>';
     echo '<p>' . __('The Aweber Associated Lists can only be sent to via Aweber, a series entry exists for Sync Reasons') . '</p>';
     ym_box_bottom();
     add_filter('mailmanager_adjust_recipients', array($this, 'filter_lists_remove'), 10, 1);
 }
Exemplo n.º 7
0
 function series_precontent()
 {
     ym_box_top('Message');
     echo '<p>' . __('Series are being kept synced with') . ' ' . $this->name . '</p>';
     echo '<p>' . __('The ' . $this->name . ' Associated Lists can only be sent to via') . ' ' . $this->name . ' A series link exists only for Sync Purposes</p>';
     ym_box_bottom();
     add_filter('mailmanager_adjust_recipients', array($this, 'filter_lists_remove'), 10, 1);
 }
 function options()
 {
     global $ym_upload_url, $ym_upload_root;
     if ($_POST && isset($_POST['submit'])) {
         // call save
         if (method_exists($this, 'save_options')) {
             $this->save_options();
         } else {
             $this->buildnsave();
         }
     }
     echo '<div class="wrap" id="poststuff">';
     if (method_exists($this, 'my_options')) {
         // use class methid
         $this->my_options();
     } else {
         if (method_exists($this, 'load_options')) {
             ym_box_top('&nbsp');
             echo '<form action="" method="post" enctype="multipart/form-data">';
             // use generator
             $options = $this->load_options();
             //			if (!$options) {
             if (!is_array($options)) {
                 return;
             }
             if (method_exists($this, 'pay_per_post_bundle')) {
                 array_unshift($options, array('name' => 'bundle_purchase_words', 'label' => __('Bundle Purchase', 'ym'), 'caption' => __('You can change the Gateway Name/Bundle Purchase Words display to something more customer Friendly', 'ym'), 'type' => 'text'));
             }
             if (method_exists($this, 'pay_per_post')) {
                 array_unshift($options, array('name' => 'post_purchase_words', 'label' => __('Post Purchase', 'ym'), 'caption' => __('You can change the Gateway Name/Post Purchase Words display to something more customer Friendly', 'ym'), 'type' => 'text'));
             }
             array_unshift($options, array('name' => 'membership_words', 'label' => __('Gateway Name', 'ym'), 'caption' => __('You can change the Gateway Name/Membership Words display to something more customer Friendly', 'ym'), 'type' => 'text'));
             $options[] = array('name' => 'logo', 'label' => __('Button/Logo', 'ym'), 'caption' => '', 'type' => 'image');
             $options[] = array('name' => 'callback_script', 'label' => __('Callback Script', 'ym'), 'caption' => __('Javascript to run on a successfully return from PayPal, useful for integration with affiliate schemes or other tracking. This is a Raw HTML field and is applied to the HTML Head. You can use these short codes to represent certain vaiables: [user_id], [pack_id], [post_id], [post_pack_id], [cost], [account_type], [item_code], [if_cb_pack][/if_cb_pack] show content if a pack, [if_cb_post][/if_cb_post] show content if a post, [if_cb_bundle][/if_cb_bundle] show content if a bundle', 'ym'), 'type' => 'textarea');
             foreach ($options as $option) {
                 echo '<div class="ym_option">';
                 echo '<label for="' . $option['name'] . '">' . $option['label'] . '</label>';
                 if ($option['caption']) {
                     echo '<p class="caption">' . $option['caption'] . '</p>';
                 }
                 $var = $option['name'];
                 $val = isset($this->{$var}) ? $this->{$var} : '';
                 if ($option['type'] == 'image') {
                     echo '<p class="caption">' . __('Current:', 'ym') . '<br /><img src="' . $val . '" alt="Image" /></p>';
                 }
                 echo '<span class="input">';
                 switch ($option['type']) {
                     case 'yesno':
                         echo '<select name="' . $option['name'] . '">';
                         echo '<option value="1" ' . ($val == 1 ? 'selected="selected"' : '') . ' >' . __('Yes', 'ym') . '</option>';
                         echo '<option value="0"' . ($val == 1 ? '' : 'selected="selected"') . '>' . __('No', 'ym') . '</option>';
                         echo '</select>';
                         break;
                     case 'status':
                         $option['options'] = array('test' => 'test', 'live' => 'live');
                     case 'select':
                         echo '<select name="' . $option['name'] . '">';
                         if ($option['type'] == 'select') {
                             echo '<option value="">' . __('--Select--', 'ym') . '</option>';
                         }
                         foreach ($option['options'] as $optionkey => $optionval) {
                             echo '<option value="' . $optionkey . '"';
                             if ($val == $optionkey) {
                                 echo ' selected="selected" ';
                             }
                             echo '>' . ucwords($optionval) . '</option>';
                         }
                         echo '</select>';
                         break;
                     case 'image':
                     case 'file':
                         echo '<input type="file" name="' . $option['name'] . '" id="' . $option['name'] . '" />';
                         break;
                     case 'textarea':
                         echo '<textarea name="' . $option['name'] . '" id="' . $option['name'] . '" cols="50" rows="5">' . $val . '</textarea>';
                         break;
                     case 'wp_editor':
                         echo '<div style="width: 650px;">';
                         wp_editor($val, $option['name'], array('media_buttons' => FALSE));
                         echo '</div>';
                         break;
                     case 'url':
                         echo site_url();
                     case 'text':
                     default:
                         echo '<input type="text" name="' . $option['name'] . '" id="' . $option['name'] . '" value="' . $val . '" />';
                 }
                 echo '</span>';
                 echo '</div>';
             }
             echo '<input type="submit" class="button-primary" style="float: right;" name="submit" value="' . sprintf(__('Save Settings for %s', 'ym'), $this->name) . '" />';
             echo '</form>';
             ym_box_bottom();
             if (method_exists($this, 'options_additional')) {
                 $this->options_additional();
             }
         } else {
             echo '<div id="message" class="error"><p>' . sprintf(__('There are no user settable options for this gateway, %s', 'ym'), $this->name) . '</p></div>';
         }
     }
     echo '</div>';
     return;
 }
function ym_tos_checks()
{
    global $ym_version_resp, $ym_auth;
    $key = ym_post('registration_email', FALSE);
    $tos_result = FALSE;
    $ym_tos_version_accepted = get_option('ym_tos_version_accepted', 0);
    if ($ym_tos_version_accepted < $ym_version_resp->tos->tos_version_id) {
        if (ym_post('activate_plugin') == 'tosterms') {
            // submitted form
            $tos_result = $ym_auth->tos_submit();
            if (!is_wp_error($tos_result) && $key) {
                // reload for recon
                ym_check_version(TRUE);
                ym_activate_last_step($key);
            }
        }
        // Show FORM
        echo '
<div class="wrap" id="poststuff">
	<h2>' . YM_ADMIN_NAME . '</h2>';
        ym_box_top(__('The End User License has been Updated', 'ym'));
        if (is_wp_error($tos_result)) {
            echo '<div id="message" class="error ym_auth">';
            echo '<div style="margin: 5px 0px; color:red; font-weight:bold;">';
            echo $tos_result->get_error_message();
            echo '</div></div>';
        }
        echo '<iframe src="' . $ym_version_resp->tos->tos_text_url . '" style="width: 100%; height: 500px;"></iframe>';
        echo '<p style="float: right;"><a href="' . $ym_version_resp->tos->tos_text_url . '">' . __('Download EULA', 'ym') . '</a></p>';
        echo '
	<form action="" method="post">
		<fieldset>
			<table class="form-table" style="width: 50%; margin: 10px auto; text-align: center;" >
				<tr>
					<td>
			<label for="confirm_email">' . __('Please confirm your Email', 'ym') . '</label>
					</td><td>
			<input type="email" name="confirm_email" id="confirm_email" value="' . ym_post('confirm_email') . '" style="width: 300px;" />
			<input type="hidden" name="registration_email" value="' . ym_post('registration_email') . '" />
					</td>
				</tr>
				<tr>
					<td colspan="2">

			<p>' . __('To continue you must accept the terms of this agreement:', 'ym') . '</p>
				<input type="hidden" name="activate_plugin" value="tosterms" />
				<input type="hidden" name="tosversion" value="' . $ym_version_resp->tos->tos_version_id . '" />
					</td>
				</tr><tr>
					<td colspan="2">
						<label for="tickbox">' . __('I accept the terms of this agreement:', 'ym') . '</label>
						<input type="checkbox" name="tickbox" id="tickbox" value="ticked" />
					</td>
				</tr><tr>
					<td colspan="2">
						<p class="submit" style="text-align: center;">
							<input type="submit" class="button-secondary" name="tos" value="Uninstall" />
							<input type="submit" class="button-primary" name="tos" value="Continue" style="font-weight: 700;" />
						</p>
					</td>
				</tr>
			</table>
		</fieldset>
	</form>';
        ym_box_bottom();
        echo '
</div>
';
    } else {
        if ($key) {
            // TOS OK/already accepted
            ym_activate_last_step($key);
        } else {
            return FALSE;
        }
    }
    return TRUE;
}
Exemplo n.º 10
0
 function broadcast_create($email_id, $email_subject, $email_content, $recipient_list, $time)
 {
     define('STOP_BROADCAST', TRUE);
     // burn baby burn
     //send_newsletter($campaign_id, $from_field = FALSE, $subject, $contents, $flags, $contacts = FALSE, $get_contacts = FALSE, $suppressions = FALSE, $get_suppressions = FALSE) {
     $flags = array('clicktrack', 'openrate');
     $test = explode('_', $recipient_list);
     if ($test[0] == 'wordpress') {
         // everyone
         $key = 'everyone';
     } else {
         if ($test[1] == 'ac') {
             $key = 'segment_account_type';
         } else {
             if ($test[1] == 'pack') {
                 $key = 'segment_pack_id';
             } else {
                 if ($test[1] == 'all') {
                     $key = 'segment_all';
                 } else {
                     echo '<div id="message" class="error"><p>An error occured with determining who to send to</p></div>';
                     return;
                 }
             }
         }
     }
     if ($key != 'everyone') {
         $paras = array('customs' => array(array('name' => $key, 'content' => array('EQUALS' => $recipient_list))));
     } else {
         $paras = array('campaigns' => array($this->options->campaign_id));
     }
     $from_email_id = $this->from_id();
     if (!$from_email_id) {
         echo '<div id="message" class="error"><p>An error occured with determining a Send From ID</p></div>';
         return;
     }
     $contents = array('plain' => strip_tags($email_content), 'html' => $email_content);
     if ($time < time()) {
         // now
         $r = $this->getresponse->send_newsletter($this->options->campaign_id, $from_email_id, $email_subject, $contents, $flags, FALSE, $paras, FALSE, FALSE);
         echo '<div id="message" class="';
         if ($r) {
             echo 'updated"><p>Message was sent successfully</p></div>';
         } else {
             echo 'error"><p>An Error Occured</p></div>';
         }
     } else {
         $email_json = array('campaign_id' => $this->options->campaign_id, 'from_email_id' => $from_email_id, 'email_subject' => $email_subject, 'contents' => $contents, 'flags' => $flags, 'paras' => $paras);
         $email_json = json_encode($email_json);
         // scheduler
         global $wpdb;
         if (!$email_id) {
             $sql = 'INSERT INTO ' . $wpdb->prefix . 'mm_email(name, subject, body) VALUES (\'broadcast_' . $email_subject . '\', \'' . $email_subject . '\', \'' . $email_json . '\')';
             $wpdb->query($sql);
             $email_id = $wpdb->insert_id;
         } else {
             // build json packet
             $sql = 'UPDATE ' . $wpdb->prefix . 'mm_email SET subject = \'json_encode_for_schedule\', body = \'' . $email_json . '\' WHERE id = ' . $email_id;
             $wpdb->query($sql);
         }
         $args = array($email_id, $recipient_list);
         wp_schedule_single_event($time, 'mm_scheduled_email', $args);
         ym_box_top('Broadcast');
         echo 'Scheduled for ' . date('r', $time) . ' it is currently ' . date('r', time());
         ym_box_bottom();
     }
     return;
 }
Exemplo n.º 11
0
    function settings(&$break)
    {
        global $ym_formgen, $mm;
        $break = TRUE;
        if ($_POST) {
            $this->options->canspam = ym_post('canspam');
            $this->options->broadcast_header = ym_post('broadcast_header');
            $this->options->broadcast_footer = ym_post('broadcast_footer');
            $this->options->generic_header = ym_post('generic_header');
            $this->options->generic_footer = ym_post('generic_footer');
            $this->options->postal_address = ym_post('postal_address');
            $this->options->unsubscribe_page = ym_post('unsubscribe_page');
            ym_box_top('Mail Manager Settings');
            if (ym_post('canspam') == 1) {
                if (!ym_post('postal_address')) {
                    $this->options->canspam = 0;
                    echo '<p>You must provide you Postal Address for CAN-SPAM Act (2003) Compliance</p>';
                }
                if (FALSE === strpos($this->options->broadcast_footer, '[unsubscribe]')) {
                    $this->options->canspam = 0;
                    echo '<p>You must include the unsubscribe shortcode in your Broadcast Footer for CAN-SPAM Act (2003) Compliance</p>';
                }
                if (FALSE === strpos($this->options->generic_footer, '[unsubscribe]')) {
                    $this->options->canspam = 0;
                    echo '<p>You must include the unsubscribe shortcode in your Generic Footer for CAN-SPAM Act (2003) Compliance</p>';
                }
                if (FALSE === strpos($this->options->broadcast_footer, '[address]')) {
                    $this->options->canspam = 0;
                    echo '<p>You must include the address shortcode in your Broadcast Footer for CAN-SPAM Act (2003) Compliance</p>';
                }
                if (FALSE === strpos($this->options->generic_footer, '[address]')) {
                    $this->options->canspam = 0;
                    echo '<p>You must include the address shortcode in your Generic Footer for CAN-SPAM Act (2003) Compliance</p>';
                }
            }
            $this->saveoptions();
            echo '<p>Settings were updated</p>';
            ym_box_bottom();
            echo '<meta http-equiv="refresh" content="5" />';
            return;
        }
        echo '<form action="" method="post">';
        ym_box_top('CAN-SPAM Compliant');
        echo '<p>This option allows you to turn compliancy with the <a href="http://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003">CAN-SPAM Act of 2003</a> on or off. 
		<!--
		If it is on when somebody signs up to an email series then it will first send a confirmation email to the registrant to click before it will add them to the list. When this is off it will just sign them up.
		-->
		</p>';
        echo '<table class="form-table">';
        echo $ym_formgen->render_form_table_radio_row('CAN-SPAM Act (2003) Compliant?', 'canspam', $this->options->canspam);
        echo '</table>
		<p class="submit" style="text-align: right;">
			<input type="submit" name="submit" value="' . __('Save Settings', 'ym') . ' &raquo;" />
		</p>
		';
        ym_box_bottom();
        ym_box_top('Email Templates', TRUE);
        echo '<table class="form-table">';
        echo $ym_formgen->render_form_table_textarea_row('Broadcast Email Header', 'broadcast_header', $this->options->broadcast_header, 'This will be attached to the start of any email messages that are broadcasts');
        echo $ym_formgen->render_form_table_textarea_row('Broadcast Email Footer', 'broadcast_footer', $this->options->broadcast_footer, 'This will be attached to the end of any email messages that are broadcasts. You can use the following hooks:<br />
		[unsubscribe] = The unsubscribe link (required for CAN-SPAM compliance)<br />
		[address] = The address you entered on this page (required for CAN-SPAM compliance]');
        echo $ym_formgen->render_form_table_textarea_row('Generic Email Header', 'generic_header', $this->options->generic_header, 'This will be attached to the start of any non broadcast emails');
        echo $ym_formgen->render_form_table_textarea_row('Generic Email Footer', 'generic_footer', $this->options->generic_footer, 'This will be attached to the end of any non broadcast emails. You can use the following hooks:<br />
		[unsubscribe] = The unsubscribe link (required for CAN-SPAM compliance)<br />
		[address] = The address you entered on this page (required for CAN-SPAM compliance]');
        echo $ym_formgen->render_form_table_textarea_row('Postal Address', 'postal_address', $this->options->postal_address, 'A postal address which can be inserted into your emails if you use the [address] hook (required for CAN-SPAM compliance)');
        echo '</table>';
        echo '
		<p class="submit" style="text-align: right;">
			<input type="submit" name="submit" value="' . __('Save Settings', 'ym') . ' &raquo;" />
		</p>
		';
        ym_box_bottom();
        ym_box_top('Un/Subscribe');
        echo '<table class="form-table">';
        echo $ym_formgen->render_form_table_text_row('Series Unsubscribe Page', 'unsubscribe_page', $this->options->unsubscribe_page, 'Users will be redirect here when they unsubscribe from a series');
        echo '
		</table>
		<p class="submit" style="text-align: right;">
			<input type="submit" name="submit" value="' . __('Save Settings', 'ym') . ' &raquo;" />
		</p>
		';
        ym_box_bottom();
        echo '</form>';
    }
Exemplo n.º 12
0
function mailmanager_list_stats()
{
    ym_box_top('List Stats');
    echo '<ul>';
    foreach (mailmanager_get_recipients() as $value => $text) {
        echo '<li>';
        echo $text;
        echo ' - ';
        echo mailmanager_get_size_of_list($value);
        echo ' ' . __('Subscribers', 'ym_mailmanager');
        echo '</li>';
    }
    echo '</ul>';
    ym_box_bottom();
}
Exemplo n.º 13
0
function ym_fbook_admin()
{
    global $wpdb, $ym_formgen, $facebook_settings;
    include YM_FBOOK_BASE_DIR . 'includes/ym_facebook_constants.php';
    ym_facebook_settings(TRUE);
    $pricing_data = get_option('ym_fbook_pricing');
    if ($_POST) {
        foreach ($settings as $setting) {
            $facebook_settings->{$setting} = $_POST[$setting];
        }
        // images
        foreach ($images as $image) {
            if (is_uploaded_file($_FILES[$image]['tmp_name'])) {
                $file = $_FILES[$image];
                $ym_upload = new ym_dl_file_upload();
                $ym_upload->upload_dir = $ym_upload_root;
                $ym_upload->max_length_filename = 100;
                $ym_upload->rename_file = false;
                $ym_upload->the_temp_file = $file['tmp_name'];
                $ym_upload->the_file = $file['name'];
                $ym_upload->http_error = $file['error'];
                $ym_upload->replace = "y";
                $ym_upload->do_filename_check = "n";
                if ($ym_upload->upload()) {
                    $filename = $ym_upload_url . $ym_upload->file_copy;
                    $facebook_settings->{$image} = $filename;
                } else {
                    ym_display_message(sprintf(__('unable to move file to %s', 'ym'), $ym_upload->upload_dir), 'error');
                }
            }
        }
        update_option('ym_fbook_options', $facebook_settings);
        echo '<div id="message" class="updated fade"><p>Settings were updated</p></div>';
        $packs = ym_get_packs();
        foreach ($packs as $pack) {
            $id = 'pack_' . $pack['id'];
            $post = 'override_price_' . $id;
            $price = ym_post($post);
            if ($price) {
                $price = number_format((double) $price, 0);
            }
            $pricing_data->{$id} = $price;
        }
        $query = 'SELECT post_id FROM ' . $wpdb->prefix . 'postmeta WHERE meta_key = \'ym_post_purchasable\' AND meta_value = 1';
        foreach ($wpdb->get_results($query) as $post) {
            $id = 'post_' . $post->post_id;
            $post = 'override_price_' . $id;
            $price = ym_post($post);
            if ($price) {
                $price = number_format((double) $price, 0);
            }
            $pricing_data->{$id} = $price;
        }
        $query = 'SELECT id, name FROM ' . $wpdb->prefix . 'ym_post_pack ORDER BY id ASC';
        foreach ($wpdb->get_results($query) as $bundle) {
            $id = 'bundle_' . $bundle->id;
            $post = 'override_price_' . $id;
            $price = ym_post($post);
            if ($price) {
                $price = number_format((double) $price, 0);
            }
            $pricing_data->{$id} = $price;
        }
        $price = ym_post('override_price_post_override');
        if ($price) {
            $price = number_format((double) $price, 0);
        }
        $pricing_data->post_override = $price;
        $price = ym_post('override_price_bundle_override');
        if ($price) {
            $price = number_format((double) $price, 0);
        }
        $pricing_data->bundle_override = $price;
        update_option('ym_fbook_pricing', $pricing_data);
        echo '<div id="message" class="updated fade"><p>Pricings were updated</p></div>';
    }
    echo '
<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery(\'#ym_fbook_tabs\').tabs({
			fx: {opacity: \'toggle\'},
			selected: ' . ym_post('ym_fb_tab_select', ym_get('ym_fb_tab_select', 0)) . '
		});
		jQuery(\'.subtabs\').tabs({
			fx: {opacity: \'toggle\'}
		});
		jQuery(\'#tabkiller\').click(function() {
			jQuery(this).hide();
			jQuery(\'.subtabs\').slideUp(function() {
				jQuery(\'.subtabs\').tabs(\'destroy\');
				jQuery(\'.subtabs ul\').hide();
				jQuery(\'.subtabs\').slideDown();
			});
			jQuery(\'#ym_fbook_tabs\').slideUp(function() {
				jQuery(\'#ym_fbook_tabs\').tabs(\'destroy\');
				jQuery(\'#ym_fbook_tabs ul\').hide();
				jQuery(\'#transaction_logging\').hide();
				jQuery(\'#ym_fbook_tabs\').slideDown();
			});
		});
		jQuery(\'#ym_fb\').submit(function() {
			var selected = jQuery(\'#ym_fbook_tabs\').tabs(\'option\', \'selected\');
			jQuery(\'#ym_fb_tab_select\').val(selected);
		});
		jQuery(\'table\').after(\'<p class="submit" style="text-align: right;"><input type="submit" value="Save Settings" /></p>\');
	});
</script>
';
    echo '<div class="wrap" id="poststuff">';
    //	echo '<h2>YourMembers in Facebook | Settings</h2>';
    //	echo '<p style="text-align: right;"><a href="#nowhere" id="tabkiller">Remove Tabs/All Settings on a single page</a></p>';
    echo '<div id="ym_fbook_tabs">';
    echo '<form action="" method="post" enctype="multipart/form-=data" id="ym_fb">';
    $credits = FALSE;
    global $ym_active_modules;
    if (in_array('ym_facebook_credits', $ym_active_modules)) {
        //	if (get_option('ym_facebook_credits')) {
        $credits = TRUE;
    }
    echo '
<ul>
	<li><a href="#guide">Guide</a></li>
	<li><a href="#facebook_settings">Facebook</a></li>
	<li><a href="#settings_settings">Settings</a></li>
	<li><a href="';
    if ($credits) {
        echo '#facebook_credits';
    }
    echo '">Facebook Credits</a></li>
	<li><a href="';
    if ($credits) {
        echo '#facebook_pricing';
    }
    echo '">Facebook Pricing</a></li>
	<li><a href="#share_control">Like/Share</a></li>
	<li><a href="#open_graph">Open Graph</a></li>
	<li><a href="';
    if ($credits) {
        echo '#transaction_logging';
    }
    echo '">Transaction Log</a></li>
</ul>';
    echo '<div id="guide">';
    ym_box_top('Guide');
    echo '<div id="message" class="updated">';
    echo '<p>We have written a guide that should help you get Your Members Facebook Integration Up and Running, you can read it <a href="http://www.yourmembers.co.uk/the-support/guides-tutorials/your-members-facebook-integration/" target="_blank">here</a></p>';
    echo '</div>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="facebook_settings" class="subtabs">';
    echo '
<ul>
	<li><a href="#master_enable">Master Enable</a></li>
	<li><a href="#keys_settings">Application Keys</a></li>
	<li><a href="#canvas_settings">Canvas Settings</a></li>
	<li><a href="#page_settings">Page Settings</a></li>
	<li><a href="#dim_settings">Dimensions</a></li>
	<li><a href="#permissions">Permissions</a></li>
</ul>
';
    echo '<div id="master_enable">';
    ym_box_top('Enable Facebook');
    $review = '';
    if (!$facebook_settings->app_id) {
        $review .= '<div id="message" class="updated"><p>If you havn&#39;t created an app yet, you can do so <a href="http://developers.facebook.com/setup" target="_new">here</a></p></div>';
    }
    echo $review;
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Enable Facebook', 'enabled', $facebook_settings->enabled, 'If not enabled if a users access the app, they are redirected to the site');
    echo '</table>';
    ym_box_bottom();
    echo '</div>
<div id="keys_settings">';
    ym_box_top('Application Keys');
    $review .= '<p>You can find and review these settings <a href="https://developers.facebook.com/apps/';
    if ($facebook_settings->app_id) {
        $review .= $facebook_settings->app_id;
    }
    $review .= '" target="_new">Here</a></p>';
    echo $review;
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_text_row('Facebook Application ID', 'app_id', $facebook_settings->app_id, 'The application ID');
    $ym_formgen->render_form_table_text_row('Facebook Application Secret', 'app_secret', $facebook_settings->app_secret, 'The application secret');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="canvas_settings">';
    ym_box_top('Canvas Settings');
    echo $review;
    echo '<table class="form-table">';
    echo '<tr><th>Facebook Canvas Name</th><td>http://apps.facebook.com/<input class="ym_input" type="text" name="canvas_url" id="canvas_url" value="' . $facebook_settings->canvas_url . '" /></td></tr>';
    echo '<tr><th>Facebook Canvas Landing</th><td>' . site_url('/') . '<input class="ym_input" type="text" name="canvas_landing" id="canvas_landing" value="' . $facebook_settings->canvas_landing . '" /></td></tr>';
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="page_settings">';
    ym_box_top('Page Settings');
    echo $review;
    echo '<p>If you have a (fan) page vanity url specified the app will do its best to stay in the (fan) page if the session starts on the (fan) page</p>';
    if ($facebook_settings->app_id) {
        echo '<p>You will have needed to have added your Application as a Tab to your Facebook Fan Page, you can do that <a href="http://www.facebook.com/apps/application.php?id=' . $facebook_settings->app_id . '">here</a> and then click <strong>Add to my Page</strong></p>';
    }
    echo '<table class="form-table">';
    echo '<tr><th>Facebook (fan) Page Vanity Url</th><td>http://www.facebook.com/<input class="ym_input" type="text" name="page_url" id="page_url" value="' . $facebook_settings->page_url . '" /></td></tr>';
    echo '<tr><th>Facebook Page Landing</th><td>' . site_url('/') . '<input class="ym_input" type="text" name="page_landing" id="page_landing" value="' . $facebook_settings->page_landing . '" /></td></tr>';
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="dim_settings">';
    ym_box_top('Dimension Settings');
    echo '<table class="form-table">';
    $ym_formgen->render_combo_from_array_row('IFrame Size', 'iframe_size', $iframe_options, $facebook_settings->iframe_size, 'Make sure this setting is set identical to the setting in Facebook Application settings');
    $ym_formgen->render_form_table_text_row('IFrame Height', 'iframe_size_height', $facebook_settings->iframe_size_height, 'If you are using Scrollbars you can specify the height you want here, in px');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="permissions">';
    ym_box_top('Permissions');
    echo '<table class="form-table">';
    echo '<tr><td></td><td style="width: 50px;"></td></tr>';
    $ym_formgen->render_form_table_radio_row('Likewalls - user_likes', 'permission_likewall', $facebook_settings->permission_likewall, 'If using likewalls, we need to extended permissions to get User Likes, as some users have their Likes set to Private');
    $ym_formgen->render_form_table_radio_row('Email Address - email', 'permission_email', $facebook_settings->permission_email, 'For the registration with Facebook you can enable this to pre fill the email entry with their Primary Facebook Email Address. Users will be asked to accept additional permissions.');
    $ym_formgen->render_form_table_radio_row('Offline Access - offline_access', 'permission_offline_access', $facebook_settings->permission_offline_access, 'Access Tokens are on average valid for about an hour. Which means once an hour we have to send the user thru a loop, normally this is transparent. However if you do not want this you can enable offline access to get a longer access key');
    $ym_formgen->render_form_table_radio_row('Offline Access - publish_actions', 'permission_publish_actions', $facebook_settings->permission_publish_actions, 'Part of the new Open Graph Actions');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '</div>';
    echo '<div id="settings_settings" class="subtabs">';
    echo '
<ul>
	<li><a href="#access_settings">Access Settings</a></li>
	<li><a href="#registration_settings">Registration Settings</a></li>
	<li><a href="#content_settings">Content Settings</a></li>
	<li><a href="#comment_settings">Comment Settings</a></li>
	<li><a href="#analytics_settings">Analytics Settings</a></li>
</ul>
';
    echo '<div id="access_settings">';
    ym_box_top('Access Settings');
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Force Facebook', 'force_facebook', $facebook_settings->force_facebook, 'Make YM Facebook only, force users visting the Website to access via Facebook');
    $ym_formgen->render_form_table_radio_row('Force Application Add', 'force_facebook_auth', $facebook_settings->force_facebook_auth, 'Force a user to be logged into Facebook and authorised the Application');
    $ym_formgen->render_form_table_radio_row('Force WordPress Login', 'force_wordpress_auth', $facebook_settings->force_wordpress_auth, 'Force a user to be logged into WordPress');
    $ym_formgen->render_form_table_radio_row('Require Link', 'require_link', $facebook_settings->require_link, 'Require a User to link their Facebook and WordPress Accounts if Logged in (unless superseeded by above)');
    $ym_formgen->render_form_table_radio_row('Disable the Link Suggested Message', 'disable_link_message', $facebook_settings->disable_link_message, 'When a user is logged out do not prompt them to link/login');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="registration_settings">';
    ym_box_top('Registration Settings');
    echo '<p>Using Hidden Register? You might want to turn on the Email Permission on the Facebook->Permissions Tab</p>';
    echo '<table class="form-table">';
    //	$ym_formgen->render_form_table_radio_row('Register with Facebook', 'register_with_facebook', $facebook_settings->register_with_facebook, 'Allow a user to register a WordPress accout using their Facebook Account as a Base');
    $ym_formgen->render_form_table_radio_row('Hidden Register with Facebook', 'register_with_facebook_hidden', $facebook_settings->register_with_facebook_hidden, 'If a User uses the Facebook App and are not logged into WordPress create them a WordPress Account. If they are found by their username or email address, the two accounts are Auto Linked. (Implies Require Link and Force Redirect)');
    //	$ym_formgen->render_form_table_radio_row('Email Address', 'permission_emailb', $facebook_settings->permission_email, 'For the registration with Facebook you can enable this to pre fill the email entry with their Primary Facebook Email Address. Users will be asked to accept additional permissions.');
    $packs = ym_get_packs();
    $ym_packs = array();
    $ym_packs[0] = 'No Account';
    foreach ($packs as $pack) {
        $ym_packs[$pack['id']] = ym_get_pack_label($pack['id']);
    }
    $ym_formgen->render_combo_from_array_row('Hidden Register Subscription', 'register_with_facebook_hidden_subid', $ym_packs, $facebook_settings->register_with_facebook_hidden_subid, 'Which Subscription To Put a Hidden Regsiter User on. It will <strong>not</strong> prompt for Payment');
    $ym_formgen->render_form_table_text_row('Hidden Register Redirect', 'register_with_facebook_hidden_redirect', $facebook_settings->register_with_facebook_hidden_redirect, 'On Hidden Register Complete Redirect the users to a page');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="content_settings">';
    ym_box_top('Content Settings');
    echo '<p>fb.php status is: ';
    $result = locate_template('fb.php');
    if (empty($result)) {
        echo 'Not Present';
    } else {
        echo 'Present';
    }
    echo '</p>';
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('fb.php', 'enable_fb_php', $facebook_settings->enable_fb_php, 'Enable the use of the Theme File fb.php instead of YM FB Theme, if fb.php is present');
    echo '</table>';
    echo '<p>If you use a theme fb.php file, most of these options are redundant, unless you implement them in your Theme File</p>';
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Allow Leave Facebook', 'enable_leave_facebook', $facebook_settings->enable_leave_facebook, 'Allow a user to start a website session from inside facebook, if a user vists the blog on Facebook first, they will stay inside Facebook, (is overriden by force facebook)');
    $ym_formgen->render_form_table_radio_row('Post Breakout', 'post_breakout', $facebook_settings->post_breakout, 'when viewing the end post, breakout (overrides Force Facebook)');
    $ym_formgen->render_form_table_radio_row('Page Breakout', 'page_breakout', $facebook_settings->page_breakout, 'when viewing the end page, breakout (overrides Force Facebook)');
    $ym_formgen->render_form_table_radio_row('Use excerpt', 'use_excerpt', $facebook_settings->use_excerpt, 'Use excerpts on post pages? (Template dependant)');
    $menus = array('Auto', 'Slug');
    $query = 'SELECT name FROM ' . $wpdb->prefix . 'term_taxonomy tt LEFT JOIN ' . $wpdb->prefix . 'terms t ON t.term_id = tt.term_id WHERE taxonomy = \'nav_menu\'';
    foreach ($wpdb->get_results($query) as $row) {
        $menus[] = $row->name;
    }
    $ym_formgen->render_combo_from_array_row('Menu Control', 'menu', $menus, $facebook_settings->menu, 'We can use the First non blank menu, or you can pick your own. Menus are controlled <a href="' . site_url('/wp-admin/nav-menus.php') . '">here</a>');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="comment_settings">';
    ym_box_top('Comment Settings');
    echo '<p>You can replace the standard comment form with a Facebook Powered comment form</p>';
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Use Facebook Comments on Facebook', 'use_facebook_comments', $facebook_settings->use_facebook_comments);
    $ym_formgen->render_form_table_radio_row('Use Facebook Comments on the Site', 'use_facebook_comments_on_site', $facebook_settings->use_facebook_comments_on_site);
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="analytics_settings">';
    ym_box_top('Analytics');
    echo '<p>You need to set the Website URL of the Profile to <strong>' . site_url('?ymfbook=googleanalytics') . '</strong> in order for Check Status to succeed</p>';
    echo '<p>Its recommended you use a separate profile under the same domain to track the Facebook Application</p>';
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_text_row('Google Analytics Profile ID', 'google_analytics_profile_id', $facebook_settings->google_analytics_profile_id, 'Uses the Standard code with this ID');
    $ym_formgen->render_form_table_textarea_row('Tracking Code', 'analytics_tracking_code', $facebook_settings->analytics_tracking_code, 'This will override the standard Google Analytics Code');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '</div>';
    if ($credits) {
        echo '<div id="facebook_credits">';
        ym_box_top(__('Facebook Credits', 'ym_facebook'));
        echo __('<p>Facebook Credits can only be used inside Facebook</p>', 'ym_facebook');
        echo sprintf(__('<p>You will need a Credits Callback URL, please use this: <strong>%s</strong></p>', 'ym_facebook'), site_url('?ym_process=ym_facebook_credits'));
        ym_box_bottom();
        ym_box_top(__('Primary Button', 'ym_facebook'));
        echo __('<p>In line with the Facebook Credits branding guide, you have a choice of three Pay with Facebook Credits Icons</p>', 'ym_facebook');
        $select = $facebook_settings->logo;
        echo '<table class="form-table">';
        echo '<tr><th>' . __('Option A', 'ym_facebook') . '</th>
			<td>
				<input type="radio" name="logo" id="logoa" value="' . YM_IMAGES_DIR_URL . 'pg/facebook_credits_a.png" ' . ($select == YM_IMAGES_DIR_URL . 'pg/facebook_credits_a.png' ? 'checked="checked"' : '') . ' />
				<label for="logoa">
					<img src="' . YM_IMAGES_DIR_URL . 'pg/facebook_credits_a.png" />
				</label>
			</td>
		</tr>';
        echo '<tr><th>' . __('Option B', 'ym_facebook') . '</th>
			<td>
				<input type="radio" name="logo" id="logob" value="' . YM_IMAGES_DIR_URL . 'pg/facebook_credits_b.png" ' . ($select == YM_IMAGES_DIR_URL . 'pg/facebook_credits_b.png' ? 'checked="checked"' : '') . ' />
				<label for="logob">
					<img src="' . YM_IMAGES_DIR_URL . 'pg/facebook_credits_b.png" />
				</label>
			</td>
		</tr>';
        echo '<tr><th>' . __('Option C', 'ym_facebook') . '</th>
			<td>
				<input type="radio" name="logo" id="logoc" value="' . YM_IMAGES_DIR_URL . 'pg/facebook_credits_c.png" ' . ($select == YM_IMAGES_DIR_URL . 'pg/facebook_credits_c.png' ? 'checked="checked"' : '') . ' />
				<label for="logoc">
					<img src="' . YM_IMAGES_DIR_URL . 'pg/facebook_credits_c.png" />
				</label>
			</td>
		</tr>';
        echo '</table>';
        ym_box_bottom();
        ym_box_top(__('Credits Dialog Images', 'ym_facebook'));
        echo __('<p>When purchasing a item users are shown a title, description, cost and a icon/logo. You can crontol these logos here</p>', 'ym_facebook');
        echo '<table class="form-table">';
        echo '
		<tr>
			<th>' . __('Subscription Purchase Image', 'ym_facebook') . '</th>
			<td>
				<input type="file" name="credits_purchase_sub_image" id="credits_purchase_sub_image" />';
        if ($facebook_settings->credits_purchase_sub_image) {
            echo '<div style="margin-top: 5px;"><img src="' . $facebook_settings->credits_purchase_sub_image . '" alt="' . __('Subscription Purchase Image', 'ym_facebook') . '" /></div>';
        }
        echo '
			</td>
		</tr>
		<tr>
			<th>' . __('Post Purchase Image', 'ym_facebook') . '</th>
			<td>
				<input type="file" name="credits_purchase_post_image" id="credits_purchase_post_image" />';
        if ($facebook_settings->credits_purchase_post_image) {
            echo '<div style="margin-top: 5px;"><img src="' . $facebook_settings->credits_purchase_post_image . '" alt="' . __('Post Purchase Image', 'ym_facebook') . '" /></div>';
        }
        echo '
			</td>
		</tr>
		<tr>
			<th>' . __('Bundle Purchase Image', 'ym_facebook') . '</th>
			<td>
				<input type="file" name="credits_purchase_bundle_image" id="credits_purchase_bundle_image" />';
        if ($facebook_settings->credits_purchase_bundle_image) {
            echo '<div style="margin-top: 5px;"><img src="' . $facebook_settings->credits_purchase_bundle_image . '" alt="' . __('Bundle Purchase Image', 'ym_facebook') . '" /></div>';
        }
        echo '
			</td>
		</tr>
		';
        echo '</table>';
        ym_box_bottom();
        ym_box_top(__('Other Settings', 'ym_facebook'));
        echo '<table class="form-table">';
        $ym_formgen->render_form_table_radio_row('Exclusive Facebook Credits', 'credits_exclusive', $facebook_settings->credits_exclusive, 'Use only Facebook Credits when inside Facebook');
        echo '<tr><td></td><td><p>';
        echo 'Facebook takes a 30% fee on all transactions.<br />' . 'For Transactions in non USD Facebook pays out based on:<br />' . 'Each Facebook Credit is $0.10 and then converts this into your native currency based on that days exchange rate<br />' . 'So 10 Credits is $1 and 100 is $10<br />' . 'Transactions can only occur in whole credits, so if any math involved results in a decimal prices will be rounded up<br />' . 'Costs can only be in Whole Credits';
        global $ym_res;
        if ($ym_res->currency != 'USD') {
            echo '<br /><br />So you can either specify an exchange rate, or set a Facebook credits price per item on the Facebook Pricing Tab';
            echo '</p></td></tr>';
            $ym_formgen->render_form_table_text_row('Specify a Exchange Rate', 'exchange_rate', $facebook_settings->exchange_rate, 'If you specify an exchange rate, it will be used. Its the Exchange rate for your Currency to USD');
        } else {
            echo '<br /><br />You are using USD, so you do not need to worry about an exchange rate, but you can still set a Facebook credits price per item on the Facebook Pricing Tab';
            echo '</p></td></tr>';
        }
        $ym_formgen->render_combo_from_array_row('Rounding', 'exchange_round', $round_options, $facebook_settings->exchange_round, 'You can control the rounding method if any');
        echo '</table>';
        ym_box_bottom();
        echo '</div>';
        echo '<div id="facebook_pricing" class="subtabs">';
        echo '
<ul>
	<li><a href="#pack_pricing">Pack</a></li>
	<li><a href="#post_pricing">Post</a></li>
	<li><a href="#bundle_pricing">Bundle</a></li>
</ul>
';
        echo '<div id="pack_pricing">';
        ym_box_top('Pack Pricing');
        echo '<p>Remember: 1 Credit is USD 0.10 and pricing is in whole credits, if a override price is set Exchange Rates and Rouding is ignored</p>';
        echo '<table class="form-table">';
        $pricing_data = get_option('ym_fbook_pricing');
        // subs
        $packs = ym_get_packs();
        foreach ($packs as $pack) {
            $id = 'pack_' . $pack['id'];
            $ym_formgen->render_form_table_text_row('Pack Price: ' . ym_get_pack_label($pack['id']), 'override_price_' . $id, $pricing_data->{$id});
        }
        echo '</table>';
        ym_box_bottom();
        echo '</div>';
        echo '<div id="post_pricing">';
        ym_box_top('Post Pricing');
        echo '<p>Remember: 1 Credit is USD 0.10 and pricing is in whole credits, if a override price is set Exchange Rates and Rouding is ignored</p>';
        echo '<table class="form-table">';
        $query = 'SELECT post_id FROM ' . $wpdb->prefix . 'postmeta WHERE meta_key = \'ym_post_purchasable\' AND meta_value = 1';
        foreach ($wpdb->get_results($query) as $post) {
            $id = 'post_' . $post->post_id;
            $postdata = get_post($post);
            $ym_formgen->render_form_table_text_row('Post Price: ' . $postdata->post_title, 'override_price_' . $id, $pricing_data->{$id});
        }
        if (!$wpdb->num_rows) {
            echo '<tr><td></td><th>No Available Posts</th></tr>';
        }
        $ym_formgen->render_form_table_text_row('Default Override Pack Price', 'override_price_post_override', $pricing_data->post_override, 'You can set a default price to override if one is not set');
        echo '</table>';
        ym_box_bottom();
        echo '</div>';
        echo '<div id="bundle_pricing">';
        ym_box_top('Bundle Pricing');
        echo '<p>Remember: 1 Credit is USD 0.10 and pricing is in whole credits, if a override price is set Exchange Rates and Rouding is ignored</p>';
        echo '<table class="form-table">';
        $query = 'SELECT id, name FROM ' . $wpdb->prefix . 'ym_post_pack ORDER BY id ASC';
        foreach ($wpdb->get_results($query) as $bundle) {
            $id = 'bundle_' . $bundle->id;
            $ym_formgen->render_form_table_text_row('Bundle Price: ' . $bundle->name, 'override_price_' . $id, $pricing_data->{$id});
        }
        if (!$wpdb->num_rows) {
            echo '<tr><td></td><th>No Available Bundles</th></tr>';
        }
        $ym_formgen->render_form_table_text_row('Default Override Bundle Price', 'override_price_bundle_override', $pricing_data->bundle_override, 'You can set a default price to override if one is not set');
        echo '</table>';
        ym_box_bottom();
        echo '</div>';
        echo '</div>';
    }
    echo '<div id="share_control" class="subtabs">';
    echo '
<ul>
	<li><a href="#post_control">Post Like/Share</a></li>
	<li><a href="#footer_control">Footer Like/Share</a></li>
	<li><a href="#shortcode_control">Shortcode Like/Share</a></li>
	<li><a href="#likewall_control">Likewall Like/Share</a></li>
</ul>
';
    echo '<div id="post_control">';
    ym_box_top('Post Share Control');
    echo '<p>This are the options for adding Share/Send buttons to Posts/Pages</p>';
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Enable Facebook Share', 'enable_share', $facebook_settings->enable_share, 'Allow people to share content to Facebook Feeds from within the App');
    $ym_formgen->render_form_table_radio_row('Enable Facebook Send', 'enable_send', $facebook_settings->enable_send, 'Allow people to share content via PM (needs Share to be on)');
    $ym_formgen->render_combo_from_array_row('Share Box to Use', 'share_box', $sharebox_options, $facebook_settings->share_box);
    $ym_formgen->render_form_table_radio_row('Show faces', 'show_faces', $facebook_settings->show_faces, 'Show the faces of Friend who have shared the same link');
    $ym_formgen->render_combo_from_array_row('Verb to Use', 'verb', $verbs, $facebook_settings->verb);
    $ym_formgen->render_combo_from_array_row('Color Scheme', 'color_scheme', $color_schemes, $facebook_settings->color_scheme);
    $ym_formgen->render_combo_from_array_row('Font', 'font', $fonts, $facebook_settings->font, 'The Font to use for the Buttons');
    //	$ym_formgen->render_form_table_text_row('Add a Ref', 'ref', $facebook_settings->ref, 'A reference for tracking');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="footer_control">';
    ym_box_top('Footer Share Control');
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Enable Facebook Share Footer', 'enable_share_footer', $facebook_settings->enable_share_footer, 'Add a Share button for the whole site in the footer');
    $ym_formgen->render_form_table_radio_row('Enable Facebook Send Footer', 'enable_send_footer', $facebook_settings->enable_send_footer, 'Allow people to share content via PM (needs Share to be on)');
    $ym_formgen->render_combo_from_array_row('Share Box to Use', 'share_box_footer', $sharebox_options, $facebook_settings->share_box_footer);
    $ym_formgen->render_form_table_radio_row('Show faces', 'show_faces_footer', $facebook_settings->show_faces_footer, 'Show the faces of Friend who have shared the same link');
    $ym_formgen->render_combo_from_array_row('Verb to Use', 'verb_footer', $verbs, $facebook_settings->verb_footer);
    $ym_formgen->render_combo_from_array_row('Color Scheme', 'color_scheme_footer', $color_schemes, $facebook_settings->color_scheme_footer);
    $ym_formgen->render_combo_from_array_row('Font', 'font_footer', $fonts, $facebook_settings->font_footer, 'The Font to use for the Buttons');
    //	$ym_formgen->render_form_table_text_row('Add a Ref', 'ref_footer', $facebook_settings->ref_footer, 'A reference for tracking');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="shortcode_control">';
    ym_box_top('Shortcode Share Control');
    echo '<p>You can use the shortcode [ym_fb_like]</p>';
    echo '<p>You can specify a shareurl to use, if not the post permalink will be used</p>';
    //	echo '<p>You can specify a type to use, if not the "post" tab settings will be used, specify "shortcode" to use the below settings, or "footer" to use the footer tab settings</p>';
    echo '<table class="form-table">';
    $ym_formgen->render_form_table_radio_row('Enable Facebook Share Shortcode', 'enable_share_shortcode', $facebook_settings->enable_share_shortcode);
    $ym_formgen->render_form_table_radio_row('Auto Add to the bottom of posts on non Facebook Pages', 'enable_share_auto_nonfb', $facebook_settings->enable_share_auto_nonfb, 'Add a Share button to the bottom of all posts on non Facebook Framed Pages');
    $ym_formgen->render_form_table_radio_row('Enable Facebook Send Shortcode', 'enable_send_shortcode', $facebook_settings->enable_send_shortcode, 'Allow people to share content via PM (needs Share to be on)');
    $ym_formgen->render_combo_from_array_row('Share Box to Use', 'share_box_shortcode', $sharebox_options, $facebook_settings->share_box_shortcode);
    $ym_formgen->render_form_table_radio_row('Show faces', 'show_faces_shortcode', $facebook_settings->show_faces_shortcode, 'Show the faces of Friend who have shared the same link');
    $ym_formgen->render_combo_from_array_row('Verb to Use', 'verb_shortcode', $verbs, $facebook_settings->verb_shortcode);
    $ym_formgen->render_combo_from_array_row('Color Scheme', 'color_scheme_shortcode', $color_schemes, $facebook_settings->color_scheme_shortcode);
    $ym_formgen->render_combo_from_array_row('Font', 'font_shortcode', $fonts, $facebook_settings->font_shortcode, 'The Font to use for the Buttons');
    //	$ym_formgen->render_form_table_text_row('Add a Ref', 'ref_shortcode', $facebook_settings->ref_shortcode, 'A reference for tracking');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<div id="likewall_control">';
    ym_box_top('Likewall Share Control');
    echo '<table class="form-table">';
    //		$ym_formgen->render_form_table_radio_row('Enable Facebook Share LikeWall', 'enable_share_likewall', $facebook_settings->enable_share_likewall, 'Add a Share button for the whole site in the likewall');
    //		$ym_formgen->render_form_table_radio_row('Enable Facebook Send LikeWall', 'enable_send_likewall', $facebook_settings->enable_send_likewall, 'Allow people to share content via PM (needs Share to be on)');
    $ym_formgen->render_combo_from_array_row('Share Box to Use', 'share_box_likewall', $sharebox_options, $facebook_settings->share_box_likewall);
    $ym_formgen->render_form_table_radio_row('Show faces', 'show_faces_likewall', $facebook_settings->show_faces_likewall, 'Show the faces of Friend who have shared the same link');
    $ym_formgen->render_combo_from_array_row('Verb to Use', 'verb_likewall', $verbs, $facebook_settings->verb_likewall);
    $ym_formgen->render_combo_from_array_row('Color Scheme', 'color_scheme_likewall', $color_schemes, $facebook_settings->color_scheme_likewall);
    $ym_formgen->render_combo_from_array_row('Font', 'font_likewall', $fonts, $facebook_settings->font_likewall, 'The Font to use for the Buttons');
    //	$ym_formgen->render_form_table_text_row('Add a Ref', 'ref_likewall', $facebook_settings->ref_likewall, 'A reference for tracking');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '</div>';
    echo '<div id="open_graph">';
    ym_box_top('Open Graph Options');
    echo '<table class="form-table">';
    echo '
	<tr>
		<th>Open Graph Image
			<div style="color: gray; margin-top: 5px; font-size: 11px;">This image is used when a user links/shares content from your site.</div>
		</th>
		<td>
			<input type="file" name="open_graph_image" id="open_graph_image" />';
    if ($facebook_settings->open_graph_image) {
        echo '<div style="margin-top: 5px;"><img src="' . $facebook_settings->open_graph_image . '" alt="Open Graph Image" /></div>';
    }
    echo '
		</td>
	</tr>
	';
    $ym_formgen->render_combo_from_array_row('Default Open Graph Type', 'open_graph_type', $types, $facebook_settings->open_graph_type);
    $ym_formgen->render_form_table_text_row('Admin Ids', 'open_graph_admins', $facebook_settings->open_graph_admins, 'Users who should be linked/denoted as admins for your YM in Facebook, comma separated');
    echo '</table>';
    ym_box_bottom();
    echo '</div>';
    echo '<input type="hidden" name="ym_fb_tab_select" id="ym_fb_tab_select" value="0" />';
    echo '</form>';
    if ($credits) {
        // facebook credits appears to be enabled in YM
        echo '<div id="transaction_logging">';
        ym_box_top('Facebook Credits Transaction Logging');
        include YM_FBOOK_BASE_DIR . 'admin/ym_facebook_transaction_log.php';
        ym_box_bottom();
        echo '</div>';
    }
    echo '</div>';
    echo '</div>';
}
/**
Bundle Content Editor
*/
function ym_bundle_edit_content($bundle)
{
    if (isset($_POST['ym_remove_post_id']) && $_POST['ym_remove_post_id']) {
        ym_remove_post_from_bundle($_POST['ym_remove_post_id'], $bundle->id);
        echo '<div id="message" class="updated"><p>' . __('Removed Post from Bundle', 'ym') . '</p></div>';
        ym_box_bottom();
        ym_box_top();
    }
    if (isset($_POST['add_posts']) && $_POST['add_posts']) {
        foreach ($_POST['post_ids'] as $id) {
            if (ym_add_post_to_bundle($id, $bundle->id)) {
                echo '<p>' . sprintf(__('Added post ID: %s to bundle ID: %s', 'ym'), $id, $bundle->id) . '</p>';
            }
        }
        ym_box_bottom();
        ym_box_top();
    }
    $posts = ym_get_bundle_posts($bundle->id);
    echo '<table style="width: 100%;">';
    $post_ids = array();
    foreach ($posts as $post) {
        $post_ids[] = $post->post_id;
        echo '<tr>';
        echo '<td>(' . $post->post_id . ') ' . get_the_title($post->post_id) . '</td>';
        echo '<td>
		<form action="" method="post">
			<input type="hidden" name="bundle_id" value="' . $bundle->id . '" />
			<input type="hidden" name="posts" value="1" />
			<input type="hidden" name="ym_remove_post_id" value="' . $post->post_id . '" />
			<input type="submit" class="button-secondary deletelink" value="' . __('Remove Post from Bundle', 'ym') . '" />
		</form>
		</td>';
        echo '</tr>';
    }
    echo '</table>';
    ym_box_bottom();
    ym_box_top(__('Add new Item(s) to bundle', 'ym'));
    echo '<form action="" method="post">
		<input type="hidden" name="bundle_id" value="' . $bundle->id . '" />
		<input type="hidden" name="posts" value="1" />
		<input type="hidden" name="add_posts" value="1" />
	<table id="ym_posts_space" style="width: 100%;">
	';
    $max = 15;
    $posts = ym_bundle_get_some_posts(0, $post_ids, $max);
    $total = count($posts);
    foreach ($posts as $post) {
        echo '<tr>';
        echo '<td>(' . $post->ID . ' - ' . $post->post_type . ') ' . $post->post_title . '</td>';
        echo '<td><input type="checkbox" name="post_ids[]" value="' . $post->ID . '" /></td>';
        echo '</tr>';
    }
    echo '
	</table>
	';
    if ($total == $max) {
        echo '<a href="#nowhere" id="ym_next_page" class="button-secondary" style="float: right;">' . __('Load More Posts', 'ym') . '</a>';
    }
    echo '
<input type="hidden" name="offset" id="offset" value="5" />
<input type="hidden" name="current_post_ids" id="current_post_ids" value="' . implode(',', $post_ids) . '" />
	<br />
<input type="submit" class="button-primary" value="' . __('Add Selected Item(s) to Bundle', 'ym') . '" />
	</form>

<script type="text/javascript">' . "\njQuery(document).ready(function() {\n\tjQuery('#ym_next_page').click(function() {\n\t\tvar count = 0;\n\t\tjQuery(this).html('" . __('Loading...', 'ym') . "');\n\t\tjQuery.getJSON('" . YM_ADMIN_URL . "&ym_page=ym-content-bundles&do_munch=1&offset=' + jQuery('#offset').val() + '&post_ids=' + jQuery('#current_post_ids').val() + '&max=" . $max . "', function(data) {\n\t\t\t\tjQuery('#ym_posts_space input').each(function() {\n\t\t\t\t\tif (!jQuery(this).is(':checked')) {\n\t\t\t\t\t\tjQuery(this).parents('tr').remove();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tjQuery.each(data, function(key, val) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tjQuery(val).appendTo('#ym_posts_space');\n\t\t\t\t});\n\t\t\t\tif (count == " . $max . ") {\n\t\t\t\t\tjQuery('#ym_next_page').html('" . __('Load More Posts', 'ym') . "');\n\t\t\t\t} else {\n\t\t\t\t\tjQuery('#ym_next_page').remove();\n\t\t\t\t}\n\t\t\t\tjQuery('#offset').val(jQuery('#offset').val() + " . $max . ");\n\t\t});\n\t});\n});\n</script>\n";
}
Exemplo n.º 15
0
function mailmanager_admin($other_action)
{
    global $mm, $wpdb;
    $current_settings = get_option('ym_other_mm_settings');
    if ($other_action == 'mailmanager') {
        $mm_action = ym_get('mm_action');
        echo '<div class="wrap" id="poststuff" style="width: 98%;">';
        if (!$current_settings->first_run_done) {
            $mm_action = 'gateways';
        }
        do_action('mailmanager_precontent');
        switch ($mm_action) {
            case 'gateways':
            case 'settings':
            case 'broadcast':
            case 'create':
            case 'emails':
            case 'preview':
            case 'series':
            case 'welcome':
            case 'invoice':
                include YM_MM_PAGES_DIR . $mm_action . '.php';
                wp_tiny_mce(false, array('editor_selector' => 'editorContent'));
                break;
            case 'gateway':
                $file = $current_settings->mail_gateway;
                $break = FALSE;
                // just in case it should be already loaded from the generation of the settings menu
                require_once YM_MM_GATEWAY_DIR . $file . '/' . $file . '.php';
                // invoke settings page
                global $mailgateway;
                if ($mailgateway->settings) {
                    $mailgateway->settings($break);
                }
                wp_tiny_mce(false, array('editor_selector' => 'editorContent'));
                if ($break) {
                    break;
                }
            case 'runnow':
                if ($mm_action == 'runnow') {
                    ym_box_top(__('MailManger: Cron', 'ym_mailmanager'));
                    echo '<p>';
                    do_action('mailmanager_cron_check');
                    echo '</p>';
                    echo '<p>' . __('The run of the cron is complete', 'ym_mailmanager') . '</p>';
                    ym_box_bottom();
                }
            default:
                echo '<div style="width: 49%; float: left;">';
                ym_box_top(__('MailManger', 'ym_mailmanager'));
                mailmanager_email_stats();
                $sch_using = wp_get_schedule('mailmanager_cron_check');
                $next = wp_next_scheduled('mailmanager_cron_check');
                if (!$sch_using) {
                    $now = time();
                    if ($current_settings->series_hour < date('H', $now)) {
                        // the hour has passed schedule for tomorrow
                        $now = $now + 86400;
                    }
                    $next = mktime($current_settings->series_hour, $current_settings->series_min, 59, date('n', $now), date('j', $now), date('Y', $now));
                    wp_schedule_event($next, 'daily', 'mailmanager_cron_check');
                } else {
                    echo '<p>' . sprintf(__('The Cron is set to check %s and will next run at %s', 'ym_mailmanager'), $sch_using, date('r', $next)) . '</p>';
                }
                echo '<p>' . sprintf(__('Run the <a href="%s&mm_action=runnow">cron now</a>', 'ym_mailmanager'), $mm->page_root) . '</p>';
                do_action('mailmanager_homepage');
                ym_box_bottom();
                echo '</div>';
                echo '<div style="width: 49%; float: right">';
                mailmanager_list_stats();
                echo '</div>';
        }
        echo '</div>';
    }
}
function ym_members_filters($filters)
{
    global $ym_members_tasks;
    // filters
    ym_box_top(__('Search and Sort', 'ym'));
    echo '<table style="width: 100%;">';
    echo '
<tr><td colspan="10">
<table class="form-table" style="width: 100%;">
<tr><td>
<strong>' . __('Filter Members by:', 'ym') . '</strong>

	<select name="filter_by_option" id="filter_by_option">
		<option value="">' . __('No Filter', 'ym') . '</option>
		<option value="username" ' . ($filters['by_option'] == 'username' ? 'selected="selected"' : '') . '>' . __('Username', 'ym') . '</option>
		<option value="user_email" ' . ($filters['by_option'] == 'user_email' ? 'selected="selected"' : '') . '>' . __('User Email', 'ym') . '</option>
		<option value="package" ' . ($filters['by_option'] == 'package' ? 'selected="selected"' : '') . '>' . __('Package', 'ym') . '</option>
		<option value="package_type" ' . ($filters['by_option'] == 'package_type' ? 'selected="selected"' : '') . '>' . __('Package Type', 'ym') . '</option>
		<option value="custom_field" ' . ($filters['by_option'] == 'custom_field' ? 'selected="selected"' : '') . '>' . __('Custom Field', 'ym') . '</option>
		<option value="status" ' . ($filters['by_option'] == 'status' ? 'selected="selected"' : '') . '>' . __('Status', 'ym') . '</option>
		';
    echo '		
		<option value="">--' . __('User Exposed Fields', 'ym') . '--</option>
		';
    $funbus = '';
    $available = new YourMember_User();
    $available = $available->api_expose();
    foreach ($available as $item) {
        if ($item != 'status' && $item != 'account_type') {
            $funbus .= 'filter_by_text_exposed_' . $item . ' ';
            echo '<option value="exposed_' . $item . '" ' . ($filters['by_option'] == 'exposed_' . $item ? 'selected="selected"' : '') . '>' . ucwords(str_replace('_', ' ', str_replace('account', 'package', $item))) . '</option>';
        }
    }
    echo '
	</select>
</td><td>
<select name="filter_by_text_package" class="filter_by_text filter_by_text_package">
<option value="">' . __('Select', 'ym') . '</option>
<option value="none" ';
    if ('none' == $filters['by_text']) {
        echo 'selected="selected"';
    }
    echo '>' . __('No Package', 'ym') . '</option>';
    global $ym_packs;
    foreach ($ym_packs->packs as $pack) {
        echo '<option value="' . $pack['id'] . '" ';
        if ($pack['id'] == $filters['by_text']) {
            echo 'selected="selected"';
        }
        echo '>' . ym_get_pack_label($pack) . '</option>';
    }
    echo '
</select>

<select name="filter_by_text_package_type" class="filter_by_text filter_by_text_package_type">
<option value="">' . __('Select', 'ym') . '</option>
<option value="none" ';
    if ('none' == $filters['by_text']) {
        echo 'selected="selected"';
    }
    echo '>' . __('No Package Type', 'ym') . '</option>';
    global $ym_package_types;
    foreach ($ym_package_types->types as $type) {
        echo '<option value="' . $type . '" ';
        if ($type == $filters['by_text']) {
            echo 'selected="selected"';
        }
        echo '>' . $type . '</option>';
    }
    echo '
</select>

<select name="filter_by_text_custom_field" class="filter_by_text filter_by_text_custom_field">
	<option value="">' . __('Select', 'ym') . '</option>
	';
    $customs = get_option('ym_custom_fields');
    $order = explode(';', $customs->order);
    foreach ($order as $id) {
        $custom = ym_get_custom_field_by_id($id);
        echo '<option value="' . $id . '" ';
        if ($id == $filters['cf_field']) {
            echo 'selected="selected"';
        }
        echo '>' . $custom['label'] . '</option>';
    }
    echo '
</select>

<select name="filter_by_text_status" class="filter_by_text filter_by_text_status">
	<option value="">' . __('Select', 'ym') . '</option>
	';
    global $status_str;
    foreach ($status_str as $state) {
        echo '<option ';
        if ($state == $filters['by_text']) {
            echo 'selected="selected"';
        }
        echo '>' . $state . '</option>';
    }
    echo '
</select>
</td><td>
<input type="text" name="filter_by_text" class="filter_by_text filter_by_text_username filter_by_text_user_email filter_by_text_custom_field ' . $funbus . '" value="' . $filters['by_text'] . '" size="10">
</td><td style="width: 120px;">
<input type="submit" id="change_filters" name="task" class="button-primary" value="' . $ym_members_tasks['change_filters'] . '" />
</td></tr>
<tr><td style="width: 25%;"></td><td style="width: 25%;"></td><td style="width: 25%;">' . __('Use * to wildcard match', 'ym') . '</td><td style="width: 25%;"></td></tr>
<tr><td>
<strong>' . __('Sort Members by:', 'ym') . '</strong>
<select name="filter_by_order_by">
	<option value="ID" ' . ($filters['order_by'] == 'ID' ? 'selected="selected"' : '') . '>' . __('User ID', 'ym') . '</option>
	<option value="login" ' . ($filters['order_by'] == 'login' ? 'selected="selected"' : '') . '>' . __('User Login', 'ym') . '</option>
	<option value="email" ' . ($filters['order_by'] == 'email' ? 'selected="selected"' : '') . '>' . __('Email Address', 'ym') . '</option>
	<option value="registered" ' . ($filters['order_by'] == 'registered' ? 'selected="selected"' : '') . '>' . __('Registration Date', 'ym') . '</option>
	';
    echo '		
	<option value="">--' . __('User Exposed Fields', 'ym') . '--</option>
	';
    foreach ($available as $item) {
        echo '<option value="exposed_' . $item . '" ' . ($filters['order_by'] == 'exposed_' . $item ? 'selected="selected"' : '') . '>' . ucwords(str_replace('_', ' ', str_replace('account', 'package', $item))) . '</option>';
    }
    echo '
</select>
<td>
</td>
</td><td>
<select name="filter_by_order_by_direction">
	<option value="ASC" ' . ($filters['order_by_direction'] == 'ASC' ? 'selected="selected"' : '') . '>' . __('Ascending', 'ym') . '</option>
	<option value="DESC" ' . ($filters['order_by_direction'] == 'DESC' ? 'selected="selected"' : '') . '>' . __('Descending', 'ym') . '</option>
</select>
</td><td>
<input type="submit" id="change_order" name="task" class="button-primary" value="' . $ym_members_tasks['change_order'] . '" />
</td></tr>

</table>

</td></tr>
';
    echo '</table>';
    ym_box_bottom();
    return;
}