From 42b4ef44c8aa7faf3a192775bb5ba20c72f2d09b Mon Sep 17 00:00:00 2001 From: Tremi Dkhar Date: Wed, 17 Mar 2021 13:38:25 +0530 Subject: [PATCH 01/54] Pass a valid array to the wp_localize_script() The $l10n arguments in the wp_localize_script() function requied an array to be pass instead of a string. See: https://developer.wordpress.org/reference/functions/wp_localize_script/#parameters --- app/admin/RTMediaAdmin.php | 24 +- app/admin/RTMediaUploadTermsAdmin.php | 2 +- app/main/RTMedia.php | 245 ++++++++++++------ app/main/RTMediaUploadTerms.php | 2 +- .../activity/RTMediaBuddyPressActivity.php | 13 +- .../shortcodes/RTMediaGalleryShortcode.php | 9 +- .../controllers/template/RTMediaTemplate.php | 10 +- 7 files changed, 208 insertions(+), 97 deletions(-) diff --git a/app/admin/RTMediaAdmin.php b/app/admin/RTMediaAdmin.php index a27ddc410..13859bb40 100755 --- a/app/admin/RTMediaAdmin.php +++ b/app/admin/RTMediaAdmin.php @@ -939,13 +939,6 @@ public function ui( $hook ) { ) ); - wp_localize_script( 'rtmedia-admin', 'rtmedia_on_label', __( 'ON', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-admin', 'rtmedia_off_label', __( 'OFF', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_ajax', $admin_ajax ); - wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() ); - /* path for file upload using ajax */ - wp_localize_script( 'rtmedia-admin', 'rtmedia_fileupload_url', RTMEDIA_URL . 'app/helper/rtUploadAttachment.php' ); - $rtmedia_admin_strings = array( 'no_refresh' => esc_html__( 'Please do not refresh this page.', 'buddypress-media' ), 'something_went_wrong' => esc_html__( 'Something went wrong. Please ', 'buddypress-media' ) . '' . esc_html__( 'refresh', 'buddypress-media' ) . '' . esc_html__( ' page.', 'buddypress-media' ), @@ -964,9 +957,20 @@ public function ui( $hook ) { 'wrong_css_input' => esc_html__( 'You can not use @import statement in custom css', 'buddypress-media' ), ); - wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_strings', $rtmedia_admin_strings ); - wp_localize_script( 'rtmedia-admin', 'settings_url', esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) . '#privacy_enabled' ); - wp_localize_script( 'rtmedia-admin', 'settings_rt_album_import_url', esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) ); + wp_localize_script( + 'rtmedia-admin', + 'rtmedia', + array( + 'on_label' => __( 'ON', 'buddypress-media' ), + 'off_label' => __( 'OFF', 'buddypress-media' ), + 'admin_ajax' => $admin_ajax, + 'admin_url' => admin_url(), + 'fileupload_url' => RTMEDIA_URL . 'app/helper/rtUploadAttachment.php', /* path for file upload using ajax */ + 'admin_strings' => $rtmedia_admin_strings, + 'settings_url' => esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ): admin_url( 'admin.php' ) ) ) ) . '#privacy_enabled', + 'settings_rt_album_import_url' => esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ), + ) + ); $rtmedia_admin_support_strings = array( 'wp_admin_username_error' => esc_html__( 'Please enter WP Admin Login.', 'buddypress-media' ), diff --git a/app/admin/RTMediaUploadTermsAdmin.php b/app/admin/RTMediaUploadTermsAdmin.php index 2f56bdca5..f2234cf27 100755 --- a/app/admin/RTMediaUploadTermsAdmin.php +++ b/app/admin/RTMediaUploadTermsAdmin.php @@ -65,7 +65,7 @@ public function enqueue_scripts_styles() { 'privacy_msg' => esc_html__( 'Please enter privacy message.', 'buddypress-media' ), ); - wp_localize_script( 'rtmedia-upload-terms-main', 'rtm_upload_terms_error_msgs', $translation_data ); + wp_localize_script( 'rtmedia-upload-terms-main', 'rtm_upload_terms', array( 'error_msgs' => $translation_data ) ); } diff --git a/app/main/RTMedia.php b/app/main/RTMedia.php index 3465b65e4..24643b2a4 100755 --- a/app/main/RTMedia.php +++ b/app/main/RTMedia.php @@ -1214,6 +1214,10 @@ public function create_table_error_notice() { public function enqueue_scripts_styles() { global $rtmedia, $bp, $rtmedia_interaction; + $rtmedia_main = array(); + $rtmedia_magnific = array(); + $rtmedia_backbone = array(); + $bp_template = get_option( '_bp_theme_package_id' ); wp_enqueue_script( 'rt-mediaelement', RTMEDIA_URL . 'lib/media-element/mediaelement-and-player.min.js', '', RTMEDIA_VERSION, true ); @@ -1274,7 +1278,8 @@ public function enqueue_scripts_styles() { true ); // localize for rtmedia js. - wp_localize_script( 'rtmedia-main', 'bp_template_pack', $bp_template ); + // wp_localize_script( 'rtmedia-main', 'bp_template_pack', $bp_template ); + $rtmedia_main['bp_template_pack'] = $bp_template; } $media_delete_confirmation_msg = __( 'Are you sure you want to delete this media?', 'buddypress-media' ); @@ -1298,63 +1303,113 @@ public function enqueue_scripts_styles() { */ $media_delete_success = apply_filters( 'rtmedia_media_delete_success_message', $media_delete_success_msg ); - wp_localize_script( - 'rtmedia-main', - 'RTMedia_Main_JS', - array( - 'media_delete_confirmation' => $media_delete_confirmation, - 'rtmedia_ajaxurl' => admin_url( 'admin-ajax.php' ), - 'media_delete_success' => $media_delete_success, - ) - ); - - wp_localize_script( 'rtmedia-main', 'rtmedia_ajax_url', admin_url( 'admin-ajax.php' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_media_slug', RTMEDIA_MEDIA_SLUG ); - wp_localize_script( 'rtmedia-main', 'rtmedia_lightbox_enabled', strval( $this->options['general_enableLightbox'] ) ); + // wp_localize_script( + // 'rtmedia-main', + // 'RTMedia_Main_JS', + // array( + // 'media_delete_confirmation' => $media_delete_confirmation, + // 'rtmedia_ajaxurl' => admin_url( 'admin-ajax.php' ), + // 'media_delete_success' => $media_delete_success, + // ) + // ); + $rtmedia_main['media_delete_confirmation'] = $media_delete_confirmation; + $rtmedia_main['rtmedia_ajaxurl'] = admin_url( 'admin-ajax.php' ); + $rtmedia_main['media_delete_success'] = $media_delete_success; + + + // wp_localize_script( 'rtmedia-main', 'rtmedia_ajax_url', admin_url( 'admin-ajax.php' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_media_slug', RTMEDIA_MEDIA_SLUG ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_lightbox_enabled', strval( $this->options['general_enableLightbox'] ) ); + $rtmedia_main['rtmedia_ajax_url'] = admin_url( 'admin-ajax.php' ); + $rtmedia_main['rtmedia_media_slug'] = RTMEDIA_MEDIA_SLUG; + $rtmedia_main['rtmedia_lightbox_enabled'] = strval( $this->options['general_enableLightbox'] ); $direct_upload = ( isset( $this->options['general_direct_upload'] ) ? $this->options['general_direct_upload'] : '0' ); - wp_localize_script( 'rtmedia-main', 'rtmedia_direct_upload_enabled', $direct_upload ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_direct_upload_enabled', $direct_upload ); + $rtmedia_main['rtmedia_direct_upload_enabled'] = $direct_upload; // gallery reload after media upload, by default true. - wp_localize_script( 'rtmedia-main', 'rtmedia_gallery_reload_on_upload', '1' ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_gallery_reload_on_upload', '1' ); + $rtmedia_main['rtmedia_gallery_reload_on_upload'] = '1'; // javascript messages. - wp_localize_script( 'rtmedia-magnific', 'rtmedia_load_more', __( 'Loading media', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_empty_activity_msg', __( 'Please enter some content to post.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_empty_comment_msg', __( 'Empty comment is not allowed.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_media_delete_confirmation', __( 'Are you sure you want to delete this media?', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_media_comment_delete_confirmation', __( 'Are you sure you want to delete this comment?', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_album_delete_confirmation', __( 'Are you sure you want to delete this Album?', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_drop_media_msg', __( 'Drop files here', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_album_created_msg', ' ' . __( 'album created successfully.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_something_wrong_msg', __( 'Something went wrong. Please try again.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_empty_album_name_msg', __( 'Enter an album name.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_max_file_msg', __( 'Max file Size Limit : ', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_allowed_file_formats', __( 'Allowed File Formats', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_select_all_visible', __( 'Select All Visible', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_unselect_all_visible', __( 'Unselect All Visible', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_no_media_selected', __( 'Please select some media.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_selected_media_delete_confirmation', __( 'Are you sure you want to delete the selected media?', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_selected_media_move_confirmation', __( 'Are you sure you want to move the selected media?', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_waiting_msg', __( 'Waiting', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_uploaded_msg', __( 'Uploaded', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_uploading_msg', __( 'Uploading', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_upload_failed_msg', __( 'Failed', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_close', __( 'Close', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_edit', __( 'Edit', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_delete', __( 'Delete', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_edit_media', __( 'Edit Media', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_remove_from_queue', __( 'Remove from queue', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_add_more_files_msg', __( 'Add more files', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_file_extension_error_msg', __( 'File not supported', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_more', __( 'more', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_less', __( 'less', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_read_more', __( 'Read more', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia__show_less', __( 'Show less', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_activity_text_with_attachment', apply_filters( 'rtmedia_required_activity_text_with_attachment', 'disable' ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_delete_uploaded_media', __( 'This media is uploaded. Are you sure you want to delete this media?', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-main', 'rtm_wp_version', get_bloginfo( 'version' ) ); - wp_localize_script( 'rtmedia-backbone', 'rMedia_loading_media', RTMEDIA_URL . 'app/assets/admin/img/boxspinner.gif' ); + // wp_localize_script( 'rtmedia-magnific', 'rtmedia_load_more', __( 'Loading media', 'buddypress-media' ) ); + $rtmedia_magnific['rtmedia_load_more'] = __( 'Loading media', 'buddypress-media' ); + + // wp_localize_script( 'rtmedia-main', 'rtmedia_empty_activity_msg', __( 'Please enter some content to post.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_empty_comment_msg', __( 'Empty comment is not allowed.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_media_delete_confirmation', __( 'Are you sure you want to delete this media?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_media_comment_delete_confirmation', __( 'Are you sure you want to delete this comment?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_album_delete_confirmation', __( 'Are you sure you want to delete this Album?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_drop_media_msg', __( 'Drop files here', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_album_created_msg', ' ' . __( 'album created successfully.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_something_wrong_msg', __( 'Something went wrong. Please try again.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_empty_album_name_msg', __( 'Enter an album name.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_max_file_msg', __( 'Max file Size Limit : ', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_allowed_file_formats', __( 'Allowed File Formats', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_select_all_visible', __( 'Select All Visible', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_unselect_all_visible', __( 'Unselect All Visible', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_no_media_selected', __( 'Please select some media.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_selected_media_delete_confirmation', __( 'Are you sure you want to delete the selected media?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_selected_media_move_confirmation', __( 'Are you sure you want to move the selected media?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_waiting_msg', __( 'Waiting', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_uploaded_msg', __( 'Uploaded', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_uploading_msg', __( 'Uploading', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_upload_failed_msg', __( 'Failed', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_close', __( 'Close', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_edit', __( 'Edit', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_delete', __( 'Delete', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_edit_media', __( 'Edit Media', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_remove_from_queue', __( 'Remove from queue', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_add_more_files_msg', __( 'Add more files', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_file_extension_error_msg', __( 'File not supported', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_more', __( 'more', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_less', __( 'less', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_read_more', __( 'Read more', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia__show_less', __( 'Show less', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_activity_text_with_attachment', apply_filters( 'rtmedia_required_activity_text_with_attachment', 'disable' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_delete_uploaded_media', __( 'This media is uploaded. Are you sure you want to delete this media?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtm_wp_version', get_bloginfo( 'version' ) ); + $rtmedia_main['rtmedia_empty_activity_msg'] = __( 'Please enter some content to post.', 'buddypress-media' ); + $rtmedia_main['rtmedia_empty_comment_msg'] = __( 'Empty comment is not allowed.', 'buddypress-media' ); + $rtmedia_main['rtmedia_media_delete_confirmation'] = __( 'Are you sure you want to delete this media?', 'buddypress-media' ); + $rtmedia_main['rtmedia_media_comment_delete_confirmation'] = __( 'Are you sure you want to delete this comment?', 'buddypress-media' ); + $rtmedia_main['rtmedia_album_delete_confirmation'] = __( 'Are you sure you want to delete this Album?', 'buddypress-media' ); + $rtmedia_main['rtmedia_drop_media_msg'] = __( 'Drop files here', 'buddypress-media' ); + $rtmedia_main['rtmedia_album_created_msg'] = ' ' . __( 'album created successfully.', 'buddypress-media' ); + $rtmedia_main['rtmedia_something_wrong_msg'] = __( 'Something went wrong. Please try again.', 'buddypress-media' ); + $rtmedia_main['rtmedia_empty_album_name_msg'] = __( 'Enter an album name.', 'buddypress-media' ); + $rtmedia_main['rtmedia_max_file_msg'] = __( 'Max file Size Limit: ', 'buddypress-media' ); + $rtmedia_main['rtmedia_allowed_file_formats'] = __( 'Allowed File Formats', 'buddypress-media' ); + $rtmedia_main['rtmedia_select_all_visible'] = __( 'Select All Visible', 'buddypress-media' ); + $rtmedia_main['rtmedia_unselect_all_visible'] = __( 'Unselect All Visible', 'buddypress-media' ); + $rtmedia_main['rtmedia_no_media_selected'] = __( 'Please select some media.', 'buddypress-media' ); + $rtmedia_main['rtmedia_selected_media_delete_confirmation'] = __( 'Are you sure you want to delete the selected media?', 'buddypress-media' ); + $rtmedia_main['rtmedia_selected_media_move_confirmation'] = __( 'Are you sure you want to move the selected media?', 'buddypress-media' ); + $rtmedia_main['rtmedia_waiting_msg'] = __( 'Waiting', 'buddypress-media' ); + $rtmedia_main['rtmedia_uploaded_msg'] = __( 'Uploaded', 'buddypress-media' ); + $rtmedia_main['rtmedia_uploading_msg'] = __( 'Uploading', 'buddypress-media' ); + $rtmedia_main['rtmedia_upload_failed_msg'] = __( 'Failed', 'buddypress-media' ); + $rtmedia_main['rtmedia_close'] = __( 'Close', 'buddypress-media' ); + $rtmedia_main['rtmedia_edit'] = __( 'Edit', 'buddypress-media' ); + $rtmedia_main['rtmedia_delete'] = __( 'Delete', 'buddypress-media' ); + $rtmedia_main['rtmedia_edit_media'] = __( 'Edit Media', 'buddypress-media' ); + $rtmedia_main['rtmedia_remove_from_queue'] = __( 'Remove from queue', 'buddypress-media' ); + $rtmedia_main['rtmedia_add_more_files_msg'] = __( 'Add more files', 'buddypress-media' ); + $rtmedia_main['rtmedia_file_extension_error_msg'] = __( 'File not supported', 'buddypress-media' ); + $rtmedia_main['rtmedia_more'] = __( 'more', 'buddypress-media' ); + $rtmedia_main['rtmedia_less'] = __( 'less', 'buddypress-media' ); + $rtmedia_main['rtmedia_read_more'] = __( 'Read more', 'buddypress-media' ); + $rtmedia_main['rtmedia__show_less'] = __( 'Show less', 'buddypress-media' ); + $rtmedia_main['rtmedia_activity_text_with_attachment'] = apply_filters( 'rtmedia_required_activity_text_with_attachment', 'disable' ); + $rtmedia_main['rtmedia_delete_uploaded_media'] = __( 'This media is uploaded. Are you sure you want to delete this media?', 'buddypress-media' ); + $rtmedia_main['rtm_wp_version'] = get_bloginfo( 'version' ); + + + // wp_localize_script( 'rtmedia-backbone', 'rMedia_loading_media', RTMEDIA_URL . 'app/assets/admin/img/boxspinner.gif' ); + $rtmedia_backbone['rMedia_loading_media'] = RTMEDIA_URL . 'app/assets/admin/img/boxspinner.gif'; + + $rtmedia_media_thumbs = array(); foreach ( $this->allowed_types as $key_type => $value_type ) { $rtmedia_media_thumbs[ $key_type ] = $value_type['thumbnail']; @@ -1367,9 +1422,13 @@ public function enqueue_scripts_styles() { * */ $rtmedia_media_thumbs = apply_filters( 'rtmedia_add_docs_thumbs', $rtmedia_media_thumbs ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_media_thumbs', $rtmedia_media_thumbs ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_set_featured_image_msg', __( 'Featured media set successfully.', 'buddypress-media' ) ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_unset_featured_image_msg', __( 'Featured media removed successfully.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_media_thumbs', $rtmedia_media_thumbs ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_set_featured_image_msg', __( 'Featured media set successfully.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_unset_featured_image_msg', __( 'Featured media removed successfully.', 'buddypress-media' ) ); + $rtmedia_backbone['rtmedia_media_thumbs'] = $rtmedia_media_thumbs; + $rtmedia_backbone['rtmedia_set_featured_image_msg'] = __( 'Featured media set successfully.', 'buddypress-media' ); + $rtmedia_backbone['rtmedia_unset_featured_image_msg'] = __( 'Featured media removed successfully.', 'buddypress-media' ); + wp_localize_script( 'rtmedia-backbone', 'rtmedia_edit_media_info_upload', @@ -1378,7 +1437,9 @@ public function enqueue_scripts_styles() { 'description' => esc_html__( 'Description:', 'buddypress-media' ), ) ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_no_media_found', __( 'Oops !! There\'s no media found for the request !!', 'buddypress-media' ) ); + + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_no_media_found', __( 'Oops !! There\'s no media found for the request !!', 'buddypress-media' ) ); + $rtmedia_backbone['rtmedia_no_media_found'] = __( 'Oops !! There\'s no media found for the request !!', 'buddypress-media' ); // Localizing strings for rtMedia.backbone.js. $rtmedia_backbone_strings = array( @@ -1386,9 +1447,11 @@ public function enqueue_scripts_styles() { ); // Localise fot rtmedia-backcone js. - wp_localize_script( 'rtmedia-backbone', 'bp_template_pack', $bp_template ); + // wp_localize_script( 'rtmedia-backbone', 'bp_template_pack', $bp_template ); + $rtmedia_backbone['bp_template_pack'] = $bp_template; - wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_strings', $rtmedia_backbone_strings ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_strings', $rtmedia_backbone_strings ); + $rtmedia_backbone['rtmedia_backbone_strings'] = $rtmedia_backbone_strings; // Localizing strings for rtMedia.js. $rtmedia_main_js_strings = array( @@ -1397,7 +1460,8 @@ public function enqueue_scripts_styles() { 'privacy_update_error' => esc_html__( 'Couldn\'t change privacy, please try again.', 'buddypress-media' ), ); - wp_localize_script( 'rtmedia-main', 'rtmedia_main_js_strings', $rtmedia_main_js_strings ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_main_js_strings', $rtmedia_main_js_strings ); + $rtmedia_main['rtmedia_main_js_strings'] = $rtmedia_main_js_strings; // Enqueue touchswipe. wp_enqueue_script( 'rtmedia-touchswipe', RTMEDIA_URL . 'lib/touchswipe/jquery.touchSwipe.min.js', array( 'jquery' ), RTMEDIA_VERSION, true ); @@ -1406,34 +1470,47 @@ public function enqueue_scripts_styles() { if ( wp_script_is( 'jquery-masonry', 'registered' ) ) { wp_enqueue_style( 'jquery-masonry' ); wp_enqueue_script( 'jquery-masonry' ); - wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout', 'true' ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout', 'true' ); + $rtmedia_main['rtmedia_masonry_layout'] = 'true'; + if ( isset( $rtmedia->options ) && isset( $rtmedia->options['general_masonry_layout_activity'] ) && 1 === intval( $rtmedia->options['general_masonry_layout_activity'] ) ) { - wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout_activity', 'true' ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout_activity', 'true' ); + $rt_media_main['rtmedia_masonry_layout_activity'] = 'true'; } else { - wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout_activity', 'false' ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout_activity', 'false' ); + $rtmedia_main['rtmedia_masonry_layout_activity'] = 'false'; + } } else { - wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout', 'false' ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout', 'false' ); + $rtmedia_main['rtmedia_masonry_layout'] = 'false'; } } else { - wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout', 'false' ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_masonry_layout', 'false' ); + $rtmedia_main['rtmedia_masonry_layout'] = 'false'; } if ( isset( $rtmedia->options['general_display_media'] ) ) { - wp_localize_script( 'rtmedia-backbone', 'rtmedia_load_more_or_pagination', (string) $rtmedia->options['general_display_media'] ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_load_more_or_pagination', (string) $rtmedia->options['general_display_media'] ); + $rtmedia_backbone['rtmedia_load_more_or_pagination'] = (string) $rtmedia->options['general_display_media']; } else { - wp_localize_script( 'rtmedia-backbone', 'rtmedia_load_more_or_pagination', 'load_more' ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_load_more_or_pagination', 'load_more' ); + $rtmedia_backbone[ 'rtmedia_load_more_or_pagination' ] = 'load_more'; } if ( isset( $rtmedia->options['buddypress_enableOnActivity'] ) ) { - wp_localize_script( 'rtmedia-backbone', 'rtmedia_bp_enable_activity', (string) $rtmedia->options['buddypress_enableOnActivity'] ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_bp_enable_activity', (string) $rtmedia->options['buddypress_enableOnActivity'] ); + $rtmedia_backbone['rtmedia_bp_enable_activity'] = (string) $rtmedia->options['buddypress_enableOnActivity']; } else { - wp_localize_script( 'rtmedia-backbone', 'rtmedia_bp_enable_activity', '0' ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_bp_enable_activity', '0' ); + $rtmedia_backbone['rtmedia_bp_enable_activity'] = '0'; } - wp_localize_script( 'rtmedia-backbone', 'rtmedia_upload_progress_error_message', __( 'There are some uploads in progress. Do you want to cancel them?', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_upload_progress_error_message', __( 'There are some uploads in progress. Do you want to cancel them?', 'buddypress-media' ) ); + $rtmedia_backbone['rtmedia_upload_progress_error_message'] = __( 'There are some uploads in progress. Do you want to cancel them?', 'buddypress-media' ); // Added to display error message when all media types upload are disabled. - wp_localize_script( 'rtmedia-backbone', 'rtmedia_media_disabled_error_message', __( 'Media upload is disabled. Please Enable at least one media type to proceed.', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_media_disabled_error_message', __( 'Media upload is disabled. Please Enable at least one media type to proceed.', 'buddypress-media' ) ); + $rtmedia_backbone[ 'rtmedia_media_disabled_error_message'] = __( 'Media upload is disabled. Please Enable at least one media type to proceed.', 'buddypress-media' ); // localise media size config. $media_size_config = array( @@ -1480,7 +1557,9 @@ public function enqueue_scripts_styles() { ), ), ); - wp_localize_script( 'rtmedia-main', 'rtmedia_media_size_config', $media_size_config ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_media_size_config', $media_size_config ); + $rtmedia_main[ 'rtmedia_media_size_config'] = $media_size_config; + // rtMedia fot comment media script localize. $request_uri = rtm_get_server_var( 'REQUEST_URI', 'FILTER_SANITIZE_URL' ); @@ -1542,18 +1621,25 @@ public function enqueue_scripts_styles() { if ( isset( $rtmedia->options['rtmedia_disable_media_in_commented_media'] ) ) { $rtmedia_disable_media = $rtmedia->options['rtmedia_disable_media_in_commented_media']; } - wp_localize_script( 'rtmedia-main', 'rtmedia_disable_media_in_commented_media', $rtmedia_disable_media ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_disable_media_in_commented_media', $rtmedia_disable_media ); + $rtmedia_main['rtmedia_disable_media_in_commented_media'] = $rtmedia_disable_media ; - wp_localize_script( 'rtmedia-main', 'rtmedia_disable_media_in_commented_media_text', __( 'Adding media in Comments is not allowed', 'buddypress-media' ) ); + // wp_localize_script( 'rtmedia-main', 'rtmedia_disable_media_in_commented_media_text', __( 'Adding media in Comments is not allowed', 'buddypress-media' ) ); + $rtmedia_main['rtmedia_disable_media_in_commented_media_text'] = __( 'Adding media in Comments is not allowed', 'buddypress-media' ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_exteansions', $rtmedia_extns ); - wp_localize_script( 'rtmedia-backbone', 'rtMedia_update_plupload_comment', $params ); - wp_localize_script( 'rtmedia-backbone', 'rMedia_loading_file', admin_url( '/images/loading.gif' ) ); + // wp_localize_script( 'rtmedia-backbone', 'rtmedia_exteansions', $rtmedia_extns ); + // wp_localize_script( 'rtmedia-backbone', 'rtMedia_update_plupload_comment', $params ); + // wp_localize_script( 'rtmedia-backbone', 'rMedia_loading_file', admin_url( '/images/loading.gif' ) ); + + $rtmedia_backbone['rtmedia_exteansions'] = $rtmedia_extns; + $rtmedia_backbone['rtMedia_update_plupload_comment'] = $params; + $rtmedia_backbone['rMedia_loading_file'] = admin_url( '/images/loading.gif' ); // Check if BuddyPress plugin is not activated. $is_buddypress_activate = rtm_is_buddypress_activate(); if ( empty( $is_buddypress_activate ) ) { - wp_localize_script( 'rtmedia-main', 'ajaxurl', admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ) ); + // wp_localize_script( 'rtmedia-main', 'ajaxurl', admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ) ); + $rtmedia_main[ 'ajaxurl'] = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ); } $options = $rtmedia->options; @@ -1564,6 +1650,11 @@ public function enqueue_scripts_styles() { $css = stripslashes( wp_filter_nohtml_kses( $options['styles_custom'] ) ); wp_add_inline_style( 'rtmedia-custom-css', $css ); } + + wp_localize_script( 'rtmedia-main', 'rtmedia_main', $rtmedia_main ); + wp_localize_script( 'rtmedia-magnific', 'rtmedia_magnific', $rtmedia_magnific ); + wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone', $rtmedia_backbone ); + } /** diff --git a/app/main/RTMediaUploadTerms.php b/app/main/RTMediaUploadTerms.php index 5c628b50c..9f1bb31d6 100755 --- a/app/main/RTMediaUploadTerms.php +++ b/app/main/RTMediaUploadTerms.php @@ -115,7 +115,7 @@ public function enqueue_scripts_styles() { ) ); - wp_localize_script( 'rtmedia-main', 'rtmedia_upload_terms_check_terms_message', $general_upload_terms_error_message ); + wp_localize_script( 'rtmedia-main', 'rtmedia_upload_terms', array( 'check_terms_message' => $general_upload_terms_error_message ) ); } } diff --git a/app/main/controllers/activity/RTMediaBuddyPressActivity.php b/app/main/controllers/activity/RTMediaBuddyPressActivity.php index 0e6bb043d..944c81656 100755 --- a/app/main/controllers/activity/RTMediaBuddyPressActivity.php +++ b/app/main/controllers/activity/RTMediaBuddyPressActivity.php @@ -785,9 +785,16 @@ public function bp_after_activity_post_form() { wp_enqueue_script( 'rtmedia-backbone', false, '', RTMEDIA_VERSION, true ); $is_album = is_rtmedia_album() ? true : false; $is_edit_allowed = is_rtmedia_edit_allowed() ? true : false; - wp_localize_script( 'rtmedia-backbone', 'is_album', $is_album ); - wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', $is_edit_allowed ); - wp_localize_script( 'rtmedia-backbone', 'rtMedia_update_plupload_config', $params ); + // wp_localize_script( 'rtmedia-backbone', 'is_album', $is_album ); + // wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', $is_edit_allowed ); + // wp_localize_script( 'rtmedia-backbone', 'rtMedia_update_plupload_config', $params ); + wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_bp', + array( + 'is_album' => $is_album, + 'is_edit_allowed' => $is_edit_allowed, + 'rtMedia_update_plupload_config' => $params, + ) + ); $upload_view = new RTMediaUploadView( array( 'activity' => true ) ); $upload_view->render( 'uploader' ); diff --git a/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php b/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php index 4a18c0531..1de65f22a 100755 --- a/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php +++ b/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php @@ -94,7 +94,9 @@ public static function register_scripts() { $template_url = esc_url( add_query_arg( $media_template_args, admin_url( 'admin-ajax.php' ) ), null, '' ); } - wp_localize_script( 'rtmedia-backbone', 'template_url', $template_url ); + // wp_localize_script( 'rtmedia-backbone', 'template_url', $template_url ); + wp_localize_script( 'rtmedia-backbon', 'rtmedia_template', array( 'url' => $template_url ) ); + $request_uri = rtm_get_server_var( 'REQUEST_URI', 'FILTER_SANITIZE_URL' ); $url = rtmedia_get_upload_url( $request_uri ); @@ -137,7 +139,7 @@ public static function register_scripts() { $params = apply_filters( 'rtmedia_modify_upload_params', $params ); - wp_localize_script( 'rtmedia-backbone', 'rtMedia_plupload_config', $params ); + wp_localize_script( 'rtmedia-backbone', 'rtMedia_plupload', array( 'config' => $params ) ); } /** @@ -245,7 +247,8 @@ public static function render( $attr ) { $template_url = esc_url( add_query_arg( $media_template_args, admin_url( 'admin-ajax.php' ) ), null, '' ); } - wp_localize_script( 'rtmedia-backbone', 'template_url', $template_url ); + // wp_localize_script( 'rtmedia-backbone', 'template_url', $template_url ); + wp_localize_script( 'rtmedia-backbon', 'rtmedia_template', array( 'url' => $template_url ) ); /** * Remove search_filter parameter from attr, diff --git a/app/main/controllers/template/RTMediaTemplate.php b/app/main/controllers/template/RTMediaTemplate.php index 2049fccda..a3e4f94ea 100755 --- a/app/main/controllers/template/RTMediaTemplate.php +++ b/app/main/controllers/template/RTMediaTemplate.php @@ -46,8 +46,14 @@ public function enqueue_scripts() { $is_album = is_rtmedia_album() ? true : false; $is_edit_allowed = is_rtmedia_edit_allowed() ? true : false; - wp_localize_script( 'rtmedia-backbone', 'is_album', array( $is_album ) ); - wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', array( $is_edit_allowed ) ); + // wp_localize_script( 'rtmedia-backbone', 'is_album', array( $is_album ) ); + // wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', array( $is_edit_allowed ) ); + wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_tpl', + array( + 'is_album' => $is_album, + 'is_edit_allowed' => $is_edit_allowed, + ) + ) } /** From 09e220aa8e3e469221541260665340d9602cf9dd Mon Sep 17 00:00:00 2001 From: Tremi Dkhar Date: Wed, 17 Mar 2021 13:56:55 +0530 Subject: [PATCH 02/54] Remove the array as the data is already in associated array --- app/admin/RTMediaUploadTermsAdmin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/RTMediaUploadTermsAdmin.php b/app/admin/RTMediaUploadTermsAdmin.php index f2234cf27..2f56bdca5 100755 --- a/app/admin/RTMediaUploadTermsAdmin.php +++ b/app/admin/RTMediaUploadTermsAdmin.php @@ -65,7 +65,7 @@ public function enqueue_scripts_styles() { 'privacy_msg' => esc_html__( 'Please enter privacy message.', 'buddypress-media' ), ); - wp_localize_script( 'rtmedia-upload-terms-main', 'rtm_upload_terms', array( 'error_msgs' => $translation_data ) ); + wp_localize_script( 'rtmedia-upload-terms-main', 'rtm_upload_terms_error_msgs', $translation_data ); } From 8512f2f4a05c8b670128c6dd68fd228fb9e03ae8 Mon Sep 17 00:00:00 2001 From: Tremi Dkhar Date: Wed, 17 Mar 2021 14:20:36 +0530 Subject: [PATCH 03/54] Match the variable name in the JS with the localize object --- app/assets/admin/js/scripts.js | 4 +- app/assets/admin/js/settings.js | 62 +++++++++++++++---------------- app/assets/js/rtMedia.backbone.js | 18 ++++----- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/assets/admin/js/scripts.js b/app/assets/admin/js/scripts.js index eac6ee006..ca69c792e 100644 --- a/app/assets/admin/js/scripts.js +++ b/app/assets/admin/js/scripts.js @@ -14,7 +14,7 @@ jQuery( document ).ready( function( $ ) { $( '.rtm-save-settings-msg' ).remove(); if ( 0 === $( '.rtm-fly-warning' ).length ) { - rtm_warning.innerText = rtmedia_admin_strings.settings_changed; + rtm_warning.innerText = rtmedia.admin_strings.settings_changed; $( '.rtm-button-container.top' ).prepend( rtm_warning ); $( '.rtm-fly-warning' ).slideDown(); @@ -203,7 +203,7 @@ jQuery( document ).ready( function( $ ) { // if @import found in the css, then show error message if ( removable_line != null ) { - jQuery( '#rtmedia-custom-css' ).after( '

