/** * 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); }
/** * Checks plugin version against db and updates * * @uses buddydrive_is_install() to see if first install * @uses buddydrive_get_db_version() to get db version * @uses buddydrive_get_version() to get BuddyDrive plugin version */ function buddydrive_check_version() { // Bail if config does not match what we need if (buddydrive::bail()) { return; } if (version_compare(buddydrive_get_db_version(), buddydrive_get_version(), '=')) { return; } if (buddydrive_is_install()) { // Do installation routine } else { if (buddydrive_is_update()) { // Do upgrade routine } } // Finally upgrade plugin version update_option('_buddydrive_version', buddydrive_get_version()); }
/** * Displays the Welcome screen * * @uses buddydrive_get_version() to get the current version of the plugin * @uses bp_get_admin_url() to build the url to settings page * @uses add_query_arg() to add args to the url */ public function about_screen() { global $wp_version; $display_version = buddydrive_get_version(); $settings_url = add_query_arg(array('page' => 'buddydrive'), bp_get_admin_url($this->settings_page)); ?> <div class="wrap about-wrap"> <h1><?php printf(__('BuddyDrive %s', 'buddydrive'), $display_version); ?> </h1> <div class="about-text"><?php printf(__('Thank you for upgrading to the latest version of BuddyDrive! BuddyDrive %s is ready to manage the files and folders of your buddies!', 'buddydrive'), $display_version); ?> </div> <div class="buddydrive-badge"></div> <h2 class="nav-tab-wrapper"> <a class="nav-tab nav-tab-active" href="<?php echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'buddydrive-about'), 'index.php'))); ?> "> <?php _e('About', 'buddydrive'); ?> </a> </h2> <div class="headline-feature"> <h3><?php esc_html_e('Meet the BuddyDrive Editor', 'buddydrive'); ?> </h3> <div class="featured-image"> <img src="<?php echo esc_url(buddydrive_get_images_url() . '/buddydrive-editor.png'); ?> " alt="<?php esc_attr_e('The BuddyDrive Editor', 'buddydrive'); ?> "> </div> <div class="feature-section"> <h3><?php esc_html_e('BuddyDrive is now using the BuddyPress Attachments API!', 'buddydrive'); ?> </h3> <p><?php esc_html_e('Introduced in BuddyPress 2.3, BuddyDrive uses this API to manage user uploads the BuddyPress way. It gave birth to a new BuddyDrive Editor. Now, you and plugins can use it to easily share public files with your community members.', 'buddydrive'); ?> <a href="https://github.com/imath/buddydrive/wiki/The-BuddyDrive-Editor"><?php esc_html_e('Learn more →', 'buddydrive'); ?> </a></p> </div> <div class="clear"></div> </div> <div class="feature-list"> <h2><?php printf(__('The other improvements in %s', 'buddydrive'), $display_version); ?> </h2> <div class="feature-section col two-col"> <div> <h4><?php esc_html_e('Bulk-deleting files in the Administration screen', 'buddydrive'); ?> </h4> <p><?php _e('When the community administrator bulk-deletes files having different owners, each owner's quota will now be updated.', 'buddydrive'); ?> </p> <h4><?php esc_html_e('Representation of embed public image files.', 'buddydrive'); ?> </h4> <p><?php esc_html_e('When you share a link to a file into the activity stream, a private message, a post, a page, ..., BuddyDrive is catching this link to build some specific output.', 'buddydrive'); ?> </p> <p><?php esc_html_e('Now, if this link is about a public image, a thumbnail will be displayed next to the file title (and description if provided).', 'buddydrive'); ?> </p> </div> <div class="last-feature"> <h4><?php esc_html_e('BuddyPress single group's latest activity', 'buddydrive'); ?> </h4> <p><?php esc_html_e('When a file is shared with the members of a group, the latest activity of the group will be updated.', 'buddydrive'); ?> </p> <h4><?php esc_html_e('Reassign deleted files', 'buddydrive'); ?> </h4> <p><?php esc_html_e('If you need to keep files when a user leaves your community (sad), you can use the following filter making sure to return the ID of a user having the bp_moderate capability.', 'buddydrive'); ?> </p> <p><code>buddydrive_set_owner_on_user_deleted</code></p> </div> </div> </div> <?php if (!empty($_REQUEST['is_new_install'])) { ?> <div class="changelog"> <h2 class="about-headline-callout"><?php esc_html_e('and always..', 'buddydrive'); ?> </h2> <div class="feature-section col two-col"> <div> <h4><?php _e('User's BuddyDrive', 'buddydrive'); ?> </h4> <p> <?php _e('It lives in the member's page just under the BuddyDrive tab.', 'buddydrive'); ?> <?php _e('The BuddyDrive edit bar allows the user to manage from one unique place his content.', 'buddydrive'); ?> <?php _e('He can add new files, new folders, set their privacy settings, edit them and of course delete them at any time.', 'buddydrive'); ?> </p> <img src="<?php echo buddydrive_get_plugin_url(); ?> /screenshot-1.png" style="width:90%"> </div> <div class="last-feature"> <h4><?php _e('BuddyDrive Uploader', 'buddydrive'); ?> </h4> <p> <?php _e('BuddyDrive uses WordPress HTML5 uploader and do not add any third party script to handle uploads.', 'buddydrive'); ?> <?php _e('WordPress is a fabulous tool and already knows how to deal with attachments for its content.', 'buddydrive'); ?> <?php _e('So BuddyDrive is managing uploads, the WordPress way!', 'buddydrive'); ?> </p> <img src="<?php echo buddydrive_get_plugin_url(); ?> /screenshot-2.png" style="width:90%"> </div> </div> </div> <div class="changelog"> <div class="feature-section col two-col"> <div> <h4><?php _e('BuddyDrive Folders', 'buddydrive'); ?> </h4> <p> <?php _e('Using folders is a convenient way to share a list of files at once.', 'buddydrive'); ?> <?php _e('Users just need to create a folder, open it an add the files of their choice to it.', 'buddydrive'); ?> <?php _e('When sharing a folder, a member actually shares the list of files that is attached to it.', 'buddydrive'); ?> </p> <img src="<?php echo buddydrive_get_images_url(); ?> /folder-demo.png" style="width:90%"> </div> <div class="last-feature"> <h4><?php _e('BuddyDrive privacy options', 'buddydrive'); ?> </h4> <p> <?php _e('There are five levels of privacy for the files or folders.', 'buddydrive'); ?> <?php _e('Depending on your BuddyPress settings, a user can set the privacy of a BuddyDrive item to:', 'buddydrive'); ?> </p> <ul> <li><?php _e('Private: the owner of the item will be the only one to be able to download the file.', 'buddydrive'); ?> </li> <li><?php _e('Password protected: a password will be required before being able to download the file.', 'buddydrive'); ?> </li> <li><?php _e('Public: everyone can download the file.', 'buddydrive'); ?> </li> <li><?php _e('Friends only: if the BuddyPress friendship component is active, a user can restrict a download to his friends only.', 'buddydrive'); ?> </li> <li><?php _e('One of the user's group: if the BuddyPress user groups component is active, and if the administrator of the group enabled BuddyDrive, a user can restrict the download to members of the group only.', 'buddydrive'); ?> </li> </ul> </div> </div> </div> <div class="changelog"> <div class="feature-section col two-col"> <div> <h4><?php _e('Sharing BuddyDrive items', 'buddydrive'); ?> </h4> <p> <?php _e('Depending on the privacy option of an item and the activated BuddyPress components, a user can :', 'buddydrive'); ?> </p> <ul> <li><?php _e('Share a public BuddyDrive item in his personal activity.', 'buddydrive'); ?> </li> <li><?php _e('Share a password protected item using the private messaging BuddyPress component.', 'buddydrive'); ?> </li> <li><?php _e('Alert his friends he shared a new item using the private messaging BuddyPress component.', 'buddydrive'); ?> </li> <li><?php _e('Share his file in a group activity to inform the other members of the group.', 'buddydrive'); ?> </li> <li><?php _e('Copy the link to his item and paste it anywhere in the blog or in a child blog (in case of a multisite configuration). This link will automatically be converted into a nice piece of html.', 'buddydrive'); ?> </li> </ul> </div> <div class="last-feature"> <h4><?php _e('Supervising BuddyDrive', 'buddydrive'); ?> </h4> <p> <?php _e('The administrator of the community can manage all BuddyDrive items from the backend of WordPress.', 'buddydrive'); ?> </p> <img src="<?php echo buddydrive_get_plugin_url(); ?> /screenshot-4.png" style="width:90%"> </div> </div> </div> <?php } ?> <div class="changelog"> <div class="return-to-dashboard"> <a href="<?php echo esc_url($settings_url); ?> " title="<?php esc_attr_e('Configure BuddyDrive', 'buddydrive'); ?> "><?php esc_html_e('Go to the BuddyDrive Settings page', 'buddydrive'); ?> </a> </div> </div> </div> <?php }