diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index 6d141b658..beba88a75 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -11,6 +11,7 @@ jobs: - name: WordPress Plugin Deploy uses: rtCamp/action-wordpress-org-plugin-deploy@master env: + ASSETS_DIR: wpassets EXCLUDE_LIST: .bowerrc .gitattributes .gitignore .jshintrc .travis.yml CONTRIBUTING.md Gruntfile.js README.md bin deploy.sh package-lock.json package.json phpcs.xml phpunit.xml tests diff --git a/README.md b/README.md index a7c8d5204..9e8d61105 100755 --- a/README.md +++ b/README.md @@ -147,6 +147,19 @@ https://www.youtube.com/watch?v=dJrykKQGDcs ## Changelog ## +### 4.6.1 [April 8, 2020] ### + +* Enhancement + * Disable the terms of service checkbox when the activity is published + +* FIXED + * Different language characters not showing up properly on rtMedia pages + * HTML warnings of rtMedia contents + * Nouveau template tab count bug + * Added server side validation for terms of service + * Terms of service checkbox conflicting with rtMedia Sidebar Widgets addon + * PHPCS errors and warnings + ### 4.6.0 [February 17, 2020] ### * Enhancement @@ -1662,8 +1675,8 @@ https://www.youtube.com/watch?v=dJrykKQGDcs * HTML5 Audio Tag Support (with fallback) * HTML5 Video Tag Support (with fallback) -#### 4.6.0 #### -rtMedia 4.6.0, with improved activity content preview and JavaScript and Nouveau template related fixes. +#### 4.6.1 #### +rtMedia 4.6.1 with added server side validation for terms of services checkbox, minor bug fixes along with warnings and PHPCS fixes ## Sponsors ## diff --git a/app/admin/RTMediaAdmin.php b/app/admin/RTMediaAdmin.php index 919a764f7..a27ddc410 100755 --- a/app/admin/RTMediaAdmin.php +++ b/app/admin/RTMediaAdmin.php @@ -1,23 +1,51 @@ rtmedia_support, 'submit_request' ), 1 ); - add_action( 'wp_ajax_rtmedia_linkback', array( $this, 'linkback' ), 1 ); //fixme : is it being used ? + add_action( 'wp_ajax_rtmedia_linkback', array( $this, 'linkback' ), 1 ); // todo: is it being used ? add_action( 'wp_ajax_rtmedia_rt_album_deactivate', 'BPMediaAlbumimporter::bp_album_deactivate', 1 ); add_action( 'wp_ajax_rtmedia_rt_album_import', 'BPMediaAlbumimporter::bpmedia_ajax_import_callback', 1 ); add_action( 'wp_ajax_rtmedia_rt_album_import_favorites', 'BPMediaAlbumimporter::bpmedia_ajax_import_favorites', 1 ); add_action( 'wp_ajax_rtmedia_rt_album_import_step_favorites', 'BPMediaAlbumimporter::bpmedia_ajax_import_step_favorites', 1 ); add_action( 'wp_ajax_rtmedia_rt_album_cleanup', 'BPMediaAlbumimporter::cleanup_after_install' ); - add_action( 'wp_ajax_rtmedia_convert_videos_form', array( $this, 'convert_videos_mailchimp_send' ), 1 ); //fixme : is it being used ? + add_action( 'wp_ajax_rtmedia_convert_videos_form', array( $this, 'convert_videos_mailchimp_send' ), 1 ); // todo: is it being used ? add_action( 'wp_ajax_rtmedia_correct_upload_filetypes', array( $this, 'correct_upload_filetypes' ), 1 ); add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_premium_addon_link' ), 1, 2 ); add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widgets' ), 0 ); add_action( 'wp_ajax_rtmedia_export_settings', array( $this, 'export_settings' ), 10 ); - add_action( 'wp_ajax_rtmedia_hide_addon_update_notice', array( - $this, - 'rtmedia_hide_addon_update_notice', - ), 1 ); + add_action( + 'wp_ajax_rtmedia_hide_addon_update_notice', + array( + $this, + 'rtmedia_hide_addon_update_notice', + ), + 1 + ); add_filter( 'media_row_actions', array( $this, 'modify_medialibrary_permalink' ), 10, 2 ); if ( ! isset( $rtmedia->options ) ) { @@ -96,22 +128,34 @@ public function __construct() { add_action( 'admin_init', array( $this, 'check_permalink_admin_notice' ) ); } - add_action( 'wp_ajax_rtmedia_hide_template_override_notice', array( - $this, - 'rtmedia_hide_template_override_notice', - ), 1 ); + add_action( + 'wp_ajax_rtmedia_hide_template_override_notice', + array( + $this, + 'rtmedia_hide_template_override_notice', + ), + 1 + ); add_action( 'admin_init', array( $this, 'rtmedia_bp_add_update_type' ) ); - add_action( 'wp_ajax_rtmedia_hide_inspirebook_release_notice', array( - $this, - 'rtmedia_hide_inspirebook_release_notice', - ), 1 ); - add_action( 'wp_ajax_rtmedia_hide_social_sync_notice', array( - $this, - 'rtmedia_hide_social_sync_notice', - ), 1 ); + add_action( + 'wp_ajax_rtmedia_hide_inspirebook_release_notice', + array( + $this, + 'rtmedia_hide_inspirebook_release_notice', + ), + 1 + ); + add_action( + 'wp_ajax_rtmedia_hide_social_sync_notice', + array( + $this, + 'rtmedia_hide_social_sync_notice', + ), + 1 + ); add_action( 'wp_ajax_rtmedia_hide_premium_addon_notice', array( $this, 'rtmedia_hide_premium_addon_notice' ), 1 ); - new RTMediaMediaSizeImporter(); // do not delete this line. We only need to create object of this class if we are in admin section + new RTMediaMediaSizeImporter(); // do not delete this line. We only need to create object of this class if we are in admin section. if ( class_exists( 'BuddyPress' ) ) { new RTMediaActivityUpgrade(); } @@ -131,19 +175,19 @@ public function __construct() { /** * Display admin notice. */ - function install_transcoder_admin_notice() { + public function install_transcoder_admin_notice() { $show_notice = get_site_option( 'install_transcoder_admin_notice', 1 ); if ( '1' === $show_notice || 1 === $show_notice ) : - ?> + ?>

array( - 'href' => array(), - 'target' => array(), - ), + 'a' => array( + 'href' => array(), + 'target' => array(), + ), ); echo wp_kses( __( 'Install Transcoder plugin to convert audio/video files and thumbnails generation.', 'buddypress-media' ), $allowed_tags ); ?> @@ -162,20 +206,24 @@ function install_transcoder_admin_notice() { }); }); - '; } - $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; + $page_name = sanitize_text_field( filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ) ); - if ( ! empty( $page ) && 'rtmedia-settings' === $page ) { + if ( ! empty( $page_name ) && 'rtmedia-settings' === $page_name ) { /** * Filter is use to enable comment option in side the media that are being uploaded in the comment section. * @@ -195,10 +243,11 @@ function rtm_admin_templates() { * @param True to hide the option and false to show the option. */ $display = apply_filters( 'rtmedia_disable_media_in_commented_media', true ); - if ( $display ) { ?> + if ( $display ) { + ?> ID ); if ( $rtm_id ) { - $link = get_rtmedia_permalink( $rtm_id ); - $title = _draft_or_post_title( $post->post_parent ); - $action['view'] = '' . esc_html__( 'View', 'buddypress-media' ) . ''; + $link = get_rtmedia_permalink( $rtm_id ); + $title = _draft_or_post_title( $post->post_parent ); + + // translators: 1. Title. + $action['view'] = '' . esc_html__( 'View', 'buddypress-media' ) . ''; } return $action; } - function rtmedia_migration() { + /** + * Get rtmedia migration object. + */ + public function rtmedia_migration() { new RTMediaMigration(); } - function rtmedia_addon_license_save_hook() { + /** + * Add-on License save hook. + */ + public function rtmedia_addon_license_save_hook() { do_action( 'rtmedia_addon_license_save_hook' ); } @@ -231,8 +296,6 @@ function rtmedia_addon_license_save_hook() { * * @access public * - * @param void - * * @return void */ public function rtmedia_network_admin_notices() { @@ -242,12 +305,10 @@ public function rtmedia_network_admin_notices() { } /** - * Show rtmedia admin notices. + * Show rtMedia admin notices. * * @access public * - * @param void - * * @return void */ public function rtmedia_admin_notices() { @@ -263,8 +324,8 @@ public function rtmedia_admin_notices() { } } - /* - * rtMedia Pro split release admin notice + /** + * For rtMedia Pro split release admin notice */ public function rtmedia_premium_addon_notice() { $site_option = rtmedia_get_site_option( 'rtmedia_premium_addon_notice' ); @@ -276,17 +337,24 @@ public function rtmedia_premium_addon_notice() {

store.', 'buddypress-media' ), $product_page - ); + $product_page = 'https://rtmedia.io/products/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media'; + + // translators: 1. Product page link. + $message = sprintf( __( 'Check 30+ premium rtMedia add-ons on our store.', 'buddypress-media' ), $product_page ); ?> - + array( + 'href' => array(), + ), + ) + ); + ?> - Dismiss + >


- + get_total_count(); @@ -542,7 +672,7 @@ function migrate_to_new_db( $lastid = 0, $limit = 1 ) { order by a.post_id limit %d"; - $results = $wpdb->get_results( $wpdb->prepare( $sql, $lastid, $limit ) ); // @codingStandardsIgnoreLine + $results = $wpdb->get_results( $wpdb->prepare( $sql, $lastid, $limit ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared if ( function_exists( 'bp_core_get_table_prefix' ) ) { $bp_prefix = bp_core_get_table_prefix(); @@ -557,14 +687,17 @@ function migrate_to_new_db( $lastid = 0, $limit = 1 ) { } } else { global $wp_rewrite; - //Call flush_rules() as a method of the $wp_rewrite object + // Call flush_rules() as a method of the $wp_rewrite object. $wp_rewrite->flush_rules( true ); } $this->return_migration(); } - function migrate_encoding_options() { - $encoding_mnigration_array = array( + /** + * Update migrate encoding options. + */ + public function migrate_encoding_options() { + $encoding_migration_array = array( 'bp-media-encoding-api-key' => 'rtmedia-encoding-api-key', 'bp-media-encoding-usage-limit-mail' => 'rtmedia-encoding-usage-limit-mail', 'bp-media-encoding-usage' => 'rtmedia-encoding-usage', @@ -573,26 +706,42 @@ function migrate_encoding_options() { 'bp_media_ffmpeg_options' => 'rtmedia-ffmpeg-options', 'bp_media_kaltura_options' => 'rtmedia-kaltura-options', ); - foreach ( $encoding_mnigration_array as $key => $ma ) { - if ( false !== ( $value = rtmedia_get_site_option( $key ) ) ) { + + foreach ( $encoding_migration_array as $key => $ma ) { + $value = rtmedia_get_site_option( $key ); + + if ( false !== $value ) { rtmedia_update_site_option( $ma, $value ); } } } - function migrate_single_media( $result, $album = false ) { + /** + * Migrate single media. + * + * @param string $result Media id. + * @param bool|string $album Album name. + * + * @return mixed + */ + public function migrate_single_media( $result, $album = false ) { + $blog_id = get_current_blog_id(); $old = $result; + if ( function_exists( 'bp_core_get_table_prefix' ) ) { $bp_prefix = bp_core_get_table_prefix(); } else { $bp_prefix = ''; } + global $wpdb; if ( false !== $album && ! ( is_object( $result ) ) ) { - $id = $wpdb->get_var( $wpdb->prepare( "select ID from {$this->bmp_table} where media_id = %d", $result ) ); // @codingStandardsIgnoreLine - if ( null == $id ) { + + $id = $wpdb->get_var( $wpdb->prepare( "select ID from {$this->bmp_table} where media_id = %d", $result ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + + if ( null === $id ) { $sql = "select a.post_id as 'post_id', a.meta_value as 'privacy', @@ -616,7 +765,7 @@ function migrate_single_media( $result, $album = false ) { where a.post_id = %d and (NOT p.ID IS NULL) and a.meta_key = 'bp_media_privacy'"; - $result = $wpdb->get_row( $wpdb->prepare( $sql, $result ) ); // @codingStandardsIgnoreLine + $result = $wpdb->get_row( $wpdb->prepare( $sql, $result ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } else { return $id; } @@ -635,7 +784,7 @@ function migrate_single_media( $result, $album = false ) { } $old_type = ''; - if ( 'attachment' != $result->post_type ) { + if ( 'attachment' !== $result->post_type ) { $media_type = 'album'; } else { $mime_type = strtolower( $result->post_mime_type ); @@ -658,15 +807,16 @@ function migrate_single_media( $result, $album = false ) { } } - $activity_data = $wpdb->get_row( $wpdb->prepare( "select * from {$bp_prefix}bp_activity where id= %d", $result->activity_id ) ); // @codingStandardsIgnoreLine - if ( 'album' != $media_type ) { + $activity_data = $wpdb->get_row( $wpdb->prepare( "select * from {$bp_prefix}bp_activity where id= %d", $result->activity_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + if ( 'album' !== $media_type ) { $this->importmedia( $media_id, $prefix ); } if ( $this->table_exists( $bp_prefix . 'bp_activity' ) && class_exists( 'BP_Activity_Activity' ) ) { - $bp_activity = new BP_Activity_Activity(); - // @codingStandardsIgnoreStart - $activity_sql = $wpdb->prepare( "SELECT + $bp_activity = new BP_Activity_Activity(); + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared + $activity_sql = $wpdb->prepare( + "SELECT * FROM {$bp_prefix}bp_activity @@ -679,9 +829,11 @@ function migrate_single_media( $result, $album = false ) { $wpdb->posts p ON (a.post_id = p.ID) where (NOT p.ID IS NULL) and p.ID = %d - and a.meta_key = 'bp_media_child_activity')", $media_id ); + and a.meta_key = 'bp_media_child_activity')", + $media_id + ); $all_activity = $wpdb->get_results( $activity_sql ); - // @codingStandardsIgnoreEnd + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared remove_all_actions( 'wp_insert_comment' ); foreach ( $all_activity as $activity ) { $comments = $bp_activity->get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right ); @@ -705,22 +857,27 @@ function migrate_single_media( $result, $album = false ) { $likes = 0; } - $wpdb->insert( $this->bmp_table, array( - 'blog_id' => $blog_id, - 'media_id' => $media_id, - 'media_type' => $media_type, - 'context' => $media_context, - 'context_id' => abs( intval( $result->context_id ) ), - 'activity_id' => $result->activity_id, - 'privacy' => intval( $result->privacy ) * 10, - 'media_author' => $result->media_author, - 'media_title' => $result->media_title, - 'album_id' => $album_id, - 'likes' => $likes, - ), array( '%d', '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d' ) ); + $wpdb->insert( + $this->bmp_table, + array( + 'blog_id' => $blog_id, + 'media_id' => $media_id, + 'media_type' => $media_type, + 'context' => $media_context, + 'context_id' => abs( intval( $result->context_id ) ), + 'activity_id' => $result->activity_id, + 'privacy' => intval( $result->privacy ) * 10, + 'media_author' => $result->media_author, + 'media_title' => $result->media_title, + 'album_id' => $album_id, + 'likes' => $likes, + ), + array( '%d', '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d' ) + ); + $last_id = $wpdb->insert_id; - if ( 'album' != $media_type && function_exists( 'bp_core_get_user_domain' ) && $activity_data ) { + if ( 'album' !== $media_type && function_exists( 'bp_core_get_user_domain' ) && $activity_data ) { if ( function_exists( 'bp_core_get_table_prefix' ) ) { $bp_prefix = bp_core_get_table_prefix(); } else { @@ -740,13 +897,17 @@ function migrate_single_media( $result, $album = false ) { $activity_data->content = str_replace( $last_baseurl, $replace_img, $activity_data->content ); } global $wpdb; - $wpdb->update( $bp_prefix . 'bp_activity', array( - 'primary_link' => $activity_data->primary_link, - 'action' => $activity_data->action, - 'content' => $activity_data->content, - ), array( 'id' => $activity_data->id ) ); + $wpdb->update( + $bp_prefix . 'bp_activity', + array( + 'primary_link' => $activity_data->primary_link, + 'action' => $activity_data->action, + 'content' => $activity_data->content, + ), + array( 'id' => $activity_data->id ) + ); } else { - if ( 'group' == $media_context ) { + if ( 'group' === $media_context ) { $activity_data->old_primary_link = $activity_data->primary_link; $parent_link = get_rtmedia_group_link( abs( intval( $result->context_id ) ) ); $parent_link = trailingslashit( $parent_link ); @@ -760,8 +921,8 @@ function migrate_single_media( $result, $album = false ) { $this->search_and_replace( $activity_data->old_primary_link, $activity_data->primary_link ); } } - if ( '' != $old_type ) { - if ( 'group' == $media_context ) { + if ( '' !== $old_type ) { + if ( 'group' === $media_context ) { $parent_link = get_rtmedia_group_link( abs( intval( $result->context_id ) ) ); $parent_link = trailingslashit( $parent_link ); $this->search_and_replace( trailingslashit( $parent_link . $old_type . '/' . $media_id ), trailingslashit( $parent_link . RTMEDIA_MEDIA_SLUG . '/' . $last_id ) ); @@ -776,10 +937,12 @@ function migrate_single_media( $result, $album = false ) { } /** - * @param $id - * @param $prefix + * Import media. + * + * @param int $id Media id. + * @param string $prefix Prefix. */ - function importmedia( $id, $prefix ) { + public function importmedia( $id, $prefix ) { $delete = false; $attached_file = get_attached_file( $id ); @@ -790,17 +953,19 @@ function importmedia( $id, $prefix ) { $siteurl = get_option( 'siteurl' ); $upload_path = trim( get_option( 'upload_path' ) ); - if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) { + if ( empty( $upload_path ) || 'wp-content/uploads' === $upload_path ) { $dir = WP_CONTENT_DIR . '/uploads'; } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) { - // $dir is absolute, $upload_path is (maybe) relative to ABSPATH + // $dir is absolute, $upload_path is (maybe) relative to ABSPATH. $dir = path_join( ABSPATH, $upload_path ); } else { $dir = $upload_path; } - if ( ! $url = get_option( 'upload_url_path' ) ) { - if ( empty( $upload_path ) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) { + $url = get_option( 'upload_url_path' ); + + if ( ! empty( $url ) ) { + if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path === $dir ) ) { $url = WP_CONTENT_URL . '/uploads'; } else { $url = trailingslashit( $siteurl ) . $upload_path; @@ -814,7 +979,7 @@ function importmedia( $id, $prefix ) { $url = trailingslashit( $siteurl ) . UPLOADS; } - // If multisite (and if not the main site in a post-MU network) + // If multisite (and if not the main site in a post-MU network). if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) { if ( ! rtmedia_get_site_option( 'ms_files_rewriting' ) ) { @@ -822,8 +987,7 @@ function importmedia( $id, $prefix ) { // Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory // prevents a four-digit ID from conflicting with a year-based directory for the main site. // But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra - // directory, as they never had wp-content/uploads for the main site.) - + // directory, as they never had wp-content/uploads for the main site.). if ( defined( 'MULTISITE' ) ) { $ms_dir = '/sites/' . get_current_blog_id(); } else { @@ -835,16 +999,15 @@ function importmedia( $id, $prefix ) { } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) { // Handle the old-form ms-files.php rewriting if the network still has that enabled. // When ms-files rewriting is enabled, then we only listen to UPLOADS when: - // 1) we are not on the main site in a post-MU network, - // as wp-content/uploads is used there, and - // 2) we are not switched, as ms_upload_constants() hardcodes - // these constants to reflect the original blog ID. + // 1) we are not on the main site in a post-MU network, + // as wp-content/uploads is used there, and + // 2) we are not switched, as ms_upload_constants() hardcodes + // these constants to reflect the original blog ID. // // Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute. // (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as // as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files - // rewriting in multisite, the resulting URL is /files. (#WP22702 for background.) - + // rewriting in multisite, the resulting URL is /files. (#WP22702 for background.). if ( defined( 'BLOGUPLOADDIR' ) ) { $dir = untrailingslashit( BLOGUPLOADDIR ); } else { @@ -1009,18 +1172,33 @@ function importmedia( $id, $prefix ) { } } - function search_and_replace( $old, $new ) { + /** + * Search and replace in activity table. + * + * @param string $old Old string. + * @param string $new New string. + */ + public function search_and_replace( $old, $new ) { global $wpdb; + if ( function_exists( 'bp_core_get_table_prefix' ) ) { $bp_prefix = bp_core_get_table_prefix(); } else { $bp_prefix = $wpdb->prefix; } - $sql = $wpdb->prepare( "update {$bp_prefix}bp_activity set action=replace(action,%s,%s) ,content=replace(content,%s,%s), primary_link=replace(primary_link,%s,%s) where id > 0;", $old, $new, $old, $new, $old, $new ); // @codingStandardsIgnoreLine - $wpdb->get_row( $sql );// @codingStandardsIgnoreLine + + $sql = $wpdb->prepare( "update {$bp_prefix}bp_activity set action=replace(action,%s,%s) ,content=replace(content,%s,%s), primary_link=replace(primary_link,%s,%s) where id > 0;", $old, $new, $old, $new, $old, $new ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + $wpdb->get_row( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } - function format_seconds( $seconds_left ) { + /** + * Format seconds into time. + * + * @param float $seconds_left Seconds to format. + * + * @return string + */ + public function format_seconds( $seconds_left ) { $minute_in_seconds = 60; $hour_in_seconds = $minute_in_seconds * 60; @@ -1039,7 +1217,7 @@ function format_seconds( $seconds_left ) { $time_components = array(); if ( $days > 0 ) { - $time_components[] = $days .esc_html__( ' day', 'buddypress-media' ) . ( $days > 1 ? 's' : '' ); + $time_components[] = $days . esc_html__( ' day', 'buddypress-media' ) . ( $days > 1 ? 's' : '' ); } if ( $hours > 0 ) { @@ -1063,7 +1241,15 @@ function format_seconds( $seconds_left ) { return $formatted_time_remaining; } - function insert_comment( $media_id, $data, $exclude, $parent_commnet_id = 0 ) { + /** + * Insert comment. + * + * @param int $media_id media id. + * @param array $data Media data. + * @param string $exclude Exclude. + * @param int $parent_commnet_id parent comment id. + */ + public function insert_comment( $media_id, $data, $exclude, $parent_commnet_id = 0 ) { foreach ( $data as $cmnt ) { $comment_id = 0; if ( ! key_exists( strval( $cmnt->id ), $exclude ) ) { diff --git a/app/main/RTMedia.php b/app/main/RTMedia.php index f84ab321e..0e0c7fa1c 100755 --- a/app/main/RTMedia.php +++ b/app/main/RTMedia.php @@ -1,46 +1,54 @@ */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * The main rtMedia Class. This is where everything starts. + */ class RTMedia { /** - * @var string default thumbnail url fallback for all media types + * Default thumbnail url fallback for all media types + * + * @var string $default_thumbnail */ private $default_thumbnail; /** + * Allowed media types array * - * @var array allowed media types + * @var array $allowed_types */ public $allowed_types; /** + * Array of privacy settings * - * @var array privacy settings + * @var array $privacy_settings */ public $privacy_settings; /** + * Default media sizes * - * @var array default media sizes + * @var array $default_sizes */ public $default_sizes; /** + * Default application wide privacy levels * - * @var object default application wide privacy levels + * @var array $default_privacy */ public $default_privacy = array( '0' => 'Public', @@ -50,28 +58,43 @@ class RTMedia { ); /** + * Support forum url * - * @var string Support forum url + * @var string $support_url */ public $support_url = 'https://rtmedia.io/support/'; /** + * Number of media items to show in one view. * - * @var int Number of media items to show in one view. + * @var int $posts_per_page */ public $posts_per_page = 10; /** + * The types of activity BuddyPress Media creates * - * @var array The types of activity BuddyPress Media creates + * @var array $activity_types */ public $activity_types = array( 'media_upload', 'album_updated', 'album_created', ); + + /** + * Array of site options. + * + * @var array $options + */ public $options; - public $render_options; + + /** + * Render site options. + * + * @var array $render_options + */ + public $render_options; // todo:remove if unused. /** * Constructs the class @@ -94,11 +117,11 @@ public function __construct() { add_action( 'groups_settings_updated', array( $this, 'group_status_reset_cache' ) ); add_action( 'groups_delete_group', array( $this, 'group_status_reset_cache' ) ); - // Including core functions, actions & filters - include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-functions.php' ); - include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-actions.php' ); - include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-ajax-actions.php' ); - include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-filters.php' ); + // Including core functions, actions & filters. + include RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-functions.php'; + include RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-actions.php'; + include RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-ajax-actions.php'; + include RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-filters.php'; add_filter( 'intermediate_image_sizes_advanced', array( $this, 'filter_image_sizes_details' ) ); add_filter( 'intermediate_image_sizes', array( $this, 'filter_image_sizes' ) ); @@ -115,7 +138,14 @@ public function group_status_reset_cache( $group_id ) { delete_transient( 'group_status_' . $group_id ); } - function filter_allow_mime_type_mu( $options ) { + /** + * Change allowed types for media. + * + * @param array $options Array of options. + * + * @return string + */ + public function filter_allow_mime_type_mu( $options ) { $allowed_types = array(); $this->allowed_types = apply_filters( 'rtmedia_allowed_types', $this->allowed_types ); foreach ( $this->allowed_types as $type ) { @@ -125,12 +155,15 @@ function filter_allow_mime_type_mu( $options ) { } } } - $ext = apply_filters( 'rtmedia_plupload_files_filter', array( + $ext = apply_filters( + 'rtmedia_plupload_files_filter', array( - 'title' => 'Media Files', - 'extensions' => implode( ',', $allowed_types ), - ), - ) ); + array( + 'title' => esc_html__( 'Media Files', 'buddypress-media' ), + 'extensions' => implode( ',', $allowed_types ), + ), + ) + ); $ext_arr = explode( ',', $ext[0]['extensions'] ); $options = trim( $options ); foreach ( $ext_arr as $f_ext ) { @@ -142,7 +175,10 @@ function filter_allow_mime_type_mu( $options ) { return $options; } - function fix_parent_id() { + /** + * Fix parents ids for global albums. + */ + public function fix_parent_id() { $site_global = rtmedia_get_site_option( 'rtmedia-global-albums' ); if ( $site_global && is_array( $site_global ) && isset( $site_global[0] ) ) { $model = new RTMediaModel(); @@ -151,8 +187,9 @@ function fix_parent_id() { global $wpdb; $row = $album_row['result'][0]; if ( isset( $row['media_id'] ) ) { - // @codingStandardsIgnoreStart - $sql = $wpdb->prepare( "update $wpdb->posts p + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared + $sql = $wpdb->prepare( + "update $wpdb->posts p left join $model->table_name r ON ( p.ID = r.media_id and blog_id = %d ) set @@ -161,28 +198,34 @@ function fix_parent_id() { p.guid like %s and (p.post_parent = 0 or p.post_parent is NULL) and not r.id is NULL - and r.media_type <> 'album'", get_current_blog_id(), $row['media_id'], '%/rtMedia/%' ); + and r.media_type <> 'album'", + get_current_blog_id(), + $row['media_id'], + '%/rtMedia/%' + ); $wpdb->query( $sql ); - // @codingStandardsIgnoreEnd + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared } } } } - function fix_privacy() { + /** + * Function to change privacy in rtm_media table. + */ + public function fix_privacy() { global $wpdb; $model = new RTMediaModel(); $update_sql = "UPDATE {$model->table_name} SET privacy = '80' where privacy = '-1' "; - $wpdb->query( $update_sql ); // @codingStandardsIgnoreLine + $wpdb->query( $update_sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } - /* + /** * Update media privacy of the medias having context=group * update privacy of groups medias according to the privacy of the group 0->public, 20-> private/hidden */ - - function fix_group_media_privacy() { - //if buddypress is active and groups are enabled + public function fix_group_media_privacy() { + // if buddypress is active and groups are enabled. global $wpdb; $table_exist = false; if ( $wpdb->query( "SHOW TABLES LIKE '{$wpdb->prefix}bp_groups'" ) ) { @@ -191,25 +234,31 @@ function fix_group_media_privacy() { if ( class_exists( 'BuddyPress' ) && $table_exist ) { $model = new RTMediaModel(); $sql_group = " UPDATE $model->table_name m join {$wpdb->prefix}bp_groups bp on m.context_id = bp.id SET m.privacy = 0 where m.context = 'group' and bp.status = 'public' and m.privacy <> 80 "; - $wpdb->query( $sql_group ); // @codingStandardsIgnoreLine + $wpdb->query( $sql_group ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $sql_group = " UPDATE $model->table_name m join {$wpdb->prefix}bp_groups bp on m.context_id = bp.id SET m.privacy = 20 where m.context = 'group' and ( bp.status = 'private' OR bp.status = 'hidden' ) and m.privacy <> 80 "; - $wpdb->query( $sql_group ); // @codingStandardsIgnoreLine + $wpdb->query( $sql_group ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } } - function fix_db_collation() { + /** + * Function to fix DB collection by altering DB tables character set. + */ + public function fix_db_collation() { global $wpdb; $model = new RTMediaModel(); $interaction_model = new RTMediaInteractionModel(); $update_media_sql = 'ALTER TABLE ' . $model->table_name . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'; - $wpdb->query( $update_media_sql ); // @codingStandardsIgnoreLine + $wpdb->query( $update_media_sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $update_media_meta_sql = 'ALTER TABLE ' . $wpdb->base_prefix . $model->meta_table_name . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'; - $wpdb->query( $update_media_meta_sql ); // @codingStandardsIgnoreLine + $wpdb->query( $update_media_meta_sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $update_media_interaction_sql = 'ALTER TABLE ' . $interaction_model->table_name . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'; - $wpdb->query( $update_media_interaction_sql ); // @codingStandardsIgnoreLine + $wpdb->query( $update_media_interaction_sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } - function set_site_options() { + /** + * Set site options for rtMedia. + */ + public function set_site_options() { $rtmedia_options = rtmedia_get_site_option( 'rtmedia-options' ); $bp_media_options = rtmedia_get_site_option( 'bp_media_options' ); @@ -217,7 +266,7 @@ function set_site_options() { if ( false === $rtmedia_options ) { $this->init_site_options(); } else { - /* if new options added via filter then it needs to be updated */ + // if new options added via filter then it needs to be updated. $this->options = $rtmedia_options; } $this->add_image_sizes(); @@ -226,20 +275,22 @@ function set_site_options() { } /** - * add filter that is being given in the buddypress plugin which add the JS and CSS for autocomplete + * Add filter that is being given in the buddypress plugin which add the JS and CSS for autocomplete + * + * More details on: http://hookr.io/functions/bp_activity_maybe_load_mentions_scripts/ * - * More deatils on: http://hookr.io/functions/bp_activity_maybe_load_mentions_scripts/ + * @param bool $rtmedia_options RTMedia options. + * @param bool $bp_media_options BuddyPress media options. */ public function comment_auto_complete( $rtmedia_options = false, $bp_media_options = false ) { add_filter( 'bp_activity_maybe_load_mentions_scripts', array( $this, 'rtmedia_bp_activity_maybe_load_mentions_scripts_callback' ), 10001, 2 ); } - /** * Always set to true when call on any of the Buddypress Pages * - * @param bool $load_mentions - * @param bool $$mentions_enabled + * @param bool $load_mentions Load mentions script callback. + * @param bool $mentions_enabled Weather mentions enabled or not. * * @return bool true */ @@ -248,17 +299,31 @@ public function rtmedia_bp_activity_maybe_load_mentions_scripts_callback( $load_ return $load_mentions; } - + /** + * Function to set JPEG image quality. + */ public function set_image_quality() { add_filter( 'jpeg_quality', array( $this, 'rtmedia_jpeg_quality' ) ); } + /** + * Function to get JPEG image quality. + * + * @param int $quality Image quality. + * + * @return int + */ public function rtmedia_jpeg_quality( $quality ) { $quality = isset( $this->options['general_jpeg_image_quality'] ) ? $this->options['general_jpeg_image_quality'] : 90; return $quality; } + /** + * Get image sizes for different purposes. + * + * @return array + */ public function image_sizes() { $image_sizes = array(); $image_sizes['thumbnail'] = array( @@ -285,6 +350,9 @@ public function image_sizes() { return $image_sizes; } + /** + * Add different image sizes. + */ public function add_image_sizes() { $bp_media_sizes = $this->image_sizes(); add_image_size( 'rt_media_thumbnail', $bp_media_sizes['thumbnail']['width'], $bp_media_sizes['thumbnail']['height'], $bp_media_sizes['thumbnail']['crop'] ); @@ -294,7 +362,10 @@ public function add_image_sizes() { add_action( 'wp_head', array( &$this, 'custom_style_for_image_size' ) ); } - function custom_style_for_image_size() { + /** + * Add custom style for image size. + */ + public function custom_style_for_image_size() { if ( apply_filters( 'rtmedia_custom_image_style', true ) ) { ?> '; // @codingStandardsIgnoreLine - } - -} - -add_action( 'wp_head', 'rtmedia_custom_css' ); - /** * Update the group media privacy according to the group privacy settings when group settings are changed * - * @global wpdb $wpdb + * @param int $group_id Buddypress Group id. * - * @param int $group_id + * @global wpdb $wpdb */ function update_group_media_privacy( $group_id ) { if ( ! empty( $group_id ) && function_exists( 'groups_get_group' ) ) { - //get the buddybress group - $group = groups_get_group( array( - 'group_id' => $group_id, - ) ); + // get the buddybress group. + $group = groups_get_group( + array( + 'group_id' => $group_id, + ) + ); if ( isset( $group->status ) ) { global $wpdb; @@ -434,28 +417,27 @@ function update_group_media_privacy( $group_id ) { $model = new RTMediaModel(); if ( 'public' !== $group->status ) { - // when group settings are updated and is private/hidden, set media privacy to 20 - $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '20' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // @codingStandardsIgnoreLine + // when group settings are updated and is private/hidden, set media privacy to 20. + $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '20' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } else { - // when group settings are updated and is private/hidden, set media privacy to 0 - $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '0' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // @codingStandardsIgnoreLine + // when group settings are updated and is private/hidden, set media privacy to 0. + $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '0' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } - //update the medias - $wpdb->query( $update_sql ); // @codingStandardsIgnoreLine + // update the medias. + $wpdb->query( $update_sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } } } - add_action( 'groups_settings_updated', 'update_group_media_privacy', 99, 1 ); /** * Function for no-popup class for rtmedia media gallery * - * @param string $class + * @param string $class Class name. * - * @return string + * @return string */ function rtmedia_add_no_popup_class( $class = '' ) { @@ -466,9 +448,9 @@ function rtmedia_add_no_popup_class( $class = '' ) { /** * This function is used in RTMediaQuery.php file for show title filter * - * @param bool $flag + * @param bool $flag Flag to show media title. * - * @return bool + * @return bool */ function rtmedia_gallery_do_not_show_media_title( $flag ) { @@ -485,19 +467,18 @@ function rtmedia_remove_media_query_hooks_after_gallery() { remove_filter( 'rtmedia_media_gallery_show_media_title', 'rtmedia_gallery_do_not_show_media_title', 10, 1 ); } - add_action( 'rtmedia_after_media_gallery', 'rtmedia_remove_media_query_hooks_after_gallery' ); /** * Sanitize media file name before uploading * - * @param string $filename + * @param string $filename File name. * - * @return string + * @return string */ function sanitize_filename_before_upload( $filename ) { - $info = pathinfo( $filename ); + $info = pathinfo( $filename ); $ext = empty( $info['extension'] ) ? '' : '.' . $info['extension']; $name = basename( $filename, $ext ); $final_file_name = $name; @@ -518,13 +499,12 @@ function rtmedia_upload_sanitize_filename_before_upload() { add_action( 'sanitize_file_name', 'sanitize_filename_before_upload', 10, 1 ); } - add_action( 'rtmedia_upload_set_post_object', 'rtmedia_upload_sanitize_filename_before_upload', 10 ); /** * Admin pages content * - * @param string $page + * @param string $page Current page. */ function rtmedia_admin_pages_content( $page ) { @@ -545,7 +525,6 @@ function rtmedia_admin_pages_content( $page ) { } } - add_action( 'rtmedia_admin_page_insert', 'rtmedia_admin_pages_content', 99, 1 ); /** @@ -556,7 +535,6 @@ function rtmedia_add_media_delete_nonce() { wp_nonce_field( 'rtmedia_' . get_current_user_id(), 'rtmedia_media_delete_nonce' ); } - add_action( 'rtmedia_before_template_load', 'rtmedia_add_media_delete_nonce' ); /** @@ -565,7 +543,7 @@ function rtmedia_add_media_delete_nonce() { * * Adds delete nonce for gallery shortcode * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query */ function rtmedia_add_media_delete_nonce_shortcode() { @@ -578,43 +556,55 @@ function rtmedia_add_media_delete_nonce_shortcode() { } add_action( 'rtmedia_pre_template', 'rtmedia_add_media_delete_nonce_shortcode' ); -/** - * add function to display pagination on single media page with add_filter - * By: Yahil - */ - if ( ! function_exists( 'rtmedia_single_media_pagination' ) ) { + + /** + * Add function to display pagination on single media page with add_filter + * By: Yahil + */ function rtmedia_single_media_pagination() { + $disable = apply_filters( 'rtmedia_single_media_pagination', false ); + if ( true === $disable ) { return; } + if ( rtmedia_id() ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => rtmedia_id(), - ), 0, 1 ); - - if ( 'profile' == $media[0]->context ) { - $media = $model->get_media( array( - 'media_author' => $media[0]->media_author, - 'context' => $media[0]->context, - ) ); - } else if ( 'group' == $media[0]->context ) { - $media = $model->get_media( array( - 'media_author' => $media[0]->media_author, - 'context' => $media[0]->context, - 'context_id' => $media[0]->context_id, - ) ); + $media = $model->get_media( + array( + 'id' => rtmedia_id(), + ), + 0, + 1 + ); + + if ( 'profile' === $media[0]->context ) { + $media = $model->get_media( + array( + 'media_author' => $media[0]->media_author, + 'context' => $media[0]->context, + ) + ); + } elseif ( 'group' === $media[0]->context ) { + $media = $model->get_media( + array( + 'media_author' => $media[0]->media_author, + 'context' => $media[0]->context, + 'context_id' => $media[0]->context_id, + ) + ); } - for ( $i = 0; $i < count( $media ); $i++ ) { - if ( rtmedia_id() == $media[ $i ]->id ) { - if ( 0 != $i ) { + $total_media = count( $media ); + for ( $i = 0; $i < $total_media; $i++ ) { + if ( rtmedia_id() === $media[ $i ]->id ) { + if ( 0 !== $i ) { $previous = $media[ $i - 1 ]->id; } - if ( count( $media ) != $i + 1 ) { + if ( count( $media ) !== $i + 1 ) { $next = $media[ $i + 1 ]->id; } break; @@ -625,10 +615,10 @@ function rtmedia_single_media_pagination() { $html = ''; $pagination_label = array( - 'previous_title' => __( 'Previous', 'buddypress-media' ), - 'previous_label' => __( 'Previous', 'buddypress-media' ), - 'next_title' => __( 'Next', 'buddypress-media' ), - 'next_label' => __( 'Next', 'buddypress-media' ), + 'previous_title' => __( 'Previous', 'buddypress-media' ), + 'previous_label' => __( 'Previous', 'buddypress-media' ), + 'next_title' => __( 'Next', 'buddypress-media' ), + 'next_label' => __( 'Next', 'buddypress-media' ), ); $pagination_label = apply_filters( 'rtmedia_media_pagination_label', $pagination_label ); @@ -636,36 +626,46 @@ function rtmedia_single_media_pagination() { if ( isset( $previous ) && $previous ) { $html .= '
' . esc_html( $pagination_label['previous_label'] ) . '
'; } + if ( isset( $next ) && $next ) { $html .= '
' . esc_html( $pagination_label['next_label'] ) . '
'; } - echo $html; // @codingStandardsIgnoreLine + + echo wp_kses( $html, RTMedia::expanded_allowed_tags() ); } } /** - * @param $album_id + * Get album media count. * - * @return array + * @param int $album_id Album Id. + * + * @return array|int */ function rtm_get_album_media_count( $album_id ) { global $rtmedia_query; - $args = array(); + $args = array(); + $count = 0; + if ( isset( $album_id ) && $album_id ) { $args['album_id'] = $album_id; } + if ( isset( $rtmedia_query->query['context'] ) && $rtmedia_query->query['context'] ) { $args['context'] = $rtmedia_query->query['context']; } + if ( isset( $rtmedia_query->query['context_id'] ) && $rtmedia_query->query['context_id'] ) { $args['context_id'] = $rtmedia_query->query['context_id']; } $rtmedia_model = new RTMediaModel(); + if ( $args ) { $count = $rtmedia_model->get( $args, false, false, 'media_id desc', true ); } + return $count; } @@ -675,31 +675,28 @@ function rtm_get_album_media_count( $album_id ) { function rtm_album_media_count() { $rtmedia_album_count_status = array( - 'status' => true, - 'before_string' => '', - 'after_string' => '', + 'status' => true, + 'before_string' => '', + 'after_string' => '', ); /** - * rtmedia_string_album_count Filter to update album count status, add string before/after count. + * Function rtmedia_string_album_count Filter to update album count status, add string before/after count. * * @since 4.8 * * @param array $rtmedia_album_count_status status, before_string, after_string - * */ $rtmedia_album_count_status = apply_filters( 'rtmedia_string_album_count', $rtmedia_album_count_status ); if ( isset( $rtmedia_album_count_status ) && $rtmedia_album_count_status['status'] ) { ?>
-
+ + - success ) && isset( $addon_data->license ) ) { - if ( ( isset( $_POST[ 'edd_' . $addon_id . '_license_key' ] ) && '' == $_POST[ 'edd_' . $addon_id . '_license_key' ] ) || '' == $addon_data->success || 'invalid' == $addon_data->license ) { + + $activate_addon = sanitize_text_field( filter_input( INPUT_POST, 'edd_' . $addon_id . '_license_key', FILTER_SANITIZE_STRING ) ); + + if ( ( isset( $activate_addon ) && '' === $activate_addon ) || '' === $addon_data->success || 'invalid' === $addon_data->license ) { delete_option( 'edd_' . $addon_id . '_license_status' ); delete_option( 'edd_' . $addon_id . '_active' ); @@ -749,23 +749,23 @@ function rt_check_addon_status() { /** * Perform action before addon activation or license update * - * @since 4.2 + * @param array $addon Array containing the license_key, addon_id + * and addon name + * @param object|boolean $addon_active Detailed license data of the addon, or boolean + * false if data is not present * - * @param array $addon Array containing the license_key, addon_id - * and addon name - * @param object|boolean $addon_active Detailed license data of the addon, or boolean - * false if data is not present + * @since 4.2 */ do_action( 'rtmedia_before_addon_activate', $addon, $addon_active ); - if ( isset( $addon_active->expires ) && 'lifetime' != $addon_active->expires ) { + if ( isset( $addon_active->expires ) && 'lifetime' !== $addon_active->expires ) { $now = current_time( 'timestamp' ); $expiration = strtotime( $addon_active->expires, current_time( 'timestamp' ) ); - // For regularly check for license key is expired from store or not - // Check if last verification attempt is expired or not - // Will return false if it is expired - // It will check for every 6 hours + // For regularly check for license key is expired from store or not. + // Check if last verification attempt is expired or not. + // Will return false if it is expired. + // It will check for every 6 hours. if ( is_multisite() ) { $dont_check_verification = get_site_transient( 'check_rtmedia_license_verifiction_' . $addon_id ); } else { @@ -774,14 +774,14 @@ function rt_check_addon_status() { if ( $now > $expiration && ( false === $dont_check_verification ) ) { - // Get license key information from the store + // Get license key information from the store. $license_data = rtmedia_activate_addon_license( $addon ); if ( $license_data ) { - // Store the data in database + // Store the data in database. update_option( 'edd_' . $addon_id . '_active', $license_data ); } - // Once license status is checked from the store, then set the transient to check again + // Once license status is checked from the store, then set the transient to check again. if ( is_multisite() ) { set_site_transient( 'check_rtmedia_license_verifiction_' . $addon_id, $license_data, 6 * HOUR_IN_SECONDS ); } else { @@ -790,26 +790,25 @@ function rt_check_addon_status() { } } - // Listen for activate button to be clicked - - // Also check if information about the addon in already fetched from the store - // If it's already fetched, then don't send the request again for the information + $activate = sanitize_text_field( filter_input( INPUT_POST, 'edd_' . $addon_id . '_license_activate', FILTER_SANITIZE_STRING ) ); - if ( ! empty( $addon_active ) && ! isset( $_POST[ 'edd_' . $addon_id . '_license_activate' ] ) ) { + // Listen for activate button to be clicked. + // Also check if information about the addon in already fetched from the store. + // If it's already fetched, then don't send the request again for the information. + if ( ! empty( $addon_active ) && empty( $activate ) ) { continue; } - // Get license key information from the store + // Get license key information from the store. $license_data = rtmedia_activate_addon_license( $addon ); if ( $license_data ) { - // Store the data in database + // Store the data in database. update_option( 'edd_' . $addon_id . '_active', $license_data ); } - }// End if(). - }// End foreach(). + } // End if. + } // End foreach. } - add_action( 'admin_init', 'rt_check_addon_status' ); /** @@ -821,16 +820,16 @@ function rtmedia_addons_admin_notice() { if ( 'rtmedia_page_rtmedia-license' === $screen->id ) { - if ( isset( $_POST ) && count( $_POST ) > 0 ) { ?> - + if ( isset( $_POST ) && count( $_POST ) > 0 ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification + ?>
-

+

-

+

- activity->id, 'rtmedia_update', @@ -854,10 +854,10 @@ function rtmedia_activity_register_activity_actions_callback() { } add_action( 'bp_activity_register_activity_actions', 'rtmedia_activity_register_activity_actions_callback' ); - /** - * Search Media mockup - * @param array $attr + * Search Media mock-up + * + * @param array $attr Attributes array. * * @since 4.4 */ @@ -888,16 +888,20 @@ function add_search_filter( $attr = null ) { } // Do not show search box if playlist view is enabled. - if ( ! empty( $rtmedia->options['general_enable_music_playlist_view'] ) && 1 == $rtmedia->options['general_enable_music_playlist_view'] && 'music' === $media_type ) { + if ( ! empty( $rtmedia->options['general_enable_music_playlist_view'] ) && 1 === intval( $rtmedia->options['general_enable_music_playlist_view'] ) && 'music' === $media_type ) { return; } // Do not show search box if table view is enabled for documents. - if ( ! empty( $rtmedia->options['general_enable_document_other_table_view'] ) && 1 == $rtmedia->options['general_enable_document_other_table_view'] && 'document' === $media_type ) { + if ( ! empty( $rtmedia->options['general_enable_document_other_table_view'] ) && 1 === intval( $rtmedia->options['general_enable_document_other_table_view'] ) && 'document' === $media_type ) { return; } - $search_value = ( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); + $search_value = sanitize_text_field( wp_unslash( filter_input( INPUT_POST, 'search', FILTER_SANITIZE_STRING ) ) ); + + if ( empty( $search_by ) ) { + $search_value = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING ) ) ); + } $html = "'; @@ -97,15 +101,14 @@ function rtmedia_album_edit( $options ) { return $options; } - add_filter( 'rtmedia_gallery_actions', 'rtmedia_album_edit', 11 ); /** * Add activity type * - * @param array $actions + * @param array $actions Actions array. * - * @return array + * @return array */ function rtmedia_bp_activity_get_types( $actions ) { @@ -114,88 +117,102 @@ function rtmedia_bp_activity_get_types( $actions ) { return $actions; } - add_filter( 'bp_activity_get_types', 'rtmedia_bp_activity_get_types', 10, 1 ); /** * Checking if BuddyPress enable * - * @global RTMediaQuery $rtmedia_query - * - * @param bool $flag + * @param bool $flag Check if Buddypress enable or not. * - * @return bool + * @return bool + * @global RTMediaQuery $rtmedia_query */ function rtm_is_buddypress_enable( $flag ) { global $rtmedia_query; - if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] && is_rtmedia_group_media_enable() ) { - return $flag; - } else if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] && is_rtmedia_profile_media_enable() ) { + if ( ( + isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) + && 'group' === $rtmedia_query->query['context'] && is_rtmedia_group_media_enable() + ) || ( + isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) + && 'profile' === $rtmedia_query->query['context'] && is_rtmedia_profile_media_enable() + ) ) + { return $flag; } return false; } - add_filter( 'rtm_main_template_buddypress_enable', 'rtm_is_buddypress_enable', 10, 1 ); /** - * we need to use show title filter when there is a request for template from rtMedia.backbone.js + * We need to use show title filter when there is a request for template from rtMedia.backbone.js * - * @param bool $flag + * @param bool $flag Show title or not. * - * @return bool + * @return bool */ function rtmedia_media_gallery_show_title_template_request( $flag ) { + $media_title = sanitize_text_field( filter_input( INPUT_POST, 'media_title', FILTER_SANITIZE_STRING ) ); + + if ( empty( $media_title ) ) { + $media_title = sanitize_text_field( filter_input( INPUT_GET, 'media_title', FILTER_SANITIZE_STRING ) ); + } - if ( isset( $_REQUEST['media_title'] ) && 'false' === $_REQUEST['media_title'] ) { - return false; + if ( ! empty( $media_title ) && 'false' === $media_title ) { + $flag = false; } return $flag; } - add_filter( 'rtmedia_media_gallery_show_media_title', 'rtmedia_media_gallery_show_title_template_request', 10, 1 ); /** - * we need to use lightbox filter when there is a request for template from rtMedia.backbone.js + * We need to use lightbox filter when there is a request for template from rtMedia.backbone.js * - * @param string $class + * @param string $class Classes for media div. * - * @return string + * @return string */ function rtmedia_media_gallery_lightbox_template_request( $class ) { - if ( isset( $_REQUEST['lightbox'] ) && 'false' === $_REQUEST['lightbox'] ) { - return $class .= ' no-popup'; + $lightbox = sanitize_text_field( filter_input( INPUT_POST, 'lightbox', FILTER_SANITIZE_STRING ) ); + + if ( empty( $lightbox ) ) { + $lightbox = sanitize_text_field( filter_input( INPUT_GET, 'lightbox', FILTER_SANITIZE_STRING ) ); + } + + if ( ! empty( $lightbox ) && 'false' === $lightbox ) { + $class .= ' no-popup'; } return $class; } - add_filter( 'rtmedia_gallery_list_item_a_class', 'rtmedia_media_gallery_lightbox_template_request', 10, 1 ); /** * Fix for BuddyPress multilingual plugin on activity pages * - * @param array $params + * @param array $params Array parameters. * - * @return array + * @return array */ function rtmedia_modify_activity_upload_url( $params ) { - // return original params if BuddyPress multilingual plugin is not active - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); + // return original params if BuddyPress multilingual plugin is not active. + include_once ABSPATH . 'wp-admin/includes/plugin.php'; if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-multilingual/sitepress-bp.php' ) ) { + if ( class_exists( 'BuddyPress' ) ) { - // change upload url only if it's activity page and if it's group page than it shouldn't group media page + + // change upload url only if it's activity page and if it's group page than it shouldn't group media page. if ( bp_is_activity_component() || ( bp_is_groups_component() && ! is_rtmedia_page() ) ) { + if ( function_exists( 'bp_get_activity_directory_permalink' ) ) { $params['url'] = bp_get_activity_directory_permalink() . 'upload/'; } @@ -206,17 +223,15 @@ function rtmedia_modify_activity_upload_url( $params ) { return $params; } - add_filter( 'rtmedia_modify_upload_params', 'rtmedia_modify_activity_upload_url', 999, 1 ); /** * WordPress filter to change browser title if theme has title-tag support * - * @global RTMediaQuery $rtmedia_query + * @param array $title Title. * - * @param array $title - * - * @return array + * @return array + * @global RTMediaQuery $rtmedia_query */ function rtm_modify_document_title_parts( $title = array() ) { @@ -233,16 +248,15 @@ function rtm_modify_document_title_parts( $title = array() ) { return $title; } - add_filter( 'document_title_parts', 'rtm_modify_document_title_parts', 30, 1 ); /** * Replace original src with the transcoded media src * - * @param string $html - * @param object $rtmedia_media + * @param string $html HTML string. + * @param object $rtmedia_media RTMedia object. * - * @return string + * @return string */ function replace_src_with_transcoded_file_url( $html, $rtmedia_media ) { @@ -250,8 +264,8 @@ function replace_src_with_transcoded_file_url( $html, $rtmedia_media ) { return $html; } - $media_type = ''; - $attachment_id = $rtmedia_media->media_id; + $media_type = ''; + $attachment_id = $rtmedia_media->media_id; if ( 'video' === $rtmedia_media->media_type ) { $media_type = 'mp4'; @@ -261,10 +275,11 @@ function replace_src_with_transcoded_file_url( $html, $rtmedia_media ) { return $html; } - $medias = get_post_meta( $attachment_id, '_rt_media_transcoded_files', true ); + $medias = get_post_meta( $attachment_id, '_rt_media_transcoded_files', true ); + $file_url = rtt_is_video_exists( $medias, $media_type ); - if ( $file_url = rtt_is_video_exists( $medias, $media_type ) ) { - /* for WordPress backward compatibility */ + if ( ! empty( $file_url ) ) { + // for WordPress backward compatibility. if ( function_exists( 'wp_get_upload_dir' ) ) { $uploads = wp_get_upload_dir(); } else { @@ -282,29 +297,31 @@ function replace_src_with_transcoded_file_url( $html, $rtmedia_media ) { $final_file_url = wp_get_attachment_url( $attachment_id ); } - //Add timestamp to resolve conflict with cache media. + // Add timestamp to resolve conflict with cache media. return preg_replace( '/src=["]([^"]+)["]/', 'src="' . $final_file_url . '?' . time() . '"', $html ); } - add_filter( 'rtmedia_single_content_filter', 'replace_src_with_transcoded_file_url', 100, 2 ); /** - * Replace aws url of image with the wordpress attachment url in buddypress activity - * @param string $html - * @param object $rtmedia_media + * Replace aws url of image with the WordPress attachment url in buddypress activity + * + * @param string $html HTML string. + * @param object $rtmedia_media RTMedia object. * * @return string */ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) { + if ( empty( $rtmedia_media ) ) { return $html; } + /** - * Allow users/plugins to prevent replacing of URL from activty + * Allow users/plugins to prevent replacing of URL from activity * - * @var boolean Boolean false is passed as a parameter. - * @var object $rtmedia_media Object of rtmedia containing media_id, media_type etc. + * @var boolean Boolean false is passed as a parameter. + * @var object $rtmedia_media Object of rtmedia containing media_id, media_type etc. */ if ( apply_filters( 'replace_aws_img_urls_from_activity', false, $rtmedia_media ) ) { return $html; @@ -314,7 +331,7 @@ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) { return $html; } - $media_type = $rtmedia_media->media_type; + $media_type = $rtmedia_media->media_type; if ( 'image' === $media_type && ! empty( $rtmedia_media->guid ) ) { /** @@ -323,7 +340,7 @@ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) { * original WordPress URL structure */ if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) { - /* for WordPress backward compatibility */ + // for WordPress backward compatibility. if ( function_exists( 'wp_get_upload_dir' ) ) { $uploads = wp_get_upload_dir(); } else { @@ -338,7 +355,7 @@ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) { $rtmedia_folder_name = apply_filters( 'rtmedia_upload_folder_name', 'rtMedia' ); - $thumbnail_url = explode( $rtmedia_folder_name , $rtmedia_media->guid ); + $thumbnail_url = explode( $rtmedia_folder_name, $rtmedia_media->guid ); if ( is_array( $thumbnail_url ) && ! empty( $thumbnail_url[1] ) ) { $thumbnail_url = $baseurl . '/' . $rtmedia_folder_name . '/' . ltrim( $thumbnail_url[1], '/' ); @@ -351,10 +368,9 @@ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) { $html = preg_replace( '/src=["]([^"]+)["]/', "src=\"$thumbnail_url\"", $html ); } } - }// End if(). + } // End if. return $html; } - add_filter( 'rtmedia_single_content_filter', 'replace_aws_img_urls_from_activity', 100, 2 ); /** @@ -362,12 +378,11 @@ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) { * When rtAmazon S3 is disabled we need to restore/replace the attachment URLS with the * original WordPress URL structure * - * @since 1.0.1 - * - * @param string $content HTML contents of the activity - * @param object $activity Activity object + * @param string $content HTML contents of the activity. + * @param object|string $activity Activity object. * * @return string + * @since 1.0.1 */ function replace_aws_img_urls_from_activities( $content, $activity = '' ) { @@ -378,8 +393,8 @@ function replace_aws_img_urls_from_activities( $content, $activity = '' ) { /** * Allow users/plugins to prevent replacing of URL from activty * - * @var boolean Boolean false is passed as a parameter. - * @var object $activity Object of activity. + * @var boolean Boolean false is passed as a parameter. + * @var object $activity Object of activity. */ if ( apply_filters( 'replace_aws_img_urls_from_activities', false, $activity ) ) { return $content; @@ -388,20 +403,22 @@ function replace_aws_img_urls_from_activities( $content, $activity = '' ) { $rt_model = new RTMediaModel(); $all_media = $rt_model->get( array( 'activity_id' => $activity->id ) ); - $is_img = false; - $url = ''; - $is_img = strpos( $content , ' $url ) { + if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) { - /* for WordPress backward compatibility */ + + // for WordPress backward compatibility. if ( function_exists( 'wp_get_upload_dir' ) ) { $uploads = wp_get_upload_dir(); } else { @@ -415,7 +432,7 @@ function replace_aws_img_urls_from_activities( $content, $activity = '' ) { } else { $rtmedia_folder_name = apply_filters( 'rtmedia_upload_folder_name', 'rtMedia' ); - $thumbnail_url = explode( $rtmedia_folder_name , $url ); + $thumbnail_url = explode( $rtmedia_folder_name, $url ); if ( is_array( $thumbnail_url ) && ! empty( $thumbnail_url[1] ) ) { $thumbnail_url = $baseurl . '/' . $rtmedia_folder_name . '/' . ltrim( $thumbnail_url[1], '/' ); @@ -433,19 +450,17 @@ function replace_aws_img_urls_from_activities( $content, $activity = '' ) { */ $attachment_id = md5( $url ); if ( ! empty( $all_media ) && ! empty( $all_media[0]->media_id ) ) { - $attachment_id = $all_media[0]->media_id; + $attachment_id = $all_media[0]->media_id; } $image_url = apply_filters( 'rtmedia_filtered_photo_url', $url, $attachment_id ); - $content = str_replace( $url, $image_url, $content ); - }// End if(). - }// End foreach(). - }// End if(). + $content = str_replace( $url, $image_url, $content ); + } // End if. + } // End foreach. + } // End if. return $content; } - add_filter( 'bp_get_activity_content_body', 'replace_aws_img_urls_from_activities', 99, 2 ); - /** * Gives the WordPress's default attachment URL if the base URL of the attachment is * different than the WordPress's default base URL. e.g following URL @@ -453,11 +468,11 @@ function replace_aws_img_urls_from_activities( $content, $activity = '' ) { * will get replaced with * http://www.wordpress-base.url/wp-content/uploads/2016/09/1473432502-small-10-1-16_1.jpg * - * @param int $thumbnail_id It can be attachment URL or attachment ID - * @param string $media_type Media type - * @param int $media_id Attachment ID + * @param int $thumbnail_id It can be attachment URL or attachment ID. + * @param string $media_type Media type. + * @param int $media_id Attachment ID. * - * @return string Attachment URL if attachment URL is provided in the argument + * @return string Attachment URL if attachment URL is provided in the argument */ function rtt_restore_og_wp_image_url( $thumbnail_id, $media_type, $media_id ) { @@ -468,8 +483,8 @@ function rtt_restore_og_wp_image_url( $thumbnail_id, $media_type, $media_id ) { /** * Allow users/plugins to prevent replacing of URL of album cover * - * @var boolean Boolean false is passed as a parameter. - * @var string $media_type Type of the media. + * @var boolean Boolean false is passed as a parameter. + * @var string $media_type Type of the media. */ if ( apply_filters( 'rtt_restore_og_wp_image_url', false, $media_type ) ) { return $thumbnail_id; @@ -481,22 +496,19 @@ function rtt_restore_og_wp_image_url( $thumbnail_id, $media_type, $media_id ) { * original WordPress URL structure */ if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) { - /* for WordPress backward compatibility */ + // for WordPress backward compatibility. if ( function_exists( 'wp_get_upload_dir' ) ) { $uploads = wp_get_upload_dir(); } else { $uploads = wp_upload_dir(); } - if ( 0 === strpos( $thumbnail_id, $uploads['baseurl'] ) ) { - /* URL is clean here */ - /* Apply any filter here if its required */ - } else { + if ( 0 !== strpos( $thumbnail_id, $uploads['baseurl'] ) ) { $baseurl = $uploads['baseurl']; $rtmedia_folder_name = apply_filters( 'rtmedia_upload_folder_name', 'rtMedia' ); - $thumbnail_url = explode( $rtmedia_folder_name , $thumbnail_id ); + $thumbnail_url = explode( $rtmedia_folder_name, $thumbnail_id ); if ( is_array( $thumbnail_url ) && ! empty( $thumbnail_url[1] ) ) { $thumbnail_url = $baseurl . '/' . $rtmedia_folder_name . '/' . ltrim( $thumbnail_url[1], '/' ); } else { @@ -517,20 +529,21 @@ function rtt_restore_og_wp_image_url( $thumbnail_id, $media_type, $media_id ) { return $final_file_url; } - add_filter( 'show_custom_album_cover', 'rtt_restore_og_wp_image_url', 100, 3 ); /** * Function to edit comment link for media * - * @param string $link Media comment link - * @param object $comment comment data + * @param string $link Media comment link. + * @param object $comment comment data. * * @return string $link media comment link */ function rt_get_comment_link_callback( $link, $comment ) { + $rtmedia_media_id = rtmedia_id( $comment->comment_post_ID ); - if ( get_post_type( $comment->comment_post_ID ) == 'attachment' && is_admin() && ! empty( $rtmedia_media_id ) ) { + + if ( get_post_type( $comment->comment_post_ID ) === 'attachment' && is_admin() && ! empty( $rtmedia_media_id ) ) { $link = esc_url( get_rtmedia_permalink( $rtmedia_media_id ) ) . '#rtmedia_comment_ul'; } return $link; @@ -540,74 +553,85 @@ function rt_get_comment_link_callback( $link, $comment ) { /** * Function to edit attachment for media * - * @param string $permalink attachment permalink - * @param array $post_id return attachment post id + * @param string $permalink attachment permalink. + * @param array $post_id return attachment post id. * * @return string attachment post permalink */ function rtmedia_attachment_link_callback( $permalink, $post_id ) { $rtmedia_media_id = rtmedia_id( $post_id ); + if ( is_admin() && ! empty( $rtmedia_media_id ) ) { $permalink = esc_url( get_rtmedia_permalink( rtmedia_id( $post_id ) ) ) . '#rtmedia_comment_ul'; } + return $permalink; } - -add_filter( 'attachment_link', 'rtmedia_attachment_link_callback', 99,2 ); +add_filter( 'attachment_link', 'rtmedia_attachment_link_callback', 99, 2 ); /** * [rtmedia_edit_media_on_database] * Update Media details on database while admin edit reported media - * @param [Array] $data Image Details - * @param [Number] $post_ID Media ID - * @return [array] $data + * + * @param array $data Image Details. + * @param int $post_ID Media ID. + * + * @return array $data */ function rtmedia_edit_media_on_database( $data, $post_ID ) { $post = get_post( $post_ID ); - if ( $_REQUEST ) { + $postid = filter_input( INPUT_POST, 'postid', FILTER_VALIDATE_INT ); + $action = sanitize_text_field( filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) ); + $context = sanitize_text_field( filter_input( INPUT_POST, 'context', FILTER_SANITIZE_STRING ) ); + + // @todo need to check why 'context' key is not set in POST when user clicks on scale button on edit image. + if ( ! empty( $postid ) && 'image-editor' === $action && ! empty( $context ) && 'edit-attachment' === $context ) { - // @todo need to check why 'context' key is not set in $_REQUEST when user clicks on scale button on edit image. - if ( isset( $_REQUEST['postid'] ) && 'image-editor' == $_REQUEST['action'] && ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) { + $media = new RTMediaModel(); + $media_available = $media->get_media( + array( + 'media_id' => $postid, + ), + 0, + 1 + ); - $media = new RTMediaModel(); - $media_available = $media->get_media( array( - 'media_id' => $_REQUEST['postid'], - ), 0, 1 ); + $media_id = $media_available[0]->id; - $media_id = $media_available[0]->id; + if ( ! empty( $media_available ) ) { + $rtmedia_filepath_old = rtmedia_image( 'rt_media_activity_image', $media_id, false ); - if ( ! empty( $media_available ) ) { - $rtmedia_filepath_old = rtmedia_image( 'rt_media_activity_image', $media_id, false ); + if ( isset( $rtmedia_filepath_old ) ) { + $is_valid_url = preg_match( "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $rtmedia_filepath_old ); - if ( isset( $rtmedia_filepath_old ) ) { - $is_valid_url = preg_match( "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $rtmedia_filepath_old ); + if ( $is_valid_url && function_exists( 'bp_is_active' ) && bp_is_active( 'activity' ) ) { + $thumbnailinfo = wp_get_attachment_image_src( $post_ID, 'rt_media_activity_image' ); + $activity_id = rtmedia_activity_id( $media_id ); - if ( $is_valid_url && function_exists( 'bp_is_active' ) && bp_is_active( 'activity' ) ) { - $thumbnailinfo = wp_get_attachment_image_src( $post_ID, 'rt_media_activity_image' ); - $activity_id = rtmedia_activity_id( $media_id ); + if ( $post_ID && ! empty( $activity_id ) ) { + global $wpdb, $bp; - if ( $post_ID && ! empty( $activity_id ) ) { - global $wpdb, $bp; + if ( ! empty( $bp->activity ) ) { - if ( ! empty( $bp->activity ) ) { - $media->model = new RTMediaModel(); - $related_media_data = $media->model->get( array( 'activity_id' => $activity_id ) ); - $related_media = array(); - foreach ( $related_media_data as $activity_media ) { - $related_media[] = $activity_media->id; - } - $activity_text = bp_activity_get_meta( $activity_id, 'bp_activity_text' ); + $media->model = new RTMediaModel(); + $related_media_data = $media->model->get( array( 'activity_id' => $activity_id ) ); + $related_media = array(); - $activity = new RTMediaActivity( $related_media, 0, $activity_text ); + foreach ( $related_media_data as $activity_media ) { + $related_media[] = $activity_media->id; + } - $activity_content_new = $activity->create_activity_html(); + $activity_text = bp_activity_get_meta( $activity_id, 'bp_activity_text' ); - $activity_content = str_replace( $rtmedia_filepath_old, wp_get_attachment_url( $post_ID ), $activity_content_new ); + $activity = new RTMediaActivity( $related_media, 0, $activity_text ); - $wpdb->update( $bp->activity->table_name, array( 'content' => $activity_content ), array( 'id' => $activity_id ) ); - } + $activity_content_new = $activity->create_activity_html(); + + $activity_content = str_replace( $rtmedia_filepath_old, wp_get_attachment_url( $post_ID ), $activity_content_new ); + + $wpdb->update( $bp->activity->table_name, array( 'content' => $activity_content ), array( 'id' => $activity_id ) ); } } } @@ -619,17 +643,23 @@ function rtmedia_edit_media_on_database( $data, $post_ID ) { } add_filter( 'wp_update_attachment_metadata', 'rtmedia_edit_media_on_database', 10, 2 ); - -/** - * Disallow media edit for comment media - */ if ( ! function_exists( 'rtmedia_media_edit_priv_callback' ) ) { + + /** + * Disallow media edit for comment media + * + * @param bool $value If mmedia edit is allowed or not. + * + * @return bool + */ function rtmedia_media_edit_priv_callback( $value ) { - // comment media - $rtmedia_id = rtmedia_id(); + // comment media. + $rtmedia_id = rtmedia_id(); $comment_media = false; + if ( ! empty( $rtmedia_id ) && function_exists( 'rtmedia_is_comment_media' ) && ! empty( $value ) ) { $comment_media = rtmedia_is_comment_media( $rtmedia_id ); + if ( ! empty( $comment_media ) ) { $value = false; } @@ -639,17 +669,23 @@ function rtmedia_media_edit_priv_callback( $value ) { } add_filter( 'rtmedia_media_edit_priv', 'rtmedia_media_edit_priv_callback', 10, 1 ); - -/** - * Disallow media author action - */ if ( ! function_exists( 'rtmedia_author_actions_callback' ) ) { + + /** + * Disallow media author action + * + * @param string $value Comment value. + * + * @return bool + */ function rtmedia_author_actions_callback( $value ) { - // comment media - $rtmedia_id = rtmedia_id(); + // comment media. + $rtmedia_id = rtmedia_id(); $comment_media = false; + if ( ! empty( $rtmedia_id ) && function_exists( 'rtmedia_is_comment_media' ) && ! empty( $value ) ) { $comment_media = rtmedia_is_comment_media( $rtmedia_id ); + if ( ! empty( $comment_media ) ) { $value = false; } @@ -659,11 +695,18 @@ function rtmedia_author_actions_callback( $value ) { } add_filter( 'rtmedia_author_actions', 'rtmedia_author_actions_callback', 10, 1 ); - +/** + * MMultiple like on media show. + * + * @param int $like_count Total likes. + * @param true $user_like_it Current user liked it or not. + * + * @return string + */ function rtmedia_like_html_you_and_more_like_callback( $like_count, $user_like_it ) { if ( $like_count > 1 && $user_like_it ) { - /* if login user has like the comment then less from the total count */ - $like_count --; + // if login user has like the comment then less from the total count. + $like_count--; } return sprintf( '%s', $like_count ); } @@ -671,17 +714,21 @@ function rtmedia_like_html_you_and_more_like_callback( $like_count, $user_like_i /** * Update where query for media search - * @param string $where - * @param string $table_name - * @param string $join + * + * @param string $where Where condition query string. + * @param string $table_name Table name. + * @param string $join Join query string. + * * @return string */ function rtmedia_search_fillter_where_query( $where, $table_name, $join ) { + if ( function_exists( 'rtmedia_media_search_enabled' ) && rtmedia_media_search_enabled() ) { - $search = ( isset( $_REQUEST['search'] ) ) ? sanitize_text_field( urldecode( wp_unslash( $_REQUEST['search'] ) ) ) : ''; - $search_by = ( isset( $_REQUEST['search_by'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['search_by'] ) ) : ''; - $media_type = ( isset( $_REQUEST['media_type'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['media_type'] ) ) : ''; - $rtmedia_current_album = ( isset( $_REQUEST['rtmedia-current-album'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['rtmedia-current-album'] ) ) : ''; + + $search = sanitize_text_field( urldecode( wp_unslash( filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING ) ) ) ); + $search_by = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'search_by', FILTER_SANITIZE_STRING ) ) ); + $media_type = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'media_type', FILTER_SANITIZE_STRING ) ) ); + $rtmedia_current_album = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'rtmedia-current-album', FILTER_SANITIZE_STRING ) ) ); if ( '' !== $search ) { $author_id = rtm_select_user( $search ); @@ -709,16 +756,17 @@ function rtmedia_search_fillter_where_query( $where, $table_name, $join ) { } elseif ( 'author' === $search_by ) { if ( ! empty( $author_id ) ) { - $where .= " $table_name.media_author IN (" . $author_id . ") "; + $where .= " $table_name.media_author IN (" . $author_id . ') '; } } elseif ( 'member_type' === $search_by ) { if ( ! empty( $member_type ) ) { - $where .= " $table_name.media_author IN (" . $member_type . ") "; + $where .= " $table_name.media_author IN (" . $member_type . ') '; } } else { $where .= '2=2'; } } else { + if ( ! empty( $rtmedia_current_album ) ) { $where .= " $table_name.album_id = '" . $rtmedia_current_album . "' AND "; } @@ -729,10 +777,10 @@ function rtmedia_search_fillter_where_query( $where, $table_name, $join ) { $where .= ' ( '; $where .= " $table_name.media_title LIKE '%" . $search . "%' "; if ( ! empty( $author_id ) ) { - $where .= " OR $table_name.media_author IN (" . $author_id . ") "; + $where .= " OR $table_name.media_author IN (" . $author_id . ') '; } if ( ! empty( $member_type ) ) { - $where .= " OR $table_name.media_author IN (" . $member_type . ") "; + $where .= " OR $table_name.media_author IN (" . $member_type . ') '; } $where .= " OR post_table.post_content LIKE '%" . $search . "%'"; @@ -741,7 +789,7 @@ function rtmedia_search_fillter_where_query( $where, $table_name, $join ) { } $where .= ' ) '; - } // End if(). + } // End if. } else { // Reset data for album's media. @@ -753,29 +801,32 @@ function rtmedia_search_fillter_where_query( $where, $table_name, $join ) { if ( ! empty( $media_type ) && empty( $rtmedia_current_album ) ) { $where .= " AND $table_name.media_type = '" . $media_type . "' "; } - } // End if(). - } // End if(). - + } // End if. + } // End if. + return $where; } - add_filter( 'rtmedia-model-where-query', 'rtmedia_search_fillter_where_query', 10, 3 ); /** * Update join query for media search - * @param string $join - * @param string $table_name + * + * @param string $join Join query string. + * @param string $table_name Table name. + * * @return string */ function rtmedia_search_fillter_join_query( $join, $table_name ) { + if ( function_exists( 'rtmedia_media_search_enabled' ) && rtmedia_media_search_enabled() ) { + global $wpdb; $posts_table = $wpdb->posts; $terms_table = $wpdb->terms; $term_relationships_table = $wpdb->term_relationships; $term_taxonomy_table = $wpdb->term_taxonomy; - $search = ( isset( $_REQUEST['search'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['search'] ) ) : ''; - $search_by = ( isset( $_REQUEST['search_by'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['search_by'] ) ) : ''; + $search = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING ) ) ); + $search_by = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'search_by', FILTER_SANITIZE_STRING ) ) ); if ( '' !== $search ) { $join .= "INNER JOIN $posts_table as post_table ON ( post_table.ID = $table_name.media_id AND post_table.post_type = 'attachment')"; @@ -792,17 +843,19 @@ function rtmedia_search_fillter_join_query( $join, $table_name ) { } return $join; } - add_filter( 'rtmedia-model-join-query', 'rtmedia_search_fillter_join_query', 11, 2 ); /** * Update media type for media search - * @param array $columns + * + * @param array $columns Query columns. + * * @return array */ function rtmedia_model_query_columns( $columns ) { - $search = ( isset( $_REQUEST['search'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['search'] ) ) : ''; - $search_by = ( isset( $_REQUEST['search_by'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['search_by'] ) ) : ''; + $search = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'search', FILTER_SANITIZE_STRING ) ) ); + $search_by = sanitize_text_field( wp_unslash( filter_input( INPUT_GET, 'search_by', FILTER_SANITIZE_STRING ) ) ); + if ( ! empty( $search ) ) { if ( ! empty( $search_by ) && 'media_type' === $search_by ) { if ( isset( $columns['media_type']['value'] ) && is_array( $columns['media_type']['value'] ) ) { @@ -813,24 +866,36 @@ function rtmedia_model_query_columns( $columns ) { return $columns; } - add_filter( 'rtmedia-model-query-columns', 'rtmedia_model_query_columns', 10, 1 ); /** - * add link for @mentions of the username in the comment or the activity section after the media delete or media is trancoder + * Add link for @mentions of the username in the comment or the activity section after the media delete or media is trancoder + * + * @param string $retval Meta Value. + * @param int $activity_id activity id. + * @param string $meta_key Meta key. + * @param bool $single Single value or not. + * + * @return mixed */ function rtmedia_bp_activity_get_meta_callback( $retval, $activity_id, $meta_key, $single ) { $new_retval = $retval; - if ( 'bp_activity_text' == $meta_key && true == $single && function_exists( 'bp_activity_at_name_filter' ) ) { + if ( 'bp_activity_text' === $meta_key && true === $single && function_exists( 'bp_activity_at_name_filter' ) ) { $new_retval = bp_activity_at_name_filter( $new_retval ); } return $new_retval; } add_filter( 'bp_activity_get_meta', 'rtmedia_bp_activity_get_meta_callback', 10, 4 ); - -// remove unwanted attr of sorting when rtmedia-sorting addon is not there if ( ! function_exists( 'rtmedia_gallery_shortcode_parameter_pre_filter_callback' ) ) { + + /** + * Remove unwanted attr of sorting when rtmedia-sorting addon is not there + * + * @param array $attr Attributes array. + * + * @return mixed + */ function rtmedia_gallery_shortcode_parameter_pre_filter_callback( $attr ) { $new_attr = $attr; if ( ! class_exists( 'RTMediaSorting' ) && isset( $attr['attr'] ) && isset( $attr['attr']['sort_parameters'] ) ) { @@ -841,11 +906,11 @@ function rtmedia_gallery_shortcode_parameter_pre_filter_callback( $attr ) { } add_filter( 'rtmedia_gallery_shortcode_parameter_pre_filter', 'rtmedia_gallery_shortcode_parameter_pre_filter_callback', 10, 1 ); - /** * Add exporters to queue * - * @param array $exporters Exporter queue. + * @param array $exporters Exporter queue. + * * @return array */ function register_rtmedia_exporter( $exporters ) { @@ -872,37 +937,32 @@ function register_rtmedia_exporter( $exporters ) { return $exporters; } - -add_filter( - 'wp_privacy_personal_data_exporters', - 'register_rtmedia_exporter', - 10 -); +add_filter( 'wp_privacy_personal_data_exporters', 'register_rtmedia_exporter', 10 ); /** * Add eraser to queue * * @param array $erasers Exporter queue. + * * @return array */ function register_rtmedia_eraser( $erasers ) { - $erasers['buddypress-media'] = array( + + $erasers['buddypress-media'] = array( 'eraser_friendly_name' => esc_html__( 'rtMedia Eraser', 'buddypress-media' ), 'callback' => 'rtmedia_eraser', ); + $erasers['buddypress-media-likes'] = array( 'eraser_friendly_name' => esc_html__( 'rtMedia Likes Eraser', 'buddypress-media' ), 'callback' => 'rtmedia_like_eraser', ); + $erasers['buddypress-media-album'] = array( 'eraser_friendly_name' => esc_html__( 'rtMedia Album Eraser', 'buddypress-media' ), 'callback' => 'rtmedia_album_eraser', ); + return $erasers; } - -add_filter( - 'wp_privacy_personal_data_erasers', - 'register_rtmedia_eraser', - 10 -); +add_filter( 'wp_privacy_personal_data_erasers', 'register_rtmedia_eraser', 10 ); diff --git a/app/main/controllers/template/rtmedia-functions.php b/app/main/controllers/template/rtmedia-functions.php index ec7a8e486..e3b0a1fde 100644 --- a/app/main/controllers/template/rtmedia-functions.php +++ b/app/main/controllers/template/rtmedia-functions.php @@ -1,11 +1,16 @@ get( array( - 'id' => $id, - ) ); + $title = $rtmedia_model->get( + array( + 'id' => $id, + ) + ); return $title[0]->media_title; @@ -164,14 +171,14 @@ function get_rtmedia_title( $id ) { /** * Media author's profile pic * - * @global array $rtmedia_backbone - * @global object $rtmedia_media + * @global array $rtmedia_backbone + * @global object $rtmedia_media * - * @param bool $show_link - * @param bool $echo - * @param bool $author_id + * @param bool $show_link Show link or only picture. + * @param bool $echo Echo or return html. + * @param bool|int $author_id Author id. * - * @return string + * @return string */ function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id = false ) { @@ -196,21 +203,25 @@ function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id $size = apply_filters( 'rtmedia_single_media_profile_picture_size', 90 ); if ( function_exists( 'bp_get_user_has_avatar' ) ) { - if ( bp_core_fetch_avatar( array( + if ( bp_core_fetch_avatar( + array( 'item_id' => $author_id, 'object' => 'user', 'no_grav' => false, 'html' => false, - ) ) !== bp_core_avatar_default() + ) + ) !== bp_core_avatar_default() ) { - $profile_pic .= bp_core_fetch_avatar( array( - 'item_id' => $author_id, - 'object' => 'user', - 'no_grav' => false, - 'html' => true, - 'width' => $size, - 'height' => $size, - ) ); + $profile_pic .= bp_core_fetch_avatar( + array( + 'item_id' => $author_id, + 'object' => 'user', + 'no_grav' => false, + 'html' => true, + 'width' => $size, + 'height' => $size, + ) + ); } else { $profile_pic .= ""; } @@ -223,21 +234,21 @@ function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id } if ( $echo ) { - echo $profile_pic; // @codingStandardsIgnoreLine + echo wp_kses( $profile_pic, RTMedia::expanded_allowed_tags() ); } else { return $profile_pic; } - }// End if(). + } // End if. } /** * Media's author link * - * @global array $rtmedia_backbone - * @global object $rtmedia_media + * @global object $rtmedia_media + * @global array $rtmedia_backbone * - * @param bool $show_link + * @param bool $show_link Show link or only show name. */ function rtmedia_author_name( $show_link = true ) { @@ -266,11 +277,12 @@ function rtmedia_author_name( $show_link = true ) { /** * Get media author name using user ID * - * @param $user_id + * @param int $user_id User id to get author name. * - * @return string + * @return string */ function rtmedia_get_author_name( $user_id ) { + if ( function_exists( 'bp_core_get_user_displayname' ) ) { return bp_core_get_user_displayname( $user_id ); } else { @@ -286,7 +298,7 @@ function rtmedia_get_author_name( $user_id ) { /** * Media Gallery CSS classes * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query */ function rtmedia_media_gallery_class() { @@ -304,12 +316,12 @@ function rtmedia_media_gallery_class() { /** * Get RTMedia ID using Post(Media) ID * - * @global array $rtmedia_backbone - * @global object $rtmedia_media + * @global array $rtmedia_backbone + * @global object $rtmedia_media * - * @param bool|int $media_id + * @param bool|int $media_id Media id. * - * @return bool|string + * @return bool|string */ function rtmedia_id( $media_id = false ) { @@ -321,9 +333,13 @@ function rtmedia_id( $media_id = false ) { if ( $media_id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'media_id' => $media_id, - ), 0, 1 ); + $media = $model->get_media( + array( + 'media_id' => $media_id, + ), + 0, + 1 + ); if ( isset( $media ) && count( $media ) > 0 ) { return $media[0]->id; @@ -341,11 +357,11 @@ function rtmedia_id( $media_id = false ) { /** * Get Post(Media) ID using RTMedia ID * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $id + * @param bool|int $id Media id. * - * @return int + * @return int */ function rtmedia_media_id( $id = false ) { global $rtmedia_media; @@ -353,9 +369,13 @@ function rtmedia_media_id( $id = false ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), 0, 1 ); + $media = $model->get_media( + array( + 'id' => $id, + ), + 0, + 1 + ); // update code to fix GL-21-rtmoderation. if ( ! empty( $media ) && ! empty( $media[0] ) ) { @@ -372,19 +392,23 @@ function rtmedia_media_id( $id = false ) { /** * Get Media extension using ID * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $id + * @param bool|int $id Media id to get extension. * - * @return string + * @return string */ function rtmedia_media_ext( $id = false ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), 0, 1 ); + $media = $model->get_media( + array( + 'id' => $id, + ), + 0, + 1 + ); if ( isset( $media[0] ) ) { $filepath = get_attached_file( $media[0]->media_id ); @@ -406,19 +430,23 @@ function rtmedia_media_ext( $id = false ) { /** * Get Activity ID using Media ID * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $id + * @param bool|int $id Media id to get activity. * - * @return int + * @return int */ function rtmedia_activity_id( $id = false ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), 0, 1 ); + $media = $model->get_media( + array( + 'id' => $id, + ), + 0, + 1 + ); return $media[0]->activity_id; } else { @@ -432,19 +460,23 @@ function rtmedia_activity_id( $id = false ) { /** * Get Media type using Media ID * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $id + * @param bool|int $id Media id to get type. * - * @return bool|string + * @return bool|string */ function rtmedia_type( $id = false ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), 0, 1 ); + $media = $model->get_media( + array( + 'id' => $id, + ), + 0, + 1 + ); if ( isset( $media[0] ) && isset( $media[0]->media_type ) ) { return $media[0]->media_type; @@ -466,19 +498,23 @@ function rtmedia_type( $id = false ) { /** * Get cover art using Media ID * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $id + * @param bool|int $id Media id to get cover. * - * @return string + * @return string */ function rtmedia_cover_art( $id = false ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), 0, 1 ); + $media = $model->get_media( + array( + 'id' => $id, + ), + 0, + 1 + ); return $media[0]->cover_art; } else { @@ -490,11 +526,11 @@ function rtmedia_cover_art( $id = false ) { } /** - * echo parmalink of the media + * Echo permalink of the media * - * @global array $rtmedia_backbone + * @global array $rtmedia_backbone * - * @param bool|int $media_id + * @param bool|int $media_id Media id. */ function rtmedia_permalink( $media_id = false ) { @@ -509,9 +545,9 @@ function rtmedia_permalink( $media_id = false ) { } /** - * echo parmalink of the album + * Echo permalink of the album * - * @global object $rtmedia_media + * @global object $rtmedia_media */ function rtmedia_album_permalink() { @@ -524,14 +560,14 @@ function rtmedia_album_permalink() { /** * Get media * - * @global object $rtmedia_media - * @global RTMedia $rtmedia + * @global object $rtmedia_media + * @global RTMedia $rtmedia * - * @param bool $size_flag - * @param bool $echo - * @param string $media_size + * @param bool $size_flag Size flag. + * @param bool $echo Echo html or return html string. + * @param string $media_size Media size to get. * - * @return bool|string + * @return bool|string */ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media_single_image' ) { @@ -540,34 +576,45 @@ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media global $rtmedia_media, $rtmedia; if ( isset( $rtmedia_media->media_type ) ) { + if ( 'photo' === $rtmedia_media->media_type ) { - $src = wp_get_attachment_image_src( $rtmedia_media->media_id, $media_size ); + + $src = wp_get_attachment_image_src( $rtmedia_media->media_id, $media_size ); /** * Used `set_url_scheme` because `esc_url` breaks the image if there is special characters are there into image name. * Added by checking the code from "wp-admin/includes/media.php:2740". * Because in media library, it was not breaking. - * + * * Add timestamp to resolve conflict with cache image. */ - $html = "" . esc_attr( $rtmedia_media->post_name ) . ""; + $html = "" . esc_attr( $rtmedia_media->post_name ) . ""; } elseif ( 'video' === $rtmedia_media->media_type ) { + $youtube_url = get_rtmedia_meta( $rtmedia_media->id, 'video_url_uploaded_from' ); - $height = $rtmedia->options['defaultSizes_video_singlePlayer_height']; - $height = ( $height * 75 ) / 640; - $size = ' width="' . esc_attr( $rtmedia->options['defaultSizes_video_singlePlayer_width'] ) . '" height="' . esc_attr( $height ) . '%" '; - $html = "
"; + $height = $rtmedia->options['defaultSizes_video_singlePlayer_height']; + $height = ( $height * 75 ) / 640; + $size = ' width="' . esc_attr( $rtmedia->options['defaultSizes_video_singlePlayer_width'] ) . '" height="' . esc_attr( $height ) . '%" '; + $html = "
"; + if ( empty( $youtube_url ) ) { + // added poster for showing thumbnail and changed preload value to fix rtMedia GL-209. $html_video = ''; $html .= sprintf( $html_video, esc_url( $rtmedia_media->cover_art ), esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ), esc_attr( $size ), esc_attr( $rtmedia_media->id ) ); + } else { + $html_video = ''; - $html .= sprintf( $html_video, esc_attr( $rtmedia_media->id ), esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ) ); + $html .= sprintf( $html_video, esc_attr( $rtmedia_media->id ), esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ) ); + } - $html .= '
'; + + $html .= '
'; + } elseif ( 'music' === $rtmedia_media->media_type ) { + $width = $rtmedia->options['defaultSizes_music_singlePlayer_width']; $width = ( $width * 75 ) / 640; $size = ' width= ' . esc_attr( $width ) . '% height=30 '; @@ -577,7 +624,7 @@ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media } $audio_html = ''; - $html = sprintf( $audio_html, esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ), esc_attr( $size ), esc_attr( $rtmedia_media->id ) ); + $html = sprintf( $audio_html, esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ), esc_attr( $size ), esc_attr( $rtmedia_media->id ) ); } else { $html = false; } @@ -590,7 +637,7 @@ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media $html = apply_filters( 'rtmedia_single_content_filter', $html, $rtmedia_media ); if ( $echo ) { - echo $html; // @codingStandardsIgnoreLine + echo wp_kses( $html, RTMedia::expanded_allowed_tags() ); } else { return $html; } @@ -600,17 +647,18 @@ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media /** * Get media src * - * @global array $rtmedia_backbone - * @global object $rtmedia_media - * @global RTMedia $rtmedia + * @global object $rtmedia_media + * @global RTMedia $rtmedia + * @global array $rtmedia_backbone * - * @param string $size - * @param bool|int $id - * @param bool $recho + * @param string $size Media size. + * @param bool|int $id Media id. + * @param bool $echo Echo html or return html. + * @param int $key Media key. * - * @return bool|int|string|void + * @return bool|int|string|void */ -function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true, $key = 0 ) { +function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $echo = true, $key = 0 ) { global $rtmedia_backbone; global $rtmedia; @@ -623,9 +671,13 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), false, false ); + $media = $model->get_media( + array( + 'id' => $id, + ), + false, + false + ); /** * Added because the function was generating duplicate thumbnails for @@ -647,12 +699,13 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true $thumbnail_id = 0; if ( isset( $media_object->media_type ) ) { + if ( 'album' === $media_object->media_type || 'photo' !== $media_object->media_type || 'video' === $media_object->media_type ) { $thumbnail_id = ( isset( $media_object->cover_art ) - && ( ( false !== filter_var( $media_object->cover_art, FILTER_VALIDATE_URL ) ) // Cover art might be an absolute URL - || ( 0 !== intval( $media_object->cover_art ) ) // Cover art might be a media ID - ) ) ? $media_object->cover_art : false; - $thumbnail_id = apply_filters( 'show_custom_album_cover', $thumbnail_id, $media_object->media_type, $media_object->id ); // for rtMedia pro users + && ( ( false !== filter_var( $media_object->cover_art, FILTER_VALIDATE_URL ) ) // Cover art might be an absolute URL. + || ( 0 !== intval( $media_object->cover_art ) ) // Cover art might be a media ID. + ) ) ? $media_object->cover_art : false; + $thumbnail_id = apply_filters( 'show_custom_album_cover', $thumbnail_id, $media_object->media_type, $media_object->id ); // for rtMedia pro users. } elseif ( 'photo' === $media_object->media_type ) { $thumbnail_id = $media_object->media_id; } else { @@ -671,13 +724,13 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true if ( ! $thumbnail_id ) { global $rtmedia; - // Getting the extension of the uploaded file + // Getting the extension of the uploaded file. $extension = rtmedia_get_extension( $media_object->media_id ); - // Checking if custom thumbnail for this file extension is set or not + // Checking if custom thumbnail for this file extension is set or not. if ( isset( $rtmedia->allowed_types[ $media_object->media_type ] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'][ $extension ] ) ) { $src = $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'][ $extension ]; - } else if ( isset( $rtmedia->allowed_types[ $media_object->media_type ] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['thumbnail'] ) ) { + } elseif ( isset( $rtmedia->allowed_types[ $media_object->media_type ] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['thumbnail'] ) ) { $src = $rtmedia->allowed_types[ $media_object->media_type ]['thumbnail']; } elseif ( 'album' === $media_object->media_type ) { $src = rtmedia_album_image( $size, $id ); @@ -694,11 +747,11 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true $src = apply_filters( 'rtmedia_media_thumb', $src, $media_object->id, $media_object->media_type ); - //Added timestamp because conflict with cache image. + // Added timestamp because conflict with cache image. $src = $src . '?' . time(); - if ( true === $recho ) { - echo set_url_scheme( $src ); + if ( true === $echo ) { + echo wp_kses( set_url_scheme( $src ), RTMedia::expanded_allowed_tags() ); } else { return $src; } @@ -708,20 +761,24 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true /** * Get media alt * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $id - * @param bool $echo + * @param bool|int $id Media id. + * @param bool $echo Echo html or return html. * - * @return string + * @return string */ function rtmedia_image_alt( $id = false, $echo = true ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), false, false ); + $media = $model->get_media( + array( + 'id' => $id, + ), + false, + false + ); if ( isset( $media[0] ) ) { $media_object = $media[0]; @@ -757,14 +814,14 @@ function rtmedia_image_alt( $id = false, $echo = true ) { /** * Get album image * - * @global object $rtmedia_media - * @global RTMediaQuery $rtmedia_query - * @global RTMedia $rtmedia + * @global object $rtmedia_media + * @global RTMediaQuery $rtmedia_query + * @global RTMedia $rtmedia * - * @param string $size - * @param bool|int $id + * @param string $size Image size. + * @param bool|int $id Media id. * - * @return string + * @return string */ function rtmedia_album_image( $size = 'thumbnail', $id = false ) { @@ -777,33 +834,55 @@ function rtmedia_album_image( $size = 'thumbnail', $id = false ) { $model = new RTMediaModel(); if ( isset( $rtmedia_query->query['context_id'] ) && isset( $rtmedia_query->query['context'] ) && 'group' !== $rtmedia_query->query['context'] ) { + if ( 'profile' === $rtmedia_query->query['context'] ) { - $media = $model->get_media( array( - 'album_id' => $id, - 'media_type' => 'photo', - 'media_author' => $rtmedia_query->query['context_id'], - 'context' => 'profile', - 'context_id' => $rtmedia_query->query['context_id'], - ), 0, 1 ); + + $media = $model->get_media( + array( + 'album_id' => $id, + 'media_type' => 'photo', + 'media_author' => $rtmedia_query->query['context_id'], + 'context' => 'profile', + 'context_id' => $rtmedia_query->query['context_id'], + ), + 0, + 1 + ); } else { - $media = $model->get_media( array( - 'album_id' => $id, - 'media_type' => 'photo', - 'media_author' => $rtmedia_query->query['context_id'], - ), 0, 1 ); + + $media = $model->get_media( + array( + 'album_id' => $id, + 'media_type' => 'photo', + 'media_author' => $rtmedia_query->query['context_id'], + ), + 0, + 1 + ); } } else { + if ( isset( $rtmedia_query->query['context_id'] ) && isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) { - $media = $model->get_media( array( - 'album_id' => $id, - 'media_type' => 'photo', - 'context_id' => $rtmedia_query->query['context_id'], - ), 0, 1 ); + + $media = $model->get_media( + array( + 'album_id' => $id, + 'media_type' => 'photo', + 'context_id' => $rtmedia_query->query['context_id'], + ), + 0, + 1 + ); } else { - $media = $model->get_media( array( - 'album_id' => $id, - 'media_type' => 'photo', - ), 0, 1 ); + + $media = $model->get_media( + array( + 'album_id' => $id, + 'media_type' => 'photo', + ), + 0, + 1 + ); } } @@ -822,12 +901,12 @@ function rtmedia_album_image( $size = 'thumbnail', $id = false ) { /** * Get duration for media * - * @global array $rtmedia_backbone - * @global object $rtmedia_media + * @global array $rtmedia_backbone + * @global object $rtmedia_media * - * @param bool|int $id + * @param bool|int $id Media id. * - * @return array|bool|mixed|null|string|void + * @return array|bool|mixed|null|string|void */ function rtmedia_duration( $id = false ) { @@ -841,9 +920,13 @@ function rtmedia_duration( $id = false ) { if ( $id ) { $model = new RTMediaModel(); - $media = $model->get_media( array( - 'id' => $id, - ), false, false ); + $media = $model->get_media( + array( + 'id' => $id, + ), + false, + false + ); if ( isset( $media[0] ) ) { $media_object = $media[0]; @@ -882,10 +965,10 @@ function rtmedia_duration( $id = false ) { /** * Sanitizing object * - * @param array $data - * @param array $exceptions + * @param array $data Array of data. + * @param array $exceptions Exception array. * - * @return array + * @return array */ function rtmedia_sanitize_object( $data, $exceptions = array() ) { @@ -902,9 +985,9 @@ function rtmedia_sanitize_object( $data, $exceptions = array() ) { /** * Checking if delete media is allowed * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @return bool + * @return bool */ function rtmedia_delete_allowed() { @@ -929,9 +1012,9 @@ function rtmedia_delete_allowed() { /** * Checking if edit media is allowed * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @return bool + * @return bool */ function rtmedia_edit_allowed() { @@ -952,9 +1035,9 @@ function rtmedia_edit_allowed() { /** * Get media action like edit, delete * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return string + * @return string */ function rtmedia_request_action() { @@ -967,7 +1050,7 @@ function rtmedia_request_action() { /** * Get text-box for editing media title * - * @global object $rtmedia_media + * @global object $rtmedia_media */ function rtmedia_title_input() { @@ -985,19 +1068,19 @@ function rtmedia_title_input() { $html .= ''; - echo $html; // @codingStandardsIgnoreLine + echo wp_kses( $html, RTMedia::expanded_allowed_tags() ); } /** * Get text-area when editing media * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool $editor - * @param bool $echo + * @param bool $editor Show in Editor or not. + * @param bool $echo Echo html or return it. * - * @return string + * @return string */ function rtmedia_description_input( $editor = true, $echo = false ) { @@ -1017,11 +1100,15 @@ function rtmedia_description_input( $editor = true, $echo = false ) { if ( $editor ) { if ( 'edit' === rtmedia_request_action() ) { ob_start(); - wp_editor( $value, $name, array( - 'media_buttons' => false, - 'textarea_rows' => 2, - 'quicktags' => false, - ) ); + wp_editor( + $value, + $name, + array( + 'media_buttons' => false, + 'textarea_rows' => 2, + 'quicktags' => false, + ) + ); $html .= ob_get_clean(); } else { @@ -1034,7 +1121,7 @@ function rtmedia_description_input( $editor = true, $echo = false ) { $html .= ''; if ( $echo ) { - echo $html; // @codingStandardsIgnoreLine + echo wp_kses( $html, RTMedia::expanded_allowed_tags() ); } else { return $html; } @@ -1042,17 +1129,17 @@ function rtmedia_description_input( $editor = true, $echo = false ) { } /** - * echo media description + * Echo media description * - * @param bool $echo + * @param bool $echo Echo description or not. * - * @return string + * @return string */ function rtmedia_description( $echo = true ) { if ( $echo ) { - // escape description for any html tags and reformat using `wpautop` - echo rtmedia_get_media_description(); + // escape description for any html tags and reformat using `wpautop`. + echo wp_kses_post( rtmedia_get_media_description() ); } else { return rtmedia_get_media_description(); } @@ -1062,11 +1149,11 @@ function rtmedia_description( $echo = true ) { /** * Get media description * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool $id + * @param bool|int $id Media id. * - * @return string + * @return string */ function rtmedia_get_media_description( $id = false ) { @@ -1091,9 +1178,9 @@ function rtmedia_get_media_description( $id = false ) { /** * Get total media count in the album * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return int + * @return int */ function rtmedia_count() { @@ -1106,9 +1193,9 @@ function rtmedia_count() { /** * Get the page offset for the media pool * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return int + * @return int */ function rtmedia_offset() { @@ -1121,9 +1208,9 @@ function rtmedia_offset() { /** * Get number of media per page to be displayed * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return int + * @return int */ function rtmedia_per_page_media() { @@ -1136,9 +1223,9 @@ function rtmedia_per_page_media() { /** * Get the page number of media album in the pagination * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return int + * @return int */ function rtmedia_page() { @@ -1151,9 +1238,9 @@ function rtmedia_page() { /** * Get the current media number in the album pool * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return string + * @return string */ function rtmedia_current_media() { @@ -1164,9 +1251,9 @@ function rtmedia_current_media() { } /** - * rtMedia edit form + * RTMedia edit form * - * @return bool|string + * @return bool|string */ function rtmedia_edit_form() { @@ -1183,7 +1270,7 @@ function rtmedia_edit_form() { } /** - * list of actions might be performed on media + * List of actions might be performed on media */ function rtmedia_actions() { @@ -1198,19 +1285,19 @@ function rtmedia_actions() { $actions = apply_filters( 'rtmedia_action_buttons_before_delete', $actions ); foreach ( $actions as $action ) { - echo $action; // @codingStandardsIgnoreLine + echo wp_kses( $action, RTMedia::expanded_allowed_tags() ); } $actions = array(); if ( rtmedia_delete_allowed() ) { - $actions[] = rtmedia_delete_form( $echo = false ); + $actions[] = rtmedia_delete_form( false ); } $actions = apply_filters( 'rtmedia_action_buttons_after_delete', $actions ); foreach ( $actions as $action ) { - echo $action; // @codingStandardsIgnoreLine + echo wp_kses( $action, RTMedia::expanded_allowed_tags() ); } do_action( 'after_rtmedia_action_buttons' ); @@ -1220,30 +1307,33 @@ function rtmedia_actions() { /** * Rendering comments section * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool $echo + * @param bool $echo Weather to echo comment or return html. * - * @return string + * @return string */ function rtmedia_comments( $echo = true ) { global $rtmedia_media; - /* check is comment media */ + // check is comment media. $comment_media = rtmedia_is_comment_media_single_page( rtmedia_id() ); - $html = ""; + $html = ''; + + if ( empty( $comment_media ) ) { - if( empty( $comment_media ) ){ $html = ''; } - if ( $html ) { - echo $html; // @codingStandardsIgnoreLine + echo wp_kses( $html, RTMedia::expanded_allowed_tags() ); } else { return $html; } @@ -1271,20 +1360,24 @@ function rtmedia_comments( $echo = true ) { /** * Render single comment, * And display show all comment link to display all comment - * @param [array] $comment [comment] - * @param [int] $count [default false other ways comment count] - * @param [int] $i [default false other ways increment with loop] - * By: Yahil + * + * @param array $comment comment. + * @param int|bool $count default false other ways comment count. + * @param int|bool $i default false other ways increment with loop. + * @author Yahil + * + * @return mixed|void */ function rmedia_single_comment( $comment, $count = false, $i = false ) { - $html = ''; + $html = ''; $class = ''; if ( isset( $count ) && $count ) { $hide = $count - 5; if ( $i < $hide ) { $class = 'hide'; - if ( 0 == $i ) { + if ( 0 === $i ) { + // translators: %s Count of comments. echo '
' . sprintf( esc_html__( 'Show all %s comments', 'buddypress-media' ), esc_html( $count ) ) . '
'; } } @@ -1296,7 +1389,7 @@ function rmedia_single_comment( $comment, $count = false, $i = false ) { if ( $comment['user_id'] ) { $user_link = "" . esc_html( rtmedia_get_author_name( $comment['user_id'] ) ) . ''; $user_name = apply_filters( 'rtmedia_comment_author_name', $user_link, $comment ); - $profile_pic = rtmedia_author_profile_pic( $show_link = true, $echo = false, $comment['user_id'] ); + $profile_pic = rtmedia_author_profile_pic( true, false, $comment['user_id'] ); } else { $user_name = 'Annonymous'; $profile_pic = ''; @@ -1317,7 +1410,7 @@ function rmedia_single_comment( $comment, $count = false, $i = false ) { $html .= '
' . wpautop( make_clickable( apply_filters( 'bp_get_activity_content', $comment_string ) ) ) . '
'; $html .= '
' . apply_filters( 'rtmedia_comment_extra', '', $comment ) . '
'; - if ( is_rt_admin() || ( isset( $comment['user_id'] ) && ( get_current_user_id() === intval( $comment['user_id'] ) || intval( $rtmedia_media->media_author ) === get_current_user_id() ) ) || apply_filters( 'rtmedia_allow_comment_delete', false ) ) { // show delete button for comment author and admins + if ( is_rt_admin() || ( isset( $comment['user_id'] ) && ( get_current_user_id() === intval( $comment['user_id'] ) || intval( $rtmedia_media->media_author ) === get_current_user_id() ) ) || apply_filters( 'rtmedia_allow_comment_delete', false ) ) { // show delete button for comment author and admins. $html .= ''; } @@ -1327,17 +1420,15 @@ function rmedia_single_comment( $comment, $count = false, $i = false ) { } - - /** * Get media comment count using media ID * - * @global wpdb $wpdb - * @global object $rtmedia_media + * @global wpdb $wpdb + * @global object $rtmedia_media * - * @param bool|int $media_id + * @param bool|int $media_id Media id. * - * @return int + * @return int */ function rtmedia_get_media_comment_count( $media_id = false ) { @@ -1349,8 +1440,7 @@ function rtmedia_get_media_comment_count( $media_id = false ) { $post_id = rtmedia_media_id( $media_id ); } - $query = $wpdb->prepare( "SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ); - $comment_count = $wpdb->get_results( $query, ARRAY_N ); // @codingStandardsIgnoreLine + $comment_count = $wpdb->get_results( $wpdb->prepare( "SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ), ARRAY_N ); if ( is_array( $comment_count ) && is_array( $comment_count[0] ) && isset( $comment_count[0][0] ) ) { return $comment_count[0][0]; @@ -1363,10 +1453,10 @@ function rtmedia_get_media_comment_count( $media_id = false ) { /** * Get previous media link * - * @global object $rtmedia_interaction - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query + * @global object $rtmedia_interaction * - * @return string + * @return string */ function rtmedia_pagination_prev_link() { @@ -1389,7 +1479,7 @@ function rtmedia_pagination_prev_link() { $link .= $site_url . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/'; } } else { - $post = get_post( get_post_field( 'post_parent', $rtmedia_query->media->media_id ) ); + $post = get_post( get_post_field( 'post_parent', $rtmedia_query->media->media_id ) ); $link .= $site_url . $post->post_name . '/'; } } @@ -1411,10 +1501,10 @@ function rtmedia_pagination_prev_link() { /** * Get next media link * - * @global object $rtmedia_interaction - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query + * @global object $rtmedia_interaction * - * @return string + * @return string */ function rtmedia_pagination_next_link() { @@ -1426,27 +1516,32 @@ function rtmedia_pagination_next_link() { $link = ''; if ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && 'profile' === $rtmedia_interaction->context->type ) { + if ( function_exists( 'bp_core_get_user_domain' ) ) { + if ( isset( $rtmedia_query->media_query['context'] ) && 'profile' === $rtmedia_query->media_query['context'] && isset( $rtmedia_query->media_query['context_id'] ) ) { $user_id = $rtmedia_query->media_query['context_id']; - } else if ( isset( $rtmedia_query->media_query['media_author'] ) ) { + } elseif ( isset( $rtmedia_query->media_query['media_author'] ) ) { $user_id = $rtmedia_query->media_query['media_author']; } else { $user_id = bp_displayed_user_id(); } $link .= trailingslashit( bp_core_get_user_domain( $user_id ) ); + } else { $link .= $site_url . 'author/' . $author_name . '/'; } } else { if ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && 'group' === $rtmedia_interaction->context->type ) { + if ( function_exists( 'bp_get_current_group_slug' ) ) { $link .= $site_url . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/'; } } else { - // if there are more media than number of media per page to show than $rtmedia_query->media->media_id will be set other wise take media_id of very first media - // For more understanding why array became object check rewind_media() in RTMediaQuery.php file and check it's call + + // if there are more media than number of media per page to show than $rtmedia_query->media->media_id will be set other wise take media_id of very first media. + // For more understanding why array became object check rewind_media() in RTMediaQuery.php file and check it's call. $post_id = ( isset( $rtmedia_query->media->media_id ) ? $rtmedia_query->media->media_id : $rtmedia_query->media[0]->media_id ); $post = get_post( get_post_field( 'post_parent', $post_id ) ); @@ -1477,14 +1572,14 @@ function rtmedia_pagination_next_link() { } /** - * get media page link + * Get media page link * - * @global object $rtmedia_interaction - * @global RTMediaQuery $rtmedia_query + * @global object $rtmedia_interaction + * @global RTMediaQuery $rtmedia_query * - * @param string $page_no + * @param string $page_no Current page number. * - * @return string + * @return string */ function rtmedia_pagination_page_link( $page_no = '' ) { @@ -1493,10 +1588,16 @@ function rtmedia_pagination_page_link( $page_no = '' ) { $wp_default_context = array( 'page', 'post' ); $rtm_context = get_query_var( 'rtm_context' ); $rtm_attr = get_query_var( 'rtm_attr' ); - $rtm_term = get_query_var( 'rtm_term' ); + $rtm_term = get_query_var( 'rtm_term' ); - if ( isset( $_GET['context'] ) && in_array( $_GET['context'], $wp_default_context ) && isset( $_GET['rtmedia_shortcode'] ) && 'true' === $_GET['rtmedia_shortcode'] ) { - $post = get_post( intval( $_GET['context_id'] ) ); + $is_on_home = sanitize_text_field( filter_input( INPUT_GET, 'is_on_home', FILTER_SANITIZE_STRING ) ); + $is_rtmedia_shortcode = sanitize_text_field( filter_input( INPUT_GET, 'rtmedia_shortcode', FILTER_SANITIZE_STRING ) ); + $context_id = filter_input( INPUT_GET, 'context_id', FILTER_VALIDATE_INT ); + $context = sanitize_text_field( filter_input( INPUT_GET, 'context', FILTER_SANITIZE_STRING ) ); + + // phpcs:disable WordPress.WP.GlobalVariablesOverride.OverrideProhibited + if ( ! empty( $context ) && in_array( $context, $wp_default_context, true ) && ! empty( $is_rtmedia_shortcode ) && 'true' === $is_rtmedia_shortcode ) { + $post = get_post( intval( $context_id ) ); } $page_url = 'pg/' . $page_no; @@ -1504,12 +1605,14 @@ function rtmedia_pagination_page_link( $page_no = '' ) { $author_name = get_query_var( 'author_name' ); $link = ''; - $is_shortcode_on_home = ( isset( $_GET['is_on_home'] ) && '1' === $_GET['is_on_home'] && isset( $_GET['rtmedia_shortcode'] ) && 'true' === $_GET['rtmedia_shortcode'] && isset( $_GET['context_id'] ) && $_GET['context_id'] === get_option( 'page_on_front' ) ) ? true : false; + $is_shortcode_on_home = ( ! empty( $is_on_home ) && '1' === $is_on_home && ! empty( $is_rtmedia_shortcode ) && 'true' === $is_rtmedia_shortcode && ! empty( $context_id ) && intval( get_option( 'page_on_front' ) ) === $context_id ) ? true : false; if ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && 'profile' === $rtmedia_interaction->context->type ) { + if ( function_exists( 'bp_core_get_user_domain' ) && ! empty( $rtmedia_query->query['context_id'] ) ) { $link .= trailingslashit( bp_core_get_user_domain( $rtmedia_query->query['context_id'] ) ); } else { + if ( $is_shortcode_on_home ) { $link .= $site_url; } elseif ( 'group' === $rtm_context || 'profile' === $rtm_context ) { @@ -1519,51 +1622,60 @@ function rtmedia_pagination_page_link( $page_no = '' ) { } } } else { + if ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && 'group' === $rtmedia_interaction->context->type ) { + if ( function_exists( 'bp_get_current_group_slug' ) ) { $link .= $site_url . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/'; } - } elseif ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && in_array( $rtmedia_interaction->context->type, $wp_default_context ) ) { - // Make sure that only one slash is at the end of url + } elseif ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && in_array( $rtmedia_interaction->context->type, $wp_default_context, true ) ) { + + // Make sure that only one slash is at the end of url. $link .= rtrim( get_permalink( $post ), '/' ) . '/'; - } elseif ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && 'rtmedia_album' === $rtmedia_interaction->context->type ) { // url for rtmedia album + + } elseif ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && 'rtmedia_album' === $rtmedia_interaction->context->type ) { // url for rtmedia album. + global $rtmedia; $options = $rtmedia->options; - // Get album slug + // Get album slug. $album_slug = $options['rtmedia_wp_album_slug']; if ( empty( $album_slug ) ) { $album_slug = 'rtmedia-album'; } - $post = get_post( get_post_field( 'post_parent', $rtmedia_query->media->media_id ) ); + + $post = get_post( get_post_field( 'post_parent', $rtmedia_query->media->media_id ) ); $link .= $site_url . $album_slug . '/' . $post->post_name . '/'; + } elseif ( isset( $rtmedia_query->media->media_id ) ) { + $post = get_post( get_post_field( 'post_parent', $rtmedia_query->media->media_id ) ); $link .= $site_url . $post->post_name . '/'; } } + // phpcs:enable WordPress.WP.GlobalVariablesOverride.OverrideProhibited - // Do not add media slug for gallery shortcode and sitewide gallery - if ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && ! in_array( $rtmedia_interaction->context->type, array( 'page', 'rtmedia_album', 'post' ) ) && ! $is_shortcode_on_home ) { + // Do not add media slug for gallery shortcode and sitewide gallery. + if ( $rtmedia_interaction && isset( $rtmedia_interaction->context ) && ! in_array( $rtmedia_interaction->context->type, array( 'page', 'rtmedia_album', 'post' ), true ) && ! $is_shortcode_on_home ) { $link .= RTMEDIA_MEDIA_SLUG . '/'; } - // For albums tab + // For albums tab. if ( isset( $rtmedia_query->media_query['album_id'] ) && intval( $rtmedia_query->media_query['album_id'] ) > 0 ) { $link .= $rtmedia_query->media_query['album_id'] . '/'; } - // For those pages of which es id is set into action query + // For those pages of which es id is set into action query. if ( isset( $rtmedia_query->action_query->id ) && intval( $rtmedia_query->action_query->id ) > 0 ) { $link .= $rtmedia_query->action_query->id . '/'; } $allowed_types = array( 'album' ); - // get all allowed media type + // get all allowed media type. foreach ( $rtmedia->allowed_types as $type ) { - $name = strtoupper( $type['name'] ); + $name = strtoupper( $type['name'] ); $allowed_types[] = constant( 'RTMEDIA_' . $name . '_SLUG' ); } @@ -1588,7 +1700,6 @@ function rtmedia_pagination_page_link( $page_no = '' ) { $link .= $media_type . '/'; } } - } return apply_filters( 'rtmedia_pagination_page_link', $link . $page_url, $link, $page_url ); @@ -1598,7 +1709,7 @@ function rtmedia_pagination_page_link( $page_no = '' ) { /** * Media pagination * - * @global array $rtmedia_backbone + * @global array $rtmedia_backbone */ function rtmedia_media_pagination() { @@ -1607,7 +1718,7 @@ function rtmedia_media_pagination() { if ( ! empty( $rtmedia_backbone['backbone'] ) ) { echo '<%= pagination %>'; } else { - echo rtmedia_get_pagination_values(); // @codingStandardsIgnoreLine + echo wp_kses( rtmedia_get_pagination_values(), RTMedia::expanded_allowed_tags() ); } } @@ -1615,11 +1726,11 @@ function rtmedia_media_pagination() { /** * Render pagination UI * - * @global RTMedia $rtmedia - * @global RTMediaQuery $rtmedia_query - * @global int $paged + * @global RTMediaQuery $rtmedia_query + * @global int $paged + * @global RTMedia $rtmedia * - * @return string + * @return string */ function rtmedia_get_pagination_values() { @@ -1636,15 +1747,15 @@ function rtmedia_get_pagination_values() { $range = 1; $showitems = ( $range * 2 ) + 1; $rtmedia_media_pages = ''; - + // phpcs:disable WordPress.WP.GlobalVariablesOverride.OverrideProhibited if ( 0 === intval( rtmedia_offset() ) ) { - $paged = 1; // @codingStandardsIgnoreLine - } else if ( intval( rtmedia_offset() ) === $per_page ) { - $paged = 2; // @codingStandardsIgnoreLine + $paged = 1; + } elseif ( intval( rtmedia_offset() ) === $per_page ) { + $paged = 2; } else { - $paged = ceil( rtmedia_offset() / $per_page ) + 1; // @codingStandardsIgnoreLine + $paged = ceil( rtmedia_offset() / $per_page ) + 1; } - + // phpcs:enable WordPress.WP.GlobalVariablesOverride.OverrideProhibited $pages = ceil( rtmedia_count() / $per_page ); if ( ! $pages ) { @@ -1654,6 +1765,7 @@ function rtmedia_get_pagination_values() { $page_base_url = rtmedia_pagination_page_link(); if ( 1 !== intval( $pages ) ) { + $rtmedia_media_pages .= "
"; $rtmedia_media_pages .= "
"; $rtmedia_media_pages .= ""; @@ -1666,7 +1778,7 @@ function rtmedia_get_pagination_values() { $rtmedia_media_pages .= "
"; if ( $paged > 1 && $showitems < $pages ) { - $page_url = ( ( rtmedia_page() - 1 ) == 1 ) ? '' : $page_base_url . ( rtmedia_page() - 1 ); + $page_url = ( ( rtmedia_page() - 1 ) === 1 ) ? '' : $page_base_url . ( rtmedia_page() - 1 ); $rtmedia_media_pages .= ""; } @@ -1681,17 +1793,17 @@ function rtmedia_get_pagination_values() { } for ( $i = 1; $i <= $pages; $i ++ ) { - if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) { + if ( 1 !== $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) { $page_url = $page_base_url . $i; - $rtmedia_media_pages .= ( $paged == $i ) ? "" . esc_html( $i ) . '' : "" . esc_html( $i ) . ''; + $rtmedia_media_pages .= ( $paged === $i ) ? "" . esc_html( $i ) . '' : "" . esc_html( $i ) . ''; } } if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ) { $page_url = $page_base_url . $pages; - if ( $paged + 2 < $pages ) { + if ( $paged + 2 < $pages ) { $rtmedia_media_pages .= '...'; } @@ -1704,8 +1816,8 @@ function rtmedia_get_pagination_values() { $rtmedia_media_pages .= ""; } - $rtmedia_media_pages .= "
"; - }// End if(). + $rtmedia_media_pages .= ''; + } // End if. return $rtmedia_media_pages; @@ -1733,9 +1845,9 @@ function rtmedia_comments_enabled() { /** * Checking if it's a rtmedia gallery * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_gallery() { @@ -1752,9 +1864,9 @@ function is_rtmedia_gallery() { /** * Checking if it's a album gallery * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_album_gallery() { @@ -1771,9 +1883,9 @@ function is_rtmedia_album_gallery() { /** * Checking if it's a single media * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_single() { @@ -1790,19 +1902,21 @@ function is_rtmedia_single() { /** * Checking if it's an album * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @param bool|int $album_id + * @param bool|int $album_id Album id. * - * @return bool + * @return bool */ function is_rtmedia_album( $album_id = false ) { if ( $album_id ) { $rtmedia_model = new RTMediaModel(); - $media = $rtmedia_model->get( array( - 'id' => $album_id, - ) ); + $media = $rtmedia_model->get( + array( + 'id' => $album_id, + ) + ); if ( is_array( $media ) && isset( $media[0] ) && isset( $media[0]->media_type ) && 'album' === $media[0]->media_type ) { return true; @@ -1824,9 +1938,9 @@ function is_rtmedia_album( $album_id = false ) { /** * Checking if it's a group album * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_group_album() { @@ -1843,9 +1957,9 @@ function is_rtmedia_group_album() { /** * Checking if edit is allowed * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_edit_allowed() { @@ -1866,24 +1980,28 @@ function is_rtmedia_edit_allowed() { /** * Updating activity after thumbnail set * - * @global wpdb $wpdb - * @global BuddyPress $bp + * @global wpdb $wpdb + * @global BuddyPress $bp * - * @param int $id + * @param int $id Media id. */ function update_activity_after_thumb_set( $id ) { $model = new RTMediaModel(); $media_obj = new RTMediaMedia(); - $media = $model->get( array( - 'id' => $id, - ) ); + $media = $model->get( + array( + 'id' => $id, + ) + ); $privacy = $media[0]->privacy; $activity_id = rtmedia_activity_id( $id ); if ( ! empty( $activity_id ) ) { - $same_medias = $media_obj->model->get( array( - 'activity_id' => $activity_id, - ) ); + $same_medias = $media_obj->model->get( + array( + 'activity_id' => $activity_id, + ) + ); $update_activity_media = array(); foreach ( $same_medias as $a_media ) { @@ -1897,75 +2015,82 @@ function update_activity_after_thumb_set( $id ) { $activity_old_content = bp_activity_get_meta( $activity_id, 'bp_old_activity_content' ); if ( ! empty( $activity_old_content ) ) { - // get old activity content and save in activity meta - $activity_get = bp_activity_get_specific( array( - 'activity_ids' => $activity_id, - ) ); + // get old activity content and save in activity meta. + $activity_get = bp_activity_get_specific( + array( + 'activity_ids' => $activity_id, + ) + ); $activity = $activity_get['activities'][0]; $activity_body = $activity->content; bp_activity_update_meta( $activity_id, 'bp_old_activity_content', $activity_body ); - //extract activity text from old content + // extract activity text from old content. $activity_text = strip_tags( $activity_body, '' ); $activity_text = explode( '', $activity_text ); - $activity_text = strip_tags( $activity_text[0] ); + $activity_text = wp_strip_all_tags( $activity_text[0] ); bp_activity_update_meta( $activity_id, 'bp_activity_text', $activity_text ); } $activity_text = bp_activity_get_meta( $activity_id, 'bp_activity_text' ); $obj_activity->activity_text = $activity_text; - $activity_content = $obj_activity->create_activity_html(); + $activity_content = $obj_activity->create_activity_html(); - $wpdb->update( $bp->activity->table_name, array( - 'content' => $activity_content, - ), array( - 'id' => $activity_id, - ) ); + $wpdb->update( + $bp->activity->table_name, + array( + 'content' => $activity_content, + ), + array( + 'id' => $activity_id, + ) + ); - if( function_exists( 'rtmedia_update_content_of_comment_media' ) ){ + if ( function_exists( 'rtmedia_update_content_of_comment_media' ) ) { rtmedia_update_content_of_comment_media( $id, $activity_content ); } - }// End if(). + } // End if. } - - /** * Updating profile and comment activity after thumbnail set * - * @global wpdb $wpdb + * @global wpdb $wpdb * - * @param int $media_id - * @param string $activity_content + * @param int $media_id Media id. + * @param string $activity_content Activity content. */ -function rtmedia_update_content_of_comment_media( $media_id, $activity_content ){ - /* update activity profile and comment content of the media */ - if( isset( $media_id ) && ! empty( $media_id ) && function_exists( 'rtmedia_is_comment_media' ) ){ +function rtmedia_update_content_of_comment_media( $media_id, $activity_content ) { + // update activity profile and comment content of the media. + if ( isset( $media_id ) && ! empty( $media_id ) && function_exists( 'rtmedia_is_comment_media' ) ) { global $wpdb; - /* check if it's an comment media */ - if( rtmedia_is_comment_media( $media_id ) ){ + + // check if it's an comment media. + if ( rtmedia_is_comment_media( $media_id ) ) { // update profile content - /* get the profile activity id from the rtmedia meta table */ + // get the profile activity id from the rtmedia meta table. $activity_id = get_rtmedia_meta( $media_id, 'rtmedia_comment_media_profile_id' ); - /* check is activity id is empty or not */ - if( isset( $activity_id ) && ! empty( $activity_id ) ){ + + // check is activity id is empty or not. + if ( isset( $activity_id ) && ! empty( $activity_id ) ) { $update = $wpdb->update( $wpdb->base_prefix . 'bp_activity', array( 'content' => $activity_content ), array( 'id' => $activity_id ) ); } - // update comment content - // get the comment id from the rtmedia meta table + // update comment content. + // get the comment id from the rtmedia meta table. $comment_id = get_rtmedia_meta( $media_id, 'rtmedia_comment_media_comment_id' ); - if( isset( $comment_id ) && ! empty( $comment_id ) ){ + + if ( isset( $comment_id ) && ! empty( $comment_id ) ) { $activity_content = str_replace( 'rtmedia-activity-container', 'rtmedia-comment-media-container', $activity_content ); $activity_content = str_replace( 'rtmedia-activity-text', 'rtmedia-comment-media-text', $activity_content ); $activity_content = str_replace( 'rtmedia-list-item', 'rtmedia-comment-media-list-item', $activity_content ); $activity_content = str_replace( 'rtmedia-list', 'rtmedia-comment-media-list', $activity_content ); $activity_content = str_replace( 'rtmedia-comment-media-list-item', 'rtmedia-list-item', $activity_content ); - $update = $wpdb->update( $wpdb->base_prefix . 'comments', array( 'comment_content' => $activity_content ), array( 'comment_ID' => $comment_id ) ); + $update = $wpdb->update( $wpdb->base_prefix . 'comments', array( 'comment_content' => $activity_content ), array( 'comment_ID' => $comment_id ) ); } } } @@ -1975,11 +2100,11 @@ function rtmedia_update_content_of_comment_media( $media_id, $activity_content ) /** * Updating video poster * - * @param string $html - * @param object $media - * @param bool $activity + * @param string $html HTML string. + * @param object $media Media details. + * @param bool $activity Is Activity or not. * - * @return string + * @return string */ function update_video_poster( $html, $media, $activity = false ) { @@ -1999,9 +2124,9 @@ function update_video_poster( $html, $media, $activity = false ) { /** * Get video without thumbnail * - * @global wpdb $wpdb + * @global wpdb $wpdb * - * @return string + * @return array */ function get_video_without_thumbs() { @@ -2009,8 +2134,7 @@ function get_video_without_thumbs() { $rtmedia_model = new RTMediaModel(); - $sql = $wpdb->prepare( "select media_id from {$rtmedia_model->table_name} where media_type = %s and blog_id = %d and cover_art is null", 'video', get_current_blog_id() ); // @codingStandardsIgnoreLine - $results = $wpdb->get_col( $sql ); // @codingStandardsIgnoreLine + $results = $wpdb->get_col( $wpdb->prepare( "select media_id from {$rtmedia_model->table_name} where media_type = %s and blog_id = %d and cover_art is null", 'video', get_current_blog_id() ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared return $results; @@ -2021,7 +2145,7 @@ function get_video_without_thumbs() { */ function rtmedia_comment_form() { - /* check is comment media */ + // check is comment media. $comment_media = rtmedia_is_comment_media_single_page( rtmedia_id() ); if ( is_user_logged_in() && empty( $comment_media ) ) { @@ -2043,16 +2167,18 @@ function rtmedia_comment_form() { /** * Get cover srt using media ID * - * @param int $id + * @param int $id Media id. * - * @return bool|string + * @return bool|string */ function rtmedia_get_cover_art_src( $id ) { $model = new RTMediaModel(); - $media = $model->get( array( - 'id' => $id, - ) ); + $media = $model->get( + array( + 'id' => $id, + ) + ); $cover_art = $media[0]->cover_art; if ( ! empty( $cover_art ) ) { @@ -2072,19 +2198,19 @@ function rtmedia_get_cover_art_src( $id ) { /** * Rendering media delete form * - * @param bool $echo + * @param bool $echo Echo or return html. * - * @return bool|string + * @return bool|string */ function rtmedia_delete_form( $echo = true ) { if ( rtmedia_delete_allowed() ) { - $html = '
'; + $html = ''; $html .= ''; $html .= ''; if ( $echo ) { - echo $html; // @codingStandardsIgnoreLine + echo wp_kses( $html, RTMedia::expanded_allowed_tags() ); RTMediaMedia::media_nonce_generator( rtmedia_id(), true ); @@ -2112,18 +2238,18 @@ function rtmedia_delete_form( $echo = true ) { /** * Rendering RTMedia Uploader * - * @param array|string $attr + * @param array|string $attr Attributes array. */ function rtmedia_uploader( $attr = '' ) { if ( rtmedia_is_uploader_view_allowed( true, 'media_gallery' ) ) { if ( function_exists( 'bp_is_blog_page' ) && ! bp_is_blog_page() ) { if ( function_exists( 'bp_is_user' ) && bp_is_user() && function_exists( 'bp_displayed_user_id' ) && bp_displayed_user_id() === get_current_user_id() ) { - echo RTMediaUploadShortcode::pre_render( $attr ); // @codingStandardsIgnoreLine + echo wp_kses( RTMediaUploadShortcode::pre_render( $attr ), RTMedia::expanded_allowed_tags() ); } else { if ( function_exists( 'bp_is_group' ) && bp_is_group() ) { if ( can_user_upload_in_group() ) { - echo RTMediaUploadShortcode::pre_render( $attr ); // @codingStandardsIgnoreLine + echo wp_kses( RTMediaUploadShortcode::pre_render( $attr ), RTMedia::expanded_allowed_tags() ); } } } @@ -2137,19 +2263,17 @@ function rtmedia_uploader( $attr = '' ) { /** * Rendering RTMedia Gallery * - * @param array|string $attr + * @param array|string $attr Attributes array. */ function rtmedia_gallery( $attr = '' ) { - - echo RTMediaGalleryShortcode::render( $attr ); // @codingStandardsIgnoreLine - + echo wp_kses( RTMediaGalleryShortcode::render( $attr ), RTMedia::expanded_allowed_tags() ); } /** * Get meta data of media * - * @param bool|int $id - * @param bool|string $key + * @param bool|int $id Media id. + * @param bool|string $key Meta key. * * @return bool */ @@ -2160,10 +2284,10 @@ function get_rtmedia_meta( $id = false, $key = false ) { return $rtmediameta->get_meta( $id, $key ); } else { - // check whether to get single value or multiple + // check whether to get single value or multiple. $single = ( false === $key ) ? false : true; - // use WP's default get_metadata function replace column name from "media_id" to "id" in query + // use WP's default get_metadata function replace column name from "media_id" to "id" in query. add_filter( 'query', 'rtm_filter_metaid_column_name' ); $meta = get_metadata( 'media', $id, $key, $single ); @@ -2178,12 +2302,12 @@ function get_rtmedia_meta( $id = false, $key = false ) { /** * Add media meta * - * @param bool|int $id - * @param bool|string $key - * @param bool|string $value - * @param bool $duplicate + * @param bool|int $id Media id. + * @param bool|string $key Meta key. + * @param bool|string $value Meta value. + * @param bool $duplicate Duplicate meta allow or not. * - * @return bool|string + * @return bool|string */ function add_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate = false ) { @@ -2192,7 +2316,7 @@ function add_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate return $rtmediameta->add_meta( $id, $key, $value, $duplicate ); } else { - // use WP's default get_metadata function replace column name from "media_id" to "id" in query + // use WP's default get_metadata function replace column name from "media_id" to "id" in query. add_filter( 'query', 'rtm_filter_metaid_column_name' ); $meta = add_metadata( 'media', $id, $key, $value, ! $duplicate ); @@ -2207,12 +2331,12 @@ function add_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate /** * Update media meta * - * @param bool|int $id - * @param bool|string $key - * @param bool|string $value - * @param bool $duplicate + * @param bool|int $id Media id. + * @param bool|string $key Meta key. + * @param bool|string $value Meta value. + * @param bool $duplicate Duplicate meta allow or not. * - * @return bool|string + * @return bool|string */ function update_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate = false ) { @@ -2221,7 +2345,7 @@ function update_rtmedia_meta( $id = false, $key = false, $value = false, $duplic return $rtmediameta->update_meta( $id, $key, $value, $duplicate ); } else { - // use WP's default get_metadata function replace column name from "media_id" to "id" in query + // use WP's default get_metadata function replace column name from "media_id" to "id" in query. add_filter( 'query', 'rtm_filter_metaid_column_name' ); $meta = update_metadata( 'media', $id, $key, $value, $duplicate ); @@ -2236,10 +2360,10 @@ function update_rtmedia_meta( $id = false, $key = false, $value = false, $duplic /** * Delete media meta * - * @param bool|int $id - * @param bool|string $key + * @param bool|int $id Media id. + * @param bool|string $key Meta key. * - * @return array|bool + * @return array|bool */ function delete_rtmedia_meta( $id = false, $key = false ) { @@ -2248,7 +2372,7 @@ function delete_rtmedia_meta( $id = false, $key = false ) { return $rtmediameta->delete_meta( $id, $key ); } else { - // use WP's default get_metadata function replace column name from "media_id" to "id" in query + // use WP's default get_metadata function replace column name from "media_id" to "id" in query. add_filter( 'query', 'rtm_filter_metaid_column_name' ); $meta = delete_metadata( 'media', $id, $key ); @@ -2262,7 +2386,7 @@ function delete_rtmedia_meta( $id = false, $key = false ) { /** * Get global albums * - * @return array + * @return mixed */ function rtmedia_global_albums() { @@ -2273,9 +2397,9 @@ function rtmedia_global_albums() { /** * Get global album list * - * @param bool|int $selected_album_id + * @param bool|int $selected_album_id Current selected album id. * - * @return null|string + * @return null|string */ function rtmedia_global_album_list( $selected_album_id = false ) { @@ -2287,13 +2411,17 @@ function rtmedia_global_album_list( $selected_album_id = false ) { } $option = null; - $album_objects = $model->get_media( array( - 'id' => $global_albums, - ), false, false ); + $album_objects = $model->get_media( + array( + 'id' => $global_albums, + ), + false, + false + ); if ( $album_objects ) { foreach ( $album_objects as $album ) { - //if selected_album_id is provided, keep that album_id selected by default + // if selected_album_id is provided, keep that album_id selected by default. $selected = ''; if ( ! empty( $selected_album_id ) && $selected_album_id === $album->id ) { @@ -2311,26 +2439,30 @@ function rtmedia_global_album_list( $selected_album_id = false ) { /** * Get user's album list * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @param bool $get_all - * @param bool|int $selected_album_id + * @param bool $get_all Flag to get all albums. + * @param bool|int $selected_album_id Current selected album id. * - * @return bool|string + * @return bool|string */ function rtmedia_user_album_list( $get_all = false, $selected_album_id = false ) { global $rtmedia_query; - $model = new RTMediaModel(); - $global_option = rtmedia_global_album_list( $selected_album_id ); - $global_albums = rtmedia_global_albums(); + $model = new RTMediaModel(); + $global_option = rtmedia_global_album_list( $selected_album_id ); + $global_albums = rtmedia_global_albums(); - $user_id = apply_filters( 'rtmedia_album_by_user', get_current_user_id() ); - $album_objects = $model->get_media( array( - 'media_author' => $user_id, - 'media_type' => 'album', - ), false, 'context' ); + $user_id = apply_filters( 'rtmedia_album_by_user', get_current_user_id() ); + $album_objects = $model->get_media( + array( + 'media_author' => $user_id, + 'media_type' => 'album', + ), + false, + 'context' + ); $option_group = ''; $profile_option = ''; @@ -2346,11 +2478,11 @@ function rtmedia_user_album_list( $get_all = false, $selected_album_id = false ) $option = apply_filters( 'rtmedia_global_albums_in_uploader', "$global_option" ); - if ( '' != $profile_option ) { + if ( '' !== $profile_option ) { $option .= "$profile_option"; } - if ( '' != $option_group && class_exists( 'BuddyPress' ) ) { + if ( '' !== $option_group && class_exists( 'BuddyPress' ) ) { $option .= "$option_group"; } @@ -2365,29 +2497,33 @@ function rtmedia_user_album_list( $get_all = false, $selected_album_id = false ) /** * Get group's album list * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @param bool|int $selected_album_id + * @param bool|int $selected_album_id Current selected album id. * - * @return bool|null|string + * @return bool|null|string */ function rtmedia_group_album_list( $selected_album_id = false ) { - //by default, first album in list will be selected + // by default, first album in list will be selected. global $rtmedia_query; $model = new RTMediaModel(); $global_option = rtmedia_global_album_list( $selected_album_id ); $global_albums = rtmedia_global_albums(); - $album_objects = $model->get_media( array( - 'context' => $rtmedia_query->media_query['context'], - 'context_id' => $rtmedia_query->media_query['context_id'], - 'media_type' => 'album', - ), false, false ); + $album_objects = $model->get_media( + array( + 'context' => $rtmedia_query->media_query['context'], + 'context_id' => $rtmedia_query->media_query['context_id'], + 'media_type' => 'album', + ), + false, + false + ); $option_group = ''; if ( $album_objects ) { foreach ( $album_objects as $album ) { - if ( ! in_array( $album->id, $global_albums ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id != $rtmedia_query->media_query['album_id'] ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) ) ) { + if ( ! in_array( $album->id, $global_albums, true ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id !== $rtmedia_query->media_query['album_id'] ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) ) ) { $option_group .= ''; } } @@ -2410,7 +2546,7 @@ function rtmedia_group_album_list( $selected_album_id = false ) { /** * Checking if album creation is allowed * - * @return bool + * @return bool */ function rtm_is_album_create_allowed() { @@ -2421,9 +2557,9 @@ function rtm_is_album_create_allowed() { /** * Checking if user has an access to create an album * - * @param bool|int $user_id + * @param bool|int $user_id User id. * - * @return bool + * @return bool */ function rtm_is_user_allowed_to_create_album( $user_id = false ) { @@ -2438,9 +2574,9 @@ function rtm_is_user_allowed_to_create_album( $user_id = false ) { /** * Checking if album is editable * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function rtmedia_is_album_editable() { @@ -2465,24 +2601,25 @@ function rtmedia_is_album_editable() { /** * Rendering sub nav * - * @global RTMediaNav $rtMediaNav + * @global RTMediaNav $rtMediaNav */ function rtmedia_sub_nav() { + // phpcs:disable WordPress.NamingConventions.ValidVariableName.NotSnakeCase global $rtMediaNav; $rtMediaNav = new RTMediaNav(); $rtMediaNav->sub_nav(); - + // phpcs:enable WordPress.NamingConventions.ValidVariableName.NotSnakeCase } /** * Checking if album is enable * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_album_enable() { @@ -2515,9 +2652,9 @@ function rtmedia_load_template() { /** * Checking if privacy is enabled * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_privacy_enable() { @@ -2534,9 +2671,9 @@ function is_rtmedia_privacy_enable() { /** * Checking if user can override the existing privacy * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_privacy_user_overide() { @@ -2553,28 +2690,28 @@ function is_rtmedia_privacy_user_overide() { /** * Rendering privacy UI * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool|string + * @return bool|string */ function rtmedia_edit_media_privacy_ui() { global $rtmedia_query; - /* check is comment media */ + // check is comment media. $comment_media = rtmedia_is_comment_media( rtmedia_id() ); if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) { - //if context is group i.e editing a group media, dont show the privacy dropdown + // if context is group i.e editing a group media, dont show the privacy dropdown. return false; } $privacymodel = new RTMediaPrivacy( false ); - $privacy = $privacymodel->select_privacy_ui( $echo = false ); + $privacy = $privacymodel->select_privacy_ui( false ); - // @todo: strict standard error + // @todo: strict standard error. if ( isset( $rtmedia_query->media ) && is_array( $rtmedia_query->media ) && isset( $rtmedia_query->media['0'] ) ) { - if ( isset( $rtmedia_query->media['0']->privacy ) && $rtmedia_query->media['0']->privacy != '80' ) { + if ( isset( $rtmedia_query->media['0']->privacy ) && 80 !== intval( $rtmedia_query->media['0']->privacy ) ) { if ( $privacy && empty( $comment_media ) ) { return "
' . $privacy . '
'; } @@ -2585,9 +2722,9 @@ function rtmedia_edit_media_privacy_ui() { /** * Get default privacy * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return int + * @return int */ function get_rtmedia_default_privacy() { @@ -2604,9 +2741,9 @@ function get_rtmedia_default_privacy() { /** * Checking if media is enabled in BuddyPress group * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_group_media_enable() { @@ -2622,9 +2759,9 @@ function is_rtmedia_group_media_enable() { /** * Checking if media is enabled in BuddyPress Member's profile * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_profile_media_enable() { @@ -2641,9 +2778,9 @@ function is_rtmedia_profile_media_enable() { /** * Checking if user in group component * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_bp_group() { @@ -2660,15 +2797,15 @@ function is_rtmedia_bp_group() { /** * Checking if user in profile component * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return bool + * @return bool */ function is_rtmedia_bp_profile() { global $rtmedia_query; - if ( isset( $rtmedia_query->query['context'] ) && 'profile' == $rtmedia_query->query['context'] ) { + if ( isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] ) { return true; } @@ -2679,7 +2816,7 @@ function is_rtmedia_bp_profile() { /** * Checking if user can upload in BuddyPress group * - * @return bool + * @return bool */ function can_user_upload_in_group() { @@ -2700,14 +2837,14 @@ function can_user_upload_in_group() { /** * Checking if user can create an album in BuddyPress group * - * @param bool|int $group_id - * @param bool|int $user_id + * @param bool|int $group_id BP Group id. + * @param bool|int $user_id User id. * * @return bool */ function can_user_create_album_in_group( $group_id = false, $user_id = false ) { - if ( false == $group_id ) { + if ( false === $group_id ) { $group = groups_get_current_group(); $group_id = $group->id; } @@ -2750,9 +2887,9 @@ function can_user_create_album_in_group( $group_id = false, $user_id = false ) { /** * Checking if video upload is allowed * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_upload_video_enabled() { @@ -2768,7 +2905,7 @@ function is_rtmedia_upload_video_enabled() { /** * Checking if photo upload is allowed * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * * @return bool */ @@ -2787,7 +2924,7 @@ function is_rtmedia_upload_photo_enabled() { /** * Checking if music upload is allowed * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * * @return bool */ @@ -2806,9 +2943,9 @@ function is_rtmedia_upload_music_enabled() { /** * Get allowed media upload type * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return string + * @return string */ function get_rtmedia_allowed_upload_type() { @@ -2845,16 +2982,18 @@ function is_rt_admin() { /** * Get media like count * - * @param bool|int $media_id + * @param bool|int $media_id Media id. * - * @return array|int + * @return array|int */ function get_rtmedia_like( $media_id = false ) { $mediamodel = new RTMediaModel(); - $actions = $mediamodel->get( array( - 'id' => rtmedia_id( $media_id ), - ) ); + $actions = $mediamodel->get( + array( + 'id' => rtmedia_id( $media_id ), + ) + ); if ( isset( $actions[0]->likes ) ) { $actions = intval( $actions[0]->likes ); @@ -2869,7 +3008,7 @@ function get_rtmedia_like( $media_id = false ) { /** * Show media like count * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia */ function show_rtmedia_like_counts() { @@ -2885,68 +3024,70 @@ function show_rtmedia_like_counts() { $class = 'hide'; } ?> -
+
is_liked( rtmedia_id() ) ); + echo wp_kses( rtmedia_who_like_html( $count, $rtmedialike->is_liked( rtmedia_id() ) ), RTMedia::expanded_allowed_tags() ); } ?> -
1 && $user_like_it ) { /** * Rtmedia you and * - * @param $html TEXT - * @param int $like_count Total Like - * @param int $user_like_it User Like it or Not + * @param string $html TEXT. + * @param int $like_count Total Like. + * @param int $user_like_it User Like it or Not. * - * @return html TEXT to display + * @return string TEXT to display */ $html .= apply_filters( 'rtmedia_like_html_you_and_more_like', esc_html__( 'You and ', 'buddypress-media' ), $like_count, $user_like_it ); $like_count_new--; } /** - * Rtmedia Disaply count + * Rtmedia Display count * - * @param int $like_count Total Like - * @param int $user_like_it User Like it or Not + * @param int $like_count Total Like. + * @param int $user_like_it User Like it or Not. * * @return INT Count to display */ @@ -2955,11 +3096,11 @@ function rtmedia_who_like_html( $like_count = false, $user_like_it = false ) { /** * Rtmedia person or people likes it * - * @param $html TEXT - * @param int $like_count Total Like - * @param int $user_like_it User Like it or Not + * @param string $html TEXT. + * @param int $like_count Total Like. + * @param int $user_like_it User Like it or Not. * - * @return html TEXT to display + * @return string TEXT to display */ $html .= apply_filters( 'rtmedia_like_html_othe_likes_this', _n( ' person likes this', ' people like this', $like_count_new, 'buddypress-media' ), $like_count, $user_like_it ); } @@ -2967,11 +3108,11 @@ function rtmedia_who_like_html( $like_count = false, $user_like_it = false ) { /** * Rtmedia return whole HTML * - * @param $html TEXT - * @param int $like_count Total Like - * @param int $user_like_it User Like it or Not + * @param string $html TEXT. + * @param int $like_count Total Like. + * @param int $user_like_it User Like it or Not. * - * @return html TEXT to display + * @return string TEXT to display */ $html = apply_filters( 'rtmedia_who_like_html', $html, $like_count, $user_like_it ); return $html; @@ -2981,7 +3122,7 @@ function rtmedia_who_like_html( $like_count = false, $user_like_it = false ) { /** * Get music cover art * - * @param object $media_object + * @param object $media_object Media details object. * * @return bool|string */ @@ -2994,7 +3135,7 @@ function rtm_get_music_cover_art( $media_object ) { return $url; } - // return false if covert_art is already analyzed earlier + // return false if covert_art is already analyzed earlier. if ( -1 === intval( $url ) ) { return false; } @@ -3010,39 +3151,50 @@ function rtm_get_music_cover_art( $media_object ) { $id = $media_object->id; if ( ! empty( $image_info['data'] ) ) { + $thumb_upload_info = wp_upload_bits( $title_info . '.' . $mime[ count( $mime ) - 1 ], null, $image_info['data'] ); if ( is_array( $thumb_upload_info ) && ! empty( $thumb_upload_info['url'] ) ) { - $media_obj->model->update( array( - 'cover_art' => $thumb_upload_info['url'], - ), array( - 'id' => $id, - ) ); + $media_obj->model->update( + array( + 'cover_art' => $thumb_upload_info['url'], + ), + array( + 'id' => $id, + ) + ); return $thumb_upload_info['url']; } } - $media_obj->model->update( array( - 'cover_art' => '-1', - ), array( - 'id' => $id, - ) ); + $media_obj->model->update( + array( + 'cover_art' => '-1', + ), + array( + 'id' => $id, + ) + ); return false; } -/** - * "get_music_cover_art" is too generic function name. It shouldn't added in very first place. - * It is renamed as "rtm_get_music_cover_art" - * - * @return bool - */ if ( ! function_exists( 'get_music_cover_art' ) ) { + /** + * Function "get_music_cover_art" is too generic function name. It shouldn't added in very first place. + * It is renamed as "rtm_get_music_cover_art" + * + * @param string $file Media file. + * @param int $id Media id. + * + * @return bool + */ function get_music_cover_art( $file, $id ) { + // todo:delete if not used. return false; } @@ -3051,43 +3203,46 @@ function get_music_cover_art( $file, $id ) { /** * Get the media privacy symbol * - * @param bool|int $rtmedia_id + * @param bool|int $rtmedia_id Media id to check privacy. * - * @return string + * @return string */ function get_rtmedia_privacy_symbol( $rtmedia_id = false ) { $mediamodel = new RTMediaModel(); - $actions = $mediamodel->get( array( - 'id' => rtmedia_id( $rtmedia_id ), - ) ); + $actions = $mediamodel->get( + array( + 'id' => rtmedia_id( $rtmedia_id ), + ) + ); $privacy = ''; if ( intval( $actions[0]->privacy ) >= 0 ) { - $title = $icon = ''; + $title = ''; + $icon = ''; switch ( $actions[0]->privacy ) { - case 0: // public + case 0: // public. $title = esc_html__( 'Public', 'buddypress-media' ); $icon = 'dashicons dashicons-admin-site'; break; - case 20: // users + case 20: // users. $title = esc_html__( 'All members', 'buddypress-media' ); $icon = 'dashicons dashicons-groups'; break; - case 40: // friends + case 40: // friends. $title = esc_html__( 'Your friends', 'buddypress-media' ); $icon = 'dashicons dashicons-networking'; break; - case 60: // private + case 60: // private. $title = esc_html__( 'Only you', 'buddypress-media' ); $icon = 'dashicons dashicons-lock'; break; - case 80: // private + case 80: // private. $title = esc_html__( 'Blocked temporarily', 'buddypress-media' ); $icon = 'dashicons dashicons-dismiss'; @@ -3106,9 +3261,11 @@ function get_rtmedia_privacy_symbol( $rtmedia_id = false ) { /** * Get media uploaded gmt date * - * @param bool|int $rtmedia_id + * @param bool|int $rtmedia_id Media id. + * + * @return string * - * @return string + * @throws Exception Error while getting media date. */ function get_rtmedia_date_gmt( $rtmedia_id = false ) { @@ -3128,9 +3285,11 @@ function get_rtmedia_date_gmt( $rtmedia_id = false ) { /** * Convert comment datetime to "time ago" format * - * @param string $_date + * @param string $_date Comment datetime. * - * @return string + * @return string + * + * @throws Exception Error while converting date. */ function rtmedia_convert_date( $_date ) { @@ -3141,33 +3300,40 @@ function rtmedia_convert_date( $_date ) { $diff = $cur_time - $date; $time_unit = array( 'second', 'minute', 'hour' ); $length = array( 1, 60, 3600, 86400 ); - $ago_text = esc_html__( '%s ago ', 'buddypress-media' ); + // translators: %s: count of hour/minute/second. + $ago_text = esc_html__( '%s ago ', 'buddypress-media' ); + $no = 0; - for ( $i = sizeof( $length ) - 1; ( $i >= 0 ) && ( ( $no = $diff / $length[ $i ] ) <= 1 ); $i -- ) {} + for ( $i = count( $length ) - 1; ( $i >= 0 ) && ( $no <= 1 ); $i-- ) { + $no = $diff / $length[ $i ]; + } if ( $i < 0 ) { $i = 0; } - if ( $i <= 2 ) { //if posted in last 24 hours + if ( $i <= 2 ) { // if posted in last 24 hours. $_time = $cur_time - ( $diff % $length[ $i ] ); $no = floor( $no ); switch ( $time_unit[ $i ] ) { case 'second': - $time_unit_phrase = _n( '1 second', '%s seconds', $no, 'buddypress-media' ); + // translators: %s: number of seconds. + $time_unit_phrase = _n( '%s second', '%s seconds', $no, 'buddypress-media' ); break; case 'minute': - $time_unit_phrase = _n( '1 minute', '%s minutes', $no, 'buddypress-media' ); + // translators: %s: number of minutes. + $time_unit_phrase = _n( '%s minute', '%s minutes', $no, 'buddypress-media' ); break; case 'hour': - $time_unit_phrase = _n( '1 hour', '%s hours', $no, 'buddypress-media' ); + // translators: %s: number of hours. + $time_unit_phrase = _n( '%s hour', '%s hours', $no, 'buddypress-media' ); break; default: - // should not happen + // should not happen. $time_unit_phrase = '%s unknown'; } @@ -3179,7 +3345,7 @@ function rtmedia_convert_date( $_date ) { return sprintf( $ago_text, $value ); } else { - /* translators: date format, see http://php.net/date */ + // translators: %s: date format, see http://php.net/date. return date_i18n( 'd F Y ', strtotime( $_date ), true ); } @@ -3188,9 +3354,9 @@ function rtmedia_convert_date( $_date ) { /** * Get media counts * - * @global RTMediaQuery $rtmedia_query + * @global RTMediaQuery $rtmedia_query * - * @return array|void + * @return array|void */ function get_media_counts() { @@ -3216,26 +3382,26 @@ function get_media_counts() { /** * Checking if it is rtmedia's edit page * - * @global string $pagenow + * @global string $pagenow * - * @param null $new_edit + * @param null|string $new_edit Edit or new page. * - * @return bool + * @return bool */ function rtmedia_is_edit_page( $new_edit = null ) { global $pagenow; - //make sure we are on the backend + // make sure we are on the backend. if ( ! is_admin() ) { return false; } if ( 'edit' === $new_edit ) { return in_array( $pagenow, array( 'post.php' ), true ); - } elseif ( 'new' === $new_edit ) { //check for new post page + } elseif ( 'new' === $new_edit ) { // check for new post page. return in_array( $pagenow, array( 'post-new.php' ), true ); - } else { //check for either new or edit + } else { // check for either new or edit. return in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ); } @@ -3244,9 +3410,9 @@ function rtmedia_is_edit_page( $new_edit = null ) { /** * Checking if it's a rtmedia page * - * @global object $rtmedia_interaction + * @global object $rtmedia_interaction * - * @return bool + * @return bool */ function is_rtmedia_page() { @@ -3271,9 +3437,9 @@ function is_rtmedia_page() { /** * To be used in migration in importing * - * @param int $seconds_left + * @param int $seconds_left Seconds left in migration. * - * @return string + * @return string */ function rtmedia_migrate_formatseconds( $seconds_left ) { @@ -3320,12 +3486,12 @@ function rtmedia_migrate_formatseconds( $seconds_left ) { } /** - * echo the size of the media file + * Echo the size of the media file * - * @global array $rtmedia_backbone - * @global object $rtmedia_media + * @global array $rtmedia_backbone + * @global object $rtmedia_media * - * @return int + * @return int */ function rtmedia_file_size() { @@ -3348,11 +3514,11 @@ function rtmedia_file_size() { /** * Get rtmedia media type from file extension * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @param string $extn + * @param string $extn media extension. * - * @return bool|int|string + * @return bool|int|string */ function rtmedia_get_media_type_from_extn( $extn ) { @@ -3373,14 +3539,14 @@ function rtmedia_get_media_type_from_extn( $extn ) { /** * Get extension from media id * - * @global object $rtmedia_media + * @global object $rtmedia_media * - * @param bool|int $media_id + * @param bool|int $media_id Media id to get extension. * - * @return bool + * @return bool */ function rtmedia_get_extension( $media_id = false ) { - // If media_id is false then use global media_id + // If media_id is false then use global media_id. if ( ! $media_id ) { global $rtmedia_media; @@ -3391,13 +3557,13 @@ function rtmedia_get_extension( $media_id = false ) { } } - // Getting filename from media id + // Getting filename from media id. $filename = basename( wp_get_attachment_url( $media_id ) ); - // Checking file type of uploaded document + // Checking file type of uploaded document. $file_type = wp_check_filetype( $filename ); - // return the extension of the filename + // return the extension of the filename. return $file_type['ext']; } @@ -3405,9 +3571,9 @@ function rtmedia_get_extension( $media_id = false ) { /** * Function to get permalink for current blog * - * @param string $domain + * @param string $domain current domain. * - * @return string + * @return string */ function rtmedia_get_current_blog_url( $domain ) { @@ -3420,9 +3586,9 @@ function rtmedia_get_current_blog_url( $domain ) { /** * Checking if album is global * - * @param int $album_id + * @param int $album_id Album id to check. * - * @return bool + * @return bool */ function rtmedia_is_global_album( $album_id ) { @@ -3439,10 +3605,10 @@ function rtmedia_is_global_album( $album_id ) { /** * Checking if uploader view is allowed * - * @param bool $allow - * @param string $section + * @param bool $allow Weather uploader view is allowed or not. + * @param string $section Section name, default media_gallery. * - * @return bool + * @return bool */ function rtmedia_is_uploader_view_allowed( $allow, $section = 'media_gallery' ) { @@ -3453,7 +3619,7 @@ function rtmedia_is_uploader_view_allowed( $allow, $section = 'media_gallery' ) /** * Get rtMedia Encoding API Key * - * @return string + * @return string */ function get_rtmedia_encoding_api_key() { @@ -3469,13 +3635,13 @@ function get_rtmedia_encoding_api_key() { * uses 'id' for the primary column. To make WP's functions usable for rtMedia, * we use this filter on 'query' to swap all 'meta_id' with 'id. * - * @param string $q + * @param string $q Query string. * - * @return string + * @return string */ function rtm_filter_metaid_column_name( $q ) { - /* + /** * Replace quoted content with __QUOTE__ to avoid false positives. * This regular expression will match nested quotes. */ @@ -3488,9 +3654,12 @@ function rtm_filter_metaid_column_name( $q ) { // Put quoted content back into the string. if ( ! empty( $quoted_matches[0] ) ) { - for ( $i = 0; $i < count( $quoted_matches[0] ); $i ++ ) { + $count = count( $quoted_matches[0] ); + + for ( $i = 0; $i < $count; $i++ ) { $quote_pos = strpos( $q, '__QUOTE__' ); $q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 ); + $count = count( $quoted_matches[0] ); } } @@ -3501,7 +3670,7 @@ function rtm_filter_metaid_column_name( $q ) { /** * Checking if SCRIPT_DEBUG constant is defined or not * - * @return string + * @return string */ function rtm_get_script_style_suffix() { @@ -3514,11 +3683,11 @@ function rtm_get_script_style_suffix() { /** * To get list of allowed types in rtMedia * - * @since 3.8.16 + * @since 3.8.16 * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return array + * @return array */ function rtmedia_get_allowed_types() { @@ -3534,9 +3703,9 @@ function rtmedia_get_allowed_types() { /** * To get list of allowed upload types in rtMedia * - * @since 3.8.16 + * @since 3.8.16 * - * @return array + * @return array */ function rtmedia_get_allowed_upload_types() { @@ -3555,9 +3724,9 @@ function rtmedia_get_allowed_upload_types() { /** * To get list of allowed upload type name in rtMedia * - * @since 3.8.16 + * @since 3.8.16 * - * @return array + * @return array */ function rtmedia_get_allowed_upload_types_array() { @@ -3571,14 +3740,14 @@ function rtmedia_get_allowed_upload_types_array() { /** * Upload and add media * - * @param array $upload_params + * @param array $upload_params Upload parameters array. * - * @return bool|int + * @return bool|int */ function rtmedia_add_media( $upload_params = array() ) { if ( empty( $upload_params ) ) { - $upload_params = $_POST; // @codingStandardsIgnoreLine + $upload_params = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification } $upload_model = new RTMediaUploadModel(); @@ -3594,10 +3763,10 @@ function rtmedia_add_media( $upload_params = array() ) { /** * Add multiple meta key and value for media. * - * @param int $media_id - * @param string $meta_key_val + * @param int $media_id Media id. + * @param array $meta_key_val Media meta data with values. * - * @return array + * @return array */ function rtmedia_add_multiple_meta( $media_id, $meta_key_val ) { @@ -3618,10 +3787,10 @@ function rtmedia_add_multiple_meta( $media_id, $meta_key_val ) { /** * To get server variable * - * @param string $server_key - * @param string $filter_type + * @param string $server_key Server variable name. + * @param string $filter_type Filter type. * - * @return string + * @return string */ function rtm_get_server_var( $server_key, $filter_type = 'FILTER_SANITIZE_STRING' ) { @@ -3640,10 +3809,10 @@ function rtm_get_server_var( $server_key, $filter_type = 'FILTER_SANITIZE_STRING /** * Check if URL exists of a given media type (i.e mp4, ogg, wmv) * - * @param array $medias - * @param string $media_type + * @param array $medias Media array. + * @param string $media_type Media type. * - * @return bool + * @return bool */ function rtt_is_video_exists( $medias, $media_type = 'mp4' ) { @@ -3656,17 +3825,15 @@ function rtt_is_video_exists( $medias, $media_type = 'mp4' ) { } } - /** * Send the request to the rtmedia server for addon license validation * and activation * * @since 4.2 * - * @param array $addon Array containing the license_key, addon_id - * and addon name + * @param array $addon Array containing the license_key, addon_id and addon name. * - * @return obejct|boolean Addon license data/status from server or the false on error + * @return obejct|boolean Addon license data/status from server or the false on error */ function rtmedia_activate_addon_license( $addon = array() ) { @@ -3682,105 +3849,134 @@ function rtmedia_activate_addon_license( $addon = array() ) { return false; } - $license = $addon['args']['license_key']; + $license = $addon['args']['license_key']; $addon_name = $addon['name']; - $addon_id = $addon['args']['addon_id']; + $addon_id = $addon['args']['addon_id']; $store_url = ''; if ( defined( 'EDD_' . strtoupper( $addon_id ) . '_STORE_URL' ) ) { - // Get the store URL from the constant defined in the addon - $store_url = constant( 'EDD_' . strtoupper( $addon_id ) . '_STORE_URL' ); + // Get the store URL from the constant defined in the addon. + $store_url = constant( 'EDD_' . strtoupper( $addon_id ) . '_STORE_URL' ); } - // If store URL not found in the addon, use the default store URL + // If store URL not found in the addon, use the default store URL. if ( empty( $store_url ) ) { $store_url = 'https://rtmedia.io/'; } - // data to send in our API request + // data to send in our API request. $api_params = array( 'edd_action' => 'activate_license', 'license' => $license, - 'item_name' => urlencode( $addon_name ), // the name of our product in EDD + 'item_name' => rawurlencode( $addon_name ), // the name of our product in EDD. 'url' => home_url(), ); // Call the custom API. - $response = wp_remote_get( esc_url_raw( add_query_arg( $api_params, $store_url ) ), array( 'timeout' => 15, 'sslverify' => false ) ); + $response = wp_remote_get( + esc_url_raw( add_query_arg( $api_params, $store_url ) ), + array( + 'timeout' => 15, + 'sslverify' => false, + ) + ); - // make sure the response came back okay + // make sure the response came back okay. if ( is_wp_error( $response ) ) { return false; } - // decode the license data + // decode the license data. $license_data = json_decode( wp_remote_retrieve_body( $response ) ); return $license_data; } +/** + * Filter comment with allowed html. + * + * @param string $comment_content Comment content. + * @param array $allowedtags Allowed html tags. + * + * @return string + */ +function rtmedia_wp_kses_of_buddypress( $comment_content, $allowedtags ) { - - -function rtmedia_wp_kses_of_buddypress( $comment_content, $allowedtags ){ - if( function_exists( 'bp_activity_filter_kses' ) ){ + if ( function_exists( 'bp_activity_filter_kses' ) ) { $comment_string = bp_activity_filter_kses( $comment_content, $allowedtags ); - }else{ + } else { $comment_string = wp_kses( $comment_content, $allowedtags ); } + return $comment_string; } - -/* - * is media is uploaded in the comment +/** + * If media is uploaded in the comment * parameter media_id int * return true/false value -*/ -function rtmedia_is_comment_media( $rtmedia_id ){ + * + * @param int $rtmedia_id media id. + * + * @return bool + */ +function rtmedia_is_comment_media( $rtmedia_id ) { return get_rtmedia_meta( $rtmedia_id, 'rtmedia_comment_media' ); } - - -function rtmedia_is_comment_media_single_page( $rtmedia_id ){ +/** + * Check if provided media is comment media. + * + * @param int $rtmedia_id media id. + * + * @return bool + */ +function rtmedia_is_comment_media_single_page( $rtmedia_id ) { $comment_media = false; global $rtmedia; - /* check if the reply in comment media is not allow */ - if( $rtmedia_id && ! rtmedia_check_comment_in_commented_media_allow() ){ + + // check if the reply in comment media is not allow. + if ( $rtmedia_id && ! rtmedia_check_comment_in_commented_media_allow() ) { $comment_media = rtmedia_is_comment_media( $rtmedia_id ); } + return $comment_media; } - +/** + * Get activity conversation of media. + * + * @param int $activity_id Activity id. + */ function rtmedia_view_conversation_of_media( $activity_id ) { if ( function_exists( 'bp_activity_get_permalink' ) ) { ?> - - + + $media_id, ); return get_comments( $args ); } - /** * Check if comment are allow in Media that are being add in the comment section. * @@ -3791,16 +3987,13 @@ function rtmedia_get_comments_details_for_media_id( $media_id ){ function rtmedia_check_comment_in_commented_media_allow() { $value = false; global $rtmedia; - /* variable */ + // variable. if ( isset( $rtmedia->options ) && isset( $rtmedia->options['rtmedia_disable_media_in_commented_media'] ) && 0 === $rtmedia->options['rtmedia_disable_media_in_commented_media'] ) { $value = true; } return $value; } - - - /** * Check if comment in media is allow or not. * @@ -3811,33 +4004,33 @@ function rtmedia_check_comment_in_commented_media_allow() { function rtmedia_check_comment_media_allow() { $value = false; global $rtmedia; - /* variable */ - if ( ( isset( $rtmedia->options ) && isset( $rtmedia->options['buddypress_enableOnComment'] ) && 1 == $rtmedia->options['buddypress_enableOnComment'] ) || ! isset( $rtmedia->options['buddypress_enableOnComment'] ) ) { + // variable. + if ( ( isset( $rtmedia->options ) && isset( $rtmedia->options['buddypress_enableOnComment'] ) && 1 === intval( $rtmedia->options['buddypress_enableOnComment'] ) ) || ! isset( $rtmedia->options['buddypress_enableOnComment'] ) ) { $value = true; } return $value; } - /** - * Get the Original Content from the $_REQUEST + * Get the Original Content from the POST * * @return string */ function rtmedia_get_original_comment_media_content() { $old_content = ' '; - /* get the original contant from the $REQUEST */ - if ( isset( $_REQUEST['content'] ) ) { - $old_content = $_REQUEST['content']; + // get the original content from the POST. + $content = sanitize_text_field( filter_input( INPUT_POST, 'content', FILTER_SANITIZE_STRING ) ); + if ( ! empty( $content ) ) { + $old_content = $content; } - if ( isset( $_REQUEST['comment_content'] ) ) { - $old_content = $_REQUEST['comment_content']; + $comment = sanitize_text_field( filter_input( INPUT_POST, 'comment_content', FILTER_SANITIZE_STRING ) ); + if ( ! empty( $comment ) ) { + $old_content = $comment; } - - /* is comment is empty then add content content space */ + // is comment is empty then add content content space. if ( strstr( $old_content, 'nbsp' ) ) { $old_content = ' '; } @@ -3845,50 +4038,58 @@ function rtmedia_get_original_comment_media_content() { return sanitize_text_field( $old_content ); } - - /** * Will alter the rtMedia query and remove the comment media from it * - * parameter $where string rtMedia query where conditions - * parameter $table_name string rtMedia query table name - * parameter $join string + * @param string $where rtMedia query where conditions. + * @param string $table_name rtMedia query table name. + * @param string $join join clause. * - * return string of rtMedia query where conditions -*/ + * @return string of rtMedia query where conditions + */ function rtmedia_query_where_filter_remove_comment_media( $where, $table_name, $join ) { $where .= ' AND ' . $table_name . '.context NOT LIKE ( "comment-media" ) '; return $where; } - - - - -function rtmedia_bp_activity_entry_comments_callback(){ +/** + * Function to show activities. + */ +function rtmedia_bp_activity_entry_comments_callback() { global $activities_template; - /* comment media activity is created so media is not allow */ + // comment media activity is created so media is not allow. $allow_media_activity_type = array( 'rtmedia_comment_activity', 'rtmedia_like_activity' ); - $allow_media_activity_type = apply_filters( 'rtmedia_not_allow_comment_media_in_activity_type' , $allow_media_activity_type ); + $allow_media_activity_type = apply_filters( 'rtmedia_not_allow_comment_media_in_activity_type', $allow_media_activity_type ); - /* parent activity id */ + // parent activity id. $activity_id = bp_get_activity_id(); - /* if activity id is not empty and the type is not as $allow_media_activity_type */ - if( $activity_id && isset( $activities_template->activity ) && isset( $activities_template->activity->type ) && ! in_array( $activities_template->activity->type , $allow_media_activity_type ) ){ + // if activity id is not empty and the type is not as $allow_media_activity_type. + if ( $activity_id && isset( $activities_template->activity ) && isset( $activities_template->activity->type ) && ! in_array( $activities_template->activity->type, $allow_media_activity_type, true ) ) { add_action( 'before_rtmedia_comment_uploader_display', 'rtmedia_before_rtmedia_comment_uploader_display_callback', 10 ); - echo rtmedia_bp_activity_entry_comments_id_callback( $activity_id, 'activity', $activities_template->activity->component ); + echo wp_kses( rtmedia_bp_activity_entry_comments_id_callback( $activity_id, 'activity', $activities_template->activity->component ), RTMedia::expanded_allowed_tags() ); remove_action( 'before_rtmedia_comment_uploader_display', 'rtmedia_before_rtmedia_comment_uploader_display_callback', 10 ); } } - -function rtmedia_before_rtmedia_comment_uploader_display_callback( $flag ){ +/** + * Display comment uploader or not. + * + * @param bool $flag Flag to show uploader. + * + * @return bool + */ +function rtmedia_before_rtmedia_comment_uploader_display_callback( $flag ) { + // todo:remove if not used. return true; } +/** + * Enable media upload in comments. + */ function rtmedia_enable_comment_media_uplaod() { + global $rtmedia; $comment_media = false; @@ -3901,25 +4102,34 @@ function rtmedia_enable_comment_media_uplaod() { } if ( $comment_media ) { - /* - * Add Comment Media in rtMedia Popup - */ + + // Add Comment Media in rtMedia Popup. add_action( 'rtmedia_add_comments_extra', 'rtmedia_add_comments_extra_callback', 10 ); - /* - * Add Media Upload in Activity - */ + // Add Media Upload in Activity. add_action( 'bp_activity_entry_comments', 'rtmedia_bp_activity_entry_comments_callback', 10 ); } } -function rtmedia_bp_activity_entry_comments_id_callback( $id, $type, $context = "activity" ) { - if( class_exists( 'RTMediaComment' ) ){ - /*add media in comment*/ +/** + * Function to upload media in comment. + * + * @param int $id Media id. + * @param string $type Type of media. + * @param string $context Media content. + * + * @return string|void + */ +function rtmedia_bp_activity_entry_comments_id_callback( $id, $type, $context = 'activity' ) { + if ( class_exists( 'RTMediaComment' ) ) { + // add media in comment. return RTMediaComment::add_uplaod_media_button( $id, $type, $context ); } } +/** + * Add extra button in comments. + */ function rtmedia_add_comments_extra_callback() { global $rtmedia_media; $context = 'activity'; @@ -3927,67 +4137,80 @@ function rtmedia_add_comments_extra_callback() { if ( is_array( $rtmedia_media->context ) ) { $context = $rtmedia_media->context; } + $rtmedia_id = rtmedia_id(); if ( $rtmedia_id ) { - echo rtmedia_bp_activity_entry_comments_id_callback( $rtmedia_id, 'rtmedia', $context ); + echo wp_kses( rtmedia_bp_activity_entry_comments_id_callback( $rtmedia_id, 'rtmedia', $context ), RTMedia::expanded_allowed_tags() ); } } -/** - * check if the show desc in album gallery setting is set or not - * @return boolean if the general is enable then return true or else false - */ if ( ! function_exists( 'rtmedia_get_album_description_setting' ) ) { + + /** + * Check if the show desc in album gallery setting is set or not + * + * @return boolean if the general is enable then return true or else false + */ function rtmedia_get_album_description_setting() { $return = false; global $rtmedia; - if ( isset( $rtmedia->options ) && isset( $rtmedia->options['general_enableAlbums_description'] ) && 1 == intval( $rtmedia->options['general_enableAlbums_description'] ) ) { + + if ( isset( $rtmedia->options ) && isset( $rtmedia->options['general_enableAlbums_description'] ) && 1 === intval( $rtmedia->options['general_enableAlbums_description'] ) ) { $return = true; } return $return; } } - if ( ! function_exists( 'rtmedia_hide_title_media_gallery' ) ) { + + /** + * Hides title of media gallery. + * + * @param bool|string $media_type Media type to check. + * + * @return string + */ function rtmedia_hide_title_media_gallery( $media_type = false ) { + global $rtmedia_query; // Check if the page is gallery shortcode or not. $is_gallery_shortcode = ( isset( $rtmedia_query->is_gallery_shortcode ) && true === $rtmedia_query->is_gallery_shortcode ) ? true : false; - $return = 'hide'; - $media_type_allow = array(); - $media_type_allow = apply_filters( 'rtmedia_show_title_media_gallery', $media_type_allow ); + $return = 'hide'; + $media_type_allow = array(); + $media_type_allow = apply_filters( 'rtmedia_show_title_media_gallery', $media_type_allow ); if ( ! is_array( $media_type_allow ) ) { $media_type_allow = array(); } // Set this class for allowed media type and gallery shortcode. - if ( ( is_array( $media_type_allow ) && ! empty( $media_type ) && in_array( $media_type, $media_type_allow ) ) || ( true === $is_gallery_shortcode ) ) { + if ( ( is_array( $media_type_allow ) && ! empty( $media_type ) && in_array( $media_type, $media_type_allow, true ) ) || ( true === $is_gallery_shortcode ) ) { $return = 'show'; } + return $return; } } - -/** - * echo the title of the media - * - * @global array $rtmedia_backbone - * - * @return string - */ if ( ! function_exists( 'rtmedia_show_title' ) ) { + + /** + * Echo the title of the media + * + * @global array $rtmedia_backbone + * + * @return string + */ function rtmedia_show_title() { global $rtmedia_backbone; if ( ! empty( $rtmedia_backbone['backbone'] ) ) { - $media_title = filter_input( INPUT_POST, 'media_title', FILTER_SANITIZE_STRING ); + $media_title = sanitize_text_field( filter_input( INPUT_POST, 'media_title', FILTER_SANITIZE_STRING ) ); if ( empty( $media_title ) ) { - $media_title = filter_input( INPUT_GET, 'media_title', FILTER_SANITIZE_STRING ); + $media_title = sanitize_text_field( filter_input( INPUT_GET, 'media_title', FILTER_SANITIZE_STRING ) ); } if ( empty( $media_title ) || 'false' === $media_title ) { return 'hide'; @@ -3996,8 +4219,10 @@ function rtmedia_show_title() { return 'show'; } else { + global $rtmedia_media; $media_class = 'hide'; + if ( isset( $rtmedia_media->media_type ) && function_exists( 'rtmedia_hide_title_media_gallery' ) ) { $media_class = rtmedia_hide_title_media_gallery( $rtmedia_media->media_type ); } @@ -4009,8 +4234,9 @@ function rtmedia_show_title() { /** * Fetch user as per keyword. * - * @param [string] $user - * @return [string] $user_id + * @param string $user User keyword. + * + * @return string */ function rtm_select_user( $user ) { $user_ids = array(); @@ -4025,7 +4251,6 @@ function rtm_select_user( $user ) { } } - $user_id = implode( ',', $user_ids ); return $user_id; } @@ -4036,7 +4261,9 @@ function rtm_select_user( $user ) { * @author Yahil * * @since 4.4 - * @param string $type user member type string + * + * @param string $type user member type string. + * * @return string $member_id */ function rtm_fetch_user_by_member_type( $type ) { @@ -4047,7 +4274,7 @@ function rtm_fetch_user_by_member_type( $type ) { if ( ! empty( $type ) ) { $member_args = array( - 'member_type' => array( $type ), + 'member_type' => array( $type ), ); if ( rtm_is_buddypress_activate() && bp_has_members( $member_args ) ) { @@ -4065,13 +4292,13 @@ function rtm_fetch_user_by_member_type( $type ) { } /** - * Check member type set or not. - * - * @author Yahil - * - * @since 4.4 - * @return bool - */ + * Check member type set or not. + * + * @author Yahil + * + * @since 4.4 + * @return bool + */ function rtm_check_member_type() { $status = false; @@ -4087,12 +4314,13 @@ function rtm_check_member_type() { return $status; } + /** * Checking if media search option are enabled * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function rtmedia_media_search_enabled() { @@ -4106,7 +4334,6 @@ function rtmedia_media_search_enabled() { } /** - * * Will Check that if the BuddyPress plugin is activated or not. * * @return bool True if BuddyPress is activated or else False. @@ -4114,7 +4341,7 @@ function rtmedia_media_search_enabled() { function rtm_is_buddypress_activate() { // check if is_plugin_active exists or not. if ( ! function_exists( 'is_plugin_active' ) ) { - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); + require_once ABSPATH . 'wp-admin/includes/plugin.php'; } return is_plugin_active( 'buddypress/bp-loader.php' ); @@ -4123,8 +4350,9 @@ function rtm_is_buddypress_activate() { /** * Get the uploader url for uploading media. * - * @param url $request_uri sub url of current page. - * @return url URL of uploader. + * @param string $request_uri sub url of current page. + * + * @return string URL of uploader. */ function rtmedia_get_upload_url( $request_uri ) { @@ -4133,15 +4361,21 @@ function rtmedia_get_upload_url( $request_uri ) { $slug_split = array_values( array_filter( $slug_split ) ); $rtmedia_slug = '/' . RTMEDIA_MEDIA_SLUG; $slug_pos = strrpos( $url, $rtmedia_slug ); + // check position of media slug for end of the URL. if ( is_array( $slug_split ) && ! empty( $slug_split ) && false !== $slug_pos ) { + // replace media slug with the blank space. - $url_upload = substr( $url, 0, $slug_pos ); - $url = trailingslashit( $url_upload ) . 'upload/'; + $url_upload = substr( $url, 0, $slug_pos ); + $url = trailingslashit( $url_upload ) . 'upload/'; + } else { + // If url contains '?' then put query string at last. if ( strstr( $url, '?' ) ) { + $url_arr = explode( '?', $url ); + if ( is_array( $url_arr ) && ! empty( $url_arr ) && count( $url_arr ) > 1 ) { $sub_url = isset( $url_arr[0] ) ? $url_arr[0] : ''; $query_string = isset( $url_arr[1] ) ? $url_arr[1] : ''; @@ -4158,9 +4392,9 @@ function rtmedia_get_upload_url( $request_uri ) { /** * Checking if document upload is enabled. * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_upload_document_enabled() { @@ -4176,9 +4410,9 @@ function is_rtmedia_upload_document_enabled() { /** * Checking if other media upload is enabled. * - * @global RTMedia $rtmedia + * @global RTMedia $rtmedia * - * @return bool + * @return bool */ function is_rtmedia_upload_other_enabled() { @@ -4195,6 +4429,7 @@ function is_rtmedia_upload_other_enabled() { * Format a number to human readable format. * * @param Integer $n Number to be formatted. + * * @return String Return format a number to human readable format. */ function rtmedia_number_to_human_readable( $n ) { @@ -4214,8 +4449,8 @@ function rtmedia_number_to_human_readable( $n ) { /** * Activity exporter with attachments for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. * * @return array */ @@ -4251,19 +4486,19 @@ function rtmedia_activity_exporter( $email_address, $page = 1 ) { global $wpdb; - $query = $wpdb->prepare( - 'SELECT * FROM ' . $wpdb->prefix . "bp_activity WHERE user_id=%d and type='rtmedia_update' LIMIT %d OFFSET %d", - $user_id, - $number, - $number * ( $page - 1 ) - ); - $activities_args = array( $user_id, $number, $page ); $activities_cache_key = md5( wp_json_encode( $activities_args ) ); $activities = wp_cache_get( $activities_cache_key, 'activity_exporter' ); if ( false === $activities ) { - $activities = $wpdb->get_results( $query ); + $activities = $wpdb->get_results( + $wpdb->prepare( + 'SELECT * FROM ' . $wpdb->prefix . "bp_activity WHERE user_id=%d and type='rtmedia_update' LIMIT %d OFFSET %d", + $user_id, + $number, + $number * ( $page - 1 ) + ) + ); wp_cache_set( $activities_cache_key, $activities, 'activity_exporter', 300 ); } @@ -4276,8 +4511,6 @@ function rtmedia_activity_exporter( $email_address, $page = 1 ) { $group_id = 'activity'; $group_label = esc_html__( 'rtMedia Activities', 'buddypress-media' ); - $query = $wpdb->prepare( 'SELECT media_id, media_title FROM ' . $wpdb->prefix . 'rt_rtm_media WHERE activity_id=%d', $activity_id ); - $activity_args = array( $user_id, $activity_id ); $activity_cache_key = md5( wp_json_encode( $activity_args ) ); $activity_count_args = array( $user_id, $activity_id, 'count' ); @@ -4286,7 +4519,7 @@ function rtmedia_activity_exporter( $email_address, $page = 1 ) { $activity_count = wp_cache_get( $activity_count_key, 'activity_exporter' ); if ( false === $activity_results || false === $activity_count ) { - $activity_results = $wpdb->get_results( $query ); + $activity_results = $wpdb->get_results( $wpdb->prepare( 'SELECT media_id, media_title FROM ' . $wpdb->prefix . 'rt_rtm_media WHERE activity_id=%d', $activity_id ) ); $activity_count = $wpdb->num_rows; wp_cache_set( $activity_cache_key, $activity_results, 'activity_exporter', 300 ); @@ -4330,12 +4563,11 @@ function rtmedia_activity_exporter( $email_address, $page = 1 ) { ); } - /** * Shortcode upload exporter with for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. * * @return array */ @@ -4370,12 +4602,6 @@ function rtmedia_shortcode_upload_exporter( $email_address, $page = 1 ) { global $wpdb; - $query = $wpdb->prepare( 'SELECT media.media_id, media.media_title, media.upload_date, album.media_title AS album_title FROM ' . $wpdb->prefix . 'rt_rtm_media AS media, ' . $wpdb->prefix . 'rt_rtm_media AS album WHERE media.album_id=album.id AND media.activity_id=0 AND media.media_author=%d LIMIT %d OFFSET %d', - $user_id, - $number, - $number * ( $page - 1 ) - ); - $upload_args = array( $user_id, $number, $page ); $upload_cache_key = md5( wp_json_encode( $upload_args ) ); $media_count_args = array( $user_id, $number, $page, 'count' ); @@ -4384,7 +4610,14 @@ function rtmedia_shortcode_upload_exporter( $email_address, $page = 1 ) { $media_count = wp_cache_get( $media_count_key, 'upload_exporter' ); if ( false === $media || false === $media_count ) { - $media = $wpdb->get_results( $query ); + $media = $wpdb->get_results( + $wpdb->prepare( + 'SELECT media.media_id, media.media_title, media.upload_date, album.media_title AS album_title FROM ' . $wpdb->prefix . 'rt_rtm_media AS media, ' . $wpdb->prefix . 'rt_rtm_media AS album WHERE media.album_id=album.id AND media.activity_id=0 AND media.media_author=%d LIMIT %d OFFSET %d', + $user_id, + $number, + $number * ( $page - 1 ) + ) + ); $media_count = $wpdb->num_rows; wp_cache_set( $upload_cache_key, $media, 'upload_exporter', 300 ); @@ -4411,7 +4644,7 @@ function rtmedia_shortcode_upload_exporter( $email_address, $page = 1 ) { 'value' => $media_title, ), array( - 'name' => __( 'Media URL', 'buddypress-media' ), + 'name' => esc_html__( 'Media URL', 'buddypress-media' ), 'value' => $media_url, ), array( @@ -4438,8 +4671,8 @@ function rtmedia_shortcode_upload_exporter( $email_address, $page = 1 ) { /** * Activity Comment exporter with attachments for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. * * @return array */ @@ -4474,13 +4707,6 @@ function rtmedia_activity_comments_exporter( $email_address, $page = 1 ) { global $wpdb; - $query = $wpdb->prepare( - 'SELECT * FROM ' . $wpdb->prefix . "bp_activity WHERE user_id=%d and type='activity_comment' LIMIT %d OFFSET %d", - $user_id, - $number, - $number * ( $page - 1 ) - ); - $activity_comment_args = array( $user_id, $number, $page ); $activity_comment_cache_key = md5( wp_json_encode( $activity_comment_args ) ); $comment_count_args = array( $user_id, $number, $page, 'count' ); @@ -4489,7 +4715,14 @@ function rtmedia_activity_comments_exporter( $email_address, $page = 1 ) { $comments = wp_cache_get( $activity_comment_cache_key, 'comments_exporter' ); if ( false === $comments || false === $comment_count ) { - $comments = $wpdb->get_results( $query ); + $comments = $wpdb->get_results( + $wpdb->prepare( + 'SELECT * FROM ' . $wpdb->prefix . "bp_activity WHERE user_id=%d and type='activity_comment' LIMIT %d OFFSET %d", + $user_id, + $number, + $number * ( $page - 1 ) + ) + ); $comment_count = $wpdb->num_rows; wp_cache_set( $activity_comment_cache_key, $comments, 'comments_exporter', 300 ); @@ -4505,14 +4738,12 @@ function rtmedia_activity_comments_exporter( $email_address, $page = 1 ) { $group_id = 'activity-comment'; $group_label = esc_html__( 'rtMedia Activity Comments', 'buddypress-media' ); - $query = $wpdb->prepare( 'SELECT media_id, media_title FROM ' . $wpdb->prefix . 'rt_rtm_media WHERE activity_id=%d', $comment_id ); - $comment_args = array( $user_id, $comment_id ); $comment_cache_key = md5( wp_json_encode( $comment_args ) ); $comment_results = wp_cache_get( $comment_cache_key, 'comments_exporter' ); if ( false === $comment_results ) { - $comment_results = $wpdb->get_results( $query ); + $comment_results = $wpdb->get_results( $wpdb->prepare( 'SELECT media_id, media_title FROM ' . $wpdb->prefix . 'rt_rtm_media WHERE activity_id=%d', $comment_id ) ); wp_cache_set( $comment_cache_key, $comment_results, 'comments_exporter', 300 ); } @@ -4557,8 +4788,8 @@ function rtmedia_activity_comments_exporter( $email_address, $page = 1 ) { /** * Media view exporter for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. * * @return array */ @@ -4608,7 +4839,7 @@ function rtmedia_media_view_exporter( $email_address, $page = 1 ) { $views = wp_cache_get( $view_cache_key, 'view_exporter' ); if ( false === $views || false === $view_count ) { - $views = $wpdb->get_results( $query ); + $views = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $view_count = $wpdb->num_rows; wp_cache_set( $view_cache_key, $views, 'view_exporter', 300 ); @@ -4616,6 +4847,7 @@ function rtmedia_media_view_exporter( $email_address, $page = 1 ) { } foreach ( $views as $view ) { + $no_of_views = $view->value; $first_view_date = $view->action_date; $item_id = 'media-view' . $view->id; @@ -4658,8 +4890,8 @@ function rtmedia_media_view_exporter( $email_address, $page = 1 ) { /** * Media Like exporter with attachments for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. * * @return array */ @@ -4709,7 +4941,7 @@ function rtmedia_media_like_exporter( $email_address, $page = 1 ) { $likes = wp_cache_get( $likes_cache_key, 'like_exporter' ); if ( false === $likes || false === $like_count ) { - $likes = $wpdb->get_results( $query ); + $likes = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $like_count = $wpdb->num_rows; wp_cache_set( $likes_cache_key, $likes, 'like_exporter', 300 ); @@ -4756,8 +4988,8 @@ function rtmedia_media_like_exporter( $email_address, $page = 1 ) { /** * Media eraser for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. * * @return array */ @@ -4790,7 +5022,7 @@ function rtmedia_eraser( $email_address, $page = 1 ) { $number * ( $page - 1 ) ); - $media_ids = $wpdb->get_col( $query ); + $media_ids = $wpdb->get_col( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared foreach ( $media_ids as $media_id ) { @@ -4813,8 +5045,9 @@ function rtmedia_eraser( $email_address, $page = 1 ) { /** * Media album eraser for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. + * * @return array */ function rtmedia_album_eraser( $email_address, $page = 1 ) { @@ -4842,15 +5075,18 @@ function rtmedia_album_eraser( $email_address, $page = 1 ) { $default_albums = rtmedia_global_albums(); $default_album_str = ''; $default_album_postid_str = ''; + foreach ( $default_albums as $default_album ) { $default_album_str .= $default_album . ','; $default_album_postid_str .= rtmedia_media_id( $default_album ) . ','; } + $default_album_str = rtrim( $default_album_str, ',' ); $default_album_postid_str = rtrim( $default_album_postid_str, ',' ); + // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared $query = $wpdb->prepare( - 'DELETE FROM ' . $wpdb->prefix . "rt_rtm_media WHERE media_type='album' AND media_author=%d AND id NOT IN (" . $default_album_str . ") LIMIT %d", + 'DELETE FROM ' . $wpdb->prefix . "rt_rtm_media WHERE media_type='album' AND media_author=%d AND id NOT IN (" . $default_album_str . ') LIMIT %d', $user_data->ID, $number ); @@ -4858,13 +5094,13 @@ function rtmedia_album_eraser( $email_address, $page = 1 ) { $items_removed = $wpdb->query( $query ); $query = $wpdb->prepare( - 'DELETE FROM ' . $wpdb->prefix . "posts WHERE post_type='rtmedia_album' AND post_author=%d AND ID NOT IN (" . $default_album_postid_str . ") LIMIT %d", + 'DELETE FROM ' . $wpdb->prefix . "posts WHERE post_type='rtmedia_album' AND post_author=%d AND ID NOT IN (" . $default_album_postid_str . ') LIMIT %d', $user_data->ID, $number ); $items_removed += $wpdb->query( $query ); - + // phpcs:enable WordPress.DB.PreparedSQL.NotPrepared $done = ( $items_removed < $number ); return array( @@ -4875,12 +5111,12 @@ function rtmedia_album_eraser( $email_address, $page = 1 ) { ); } - /** * Media like eraser for GDPR * - * @param string $email_address user email address. - * @param int $page page no to fetch data from. + * @param string $email_address user email address. + * @param int $page page no to fetch data from. + * * @return array */ function rtmedia_like_eraser( $email_address, $page = 1 ) { @@ -4911,7 +5147,7 @@ function rtmedia_like_eraser( $email_address, $page = 1 ) { $number ); - $items_removed = $wpdb->query( $query ); + $items_removed = $wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $done = ( $items_removed < $number ); diff --git a/app/main/controllers/upload/RTMediaUpload.php b/app/main/controllers/upload/RTMediaUpload.php index ec6015ef2..804331f5b 100755 --- a/app/main/controllers/upload/RTMediaUpload.php +++ b/app/main/controllers/upload/RTMediaUpload.php @@ -1,18 +1,50 @@ array( - 'id' => array(), - 'href' => array(), + 'id' => array(), + 'href' => array(), 'target' => array(), ), 'p' => array(), ); /** + * RTMediaUpload constructor. * - * @param array $uploaded - * + * @param array $uploaded Uploaded media details. */ public function __construct( $uploaded ) { /** - * prepare to upload a file + * Prepare to upload a file */ $this->file = new RTMediaUploadFile( $uploaded ); + /** - * prepare to upload a url + * Prepare to upload a url */ $this->url = new RTMediaUploadUrl(); + /** - * prepare media object to populate the album + * Prepare media object to populate the album */ $this->media = new RTMediaMedia(); /** - * upload the intity according to the mode of request + * Upload the entity according to the mode of request * either file_upload or link_input */ $file_object = $this->upload( $uploaded ); /** - * if upload successful then populate the rtMedia database and insert the media into album + * If upload successful then populate the rtMedia database and insert the media into album */ if ( ! is_wp_error( $file_object ) && $file_object && $uploaded ) { + $this->media_ids = $this->media->add( $uploaded, $file_object ); do_action( 'rtemdia_after_file_upload_before_activity', $file_object, $this ); + if ( $this->media_ids ) { return true; } else { @@ -70,13 +106,14 @@ public function __construct( $uploaded ) { } /** - * upload a file or a link input + * Upload a file or a link input * - * @param type $uploaded + * @param array $uploaded Uploaded media details. * - * @return type + * @return mixed */ - function upload( $uploaded ) { + public function upload( $uploaded ) { + switch ( $uploaded['mode'] ) { case 'file_upload': if ( isset( $uploaded['files'] ) ) { @@ -85,7 +122,6 @@ function upload( $uploaded ) { break; case 'link_input': return $this->url->init( $uploaded ); - break; default: do_action( 'rtmedia_upload_' . $uploaded['mode'], $uploaded ); } diff --git a/app/main/controllers/upload/RTMediaUploadEndpoint.php b/app/main/controllers/upload/RTMediaUploadEndpoint.php index d4e6bf3f6..d276e6998 100755 --- a/app/main/controllers/upload/RTMediaUploadEndpoint.php +++ b/app/main/controllers/upload/RTMediaUploadEndpoint.php @@ -1,85 +1,118 @@ */ + +/** + * Class to handle media upload endpoint. + */ class RTMediaUploadEndpoint { + /** + * Uploaded media details. + * + * @var array + */ public $upload; /** - * + * RTMediaUploadEndpoint constructor. */ public function __construct() { add_action( 'rtmedia_upload_redirect', array( $this, 'template_redirect' ) ); } /** + * Handles media upload redirection. * + * @param bool $create_activity If create activity or not. + * + * @return array|bool */ - // todo refactor below function so it takes param also and use if passed else use POST request - function template_redirect( $create_activity = true ) { + public function template_redirect( $create_activity = true ) { + // todo refactor below function so it takes param also and use if passed else use POST request. ob_start(); - if ( ! count( $_POST ) ) { // @codingStandardsIgnoreLine + if ( ! count( $_POST ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification include get_404_template(); } else { - $nonce = $mode = ''; - $_activity_id = - 1; - if ( isset( $_REQUEST['rtmedia_upload_nonce'] ) ) { - $nonce = sanitize_text_field( wp_unslash( $_REQUEST['rtmedia_upload_nonce'] ) ); - } - if ( isset( $_REQUEST['mode'] ) ) { - $mode = sanitize_text_field( wp_unslash( $_REQUEST['mode'] ) ); - } + $nonce = sanitize_text_field( wp_unslash( filter_input( INPUT_POST, 'rtmedia_upload_nonce', FILTER_SANITIZE_STRING ) ) ); + $mode = sanitize_text_field( wp_unslash( filter_input( INPUT_POST, 'mode', FILTER_SANITIZE_STRING ) ) ); + $_redirection = sanitize_text_field( wp_unslash( filter_input( INPUT_POST, 'redirection', FILTER_SANITIZE_STRING ) ) ); + $_redirect = sanitize_text_field( wp_unslash( filter_input( INPUT_POST, 'redirect', FILTER_SANITIZE_STRING ) ) ); + $_activity_id = filter_input( INPUT_POST, 'activity_id', FILTER_VALIDATE_INT ); + $_redirect_url = filter_input( INPUT_POST, 'redirect', FILTER_SANITIZE_NUMBER_INT ); - if ( isset( $_REQUEST['activity_id'] ) ) { - $_activity_id = sanitize_text_field( $_REQUEST['activity_id'] ); - } + global $rtmedia; + + // When activity upload terms are enabled on activity page, we check whether someone has removed the html element or not. + if ( ! empty( $rtmedia->options['activity_enable_upload_terms'] ) ) { - if ( isset( $_REQUEST['redirection'] ) ) { - $_redirection = sanitize_text_field( $_REQUEST['redirection'] ); + // When media comment is uploaded, comment_media_activity_id will be there, so we check if it's not there. + $activity_request = wp_unslash( filter_input( INPUT_POST, 'activity_terms_condition_request', FILTER_SANITIZE_STRING ) ); + if ( ! empty( $activity_request ) ) { + $terms_condition = wp_unslash( filter_input( INPUT_POST, 'activity_terms_condition', FILTER_SANITIZE_STRING ) ); + if ( empty( $terms_condition ) ) { + // This will be uploaded by JavaScript only so we send json response. + wp_send_json_error( esc_html__( 'Terms and Conditions checkbox not found!', 'buddypress-media' ) ); + } + } } - if ( isset( $_REQUEST['redirect'] ) ) { - $_redirect = sanitize_text_field( $_REQUEST['redirect'] ); + // When activity upload terms are enabled on media upload page, we check whether someone has removed the html element or not. + if ( ! empty( $rtmedia->options['general_enable_upload_terms'] ) ) { + + $uploader_request = wp_unslash( filter_input( INPUT_POST, 'uploader_terms_condition_request', FILTER_SANITIZE_STRING ) ); + // We check for all other contexts, group and profile is checked above. + if ( ! empty( $uploader_request ) ) { + $terms_condition = wp_unslash( filter_input( INPUT_POST, 'uploader_terms_condition', FILTER_SANITIZE_STRING ) ); + if ( empty( $terms_condition ) ) { + // This will be uploaded by JavaScript only so we send json response. + wp_send_json_error( esc_html__( 'Terms and Conditions checkbox not found!', 'buddypress-media' ) ); + } + } } - $_redirect_url = filter_input( INPUT_POST, 'redirect', FILTER_SANITIZE_NUMBER_INT ); - $rtupload = false; - $activity_id = - 1; - $redirect_url = ''; + $rtupload = false; + $activity_id = - 1; + $redirect_url = ''; + $permalink = ''; + $thumb_image = ''; + if ( wp_verify_nonce( $nonce, 'rtmedia_upload_nonce' ) ) { $model = new RTMediaUploadModel(); do_action( 'rtmedia_upload_set_post_object' ); $this->upload = $model->set_post_object(); - if ( - 1 !== $_activity_id ) { + + if ( -1 !== $_activity_id ) { $this->upload['activity_id'] = $_activity_id; $activity_id = $_activity_id; } - //if media upload is being made for a group, identify the group privacy and set media privacy accordingly + // if media upload is being made for a group, identify the group privacy and set media privacy accordingly. if ( isset( $this->upload['context'] ) && isset( $this->upload['context_id'] ) && 'group' === $this->upload['context'] && function_exists( 'groups_get_group' ) ) { $group = groups_get_group( array( 'group_id' => $this->upload['context_id'] ) ); + if ( isset( $group->status ) && 'public' !== $group->status ) { - // if group is not public, then set media privacy as 20, so only the group members can see the images + // if group is not public, then set media privacy as 20, so only the group members can see the images. $this->upload['privacy'] = '20'; } else { - // if group is public, then set media privacy as 0 + // if group is public, then set media privacy as 0. $this->upload['privacy'] = '0'; } } $comment_media = false; - // if media is add in from the comment media section + // if media is add in from the comment media section. if ( isset( $this->upload['comment_media_activity_id'] ) && ! empty( $this->upload['comment_media_activity_id'] ) ) { - // if group is public, then set media privacy as 0 - global $rtmedia; + // if group is public, then set media privacy as 0. $privacy = '0'; + if ( isset( $rtmedia->options['privacy_enabled'] ) && isset( $rtmedia->options['privacy_default'] ) ) { $privacy = $rtmedia->options['privacy_default']; } @@ -87,39 +120,42 @@ function template_redirect( $create_activity = true ) { if ( class_exists( 'RTMediaAlbum' ) ) { $album_id = RTMediaAlbum::get_default(); } else { - $album = rtmedia_get_site_option( 'rtmedia-global-albums' ); - $album_id = $album_id = $album[0]; + $album = rtmedia_get_site_option( 'rtmedia-global-albums' ); + $album_id = $album[0]; } - $current_media_id = preg_replace( '/[^0-9]/', '', $this->upload['comment_media_activity_id'] ); + $current_media_id = preg_replace( '/[^0-9]/', '', $this->upload['comment_media_activity_id'] ); $current_media_type = preg_replace( '/[^a-z]/', '', $this->upload['comment_media_activity_id'] ); if ( $current_media_id ) { - $comment_media = true; - $context = 'profile'; - $context_id = get_current_user_id(); - $media_obj = new RTMediaMedia(); + $comment_media = true; + $context = 'profile'; + $context_id = get_current_user_id(); + $media_obj = new RTMediaMedia(); - if ( 'rtmedia' == $current_media_type ) { - /* search from media id*/ + if ( 'rtmedia' === $current_media_type ) { + // search from media id. $media = $media_obj->model->get( array( 'id' => $current_media_id ) ); } else { - /* search from activity id*/ + // search from activity id. $media = $media_obj->model->get( array( 'activity_id' => $current_media_id ) ); } if ( ! empty( $media[0] ) && $media[0]->album_id ) { - $album_id = $media[0]->album_id; - $privacy = $media[0]->privacy; - $context = $media[0]->context; + + $album_id = $media[0]->album_id; + $privacy = $media[0]->privacy; + $context = $media[0]->context; $context_id = $media[0]->context_id; + } else { - /* search from the BuddyPress Table */ + + // search from the BuddyPress Table. $media = bp_activity_get_specific( array( 'activity_ids' => $current_media_id ) ); if ( isset( $media['activities'][0]->component ) ) { - if ( $media['activities'][0]->component != 'activity' ) { + if ( 'activity' !== $media['activities'][0]->component ) { $context = $media['activities'][0]->component; } } @@ -130,17 +166,16 @@ function template_redirect( $create_activity = true ) { } $this->upload['album_id'] = $album_id; - $this->upload['privacy'] = $privacy; + $this->upload['privacy'] = $privacy; - if ( 0 == strrpos( $context , 'comment-media' ) ) { + if ( 0 === strrpos( $context, 'comment-media' ) ) { $this->upload['context'] = 'comment-media'; } $this->upload['context_id'] = $context_id; - }// End if(). - - }// End if(). + } // End if. + } // End if. $this->upload = apply_filters( 'rtmedia_media_param_before_upload', $this->upload ); $rtupload = new RTMediaUpload( $this->upload ); @@ -149,17 +184,19 @@ function template_redirect( $create_activity = true ) { add_rtmedia_meta( $rtupload->media_ids[0], 'rtmedia_comment_media', true ); if ( isset( $media[0]->id ) ) { - // add in comment media the parent media id + // add in comment media the parent media id. add_rtmedia_meta( $rtupload->media_ids[0], 'rtmedia_comment_media_id', $media[0]->id ); - // add in parent media the comment media id - $get_rtmedia_meta = array(); + // add in parent media the comment media id. + $get_rtmedia_meta = array(); $get_rtmedia_meta_old = get_rtmedia_meta( $media[0]->id, 'has_comment_media' ); + if ( is_array( $get_rtmedia_meta_old ) ) { foreach ( $get_rtmedia_meta_old as $value ) { $get_rtmedia_meta[] = $value; } } + $get_rtmedia_meta[] = $rtupload->media_ids[0]; update_rtmedia_meta( $media[0]->id, 'has_comment_media', $get_rtmedia_meta ); } @@ -173,80 +210,101 @@ function template_redirect( $create_activity = true ) { } } - $media_obj = new RTMediaMedia(); - $media = $media_obj->model->get( array( 'id' => $rtupload->media_ids[0] ) ); - $rtmedia_nav = new RTMediaNav(); - $perma_link = ''; + $media_obj = new RTMediaMedia(); + $media = $media_obj->model->get( array( 'id' => $rtupload->media_ids[0] ) ); + $rtmedia_nav = new RTMediaNav(); + if ( isset( $media ) && count( $media ) > 0 ) { - $perma_link = get_rtmedia_permalink( $media[0]->id ); + + $permalink = get_rtmedia_permalink( $media[0]->id ); + if ( 'photo' === $media[0]->media_type ) { $thumb_image = rtmedia_image( 'rt_media_thumbnail', $rtupload->media_ids[0], false ); } elseif ( 'music' === $media[0]->media_type ) { $thumb_image = $media[0]->cover_art; - } else { - $thumb_image = ''; } if ( 'group' === $media[0]->context ) { - $rtmedia_nav->refresh_counts( $media[0]->context_id, array( - 'context' => $media[0]->context, - 'context_id' => $media[0]->context_id, - ) ); + $rtmedia_nav->refresh_counts( + $media[0]->context_id, + array( + 'context' => $media[0]->context, + 'context_id' => $media[0]->context_id, + ) + ); } else { - $rtmedia_nav->refresh_counts( $media[0]->media_author, array( - 'context' => 'profile', - 'media_author' => $media[0]->media_author, - ) ); + $rtmedia_nav->refresh_counts( + $media[0]->media_author, + array( + 'context' => 'profile', + 'media_author' => $media[0]->media_author, + ) + ); } + if ( false !== $create_activity && class_exists( 'BuddyPress' ) && bp_is_active( 'activity' ) ) { $allow_single_activity = apply_filters( 'rtmedia_media_single_activity', false ); // Following will not apply to activity uploads. For first time activity won't be generated. // Create activity first and pass activity id in response. + // todo rtmedia_media_single_activity filter. It will create 2 activity with same media if uploaded from activity page. + $_rtmedia_update = sanitize_text_field( filter_input( INPUT_POST, 'rtmedia_update', FILTER_SANITIZE_STRING ) ); - // todo fixme rtmedia_media_single_activity filter. It will create 2 activity with same media if uploaded from activity page. - - $_rtmedia_update = filter_input( INPUT_POST, 'rtmedia_update', FILTER_SANITIZE_STRING ); if ( ( -1 === intval( $activity_id ) && ( ! ( isset( $_rtmedia_update ) && 'true' === $_rtmedia_update ) ) ) || $allow_single_activity ) { $activity_id = $media_obj->insert_activity( $media[0]->media_id, $media[0] ); } else { + $media_obj->model->update( array( 'activity_id' => $activity_id ), array( 'id' => $rtupload->media_ids[0] ) ); - // $same_medias = $media_obj->model->get( array( 'activity_id' => $activity_id ) ); $update_activity_media = array(); + foreach ( $same_medias as $a_media ) { $update_activity_media[] = $a_media->id; } + $privacy = filter_input( INPUT_POST, 'privacy', FILTER_SANITIZE_NUMBER_INT ); + if ( empty( $privacy ) ) { $privacy = 0; } $obj_activity = new RTMediaActivity( $update_activity_media, $privacy, false ); + global $wpdb, $bp; $user = get_userdata( $same_medias[0]->media_author ); $username = '' . esc_html( $user->display_name ) . ''; - $action = sprintf( esc_html__( '%s added %d %s', 'buddypress-media' ), $username, count( $same_medias ), RTMEDIA_MEDIA_SLUG ); - $action = apply_filters( 'rtmedia_buddypress_action_text_fitler_multiple_media', $action, $username, count( $same_medias ), $user->display_name ); - $wpdb->update( $bp->activity->table_name, array( - 'type' => 'rtmedia_update', - 'content' => $obj_activity->create_activity_html(), - 'action' => $action, - ), array( 'id' => $activity_id ) ); + + // translators: 1: Username, 2: Number of medias, 3: Media slug. + $action = sprintf( esc_html__( '%1$s added %2$d %3$s', 'buddypress-media' ), $username, count( $same_medias ), RTMEDIA_MEDIA_SLUG ); + $action = apply_filters( 'rtmedia_buddypress_action_text_fitler_multiple_media', $action, $username, count( $same_medias ), $user->display_name ); + + $wpdb->update( + $bp->activity->table_name, + array( + 'type' => 'rtmedia_update', + 'content' => $obj_activity->create_activity_html(), + 'action' => $action, + ), + array( 'id' => $activity_id ) + ); } - // update group last active + // update group last active. if ( 'group' === $media[0]->context ) { RTMediaGroup::update_last_active( $media[0]->context_id ); } } } - if ( isset( $this->upload['rtmedia_simple_file_upload'] ) && true == $this->upload['rtmedia_simple_file_upload'] ) { + + if ( isset( $this->upload['rtmedia_simple_file_upload'] ) && '1' === strval( $this->upload['rtmedia_simple_file_upload'] ) ) { + if ( isset( $media ) && count( $media ) > 0 ) { - if ( ( ( isset( $_redirection ) && 'true' === $_redirection ) || ( isset( $_redirect ) && 'no' !== $_redirect ) ) && - isset( $_redirect_url ) ) { + + if ( ( ( isset( $_redirection ) && 'true' === $_redirection ) || ( isset( $_redirect ) && 'no' !== $_redirect ) ) && isset( $_redirect_url ) ) { + if ( intval( $_redirect_url ) > 1 ) { - //bulkurl + + // bulk url. if ( 'group' === $media[0]->context ) { $redirect_url = trailingslashit( get_rtmedia_group_link( $media[0]->context_id ) ) . RTMEDIA_MEDIA_SLUG; } else { @@ -255,6 +313,7 @@ function template_redirect( $create_activity = true ) { } else { $redirect_url = get_rtmedia_permalink( $media[0]->id ); } + $redirect_url = apply_filters( 'rtmedia_simple_file_upload_redirect_url_filter', $redirect_url ); wp_safe_redirect( esc_url_raw( $redirect_url ) ); die(); @@ -268,12 +327,12 @@ function template_redirect( $create_activity = true ) { } $redirect_url = ''; - if ( ( ( isset( $_redirection ) && 'true' === $_redirection ) || ( isset( $_redirect ) && 'no' !== $_redirect ) ) && - isset( $_redirect_url ) && is_numeric( $_redirect_url ) ) { + if ( ( ( isset( $_redirection ) && 'true' === $_redirection ) || ( isset( $_redirect ) && 'no' !== $_redirect ) ) && isset( $_redirect_url ) && is_numeric( $_redirect_url ) ) { if ( intval( $_redirect_url ) > 1 ) { - //bulkurl - if ( 'group' === $media[0]->context ) { + + // bulk url. + if ( ! empty( $media[0] ) && 'group' === $media[0]->context ) { $redirect_url = trailingslashit( get_rtmedia_group_link( $media[0]->context_id ) ) . RTMEDIA_MEDIA_SLUG; } else { $redirect_url = trailingslashit( get_rtmedia_user_link( $media[0]->media_author ) ) . RTMEDIA_MEDIA_SLUG; @@ -282,36 +341,40 @@ function template_redirect( $create_activity = true ) { $redirect_url = get_rtmedia_permalink( $media[0]->id ); } } - // Ha ha ha + // Ha ha ha. ob_end_clean(); - //check for simpe - $rtmedia_update = filter_input( INPUT_POST, 'rtmedia_update', FILTER_SANITIZE_STRING ); + // check for simple. + $rtmedia_update = sanitize_text_field( filter_input( INPUT_POST, 'rtmedia_update', FILTER_SANITIZE_STRING ) ); $_user_agent = rtm_get_server_var( 'HTTP_USER_AGENT', 'FILTER_SANITIZE_STRING' ); + /** - * if(redirect) - * + * If(redirect) */ if ( ! empty( $rtmedia_update ) && 'true' === $rtmedia_update ) { - if ( preg_match( '/(?i)msie [1-9]/', $_user_agent ) ) { // if IE(<=9) set content type = text/plain + + if ( preg_match( '/(?i)msie [1-9]/', $_user_agent ) ) { // if IE(<=9) set content type = text/plain. header( 'Content-type: text/plain' ); } else { header( 'Content-type: application/json' ); } echo wp_json_encode( $rtupload->media_ids ); + } else { - // Media Upload Case - on album/post/profile/group - if ( isset( $media[0] ) ) { + + // Media Upload Case - on album/post/profile/group. + if ( ! empty( $media[0] ) ) { $data = array( 'media_id' => $media[0]->id, 'activity_id' => $activity_id, 'redirect_url' => $redirect_url, - 'permalink' => $perma_link, + 'permalink' => $permalink, 'cover_art' => $thumb_image, ); } else { $data = array(); } - if ( preg_match( '/(?i)msie [1-9]/', $_user_agent ) ) { // if IE(<=9) set content type = text/plain + + if ( preg_match( '/(?i)msie [1-9]/', $_user_agent ) ) { // if IE(<=9) set content type = text/plain. header( 'Content-type: text/plain' ); } else { header( 'Content-type: application/json' ); diff --git a/app/main/controllers/upload/RTMediaUploadHelper.php b/app/main/controllers/upload/RTMediaUploadHelper.php index 83b9730af..76faa6ae7 100755 --- a/app/main/controllers/upload/RTMediaUploadHelper.php +++ b/app/main/controllers/upload/RTMediaUploadHelper.php @@ -1,25 +1,25 @@ */ + +/** + * Helper class for PL Upload - Upload files via AJAX Request + */ class RTMediaUploadHelper { /** - * + * RTMediaUploadHelper constructor. */ - public function __construct() { - - } + public function __construct() {} /** - * + * Function to perform file upload. */ - static function file_upload() { + public static function file_upload() { $end_point = new RTMediaUploadEndpoint(); $end_point->template_redirect(); diff --git a/app/main/controllers/upload/RTMediaUploadModel.php b/app/main/controllers/upload/RTMediaUploadModel.php index 0ca60f018..ffe859d65 100755 --- a/app/main/controllers/upload/RTMediaUploadModel.php +++ b/app/main/controllers/upload/RTMediaUploadModel.php @@ -1,12 +1,21 @@ */ + +/** + * Class to handle uploaded media operations. + */ class RTMediaUploadModel { + /** + * Uploaded media details. + * + * @var array + */ public $upload = array( 'mode' => 'file_upload', 'context' => false, @@ -22,11 +31,15 @@ class RTMediaUploadModel { ); /** + * Set uploaded media data in class upload object. + * + * @param array $upload_params array of parameters. * * @return array */ - function set_post_object( $upload_params = array() ) { - $upload_array = empty( $upload_params ) ? $_POST : $upload_params; // @codingStandardsIgnoreLine + public function set_post_object( $upload_params = array() ) { + // todo: check what's in POST. + $upload_array = empty( $upload_params ) ? $_POST : $upload_params; // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification $this->upload = wp_parse_args( $upload_array, $this->upload ); $this->sanitize_object(); @@ -34,10 +47,11 @@ function set_post_object( $upload_params = array() ) { } /** + * Check if context is set for uploaded media. * * @return boolean */ - function has_context() { + public function has_context() { if ( isset( $this->upload['context_id'] ) && ! empty( $this->upload['context_id'] ) ) { return true; } @@ -46,15 +60,16 @@ function has_context() { } /** + * Assign values to upload media object. * * @global type $rtmedia_interaction */ - function sanitize_object() { + public function sanitize_object() { if ( ! $this->has_context() ) { - // Set context_id to Logged in user id if context is profile and context_id is not provided + // Set context_id to Logged in user id if context is profile and context_id is not provided. if ( 'profile' === $this->upload['context'] || 'bp_member' === $this->upload['context'] ) { - $this->upload['context'] = 'profile'; + $this->upload['context'] = 'profile'; $this->upload['context_id'] = get_current_user_id(); } else { global $rtmedia_interaction; @@ -79,9 +94,13 @@ function sanitize_object() { if ( ! $this->has_author() ) { $this->set_author(); } + if ( is_rtmedia_privacy_enable() ) { + if ( is_rtmedia_privacy_user_overide() ) { + $privacy = filter_input( INPUT_POST, 'privacy', FILTER_SANITIZE_NUMBER_INT ); + if ( is_null( $privacy ) ) { $this->upload['privacy'] = get_rtmedia_default_privacy(); } else { @@ -96,22 +115,27 @@ function sanitize_object() { } /** + * Get uploaded media author. * - * @return type + * @return int */ - function has_author() { + public function has_author() { return $this->upload['media_author']; } - function set_author() { + /** + * Set upload media author as current user. + */ + public function set_author() { $this->upload['media_author'] = get_current_user_id(); } /** + * Check if album id is set. * * @return boolean */ - function has_album_id() { + public function has_album_id() { if ( ! $this->upload['album_id'] || 'undefined' === $this->upload['album_id'] ) { return false; } @@ -120,28 +144,31 @@ function has_album_id() { } /** + * Check album permissions. * * @return boolean */ - function has_album_permissions() { - //yet to be coded for the privacy options of the album + public function has_album_permissions() { + // yet to be coded for the privacy options of the album. return true; } /** + * Check if album exists. * - * @param type $id + * @param int $id Album id. * * @return boolean */ - function album_id_exists( $id ) { + public function album_id_exists( $id ) { + // todo:remove if not used anywhere. return true; } /** - * + * Set Album id to upload media based on Buddypress enabled. */ - function set_album_id() { + public function set_album_id() { if ( class_exists( 'BuddyPress' ) ) { $this->set_bp_album_id(); } else { @@ -150,9 +177,9 @@ function set_album_id() { } /** - * + * Set Album id to upload media based on current page. */ - function set_bp_album_id() { + public function set_bp_album_id() { if ( bp_is_blog_page() ) { $this->set_wp_album_id(); } else { @@ -161,29 +188,29 @@ function set_bp_album_id() { } /** + * Set Album id to upload media. * - * @throws RTMediaUploadException + * @throws RTMediaUploadException Throws for upload error. */ - function set_wp_album_id() { + public function set_wp_album_id() { if ( isset( $this->upload['context'] ) ) { + $this->upload['album_id'] = $this->upload['context_id']; - // If context is profile then set album_id to default global album + + // If context is profile then set album_id to default global album. if ( 'profile' === $this->upload['context'] ) { $this->upload['album_id'] = RTMediaAlbum::get_default(); } } else { - throw new RTMediaUploadException( 9 ); // Invalid Context + throw new RTMediaUploadException( 9 ); // Invalid Context. } } /** - * + * Set album id. */ - function set_bp_component_album_id() { + public function set_bp_component_album_id() { switch ( bp_current_component() ) { - case 'groups': - $this->upload['album_id'] = RTMediaAlbum::get_default(); - break; default: $this->upload['album_id'] = RTMediaAlbum::get_default(); break; diff --git a/app/main/controllers/upload/RTMediaUploadView.php b/app/main/controllers/upload/RTMediaUploadView.php index 487d8fc94..5c53c5e18 100755 --- a/app/main/controllers/upload/RTMediaUploadView.php +++ b/app/main/controllers/upload/RTMediaUploadView.php @@ -1,29 +1,54 @@ attributes = $attr; } - static function upload_nonce_generator( $echo = true, $only_nonce = false ) { + /** + * Function to generate nonce for media upload. + * + * @param bool $echo Weather to echo or not. + * @param bool $only_nonce Weather to return only nonce. + * + * @return false|string + */ + public static function upload_nonce_generator( $echo = true, $only_nonce = false ) { if ( $echo ) { - wp_nonce_field( 'rtmedia_upload_nonce', 'rtmedia_upload_nonce' ); + /** + * If we use wp_nonce_field, it'll create a hidden field with ID, which will generate HTML warning. + * Because this nonce is being used in multiple places on the same page. + */ + echo ''; } else { + if ( $only_nonce ) { return wp_create_nonce( 'rtmedia_upload_nonce' ); } + $token = array( 'action' => 'rtmedia_upload_nonce', 'nonce' => wp_create_nonce( 'rtmedia_upload_nonce' ), @@ -36,13 +61,15 @@ static function upload_nonce_generator( $echo = true, $only_nonce = false ) { /** * Render the uploader shortcode and attach the uploader panel * - * @param type $template_name + * @param string $template_name Template name to render. */ public function render( $template_name ) { global $rtmedia_query; $album = ''; + if ( apply_filters( 'rtmedia_render_select_album_upload', true ) ) { + if ( $rtmedia_query && isset( $rtmedia_query->media_query ) && isset( $rtmedia_query->media_query['album_id'] ) && is_rtmedia_album( $rtmedia_query->media_query['album_id'] ) ) { $album = ''; } elseif ( is_rtmedia_album_enable() && $rtmedia_query && is_rtmedia_gallery() ) { @@ -50,22 +77,26 @@ public function render( $template_name ) { if ( isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] ) { $album = ' '; } + if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) { $album = ' '; } } } - $up_privacy = $privacy = ''; //uploader privacy dropdown for uploader under rtMedia Media tab. + + $privacy = ''; + $up_privacy = ''; // uploader privacy dropdown for uploader under rtMedia Media tab. + if ( is_rtmedia_privacy_enable() && ( ( ! isset( $rtmedia_query->is_upload_shortcode ) || false === $rtmedia_query->is_upload_shortcode ) ) || ( isset( $rtmedia_query->is_upload_shortcode ) && ! isset( $this->attributes['privacy'] ) ) ) { if ( ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) || ( function_exists( 'bp_is_groups_component' ) && bp_is_groups_component() ) ) { - // bp_get_group_status() is always reurning NULL. + // bp_get_group_status() is always returning NULL. // So fetched data from DB and assigned to media. global $wpdb; - // BP Groups tablename. + // BP Groups table name. $table_name = $wpdb->prefix . 'bp_groups'; // Will fetch ID of current group. $group_id = bp_get_current_group_id(); @@ -75,7 +106,7 @@ public function render( $template_name ) { if ( false === $group_status ) { // Query to fetch current group's privacy status. - $group_status = $wpdb->get_var( 'SELECT `status` FROM ' . $table_name . ' WHERE id = ' . $group_id ); + $group_status = $wpdb->get_var( 'SELECT `status` FROM ' . $table_name . ' WHERE id = ' . $group_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared // Set data in transient for better performance. set_transient( 'group_status_' . $group_id, $group_status ); @@ -89,10 +120,14 @@ public function render( $template_name ) { $privacy_levels_array = apply_filters( 'rtmedia_group_privacy_levels', $privacy_levels_array ); $privacy_val = $privacy_levels_array[ $group_status ]; - $up_privacy = $privacy = ""; + $up_privacy = ""; + $privacy = $up_privacy; + } else { + $up_privacy = new RTMediaPrivacy( false ); $up_privacy = $up_privacy->select_privacy_ui( false, 'rtSelectPrivacy' ); + if ( $up_privacy ) { $privacy = " ' . $up_privacy . ''; } @@ -119,9 +154,11 @@ public function render( $template_name ) { $upload_tab_html = $upload_tabs['file_upload']['content']; } else { $upload_tab_html = '
    '; + foreach ( $upload_tabs as $single_tab ) { $upload_tab_html .= '
  • ' . $single_tab['title'] . '
  • '; } + $upload_tab_html .= '
'; foreach ( $upload_tabs as $single_tab ) { $upload_tab_html .= $single_tab['content']; @@ -133,23 +170,25 @@ public function render( $template_name ) { } global $rtmedia; - $rtmedia_comment_main = "rtmedia-comment-action-update"; - $rtmedia_comment_container = "rtmedia-comment-media-upload-container"; - $rtmedia_comment_button = "rtmedia-comment-media-upload"; - $rtmedia_comment_filelist = "rtmedia_uploader_filelist"; - $rtmedia_comment_context = "activity"; - if( - ( isset( $this->attributes['upload_parent_id'] ) && ! empty( $this->attributes['upload_parent_id'] ) ) + $rtmedia_comment_main = 'rtmedia-comment-action-update'; + $rtmedia_comment_container = 'rtmedia-comment-media-upload-container'; + $rtmedia_comment_button = 'rtmedia-comment-media-upload'; + $rtmedia_comment_filelist = 'rtmedia_uploader_filelist'; + $rtmedia_comment_context = 'activity'; + if ( + ( isset( $this->attributes['upload_parent_id'] ) && ! empty( $this->attributes['upload_parent_id'] ) ) && - ( isset( $this->attributes['upload_parent_id_type'] ) && ! empty( $this->attributes['upload_parent_id_type'] ) ) - ){ - $main_id = '-'.$this->attributes['upload_parent_id_type'].'-'.$this->attributes['upload_parent_id']; - $rtmedia_comment_main .= $main_id; + ( isset( $this->attributes['upload_parent_id_type'] ) && ! empty( $this->attributes['upload_parent_id_type'] ) ) + ) { + $main_id = '-' . $this->attributes['upload_parent_id_type'] . '-' . $this->attributes['upload_parent_id']; + $rtmedia_comment_main .= $main_id; $rtmedia_comment_container .= $main_id; - $rtmedia_comment_button .= $main_id; - $rtmedia_comment_filelist .= $main_id; - $up_privacy = $privacy = ""; - if( isset( $this->attributes['upload_parent_id_context'] ) ){ + $rtmedia_comment_button .= $main_id; + $rtmedia_comment_filelist .= $main_id; + $up_privacy = ""; + $privacy = $up_privacy; + + if ( isset( $this->attributes['upload_parent_id_context'] ) ) { $rtmedia_comment_context = $this->attributes['upload_parent_id_context']; } } @@ -195,15 +234,15 @@ public function render( $template_name ) { . '
    ' . '
    ', ), - 'comment' => array( + 'comment' => array( 'title' => esc_html__( 'File Upload', 'buddypress-media' ), 'content' => '
    ' - . '
    ' + . '
    ' . '
    ' - . '
    ' + . '
    ' . '
    ' - . '' @@ -213,7 +252,7 @@ public function render( $template_name ) { . '
    ' . apply_filters( 'rtmedia_uploader_after_comment_upload_button', '' ) . '
    ' - . '
      ' + . '
        ' . '
        ', ), ), @@ -225,23 +264,44 @@ public function render( $template_name ) { $tabs = apply_filters( 'rtmedia_upload_tabs', $tabs ); $attr = $this->attributes; - $mode = filter_input( INPUT_GET, 'mode', FILTER_SANITIZE_STRING ); + $mode = sanitize_text_field( filter_input( INPUT_GET, 'mode', FILTER_SANITIZE_STRING ) ); + if ( is_null( $mode ) || false === $mode || ! array_key_exists( $mode, $tabs ) ) { $mode = 'file_upload'; } + if ( $attr && is_array( $attr ) ) { + foreach ( $attr as $key => $val ) { - $selector = "id"; - if( ( $key == 'upload_parent_id' && ! empty( $key ) ) || ( $key == 'upload_parent_id_type' && ! empty( $key ) ) ){ - $selector = "class"; + $selector = 'id'; + + if ( ( 'upload_parent_id' === $key && ! empty( $key ) ) || ( 'upload_parent_id_type' === $key && ! empty( $key ) ) ) { + $selector = 'class'; + } + + // We use associated array for O(1) time, which increases performance. + $elems_with_class = array( + 'comment' => 1, + 'privacy' => 1, + 'upload_parent_id_context' => 1, + ); + + /** + * These will be repeated for all activities, which will result in duplicate elements with same IDs. + * So adding these as class. + */ + if ( ! empty( $elems_with_class[ $key ] ) ) { + $selector = 'class'; } + ?> - ="rt_upload_hf_" - value='' - name=''/> + ="rt_upload_hf_" + value='' + name=''/> */ + +/** + * Class responsible for uploading a file to the website. + */ class RTMediaUploadFile { - var $files; - var $fake = false; - var $uploaded = false; + /** + * Uploaded file details. + * + * @var array + */ + public $files; - function __construct( $uploaded ) { + /** + * File is uploaded or not. + * + * @var bool + */ + public $fake = false; // todo:find usage. + + /** + * File details. + * + * @var bool |array + */ + public $uploaded = false; + + /** + * RTMediaUploadFile constructor. + * + * @param array $uploaded Uploaded file details. + */ + public function __construct( $uploaded ) { $this->uploaded = $uploaded; } /** * Initialize the upload process * - * @param type $files + * @param array $files Array of file details. * - * @return type + * @return array */ - function init( $files ) { + public function init( $files ) { $this->set_file( $files ); $this->unset_invalid_files(); @@ -33,27 +59,37 @@ function init( $files ) { } /** - * core process of upload + * Core process of upload + * + * @return array|bool|WP_Error + * + * @throws RTMediaUploadException Throws exception when error occurs while uploading media. */ - function process() { - // hook for before file upload process + public function process() { + // hook for before file upload process. do_action( 'rtmedia_before_file_upload_process' ); - include_once( ABSPATH . 'wp-admin/includes/file.php' ); - include_once( ABSPATH . 'wp-admin/includes/image.php' ); + include_once ABSPATH . 'wp-admin/includes/file.php'; + include_once ABSPATH . 'wp-admin/includes/image.php'; $upload_type = $this->fake ? 'wp_handle_sideload' : 'wp_handle_upload'; - //todo why use $rt_set_filter_uplaod_dir global variable if we can remove filter for upload_dir after upload finish + // todo why use $rt_set_filter_uplaod_dir global variable if we can remove filter for upload_dir after upload finish. global $rt_set_filter_uplaod_dir; + if ( ! isset( $rt_set_filter_uplaod_dir ) ) { add_filter( 'upload_dir', array( $this, 'upload_dir' ) ); $rt_set_filter_uplaod_dir = true; } + if ( isset( $this->files ) && count( $this->files ) > 0 ) { + + $uploaded_file = array(); + foreach ( $this->files as $key => $file ) { - $uploaded_file[] = $upload_type ( $file, array( 'test_form' => false ) ); + $uploaded_file[] = $upload_type( $file, array( 'test_form' => false ) ); + try { if ( isset( $uploaded_file[ $key ]['error'] ) || is_null( $uploaded_file[ $key ] ) ) { array_pop( $uploaded_file ); @@ -78,9 +114,19 @@ function process() { return false; } - function upload_dir( $upload_dir ) { + /** + * Set upload directory to save media. + * + * @param string $upload_dir Upload directory. + * + * @return mixed|void + */ + public function upload_dir( $upload_dir ) { + global $rtmedia_interaction; + if ( isset( $this->uploaded['context'] ) && isset( $this->uploaded['context_id'] ) ) { + if ( 'group' !== $this->uploaded['context'] ) { $rtmedia_upload_prefix = 'users/'; $id = apply_filters( 'rtmedia_current_user', get_current_user_id() ); @@ -89,6 +135,7 @@ function upload_dir( $upload_dir ) { $id = $this->uploaded['context_id']; } } else { + if ( 'group' !== $rtmedia_interaction->context->type ) { $rtmedia_upload_prefix = 'users/'; $id = apply_filters( 'rtmedia_current_user', get_current_user_id() ); @@ -105,7 +152,7 @@ function upload_dir( $upload_dir ) { $upload_dir['url'] = trailingslashit( str_replace( $upload_dir['subdir'], '', $upload_dir['url'] ) ) . $rtmedia_folder_name . '/' . $rtmedia_upload_prefix . $id . $upload_dir['subdir']; } - // set dir as per the upload date + // set dir as per the upload date. if ( isset( $this->uploaded['date'] ) ) { $str_date = strtotime( $this->uploaded['date'] ); $year_month = date( 'Y/m', $str_date ); @@ -119,15 +166,23 @@ function upload_dir( $upload_dir ) { return $upload_dir; } - function set_file( $files ) { + /** + * Set file detail to current class to process upload. + * + * @param array $files Array of file details. + * + * @throws RTMediaUploadException Error while uploading media. + */ + public function set_file( $files ) { /** - * if files parameter is provided then take th file details from that object + * If files parameter is provided then take th file details from that object */ if ( $files ) { + $this->fake = true; $this->populate_file_array( (array) $this->uploaded['files'] ); /** - * otherwise check for $_FILES global object from the form submitted + * Otherwise check for $_FILES global object from the form submitted */ } elseif ( isset( $_FILES['rtmedia_file'] ) ) { $this->populate_file_array( $_FILES['rtmedia_file'] ); @@ -138,17 +193,17 @@ function set_file( $files ) { try { throw new RTMediaUploadException( UPLOAD_ERR_NO_FILE ); } catch ( Exception $e ) { - error_log( $e->getMessage() ); + error_log( $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log } } } /** - * gather the file information for upload process + * Gather the file information for upload process * - * @param type $file_array + * @param array $file_array File details. */ - function populate_file_array( $file_array ) { + public function populate_file_array( $file_array ) { $this->files[] = array( 'name' => isset( $file_array['name'] ) ? $file_array['name'] = str_replace( '%', '-', $file_array['name'] ) : '', 'type' => isset( $file_array['type'] ) ? $file_array['type'] : '', @@ -163,16 +218,18 @@ function populate_file_array( $file_array ) { * * @global type $rtmedia * - * @param type $file + * @param array $file File details. * * @return boolean - * @throws RTMediaUploadException + * + * @throws RTMediaUploadException Exception for Invalid context while uploading any media. */ - function is_valid_type( $file ) { + public function is_valid_type( $file ) { try { global $rtmedia; $allowed_types = array(); $rtmedia->allowed_types = apply_filters( 'rtmedia_allowed_types', $rtmedia->allowed_types ); + foreach ( $rtmedia->allowed_types as $type ) { if ( '' !== $type['extn'] && call_user_func( 'is_rtmedia_upload_' . $type['name'] . '_enabled' ) ) { foreach ( $type['extn'] as $extn ) { @@ -180,20 +237,24 @@ function is_valid_type( $file ) { } } } + $file_data = wp_check_filetype( $file['name'] ); - $allowed_types = apply_filters( 'rtmedia_plupload_files_filter', array( + $allowed_types = apply_filters( + 'rtmedia_plupload_files_filter', array( - 'title' => 'Media Files', - 'extensions' => implode( ',', $allowed_types ), - ), - ) ); + array( + 'title' => esc_html__( 'Media Files', 'buddypress-media' ), + 'extensions' => implode( ',', $allowed_types ), + ), + ) + ); $allowed_types = explode( ',', $allowed_types[0]['extensions'] ); + if ( false === in_array( strtolower( $file_data['ext'] ), $allowed_types, true ) ) { if ( ! preg_match( '/' . implode( '|', $allowed_types ) . '/i', $file['type'], $result ) || ! isset( $result[0] ) ) { throw new RTMediaUploadException( UPLOAD_ERR_EXTENSION ); } } - // $is_valid = $this->id3_validate_type($file); } catch ( RTMediaUploadException $e ) { echo esc_html( $e->getMessage() ); @@ -206,9 +267,10 @@ function is_valid_type( $file ) { /** * Remove invalid files */ - function unset_invalid_files() { + public function unset_invalid_files() { $temp_array = $this->files; $this->files = null; + foreach ( $temp_array as $key => $file ) { if ( apply_filters( 'rtmedia_valid_type_check', $this->is_valid_type( $file ), $file ) ) { $this->files[] = $file; @@ -216,96 +278,125 @@ function unset_invalid_files() { } } - function id3_validate_type( $file ) { + /** + * Check if file type is valid to upload. + * + * @param array $file File data. + * + * @return bool + * @throws RTMediaUploadException Throws unacceptable media types exceptions. + */ + public function id3_validate_type( $file ) { $file_type = explode( '/', $file['type'] ); $type = $file_type[0]; + switch ( $type ) { - case 'video' : + case 'video': if ( ! class_exists( 'getID3', true ) ) { - include_once( trailingslashit( RTMEDIA_PATH ) . 'lib/getid3/getid3.php' ); + include_once trailingslashit( RTMEDIA_PATH ) . 'lib/getid3/getid3.php'; } + try { - $get_id3 = new getID3; + $get_id3 = new getID3(); $vid_info = $get_id3->analyze( $file['tmp_name'] ); } catch ( Exception $e ) { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'MP4 file you have uploaded is corrupt.', 'buddypress-media' ) ); } + if ( is_array( $vid_info ) ) { + if ( ! array_key_exists( 'error', $vid_info ) && array_key_exists( 'fileformat', $vid_info ) && array_key_exists( 'video', $vid_info ) && array_key_exists( 'fourcc', $vid_info['video'] ) ) { if ( ! ( 'mp4' === $vid_info['fileformat'] && 'avc1' === $vid_info['video']['fourcc'] ) ) { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264.', 'buddypress-media' ) ); } } else { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264.', 'buddypress-media' ) ); } } else { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'The MP4 file you have uploaded is not a video file.', 'buddypress-media' ) ); } break; - case 'audio' : + case 'audio': if ( ! class_exists( 'getID3' ) ) { - include_once( trailingslashit( RTMEDIA_PATH ) . 'lib/getid3/getid3.php' ); + include_once trailingslashit( RTMEDIA_PATH ) . 'lib/getid3/getid3.php'; } + try { - $get_id3 = new getID3; + $get_id3 = new getID3(); $file_info = $get_id3->analyze( $file['tmp_name'] ); } catch ( Exception $e ) { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'MP3 file you have uploaded is currupt.', 'buddypress-media' ) ); } + if ( is_array( $file_info ) ) { + if ( ! array_key_exists( 'error', $file_info ) && array_key_exists( 'fileformat', $file_info ) && array_key_exists( 'audio', $file_info ) && array_key_exists( 'dataformat', $file_info['audio'] ) ) { if ( ! ( 'mp3' === $file_info['fileformat'] && 'mp3' === $file_info['audio']['dataformat'] ) ) { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3.', 'buddypress-media' ) ); } } else { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3.', 'buddypress-media' ) ); } } else { $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'The MP3 file you have uploaded is not an audio file.', 'buddypress-media' ) ); } break; - case 'image' : + case 'image': break; - default : + default: $this->safe_unlink( $file['tmp_name'] ); - $activity_content = false; throw new RTMediaUploadException( 0, esc_html__( 'Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4.', 'buddypress-media' ) ); } return true; } - function safe_unlink( $file_path ) { + /** + * Delete file from given path. + * + * @param string $file_path File path. + */ + public function safe_unlink( $file_path ) { if ( file_exists( $file_path ) ) { - if ( function_exists( 'wp_delete_file' ) ) { // wp_delete_file is introduced in WordPress 4.2 + + if ( function_exists( 'wp_delete_file' ) ) { // wp_delete_file is introduced in WordPress 4.2. wp_delete_file( $file_path ); } else { - unlink( $file_path ); // @codingStandardsIgnoreLine + unlink( $file_path ); } } } - function exif( $file ) { + /** + * Save uploaded file/image. + * + * @param array $file File information. + * + * @return mixed + * @throws ImagickException Error while processing file. + */ + public function exif( $file ) { + $file_parts = pathinfo( $file['file'] ); - if ( in_array( strtolower( $file_parts['extension'] ), array( 'jpg', 'jpeg', 'tiff' ) ) ) { - $exif = @read_exif_data( $file['file'] ); - $exif_orient = isset( $exif['Orientation'] ) ? $exif['Orientation'] : 0; + + if ( in_array( strtolower( $file_parts['extension'] ), array( 'jpg', 'jpeg', 'tiff' ), true ) ) { + + if ( function_exists( 'read_exif_data' ) ) { + $exif = @read_exif_data( $file['file'] ); // phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated, WordPress.PHP.NoSilencedErrors.Discouraged, PHPCompatibility.FunctionUse.RemovedFunctions.read_exif_dataDeprecated + } else { + // read_exif_data is deprecated since PHP 7.2. + $exif = @exif_read_data( $file['file'] ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + } + + $exif_orient = isset( $exif['Orientation'] ) ? $exif['Orientation'] : 0; $rotate_image = 0; $exif_orient = intval( $exif_orient ); @@ -321,7 +412,9 @@ function exif( $file ) { } if ( $rotate_image ) { + if ( class_exists( 'Imagick' ) ) { + $imagick = new Imagick(); $imagick->readImage( $file['file'] ); $imagick->rotateImage( new ImagickPixel(), $rotate_image ); @@ -329,7 +422,9 @@ function exif( $file ) { $imagick->writeImage( $file['file'] ); $imagick->clear(); $imagick->destroy(); + } else { + $rotate_image = - $rotate_image; switch ( $file['type'] ) { @@ -358,11 +453,23 @@ function exif( $file ) { return $file; } - function arrayify( $files ) { + /** + * Converts files into array. + * + * @param array|string $files File or array to upload. + * + * @return mixed + */ + public function arrayify( $files ) { + // todo: delete if not used. + $updated_files = array(); + if ( isset( $files['name'] ) && ! is_array( $files['name'] ) ) { $updated_files[0] = $files; } else { + foreach ( $files as $key => $array ) { + foreach ( $array as $index => $value ) { $updated_files[ $index ][ $key ] = $value; } diff --git a/app/main/controllers/upload/processors/RTMediaUploadUrl.php b/app/main/controllers/upload/processors/RTMediaUploadUrl.php index 688f050c3..9989f5319 100755 --- a/app/main/controllers/upload/processors/RTMediaUploadUrl.php +++ b/app/main/controllers/upload/processors/RTMediaUploadUrl.php @@ -1,15 +1,15 @@ */ class RTMediaDeprecated { - //put your code here - - var $deprecate_notice = false; + /** + * Deprecate notice. + * + * @var bool + */ + public $deprecate_notice = false; - static function uploadshortcode() { - // - //add_shortcode('rtmedia_uploader', array($this, 'pre_render')); + /** + * Upload shortcode. + */ + public static function uploadshortcode() { $deprecated = false; $deprecate_notice = ''; - // echo self::generate_notice(__METHOD__, $deprecated, $deprecate_notice); } - static function generate_notice( $method, $deprecated = false, $notice = '' ) { - return sprintf( esc_html__( 'Deprecated %s. Please use %s.', 'buddypress-media' ), $deprecated, $method ); + /** + * Add notice for deprecated method. + * + * @param string $method Method name. + * @param bool $deprecated Deprecated or not. + * @param string $notice Notice to show. + * + * @return string + */ + public static function generate_notice( $method, $deprecated = false, $notice = '' ) { + // translators: 1: function name, 2: method. + return sprintf( esc_html__( 'Deprecated %1$s. Please use %2$s.', 'buddypress-media' ), $deprecated, $method ); } } diff --git a/app/main/interactions/RTMediaInteraction.php b/app/main/interactions/RTMediaInteraction.php index 3fe5da21f..d5967c074 100755 --- a/app/main/interactions/RTMediaInteraction.php +++ b/app/main/interactions/RTMediaInteraction.php @@ -1,32 +1,53 @@ ' ) ) { flush_rewrite_rules( false ); rtmedia_update_site_option( 'rtmedia_flush_rules_plugin_version', $new_version ); } } - function init() { - // set up the routes array + /** + * Init function for class. + */ + public function init() { + // set up the routes array. $this->route_slugs(); $this->set_context(); $this->set_routers(); @@ -63,13 +95,16 @@ function init() { /** * Set up the route slugs' array */ - function route_slugs() { + public function route_slugs() { - // filter to add custom slugs for routes + // filter to add custom slugs for routes. $this->slugs = apply_filters( 'rtmedia_default_routes', $this->slugs ); } - static function rewrite_rules() { + /** + * Add rewrite rules with RTMedia slugs. + */ + public static function rewrite_rules() { add_rewrite_rule( '^/' . RTMEDIA_MEDIA_SLUG . '/([0-9]*)/([^/]*)/?', 'index.php?media_id=$matches[1]&action=$matches[2]', 'bottom' ); add_rewrite_rule( '^/' . RTMEDIA_MEDIA_SLUG . '/([0-9]*)/pg/([0-9]*)/?', 'index.php?media_id=$matches[1]&pg=$matches[2]', 'bottom' ); add_rewrite_rule( '^/' . RTMEDIA_MEDIA_SLUG . '/nonce/([^/]*)/?', 'index.php?nonce_type=$matches[1]', 'bottom' ); @@ -78,7 +113,10 @@ static function rewrite_rules() { do_action( 'rtmedia_add_rewrite_rules' ); } - static function rewrite_tags() { + /** + * Add Rewrite tags. + */ + public static function rewrite_tags() { add_rewrite_tag( '%media_id%', '([0-9]*)' ); add_rewrite_tag( '%action%', '([^/]*)' ); add_rewrite_tag( '%nonce_type%', '([^/]*)' ); @@ -90,16 +128,19 @@ static function rewrite_tags() { /** * Just adds the current /{slug}/ to the rewite endpoint */ - function endpoint() { + public function endpoint() { foreach ( $this->slugs as $slug ) { add_rewrite_endpoint( $slug, EP_ALL ); } } - function set_routers() { + /** + * Set routers. + */ + public function set_routers() { - // set up routes for each slug + // set up routes for each slug. foreach ( $this->slugs as $slug ) { $this->routes[ $slug ] = new RTMediaRouter( $slug ); } @@ -108,32 +149,33 @@ function set_routers() { /** * Sets up the default context */ - function default_context() { + public function default_context() { return new RTMediaContext(); } /** + * Set context. * - * @param array $context the context array + * @param array|bool $context the context array. * * @todo the method should also allow objects */ - function set_context( $context = false ) { + public function set_context( $context = false ) { - // take the context supplied and replace the context + // take the context supplied and replace the context. if ( is_array( $context ) && isset( $context['type'] ) && isset( $context['id'] ) ) { $context_object->type = $context['type']; $context_object->id = $context['id']; - // if there is no context array supplied, set the default context + // if there is no context array supplied, set the default context. } else { $context_object = $this->default_context(); } - //set the context property + // set the context property. $this->context = $context_object; } @@ -141,13 +183,18 @@ function set_context( $context = false ) { * Reset the context to the default context after temporarily setting it, * Say, for an upload */ - function rewind_context() { + public function rewind_context() { $this->context = $this->default_context(); } - function set_query() { + /** + * Function to set global rtMedia_query. + */ + public function set_query() { + global $rtmedia_query; + if ( $this->routes[ RTMEDIA_MEDIA_SLUG ]->is_template() ) { $args = array( 'context' => $this->context->type, @@ -158,18 +205,27 @@ function set_query() { } } - function set_title( $default, $sep = '|' ) { + /** + * Function to filter title. + * + * @param string $default Default title. + * @param string $sep Separator. + * + * @return mixed + */ + public function set_title( $default, $sep = '|' ) { global $wp_query; global $rtmedia_seo_title; if ( ! array_key_exists( RTMEDIA_MEDIA_SLUG, $wp_query->query_vars ) ) { return $default; } - $title = ''; - $oldSep = ' ' . $sep . ' '; - $sep = ''; - global $bp; - global $rtmedia_query; + + global $bp, $rtmedia_query; + $title = ''; + $old_sep = ' ' . $sep . ' '; + $sep = ''; + if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['media_type'] ) ) { if ( 'album' === $rtmedia_query->query['media_type'] ) { if ( isset( $rtmedia_query->media_query ) && isset( $rtmedia_query->media_query['album_id'] ) ) { @@ -177,7 +233,7 @@ function set_title( $default, $sep = '|' ) { foreach ( $rtmedia_query->album as $single_album ) { if ( intval( $single_album->id ) === intval( $rtmedia_query->media_query['album_id'] ) ) { $title .= $sep . stripslashes( esc_html( ucfirst( $single_album->media_title ) ) ); - $sep = $oldSep; + $sep = $old_sep; } } } @@ -185,42 +241,44 @@ function set_title( $default, $sep = '|' ) { } else { if ( isset( $rtmedia_query->media ) && $rtmedia_query->media && count( $rtmedia_query->media ) > 0 ) { $title .= $sep . stripslashes( esc_html( ucfirst( $rtmedia_query->media[0]->media_title ) ) ); - $sep = $oldSep; + $sep = $old_sep; } $title .= $sep . ucfirst( $rtmedia_query->query['media_type'] ); - $sep = $oldSep; + $sep = $old_sep; } } else { if ( isset( $rtmedia_query->action_query ) && isset( $rtmedia_query->action_query->media_type ) ) { $title .= $sep . ucfirst( $rtmedia_query->action_query->media_type ); - $sep = $oldSep; + $sep = $old_sep; } } + if ( function_exists( 'bp_is_group' ) ) { if ( bp_is_groups_component() ) { - if ( bp_is_group() or bp_is_group_forum_topic() ) { + if ( bp_is_group() || bp_is_group_forum_topic() ) { if ( bp_is_group_forum_topic() ) { $title .= $sep . bp_get_the_topic_title(); - $sep = $oldSep; + $sep = $old_sep; } $title .= $sep . bp_get_current_group_name(); - $sep = $oldSep; + $sep = $old_sep; } } } - if ( function_exists( 'bp_get_displayed_user_fullname' ) && bp_displayed_user_id() != 0 ) { + + if ( function_exists( 'bp_get_displayed_user_fullname' ) && 0 !== bp_displayed_user_id() ) { $title .= $sep . bp_get_displayed_user_fullname(); - $sep = $oldSep; + $sep = $old_sep; } else { $user_info = get_userdata( get_current_user_id() ); if ( isset( $user_info->data->display_name ) ) { $title .= $sep . $user_info->data->display_name; - $sep = $oldSep; + $sep = $old_sep; } } $title .= $sep . apply_filters( 'rtmedia_media_tab_name', RTMEDIA_MEDIA_LABEL ); - $sep = $oldSep; + $sep = $old_sep; if ( isset( $this->context->type ) ) { switch ( $this->context->type ) { case 'group': @@ -238,20 +296,27 @@ function set_title( $default, $sep = '|' ) { break; } } - $title .= $sep . get_bloginfo( 'name' ); + $title .= $sep . get_bloginfo( 'name' ); $rtmedia_seo_title = $title; return apply_filters( 'rtmedia_wp_title', $title, $default, $sep ); } - function rtmedia_wpseo_og_image( $data ) { + /** + * Change OG Image using Yoast SEO plugin's filter + * + * @param array $data Image data. + * + * @return mixed + */ + public function rtmedia_wpseo_og_image( $data ) { global $wp_query; if ( class_exists( 'BuddyPress' ) ) { global $bp; if ( bp_is_single_activity() ) { - $mediaObj = new RTMediaModel(); - $media_details = $mediaObj->get( array( 'activity_id' => $bp->current_action ) ); + $media_obj = new RTMediaModel(); + $media_details = $media_obj->get( array( 'activity_id' => $bp->current_action ) ); foreach ( $media_details as $media ) { if ( 'photo' === $media->media_type ) { $img = wp_get_attachment_image_src( $media->media_id, 'full' ); @@ -262,6 +327,7 @@ function rtmedia_wpseo_og_image( $data ) { } } } + if ( ( array_key_exists( 'media', $wp_query->query_vars ) ) ) { global $rtmedia_query; if ( isset( $rtmedia_query->media ) && $rtmedia_query->media && count( $rtmedia_query->media ) > 0 ) { @@ -278,7 +344,14 @@ function rtmedia_wpseo_og_image( $data ) { return $data; } - function rtmedia_wpseo_og_url( $url ) { + /** + * Change URL using Yoast SEO plugin's filter + * + * @param string $url OG URL. + * + * @return string + */ + public function rtmedia_wpseo_og_url( $url ) { global $wp_query; if ( ! array_key_exists( 'media', $wp_query->query_vars ) ) { return $url; @@ -286,15 +359,19 @@ function rtmedia_wpseo_og_url( $url ) { $s = empty( $_SERVER['HTTPS'] ) ? '' : ( ( 'on' === $_SERVER['HTTPS'] ) ? 's' : '' ); $sp = strtolower( wp_unslash( $_SERVER['SERVER_PROTOCOL'] ) ); $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . $s; - $port = ( '80' === $_SERVER['SERVER_PORT'] ) ? '' : ( ':' . $_SERVER['SERVER_PORT'] ); // @codingStandardsIgnoreLine + $port = ( '80' === $_SERVER['SERVER_PORT'] ) ? '' : ( ':' . $_SERVER['SERVER_PORT'] ); - return $protocol . '://' . esc_url( $_SERVER['SERVER_NAME'] ) . esc_url( $port ) . esc_url( $_SERVER['REQUEST_URI'] ); // @codingStandardsIgnoreLine + return $protocol . '://' . esc_url( $_SERVER['SERVER_NAME'] ) . esc_url( $port ) . esc_url( $_SERVER['REQUEST_URI'] ); } - /* + /** * Change description using Yoast SEO plugin's filter + * + * @param string $desc SEO OG description. + * + * @return mixed */ - function rtmedia_wpseo_og_desc( $desc ) { + public function rtmedia_wpseo_og_desc( $desc ) { global $wp_query; if ( ! array_key_exists( RTMEDIA_MEDIA_SLUG, $wp_query->query_vars ) ) { diff --git a/app/main/routers/RTMediaRouter.php b/app/main/routers/RTMediaRouter.php index 4e33afe78..86dd3150f 100755 --- a/app/main/routers/RTMediaRouter.php +++ b/app/main/routers/RTMediaRouter.php @@ -1,6 +1,7 @@ slug( $slug ); $this->template_redirect(); - // add_filter( 'template_include', array( $this, 'template_include' ), 0, 1 ); add_action( 'wp_ajax_rtmedia_include_gallery_item', array( 'RTMediaTemplate', 'include_gallery_item' ) ); } @@ -45,21 +47,21 @@ function __construct( $slug = RTMEDIA_MEDIA_SLUG ) { * Check if there is a constant defined for this route and use that instead * So, this can be overridden by defining RTMEDIA_MEDIA_SLUG in wp-config.php * - * @param string $slug The slug string passed for the route, in the constructor + * @param string $slug The slug string passed for the route, in the constructor. */ - function slug( $slug ) { + public function slug( $slug ) { - // create the slug constant name + // create the slug constant name. $slug_constant = 'RTMEDIA_' . strtoupper( $slug ) . '_SLUG'; - // check if the constant is defined + // check if the constant is defined. if ( defined( $slug_constant ) ) { - // assign the value of the constant instead + // assign the value of the constant instead. $slug = constant( $slug_constant ); } - // set the slug property + // set the slug property. $this->slug = $slug; } @@ -69,7 +71,7 @@ function slug( $slug ) { * @global object $wp_query * @return boolean */ - function is_template() { + public function is_template() { global $wp_query, $rtmedia_query; $return = isset( $wp_query->query_vars[ $this->slug ] ); @@ -102,43 +104,44 @@ function is_template() { /** * Hook into the template redirect action to populate the global objects - * */ - function template_redirect() { + public function template_redirect() { - // if it is not our route, return early + // if it is not our route, return early. if ( ! $this->is_template() ) { return; } status_header( 200 ); - //set up the query variables + // set up the query variables. $this->set_query_vars(); // otherwise provide a hook for only this route, - // pass the slug to the function hooking here + // pass the slug to the function hooking here. do_action( 'rtmedia_' . $this->slug . '_redirect' ); } /** * Hook into the template_include filter to load custom template files * - * @param string $template Template file path of the default template + * @param string $template Template file path of the default template. * * @return string File path of the template file to be loaded */ - function template_include( $template ) { + public function template_include( $template ) { - // if it is not our route, return the default template early + // if it is not our route, return the default template early. if ( ! $this->is_template() ) { return $template; } - // otherwise, apply a filter to the template, - // pass the template and slug to the function hooking here - // so it can load a custom template - + /** + * Otherwise, apply a filter to the template, + * pass the template and slug to the function hooking here + * so it can load a custom template. + */ $template_load = new RTMediaTemplate(); + global $new_rt_template; $new_rt_template = $template_load->set_template( $template ); @@ -147,19 +150,23 @@ function template_include( $template ) { $rt_ajax_request = false; $req_with = rtm_get_server_var( 'HTTP_X_REQUESTED_WITH', 'FILTER_SANITIZE_STRING' ); - // check if it is an ajax request + + // check if it is an ajax request. if ( ! empty( $req_with ) && strtolower( $req_with ) === 'xmlhttprequest' ) { $rt_ajax_request = true; } + if ( $rt_ajax_request ) { return $new_rt_template; } + if ( function_exists( 'bp_set_theme_compat_active' ) ) { bp_set_theme_compat_active( apply_filters( 'rtmedia_main_template_set_theme_compat', true ) ); } + add_filter( 'the_content', array( &$this, 'rt_replace_the_content' ) ); $this->rt_theme_compat_reset_post(); @@ -173,18 +180,18 @@ function template_include( $template ) { * * @since BuddyPress (1.7) * - * @param string $content + * @param string $content Content. * * @return mixed|string|void * @global WP_Query $wp_query * @global object $post * * @internal param array $args - * */ - function rt_replace_the_content( $content = '' ) { + public function rt_replace_the_content( $content = '' ) { // Do we have new content to replace the old content? global $new_rt_template, $rt_template_content; + if ( ! isset( $rt_template_content ) ) { ob_start(); load_template( $new_rt_template ); @@ -193,31 +200,41 @@ function rt_replace_the_content( $content = '' ) { } return $rt_template_content; + + // todo:Check usage of code after return statement. + // phpcs:disable Squiz.PHP.NonExecutableCode.Unreachable $new_content = apply_filters( 'bp_replace_the_content', $rt_template_content ); - // Juggle the content around and try to prevent unsightly comments + // Juggle the content around and try to prevent unsightly comments. if ( ! empty( $new_content ) && ( $new_content !== $rt_template_content ) ) { - // Set the content to be the new content + // Set the content to be the new content. $rt_template_content = $new_content; - // Clean up after ourselves + // Clean up after ourselves. unset( $new_content ); - // Reset the $post global + // Reset the $post global. wp_reset_postdata(); } - // Return possibly hi-jacked content + // Return possibly hi-jacked content. return $content; + // phpcs:enable Squiz.PHP.NonExecutableCode.Unreachable } - function rt_theme_compat_reset_post( $args = array() ) { + /** + * Reset post function. + * + * @param array $args Array of arguments. + */ + public function rt_theme_compat_reset_post( $args = array() ) { global $wp_query, $post; - // Switch defaults if post is set + // Switch defaults if post is set. global $rtmedia_query; if ( isset( $wp_query->post ) ) { + if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['media_type'] ) && 'album' === $rtmedia_query->query['media_type'] && isset( $rtmedia_query->media_query['album_id'] ) && ! empty( $rtmedia_query->album ) ) { foreach ( $rtmedia_query->album as $al ) { if ( intval( $al->id ) === intval( $rtmedia_query->media_query['album_id'] ) ) { @@ -225,74 +242,82 @@ function rt_theme_compat_reset_post( $args = array() ) { break; } } - } else if ( isset( $rtmedia_query->media ) && 1 === count( $rtmedia_query->media ) && $rtmedia_query->media ) { + } elseif ( isset( $rtmedia_query->media ) && 1 === count( $rtmedia_query->media ) && $rtmedia_query->media ) { $wp_query->post = get_post( $rtmedia_query->media[0]->media_id ); } - $dummy = wp_parse_args( $args, array( - 'ID' => $wp_query->post->ID, - 'post_status' => $wp_query->post->post_status, - 'post_author' => $wp_query->post->post_author, - 'post_parent' => $wp_query->post->post_parent, - 'post_type' => 'rtmedia', - 'post_date' => $wp_query->post->post_date, - 'post_date_gmt' => $wp_query->post->post_date_gmt, - 'post_modified' => $wp_query->post->post_modified, - 'post_modified_gmt' => $wp_query->post->post_modified_gmt, - 'post_content' => $wp_query->post->post_content, - 'post_title' => $wp_query->post->post_title, - 'post_excerpt' => $wp_query->post->post_excerpt, - 'post_content_filtered' => $wp_query->post->post_content_filtered, - 'post_mime_type' => $wp_query->post->post_mime_type, - 'post_password' => $wp_query->post->post_password, - 'post_name' => $wp_query->post->post_name, - 'guid' => $wp_query->post->guid, - 'menu_order' => $wp_query->post->menu_order, - 'pinged' => $wp_query->post->pinged, - 'to_ping' => $wp_query->post->to_ping, - 'ping_status' => $wp_query->post->ping_status, - 'comment_status' => $wp_query->post->comment_status, - 'comment_count' => $wp_query->post->comment_count, - 'filter' => $wp_query->post->filter, - - 'is_404' => false, - 'is_page' => false, - 'is_single' => false, - 'is_archive' => false, - 'is_tax' => false, - ) ); + + $dummy = wp_parse_args( + $args, + array( + 'ID' => $wp_query->post->ID, + 'post_status' => $wp_query->post->post_status, + 'post_author' => $wp_query->post->post_author, + 'post_parent' => $wp_query->post->post_parent, + 'post_type' => 'rtmedia', + 'post_date' => $wp_query->post->post_date, + 'post_date_gmt' => $wp_query->post->post_date_gmt, + 'post_modified' => $wp_query->post->post_modified, + 'post_modified_gmt' => $wp_query->post->post_modified_gmt, + 'post_content' => $wp_query->post->post_content, + 'post_title' => $wp_query->post->post_title, + 'post_excerpt' => $wp_query->post->post_excerpt, + 'post_content_filtered' => $wp_query->post->post_content_filtered, + 'post_mime_type' => $wp_query->post->post_mime_type, + 'post_password' => $wp_query->post->post_password, + 'post_name' => $wp_query->post->post_name, + 'guid' => $wp_query->post->guid, + 'menu_order' => $wp_query->post->menu_order, + 'pinged' => $wp_query->post->pinged, + 'to_ping' => $wp_query->post->to_ping, + 'ping_status' => $wp_query->post->ping_status, + 'comment_status' => $wp_query->post->comment_status, + 'comment_count' => $wp_query->post->comment_count, + 'filter' => $wp_query->post->filter, + + 'is_404' => false, + 'is_page' => false, + 'is_single' => false, + 'is_archive' => false, + 'is_tax' => false, + ) + ); } else { - $dummy = wp_parse_args( $args, array( - 'ID' => 0, - 'post_status' => 'public', - 'post_author' => 0, - 'post_parent' => 0, - 'post_type' => 'bp_member', - 'post_date' => 0, - 'post_date_gmt' => 0, - 'post_modified' => 0, - 'post_modified_gmt' => 0, - 'post_content' => '', - 'post_title' => '', - 'post_excerpt' => '', - 'post_content_filtered' => '', - 'post_mime_type' => '', - 'post_password' => '', - 'post_name' => '', - 'guid' => '', - 'menu_order' => 0, - 'pinged' => '', - 'to_ping' => '', - 'ping_status' => '', - 'comment_status' => 'closed', - 'comment_count' => 0, - 'filter' => 'raw', - 'is_404' => false, - 'is_page' => false, - 'is_single' => false, - 'is_archive' => false, - 'is_tax' => false, - ) ); + $dummy = wp_parse_args( + $args, + array( + 'ID' => 0, + 'post_status' => 'public', + 'post_author' => 0, + 'post_parent' => 0, + 'post_type' => 'bp_member', + 'post_date' => 0, + 'post_date_gmt' => 0, + 'post_modified' => 0, + 'post_modified_gmt' => 0, + 'post_content' => '', + 'post_title' => '', + 'post_excerpt' => '', + 'post_content_filtered' => '', + 'post_mime_type' => '', + 'post_password' => '', + 'post_name' => '', + 'guid' => '', + 'menu_order' => 0, + 'pinged' => '', + 'to_ping' => '', + 'ping_status' => '', + 'comment_status' => 'closed', + 'comment_count' => 0, + 'filter' => 'raw', + 'is_404' => false, + 'is_page' => false, + 'is_single' => false, + 'is_archive' => false, + 'is_tax' => false, + ) + ); } + if ( function_exists( 'bp_is_group' ) ) { if ( bp_is_group() ) { $dummy['post_type'] = 'bp_group'; @@ -315,19 +340,19 @@ function rt_theme_compat_reset_post( $args = array() ) { } } - // Bail if dummy post is empty + // Bail if dummy post is empty. if ( empty( $dummy ) ) { return; } - // Set the $post global - $post = new WP_Post( (object) $dummy );// @codingStandardsIgnoreLine + // Set the $post global. + $post = new WP_Post( (object) $dummy ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited - // Copy the new post global into the main $wp_query + // Copy the new post global into the main $wp_query . $wp_query->post = $post; - $wp_query->posts = array( $post ); // @codingStandardsIgnoreLine + $wp_query->posts = array( $post ); - // Prevent comments form from appearing + // Prevent comments form from appearing. $wp_query->post_count = 1; $wp_query->is_404 = $dummy['is_404']; $wp_query->is_page = $dummy['is_page']; @@ -335,7 +360,7 @@ function rt_theme_compat_reset_post( $args = array() ) { $wp_query->is_archive = $dummy['is_archive']; $wp_query->is_tax = $dummy['is_tax']; - // Clean up the dummy post + // Clean up the dummy post. unset( $dummy ); /** @@ -349,13 +374,12 @@ function rt_theme_compat_reset_post( $args = array() ) { } - /** * Break the request URL into an array of variables after the route slug * * @global object $wp_query */ - function set_query_vars() { + public function set_query_vars() { global $wp_query; $query_vars_array = ''; diff --git a/app/main/routers/query/RTMediaQuery.php b/app/main/routers/query/RTMediaQuery.php index 5ec7a9d16..f1a9ebfc2 100755 --- a/app/main/routers/query/RTMediaQuery.php +++ b/app/main/routers/query/RTMediaQuery.php @@ -1,45 +1,56 @@ array( 'Edit', false ), @@ -47,25 +58,74 @@ class RTMediaQuery { 'comment' => array( 'Comment', true ), 'delete-comment' => array( 'Comment Deleted', false ), ); + + /** + * Media to process. + * + * @var string|array $media + */ public $media = ''; + + /** + * Stores media count. + * + * @var int $media_count + */ public $media_count = 0; + + /** + * Current Media number. + * + * @var int $current_media + */ public $current_media = - 1; + + /** + * In media loop or not. + * + * @var bool $in_the_media_loop + */ public $in_the_media_loop = false; + + /** + * Data format. + * + * @var bool|string $format + */ public $format = false; + + /** + * Global shortcode. + * + * @var bool|string $shortcode_global + */ public $shortcode_global = false; + /** + * Object of RTMediaModel class. + * + * @var RTMediaModel + */ + public $model; + + /** + * Object of RTMediaFriends class + * + * @var RTMediaFriends + */ + public $friendship; + /** * Initialise the query * - * @param array|bool $args The query arguments + * @param array|bool $args The query arguments. * * @global object $rtmedia_interaction The global interaction object - * */ - function __construct( $args = false ) { + public function __construct( $args = false ) { - // set up the interaction object relevant to just the query - // we only need information related to the media route + // set up the interaction object relevant to just the query. + // we only need information related to the media route. global $rtmedia_interaction; $this->model = new RTMediaModel(); @@ -74,24 +134,23 @@ function __construct( $args = false ) { $this->friendship = new RTMediaFriends(); - // action manipulator hook + // action manipulator hook. $this->set_actions(); - //check and set the format to json, if needed + // check and set the format to json, if needed. $this->set_json_format(); - // set up the action query from the URL + // set up the action query from the URL. $this->set_action_query(); add_filter( 'rtmedia-model-where-query', array( $this, 'privacy_filter' ), 1, 2 ); - // if no args were supplied, initialise the $args - + // if no args were supplied, initialise the $args. if ( empty( $args ) ) { $this->init(); - // otherwise just populate the query + // otherwise just populate the query. } else { $this->query( $args ); @@ -103,25 +162,31 @@ function __construct( $args = false ) { /** * Initialise the default args for the query */ - function init() { + public function init() { } - function set_media_type() { + /** + * Function to set media type in query var. + */ + public function set_media_type() { if ( ! isset( $this->query['media_type'] ) ) { if ( isset( $this->action_query->id ) ) { $media = $this->model->get( array( 'id' => $this->action_query->id ) ); - if ( sizeof( $media ) > 0 ) { - $media_type = $media[0]->media_type; + if ( is_array( $media ) && count( $media ) > 0 ) { + $media_type = $media[0]->media_type; $this->query['media_type'] = $media_type; } } - } else { - } } - function is_single() { + /** + * Function to check if it's single page. + * + * @return bool + */ + public function is_single() { /** * // check the condition * wont be true in case of multiple albums @@ -137,7 +202,12 @@ function is_single() { return true; } - function is_album() { + /** + * Function to check if it's album. + * + * @return bool + */ + public function is_album() { if ( isset( $this->query['media_type'] ) && 'album' === $this->query['media_type'] ) { return true; } @@ -145,7 +215,12 @@ function is_album() { return false; } - function is_group_album() { + /** + * Function to check group album. + * + * @return bool + */ + public function is_group_album() { if ( $this->is_album() && ( isset( $this->query['context'] ) && 'group' === $this->query['context'] ) ) { return true; } @@ -153,7 +228,12 @@ function is_group_album() { return false; } - function is_gallery() { + /** + * Function to check gallery. + * + * @return bool + */ + public function is_gallery() { if ( ! $this->is_single() ) { return true; } @@ -161,7 +241,12 @@ function is_gallery() { return false; } - function is_album_gallery() { + /** + * Function to check album gallery page. + * + * @return bool + */ + public function is_album_gallery() { if ( isset( $this->action_query->media_type ) && 'album' === $this->action_query->media_type ) { return true; } @@ -169,7 +254,12 @@ function is_album_gallery() { return false; } - function is_playlist_gallery() { + /** + * Function to check playlist gallery page + * + * @return bool + */ + public function is_playlist_gallery() { if ( isset( $this->action_query->media_type ) && 'playlist' === $this->action_query->media_type ) { return true; } @@ -177,7 +267,12 @@ function is_playlist_gallery() { return false; } - function is_playlist() { + /** + * Function to check playlist page + * + * @return bool + */ + public function is_playlist() { if ( isset( $this->query['media_type'] ) && 'playlist' === $this->query['media_type'] ) { return true; } @@ -185,7 +280,12 @@ function is_playlist() { return false; } - function is_single_edit() { + /** + * Function to check page single edit page + * + * @return bool + */ + public function is_single_edit() { if ( $this->is_single() && ( isset( $this->action_query->action ) && 'edit' === $this->action_query->action ) ) { return true; } @@ -194,16 +294,21 @@ function is_single_edit() { } /** - * json request + * Function for json request */ - function set_json_format() { + public function set_json_format() { + + $json = sanitize_text_field( filter_input( INPUT_GET, 'json', FILTER_SANITIZE_STRING ) ); - if ( ! empty( $_REQUEST['json'] ) ) { + if ( ! empty( $json ) ) { $this->format = 'json'; } } - function set_action_query() { + /** + * Function to set action query. + */ + public function set_action_query() { if ( isset( $this->interaction ) && isset( $this->interaction->query_vars ) ) { $raw_query = $this->interaction->query_vars; } else { @@ -212,19 +317,18 @@ function set_action_query() { if ( isset( $raw_query ) && is_array( $raw_query ) && count( $raw_query ) > 1 ) { if ( empty( $raw_query[0] ) && ! empty( $raw_query[1] ) ) { + $temp_query = array(); - for ( $rtCount = 1; $rtCount < count( $raw_query ); $rtCount ++ ) { - $temp_query[] = $raw_query[ $rtCount ]; + $row_count = count( $raw_query ); + + for ( $rt_count = 1; $rt_count < $row_count; $rt_count++ ) { + $temp_query[] = $raw_query[ $rt_count ]; } + $raw_query = $temp_query; } } - // if ( isset ( $_SERVER[ "REMOTE_ADDR" ] ) && $_SERVER[ "REMOTE_ADDR" ] == "14.97.170.202" ) { - // echo "
        ";
        -		//            print_r ( $this );
        -		//            echo "
        "; - // } $bulk = false; $action = false; $attribute = false; @@ -233,22 +337,25 @@ function set_action_query() { $format = ''; $pageno = 1; - // Get page number for json response - if ( ! empty( $_REQUEST['json'] ) ) { - $pageno = ( isset( $_REQUEST['rtmedia_page'] ) && ! empty( $_REQUEST['rtmedia_page'] ) ) ? intval( $_REQUEST['rtmedia_page'] ) : 1; + $json = sanitize_text_field( filter_input( INPUT_GET, 'json', FILTER_SANITIZE_STRING ) ); + + // Get page number for json response. + if ( ! empty( $json ) ) { + $rtmedia_page = filter_input( INPUT_GET, 'rtmedia_page', FILTER_VALIDATE_INT ); + $pageno = ( ! empty( $rtmedia_page ) ) ? $rtmedia_page : 1; } - // Get page number for none json response - if ( ! isset( $_REQUEST['json'] ) && empty( $_REQUEST['json'] ) ) { + // Get page number for none json response. + if ( empty( $json ) ) { $pageno = ( get_query_var( 'pg' ) ) ? get_query_var( 'pg' ) : 1; } - $attributes = ''; + $attributes = ''; - // The first part of the query /media/{*}/ + // The first part of the query /media/{*}/ . if ( is_array( $raw_query ) && count( $raw_query ) && ! empty( $raw_query[0] ) ) { - //set the modifier value beforehand + // set the modifier value beforehand. $modifier_value = $raw_query[0]; if ( 'album' === $modifier_value && ! is_rtmedia_album_enable() ) { @@ -256,31 +363,29 @@ function set_action_query() { die(); } - do_action( 'rtmedia_slug_404_handler' ); // disbale media type 404 handler - - // requesting nonce /media/nonce/edit/ | /media/nonce/comment - // | /media/nonce/delete + do_action( 'rtmedia_slug_404_handler' ); // disable media type 404 handler. + // requesting nonce /media/nonce/edit/ | /media/nonce/comment. + // | /media/nonce/delete . if ( 'nonce' === $modifier_value ) { $modifier_type = 'nonce'; - // requesting media id /media/{id}/ + // requesting media id /media/{id}/. } elseif ( is_numeric( $modifier_value ) ) { $modifier_type = 'id'; - $request_action = filter_input( INPUT_POST, 'request_action', FILTER_SANITIZE_STRING ); - // this block is unnecessary, please delete, asap + $request_action = sanitize_text_field( filter_input( INPUT_POST, 'request_action', FILTER_SANITIZE_STRING ) ); + // this block is unnecessary, please delete, asap. if ( 'delete' === $request_action ) { $action = 'delete'; } - // requesting an upload screen /media/upload/ + // requesting an upload screen /media/upload/. } elseif ( array_key_exists( $modifier_value, $this->actions ) ) { // /media/edit/ | media/delete/ | /media/like/ - $action = $modifier_value; $bulk = true; } elseif ( 'upload' === $modifier_value ) { @@ -291,11 +396,11 @@ function set_action_query() { // /media/pg/2/ } elseif ( 'pg' === $modifier_value ) { - //paginating default query + // paginating default query. $modifier_type = 'pg'; } else { - // requesting by media type /media/photos | /media/videos/ + // requesting by media type /media/photos | /media/videos/. $modifier_type = 'media_type'; } } @@ -310,7 +415,6 @@ function set_action_query() { switch ( $modifier_type ) { case 'nonce': - // /media/nonce/edit/ | /media/nonce/delete/ if ( array_key_exists( $second_modifier, $this->actions ) ) { @@ -320,7 +424,6 @@ function set_action_query() { break; case 'id': - // /media/23/edit/ | media/23/delete/ | /media/23/like/ if ( array_key_exists( $second_modifier, $this->actions ) ) { @@ -329,14 +432,13 @@ function set_action_query() { if ( 'pg' === $second_modifier ) { if ( isset( $raw_query[2] ) && is_numeric( $raw_query[2] ) ) { $pageno = $raw_query[2]; - } - /** - * Fix for URL - * like http://website.com/members//media/2/pg/edit/ - * - * Fix for 'pg' (pagination) in URL - */ - elseif ( 'edit' === $raw_query[2] ) { + } elseif ( 'edit' === $raw_query[2] ) { + /** + * Fix for URL + * like http://website.com/members//media/2/pg/edit/ + * + * Fix for 'pg' (pagination) in URL + */ $action = 'edit'; } } @@ -344,7 +446,6 @@ function set_action_query() { break; case 'pg': - // /media/page/2/ | /media/page/3/ if ( is_numeric( $second_modifier ) ) { @@ -353,18 +454,12 @@ function set_action_query() { break; case 'media_type': - // /media/photos/edit/ | /media/videos/edit/ if ( array_key_exists( $second_modifier, $this->actions ) ) { $action = $second_modifier; $bulk = true; } - // /media/photos/page/2/ - //elseif($second_modifier=='page'){ - //$page = $second_modifier; - //pagination support - //} break; default: @@ -372,8 +467,7 @@ function set_action_query() { } } - //the third part of the query /media/modifier/second_modifier/{*} - + // The third part of the query /media/modifier/second_modifier/{*}. if ( isset( $raw_query[2] ) ) { $third_modifier = $raw_query[2]; @@ -381,25 +475,27 @@ function set_action_query() { switch ( $modifier_type ) { case 'nonce': - - // leaving here for more granular nonce, in future, for eg, - // /media/nonce/edit/title/ - + /** + * Leaving here for more granular nonce, in future, for eg, + * /media/nonce/edit/title/ + */ break; case 'id': - - // leaving here for more granular editing, in future, for eg, - // /media/23/edit/title/ - + /** + * Leaving here for more granular editing, in future, for eg, + * /media/23/edit/title/ + */ break; case 'media_type': - - // /media/photos/edit/ | /media/videos/edit/ - // leaving here for more granular editing, in future, for eg, - // /media/photos/edit/title/ - // /media/photos/page/2/ + /** + * /media/photos/edit/ | /media/videos/edit/. + * leaving here for more granular editing, in future, + * for eg, + * /media/photos/edit/title/ + * /media/photos/page/2/. + */ if ( 'pg' === $second_modifier && is_numeric( $third_modifier ) ) { $pageno = $third_modifier; @@ -414,11 +510,8 @@ function set_action_query() { global $rtmedia; - //if ( ! $rtmedia->get_option( 'media_end_point_enable' ) ) - //include get_404_template(); - /** - * set action query object + * Set action query object * setting parameters in action query object for pagination */ $per_page_media = intval( $rtmedia->options['general_perPageMedia'] ); @@ -428,62 +521,66 @@ function set_action_query() { $modifier_type => $modifier_value, 'action' => $action, 'bulk' => $bulk, - 'page' => $pageno, + 'page' => intval( $pageno ), 'per_page_media' => $per_page_media, 'attributes' => $attributes, ); } /** - * additional actions to be added via action hook + * Additional actions to be added via action hook */ - function set_actions() { + public function set_actions() { $this->actions = apply_filters( 'rtmedia_query_actions', $this->actions ); } /** - * get media query for the request + * Get media query for the request * - * @param type $query + * @param object $query Query object. * - * @return type + * @return array */ - function &query( $query ) { + public function &query( $query ) { $this->original_query = $query; - /* + /** + * Comment. + * * @chandrapatel commented below code. here we are merging new query vars and previous query vars * which is cause an issue. For example, First time query vars contains media_type and second time query vars not contain media_type * then media not listed properly. * - * Later on, renmove this comment and below commented code. + * Later on, remove this comment and below commented code. + * $this->query = wp_parse_args( $query, $this->query ); */ - // $this->query = wp_parse_args( $query, $this->query ); - $this->query = $query; - //Set Json - $allowed_query = apply_filters( 'rtmedia_allowed_query', array( - 'id', - 'media_id', - 'media_type', - 'media_author', - 'album_id', - 'context', - 'context_id', - 'global', - 'privacy', - 'per_page', - 'lightbox', - 'media_title', - ) ); - if ( isset( $_REQUEST['rtmedia_shortcode'] ) ) { - $rtmedia_shortcode = $_REQUEST['rtmedia_shortcode']; - } + // Set Json. + $allowed_query = apply_filters( + 'rtmedia_allowed_query', + array( + 'id', + 'media_id', + 'media_type', + 'media_author', + 'album_id', + 'context', + 'context_id', + 'global', + 'privacy', + 'per_page', + 'lightbox', + 'media_title', + ) + ); + + $rtmedia_shortcode = sanitize_text_field( filter_input( INPUT_GET, 'rtmedia_shortcode', FILTER_SANITIZE_STRING ) ); + if ( ! empty( $rtmedia_shortcode ) ) { - $query_data = $_REQUEST; + $query_data = $_REQUEST; // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification foreach ( $query_data as $key => $val ) { - if ( ! in_array( $key, $allowed_query ) ) { + if ( ! in_array( $key, $allowed_query, true ) ) { unset( $query_data[ $key ] ); } } @@ -499,8 +596,8 @@ function &query( $query ) { } } - /* - * in gallery shortcode with uploader set to true, $this->is_gallery_shortcode won't be set for very first time and hence + /** + * In gallery shortcode with uploader set to true, $this->is_gallery_shortcode won't be set for very first time and hence * will miss the check for "$this->query['uploader']" */ if ( isset( $this->query['uploader'] ) ) { @@ -511,17 +608,23 @@ function &query( $query ) { if ( isset( $this->query['context'] ) && 'activity' === $this->query['context'] ) { $this->query['activity_id'] = array( 'value' ); global $wpdb; - //todo cache - $sql_query = "select id from {$wpdb->prefix}bp_activity where item_id = 0 and type = 'rtmedia_update'"; - $this->query['activity_id']['value'] = $wpdb->get_col( $sql_query ); + // todo cache. + $sql_query = "select id from {$wpdb->prefix}bp_activity where item_id = 0 and type = 'rtmedia_update'"; + $this->query['activity_id']['value'] = $wpdb->get_col( $sql_query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } + if ( isset( $this->query ) && isset( $this->query['global'] ) ) { if ( 'true' === $this->query['global'] ) { $this->shortcode_global = true; - add_filter( 'rtmedia-model-where-query', array( - 'RTMediaGalleryShortcode', - 'rtmedia_query_where_filter', - ), 10, 3 ); + add_filter( + 'rtmedia-model-where-query', + array( + 'RTMediaGalleryShortcode', + 'rtmedia_query_where_filter', + ), + 10, + 3 + ); $remove_comment_media = apply_filters( 'rtmedia_query_where_filter_remove_comment_media', true, 'galleryshortcode' ); if ( isset( $remove_comment_media ) && ! empty( $remove_comment_media ) ) { @@ -534,19 +637,23 @@ function &query( $query ) { if ( isset( $this->query['context'] ) ) { unset( $this->query['context'] ); } - //dont unset album id when provided, to show content of a single album - // if ( isset ( $this->query[ "album_id" ] ) ) - // unset ( $this->query[ "album_id" ] ); + if ( isset( $this->query['media_type'] ) && 'album' === $this->query['media_type'] ) { - //$this->action_query->media_type = "album"; - add_filter( 'rtmedia-before-template', array( - &$this, - 'register_set_gallery_template_filter', - ), 10, 2 ); + + add_filter( + 'rtmedia-before-template', + array( + &$this, + 'register_set_gallery_template_filter', + ), + 10, + 2 + ); } } unset( $this->query['global'] ); } + $this->set_media_type(); $this->media_query = $this->query; do_action( 'rtmedia_set_query' ); @@ -554,14 +661,30 @@ function &query( $query ) { return $this->get_data(); } - function register_set_gallery_template_filter( $template, $attr ) { + /** + * Function to remove gallery template filter. + * + * @param string $template Template. + * @param array $attr Attributes. + * + * @return string + */ + public function register_set_gallery_template_filter( $template, $attr ) { remove_filter( 'rtmedia-before-template', array( &$this, 'register_set_gallery_template_filter' ), 10, 2 ); return 'album-gallery'; } - function privacy_filter( $where, $table_name ) { + /** + * Function to filter user privacy for query. + * + * @param string $where Where clause. + * @param string $table_name Table name. + * + * @return string + */ + public function privacy_filter( $where, $table_name ) { if ( is_rt_admin() ) { return $where; } @@ -574,7 +697,7 @@ function privacy_filter( $where, $table_name ) { if ( class_exists( 'BuddyPress' ) ) { if ( bp_is_active( 'friends' ) ) { $friends = $this->friendship->get_friends_cache( $user ); - $where .= " OR ({$table_name}.privacy=40 AND {$table_name}.media_author IN ('" . implode( "','", $friends ) . "'))"; + $where .= " OR ({$table_name}.privacy=40 AND {$table_name}.media_author IN ('" . implode( "','", $friends ) . "'))"; } } } @@ -582,7 +705,12 @@ function privacy_filter( $where, $table_name ) { return $where . ')'; } - function get_user() { + /** + * Get current user. + * + * @return int|mixed|void + */ + public function get_user() { if ( is_user_logged_in() ) { $user = apply_filters( 'rtmedia_current_user', get_current_user_id() ); } else { @@ -592,7 +720,10 @@ function get_user() { return $user; } - function set_privacy() { + /** + * Set user privacy. + */ + public function set_privacy() { $user = $this->get_user(); if ( ! $user ) { $privacy = 0; @@ -601,7 +732,13 @@ function set_privacy() { } } - function populate_media() { + /** + * Function to populate media. + * + * @return array|bool + */ + public function populate_media() { + global $rtmedia_query; // Check if the page is gallery shortcode or not. @@ -614,14 +751,11 @@ function populate_media() { $allowed_media_types = array(); - // is this an album or some other media + // is this an album or some other media. $this->album_or_media(); $order_by = $this->order_by(); - //add filter to filter group media when context is profile - //add_filter('rtmedia-model-where-query',array($this,'rtmedia_model_where_query'), 10, 3); - if ( isset( $this->media_query['context'] ) ) { if ( 'profile' === $this->media_query['context'] ) { @@ -632,23 +766,19 @@ function populate_media() { $author = $this->media_query['context_id']; } - //if it is a media single page, then unset the context and context id + // If it is a media single page, then unset the context and context id. if ( $this->is_single() ) { unset( $this->media_query['context'] ); unset( $this->media_query['context_id'] ); } - //unset ( $this->media_query[ 'context' ] ); - //unset ( $this->media_query[ 'context_id' ] ); } else { if ( 'group' === $this->media_query['context'] ) { $group_id = $this->media_query['context_id']; - } else { - } } - // Multiple context_id support - if ( isset( $this->media_query['context_id'] ) && sizeof( explode( ',', $this->media_query['context_id'] ) ) > 1 ) { + // Multiple context_id support. + if ( isset( $this->media_query['context_id'] ) && count( explode( ',', $this->media_query['context_id'] ) ) > 1 ) { $this->media_query['context_id'] = array( 'compare' => 'in', 'value' => explode( ',', $this->media_query['context_id'] ), @@ -656,8 +786,8 @@ function populate_media() { } } - // Multiple album_id support - if ( isset( $this->media_query['album_id'] ) && sizeof( explode( ',', $this->media_query['album_id'] ) ) > 1 ) { + // Multiple album_id support. + if ( isset( $this->media_query['album_id'] ) && count( explode( ',', $this->media_query['album_id'] ) ) > 1 ) { $this->media_query['album_id'] = array( 'compare' => 'in', 'value' => explode( ',', $this->media_query['album_id'] ), @@ -665,18 +795,18 @@ function populate_media() { } if ( isset( $this->media_query['per_page'] ) ) { - //Do not include per_page in sql query to get media + // Do not include per_page in sql query to get media. $this->action_query->per_page_media = intval( $this->media_query['per_page'] ); unset( $this->media_query['per_page'] ); } - // lightbox option + // Lightbox option. if ( isset( $this->media_query['lightbox'] ) ) { if ( 'false' === $this->media_query['lightbox'] ) { - // Add filter to add no-popup class in a tag + // Add filter to add no-popup class in a tag. add_filter( 'rtmedia_gallery_list_item_a_class', 'rtmedia_add_no_popup_class', 10, 1 ); } - // Unset the lightbox parameter from media query + // Unset the lightbox parameter from media query. unset( $this->media_query['lightbox'] ); } @@ -702,26 +832,26 @@ function populate_media() { $context_id = $group_id; } - $media_for_total_count = count( $this->model->{$query_function} ( $context_id, false, false ) ); + $media_for_total_count = count( $this->model->{$query_function}( $context_id, false, false ) ); $this->action_query = apply_filters( 'rtmedia_action_query_in_populate_media', $this->action_query, $media_for_total_count ); if ( ' ' === $order_by ) { - $pre_media = $this->model->{$query_function} ( $context_id, ( $this->action_query->page - 1 ) * $this->action_query->per_page_media, $this->action_query->per_page_media ); + $pre_media = $this->model->{$query_function}( $context_id, ( $this->action_query->page - 1 ) * $this->action_query->per_page_media, $this->action_query->per_page_media ); } else { - $pre_media = $this->model->{$query_function} ( $context_id, ( $this->action_query->page - 1 ) * $this->action_query->per_page_media, $this->action_query->per_page_media, $order_by ); + $pre_media = $this->model->{$query_function}( $context_id, ( $this->action_query->page - 1 ) * $this->action_query->per_page_media, $this->action_query->per_page_media, $order_by ); } } else { /** - * count total medias in album irrespective of pagination + * Count total medias in album irrespective of pagination */ $media_for_total_count = $this->model->get_media( $this->media_query, false, false, false, true ); $this->action_query = apply_filters( 'rtmedia_action_query_in_populate_media', $this->action_query, $media_for_total_count ); /** - * fetch media entries from rtMedia context + * Fetch media entries from rtMedia context */ if ( ' ' === $order_by ) { $pre_media = $this->model->get_media( $this->media_query, ( $this->action_query->page - 1 ) * $this->action_query->per_page_media, $this->action_query->per_page_media ); @@ -729,8 +859,6 @@ function populate_media() { $pre_media = $this->model->get_media( $this->media_query, ( $this->action_query->page - 1 ) * $this->action_query->per_page_media, $this->action_query->per_page_media, $order_by ); } } - //add filter that was added to filter group media when context is profile - // remove_filter('rtmedia-model-where-query',array($this,'rtmedia_model_where_query'), 10, 3); $this->media_count = intval( $media_for_total_count ); @@ -740,22 +868,15 @@ function populate_media() { return $pre_media; } - /* removed because of indexing ---- 0,1,2 was required rather than post_ids - foreach ( $pre_media as $pre_medium ) { - $this->media[ $pre_medium->media_id ] = $pre_medium; - } */ } - // add a where condition to filter group media when context is profile - // function rtmedia_model_where_query($where, $table_name, $join) { - // - // if( isset( $this->original_query ) && isset( $this->original_query[ 'context' ] ) && $this->original_query[ 'context' ] == "profile" ) { - // $where .= ' AND ' . $table_name . '.context <> "group" '; - // } - // return $where; - // } - - function album_or_media() { + + /** + * Function to check media type. + */ + public function album_or_media() { + global $rtmedia; + foreach ( $rtmedia->allowed_types as $value ) { $allowed_media_types[] = $value['name']; } @@ -768,12 +889,17 @@ function album_or_media() { 'compare' => 'IN', 'value' => array( 'music', 'video', 'photo' ), ); - $this->media_query['media_type'] = apply_filters( 'rtmedia_query_media_type_filter', $this->media_query['media_type'] ); // can add more types here + $this->media_query['media_type'] = apply_filters( 'rtmedia_query_media_type_filter', $this->media_query['media_type'] ); // Can add more types here. } } } - function order_by() { + /** + * Function to filter order by. + * + * @return mixed|string|void + */ + public function order_by() { /** * Handle order of the result set */ @@ -793,11 +919,18 @@ function order_by() { } $order_by .= ' ' . $order; - return $order_by = apply_filters( 'rtmedia_model_order_by', $order_by ); + $order_by = apply_filters( 'rtmedia_model_order_by', $order_by ); + + return $order_by; } - function populate_album() { - $this->album = $this->media; + /** + * Function to populate album. + * + * @return array|bool + */ + public function populate_album() { + $this->album = $this->media; $this->media_query['album_id'] = $this->action_query->id; if ( apply_filters( 'rtmedia_unset_action_query_id_album', true ) ) { @@ -810,7 +943,12 @@ function populate_album() { return $this->populate_media(); } - function populate_comments() { + /** + * Function to populate comments. + * + * @return array|int + */ + public function populate_comments() { $this->model = new RTMediaCommentModel(); global $rtmedia_interaction; @@ -819,17 +957,18 @@ function populate_comments() { } /** - * populate the data object for the page/album + * Populate the data object for the page/album * - * @return boolean + * @return null */ - function populate_data() { + public function populate_data() { + unset( $this->media_query->meta_query ); unset( $this->media_query->tax_query ); $this->current_media = - 1; if ( 'comments' === $this->action_query->action && ! isset( $this->action_query->id ) ) { $this->media = $this->populate_comments(); - } else if ( $this->is_album() && ! $this->shortcode_global ) { + } elseif ( $this->is_album() && ! $this->shortcode_global ) { $this->media = $this->populate_album(); } else { $this->media = $this->populate_media(); @@ -840,7 +979,7 @@ function populate_data() { } /** - * multiside manipulation + * Multisite manipulation */ if ( is_multisite() ) { $blogs = array(); @@ -849,11 +988,11 @@ function populate_data() { } foreach ( $blogs as $blog_id => &$media ) { - //todo something for below statement + // todo something for below statement. switch_to_blog( $blog_id ); if ( ! ( 'comments' === $this->action_query->action && ! isset( $this->action_query->id ) ) ) { $this->populate_post_data( $media ); - wp_reset_query(); + wp_reset_query(); // phpcs:ignore WordPress.WP.DiscouragedFunctions.wp_reset_query_wp_reset_query } } restore_current_blog(); @@ -863,33 +1002,37 @@ function populate_data() { } } if ( $this->shortcode_global ) { - remove_filter( 'rtmedia-model-where-query', array( - 'RTMediaGalleryShortcode', - 'rtmedia_query_where_filter', - ), 10, 3 ); + remove_filter( + 'rtmedia-model-where-query', + array( + 'RTMediaGalleryShortcode', + 'rtmedia_query_where_filter', + ), + 10 + ); } } /** - * helper method to fetch media id of each media from the map + * Helper method to fetch media id of each media from the map * - * @param type $media + * @param object $media Media object. * - * @return type + * @return int */ - function get_media_id( $media ) { + public function get_media_id( $media ) { return $media->media_id; } /** - * helper method to find the array entry for the given media id + * Helper method to find the array entry for the given media id * - * @param type $id + * @param int $id Media Id. * * @return null */ - function get_media_by_media_id( $id ) { + public function get_media_by_media_id( $id ) { foreach ( $this->media as $key => $media ) { if ( intval( $media->media_id ) === intval( $id ) ) { @@ -901,15 +1044,15 @@ function get_media_by_media_id( $id ) { } /** - * populate the post data for the fetched media from rtMedia context + * Populate the post data for the fetched media from rtMedia context * - * @param type $media + * @param array $media Medias to process. */ - function populate_post_data( $media ) { + public function populate_post_data( $media ) { if ( ! empty( $media ) && is_array( $media ) ) { /** - * setting up query vars for WP_Query + * Setting up query vars for WP_Query */ $media_post_query_args = array( 'orderby' => 'ID', @@ -922,20 +1065,20 @@ function populate_post_data( $media ) { ); /** - * setting up meta query vars + * Setting up meta query vars */ if ( isset( $this->query_vars->meta_query ) ) { $media_post_query_args['meta_query'] = $this->query_vars->meta_query; } /** - * setting up taxonomy query vars + * Setting up taxonomy query vars */ if ( isset( $this->query_vars->tax_query ) ) { $media_post_query_args['tax_query'] = $this->query_vars->tax_query; } /** - * fetch relative data from WP_POST + * Fetch relative data from WP_POST */ $media_post_query = new WP_Query( $media_post_query_args ); @@ -961,7 +1104,7 @@ function populate_post_data( $media ) { * * @return boolean */ - function have_media() { + public function have_media() { $total = $this->media_count; $curr = $this->current_media; @@ -972,7 +1115,7 @@ function have_media() { return true; } elseif ( $curr + 1 === $per_page && $per_page > 0 ) { do_action_ref_array( 'rtmedia_loop_end', array( &$this ) ); - // Do some cleaning up after the loop + // Do some cleaning up after the loop. $this->rewind_media(); } @@ -982,36 +1125,46 @@ function have_media() { } /** - * moves ahead in the loop of media within the album + * Moves ahead in the loop of media within the album * - * @global type $rtmedia_media - * @return type + * @global object $rtmedia_media + * @return object */ - function rtmedia() { + public function rtmedia() { + global $rtmedia_media; + $this->in_the_media_loop = true; - if ( - 1 === intval( $this->current_media ) ) { // loop has just started + if ( -1 === intval( $this->current_media ) ) { // loop has just started. do_action_ref_array( 'rtmedia_loop_start', array( &$this ) ); } - return $rtmedia_media = $this->next_media(); + $rtmedia_media = $this->next_media(); + + return $rtmedia_media; + } /** - * helper method for rt_album to move ahead in the db pool + * Helper method for rt_album to move ahead in the db pool * - * @return type + * @return array */ - function next_media() { - $this->current_media ++; + public function next_media() { + $this->current_media++; $this->rtmedia = $this->media[ $this->current_media ]; return $this->rtmedia; } - function permalink() { + /** + * Function for get parent permalink. + * + * @return mixed + */ + public function permalink() { global $rtmedia_media; $parent_link = ''; @@ -1030,7 +1183,7 @@ function permalink() { /** * Rewinds the db pool of media album and resets it to begining */ - function rewind_media() { + public function rewind_media() { $this->current_media = - 1; if ( $this->action_query->per_page_media > 0 ) { $this->media = $this->media[0]; @@ -1038,10 +1191,11 @@ function rewind_media() { } /** + * Function to get data. * - * @return type + * @return array */ - function &get_data() { + public function &get_data() { $this->populate_data(); diff --git a/bin/.travis.yml b/bin/.travis.yml index 1d485a93a..54b8ec178 100644 --- a/bin/.travis.yml +++ b/bin/.travis.yml @@ -43,7 +43,7 @@ before_script: - cd $PLUGIN_DIR - cp -Rf * /var/www/automation.rtmedia.me/htdocs/wp-content/plugins/rtMedia/ - cd /var/www/automation.rtmedia.me/htdocs/ - - wp --allow-root plugin install https://downloads.wordpress.org/plugin/buddypress.5.1.1.zip + - wp --allow-root plugin install https://downloads.wordpress.org/plugin/buddypress.5.1.2.zip - wp plugin activate --all - wp theme activate twentynineteen - cd $PLUGIN_DIR @@ -54,8 +54,8 @@ before_script: - unzip BrowserStackLocal-linux-x64.zip - nohup ./BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY & - cd $PLUGIN_DIR/tests/codeception/ - # - composer update - - composer install + - composer update + # - composer install - export PATH="$PATH:/home/travis/build/rtMediaWP/rtMedia/tests/codeception/vendor/bin" ## PHP_CodeSniffer - git clone https://github.com/squizlabs/PHP_CodeSniffer.git @@ -63,11 +63,13 @@ before_script: - pear install package.xml - cd ../ - git clone git://github.com/wimg/PHPCompatibility.git $(pear config-get php_dir)/PHP/CodeSniffer/Standards/PHPCompatibility + - git clone git://github.com/PHPCSStandards/PHPCSUtils.git $(pear config-get php_dir)/PHP/CodeSniffer/Standards/PHPCSUtils - phpenv rehash - phpcs -i - phpenv rehash - phpcs --config-set installed_paths $(pear config-get php_dir)/PHP/CodeSniffer/Standards - - phpcs --config-set installed_paths $(pear config-get php_dir)/PHP/CodeSniffer/Standards/PHPCompatibility + - phpcs --config-set installed_paths $(pear config-get php_dir)/PHP/CodeSniffer/Standards/PHPCompatibility,$(pear config-get php_dir)/PHP/CodeSniffer/Standards/PHPCSUtils + - phpcs --config-show installed_paths - phpcs -i - phpcs --config-set error_severity 0 - phpcs --config-set warning_severity 0 diff --git a/index.php b/index.php index 6117bd750..e8ddd12d3 100755 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: rtMedia for WordPress, BuddyPress and bbPress Plugin URI: https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously! - Version: 4.6.0 + Version: 4.6.1 Author: rtCamp Text Domain: buddypress-media Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media @@ -20,16 +20,14 @@ if ( ! defined( 'RTMEDIA_VERSION' ) ) { /** * The version of the plugin - * */ - define( 'RTMEDIA_VERSION', '4.6.0' ); + define( 'RTMEDIA_VERSION', '4.6.1' ); } if ( ! defined( 'RTMEDIA_PATH' ) ) { /** * The server file system path to the plugin directory - * */ define( 'RTMEDIA_PATH', plugin_dir_path( __FILE__ ) ); } @@ -38,7 +36,6 @@ /** * Legacy support - * */ define( 'BP_MEDIA_PATH', RTMEDIA_PATH ); } @@ -48,7 +45,6 @@ /** * The url to the plugin directory - * */ define( 'RTMEDIA_URL', plugin_dir_url( __FILE__ ) ); } @@ -57,7 +53,6 @@ /** * The url to the plugin directory - * */ define( 'RTMEDIA_BASE_NAME', plugin_basename( __FILE__ ) ); } @@ -67,7 +62,7 @@ * * Autoloads classes on instantiation. Used by spl_autoload_register. * - * @param string $class_name The name of the class to autoload + * @param string $class_name The name of the class to autoload. */ function rtmedia_autoloader( $class_name ) { $rtlibpath = array( @@ -111,7 +106,11 @@ function rtmedia_autoloader( $class_name ) { /** * Register the autoloader function into spl_autoload */ -spl_autoload_register( 'rtmedia_autoloader' ); +try { + spl_autoload_register( 'rtmedia_autoloader' ); +} catch ( Exception $e ) { + echo esc_html( $e->getMessage() ); +} /** * Instantiate the BuddyPressMedia class. @@ -119,15 +118,21 @@ function rtmedia_autoloader( $class_name ) { global $rtmedia; $rtmedia = new RTMedia(); +/** + * Check if it's VIP environment or not. + * + * @return bool + */ function is_rtmedia_vip_plugin() { return ( defined( 'WPCOM_IS_VIP_ENV' ) && WPCOM_IS_VIP_ENV ); } -/* + +/** * Look Ma! Very few includes! Next File: /app/main/RTMedia.php */ /** - * rtmedia_plugin_deactivate Do stuff on plugin deactivation + * Do stuff on plugin deactivation */ function rtmedia_plugin_deactivate() { update_option( 'is_permalink_reset', 'no' ); diff --git a/languages/buddypress-media.po b/languages/buddypress-media.po index 208af2282..d7c67f5e5 100644 --- a/languages/buddypress-media.po +++ b/languages/buddypress-media.po @@ -2,9 +2,9 @@ # This file is distributed under the same license as the rtMedia for WordPress, BuddyPress and bbPress package. msgid "" msgstr "" -"Project-Id-Version: rtMedia for WordPress, BuddyPress and bbPress 4.6.0\n" +"Project-Id-Version: rtMedia for WordPress, BuddyPress and bbPress 4.6.1\n" "Report-Msgid-Bugs-To: https://rtmedia.io/support/\n" -"POT-Creation-Date: 2020-02-14 09:36:14+00:00\n" +"POT-Creation-Date: 2020-04-08 09:51:26+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -24,904 +24,916 @@ msgstr "" "X-Textdomain-Support: yes\n" "X-Generator: grunt-wp-i18n 1.0.3\n" -#: app/admin/RTMediaAdmin.php:148 +#: app/admin/RTMediaAdmin.php:192 msgid "" "Install Transcoder plugin to convert audio/video files and " "thumbnails generation." msgstr "" -#: app/admin/RTMediaAdmin.php:215 -msgid "View “%s”" -msgstr "" - -#: app/admin/RTMediaAdmin.php:215 +#: app/admin/RTMediaAdmin.php:274 +#. translators: 1. Title. msgid "View" msgstr "" -#: app/admin/RTMediaAdmin.php:281 +#: app/admin/RTMediaAdmin.php:343 +#. translators: 1. Product page link. msgid "Check 30+ premium rtMedia add-ons on our store." msgstr "" -#: app/admin/RTMediaAdmin.php:284 +#: app/admin/RTMediaAdmin.php:345 msgid "rtMedia: " msgstr "" -#: app/admin/RTMediaAdmin.php:339 +#: app/admin/RTMediaAdmin.php:357 app/admin/RTMediaAdmin.php:507 +msgid "Dismiss" +msgstr "" + +#: app/admin/RTMediaAdmin.php:403 msgid "Meet InspireBook" msgstr "" -#: app/admin/RTMediaAdmin.php:341 +#: app/admin/RTMediaAdmin.php:405 msgid " - First official rtMedia premium theme." msgstr "" -#: app/admin/RTMediaAdmin.php:425 app/admin/RTMediaAdmin.php:450 +#: app/admin/RTMediaAdmin.php:481 app/admin/RTMediaAdmin.php:504 msgid "rtMedia:" msgstr "" -#: app/admin/RTMediaAdmin.php:425 +#: app/admin/RTMediaAdmin.php:481 msgid " You must" msgstr "" -#: app/admin/RTMediaAdmin.php:425 +#: app/admin/RTMediaAdmin.php:481 msgid "update permalink structure" msgstr "" -#: app/admin/RTMediaAdmin.php:425 +#: app/admin/RTMediaAdmin.php:481 msgid "to something other than the default for it to work." msgstr "" -#: app/admin/RTMediaAdmin.php:451 +#: app/admin/RTMediaAdmin.php:505 msgid "Please update all premium add-ons that you have purchased from" msgstr "" -#: app/admin/RTMediaAdmin.php:453 +#: app/admin/RTMediaAdmin.php:506 msgid "your account" msgstr "" -#: app/admin/RTMediaAdmin.php:455 -msgid "Dismiss" -msgstr "" - -#: app/admin/RTMediaAdmin.php:570 +#: app/admin/RTMediaAdmin.php:616 msgid "rtMedia Pro is released" msgstr "" -#: app/admin/RTMediaAdmin.php:591 +#: app/admin/RTMediaAdmin.php:635 msgid "Media Stats" msgstr "" -#: app/admin/RTMediaAdmin.php:621 +#: app/admin/RTMediaAdmin.php:665 msgid "Usage Stats" msgstr "" -#: app/admin/RTMediaAdmin.php:633 +#: app/admin/RTMediaAdmin.php:678 msgid "Total " msgstr "" -#: app/admin/RTMediaAdmin.php:644 +#: app/admin/RTMediaAdmin.php:689 msgid "With Media" msgstr "" -#: app/admin/RTMediaAdmin.php:655 +#: app/admin/RTMediaAdmin.php:700 msgid "Comments " msgstr "" -#: app/admin/RTMediaAdmin.php:666 app/main/controllers/media/RTMediaLike.php:21 +#: app/admin/RTMediaAdmin.php:711 app/main/controllers/media/RTMediaLike.php:31 msgid "Likes" msgstr "" -#: app/admin/RTMediaAdmin.php:676 +#: app/admin/RTMediaAdmin.php:721 msgid "rtMedia Links:" msgstr "" -#: app/admin/RTMediaAdmin.php:677 +#: app/admin/RTMediaAdmin.php:722 msgid "Homepage" msgstr "" -#: app/admin/RTMediaAdmin.php:679 +#: app/admin/RTMediaAdmin.php:724 msgid "Free Support" msgstr "" -#: app/admin/RTMediaAdmin.php:682 +#: app/admin/RTMediaAdmin.php:727 msgid "Premium Addons" msgstr "" -#: app/admin/RTMediaAdmin.php:699 +#: app/admin/RTMediaAdmin.php:744 msgid "Right Now in rtMedia" msgstr "" -#: app/admin/RTMediaAdmin.php:734 app/admin/RTMediaAdmin.php:768 -#: app/admin/RTMediaAdmin.php:771 app/admin/RTMediaAdmin.php:948 -#: app/admin/RTMediaAdmin.php:1295 +#: app/admin/RTMediaAdmin.php:777 app/admin/RTMediaAdmin.php:813 +#: app/admin/RTMediaAdmin.php:816 app/admin/RTMediaAdmin.php:1015 +#: app/admin/RTMediaAdmin.php:1016 app/admin/RTMediaAdmin.php:1381 msgid "Settings" msgstr "" -#: app/admin/RTMediaAdmin.php:736 app/admin/RTMediaAdmin.php:792 -#: app/admin/RTMediaAdmin.php:795 app/admin/RTMediaAdmin.php:958 -#: app/admin/RTMediaAdmin.php:1321 app/helper/RTMediaSettings.php:249 -#: app/helper/RTMediaSupport.php:67 app/helper/RTMediaSupport.php:68 +#: app/admin/RTMediaAdmin.php:779 app/admin/RTMediaAdmin.php:839 +#: app/admin/RTMediaAdmin.php:842 app/admin/RTMediaAdmin.php:1039 +#: app/admin/RTMediaAdmin.php:1040 app/admin/RTMediaAdmin.php:1407 +#: app/helper/RTMediaSettings.php:261 app/helper/RTMediaSupport.php:87 +#: app/helper/RTMediaSupport.php:88 msgid "Support" msgstr "" -#: app/admin/RTMediaAdmin.php:761 app/admin/RTMediaAdmin.php:1267 -#: app/admin/RTMediaAdmin.php:1268 app/importers/RTMediaActivityUpgrade.php:128 -#: app/importers/RTMediaMigration.php:68 app/main/RTMedia.php:1060 -#: app/main/RTMedia.php:1622 +#: app/admin/RTMediaAdmin.php:805 app/admin/RTMediaAdmin.php:1355 +#: app/admin/RTMediaAdmin.php:1356 app/importers/RTMediaActivityUpgrade.php:188 +#: app/importers/RTMediaMigration.php:92 app/main/RTMedia.php:1208 +#: app/main/RTMedia.php:2060 msgid "rtMedia" msgstr "" -#: app/admin/RTMediaAdmin.php:780 app/admin/RTMediaAdmin.php:783 -#: app/admin/RTMediaAdmin.php:953 app/admin/RTMediaAdmin.php:1300 +#: app/admin/RTMediaAdmin.php:826 app/admin/RTMediaAdmin.php:829 +#: app/admin/RTMediaAdmin.php:1027 app/admin/RTMediaAdmin.php:1028 +#: app/admin/RTMediaAdmin.php:1386 msgid "Addons" msgstr "" -#: app/admin/RTMediaAdmin.php:804 app/admin/RTMediaAdmin.php:807 -#: app/admin/RTMediaAdmin.php:964 app/admin/RTMediaAdmin.php:1308 +#: app/admin/RTMediaAdmin.php:852 app/admin/RTMediaAdmin.php:855 +#: app/admin/RTMediaAdmin.php:1052 app/admin/RTMediaAdmin.php:1053 +#: app/admin/RTMediaAdmin.php:1394 msgid "Themes" msgstr "" -#: app/admin/RTMediaAdmin.php:817 app/admin/RTMediaAdmin.php:820 -#: app/admin/RTMediaAdmin.php:971 app/admin/RTMediaAdmin.php:1314 +#: app/admin/RTMediaAdmin.php:866 app/admin/RTMediaAdmin.php:869 +#: app/admin/RTMediaAdmin.php:1066 app/admin/RTMediaAdmin.php:1067 +#: app/admin/RTMediaAdmin.php:1400 msgid "Hire Us" msgstr "" -#: app/admin/RTMediaAdmin.php:830 app/admin/RTMediaAdmin.php:833 -#: app/admin/RTMediaAdmin.php:978 app/admin/RTMediaAdmin.php:1328 +#: app/admin/RTMediaAdmin.php:880 app/admin/RTMediaAdmin.php:883 +#: app/admin/RTMediaAdmin.php:1080 app/admin/RTMediaAdmin.php:1081 +#: app/admin/RTMediaAdmin.php:1414 msgid "Licenses" msgstr "" -#: app/admin/RTMediaAdmin.php:884 +#: app/admin/RTMediaAdmin.php:938 +msgid "Invalid value for [default_size_property]." +msgstr "" + +#: app/admin/RTMediaAdmin.php:942 msgid "ON" msgstr "" -#: app/admin/RTMediaAdmin.php:885 +#: app/admin/RTMediaAdmin.php:943 msgid "OFF" msgstr "" -#: app/admin/RTMediaAdmin.php:892 +#: app/admin/RTMediaAdmin.php:950 msgid "Please do not refresh this page." msgstr "" -#: app/admin/RTMediaAdmin.php:893 +#: app/admin/RTMediaAdmin.php:951 msgid "Something went wrong. Please " msgstr "" -#: app/admin/RTMediaAdmin.php:893 +#: app/admin/RTMediaAdmin.php:951 msgid "refresh" msgstr "" -#: app/admin/RTMediaAdmin.php:893 +#: app/admin/RTMediaAdmin.php:951 msgid " page." msgstr "" -#: app/admin/RTMediaAdmin.php:894 +#: app/admin/RTMediaAdmin.php:952 msgid "This will subscribe you to the free plan." msgstr "" -#: app/admin/RTMediaAdmin.php:895 +#: app/admin/RTMediaAdmin.php:953 msgid "Are you sure you want to disable the encoding service?" msgstr "" -#: app/admin/RTMediaAdmin.php:896 +#: app/admin/RTMediaAdmin.php:954 msgid "Are you sure you want to enable the encoding service?" msgstr "" -#: app/admin/RTMediaAdmin.php:897 +#: app/admin/RTMediaAdmin.php:955 msgid "Settings have changed, you should save them!" msgstr "" -#: app/admin/RTMediaAdmin.php:898 +#: app/admin/RTMediaAdmin.php:956 msgid "" "Number of video thumbnails to be generated should be greater than 0 in " "media sizes settings. Setting it to default value 2." msgstr "" -#: app/admin/RTMediaAdmin.php:899 +#: app/admin/RTMediaAdmin.php:957 msgid "" "Invalid value for number of video thumbnails in media sizes settings. " "Setting it to round value" msgstr "" -#: app/admin/RTMediaAdmin.php:900 +#: app/admin/RTMediaAdmin.php:958 msgid "" "Number of percentage in JPEG image quality should be greater than 0 in " "media sizes settings. Setting it to default value 90." msgstr "" -#: app/admin/RTMediaAdmin.php:901 +#: app/admin/RTMediaAdmin.php:959 msgid "" "Number of percentage in JPEG image quality should be less than 100 in media " "sizes settings. Setting it to 100." msgstr "" -#: app/admin/RTMediaAdmin.php:902 +#: app/admin/RTMediaAdmin.php:960 msgid "" "Invalid value for percentage in JPEG image quality in media sizes settings. " "Setting it to round value" msgstr "" -#: app/admin/RTMediaAdmin.php:903 +#: app/admin/RTMediaAdmin.php:961 msgid "" "Please enter positive integer value only. Setting number of media per page " "value to default value 10." msgstr "" -#: app/admin/RTMediaAdmin.php:904 +#: app/admin/RTMediaAdmin.php:962 msgid "" "Please enter positive integer value only. Setting number of media per page " "value to round value" msgstr "" -#: app/admin/RTMediaAdmin.php:905 +#: app/admin/RTMediaAdmin.php:963 msgid "Request failed." msgstr "" -#: app/admin/RTMediaAdmin.php:906 +#: app/admin/RTMediaAdmin.php:964 msgid "You can not use @import statement in custom css" msgstr "" -#: app/admin/RTMediaAdmin.php:914 +#: app/admin/RTMediaAdmin.php:972 msgid "Please enter WP Admin Login." msgstr "" -#: app/admin/RTMediaAdmin.php:915 +#: app/admin/RTMediaAdmin.php:973 msgid "Please enter WP Admin password." msgstr "" -#: app/admin/RTMediaAdmin.php:916 +#: app/admin/RTMediaAdmin.php:974 msgid "Please enter SSH / FTP host." msgstr "" -#: app/admin/RTMediaAdmin.php:917 +#: app/admin/RTMediaAdmin.php:975 msgid "Please enter SSH / FTP login." msgstr "" -#: app/admin/RTMediaAdmin.php:918 +#: app/admin/RTMediaAdmin.php:976 msgid "Please enter SSH / FTP password." msgstr "" -#: app/admin/RTMediaAdmin.php:919 +#: app/admin/RTMediaAdmin.php:977 msgid "Please fill all the fields." msgstr "" -#: app/admin/RTMediaAdmin.php:1149 +#: app/admin/RTMediaAdmin.php:1238 msgid "Empowering The Web With WordPress" msgstr "" -#: app/admin/RTMediaAdmin.php:1170 +#: app/admin/RTMediaAdmin.php:1260 msgid "Settings saved successfully!" msgstr "" -#: app/admin/RTMediaAdmin.php:1176 app/admin/RTMediaAdmin.php:1205 +#: app/admin/RTMediaAdmin.php:1264 app/admin/RTMediaAdmin.php:1295 msgid "Save Settings" msgstr "" -#: app/admin/RTMediaAdmin.php:1402 app/admin/RTMediaAdmin.php:1403 +#: app/admin/RTMediaAdmin.php:1488 app/admin/RTMediaAdmin.php:1489 msgid "Display" msgstr "" -#: app/admin/RTMediaAdmin.php:1411 +#: app/admin/RTMediaAdmin.php:1497 msgid "rtMedia BuddyPress" msgstr "" -#: app/admin/RTMediaAdmin.php:1412 +#: app/admin/RTMediaAdmin.php:1498 msgid "BuddyPress" msgstr "" -#: app/admin/RTMediaAdmin.php:1420 +#: app/admin/RTMediaAdmin.php:1506 msgid "rtMedia Types" msgstr "" -#: app/admin/RTMediaAdmin.php:1421 +#: app/admin/RTMediaAdmin.php:1507 msgid "Types" msgstr "" -#: app/admin/RTMediaAdmin.php:1428 +#: app/admin/RTMediaAdmin.php:1514 msgid "rtMedia Sizes" msgstr "" -#: app/admin/RTMediaAdmin.php:1429 +#: app/admin/RTMediaAdmin.php:1515 msgid "Media Sizes" msgstr "" -#: app/admin/RTMediaAdmin.php:1436 +#: app/admin/RTMediaAdmin.php:1522 msgid "rtMedia Privacy" msgstr "" -#: app/admin/RTMediaAdmin.php:1437 -#: app/main/controllers/privacy/RTMediaPrivacy.php:435 +#: app/admin/RTMediaAdmin.php:1523 +#: app/main/controllers/privacy/RTMediaPrivacy.php:538 msgid "Privacy" msgstr "" -#: app/admin/RTMediaAdmin.php:1443 +#: app/admin/RTMediaAdmin.php:1529 msgid "rtMedia Custom CSS" msgstr "" -#: app/admin/RTMediaAdmin.php:1444 +#: app/admin/RTMediaAdmin.php:1530 msgid "Custom CSS" msgstr "" -#: app/admin/RTMediaAdmin.php:1453 app/admin/RTMediaAdmin.php:1454 +#: app/admin/RTMediaAdmin.php:1539 app/admin/RTMediaAdmin.php:1540 msgid "Other Settings" msgstr "" -#: app/admin/RTMediaAdmin.php:1461 app/admin/RTMediaAdmin.php:1462 +#: app/admin/RTMediaAdmin.php:1547 app/admin/RTMediaAdmin.php:1548 msgid "Export/Import" msgstr "" -#: app/admin/RTMediaAdmin.php:1509 +#: app/admin/RTMediaAdmin.php:1599 +#. translators: 1. Home url. msgid "I use @rtMediaWP http://rt.cx/rtmedia on %s" msgstr "" -#: app/admin/RTMediaAdmin.php:1511 +#: app/admin/RTMediaAdmin.php:1601 msgid "Post to Twitter Now" msgstr "" -#: app/admin/RTMediaAdmin.php:1511 +#: app/admin/RTMediaAdmin.php:1601 msgid "Post to Twitter" msgstr "" -#: app/admin/RTMediaAdmin.php:1512 +#: app/admin/RTMediaAdmin.php:1602 msgid "Share on Facebook Now" msgstr "" -#: app/admin/RTMediaAdmin.php:1512 +#: app/admin/RTMediaAdmin.php:1602 msgid "Share on Facebook" msgstr "" -#: app/admin/RTMediaAdmin.php:1513 +#: app/admin/RTMediaAdmin.php:1603 msgid "Rate rtMedia on Wordpress.org" msgstr "" -#: app/admin/RTMediaAdmin.php:1513 +#: app/admin/RTMediaAdmin.php:1603 msgid "Rate on Wordpress.org" msgstr "" -#: app/admin/RTMediaAdmin.php:1514 +#: app/admin/RTMediaAdmin.php:1604 msgid "Subscribe to our Feeds" msgstr "" -#: app/admin/RTMediaAdmin.php:1517 +#: app/admin/RTMediaAdmin.php:1607 msgid "Spread the Word" msgstr "" -#: app/admin/RTMediaAdmin.php:1523 app/admin/RTMediaAdmin.php:1530 +#: app/admin/RTMediaAdmin.php:1613 app/admin/RTMediaAdmin.php:1620 msgid "Subscribe" msgstr "" -#: app/admin/RTMediaAdmin.php:1574 +#: app/admin/RTMediaAdmin.php:1669 msgid "Unable to read file!" msgstr "" -#: app/admin/RTMediaAdmin.php:1585 app/admin/RTMediaAdmin.php:1592 +#: app/admin/RTMediaAdmin.php:1681 app/admin/RTMediaAdmin.php:1688 msgid "Invalid JSON Supplied!" msgstr "" -#: app/admin/RTMediaAdmin.php:1598 +#: app/admin/RTMediaAdmin.php:1694 msgid "Invalid JSON Supplied. The JSON you supplied is not exported from rtMedia!" msgstr "" -#: app/admin/RTMediaAdmin.php:1608 +#: app/admin/RTMediaAdmin.php:1704 msgid "Data passed for settings is unchanged!" msgstr "" -#: app/admin/RTMediaAdmin.php:1612 +#: app/admin/RTMediaAdmin.php:1708 msgid "rtMedia Settings imported successfully!" msgstr "" -#: app/admin/RTMediaAdmin.php:1615 +#: app/admin/RTMediaAdmin.php:1711 msgid "Could not update rtMedia Settings" msgstr "" -#: app/admin/RTMediaAdmin.php:1637 +#: app/admin/RTMediaAdmin.php:1746 msgid "Thank you for your time." msgstr "" -#: app/admin/RTMediaAdmin.php:1650 +#: app/admin/RTMediaAdmin.php:1770 msgid "Premium Add-ons" msgstr "" -#: app/admin/RTMediaAdmin.php:1668 +#: app/admin/RTMediaAdmin.php:1794 +#. translators: 1. Not supported image types. msgid "" "You have images enabled on rtMedia but your network allowed filetypes do " "not permit uploading of %s. Click " msgstr "" -#: app/admin/RTMediaAdmin.php:1669 app/admin/RTMediaAdmin.php:1687 -#: app/admin/RTMediaAdmin.php:1705 app/admin/RTMediaFormHandler.php:610 -#: app/helper/RTMediaSettings.php:325 app/helper/RTMediaSupport.php:417 -#: app/helper/RTMediaSupport.php:695 +#: app/admin/RTMediaAdmin.php:1796 app/admin/RTMediaAdmin.php:1814 +#: app/admin/RTMediaAdmin.php:1832 app/admin/RTMediaFormHandler.php:628 +#: app/helper/RTMediaSettings.php:342 app/helper/RTMediaSupport.php:445 +#: app/helper/RTMediaSupport.php:730 msgid "here" msgstr "" -#: app/admin/RTMediaAdmin.php:1670 app/admin/RTMediaAdmin.php:1688 -#: app/admin/RTMediaAdmin.php:1706 +#: app/admin/RTMediaAdmin.php:1797 app/admin/RTMediaAdmin.php:1815 +#: app/admin/RTMediaAdmin.php:1833 msgid " to change your settings manually." msgstr "" -#: app/admin/RTMediaAdmin.php:1672 app/admin/RTMediaAdmin.php:1690 -#: app/admin/RTMediaAdmin.php:1708 +#: app/admin/RTMediaAdmin.php:1799 app/admin/RTMediaAdmin.php:1817 +#: app/admin/RTMediaAdmin.php:1835 msgid "Recommended:" msgstr "" -#: app/admin/RTMediaAdmin.php:1673 app/admin/RTMediaAdmin.php:1691 -#: app/admin/RTMediaAdmin.php:1709 +#: app/admin/RTMediaAdmin.php:1800 app/admin/RTMediaAdmin.php:1818 +#: app/admin/RTMediaAdmin.php:1836 msgid "Update Network Settings Automatically" msgstr "" -#: app/admin/RTMediaAdmin.php:1686 +#: app/admin/RTMediaAdmin.php:1813 msgid "" "You have video enabled on BuddyPress Media but your network allowed " "filetypes do not permit uploading of mp4. Click " msgstr "" -#: app/admin/RTMediaAdmin.php:1704 +#: app/admin/RTMediaAdmin.php:1831 msgid "" "You have audio enabled on BuddyPress Media but your network allowed " "filetypes do not permit uploading of mp3. Click " msgstr "" -#: app/admin/RTMediaAdmin.php:1725 +#: app/admin/RTMediaAdmin.php:1852 msgid "Network settings updated successfully." msgstr "" -#: app/admin/RTMediaAdmin.php:1778 +#: app/admin/RTMediaAdmin.php:1914 msgid "" "Please update rtMedia template files if you have overridden the default " "rtMedia templates in your theme. If not, you can ignore and hide this " "notice." msgstr "" -#: app/admin/RTMediaAdmin.php:1778 -#: app/importers/RTMediaMediaSizeImporter.php:73 -#: app/importers/RTMediaMigration.php:68 +#: app/admin/RTMediaAdmin.php:1914 +#: app/importers/RTMediaMediaSizeImporter.php:104 +#: app/importers/RTMediaMigration.php:92 msgid "Hide" msgstr "" -#: app/admin/RTMediaAdmin.php:1918 +#: app/admin/RTMediaAdmin.php:2074 +#. translators: 1. Account page and link. msgid "" -"Your license keys can be found on my-account page. For " -"more details, please refer to License documentation page." +"Your license keys can be found on my-account page. For " +"more details, please refer to License documentation " +"page." msgstr "" -#: app/admin/RTMediaAdmin.php:1935 +#: app/admin/RTMediaAdmin.php:2090 +#. translators: 1. License page link. msgid "" "We found an invalid or expired license key for an rtMedia add-on. Please go " -"to the Licenses page to fix this issue." +"to the Licenses page to fix this issue." msgstr "" -#: app/admin/RTMediaFormHandler.php:63 app/admin/RTMediaFormHandler.php:104 -#: app/admin/RTMediaFormHandler.php:197 app/admin/RTMediaFormHandler.php:232 -#: app/admin/RTMediaFormHandler.php:313 app/admin/RTMediaFormHandler.php:342 +#: app/admin/RTMediaFormHandler.php:68 app/admin/RTMediaFormHandler.php:114 +#: app/admin/RTMediaFormHandler.php:217 app/admin/RTMediaFormHandler.php:249 +#: app/admin/RTMediaFormHandler.php:332 app/admin/RTMediaFormHandler.php:362 msgid "Please provide a \"value\" in the argument." msgstr "" -#: app/admin/RTMediaFormHandler.php:145 +#: app/admin/RTMediaFormHandler.php:160 msgid "Need to specify atleast two radios, else use a checkbox instead" msgstr "" -#: app/admin/RTMediaFormHandler.php:268 +#: app/admin/RTMediaFormHandler.php:285 msgid "Please provide a \"href\" in the argument." msgstr "" -#: app/admin/RTMediaFormHandler.php:274 +#: app/admin/RTMediaFormHandler.php:291 msgid "Please provide a \"text\" in the argument." msgstr "" -#: app/admin/RTMediaFormHandler.php:415 templates/media/album-gallery.php:67 -#: templates/media/media-gallery.php:101 +#: app/admin/RTMediaFormHandler.php:435 templates/media/album-gallery.php:75 +#: templates/media/media-gallery.php:114 msgid "Load More" msgstr "" -#: app/admin/RTMediaFormHandler.php:416 +#: app/admin/RTMediaFormHandler.php:436 msgid "Pagination" msgstr "" -#: app/admin/RTMediaFormHandler.php:428 +#: app/admin/RTMediaFormHandler.php:448 msgid "Allow user to comment on uploaded media" msgstr "" -#: app/admin/RTMediaFormHandler.php:433 +#: app/admin/RTMediaFormHandler.php:453 msgid "" "This will display the comment form and comment listing on single media " "pages as well as inside lightbox (if lightbox is enabled)." msgstr "" -#: app/admin/RTMediaFormHandler.php:438 +#: app/admin/RTMediaFormHandler.php:458 msgid "Enable gallery media search" msgstr "" -#: app/admin/RTMediaFormHandler.php:443 +#: app/admin/RTMediaFormHandler.php:463 msgid "This will enable the search box in gallery page." msgstr "" -#: app/admin/RTMediaFormHandler.php:448 +#: app/admin/RTMediaFormHandler.php:468 msgid "Enable likes for media" msgstr "" -#: app/admin/RTMediaFormHandler.php:453 +#: app/admin/RTMediaFormHandler.php:473 msgid "Enabling this setting will add like feature for media." msgstr "" -#: app/admin/RTMediaFormHandler.php:458 +#: app/admin/RTMediaFormHandler.php:478 msgid "Use lightbox to display media" msgstr "" -#: app/admin/RTMediaFormHandler.php:463 +#: app/admin/RTMediaFormHandler.php:483 msgid "View single media in facebook style lightbox." msgstr "" -#: app/admin/RTMediaFormHandler.php:468 +#: app/admin/RTMediaFormHandler.php:488 msgid "Number of media per page" msgstr "" -#: app/admin/RTMediaFormHandler.php:474 +#: app/admin/RTMediaFormHandler.php:494 msgid "Number of media items you want to show per page on front end." msgstr "" -#: app/admin/RTMediaFormHandler.php:480 +#: app/admin/RTMediaFormHandler.php:500 msgid "Media display pagination option" msgstr "" -#: app/admin/RTMediaFormHandler.php:486 +#: app/admin/RTMediaFormHandler.php:506 msgid "Choose whether you want the load more button or pagination buttons." msgstr "" -#: app/admin/RTMediaFormHandler.php:492 +#: app/admin/RTMediaFormHandler.php:512 msgid "Enable" msgstr "" -#: app/admin/RTMediaFormHandler.php:492 +#: app/admin/RTMediaFormHandler.php:512 msgid "Cascading grid layout" msgstr "" -#: app/admin/RTMediaFormHandler.php:497 app/admin/RTMediaFormHandler.php:509 +#: app/admin/RTMediaFormHandler.php:517 app/admin/RTMediaFormHandler.php:529 msgid "If you enable masonry view, it is advisable to" msgstr "" -#: app/admin/RTMediaFormHandler.php:497 app/admin/RTMediaFormHandler.php:509 +#: app/admin/RTMediaFormHandler.php:517 app/admin/RTMediaFormHandler.php:529 msgid "for masonry view." msgstr "" -#: app/admin/RTMediaFormHandler.php:501 +#: app/admin/RTMediaFormHandler.php:521 msgid "You might need to" msgstr "" -#: app/admin/RTMediaFormHandler.php:501 +#: app/admin/RTMediaFormHandler.php:521 msgid "change thumbnail size" msgstr "" -#: app/admin/RTMediaFormHandler.php:501 +#: app/admin/RTMediaFormHandler.php:521 msgid "and uncheck the crop box for thumbnails." msgstr "" -#: app/admin/RTMediaFormHandler.php:501 +#: app/admin/RTMediaFormHandler.php:521 msgid "" "To set gallery for fixed width, set image height to 0 and width as per your " "requirement and vice-versa." msgstr "" -#: app/admin/RTMediaFormHandler.php:504 +#: app/admin/RTMediaFormHandler.php:524 msgid "Enable Masonry Cascading grid layout for activity" msgstr "" -#: app/admin/RTMediaFormHandler.php:516 +#: app/admin/RTMediaFormHandler.php:536 msgid "Enable Direct Upload" msgstr "" -#: app/admin/RTMediaFormHandler.php:521 +#: app/admin/RTMediaFormHandler.php:541 msgid "Uploading media directly as soon as it gets selected." msgstr "" -#: app/admin/RTMediaFormHandler.php:550 +#: app/admin/RTMediaFormHandler.php:568 msgid "Single Media View" msgstr "" -#: app/admin/RTMediaFormHandler.php:551 app/helper/RTMediaAddon.php:348 +#: app/admin/RTMediaFormHandler.php:569 app/helper/RTMediaAddon.php:358 msgid "Media Likes" msgstr "" -#: app/admin/RTMediaFormHandler.php:552 +#: app/admin/RTMediaFormHandler.php:570 msgid "List Media View" msgstr "" -#: app/admin/RTMediaFormHandler.php:553 +#: app/admin/RTMediaFormHandler.php:571 msgid "Masonry View" msgstr "" -#: app/admin/RTMediaFormHandler.php:554 +#: app/admin/RTMediaFormHandler.php:572 msgid "Direct Upload" msgstr "" -#: app/admin/RTMediaFormHandler.php:555 +#: app/admin/RTMediaFormHandler.php:573 msgid "Gallery Media Search" msgstr "" -#: app/admin/RTMediaFormHandler.php:573 +#: app/admin/RTMediaFormHandler.php:591 msgid "Allow usage data tracking" msgstr "" -#: app/admin/RTMediaFormHandler.php:578 +#: app/admin/RTMediaFormHandler.php:596 msgid "" "To make rtMedia better compatible with your sites, you can help the rtMedia " "team learn what themes and plugins you are using. No private information " "about your setup will be sent during tracking." msgstr "" -#: app/admin/RTMediaFormHandler.php:582 +#: app/admin/RTMediaFormHandler.php:600 msgid "Admin bar menu integration" msgstr "" -#: app/admin/RTMediaFormHandler.php:587 +#: app/admin/RTMediaFormHandler.php:605 msgid "" "Add rtMedia menu to WordPress admin bar for easy access to settings and " "moderation page (if enabled)." msgstr "" -#: app/admin/RTMediaFormHandler.php:592 +#: app/admin/RTMediaFormHandler.php:610 msgid "Add a link to rtMedia in footer" msgstr "" -#: app/admin/RTMediaFormHandler.php:597 +#: app/admin/RTMediaFormHandler.php:615 msgid "Help us promote rtMedia." msgstr "" -#: app/admin/RTMediaFormHandler.php:602 +#: app/admin/RTMediaFormHandler.php:620 msgid "Enable JSON API" msgstr "" -#: app/admin/RTMediaFormHandler.php:607 +#: app/admin/RTMediaFormHandler.php:625 msgid "" "This will allow handling API requests for rtMedia sent through any mobile " "app." msgstr "" -#: app/admin/RTMediaFormHandler.php:610 +#: app/admin/RTMediaFormHandler.php:628 msgid "You can refer to the API document from" msgstr "" -#: app/admin/RTMediaFormHandler.php:630 +#: app/admin/RTMediaFormHandler.php:648 msgid "Admin Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:631 +#: app/admin/RTMediaFormHandler.php:649 msgid "API Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:632 +#: app/admin/RTMediaFormHandler.php:650 msgid "Miscellaneous" msgstr "" -#: app/admin/RTMediaFormHandler.php:633 +#: app/admin/RTMediaFormHandler.php:651 msgid "Footer Link" msgstr "" -#: app/admin/RTMediaFormHandler.php:651 +#: app/admin/RTMediaFormHandler.php:669 msgid "Export rtMedia Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:656 +#: app/admin/RTMediaFormHandler.php:674 msgid "Export Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:657 +#: app/admin/RTMediaFormHandler.php:675 msgid "This will export rtMedia settings into a JSON file." msgstr "" -#: app/admin/RTMediaFormHandler.php:663 +#: app/admin/RTMediaFormHandler.php:681 msgid "Import rtMedia Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:668 +#: app/admin/RTMediaFormHandler.php:686 msgid "Import Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:669 +#: app/admin/RTMediaFormHandler.php:687 msgid "This will import rtMedia settings. Allowed File Type: json" msgstr "" -#: app/admin/RTMediaFormHandler.php:672 +#: app/admin/RTMediaFormHandler.php:690 msgid "" "Importing invalid files/settings may break your site. Please import valid " "file exported from rtMedia plugin only." msgstr "" -#: app/admin/RTMediaFormHandler.php:675 +#: app/admin/RTMediaFormHandler.php:693 msgid "Export your personal data" msgstr "" -#: app/admin/RTMediaFormHandler.php:680 +#: app/admin/RTMediaFormHandler.php:698 msgid "Export Data" msgstr "" -#: app/admin/RTMediaFormHandler.php:681 +#: app/admin/RTMediaFormHandler.php:699 msgid "This will export your personal data." msgstr "" -#: app/admin/RTMediaFormHandler.php:687 +#: app/admin/RTMediaFormHandler.php:705 msgid "Erase your personal data" msgstr "" -#: app/admin/RTMediaFormHandler.php:692 +#: app/admin/RTMediaFormHandler.php:710 msgid "Erase Data" msgstr "" -#: app/admin/RTMediaFormHandler.php:693 +#: app/admin/RTMediaFormHandler.php:711 msgid "This will erase your personal data." msgstr "" -#: app/admin/RTMediaFormHandler.php:697 +#: app/admin/RTMediaFormHandler.php:715 msgid "Data will be expoted or erased along with wordpress user data." msgstr "" -#: app/admin/RTMediaFormHandler.php:726 +#: app/admin/RTMediaFormHandler.php:744 msgid "Export/Import Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:727 +#: app/admin/RTMediaFormHandler.php:745 msgid "Export/Erase Personal Data" msgstr "" -#: app/admin/RTMediaFormHandler.php:813 +#: app/admin/RTMediaFormHandler.php:829 msgid "Media Types Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:821 app/helper/RTMediaSettings.php:347 +#: app/admin/RTMediaFormHandler.php:838 app/helper/RTMediaSettings.php:363 msgid "Media Type" msgstr "" -#: app/admin/RTMediaFormHandler.php:826 +#: app/admin/RTMediaFormHandler.php:844 msgid "Allow Upload" msgstr "" -#: app/admin/RTMediaFormHandler.php:828 +#: app/admin/RTMediaFormHandler.php:846 msgid "Allows you to upload a particular media type on your post." msgstr "" -#: app/admin/RTMediaFormHandler.php:836 +#: app/admin/RTMediaFormHandler.php:854 msgid "Set Featured" msgstr "" -#: app/admin/RTMediaFormHandler.php:838 +#: app/admin/RTMediaFormHandler.php:856 msgid "Place a specific media as a featured content on the post." msgstr "" -#: app/admin/RTMediaFormHandler.php:886 +#: app/admin/RTMediaFormHandler.php:904 msgid "File Extensions" msgstr "" -#: app/admin/RTMediaFormHandler.php:1017 +#: app/admin/RTMediaFormHandler.php:1039 msgid "Media Size Settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:1022 +#: app/admin/RTMediaFormHandler.php:1044 msgid "Category" msgstr "" -#: app/admin/RTMediaFormHandler.php:1023 +#: app/admin/RTMediaFormHandler.php:1045 msgid "Entity" msgstr "" -#: app/admin/RTMediaFormHandler.php:1024 +#: app/admin/RTMediaFormHandler.php:1046 msgid "Width" msgstr "" -#: app/admin/RTMediaFormHandler.php:1025 +#: app/admin/RTMediaFormHandler.php:1047 msgid "Height" msgstr "" -#: app/admin/RTMediaFormHandler.php:1026 +#: app/admin/RTMediaFormHandler.php:1048 msgid "Crop" msgstr "" -#: app/admin/RTMediaFormHandler.php:1076 +#: app/admin/RTMediaFormHandler.php:1098 msgid "JPEG/JPG image quality (1-100)" msgstr "" -#: app/admin/RTMediaFormHandler.php:1082 +#: app/admin/RTMediaFormHandler.php:1104 msgid "Enter JPEG/JPG Image Quality. Minimum value is 1. 100 is original quality." msgstr "" -#: app/admin/RTMediaFormHandler.php:1090 +#: app/admin/RTMediaFormHandler.php:1112 msgid "Image Quality" msgstr "" -#: app/admin/RTMediaFormHandler.php:1112 +#: app/admin/RTMediaFormHandler.php:1132 msgid "Custom CSS settings" msgstr "" -#: app/admin/RTMediaFormHandler.php:1129 +#: app/admin/RTMediaFormHandler.php:1149 msgid "rtMedia default styles" msgstr "" -#: app/admin/RTMediaFormHandler.php:1135 +#: app/admin/RTMediaFormHandler.php:1155 msgid "" "Load default rtMedia styles. You need to write your own style for rtMedia " "if you disable it." msgstr "" -#: app/admin/RTMediaFormHandler.php:1140 +#: app/admin/RTMediaFormHandler.php:1160 msgid "Paste your CSS code" msgstr "" -#: app/admin/RTMediaFormHandler.php:1146 +#: app/admin/RTMediaFormHandler.php:1166 msgid "Custom rtMedia CSS container" msgstr "" -#: app/admin/RTMediaFormHandler.php:1169 +#: app/admin/RTMediaFormHandler.php:1189 msgid "Enable privacy" msgstr "" -#: app/admin/RTMediaFormHandler.php:1175 +#: app/admin/RTMediaFormHandler.php:1195 msgid "Enable privacy in rtMedia" msgstr "" -#: app/admin/RTMediaFormHandler.php:1180 +#: app/admin/RTMediaFormHandler.php:1200 msgid "Default privacy" msgstr "" -#: app/admin/RTMediaFormHandler.php:1186 +#: app/admin/RTMediaFormHandler.php:1206 msgid "Set default privacy for media" msgstr "" -#: app/admin/RTMediaFormHandler.php:1192 +#: app/admin/RTMediaFormHandler.php:1212 msgid "Allow users to set privacy for their content" msgstr "" -#: app/admin/RTMediaFormHandler.php:1197 +#: app/admin/RTMediaFormHandler.php:1217 msgid "" "If you choose this, users will be able to change privacy of their own " "uploads." msgstr "" -#: app/admin/RTMediaFormHandler.php:1201 +#: app/admin/RTMediaFormHandler.php:1221 msgid "For group uploads, BuddyPress groups privacy is used." msgstr "" -#: app/admin/RTMediaFormHandler.php:1243 +#: app/admin/RTMediaFormHandler.php:1261 msgid "Enable media in profile" msgstr "" -#: app/admin/RTMediaFormHandler.php:1248 +#: app/admin/RTMediaFormHandler.php:1266 msgid "Enable Media on BuddyPress Profile" msgstr "" -#: app/admin/RTMediaFormHandler.php:1253 +#: app/admin/RTMediaFormHandler.php:1271 msgid "Enable media in group" msgstr "" -#: app/admin/RTMediaFormHandler.php:1258 +#: app/admin/RTMediaFormHandler.php:1276 msgid "Enable Media on BuddyPress Groups" msgstr "" -#: app/admin/RTMediaFormHandler.php:1264 +#: app/admin/RTMediaFormHandler.php:1282 msgid "Allow upload from activity stream" msgstr "" -#: app/admin/RTMediaFormHandler.php:1269 +#: app/admin/RTMediaFormHandler.php:1287 msgid "Allow upload using status update box present on activity stream page" msgstr "" -#: app/admin/RTMediaFormHandler.php:1275 +#: app/admin/RTMediaFormHandler.php:1293 msgid "Enable media in comment" msgstr "" -#: app/admin/RTMediaFormHandler.php:1280 +#: app/admin/RTMediaFormHandler.php:1298 msgid "" "This will allow users to upload media in comment section for originally " "uploaded media up to 1 level." msgstr "" -#: app/admin/RTMediaFormHandler.php:1285 app/admin/RTMediaFormHandler.php:1290 +#: app/admin/RTMediaFormHandler.php:1303 app/admin/RTMediaFormHandler.php:1308 msgid "Disable upload in comment media" msgstr "" -#: app/admin/RTMediaFormHandler.php:1296 +#: app/admin/RTMediaFormHandler.php:1314 msgid "Number of media items to show in activity stream" msgstr "" -#: app/admin/RTMediaFormHandler.php:1301 +#: app/admin/RTMediaFormHandler.php:1319 msgid "" "With bulk uploads activity, the stream may get flooded. You can control the " "maximum number of media items or files per activity. This limit will not " @@ -929,871 +941,884 @@ msgid "" "unlimited." msgstr "" -#: app/admin/RTMediaFormHandler.php:1309 +#: app/admin/RTMediaFormHandler.php:1327 msgid "Enable media notification" msgstr "" -#: app/admin/RTMediaFormHandler.php:1314 +#: app/admin/RTMediaFormHandler.php:1332 msgid "" "This will enable notifications to media authors for media likes and " "comments." msgstr "" -#: app/admin/RTMediaFormHandler.php:1320 +#: app/admin/RTMediaFormHandler.php:1338 msgid "Create activity for media likes" msgstr "" -#: app/admin/RTMediaFormHandler.php:1325 +#: app/admin/RTMediaFormHandler.php:1343 msgid "Enabling this setting will create BuddyPress activity for media likes." msgstr "" -#: app/admin/RTMediaFormHandler.php:1332 +#: app/admin/RTMediaFormHandler.php:1350 msgid "Create activity for media comments" msgstr "" -#: app/admin/RTMediaFormHandler.php:1337 +#: app/admin/RTMediaFormHandler.php:1355 msgid "Enabling this setting will create BuddyPress activity for media comments." msgstr "" -#: app/admin/RTMediaFormHandler.php:1344 +#: app/admin/RTMediaFormHandler.php:1362 msgid "Organize media into albums" msgstr "" -#: app/admin/RTMediaFormHandler.php:1350 +#: app/admin/RTMediaFormHandler.php:1368 msgid "" "This will add 'album' tab to BuddyPress profile and group depending on the " "^above^ settings." msgstr "" -#: app/admin/RTMediaFormHandler.php:1355 +#: app/admin/RTMediaFormHandler.php:1373 msgid "Show album description" msgstr "" -#: app/admin/RTMediaFormHandler.php:1361 +#: app/admin/RTMediaFormHandler.php:1379 msgid "This will show description of an album under album gallery page." msgstr "" -#: app/admin/RTMediaFormHandler.php:1396 +#: app/admin/RTMediaFormHandler.php:1408 msgid "Please Enable BuddyPress Activity Streams to update option" msgstr "" -#: app/admin/RTMediaFormHandler.php:1402 +#: app/admin/RTMediaFormHandler.php:1418 msgid "Please Enable BuddyPress User Groups to update option" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:39 +#: app/admin/RTMediaUploadTermsAdmin.php:40 msgid "terms of services." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:40 +#: app/admin/RTMediaUploadTermsAdmin.php:41 msgid "Please check terms of service." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:61 +#: app/admin/RTMediaUploadTermsAdmin.php:62 msgid "Please enter valid URL." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:62 +#: app/admin/RTMediaUploadTermsAdmin.php:63 msgid "Please enter terms message." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:63 +#: app/admin/RTMediaUploadTermsAdmin.php:64 msgid "Please enter error message." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:64 +#: app/admin/RTMediaUploadTermsAdmin.php:65 msgid "Please enter privacy message." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:124 +#: app/admin/RTMediaUploadTermsAdmin.php:127 msgid "Ask users to agree to your terms" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:138 +#: app/admin/RTMediaUploadTermsAdmin.php:142 msgid "Show \"Terms of Service\" checkbox on upload screen" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:143 -#: app/admin/RTMediaUploadTermsAdmin.php:153 +#: app/admin/RTMediaUploadTermsAdmin.php:147 +#: app/admin/RTMediaUploadTermsAdmin.php:157 msgid "User have to check the terms and conditions before uploading the media." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:148 +#: app/admin/RTMediaUploadTermsAdmin.php:152 msgid "Show \"Terms of Service\" checkbox on activity screen" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:158 +#: app/admin/RTMediaUploadTermsAdmin.php:162 msgid "Link for \"Terms of Service\" page" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:163 +#: app/admin/RTMediaUploadTermsAdmin.php:167 msgid "" "Link to the terms and condition page where user can read terms and " "conditions." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:169 +#: app/admin/RTMediaUploadTermsAdmin.php:173 msgid "Terms of Service Message" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:174 +#: app/admin/RTMediaUploadTermsAdmin.php:178 msgid "Add Terms of Service Message." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:179 +#: app/admin/RTMediaUploadTermsAdmin.php:183 msgid "Error Message" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:184 +#: app/admin/RTMediaUploadTermsAdmin.php:188 msgid "Display Error Message When User Upload Media Without Selecting Checkbox ." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:189 +#: app/admin/RTMediaUploadTermsAdmin.php:193 msgid "Show \"Privacy Message\" on website" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:194 +#: app/admin/RTMediaUploadTermsAdmin.php:198 msgid "User will see the privacy message on website." msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:199 +#: app/admin/RTMediaUploadTermsAdmin.php:203 msgid "Privacy Message" msgstr "" -#: app/admin/RTMediaUploadTermsAdmin.php:204 +#: app/admin/RTMediaUploadTermsAdmin.php:208 msgid "Display privacy message on your website." msgstr "" -#: app/admin/templates/tmpl-rtm-album-favourites-importer.php:4 +#: app/admin/templates/tmpl-rtm-album-favourites-importer.php:12 msgid "User's Favorites:" msgstr "" -#: app/helper/RTMediaAddon.php:81 app/helper/RTMediaAddon.php:82 +#: app/helper/RTMediaAddon.php:91 app/helper/RTMediaAddon.php:92 msgid "Plugins" msgstr "" -#: app/helper/RTMediaAddon.php:106 +#: app/helper/RTMediaAddon.php:116 msgid "SEO" msgstr "" -#: app/helper/RTMediaAddon.php:109 +#: app/helper/RTMediaAddon.php:119 msgid "" "Generate an XML sitemap for all the public media files uploaded via rtMedia " "plugin. These sitemaps can be useful to index search engine to improve " "website SEO." msgstr "" -#: app/helper/RTMediaAddon.php:117 +#: app/helper/RTMediaAddon.php:127 msgid "Moderation" msgstr "" -#: app/helper/RTMediaAddon.php:120 +#: app/helper/RTMediaAddon.php:130 msgid "" "Report media if they find offensive. Set number of reports to automatically " "take down media from site." msgstr "" -#: app/helper/RTMediaAddon.php:128 +#: app/helper/RTMediaAddon.php:138 msgid "Custom Attributes" msgstr "" -#: app/helper/RTMediaAddon.php:131 +#: app/helper/RTMediaAddon.php:141 msgid "" "Categories media based on attributes. Site owner need to create attributes. " "When user upload a media, can select in which attribute that media can add." msgstr "" -#: app/helper/RTMediaAddon.php:139 +#: app/helper/RTMediaAddon.php:149 msgid "Docs and Other files" msgstr "" -#: app/helper/RTMediaAddon.php:142 +#: app/helper/RTMediaAddon.php:152 msgid "" "Allow users to upload documents and other file type using rtMedia upload " "box. This addon support all the file extensions which WordPress allows." msgstr "" -#: app/helper/RTMediaAddon.php:150 +#: app/helper/RTMediaAddon.php:160 msgid "Default Albums" msgstr "" -#: app/helper/RTMediaAddon.php:153 +#: app/helper/RTMediaAddon.php:163 msgid "" "This plugin allows the creation of multiple default albums for rtMedia " "uploads. One of these albums can be set as the default global album." msgstr "" -#: app/helper/RTMediaAddon.php:161 +#: app/helper/RTMediaAddon.php:171 msgid "Podcast (RSS and Atom feeds)" msgstr "" -#: app/helper/RTMediaAddon.php:164 +#: app/helper/RTMediaAddon.php:174 msgid "" "Read rtMedia uploads from iTunes as well as any RSS feed-reader/podcasting " "software." msgstr "" -#: app/helper/RTMediaAddon.php:172 +#: app/helper/RTMediaAddon.php:182 msgid "Playlists" msgstr "" -#: app/helper/RTMediaAddon.php:175 +#: app/helper/RTMediaAddon.php:185 msgid "" "Audio can be grouped into playlists. Once the user upload any audio file, " "can create a playlist or use existing one to manage audio files." msgstr "" -#: app/helper/RTMediaAddon.php:183 +#: app/helper/RTMediaAddon.php:193 msgid "Favorites" msgstr "" -#: app/helper/RTMediaAddon.php:186 +#: app/helper/RTMediaAddon.php:196 msgid "" "Users can create their list of favorite media in which they can add media " "previously uploaded by any user." msgstr "" -#: app/helper/RTMediaAddon.php:194 +#: app/helper/RTMediaAddon.php:204 msgid "Restrictions" msgstr "" -#: app/helper/RTMediaAddon.php:197 +#: app/helper/RTMediaAddon.php:207 msgid "" "Site admin can set an upload limit on the basis of time span, file size " "(MB) and number of files user can upload." msgstr "" -#: app/helper/RTMediaAddon.php:205 +#: app/helper/RTMediaAddon.php:215 msgid "bbPress Attachments" msgstr "" -#: app/helper/RTMediaAddon.php:208 +#: app/helper/RTMediaAddon.php:218 msgid "Attach media files to bbPress forum topics and replies." msgstr "" -#: app/helper/RTMediaAddon.php:216 +#: app/helper/RTMediaAddon.php:226 msgid "WordPress Sitewide Gallery" msgstr "" -#: app/helper/RTMediaAddon.php:219 +#: app/helper/RTMediaAddon.php:229 msgid "" "Site admin can create and upload media into WordPress album. Create album " "without being dependent on BuddyPress." msgstr "" -#: app/helper/RTMediaAddon.php:227 +#: app/helper/RTMediaAddon.php:237 msgid "WordPress Comment Attachments" msgstr "" -#: app/helper/RTMediaAddon.php:230 +#: app/helper/RTMediaAddon.php:240 msgid "" "Allow users to upload a media file in WordPress comment attachment box. It " "will display a thumbnail of attached file." msgstr "" -#: app/helper/RTMediaAddon.php:238 +#: app/helper/RTMediaAddon.php:248 msgid "Social Sharing" msgstr "" -#: app/helper/RTMediaAddon.php:241 +#: app/helper/RTMediaAddon.php:251 msgid "" "Share uploaded media on social network sites like Facebook, twitter, " "linkedin, Google +. This addon integrate with rtSocial plugin." msgstr "" -#: app/helper/RTMediaAddon.php:249 +#: app/helper/RTMediaAddon.php:259 msgid "Sidebar Widgets" msgstr "" -#: app/helper/RTMediaAddon.php:252 +#: app/helper/RTMediaAddon.php:262 msgid "" "This addon provide widgets to upload media and display gallery for rtMedia " "plugin." msgstr "" -#: app/helper/RTMediaAddon.php:260 +#: app/helper/RTMediaAddon.php:270 msgid "5 Star Ratings" msgstr "" -#: app/helper/RTMediaAddon.php:263 +#: app/helper/RTMediaAddon.php:273 msgid "" "Display 5 star rating for all the uploaded media. User can rate the media " "files from 1 to 5 star." msgstr "" -#: app/helper/RTMediaAddon.php:271 +#: app/helper/RTMediaAddon.php:281 msgid "Edit Mp3 Info (ID3 Tags)" msgstr "" -#: app/helper/RTMediaAddon.php:274 +#: app/helper/RTMediaAddon.php:284 msgid "Allow user to edit MP3 FIle Audio tags (ID 3 tags)." msgstr "" -#: app/helper/RTMediaAddon.php:282 +#: app/helper/RTMediaAddon.php:292 msgid "Media Sorting" msgstr "" -#: app/helper/RTMediaAddon.php:285 +#: app/helper/RTMediaAddon.php:295 msgid "" "Sort uploaded media based on file size, ascending/descending title, upload " "date of media." msgstr "" -#: app/helper/RTMediaAddon.php:293 +#: app/helper/RTMediaAddon.php:303 msgid "Bulk Edit" msgstr "" -#: app/helper/RTMediaAddon.php:296 +#: app/helper/RTMediaAddon.php:306 msgid "" "Bulk edit option will allow user to quickly select media files and do " "required actions like move files from one album to another, change " "attributes, change privacy, delete files." msgstr "" -#: app/helper/RTMediaAddon.php:304 +#: app/helper/RTMediaAddon.php:314 msgid "BuddyPress Profile Picture" msgstr "" -#: app/helper/RTMediaAddon.php:307 +#: app/helper/RTMediaAddon.php:317 msgid "User can easily set his/her profile picture from media uploaded via rtMedia." msgstr "" -#: app/helper/RTMediaAddon.php:315 +#: app/helper/RTMediaAddon.php:325 msgid "Album Cover Art" msgstr "" -#: app/helper/RTMediaAddon.php:318 +#: app/helper/RTMediaAddon.php:328 msgid "User can easily set any of the image of the album as album cover photo" msgstr "" -#: app/helper/RTMediaAddon.php:326 +#: app/helper/RTMediaAddon.php:336 msgid "Direct Download Link" msgstr "" -#: app/helper/RTMediaAddon.php:329 +#: app/helper/RTMediaAddon.php:339 msgid "" "User can download media from website. Site owner can restrict which media " "type can be allowed to download." msgstr "" -#: app/helper/RTMediaAddon.php:337 +#: app/helper/RTMediaAddon.php:347 msgid "Upload by URL" msgstr "" -#: app/helper/RTMediaAddon.php:340 +#: app/helper/RTMediaAddon.php:350 msgid "" "Users do not need to download media files from a URL and then upload it " "with rtMedia. Just provide the absolute URL for the media and it will " "upload on site." msgstr "" -#: app/helper/RTMediaAddon.php:351 +#: app/helper/RTMediaAddon.php:361 msgid "" "This add-on let you know who liked the media. User can also see which media " "they liked under their profile." msgstr "" -#: app/helper/RTMediaAddon.php:359 +#: app/helper/RTMediaAddon.php:369 msgid "Activity URL Preview" msgstr "" -#: app/helper/RTMediaAddon.php:362 +#: app/helper/RTMediaAddon.php:372 msgid "" "This addon provides a preview of the URL that is shared in BuddyPress " "activity. Just enter the URL you want to share on your site and see a " "preview of it before it is shared." msgstr "" -#: app/helper/RTMediaAddon.php:370 +#: app/helper/RTMediaAddon.php:380 msgid "View Counter" msgstr "" -#: app/helper/RTMediaAddon.php:373 +#: app/helper/RTMediaAddon.php:383 msgid "" "Enable view count for all the uploaded media. Whenever user open that media " "file in lightbox or in single media view, that view count will be " "calculated and display next to media file." msgstr "" -#: app/helper/RTMediaAddon.php:381 +#: app/helper/RTMediaAddon.php:391 msgid "Shortcode Generator" msgstr "" -#: app/helper/RTMediaAddon.php:384 +#: app/helper/RTMediaAddon.php:394 msgid "" "This add-on will add shortcode generator button in WordPress post and page " "editor for all the rtMedia shortcodes." msgstr "" -#: app/helper/RTMediaAddon.php:392 +#: app/helper/RTMediaAddon.php:402 msgid "Album Privacy" msgstr "" -#: app/helper/RTMediaAddon.php:395 +#: app/helper/RTMediaAddon.php:405 msgid "" "Set album privacy when user create an album or change album privacy when " "editing existing albums. The privacy levels are Public, Logged in user, " "Friends and Private." msgstr "" -#: app/helper/RTMediaAddon.php:403 +#: app/helper/RTMediaAddon.php:413 msgid "BuddyPress Group Media Control" msgstr "" -#: app/helper/RTMediaAddon.php:406 +#: app/helper/RTMediaAddon.php:416 msgid "This add-on allows group owner to manage media upload feature group wise." msgstr "" -#: app/helper/RTMediaAddon.php:414 +#: app/helper/RTMediaAddon.php:424 msgid "Set Custom Thumbnail for Audio/Video" msgstr "" -#: app/helper/RTMediaAddon.php:417 +#: app/helper/RTMediaAddon.php:427 msgid "" "Allow media owner to change the thumbnail of uploaded audio/video files. " "The File Upload box will be provided to change media thumbnail." msgstr "" -#: app/helper/RTMediaAddon.php:425 +#: app/helper/RTMediaAddon.php:435 msgid "myCRED" msgstr "" -#: app/helper/RTMediaAddon.php:428 +#: app/helper/RTMediaAddon.php:438 msgid "" "This plugin integrates rtMedia and myCRED plugin, users can be can award " "virtual points for various rtMedia activities, like media upload, likes, " "deleted etc." msgstr "" -#: app/helper/RTMediaAddon.php:436 +#: app/helper/RTMediaAddon.php:446 msgid "CubePoints" msgstr "" -#: app/helper/RTMediaAddon.php:439 +#: app/helper/RTMediaAddon.php:449 msgid "" "If you are using CubePoints plugin on your website than rtMedia CubePoint " "add-on can be integrate with that plugin to setup point management system " "for rtMedia related activities." msgstr "" -#: app/helper/RTMediaAddon.php:447 +#: app/helper/RTMediaAddon.php:457 msgid "Social Sync" msgstr "" -#: app/helper/RTMediaAddon.php:450 +#: app/helper/RTMediaAddon.php:460 msgid "rtMedia Social Sync allows you to import media from your Facebook account." msgstr "" -#: app/helper/RTMediaAddon.php:458 +#: app/helper/RTMediaAddon.php:468 msgid "Photo Watermark" msgstr "" -#: app/helper/RTMediaAddon.php:461 +#: app/helper/RTMediaAddon.php:471 msgid "" "rtMedia Photo Watermark let you add watermark on your images uploaded using " "rtMedia." msgstr "" -#: app/helper/RTMediaAddon.php:469 +#: app/helper/RTMediaAddon.php:479 msgid "Photo Tagging" msgstr "" -#: app/helper/RTMediaAddon.php:472 +#: app/helper/RTMediaAddon.php:482 msgid "" "rtMedia Photo Tagging enable users to tag their friends on photos uploaded " "using rtMedia." msgstr "" -#: app/helper/RTMediaAddon.php:480 +#: app/helper/RTMediaAddon.php:490 msgid "Photo Filters" msgstr "" -#: app/helper/RTMediaAddon.php:483 +#: app/helper/RTMediaAddon.php:493 msgid "" "rtMedia Photo Filters adds Instagram like filters to images uploaded with " "rtMedia." msgstr "" -#: app/helper/RTMediaAddon.php:491 +#: app/helper/RTMediaAddon.php:501 msgid "Membership Add-on" msgstr "" -#: app/helper/RTMediaAddon.php:494 +#: app/helper/RTMediaAddon.php:504 msgid "" "rtMedia Membership add-on provides membership functionality in your site in " "terms of media upload." msgstr "" -#: app/helper/RTMediaAddon.php:521 +#: app/helper/RTMediaAddon.php:531 msgid "Coming Soon !!" msgstr "" -#: app/helper/RTMediaAddon.php:554 +#: app/helper/RTMediaAddon.php:561 msgid "Purchased" msgstr "" -#: app/helper/RTMediaAddon.php:556 app/helper/RTMediaThemes.php:157 -#: app/helper/RTMediaThemes.php:201 app/helper/RTMediaThemes.php:310 -#: app/helper/RTMediaThemes.php:354 app/importers/BPMediaAlbumimporter.php:177 +#: app/helper/RTMediaAddon.php:563 app/helper/RTMediaThemes.php:161 +#: app/helper/RTMediaThemes.php:205 app/helper/RTMediaThemes.php:311 +#: app/helper/RTMediaThemes.php:355 app/importers/BPMediaAlbumimporter.php:205 msgid "Buy Now" msgstr "" -#: app/helper/RTMediaAddon.php:588 app/helper/RTMediaThemes.php:155 -#: app/helper/RTMediaThemes.php:199 app/helper/RTMediaThemes.php:308 -#: app/helper/RTMediaThemes.php:352 app/importers/BPMediaAlbumimporter.php:178 +#: app/helper/RTMediaAddon.php:603 app/helper/RTMediaThemes.php:159 +#: app/helper/RTMediaThemes.php:203 app/helper/RTMediaThemes.php:309 +#: app/helper/RTMediaThemes.php:353 app/importers/BPMediaAlbumimporter.php:206 msgid "Live Demo" msgstr "" -#: app/helper/RTMediaAdminWidget.php:32 +#: app/helper/RTMediaAdminWidget.php:40 msgid "Argument missing. id is required." msgstr "" -#: app/helper/RTMediaCommentNotification.php:62 +#: app/helper/RTMediaCommentNotification.php:81 msgid "commented on your" msgstr "" -#: app/helper/RTMediaCommentNotification.php:64 +#: app/helper/RTMediaCommentNotification.php:83 msgid "new comments on your" msgstr "" -#: app/helper/RTMediaFeed.php:48 +#: app/helper/RTMediaFeed.php:56 msgid "No items" msgstr "" -#: app/helper/RTMediaFeed.php:55 +#: app/helper/RTMediaFeed.php:63 msgid "Posted " msgstr "" -#: app/helper/RTMediaLicense.php:53 +#: app/helper/RTMediaLicense.php:68 msgid "You may be interested in" msgstr "" -#: app/helper/RTMediaLicense.php:53 +#: app/helper/RTMediaLicense.php:68 msgid "rtMedia Addons" msgstr "" -#: app/helper/RTMediaLicense.php:83 +#: app/helper/RTMediaLicense.php:104 msgid "Deactivate License" msgstr "" -#: app/helper/RTMediaLicense.php:86 +#: app/helper/RTMediaLicense.php:107 msgid "Activate License" msgstr "" -#: app/helper/RTMediaLicense.php:126 -msgid "Your license key expired on %1$s. Please renew your license key." +#: app/helper/RTMediaLicense.php:153 +#. translators: %s: Expiry date. +msgid "Your license key expired on %s. Please renew your license key." msgstr "" -#: app/helper/RTMediaLicense.php:137 +#: app/helper/RTMediaLicense.php:163 msgid "" "Your license key has been disabled. Please contact support for more " "information." msgstr "" -#: app/helper/RTMediaLicense.php:147 +#: app/helper/RTMediaLicense.php:173 +#. translators: %s: Account page link. msgid "" "Invalid license. Please visit your account " "page and verify it." msgstr "" -#: app/helper/RTMediaLicense.php:159 +#: app/helper/RTMediaLicense.php:189 +#. translators: 1: Add-on name, 2:My account page link. msgid "" "Your %1$s is not active for this URL. Please visit your account page to manage your license key " "URLs." msgstr "" -#: app/helper/RTMediaLicense.php:171 +#: app/helper/RTMediaLicense.php:202 +#. translators: %s: Add-on name. msgid "This appears to be an invalid license key for %s." msgstr "" -#: app/helper/RTMediaLicense.php:180 +#: app/helper/RTMediaLicense.php:212 +#. translators: %s: Account link. msgid "" "Your license key has reached its activation limit. View " "possible upgrades now." msgstr "" -#: app/helper/RTMediaLicense.php:189 +#: app/helper/RTMediaLicense.php:222 +#. translators: %s: Account link. msgid "" "Your license is not activable, please visit your account " "page." msgstr "" -#: app/helper/RTMediaLicense.php:198 app/helper/RTMediaLicense.php:252 +#: app/helper/RTMediaLicense.php:230 app/helper/RTMediaLicense.php:285 msgid "To receive updates, please enter your valid license key." msgstr "" -#: app/helper/RTMediaLicense.php:217 +#: app/helper/RTMediaLicense.php:248 msgid "License key never expires." msgstr "" -#: app/helper/RTMediaLicense.php:226 +#: app/helper/RTMediaLicense.php:258 +#. translators: 1: Expiry date. msgid "Your license key expires soon! It expires on %1$s. Renew your license key." msgstr "" -#: app/helper/RTMediaLicense.php:237 +#: app/helper/RTMediaLicense.php:270 +#. translators: %s: Expiry date. msgid "Your license key expires on %s." msgstr "" -#: app/helper/RTMediaLikeNotification.php:96 +#: app/helper/RTMediaLikeNotification.php:116 msgid "liked your" msgstr "" -#: app/helper/RTMediaLikeNotification.php:98 +#: app/helper/RTMediaLikeNotification.php:118 msgid "and one more friend liked your" msgstr "" -#: app/helper/RTMediaLikeNotification.php:101 +#: app/helper/RTMediaLikeNotification.php:121 msgid "and" msgstr "" -#: app/helper/RTMediaLikeNotification.php:101 +#: app/helper/RTMediaLikeNotification.php:121 msgid "other friends liked your" msgstr "" -#: app/helper/RTMediaSettings.php:244 +#: app/helper/RTMediaSettings.php:251 msgid "BuddyPress Media Addons for Photos" msgstr "" -#: app/helper/RTMediaSettings.php:254 +#: app/helper/RTMediaSettings.php:271 msgid "rtMedia Themes" msgstr "" -#: app/helper/RTMediaSettings.php:324 +#: app/helper/RTMediaSettings.php:341 +#. translators: %s: link. msgid "" "Currently your network allows uploading of the following file types. You " "can change the settings %s" msgstr "" -#: app/helper/RTMediaSettings.php:345 app/helper/RTMediaSettings.php:347 +#: app/helper/RTMediaSettings.php:361 app/helper/RTMediaSettings.php:363 msgid "Atleast one Media Type Must be selected" msgstr "" -#: app/helper/RTMediaSettings.php:356 app/helper/RTMediaSettings.php:358 +#: app/helper/RTMediaSettings.php:372 app/helper/RTMediaSettings.php:374 msgid "\"Number of media\" count value should be numeric and greater than 0." msgstr "" -#: app/helper/RTMediaSettings.php:358 +#: app/helper/RTMediaSettings.php:374 msgid "Default Count" msgstr "" -#: app/helper/RTMediaSettings.php:363 +#: app/helper/RTMediaSettings.php:380 msgid "Settings saved." msgstr "" -#: app/helper/RTMediaSettings.php:387 +#: app/helper/RTMediaSettings.php:404 msgid "If you make changes to width, height or crop settings, you must use " msgstr "" -#: app/helper/RTMediaSettings.php:388 +#: app/helper/RTMediaSettings.php:405 msgid "Regenerate Thumbnail Plugin" msgstr "" -#: app/helper/RTMediaSettings.php:389 +#: app/helper/RTMediaSettings.php:406 msgid " to regenerate old images." msgstr "" -#: app/helper/RTMediaSettings.php:412 +#: app/helper/RTMediaSettings.php:425 msgid "BuddyPress Media 2.6 requires a database upgrade. " msgstr "" -#: app/helper/RTMediaSettings.php:413 +#: app/helper/RTMediaSettings.php:426 msgid "Update Database" msgstr "" -#: app/helper/RTMediaSettings.php:427 +#: app/helper/RTMediaSettings.php:438 msgid "" "If your site has some issues due to rtMedia and you want one on one support " "then you can create a support topic on the " msgstr "" -#: app/helper/RTMediaSettings.php:428 app/helper/RTMediaSupport.php:461 +#: app/helper/RTMediaSettings.php:439 app/helper/RTMediaSupport.php:488 msgid "rtMedia Support Page" msgstr "" -#: app/helper/RTMediaSettings.php:430 +#: app/helper/RTMediaSettings.php:441 msgid "" "If you have any suggestions, enhancements or bug reports, then you can open " "a new issue on " msgstr "" -#: app/helper/RTMediaSettings.php:431 app/helper/RTMediaSupport.php:468 +#: app/helper/RTMediaSettings.php:442 app/helper/RTMediaSupport.php:496 msgid "GitHub" msgstr "" -#: app/helper/RTMediaSupport.php:43 app/helper/RTMediaSupport.php:578 +#: app/helper/RTMediaSupport.php:66 app/helper/RTMediaSupport.php:602 msgid "Cheatin' uh?" msgstr "" -#: app/helper/RTMediaSupport.php:44 app/helper/RTMediaSupport.php:579 +#: app/helper/RTMediaSupport.php:67 app/helper/RTMediaSupport.php:603 msgid "Can not verify request source." msgstr "" -#: app/helper/RTMediaSupport.php:74 app/helper/RTMediaSupport.php:75 -#: app/helper/RTMediaSupport.php:352 +#: app/helper/RTMediaSupport.php:94 app/helper/RTMediaSupport.php:95 +#: app/helper/RTMediaSupport.php:382 msgid "Debug Info" msgstr "" -#: app/helper/RTMediaSupport.php:84 app/helper/RTMediaSupport.php:85 -#: app/importers/RTMediaMigration.php:87 +#: app/helper/RTMediaSupport.php:104 app/helper/RTMediaSupport.php:105 +#: app/importers/RTMediaMigration.php:131 +#: app/importers/RTMediaMigration.php:132 msgid "Migration" msgstr "" -#: app/helper/RTMediaSupport.php:157 +#: app/helper/RTMediaSupport.php:184 msgid "Service" msgstr "" -#: app/helper/RTMediaSupport.php:164 +#: app/helper/RTMediaSupport.php:193 msgid "Premium Support" msgstr "" -#: app/helper/RTMediaSupport.php:170 +#: app/helper/RTMediaSupport.php:201 msgid "Bug Report" msgstr "" -#: app/helper/RTMediaSupport.php:176 +#: app/helper/RTMediaSupport.php:209 msgid "New Feature" msgstr "" -#: app/helper/RTMediaSupport.php:178 +#: app/helper/RTMediaSupport.php:211 msgid "Submit" msgstr "" -#: app/helper/RTMediaSupport.php:226 +#: app/helper/RTMediaSupport.php:256 msgid "by" msgstr "" -#: app/helper/RTMediaSupport.php:226 +#: app/helper/RTMediaSupport.php:256 msgid "version" msgstr "" -#: app/helper/RTMediaSupport.php:372 +#: app/helper/RTMediaSupport.php:403 msgid "Download Debug Info" msgstr "" -#: app/helper/RTMediaSupport.php:411 +#: app/helper/RTMediaSupport.php:439 msgid "There is no media found to migrate." msgstr "" -#: app/helper/RTMediaSupport.php:417 -#: app/main/controllers/media/RTMediaLoginPopup.php:56 +#: app/helper/RTMediaSupport.php:445 +#: app/main/controllers/media/RTMediaLoginPopup.php:67 msgid "Click" msgstr "" -#: app/helper/RTMediaSupport.php:417 +#: app/helper/RTMediaSupport.php:445 msgid "here to migrate media from rtMedia 2.x to rtMedia 3.0+." msgstr "" -#: app/helper/RTMediaSupport.php:445 +#: app/helper/RTMediaSupport.php:471 msgid "Submit a Bug Report" msgstr "" -#: app/helper/RTMediaSupport.php:448 +#: app/helper/RTMediaSupport.php:474 msgid "Submit a New Feature Request" msgstr "" -#: app/helper/RTMediaSupport.php:451 +#: app/helper/RTMediaSupport.php:477 msgid "Submit Support Request" msgstr "" -#: app/helper/RTMediaSupport.php:460 +#: app/helper/RTMediaSupport.php:487 +#. translators: %s: link. msgid "" "If your site has some issues due to rtMedia and you want support, feel free " "to create a support topic on %s" msgstr "" -#: app/helper/RTMediaSupport.php:467 +#: app/helper/RTMediaSupport.php:495 +#. translators: %s: Github link. msgid "" "If you have any suggestions, enhancements or bug reports, then you can open " "a new issue on %s" msgstr "" -#: app/helper/RTMediaSupport.php:487 +#: app/helper/RTMediaSupport.php:515 msgid "Name" msgstr "" -#: app/helper/RTMediaSupport.php:492 +#: app/helper/RTMediaSupport.php:520 msgid "Use actual user name which used during purchased." msgstr "" -#: app/helper/RTMediaSupport.php:499 +#: app/helper/RTMediaSupport.php:527 msgid "Email" msgstr "" -#: app/helper/RTMediaSupport.php:504 +#: app/helper/RTMediaSupport.php:532 msgid "Use email id which used during purchased" msgstr "" -#: app/helper/RTMediaSupport.php:511 +#: app/helper/RTMediaSupport.php:539 msgid "Website" msgstr "" -#: app/helper/RTMediaSupport.php:519 +#: app/helper/RTMediaSupport.php:547 msgid "Subject" msgstr "" -#: app/helper/RTMediaSupport.php:527 templates/media/album-single-edit.php:20 -#: templates/media/media-single-edit.php:19 +#: app/helper/RTMediaSupport.php:555 templates/media/album-single-edit.php:31 +#: templates/media/media-single-edit.php:27 msgid "Details" msgstr "" -#: app/helper/RTMediaSupport.php:543 -msgid "Attachement" +#: app/helper/RTMediaSupport.php:571 +msgid "Attachment" msgstr "" -#: app/helper/RTMediaSupport.php:548 +#: app/helper/RTMediaSupport.php:576 msgid "Allowed file types are : images, documents and texts." msgstr "" -#: app/helper/RTMediaSupport.php:594 +#: app/helper/RTMediaSupport.php:618 msgid "rtMedia Premium Support Request from" msgstr "" -#: app/helper/RTMediaSupport.php:597 +#: app/helper/RTMediaSupport.php:621 msgid "rtMedia New Feature Request from" msgstr "" -#: app/helper/RTMediaSupport.php:600 +#: app/helper/RTMediaSupport.php:624 msgid "rtMedia Bug Report from" msgstr "" -#: app/helper/RTMediaSupport.php:603 +#: app/helper/RTMediaSupport.php:627 msgid "rtMedia Contact from" msgstr "" -#: app/helper/RTMediaSupport.php:682 +#: app/helper/RTMediaSupport.php:716 msgid "Thank you for your Feedback/Suggestion." msgstr "" -#: app/helper/RTMediaSupport.php:684 +#: app/helper/RTMediaSupport.php:718 msgid "Thank you for posting your support request." msgstr "" -#: app/helper/RTMediaSupport.php:685 +#: app/helper/RTMediaSupport.php:719 msgid "We will get back to you shortly." msgstr "" -#: app/helper/RTMediaSupport.php:690 +#: app/helper/RTMediaSupport.php:724 msgid "Your server failed to send an email." msgstr "" -#: app/helper/RTMediaSupport.php:691 +#: app/helper/RTMediaSupport.php:725 msgid "Kindly contact your server support to fix this." msgstr "" -#: app/helper/RTMediaSupport.php:694 +#: app/helper/RTMediaSupport.php:729 +#. translators: %s: rtmedia link. msgid "You can alternatively create a support request %s" msgstr "" -#: app/helper/RTMediaThemes.php:60 app/helper/RTMediaThemes.php:61 +#: app/helper/RTMediaThemes.php:67 app/helper/RTMediaThemes.php:68 msgid "Themes By rtCamp" msgstr "" -#: app/helper/RTMediaThemes.php:67 app/helper/RTMediaThemes.php:68 +#: app/helper/RTMediaThemes.php:74 app/helper/RTMediaThemes.php:75 msgid "3rd Party Themes" msgstr "" -#: app/helper/RTMediaThemes.php:105 +#: app/helper/RTMediaThemes.php:109 msgid "rtDating" msgstr "" @@ -1801,94 +1826,94 @@ msgstr "" msgid "rtCamp" msgstr "" -#: app/helper/RTMediaThemes.php:111 +#: app/helper/RTMediaThemes.php:115 msgid "" "rtDating is a unique, clean and modern theme only for WordPress. This theme " "is mostly useful for dating sites and community websites. It can also be " "use for any other WordPress based website." msgstr "" -#: app/helper/RTMediaThemes.php:115 +#: app/helper/RTMediaThemes.php:119 msgid "InspireBook" msgstr "" -#: app/helper/RTMediaThemes.php:121 +#: app/helper/RTMediaThemes.php:125 msgid "" "InspireBook is a premium WordPress theme, designed especially for " "BuddyPress and rtMedia powered social-networks." msgstr "" -#: app/helper/RTMediaThemes.php:125 +#: app/helper/RTMediaThemes.php:129 msgid "Foodmania" msgstr "" -#: app/helper/RTMediaThemes.php:131 +#: app/helper/RTMediaThemes.php:135 msgid "" "Its premium WordPress theme, designed especially for Food, recipe and " "photography community sites." msgstr "" -#: app/helper/RTMediaThemes.php:149 app/helper/RTMediaThemes.php:302 +#: app/helper/RTMediaThemes.php:153 app/helper/RTMediaThemes.php:303 msgid "Theme Details" msgstr "" -#: app/helper/RTMediaThemes.php:164 app/helper/RTMediaThemes.php:317 +#: app/helper/RTMediaThemes.php:168 app/helper/RTMediaThemes.php:318 msgid "Show previous theme" msgstr "" -#: app/helper/RTMediaThemes.php:167 app/helper/RTMediaThemes.php:320 +#: app/helper/RTMediaThemes.php:171 app/helper/RTMediaThemes.php:321 msgid "Show next theme" msgstr "" -#: app/helper/RTMediaThemes.php:170 app/helper/RTMediaThemes.php:323 +#: app/helper/RTMediaThemes.php:174 app/helper/RTMediaThemes.php:324 msgid "Close overlay" msgstr "" -#: app/helper/RTMediaThemes.php:189 app/helper/RTMediaThemes.php:342 +#: app/helper/RTMediaThemes.php:193 app/helper/RTMediaThemes.php:343 msgid "Read More" msgstr "" -#: app/helper/RTMediaThemes.php:192 app/helper/RTMediaThemes.php:345 +#: app/helper/RTMediaThemes.php:196 app/helper/RTMediaThemes.php:346 msgid "Tags:" msgstr "" -#: app/helper/RTMediaThemes.php:227 +#: app/helper/RTMediaThemes.php:229 msgid "Woffice - Intranet/Extranet WordPress Theme" msgstr "" -#: app/helper/RTMediaThemes.php:230 +#: app/helper/RTMediaThemes.php:232 msgid "Alkaweb" msgstr "" -#: app/helper/RTMediaThemes.php:233 +#: app/helper/RTMediaThemes.php:235 msgid "" "Woffice is a feature rich, powerful Multipurpose Intranet/Extranet " "Wordpress theme." msgstr "" -#: app/helper/RTMediaThemes.php:237 +#: app/helper/RTMediaThemes.php:239 msgid "Thrive - Intranet & Community WordPress Theme" msgstr "" -#: app/helper/RTMediaThemes.php:240 app/helper/RTMediaThemes.php:260 +#: app/helper/RTMediaThemes.php:242 app/helper/RTMediaThemes.php:262 msgid "dunhakdis" msgstr "" -#: app/helper/RTMediaThemes.php:243 +#: app/helper/RTMediaThemes.php:245 msgid "" "Thrive is an innovative WordPress Theme designed to cater company portals, " "organisational websites, company intranet and extranets." msgstr "" -#: app/helper/RTMediaThemes.php:247 +#: app/helper/RTMediaThemes.php:249 msgid "(M) SOCIAL NETWORK BUDDYPRESS THEME" msgstr "" -#: app/helper/RTMediaThemes.php:250 +#: app/helper/RTMediaThemes.php:252 msgid "gavick" msgstr "" -#: app/helper/RTMediaThemes.php:253 +#: app/helper/RTMediaThemes.php:255 msgid "" "(M)Social is a sophisticated, vibrant community theme that offers " "incredible grid layouts, with full BuddyPress support so your users can " @@ -1896,26 +1921,26 @@ msgid "" "and images with the community." msgstr "" -#: app/helper/RTMediaThemes.php:257 +#: app/helper/RTMediaThemes.php:259 msgid "Klein" msgstr "" -#: app/helper/RTMediaThemes.php:263 +#: app/helper/RTMediaThemes.php:265 msgid "" "Klein is an innovative WordPress theme built to support BuddyPress, " "bbPress, and WooCommerce out of the box. Perfect for websites that " "interacts with many users." msgstr "" -#: app/helper/RTMediaThemes.php:267 +#: app/helper/RTMediaThemes.php:269 msgid "SweetDate" msgstr "" -#: app/helper/RTMediaThemes.php:270 app/helper/RTMediaThemes.php:280 +#: app/helper/RTMediaThemes.php:272 app/helper/RTMediaThemes.php:282 msgid "SeventhQueen" msgstr "" -#: app/helper/RTMediaThemes.php:273 +#: app/helper/RTMediaThemes.php:275 msgid "" "SweetDate is a unique, clean and modern Premium Wordpress theme. It is " "perfect for a dating or community website but can be used as well for any " @@ -1923,953 +1948,976 @@ msgid "" "community system." msgstr "" -#: app/helper/RTMediaThemes.php:277 +#: app/helper/RTMediaThemes.php:279 msgid "KLEO" msgstr "" -#: app/helper/RTMediaThemes.php:283 +#: app/helper/RTMediaThemes.php:285 msgid "" "You no longer need to be a professional developer or designer to create an " "awesome website. Let your imagination run wild and create the site of your " "dreams. KLEO has all the tools to get you started." msgstr "" -#: app/helper/RTMediaThemes.php:365 +#: app/helper/RTMediaThemes.php:366 msgid "" "These are the third party themes. For any issues or queries regarding these " "themes please contact theme developers." msgstr "" -#: app/helper/RTMediaThemes.php:368 +#: app/helper/RTMediaThemes.php:369 msgid "Are you a developer?" msgstr "" -#: app/helper/RTMediaThemes.php:371 +#: app/helper/RTMediaThemes.php:372 msgid "" "If you have developed a rtMedia compatible theme and would like it to list " "here, please email us at" msgstr "" -#: app/helper/RTMediaThemes.php:372 +#: app/helper/RTMediaThemes.php:373 msgid "rtmedia@rtcamp.com" msgstr "" -#: app/helper/RTMediaUploadException.php:41 +#: app/helper/RTMediaUploadException.php:46 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: app/helper/RTMediaUploadException.php:44 +#: app/helper/RTMediaUploadException.php:49 msgid "No file was uploaded" msgstr "" -#: app/helper/RTMediaUploadException.php:49 +#: app/helper/RTMediaUploadException.php:54 msgid "Uploade failed due to internal server error." msgstr "" -#: app/helper/RTMediaUploadException.php:52 +#: app/helper/RTMediaUploadException.php:57 msgid "File type not allowed." msgstr "" -#: app/helper/RTMediaUploadException.php:56 +#: app/helper/RTMediaUploadException.php:61 msgid "Invalid Context for upload." msgstr "" -#: app/helper/RTMediaUploadException.php:59 +#: app/helper/RTMediaUploadException.php:64 msgid "Unknown file upload error." msgstr "" -#: app/helper/rtForm.php:628 +#: app/helper/rtForm.php:651 msgid "Delete this file" msgstr "" -#: app/helper/rtFormInvalidArgumentsException.php:21 -msgid "Error on line %s in %s : " +#: app/helper/rtFormInvalidArgumentsException.php:28 +#. translators: 1: Line number, 2: file. +msgid "Error on line %1$s in %2$s : " msgstr "" -#: app/helper/rtFormInvalidArgumentsException.php:22 +#: app/helper/rtFormInvalidArgumentsException.php:30 +#. translators: %s: message. msgid "The method expects an array in arguments for %s provided." msgstr "" -#: app/helper/rtUploadAttachment.php:70 +#: app/helper/rtUploadAttachment.php:80 msgid "You can not upload more than 2 MB." msgstr "" -#: app/helper/rtUploadAttachment.php:76 +#: app/helper/rtUploadAttachment.php:86 msgid "There was an error uploading your files" msgstr "" -#: app/helper/rtUploadAttachment.php:80 +#: app/helper/rtUploadAttachment.php:90 msgid "Form was submitted" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:64 +#: app/importers/BPMediaAlbumimporter.php:86 msgid "Warning!" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:65 +#: app/importers/BPMediaAlbumimporter.php:87 msgid "" "This import process is irreversible. Although everything is tested, please " "take a " msgstr "" -#: app/importers/BPMediaAlbumimporter.php:66 +#: app/importers/BPMediaAlbumimporter.php:88 msgid "backup of your database and files" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:67 +#: app/importers/BPMediaAlbumimporter.php:89 msgid "" ", before proceeding. If you don't know your way around databases and files, " "consider " msgstr "" -#: app/importers/BPMediaAlbumimporter.php:68 +#: app/importers/BPMediaAlbumimporter.php:90 msgid "hiring us" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:69 +#: app/importers/BPMediaAlbumimporter.php:91 msgid ", or another professional." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:71 +#: app/importers/BPMediaAlbumimporter.php:93 msgid "" "If you have set \"WP_DEBUG\" in you wp-config.php file, please make sure it " "is set to \"false\", so that it doesn't conflict with the import process." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:72 +#: app/importers/BPMediaAlbumimporter.php:94 msgid "I have taken a backup of the database and files of this site." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:74 +#: app/importers/BPMediaAlbumimporter.php:96 msgid "Start Import" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:79 +#: app/importers/BPMediaAlbumimporter.php:101 msgid "Users" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:89 app/main/RTMedia.php:745 +#: app/importers/BPMediaAlbumimporter.php:111 app/main/RTMedia.php:862 msgid "Media" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:109 +#: app/importers/BPMediaAlbumimporter.php:134 msgid "Comments" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:115 +#: app/importers/BPMediaAlbumimporter.php:140 msgid "Comments: 0/0 (No comments to import)" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:122 +#: app/importers/BPMediaAlbumimporter.php:148 msgid "User's Favorites" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:131 +#: app/importers/BPMediaAlbumimporter.php:157 msgid "BP-Album is active on your site and will cause problems with the import." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:132 +#: app/importers/BPMediaAlbumimporter.php:158 msgid "Click here to deactivate BP-Album and continue importing" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:138 +#: app/importers/BPMediaAlbumimporter.php:164 msgid "Some of the media failed to import. The file might be corrupt or deleted." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:139 +#: app/importers/BPMediaAlbumimporter.php:166 +#. translators: %d: Media. msgid "The following %d BP Album Media id's could not be imported" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:148 +#: app/importers/BPMediaAlbumimporter.php:176 +#. translators: %s: URL. msgid "I just imported bp-album to @rtMediaWP http://rt.cx/rtmedia on %s" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:149 +#: app/importers/BPMediaAlbumimporter.php:177 msgid "Congratulations!" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:149 +#: app/importers/BPMediaAlbumimporter.php:177 msgid "All media from BP Album has been imported." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:150 +#: app/importers/BPMediaAlbumimporter.php:178 msgid "Tweet this" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:154 +#: app/importers/BPMediaAlbumimporter.php:182 msgid "" "However, a lot of unnecessary files and a database table are still eating " "up your resources. If everything seems fine, you can clean this data up." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:157 +#: app/importers/BPMediaAlbumimporter.php:185 msgid "Clean up Now" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:160 +#: app/importers/BPMediaAlbumimporter.php:188 msgid "Clean up Later" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:165 -msgid "Why don't you try adding some instagram like effects to your images?" +#: app/importers/BPMediaAlbumimporter.php:193 +msgid "Why don't you try adding some Instagram like effects to your images?" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:172 +#: app/importers/BPMediaAlbumimporter.php:200 msgid "" "rtMedia Photo Filters adds Instagram like filters to images uploaded with " "BuddyPress Media." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:173 +#: app/importers/BPMediaAlbumimporter.php:201 msgid "Important" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:173 +#: app/importers/BPMediaAlbumimporter.php:201 msgid "" "You need to have ImageMagick installed on your server for this addon to " "work." msgstr "" -#: app/importers/BPMediaAlbumimporter.php:183 +#: app/importers/BPMediaAlbumimporter.php:211 msgid "" "Looks like you don't use BP Album. Is there any other BuddyPress Plugin you " "want an importer for?" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:184 +#: app/importers/BPMediaAlbumimporter.php:212 msgid "Create an issue" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:185 +#: app/importers/BPMediaAlbumimporter.php:213 msgid " on GitHub requesting the same." msgstr "" -#: app/importers/RTMediaActivityUpgrade.php:20 +#: app/importers/RTMediaActivityUpgrade.php:33 +#: app/importers/RTMediaActivityUpgrade.php:34 msgid "Media activity upgrade" msgstr "" -#: app/importers/RTMediaActivityUpgrade.php:129 -#: app/importers/RTMediaMediaSizeImporter.php:73 +#: app/importers/RTMediaActivityUpgrade.php:189 +#: app/importers/RTMediaMediaSizeImporter.php:104 msgid ": Database table structure for rtMedia has been updated. Please " msgstr "" -#: app/importers/RTMediaActivityUpgrade.php:130 -#: app/importers/RTMediaMediaSizeImporter.php:73 -#: app/importers/RTMediaMigration.php:68 +#: app/importers/RTMediaActivityUpgrade.php:190 +#: app/importers/RTMediaMediaSizeImporter.php:104 +#: app/importers/RTMediaMigration.php:92 msgid "Click Here" msgstr "" -#: app/importers/RTMediaActivityUpgrade.php:131 +#: app/importers/RTMediaActivityUpgrade.php:191 msgid " to upgrade rtMedia activities." msgstr "" -#: app/importers/RTMediaActivityUpgrade.php:188 +#: app/importers/RTMediaActivityUpgrade.php:271 msgid "rtMedia: Upgrade rtMedia activity" msgstr "" -#: app/importers/RTMediaActivityUpgrade.php:191 -#: app/importers/RTMediaMediaSizeImporter.php:109 +#: app/importers/RTMediaActivityUpgrade.php:275 +#: app/importers/RTMediaMediaSizeImporter.php:155 +#. translators: %s: Estimated. msgid "%s (estimated)" msgstr "" -#: app/importers/RTMediaMediaSizeImporter.php:28 +#: app/importers/RTMediaMediaSizeImporter.php:38 +#: app/importers/RTMediaMediaSizeImporter.php:39 msgid "Media Size Import" msgstr "" -#: app/importers/RTMediaMediaSizeImporter.php:73 +#: app/importers/RTMediaMediaSizeImporter.php:104 msgid " to import media sizes. " msgstr "" -#: app/importers/RTMediaMediaSizeImporter.php:106 +#: app/importers/RTMediaMediaSizeImporter.php:151 msgid "rtMedia: Import Media Size" msgstr "" -#: app/importers/RTMediaMigration.php:68 +#: app/importers/RTMediaMigration.php:92 msgid "Please Migrate your Database" msgstr "" -#: app/importers/RTMediaMigration.php:369 +#: app/importers/RTMediaMigration.php:482 msgid "Please Resolve create database error before migration." msgstr "" -#: app/importers/RTMediaMigration.php:384 -#. translators: %1$s gets replaced by '', and %2$s by '' +#: app/importers/RTMediaMigration.php:497 +#. translators: 1: %s gets replaced by '', 2: %s by '' msgid "" "Please Backup your %1$sDATABASE%2$s and %1$sUPLOAD%2$s folder before " "Migration." msgstr "" -#: app/importers/RTMediaMigration.php:394 +#: app/importers/RTMediaMigration.php:507 msgid "rtMedia Migration" msgstr "" -#: app/importers/RTMediaMigration.php:396 +#: app/importers/RTMediaMigration.php:509 msgid "It will migrate following things" msgstr "" -#: app/importers/RTMediaMigration.php:397 +#: app/importers/RTMediaMigration.php:511 msgid "User Albums : " msgstr "" -#: app/importers/RTMediaMigration.php:400 +#: app/importers/RTMediaMigration.php:517 msgid "Groups Albums : " msgstr "" -#: app/importers/RTMediaMigration.php:403 +#: app/importers/RTMediaMigration.php:523 msgid "Media : " msgstr "" -#: app/importers/RTMediaMigration.php:407 +#: app/importers/RTMediaMigration.php:530 msgid "Comments : " msgstr "" -#: app/importers/RTMediaMigration.php:468 +#: app/importers/RTMediaMigration.php:593 msgid "Error During Migration, Please Refresh Page then try again" msgstr "" -#: app/importers/RTMediaMigration.php:488 +#: app/importers/RTMediaMigration.php:613 msgid "Start" msgstr "" -#: app/importers/RTMediaMigration.php:1042 +#: app/importers/RTMediaMigration.php:1220 msgid " day" msgstr "" -#: app/importers/RTMediaMigration.php:1046 +#: app/importers/RTMediaMigration.php:1224 msgid " hour" msgstr "" -#: app/importers/RTMediaMigration.php:1050 +#: app/importers/RTMediaMigration.php:1228 msgid " minute" msgstr "" -#: app/importers/RTMediaMigration.php:1054 +#: app/importers/RTMediaMigration.php:1232 msgid " second" msgstr "" -#: app/importers/RTMediaMigration.php:1060 +#: app/importers/RTMediaMigration.php:1238 msgid "No time remaining." msgstr "" -#: app/main/RTMedia.php:474 +#: app/main/RTMedia.php:162 app/main/RTMedia.php:1497 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:744 +#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:112 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:246 +msgid "Media Files" +msgstr "" + +#: app/main/RTMedia.php:555 msgid "Photo" msgstr "" -#: app/main/RTMedia.php:475 +#: app/main/RTMedia.php:556 msgid "Photos" msgstr "" -#: app/main/RTMedia.php:483 +#: app/main/RTMedia.php:564 msgid "Video" msgstr "" -#: app/main/RTMedia.php:484 +#: app/main/RTMedia.php:565 msgid "Videos" msgstr "" -#: app/main/RTMedia.php:492 app/main/RTMedia.php:493 +#: app/main/RTMedia.php:573 app/main/RTMedia.php:574 msgid "Music" msgstr "" -#: app/main/RTMedia.php:584 +#: app/main/RTMedia.php:687 msgid "Private - Visible only to the user" msgstr "" -#: app/main/RTMedia.php:585 +#: app/main/RTMedia.php:688 msgid "Friends - Visible to user's friends" msgstr "" -#: app/main/RTMedia.php:586 +#: app/main/RTMedia.php:689 msgid "Logged in Users - Visible to registered users" msgstr "" -#: app/main/RTMedia.php:587 +#: app/main/RTMedia.php:690 msgid "Public - Visible to the world" msgstr "" -#: app/main/RTMedia.php:753 app/main/controllers/template/RTMediaNav.php:229 -#: app/main/controllers/template/rtmedia-functions.php:136 +#: app/main/RTMedia.php:870 app/main/controllers/template/RTMediaNav.php:281 +#: app/main/controllers/template/rtmedia-functions.php:141 msgid "All" msgstr "" -#: app/main/RTMedia.php:765 app/main/controllers/media/RTMediaAlbum.php:54 -#: app/main/controllers/template/rtmedia-actions.php:123 -#: app/main/controllers/upload/RTMediaUploadView.php:51 -#: app/main/controllers/upload/RTMediaUploadView.php:54 +#: app/main/RTMedia.php:882 app/main/controllers/media/RTMediaAlbum.php:56 +#: app/main/controllers/template/rtmedia-actions.php:130 +#: app/main/controllers/upload/RTMediaUploadView.php:78 +#: app/main/controllers/upload/RTMediaUploadView.php:82 msgid "Album" msgstr "" -#: app/main/RTMedia.php:769 app/main/RTMedia.php:1185 -#: app/main/controllers/media/RTMediaAlbum.php:53 -#: app/main/controllers/media/RTMediaAlbum.php:65 +#: app/main/RTMedia.php:886 app/main/RTMedia.php:1394 +#: app/main/controllers/media/RTMediaAlbum.php:55 +#: app/main/controllers/media/RTMediaAlbum.php:67 msgid "Albums" msgstr "" -#: app/main/RTMedia.php:779 app/main/controllers/media/RTMediaLoginPopup.php:38 -#: app/main/controllers/template/rtmedia-actions.php:316 -#: app/main/controllers/template/rtmedia-actions.php:319 -#: app/main/controllers/template/rtmedia-actions.php:323 +#: app/main/RTMedia.php:896 app/main/controllers/media/RTMediaLoginPopup.php:48 +#: app/main/controllers/template/rtmedia-actions.php:321 +#: app/main/controllers/template/rtmedia-actions.php:324 +#: app/main/controllers/template/rtmedia-actions.php:330 msgid "Upload" msgstr "" -#: app/main/RTMedia.php:784 +#: app/main/RTMedia.php:901 msgid "Wall Post" msgstr "" -#: app/main/RTMedia.php:1007 app/main/RTMedia.php:1016 +#: app/main/RTMedia.php:1137 app/main/RTMedia.php:1146 msgid "Wall Posts" msgstr "" -#: app/main/RTMedia.php:1060 +#: app/main/RTMedia.php:1208 msgid ": Can't Create Database table. Please check create table permission." msgstr "" -#: app/main/RTMedia.php:1116 +#: app/main/RTMedia.php:1280 +msgid "Are you sure you want to delete this media?" +msgstr "" + +#: app/main/RTMedia.php:1281 +msgid "Media file deleted successfully." +msgstr "" + +#: app/main/RTMedia.php:1322 msgid "Loading media" msgstr "" -#: app/main/RTMedia.php:1117 +#: app/main/RTMedia.php:1323 msgid "Please enter some content to post." msgstr "" -#: app/main/RTMedia.php:1118 +#: app/main/RTMedia.php:1324 msgid "Empty comment is not allowed." msgstr "" -#: app/main/RTMedia.php:1119 -msgid "Are you sure you want to delete this media?" -msgstr "" - -#: app/main/RTMedia.php:1120 +#: app/main/RTMedia.php:1325 msgid "Are you sure you want to delete this comment?" msgstr "" -#: app/main/RTMedia.php:1121 +#: app/main/RTMedia.php:1326 msgid "Are you sure you want to delete this Album?" msgstr "" -#: app/main/RTMedia.php:1122 +#: app/main/RTMedia.php:1327 msgid "Drop files here" msgstr "" -#: app/main/RTMedia.php:1123 +#: app/main/RTMedia.php:1328 msgid "album created successfully." msgstr "" -#: app/main/RTMedia.php:1124 +#: app/main/RTMedia.php:1329 msgid "Something went wrong. Please try again." msgstr "" -#: app/main/RTMedia.php:1125 +#: app/main/RTMedia.php:1330 msgid "Enter an album name." msgstr "" -#: app/main/RTMedia.php:1126 +#: app/main/RTMedia.php:1331 msgid "Max file Size Limit : " msgstr "" -#: app/main/RTMedia.php:1127 +#: app/main/RTMedia.php:1332 msgid "Allowed File Formats" msgstr "" -#: app/main/RTMedia.php:1128 templates/media/album-single-edit.php:73 +#: app/main/RTMedia.php:1333 templates/media/album-single-edit.php:87 msgid "Select All Visible" msgstr "" -#: app/main/RTMedia.php:1129 +#: app/main/RTMedia.php:1334 msgid "Unselect All Visible" msgstr "" -#: app/main/RTMedia.php:1130 +#: app/main/RTMedia.php:1335 msgid "Please select some media." msgstr "" -#: app/main/RTMedia.php:1131 +#: app/main/RTMedia.php:1336 msgid "Are you sure you want to delete the selected media?" msgstr "" -#: app/main/RTMedia.php:1132 +#: app/main/RTMedia.php:1337 msgid "Are you sure you want to move the selected media?" msgstr "" -#: app/main/RTMedia.php:1133 +#: app/main/RTMedia.php:1338 msgid "Waiting" msgstr "" -#: app/main/RTMedia.php:1134 +#: app/main/RTMedia.php:1339 msgid "Uploaded" msgstr "" -#: app/main/RTMedia.php:1135 +#: app/main/RTMedia.php:1340 msgid "Uploading" msgstr "" -#: app/main/RTMedia.php:1136 +#: app/main/RTMedia.php:1341 msgid "Failed" msgstr "" -#: app/main/RTMedia.php:1137 +#: app/main/RTMedia.php:1342 msgid "Close" msgstr "" -#: app/main/RTMedia.php:1138 -#: app/main/controllers/media/RTMediaGalleryItemAction.php:63 -#: app/main/controllers/media/RTMediaGalleryItemAction.php:80 -#: app/main/controllers/template/rtmedia-functions.php:1174 -#: app/main/controllers/template/rtmedia-functions.php:1193 +#: app/main/RTMedia.php:1343 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:86 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:109 +#: app/main/controllers/template/rtmedia-functions.php:1261 +#: app/main/controllers/template/rtmedia-functions.php:1280 msgid "Edit" msgstr "" -#: app/main/RTMedia.php:1139 -#: app/main/controllers/media/RTMediaGalleryItemAction.php:67 -#: app/main/controllers/media/RTMediaGalleryItemAction.php:80 -#: app/main/controllers/template/rtmedia-functions.php:2093 -#: app/main/controllers/template/rtmedia-functions.php:2102 -#: templates/media/album-single-edit.php:78 +#: app/main/RTMedia.php:1344 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:89 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:109 +#: app/main/controllers/template/rtmedia-functions.php:2219 +#: app/main/controllers/template/rtmedia-functions.php:2228 +#: templates/media/album-single-edit.php:94 msgid "Delete" msgstr "" -#: app/main/RTMedia.php:1140 templates/media/media-single-edit.php:10 +#: app/main/RTMedia.php:1345 templates/media/media-single-edit.php:19 msgid "Edit Media" msgstr "" -#: app/main/RTMedia.php:1141 +#: app/main/RTMedia.php:1346 msgid "Remove from queue" msgstr "" -#: app/main/RTMedia.php:1142 +#: app/main/RTMedia.php:1347 msgid "Add more files" msgstr "" -#: app/main/RTMedia.php:1143 +#: app/main/RTMedia.php:1348 msgid "File not supported" msgstr "" -#: app/main/RTMedia.php:1144 +#: app/main/RTMedia.php:1349 msgid "more" msgstr "" -#: app/main/RTMedia.php:1145 +#: app/main/RTMedia.php:1350 msgid "less" msgstr "" -#: app/main/RTMedia.php:1146 +#: app/main/RTMedia.php:1351 msgid "Read more" msgstr "" -#: app/main/RTMedia.php:1147 +#: app/main/RTMedia.php:1352 msgid "Show less" msgstr "" -#: app/main/RTMedia.php:1149 +#: app/main/RTMedia.php:1354 msgid "This media is uploaded. Are you sure you want to delete this media?" msgstr "" -#: app/main/RTMedia.php:1165 +#: app/main/RTMedia.php:1370 msgid "Featured media set successfully." msgstr "" -#: app/main/RTMedia.php:1166 +#: app/main/RTMedia.php:1371 msgid "Featured media removed successfully." msgstr "" -#: app/main/RTMedia.php:1168 +#: app/main/RTMedia.php:1376 msgid "Title:" msgstr "" -#: app/main/RTMedia.php:1169 +#: app/main/RTMedia.php:1377 msgid "Description:" msgstr "" -#: app/main/RTMedia.php:1171 +#: app/main/RTMedia.php:1380 msgid "Oops !! There's no media found for the request !!" msgstr "" -#: app/main/RTMedia.php:1175 +#: app/main/RTMedia.php:1384 msgid "Edit File Name" msgstr "" -#: app/main/RTMedia.php:1186 +#: app/main/RTMedia.php:1395 msgid "Privacy updated successfully." msgstr "" -#: app/main/RTMedia.php:1187 +#: app/main/RTMedia.php:1396 msgid "Couldn't change privacy, please try again." msgstr "" -#: app/main/RTMedia.php:1188 -msgid "file deleted successfully." -msgstr "" - -#: app/main/RTMedia.php:1225 +#: app/main/RTMedia.php:1433 msgid "There are some uploads in progress. Do you want to cancel them?" msgstr "" -#: app/main/RTMedia.php:1227 +#: app/main/RTMedia.php:1435 msgid "Media upload is disabled. Please Enable at least one media type to proceed." msgstr "" -#: app/main/RTMedia.php:1329 +#: app/main/RTMedia.php:1546 msgid "Adding media in Comments is not allowed" msgstr "" -#: app/main/RTMediaUploadTerms.php:138 +#: app/main/RTMediaUploadTerms.php:186 msgid "I agree to" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:649 -msgid "Media Files" +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:457 +#: app/main/controllers/upload/RTMediaUploadEndpoint.php:60 +#: app/main/controllers/upload/RTMediaUploadEndpoint.php:74 +msgid "Terms and Conditions checkbox not found!" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:687 -#: app/main/controllers/media/RTMediaComment.php:175 -#: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:102 -#: app/main/controllers/template/rtmedia-functions.php:2132 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:791 +#: app/main/controllers/media/RTMediaComment.php:204 +#: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:125 +#: app/main/controllers/template/rtmedia-functions.php:2258 msgid "You are not allowed to upload/attach media." msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:822 -msgid "%s added a %s" +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:938 +#: app/main/controllers/media/RTMediaMedia.php:782 +#. translators: 1: user link, 2: media. +#. translators: 1: username, 2: media type, 3: media name, 4: total media. +msgid "%1$s added a %2$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:829 -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:831 -#: app/main/controllers/upload/RTMediaUploadEndpoint.php:229 -msgid "%s added %d %s" +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:946 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:949 +#: app/main/controllers/upload/RTMediaUploadEndpoint.php:278 +#. translators: 1: user link, 2: media count, 3: media. +#. translators: 1: user link, 2: media count, 3: rtMedia slug. +#. translators: 1: Username, 2: Number of medias, 3: Media slug. +msgid "%1$s added %2$d %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:884 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1003 +#. translators: 1: username, 2: media, 3: group name. msgid "%1$s liked a %2$s in the group %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:887 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1007 +#. translators: 1: username, 2: media. msgid "%1$s liked their %2$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:891 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1012 +#. translators: 1: username, 2: author, 3: media. msgid "%1$s liked %2$s's %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:981 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1102 +#. translators: 1: username, 2: media, 3: group name. msgid "%1$s commented on a %2$s in the group %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:984 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1107 +#. translators: 1: username, 2: media. msgid "%1$s commented on their %2$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:988 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1112 +#. translators: 1: username, 2: author, 3: media. msgid "%1$s commented on %2$s's %3$s" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:168 +#: app/main/controllers/api/RTMediaJsonApi.php:307 msgid "username/password empty" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:171 +#: app/main/controllers/api/RTMediaJsonApi.php:310 msgid "incorrect username" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:174 +#: app/main/controllers/api/RTMediaJsonApi.php:313 msgid "incorrect password" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:177 +#: app/main/controllers/api/RTMediaJsonApi.php:316 msgid "login success" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:223 +#: app/main/controllers/api/RTMediaJsonApi.php:365 msgid "fields empty" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:226 +#: app/main/controllers/api/RTMediaJsonApi.php:368 msgid "invalid email" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:229 +#: app/main/controllers/api/RTMediaJsonApi.php:371 msgid "password do not match" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:232 +#: app/main/controllers/api/RTMediaJsonApi.php:374 msgid "username already registered" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:235 +#: app/main/controllers/api/RTMediaJsonApi.php:377 msgid "email already exists" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:238 +#: app/main/controllers/api/RTMediaJsonApi.php:380 msgid "new user created" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:299 +#: app/main/controllers/api/RTMediaJsonApi.php:441 msgid "email empty" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:302 +#: app/main/controllers/api/RTMediaJsonApi.php:444 msgid "username/email not registered" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:305 +#: app/main/controllers/api/RTMediaJsonApi.php:447 msgid "reset link sent" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:338 +#: app/main/controllers/api/RTMediaJsonApi.php:480 msgid "Someone has asked to reset the password for the following site and username." msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:340 +#: app/main/controllers/api/RTMediaJsonApi.php:484 +#. translators: 1: Username. msgid "Username: %s" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:341 +#: app/main/controllers/api/RTMediaJsonApi.php:485 msgid "" "To reset your password visit the following address, otherwise just ignore " "this email and nothing will happen." msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:344 +#: app/main/controllers/api/RTMediaJsonApi.php:490 +#. translators: 1: Blog name. msgid "[%s] Password Reset" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:359 +#: app/main/controllers/api/RTMediaJsonApi.php:506 msgid "bp activities" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:362 +#: app/main/controllers/api/RTMediaJsonApi.php:509 msgid "user activities" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:371 +#: app/main/controllers/api/RTMediaJsonApi.php:518 msgid "no updates" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:393 +#: app/main/controllers/api/RTMediaJsonApi.php:541 msgid "comment content missing" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:396 +#: app/main/controllers/api/RTMediaJsonApi.php:544 msgid "comment posted" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:442 +#: app/main/controllers/api/RTMediaJsonApi.php:592 msgid "unliked media" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:445 +#: app/main/controllers/api/RTMediaJsonApi.php:595 msgid "liked media" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:526 +#: app/main/controllers/api/RTMediaJsonApi.php:680 msgid "no comments" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:529 +#: app/main/controllers/api/RTMediaJsonApi.php:683 msgid "media comments" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:532 -msgid "my comments" -msgstr "" - -#: app/main/controllers/api/RTMediaJsonApi.php:579 +#: app/main/controllers/api/RTMediaJsonApi.php:732 msgid "no likes" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:582 +#: app/main/controllers/api/RTMediaJsonApi.php:735 msgid "media likes" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:632 +#: app/main/controllers/api/RTMediaJsonApi.php:789 msgid "invalid comment/media id" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:635 +#: app/main/controllers/api/RTMediaJsonApi.php:792 msgid "no comment id" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:638 +#: app/main/controllers/api/RTMediaJsonApi.php:795 msgid "comment deleted" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:678 +#: app/main/controllers/api/RTMediaJsonApi.php:843 msgid "no profile found" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:681 +#: app/main/controllers/api/RTMediaJsonApi.php:846 msgid "profile fields" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:775 +#: app/main/controllers/api/RTMediaJsonApi.php:948 msgid "follow user id missing" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:778 +#: app/main/controllers/api/RTMediaJsonApi.php:951 msgid "started following" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:781 +#: app/main/controllers/api/RTMediaJsonApi.php:954 msgid "already following" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:809 +#: app/main/controllers/api/RTMediaJsonApi.php:987 msgid "unfollow id missing" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:812 +#: app/main/controllers/api/RTMediaJsonApi.php:990 msgid "stopped following" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:815 +#: app/main/controllers/api/RTMediaJsonApi.php:993 msgid "not following" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:843 +#: app/main/controllers/api/RTMediaJsonApi.php:1026 msgid "name/location empty" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:846 +#: app/main/controllers/api/RTMediaJsonApi.php:1029 msgid "profile updated" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:872 -#: app/main/controllers/api/RTMediaJsonApi.php:895 +#: app/main/controllers/api/RTMediaJsonApi.php:1058 +#: app/main/controllers/api/RTMediaJsonApi.php:1086 msgid "no file" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:875 -#: app/main/controllers/api/RTMediaJsonApi.php:907 +#: app/main/controllers/api/RTMediaJsonApi.php:1061 +#: app/main/controllers/api/RTMediaJsonApi.php:1098 msgid "upload failed, check size and file type" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:878 +#: app/main/controllers/api/RTMediaJsonApi.php:1064 msgid "avatar updated" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:898 +#: app/main/controllers/api/RTMediaJsonApi.php:1089 msgid "invalid file string" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:901 +#: app/main/controllers/api/RTMediaJsonApi.php:1092 msgid "image type missing" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:904 +#: app/main/controllers/api/RTMediaJsonApi.php:1095 msgid "no title" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:910 +#: app/main/controllers/api/RTMediaJsonApi.php:1101 msgid "media updated" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:1050 +#: app/main/controllers/api/RTMediaJsonApi.php:1261 msgid "media list" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:1053 +#: app/main/controllers/api/RTMediaJsonApi.php:1264 msgid "no media found for requested media type" msgstr "" -#: app/main/controllers/api/RTMediaJsonApi.php:1056 -msgid "media_type not allowed" -msgstr "" - -#: app/main/controllers/api/RTMediaJsonApi.php:1163 +#: app/main/controllers/api/RTMediaJsonApi.php:1382 msgid "single media" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:30 -#: app/main/controllers/group/RTMediaGroupExtension.php:109 +#: app/main/controllers/group/RTMediaGroupExtension.php:75 +#: app/main/controllers/group/RTMediaGroupExtension.php:160 msgid "Album Creation Control" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:31 -#: app/main/controllers/group/RTMediaGroupExtension.php:110 +#: app/main/controllers/group/RTMediaGroupExtension.php:76 +#: app/main/controllers/group/RTMediaGroupExtension.php:161 msgid "Who can create Albums in this group?" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:35 -#: app/main/controllers/group/RTMediaGroupExtension.php:114 +#: app/main/controllers/group/RTMediaGroupExtension.php:80 +#: app/main/controllers/group/RTMediaGroupExtension.php:165 msgid "All Group Members" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:39 -#: app/main/controllers/group/RTMediaGroupExtension.php:118 +#: app/main/controllers/group/RTMediaGroupExtension.php:84 +#: app/main/controllers/group/RTMediaGroupExtension.php:169 msgid "Group Admins and Mods only" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:43 -#: app/main/controllers/group/RTMediaGroupExtension.php:122 +#: app/main/controllers/group/RTMediaGroupExtension.php:88 +#: app/main/controllers/group/RTMediaGroupExtension.php:173 msgid "Group Admin only" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:130 -#: app/main/controllers/privacy/RTMediaPrivacy.php:427 -#: templates/media/album-single-edit.php:55 +#: app/main/controllers/group/RTMediaGroupExtension.php:181 +#: app/main/controllers/privacy/RTMediaPrivacy.php:526 +#: templates/media/album-single-edit.php:69 msgid "Save Changes" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:182 +#: app/main/controllers/group/RTMediaGroupExtension.php:234 msgid "There was an error saving, please try again" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:184 +#: app/main/controllers/group/RTMediaGroupExtension.php:236 msgid "Settings saved successfully" msgstr "" -#: app/main/controllers/group/RTMediaGroupExtension.php:205 +#: app/main/controllers/group/RTMediaGroupExtension.php:254 msgid "" "You could display a small snippet of information from your group extension " "here. It will show on the group home screen." msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:36 +#: app/main/controllers/media/RTMediaAlbum.php:38 +#. translators: %s: Album. msgid "Hidden (%s)" msgid_plural "Hidden (%s)" msgstr[0] "" msgstr[1] "" -#: app/main/controllers/media/RTMediaAlbum.php:55 +#: app/main/controllers/media/RTMediaAlbum.php:57 msgid "Create" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:56 -#: app/main/controllers/template/rtmedia-actions.php:206 +#: app/main/controllers/media/RTMediaAlbum.php:58 +#: app/main/controllers/template/rtmedia-actions.php:214 msgid "Create Album" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:57 -#: app/main/controllers/template/rtmedia-filters.php:82 +#: app/main/controllers/media/RTMediaAlbum.php:59 +#: app/main/controllers/template/rtmedia-filters.php:86 msgid "Edit Album" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:58 +#: app/main/controllers/media/RTMediaAlbum.php:60 msgid "New Album" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:59 +#: app/main/controllers/media/RTMediaAlbum.php:61 msgid "All Albums" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:60 +#: app/main/controllers/media/RTMediaAlbum.php:62 msgid "View Album" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:61 +#: app/main/controllers/media/RTMediaAlbum.php:63 msgid "Search Albums" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:62 +#: app/main/controllers/media/RTMediaAlbum.php:64 msgid "No album found" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:63 +#: app/main/controllers/media/RTMediaAlbum.php:65 msgid "No album found in Trash" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:64 +#: app/main/controllers/media/RTMediaAlbum.php:66 msgid "Parent" msgstr "" @@ -2877,229 +2925,225 @@ msgstr "" msgid "Untitled Album" msgstr "" -#: app/main/controllers/media/RTMediaComment.php:163 -#: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:90 +#: app/main/controllers/media/RTMediaComment.php:189 +#: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:113 msgid "The web browser on your device cannot be used to upload files." msgstr "" -#: app/main/controllers/media/RTMediaFeatured.php:25 -#: app/main/controllers/media/RTMediaGroupFeatured.php:17 +#: app/main/controllers/media/RTMediaFeatured.php:45 +#: app/main/controllers/media/RTMediaGroupFeatured.php:45 msgid "Set as Featured" msgstr "" -#: app/main/controllers/media/RTMediaFeatured.php:27 -#: app/main/controllers/media/RTMediaGroupFeatured.php:19 +#: app/main/controllers/media/RTMediaFeatured.php:47 +#: app/main/controllers/media/RTMediaGroupFeatured.php:47 msgid "Remove Featured" msgstr "" -#: app/main/controllers/media/RTMediaFeatured.php:193 -#: app/main/controllers/media/RTMediaGroupFeatured.php:195 +#: app/main/controllers/media/RTMediaFeatured.php:270 +#: app/main/controllers/media/RTMediaGroupFeatured.php:284 msgid "Media type is not allowed" msgstr "" -#: app/main/controllers/media/RTMediaGalleryItemAction.php:62 -#: app/main/controllers/media/RTMediaGalleryItemAction.php:80 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:85 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:109 msgid "Edit this media" msgstr "" -#: app/main/controllers/media/RTMediaGalleryItemAction.php:66 -#: app/main/controllers/media/RTMediaGalleryItemAction.php:80 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:88 +#: app/main/controllers/media/RTMediaGalleryItemAction.php:109 msgid "Delete this media" msgstr "" -#: app/main/controllers/media/RTMediaLike.php:18 +#: app/main/controllers/media/RTMediaLike.php:28 msgid "person likes this" msgstr "" -#: app/main/controllers/media/RTMediaLike.php:19 +#: app/main/controllers/media/RTMediaLike.php:29 msgid "people like this" msgstr "" -#: app/main/controllers/media/RTMediaLike.php:20 +#: app/main/controllers/media/RTMediaLike.php:30 msgid "Like" msgstr "" -#: app/main/controllers/media/RTMediaLike.php:22 +#: app/main/controllers/media/RTMediaLike.php:32 msgid "Unlike" msgstr "" -#: app/main/controllers/media/RTMediaLoginPopup.php:38 -#: app/main/controllers/template/rtmedia-actions.php:319 -#: app/main/controllers/template/rtmedia-actions.php:323 +#: app/main/controllers/media/RTMediaLoginPopup.php:48 +#: app/main/controllers/template/rtmedia-actions.php:324 +#: app/main/controllers/template/rtmedia-actions.php:330 msgid "Upload Media" msgstr "" -#: app/main/controllers/media/RTMediaLoginPopup.php:51 +#: app/main/controllers/media/RTMediaLoginPopup.php:62 msgid "Please login" msgstr "" -#: app/main/controllers/media/RTMediaLoginPopup.php:53 +#: app/main/controllers/media/RTMediaLoginPopup.php:64 msgid "You need to be logged in to upload Media or to create Album." msgstr "" -#: app/main/controllers/media/RTMediaLoginPopup.php:56 +#: app/main/controllers/media/RTMediaLoginPopup.php:67 msgid "Login" msgstr "" -#: app/main/controllers/media/RTMediaLoginPopup.php:56 +#: app/main/controllers/media/RTMediaLoginPopup.php:67 msgid "HERE" msgstr "" -#: app/main/controllers/media/RTMediaLoginPopup.php:56 +#: app/main/controllers/media/RTMediaLoginPopup.php:67 msgid " to login." msgstr "" -#: app/main/controllers/media/RTMediaMedia.php:610 +#: app/main/controllers/media/RTMediaMedia.php:650 msgid "Error creating attachment for the media file, please try again" msgstr "" -#: app/main/controllers/media/RTMediaMedia.php:725 -msgid "%1$s added a %2$s" -msgstr "" - -#: app/main/controllers/media/RTMediaMedia.php:725 +#: app/main/controllers/media/RTMediaMedia.php:782 msgid "%1$s added %4$d %3$s" msgstr "" -#: app/main/controllers/privacy/RTMediaPrivacy.php:389 +#: app/main/controllers/privacy/RTMediaPrivacy.php:481 msgid "No changes were made to your account." msgstr "" -#: app/main/controllers/privacy/RTMediaPrivacy.php:392 +#: app/main/controllers/privacy/RTMediaPrivacy.php:484 msgid "Your default privacy settings saved successfully." msgstr "" -#: app/main/controllers/privacy/RTMediaPrivacy.php:416 +#: app/main/controllers/privacy/RTMediaPrivacy.php:513 msgid "Default Privacy" msgstr "" -#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:276 +#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:321 msgid "You do not have sufficient privileges to view this gallery" msgstr "" -#: app/main/controllers/template/RTMediaAJAX.php:36 +#: app/main/controllers/template/RTMediaAJAX.php:48 msgid "You can not create album in this group." msgstr "" -#: app/main/controllers/template/RTMediaAJAX.php:42 +#: app/main/controllers/template/RTMediaAJAX.php:54 msgid "You can not create album." msgstr "" -#: app/main/controllers/template/RTMediaAJAX.php:47 +#: app/main/controllers/template/RTMediaAJAX.php:59 msgid "You can not create more albums, you exceed your album limit." msgstr "" -#: app/main/controllers/template/RTMediaAJAX.php:98 +#: app/main/controllers/template/RTMediaAJAX.php:119 msgid "Data mismatch, Please insert data properly." msgstr "" -#: app/main/controllers/template/RTMediaTemplate.php:119 -#: app/main/controllers/template/RTMediaTemplate.php:174 +#: app/main/controllers/template/RTMediaTemplate.php:141 +#: app/main/controllers/template/RTMediaTemplate.php:195 msgid "Invalid attribute passed for rtmedia_gallery shortcode." msgstr "" -#: app/main/controllers/template/RTMediaTemplate.php:392 -#: app/main/controllers/template/RTMediaTemplate.php:485 -#: app/main/controllers/template/RTMediaTemplate.php:583 -#: app/main/controllers/template/RTMediaTemplate.php:787 +#: app/main/controllers/template/RTMediaTemplate.php:445 +#: app/main/controllers/template/RTMediaTemplate.php:553 +#: app/main/controllers/template/RTMediaTemplate.php:659 +#: app/main/controllers/template/RTMediaTemplate.php:878 msgid "Ooops !!! Invalid access. No nonce was found !!" msgstr "" -#: app/main/controllers/template/RTMediaTemplate.php:399 +#: app/main/controllers/template/RTMediaTemplate.php:455 msgid "Media updated Sucessfully" msgstr "" -#: app/main/controllers/template/RTMediaTemplate.php:405 +#: app/main/controllers/template/RTMediaTemplate.php:464 msgid "Error in updating Media" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:17 -#: app/main/controllers/template/rtmedia-actions.php:153 +#: app/main/controllers/template/rtmedia-actions.php:26 +#: app/main/controllers/template/rtmedia-actions.php:162 msgid "Options" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:54 +#: app/main/controllers/template/rtmedia-actions.php:62 msgid "Image" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:80 +#: app/main/controllers/template/rtmedia-actions.php:88 msgid "Modify Image" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:192 +#: app/main/controllers/template/rtmedia-actions.php:200 msgid "Create an Album" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:194 +#: app/main/controllers/template/rtmedia-actions.php:202 msgid "Album Title : " msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:198 +#: app/main/controllers/template/rtmedia-actions.php:206 msgid "Album Description : " msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:246 #: app/main/controllers/template/rtmedia-actions.php:253 -#: app/main/controllers/template/rtmedia-filters.php:92 +#: app/main/controllers/template/rtmedia-actions.php:260 +#: app/main/controllers/template/rtmedia-filters.php:96 msgid "Merge Album" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:249 +#: app/main/controllers/template/rtmedia-actions.php:256 msgid "Select Album to merge with : " msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:299 +#: app/main/controllers/template/rtmedia-actions.php:304 msgid "Merge" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:369 +#: app/main/controllers/template/rtmedia-actions.php:371 msgid "Empowering your community with " msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:370 +#: app/main/controllers/template/rtmedia-actions.php:372 msgid "The only complete media solution for WordPress, BuddyPress and bbPress" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:389 +#: app/main/controllers/template/rtmedia-actions.php:390 msgid "Close (Esc)" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:534 +#: app/main/controllers/template/rtmedia-actions.php:514 msgid "You can consider rtMedia Team for following :" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:536 +#: app/main/controllers/template/rtmedia-actions.php:516 msgid "rtMedia Customization ( in Upgrade Safe manner )" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:537 +#: app/main/controllers/template/rtmedia-actions.php:517 msgid "WordPress/BuddyPress Theme Design and Development" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:538 +#: app/main/controllers/template/rtmedia-actions.php:518 msgid "WordPress/BuddyPress Plugin Development" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:541 +#: app/main/controllers/template/rtmedia-actions.php:521 msgid "Contact Us" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:628 -#: app/main/controllers/template/rtmedia-actions.php:629 +#: app/main/controllers/template/rtmedia-actions.php:618 +#: app/main/controllers/template/rtmedia-actions.php:619 msgid "Previous" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:630 -#: app/main/controllers/template/rtmedia-actions.php:631 -#: templates/media/album-single-edit.php:121 +#: app/main/controllers/template/rtmedia-actions.php:620 +#: app/main/controllers/template/rtmedia-actions.php:621 +#: templates/media/album-single-edit.php:142 msgid "Next" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:827 +#: app/main/controllers/template/rtmedia-actions.php:826 msgid "Settings has been saved successfully." msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:831 +#: app/main/controllers/template/rtmedia-actions.php:830 msgid "Refresh the page in case if license data is not showing correct." msgstr "" @@ -3111,381 +3155,397 @@ msgstr "" msgid "rtMedia Updates" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:903 +#: app/main/controllers/template/rtmedia-actions.php:907 msgid "Search Media" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:1089 +#: app/main/controllers/template/rtmedia-actions.php:1101 msgid "Please swipe for more media." msgstr "" -#: app/main/controllers/template/rtmedia-ajax-actions.php:88 -#: app/main/controllers/template/rtmedia-functions.php:2032 +#: app/main/controllers/template/rtmedia-ajax-actions.php:67 +msgid "Doing wrong, invalid AJAX request!" +msgstr "" + +#: app/main/controllers/template/rtmedia-ajax-actions.php:144 +#: app/main/controllers/template/rtmedia-functions.php:2156 msgid "Comment" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:50 +#: app/main/controllers/template/rtmedia-filters.php:54 msgid "Create New Album" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:50 +#: app/main/controllers/template/rtmedia-filters.php:54 msgid "Add Album" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:83 +#: app/main/controllers/template/rtmedia-filters.php:87 msgid "Delete Album" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:853 -#: app/main/controllers/template/rtmedia-functions.php:4397 +#: app/main/controllers/template/rtmedia-filters.php:918 +#: app/main/controllers/template/rtmedia-functions.php:4630 msgid "rtMedia Shortcode Uploads" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:857 -#: app/main/controllers/template/rtmedia-functions.php:4277 +#: app/main/controllers/template/rtmedia-filters.php:922 +#: app/main/controllers/template/rtmedia-functions.php:4512 msgid "rtMedia Activities" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:861 +#: app/main/controllers/template/rtmedia-filters.php:926 msgid "rtMedia Comments" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:865 -#: app/main/controllers/template/rtmedia-functions.php:4625 +#: app/main/controllers/template/rtmedia-filters.php:930 +#: app/main/controllers/template/rtmedia-functions.php:4857 msgid "rtMedia Media Views" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:869 -#: app/main/controllers/template/rtmedia-functions.php:4726 +#: app/main/controllers/template/rtmedia-filters.php:934 +#: app/main/controllers/template/rtmedia-functions.php:4958 msgid "rtMedia Media Likes" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:890 +#: app/main/controllers/template/rtmedia-filters.php:952 msgid "rtMedia Eraser" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:894 +#: app/main/controllers/template/rtmedia-filters.php:957 msgid "rtMedia Likes Eraser" msgstr "" -#: app/main/controllers/template/rtmedia-filters.php:898 +#: app/main/controllers/template/rtmedia-filters.php:962 msgid "rtMedia Album Eraser" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:1256 +#: app/main/controllers/template/rtmedia-functions.php:1346 msgid "There are no comments on this media yet." msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:1288 +#: app/main/controllers/template/rtmedia-functions.php:1381 +#. translators: %s Count of comments. msgid "Show all %s comments" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:1321 +#: app/main/controllers/template/rtmedia-functions.php:1414 msgid "Delete Comment" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:1660 +#: app/main/controllers/template/rtmedia-functions.php:1772 msgid "Go to page no : " msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:1665 +#: app/main/controllers/template/rtmedia-functions.php:1777 msgid "Go" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2030 +#: app/main/controllers/template/rtmedia-functions.php:2154 msgid "Type Comment..." msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2093 -#: app/main/controllers/template/rtmedia-functions.php:2102 +#: app/main/controllers/template/rtmedia-functions.php:2219 +#: app/main/controllers/template/rtmedia-functions.php:2228 msgid "Delete Media" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2350 +#: app/main/controllers/template/rtmedia-functions.php:2482 msgid "Profile Albums" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2354 -#: app/main/controllers/template/rtmedia-functions.php:2399 +#: app/main/controllers/template/rtmedia-functions.php:2486 +#: app/main/controllers/template/rtmedia-functions.php:2535 msgid "Group Albums" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2579 +#: app/main/controllers/template/rtmedia-functions.php:2716 msgid "Privacy : " msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2929 +#: app/main/controllers/template/rtmedia-functions.php:3068 msgid "You like this" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2941 +#: app/main/controllers/template/rtmedia-functions.php:3082 msgid "You and " msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:2964 +#: app/main/controllers/template/rtmedia-functions.php:3105 msgid " person likes this" msgid_plural " people like this" msgstr[0] "" msgstr[1] "" -#: app/main/controllers/template/rtmedia-functions.php:3071 +#: app/main/controllers/template/rtmedia-functions.php:3226 msgid "Public" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:3076 +#: app/main/controllers/template/rtmedia-functions.php:3231 msgid "All members" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:3081 +#: app/main/controllers/template/rtmedia-functions.php:3236 msgid "Your friends" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:3086 +#: app/main/controllers/template/rtmedia-functions.php:3241 msgid "Only you" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:3091 +#: app/main/controllers/template/rtmedia-functions.php:3246 msgid "Blocked temporarily" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:3144 +#: app/main/controllers/template/rtmedia-functions.php:3304 +#. translators: %s: count of hour/minute/second. msgid "%s ago " msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:3158 -msgid "1 second" +#: app/main/controllers/template/rtmedia-functions.php:3322 +#. translators: %s: number of seconds. +msgid "%s second" msgid_plural "%s seconds" msgstr[0] "" msgstr[1] "" -#: app/main/controllers/template/rtmedia-functions.php:3162 -msgid "1 minute" +#: app/main/controllers/template/rtmedia-functions.php:3327 +#. translators: %s: number of minutes. +msgid "%s minute" msgid_plural "%s minutes" msgstr[0] "" msgstr[1] "" -#: app/main/controllers/template/rtmedia-functions.php:3166 -msgid "1 hour" +#: app/main/controllers/template/rtmedia-functions.php:3332 +#. translators: %s: number of hours. +msgid "%s hour" msgid_plural "%s hours" msgstr[0] "" msgstr[1] "" -#: app/main/controllers/template/rtmedia-functions.php:3766 -#. translators: date format, see http:php.net/date +#: app/main/controllers/template/rtmedia-functions.php:3959 +#. translators: %s: date format, see http:php.net/date. msgid "View Conversation" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4305 +#: app/main/controllers/template/rtmedia-functions.php:4538 msgid "Activity Date" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4309 +#: app/main/controllers/template/rtmedia-functions.php:4542 msgid "Activity Content" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4313 -#: app/main/controllers/template/rtmedia-functions.php:4536 +#: app/main/controllers/template/rtmedia-functions.php:4546 +#: app/main/controllers/template/rtmedia-functions.php:4767 msgid "Attachments" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4406 +#: app/main/controllers/template/rtmedia-functions.php:4639 msgid "Media Upload Date" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4410 +#: app/main/controllers/template/rtmedia-functions.php:4643 msgid "Media Title" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4414 -#: app/main/controllers/template/rtmedia-functions.php:4629 -#: app/main/controllers/template/rtmedia-functions.php:4730 +#: app/main/controllers/template/rtmedia-functions.php:4647 +#: app/main/controllers/template/rtmedia-functions.php:4861 +#: app/main/controllers/template/rtmedia-functions.php:4962 msgid "Media URL" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4418 +#: app/main/controllers/template/rtmedia-functions.php:4651 msgid "Album Title" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4506 +#: app/main/controllers/template/rtmedia-functions.php:4739 msgid "rtMedia Activity Comments" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4528 +#: app/main/controllers/template/rtmedia-functions.php:4759 msgid "Comment Date" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4532 +#: app/main/controllers/template/rtmedia-functions.php:4763 msgid "Comment Content" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4633 +#: app/main/controllers/template/rtmedia-functions.php:4865 msgid "Number of Views" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4637 +#: app/main/controllers/template/rtmedia-functions.php:4869 msgid "Date of First View" msgstr "" -#: app/main/controllers/template/rtmedia-functions.php:4734 +#: app/main/controllers/template/rtmedia-functions.php:4966 msgid "Date" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:97 +#: app/main/controllers/upload/RTMediaUploadView.php:132 msgid "Privacy:" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:104 -#: app/main/controllers/upload/RTMediaUploadView.php:161 -#: app/main/controllers/upload/RTMediaUploadView.php:178 -#: app/main/controllers/upload/RTMediaUploadView.php:199 +#: app/main/controllers/upload/RTMediaUploadView.php:139 +#: app/main/controllers/upload/RTMediaUploadView.php:200 +#: app/main/controllers/upload/RTMediaUploadView.php:217 +#: app/main/controllers/upload/RTMediaUploadView.php:238 msgid "File Upload" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:108 +#: app/main/controllers/upload/RTMediaUploadView.php:143 msgid "Select your files" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:109 +#: app/main/controllers/upload/RTMediaUploadView.php:144 msgid "or" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:109 +#: app/main/controllers/upload/RTMediaUploadView.php:144 msgid "Drop your files here" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:157 +#: app/main/controllers/upload/RTMediaUploadView.php:196 msgid "Start upload" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:185 -#: app/main/controllers/upload/RTMediaUploadView.php:206 +#: app/main/controllers/upload/RTMediaUploadView.php:224 +#: app/main/controllers/upload/RTMediaUploadView.php:245 msgid "Attach Media" msgstr "" -#: app/main/controllers/upload/RTMediaUploadView.php:221 +#: app/main/controllers/upload/RTMediaUploadView.php:260 msgid "Insert from URL" msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:61 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:97 msgid "Error Uploading File" msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:233 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:304 msgid "MP4 file you have uploaded is corrupt." msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:240 -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:245 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:312 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:316 msgid "" "The MP4 file you have uploaded is using an unsupported video codec. " "Supported video codec is H.264." msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:250 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:320 msgid "The MP4 file you have uploaded is not a video file." msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:263 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:333 msgid "MP3 file you have uploaded is currupt." msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:270 -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:275 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:341 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:345 msgid "" "The MP3 file you have uploaded is using an unsupported audio format. " "Supported audio format is MP3." msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:280 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:349 msgid "The MP3 file you have uploaded is not an audio file." msgstr "" -#: app/main/controllers/upload/processors/RTMediaUploadFile.php:288 +#: app/main/controllers/upload/processors/RTMediaUploadFile.php:356 msgid "" "Media File you have tried to upload is not supported. Supported media files " "are .jpg, .png, .gif, .mp3, .mov and .mp4." msgstr "" -#: app/main/deprecated/RTMediaDeprecated.php:27 -msgid "Deprecated %s. Please use %s." +#: app/main/deprecated/RTMediaDeprecated.php:40 +#. translators: 1: function name, 2: method. +msgid "Deprecated %1$s. Please use %2$s." msgstr "" #: templates/main.php:70 templates/main.php:143 msgid "rtMedia menu" msgstr "" -#: templates/media/album-gallery.php:21 +#: templates/media/album-gallery.php:26 msgid "Album List" msgstr "" -#: templates/media/album-single-edit.php:14 +#: templates/media/album-gallery.php:83 templates/media/media-gallery.php:123 +#: templates/media/media-single-edit.php:73 +#: templates/media/media-single.php:212 +msgid "Sorry !! There's no media found for the request !!" +msgstr "" + +#: templates/media/album-single-edit.php:22 msgid "Edit Album : " msgstr "" -#: templates/media/album-single-edit.php:24 +#: templates/media/album-single-edit.php:37 msgid "Manage Media" msgstr "" -#: templates/media/album-single-edit.php:39 -#: templates/media/media-single-edit.php:29 +#: templates/media/album-single-edit.php:53 +#: templates/media/media-single-edit.php:37 msgid "Title : " msgstr "" -#: templates/media/album-single-edit.php:44 -#: templates/media/media-single-edit.php:35 +#: templates/media/album-single-edit.php:58 +#: templates/media/media-single-edit.php:43 msgid "Description: " msgstr "" -#: templates/media/album-single-edit.php:57 -#: templates/media/media-single-edit.php:52 +#: templates/media/album-single-edit.php:71 +#: templates/media/media-single-edit.php:60 msgid "Back" msgstr "" -#: templates/media/album-single-edit.php:75 +#: templates/media/album-single-edit.php:89 msgid "Move Selected media to another album." msgstr "" -#: templates/media/album-single-edit.php:75 +#: templates/media/album-single-edit.php:90 msgid "Move" msgstr "" -#: templates/media/album-single-edit.php:78 +#: templates/media/album-single-edit.php:93 msgid "Delete Selected media from the album." msgstr "" -#: templates/media/album-single-edit.php:83 +#: templates/media/album-single-edit.php:100 msgid "Move selected media to the album : " msgstr "" -#: templates/media/album-single-edit.php:86 +#: templates/media/album-single-edit.php:106 msgid "Move Selected" msgstr "" -#: templates/media/album-single-edit.php:110 +#: templates/media/album-single-edit.php:129 msgid "Prev" msgstr "" -#: templates/media/album-single-edit.php:124 +#: templates/media/album-single-edit.php:146 msgid "The album is empty." msgstr "" -#: templates/media/album-single-edit.php:134 +#: templates/media/album-single-edit.php:156 msgid "Sorry !! You can not edit this album." msgstr "" -#: templates/media/media-gallery.php:21 templates/media/media-gallery.php:54 +#: templates/media/media-gallery.php:27 templates/media/media-gallery.php:63 msgid "Media Gallery" msgstr "" -#: templates/media/media-single-edit.php:50 +#: templates/media/media-single-edit.php:58 msgid "Save" msgstr "" -#: templates/media/media-single-edit.php:59 +#: templates/media/media-single-edit.php:67 msgid "Sorry !! You do not have rights to edit this media" msgstr "" -#: templates/media/media-single.php:62 +#: templates/media/media-single.php:75 msgid "under" msgstr "" @@ -3512,12 +3572,12 @@ msgid "" "campaign=buddypress-media" msgstr "" -#: app/main/controllers/media/RTMediaAlbum.php:35 +#: app/main/controllers/media/RTMediaAlbum.php:36 msgctxt "Status General Name" msgid "hidden" msgstr "" -#: app/main/controllers/template/RTMediaNav.php:41 +#: app/main/controllers/template/RTMediaNav.php:68 msgctxt "My Account Privacy sub nav" msgid "Privacy" msgstr "" \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c6ccdb0fc..0bd0b9f6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,12 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "dev": true + }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -1052,9 +1058,9 @@ } }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mkdirp": { diff --git a/package.json b/package.json index 97cd3183f..46b3bb038 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "grunt-contrib-watch": "^1.1.0", "grunt-wp-i18n": "^1.0.3", "load-grunt-tasks": "^5.0.0", - "diff": ">=3.5.0" + "diff": ">=3.5.0", + "acorn": "^7.1.1", + "minimist": "^1.2.5" } } diff --git a/phpcs.xml b/phpcs.xml index abb18fc1b..856024f2d 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -15,7 +15,7 @@ - + */bin/* */lib/* diff --git a/readme.txt b/readme.txt index 64e801529..26af82267 100755 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, i License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Requires at least: WordPress 4.1 -Tested up to: 5.3.2 -Stable tag: 4.6.0 +Tested up to: 5.4 +Stable tag: 4.6.1 Add albums, photo, audio/video upload, privacy, sharing, front-end uploads & more. All this works on mobile/tablets devices. @@ -134,6 +134,21 @@ http://www.youtube.com/watch?v=dJrykKQGDcs == Changelog == += 4.6.1 [April 8, 2020] = + +* Enhancement + + * Disable the terms of service checkbox when the activity is published + +* FIXED + + * Different language characters not showing up properly on rtMedia pages + * HTML warnings of rtMedia contents + * Nouveau template tab count bug + * Added server side validation for terms of service + * Terms of service checkbox conflicting with rtMedia Sidebar Widgets addon + * PHPCS errors and warnings + = 4.6.0 [February 17, 2020] = * Enhancement @@ -1658,8 +1673,8 @@ http://www.youtube.com/watch?v=dJrykKQGDcs == Upgrade Notice == -= 4.6.0 = -rtMedia 4.6.0, with improved activity content preview and JavaScript and Nouveau template related fixes. += 4.6.1 = +rtMedia 4.6.1 with added server side validation for terms of services checkbox, minor bug fixes along with warnings and PHPCS fixes == Sponsors == diff --git a/templates/main.php b/templates/main.php index 26b3788cf..6fd73d598 100755 --- a/templates/main.php +++ b/templates/main.php @@ -310,7 +310,6 @@ } else { // If ajax/iframe request, just load images. rtmedia_load_template(); } - // close all markup. ?>
        diff --git a/templates/media/album-gallery-item.php b/templates/media/album-gallery-item.php index 84ca99275..a2dd19d5f 100755 --- a/templates/media/album-gallery-item.php +++ b/templates/media/album-gallery-item.php @@ -1,5 +1,10 @@ false, ); -//todo: nonce verification +// todo: nonce verification. $rtmedia_backbone['backbone'] = filter_input( INPUT_POST, 'backbone', FILTER_VALIDATE_BOOLEAN ); $is_album = filter_input( INPUT_POST, 'is_album', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); @@ -21,7 +26,7 @@ $rtmedia_backbone['is_edit_allowed'] = $is_edit_allowed[0]; } ?> -
      • +
      • <?php echo esc_attr( rtmedia_title() ); ?> @@ -40,7 +45,7 @@
        + ?>
        -