function yss_s3_save()
{
    // saving
    get_currentuserinfo();
    global $wpdb, $current_user, $yss_db, $yss_post_assoc;
    $user = $current_user->ID;
    $file = ym_post('s3_file_select');
    $file = explode('/', $file);
    $bucket = array_shift($file);
    $resource = implode('/', $file);
    $account_types = ym_post('account_types');
    if (is_array($account_types)) {
        $account_types = implode('||', $account_types);
    } else {
        $account_types = '';
    }
    $members = isset($_POST['memberonly']);
    if ($id = ym_post('s3s_id')) {
        $sql = "UPDATE " . $yss_db . " SET\n\t\t\t\t\tbucket = '" . $bucket . "'\n\t\t\t\t\t, resource_path = '" . $resource . "'\n\t\t\t\t\t, postDate = NOW()\n\t\t\t\t\t, user = '******'\n\t\t\t\t\t, members = '" . $members . "'\n\t\t\t\t\t, account_types = '" . mysql_real_escape_string($account_types) . "'\n\t\t\t\tWHERE id = " . $id;
        $wpdb->query($sql);
        $sql = 'DELETE FROM ' . $yss_post_assoc . '
				WHERE s3_id = ' . $id;
        $wpdb->query($sql);
    } else {
        if ($bucket && $resource) {
            $sql = "INSERT INTO " . $yss_db . " (bucket, resource_path, postDate, user, members, account_types)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . $bucket . "'\n\t\t\t\t\t\t, '" . $resource . "'\n\t\t\t\t\t\t, NOW()\n\t\t\t\t\t\t, '" . $user . "'\n\t\t\t\t\t\t, '" . $members . "'\n\t\t\t\t\t\t, '" . mysql_real_escape_string($account_types) . "'\n\t\t\t\t\t)";
            $wpdb->query($sql);
            $id = $wpdb->insert_id;
            if ($id) {
                ym_display_message(__('New video created Successfully', 'yss'));
            } else {
                ym_display_message(__('Failed video Creation ', 'yss'));
            }
        } else {
            ym_display_message(__('No Resource and/or Bucket specified', 'yss'), 'error');
        }
    }
    if ($id) {
        if ($link_ids = ym_post('link_to_post_id')) {
            foreach ($link_ids as $post_id) {
                $sql = 'INSERT INTO ' . $yss_post_assoc . ' (s3_id, post_id)
					VALUES (' . $id . ', ' . $post_id . ')';
                $wpdb->query($sql);
            }
        }
    }
}
        if ($pack['account_type'] == $delete) {
            $ym_packs->packs[$k]['account_type'] = $to;
        }
    }
    update_option('ym_packs', $ym_packs);
    ym_display_message(__('Package Type Deleted', 'ym'));
}
if (ym_post('new_package_type')) {
    $new = strip_tags(ym_post('new_package_type'));
    if (empty($new)) {
        ym_display_message(__('Please specify a package type to create', 'ym'), 'error');
    } else {
        if ($ym_package_types->create($new)) {
            ym_display_message(__('The new Package Type has been created successfully', 'ym'));
        } else {
            ym_display_message(__('The new Package Type already exists', 'ym'), 'error');
        }
    }
}
ym_box_top(__('Package Types', 'ym'));
echo '<form action="" method="post">';
echo '
<table class="form-table">
	<tr class="alternate"> 
		<td style="font-weight: bold;">' . __('Package Type', 'ym') . '</td> 
		<td style="font-weight: bold;">' . __('Delete', 'ym') . '</td> 
	</tr>