' + rtmedia_admin_strings.wrong_css_input + '

' ); + jQuery( '#rtmedia-custom-css' ).after( '

' + rtmedia.admin_strings.wrong_css_input + '

' ); return false; } } diff --git a/app/assets/admin/js/settings.js b/app/assets/admin/js/settings.js index fae4c5265..e7d15dea6 100755 --- a/app/assets/admin/js/settings.js +++ b/app/assets/admin/js/settings.js @@ -35,7 +35,7 @@ jQuery( document ).ready( function ( $ ) { action: 'rtmedia_linkback', linkback: jQuery( '#bp-media-add-linkback:checked' ).length }; - jQuery.post( rtmedia_admin_ajax, data, function ( response ) { + jQuery.post( rtmedia.admin_ajax, data, function ( response ) { } ); } ); @@ -120,10 +120,10 @@ jQuery( document ).ready( function ( $ ) { var general_videothumb_val = 0; if ( general_videothumb.val() <= 0 ) { - error_msg += rtmedia_admin_strings.video_thumbnail_error; + error_msg += rtmedia.admin_strings.video_thumbnail_error; general_videothumb_val = 2; } else if ( ! reg.test( general_videothumb.val() ) ) { - error_msg += rtmedia_admin_strings.video_thumbnail_invalid_value + ' ' + Math.round( general_videothumb.val() ) + "."; + error_msg += rtmedia.admin_strings.video_thumbnail_invalid_value + ' ' + Math.round( general_videothumb.val() ) + "."; general_videothumb_val = Math.round( general_videothumb.val() ); } @@ -147,11 +147,11 @@ jQuery( document ).ready( function ( $ ) { if ( return_code && 1 === general_jpeg_image_quality.length && 'undefined' !== typeof general_jpeg_image_quality ) { if ( general_jpeg_image_quality.val() <= 0 ) { - error_msg += rtmedia_admin_strings.jpeg_quality_negative_error; + error_msg += rtmedia.admin_strings.jpeg_quality_negative_error; } else if ( general_jpeg_image_quality.val() > 100 ) { - error_msg += rtmedia_admin_strings.jpeg_quality_percentage_error; + error_msg += rtmedia.admin_strings.jpeg_quality_percentage_error; } else if ( ! reg.test( general_jpeg_image_quality.val() ) ) { - error_msg += rtmedia_admin_strings.jpeg_quality_invalid_value + ' ' + Math.round( general_jpeg_image_quality.val() ) + "."; + error_msg += rtmedia.admin_strings.jpeg_quality_invalid_value + ' ' + Math.round( general_jpeg_image_quality.val() ) + "."; } if ( '' !== error_msg ) { @@ -177,9 +177,9 @@ jQuery( document ).ready( function ( $ ) { if ( return_code && 1 === general_perPageMedia.length && 'undefined' !== typeof general_perPageMedia ) { if ( 1 > general_perPageMedia.val() ) { - error_msg += rtmedia_admin_strings.per_page_media_negative_value; + error_msg += rtmedia.admin_strings.per_page_media_negative_value; } else if ( jQuery.isNumeric( general_perPageMedia.val() ) && ( Math.floor( general_perPageMedia.val() ) != general_perPageMedia.val() ) ) { - error_msg += rtmedia_admin_strings.per_page_media_positive_error + " " + Math.round( general_perPageMedia.val() ) + "."; + error_msg += rtmedia.admin_strings.per_page_media_positive_error + " " + Math.round( general_perPageMedia.val() ) + "."; } if ( '' !== error_msg ) { @@ -201,9 +201,9 @@ jQuery( document ).ready( function ( $ ) { jQuery( document ).on( 'click', "#bpm-services .encoding-try-now,#rtm-services .encoding-try-now", function ( e ) { e.preventDefault(); - if ( confirm( rtmedia_admin_strings.are_you_sure ) ) { + if ( confirm( rtmedia.admin_strings.are_you_sure ) ) { var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif" + src : rtmedia.admin_url + "images/wpspin_light.gif" }; jQuery( this ).after( rtMediaAdmin.templates.rtm_image( data ) ); @@ -240,7 +240,7 @@ jQuery( document ).ready( function ( $ ) { if ( jQuery( this ).next( 'img' ).length == 0 ) { var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif" + src : rtmedia.admin_url + "images/wpspin_light.gif" }; jQuery( this ).after( rtMediaAdmin.templates.rtm_image( data ) ); @@ -284,9 +284,9 @@ jQuery( document ).ready( function ( $ ) { jQuery( document ).on( 'click', '#disable-encoding', function ( e ) { e.preventDefault(); - if ( confirm( rtmedia_admin_strings.disable_encoding ) ) { + if ( confirm( rtmedia.admin_strings.disable_encoding ) ) { var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif" + src : rtmedia.admin_url + "images/wpspin_light.gif" }; jQuery( this ).after( rtMediaAdmin.templates.rtm_image( data ) ); @@ -321,7 +321,7 @@ jQuery( document ).ready( function ( $ ) { var data = { id : 'settings-error-encoding-disabled', - msg : rtmedia_admin_strings.something_went_wrong, + msg : rtmedia.admin_strings.something_went_wrong, class : 'error' }; @@ -334,9 +334,9 @@ jQuery( document ).ready( function ( $ ) { jQuery( document ).on( 'click', '#enable-encoding', function ( e ) { e.preventDefault(); - if ( confirm( rtmedia_admin_strings.enable_encoding ) ) { + if ( confirm( rtmedia.admin_strings.enable_encoding ) ) { var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif" + src : rtmedia.admin_url + "images/wpspin_light.gif" }; jQuery( this ).after( rtMediaAdmin.templates.rtm_image( data ) ); @@ -371,7 +371,7 @@ jQuery( document ).ready( function ( $ ) { var data = { id : 'settings-error-encoding-enabled', - msg : rtmedia_admin_strings.something_went_wrong, + msg : rtmedia.admin_strings.something_went_wrong, class : 'error' }; @@ -392,7 +392,7 @@ jQuery( document ).ready( function ( $ ) { jQuery( this ).dialog( "close" ); var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif" + src : rtmedia.admin_url + "images/wpspin_light.gif" }; var bpm_unsubscribe = $( '.bpm-unsubscribe' ); @@ -462,7 +462,7 @@ jQuery( document ).ready( function ( $ ) { jQuery.post( ajaxurl, { action: 'rtmedia_privacy_redirect' }, function ( response ) { - window.location = settings_url; + window.location = rtmedia.settings_url ; } ); } } else { @@ -616,7 +616,7 @@ jQuery( document ).ready( function ( $ ) { jQuery('#map_progress_msgs').html( rtMediaAdmin.templates.rtm_map_mapping_failure( map_data ) ); } else { var map_data = { - msg : rtmedia_admin_strings.request_failed + msg : rtmedia.admin_strings.request_failed }; jQuery('#map_progress_msgs').html( rtMediaAdmin.templates.rtm_map_mapping_failure( map_data ) ); @@ -655,7 +655,7 @@ jQuery( document ).ready( function ( $ ) { action: 'rtmedia_rt_album_cleanup', rtm_wpnonce: jQuery('#bpaimporter_wpnonce').val() }, function ( response ) { - window.location = settings_rt_album_import_url; + window.location = rtmedia.settings_rt_album_import_url; } ); } ); @@ -689,9 +689,9 @@ jQuery( document ).ready( function ( $ ) { if ( !jQuery( '.bpm-ajax-loader' ).length ) { var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif", + src : rtmedia.admin_url + "images/wpspin_light.gif", class : 'bpm-ajax-loader', - norefresh : rtmedia_admin_strings.no_refresh + norefresh : rtmedia.admin_strings.no_refresh }; jQuery( this ).after( rtMediaAdmin.templates.rtm_image( data ) ); @@ -778,7 +778,7 @@ jQuery( document ).ready( function ( $ ) { location.reload(); } else { var p_data = { - msg : rtmedia_admin_strings.something_went_wrong + msg : rtmedia.admin_strings.something_went_wrong }; $bpalbum.parent().after( rtMediaAdmin.templates.rtm_p_tag( p_data ) ); @@ -788,7 +788,7 @@ jQuery( document ).ready( function ( $ ) { jQuery( '.updated' ).on( 'click', '.bpm-hide-encoding-notice', function () { var data = { - src : rtmedia_admin_url + "images/wpspin_light.gif" + src : rtmedia.admin_url + "images/wpspin_light.gif" }; jQuery( this ).after( rtMediaAdmin.templates.rtm_image( data ) ); @@ -820,10 +820,10 @@ jQuery( document ).ready( function ( $ ) { var onData = ''; var offData = ''; - if ( rtmedia_on_label !== undefined ) - onData = 'data-on-label="' + rtmedia_on_label + '"'; - if ( rtmedia_off_label !== undefined ) - offData = 'data-off-label="' + rtmedia_off_label + '"'; + if ( rtmedia.on_label !== undefined ) + onData = 'data-on-label="' + rtmedia.on_label + '"'; + if ( rtmedia.off_label !== undefined ) + offData = 'data-off-label="' + rtmedia.off_label + '"'; var files; /* upload file immediately after selecting it */ @@ -979,7 +979,7 @@ jQuery( document ).ready( function ( $ ) { data.append( 'action', 'rtmedia_admin_upload' ); jQuery.ajax({ - url: rtmedia_admin_ajax, + url: rtmedia.admin_ajax, type: 'POST', data: data, cache: false, @@ -1099,7 +1099,7 @@ function rtmedia_addon_do_not_show() { var data = { action: 'rtmedia_addon_popup_not_show_again' }; - jQuery.post( rtmedia_admin_ajax, data, function ( response ) { + jQuery.post( rtmedia.admin_ajax, data, function ( response ) { jQuery( '#TB_window' ).remove(); jQuery( '#TB_overlay' ).remove(); } ); diff --git a/app/assets/js/rtMedia.backbone.js b/app/assets/js/rtMedia.backbone.js index 0a8c25281..4b754262c 100755 --- a/app/assets/js/rtMedia.backbone.js +++ b/app/assets/js/rtMedia.backbone.js @@ -83,15 +83,15 @@ jQuery( function( $ ) { var o_is_album, o_is_edit_allowed; - if ( typeof ( is_album ) == 'undefined' ) { + if ( typeof ( rtmedia_backbone_check.is_album ) == 'undefined' ) { o_is_album = new Array( '' ); } else { - o_is_album = is_album; + o_is_album = rtmedia_backbone_check.is_album; } - if ( typeof ( is_edit_allowed ) == 'undefined' ) { + if ( typeof ( rtmedia_backbone_check.is_edit_allowed ) == 'undefined' ) { o_is_edit_allowed = new Array( '' ); } else { - o_is_edit_allowed = is_edit_allowed; + o_is_edit_allowed = rtmedia_backbone_check.is_edit_allowed; } rtMedia = window.rtMedia || { }; @@ -178,12 +178,12 @@ jQuery( function( $ ) { that = this; if ( rtmedia_load_template_flag == true ) { if ( jQuery( '.rtmedia_gallery_wrapper' ).find( 'input[name=media_title]' ).length > 0 ) { - template_url += '&media_title=' + jQuery( '.rtmedia_gallery_wrapper' ).find( 'input[name=media_title]' ).val(); + rtmedia_template.url += '&media_title=' + jQuery( '.rtmedia_gallery_wrapper' ).find( 'input[name=media_title]' ).val(); } if ( jQuery( '.rtmedia_gallery_wrapper' ).find( 'input[name=lightbox]' ).length > 0 ) { - template_url += '&lightbox=' + jQuery( '.rtmedia_gallery_wrapper' ).find( 'input[name=lightbox]' ).val(); + rtmedia_template.url += '&lightbox=' + jQuery( '.rtmedia_gallery_wrapper' ).find( 'input[name=lightbox]' ).val(); } - $( '#rtmedia-gallery-item-template' ).load( template_url, { backbone: true, is_album: o_is_album, is_edit_allowed: o_is_edit_allowed }, function() { + $( '#rtmedia-gallery-item-template' ).load( rtmedia_template.url, { backbone: true, is_album: o_is_album, is_edit_allowed: o_is_edit_allowed }, function() { rtmedia_load_template_flag = false; that.getNext( page, el, element); } ); @@ -1151,7 +1151,7 @@ jQuery( document ).ready( function( $ ) { } } ); - if ( typeof rtMedia_update_plupload_config == 'undefined' ) { + if ( typeof rtmedia_backbone_check.rtMedia_update_plupload_config == 'undefined' ) { return false; } var activity_attachemnt_ids = [ ]; @@ -1161,7 +1161,7 @@ jQuery( document ).ready( function( $ ) { } if ( rtmedia_add_media_button_post_update.length > 0 ) { - objUploadView = new UploadView( rtMedia_update_plupload_config ); + objUploadView = new UploadView( rtmedia_backbone_check.rtMedia_update_plupload_config ); objUploadView.initUploader(); setTimeout( function() { From ab6b41601a0c861d3c9b3050cc28b060e675ebd6 Mon Sep 17 00:00:00 2001 From: Tremi Dkhar Date: Wed, 17 Mar 2021 14:22:20 +0530 Subject: [PATCH 04/54] Match the object name with the variable in the JS --- app/main/controllers/activity/RTMediaBuddyPressActivity.php | 2 +- app/main/controllers/template/RTMediaTemplate.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main/controllers/activity/RTMediaBuddyPressActivity.php b/app/main/controllers/activity/RTMediaBuddyPressActivity.php index 944c81656..68794db7c 100755 --- a/app/main/controllers/activity/RTMediaBuddyPressActivity.php +++ b/app/main/controllers/activity/RTMediaBuddyPressActivity.php @@ -788,7 +788,7 @@ public function bp_after_activity_post_form() { // wp_localize_script( 'rtmedia-backbone', 'is_album', $is_album ); // wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', $is_edit_allowed ); // wp_localize_script( 'rtmedia-backbone', 'rtMedia_update_plupload_config', $params ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_bp', + wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_check', array( 'is_album' => $is_album, 'is_edit_allowed' => $is_edit_allowed, diff --git a/app/main/controllers/template/RTMediaTemplate.php b/app/main/controllers/template/RTMediaTemplate.php index a3e4f94ea..7219b6458 100755 --- a/app/main/controllers/template/RTMediaTemplate.php +++ b/app/main/controllers/template/RTMediaTemplate.php @@ -48,7 +48,7 @@ public function enqueue_scripts() { // wp_localize_script( 'rtmedia-backbone', 'is_album', array( $is_album ) ); // wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', array( $is_edit_allowed ) ); - wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_tpl', + wp_localize_script( 'rtmedia-backbone', 'rtmedia_backbone_check', array( 'is_album' => $is_album, 'is_edit_allowed' => $is_edit_allowed, From 0579074c7fcfbf37dabd9f9b885ee886f0653f09 Mon Sep 17 00:00:00 2001 From: Tremi Dkhar Date: Wed, 17 Mar 2021 14:23:08 +0530 Subject: [PATCH 05/54] Update the variable name to match the localize object --- app/importers/RTMediaMediaSizeImporter.php | 2 +- app/importers/RTMediaMigration.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/importers/RTMediaMediaSizeImporter.php b/app/importers/RTMediaMediaSizeImporter.php index 90cf04bb4..69b12b03a 100644 --- a/app/importers/RTMediaMediaSizeImporter.php +++ b/app/importers/RTMediaMediaSizeImporter.php @@ -182,7 +182,7 @@ function db_start_migration(db_done, db_total, last_id) { "nonce": jQuery.trim(jQuery('#rtmedia_media_size_import_nonce').val()) }; jQuery.ajax({ - url: rtmedia_admin_ajax, + url: rtmedia.admin_ajax, type: 'post', data: ajax_data, success: function (sdata) { diff --git a/app/importers/RTMediaMigration.php b/app/importers/RTMediaMigration.php index 0442b472e..52defdcbd 100755 --- a/app/importers/RTMediaMigration.php +++ b/app/importers/RTMediaMigration.php @@ -559,7 +559,7 @@ function db_start_migration(db_done, db_total) { if (db_done < db_total) { jQuery("#rtMediaSyncing").show(); jQuery.ajax({ - url: rtmedia_admin_ajax, + url: rtmedia.admin_ajax, type: 'post', data: { "action": "bp_media_rt_db_migration", From 109d3fa56cd2e7b1e2c3ce3efb98e416f92262a1 Mon Sep 17 00:00:00 2001 From: Tremi Dkhar Date: Wed, 17 Mar 2021 16:01:38 +0530 Subject: [PATCH 06/54] Match the variable in the php localize function with that in the JavaScript --- app/assets/admin/js/admin.min.js | 2 +- app/assets/admin/js/settings.js | 38 +++--- app/assets/js/rtMedia.backbone.js | 128 +++++++++--------- app/assets/js/rtMedia.js | 78 +++++------ app/assets/js/rtm-upload-terms.js | 2 +- app/assets/js/rtm-upload-terms.min.js | 2 +- app/assets/js/rtmedia.min.js | 2 +- app/importers/RTMediaMediaSizeImporter.php | 2 +- app/main/RTMedia.php | 25 ++-- .../activity/RTMediaBuddyPressActivity.php | 6 +- 10 files changed, 140 insertions(+), 145 deletions(-) diff --git a/app/assets/admin/js/admin.min.js b/app/assets/admin/js/admin.min.js index 03edc63b0..54ec2e610 100644 --- a/app/assets/admin/js/admin.min.js +++ b/app/assets/admin/js/admin.min.js @@ -3,4 +3,4 @@ * @package rtMedia */ -"function"!=typeof Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),function(n,s){var r={init:function(e,t){var r=this;r.elem=t,r.$elem=n(t),r.options=n.extend({},n.fn.rtTab.options,e),r.rtTabs()},rtTabs:function(){var t=this,e=t.options.activeTab;if(t.$elem.find("li:nth-child("+e+")").addClass("active"),t.rtTabContent(activeTabContent="yes"),t.rtClick(),!0==("false"!==t.$elem.attr("data-hash"))){var r=s.location.hash;r&&t.$elem.find("li").find('a[href="'+r+'"]').trigger("click"),n(s).on("hashchange",function(){var e=s.location.hash;t.$elem.find("li").find('a[href="'+e+'"]').trigger("click")})}},rtClick:function(){var a=this,i=a.$elem.find("li");i.find("a").on("click",function(e){e.preventDefault(),i.removeClass("active"),a.rtTabContent(),n(this).parent().addClass("active");var t=n(this).attr("href");if(n(t).removeClass("hide"),!0==("false"!==a.$elem.attr("data-hash"))){var r=n(s).scrollTop();location.hash=n(this).attr("href"),n(s).scrollTop(r)}"function"==typeof a.options.onComplete&&a.options.onComplete.apply(a.elem,arguments)})},rtTabContent:function(r){this.$elem.find("li").find("a").each(function(){var e=n(this),t=e.attr("href");"yes"===r&&e.parent().hasClass("active")||n(t).addClass("hide")})}};n.fn.rtTab=function(t){return this.each(function(){var e=Object.create(r);e.init(t,this),n.data(this,"rtTab",e)})},n.fn.rtTab.options={activeTab:1,onComplete:null}}(jQuery,window,document),jQuery(document).ready(function(a){var e=document.createElement("div");e.setAttribute("class","rtm-warning rtm-fly-warning hide"),a(".rtm-tabs").rtTab(),a('input[name^="rtmedia-options"]').on("change",function(){a(".rtm-save-settings-msg").remove(),0===a(".rtm-fly-warning").length&&(e.innerText=rtmedia_admin_strings.settings_changed,a(".rtm-button-container.top").prepend(e),a(".rtm-fly-warning").slideDown())}),a(".rtm-img-size-setting .form-table tr:nth-child(7) td:last-child").attr("colspan","3"),a(".rtm-field-wrap .switch input[type=checkbox]").each(function(){var e=a(this);e.parents("table").attr("data-depends")||(e.is(":checked")?(e.parents("table").next(".rtm-notice").slideDown(),e.parents("table").siblings("table").each(function(){a(this).attr("data-depends")&&a(this).slideDown()})):(e.parents("table").next(".rtm-notice").slideUp(),e.parents("table").siblings("table").each(function(){a(this).attr("data-depends")&&a(this).slideUp()}))),e.parents("tr").next("tr").attr("data-depends")&&(e.is(":checked")?e.parents("tr").next("tr").slideDown():e.parents("tr").next("tr").slideUp())}),a(".rtm-field-wrap .switch input[type=checkbox]").on("change",function(){var e=a(this);e.parents("table").attr("data-depends")||(e.parents("table").next(".rtm-notice").slideToggle(),e.parents("table").siblings("table").each(function(){a(this).attr("data-depends")&&a(this).slideToggle()})),e.parents("tr").next("tr").attr("data-depends")&&e.parents("tr").next("tr").slideToggle()});new(Backbone.View.extend({el:a(".bp-media-admin"),events:{"click .rtm-theme":"render","click .rtm-close":"close","click .rtm-previous":"previousTheme","click .rtm-next":"nextTheme",keyup:"keyEvent"},initialize:function(){_.bindAll(this,"render","close","nextTheme","previousTheme","keyEvent"),this.keyEvent()},render:function(e){a(".rtm-theme").removeClass("rtm-modal-open");var t=a(e.currentTarget).addClass("rtm-modal-open").find(".rtm-theme-content").html();if(a(".rtm-theme-overlay")[0])a(".rtm-theme-overlay").show(),a(this.el).find(".rtm-theme-content-wrap").empty().append(t);else{var r={themeContent:t};a(this.el).append(rtMediaAdmin.templates.rtm_theme_overlay(r))}a(e.currentTarget).is(":first-child")?a(".rtm-previous").addClass("disabled"):a(e.currentTarget).is(":last-child")?a(".rtm-next").addClass("disabled"):a(".rtm-next, .rtm-previous").removeClass("disabled")},close:function(){a(".rtm-theme").removeClass("rtm-modal-open"),a(".rtm-theme-overlay").hide(),a(".rtm-next, .rtm-previous").removeClass("disabled")},nextTheme:function(e){return a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:last-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").next().trigger("click"),!1},previousTheme:function(e){return a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:first-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").prev().trigger("click"),!1},keyEvent:function(){a("body").on("keyup",function(e){return 39===e.keyCode?(a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:last-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").next().trigger("click"),!1):37===e.keyCode?(a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:first-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").prev().trigger("click"),!1):void(27===e.keyCode&&a(".rtm-close").trigger("click"))})}}));jQuery("#rtm-licenses .regular-text").each(function(){jQuery(this).keypress(function(e){if("13"==(e.keyCode?e.keyCode:e.which))return!1})}),jQuery("#bp_media_settings_form").on("submit",function(e){jQuery("#rtcss-notice").remove();var t=jQuery("#rtmedia-custom-css").val().match(/@import\s*(url)?\s*\(?([^;]+?)\)?;/);if(null!=t&&null!=t[0])return jQuery("#rtmedia-custom-css").after('

