Exemplo n.º 1
0
 /**
  * Creates a transaction
  *
  * @since 	1.3
  * @param 	arr		$data Array of attributes for a transaction. See $defaults.
  * @return	mixed	false if data isn't passed and class not instantiated for creation, or New Transaction ID
  */
 public function create($data = array(), $meta = array())
 {
     if ($this->id != 0) {
         return false;
     }
     remove_action('save_post_mdjm-transaction', 'mdjm_save_txn_post', 10, 3);
     $default_data = array('post_type' => 'mdjm-transaction', 'post_status' => 'mdjm-income', 'post_title' => __('New Transaction', 'mobile-dj-manager'), 'post_content' => '');
     $default_meta = array('_mdjm_txn_source' => mdjm_get_option('default_type', __('Cash')), '_mdjm_txn_currency' => mdjm_get_currency(), '_mdjm_txn_status' => 'Pending');
     $data = wp_parse_args($data, $default_data);
     $meta = wp_parse_args($meta, $default_meta);
     do_action('mdjm_pre_txn_create', $data, $meta);
     $id = wp_insert_post($data, true);
     if (is_wp_error($id)) {
         MDJM()->debug->log_it('ERROR: ' . $id->get_error_message());
     }
     $txn = WP_Post::get_instance($id);
     if ($txn) {
         mdjm_update_txn_meta($txn->ID, $meta);
         wp_update_post(array('ID' => $id, 'post_title' => mdjm_get_option('event_prefix') . $id, 'post_name' => mdjm_get_option('event_prefix') . $id));
     }
     do_action('mdjm_post_txn_create', $id, $data, $meta);
     add_action('save_post_mdjm-transaction', 'mdjm_save_txn_post', 10, 3);
     return $this->setup_txn($txn);
 }
Exemplo n.º 2
0
/**
 * Save the meta data for the transaction
 *
 * @since	0.7
 * @param	int		$post_id		The current post ID.
 * @param	obj		$post			The current post object (WP_Post).
 * @param	bool	$update			Whether this is an existing post being updated or not.
 * @return	void
 */
function mdjm_save_txn_post($post_id, $post, $update)
{
    global $mdjm_settings;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    if ($post->post_status == 'trash') {
        return;
    }
    if (empty($update)) {
        return;
    }
    // Permission Check
    if (!mdjm_employee_can('edit_txns')) {
        if (MDJM_DEBUG == true) {
            MDJM()->debug->log_it('PERMISSION ERROR: User ' . get_current_user_id() . ' is not allowed to edit transactions');
        }
        return;
    }
    // Remove the save post action to avoid loops
    remove_action('save_post_mdjm-transaction', 'mdjm_save_txn_post', 10, 3);
    // Fire our pre-save hook
    do_action('mdjm_before_txn_save', $post_id, $post, $update);
    $trans_type = get_term($_POST['mdjm_transaction_type'], 'transaction-types');
    // Set the post data
    $trans_data['ID'] = $post_id;
    $trans_data['post_status'] = $_POST['transaction_direction'] == 'Out' ? 'mdjm-expenditure' : 'mdjm-income';
    $trans_data['post_date'] = date('Y-m-d H:i:s', strtotime($_POST['transaction_date']));
    $trans_data['edit_date'] = true;
    $trans_data['post_author'] = get_current_user_id();
    $trans_data['post_type'] = 'mdjm-transaction';
    $trans_data['post_category'] = array($_POST['mdjm_transaction_type']);
    // Set the post meta
    $trans_meta['_mdjm_txn_status'] = sanitize_text_field($_POST['transaction_status']);
    $trans_meta['_mdjm_txn_source'] = sanitize_text_field($_POST['transaction_src']);
    $trans_meta['_mdjm_txn_total'] = $_POST['transaction_amount'];
    $trans_meta['_mdjm_txn_notes'] = sanitize_text_field($_POST['transaction_description']);
    if ($_POST['transaction_direction'] == 'In') {
        $trans_meta['_mdjm_payment_from'] = sanitize_text_field($_POST['transaction_payee']);
    } elseif ($_POST['transaction_direction'] == 'Out') {
        $trans_meta['_mdjm_payment_to'] = sanitize_text_field($_POST['transaction_payee']);
    }
    $trans_meta['_mdjm_txn_currency'] = mdjm_get_currency();
    // Update the post
    if (MDJM_DEBUG == true) {
        MDJM()->debug->log_it('Updating the transaction');
    }
    wp_update_post($trans_data);
    // Set the transaction Type
    if (MDJM_DEBUG == true) {
        MDJM()->debug->log_it('Setting the transaction type');
    }
    wp_set_post_terms($post_id, $_POST['mdjm_transaction_type'], 'transaction-types');
    // Add the meta data
    if (MDJM_DEBUG == true) {
        MDJM()->debug->log_it('Updating the transaction post meta');
    }
    // Loop through the post meta and add/update/delete the meta keys.
    foreach ($trans_meta as $meta_key => $new_meta_value) {
        $current_meta_value = get_post_meta($post_id, $meta_key, true);
        // If we have a value and the key did not exist previously, add it.
        if (!empty($new_meta_value) && empty($current_meta_value)) {
            add_post_meta($post_id, $meta_key, $new_meta_value, true);
        } elseif (!empty($new_meta_value) && $new_meta_value != $current_meta_value) {
            update_post_meta($post_id, $meta_key, $new_meta_value);
        } elseif (empty($new_meta_value) && !empty($current_meta_value)) {
            delete_post_meta($post_id, $meta_key, $new_meta_value);
        }
    }
    // Fire our post txn save hook
    do_action('mdjm_after_txn_save', $post_id, $post, $update);
    // Re-add the save post action to avoid loops
    add_action('save_post_mdjm-transaction', 'mdjm_save_txn_post', 10, 3);
}
Exemplo n.º 3
0
/**
 * Get system info
 *
 * @since	1.4
 * @global	obj	$wpdb	Used to query the database using the WordPress Database API
 * @return	str	$return	A string containing the info to output
 */