';
foreach ($ym_package_types->types as $type) {
    echo '
	<tr class="alternate">
function ym_delete_download()
{
    global $wpdb, $ym_dl_db;
    $sql = 'DELETE FROM ' . $ym_dl_db . '
			WHERE id = ' . $_GET['id'];
    if ($wpdb->query($sql)) {
        ym_display_message(__('Download deleted Successfully', 'ym'));
    }
}
function ym_shortcode_ym_group_membership_control()
{
    // @TODO: Finish
    global $ym_user, $ym_formgen;
    if ($ym_user->child_ids || $ym_user->child_accounts_allowed) {
        // has children
        $total_kids = count($ym_user->child_ids);
        $action = ym_post('action', false);
        if ($action == 'ym_add_child_user') {
            if ($ym_user->child_accounts_allowed > $total_kids) {
                $email_address = ym_post('email_address');
                $username = ym_post('username', $email_address);
                $password = ym_post('password');
                $c_password = ym_post('c_password');
                if ($email_address && is_email($email_address)) {
                    if (!empty($password) && $password != $c_password) {
                        ym_display_message(__('Passwords do not match', 'ym'), 'error');
                    }
                    $new_user = new YourMember_User();
                    $result = $new_user->create($email_address, false, false, $username, $password);
                    if (is_wp_error($result)) {
                        ym_display_message($result->get_error_message(), 'error');
                    } else {
                        // apply child
                        $data = array('parent_id' => $ym_user->ID);
                        // package type
                        if (count($ym_user->child_accounts_package_types) > 1) {
                            $data['account_type'] = $ym_user->child_accounts_package_types[0];
                        } else {
                            $data['account_type'] = $ym_user->account_type;
                        }
                        $new_user->update($data);
                        $new_user->save();
                        unset($new_user);
                        //garbage collect
                        $child_ids = $ym_user->child_ids;
                        $child_ids[] = $result;
                        $ym_user->update(array('child_ids' => $child_ids));
                        $ym_user->save();
                        // all done
                        ym_display_message(__('Child User was created successfully', 'ym'));
                    }
                } else {
                    ym_display_message(__('The Email Address was Blank or Invalid', 'ym'), 'error');
                }
            } else {
                ym_display_message(__('You have reached the maximum number of accounts', 'ym'), 'error');
            }
        } else {
            if ($action == 'ym_child_package_type_change') {
                $child_id = ym_post('child_id', false);
                if ($child_id) {
                    $ym_child = new YourMember_User($child_id);
                    if ($ym_child->parent_id = $ym_user->ID) {
                        $ym_child->update(array('account_type' => $_POST['package_type']));
                        $ym_child->save();
                        ym_display_message(__('Child account was updated successfully', 'ym'));
                    } else {
                        ym_display_message(__('You are trying to update someone elses child', 'ym'), 'error');
                    }
                }
            }
        }
        $return .= '<table class="form-table">';
        foreach ($ym_user->child_ids as $child) {
            // loop thru kids
            $ym_child = new YourMember_User($child);
            $return .= '<tr>';
            $return .= '<td>' . $ym_child->data->user_login . '</td>';
            $return .= '<td>';
            $return .= $ym_child->account_type;
            $return .= '</td>';
            $return .= '</tr>';
        }
        $return .= '</table>';
        if ($ym_user->child_accounts_allowed > $total_kids) {
            // can add child
            $return .= '<h4>' . __('Create new Group Account', 'ym') . '</h4>';
            $return .= '<form action="" method="post">
	<input type="hidden" name="action" value="ym_add_child_user" />
<table class="form-table">
';
            $ym_formgen->return = true;
            $return .= $ym_formgen->render_form_table_email_row(__('Email Address', 'ym'), 'email_address');
            $return .= $ym_formgen->render_form_table_text_row(__('Username', 'ym'), 'username', '', __('Leave blank to use the email address', 'ym'));
            $return .= $ym_formgen->render_form_table_password_row(__('Password', 'ym'), 'password', '', __('Leave blank to auto generate', 'ym'));
            $return .= $ym_formgen->render_form_table_password_row(__('Confirm Password', 'ym'), 'c_password');
            $ym_formgen->return = false;
            $return .= '<tr><td colspan="2"><p class="submit"><input type="submit" class="button-primary alignright" value="' . __('Create', 'ym') . '" /></p></td></tr>';
            $return .= '</table></form>';
        }
        return $return;
    } else {
        return '<p>' . __('You do not have access to Group Management', 'ym') . '</p>';
    }
}
function ym_save_coupon($name, $value, $description = false, $allowed, $usage_limit = 0)
{
    global $wpdb;
    $sql = 'SELECT * FROM ' . $wpdb->prefix . 'ym_coupon WHERE name = \'' . $name . '\'';
    $wpdb->query($sql);
    if ($wpdb->num_rows) {
        ym_display_message(__('Coupon Code already exists: ', 'ym') . $name, 'error');
        return;
    }
    $sql = 'INSERT INTO ' . $wpdb->prefix . 'ym_coupon (name, description, value, allowed, usage_limit, unixtime)
			VALUES ("' . $name . '", "' . $description . '", "' . $value . '", "' . $allowed . '", "' . $usage_limit . '", UNIX_TIMESTAMP())';
    if ($wpdb->query($sql)) {
        ym_display_message(__('Successfully created new coupon: ', 'ym') . $name);
    }
}
            $ym_user = new YourMember_User($ym_user->ID);
        }
    } else {
        if ($action == 'create_child_account') {
            $email_address = ym_post('email_address');
            $username = ym_post('username', $email_address);
            $password = ym_post('password');
            $c_password = ym_post('c_password');
            $sub_id = ym_post('package', false);
            $package_type = ym_post('package_type', false);
            if (ym_group_membership_create_child($email_address, $username, $password, $c_password, $sub_id, $package_type, TRUE)) {
                // reload
                $ym_user = new YourMember_User($ym_user->ID);
            }
        } else {
            ym_display_message(__('Unknown Action Requested', 'ym'), 'error');
        }
    }
}
// get breakdown
$current_counts = ym_group_membership_get_counts();
echo '<div id="poststuff" class="wrap">
	<h2>' . __('Group Membership', 'ym') . '</h2>';