'+rtmedia_admin_strings.wrong_css_input+"

"),!1})});var rtMediaAdmin=new Object;function rtmedia_addon_do_not_show(){jQuery.post(rtmedia_admin_ajax,{action:"rtmedia_addon_popup_not_show_again"},function(e){jQuery("#TB_window").remove(),jQuery("#TB_overlay").remove()})}rtMediaAdmin.templates={rtm_image:wp.template("rtm-image"),rtm_msg_div:wp.template("rtm-msg-div"),rtm_album_favourites_importer:wp.template("rtm-album-favourites-importer"),rtm_map_mapping_failure:wp.template("rtm-map-mapping-failure"),rtm_p_tag:wp.template("rtm-p-tag"),rtm_theme_overlay:wp.template("rtm-theme-overlay")},jQuery(document).ready(function(g){var i=g("#bp-media-settings-boxes"),t=g("#bp_media_settings_form .bp-media-metabox-holder"),e=g("#rtm-licenses");0div").css("width",t+"%"),jQuery(".bp-album-comments #rtprogressbar>div").css("width",r+"%"),jQuery(".bp-album-users #rtprogressbar>div").css("width",a+"%"),media_finished=jQuery("#bpmedia-bpalbumimporter .bp-album-media span.finished").html(),parseInt(media_finished)div").css("width",t+"%"),redirect&&window.setTimeout(s,2e3)})}(t)})})}},"json"))}else if(n.hasOwnProperty(page)){var i={msg:"Row "+e.page+" failed."};jQuery("#map_progress_msgs").html(rtMediaAdmin.templates.rtm_map_mapping_failure(i))}else{i={msg:rtmedia_admin_strings.request_failed};jQuery("#map_progress_msgs").html(rtMediaAdmin.templates.rtm_map_mapping_failure(i))}})}function s(){window.location=document.URL}r.className="support_form_loader",0div").css("width",r+"%"),finished=jQuery("#rtprivacyinstaller span.finished").html(),jQuery("#rtprivacyinstaller span.finished").html(parseInt(finished)+i.count),t&&jQuery.post(ajaxurl,{action:"rtmedia_privacy_redirect"},function(e){window.location=settings_url})}else{var a={msg:"Row "+e+" failed."};jQuery("#map_progress_msgs").html(rtMediaAdmin.templates.rtm_map_mapping_failure(a))}})}(t)})})}})}),jQuery("#bpmedia-bpalbumimport-cleanup").click(function(e){e.preventDefault(),jQuery.post(ajaxurl,{action:"rtmedia_rt_album_cleanup",rtm_wpnonce:jQuery("#bpaimporter_wpnonce").val()},function(e){window.location=settings_rt_album_import_url})}),jQuery("#bpmedia-bpalbumimporter").on("click","#bpmedia-bpalbumimport",function(e){if(e.preventDefault(),jQuery("#bp-album-import-accept").prop("checked")){if(jQuery(this).prop("disabled",!0),wp_admin_url=ajaxurl.replace("admin-ajax.php",""),!jQuery(".bpm-ajax-loader").length){var t={src:rtmedia_admin_url+"images/wpspin_light.gif",class:"bpm-ajax-loader",norefresh:rtmedia_admin_strings.no_refresh};jQuery(this).after(rtMediaAdmin.templates.rtm_image(t))}$progress_parent=jQuery("#bpmedia-bpalbumimport"),$values=[],jQuery(this).parent().find("input").each(function(){$values[jQuery(this).attr("name")]=[jQuery(this).val()]}),0==$values.steps[0]&&($values.steps[0]=1),$data={};for(i=1;i<=$values.steps[0];i++)$count=5,i==$values.steps[0]&&($count=parseInt($values.laststep[0]),0==$count&&($count=5)),newvals={page:i,action:"rtmedia_rt_album_import",count:$count,values:$values,rtm_wpnonce:jQuery("#bpaimporter_wpnonce").val()},$data[i]=newvals;var r=jQuery.Deferred();r.resolve(),jQuery.each($data,function(e,t){r=r.pipe(function(){return n(t)})})}else{jQuery("html, body").animate({scrollTop:jQuery("#bp-album-import-accept").offset().top},500);var a=jQuery(".bp-album-import-accept"),i=3;(function e(){a.css("background-color","#EE0000"),setTimeout(function(){a.css("background-color","#FFEBE8"),--i&&setTimeout(e,500)},500)})()}}),i.on("click",".interested",function(){jQuery(".interested-container").removeClass("hidden"),jQuery(".choice-free").attr("required","required")}),i.on("click",".not-interested",function(){jQuery(".interested-container").addClass("hidden"),jQuery(".choice-free").removeAttr("required")}),jQuery("#video-transcoding-main-container").on("click",".video-transcoding-survey",function(e){e.preventDefault();var t={action:"rtmedia_convert_videos_form",email:jQuery(".email").val(),url:jQuery(".url").val(),choice:jQuery('input[name="choice"]:checked').val(),interested:jQuery('input[name="interested"]:checked').val()};return jQuery.post(ajaxurl,t,function(e){var t={msg:e,strong:"yes"};jQuery("#video-transcoding-main-container").html(rtMediaAdmin.templates.rtm_p_tag(t))}),!1}),jQuery("#bpmedia-bpalbumimporter").on("click",".deactivate-bp-album",function(e){e.preventDefault(),$bpalbum=jQuery(this);var t={action:"rtmedia_rt_album_deactivate",rtm_wpnonce:jQuery("#bpaimporter_wpnonce").val()};jQuery.get(ajaxurl,t,function(e){if(e)location.reload();else{var t={msg:rtmedia_admin_strings.something_went_wrong};$bpalbum.parent().after(rtMediaAdmin.templates.rtm_p_tag(t))}})}),jQuery(".updated").on("click",".bpm-hide-encoding-notice",function(){var e={src:rtmedia_admin_url+"images/wpspin_light.gif"};jQuery(this).after(rtMediaAdmin.templates.rtm_image(e));e={action:"rtmedia_hide_encoding_notice"};jQuery.post(ajaxurl,e,function(e){e&&jQuery(".bpm-hide-encoding-notice").closest(".updated").remove()})}),jQuery("#rtmedia-bp-enable-activity").is(":checked")?jQuery(".rtmedia-bp-activity-setting").prop("readonly",!1):jQuery(".rtmedia-bp-activity-setting").prop("readonly",!0),jQuery("#rtmedia-bp-enable-activity").on("click",function(e){jQuery(this).is(":checked")?jQuery(".rtmedia-bp-activity-setting").prop("readonly",!1):jQuery(".rtmedia-bp-activity-setting").prop("readonly",!0)});var a;function u(e,t){var r=jQuery(e);r.focus(),r.css("border-color","red");var a=r.parent();if(0").attr("style","display:block").addClass("error_msg").html(t);r.after(i)}return return_code=!1}void 0!==rtmedia_on_label&&rtmedia_on_label,void 0!==rtmedia_off_label&&rtmedia_off_label,jQuery("input[type=file]").on("change",function(e){a=e.target.files,function(e){e.stopPropagation(),e.preventDefault();var r=new FormData;void 0!==e&&void 0!==e.target&&void 0!==e.target.name&&"rtFileInput"===e.target.name&&r.append("import_export_control",e.target.name);jQuery.each(a,function(e,t){r.append(e,t)});var t=jQuery("#rtmedia_admin_upload_nonce").val();void 0!==t&&""!==t&&r.append("rtmedia_admin_upload_nonce",t);r.append("action","rtmedia_admin_upload"),jQuery.ajax({url:rtmedia_admin_ajax,type:"POST",data:r,cache:!1,processData:!1,contentType:!1,success:function(e){if(e.hasOwnProperty("rtm_response")&&e.hasOwnProperty("rtm_response_msg")){jQuery("#rtm-setting-msg").remove();var t=jQuery("
",{id:"rtm-setting-msg",class:"rtm-fly-warning"});"success"===e.rtm_response?(t.addClass("rtm-success rtm-save-settings-msg"),t.text(e.rtm_response_msg),jQuery(".rtm-button-container.top").append(t),location.reload()):"error"===e.rtm_response&&(t.addClass("rtm-warning"),t.text(e.rtm_response_msg),jQuery(".rtm-button-container.top").append(t),t.delay(3e3).fadeOut(100))}if(void 0===e.error){if((e=JSON.parse(e)).exceed_size_msg)return jQuery("#debuglog").val(""),alert(e.exceed_size_msg),!1;jQuery("#debuglog_temp_path").val(e.debug_attachmanet)}else jQuery("#debuglog").val(""),alert("ERRORS: "+e.error)}})}(e)}),jQuery("#rtmedia-submit-request").click(function(){var e=jQuery("#name").val(),t=jQuery("#email").val(),r=jQuery("#website").val(),a=jQuery("#subject").val(),i=jQuery("#details").val(),n=jQuery('input[name="request_type"]').val(),s=jQuery('input[name="request_id"]').val(),o=jQuery('input[name="server_address"]').val(),m=jQuery('input[name="ip_address"]').val(),d=jQuery('input[name="server_type"]').val(),u=jQuery('input[name="user_agent"]').val(),l={name:e,email:t,website:r,subject:a,details:i,request_id:s,request_type:"premium_support",server_address:o,ip_address:m,server_type:d,user_agent:u,debuglog_temp_path:jQuery('input[name="debuglog_temp_path"]').val()};if("bug_report"==n){var p=jQuery("#wp_admin_username").val();if(""===p)return alert(rtmedia_admin_support_strings.wp_admin_username_error),!1;var c=jQuery("#wp_admin_pwd").val();if(""===c)return alert(rtmedia_admin_support_strings.wp_admin_pwd_error),!1;var _=jQuery("#ssh_ftp_host").val();if(""===_)return alert(rtmedia_admin_support_strings.ssh_ftp_host_error),!1;var f=jQuery("#ssh_ftp_username").val();if(""===f)return alert(rtmedia_admin_support_strings.ssh_ftp_username_error),!1;var v=jQuery("#ssh_ftp_pwd").val();if(""===v)return alert(rtmedia_admin_support_strings.ssh_ftp_pwd_error),!1;l={name:e,email:t,website:r,subject:a,details:i,request_id:s,request_type:"premium_support",server_address:o,ip_address:m,server_type:d,user_agent:u,wp_admin_username:p,wp_admin_pwd:c,ssh_ftp_host:_,ssh_ftp_username:f,ssh_ftp_pwd:v}}for(formdata in l){if(""===l[formdata]&&"debuglog_temp_path"!==formdata)return alert("Please enter "+formdata.replace("_"," ")+" field."),!1;if(""===l[formdata]&&"debuglog_temp_path"===formdata)return alert("Please upload attachment."),!1}return data={action:"rtmedia_submit_request",form_data:l,support_wpnonce:jQuery("#support_wpnonce").val()},jQuery.post(ajaxurl,data,function(e){if("false"==(e=e.trim()))return alert(rtmedia_admin_support_strings.all_fields_error),!1;g("#rtmedia_service_contact_container").empty(),g("#rtmedia_service_contact_container").append(e)}),!1}),jQuery("#cancel-request").click(function(){return!1}),jQuery(".rtm_enable_masonry_view input[type=checkbox]").is(":checked")?jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").show():jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").hide(),jQuery(".rtm_enable_masonry_view input[type=checkbox]").on("click",function(e){jQuery(this).is(":checked")?jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").show():jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").hide()}),jQuery("#rtm-masonry-change-thumbnail-info").click(function(e){jQuery("html, body").animate({scrollTop:0},"500","swing")}),jQuery("#rtm-export-button").click(function(){data={action:"rtmedia_export_settings"},jQuery.post(ajaxurl,data,function(e){var t="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e)),r=document.createElement("a");r.setAttribute("href",t),r.setAttribute("download","rtm-settings.json"),jQuery("body").append(r),r.click(),r.remove()})}),jQuery("#rtm-export-data-button").click(function(){window.location.href="/wp-admin/tools.php?page=export_personal_data"}),jQuery("#rtm-erase-data-button").click(function(){window.location.href="/wp-admin/tools.php?page=remove_personal_data"})}),jQuery(window).load(function(){jQuery(".rtmedia-addon-thickbox").trigger("click")}); \ No newline at end of file +"function"!=typeof Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),function(n,s){var r={init:function(e,t){var r=this;r.elem=t,r.$elem=n(t),r.options=n.extend({},n.fn.rtTab.options,e),r.rtTabs()},rtTabs:function(){var t=this,e=t.options.activeTab;if(t.$elem.find("li:nth-child("+e+")").addClass("active"),t.rtTabContent(activeTabContent="yes"),t.rtClick(),!0==("false"!==t.$elem.attr("data-hash"))){var r=s.location.hash;r&&t.$elem.find("li").find('a[href="'+r+'"]').trigger("click"),n(s).on("hashchange",function(){var e=s.location.hash;t.$elem.find("li").find('a[href="'+e+'"]').trigger("click")})}},rtClick:function(){var a=this,i=a.$elem.find("li");i.find("a").on("click",function(e){e.preventDefault(),i.removeClass("active"),a.rtTabContent(),n(this).parent().addClass("active");var t=n(this).attr("href");if(n(t).removeClass("hide"),!0==("false"!==a.$elem.attr("data-hash"))){var r=n(s).scrollTop();location.hash=n(this).attr("href"),n(s).scrollTop(r)}"function"==typeof a.options.onComplete&&a.options.onComplete.apply(a.elem,arguments)})},rtTabContent:function(r){this.$elem.find("li").find("a").each(function(){var e=n(this),t=e.attr("href");"yes"===r&&e.parent().hasClass("active")||n(t).addClass("hide")})}};n.fn.rtTab=function(t){return this.each(function(){var e=Object.create(r);e.init(t,this),n.data(this,"rtTab",e)})},n.fn.rtTab.options={activeTab:1,onComplete:null}}(jQuery,window,document),jQuery(document).ready(function(a){var e=document.createElement("div");e.setAttribute("class","rtm-warning rtm-fly-warning hide"),a(".rtm-tabs").rtTab(),a('input[name^="rtmedia-options"]').on("change",function(){a(".rtm-save-settings-msg").remove(),0===a(".rtm-fly-warning").length&&(e.innerText=rtmedia.admin_strings.settings_changed,a(".rtm-button-container.top").prepend(e),a(".rtm-fly-warning").slideDown())}),a(".rtm-img-size-setting .form-table tr:nth-child(7) td:last-child").attr("colspan","3"),a(".rtm-field-wrap .switch input[type=checkbox]").each(function(){var e=a(this);e.parents("table").attr("data-depends")||(e.is(":checked")?(e.parents("table").next(".rtm-notice").slideDown(),e.parents("table").siblings("table").each(function(){a(this).attr("data-depends")&&a(this).slideDown()})):(e.parents("table").next(".rtm-notice").slideUp(),e.parents("table").siblings("table").each(function(){a(this).attr("data-depends")&&a(this).slideUp()}))),e.parents("tr").next("tr").attr("data-depends")&&(e.is(":checked")?e.parents("tr").next("tr").slideDown():e.parents("tr").next("tr").slideUp())}),a(".rtm-field-wrap .switch input[type=checkbox]").on("change",function(){var e=a(this);e.parents("table").attr("data-depends")||(e.parents("table").next(".rtm-notice").slideToggle(),e.parents("table").siblings("table").each(function(){a(this).attr("data-depends")&&a(this).slideToggle()})),e.parents("tr").next("tr").attr("data-depends")&&e.parents("tr").next("tr").slideToggle()});new(Backbone.View.extend({el:a(".bp-media-admin"),events:{"click .rtm-theme":"render","click .rtm-close":"close","click .rtm-previous":"previousTheme","click .rtm-next":"nextTheme",keyup:"keyEvent"},initialize:function(){_.bindAll(this,"render","close","nextTheme","previousTheme","keyEvent"),this.keyEvent()},render:function(e){a(".rtm-theme").removeClass("rtm-modal-open");var t=a(e.currentTarget).addClass("rtm-modal-open").find(".rtm-theme-content").html();if(a(".rtm-theme-overlay")[0])a(".rtm-theme-overlay").show(),a(this.el).find(".rtm-theme-content-wrap").empty().append(t);else{var r={themeContent:t};a(this.el).append(rtMediaAdmin.templates.rtm_theme_overlay(r))}a(e.currentTarget).is(":first-child")?a(".rtm-previous").addClass("disabled"):a(e.currentTarget).is(":last-child")?a(".rtm-next").addClass("disabled"):a(".rtm-next, .rtm-previous").removeClass("disabled")},close:function(){a(".rtm-theme").removeClass("rtm-modal-open"),a(".rtm-theme-overlay").hide(),a(".rtm-next, .rtm-previous").removeClass("disabled")},nextTheme:function(e){return a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:last-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").next().trigger("click"),!1},previousTheme:function(e){return a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:first-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").prev().trigger("click"),!1},keyEvent:function(){a("body").on("keyup",function(e){return 39===e.keyCode?(a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:last-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").next().trigger("click"),!1):37===e.keyCode?(a(".rtm-next, .rtm-previous").removeClass("disabled"),a(".rtm-theme:first-child").hasClass("rtm-modal-open")&&a(e.currentTarget).addClass("disabled"),a(".rtm-modal-open").prev().trigger("click"),!1):void(27===e.keyCode&&a(".rtm-close").trigger("click"))})}}));jQuery("#rtm-licenses .regular-text").each(function(){jQuery(this).keypress(function(e){if("13"==(e.keyCode?e.keyCode:e.which))return!1})}),jQuery("#bp_media_settings_form").on("submit",function(e){jQuery("#rtcss-notice").remove();var t=jQuery("#rtmedia-custom-css").val().match(/@import\s*(url)?\s*\(?([^;]+?)\)?;/);if(null!=t&&null!=t[0])return jQuery("#rtmedia-custom-css").after('