function mdjm_tools_sysinfo_get()
{
    global $wpdb;
    // Get theme info
    $theme_data = wp_get_theme();
    $theme = $theme_data->Name . ' ' . $theme_data->Version;
    $return = '### Begin System Info ###' . "\n\n";
    // Start with the basics...
    $return .= '-- Site Info' . "\n\n";
    $return .= 'Site URL:                 ' . site_url() . "\n";
    $return .= 'Home URL:                 ' . home_url() . "\n";
    $return .= 'Multisite:                ' . (is_multisite() ? 'Yes' : 'No') . "\n";
    $return = apply_filters('mdjm_sysinfo_after_site_info', $return);
    // WordPress configuration
    $return .= "\n" . '-- WordPress Configuration' . "\n\n";
    $return .= 'Version:                  ' . get_bloginfo('version') . "\n";
    $return .= 'Language:                 ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
    $return .= 'Permalink Structure:      ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n";
    $return .= 'Active Theme:             ' . $theme . "\n";
    $return .= 'Show On Front:            ' . get_option('show_on_front') . "\n";
    // Only show page specs if frontpage is set to 'page'
    if (get_option('show_on_front') == 'page') {
        $front_page_id = get_option('page_on_front');
        $blog_page_id = get_option('page_for_posts');
        $return .= 'Page On Front:            ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n";
        $return .= 'Page For Posts:           ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n";
    }
    $return .= 'ABSPATH:                  ' . ABSPATH . "\n";
    // Make sure wp_remote_post() is working
    $request['cmd'] = '_notify-validate';
    $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'MDJM/' . MDJM_VERSION_NUM, 'body' => $request);
    $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
    if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
        $WP_REMOTE_POST = 'wp_remote_post() works';
    } else {
        $WP_REMOTE_POST = 'wp_remote_post() does not work';
    }
    $return .= 'Remote Post:              ' . $WP_REMOTE_POST . "\n";
    $return .= 'Table Prefix:             ' . 'Length: ' . strlen($wpdb->prefix) . '   Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n";
    $return .= 'WP_DEBUG:                 ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
    $return .= 'Memory Limit:             ' . WP_MEMORY_LIMIT . "\n";
    $return .= 'Registered Post Stati:    ' . implode(', ', get_post_stati()) . "\n";
    $return = apply_filters('mdjm_sysinfo_after_wordpress_config', $return);
    // MDJM configuration
    $employer = mdjm_is_employer();
    $packages = mdjm_packages_enabled();
    $debug = MDJM_DEBUG;
    $return .= "\n" . '-- MDJM Configuration' . "\n\n";
    $return .= 'Version:                  ' . MDJM_VERSION_NUM . "\n";
    $return .= 'Upgraded From:            ' . get_option('mdjm_version_upgraded_from', 'None') . "\n";
    $return .= 'Debugging Status:         ' . (!empty($debug) ? "Enabled\n" : "Disabled\n");
    $return .= 'Multiple Employees:       ' . (!empty($employer) ? "Enabled\n" : "Disabled\n");
    $return .= 'Packages Enabled:         ' . (!empty($packages) ? "Enabled\n" : "Disabled\n");
    $return .= 'Currency Code:            ' . mdjm_get_currency() . "\n";
    $return .= 'Currency Position:        ' . mdjm_get_option('currency_format', 'before') . "\n";
    $return .= 'Decimal Separator:        ' . mdjm_get_option('decimal', '.') . "\n";
    $return .= 'Thousands Separator:      ' . mdjm_get_option('thousands_separator', ',') . "\n";
    $return = apply_filters('mdjm_sysinfo_after_mdjm_config', $return);
    // MDJM pages
    $clientzone_page = mdjm_get_option('app_home_page', '');
    $contact_page = mdjm_get_option('contact_page', '');
    $contracts_page = mdjm_get_option('contracts_page', '');
    $payments_page = mdjm_get_option('payments_page', '');
    $playlist_page = mdjm_get_option('playlist_page', '');
    $profile_page = mdjm_get_option('profile_page', '');
    $quotes_page = mdjm_get_option('quotes_page', '');
    $return .= "\n" . '-- MDJM Page Configuration' . "\n\n";
    $return .= 'Client Zone Page:         ' . (!empty($clientzone_page) ? get_permalink($clientzone_page) . "\n" : "Unset\n");
    $return .= 'Contact Page:             ' . (!empty($contact_page) ? get_permalink($contact_page) . "\n" : "Unset\n");
    $return .= 'Contracts Page:           ' . (!empty($contracts_page) ? get_permalink($contracts_page) . "\n" : "Unset\n");
    $return .= 'Payments Page:            ' . (!empty($payments_page) ? get_permalink($payments_page) . "\n" : "Unset\n");
    $return .= 'Playlist Page:            ' . (!empty($playlist_page) ? get_permalink($playlist_page) . "\n" : "Unset\n");
    $return .= 'Profile Page:             ' . (!empty($profile_page) ? get_permalink($profile_page) . "\n" : "Unset\n");
    $return .= 'Quotes Page:              ' . (!empty($quotes_page) ? get_permalink($quotes_page) . "\n" : "Unset\n");
    $return = apply_filters('mdjm_sysinfo_after_mdjm_pages', $return);
    // MDJM email templates
    $quote_template = mdjm_get_option('enquiry', '');
    $online_quote = mdjm_get_option('online_enquiry', '');
    $unavailable_template = mdjm_get_option('unavailable', '');
    $contract_template = mdjm_get_option('contract', '');
    $booking_conf_template = mdjm_get_option('booking_conf_client', '');
    $auto_payment_template = mdjm_get_option('payment_cfm_template', '');
    $manual_payment_template = mdjm_get_option('manual_payment_cfm_template', '');
    $return .= "\n" . '-- MDJM Email Templates' . "\n\n";
    $return .= 'Quote:                    ' . (!empty($quote_template) ? get_the_title($quote_template) . ' (' . $quote_template . ')' . "\n" : "Unset\n");
    $return .= 'Online Quote:             ' . (!empty($online_quote) ? get_the_title($online_quote) . ' (' . $online_quote . ')' . "\n" : "Unset\n");
    $return .= 'Unavailable:              ' . (!empty($unavailable_template) ? get_the_title($unavailable_template) . ' (' . $unavailable_template . ')' . "\n" : "Unset\n");
    $return .= 'Awaiting Contract:        ' . (!empty($contract_template) ? get_the_title($quote_template) . ' (' . $quote_template . ')' . "\n" : "Unset\n");
    $return .= 'Booking Confirmation:     ' . (!empty($booking_conf_template) ? get_the_title($booking_conf_template) . ' (' . $booking_conf_template . ')' . "\n" : "Unset\n");
    $return .= 'Gateway Payment:          ' . (!empty($auto_payment_template) ? get_the_title($auto_payment_template) . ' (' . $auto_payment_template . ')' . "\n" : "Unset\n");
    $return .= 'Manual Payment:           ' . (!empty($manual_payment_template) ? get_the_title($manual_payment_template) . ' (' . $manual_payment_template . ')' . "\n" : "Unset\n");
    $return = apply_filters('mdjm_sysinfo_after_mdjm_pages', $return);
    // MDJM Payment Gateways
    $return .= "\n" . '-- MDJM Gateway Configuration' . "\n\n";
    $active_gateways = mdjm_get_enabled_payment_gateways();
    if ($active_gateways) {
        $default_gateway_is_active = mdjm_is_gateway_active(mdjm_get_default_gateway());
        if ($default_gateway_is_active) {
            $default_gateway = mdjm_get_default_gateway();
            $default_gateway = $active_gateways[$default_gateway]['admin_label'];
        } else {
            $default_gateway = 'Test Payment';
        }
        $gateways = array();
        foreach ($active_gateways as $gateway) {
            $gateways[] = $gateway['admin_label'];
        }
        $return .= 'Enabled Gateways:         ' . implode(', ', $gateways) . "\n";
        $return .= 'Default Gateway:          ' . $default_gateway . "\n";
    } else {
        $return .= 'Enabled Gateways:         None' . "\n";
    }
    $return = apply_filters('mdjm_sysinfo_after_mdjm_gateways', $return);
    // MDJM Templates
    $dir = get_stylesheet_directory() . '/mdjm-templates/*';
    if (is_dir($dir) && count(glob("{$dir}/*")) !== 0) {
        $return .= "\n" . '-- MDJM Template Overrides' . "\n\n";
        foreach (glob($dir) as $file) {
            $return .= 'Filename:                 ' . basename($file) . "\n";
        }
        $return = apply_filters('mdjm_sysinfo_after_mdjm_templates', $return);
    }
    // Get plugins that have an update
    $updates = get_plugin_updates();
    // Must-use plugins
    // NOTE: MU plugins can't show updates!
    $muplugins = get_mu_plugins();
    if (count($muplugins > 0)) {
        $return .= "\n" . '-- Must-Use Plugins' . "\n\n";
        foreach ($muplugins as $plugin => $plugin_data) {
            $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
        }
        $return = apply_filters('mdjm_sysinfo_after_wordpress_mu_plugins', $return);
    }
    // WordPress active plugins
    $return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
    $plugins = get_plugins();
    $active_plugins = get_option('active_plugins', array());
    foreach ($plugins as $plugin_path => $plugin) {
        if (!in_array($plugin_path, $active_plugins)) {
            continue;
        }
        $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
        $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
    }
    $return = apply_filters('mdjm_sysinfo_after_wordpress_plugins', $return);
    // WordPress inactive plugins
    $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n";
    foreach ($plugins as $plugin_path => $plugin) {
        if (in_array($plugin_path, $active_plugins)) {
            continue;
        }
        $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
        $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
    }
    $return = apply_filters('mdjm_sysinfo_after_wordpress_plugins_inactive', $return);
    if (is_multisite()) {
        // WordPress Multisite active plugins
        $return .= "\n" . '-- Network Active Plugins' . "\n\n";
        $plugins = wp_get_active_network_plugins();
        $active_plugins = get_site_option('active_sitewide_plugins', array());
        foreach ($plugins as $plugin_path) {
            $plugin_base = plugin_basename($plugin_path);
            if (!array_key_exists($plugin_base, $active_plugins)) {
                continue;
            }
            $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
            $plugin = get_plugin_data($plugin_path);
            $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
        }
        $return = apply_filters('mdjm_sysinfo_after_wordpress_ms_plugins', $return);
    }
    // Server configuration (really just versioning)
    $return .= "\n" . '-- Webserver Configuration' . "\n\n";
    $return .= 'PHP Version:              ' . PHP_VERSION . "\n";
    $return .= 'MySQL Version:            ' . $wpdb->db_version() . "\n";
    $return .= 'Webserver Info:           ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
    $return = apply_filters('mdjm_sysinfo_after_webserver_config', $return);
    // PHP configs... now we're getting to the important stuff
    $return .= "\n" . '-- PHP Configuration' . "\n\n";
    $return .= 'Safe Mode:                ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n");
    $return .= 'Memory Limit:             ' . ini_get('memory_limit') . "\n";
    $return .= 'Upload Max Size:          ' . ini_get('upload_max_filesize') . "\n";
    $return .= 'Post Max Size:            ' . ini_get('post_max_size') . "\n";
    $return .= 'Upload Max Filesize:      ' . ini_get('upload_max_filesize') . "\n";
    $return .= 'Time Limit:               ' . ini_get('max_execution_time') . "\n";
    $return .= 'Max Input Vars:           ' . ini_get('max_input_vars') . "\n";
    $return .= 'Display Errors:           ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n";
    $return = apply_filters('mdjm_sysinfo_after_php_config', $return);
    // PHP extensions and such
    $return .= "\n" . '-- PHP Extensions' . "\n\n";
    $return .= 'cURL:                     ' . (function_exists('curl_init') ? 'Supported' : 'Not Supported') . "\n";
    $return .= 'fsockopen:                ' . (function_exists('fsockopen') ? 'Supported' : 'Not Supported') . "\n";
    $return .= 'SOAP Client:              ' . (class_exists('SoapClient') ? 'Installed' : 'Not Installed') . "\n";
    $return .= 'Suhosin:                  ' . (extension_loaded('suhosin') ? 'Installed' : 'Not Installed') . "\n";
    $return = apply_filters('mdjm_sysinfo_after_php_ext', $return);
    $return .= "\n" . '### End System Info ###';
    return $return;
}
/**
 * Retrieve data for an addon.
 *
 * @since	1.4
 * @param	int|obj	$package	The addon WP_Post object, or post ID.
 * @return	arr
 */