ym_box_top('&nbsp;');
echo '<p>' . sprintf(__('You are eligible to have %s account%s in your Group, you currently have %s Child Account%s', 'ym'), $ym_user->child_accounts_allowed, $ym_user->child_accounts_allowed != 1 ? 's' : '', count($ym_user->child_ids), count($ym_user->child_ids) != 1 ? 's' : '') . '</p>';
echo '
<table class="form-table widefat">';
if (count($ym_user->child_ids)) {
    echo '<tr>
		<th>' . __('User Email', 'ym') . '</th>
		<th>' . __('User Login', 'ym') . '</th>
/**
Bundle Update/create/delete function
*/
function ym_bundle_update()
{
    if (ym_post('ym_do_bundle') && !ym_post('bundle_id', FALSE)) {
        ym_create_bundle(ym_post('name'), ym_post('description'), ym_post('cost'), ym_post('purchaseexpire'), ym_post('purchaselimit'), ym_post('saleend'));
    }
    if (ym_post('ym_do_bundle') && ym_post('bundle_id', FALSE)) {
        ym_edit_bundle(ym_post('bundle_id'), ym_post('name'), ym_post('description'), ym_post('cost'), ym_post('purchaseexpire'), ym_post('purchaselimit'), ym_post('saleend'));
    }
    if (ym_post('save_pack_post')) {
        $post_id = ym_post('post_id');
        $pack_id = ym_get('pack_id');
        if (!ym_add_post_to_bundle($post_id, $pack_id)) {
            ym_display_message(__('That post is already in that pack', 'ym'), 'error');
        }
    }
    if ($id = ym_get('delete_pack_post')) {
        if ($bundle_id = ym_get('pack_id')) {
            ym_remove_post_from_bundle($id, $bundle_id);
        }
    }
    if (ym_post('delete_bundle') && ym_post('bundle_id')) {
        ym_delete_bundle(ym_post('bundle_id'));
    }
    if (ym_post('bundle_to_gift')) {
        $bundle = $_POST['bundle_to_gift'];
        $user = $_POST['user_to_gift'];
        if (ym_gift_bundle($bundle, $user)) {
            echo '<div id="message" class="updated"><p>' . __('Bundle Gifting Complete', 'ym') . '</p></div>';
        } else {
            echo '<div id="message" class="error"><p>' . __('An error occured whilst gifting', 'ym') . '</p></div>';
        }
    }
    if (ym_post('delete_bundle_purchase')) {
        echo '<div id="message" class="';
        if (ym_remove_bundle_purchase(ym_post('delete_bundle_purchase'))) {
            echo 'updated"><p>' . __('Bundle Purchase removed', 'ym');
        } else {
            echo 'error"><p>' . __('Bundle Purchase could not be removed', 'ym');
        }
        echo '</p></div>';
    }
}
';
                    }
                }
            }
        }
        echo '
	</fieldset>
</form>
';
        echo '</div></div>';
        ym_box_bottom();
        break;
    case 'update_facebook_widget':
        update_option('ym_register_flow_fb_app_id', ym_post('ym_register_flow_fb_app_id'));
        update_option('ym_register_flow_fb_secret', ym_post('ym_register_flow_fb_secret'));
        ym_display_message(__('Updated Register Flow Facebook Register Widget', 'ym'));
    default:
        ym_box_top(__('Registration Flows', 'ym'));
        echo '<p>' . __('You can create custom Registration Flows for use with the [ym_register] shortcode', 'ym') . '</p>';
        echo '<table class="form-table widefat">
<tr>
	<th>' . __('Flow ID', 'ym') . '</th>
	<th>' . __('Flow Name', 'ym') . '</th>
	<th>' . __('Pages in Flow', 'ym') . '</td>
	<th></th>
