本文整理汇总了PHP中MDJM函数的典型用法代码示例。如果您正苦于以下问题:PHP MDJM函数的具体用法?PHP MDJM怎么用?PHP MDJM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MDJM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings for version 1.2.4');
$mdjm_paypal_settings = get_option('mdjm_paypal_settings');
$mdjm_payment_settings = get_option('mdjm_payment_settings');
$mdjm_clientzone_settings = get_option('mdjm_clientzone_settings');
// Set the payment gateway - PayPal or none
if (!empty($mdjm_paypal_settings['enable_paypal'])) {
$mdjm_payment_settings['payment_gateway'] = 'paypal';
} else {
$mdjm_payment_settings['payment_gateway'] = false;
}
// Remove the enable PayPal setting as no longer required
unset($mdjm_paypal_settings['enable_paypal']);
// Setup PayFast default options
$mdjm_payfast_settings = array('merchant_id' => '', 'merchant_key' => '', 'email_confirmation' => get_bloginfo('admin_email'), 'redirect_pf_success' => !empty($mdjm_paypal_settings['redirect_success']) ? $mdjm_paypal_settings['redirect_success'] : 'N', 'redirect_pf_cancel' => !empty($mdjm_paypal_settings['redirect_cancel']) ? $mdjm_paypal_settings['redirect_cancel'] : 'N', 'payfast_button' => 'paynow_basic_logo.gif', 'enable_pf_sandbox' => false, 'sandbox_merchant_id' => '', 'sandbox_merchant_key' => '', 'payfast_debug' => false);
// Add the notification to admin on event status change setting
$mdjm_clientzone_settings['mdjm_clientzone_settings'] = true;
update_option('mdjm_paypal_settings', $mdjm_paypal_settings);
update_option('mdjm_payfast_settings', $mdjm_payfast_settings);
update_option('mdjm_payment_settings', $mdjm_payment_settings);
update_option('mdjm_clientzone_settings', $mdjm_clientzone_settings);
$status = get_option('__mydj_validation');
if ($status['key'] == 'XXXX' || ($status['type'] = 'trial' || time() >= strtotime($status['expire']))) {
add_option('mdjm_price_warn', 1, '', 'yes');
}
MDJM()->debug->log_it('Settings Updated');
}
示例2: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings for version 1.2.3.3');
if (!get_option('m_d_j_m_has_initiated')) {
add_option('m_d_j_m_has_initiated', current_time('timestamp'));
}
MDJM()->debug->log_it('Settings Updated');
}
示例3: update_settings
function update_settings()
{
$payment_settings = get_option('mdjm_payment_settings');
MDJM()->debug->log_it('Updating Payment settings', false);
$payment_settings['deposit_type'] = false;
$payment_settings['deposit_amount'] = '50.00';
update_option('mdjm_payment_settings', $payment_settings);
}
示例4: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings for version 1.2.7');
// Update the Availability Checker settings and set default settings for Unavailable Status
$mdjm_availability_settings = get_option('mdjm_availability_settings');
$mdjm_availability_settings['availability_status'] = array('mdjm-enquiry', 'mdjm-contract', 'mdjm-approved');
update_option('mdjm_availability_settings', $mdjm_availability_settings);
MDJM()->debug->log_it('Settings Updated');
}
示例5: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings');
// Add the enable playlist setting option and enable by default
$playlist_settings = get_option('mdjm_playlist_settings');
$playlist_settings['enable_playlists'] = true;
update_option('mdjm_playlist_settings', $playlist_settings);
MDJM()->debug->log_it('Settings Updated');
}
示例6: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings for version 1.2.4.1');
$status = get_option('__mydj_validation');
if ($status['key'] == 'XXXX' || ($status['type'] = 'trial' || time() >= strtotime($status['expire']))) {
add_option('mdjm_price_warn', 1, '', 'yes');
}
MDJM()->debug->log_it('Settings Updated');
}
示例7: create_template
function create_template()
{
MDJM()->debug->log_it('Adding quote template for version 1.2.3.3');
include MDJM_PLUGIN_DIR . '/includes/admin/mdjm-templates.php';
if (wp_insert_post($online_quote_template_args)) {
MDJM()->debug->log_it(' Online Quote template created successfully');
} else {
MDJM()->debug->log_it(' Online Quote template was not created');
}
MDJM()->debug->log_it('Quote template added');
}
示例8: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings for version 1.2.3.6');
$mdjm_paypal_settings = get_option('mdjm_paypal_settings');
$mdjm_payment_settings = get_option('mdjm_payment_settings');
$mdjm_paypal_settings['button_text'] = __('Pay Now', 'mobile-dj-manager');
// Customised HTML button text for payments
$mdjm_payment_settings['other_amount_label'] = __('Other Amount', 'mobile-dj-manager');
// Customised text for other amoun radio field
update_option('mdjm_paypal_settings', $mdjm_paypal_settings);
update_option('mdjm_payment_settings', $mdjm_payment_settings);
MDJM()->debug->log_it('Settings Updated');
}
示例9: remove_deprecated_db_tables
/**
* Remove deprecated DB tables
*
*
*
*
*/
function remove_deprecated_db_tables()
{
global $wpdb;
MDJM()->debug->log_it('Removing deprecated DB tables');
$tables = array('Events' => $wpdb->prefix . 'mdjm_events', 'Music Library' => $wpdb->prefix . 'mdjm_music_library', 'Transactions' => $wpdb->prefix . 'mdjm_trans', 'Journal' => $wpdb->prefix . 'mdjm_journal');
foreach ($tables as $table_display => $table_name) {
$results = $wpdb->get_results("SHOW TABLES LIKE '" . $table_name . "'");
if ($results) {
$wpdb->query('DROP TABLE IF EXISTS ' . $table_name);
MDJM()->debug->log_it($table_name . ' Removed');
}
}
MDJM()->debug->log_it('Completed removing deprecated DB tables');
}
示例10: update_playlist
function update_playlist()
{
global $wpdb;
MDJM()->debug->log_it('Updating playlist entries');
$query = "SELECT * FROM " . MDJM_PLAYLIST_TABLE . " WHERE `date_to_mdjm` IS NOT NULL AND `date_to_mdjm` != '' AND `date_to_mdjm` != '0000-00-00 00:00:00' ORDER BY `event_id`";
$records = $wpdb->get_results($query);
$rows = $wpdb->num_rows;
MDJM()->debug->log_it($rows . ' ' . _n('record ', 'records ', $rows) . ' to update');
if ($rows > 0) {
$i = 0;
foreach ($records as $record) {
$wpdb->update(MDJM_PLAYLIST_TABLE, array('upload_procedure' => '1'), array('id' => $record->id));
$i++;
}
MDJM()->debug->log_it($i . ' ' . _n('record ', 'records ', $rows) . ' updated');
} else {
MDJM()->debug->log_it('No records to update');
}
}
示例11: update_settings
function update_settings()
{
MDJM()->debug->log_it('Updating Settings for version 1.2.5');
// Copy the payment gateway settings over the the MDJM PG addon even if it is not installed yet
$mdjm_paypal_settings = get_option('mdjm_paypal_settings');
$mdjm_payfast_settings = get_option('mdjm_payfast_settings');
if (!empty($mdjm_paypal_settings)) {
update_option('mdjm_pg_paypal', $mdjm_paypal_settings);
}
if (!empty($mdjm_payfast_settings)) {
update_option('mdjm_pg_payfast', $mdjm_payfast_settings);
}
// Now delete the options from the MDJM Settings
delete_option('mdjm_paypal_settings');
delete_option('mdjm_payfast_settings');
// Delete no longer required settings
delete_option('__mydj_validation');
delete_option('m_d_j_m_has_initiated');
delete_option('mdjm_pp_options');
delete_option('mdjm_price_warn');
MDJM()->debug->log_it('Settings Updated');
}
示例12: update_profile
function update_profile()
{
global $mdjm, $current_user;
MDJM()->debug->log_it('Starting user profile update for user ' . $current_user->display_name, true);
// Firstly, our security check
if (!isset($_POST['__mdjm_user']) || !wp_verify_nonce($_POST['__mdjm_user'], 'manage_client_profile')) {
MDJM()->debug->log_it('Security verification failed during update. No update occured', false);
return parent::display_message(4, 4);
} else {
// Set our variables for updating
$update_fields = array('ID' => $current_user->ID);
$update_meta = array();
// Process the standard fields
$update_fields['first_name'] = sanitize_text_field(ucfirst($_POST['first_name']));
$update_fields['last_name'] = sanitize_text_field(ucfirst($_POST['last_name']));
$update_fields['user_email'] = sanitize_email($_POST['user_email']);
// Now the custom fields
foreach ($this->fields as $field) {
if (!isset($field['required']) || empty($field['display'])) {
continue;
}
if ($field['type'] == 'text' || $field['type'] == 'dropdown') {
$update_meta[$field['id']] = !empty($_POST[$field['id']]) ? sanitize_text_field($_POST[$field['id']]) : '';
}
if ($field['type'] == 'checkbox') {
$update_meta[$field['id']] = !empty($_POST[$field['id']]) ? $_POST[$field['id']] : '0';
}
}
// Password Reset Validation if required
if (!empty($_POST['new_password']) && $_POST['new_password'] != $_POST['new_password_confirm']) {
$pass_error = true;
}
if (!empty($_POST['new_password']) && $_POST['new_password'] == $_POST['new_password_confirm']) {
$update_fields['user_pass'] = $_POST['new_password'];
}
// Process field updates starting with custom fields
foreach ($update_meta as $meta_key => $meta_value) {
if (update_user_meta($current_user->ID, $meta_key, $meta_value)) {
MDJM()->debug->log_it('Success: User profile field ' . $meta_key . ' updated with value ' . $meta_value, false);
} else {
MDJM()->debug->log_it('Failure: User profile field ' . $meta_key . ' could not be updated with value ' . $meta_value, false);
}
}
// And now built-in fields
$user_id = wp_update_user($update_fields);
// If we changed the password, we need to logout
if (isset($update_fields['user_pass'])) {
MDJM()->debug->log_it('User password was changed. Logging user out', false);
wp_logout();
?>
<script type="text/javascript">
window.location.replace("<?php
echo mdjm_get_formatted_url(mdjm_get_option('profile_page'));
?>
");
</script>
<?php
exit;
}
// We're done
if (is_wp_error($user_id)) {
parent::display_notice(4, 'Unable to update your profile. ' . $user_id->get_error_message());
} else {
parent::display_notice(2, 'Your profile has been updated successfully');
}
if (isset($pass_error) && $pass_error == true) {
parent::display_notice(4, 'Unable to change your password. Check the password\'s you entered match!');
}
}
}
示例13: mdjm_reports_tab_export
/**
* Renders the 'Export' tab on the Reports Page
*
* @since 1.4
* @return void
*/
function mdjm_reports_tab_export()
{
if (!mdjm_employee_can('run_reports')) {
wp_die(__('You do not have permission to export reports', 'mobile-dj-manager'), __('Error', 'mobile-dj-manager'), array('response' => 403));
}
$label_single = mdjm_get_label_singular();
$label_plural = mdjm_get_label_plural();
?>
<div id="mdjm-dashboard-widgets-wrap">
<div class="metabox-holder">
<div id="post-body">
<div id="post-body-content">
<?php
do_action('mdjm_reports_tab_export_content_top');
?>
<div class="postbox mdjm-export-events-earnings">
<h3><span><?php
_e('Export Transaction History', 'mobile-dj-manager');
?>
</span></h3>
<div class="inside">
<p><?php
_e('Download a CSV of all transactions recorded.');
?>
</p>
<form id="mdjm-export-txns" class="mdjm-export-form mdjm-import-export-form" method="post">
<?php
mdjm_insert_datepicker(array('id' => 'mdjm-txn-export-start', 'altfield' => 'txn_start'));
?>
<?php
echo MDJM()->html->date_field(array('id' => 'mdjm-txn-export-start', 'name' => 'display_start_date', 'placeholder' => __('Select Start Date', 'mobile-dj-manager')));
?>
<?php
echo MDJM()->html->hidden(array('name' => 'txn_start'));
?>
<?php
mdjm_insert_datepicker(array('id' => 'mdjm-txn-export-end', 'altfield' => 'txn_end'));
?>
<?php
echo MDJM()->html->date_field(array('id' => 'mdjm-txn-export-end', 'name' => 'display_end_date', 'placeholder' => __('Select End Date', 'mobile-dj-manager')));
?>
<?php
echo MDJM()->html->hidden(array('name' => 'txn_end'));
?>
<select name="txn_status">
<option value=""><?php
_e('All Statuses', 'mobile-dj-manager');
?>
</option>
<option value="Completed"><?php
_e('Completed', 'mobile-dj-manager');
?>
</option>
<option value="Pending"><?php
_e('Pending', 'mobile-dj-manager');
?>
</option>
<option value="Cancelled"><?php
_e('Cancelled', 'mobile-dj-manager');
?>
</option>
</select>
<?php
wp_nonce_field('mdjm_ajax_export', 'mdjm_ajax_export');
?>
<input type="hidden" name="mdjm-export-class" value="MDJM_Batch_Export_Txns"/>
<span>
<input type="submit" value="<?php
_e('Generate CSV', 'mobile-dj-manager');
?>
" class="button-secondary"/>
<span class="spinner"></span>
</span>
</form>
</div><!-- .inside -->
</div><!-- .postbox -->
<div class="postbox mdjm-export-events">
<h3><span><?php
printf(__('Export %s', 'mobile-dj-manager'), $label_plural);
?>
</span></h3>
<div class="inside">
<p><?php
printf(__('Download a CSV of %s data.'), $label_plural);
?>
</p>
<form id="mdjm-export-events" class="mdjm-export-form mdjm-import-export-form" method="post">
<?php
mdjm_insert_datepicker(array('id' => 'mdjm-event-export-start', 'altfield' => 'event_start'));
?>
<?php
//.........这里部分代码省略.........
示例14: mdjm_email_manual_payment_confirmation
/**
* Email the manual payment confirmation to the client from a customisable email template.
*
* @since 1.3
* @param int $event_id The event ID
* @return void
*/
function mdjm_email_manual_payment_confirmation($event_id)
{
if (!mdjm_get_option('manual_payment_cfm_template')) {
return;
}
$mdjm_event = mdjm_get_event($event_id);
$from_name = mdjm_email_set_from_name('manual_payment', $mdjm_event);
$from_name = apply_filters('mdjm_email_from_name', $from_name, 'manual_payment', $mdjm_event);
$from_email = mdjm_email_set_from_address('manual_payment', $mdjm_event);
$from_email = apply_filters('mdjm_email_from_address', $from_email, 'manual_payment', $mdjm_event);
$client = get_userdata($mdjm_event->client);
$to_email = $client->user_email;
$subject = mdjm_email_set_subject(mdjm_get_option('manual_payment_cfm_template', false));
$subject = apply_filters('mdjm_manual_payment_subject', wp_strip_all_tags($subject));
$subject = mdjm_do_content_tags($subject, $event_id, $mdjm_event->client);
$attachments = apply_filters('mdjm_manual_payment_attachments', array(), $mdjm_event);
$message = mdjm_get_email_template_content(mdjm_get_option('manual_payment_cfm_template', false));
$message = mdjm_do_content_tags($message, $event_id, $mdjm_event->client);
$emails = MDJM()->emails;
$emails->__set('event_id', $mdjm_event->ID);
$emails->__set('from_name', $from_name);
$emails->__set('from_address', $from_email);
$headers = apply_filters('mdjm_manual_payment_headers', $emails->get_headers(), $event_id, $mdjm_event->client);
$emails->__set('headers', $headers);
$emails->__set('track', apply_filters('mdjm_track_email_manual_payment', mdjm_get_option('track_client_emails')));
if (mdjm_get_option('bcc_admin_to_client')) {
$emails->__set('copy_to', array(mdjm_get_option('system_email')));
}
$emails->send($to_email, $subject, $message, $attachments, sprintf(__('Payment received confirmation for %s', 'mobile-dj-manager'), mdjm_get_label_singular()));
}
示例15: add_journal
public function add_journal($data, $meta)
{
global $mdjm, $post;
if (MDJM_JOURNAL != true) {
if (MDJM_DEBUG == true) {
MDJM()->debug->log_it('ERROR: Instructed to Journal whilst Journalling is disabled');
}
return;
}
if (empty($data['comment_content'])) {
if (MDJM_DEBUG == true) {
MDJM()->debug->log_it('ERROR: Missing Comment Contents in ' . __FUNCTION__, true);
}
return false;
}
if (empty($meta['type'])) {
if (MDJM_DEBUG == true) {
MDJM()->debug->log_it('ERROR: Missing Comment Type in ' . __FUNCTION__, true);
}
return false;
}
/* -- Disable Comment Flood Prevention -- */
add_filter('comment_flood_filter', '__return_false');
$event_id = !empty($data['event']) ? $data['event'] : $post->ID;
if (empty($event_id)) {
if (MDJM_DEBUG == true) {
MDJM()->debug->log_it('ERROR: Missing event id in ' . __FUNCTION__, true);
}
return false;
}
/* -- Set the content -- */
if (isset($data['user'])) {
$commenter = get_userdata($data['user']);
} else {
$commenter = 'mdjm';
}
$comment_data = array('comment_post_ID' => (int) $event_id, 'comment_author' => $commenter != 'mdjm' ? $commenter->display_name : '', 'comment_author_email' => $commenter != 'mdjm' ? $commenter->user_email : '', 'comment_author_IP' => !empty($_SERVER['REMOTE_ADDR']) ? preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']) : '', 'comment_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? substr($_SERVER['HTTP_USER_AGENT'], 0, 254) : '', 'comment_author_url' => $commenter != 'mdjm' ? !empty($commenter->user_url) ? $commenter->user_url : '' : '', 'comment_content' => $data['comment_content'] . ' (' . time() . ')', 'comment_type' => !empty($data['comment_type']) ? $data['comment_type'] : 'mdjm-journal', 'comment_date' => !empty($data['comment_date']) ? $data['comment_date'] : current_time('mysql'), 'user_id' => $commenter != 'mdjm' ? $commenter->ID : '0', 'comment_parent' => 0, 'comment_approved' => 1);
// Filter the comment data before inserting
$comment_data = apply_filters('preprocess_comment', $comment_data);
$comment_data = wp_filter_comment($comment_data);
/* -- Disable comment duplication check filter -- */
remove_filter('commentdata', 'comment_duplicate_trigger');
/* -- Insert the entry -- */
$comment_id = wp_insert_comment($comment_data);
if (empty($comment_id)) {
return false;
}
/* -- Set the meta -- */
$comment_meta = array('mdjm_type' => $meta['type'], 'mdjm_visibility' => !empty($meta['visibility']) ? $meta['visibility'] : '0', 'mdjm_notify' => !empty($meta['notify']) ? $meta['notify'] : '', 'mdjm_to' => !empty($meta['to']) ? $meta['to'] : '', 'mdjm_isread' => !empty($meta['isread']) ? $meta['isread'] : '');
/* -- Insert the meta -- */
foreach ($comment_meta as $key => $value) {
if (!empty($value)) {
add_comment_meta($comment_id, $key, $value, false);
}
}
/* -- Enable comment filter -- */
add_filter('commentdata', 'comment_duplicate_trigger');
return $comment_id;
}