'+rtmedia.admin_strings.wrong_css_input+"

"),!1})});var rtMediaAdmin=new Object;function rtmedia_addon_do_not_show(){jQuery.post(rtmedia.admin_ajax,{action:"rtmedia_addon_popup_not_show_again"},function(e){jQuery("#TB_window").remove(),jQuery("#TB_overlay").remove()})}rtMediaAdmin.templates={rtm_image:wp.template("rtm-image"),rtm_msg_div:wp.template("rtm-msg-div"),rtm_album_favourites_importer:wp.template("rtm-album-favourites-importer"),rtm_map_mapping_failure:wp.template("rtm-map-mapping-failure"),rtm_p_tag:wp.template("rtm-p-tag"),rtm_theme_overlay:wp.template("rtm-theme-overlay")},jQuery(document).ready(function(g){var i=g("#bp-media-settings-boxes"),t=g("#bp_media_settings_form .bp-media-metabox-holder"),e=g("#rtm-licenses");0div").css("width",t+"%"),jQuery(".bp-album-comments #rtprogressbar>div").css("width",r+"%"),jQuery(".bp-album-users #rtprogressbar>div").css("width",a+"%"),media_finished=jQuery("#bpmedia-bpalbumimporter .bp-album-media span.finished").html(),parseInt(media_finished)div").css("width",t+"%"),redirect&&window.setTimeout(s,2e3)})}(t)})})}},"json"))}else if(n.hasOwnProperty(page)){var i={msg:"Row "+e.page+" failed."};jQuery("#map_progress_msgs").html(rtMediaAdmin.templates.rtm_map_mapping_failure(i))}else{i={msg:rtmedia.admin_strings.request_failed};jQuery("#map_progress_msgs").html(rtMediaAdmin.templates.rtm_map_mapping_failure(i))}})}function s(){window.location=document.URL}r.className="support_form_loader",0div").css("width",r+"%"),finished=jQuery("#rtprivacyinstaller span.finished").html(),jQuery("#rtprivacyinstaller span.finished").html(parseInt(finished)+i.count),t&&jQuery.post(rtmedia_main.ajaxurl,{action:"rtmedia_privacy_redirect"},function(e){window.location=rtmedia.settings_url})}else{var a={msg:"Row "+e+" failed."};jQuery("#map_progress_msgs").html(rtMediaAdmin.templates.rtm_map_mapping_failure(a))}})}(t)})})}})}),jQuery("#bpmedia-bpalbumimport-cleanup").click(function(e){e.preventDefault(),jQuery.post(rtmedia_main.ajaxurl,{action:"rtmedia_rt_album_cleanup",rtm_wpnonce:jQuery("#bpaimporter_wpnonce").val()},function(e){window.location=rtmedia.settings_rt_album_import_url})}),jQuery("#bpmedia-bpalbumimporter").on("click","#bpmedia-bpalbumimport",function(e){if(e.preventDefault(),jQuery("#bp-album-import-accept").prop("checked")){if(jQuery(this).prop("disabled",!0),wp_admin_url=rtmedia_main.ajaxurl.replace("admin-ajax.php",""),!jQuery(".bpm-ajax-loader").length){var t={src:rtmedia.admin_url+"images/wpspin_light.gif",class:"bpm-ajax-loader",norefresh:rtmedia.admin_strings.no_refresh};jQuery(this).after(rtMediaAdmin.templates.rtm_image(t))}$progress_parent=jQuery("#bpmedia-bpalbumimport"),$values=[],jQuery(this).parent().find("input").each(function(){$values[jQuery(this).attr("name")]=[jQuery(this).val()]}),0==$values.steps[0]&&($values.steps[0]=1),$data={};for(i=1;i<=$values.steps[0];i++)$count=5,i==$values.steps[0]&&($count=parseInt($values.laststep[0]),0==$count&&($count=5)),newvals={page:i,action:"rtmedia_rt_album_import",count:$count,values:$values,rtm_wpnonce:jQuery("#bpaimporter_wpnonce").val()},$data[i]=newvals;var r=jQuery.Deferred();r.resolve(),jQuery.each($data,function(e,t){r=r.pipe(function(){return n(t)})})}else{jQuery("html, body").animate({scrollTop:jQuery("#bp-album-import-accept").offset().top},500);var a=jQuery(".bp-album-import-accept"),i=3;(function e(){a.css("background-color","#EE0000"),setTimeout(function(){a.css("background-color","#FFEBE8"),--i&&setTimeout(e,500)},500)})()}}),i.on("click",".interested",function(){jQuery(".interested-container").removeClass("hidden"),jQuery(".choice-free").attr("required","required")}),i.on("click",".not-interested",function(){jQuery(".interested-container").addClass("hidden"),jQuery(".choice-free").removeAttr("required")}),jQuery("#video-transcoding-main-container").on("click",".video-transcoding-survey",function(e){e.preventDefault();var t={action:"rtmedia_convert_videos_form",email:jQuery(".email").val(),url:jQuery(".url").val(),choice:jQuery('input[name="choice"]:checked').val(),interested:jQuery('input[name="interested"]:checked').val()};return jQuery.post(rtmedia_main.ajaxurl,t,function(e){var t={msg:e,strong:"yes"};jQuery("#video-transcoding-main-container").html(rtMediaAdmin.templates.rtm_p_tag(t))}),!1}),jQuery("#bpmedia-bpalbumimporter").on("click",".deactivate-bp-album",function(e){e.preventDefault(),$bpalbum=jQuery(this);var t={action:"rtmedia_rt_album_deactivate",rtm_wpnonce:jQuery("#bpaimporter_wpnonce").val()};jQuery.get(rtmedia_main.ajaxurl,t,function(e){if(e)location.reload();else{var t={msg:rtmedia.admin_strings.something_went_wrong};$bpalbum.parent().after(rtMediaAdmin.templates.rtm_p_tag(t))}})}),jQuery(".updated").on("click",".bpm-hide-encoding-notice",function(){var e={src:rtmedia.admin_url+"images/wpspin_light.gif"};jQuery(this).after(rtMediaAdmin.templates.rtm_image(e));e={action:"rtmedia_hide_encoding_notice"};jQuery.post(rtmedia_main.ajaxurl,e,function(e){e&&jQuery(".bpm-hide-encoding-notice").closest(".updated").remove()})}),jQuery("#rtmedia-bp-enable-activity").is(":checked")?jQuery(".rtmedia-bp-activity-setting").prop("readonly",!1):jQuery(".rtmedia-bp-activity-setting").prop("readonly",!0),jQuery("#rtmedia-bp-enable-activity").on("click",function(e){jQuery(this).is(":checked")?jQuery(".rtmedia-bp-activity-setting").prop("readonly",!1):jQuery(".rtmedia-bp-activity-setting").prop("readonly",!0)});var a;function u(e,t){var r=jQuery(e);r.focus(),r.css("border-color","red");var a=r.parent();if(0").attr("style","display:block").addClass("error_msg").html(t);r.after(i)}return return_code=!1}void 0!==rtmedia.on_label&&rtmedia.on_label,void 0!==rtmedia.off_label&&rtmedia.off_label,jQuery("input[type=file]").on("change",function(e){a=e.target.files,function(e){e.stopPropagation(),e.preventDefault();var r=new FormData;void 0!==e&&void 0!==e.target&&void 0!==e.target.name&&"rtFileInput"===e.target.name&&r.append("import_export_control",e.target.name);jQuery.each(a,function(e,t){r.append(e,t)});var t=jQuery("#rtmedia_admin_upload_nonce").val();void 0!==t&&""!==t&&r.append("rtmedia_admin_upload_nonce",t);r.append("action","rtmedia_admin_upload"),jQuery.ajax({url:rtmedia.admin_ajax,type:"POST",data:r,cache:!1,processData:!1,contentType:!1,success:function(e){if(e.hasOwnProperty("rtm_response")&&e.hasOwnProperty("rtm_response_msg")){jQuery("#rtm-setting-msg").remove();var t=jQuery("
",{id:"rtm-setting-msg",class:"rtm-fly-warning"});"success"===e.rtm_response?(t.addClass("rtm-success rtm-save-settings-msg"),t.text(e.rtm_response_msg),jQuery(".rtm-button-container.top").append(t),location.reload()):"error"===e.rtm_response&&(t.addClass("rtm-warning"),t.text(e.rtm_response_msg),jQuery(".rtm-button-container.top").append(t),t.delay(3e3).fadeOut(100))}if(void 0===e.error){if((e=JSON.parse(e)).exceed_size_msg)return jQuery("#debuglog").val(""),alert(e.exceed_size_msg),!1;jQuery("#debuglog_temp_path").val(e.debug_attachmanet)}else jQuery("#debuglog").val(""),alert("ERRORS: "+e.error)}})}(e)}),jQuery("#rtmedia-submit-request").click(function(){var e=jQuery("#name").val(),t=jQuery("#email").val(),r=jQuery("#website").val(),a=jQuery("#subject").val(),i=jQuery("#details").val(),n=jQuery('input[name="request_type"]').val(),s=jQuery('input[name="request_id"]').val(),o=jQuery('input[name="server_address"]').val(),m=jQuery('input[name="ip_address"]').val(),d=jQuery('input[name="server_type"]').val(),u=jQuery('input[name="user_agent"]').val(),l={name:e,email:t,website:r,subject:a,details:i,request_id:s,request_type:"premium_support",server_address:o,ip_address:m,server_type:d,user_agent:u,debuglog_temp_path:jQuery('input[name="debuglog_temp_path"]').val()};if("bug_report"==n){var p=jQuery("#wp_admin_username").val();if(""===p)return alert(rtmedia_admin_support_strings.wp_admin_username_error),!1;var c=jQuery("#wp_admin_pwd").val();if(""===c)return alert(rtmedia_admin_support_strings.wp_admin_pwd_error),!1;var _=jQuery("#ssh_ftp_host").val();if(""===_)return alert(rtmedia_admin_support_strings.ssh_ftp_host_error),!1;var f=jQuery("#ssh_ftp_username").val();if(""===f)return alert(rtmedia_admin_support_strings.ssh_ftp_username_error),!1;var v=jQuery("#ssh_ftp_pwd").val();if(""===v)return alert(rtmedia_admin_support_strings.ssh_ftp_pwd_error),!1;l={name:e,email:t,website:r,subject:a,details:i,request_id:s,request_type:"premium_support",server_address:o,ip_address:m,server_type:d,user_agent:u,wp_admin_username:p,wp_admin_pwd:c,ssh_ftp_host:_,ssh_ftp_username:f,ssh_ftp_pwd:v}}for(formdata in l){if(""===l[formdata]&&"debuglog_temp_path"!==formdata)return alert("Please enter "+formdata.replace("_"," ")+" field."),!1;if(""===l[formdata]&&"debuglog_temp_path"===formdata)return alert("Please upload attachment."),!1}return data={action:"rtmedia_submit_request",form_data:l,support_wpnonce:jQuery("#support_wpnonce").val()},jQuery.post(rtmedia_main.ajaxurl,data,function(e){if("false"==(e=e.trim()))return alert(rtmedia_admin_support_strings.all_fields_error),!1;g("#rtmedia_service_contact_container").empty(),g("#rtmedia_service_contact_container").append(e)}),!1}),jQuery("#cancel-request").click(function(){return!1}),jQuery(".rtm_enable_masonry_view input[type=checkbox]").is(":checked")?jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").show():jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").hide(),jQuery(".rtm_enable_masonry_view input[type=checkbox]").on("click",function(e){jQuery(this).is(":checked")?jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").show():jQuery(".rtm_enable_masonry_view").parents(".metabox-holder").find(".rtmedia-info").hide()}),jQuery("#rtm-masonry-change-thumbnail-info").click(function(e){jQuery("html, body").animate({scrollTop:0},"500","swing")}),jQuery("#rtm-export-button").click(function(){data={action:"rtmedia_export_settings"},jQuery.post(rtmedia_main.ajaxurl,data,function(e){var t="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e)),r=document.createElement("a");r.setAttribute("href",t),r.setAttribute("download","rtm-settings.json"),jQuery("body").append(r),r.click(),r.remove()})}),jQuery("#rtm-export-data-button").click(function(){window.location.href="/wp-admin/tools.php?page=export_personal_data"}),jQuery("#rtm-erase-data-button").click(function(){window.location.href="/wp-admin/tools.php?page=remove_personal_data"})}),jQuery(window).load(function(){jQuery(".rtmedia-addon-thickbox").trigger("click")}); \ No newline at end of file diff --git a/app/assets/admin/js/settings.js b/app/assets/admin/js/settings.js index e7d15dea6..a86742cbf 100755 --- a/app/assets/admin/js/settings.js +++ b/app/assets/admin/js/settings.js @@ -50,7 +50,7 @@ jQuery( document ).ready( function ( $ ) { }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php - jQuery.post( ajaxurl, data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { bp_media_metabox_holder.html( response ).fadeIn( 'slow' ); } ); } @@ -71,7 +71,7 @@ jQuery( document ).ready( function ( $ ) { }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php - jQuery.post( ajaxurl, data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { bp_media_metabox_holder.html(); bp_media_metabox_holder.html( response ).fadeIn( 'slow' ); } ); @@ -213,7 +213,7 @@ jQuery( document ).ready( function ( $ ) { }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php - jQuery.getJSON( ajaxurl, data, function ( response ) { + jQuery.getJSON( rtmedia_main.ajaxurl, data, function ( response ) { if ( response.error === undefined && response.apikey ) { var tempUrl = window.location.href; var hash = window.location.hash; @@ -252,7 +252,7 @@ jQuery( document ).ready( function ( $ ) { }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php - jQuery.getJSON( ajaxurl, data, function ( response ) { + jQuery.getJSON( rtmedia_main.ajaxurl, data, function ( response ) { if ( response.error === undefined && response.apikey ) { var tempUrl = window.location.href; var hash = window.location.hash; @@ -296,7 +296,7 @@ jQuery( document ).ready( function ( $ ) { }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php - jQuery.post( ajaxurl, data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { if ( response ) { jQuery( '.settings-error-encoding-disabled' ).remove(); @@ -345,7 +345,7 @@ jQuery( document ).ready( function ( $ ) { action: 'rtmedia_enable_encoding' }; - jQuery.post( ajaxurl, data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { if ( response ) { jQuery( '.settings-error-encoding-enabled' ).remove(); @@ -407,7 +407,7 @@ jQuery( document ).ready( function ( $ ) { }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php - jQuery.getJSON( ajaxurl, data, function ( response ) { + jQuery.getJSON( rtmedia_main.ajaxurl, data, function ( response ) { if ( response.error === undefined && response.updated ) { bpm_unsubscribe.next().remove(); bpm_unsubscribe.after( response.form ); @@ -444,7 +444,7 @@ jQuery( document ).ready( function ( $ ) { } ); function fireRequest( data ) { - return jQuery.post( ajaxurl, data, function ( response ) { + return jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { if ( response != 0 ) { var redirect = false; @@ -459,7 +459,7 @@ jQuery( document ).ready( function ( $ ) { jQuery( '#rtprivacyinstaller span.finished' ).html( parseInt( finished ) + data.count ); if ( redirect ) { - jQuery.post( ajaxurl, { + jQuery.post( rtmedia_main.ajaxurl, { action: 'rtmedia_privacy_redirect' }, function ( response ) { window.location = rtmedia.settings_url ; @@ -523,7 +523,7 @@ jQuery( document ).ready( function ( $ ) { } ); function fireimportRequest( data ) { - return jQuery.getJSON( ajaxurl, data, function ( response ) { + return jQuery.getJSON( rtmedia_main.ajaxurl, data, function ( response ) { favorites = false; if ( response ) { @@ -557,7 +557,7 @@ jQuery( document ).ready( function ( $ ) { 'action': 'rtmedia_rt_album_import_favorites', rtm_wpnonce: jQuery('#bpaimporter_wpnonce').val() }; - jQuery.post( ajaxurl, favorite_data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, favorite_data, function ( response ) { if (response.hasOwnProperty(favorites) && (response.favorites !== 0 || response.favorites !== '0')) { @@ -626,7 +626,7 @@ jQuery( document ).ready( function ( $ ) { } function fireimportfavoriteRequest( data ) { - return jQuery.post( ajaxurl, data, function ( response ) { + return jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { redirect = false; favorites_total = jQuery( '#bpmedia-bpalbumimporter .bp-album-favorites span.total' ).html(); favorites_finished = jQuery( '#bpmedia-bpalbumimporter .bp-album-favorites span.finished' ).html(); @@ -651,7 +651,7 @@ jQuery( document ).ready( function ( $ ) { jQuery( '#bpmedia-bpalbumimport-cleanup' ).click( function ( e ) { e.preventDefault(); - jQuery.post( ajaxurl, { + jQuery.post( rtmedia_main.ajaxurl, { action: 'rtmedia_rt_album_cleanup', rtm_wpnonce: jQuery('#bpaimporter_wpnonce').val() }, function ( response ) { @@ -685,7 +685,7 @@ jQuery( document ).ready( function ( $ ) { } else { jQuery( this ).prop( 'disabled', true ); } - wp_admin_url = ajaxurl.replace( 'admin-ajax.php', '' ); + wp_admin_url = rtmedia_main.ajaxurl.replace( 'admin-ajax.php', '' ); if ( !jQuery( '.bpm-ajax-loader' ).length ) { var data = { @@ -753,7 +753,7 @@ jQuery( document ).ready( function ( $ ) { choice: jQuery( 'input[name="choice"]:checked' ).val(), interested: jQuery( 'input[name="interested"]:checked' ).val() }; - jQuery.post( ajaxurl, data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { var p_data = { msg :response, strong : 'yes' @@ -772,7 +772,7 @@ jQuery( document ).ready( function ( $ ) { action: 'rtmedia_rt_album_deactivate', rtm_wpnonce: jQuery('#bpaimporter_wpnonce').val() }; - jQuery.get( ajaxurl, data, function ( response ) { + jQuery.get( rtmedia_main.ajaxurl, data, function ( response ) { if ( response ) { location.reload(); @@ -796,7 +796,7 @@ jQuery( document ).ready( function ( $ ) { var data = { action: 'rtmedia_hide_encoding_notice' } - jQuery.post( ajaxurl, data, function ( response ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( response ) { if ( response ) { jQuery( '.bpm-hide-encoding-notice' ).closest( '.updated' ).remove(); } @@ -939,7 +939,7 @@ jQuery( document ).ready( function ( $ ) { form_data: form_data, support_wpnonce: jQuery('#support_wpnonce').val() }; - jQuery.post( ajaxurl, data, function ( data ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( data ) { data = data.trim(); if ( data == "false" ) { alert( rtmedia_admin_support_strings.all_fields_error ); @@ -1052,7 +1052,7 @@ jQuery( document ).ready( function ( $ ) { data = { action: "rtmedia_export_settings", }; - jQuery.post( ajaxurl, data, function ( data ) { + jQuery.post( rtmedia_main.ajaxurl, data, function ( data ) { var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent( JSON.stringify( data ) ); var downloadAnchorNode = document.createElement( 'a' ); downloadAnchorNode.setAttribute( 'href', dataStr ); diff --git a/app/assets/js/rtMedia.backbone.js b/app/assets/js/rtMedia.backbone.js index 4b754262c..b6f88fdf2 100755 --- a/app/assets/js/rtMedia.backbone.js +++ b/app/assets/js/rtMedia.backbone.js @@ -100,7 +100,7 @@ jQuery( function( $ ) { rtMedia.Context = Backbone.Model.extend( { url: function() { - var url = rtmedia_media_slug + '/'; + var url = rtmedia_main.rtmedia_media_slug + '/'; if ( ! upload_sync && nextpage > 0 ) { url += 'pg/' + nextpage + '/'; @@ -148,8 +148,8 @@ jQuery( function( $ ) { url: function() { var temp = window.location.pathname; var url = ''; - if ( temp.indexOf( '/' + rtmedia_media_slug + '/' ) == -1 ) { - url = rtmedia_media_slug + '/'; + if ( temp.indexOf( '/' + rtmedia_main.rtmedia_media_slug + '/' ) == -1 ) { + url = rtmedia_main.rtmedia_media_slug + '/'; } else { if ( temp.indexOf( 'pg/' ) == -1 ) { url = temp; @@ -333,7 +333,7 @@ jQuery( function( $ ) { $( that.el ).html( '' ); } - if ( typeof ( rtmedia_load_more_or_pagination ) != 'undefined' && rtmedia_load_more_or_pagination == 'pagination' || ( 1 == rtMedia.gallery.page ) ) { + if ( typeof ( rtmedia_backbone.rtmedia_load_more_or_pagination ) != 'undefined' && rtmedia_backbone.rtmedia_load_more_or_pagination == 'pagination' || ( 1 == rtMedia.gallery.page ) ) { $( that.el ).html( '' ); } @@ -342,7 +342,7 @@ jQuery( function( $ ) { rtmedia_gallery_container_nodata.remove(); } if ( 0 === this.collection.length ) { - $( 'div[id^="rtmedia_gallery_container_"]' ).append( '

