Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/herald/core
File: modules.php
[1000] Fix | Delete
global $herald_unique_module_posts;
[1001] Fix | Delete
[1002] Fix | Delete
$module = wp_parse_args( $module, herald_get_module_defaults( $module['type'] ) );
[1003] Fix | Delete
[1004] Fix | Delete
$args['ignore_sticky_posts'] = 1;
[1005] Fix | Delete
[1006] Fix | Delete
if ( !empty( $module['manual'] ) ) {
[1007] Fix | Delete
$args['posts_per_page'] = absint( count( $module['manual'] ) );
[1008] Fix | Delete
$args['orderby'] = 'post__in';
[1009] Fix | Delete
$args['post__in'] = $module['manual'];
[1010] Fix | Delete
$args['post_type'] = array_keys( get_post_types( array( 'public' => true ) ) ); //support all existing public post types
[1011] Fix | Delete
[1012] Fix | Delete
} else {
[1013] Fix | Delete
[1014] Fix | Delete
$args['post_type'] = $module['type'];
[1015] Fix | Delete
$args['posts_per_page'] = absint( $module['limit'] );
[1016] Fix | Delete
[1017] Fix | Delete
$args['orderby'] = $module['order'];
[1018] Fix | Delete
[1019] Fix | Delete
if ( $args['orderby'] == 'views' && function_exists( 'ev_get_meta_key' ) ) {
[1020] Fix | Delete
[1021] Fix | Delete
$args['orderby'] = 'meta_value_num';
[1022] Fix | Delete
$args['meta_key'] = ev_get_meta_key();
[1023] Fix | Delete
[1024] Fix | Delete
} else if ( strpos( $args['orderby'], 'reviews' ) !== false && herald_is_wp_review_active() ) {
[1025] Fix | Delete
[1026] Fix | Delete
if ( strpos( $args['orderby'], 'user' ) !== false ) {
[1027] Fix | Delete
[1028] Fix | Delete
$review_type = substr( $args['orderby'], 13, strlen( $args['orderby'] ) );
[1029] Fix | Delete
[1030] Fix | Delete
$args['orderby'] = 'meta_value_num';
[1031] Fix | Delete
$args['meta_key'] = 'wp_review_user_reviews';
[1032] Fix | Delete
[1033] Fix | Delete
$args['meta_query'] = array(
[1034] Fix | Delete
array(
[1035] Fix | Delete
'key' => 'wp_review_user_review_type',
[1036] Fix | Delete
'value' => $review_type,
[1037] Fix | Delete
)
[1038] Fix | Delete
);
[1039] Fix | Delete
[1040] Fix | Delete
} else {
[1041] Fix | Delete
[1042] Fix | Delete
$review_type = substr( $args['orderby'], 8, strlen( $args['orderby'] ) );
[1043] Fix | Delete
[1044] Fix | Delete
$args['orderby'] = 'meta_value_num';
[1045] Fix | Delete
$args['meta_key'] = 'wp_review_total';
[1046] Fix | Delete
[1047] Fix | Delete
$args['meta_query'] = array(
[1048] Fix | Delete
array(
[1049] Fix | Delete
'key' => 'wp_review_type',
[1050] Fix | Delete
'value' => $review_type,
[1051] Fix | Delete
)
[1052] Fix | Delete
);
[1053] Fix | Delete
}
[1054] Fix | Delete
[1055] Fix | Delete
}
[1056] Fix | Delete
[1057] Fix | Delete
$args['order'] = $module['sort'];
[1058] Fix | Delete
[1059] Fix | Delete
if ( $time_diff = $module['time'] ) {
[1060] Fix | Delete
$args['date_query'] = array( 'after' => date( 'Y-m-d', herald_calculate_time_diff( $time_diff ) ) );
[1061] Fix | Delete
}
[1062] Fix | Delete
[1063] Fix | Delete
if ( !empty( $herald_unique_module_posts ) ) {
[1064] Fix | Delete
$args['post__not_in'] = $herald_unique_module_posts;
[1065] Fix | Delete
}
[1066] Fix | Delete
[1067] Fix | Delete
if ( !empty( $module['exclude_by_id'] ) ) {
[1068] Fix | Delete
[1069] Fix | Delete
if ( !empty( $args['post__not_in'] ) ) {
[1070] Fix | Delete
$args['post__not_in'] = array_unique( array_merge( $args['post__not_in'], $module['exclude_by_id'] ) ) ;
[1071] Fix | Delete
} else {
[1072] Fix | Delete
$args['post__not_in'] = $module['exclude_by_id'];
[1073] Fix | Delete
}
[1074] Fix | Delete
}
[1075] Fix | Delete
[1076] Fix | Delete
if ( !empty( $module['tax'] ) ) {
[1077] Fix | Delete
$taxonomies = array();
[1078] Fix | Delete
foreach ( $module['tax'] as $k => $v ) {
[1079] Fix | Delete
$temp = array();
[1080] Fix | Delete
$temp['fields'] = 'id';
[1081] Fix | Delete
$temp['taxonomy'] = $k;
[1082] Fix | Delete
$temp['terms'] = $v;
[1083] Fix | Delete
$temp['operator'] = $module["{$k}_inc_exc"] == 'not_in' ? 'NOT IN' : 'IN';
[1084] Fix | Delete
$taxonomies[] = $temp;
[1085] Fix | Delete
}
[1086] Fix | Delete
[1087] Fix | Delete
$args['tax_query'] = $taxonomies;
[1088] Fix | Delete
}
[1089] Fix | Delete
}
[1090] Fix | Delete
[1091] Fix | Delete
if ( $paged ) {
[1092] Fix | Delete
$args['paged'] = $paged;
[1093] Fix | Delete
}
[1094] Fix | Delete
[1095] Fix | Delete
$args = apply_filters('herald_modify_cpt_module_query_args', $args ); //Allow child themes or plugins to modify
[1096] Fix | Delete
[1097] Fix | Delete
$query = new WP_Query( $args );
[1098] Fix | Delete
[1099] Fix | Delete
if ( $module['unique'] && !is_wp_error( $query ) && !empty( $query ) ) {
[1100] Fix | Delete
[1101] Fix | Delete
foreach ( $query->posts as $p ) {
[1102] Fix | Delete
$herald_unique_module_posts[] = $p->ID;
[1103] Fix | Delete
}
[1104] Fix | Delete
}
[1105] Fix | Delete
[1106] Fix | Delete
return $query;
[1107] Fix | Delete
[1108] Fix | Delete
}
[1109] Fix | Delete
endif;
[1110] Fix | Delete
[1111] Fix | Delete
/**
[1112] Fix | Delete
* Get layout columns
[1113] Fix | Delete
*
[1114] Fix | Delete
* @param string $layout Layout ID
[1115] Fix | Delete
* @return int Bootsrap col-lg ID
[1116] Fix | Delete
* @since 1.0
[1117] Fix | Delete
*/
[1118] Fix | Delete
[1119] Fix | Delete
if ( !function_exists( 'herald_layout_columns' ) ):
[1120] Fix | Delete
function herald_layout_columns( $layout ) {
[1121] Fix | Delete
[1122] Fix | Delete
$layouts = array(
[1123] Fix | Delete
'a' => 12,
[1124] Fix | Delete
'a1' => 12,
[1125] Fix | Delete
'a2' => 12,
[1126] Fix | Delete
'a3' => 12,
[1127] Fix | Delete
'col1' => 12,
[1128] Fix | Delete
'b' => 12,
[1129] Fix | Delete
'b1' => 12,
[1130] Fix | Delete
'col2' => 6,
[1131] Fix | Delete
'c' => 6,
[1132] Fix | Delete
'c1' => 6,
[1133] Fix | Delete
'd' => 6,
[1134] Fix | Delete
'd1' => 6,
[1135] Fix | Delete
'e' => 6,
[1136] Fix | Delete
'f' => 4,
[1137] Fix | Delete
'f1' => 4,
[1138] Fix | Delete
'g' => 4,
[1139] Fix | Delete
'g1' => 4,
[1140] Fix | Delete
'col3' => 4,
[1141] Fix | Delete
'h' => 4,
[1142] Fix | Delete
'i' => 3,
[1143] Fix | Delete
'i1' => 3,
[1144] Fix | Delete
'j' => 3,
[1145] Fix | Delete
'k' => 2,
[1146] Fix | Delete
'l' => 2
[1147] Fix | Delete
);
[1148] Fix | Delete
[1149] Fix | Delete
$layouts = apply_filters('herald_modify_layout_columns', $layouts ); //Allow child themes or plugins to modify
[1150] Fix | Delete
return $layouts[$layout];
[1151] Fix | Delete
[1152] Fix | Delete
}
[1153] Fix | Delete
endif;
[1154] Fix | Delete
[1155] Fix | Delete
[1156] Fix | Delete
/**
[1157] Fix | Delete
* Check if we need to apply eq height class to specific posts module
[1158] Fix | Delete
*
[1159] Fix | Delete
* @param array $module
[1160] Fix | Delete
* @return bool
[1161] Fix | Delete
* @since 1.3
[1162] Fix | Delete
*/
[1163] Fix | Delete
[1164] Fix | Delete
if ( !function_exists( 'herald_module_is_eq_height' ) ):
[1165] Fix | Delete
function herald_module_is_eq_height( $module ) {
[1166] Fix | Delete
[1167] Fix | Delete
if ( !herald_module_is_combined( $module ) ) {
[1168] Fix | Delete
return true;
[1169] Fix | Delete
}
[1170] Fix | Delete
[1171] Fix | Delete
if ( ( herald_layout_columns( $module['starter_layout'] ) * $module['starter_limit'] ) % $module['columns'] ) {
[1172] Fix | Delete
return false;
[1173] Fix | Delete
}
[1174] Fix | Delete
[1175] Fix | Delete
return true;
[1176] Fix | Delete
[1177] Fix | Delete
}
[1178] Fix | Delete
endif;
[1179] Fix | Delete
[1180] Fix | Delete
[1181] Fix | Delete
/**
[1182] Fix | Delete
* Get module css classes
[1183] Fix | Delete
*
[1184] Fix | Delete
* @param array $module
[1185] Fix | Delete
* @return string
[1186] Fix | Delete
* @since 1.5.2
[1187] Fix | Delete
*/
[1188] Fix | Delete
[1189] Fix | Delete
if ( !function_exists( 'herald_get_module_class' ) ):
[1190] Fix | Delete
function herald_get_module_class( $module ) {
[1191] Fix | Delete
[1192] Fix | Delete
$class = '';
[1193] Fix | Delete
[1194] Fix | Delete
if ( $module['type'] == 'featured' ) {
[1195] Fix | Delete
$class = 'col-lg-12 col-md-12 col-sm-12';
[1196] Fix | Delete
} else {
[1197] Fix | Delete
$class = 'col-lg-' . $module['columns'] . ' col-md-' . $module['columns'] .' col-sm-' . $module['columns'];
[1198] Fix | Delete
}
[1199] Fix | Delete
[1200] Fix | Delete
if ( !empty( $module['css_class'] ) ) {
[1201] Fix | Delete
$class .= ' ' . $module['css_class'];
[1202] Fix | Delete
}
[1203] Fix | Delete
[1204] Fix | Delete
return $class;
[1205] Fix | Delete
[1206] Fix | Delete
}
[1207] Fix | Delete
endif;
[1208] Fix | Delete
[1209] Fix | Delete
/**
[1210] Fix | Delete
* Get posts from manually selected field in modules
[1211] Fix | Delete
*
[1212] Fix | Delete
* @since 1.9
[1213] Fix | Delete
*
[1214] Fix | Delete
* @param srting $post_ids - Selected posts ids from choose manually meta field
[1215] Fix | Delete
* @return array - List of selected posts or empty list
[1216] Fix | Delete
*/
[1217] Fix | Delete
if ( !function_exists( 'herald_get_manually_selected_posts' ) ):
[1218] Fix | Delete
function herald_get_manually_selected_posts( $post_ids, $module_type = 'posts' ) {
[1219] Fix | Delete
[1220] Fix | Delete
if ( empty($post_ids) ) {
[1221] Fix | Delete
return array();
[1222] Fix | Delete
}
[1223] Fix | Delete
[1224] Fix | Delete
$post_type = in_array($module_type, array('posts', 'featured')) ? array_keys( get_post_types( array( 'public' => true ) ) ) : $module_type;
[1225] Fix | Delete
[1226] Fix | Delete
$get_selected_posts = get_posts(
[1227] Fix | Delete
array(
[1228] Fix | Delete
'post__in' => $post_ids,
[1229] Fix | Delete
'orderby' => 'post__in',
[1230] Fix | Delete
'post_type' => $post_type,
[1231] Fix | Delete
'posts_per_page' => '-1'
[1232] Fix | Delete
)
[1233] Fix | Delete
);
[1234] Fix | Delete
[1235] Fix | Delete
return wp_list_pluck( $get_selected_posts, 'post_title', 'ID' );
[1236] Fix | Delete
}
[1237] Fix | Delete
endif;
[1238] Fix | Delete
[1239] Fix | Delete
[1240] Fix | Delete
/**
[1241] Fix | Delete
* Display manualy selected posts
[1242] Fix | Delete
*
[1243] Fix | Delete
* @since 1.9
[1244] Fix | Delete
*
[1245] Fix | Delete
* @param array $posts - Array of manualy selected posts
[1246] Fix | Delete
* @return HTML - Title of manualy selected post
[1247] Fix | Delete
*/
[1248] Fix | Delete
if ( !function_exists( 'herald_display_manually_selected_posts' ) ):
[1249] Fix | Delete
function herald_display_manually_selected_posts($posts) {
[1250] Fix | Delete
[1251] Fix | Delete
if ( empty($posts) ) {
[1252] Fix | Delete
return;
[1253] Fix | Delete
}
[1254] Fix | Delete
[1255] Fix | Delete
$output = '';
[1256] Fix | Delete
foreach ( $posts as $id => $title ){
[1257] Fix | Delete
$output .= '<span><button type="button" class="ntdelbutton" data-id="'. esc_attr($id) .'"><span class="remove-tag-icon"></span></button><span class="herald-searched-title">'. esc_html( $title ). '</span></span>';
[1258] Fix | Delete
}
[1259] Fix | Delete
[1260] Fix | Delete
echo wp_kses_post( $output );
[1261] Fix | Delete
}
[1262] Fix | Delete
endif;
[1263] Fix | Delete
[1264] Fix | Delete
/**
[1265] Fix | Delete
* Used for getting post types with all taxonomies
[1266] Fix | Delete
*
[1267] Fix | Delete
* @return array
[1268] Fix | Delete
* @since 2.0.1
[1269] Fix | Delete
*/
[1270] Fix | Delete
if (!function_exists('herald_get_posts_types_with_taxonomies')):
[1271] Fix | Delete
function herald_get_posts_types_with_taxonomies( $exclude = array() ) {
[1272] Fix | Delete
[1273] Fix | Delete
$post_types_with_taxonomies = array();
[1274] Fix | Delete
[1275] Fix | Delete
$post_types = herald_get_custom_post_types( true, array( 'topic', 'forum', 'guest-author', 'reply' ) );
[1276] Fix | Delete
$post_types[] = get_post_type_object('post');
[1277] Fix | Delete
[1278] Fix | Delete
if (empty($post_types))
[1279] Fix | Delete
return null;
[1280] Fix | Delete
[1281] Fix | Delete
foreach ($post_types as $post_type) {
[1282] Fix | Delete
if(in_array($post_type->name, $exclude)){
[1283] Fix | Delete
continue;
[1284] Fix | Delete
}
[1285] Fix | Delete
[1286] Fix | Delete
$post_taxonomies = herald_get_taxonomies($post_type->name);
[1287] Fix | Delete
[1288] Fix | Delete
$post_type->taxonomies = $post_taxonomies;
[1289] Fix | Delete
$post_types_with_taxonomies[] = $post_type;
[1290] Fix | Delete
}
[1291] Fix | Delete
[1292] Fix | Delete
return apply_filters('herald_modify_posts_types_with_taxonomies', $post_types_with_taxonomies);
[1293] Fix | Delete
}
[1294] Fix | Delete
endif;
[1295] Fix | Delete
[1296] Fix | Delete
[1297] Fix | Delete
/**
[1298] Fix | Delete
* Now when taxonomies are dynamical in cover area depending on post type we have to overwrite old settings.
[1299] Fix | Delete
* For Category to cat and for post_tag to tag
[1300] Fix | Delete
*
[1301] Fix | Delete
* @string $taxonomy_id
[1302] Fix | Delete
* @since 1.7
[1303] Fix | Delete
* @return $taxonomy_id
[1304] Fix | Delete
*/
[1305] Fix | Delete
if(!function_exists('herald_patch_category_and_tags')):
[1306] Fix | Delete
function herald_patch_taxonomy_id($taxonomy_id){
[1307] Fix | Delete
[1308] Fix | Delete
if ( in_array( $taxonomy_id, array( 'category', 'post_tag' ) ) ) {
[1309] Fix | Delete
if ( $taxonomy_id === 'category' ) {
[1310] Fix | Delete
$taxonomy_id = 'cat';
[1311] Fix | Delete
}
[1312] Fix | Delete
if ( $taxonomy_id === 'post_tag' ) {
[1313] Fix | Delete
$taxonomy_id = 'tag';
[1314] Fix | Delete
}
[1315] Fix | Delete
}
[1316] Fix | Delete
[1317] Fix | Delete
return $taxonomy_id;
[1318] Fix | Delete
}
[1319] Fix | Delete
endif;
[1320] Fix | Delete
?>
[1321] Fix | Delete
[1322] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function