From a3bd10e27e742c8b6aad4b015f1525da16c7187a Mon Sep 17 00:00:00 2001
From: vaishali
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 );
?>
@@ -165,17 +196,21 @@ function install_transcoder_admin_notice() {
+ if ( $display ) {
+ ?>
ID );
if ( $rtm_id ) {
- $link = get_rtmedia_permalink( $rtm_id );
- $title = _draft_or_post_title( $post->post_parent );
+ $link = get_rtmedia_permalink( $rtm_id );
+ $title = _draft_or_post_title( $post->post_parent );
+
+ // translators: Title.
$action['view'] = '' . esc_html__( 'View', 'buddypress-media' ) . '';
}
return $action;
}
- function rtmedia_migration() {
+ /**
+ * Rtmedia migration.
+ */
+ public function rtmedia_migration() {
new RTMediaMigration();
}
- function rtmedia_addon_license_save_hook() {
+ /**
+ * Addon License save hook.
+ */
+ public function rtmedia_addon_license_save_hook() {
do_action( 'rtmedia_addon_license_save_hook' );
}
@@ -231,8 +283,6 @@ function rtmedia_addon_license_save_hook() {
*
* @access public
*
- * @param void
- *
* @return void
*/
public function rtmedia_network_admin_notices() {
@@ -246,8 +296,6 @@ public function rtmedia_network_admin_notices() {
*
* @access public
*
- * @param void
- *
* @return void
*/
public function rtmedia_admin_notices() {
@@ -263,8 +311,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 +324,15 @@ 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: Product page link.
+ $message = sprintf( __( 'Check 30+ premium rtMedia add-ons on our store.', 'buddypress-media' ), $product_page );
?>
- Dismiss
+ Dismiss
-
+
flush_rules( true );
}
$this->return_migration();
}
- function migrate_encoding_options() {
+ /**
+ * Migrate encoding options.
+ */
+ public function migrate_encoding_options() {
$encoding_mnigration_array = array(
'bp-media-encoding-api-key' => 'rtmedia-encoding-api-key',
'bp-media-encoding-usage-limit-mail' => 'rtmedia-encoding-usage-limit-mail',
@@ -580,7 +680,15 @@ function migrate_encoding_options() {
}
}
- function migrate_single_media( $result, $album = false ) {
+ /**
+ * Migrate single media.
+ *
+ * @param string $result Result.
+ * @param bool $album Album.
+ *
+ * @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' ) ) {
@@ -635,7 +743,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 );
@@ -659,12 +767,12 @@ 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 ) {
+ 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();
+ $bp_activity = new BP_Activity_Activity();
// @codingStandardsIgnoreStart
$activity_sql = $wpdb->prepare( "SELECT
*
@@ -705,22 +813,24 @@ 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,11 +850,13 @@ 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 ) {
$activity_data->old_primary_link = $activity_data->primary_link;
@@ -760,8 +872,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 +888,12 @@ function migrate_single_media( $result, $album = false ) {
}
/**
- * @param $id
- * @param $prefix
+ * Import media.
+ *
+ * @param int $id Id.
+ * @param string $prefix Prefix.
*/
- function importmedia( $id, $prefix ) {
+ public function importmedia( $id, $prefix ) {
$delete = false;
$attached_file = get_attached_file( $id );
@@ -790,7 +904,7 @@ 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
@@ -800,7 +914,7 @@ function importmedia( $id, $prefix ) {
}
if ( ! $url = get_option( 'upload_url_path' ) ) {
- if ( empty( $upload_path ) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) {
+ 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 +928,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 +936,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 +948,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,7 +1121,13 @@ function importmedia( $id, $prefix ) {
}
}
- function search_and_replace( $old, $new ) {
+ /**
+ * Search and replace.
+ *
+ * @param string $old Old.
+ * @param string $new New.
+ */
+ public function search_and_replace( $old, $new ) {
global $wpdb;
if ( function_exists( 'bp_core_get_table_prefix' ) ) {
$bp_prefix = bp_core_get_table_prefix();
@@ -1020,7 +1138,14 @@ function search_and_replace( $old, $new ) {
$wpdb->get_row( $sql );// @codingStandardsIgnoreLine
}
- function format_seconds( $seconds_left ) {
+ /**
+ * Format seconds.
+ *
+ * @param float $seconds_left Seconds.
+ *
+ * @return string
+ */
+ public function format_seconds( $seconds_left ) {
$minute_in_seconds = 60;
$hour_in_seconds = $minute_in_seconds * 60;
@@ -1039,7 +1164,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 +1188,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 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 ) ) {
From b8d75fcd062c3e48e13440b6fa6545276ed7610f Mon Sep 17 00:00:00 2001
From: vaishali
' . $message . '
' . wp_kses( $message, $args ) . '
' . $message . '
' . wp_kses( $message, $args ) . '
"; - // print_r ( $this ); - // echo ""; - // } + // if ( isset ( $_SERVER[ "REMOTE_ADDR" ] ) && $_SERVER[ "REMOTE_ADDR" ] == "14.97.170.202" ) { + // echo "
"; + // print_r ( $this ); + // echo ""; + // } $bulk = false; $action = false; $attribute = false; @@ -243,12 +241,12 @@ function set_action_query() { $pageno = ( get_query_var( 'pg' ) ) ? get_query_var( 'pg' ) : 1; } - $attributes = ''; + $attributes = ''; // 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() ) { @@ -260,7 +258,6 @@ function set_action_query() { // requesting nonce /media/nonce/edit/ | /media/nonce/comment // | /media/nonce/delete - if ( 'nonce' === $modifier_value ) { $modifier_type = 'nonce'; @@ -280,7 +277,6 @@ function set_action_query() { // 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,7 +287,7 @@ function set_action_query() { // /media/pg/2/ } elseif ( 'pg' === $modifier_value ) { - //paginating default query + // paginating default query $modifier_type = 'pg'; } else { @@ -310,7 +306,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 +315,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 ) ) { @@ -344,7 +338,6 @@ function set_action_query() { break; case 'pg': - // /media/page/2/ | /media/page/3/ if ( is_numeric( $second_modifier ) ) { @@ -353,7 +346,6 @@ function set_action_query() { break; case 'media_type': - // /media/photos/edit/ | /media/videos/edit/ if ( array_key_exists( $second_modifier, $this->actions ) ) { @@ -361,10 +353,10 @@ function set_action_query() { $bulk = true; } // /media/photos/page/2/ - //elseif($second_modifier=='page'){ - //$page = $second_modifier; - //pagination support - //} + // elseif($second_modifier=='page'){ + // $page = $second_modifier; + // pagination support + // } break; default: @@ -372,8 +364,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,21 +372,16 @@ function set_action_query() { switch ( $modifier_type ) { case 'nonce': - // 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/ - break; case 'media_type': - // /media/photos/edit/ | /media/videos/edit/ // leaving here for more granular editing, in future, for eg, // /media/photos/edit/title/ @@ -414,8 +400,8 @@ function set_action_query() { global $rtmedia; - //if ( ! $rtmedia->get_option( 'media_end_point_enable' ) ) - //include get_404_template(); + // if ( ! $rtmedia->get_option( 'media_end_point_enable' ) ) + // include get_404_template(); /** * set action query object @@ -459,24 +445,26 @@ function &query( $query ) { * Later on, renmove this comment and below commented code. */ // $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', - ) ); + // 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']; } @@ -511,17 +499,22 @@ 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'"; + // 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 ); } 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,15 +527,20 @@ 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" ] ); + // 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 ); + // $this->action_query->media_type = "album"; + add_filter( + 'rtmedia-before-template', + array( + &$this, + 'register_set_gallery_template_filter', + ), + 10, + 2 + ); } } unset( $this->query['global'] ); @@ -574,7 +572,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 ) . "'))"; } } } @@ -619,9 +617,8 @@ function populate_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); - + // 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,13 +629,13 @@ 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' ] ); + // 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']; @@ -665,7 +662,7 @@ 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'] ); } @@ -702,14 +699,14 @@ 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 { @@ -729,9 +726,8 @@ 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 + // 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 ); if ( ! $pre_media ) { @@ -740,20 +736,20 @@ function populate_media() { return $pre_media; } - /* removed because of indexing ---- 0,1,2 was required rather than post_ids + /* + 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) { + // 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; - // } - + // 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() { global $rtmedia; foreach ( $rtmedia->allowed_types as $value ) { @@ -797,7 +793,7 @@ function order_by() { } function populate_album() { - $this->album = $this->media; + $this->album = $this->media; $this->media_query['album_id'] = $this->action_query->id; if ( apply_filters( 'rtmedia_unset_action_query_id_album', true ) ) { @@ -829,7 +825,7 @@ function populate_data() { $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(); @@ -849,7 +845,7 @@ 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 ); @@ -863,10 +859,15 @@ 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, + 3 + ); } } From 1e54ffa753a89f9d23e1ade538e383bd8f5b7e81 Mon Sep 17 00:00:00 2001 From: Vaishali Agola
"; - // print_r ( $this ); - // echo ""; - // } $bulk = false; $action = false; $attribute = false; @@ -230,23 +319,23 @@ function set_action_query() { $modifier_value = false; $format = ''; $pageno = 1; - - // Get page number for json response + // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification + // Get page number for json response. if ( ! empty( $_REQUEST['json'] ) ) { $pageno = ( isset( $_REQUEST['rtmedia_page'] ) && ! empty( $_REQUEST['rtmedia_page'] ) ) ? intval( $_REQUEST['rtmedia_page'] ) : 1; } - // Get page number for none json response + // Get page number for none json response. if ( ! isset( $_REQUEST['json'] ) && empty( $_REQUEST['json'] ) ) { $pageno = ( get_query_var( 'pg' ) ) ? get_query_var( 'pg' ) : 1; } - + // phpcs:enable WordPress.Security.NonceVerification.NoNonceVerification $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() ) { @@ -254,27 +343,27 @@ function set_action_query() { die(); } - do_action( 'rtmedia_slug_404_handler' ); // disbale media type 404 handler + do_action( 'rtmedia_slug_404_handler' ); // disable media type 404 handler. - // requesting nonce /media/nonce/edit/ | /media/nonce/comment - // | /media/nonce/delete + // 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 + // 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; @@ -287,11 +376,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'; } } @@ -323,14 +412,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/
Name | ' . strip_tags( $form_data['name'] ) . ' | +Name | ' . wp_strip_all_tags( $form_data['name'] ) . ' |
' . strip_tags( $form_data['email'] ) . ' | +' . wp_strip_all_tags( $form_data['email'] ) . ' | ||
Website | ' . strip_tags( $form_data['website'] ) . ' | +Website | ' . wp_strip_all_tags( $form_data['website'] ) . ' |
Subject | ' . strip_tags( $form_data['subject'] ) . ' | +Subject | ' . wp_strip_all_tags( $form_data['subject'] ) . ' |
Details | ' . strip_tags( $form_data['details'] ) . ' | +Details | ' . wp_strip_all_tags( $form_data['details'] ) . ' |
Request ID | ' . strip_tags( $form_data['request_id'] ) . ' | +Request ID | ' . wp_strip_all_tags( $form_data['request_id'] ) . ' |
Server Address | ' . strip_tags( $form_data['server_address'] ) . ' | +Server Address | ' . wp_strip_all_tags( $form_data['server_address'] ) . ' |
IP Address | ' . strip_tags( $form_data['ip_address'] ) . ' | +IP Address | ' . wp_strip_all_tags( $form_data['ip_address'] ) . ' |
Server Type | ' . strip_tags( $form_data['server_type'] ) . ' | +Server Type | ' . wp_strip_all_tags( $form_data['server_type'] ) . ' |
User Agent | ' . strip_tags( $form_data['user_agent'] ) . ' | +User Agent | ' . wp_strip_all_tags( $form_data['user_agent'] ) . ' |
WordPress Admin Username | ' . strip_tags( $form_data['wp_admin_username'] ) . ' | +WordPress Admin Username | ' . wp_strip_all_tags( $form_data['wp_admin_username'] ) . ' |
WordPress Admin Password | ' . strip_tags( $form_data['wp_admin_pwd'] ) . ' | +WordPress Admin Password | ' . wp_strip_all_tags( $form_data['wp_admin_pwd'] ) . ' |
SSH FTP Host | ' . strip_tags( $form_data['ssh_ftp_host'] ) . ' | +SSH FTP Host | ' . wp_strip_all_tags( $form_data['ssh_ftp_host'] ) . ' |
SSH FTP Username | ' . strip_tags( $form_data['ssh_ftp_username'] ) . ' | +SSH FTP Username | ' . wp_strip_all_tags( $form_data['ssh_ftp_username'] ) . ' |
SSH FTP Password | ' . strip_tags( $form_data['ssh_ftp_pwd'] ) . ' | +SSH FTP Password | ' . wp_strip_all_tags( $form_data['ssh_ftp_pwd'] ) . ' | ' . parent::get_number( array( - 'name' => "rtmedia-options[{$key}_height]", - 'value' => $height, + 'name' => "rtmedia-options[{{$attributes['key']}_height]", + 'value' => $attributes['height'], 'class' => array( 'small-text large-offset-1' ), - 'show_desc' => $show_desc, + 'show_desc' => $attributes['show_desc'], ) ) . ' | '; @@ -145,22 +144,22 @@ protected function generate_dimensions( $attributes ) { $html .= '' . parent::get_switch( array( - 'name' => "rtmedia-options[{$key}_crop]", + 'name' => "rtmedia-options[{$attributes['key']}_crop]", 'rtForm_options' => array( array( '' => 1, // label would be blank. - 'checked' => $crop, + 'checked' => $attributes['crop'], ), ), - 'value' => ( isset( $options[ "rtmedia-options[{$key}_crop]" ] ) ) ? $options[ "rtmedia-options[{$key}_crop]" ] : '0', - 'show_desc' => $show_desc, + 'value' => ( isset( $options[ "rtmedia-options[{$attributes['key']}_crop]" ] ) ) ? $options[ "rtmedia-options[{$attributes['key']}_crop]" ] : '0', + 'show_desc' => $attributes['show_desc'], ) ) . ' | '; } - if ( $desc && $show_desc ) { - $html .= '' . esc_html( $desc ) . ''; + if ( $attributes['desc'] && $attributes['show_desc'] ) { + $html .= '' . esc_html( $attributes['desc'] ) . ''; } if ( isset( $attributes['label'] ) ) { @@ -189,7 +188,7 @@ public function get_dimensions( $attributes = '' ) { * @param string $args Arguments. */ public function display_dimensions( $args = '' ) { - echo $this->get_dimensions( $args ); + echo $this->get_dimensions( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } diff --git a/app/helper/rtForm.php b/app/helper/rtForm.php index 5e750613a..82492e00c 100755 --- a/app/helper/rtForm.php +++ b/app/helper/rtForm.php @@ -1,4 +1,4 @@ -processAttributes( $element, $attrib, true ); + $data .= $this->process_attributes( $element, $attrib, true ); // span elements for checkbox on/off switch. if ( 'rtCheckbox' === $element ) { @@ -585,7 +584,7 @@ protected function generate_textbox( $attributes ) { $html = 'processAttributes( $element, $attributes ); + $html .= $this->process_attributes( $element, $attributes ); /* ending the tag */ $html .= ' />'; @@ -634,7 +633,7 @@ protected function generate_inputfile( $attributes ) { $html .= 'processAttributes( $element, $attributes ); + $html .= $this->process_attributes( $element, $attributes ); /* Ending the tag */ $html .= ' />'; @@ -698,7 +697,7 @@ public function get_textbox( $attributes = '' ) { * @param string|array $args Arguments. */ public function display_textbox( $args = '' ) { - echo $this->get_textbox( $args ); + echo $this->get_textbox( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** @@ -721,7 +720,7 @@ protected function generate_link( $attributes ) { $html = 'processAttributes( $element, $attributes ); + $html .= $this->process_attributes( $element, $attributes ); // Put text of link. $html .= esc_html( ( isset( $attributes['text'] ) ) ? $attributes['text'] : '' ); @@ -769,7 +768,7 @@ public function get_link( $attributes = '' ) { * @param string|array $args Arguments. */ public function display_link( $args = '' ) { - echo $this->get_link( $args ); + echo $this->get_link( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** @@ -818,7 +817,7 @@ protected function generate_number( $attributes ) { $html = 'processAttributes( $element, $attributes ); + $html .= $this->process_attributes( $element, $attributes ); if ( isset( $attributes['min'] ) ) { $html .= " min='" . esc_attr( $attributes['min'] ) . "' "; } @@ -870,7 +869,7 @@ public function get_number( $attributes = '' ) { * @param string|array $args Arguments. */ public function display_number( $args = '' ) { - echo $this->get_number( $args ); + echo $this->get_number( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** @@ -889,7 +888,7 @@ protected function generate_date( $attributes ) { if ( is_array( $attributes ) ) { $html = 'processAttributes( $element, $attributes ); + $html .= $this->process_attributes( $element, $attributes ); $html .= ' />'; @@ -943,7 +942,7 @@ protected function generate_hidden( $attributes ) { $html = 'processAttributes( $element, $attributes ); + $html .= $this->process_attributes( $element, $attributes ); /* ending the tag */ $html .= ' />'; @@ -996,7 +995,7 @@ protected function generate_textarea( $attributes ) { if ( is_array( $attributes ) ) { $html = '