' + rtmedia_no_media_found + '

' ); + $( 'div[id^="rtmedia_gallery_container_"]' ).append( '

' + rtmedia_backbone.rtmedia_no_media_found + '

' ); } else { $.each( this.collection.toJSON(), function( key, media ) { $( that.el ).append( that.template( media ) ); @@ -356,7 +356,7 @@ jQuery( function( $ ) { $( that.el ).siblings( '.rtmedia_next_prev' ).children( '#rtMedia-galary-next' ).show(); //$("#rtMedia-galary-next").show(); } - if ( 'undefined' != typeof rtmedia_masonry_layout && 'true' == rtmedia_masonry_layout && 0 == jQuery( '.rtmedia-container .rtmedia-list.rtm-no-masonry' ).length ) { + if ( 'undefined' != typeof rtmedia_main.rtmedia_masonry_layout && 'true' == rtmedia_main.rtmedia_masonry_layout && 0 == jQuery( '.rtmedia-container .rtmedia-list.rtm-no-masonry' ).length ) { rtm_masonry_reload( rtm_masonry_container ); } $( '#media_fatch_loader' ).removeClass('load'); @@ -375,7 +375,7 @@ jQuery( function( $ ) { $( document ).on( 'click', '#rtMedia-galary-next', function( e ) { if ( jQuery( '.rtm-media-loading' ).length == 0 ) { - $( this ).before( '
' ); + $( this ).before( '
' ); } else { jQuery( '.rtm-media-loading' ).show(); } @@ -415,7 +415,7 @@ jQuery( function( $ ) { if ( $( '#' + current_gallery_id + ' .rtm-media-loading' ).length == 0 ) { - $( '#' + current_gallery_id + ' .rtm-pagination' ).before( '
' ); + $( '#' + current_gallery_id + ' .rtm-pagination' ).before( '
' ); } else { $( '#' + current_gallery_id + ' .rtm-media-loading' ).show(); } @@ -445,7 +445,7 @@ jQuery( function( $ ) { var current_gallery_id = current_gallery.attr( 'id' ); if ( $( '#' + current_gallery_id + ' .rtm-media-loading' ).length == 0 ) { - $( '#' + current_gallery_id + ' .rtm-pagination' ).before( '
' ); + $( '#' + current_gallery_id + ' .rtm-pagination' ).before( '
' ); } else { $( '#' + current_gallery_id + ' .rtm-media-loading' ).show(); } @@ -539,7 +539,7 @@ jQuery( function( $ ) { $( '#media_search_remove' ).hide(); } ); - if ( window.location.pathname.indexOf( rtmedia_media_slug ) != -1 ) { + if ( window.location.pathname.indexOf( rtmedia_main.rtmedia_media_slug ) != -1 ) { var tempNext = window.location.pathname.substring( window.location.pathname.lastIndexOf( 'pg/' ) + 5, window.location.pathname.lastIndexOf( '/' ) ); if ( isNaN( tempNext ) === false ) { nextpage = parseInt( tempNext ) + 1; @@ -559,7 +559,7 @@ jQuery( function( $ ) { var ext_enabled = config.filters[0].extensions.length; if ( ext_enabled === 0 ) { this.uploader.bind( 'Browse', function( up ) { - rtmedia_gallery_action_alert_message( rtmedia_media_disabled_error_message, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_backbone.rtmedia_media_disabled_error_message, 'warning' ); } ); } }, @@ -578,17 +578,17 @@ jQuery( function( $ ) { zIndex: 2 } ); if ( a !== false ) { - window.file_size_info = rtmedia_max_file_msg + this.uploader.settings.max_file_size_msg; - if ( rtmedia_version_compare( rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 + window.file_size_info = rtmedia_main.rtmedia_max_file_msg + this.uploader.settings.max_file_size_msg; + if ( rtmedia_version_compare( rtmedia_main.rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 file_extn = this.uploader.settings.filters.mime_types[0].extensions; } else { file_extn = this.uploader.settings.filters[0].extensions; } - window.file_extn_info = rtmedia_allowed_file_formats + ' : ' + file_extn.split( ',' ).join( ', ' ); + window.file_extn_info = rtmedia_main.rtmedia_allowed_file_formats + ' : ' + file_extn.split( ',' ).join( ', ' ); var info = window.file_size_info + '\n' + window.file_extn_info; $( '.rtm-file-size-limit' ).attr( 'title', info ); - //$("#rtMedia-upload-button").after("( " + rtmedia_max_file_msg + " "+ this.uploader.settings.max_file_size_msg + ")"); + //$("#rtMedia-upload-button").after("( " + rtmedia_main.rtmedia_max_file_msg + " "+ this.uploader.settings.max_file_size_msg + ")"); } return this; @@ -624,7 +624,7 @@ jQuery( function( $ ) { activity_id = -1; var hook_respo = rtMediaHook.call( 'rtmedia_js_after_files_uploaded' ); - if ( typeof rtmedia_gallery_reload_on_upload != 'undefined' && rtmedia_gallery_reload_on_upload == '1' ) { //Reload gallery view when upload completes if enabled( by default enabled) + if ( typeof rtmedia_main.rtmedia_gallery_reload_on_upload != 'undefined' && rtmedia_main.rtmedia_gallery_reload_on_upload == '1' ) { //Reload gallery view when upload completes if enabled( by default enabled) if ( hook_respo != false ) { galleryObj.reloadView(); } @@ -669,8 +669,8 @@ jQuery( function( $ ) { return true; } - select_btn.attr( 'value', rtmedia_add_more_files_msg ); - if ( typeof rtmedia_direct_upload_enabled != 'undefined' && rtmedia_direct_upload_enabled == '1' ) { + select_btn.attr( 'value', rtmedia_main.rtmedia_add_more_files_msg ); + if ( typeof rtmedia_main.rtmedia_direct_upload_enabled != 'undefined' && rtmedia_main.rtmedia_direct_upload_enabled == '1' ) { upload_start_btn.hide(); } else { upload_start_btn.show(); @@ -679,7 +679,7 @@ jQuery( function( $ ) { return true; } var tmp_array = file.name.split( '.' ); - if ( rtmedia_version_compare( rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 + if ( rtmedia_version_compare( rtmedia_main.rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 var ext_array = uploaderObj.uploader.settings.filters.mime_types[0].extensions.split( ',' ); } else { var ext_array = uploaderObj.uploader.settings.filters[0].extensions.split( ',' ); @@ -694,7 +694,7 @@ jQuery( function( $ ) { return true; } - if ( rtmedia_version_compare( rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 + if ( rtmedia_version_compare( rtmedia_main.rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 uploaderObj.uploader.settings.filters.mime_types[0].title; } else { uploaderObj.uploader.settings.filters[0].title; @@ -796,7 +796,7 @@ jQuery( function( $ ) { rtMediaHook.call( 'rtmedia_js_after_files_added', [ up, files ] ); - if ( typeof rtmedia_direct_upload_enabled != 'undefined' && rtmedia_direct_upload_enabled == '1' ) { + if ( typeof rtmedia_main.rtmedia_direct_upload_enabled != 'undefined' && rtmedia_main.rtmedia_direct_upload_enabled == '1' ) { var allow_upload = rtMediaHook.call( 'rtmedia_js_upload_file', { src: 'uploader' } ); if ( allow_upload == false ) { return false; @@ -823,7 +823,7 @@ jQuery( function( $ ) { } else { if ( err.code == -601 ) { // File extension error - err.message = rtmedia_file_extension_error_msg; + err.message = rtmedia_main.rtmedia_file_extension_error_msg; } rtmedia_selected_file_list( plupload, err.file, '', err ); @@ -860,7 +860,7 @@ jQuery( function( $ ) { uploaderObj.uploader.bind( 'UploadProgress', function( up, file ) { //$("#" + file.id + " .plupload_file_status").html(file.percent + "%"); - //$( "#" + file.id + " .plupload_file_status" ).html( rtmedia_uploading_msg + '( ' + file.percent + '% )' ); + //$( "#" + file.id + " .plupload_file_status" ).html( rtmedia_main.rtmedia_uploading_msg + '( ' + file.percent + '% )' ); // creates a progress bar to display file upload status var progressBar = jQuery( '
', { 'class': 'plupload_file_progress ui-widget-header', @@ -876,7 +876,7 @@ jQuery( function( $ ) { } window.onbeforeunload = function( evt ) { - var message = rtmedia_upload_progress_error_message; + var message = rtmedia_backbone.rtmedia_upload_progress_error_message; return message; }; } ); @@ -935,8 +935,8 @@ jQuery( function( $ ) { activity_id = rtnObj.activity_id; if ( rtnObj.permalink != '' ) { $( "#" + file.id + " .plupload_file_name" ).html( "" + file.title.substring( 0, 40 ).replace( /(<([^>]+)>)/ig, "" ) + "" ); - $( "#" + file.id + " .plupload_media_edit" ).html( " " + rtmedia_edit + "" ); - $( "#" + file.id + " .plupload_delete" ).html( "" ); + $( "#" + file.id + " .plupload_media_edit" ).html( " " + rtmedia_main.rtmedia_edit + "" ); + $( "#" + file.id + " .plupload_delete" ).html( "" ); } } catch ( e ) { @@ -951,7 +951,7 @@ jQuery( function( $ ) { rtMediaHook.call( 'rtmedia_js_after_file_upload', [ up, file, res.response ] ); } else { - $( '#' + file.id + ' .plupload_file_status' ).html( rtmedia_upload_failed_msg ); + $( '#' + file.id + ' .plupload_file_status' ).html( rtmedia_main.rtmedia_upload_failed_msg ); } files = up.files; @@ -981,7 +981,7 @@ jQuery( function( $ ) { var enabled_ext = rtMedia_plupload_config.filters[0].extensions.length; if ( 0 === enabled_ext ) { // If no media type is enabled error message will be displayed. - rtmedia_gallery_action_alert_message( rtmedia_media_disabled_error_message, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_backbone.rtmedia_media_disabled_error_message, 'warning' ); } } @@ -992,7 +992,7 @@ jQuery( function( $ ) { jQuery( document ).on( 'click', '.plupload_delete .rtmedia-delete-uploaded-media', function() { var that = $( this ); - if ( confirm( rtmedia_delete_uploaded_media ) ) { + if ( confirm( rtmedia_main.rtmedia_delete_uploaded_media ) ) { var nonce = $( '#rtmedia-upload-container #rtmedia_media_delete_nonce' ).val(); var media_id = $( this ).attr( 'id' ); var data = { @@ -1001,7 +1001,7 @@ jQuery( function( $ ) { media_id: media_id }; - $.post( ajaxurl, data, function( response ) { + $.post( rtmedia_main.ajaxurl, data, function( response ) { if ( response == '1' ) { that.closest( 'tr' ).remove(); $( '#' + media_id ).remove(); @@ -1053,7 +1053,7 @@ jQuery( document ).ready( function( $ ) { /** * UI changes for buddypress nouveau theme on activity page */ - if ( bp_template_pack && 'legacy' !== bp_template_pack ) { + if ( rtmedia_bp.template_pack && 'legacy' !== rtmedia_bp.template_pack ) { var whats_new_form = jQuery( '#whats-new-form' ); @@ -1178,7 +1178,7 @@ jQuery( document ).ready( function( $ ) { /** * Appends rtMedia Uploader option below form content section */ - if ( bp_template_pack && 'legacy' !== bp_template_pack ) { + if ( rtmedia_bp.template_pack && 'legacy' !== rtmedia_bp.template_pack ) { var form_ref = jQuery( '#whats-new-form' ); var rt_uploader_div = jQuery( '.rtmedia-uploader-div' ); @@ -1251,7 +1251,7 @@ jQuery( document ).ready( function( $ ) { var tmp_array = file.name.split( '.' ); - if ( rtmedia_version_compare( rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 + if ( rtmedia_version_compare( rtmedia_main.rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 var ext_array = objUploadView.uploader.settings.filters.mime_types[0].extensions.split( ',' ); } else { var ext_array = objUploadView.uploader.settings.filters[0].extensions.split( ',' ); @@ -1362,21 +1362,21 @@ jQuery( document ).ready( function( $ ) { } } ); - if ( typeof rtmedia_direct_upload_enabled != 'undefined' && rtmedia_direct_upload_enabled == '1' ) { + if ( typeof rtmedia_main.rtmedia_direct_upload_enabled != 'undefined' && rtmedia_main.rtmedia_direct_upload_enabled == '1' ) { /* - * add rtmedia_activity_text_with_attachment condition to filter + * add rtmedia_main.rtmedia_activity_text_with_attachment condition to filter * if user want media and activity_text both require * By: Yahil */ if ( '' === jQuery( '#whats-new' ).val().trim() ) { - if ( rtmedia_activity_text_with_attachment == 'disable' ) { + if ( rtmedia_main.rtmedia_activity_text_with_attachment == 'disable' ) { if ( 0 === jQuery( '#rtmedia_upload_terms_conditions' ).length ) { $( '#whats-new' ).css( 'color', 'transparent' ); $( '#whats-new' ).val( ' ' ); } } else { - jQuery('#whats-new-form').prepend('

' + rtmedia_empty_activity_msg + '

') + jQuery('#whats-new-form').prepend('

' + rtmedia_main.rtmedia_empty_activity_msg + '

') jQuery( '#whats-new' ).removeAttr( 'disabled' ); return false; } @@ -1448,7 +1448,7 @@ jQuery( document ).ready( function( $ ) { } } else { if ( err.code == -601 ) { // File extension error - err.message = rtmedia_file_extension_error_msg; + err.message = rtmedia_main.rtmedia_file_extension_error_msg; } rtmedia_selected_file_list( plupload, err.file, '', err ); @@ -1476,7 +1476,7 @@ jQuery( document ).ready( function( $ ) { var object = ''; var item_id = 0; - if ( 'legacy' === bp_template_pack ) { + if ( 'legacy' === rtmedia_bp.template_pack ) { if ( jQuery( '#whats-new-post-in' ).length ) { item_id = jQuery( '#whats-new-post-in' ).val(); } else if ( jQuery( '.groups-header' ).length ) { @@ -1523,9 +1523,9 @@ jQuery( document ).ready( function( $ ) { /** * Blank error display issue resolved */ - if ( bp_template_pack && 'legacy' !== bp_template_pack ) { + if ( rtmedia_bp.template_pack && 'legacy' !== rtmedia_bp.template_pack ) { - if ( 'disable' === rtmedia_activity_text_with_attachment && '' === jQuery.trim( jQuery( '#whats-new' ).val() ) ) { + if ( 'disable' === rtmedia_main.rtmedia_activity_text_with_attachment && '' === jQuery.trim( jQuery( '#whats-new' ).val() ) ) { let textarea = jQuery( '#whats-new' ); textarea.css( 'color', 'transparent' ); textarea.val( ' ' ); @@ -1541,7 +1541,7 @@ jQuery( document ).ready( function( $ ) { } ); objUploadView.uploader.bind( 'UploadProgress', function( up, file ) { - //$( "#" + file.id + " .plupload_file_status" ).html( rtmedia_uploading_msg + '( ' + file.percent + '% )' ); + //$( "#" + file.id + " .plupload_file_status" ).html( rtmedia_main.rtmedia_uploading_msg + '( ' + file.percent + '% )' ); // creates a progress bar to display file upload status var progressBar = jQuery( '
', { 'class': 'plupload_file_progress ui-widget-header', @@ -1557,7 +1557,7 @@ jQuery( document ).ready( function( $ ) { } window.onbeforeunload = function( evt ) { - var message = rtmedia_upload_progress_error_message; + var message = rtmedia_backbone.rtmedia_upload_progress_error_message; return message; }; } ); @@ -1623,16 +1623,16 @@ jQuery( document ).ready( function( $ ) { * Disabled TextBox color(transparent) * ELSE * Required Activity text with media - * add rtmedia_activity_text_with_attachment condition to filter + * add rtmedia_main.rtmedia_activity_text_with_attachment condition to filter * if user want media and activity_text both require * By: Yahil */ - if ( rtmedia_activity_text_with_attachment == 'disable') { + if ( rtmedia_main.rtmedia_activity_text_with_attachment == 'disable') { $( "#whats-new" ).css( 'color', 'transparent' ); $( "#whats-new" ).val( ' ' ); } else { - jQuery('#whats-new-form').prepend('

' + rtmedia_empty_activity_msg + '

') + jQuery('#whats-new-form').prepend('

' + rtmedia_main.rtmedia_empty_activity_msg + '