function mdjm_get_addon_data($addon)
{
    $addon_id = is_object($addon) ? $addon->ID : $addon;
    $events = mdjm_get_addon_event_types($addon_id);
    $users = mdjm_get_employees_with_addon($addon_id);
    $packages = mdjm_get_packages_with_addons($addon_id);
    $cats = get_the_terms($addon_id, 'addon-category');
    $employees = array();
    $months = array();
    $categories = array();
    $in_packages = array();
    if (!mdjm_addon_is_restricted_by_date($addon_id)) {
        $months[] = __('Always', 'mobile-dj-manager');
    } else {
        $availability = mdjm_get_addon_months_available($addon_id);
        if (!$availability) {
            $months[] = __('Always', 'mobile-dj-manager');
        } else {
            $i = 0;
            foreach ($availability as $month) {
                $months[] = mdjm_month_num_to_name($availability[$i]);
                $i++;
            }
        }
    }
    if (in_array('all', $users)) {
        $employees[] = __('All Employees', 'mobile-dj-manager');
    } else {
        foreach ($users as $employee_id) {
            if ('all' == $employee_id) {
                continue;
            }
            $employees[] = array($employee_id => mdjm_get_employee_display_name($employee_id));
        }
    }
    if (in_array('all', $events)) {
        $event_types = sprintf(__('All %s Types', 'mobile-dj-manager'), mdjm_get_label_singular());
    } else {
        foreach ($events as $event) {
            $term = get_term($event, 'event-types');
            if (!empty($term)) {
                $event_types[] = $term->name;
            }
        }
    }
    if (mdjm_addon_has_variable_prices($addon_id)) {
        $range = mdjm_get_addon_price_range($addon_id);
        $price = mdjm_get_currency() . ' ' . mdjm_format_amount($range['low']) . ' &mdash; ' . mdjm_format_amount($range['high']);
    } else {
        $price = mdjm_get_currency() . ' ' . mdjm_format_amount(mdjm_get_addon_price($addon_id));
    }
    if ($packages) {
        foreach ($packages as $package) {
            $in_packages[] = array($package->ID => mdjm_get_package_name($package->ID));
        }
    }
    if ($cats) {
        foreach ($cats as $cat) {
            $categories[] = $cat->name;
        }
    }
    $addon_data = array('name' => mdjm_get_addon_name($addon_id), 'categories' => $categories, 'availability' => array('months' => $months, 'employees' => $employees, 'event_types' => $event_types), 'price' => $price, 'packages' => $in_packages, 'usage' => array('packages' => mdjm_count_packages_with_addon($addon_id), 'events' => mdjm_count_events_with_addon($addon_id)));
    return apply_filters('mdjm_get_addon_data', $addon_data);
}
Exemplo n.º 5
0
/**
 * Set the number of decimal places per currency
 *
 * @since	1.3
 * @param	int		$decimals	Number of decimal places
 * @return	int		$decimals
*/
function mdjm_currency_decimal_filter($decimals = 2)
{
    $currency = mdjm_get_currency();
    switch ($currency) {
        case 'RIAL':
        case 'JPY':
        case 'TWD':
        case 'HUF':
            $decimals = 0;
            break;
    }
    return apply_filters('mdjm_currency_decimal_count', $decimals, $currency);
}
Exemplo n.º 6
0
/**
 * Load Admin Scripts
 *
 * Enqueues the required scripts for admin.
 *
 * @since	1.3
 * @return	void
 */