</tr>
';
        $query = 'SELECT * FROM ' . $flows_table . ' ORDER BY flow_id ASC';
        foreach ($wpdb->get_results($query) as $row) {
            echo '<tr>';
            echo '<td>' . $row->flow_id . '</td>';
 function load_options()
 {
     ym_display_message(__('Authorize.net can only handle transactions in USD', 'ym'), 'updated');
     $options = array();
     $options[] = array('name' => 'loginid', 'label' => __('Your Login ID', 'ym'), 'caption' => __('The API access login ID provided by Authorize.Net', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'transkey', 'label' => __('Your Transaction Key', 'ym'), 'caption' => __('The transaction key provided by Authorize.Net', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'md5hash', 'label' => __('Your MD5 Hash Word', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'mode', 'label' => __('Mode', 'ym'), 'caption' => '', 'type' => 'select', 'options' => array('sim' => __('SIM - Simple Integration Method', 'ym'), 'aim' => __('AIM - Advanced Integration Method', 'ym')));
     $options[] = array('name' => 'status', 'label' => __('Test Mode', 'ym'), 'caption' => '', 'type' => 'status');
     return $options;
 }
function ym_group_membership_create_child($email_address, $username, $password, $c_password, $sub_id, $package_type = false, $message = FALSE, $parent_id = FALSE)
{
    if ($parent_id) {
        $ym_user = new YourMember_User($parent_id);
    } else {
        global $ym_user;
    }
    $current_counts = ym_group_membership_get_counts($ym_user);
    if (count($ym_user->child_ids) >= $ym_user->child_accounts_allowed) {
        if ($message) {
            ym_display_message(__('You are out of Child Accounts', 'ym'), 'error');
        }
        return FALSE;
    } else {
        if ($email_address && is_email($email_address)) {
            if (!empty($password) && $password != $c_password) {
                ym_display_message(__('Passwords do not match', 'ym'), 'error');
            }
            if ($sub_id) {
                if (!in_array($sub_id, $ym_user->child_accounts_packages)) {
                    if ($message) {
                        ym_display_message(__('You do not have access to this pacakge', 'ym'), 'error');
                    }
                    return FALSE;
                }
                $pack = ym_get_pack_by_id($sub_id);
            } else {
                if ($package_type) {
                    $pack = array();
                    $pack['account_type'] = $package_type;
                } else {
                    // inherit mode
                    $pack = array();
                    $pack['account_type'] = $ym_user->account_type;
                }
            }
            $inherit = true;
            foreach ($ym_user->child_accounts_package_types as $type => $type_count) {
                if ($type_count) {
                    $inherit = false;
                }
            }
            //			if ($inherit) {
            //				$pack['account_type'] = '';
            //			}
            if ($pack['account_type'] && $ym_user->child_accounts_package_types[$pack['account_type']] > $current_counts[$pack['account_type']] || $inherit && $ym_user->child_accounts_allowed > count($ym_user->child_ids)) {
                $new_user = new YourMember_User();
                $result = $new_user->create($email_address, $sub_id, FALSE, $username, $password);
                if (is_wp_error($result)) {
                    ym_display_message($result->get_error_message(), 'error');
                } else {
                    // apply child
                    $data = array('parent_id' => $ym_user->ID, 'account_type' => $pack['account_type'], 'status_str' => __('Child Account', 'ym'));
                    if (!$sub_id) {
                        // the child has inherited they won't have a role!
                        $new_user->updaterole('subscriber');
                    }
                    $new_user->update($data);
                    $new_user->save();
                    unset($new_user);
                    //garbage collect
                    $child_ids = $ym_user->child_ids;
                    $child_ids[] = $result;
                    $ym_user->update(array('child_ids' => $child_ids));
                    $ym_user->save();
                    @ym_log_transaction(YM_ACCOUNT_TYPE_ASSIGNATION, __('Child', 'ym') . ' ' . $data['account_type'], $result);
                    @ym_log_transaction(YM_USER_STATUS_UPDATE, YM_STATUS_ACTIVE . ' - ' . $data['status_str'], $result);
                    // all done
                    if ($message) {
                        ym_display_message(__('Child User was created successfully', 'ym'));
                    }
                    return TRUE;
                }
            } else {
                if ($message) {
                    ym_display_message(__('Total for this package type has been reached', 'ym'), 'error');
                }
                return FALSE;
            }
        } else {
            if ($message) {
                ym_display_message(__('The Email Address was Blank or Invalid', 'ym'), 'error');
            }
            return FALSE;
        }
    }
}
Beispiel #11
0
 function load_options()
 {
     ym_display_message(sprintf(__('You need to set the "<strong>Webhook URI</strong>" in the Developer Interface to <strong>%s</strong>', 'ym'), site_url('?ym_process=' . $this->code)), 'updated');
     ym_display_message(sprintf(__('You need to set the "<strong>Cancel URI</strong>" in the Developer Interface to <strong>%s</strong>', 'ym'), site_url('?ym_process=' . $this->code . '&action=cancel')), 'updated');
     ym_display_message(sprintf(__('You need to set the "<strong>Redirect URI</strong>" in the Developer Interface to <strong>%s</strong>', 'ym'), site_url('?ym_process=' . $this->code . '&action=confirm')), 'updated');
     ym_display_message(__('You need to set the "<strong>WebHook Data Type</strong>" in the Developer Interface to <strong>JSON</strong>', 'ym'), 'updated');
     $options = array();
     $options[] = array('name' => 'status', 'label' => __('Live/Sandbox Keys', 'ym'), 'caption' => '', 'type' => 'status');
     $options[] = array('name' => 'merchant_id', 'label' => __('Merchant ID', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'application_id', 'label' => __('Application Identifier', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'application_secret', 'label' => __('Application Secret', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'access_token', 'label' => __('Access Token', 'ym'), 'caption' => __('Optional - We only use this to allow users to cancel their Subscription from your site', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'magical_word', 'label' => __('Nonce Phrase', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'cancel_url', 'label' => __('Cancel URL', 'ym'), 'caption' => __('On Payment Cancel return to this URL', 'ym'), 'type' => 'url');
     $options[] = array('name' => 'new_grace', 'label' => __('Put new User into Grace instead of Pending', 'ym'), 'caption' => __('This could mean a user has free access, without paying', 'ym'), 'type' => 'yesno');
     $days = array();
     for ($x = 1; $x <= 28; $x++) {
         $days[$x] = $x;
     }
     $options[] = array('name' => 'grace_limit', 'label' => __('Days to allow payment to clear (days)', 'ym'), 'caption' => __('This is also the Grace Limit Value used for Initial and Renewal Grace', 'ym'), 'type' => 'select', 'options' => $days);
     return $options;
 }
function ym_download_list()
{
    get_currentuserinfo();
    global $ym_dl_db, $wpdb, $date_format, $current_user, $ym_upload_root;
    if (!is_dir($ym_upload_root)) {
        if (@mkdir($ym_upload_root, 0664)) {
            ym_display_message(__('The uploads directory did not exist so it was created and the permissions set to 664. Please make sure to update these permissions if you are not happy with them.'));
        } else {
            ym_display_message(__('The uploads directory does not exist and it could not be created. Please make sure that "' . $ym_upload_root . '" is present and writeable by PHP before adding any downloads.', 'ym'), 'error');
        }
    }
    $header_style = 'border-bottom: 1px solid silver; font-weight: bold;';
    $downloadurl = get_option('ym_dl_url');
    $downloadtype = get_option('ym_dl_type');
    $sort = ym_request('sort', "title");
    $sql = 'SELECT *
			FROM ' . $ym_dl_db . ' 
			ORDER BY ' . $sort;
    $download = $wpdb->get_results($sql);
    echo '<p>' . __('Downloads can be associated with pages and posts. When associated, they take on the page or post permissions including post purchased. Non associated downloads are accessible by all.', 'ym') . '</p>';
    echo ym_start_box('All Downloads');
    if (!is_writeable($ym_upload_root)) {
        ym_display_message(__('The uploads directory is not writeable by PHP and therefore anything uploaded using this tool will fail. Please set the permissions and then refresh this page to see if you have been successful.', 'ym'), 'error');
    }
    echo '			<table style="width: 100%;" cellspacing="0" class="ym_table">
						<tr>
							<th><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=id">' . __('ID', "ym") . '</a></td>
							<th><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=title">' . __('Title', "ym") . '</a></td>
							<th><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=filename">' . __('File', "ym") . '</a></td>
							<th style="width: 150px; text-align: center;">' . __('Limited Access', "ym") . '</td>
							<th style="width: 140px; text-align: center;">' . __('File Exists?', "ym") . '</td>
							<th style="width: 200px;"><a href="' . YM_ADMIN_URL . '&ym_page=ym-content-downloads&sort=postDate">' . __('Posted', "ym") . '</a></td>
							<th style="width: 130px;">' . __('Action', "ym") . '</td>
						</tr>';
    if ($download) {
        foreach ($download as $d) {
            $date = date($date_format, strtotime($d->postDate));
            $path = get_option('siteurl') . "/wp-content/uploads/";
            $file = str_replace($path, "", $d->filename);
            $links = explode("/", $file);
            $file = end($links);
            $user = get_userdata($d->user);
            $abs_file = ym_get_abs_file($d->filename);
            $edit_link = YM_ADMIN_URL . '&ym_page=ym-content-downloads&action=edit&id=' . $d->id . '&sort=' . $sort;
            $delete_link = YM_ADMIN_URL . '&ym_page=ym-content-downloads&action=delete&id=' . $d->id . '&sort=' . $sort;
            echo '	<tr>
						<td>' . $d->id . '</td>
						<td>' . $d->title . '</td>
						<td>' . $file . '</td>
						<td style="text-align:center; font-weight: bold;">
							' . ($d->members ? __('<span style="color: green;">Yes</span>', 'ym') : __('<span style="color: red;">No</span>', 'ym')) . '
						</td>
						<td style="text-align:center; font-weight: bold;">
							' . (file_exists($abs_file) ? __('<span style="color: green;">Yes</span>', 'ym') : __('<span style="color: red;">No</span>', 'ym')) . '
						</td>
						<td>' . $date . ' by ' . $current_user->user_login . '</td>
						<td style="line-height: 2em;">
							<a class="button" href="' . $edit_link . '">' . __('Edit', 'ym') . '</a>
							<a class="button" href="' . $delete_link . '">' . __('Delete', 'ym') . '</a>
						</td>
					</tr>';
        }
    } else {
        echo '	<tr>
					<td colspan="6">' . __('No downloads have been added yet.', "ym") . '</td>
				</tr>';
    }
    echo '			</table>';
    echo '	<p class="submit">
				<form action=""	method="post" id="ym_dl_add" name="add_download">
					<input type="hidden" name="action" value="add" />
					<input type="submit" class="button" name="" value="' . __('Add New Download', "ym") . '" />
				</form>
			</p>';
    echo ym_end_box();
}
 function load_options()
 {
     if ($this->sane) {
         echo '<p>Loading</p><meta http-equiv="refresh" content="0;' . YM_ADMIN_URL . '&ym_page=other_ymfacebook&ym_fb_tab_select=3" />';
     } else {
         ym_display_message(__('Could not activate ym_facebook_credits, ym_facebook is not installed', 'ym'), 'error');
     }
     return FALSE;
 }
$entries = $fields->entries;
$ordering = $fields->order;
if (isset($msg) && !empty($msg)) {
    ym_display_message($msg);
}
if (isset($error) && !empty($error)) {
    ym_display_mesage($error, 'error');
}
if (isset($sort_msg) && !empty($sort_msg)) {
    ym_display_message($sort_msg);
}
if (isset($sort_error) && !empty($sort_error)) {
    ym_display_mesage($sort_error, 'error');
}
if (!$ym_sys->modified_registration) {
    ym_display_message(__('Modified registration is currently turned off. Custom fields will only show on the profile', 'ym'), 'error');
}
echo '
<div class="wrap" id="poststuff">
';
if (ym_get('mode') != 'edit') {
    echo ym_start_box('&nbsp;');
    echo '<form name="frm" action="" method="post" onsubmit="ym_process_custom_field_sort();">
 <table width="60%" border="0" cellpadding="5" cellspacing="5" align="center" class="form-table" id="sorttable">';
    $head = '
 <tr>
	<th scope="col">' . __('Enable', 'ym') . '</th>
 <th scope="col">' . __('ID', 'ym') . '</th>
 <th scope="col">' . __('Name', 'ym') . '</th>
 <th scope="col">' . __('Label', 'ym') . '</th>
 <th scope="col">' . __('Caption', 'ym') . '</th>
Beispiel #15
0
                                    $page = 0;
                                    //reset the page counter
                                    break;
                                case 'forward_a_page':
                                case 'back_a_page':
                                    break;
                                default:
                                    echo '<div id="message" class="error"><p>' . __('Single Task Error: No Tasks', 'ym') . '</p></div>';
                            }
                        }
                        if ($results_count > 0) {
                            $result_message = $result_message ? $result_message : __('%s Users Updated', 'ym');
                            $result_message = sprintf($result_message, $results_count);
                        }
                        if ($result_message) {
                            echo ym_display_message($result_message);
                        }
                    }
                }
            }
        }
    }
}
// security alert
wp_set_current_user($admin_user->ID);
$ym_admin_ym_members_page_limit = ym_request('ym_page_limit', get_option('ym_admin_ym_members_page_limit', 50));
// load filters
$filters = get_option('ym_admin_ym_members_filters', array());
$filters['by_option'] = isset($filters['by_option']) ? $filters['by_option'] : '';
$filters['by_text'] = isset($filters['by_text']) ? $filters['by_text'] : '';
$filters['order_by'] = isset($filters['order_by']) ? $filters['order_by'] : 'login';
 function buildnsave()
 {
     global $ym_upload_url, $ym_upload_root;
     foreach ($_POST as $var => $val) {
         $this->{$var} = $val;
     }
     foreach ($_FILES as $name => $file) {
         $tmp = $file['tmp_name'];
         if (is_uploaded_file($tmp)) {
             // use the upload class
             $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;
                 $this->{$name} = $filename;
             } else {
                 ym_display_message(sprintf(__('Unable to move file to %s', 'ym'), $ym_upload->upload_dir), 'error');
             }
             unlink($tmp);
         }
     }
     $this->callback_script = stripslashes($this->callback_script);
     // trigger object save
     $this->save();
 }
Beispiel #17
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>';
}
Beispiel #18
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>';
    }
