/** * Register css and script to be used by the BuddyDrive Editor * * @since 1.3.0 */ function buddydrive_register_public_file_scripts() { $min = '.min'; if (defined('SCRIPT_DEBUG') && true == SCRIPT_DEBUG) { $min = ''; } /** * Filter here if you wish to override and adapt the Editor css to your needs * * @param array { * $file url to the css of the Editor * $deps an array of your dependencies if needed, an empty array otherwise * } */ $css = apply_filters('buddydrive_register_public_file_css', array('file' => buddydrive_get_includes_url() . "css/buddydrive-public{$min}.css", 'deps' => array('dashicons'))); // Register the style wp_register_style('buddydrive-public-style', $css['file'], $css['deps'], buddydrive_get_version()); // Register the script wp_register_script('buddydrive-public-js', buddydrive_get_includes_url() . "js/buddydrive-public{$min}.js", array(), buddydrive_get_version(), true); }
/** * enqueue the needed scripts * * @uses wp_enqueue_script() * @uses wp_localize_script() to translate javascript messages */ public function enqueue_scripts() { wp_enqueue_script('buddydrive', buddydrive_get_includes_url() . 'js/buddydrive.js', array('plupload-all', 'jquery'), buddydrive_get_version(), true); $pluploadmessages = array('queue_limit_exceeded' => __('You have attempted to queue too many files.', 'buddydrive'), 'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.', 'buddydrive'), 'zero_byte_file' => __('This file is empty. Please try another.', 'buddydrive'), 'invalid_filetype' => __('This file type is not allowed. Please try another.', 'buddydrive'), 'not_an_image' => __('This file is not an image. Please try another.', 'buddydrive'), 'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.', 'buddydrive'), 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.', 'buddydrive'), 'default_error' => __('An error occurred in the upload. Please try again later.', 'buddydrive'), 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.', 'buddydrive'), 'upload_limit_exceeded' => __('You may only upload 1 file.', 'buddydrive'), 'http_error' => __('HTTP error.', 'buddydrive'), 'upload_failed' => __('Upload failed.', 'buddydrive'), 'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.', 'buddydrive'), 'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.', 'buddydrive'), 'io_error' => __('IO error.', 'buddydrive'), 'security_error' => __('Security error.', 'buddydrive'), 'file_cancelled' => __('File canceled.', 'buddydrive'), 'upload_stopped' => __('Upload stopped.', 'buddydrive'), 'dismiss' => __('Dismiss', 'buddydrive'), 'crunching' => __('Crunching…', 'buddydrive'), 'deleted' => __('moved to the trash.', 'buddydrive'), 'error_uploading' => __('“%s” has failed to upload.', 'buddydrive')); // get BuddyDrive specific and merge it with plupload $buddydrivel10n = buddydrive_get_js_l10n(); $pluploadmessages = array_merge($pluploadmessages, $buddydrivel10n); wp_localize_script('buddydrive', 'pluploadL10n', $pluploadmessages); }