function mdjm_register_admin_scripts($hook)
{
    $js_dir = MDJM_PLUGIN_URL . '/assets/js/';
    wp_register_script('jquery-chosen', $js_dir . 'chosen.jquery.js', array('jquery'), MDJM_VERSION_NUM);
    wp_enqueue_script('jquery-chosen');
    wp_enqueue_script('jquery-ui-datepicker', array('jquery'));
    if (strpos($hook, 'mdjm')) {
        wp_enqueue_script('jquery');
    }
    $editing_event = false;
    $require_validation = array('mdjm-event_page_mdjm-comms');
    $sortable = array('admin_page_mdjm-custom-event-fields', 'admin_page_mdjm-custom-client-fields');
    if ('post.php' == $hook || 'post-new.php' == $hook) {
        if (isset($_GET['post']) && 'mdjm-addon' == get_post_type($_GET['post'])) {
            $sortable[] = 'post.php';
            $sortable[] = 'post-new.php';
        }
        if (isset($_GET['post']) && 'mdjm-event' == get_post_type($_GET['post'])) {
            $editing_event = true;
        }
        if (isset($_GET['post_type']) && 'mdjm-event' == $_GET['post_type']) {
            $editing_event = true;
        }
        if ($editing_event) {
            $require_validation[] = 'post.php';
            $require_validation[] = 'post-new.php';
        }
    }
    if (in_array($hook, $require_validation)) {
        wp_register_script('jquery-validation-plugin', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js', false);
        wp_enqueue_script('jquery-validation-plugin');
    }
    if (in_array($hook, $sortable)) {
        wp_enqueue_script('jquery-ui-sortable');
    }
    wp_register_script('mdjm-admin-scripts', $js_dir . 'admin-scripts.js', array('jquery'), MDJM_VERSION_NUM);
    wp_enqueue_script('mdjm-admin-scripts');
    wp_localize_script('mdjm-admin-scripts', 'mdjm_admin_vars', apply_filters('mdjm_admin_script_vars', array('ajaxurl' => mdjm_get_ajax_url(), 'current_page' => $hook, 'editing_event' => $editing_event, 'load_recipient' => isset($_GET['recipient']) ? $_GET['recipient'] : false, 'ajax_loader' => MDJM_PLUGIN_URL . '/assets/images/loading.gif', 'no_client_first_name' => __('Enter a first name for the client', 'mobile-dj-manager'), 'no_client_email' => __('Enter an email address for the client', 'mobile-dj-manager'), 'no_txn_amount' => __('Enter a transaction value', 'mobile-dj-manager'), 'no_txn_date' => __('Enter a transaction date', 'mobile-dj-manager'), 'no_txn_for' => __('What is the transaction for?', 'mobile-dj-manager'), 'no_txn_src' => __('Enter a transaction source', 'mobile-dj-manager'), 'no_venue_name' => __('Enter a name for the venue', 'mobile-dj-manager'), 'currency' => mdjm_get_currency(), 'currency_symbol' => mdjm_currency_symbol(), 'currency_sign' => mdjm_currency_filter(''), 'currency_position' => mdjm_get_option('currency_format', 'before'), 'currency_decimals' => mdjm_currency_decimal_filter(), 'deposit_is_pct' => 'percentage' == mdjm_get_event_deposit_type() ? true : false, 'update_deposit' => 'percentage' == mdjm_get_event_deposit_type() ? true : false, 'select_months' => __('Select Months', 'mobile-dj-manager'), 'one_month_min' => __('You must have a pricing option for at least one month', 'mobile-dj-manager'), 'one_item_min' => __('Select at least one Add-on', 'mobile-dj-manager'), 'min_travel_distance' => mdjm_get_option('travel_min_distance'), 'update_travel_cost' => mdjm_get_option('travel_add_cost', false))));
    wp_register_script('jquery-flot', $js_dir . 'jquery.flot.js');
    wp_enqueue_script('jquery-flot');
}
Exemplo n.º 7
0
/**
 * Mark the event balance as paid.
 *
 * Determines if any balance remains and if so, assumes it has been paid and
 * creates an associted transaction.
 *
 * @since	1.3
 * @param	int		$event_id	The event ID.
 * @return	void
 */
function mdjm_mark_event_balance_paid($event_id)
{
    $mdjm_event = new MDJM_Event($event_id);
    $txn_id = 0;
    if ('Paid' == $mdjm_event->get_balance_status()) {
        return;
    }
    $remaining = $mdjm_event->get_balance();
    do_action('mdjm_pre_mark_event_balance_paid', $event_id, $remaining);
    if (!empty($remaining) && $remaining > 0) {
        $mdjm_txn = new MDJM_Txn();
        $txn_meta = array('_mdjm_txn_source' => mdjm_get_option('default_type', __('Cash', 'mobile-dj-manager')), '_mdjm_txn_currency' => mdjm_get_currency(), '_mdjm_txn_status' => 'Completed', '_mdjm_txn_total' => $remaining, '_mdjm_payer_firstname' => mdjm_get_client_firstname($mdjm_event->client), '_mdjm_payer_lastname' => mdjm_get_client_lastname($mdjm_event->client), '_mdjm_payer_email' => mdjm_get_client_email($mdjm_event->client), '_mdjm_payment_from' => mdjm_get_client_display_name($mdjm_event->client));
        $mdjm_txn->create(array('post_parent' => $event_id), $txn_meta);
        if ($mdjm_txn->ID > 0) {
            mdjm_set_txn_type($mdjm_txn->ID, mdjm_get_txn_cat_id('slug', 'mdjm-balance-payments'));
            $args = array('user_id' => get_current_user_id(), 'event_id' => $event_id, 'comment_content' => sprintf(__('%1$s payment of %2$s received and %1$s marked as paid.', 'mobile-dj-manager'), mdjm_get_balance_label(), mdjm_currency_filter(mdjm_format_amount($remaining))));
            mdjm_add_journal($args);
            mdjm_add_content_tag('payment_for', __('Reason for payment', 'mobile-dj-manager'), 'mdjm_content_tag_balance_label');
            mdjm_add_content_tag('payment_amount', __('Payment amount', 'mobile-dj-manager'), function () use($remaining) {
                return mdjm_currency_filter(mdjm_format_amount($remaining));
            });
            mdjm_add_content_tag('payment_date', __('Date of payment', 'mobile-dj-manager'), 'mdjm_content_tag_ddmmyyyy');
            do_action('mdjm_post_add_manual_txn_in', $event_id, $mdjm_txn->ID);
        }
    }
    mdjm_update_event_meta($mdjm_event->ID, array('_mdjm_event_deposit_status' => 'Paid', '_mdjm_event_balance_status' => 'Paid'));
    do_action('mdjm_post_mark_event_balance_paid', $event_id);
}
Exemplo n.º 8
0
/**
 * Retrieve the array of plugin settings
 *
 * @since	1.3
 * @return	array
*/
function mdjm_get_registered_settings()
{
    /**
     * 'Whitelisted' MDJM settings, filters are provided for each settings
     * section to allow extensions and other plugins to add their own settings
     */
    $mdjm_settings = array('general' => apply_filters('mdjm_settings_general', array('main' => array('general_settings' => array('id' => 'general_settings', 'name' => '<h3>' . __('General Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'company_name' => array('id' => 'company_name', 'name' => __('Company Name', 'mobile-dj-manager'), 'desc' => __('Your company name.', 'mobile-dj-manager'), 'type' => 'text', 'std' => get_bloginfo('name')), 'time_format' => array('id' => 'time_format', 'name' => __('Time Format', 'mobile-dj-manager'), 'desc' => sprintf(__('Select the format in which you want your %s times displayed. Applies to both admin and client pages', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => array('g:i A' => date('g:i A', current_time('timestamp')), 'H:i' => date('H:i', current_time('timestamp'))), 'std' => 'H:i'), 'short_date_format' => array('id' => 'short_date_format', 'name' => __('Short Date Format', 'mobile-dj-manager'), 'desc' => __('Select the format in which you want short dates displayed. Applies to both admin and client pages', 'mobile-dj-manager'), 'type' => 'select', 'options' => array('d/m/Y' => date('d/m/Y') . ' - d/m/Y', 'm/d/Y' => date('m/d/Y') . ' - m/d/Y', 'Y/m/d' => date('Y/m/d') . ' - Y/m/d', 'd-m-Y' => date('d-m-Y') . ' - d-m-Y', 'm-d-Y' => date('m-d-Y') . ' - m-d-Y', 'Y-m-d' => date('Y-m-d') . ' - Y-m-d'), 'std' => 'd/m/Y'), 'show_credits' => array('id' => 'show_credits', 'name' => __('Display Credits?', 'mobile-dj-manager'), 'desc' => sprintf(__('Whether or not to display the %sPowered by ' . '%s, version %s%s text at the footer of the %s application pages.', 'mobile-dj-manager'), '<span class="mdjm-admin-footer">', MDJM_NAME, MDJM_VERSION_NUM, '</span>', mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager'))), 'type' => 'checkbox')), 'debugging' => array('debugging_settings' => array('id' => 'debugging_settings', 'name' => '<h3>' . __('Debugging MDJM', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'enable_debugging' => array('id' => 'enable_debugging', 'name' => __('Enable Debugging', 'mobile-dj-manager'), 'desc' => __('Only enable if MDJM Support have asked you to do so. Performance may be impacted', 'mobile-dj-manager'), 'type' => 'checkbox'), 'debug_log_size' => array('id' => 'debug_log_size', 'name' => __('Maximum Log File Size', 'mobile-dj-manager'), 'hint' => sprintf(__('MB %sDefault is 2 (MB)%s', 'mobile-dj-manager'), '<code>', '</code>'), 'desc' => __('The max size in Megabytes to allow your log files to grow to before you receive a warning (if configured below)', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'small', 'std' => '2'), 'debug_warn' => array('id' => 'debug_warn', 'name' => __('Display Warning if Over Size', 'mobile-dj-manager'), 'desc' => __('Will display notice and allow removal and recreation of log files', 'mobile-dj-manager'), 'type' => 'checkbox', 'std' => '1'), 'debug_auto_purge' => array('id' => 'debug_auto_purge', 'name' => __('Auto Purge Log Files', 'mobile-dj-manager'), 'desc' => __('If selected, log files will be auto-purged when they reach the value of <code>Maximum Log File Size</code>', 'mobile-dj-manager'), 'type' => 'checkbox')), 'uninstall' => array('uninst_settings' => array('id' => 'uninst_settings', 'name' => '<h3>' . __('Uninstallation Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'uninst_remove_db' => array('id' => 'uninst_remove_db', 'name' => __('Remove Database Tables', 'mobile-dj-manager'), 'desc' => __('Should the database tables and data be removed when uninstalling the plugin? ' . 'Cannot be recovered unless you or your host have a backup solution in place and a recent backup.', 'mobile-dj-manager'), 'type' => 'checkbox'), 'uninst_remove_mdjm_posts' => array('id' => 'uninst_remove_mdjm_posts', 'name' => __('Remove Data?', 'mobile-dj-manager'), 'desc' => __('Do you want to remove all MDJM pages', 'mobile-dj-manager'), 'type' => 'checkbox'), 'uninst_remove_mdjm_pages' => array('id' => 'uninst_remove_mdjm_pages', 'name' => __('Remove Pages?', 'mobile-dj-manager'), 'desc' => __('Do you want to remove all MDJM pages?', 'mobile-dj-manager'), 'type' => 'checkbox'), 'uninst_remove_users' => array('id' => 'uninst_remove_users', 'name' => __('Remove Employees and Clients?', 'mobile-dj-manager'), 'desc' => __('If selected, all users who are defined as clients or employees will be removed.', 'mobile-dj-manager'), 'type' => 'checkbox')))), 'events' => apply_filters('mdjm_settings_events', array('main' => array('event_settings' => array('id' => 'event_settings', 'name' => '<h3>' . sprintf(__('%s Settings', 'mobile-dj-manager'), mdjm_get_label_singular()) . '</h3>', 'desc' => '', 'type' => 'header'), 'event_prefix' => array('id' => 'event_prefix', 'name' => sprintf(__('%s Prefix', 'mobile-dj-manager'), mdjm_get_label_singular()), 'desc' => sprintf(__('The prefix you enter here will be added to each unique %s, contract and invoice ID', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'text', 'size' => 'small'), 'show_active_only' => array('id' => 'show_active_only', 'name' => sprintf(__('Hide Inactive %s?', 'mobile-dj-manager'), mdjm_get_label_plural()), 'desc' => sprintf(__('Select to include only active %1$s within the <code>All</code> view on the %1$s screen.', 'mobile-dj-manager'), mdjm_get_label_plural(true)), 'type' => 'checkbox'), 'employer' => array('id' => 'employer', 'name' => __('I am an Employer', 'mobile-dj-manager'), 'desc' => __('Check if you employ staff other than yourself.', 'mobile-dj-manager'), 'type' => 'checkbox'), 'artist' => array('id' => 'artist', 'name' => __('Refer to Performers as', 'mobile-dj-manager'), 'hint' => '<code>' . __('Default is DJ', 'mobile-dj-manager') . '</code>', 'desc' => __('Change the name of your performers here as necessary.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'regular', 'std' => __('DJ', 'mobile-dj-manager')), 'default_contract' => array('id' => 'default_contract', 'name' => __('Default Contract', 'mobile-dj-manager'), 'desc' => sprintf(__('Select the default contract for your %s. Can be changed per %s', 'mobile-dj-manager'), mdjm_get_label_plural(true), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => mdjm_list_templates('contract')), 'warn_unattended' => array('id' => 'warn_unattended', 'name' => __('New Enquiry Notification', 'mobile-dj-manager'), 'desc' => __('Displays a notification message at the top of the Admin pages to Administrators if there are outstanding Unattended Enquiries.', 'mobile-dj-manager'), 'type' => 'checkbox', 'std' => '1'), 'events_order_by' => array('id' => 'events_order_by', 'name' => __('Default Order By', 'mobile-dj-manager'), 'desc' => sprintf(__('Select how you want to see %s ordered within the %s admin list', 'mobile-dj-manager'), mdjm_get_label_plural(true), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => array('ID' => __('Contract ID', 'mobile-dj-manager'), 'post_date' => __('Creation Date', 'mobile-dj-manager'), 'event_date' => sprintf(__('%s Date', 'mobile-dj-manager'), mdjm_get_label_singular()), 'value' => __('Total Cost', 'mobile-dj-manager')), 'std' => 'event_date'), 'events_order' => array('id' => 'events_order', 'name' => __('Default Order', 'mobile-dj-manager'), 'desc' => '', 'type' => 'select', 'options' => array('ASC' => __('Ascending', 'mobile-dj-manager'), 'DESC' => __('Descending', 'mobile-dj-manager')), 'std' => 'DESC'), 'set_client_inactive' => array('id' => 'set_client_inactive', 'name' => __('Set Client Inactive?', 'mobile-dj-manager'), 'desc' => sprintf(__('Set a client to inactive when their %s is cancelled, rejected or marked as a failed enquiry and they have no other upcoming %s.', 'mobile-dj-manager'), mdjm_get_label_singular(true), mdjm_get_label_plural(true)), 'type' => 'checkbox', 'std' => '1'), 'journaling' => array('id' => 'journaling', 'name' => __('Enable Journaling?', 'mobile-dj-manager'), 'desc' => sprintf(__('Log and track all client &amp; %s actions (recommended).', 'mobile-dj-manager'), mdjm_get_label_singular()), 'type' => 'checkbox', 'std' => '1')), 'playlist' => array('playlist_settings' => array('id' => 'playlist_settings', 'name' => '<h3>' . __('Playlist Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'enable_playlists' => array('id' => 'enable_playlists', 'name' => sprintf(__('Enable %s Playlists by Default?', 'mobile-dj-manager'), mdjm_get_label_singular()), 'desc' => sprintf(__('Check to enable Client Playlist features by default. Can be overridden per %s.', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'checkbox', 'std' => '1'), 'close' => array('id' => 'close', 'name' => __('Close the Playlist', 'mobile-dj-manager'), 'hint' => sprintf(__('Enter %s0%s to never close.', 'mobile-dj-manager'), '<code>', '</code>'), 'desc' => sprintf(__('Number of days before %s that the playlist should close to new entries.', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'text', 'size' => 'small', 'std' => '5'), 'upload_playlists' => array('id' => 'upload_playlists', 'name' => __('Upload Playlists?', 'mobile-dj-manager'), 'desc' => sprintf(__('With this option checked, your playlist information will occasionally be transmitted back to the MDJM servers ' . 'to help build an information library. The consolidated list of playlist songs will be freely shared. ' . 'Only song, artist and the %s type information is transmitted.', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'checkbox')), 'packages' => array('package_settings' => array('id' => 'package_settings', 'name' => '<h3>' . __('Package &amp; Addon Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'enable_packages' => array('id' => 'enable_packages', 'name' => __('Enable Packages', 'mobile-dj-manager'), 'desc' => __('Check this to enable Equipment Packages & Add-ons.', 'mobile-dj-manager'), 'type' => 'checkbox'), 'package_excerpt_length' => array('id' => 'package_excerpt_length', 'name' => __('Description Length', 'mobile-dj-manager'), 'desc' => __('The maximum number of characters for the package/addon description.', 'mobile-dj-manager'), 'hint' => __('Entering <code>0</code> will render the full exceprt if it exists, otherwise the description', 'mobile-dj-manager'), 'type' => 'number', 'size' => 'small', 'step' => '5', 'std' => '55'), 'package_contact_btn' => array('id' => 'package_contact_btn', 'name' => __('Add Contact Button?', 'mobile-dj-manager'), 'hint' => sprintf(__('Select to auto add a contact button to the end of package/addons post content. The link will redirect to the <code>Contact Page</code>page as defined in <a href="%s">Pages</a>', 'mobile-dj-manager'), admin_url('admin.php?page=mdjm-settings&tab=client_zone&section=pages')), 'desc' => sprintf(__('If you use the <a href="%s" target="_blank">Dynamic Contact Forms</a> add-on, the package/addon will be auto selected on page load', 'mobile-dj-manager'), 'http://mdjm.co.uk/products/dynamic-contact-forms/'), 'type' => 'checkbox'), 'package_contact_btn_text' => array('id' => 'package_contact_btn_text', 'name' => __('Text for Contact Button', 'mobile-dj-manager'), 'desc' => '', 'type' => 'text', 'std' => __('Enquire Now', 'mobile-dj-manager'))), 'travel' => array('travel_settings' => array('id' => 'travel_settings', 'name' => '<h3>' . __('Travel Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'travel_add_cost' => array('id' => 'travel_add_cost', 'name' => __('Add Travel Cost to Price?', 'mobile-dj-manager'), 'desc' => sprintf(__('If selected, the travel cost will be added to the overall %s cost', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'checkbox'), 'travel_primary' => array('id' => 'travel_primary', 'name' => __('Primary Post/Zip Code', 'mobile-dj-manager'), mdjm_get_label_singular(), 'desc' => __('When the primary employee has no address in their profile, this post code will be used to calculate the distance to the venue.', 'mobile-dj-manager'), 'type' => 'text', 'std' => mdjm_get_employee_post_code(1)), 'travel_status' => array('id' => 'travel_status', 'name' => sprintf(__('%s Status', 'mobile-dj-manager'), mdjm_get_label_singular()), 'desc' => sprintf(__("CTRL (cmd on MAC) + Click to select which %s status' can have travel costs updated.", 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'multiple_select', 'options' => mdjm_all_event_status(), 'std' => array('mdjm-unattended', 'mdjm-enquiry', 'mdjm-contract')), 'travel_units' => array('id' => 'travel_units', 'name' => __('Calculate in?', 'mobile-dj-manager'), 'desc' => '', 'type' => 'select', 'options' => array('imperial' => __('Miles', 'mobile-dj-manager'), 'metric' => __('Kilometers', 'mobile-dj-manager')), 'std' => 'imperial'), 'cost_per_unit' => array('id' => 'cost_per_unit', 'name' => sprintf(__('Cost per %s', 'mobile-dj-manager'), mdjm_travel_unit_label()), 'desc' => __('Enter the cost per mile that should be calculated. i.e. 0.45', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'small', 'std' => '0.45'), 'travel_cost_round' => array('id' => 'travel_cost_round', 'name' => __('Round Cost', 'mobile-dj-manager'), 'desc' => __('Do you want to round costs up or down?', 'mobile-dj-manager'), 'type' => 'select', 'options' => array(false => __('No', 'mobile-dj-manager'), 'up' => __('Up', 'mobile-dj-manager'), 'down' => __('Down', 'mobile-dj-manager')), 'std' => 'up'), 'travel_round_to' => array('id' => 'travel_round_to', 'name' => __('Round to Nearest', 'mobile-dj-manager'), 'hint' => mdjm_get_currency() . ' i.e. 5', 'type' => 'number', 'size' => 'small', 'std' => '5'), 'travel_min_distance' => array('id' => 'travel_min_distance', 'name' => __("Don't add if below", 'mobile-dj-manager'), 'hint' => mdjm_travel_unit_label(false, true), 'type' => 'number', 'size' => 'small', 'std' => '30')))), 'emails' => apply_filters('mdjm_settings_emails', array('main' => array('email_settings' => array('id' => 'email_settings', 'name' => '<h3>' . __('Email Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'system_email' => array('id' => 'system_email', 'name' => __('Default From Address', 'mobile-dj-manager'), 'desc' => __('The email address you want generic emails from MDJM to come from.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'regular', 'std' => get_bloginfo('admin_email')), 'comms_show_active_events_only' => array('id' => 'comms_show_active_events_only', 'name' => __('Communicate Active Events Only', 'mobile-dj-manager'), 'desc' => __("Check to only retrieve a client's/employee's active events on the communication page.", 'mobile-dj-manager'), 'type' => 'checkbox'), 'track_client_emails' => array('id' => 'track_client_emails', 'name' => __('Track Client Emails?', 'mobile-dj-manager'), 'desc' => __('Some email clients may not support this feature.', 'mobile-dj-manager'), 'type' => 'checkbox', 'std' => '1'), 'bcc_dj_to_client' => array('id' => 'bcc_dj_to_client', 'name' => sprintf(__('Copy %s in Client Emails?', 'mobile-dj-manager'), mdjm_get_option('artist', __('DJ', 'mobile-dj-manager'))), 'desc' => sprintf(__('Send a copy of client emails to the %s primary %s', 'mobile-dj-manager'), mdjm_get_label_plural(true), mdjm_get_option('artist', __('DJ', 'mobile-dj-manager'))), 'type' => 'checkbox'), 'bcc_admin_to_client' => array('id' => 'bcc_admin_to_client', 'name' => __('Copy Admin in Client Emails?', 'mobile-dj-manager'), 'desc' => sprintf(__('Send a copy of client emails to %sDefault From Address%s', 'mobile-dj-manager'), '<code>', '</code>'), 'type' => 'checkbox', 'std' => '1')), 'templates' => array('quote_templates' => array('id' => 'quote_templates', 'name' => '<h3>' . __('Quote Template Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'enquiry' => array('id' => 'enquiry', 'name' => __('Quote Template', 'mobile-dj-manager'), 'desc' => __('This is the default template used when sending quotes via email to clients', 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_templates('email_template')), 'online_enquiry' => array('id' => 'online_enquiry', 'name' => __('Online Quote Template', 'mobile-dj-manager'), 'desc' => sprintf(__('This is the default template used for clients viewing quotes online via the %s.', 'mobile-dj-manager'), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager'))), 'type' => 'select', 'options' => mdjm_list_templates('email_template', true)), 'unavailable' => array('id' => 'unavailable', 'name' => __('Unavailability Template', 'mobile-dj-manager'), 'desc' => sprintf(__('This is the default template used when responding to enquiries that you are unavailable for the %s', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => mdjm_list_templates('email_template')), 'enquiry_from' => array('id' => 'enquiry_from', 'name' => __('Emails From?', 'mobile-dj-manager'), 'desc' => __('Who should enquiries and unavailability emails to be sent by?', 'mobile-dj-manager'), 'type' => 'select', 'options' => array('admin' => __('Admin', 'mobile-dj-manager'), 'dj' => mdjm_get_option('artist', __('Primary Employee', 'mobile-dj-manager'))), 'std' => 'admin'), 'contract_templates' => array('id' => 'contract_templates', 'name' => '<h3>' . __('Awaiting Contract Template Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'contract_to_client' => array('id' => 'contract_to_client', 'name' => __('Contract Notification Email?', 'mobile-dj-manager'), 'desc' => sprintf(__('Do you want to auto send an email to the client when their %s changes to the <em>Awaiting Contract<em> status?', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'checkbox', 'std' => '1'), 'contract' => array('id' => 'contract', 'name' => __('Contract Template', 'mobile-dj-manager'), 'desc' => sprintf(__('Only applies if %sContract Notification Email%s is enabled', 'mobile-dj-manager'), '<em>', '</em>'), 'type' => 'select', 'options' => mdjm_list_templates('email_template')), 'contract_from' => array('id' => 'contract_from', 'name' => __('Emails From?', 'mobile-dj-manager'), 'desc' => __('Who should contract notification emails to be sent by?', 'mobile-dj-manager'), 'type' => 'select', 'options' => array('admin' => __('Admin', 'mobile-dj-manager'), 'dj' => mdjm_get_option('artist', __('Primary Employee', 'mobile-dj-manager'))), 'std' => 'admin'), 'booking_conf_templates' => array('id' => 'booking_conf_templates', 'name' => '<h3>' . __('Booking Confirmation Template Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'booking_conf_to_client' => array('id' => 'booking_conf_to_client', 'name' => __('Booking Confirmation to Client', 'mobile-dj-manager'), 'desc' => __('Email client with selected template when booking is confirmed i.e. contract accepted, or status changed to Approved', 'mobile-dj-manager'), 'type' => 'checkbox', 'std' => '1'), 'booking_conf_client' => array('id' => 'booking_conf_client', 'name' => __('Client Booking Confirmation Template', 'mobile-dj-manager'), 'desc' => __('Select an email template to be used when sending the Booking Confirmation to Clients', 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_templates('email_template')), 'booking_conf_from' => array('id' => 'booking_conf_from', 'name' => __('Emails From?', 'mobile-dj-manager'), 'desc' => __('Who should booking confirmation emails to be sent by?', 'mobile-dj-manager'), 'type' => 'select', 'options' => array('admin' => __('Admin', 'mobile-dj-manager'), 'dj' => mdjm_get_option('artist', __('Primary Employee', 'mobile-dj-manager'))), 'std' => 'admin'), 'booking_conf_to_dj' => array('id' => 'booking_conf_to_dj', 'name' => __('Booking Confirmation to Employee?', 'mobile-dj-manager'), 'desc' => sprintf(__('Email %s primary %s with selected template when booking is confirmed i.e. contract accepted, or status changed to Approved', 'mobile-dj-manager'), mdjm_get_label_plural(true), mdjm_get_option('artist', __('DJ', 'mobile-dj-manager'))), 'type' => 'checkbox'), 'email_dj_confirm' => array('id' => 'email_dj_confirm', 'name' => sprintf(__('%s Booking Confirmation Template', 'mobile-dj-manager'), mdjm_get_option('artist', __('DJ', 'mobile-dj-manager'))), 'desc' => sprintf(__('Select an email template to be used when sending the Booking Confirmation to %s primary %s', 'mobile-dj-manager'), mdjm_get_label_plural(true), mdjm_get_option('artist', __('DJ', 'mobile-dj-manager'))), 'type' => 'select', 'options' => mdjm_list_templates('email_template'))))), 'client_zone' => apply_filters('mdjm_settings_client_zone', array('main' => array('client_zone_settings' => array('id' => 'client_zone_settings', 'name' => '<h3>' . sprintf(__('%s Settings', 'mobile-dj-manager'), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager'))) . '</h3>', 'desc' => '', 'type' => 'header'), 'app_name' => array('id' => 'app_name', 'name' => __('Application Name', 'mobile-dj-manager'), 'hint' => sprintf(__('Default is %sClient Zone%s.', 'mobile-dj-manager'), '<code>', '</code>'), 'desc' => __('Choose your own name for the application.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'regular', 'std' => __('Client Zone', 'mobile-dj-manager')), 'client_settings' => array('id' => 'client_settings', 'name' => '<h3>' . __('Client Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'pass_length' => array('id' => 'pass_length', 'name' => __('Default Password Length', 'mobile-dj-manager'), 'desc' => sprintf(__('If opting to generate or reset a user password during %s creation, how many characters should the password be?', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => array('5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12'), 'std' => '8'), 'complex_passwords' => array('id' => 'complex_passwords', 'name' => __('Use Complex Passwords?', 'mobile-dj-manager'), 'desc' => __('Generated passwords will contain <em>special</em> characters such as <code>!@#$%^&*()</code> as well as letters and numbers', 'mobile-dj-manager'), 'type' => 'checkbox', 'std' => '1'), 'notify_profile' => array('id' => 'notify_profile', 'name' => __('Incomplete Profile Warning?', 'mobile-dj-manager'), 'desc' => __('Display notice to Clients when they login if their Profile is incomplete? (i.e. Required field is empty)', 'mobile-dj-manager'), 'type' => 'checkbox'), 'client_zone_event_settings' => array('id' => 'client_zone_event_settings', 'name' => '<h3>' . sprintf(__('%s Settings', 'mobile-dj-manager'), mdjm_get_label_singular()) . '</h3>', 'desc' => '', 'type' => 'header'), 'package_prices' => array('id' => 'package_prices', 'name' => __('Display Package Price?', 'mobile-dj-manager'), 'desc' => sprintf(__('Select to display %s package &amp; Add-on prices within hover text within the %s', 'mobile-dj-manager'), mdjm_get_label_singular(true), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager'))), 'type' => 'checkbox')), 'styles' => array('client_zone_styles' => array('id' => 'client_zone_styles', 'name' => '<h3>' . __('Styling', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'action_button_colour' => array('id' => 'action_button_colour', 'name' => __('Action Button Colour', 'mobile-dj-manager'), 'desc' => sprintf(__('Select your preferred colour for the %s action buttons', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => array('blue' => __('Blue', 'mobile-dj-manager'), 'green' => __('Green', 'mobile-dj-manager'), 'red' => __('Red', 'mobile-dj-manager'), 'turquoise' => __('Turquoise', 'mobile-dj-manager')), 'std' => 'blue')), 'pages' => array('page_settings' => array('id' => 'page_settings', 'name' => '<h3>' . __('Page Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'app_home_page' => array('id' => 'app_home_page', 'name' => mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager')) . ' ' . __('Home Page', 'mobile-dj-manager'), 'desc' => sprintf(__("Select the home page for the %s application. Needs to contain the shortcode %s[mdjm-home]%s", 'mobile-dj-manager'), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager')), '<code>', '</code>'), 'type' => 'select', 'options' => mdjm_list_pages()), 'quotes_page' => array('id' => 'quotes_page', 'name' => __('Online Quotes Page', 'mobile-dj-manager'), 'desc' => sprintf(__("Select the page to use for online %s quotes. Needs to contain the shortcode <code>[mdjm-quote]</code>", 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'select', 'options' => mdjm_list_pages()), 'contact_page' => array('id' => 'contact_page', 'name' => __('Contact Page', 'mobile-dj-manager'), 'desc' => __("Select your website's contact page so we can correctly direct visitors.", 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_pages()), 'contracts_page' => array('id' => 'contracts_page', 'name' => __('Contracts Page', 'mobile-dj-manager'), 'desc' => sprintf(__("Select your website's contracts page. Needs to contain the shortcode %s[mdjm-contract]%s", 'mobile-dj-manager'), '<code>', '</code>'), 'type' => 'select', 'options' => mdjm_list_pages()), 'payments_page' => array('id' => 'payments_page', 'name' => __('Payments Page', 'mobile-dj-manager'), 'desc' => sprintf(__("Select your website's payments page. Needs to contain the shortcode %s[mdjm-payments]%s", 'mobile-dj-manager'), '<code>', '</code>'), 'type' => 'select', 'options' => mdjm_list_pages()), 'playlist_page' => array('id' => 'playlist_page', 'name' => __('Playlist Page', 'mobile-dj-manager'), 'desc' => sprintf(__("Select your website's playlist page. Needs to contain the shortcode %s[mdjm-playlist]%s", 'mobile-dj-manager'), '<code>', '</code>'), 'type' => 'select', 'options' => mdjm_list_pages()), 'profile_page' => array('id' => 'profile_page', 'name' => __('Profile Page', 'mobile-dj-manager'), 'desc' => sprintf(__("Select your website's profile page. Needs to contain the shortcode %s[mdjm-profile]%s", 'mobile-dj-manager'), '<code>', '</code>'), 'type' => 'select', 'options' => mdjm_list_pages())), 'availability' => array('availability_settings' => array('id' => 'availability_settings', 'name' => '<h3>' . __('Availability Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'availability_status' => array('id' => 'availability_status', 'name' => __('Unavailable Statuses', 'mobile-dj-manager'), 'desc' => sprintf(__("CTRL (cmd on MAC) + Click to select %s status' that you want availability checker to report as unavailable", 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'multiple_select', 'options' => mdjm_all_event_status(), 'std' => mdjm_active_event_statuses()), 'availability_roles' => array('id' => 'availability_roles', 'name' => __('Employee Roles', 'mobile-dj-manager'), 'desc' => __('CTRL (cmd on MAC) + Click to select employee roles that need to be available', 'mobile-dj-manager'), 'type' => 'multiple_select', 'options' => mdjm_get_roles(), 'std' => array('dj')), 'avail_ajax' => array('id' => 'avail_ajax', 'name' => __('Use Ajax?', 'mobile-dj-manager'), 'desc' => __('Perform checks without page refresh', 'mobile-dj-manager'), 'type' => 'checkbox', 'std' => '1'), 'availability_check_pass_page' => array('id' => 'availability_check_pass_page', 'name' => __('Available Redirect Page', 'mobile-dj-manager'), 'desc' => __('Select a page to which users should be directed when an availability check is successful', 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_pages(array('text' => __('NO REDIRECT - USE TEXT', 'mobile-dj-manager'))), 'std' => 'text'), 'availability_check_pass_text' => array('id' => 'availability_check_pass_text', 'name' => __('Available Text', 'mobile-dj-manager'), 'desc' => __('Text to be displayed when you are available - Only displayed if <code>NO REDIRECT - USE TEXT</code> is selected above, unless you are redirecting to an MDJM Contact Form. Valid shortcodes <code>{event_date}</code> &amp; <code>{event_date_short}</code>', 'mobile-dj-manager'), 'type' => 'rich_editor', 'std' => __('Good news, we are available on the date you entered. Please contact us now', 'mobile-dj-manager')), 'availability_check_fail_page' => array('id' => 'availability_check_fail_page', 'name' => __('Unavailable Redirect Page', 'mobile-dj-manager'), 'desc' => __('Select a page to which users should be directed when an availability check is not successful', 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_pages(array('text' => __('NO REDIRECT - USE TEXT', 'mobile-dj-manager'))), 'std' => 'text'), 'availability_check_fail_text' => array('id' => 'availability_check_fail_text', 'name' => __('Unavailable Text', 'mobile-dj-manager'), 'desc' => __('Text to be displayed when you are not available - Only displayed if <code>NO REDIRECT - USE TEXT</code> is selected above. Valid shortcodes <code>{event_date}</code> &amp; <code>{event_date_short}</code>', 'mobile-dj-manager'), 'type' => 'rich_editor', 'std' => __('Unfortunately we do not appear to be available on the date you selected. Why not try another date below...', 'mobile-dj-manager'))))), 'payments' => apply_filters('mdjm_settings_payments', array('main' => array('gateway_settings' => array('id' => 'gateway_settings', 'name' => '<h3>' . __('Gateway Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'gateways' => array('id' => 'gateways', 'name' => __('Payment Gateways', 'mobile-dj-manager'), 'desc' => __('Choose the payment gateways you want to enable.', 'mobile-dj-manager'), 'type' => 'gateways', 'options' => mdjm_get_payment_gateways()), 'payment_gateway' => array('id' => 'payment_gateway', 'name' => __('Default Gateway', 'mobile-dj-manager'), 'desc' => __('This gateway will be loaded automatically with the payments page.', 'mobile-dj-manager'), 'type' => 'gateway_select', 'options' => mdjm_get_payment_gateways()), 'currency_settings' => array('id' => 'currency_settings', 'name' => '<h3>' . __('Currency Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'currency' => array('id' => 'currency', 'name' => __('Currency', 'mobile-dj-manager'), 'desc' => '', 'type' => 'select', 'options' => mdjm_get_currencies()), 'currency_format' => array('id' => 'currency_format', 'name' => __('Currency Position', 'mobile-dj-manager'), 'desc' => __('Where to display the currency symbol.', 'mobile-dj-manager'), 'type' => 'select', 'options' => array('before' => __('before price', 'mobile-dj-manager'), 'after' => __('after price', 'mobile-dj-manager'), 'before with space' => __('before price with space', 'mobile-dj-manager'), 'after with space' => __('after price with space', 'mobile-dj-manager'))), 'decimal' => array('id' => 'decimal', 'name' => __('Decimal Separator', 'mobile-dj-manager'), 'desc' => __('The symbol to separate decimal points. (Usually . or ,)', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'small', 'std' => '.'), 'thousands_seperator' => array('id' => 'thousands_seperator', 'name' => __('Thousands Separator', 'mobile-dj-manager'), 'desc' => '', 'type' => 'text', 'size' => 'small', 'std' => ','), 'deposit_settings' => array('id' => 'deposit_settings', 'name' => '<h3>' . sprintf(__('%s Settings', 'mobile-dj-manager'), mdjm_get_deposit_label()) . '</h3>', 'desc' => '', 'type' => 'header'), 'deposit_type' => array('id' => 'deposit_type', 'name' => mdjm_get_deposit_label() . "'s " . __('are', 'mobile-dj-manager'), 'desc' => sprintf(__('If you require ' . mdjm_get_deposit_label() . ' payments for your %s, how should they be calculated?', 'mobile-dj-manager'), mdjm_get_label_plural(true)), 'type' => 'select', 'options' => array('0' => 'Not required', 'percentage' => '% ' . sprintf(__('of %s value', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'fixed' => __('Fixed price', 'mobile-dj-manager'))), 'deposit_amount' => array('id' => 'deposit_amount', 'name' => mdjm_get_deposit_label() . ' ' . __('Amount', 'mobile-dj-manager'), 'desc' => sprintf(__("If your %s's are a percentage enter the value (i.e 20). For fixed prices, enter the amount in the format %s", 'mobile-dj-manager'), mdjm_get_deposit_label(), mdjm_format_amount('0')), 'type' => 'text', 'size' => 'small'), 'payment_form_settings' => array('id' => 'payment_form_settings', 'name' => '<h3>' . __('Payment Form Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'payment_label' => array('id' => 'payment_label', 'name' => __('Payment Label', 'mobile-dj-manager'), 'desc' => __('Display name of the label shown to clients to select the payment they wish to make.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'regular', 'std' => __('Make a Payment Towards', 'mobile-dj-manager')), 'other_amount_label' => array('id' => 'other_amount_label', 'name' => __('Label for Other Amount', 'mobile-dj-manager'), 'desc' => __('Enter your desired label for the other amount radio button.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'regular', 'std' => __('Other Amount', 'mobile-dj-manager')), 'payment_button' => array('id' => 'payment_button', 'name' => __('Payment Button Text', 'mobile-dj-manager'), 'desc' => __('The text you want to appear on the Payment Form submit button.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'regular', 'std' => __('Pay Now', 'mobile-dj-manager')), 'other_amount_default' => array('id' => 'other_amount_default', 'name' => __('Default', 'mobile-dj-manager') . ' ' . mdjm_get_option('other_amount_label', __('Other Amount', 'mobile-dj-manager')), 'desc' => sprintf(__('Enter the default amount to be used in the %s field.', 'mobile-dj-manager'), mdjm_get_option('other_amount_label', __('Other Amount', 'mobile-dj-manager'))), 'type' => 'text', 'size' => 'small', 'std' => '50.00'), 'tax_settings' => array('id' => 'tax_settings', 'name' => '<h3>' . __('Tax Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'enable_tax' => array('id' => 'enable_tax', 'name' => __('Enable Taxes?', 'mobile-dj-manager'), 'desc' => __('Enable if you need to add taxes to online payments', 'mobile-dj-manager'), 'type' => 'checkbox'), 'tax_type' => array('id' => 'tax_type', 'name' => __('Apply Tax As', 'mobile-dj-manager'), 'desc' => __('How do you apply tax?', 'mobile-dj-manager'), 'type' => 'select', 'options' => array('percentage' => __('% of total', 'mobile-dj-manager'), 'fixed' => __('Fixed rate', 'mobile-dj-manager')), 'std' => 'percentage'), 'tax_rate' => array('id' => 'tax_rate', 'name' => __('Tax Rate', 'mobile-dj-manager'), 'desc' => __('If you apply tax based on a fixed percentage (i.e. VAT) enter the value (i.e 20). For fixed rates, enter the amount in the format 0.00. Taxes will only be applied during checkout.', 'mobile-dj-manager'), 'type' => 'text', 'size' => 'small', 'std' => '20'), 'payment_types' => array('id' => 'payment_types', 'name' => '<h3>' . __('Payment Types', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'payment_sources' => array('id' => 'payment_sources', 'name' => __('Payment Types', 'mobile-dj-manager'), 'desc' => __('Enter methods of payment.', 'mobile-dj-manager'), 'type' => 'textarea', 'std' => __('BACS', 'mobile-dj-manager') . "\r\n" . __('Cash', 'mobile-dj-manager') . "\r\n" . __('Cheque', 'mobile-dj-manager') . "\r\n" . __('PayPal', 'mobile-dj-manager') . "\r\n" . __('PayFast', 'mobile-dj-manager') . "\r\n" . __('Stripe', 'mobile-dj-manager') . "\r\n" . __('Other', 'mobile-dj-manager')), 'default_type' => array('id' => 'default_type', 'name' => __('Default Payment Type', 'mobile-dj-manager'), 'desc' => sprintf(__('What is the default method of payment? i.e. if you select an %s %s as paid how should we log it?', 'mobile-dj-manager'), mdjm_get_label_singular(true), mdjm_get_balance_label()), 'type' => 'select', 'options' => mdjm_list_txn_sources())), 'employee_payments' => array('employee_payment_settings' => array('id' => 'employee_payment_settings', 'name' => '<h3>' . __('Employee Payment Settings', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'enable_employee_payments' => array('id' => 'enable_employee_payments', 'name' => __('Enable Employee Payments', 'mobile-dj-manager'), 'desc' => sprintf(__('Enable this option to be able to record employee wage payments for %s.', 'mobile-dj-manager'), mdjm_get_label_plural()), 'type' => 'checkbox'), 'employee_pay_status' => array('id' => 'employee_pay_status', 'name' => __('Payment Statuses', 'mobile-dj-manager'), 'desc' => sprintf(__("CTRL (cmd on MAC) + Click to select %s status' that an event must be at before employee payments can be made.", 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'type' => 'multiple_select', 'options' => mdjm_all_event_status(), 'std' => array('mdjm-completed')), 'employee_auto_pay_complete' => array('id' => 'employee_auto_pay_complete', 'name' => sprintf(__('Pay when %s Completes', 'mobile-dj-manager'), mdjm_get_label_singular()), 'desc' => sprintf(__('Enable this option to automatically pay employees once an %s completes.', 'mobile-dj-manager'), mdjm_get_label_singular()), 'type' => 'checkbox')), 'receipts' => array('payment_conf_templates' => array('id' => 'payment_conf_templates', 'name' => '<h3>' . __('Payment Receipts', 'mobile-dj-manager') . '</h3>', 'desc' => '', 'type' => 'header'), 'payment_cfm_template' => array('id' => 'payment_cfm_template', 'name' => __('Gateway Payment Receipt', 'mobile-dj-manager'), 'desc' => __('Select an email template to be sent as a receipt to clients when a gateway payment is received.', 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_templates('email_template', true)), 'manual_payment_cfm_template' => array('id' => 'manual_payment_cfm_template', 'name' => __('Manual Payment Receipt', 'mobile-dj-manager'), 'desc' => __('Select an email template to be sent as a receipt to clients when you manually log a payment.', 'mobile-dj-manager'), 'type' => 'select', 'options' => mdjm_list_templates('email_template', true))))), 'extensions' => apply_filters('mdjm_settings_extensions', array()), 'licenses' => apply_filters('mdjm_settings_licenses', array()));
    return apply_filters('mdjm_registered_settings', $mdjm_settings);
}
Exemplo n.º 9
0
/**
 * Given a currency determine the symbol to use. If no currency given, site default is used.
 * If no symbol is determine, the currency string is returned.
 *
 * @since 	1.3
 * @param	str		$currency	The currency string
 * @return	str		The symbol to use for the currency
 */
function mdjm_currency_symbol($currency = '')
{
    if (empty($currency)) {
        $currency = mdjm_get_currency();
    }
    switch ($currency) {
        case "GBP":
            $symbol = '&pound;';
            break;
        case "BRL":
            $symbol = 'R&#36;';
            break;
        case "EUR":
            $symbol = '&euro;';
            break;
        case "USD":
        case "AUD":
        case "NZD":
        case "CAD":
        case "HKD":
        case "MXN":
        case "SGD":
            $symbol = '&#36;';
            break;
        case "JPY":
            $symbol = '&yen;';
            break;
        default:
            $symbol = $currency;
            break;
    }
    return apply_filters('mdjm_currency_symbol', $symbol, $currency);
}