Beispiel #19
0
 function load_options()
 {
     ym_display_message(__('There is no Test Mode for Skrill', 'ym'), 'updated');
     $options = array();
     $options[] = array('name' => 'pay_to_email', 'label' => __('Your Skrill Email', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'secretword', 'label' => __('Your Skrill SecretWord', 'ym'), 'caption' => __('Helps to Secure your transactions (optional)', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'merchantid', 'label' => __('Your Skrill Merchant ID', 'ym'), 'caption' => __('We use this to help secure your transactions (optional)', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'language', 'label' => __('Language', 'ym'), 'caption' => '', 'type' => 'select', 'options' => array('DA' => __('Belarus', 'ym'), 'CN' => __('China', 'ym'), 'CZ' => __('Czech Republic', 'ym'), 'FI' => __('Finland', 'ym'), 'FR' => __('France', 'ym'), 'DE' => __('Germany', 'ym'), 'GR' => __('Greece', 'ym'), 'IT' => __('Italy', 'ym'), 'NL' => __('Netherlands', 'ym'), 'PL' => __('Poland', 'ym'), 'RO' => __('Romania', 'ym'), 'RU' => __('Russia', 'ym'), 'ES' => __('Spain', 'ym'), 'SV' => __('Sweden', 'ym'), 'TR' => __('Turkey', 'ym'), 'EN' => __('English', 'ym')));
     $options[] = array('name' => 'gateway_logo', 'label' => __('Gateway Logo', 'ym'), 'caption' => __('You can pick a logo to show to Users on the Gateway Payment Page, at most it can be 200px wide and 50px tall', 'ym'), 'type' => 'url');
     $options[] = array('name' => 'slim_gateway', 'label' => __('Slim Gateway', 'ym'), 'caption' => __('You can hide the Prominent Login Options', 'ym'), 'type' => 'yesno');
     $options[] = array('name' => 'cancel_url', 'label' => __('Cancel URL', 'ym'), 'caption' => __('On Payment Cancel return to this URL', 'ym'), 'type' => 'url');
     return $options;
 }
<?php

/*
* $Id: ym-advanced-payment_gateway_email.php 2297 2012-08-09 13:30:50Z bcarlyon $
* $Revision: 2297 $
* $Date: 2012-08-09 14:30:50 +0100 (Thu, 09 Aug 2012) $
*/
global $ym_formgen, $ym_res, $ym_sys;
if (ym_post('msgs_update')) {
    $ym_res->update_from_post();
    ym_display_message(__('Messages Saved', 'ym'));
    do_action('ym-advanced-payment_gateway_email_save');
}
?>
<div class="wrap" id="poststuff">
<form action="" method="post">

<div id="ym_messages">
<ul>
	<li><a href="#ym_payment_gateway_base"><?php 
echo __('Payment Gateway Base Emails', 'ym');
?>
</a></li>
	<?php 
do_action('ym-advanced-payment_gateway_email_tabs');
?>
	<li><a href="#ym_payment_gateway_copy_to"><?php 
echo __('Payment Gateway Base Emails CC/BCC', 'ym');
?>
</a></li>
</ul>
function ym_check_for_gift_sub()
{
    global $wpdb;
    // gift sub
    if (ym_post('submit')) {
        if (ym_post('post_id')) {
            $sql = 'SELECT COUNT(id)
								FROM ' . $wpdb->prefix . 'posts_purchased
								WHERE
										user_id = ' . ym_post('user_id') . '
										AND post_id = ' . ym_post('post_id');
            if (!$wpdb->get_var($sql)) {
                $sql = 'INSERT INTO ' . $wpdb->prefix . 'posts_purchased (user_id, post_id, unixtime)
								VALUES (' . $_POST['user_id'] . ', ' . $_POST['post_id'] . ', UNIX_TIMESTAMP())';
                $wpdb->query($sql);
                ym_display_message(__('Post has been successfully gifted', 'ym'));
            } else {
                ym_display_message(__('User has already purchased that post', 'ym'), 'error');
            }
        } else {
            ym_display_message(__('Please select a post to gift before submitting the form', 'ym'), 'error');
        }
    }
    if (ym_get('delete')) {
        $sql = 'DELETE FROM ' . $wpdb->prefix . 'posts_purchased
							WHERE id=' . $_GET['delete'];
        if ($wpdb->query($sql)) {
            ym_display_message(__('Purchased post has been successfully deleted', 'ym'));
        }
    }
    // end
}
<?php

global $ym_formgen, $ym_res, $ym_sys;
$full_protect_options = array(0 => 'Flexible', 1 => 'Full');
if (isset($_POST['settings_update']) && !empty($_POST['settings_update'])) {
    $ym_sys->update_from_post();
    update_option('ym_sys', $ym_sys);
    ym_display_message(__('System Updated', 'ym'));
}
$roles = new WP_Roles();
$roles_array = $roles->role_names;
echo '<div class="wrap" id="poststuff">
<form action="" method="post">
';
echo ym_box_top(__('Content Protection Settings', 'ym'));
//$selected = $ym_sys->ym_hide_posts ? 2 : ($ym_sys->magic_mode ? 1 : 0);
echo '<table class="form-table">';
echo $ym_formgen->render_combo_from_array_row(__('Post Protection', 'ym'), 'protect_mode', $full_protect_options, $ym_sys->protect_mode);
echo '</table>';
echo '<p>' . __('<strong>Flexible</strong> is the default option, allowing multiple private tags within the content, and will not redirect', 'ym') . '</p>';
echo '<p>' . __('<strong>Full</strong> Protects the entire the content, redirecting to a location if access is not permitted to the post.', 'ym') . '</p>';
// permanent loop occurs when the page looping to has tags on
echo '
<table class="form-table">
<tr>
	<th>' . __('Logged out user No Access URL', 'ym') . '<div style="color: gray; margin-top: 5px; font-size: 11px;">' . __('If not a valid permalink to a page, a permanent loop can occur', 'ym') . '</div></th>
	<td>' . site_url() . '
		<input class="ym_input" name="no_access_redirect_lo" value="' . $ym_sys->no_access_redirect_lo . '" style="width: 400px;" />
	</td>
</tr>
<tr>
Beispiel #23
0
 function load_options()
 {
     ym_display_message(__('You need to have Dynamic Pricing Enabled on your Account, and have obtained the MD5 Salt Value, both can be done via Client Support.', 'ym'), 'updated');
     ym_display_message(__('You need to have User Management Off and PostBack Disabled, we use WebHooks', 'ym'), 'updated');
     ym_display_message(sprintf(__('Under Webhooks for your Sub Account, add a Webhook of URL %s with NewSaleSuccess NewSaleFailiure,Cancellation,RenewalSuccess,RenewalFailiure checked', 'ym'), site_url()), 'updated');
     ym_display_message(__('Form IDs can be obtained from the Form Admin->View All Forms->Select Form Column inside CCBill or from the Forms box from the General Sub Account Info Area, the Name Column', 'ym'), 'updated');
     ym_display_message(__('Without special intervention from CCBill Client Support, <strong>you can only use packages of 1 2 or 3 month periods</strong>, periods are in days, so a month is am multple of 30 days. If you choose years the multiple is 365, but CCBill may allow yearly subscriptions but not more than 1 year.', 'ym'), 'updated');
     $options = array();
     $options[] = array('name' => 'clientAccnum', 'label' => __('Client Account Number', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'clientSubacc', 'label' => __('Sub Account Number', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'md5salt', 'label' => __('MD5 Salt', 'ym'), 'caption' => __('This can be obtained from Client Support and is required', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'formname', 'label' => __('Form Name', 'ym'), 'caption' => __('The form template code to use', 'ym'), 'type' => 'text');
     return $options;
 }
Beispiel #24
0
 function load_options()
 {
     ym_display_message(sprintf(__('IPN Required: Login to <a href="https://www.2checkout.com/va/" target="_blank">https://www.2checkout.com/va/</a> click notifications, use this for the Global URL <strong>%s</strong> select <strong>Apply</strong> and then <strong>Enable All Notifications</strong> and <strong>Save Settings</strong>', 'ym'), site_url('?ym_process=' . $this->code)), 'updated');
     ym_display_message(__('We cannot send over the <strong>Currency</strong>, please make sure you set the Correct Currency on the 2Checkout Admin under <strong>Account</strong>, <strong>Site Management</strong>', 'ym'), 'updated');
     ym_display_message(__('You can use either of the three <strong>Direct Return</strong> Options, the first option shows a Receipt style page, the other two auto return', 'ym'), 'updated');
     ym_display_message(__('You can allow people to cancel their subscription from your site by Providing a API Username and Password, created under <strong>User Management</strong>', 'ym'), 'updated');
     $options = array();
     $options[] = array('name' => 'merchant_sid', 'label' => __('Your Merchant ID', 'ym'), 'caption' => __('2CO Account #', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'secret_word', 'label' => __('Your Secret Word', 'ym'), 'caption' => __('Apply a Secret Word to help verify response from 2Checkout are Valid. Secret Word can be set in the <strong>Site Management</strong> under Account', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'api_user', 'label' => __('Your API User Name', 'ym'), 'caption' => __('If Present Cancel from Site is enabled', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'api_pass', 'label' => __('Your API User Password', 'ym'), 'caption' => __('If Present Cancel from Site is enabled', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'lang', 'label' => __('Language', 'ym'), 'caption' => '', 'type' => 'select', 'options' => array('zh' => __('Chinese', 'ym'), 'da' => __('Danish', 'ym'), 'fr' => __('French', 'ym'), 'gr' => __('German', 'ym'), 'el' => __('Greek', 'ym'), 'it' => __('Italian', 'ym'), 'jp' => __('Japanese', 'ym'), 'no' => __('Norwegian', 'ym'), 'pt' => __('Portuguese', 'ym'), 'sl' => __('Slovenian', 'ym'), 'es_ib' => __('Spanish (European)', 'ym'), 'es_la' => __('Spanish (Latin)', 'ym'), 'sv' => __('Swedish', 'ym'), 'en' => __('English', 'ym')));
     $options[] = array('name' => 'skip_landing', 'label' => __('Skip Cart Page', 'ym'), 'caption' => '', 'type' => 'yesno');
     $options[] = array('name' => 'status', 'label' => __('Mode', 'ym'), 'caption' => '', 'type' => 'status');
     $options[] = array('name' => 'cancel_url', 'label' => __('Cancel URL', 'ym'), 'caption' => __('On Payment Cancel return to this URL', 'ym'), 'type' => 'url');
     return $options;
 }
Beispiel #25
0
 function load_options()
 {
     ym_display_message(sprintf(__('You need to set the "<strong>Payment Response URL</strong>" in your WorldPay Installation Interface to one of the following: %s', 'ym'), '<ul><li><input type="text" value="<wpdisplay item=MC_callback>" style="width: 400px;" /></li><li><input type="text" value="' . site_url('?ym_process=' . $this->code) . '" style="width: 400px;" /></li></ul>'), 'updated');
     ym_display_message(__('For iAdmin you need WorldPay Support to create an installtion specifically for this, WorldPay Support will provide the Admin Password for this to Apply Below', 'ym'), 'updated');
     $options = array();
     $options[] = array('name' => 'inst_id', 'label' => __('Installation ID', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'callbackPW', 'label' => __('Payment Response Password', 'ym'), 'caption' => __('Called: "Payment Response password" in the WorldPay Installation Editor, optional, use to increase security', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'md5_sig', 'label' => __('MD5 Secret for Transactions', 'ym'), 'caption' => __('Called: "MD5 secret for transactions" in the WorldPay Installation Editor, optional, use to increase security', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'status', 'label' => __('Mode', 'ym'), 'caption' => '', 'type' => 'status');
     $options[] = array('name' => 'preauth', 'label' => __('Auth Mode', 'ym'), 'caption' => __('Set the authMode this should match your settings in WorldPay and will be A or E'), 'type' => 'select', 'options' => array('A' => __('A - Full Auth'), 'E' => __('E - Pre Auth')));
     $options[] = array('name' => 'iadmin_inst_id', 'label' => __('iAdmin Installation ID', 'ym'), 'caption' => __('This will allow, subscribers to cancel a subscription within YourMembers', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'remotePW', 'label' => __('Remote Admin PW', 'ym'), 'caption' => __('When you create a iAdmin installation, you will also be given a Password, place that here', 'ym'), 'type' => 'text');
     $options[] = array('name' => 'cancel_url', 'label' => __('Cancel URL', 'ym'), 'caption' => __('On Payment Cancel return to this URL', 'ym'), 'type' => 'url');
     return $options;
 }
Beispiel #26
0
 function load_options()
 {
     ym_display_message(__('You will need to create a site in <strong>Website Management</strong>, select Manual Installtion as the Installation Option', 'ym'), 'updated');
     ym_display_message(sprintf(__('After creation, you will be able to update/create the ZScript URL, use <strong>%s</strong> do not <strong>Validate</strong>, you need to copy the <strong>Site ID</strong> and <strong>Zombaio GW Pass</strong> into the relevant fields below, then you can validate and save the ZScript URL', 'ym'), site_url()), 'updated');
     $options = array();
     $options[] = array('name' => 'site_id', 'label' => __('Zombaio Site ID', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'gw_pass', 'label' => __('Gateway Password', 'ym'), 'caption' => '', 'type' => 'text');
     $options[] = array('name' => 'language', 'label' => __('Language', 'ym'), 'caption' => '', 'type' => 'select', 'options' => array('ZOM' => __('Default Language, based on IP', 'ym'), 'US' => __('United States', 'ym'), 'FR' => __('French', 'ym'), 'DE' => __('German', 'ym'), 'IT' => __('Italian', 'ym'), 'JP' => __('Japanese', 'ym'), 'ES' => __('Spanish', 'ym'), 'SE' => __('Swedish', 'ym'), 'KR' => __('Korean', 'ym'), 'CH' => __('Traditional Chinese', 'ym'), 'HK' => __('Simplified Chinese', 'ym')));
     $options[] = array('name' => 'use_password', 'label' => __('Use Returned Password', 'ym'), 'caption' => __('Users can create a password on the Zombaio interface which we can then use as the users WordPress password', 'ym'), 'type' => 'select', 'options' => array(0 => __('No', 'ym'), 1 => __('Yes', 'ym')));
     $options[] = array('name' => 'seal_code', 'label' => __('Seal Code', 'ym'), 'caption' => sprintf(__('Put your Seal Code here, and then use the shortcode [ym_zombaio_seal] to display your Seal. To find your Seal see: <a href="%s" target="_blank">Our Guide</a>', 'ym'), 'http://www.yourmembers.co.uk/the-support/guides-tutorials/zombaio-payment-gateway/'), 'type' => 'textarea');
     $options[] = array('name' => 'decline_url', 'label' => __('Decline URL', 'ym'), 'caption' => __('On Payment Declined return to this URL', 'ym'), 'type' => 'url');
     $options[] = array('name' => 'bypass_ipn_ip_verification', 'label' => __('Bypass IPN IP Verification', 'ym'), 'caption' => '', 'type' => 'yesno');
     return $options;
 }
</script>
';
        return;
    }
    if ($posts = ym_post('posts')) {
        foreach ($posts as $post_id) {
            $string = ym_post('account_types_' . $post_id);
            $string = $string ? $string : array();
            $account_type_string = implode(';', $string);
            ym_mass_post_do_post($post_id, $account_type_string, $hide_posts, $update_count, $private_count);
        }
    }
    if ($update_count || $private_count) {
        ym_display_message(__('Successfully setup YM data for ' . $update_count . ' Posts/Pages' . (!$hide_posts ? ' of which ' . $private_count . ' have had private tags added' : ''), 'ym'));
    } else {
        ym_display_message(__('Please select at least one post or page to setup/nothing was changed/updated', 'ym'), 'error');
    }
}
global $ym_package_types;
echo '<div class="wrap" id="poststuff">';
echo '<form method="post">';
echo '
<div id="masspostsetuptabs">
<ul>
';
$types = get_post_types();
foreach ($types as $type) {
    if (!in_array($type, $ym_custom_post_types_ignores)) {
        echo '<li><a href="#masspostsetup_' . $type . '">' . ucwords($type) . '</a></li>';
    }
}