本文整理汇总了PHP中mdjm_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP mdjm_get_option函数的具体用法?PHP mdjm_get_option怎么用?PHP mdjm_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mdjm_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mdjm_get_enquire_now_button
/**
* Generates an enquire now button.
*
* @since 1.4
* @param arr Array of arguments. See @defaults.
* @return str Enquire Now HTML button
*/
function mdjm_get_enquire_now_button($args)
{
$defaults = array('type' => 'package', 'id' => 0);
$args = wp_parse_args($args, $defaults);
$label = esc_html(mdjm_get_option('package_contact_btn_text', __('Enquire Now', 'mobile-dj-manager')));
$label = apply_filters('mdjm_enquire_now_' . $args['type'] . '_label', $label);
$name = 'mdjm-' . $args['type'] . '-enquiry-button';
$class = 'mdjm_' . $args['type'] . '_enquiry_button';
$value = 'test';
ob_start();
?>
<a href="<?php
echo mdjm_get_formatted_url(mdjm_get_option('contact_page')) . $args['type'] . '=' . $args['id'];
?>
">
<button type="button" name="<?php
echo $name;
?>
" class="<?php
echo $class;
?>
" formmethod="get" value="test"><?php
echo $label;
?>
</button>
</a>
<?php
$enquire_link = ob_get_clean();
return apply_filters('mdjm_enquire_now_' . $args['type'] . '_button', $enquire_link, $args);
}
示例2: __construct
/**
* Class constructor
*
* @param string $_file
* @param string $_item_name
* @param string $_version
* @param string $_author
* @param string $_optname
* @param string $_api_url
*/
function __construct($_file, $_item, $_version, $_author, $_optname = null, $_api_url = null)
{
$this->file = $_file;
if (is_numeric($_item)) {
$this->item_id = absint($_item);
} else {
$this->item_name = $_item;
}
$this->item_shortname = 'mdjm_' . preg_replace('/[^a-zA-Z0-9_\\s]/', '', str_replace(' ', '_', strtolower($this->item_name)));
$this->version = $_version;
$this->license = trim(mdjm_get_option($this->item_shortname . '_license_key', ''));
$this->author = $_author;
$this->api_url = is_null($_api_url) ? $this->api_url : $_api_url;
/**
* Allows for backwards compatibility with old license options,
* i.e. if the plugins had license key fields previously, the license
* handler will automatically pick these up and use those in lieu of the
* user having to reactive their license.
*/
if (!empty($_optname)) {
$opt = mdjm_get_option($_optname, false);
if (isset($opt) && empty($this->license)) {
$this->license = trim($opt);
}
}
// Setup hooks
$this->includes();
$this->hooks();
//$this->auto_updater();
}
示例3: mdjm_get_txn_protected_terms
/**
* Retrieve protected (built-in) txn terms.
*
* @since 1.3
* @param
* @return arr $protected_terms Array of protected terms
*/
function mdjm_get_txn_protected_terms()
{
$other_amount_term = get_term_by('name', mdjm_get_option('other_amount_label'), 'transaction-types');
$protected_terms = array('mdjm-balance-payments', 'mdjm-deposit-payments', 'mdjm-employee-wages', 'mdjm-merchant-fees');
if (!empty($other_amount_term)) {
$protected_terms[] = $other_amount_term->slug;
}
return apply_filters('mdjm_txn_protected_terms', $protected_terms);
}
示例4: mdjm_goto_payments_action
/**
* Redirect to payments.
*
* @since 1.3
* @param
* @return void
*/
function mdjm_goto_payments_action($data)
{
if (!isset($data['event_id'])) {
return;
}
if (!mdjm_event_exists($data['event_id'])) {
wp_die('Sorry but no event exists', 'mobile-dj-manager');
}
wp_redirect(add_query_arg('event_id', $data['event_id'], mdjm_get_formatted_url(mdjm_get_option('payments_page'))));
die;
}
示例5: mdjm_contract_details_metabox
/**
* Output for the Contract Details meta box.
*
* @since 1.3
* @param obj $post The post object (WP_Post).
* @return
*/
function mdjm_contract_details_metabox($post)
{
do_action('mdjm_pre_contract_details_metabox', $post);
wp_nonce_field(basename(__FILE__), 'mdjm-contract' . '_nonce');
$contract_events = get_posts(array('post_type' => 'mdjm-event', 'posts_per_page' => -1, 'meta_key' => '_mdjm_event_contract', 'meta_value_num' => $post->ID, 'post_status' => 'any'));
$event_count = count($contract_events);
$total_events = sprintf(_n(' %s', ' %s', $event_count), mdjm_get_label_singular(), mdjm_get_label_plural());
$default_contract = mdjm_get_option('default_contract') == $post->ID ? __('Yes') : __('No');
?>
<script type="text/javascript">
document.getElementById("title").className += " required";
document.getElementById("content").className += " required";
</script>
<p><?php
printf(__('<strong>Author</strong>: <a href="%s">%s</a>', 'mobile-dj-manager'), admin_url("user-edit.php?user_id={$post->post_author}"), get_the_author_meta('display_name', $post->post_author));
?>
</p>
<p><?php
_e('<strong>Default</strong>?', 'mobile-dj-manager');
echo ' ' . $default_contract;
?>
</p>
<p><?php
_e('<strong>Assigned To</strong>: ', 'mobile-dj-manager');
printf(_n($event_count . ' %1$s', $event_count . ' %2$s', $event_count), mdjm_get_label_singular(), mdjm_get_label_plural());
?>
</p>
<p><?php
_e('<strong>Description</strong>: <span class="description">(optional)</span>', 'mobile-dj-manager');
?>
<br />
<input type="hidden" name="mdjm_update_custom_post" id="mdjm_update_custom_post" value="mdjm_update" />
<textarea name="contract_description" id="contract_description" class="widefat" rows="5" placeholder="<?php
_e('i.e To be used for Pubs/Clubs', 'mobile-dj-manager');
?>
"><?php
echo esc_attr(get_post_meta($post->ID, '_contract_description', true));
?>
</textarea>
</p>
<?php
do_action('mdjm_post_contract_details_metabox', $post);
}
示例6: mdjm_settings_contextual_help
/**
* Settings contextual help.
*
* @since 1.3
* @return void
*/
function mdjm_settings_contextual_help()
{
$screen = get_current_screen();
if ($screen->id != 'mdjm-event_page_mdjm-settings') {
return;
}
$screen->set_help_sidebar('<p><strong>' . __('For more information:', 'mobile-dj-manager') . '</strong></p>' . '<p>' . sprintf(__('Visit the <a href="%s">documentation</a> on the MDJM Event Management website.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/support/')) . '</p>' . '<p>' . sprintf(__('Join our <a href="%s">Facebook Group</a>.', 'mobile-dj-manager'), esc_url('https://www.facebook.com/groups/mobiledjmanager/')) . '</p>' . '<p>' . sprintf(__('<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>.', 'mobile-dj-manager'), esc_url('https://github.com/mdjm/mobile-dj-manager/issues'), esc_url('https://github.com/mdjm/mobile-dj-manager/')) . '</p>' . '<p>' . sprintf(__('View <a href="%s">add-ons</a>.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/add-ons/')) . '</p>');
do_action('mdjm_pre_settings_contextual_help', $screen);
$screen->add_help_tab(array('id' => 'mdjm-settings-general', 'title' => __('General', 'mobile-dj-manager'), 'content' => '<p>' . __('This screen provides the most basic settings for configuring MDJM. Set your company name and preferred date and time format.', 'mobile-dj-manager') . '</p>'));
$screen->add_help_tab(array('id' => 'mdjm-settings-events', 'title' => mdjm_get_label_plural(), 'content' => '<p>' . sprintf(__('This screen enables to you configure options %1$s and playlists. Select your %1$s default contract template, whether or not you are an employer and enable equipment packages.', 'mobile-dj-manager') . '</p>' . '<p>' . __('You can also toggle playlists on or off, select when a playlist should close choose whether or not to upload your playlists to the MDJM servers.', 'mobile-dj-manager'), mdjm_get_label_plural(true)) . '</p>'));
$screen->add_help_tab(array('id' => 'mdjm-settings-emails-templates', 'title' => __('Emails & Templates', 'mobile-dj-manager'), 'content' => '<p>' . __('This screen allows you to adjust options for emails, toggle on or off the email tracking feature and select which templates to use as content for emails.', 'mobile-dj-manager') . '</p>'));
$screen->add_help_tab(array('id' => 'mdjm-settings-client-zone', 'title' => mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager')), 'content' => '<p>' . sprintf(__("This screen allows you to configure settings associated with the %s as well as set various pages and configure the Availability Checker.", 'mobile-dj-manager'), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager'))) . '</p>'));
$screen->add_help_tab(array('id' => 'mdjm-settings-payments', 'title' => __('Payments', 'mobile-dj-manager'), 'content' => '<p>' . __('This screen allows you to configure the payment settings. Specify your currency, format currency display, set default deposits and select whether or not to apply tax.', 'mobile-dj-manager') . '</p>'));
$screen->add_help_tab(array('id' => 'mdjm-settings-extensions', 'title' => __('Extensions', 'mobile-dj-manager'), 'content' => '<p>' . __('This screen provides access to settings added by most MDJM Event Management extensions.', 'mobile-dj-manager') . '</p>'));
$screen->add_help_tab(array('id' => 'mdjm-settings-licenses', 'title' => __('Licenses', 'mobile-dj-manager'), 'content' => '<p>' . sprintf(__('If you have any <a href="%s">MDJM Event Management paid add-ons</a> installed, this screen is where you should add the license to enable automatic updates whilst your license is valid.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/add-ons/')) . '</p>'));
do_action('mdjm_post_settings_contextual_help', $screen);
}
示例7: mdjm_employee_is_working
/**
* Determine if an employee is working on the given date.
*
* @since 1.3
* @param str $date The date
* @param int $employee The employee ID
* @param str|arr $status The employee ID
* @return bool True if the employee is working, otherwise false.
*/
function mdjm_employee_is_working($date, $employee_id = '', $status = '')
{
if (empty($employee_id) && is_user_logged_in()) {
$employee_id = get_current_user_id();
}
if (empty($employee_id)) {
wp_die(__('Ooops, an error occured.', 'mobile-dj-manager'));
}
if (empty($status)) {
$status = mdjm_get_option('availability_status', 'any');
}
$event = mdjm_get_events(array('post_status' => $status, 'posts_per_page' => 1, 'meta_key' => '_mdjm_event_date', 'meta_value' => date('Y-m-d', $date), 'meta_query' => array('relation' => 'OR', array('key' => '_mdjm_event_dj', 'value' => $employee_id, 'compare' => '=', 'type' => 'NUMERIC'), array('key' => '_mdjm_event_employees', 'value' => sprintf(':"%s";', $employee_id), 'compare' => 'LIKE'))));
$event = apply_filters('mdjm_employee_is_working', $event, $date, $employee_id);
if ($event) {
return true;
}
return false;
}
示例8: mdjm_run_update_138
/**
* Run the update procedures.
*
* @version 1.3.8
* @param
* @return.
*/
function mdjm_run_update_138()
{
$payment_label = __('Pay Now', 'mobile-dj-manager');
$gateway = mdjm_get_option('payment_gateway', false);
if (!empty($gateway)) {
if ($gateway == 'paypal') {
$button_text = mdjm_get_option('mdjm_pg_paypal_button_text');
}
if ($gateway == 'payfast') {
$button_text = mdjm_get_option('mdjm_pg_payfast_button_text');
}
if (!empty($button_text)) {
$payment_label = sanitize_text_field($button_text);
}
}
mdjm_delete_option('payment_gateway');
mdjm_update_option('payment_gateway', $gateway);
mdjm_update_option('gateways', array($gateway => '1'));
mdjm_update_option('payment_button', $payment_label);
}
示例9: mdjm_contract_posts_custom_column
/**
* Define the data to be displayed in each of the custom columns for the Contract post types
*
* @since 0.9
* @param str $column_name The name of the column to display
* @param int $post_id The current post ID
* @return
*/
function mdjm_contract_posts_custom_column($column_name, $post_id)
{
switch ($column_name) {
// Is Default?
case 'event_default':
$event_default = mdjm_get_option('default_contract');
if ($event_default == $post_id) {
echo '<span style="color: green; font-weight: bold;">' . __('Yes');
} else {
_e('No');
}
break;
// Assigned To
// Assigned To
case 'assigned':
$contract_events = get_posts(array('post_type' => 'mdjm-event', 'posts_per_page' => -1, 'meta_key' => '_mdjm_event_contract', 'meta_value' => $post_id, 'post_status' => 'any'));
$total = count($contract_events);
echo $total . sprintf(_n(' %1$s', ' %2$s', $total, 'mobile-dj-manager'), mdjm_get_label_singular(), mdjm_get_label_plural());
break;
}
// switch
}
示例10: mdjm_add_journal
/**
* Update the event journal.
*
* @since 1.3
* @param arr $data
* @param arr $meta
* @return: int|bool comment_id or false on failure
*/
function mdjm_add_journal($args = array(), $meta = array())
{
// Return if journaling is disabled.
if (!mdjm_get_option('journaling', false)) {
return false;
}
$defaults = array('user_id' => get_current_user_id(), 'event_id' => '', 'comment_content' => '', 'comment_type' => 'mdjm-journal');
$data = wp_parse_args($args, $defaults);
// Make sure we have the required data
if (empty($data['comment_content']) || empty($data['event_id'])) {
return false;
}
$comment_author = !empty($data['user_id']) ? get_userdata($data['user_id']) : 'mdjm';
$comment_data = apply_filters('mdjm_add_journal', array('comment_post_ID' => (int) $data['event_id'], 'comment_author' => $comment_author != 'mdjm' ? $comment_author->display_name : 'MDJM', 'comment_author_email' => $comment_author != 'mdjm' ? $comment_author->user_email : mdjm_get_option('system_email'), 'comment_author_IP' => '', 'comment_agent' => '', 'comment_author_url' => '', 'comment_date' => current_time('mysql'), 'comment_date_gmt' => current_time('mysql', 1), 'comment_content' => $data['comment_content'], 'comment_type' => 'mdjm-journal', 'user_id' => $comment_author != 'mdjm' ? $comment_author->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');
do_action('mdjm_pre_add_journal', $data, $meta, $comment_data);
// Insert the comment
$comment_id = wp_insert_comment($comment_data);
if (!$comment_id) {
return false;
}
$comment_meta = array('mdjm_type' => !empty($meta['type']) ? $meta['type'] : 'mdjm-journal', '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'] : '');
$comment_meta = wp_parse_args($meta, $comment_meta);
foreach ($comment_meta as $key => $value) {
if (!empty($value)) {
add_comment_meta($comment_id, $key, $value, false);
}
}
// Enable comment duplication check filter
add_filter('commentdata', 'comment_duplicate_trigger');
do_action('mdjm_post_add_journal', $data, $meta, $comment_data);
return $comment_id;
}
示例11: mdjm_sign_event_contract_action
/**
* Sign the contract.
*
* @since 1.3
* @param
* @return
*/
function mdjm_sign_event_contract_action($data)
{
// Check the password is correct
$user = wp_get_current_user();
$password_confirmation = wp_authenticate($user->user_login, $data['mdjm_verify_password']);
$data['mdjm_accept_terms'] = !empty($data['mdjm_accept_terms']) ? $data['mdjm_accept_terms'] : false;
$data['mdjm_confirm_client'] = !empty($data['mdjm_confirm_client']) ? $data['mdjm_confirm_client'] : false;
if (is_wp_error($password_confirmation)) {
$message = 'password_error';
} elseif (!wp_verify_nonce($data['mdjm_nonce'], 'sign_contract')) {
$message = 'nonce_fail';
} else {
// Setup the signed contract details
$posted = array();
foreach ($data as $key => $value) {
if ($key != 'mdjm_nonce' && $key != 'mdjm_action' && $key != 'mdjm_redirect' && $key != 'mdjm_submit_sign_contract') {
// All fields are required
if (empty($value)) {
wp_redirect(add_query_arg(array('event_id' => $data['event_id'], 'mdjm_message' => 'contract_data_missing'), mdjm_get_formatted_url(mdjm_get_option('contracts_page'))));
die;
} elseif (is_string($value) || is_int($value)) {
$posted[$key] = strip_tags(addslashes($value));
} elseif (is_array($value)) {
$posted[$key] = array_map('absint', $value);
}
}
}
if (mdjm_sign_event_contract($data['event_id'], $posted)) {
$message = 'contract_signed';
} else {
$message = 'contract_not_signed';
}
}
wp_redirect(add_query_arg(array('event_id' => $data['event_id'], 'mdjm_message' => $message), mdjm_get_formatted_url(mdjm_get_option('contracts_page'))));
die;
}
示例12: mdjm_register_taxonomies
/**
* Registers the custom taxonomies for the Event, Playlist.
* Transaction and Venue custom post types.
*
* @since 1.3
* @return void
*/
function mdjm_register_taxonomies()
{
/** Packages */
$package_category_labels = array('name' => _x('Package Category', 'taxonomy general name', 'mobile-dj-manager'), 'post_column_name' => __('Categories', 'mobile-dj-manager'), 'singular_name' => _x('Package Category', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Search Package Categories', 'mobile-dj-manager'), 'all_items' => __('All Package Categories', 'mobile-dj-manager'), 'edit_item' => __('Edit Package Category', 'mobile-dj-manager'), 'update_item' => __('Update Package Category', 'mobile-dj-manager'), 'add_new_item' => __('Add New Package Category', 'mobile-dj-manager'), 'new_item_name' => __('New Package Category', 'mobile-dj-manager'), 'menu_name' => __('Event Package Categories', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Package Categories', 'mobile-dj-manager'), 'not_found' => __('No package categories found', 'mobile-dj-manager'));
$package_category_args = apply_filters('mdjm_package_category_args', array('hierarchical' => true, 'labels' => apply_filters('mdjm_package_category_labels', $package_category_labels), 'query_var' => true, 'rewrite' => array('slug' => 'package-category'), 'capabilities' => apply_filters('mdjm_package_category_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('package-category', array('mdjm-package'), $package_category_args);
register_taxonomy_for_object_type('package-category', 'mdjm-package');
/** Addons */
$addon_category_labels = array('name' => _x('Add-on Category', 'taxonomy general name', 'mobile-dj-manager'), 'post_column_name' => __('Categories', 'mobile-dj-manager'), 'singular_name' => _x('Add-on Category', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Search Add-on Categories', 'mobile-dj-manager'), 'all_items' => __('All Add-on Categories', 'mobile-dj-manager'), 'edit_item' => __('Edit Add-on Category', 'mobile-dj-manager'), 'update_item' => __('Update Add-on Category', 'mobile-dj-manager'), 'add_new_item' => __('Add New Add-on Category', 'mobile-dj-manager'), 'new_item_name' => __('New Add-on Category', 'mobile-dj-manager'), 'menu_name' => __('Event Add-on Categories', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Add-on Categories', 'mobile-dj-manager'), 'not_found' => __('No add-ons categories found', 'mobile-dj-manager'));
$addon_category_args = apply_filters('mdjm_addon_category_args', array('hierarchical' => true, 'labels' => apply_filters('mdjm_addon_category_labels', $addon_category_labels), 'query_var' => true, 'rewrite' => array('slug' => 'addon-category'), 'capabilities' => apply_filters('mdjm_addon_category_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('addon-category', array('mdjm-addon'), $addon_category_args);
register_taxonomy_for_object_type('addon-category', 'mdjm-addon');
/** Event Types */
$event_type_labels = array('name' => _x('Event Type', 'taxonomy general name', 'mobile-dj-manager'), 'singular_name' => _x('Event Type', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Search Event Types', 'mobile-dj-manager'), 'all_items' => __('All Event Types', 'mobile-dj-manager'), 'edit_item' => __('Edit Event Type', 'mobile-dj-manager'), 'update_item' => __('Update Event Type', 'mobile-dj-manager'), 'add_new_item' => __('Add New Event Type', 'mobile-dj-manager'), 'new_item_name' => __('New Event Type', 'mobile-dj-manager'), 'menu_name' => __('Event Types', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Event Types', 'mobile-dj-manager'), 'not_found' => __('No event types found', 'mobile-dj-manager'));
$event_type_args = apply_filters('mdjm_event_type_args', array('hierarchical' => true, 'labels' => apply_filters('mdjm_event_type_labels', $event_type_labels), 'query_var' => true, 'rewrite' => array('slug' => 'event-types'), 'capabilities' => apply_filters('mdjm_event_type_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('event-types', array('mdjm-event'), $event_type_args);
register_taxonomy_for_object_type('event-types', 'mdjm-event');
/** Enquiry Sources */
$enquiry_source_labels = array('name' => _x('Enquiry Sources', 'taxonomy general name', 'mobile-dj-manager'), 'singular_name' => _x('Enquiry Source', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Search Enquiry Sources', 'mobile-dj-manager'), 'all_items' => __('All Enquiry Sources', 'mobile-dj-manager'), 'edit_item' => __('Edit Enquiry Source', 'mobile-dj-manager'), 'update_item' => __('Update Enquiry Source', 'mobile-dj-manager'), 'add_new_item' => __('Add New Enquiry Source', 'mobile-dj-manager'), 'new_item_name' => __('New Enquiry Source', 'mobile-dj-manager'), 'menu_name' => __('Enquiry Sources', 'mobile-dj-manager'), 'popular_items' => __('Most Enquiries from', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Enquiry Sources', 'mobile-dj-manager'), 'not_found' => __('No enquiry sources found', 'mobile-dj-manager'));
$enquiry_source_args = apply_filters('mdjm_enquiry_source_args', array('hierarchical' => false, 'labels' => apply_filters('mdjm_enquiry_source_labels', $enquiry_source_labels), 'description' => sprintf(__('Track how clients found %s', 'mobile-dj-manager'), mdjm_get_option('company_name', get_bloginfo('name'))), 'public' => false, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'enquiry-source'), 'capabilities' => apply_filters('mdjm_event_type_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('enquiry-source', array('mdjm-event'), $enquiry_source_args);
register_taxonomy_for_object_type('enquiry-source', 'mdjm-event');
/** Playlist Category */
$playlist_category_labels = array('name' => _x('Playlist Categories', 'taxonomy general name', 'mobile-dj-manager'), 'singular_name' => _x('Playlist Category', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Playlist Categories', 'mobile-dj-manager'), 'all_items' => __('All Playlist Categories', 'mobile-dj-manager'), 'edit_item' => __('Edit Playlist Category', 'mobile-dj-manager'), 'update_item' => __('Update Playlist Category', 'mobile-dj-manager'), 'add_new_item' => __('Add New Playlist Category', 'mobile-dj-manager'), 'new_item_name' => __('New Playlist Category', 'mobile-dj-manager'), 'menu_name' => __('Event Playlist Categories', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Playlist Categories', 'mobile-dj-manager'), 'not_found' => __('No playlist categories found', 'mobile-dj-manager'));
$playlist_category_args = apply_filters('mdjm_playlist_category_args', array('hierarchical' => true, 'labels' => apply_filters('mdjm_playlist_category_labels', $playlist_category_labels), 'query_var' => true, 'capabilities' => apply_filters('mdjm_playlist_category_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('playlist-category', array('mdjm-playlist'), $playlist_category_args);
register_taxonomy_for_object_type('playlist-category', 'mdjm-playlist');
/** Transaction Types */
$txn_type_labels = array('name' => _x('Transaction Type', 'taxonomy general name', 'mobile-dj-manager'), 'singular_name' => _x('Transaction Type', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Search Transaction Types', 'mobile-dj-manager'), 'all_items' => __('All Transaction Types', 'mobile-dj-manager'), 'edit_item' => __('Edit Transaction Type', 'mobile-dj-manager'), 'update_item' => __('Update Transaction Type', 'mobile-dj-manager'), 'add_new_item' => __('Add New Transaction Type', 'mobile-dj-manager'), 'new_item_name' => __('New Transaction Type', 'mobile-dj-manager'), 'menu_name' => __('Transaction Types', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Transaction Types', 'mobile-dj-manager'), 'not_found' => __('No transaction types found', 'mobile-dj-manager'));
$txn_type_args = apply_filters('mdjm_transaction_type_args', array('hierarchical' => true, 'labels' => apply_filters('mdjm_transaction_type_labels', $txn_type_labels), 'query_var' => true, 'rewrite' => array('slug' => 'transaction-types'), 'capabilities' => apply_filters('mdjm_transaction_type_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('transaction-types', array('mdjm-transaction'), $txn_type_args);
register_taxonomy_for_object_type('transaction-types', 'mdjm-transaction');
/** Venue Details */
$venue_details_labels = array('name' => _x('Venue Details', 'taxonomy general name', 'mobile-dj-manager'), 'singular_name' => _x('Venue Detail', 'taxonomy singular name', 'mobile-dj-manager'), 'search_items' => __('Search Venue Details', 'mobile-dj-manager'), 'all_items' => __('All Venue Details', 'mobile-dj-manager'), 'edit_item' => __('Edit Venue Detail', 'mobile-dj-manager'), 'update_item' => __('Update Venue Detail', 'mobile-dj-manager'), 'add_new_item' => __('Add New Venue Detail', 'mobile-dj-manager'), 'new_item_name' => __('New Venue Detail', 'mobile-dj-manager'), 'menu_name' => __('Venue Details', 'mobile-dj-manager'), 'separate_items_with_commas' => NULL, 'choose_from_most_used' => __('Choose from the most popular Venue Details', 'mobile-dj-manager'), 'not_found' => __('No details found', 'mobile-dj-manager'));
$venue_details_args = apply_filters('mdjm_venue_details_args', array('hierarchical' => true, 'labels' => apply_filters('mdjm_venue_details_labels', $venue_details_labels), 'query_var' => true, 'rewrite' => array('slug' => 'venue-details'), 'capabilities' => apply_filters('mdjm_venue_details_caps', array('manage_terms' => 'manage_mdjm', 'edit_terms' => 'manage_mdjm', 'delete_terms' => 'manage_mdjm', 'assign_terms' => 'mdjm_employee')), 'update_count_callback' => '_update_generic_term_count'));
register_taxonomy('venue-details', array('mdjm-venue'), $venue_details_args);
register_taxonomy_for_object_type('venue-details', 'mdjm-venue');
}
示例13: 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!');
}
}
}
示例14: mdjm_get_option
<?php
/**
* This template is used to display the header content of an email.
*
* @version 1.0
* @author Mike Howard
* @since 1.3
* @content_tag Not Supported
* @shortcodes Not Supported
*
* Do not customise this file!
* If you wish to make changes, copy this file to your theme directory /theme/mdjm-templates/email/email-header.php
*/
if (!defined('ABSPATH')) {
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php
echo mdjm_get_option('company_name');
?>
</title>
</head>
<body>
示例15: mdjm_communication_details_metabox
/**
* Output for the Communication Details meta box.
*
* @since 1.3
* @param obj $post The post object (WP_Post).
* @return
*/
function mdjm_communication_details_metabox($post)
{
do_action('mdjm_pre_communication_details_metabox', $post);
wp_nonce_field(basename(__FILE__), 'mdjm_communication' . '_nonce');
$from = get_userdata($post->post_author);
$recipient = get_userdata(get_post_meta($post->ID, '_recipient', true));
$attachments = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'number_posts' => -1, 'post_status' => 'any'));
?>
<p><?php
printf(__('<strong>Date Sent</strong>: %s', 'mobile-dj-manager'), date(mdjm_get_option('time_format', 'H:i') . ' ' . mdjm_get_option('short_date_format', 'd/m/Y'), get_post_meta($post->ID, '_date_sent', true)));
?>
</p>
<p><?php
printf(__('<strong>From</strong>: <a href="%s">%s</a>', 'mobile-dj-manager'), admin_url("/user-edit.php?user_id={$from->ID}"), $from->display_name);
?>
</p>
<p><?php
printf(__('<strong>Recipient</strong>: <a href="%s">%s</a>', 'mobile-dj-manager'), admin_url("/user-edit.php?user_id={$recipient->ID}"), $recipient->display_name);
?>
</p>
<?php
$copies = get_post_meta($post->ID, '_mdjm_copy_to', true);
if (!empty($copies)) {
?>
<p><?php
_e('<strong>Copied To</strong>: ', 'mobile-dj-manager');
?>
<?php
$i = 1;
foreach ($copies as $copy) {
$user = get_user_by('email', $copy);
if ($user) {
echo "<em>{$user->display_name}</em>";
$i++;
if ($i < count($copies)) {
echo '<br />';
}
}
}
?>
</p><?php
}
?>
<p><?php
_e('<strong>Status</strong>:', 'mobile-dj-manager');
?>
<?php
echo get_post_status_object($post->post_status)->label;
if ($post->post_status == 'opened') {
echo ' ' . date(mdjm_get_option('time_format', 'H:i') . ' ' . mdjm_get_option('short_date_format', 'd/m/Y'), strtotime($post->post_modified));
}
?>
</p>
<p><strong><?php
echo mdjm_get_label_singular();
?>
</strong>: <a href="<?php
echo get_edit_post_link(get_post_meta($post->ID, '_event', true));
?>
"><?php
echo mdjm_get_event_contract_id(stripslashes(get_post_meta($post->ID, '_event', true)));
?>
</a></p>
<?php
if (!empty($attachments)) {
$i = 1;
?>
<p><strong><?php
_e('Attachments', 'mobile-dj-manager');
?>
</strong>:<br />
<?php
foreach ($attachments as $attachment) {
echo '<a style="font-size: 11px;" href="' . wp_get_attachment_url($attachment->ID) . '">';
echo basename(get_attached_file($attachment->ID));
echo '</a>';
echo $i < count($attachments) ? '<br />' : '';
$i++;
}
?>
</p>
<?php
}
?>
//.........这里部分代码省略.........