') jQuery( '#whats-new' ).removeAttr( 'disabled' ); return false; } @@ -1793,7 +1793,7 @@ jQuery( document ).ready( function( $ ) { if( show_error ){ - rtmedia_single_media_alert_message( rtmedia_empty_comment_msg, 'warning', true ); + rtmedia_single_media_alert_message( rtmedia_main.rtmedia_empty_comment_msg, 'warning', true ); if ( widget_id ) { rtmedia_comment_media_input_button( widget_id, false ); @@ -1856,7 +1856,7 @@ jQuery( document ).ready( function( $ ) { e.preventDefault(); var ask_confirmation = true; ask_confirmation = rtMediaHook.call( 'rtmedia_js_delete_comment_confirmation', [ ask_confirmation ] ); - if ( ask_confirmation && ! confirm( rtmedia_media_comment_delete_confirmation ) ) { + if ( ask_confirmation && ! confirm( rtmedia_main.rtmedia_media_comment_delete_confirmation ) ) { return false; } var current_comment = jQuery( this ); @@ -1892,7 +1892,7 @@ jQuery( document ).ready( function( $ ) { var like_nonce = $( '#rtm_media_like_nonce' ).val(); $( this ).attr( 'disabled', 'disabled' ); var url = $( this ).parent().attr( 'action' ); - $( that ).prepend( '' ); + $( that ).prepend( '' ); $.ajax( { url: url, type: 'post', @@ -1933,7 +1933,7 @@ jQuery( document ).ready( function( $ ) { $( this ).attr( 'disabled', 'disabled' ); var featured_nonce = $( this ).siblings( '#rtm_media_featured_nonce' ).val(); var url = $( this ).parent().attr( 'action' ); - $( that ).prepend( '' ); + $( that ).prepend( '' ); $.ajax( { url: url, type: 'post', @@ -1946,12 +1946,12 @@ jQuery( document ).ready( function( $ ) { } if ( data.nonce ) { - rtmedia_single_media_alert_message( rtmedia_something_wrong_msg, 'warning' ); + rtmedia_single_media_alert_message( rtmedia_main.rtmedia_something_wrong_msg, 'warning' ); } else { if ( data.action ) { - rtmedia_single_media_alert_message( rtmedia_set_featured_image_msg, 'success' ); + rtmedia_single_media_alert_message( rtmedia_backbone.rtmedia_set_featured_image_msg, 'success' ); } else { - rtmedia_single_media_alert_message( rtmedia_unset_featured_image_msg, 'success' ); + rtmedia_single_media_alert_message( rtmedia_backbone.rtmedia_unset_featured_image_msg, 'success' ); } } $( that ).find( 'span' ).html( data.next ); @@ -1981,7 +1981,7 @@ function rtmedia_selected_file_list( plupload, file, uploader, error, comment_me /** * Blank error display issue resolved */ - if ( bp_template_pack && 'legacy' !== bp_template_pack ) { + if ( rtmedia_bp.template_pack && 'legacy' !== rtmedia_bp.template_pack ) { var new_submit_btn = jQuery( '#aw-whats-new-submit' ); if ( 0 < new_submit_btn.length ) { @@ -2017,7 +2017,7 @@ function rtmedia_selected_file_list( plupload, file, uploader, error, comment_me upload_progress += '
'; icon = ''; } else if ( error.code == -600 ) { - err_msg = ( uploader != '' ) ? rtmedia_max_file_msg + uploader.settings.max_file_size : window.file_size_info; + err_msg = ( uploader != '' ) ? rtmedia_main.rtmedia_max_file_msg + uploader.settings.max_file_size : window.file_size_info; title = 'title=\'' + err_msg + '\''; icon = ''; } else if ( error.code == -601 ) { @@ -2239,7 +2239,7 @@ function rtmedia_comment_media_uplaod_button_disble( widget_id, $value ){ } function rtmedia_apply_popup_to_media(){ - if ( typeof( rtmedia_lightbox_enabled ) != 'undefined' && rtmedia_lightbox_enabled == '1' ) { + if ( typeof( rtmedia_main.rtmedia_lightbox_enabled ) != 'undefined' && rtmedia_main.rtmedia_lightbox_enabled == '1' ) { apply_rtMagnificPopup( '.rtmedia-comment-media-container ul.rtmedia-comment-media-list, .rtmedia-list-media.rtm-gallery-list, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container' ); } } @@ -2373,8 +2373,8 @@ function rtmedia_activity_comment_js_add_media_id(){ widget_id = 'activity-'+originalOptions.data.form_id var rtmedia_disable_media = 1; - if( typeof rtmedia_disable_media_in_commented_media != 'undefined' ){ - rtmedia_disable_media = rtmedia_disable_media_in_commented_media; + if( typeof rtmedia_main.rtmedia_disable_media_in_commented_media != 'undefined' ){ + rtmedia_disable_media = rtmedia_main.rtmedia_disable_media_in_commented_media; } var temp = jQuery( '.'+comment_media_wrapper+widget_id ).find( 'input[name="rtMedia_attached_files[]"]' ).val(); @@ -2398,7 +2398,7 @@ function rtmedia_activity_comment_js_add_media_id(){ if( rtmedia_disable_media == 1 ){ if( originalOptions.data.form_id != originalOptions.data.comment_id && temp > 0 ){ - jQuery( '.'+comment_media_wrapper+widget_id ).append('

' + rtmedia_disable_media_in_commented_media_text + '

') + jQuery( '.'+comment_media_wrapper+widget_id ).append('

' + rtmedia_main.rtmedia_disable_media_in_commented_media_text + '

') jQuery( '.'+comment_media_wrapper+widget_id ).removeAttr( 'disabled' ); rtmedia_comment_media_input_button( widget_id, false ); @@ -2611,7 +2611,7 @@ function renderUploadercomment_media( widget_id, parent_id_type ) { var tmp_array = file.name.split( '.' ); - if ( rtmedia_version_compare( rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 + if ( rtmedia_version_compare( rtmedia_main.rtm_wp_version, '3.9' ) ) { // Plupload getting updated in 3.9 var ext_array = commentObj[ widget_id ].uploader.settings.filters.mime_types[0].extensions.split( ',' ); } else { var ext_array = commentObj[ widget_id ].uploader.settings.filters[0].extensions.split( ',' ); @@ -2727,7 +2727,7 @@ function renderUploadercomment_media( widget_id, parent_id_type ) { rtMediaHook.call( 'rtmedia_js_after_files_added', [ upl, rfiles ] ); - if ( 'undefined' != typeof rtmedia_direct_upload_enabled && '1' == rtmedia_direct_upload_enabled ) { + if ( 'undefined' != typeof rtmedia_main.rtmedia_direct_upload_enabled && '1' == rtmedia_main.rtmedia_direct_upload_enabled ) { jQuery( '.rtmedia-comment-media-submit-' + widget_id ).focus(); /* when direct upload is enable */ @@ -2793,7 +2793,7 @@ function renderUploadercomment_media( widget_id, parent_id_type ) { } } else { if ( err.code == -601 ) { // File extension error - err.message = rtmedia_file_extension_error_msg; + err.message = rtmedia_main.rtmedia_file_extension_error_msg; } rtmedia_selected_file_list( plupload, err.file, '', err, widget_id ); @@ -2857,7 +2857,7 @@ function renderUploadercomment_media( widget_id, parent_id_type ) { } window.onbeforeunload = function( evt ) { - var message = rtmedia_upload_progress_error_message; + var message = rtmedia_backbone.rtmedia_upload_progress_error_message; return message; }; } ); @@ -2884,7 +2884,7 @@ function rtmedia_comment_media_upload( upload_comment ){ function rtmedia_activity_stream_comment_media(){ // For Buddypress new template nouveau - if ( bp_template_pack && 'legacy' !== bp_template_pack ) { + if ( rtmedia_bp.template_pack && 'legacy' !== rtmedia_bp.template_pack ) { jQuery('#buddypress div#activity-stream ul.activity-list li.activity-item, #buddypress ul#activity-stream ul.activity-list li.activity-item').each(function () { if( jQuery( this ).find( '.rt_upload_hf_upload_parent_id' ).length && jQuery( this ).find( '.rt_upload_hf_upload_parent_id_type' ).length ){ if ( jQuery( this ).find( "input[type=file]" ).length == 0 ) { diff --git a/app/assets/js/rtMedia.js b/app/assets/js/rtMedia.js index 9652da5cb..8671ffff0 100755 --- a/app/assets/js/rtMedia.js +++ b/app/assets/js/rtMedia.js @@ -4,12 +4,12 @@ var comment_media = false; function apply_rtMagnificPopup( selector ) { jQuery( 'document' ).ready( function( $ ) { var rt_load_more = ''; - if ( typeof ( rtmedia_load_more ) === 'undefined' ) { + if ( typeof ( rtmedia_magnific.rtmedia_load_more ) === 'undefined' ) { rt_load_more = 'Loading media'; } else { - rt_load_more = rtmedia_load_more; + rt_load_more = rtmedia_magnific.rtmedia_load_more; } - if ( typeof( rtmedia_lightbox_enabled ) != 'undefined' && rtmedia_lightbox_enabled == '1' ) { // If lightbox is enabled. + if ( typeof( rtmedia_main.rtmedia_lightbox_enabled ) != 'undefined' && rtmedia_main.rtmedia_lightbox_enabled == '1' ) { // If lightbox is enabled. var old_gallery_media; var current_page; @@ -234,9 +234,9 @@ function rtmedia_init_action_dropdown( parent ) { jQuery( 'document' ).ready( function( $ ) { // When Ajax completed attach media uploader to new activity, applay popup and attach media to comment uploader. jQuery( document ).ajaxComplete( function( event, xhr, settings ) { - if ( 'legacy' !== bp_template_pack && bp_template_pack ) { + if ( 'legacy' !== rtmedia_bp.template_pack && rtmedia_bp.template_pack ) { var get_action = get_parameter( 'action', settings.data ); - if (('activity_filter' === get_action || 'post_update' === get_action || 'get_single_activity_content' === get_action || 'activity_get_older_updates' === get_action) && 'undefined' !== typeof rtmedia_masonry_layout && 'true' === rtmedia_masonry_layout && 'undefined' !== typeof rtmedia_masonry_layout_activity && 'true' === rtmedia_masonry_layout_activity ) { + if (('activity_filter' === get_action || 'post_update' === get_action || 'get_single_activity_content' === get_action || 'activity_get_older_updates' === get_action) && 'undefined' !== typeof rtmedia_main.rtmedia_masonry_layout && 'true' === rtmedia_main.rtmedia_masonry_layout && 'undefined' !== typeof rtmedia_main.rtmedia_masonry_layout_activity && 'true' === rtmedia_main.rtmedia_masonry_layout_activity ) { setTimeout( function() { apply_rtMagnificPopup( '.rtmedia-list-media.rtm-gallery-list, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container' ); rtmedia_activity_masonry(); @@ -278,9 +278,9 @@ jQuery( 'document' ).ready( function( $ ) { $( '#rt_media_comment_form' ).submit( function( e ) { if ( $.trim( $( '#comment_content' ).val() ) == '' ) { if ( jQuery( '#rtmedia-single-media-container' ).length == 0 ) { - rtmedia_gallery_action_alert_message( rtmedia_empty_comment_msg, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_main.rtmedia_empty_comment_msg, 'warning' ); } else { - rtmedia_single_media_alert_message( rtmedia_empty_comment_msg, 'warning' ); + rtmedia_single_media_alert_message( rtmedia_main.rtmedia_empty_comment_msg, 'warning' ); } return false; } else { @@ -299,7 +299,7 @@ jQuery( 'document' ).ready( function( $ ) { $( this ).addClass( 'no-popup' ); }); //Rtmedia_lightbox_enabled from setting - if ( typeof( rtmedia_lightbox_enabled ) != 'undefined' && rtmedia_lightbox_enabled == '1' ) { + if ( typeof( rtmedia_main.rtmedia_lightbox_enabled ) != 'undefined' && rtmedia_main.rtmedia_lightbox_enabled == '1' ) { apply_rtMagnificPopup( '.rtmedia-list-media.rtm-gallery-list, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container' ); } @@ -380,7 +380,7 @@ jQuery( 'document' ).ready( function( $ ) { jQuery( '.rtmedia-container' ).on( 'click', '.select-all', function( e ) { jQuery( this ).toggleClass( 'unselect-all' ).toggleClass( 'select-all' ); - jQuery( this ).attr( 'title', rtmedia_unselect_all_visible ); + jQuery( this ).attr( 'title', rtmedia_main.rtmedia_unselect_all_visible ); jQuery( '.rtmedia-list input' ).each( function() { jQuery( this ).prop( 'checked', true ); } ); @@ -391,7 +391,7 @@ jQuery( 'document' ).ready( function( $ ) { jQuery( '.rtmedia-container' ).on( 'click', '.unselect-all', function( e ) { jQuery( this ).toggleClass( 'select-all' ).toggleClass( 'unselect-all' ); - jQuery( this ).attr( 'title', rtmedia_select_all_visible ); + jQuery( this ).attr( 'title', rtmedia_main.rtmedia_select_all_visible ); jQuery( '.rtmedia-list input' ).each( function() { jQuery( this ).prop( 'checked', false ); } ); @@ -429,7 +429,7 @@ jQuery( 'document' ).ready( function( $ ) { $( '#rtmedia_create_new_album' ).attr( 'disabled', 'disabled' ); var old_val = $( '#rtmedia_create_new_album' ).html(); $( '#rtmedia_create_new_album' ).prepend( '' ); - jQuery.post( rtmedia_ajax_url, data, function( response ) { + jQuery.post( rtmedia_main.rtmedia_ajax_url, data, function( response ) { if ( typeof response.album != 'undefined' ) { response = jQuery.trim( response.album ); var flag = true; @@ -459,7 +459,7 @@ jQuery( 'document' ).ready( function( $ ) { jQuery( 'select.rtmedia-user-album-list option[value="' + response + '"]' ).prop( 'selected', true ); jQuery( '.rtmedia-create-new-album-container' ).slideToggle(); jQuery( '#rtmedia_album_name' ).val( '' ); - jQuery( '#rtmedia-create-album-modal' ).append( '
' + $albumname + '' + rtmedia_album_created_msg + '
' ); + jQuery( '#rtmedia-create-album-modal' ).append( '
' + $albumname + '' + rtmedia_main.rtmedia_album_created_msg + '
' ); setTimeout( function() { jQuery( '.rtmedia-create-album-alert' ).remove(); @@ -472,34 +472,34 @@ jQuery( 'document' ).ready( function( $ ) { } else if ( typeof response.error != 'undefined' ) { rtmedia_gallery_action_alert_message( response.error, 'warning' ); } else { - rtmedia_gallery_action_alert_message( rtmedia_something_wrong_msg, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_main.rtmedia_something_wrong_msg, 'warning' ); } $( '#rtmedia_create_new_album' ).removeAttr( 'disabled' ); $( '#rtmedia_create_new_album' ).html( old_val ); } ); } else { - rtmedia_gallery_action_alert_message( rtmedia_empty_album_name_msg, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_main.rtmedia_empty_album_name_msg, 'warning' ); } } ); jQuery( '.rtmedia-container' ).on( 'click', '.rtmedia-delete-selected', function( e ) { if ( jQuery( '.rtmedia-list :checkbox:checked' ).length > 0 ) { - if ( confirm( rtmedia_selected_media_delete_confirmation ) ) { - jQuery( this ).closest( 'form' ).attr( 'action', '../../../' + rtmedia_media_slug + '/delete' ).submit(); + if ( confirm( rtmedia_main.rtmedia_selected_media_delete_confirmation ) ) { + jQuery( this ).closest( 'form' ).attr( 'action', '../../../' + rtmedia_main.rtmedia_media_slug + '/delete' ).submit(); } } else { - rtmedia_gallery_action_alert_message( rtmedia_no_media_selected, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_main.rtmedia_no_media_selected, 'warning' ); } } ); jQuery( '.rtmedia-container' ).on( 'click', '.rtmedia-move-selected', function( e ) { if ( jQuery( '.rtmedia-list :checkbox:checked' ).length > 0 ) { - if ( confirm( rtmedia_selected_media_move_confirmation ) ) { + if ( confirm( rtmedia_main.rtmedia_selected_media_move_confirmation ) ) { jQuery( this ).closest( 'form' ).attr( 'action', '' ).submit(); } } else { - rtmedia_gallery_action_alert_message( rtmedia_no_media_selected, 'warning' ); + rtmedia_gallery_action_alert_message( rtmedia_main.rtmedia_no_media_selected, 'warning' ); } } ); @@ -519,7 +519,7 @@ jQuery( 'document' ).ready( function( $ ) { action: 'rtm_change_activity_privacy' }; - jQuery.post( ajaxurl, data, function( res ) { + jQuery.post( rtmedia_main.ajaxurl, data, function( res ) { var message = ''; var css_class = ''; if ( res == 'true' ) { @@ -716,9 +716,9 @@ jQuery( 'document' ).ready( function( $ ) { var dragArea = jQuery( '#drag-drop-area' ); var activityArea = jQuery( '#whats-new' ); var content = dragArea.html(); - jQuery( '#rtmedia-upload-container' ).after( '
' + rtmedia_drop_media_msg + '
' ); - if ( typeof rtmedia_bp_enable_activity != 'undefined' && rtmedia_bp_enable_activity == '1' ) { - jQuery( '#whats-new-textarea' ).append( '
' + rtmedia_drop_media_msg + '
' ); + jQuery( '#rtmedia-upload-container' ).after( '
' + rtmedia_main.rtmedia_drop_media_msg + '
' ); + if ( typeof rtmedia_backbone.rtmedia_bp_enable_activity != 'undefined' && rtmedia_backbone.rtmedia_bp_enable_activity == '1' ) { + jQuery( '#whats-new-textarea' ).append( '
' + rtmedia_main.rtmedia_drop_media_msg + '
' ); } jQuery( document ) .on( 'dragover', function( e ) { @@ -728,7 +728,7 @@ jQuery( 'document' ).ready( function( $ ) { return; } jQuery( '#rtm-media-gallery-uploader' ).show(); - if ( typeof rtmedia_bp_enable_activity != 'undefined' && rtmedia_bp_enable_activity == '1' ) { + if ( typeof rtmedia_backbone.rtmedia_bp_enable_activity != 'undefined' && rtmedia_backbone.rtmedia_bp_enable_activity == '1' ) { activityArea.addClass( 'rtm-drag-drop-active' ); } @@ -740,7 +740,7 @@ jQuery( 'document' ).ready( function( $ ) { if ( e.originalEvent.pageX != 0 && e.originalEvent.pageY != 0 ) { return false; } - if ( typeof rtmedia_bp_enable_activity != 'undefined' && rtmedia_bp_enable_activity == '1' ) { + if ( typeof rtmedia_backbone.rtmedia_bp_enable_activity != 'undefined' && rtmedia_backbone.rtmedia_bp_enable_activity == '1' ) { activityArea.removeClass( 'rtm-drag-drop-active' ); activityArea.removeAttr( 'style' ); } @@ -752,7 +752,7 @@ jQuery( 'document' ).ready( function( $ ) { e.preventDefault(); /* Put cursor into activity box after dropping any media */ jQuery( '.bp-suggestions' ).focus(); - if ( typeof rtmedia_bp_enable_activity != 'undefined' && rtmedia_bp_enable_activity == '1' ) { + if ( typeof rtmedia_backbone.rtmedia_bp_enable_activity != 'undefined' && rtmedia_backbone.rtmedia_bp_enable_activity == '1' ) { activityArea.removeClass( 'rtm-drag-drop-active' ); activityArea.removeAttr( 'style' ); } @@ -763,7 +763,7 @@ jQuery( 'document' ).ready( function( $ ) { function rtmedia_init_media_deleting() { jQuery( '.rtmedia-container' ).on( 'click', '.rtmedia-delete-media', function( e ) { e.preventDefault(); - if ( confirm( rtmedia_media_delete_confirmation ) ) { + if ( confirm( rtmedia_main.rtmedia_media_delete_confirmation ) ) { jQuery( this ).closest( 'form' ).submit(); } } ); @@ -771,14 +771,14 @@ jQuery( 'document' ).ready( function( $ ) { jQuery( '.rtmedia-container' ).on( 'click', '.rtmedia-delete-album', function( e ) { e.preventDefault(); - if ( confirm( rtmedia_album_delete_confirmation ) ) { + if ( confirm( rtmedia_main.rtmedia_album_delete_confirmation ) ) { jQuery( this ).closest( 'form' ).submit(); } } ); jQuery( '.rtmedia-container' ).on( 'click', '.rtmedia-delete-media', function( e ) { e.preventDefault(); - if ( confirm( rtmedia_media_delete_confirmation ) ) { + if ( confirm( rtmedia_main.rtmedia_media_delete_confirmation ) ) { jQuery( this ).closest( 'form' ).submit(); } } ); @@ -804,7 +804,7 @@ jQuery( 'document' ).ready( function( $ ) { } // Masonry code for activity - if ( typeof rtmedia_masonry_layout != 'undefined' && rtmedia_masonry_layout == 'true' && typeof rtmedia_masonry_layout_activity != 'undefined' && rtmedia_masonry_layout_activity == 'true' ) { + if ( typeof rtmedia_main.rtmedia_masonry_layout != 'undefined' && rtmedia_main.rtmedia_masonry_layout == 'true' && typeof rtmedia_main.rtmedia_masonry_layout_activity != 'undefined' && rtmedia_main.rtmedia_masonry_layout_activity == 'true' ) { // Arrange media into masonry view rtmedia_activity_masonry(); } @@ -813,13 +813,13 @@ jQuery( 'document' ).ready( function( $ ) { jQuery( document ).ajaxComplete( function( event, xhr, settings ) { var get_action = get_parameter( 'action', settings.data ); - if ( ( 'post_update' === get_action || 'get_single_activity_content' === get_action || 'activity_get_older_updates' === get_action ) && typeof rtmedia_masonry_layout != 'undefined' && rtmedia_masonry_layout == 'true' && typeof rtmedia_masonry_layout_activity != 'undefined' && rtmedia_masonry_layout_activity == 'true' ) { + if ( ( 'post_update' === get_action || 'get_single_activity_content' === get_action || 'activity_get_older_updates' === get_action ) && typeof rtmedia_main.rtmedia_masonry_layout != 'undefined' && rtmedia_main.rtmedia_masonry_layout == 'true' && typeof rtmedia_main.rtmedia_masonry_layout_activity != 'undefined' && rtmedia_main.rtmedia_masonry_layout_activity == 'true' ) { rtmedia_activity_masonry(); } } ); // Masonry code - if ( typeof rtmedia_masonry_layout != 'undefined' && rtmedia_masonry_layout == 'true' && jQuery( '.rtmedia-container .rtmedia-list.rtm-no-masonry' ).length == 0 ) { + if ( typeof rtmedia_main.rtmedia_masonry_layout != 'undefined' && rtmedia_main.rtmedia_masonry_layout == 'true' && jQuery( '.rtmedia-container .rtmedia-list.rtm-no-masonry' ).length == 0 ) { rtm_masonry_container = jQuery( '.rtmedia-container .rtmedia-list' ); rtm_masonry_container.masonry( { itemSelector: '.rtmedia-list-item' @@ -859,7 +859,7 @@ jQuery( 'document' ).ready( function( $ ) { */ jQuery( '.rtmedia-container' ).on( 'click', '.rtm-delete-media', function( e ) { e.preventDefault(); - var confirmation = RTMedia_Main_JS.media_delete_confirmation; + var confirmation = rtmedia_main.media_delete_confirmation; if ( confirm( confirmation ) ) { // If user confirms, send ajax request to delete the selected media var curr_li = jQuery( this ).closest( 'li' ); @@ -874,7 +874,7 @@ jQuery( 'document' ).ready( function( $ ) { }; jQuery.ajax( { - url: RTMedia_Main_JS.rtmedia_ajaxurl, + url: rtmedia_main.rtmedia_ajaxurl, type: 'POST', data: data, dataType: 'JSON', @@ -882,10 +882,10 @@ jQuery( 'document' ).ready( function( $ ) { if ( 'rtmedia-media-deleted' === response.data.code ) { //Media delete - rtmedia_gallery_action_alert_message( RTMedia_Main_JS.media_delete_success, 'success' ); + rtmedia_gallery_action_alert_message( rtmedia_main.media_delete_success, 'success' ); curr_li.remove(); - if ( 'undefined' !== typeof rtmedia_masonry_layout && 'true' === rtmedia_masonry_layout ) { + if ( 'undefined' !== typeof rtmedia_main.rtmedia_masonry_layout && 'true' === rtmedia_main.rtmedia_masonry_layout ) { rtm_masonry_reload( rtm_masonry_container ); } @@ -960,8 +960,8 @@ function rtm_masonry_reload( el ) { showChars: 100, minHideChars: 10, ellipsesText: '...', - moreText: rtmedia_read_more, - lessText: rtmedia__show_less, + moreText: rtmedia_main.rtmedia_read_more, + lessText: rtmedia_main.rtmedia__show_less, onLess: function() {}, onMore: function() {}, errMsg: null, @@ -1093,7 +1093,7 @@ function rtm_masonry_reload( el ) { })( jQuery ); window.onload = function() { - if ( 'undefined' != typeof rtmedia_masonry_layout && 'true' == rtmedia_masonry_layout && 0 == jQuery( '.rtmedia-container .rtmedia-list.rtm-no-masonry' ).length ) { + if ( 'undefined' != typeof rtmedia_main.rtmedia_masonry_layout && 'true' == rtmedia_main.rtmedia_masonry_layout && 0 == jQuery( '.rtmedia-container .rtmedia-list.rtm-no-masonry' ).length ) { rtm_masonry_reload( rtm_masonry_container ); } diff --git a/app/assets/js/rtm-upload-terms.js b/app/assets/js/rtm-upload-terms.js index e4b6e942c..150783a56 100755 --- a/app/assets/js/rtm-upload-terms.js +++ b/app/assets/js/rtm-upload-terms.js @@ -267,7 +267,7 @@ jQuery( document ).ready( function () { rtp_display_terms_warning( terms_conditions_checkbox.parent( '.rtmedia-upload-terms' ), rtmedia_upload_terms_data.message ); } - if ( 'undefined' !== typeof rtmedia_direct_upload_enabled && '1' === rtmedia_direct_upload_enabled ) { + if ( 'undefined' !== typeof rtmedia_main.rtmedia_direct_upload_enabled && '1' === rtmedia_main.rtmedia_direct_upload_enabled ) { var whats_new_submit = jQuery( '#aw-whats-new-submit' ); if ( whats_new_submit.length ) { diff --git a/app/assets/js/rtm-upload-terms.min.js b/app/assets/js/rtm-upload-terms.min.js index c95f5c04c..9a5727df7 100644 --- a/app/assets/js/rtm-upload-terms.min.js +++ b/app/assets/js/rtm-upload-terms.min.js @@ -3,4 +3,4 @@ * @package rtMedia */ -var rtmediaTermsConditionsElement;function rtp_display_terms_warning(e,t){if(0===jQuery(".rt_alert_msg").length){var r=jQuery("").attr("style","color:red; display:block; clear:both;").addClass("rt_alert_msg").empty().append(t);e.after(r)}}function handle_privacy_message(){jQuery("#close_rtm_privacy_message").on("click",function(){var e=jQuery(".privacy_message_wrapper");e.fadeOut("slow",function(){e.remove(),jQuery.cookie("rtm_show_privacy_message","view",{expires:1,path:"/"})})})}"object"==typeof rtMediaHook&&(rtMediaHook.register("rtmedia_js_before_upload",function(e){if(!e)return e;if(void 0===e.uploader||void 0===e.uploader.settings||void 0===e.uploader.settings.multipart_params||void 0===e.src)return"boolean"!=typeof e||e;var t=e.uploader.settings.multipart_params,r=!1,a=!1,d=!1;if("activity"===e.src?(r="activity_terms_condition_request",a="activity_terms_condition","true"===rtmedia_upload_terms_data.activity_terms_enabled&&(d=!0)):"uploader"===e.src&&(r="uploader_terms_condition_request",a="uploader_terms_condition","true"===rtmedia_upload_terms_data.uploader_terms_enabled&&(d=!0)),!d)return!0;if(r&&a&&d)if(t[r]="true",rtmediaTermsConditionsElement&&0").attr("style","color:red; display:block; clear:both;").addClass("rt_alert_msg").empty().append(t);e.after(r)}}function handle_privacy_message(){jQuery("#close_rtm_privacy_message").on("click",function(){var e=jQuery(".privacy_message_wrapper");e.fadeOut("slow",function(){e.remove(),jQuery.cookie("rtm_show_privacy_message","view",{expires:1,path:"/"})})})}"object"==typeof rtMediaHook&&(rtMediaHook.register("rtmedia_js_before_upload",function(e){if(!e)return e;if(void 0===e.uploader||void 0===e.uploader.settings||void 0===e.uploader.settings.multipart_params||void 0===e.src)return"boolean"!=typeof e||e;var t=e.uploader.settings.multipart_params,r=!1,a=!1,d=!1;if("activity"===e.src?(r="activity_terms_condition_request",a="activity_terms_condition","true"===rtmedia_upload_terms_data.activity_terms_enabled&&(d=!0)):"uploader"===e.src&&(r="uploader_terms_condition_request",a="uploader_terms_condition","true"===rtmedia_upload_terms_data.uploader_terms_enabled&&(d=!0)),!d)return!0;if(r&&a&&d)if(t[r]="true",rtmediaTermsConditionsElement&&0(e||C.height())},_setFocus:function(){(y.st.focus?y.content.find(y.st.focus).eq(0):y.wrap).focus()},_onFocusIn:function(e){if(e.target!==y.wrap[0]&&!d.contains(y.wrap[0],e.target))return y._setFocus(),!1},_parseMarkup:function(r,e,t){var n;t.data&&(e=d.extend(t.data,e)),p(g,[r,e,t]),d.each(e,function(e,t){if(void 0===t||!1===t)return!0;if(1<(n=e.split("_")).length){var i=r.find(b+"-"+n[0]);if(0'):i.attr(n[1],t)}}else r.find(b+"-"+e).html(t)})},_getScrollbarSize:function(){if(void 0===y.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),y.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return y.scrollbarSize}},d.magnificPopup={instance:null,proto:e.prototype,modules:[],open:function(e,t){return n(),(e=e?d.extend(!0,{},e):{}).isObj=!0,e.index=t||0,this.instance.open(e)},close:function(){return d.magnificPopup.instance&&d.magnificPopup.instance.close()},registerModule:function(e,t){t.options&&(d.magnificPopup.defaults[e]=t.options),d.extend(this.proto,t.proto),this.modules.push(e)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},d.fn.magnificPopup=function(e){n();var t=d(this);if("string"==typeof e)if("open"===e){var i,a=Q?t.data("magnificPopup"):t[0].magnificPopup,r=parseInt(arguments[1],10)||0;i=a.items?a.items[r]:(i=t,a.delegate&&(i=i.find(a.delegate)),i.eq(r)),y._openClick({mfpEl:i},t,a)}else y.isOpen&&y[e].apply(y,Array.prototype.slice.call(arguments,1));else e=d.extend(!0,{},e),Q?t.data("magnificPopup",e):t[0].magnificPopup=e,y.addGroup(t,e);return t};function k(){I&&(T.after(I.addClass(x)).detach(),I=null)}var x,T,I,M="inline";d.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){y.types.push(M),m(l+"."+M,function(){k()})},getInline:function(e,t){if(k(),e.src){var i=y.st.inline,a=d(e.src);if(a.length){var r=a[0].parentNode;r&&r.tagName&&(T||(x=i.hiddenClass,T=u(x),x="mfp-"+x),I=a.after(T).detach().removeClass(x)),y.updateStatus("ready")}else y.updateStatus("error",i.tNotFound),a=d("
");return e.inlineElement=a}return y.updateStatus("ready"),y._parseMarkup(t,{},e),t}}});function P(){E&&d(document.body).removeClass(E)}function S(){P(),y.req&&y.req.abort()}var E,O="ajax";d.magnificPopup.registerModule(O,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){y.types.push(O),E=y.st.ajax.cursor,m(l+"."+O,S),m("BeforeChange."+O,S)},getAjax:function(r){E&&d(document.body).addClass(E),y.updateStatus("loading");var e=d.extend({url:r.src,success:function(e,t,i){var a={data:e,xhr:i};p("ParseAjax",a),y.appendContent(d(a.data),O),r.finished=!0,P(),y._setFocus(),setTimeout(function(){y.wrap.addClass(j)},16),y.updateStatus("ready"),p("AjaxContentAdded")},error:function(){P(),r.finished=r.loadError=!0,y.updateStatus("error",y.st.ajax.tError.replace("%url%",r.src))}},y.st.ajax.settings);return y.req=d.ajax(e),""}}});var z;d.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var e=y.st.image,t=".image";y.types.push("image"),m(h+t,function(){"image"===y.currItem.type&&e.cursor&&d(document.body).addClass(e.cursor)}),m(l+t,function(){e.cursor&&d(document.body).removeClass(e.cursor),C.off("resize"+b)}),m("Resize"+t,y.resizeImage),y.isLowIE&&m("AfterChange",y.resizeImage)},resizeImage:function(){var e=y.currItem;if(e&&e.img&&y.st.image.verticalFit){var t=0;y.isLowIE&&(t=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",y.wH-t)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,z&&clearInterval(z),e.isCheckingImgSize=!1,p("ImageHasSize",e),e.imgHidden&&(y.content&&y.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(t){var i=0,a=t.img[0],r=function(e){z&&clearInterval(z),z=setInterval(function(){0
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){y.types.push(A),m("BeforeChange",function(e,t,i){t!==i&&(t===A?B():i===A&&B(!0))}),m(l+"."+A,function(){B()})},getIframe:function(e,t){var i=e.src,a=y.st.iframe;d.each(a.patterns,function(){if(-1',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=y.st.gallery,e=".mfp-gallery",r=Boolean(d.fn.mfpFastClick);if(y.direction=!0,!n||!n.enabled)return!1;v+=" mfp-gallery",m(h+e,function(){n.navigateByImgClick&&y.wrap.on("click"+e,".mfp-img",function(){if(1=y.index,y.index=e,y.updateItemHTML()},preloadNearbyImages:function(){var e,t=y.st.gallery.preload,i=Math.min(t[0],y.items.length),a=Math.min(t[1],y.items.length);for(e=1;e<=(y.direction?a:i);e++)y._preloadItem(y.index+e);for(e=1;e<=(y.direction?i:a);e++)y._preloadItem(y.index-e)},_preloadItem:function(e){if(e=L(e),!y.items[e].preloaded){var t=y.items[e];t.parsed||(t=y.parseEl(e)),p("LazyLoad",t),"image"===t.type&&(t.img=d('').on("load.mfploader",function(){t.hasSize=!0}).on("error.mfploader",function(){t.hasSize=!0,t.loadError=!0,p("LazyLoadError",t)}).attr("src",t.src)),t.preloaded=!0}}}});var F,R,D="retina";function W(){C.off("touchmove"+R+" touchend"+R)}d.magnificPopup.registerModule(D,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(1 a").siblings("p").children("a").length&&s(".activity-item .rtmedia-activity-container .rtmedia-list-item > a").siblings("p").children("a").addClass("no-popup"),rtMagnificPopup=jQuery(t).magnificPopup({delegate:"a:not(.no-popup, .mejs-time-slider, .mejs-volume-slider, .mejs-horizontal-volume-slider)",type:"ajax",fixedContentPos:!0,fixedBgPos:!0,tLoading:e+" #%curr%...",mainClass:"mfp-img-mobile",preload:[1,3],closeOnBgClick:!0,gallery:{enabled:!0,navigateByImgClick:!0,arrowMarkup:"",preload:[0,1]},image:{tError:'The image #%curr% could not be loaded.',titleSrc:function(e){return e.el.attr("title")+"by Marsel Van Oosten"}},callbacks:{ajaxContentAdded:function(){e=jQuery.magnificPopup.instance,1===jQuery(e.items).size()&&jQuery(".mfp-arrow").remove();var e=jQuery.magnificPopup.instance,t=e.currItem.el,i=t.parent();if(i.is("li")||(i=i.parent()),(i.is(":nth-last-child(2)")||i.is(":last-child"))&&i.find("a").hasClass("rtmedia-list-item-a")){i.next();"block"==jQuery("#rtMedia-galary-next").css("display")&&(c||(n=e.ev.children(),c=!0,l=nextpage),jQuery("#rtMedia-galary-next").click())}var a=e.items.length;if(e.index!=a-1||i.is(":last-child")){"undefined"!=typeof _wpmejsSettings&&_wpmejsSettings.pluginPath;var o=jQuery(".rtmedia-container .rtmedia-single-meta").height(),r=!1;void 0!==e&&void 0!==e.probablyMobile&&1==e.probablyMobile&&(r=!0),s(".mfp-content .rtmedia-single-media .wp-audio-shortcode,.mfp-content .rtmedia-single-media .wp-video-shortcode,.mfp-content .rtmedia-single-media .bp_media_content video").attr("autoplay",!0),r&&s(".mfp-content .rtmedia-single-media .wp-video-shortcode,.mfp-content .rtmedia-single-media .bp_media_content video").attr("muted",!1),s(".mfp-content .rtmedia-single-media .wp-audio-shortcode,.mfp-content .rtmedia-single-media .wp-video-shortcode,.mfp-content .rtmedia-single-media .bp_media_content video").mediaelementplayer({classPrefix:"mejs-",defaultVideoWidth:480,hideVolumeOnTouchDevices:!1,features:["playpause","progress","current","volume","fullscreen"],defaultVideoHeight:270,alwaysShowControls:r,enableAutosize:!0,clickToPlayPause:!0,videoHeight:-1,success:function(n,e){n.addEventListener("loadeddata",function(e){var t=s(n).height(),i=s(window).height(),a=jQuery("div.rtm-ltb-action-container").height(),r=o-(a=a+50);i span,"+e+" .click-nav > div").toggleClass("no-js js"),jQuery(e+" .click-nav .js ul").hide(),jQuery(e+" .click-nav .clicker").click(function(e){t=jQuery("#rtm-media-options .click-nav .clicker").next("ul"),i=jQuery(this).next("ul"),jQuery.each(t,function(e,t){jQuery(t).html()!=i.html()&&jQuery(t).hide()}),jQuery(i).toggle(),e.stopPropagation()})}function bp_media_create_element(e){return!1}function rtmedia_version_compare(e,t){if(typeof e+typeof t!="stringstring")return!1;for(var i=e.split("."),a=t.split("."),r=0,n=Math.max(i.length,a.length);rparseInt(a[r]))return!0;if(a[r]&&!i[r]&&0",{title:"Click to dismiss",class:"rtmedia-message-container"+(i?" rtmedia-empty-comment-error-class":""),style:"margin:1em 0;"}),s=jQuery("",{class:a});s.html(e),s.appendTo(o),i?(n=jQuery("#rt_media_comment_form"),jQuery("#comment_content").focus()):void 0===i&&(n=jQuery(".rtmedia-single-media .rtmedia-media")).css("opacity","0.2"),n.after(o),r&&(s.css({border:"2px solid #884646"}),setTimeout(function(){s.css({border:"none"})},500)),setTimeout(function(){o.remove(),void 0===i&&n.css("opacity","1")},3e3),o.click(function(){o.remove(),void 0===i&&n.css("opacity","1")})}function rtmedia_gallery_action_alert_message(e,t){var i="rtmedia-success";"warning"==t&&(i="rtmedia-warning");jQuery("body").append(''),jQuery(".rtmedia-gallery-alert-container").append(""),setTimeout(function(){jQuery(".rtmedia-gallery-alert-container").remove()},3e3),jQuery(".rtmedia-gallery-message-box").click(function(){jQuery(".rtmedia-gallery-alert-container").remove()})}function rtmedia_activity_masonry(){jQuery("#activity-stream .rtmedia-activity-container .rtmedia-list").masonry({itemSelector:".rtmedia-list-item",gutter:7});var e=0,t=setInterval(function(){5===(e+=1)&&clearInterval(t),jQuery.each(jQuery(".rtmedia-activity-container .rtmedia-list.masonry .rtmedia-item-title"),function(e,t){jQuery(t).width(jQuery(t).siblings(".rtmedia-item-thumbnail").children("img").width())}),rtm_masonry_reload(jQuery("#activity-stream .rtmedia-activity-container .rtmedia-list"))},1e3)}function get_parameter(e,t){if(!e)return!1;t=t||window.location.href;e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp(e+"=([^&#]*)").exec(t);return null!==i&&i[1]}function rtm_upload_terms_activity(){if(0 audio.wp-audio-shortcode, ul.activity-list li.rtmedia_update div.rtmedia-item-thumbnail > video.wp-video-shortcode").mediaelementplayer({classPrefix:"mejs-",defaultVideoWidth:480,defaultVideoHeight:270}),setTimeout(function(){rtmedia_activity_stream_comment_media()},900),rtMediaHook.call("rtmedia_js_after_activity_added",[])}}}),jQuery(".rtmedia-container").on("click",".select-all",function(e){jQuery(this).toggleClass("unselect-all").toggleClass("select-all"),jQuery(this).attr("title",rtmedia_unselect_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!0)}),jQuery(".rtmedia-list-item").addClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".unselect-all",function(e){jQuery(this).toggleClass("select-all").toggleClass("unselect-all"),jQuery(this).attr("title",rtmedia_select_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!1)}),jQuery(".rtmedia-list-item").removeClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".rtmedia-move",function(e){jQuery(".rtmedia-delete-container").slideUp(),jQuery(".rtmedia-move-container").slideToggle()}),jQuery("#rtmedia-create-album-modal").on("click","#rtmedia_create_new_album",function(e){if($albumname=jQuery("").text(jQuery.trim(jQuery("#rtmedia_album_name").val())).html(),$album_description=jQuery("#rtmedia_album_description"),$context=jQuery.trim(jQuery("#rtmedia_album_context").val()),$context_id=jQuery.trim(jQuery("#rtmedia_album_context_id").val()),$privacy=jQuery.trim(jQuery("#rtmedia_select_album_privacy").val()),$create_album_nonce=jQuery.trim(jQuery("#rtmedia_create_album_nonce").val()),""!=$albumname){var t={action:"rtmedia_create_album",name:$albumname,description:$album_description.val(),context:$context,context_id:$context_id,create_album_nonce:$create_album_nonce};""!==$privacy&&(t.privacy=$privacy),n("#rtmedia_create_new_album").attr("disabled","disabled");var r=n("#rtmedia_create_new_album").html();n("#rtmedia_create_new_album").prepend(""),jQuery.post(rtmedia_ajax_url,t,function(i){if(void 0!==i.album){i=jQuery.trim(i.album);var a=!0;$album_description.val(""),n("#rtmedia_album_name").focus(),jQuery(".rtmedia-user-album-list").each(function(){if(jQuery(this).children("optgroup").each(function(){if(jQuery(this).attr("value")===$context)return a=!1,void jQuery(this).append('")}),a){var e=$context.charAt(0).toUpperCase()+$context.slice(1)+" "+rtmedia_main_js_strings.rtmedia_albums,t='";jQuery(this).append(t)}}),jQuery('select.rtmedia-user-album-list option[value="'+i+'"]').prop("selected",!0),jQuery(".rtmedia-create-new-album-container").slideToggle(),jQuery("#rtmedia_album_name").val(""),jQuery("#rtmedia-create-album-modal").append("
"+$albumname+""+rtmedia_album_created_msg+"
"),setTimeout(function(){jQuery(".rtmedia-create-album-alert").remove()},4e3),setTimeout(function(){galleryObj.reloadView(),jQuery(".close-reveal-modal").click()},2e3)}else void 0!==i.error?rtmedia_gallery_action_alert_message(i.error,"warning"):rtmedia_gallery_action_alert_message(rtmedia_something_wrong_msg,"warning");n("#rtmedia_create_new_album").removeAttr("disabled"),n("#rtmedia_create_new_album").html(r)})}else rtmedia_gallery_action_alert_message(rtmedia_empty_album_name_msg,"warning")}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-selected",function(e){0'+t+"

"),setTimeout(function(){jQuery(a).siblings(".rtm-ac-privacy-updated").remove()},2e3)})}),jQuery(".media_search_input").on("keyup",function(){rtm_search_media_text_validation()}),r(),rtMediaHook.register("rtmedia_js_popup_after_content_added",function(){r(),jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(e){e.preventDefault(),confirm(rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()}),mfp=jQuery.magnificPopup.instance,1"+rtmedia_drop_media_msg+"
"),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&jQuery("#whats-new-textarea").append("
"+rtmedia_drop_media_msg+"
"),jQuery(document).on("dragover",function(e){e.preventDefault(),e.target!=this&&(jQuery("#rtm-media-gallery-uploader").show(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&i.addClass("rtm-drag-drop-active"),t.addClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").show())}).on("dragleave",function(e){if(e.preventDefault(),0!=e.originalEvent.pageX&&0!=e.originalEvent.pageY)return!1;"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&(i.removeClass("rtm-drag-drop-active"),i.removeAttr("style")),t.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}).on("drop",function(e){e.preventDefault(),jQuery(".bp-suggestions").focus(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&(i.removeClass("rtm-drag-drop-active"),i.removeAttr("style")),t.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-album",function(e){e.preventDefault(),confirm(rtmedia_album_delete_confirmation)&&jQuery(this).closest("form").submit()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(e){e.preventDefault(),confirm(rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()}),rtmedia_init_action_dropdown(""),n(document).click(function(){n(".click-nav ul").is(":visible")&&n(".click-nav ul",this).hide()}),jQuery(".rtmedia-comment-link").on("click",function(e){e.preventDefault(),jQuery("#comment_content").focus()}),0m.showChars+m.minHideChars){var i=t.substr(0,m.showChars);if(0<=i.indexOf("<")){for(var a=!1,r="",n=0,o=[],s=null,l=0,c=0;c<=m.showChars;l++)if("<"!=t[l]||a||(a=!0,"/"==(s=t.substring(l+1,t.indexOf(">",l)))[0]?s!="/"+o[0]?m.errMsg="ERROR en HTML: the top of the stack should be the tag that closes":o.shift():"br"!=s.toLowerCase()&&o.unshift(s)),a&&">"==t[l]&&(a=!1),a)r+=t.charAt(l);else if(c++,n<=m.showChars)r+=t.charAt(l),n++;else if(0";break}i=u("
").html(r+''+m.ellipsesText+"").html()}else i+=m.ellipsesText;var d='
'+i+'
'+t+'
'+m.moreText+"";e.html(d),e.find(".allcontent").hide(),u(".shortcontent p:last",e).css("margin-bottom",0)}}))}}(jQuery),window.onload=function(){"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&rtm_masonry_reload(rtm_masonry_container),rtm_search_media_text_validation(),check_condition("search")&&jQuery("#media_search_remove").show()},jQuery(document).ready(function(){rtm_upload_terms_activity(),jQuery("body").hasClass("has-sidebar")&&0===jQuery("#secondary").length&&(jQuery(".rtmedia-single-container").length||jQuery(".rtmedia-container").length)&&jQuery("body").removeClass("has-sidebar")}); \ No newline at end of file +var rtMagnificPopup,rtm_masonry_container;!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(window.jQuery||window.Zepto)}(function(c){function e(){}function m(e,t){_.ev.on(i+e+b,t)}function u(e,t,i,a){var r=document.createElement("div");return r.className="mfp-"+e,i&&(r.innerHTML=i),a?t&&t.appendChild(r):(r=c(r),t&&r.appendTo(t)),r}function p(e,t){_.ev.triggerHandler(i+e,t),_.st.callbacks&&(e=e.charAt(0).toLowerCase()+e.slice(1),_.st.callbacks[e]&&_.st.callbacks[e].apply(_,c.isArray(t)?t:[t]))}function f(e){return e===t&&_.currTemplate.closeBtn||(_.currTemplate.closeBtn=c(_.st.closeMarkup.replace("%title%",_.st.tClose)),t=e),_.currTemplate.closeBtn}function n(){c.magnificPopup.instance||((_=new e).init(),c.magnificPopup.instance=_)}var _,a,y,r,v,t,l="Close",d="BeforeClose",g="MarkupParse",h="Open",o="Change",i="mfp",b="."+i,j="mfp-ready",s="mfp-removing",w="mfp-prevent-close",Q=!!window.jQuery,C=c(window);e.prototype={constructor:e,init:function(){var e=navigator.appVersion;_.isIE7=-1!==e.indexOf("MSIE 7."),_.isIE8=-1!==e.indexOf("MSIE 8."),_.isLowIE=_.isIE7||_.isIE8,_.isAndroid=/android/gi.test(e),_.isIOS=/iphone|ipad|ipod/gi.test(e),_.supportsTransition=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1}(),_.probablyMobile=_.isAndroid||_.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),y=c(document),_.popupsCache={}},open:function(e){var t;if(!1===e.isObj){_.items=e.items.toArray(),_.index=0;var i,a=e.items;for(t=0;t(e||C.height())},_setFocus:function(){(_.st.focus?_.content.find(_.st.focus).eq(0):_.wrap).focus()},_onFocusIn:function(e){if(e.target!==_.wrap[0]&&!c.contains(_.wrap[0],e.target))return _._setFocus(),!1},_parseMarkup:function(r,e,t){var n;t.data&&(e=c.extend(t.data,e)),p(g,[r,e,t]),c.each(e,function(e,t){if(void 0===t||!1===t)return!0;if(1<(n=e.split("_")).length){var i=r.find(b+"-"+n[0]);if(0'):i.attr(n[1],t)}}else r.find(b+"-"+e).html(t)})},_getScrollbarSize:function(){if(void 0===_.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),_.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return _.scrollbarSize}},c.magnificPopup={instance:null,proto:e.prototype,modules:[],open:function(e,t){return n(),(e=e?c.extend(!0,{},e):{}).isObj=!0,e.index=t||0,this.instance.open(e)},close:function(){return c.magnificPopup.instance&&c.magnificPopup.instance.close()},registerModule:function(e,t){t.options&&(c.magnificPopup.defaults[e]=t.options),c.extend(this.proto,t.proto),this.modules.push(e)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},c.fn.magnificPopup=function(e){n();var t=c(this);if("string"==typeof e)if("open"===e){var i,a=Q?t.data("magnificPopup"):t[0].magnificPopup,r=parseInt(arguments[1],10)||0;i=a.items?a.items[r]:(i=t,a.delegate&&(i=i.find(a.delegate)),i.eq(r)),_._openClick({mfpEl:i},t,a)}else _.isOpen&&_[e].apply(_,Array.prototype.slice.call(arguments,1));else e=c.extend(!0,{},e),Q?t.data("magnificPopup",e):t[0].magnificPopup=e,_.addGroup(t,e);return t};function k(){I&&(T.after(I.addClass(x)).detach(),I=null)}var x,T,I,M="inline";c.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){_.types.push(M),m(l+"."+M,function(){k()})},getInline:function(e,t){if(k(),e.src){var i=_.st.inline,a=c(e.src);if(a.length){var r=a[0].parentNode;r&&r.tagName&&(T||(x=i.hiddenClass,T=u(x),x="mfp-"+x),I=a.after(T).detach().removeClass(x)),_.updateStatus("ready")}else _.updateStatus("error",i.tNotFound),a=c("
");return e.inlineElement=a}return _.updateStatus("ready"),_._parseMarkup(t,{},e),t}}});function P(){S&&c(document.body).removeClass(S)}function E(){P(),_.req&&_.req.abort()}var S,O="ajax";c.magnificPopup.registerModule(O,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){_.types.push(O),S=_.st.ajax.cursor,m(l+"."+O,E),m("BeforeChange."+O,E)},getAjax:function(r){S&&c(document.body).addClass(S),_.updateStatus("loading");var e=c.extend({url:r.src,success:function(e,t,i){var a={data:e,xhr:i};p("ParseAjax",a),_.appendContent(c(a.data),O),r.finished=!0,P(),_._setFocus(),setTimeout(function(){_.wrap.addClass(j)},16),_.updateStatus("ready"),p("AjaxContentAdded")},error:function(){P(),r.finished=r.loadError=!0,_.updateStatus("error",_.st.ajax.tError.replace("%url%",r.src))}},_.st.ajax.settings);return _.req=c.ajax(e),""}}});var z;c.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var e=_.st.image,t=".image";_.types.push("image"),m(h+t,function(){"image"===_.currItem.type&&e.cursor&&c(document.body).addClass(e.cursor)}),m(l+t,function(){e.cursor&&c(document.body).removeClass(e.cursor),C.off("resize"+b)}),m("Resize"+t,_.resizeImage),_.isLowIE&&m("AfterChange",_.resizeImage)},resizeImage:function(){var e=_.currItem;if(e&&e.img&&_.st.image.verticalFit){var t=0;_.isLowIE&&(t=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",_.wH-t)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,z&&clearInterval(z),e.isCheckingImgSize=!1,p("ImageHasSize",e),e.imgHidden&&(_.content&&_.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(t){var i=0,a=t.img[0],r=function(e){z&&clearInterval(z),z=setInterval(function(){0
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){_.types.push(A),m("BeforeChange",function(e,t,i){t!==i&&(t===A?B():i===A&&B(!0))}),m(l+"."+A,function(){B()})},getIframe:function(e,t){var i=e.src,a=_.st.iframe;c.each(a.patterns,function(){if(-1',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=_.st.gallery,e=".mfp-gallery",r=Boolean(c.fn.mfpFastClick);if(_.direction=!0,!n||!n.enabled)return!1;v+=" mfp-gallery",m(h+e,function(){n.navigateByImgClick&&_.wrap.on("click"+e,".mfp-img",function(){if(1<_.items.length)return _.next(),!1}),y.on("keydown"+e,function(e){37===e.keyCode?_.prev():39===e.keyCode&&_.next()})}),m("UpdateStatus"+e,function(e,t){t.text&&(t.text=$(t.text,_.currItem.index,_.items.length))}),m(g+e,function(e,t,i,a){var r=_.items.length;i.counter=1=_.index,_.index=e,_.updateItemHTML()},preloadNearbyImages:function(){var e,t=_.st.gallery.preload,i=Math.min(t[0],_.items.length),a=Math.min(t[1],_.items.length);for(e=1;e<=(_.direction?a:i);e++)_._preloadItem(_.index+e);for(e=1;e<=(_.direction?i:a);e++)_._preloadItem(_.index-e)},_preloadItem:function(e){if(e=L(e),!_.items[e].preloaded){var t=_.items[e];t.parsed||(t=_.parseEl(e)),p("LazyLoad",t),"image"===t.type&&(t.img=c('').on("load.mfploader",function(){t.hasSize=!0}).on("error.mfploader",function(){t.hasSize=!0,t.loadError=!0,p("LazyLoadError",t)}).attr("src",t.src)),t.preloaded=!0}}}});var F,D,R="retina";function W(){C.off("touchmove"+D+" touchend"+D)}c.magnificPopup.registerModule(R,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(1 a").siblings("p").children("a").length&&s(".activity-item .rtmedia-activity-container .rtmedia-list-item > a").siblings("p").children("a").addClass("no-popup"),rtMagnificPopup=jQuery(t).magnificPopup({delegate:"a:not(.no-popup, .mejs-time-slider, .mejs-volume-slider, .mejs-horizontal-volume-slider)",type:"ajax",fixedContentPos:!0,fixedBgPos:!0,tLoading:e+" #%curr%...",mainClass:"mfp-img-mobile",preload:[1,3],closeOnBgClick:!0,gallery:{enabled:!0,navigateByImgClick:!0,arrowMarkup:"",preload:[0,1]},image:{tError:'The image #%curr% could not be loaded.',titleSrc:function(e){return e.el.attr("title")+"by Marsel Van Oosten"}},callbacks:{ajaxContentAdded:function(){e=jQuery.magnificPopup.instance,1===jQuery(e.items).size()&&jQuery(".mfp-arrow").remove();var e=jQuery.magnificPopup.instance,t=e.currItem.el,i=t.parent();if(i.is("li")||(i=i.parent()),(i.is(":nth-last-child(2)")||i.is(":last-child"))&&i.find("a").hasClass("rtmedia-list-item-a")){i.next();"block"==jQuery("#rtMedia-galary-next").css("display")&&(d||(n=e.ev.children(),d=!0,l=nextpage),jQuery("#rtMedia-galary-next").click())}var a=e.items.length;if(e.index!=a-1||i.is(":last-child")){"undefined"!=typeof _wpmejsSettings&&_wpmejsSettings.pluginPath;var o=jQuery(".rtmedia-container .rtmedia-single-meta").height(),r=!1;void 0!==e&&void 0!==e.probablyMobile&&1==e.probablyMobile&&(r=!0),s(".mfp-content .rtmedia-single-media .wp-audio-shortcode,.mfp-content .rtmedia-single-media .wp-video-shortcode,.mfp-content .rtmedia-single-media .bp_media_content video").attr("autoplay",!0),r&&s(".mfp-content .rtmedia-single-media .wp-video-shortcode,.mfp-content .rtmedia-single-media .bp_media_content video").attr("muted",!1),s(".mfp-content .rtmedia-single-media .wp-audio-shortcode,.mfp-content .rtmedia-single-media .wp-video-shortcode,.mfp-content .rtmedia-single-media .bp_media_content video").mediaelementplayer({classPrefix:"mejs-",defaultVideoWidth:480,hideVolumeOnTouchDevices:!1,features:["playpause","progress","current","volume","fullscreen"],defaultVideoHeight:270,alwaysShowControls:r,enableAutosize:!0,clickToPlayPause:!0,videoHeight:-1,success:function(n,e){n.addEventListener("loadeddata",function(e){var t=s(n).height(),i=s(window).height(),a=jQuery("div.rtm-ltb-action-container").height(),r=o-(a=a+50);i span,"+e+" .click-nav > div").toggleClass("no-js js"),jQuery(e+" .click-nav .js ul").hide(),jQuery(e+" .click-nav .clicker").click(function(e){t=jQuery("#rtm-media-options .click-nav .clicker").next("ul"),i=jQuery(this).next("ul"),jQuery.each(t,function(e,t){jQuery(t).html()!=i.html()&&jQuery(t).hide()}),jQuery(i).toggle(),e.stopPropagation()})}function bp_media_create_element(e){return!1}function rtmedia_version_compare(e,t){if(typeof e+typeof t!="stringstring")return!1;for(var i=e.split("."),a=t.split("."),r=0,n=Math.max(i.length,a.length);rparseInt(a[r]))return!0;if(a[r]&&!i[r]&&0",{title:"Click to dismiss",class:"rtmedia-message-container"+(i?" rtmedia-empty-comment-error-class":""),style:"margin:1em 0;"}),s=jQuery("",{class:a});s.html(e),s.appendTo(o),i?(n=jQuery("#rt_media_comment_form"),jQuery("#comment_content").focus()):void 0===i&&(n=jQuery(".rtmedia-single-media .rtmedia-media")).css("opacity","0.2"),n.after(o),r&&(s.css({border:"2px solid #884646"}),setTimeout(function(){s.css({border:"none"})},500)),setTimeout(function(){o.remove(),void 0===i&&n.css("opacity","1")},3e3),o.click(function(){o.remove(),void 0===i&&n.css("opacity","1")})}function rtmedia_gallery_action_alert_message(e,t){var i="rtmedia-success";"warning"==t&&(i="rtmedia-warning");jQuery("body").append(''),jQuery(".rtmedia-gallery-alert-container").append(""),setTimeout(function(){jQuery(".rtmedia-gallery-alert-container").remove()},3e3),jQuery(".rtmedia-gallery-message-box").click(function(){jQuery(".rtmedia-gallery-alert-container").remove()})}function rtmedia_activity_masonry(){jQuery("#activity-stream .rtmedia-activity-container .rtmedia-list").masonry({itemSelector:".rtmedia-list-item",gutter:7});var e=0,t=setInterval(function(){5===(e+=1)&&clearInterval(t),jQuery.each(jQuery(".rtmedia-activity-container .rtmedia-list.masonry .rtmedia-item-title"),function(e,t){jQuery(t).width(jQuery(t).siblings(".rtmedia-item-thumbnail").children("img").width())}),rtm_masonry_reload(jQuery("#activity-stream .rtmedia-activity-container .rtmedia-list"))},1e3)}function get_parameter(e,t){if(!e)return!1;t=t||window.location.href;e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp(e+"=([^&#]*)").exec(t);return null!==i&&i[1]}function rtm_upload_terms_activity(){if(0 audio.wp-audio-shortcode, ul.activity-list li.rtmedia_update div.rtmedia-item-thumbnail > video.wp-video-shortcode").mediaelementplayer({classPrefix:"mejs-",defaultVideoWidth:480,defaultVideoHeight:270}),setTimeout(function(){rtmedia_activity_stream_comment_media()},900),rtMediaHook.call("rtmedia_js_after_activity_added",[])}}}),jQuery(".rtmedia-container").on("click",".select-all",function(e){jQuery(this).toggleClass("unselect-all").toggleClass("select-all"),jQuery(this).attr("title",rtmedia_main.rtmedia_unselect_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!0)}),jQuery(".rtmedia-list-item").addClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".unselect-all",function(e){jQuery(this).toggleClass("select-all").toggleClass("unselect-all"),jQuery(this).attr("title",rtmedia_main.rtmedia_select_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!1)}),jQuery(".rtmedia-list-item").removeClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".rtmedia-move",function(e){jQuery(".rtmedia-delete-container").slideUp(),jQuery(".rtmedia-move-container").slideToggle()}),jQuery("#rtmedia-create-album-modal").on("click","#rtmedia_create_new_album",function(e){if($albumname=jQuery("").text(jQuery.trim(jQuery("#rtmedia_album_name").val())).html(),$album_description=jQuery("#rtmedia_album_description"),$context=jQuery.trim(jQuery("#rtmedia_album_context").val()),$context_id=jQuery.trim(jQuery("#rtmedia_album_context_id").val()),$privacy=jQuery.trim(jQuery("#rtmedia_select_album_privacy").val()),$create_album_nonce=jQuery.trim(jQuery("#rtmedia_create_album_nonce").val()),""!=$albumname){var t={action:"rtmedia_create_album",name:$albumname,description:$album_description.val(),context:$context,context_id:$context_id,create_album_nonce:$create_album_nonce};""!==$privacy&&(t.privacy=$privacy),n("#rtmedia_create_new_album").attr("disabled","disabled");var r=n("#rtmedia_create_new_album").html();n("#rtmedia_create_new_album").prepend(""),jQuery.post(rtmedia_main.rtmedia_ajax_url,t,function(i){if(void 0!==i.album){i=jQuery.trim(i.album);var a=!0;$album_description.val(""),n("#rtmedia_album_name").focus(),jQuery(".rtmedia-user-album-list").each(function(){if(jQuery(this).children("optgroup").each(function(){if(jQuery(this).attr("value")===$context)return a=!1,void jQuery(this).append('")}),a){var e=$context.charAt(0).toUpperCase()+$context.slice(1)+" "+rtmedia_main_js_strings.rtmedia_albums,t='";jQuery(this).append(t)}}),jQuery('select.rtmedia-user-album-list option[value="'+i+'"]').prop("selected",!0),jQuery(".rtmedia-create-new-album-container").slideToggle(),jQuery("#rtmedia_album_name").val(""),jQuery("#rtmedia-create-album-modal").append("
"+$albumname+""+rtmedia_main.rtmedia_album_created_msg+"
"),setTimeout(function(){jQuery(".rtmedia-create-album-alert").remove()},4e3),setTimeout(function(){galleryObj.reloadView(),jQuery(".close-reveal-modal").click()},2e3)}else void 0!==i.error?rtmedia_gallery_action_alert_message(i.error,"warning"):rtmedia_gallery_action_alert_message(rtmedia_main.rtmedia_something_wrong_msg,"warning");n("#rtmedia_create_new_album").removeAttr("disabled"),n("#rtmedia_create_new_album").html(r)})}else rtmedia_gallery_action_alert_message(rtmedia_main.rtmedia_empty_album_name_msg,"warning")}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-selected",function(e){0'+t+"

"),setTimeout(function(){jQuery(a).siblings(".rtm-ac-privacy-updated").remove()},2e3)})}),jQuery(".media_search_input").on("keyup",function(){rtm_search_media_text_validation()}),r(),rtMediaHook.register("rtmedia_js_popup_after_content_added",function(){r(),jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(e){e.preventDefault(),confirm(rtmedia_main.rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()}),mfp=jQuery.magnificPopup.instance,1"+rtmedia_main.rtmedia_drop_media_msg+"
"),void 0!==rtmedia_backbone.rtmedia_bp_enable_activity&&"1"==rtmedia_backbone.rtmedia_bp_enable_activity&&jQuery("#whats-new-textarea").append("
"+rtmedia_main.rtmedia_drop_media_msg+"
"),jQuery(document).on("dragover",function(e){e.preventDefault(),e.target!=this&&(jQuery("#rtm-media-gallery-uploader").show(),void 0!==rtmedia_backbone.rtmedia_bp_enable_activity&&"1"==rtmedia_backbone.rtmedia_bp_enable_activity&&i.addClass("rtm-drag-drop-active"),t.addClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").show())}).on("dragleave",function(e){if(e.preventDefault(),0!=e.originalEvent.pageX&&0!=e.originalEvent.pageY)return!1;void 0!==rtmedia_backbone.rtmedia_bp_enable_activity&&"1"==rtmedia_backbone.rtmedia_bp_enable_activity&&(i.removeClass("rtm-drag-drop-active"),i.removeAttr("style")),t.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}).on("drop",function(e){e.preventDefault(),jQuery(".bp-suggestions").focus(),void 0!==rtmedia_backbone.rtmedia_bp_enable_activity&&"1"==rtmedia_backbone.rtmedia_bp_enable_activity&&(i.removeClass("rtm-drag-drop-active"),i.removeAttr("style")),t.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-album",function(e){e.preventDefault(),confirm(rtmedia_main.rtmedia_album_delete_confirmation)&&jQuery(this).closest("form").submit()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(e){e.preventDefault(),confirm(rtmedia_main.rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()}),rtmedia_init_action_dropdown(""),n(document).click(function(){n(".click-nav ul").is(":visible")&&n(".click-nav ul",this).hide()}),jQuery(".rtmedia-comment-link").on("click",function(e){e.preventDefault(),jQuery("#comment_content").focus()}),0m.showChars+m.minHideChars){var i=t.substr(0,m.showChars);if(0<=i.indexOf("<")){for(var a=!1,r="",n=0,o=[],s=null,l=0,d=0;d<=m.showChars;l++)if("<"!=t[l]||a||(a=!0,"/"==(s=t.substring(l+1,t.indexOf(">",l)))[0]?s!="/"+o[0]?m.errMsg="ERROR en HTML: the top of the stack should be the tag that closes":o.shift():"br"!=s.toLowerCase()&&o.unshift(s)),a&&">"==t[l]&&(a=!1),a)r+=t.charAt(l);else if(d++,n<=m.showChars)r+=t.charAt(l),n++;else if(0";break}i=u("
").html(r+''+m.ellipsesText+"").html()}else i+=m.ellipsesText;var c='
'+i+'
'+t+'
'+m.moreText+"";e.html(c),e.find(".allcontent").hide(),u(".shortcontent p:last",e).css("margin-bottom",0)}}))}}(jQuery),window.onload=function(){void 0!==rtmedia_main.rtmedia_masonry_layout&&"true"==rtmedia_main.rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&rtm_masonry_reload(rtm_masonry_container),rtm_search_media_text_validation(),check_condition("search")&&jQuery("#media_search_remove").show()},jQuery(document).ready(function(){rtm_upload_terms_activity(),jQuery("body").hasClass("has-sidebar")&&0===jQuery("#secondary").length&&(jQuery(".rtmedia-single-container").length||jQuery(".rtmedia-container").length)&&jQuery("body").removeClass("has-sidebar")}); \ No newline at end of file diff --git a/app/importers/RTMediaMediaSizeImporter.php b/app/importers/RTMediaMediaSizeImporter.php index 69b12b03a..277dd9d79 100644 --- a/app/importers/RTMediaMediaSizeImporter.php +++ b/app/importers/RTMediaMediaSizeImporter.php @@ -106,7 +106,7 @@ public function add_rtmedia_media_size_import_notice() {