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
/home/sportsfe.../public_h.../wp-conte.../plugins/network-.../views/post
File: header.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Created by PhpStorm.
[2] Fix | Delete
* User: Admin
[3] Fix | Delete
* Date: 04.04.2017
[4] Fix | Delete
* Time: 8:10
[5] Fix | Delete
*/
[6] Fix | Delete
use NetworkPosts\Components\NetsPostsHtmlHelper;
[7] Fix | Delete
if ( ! defined( 'POST_VIEWS_PATH' ) ) {
[8] Fix | Delete
die();
[9] Fix | Delete
}
[10] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_title' ) ){
[11] Fix | Delete
include 'title.php';
[12] Fix | Delete
}
[13] Fix | Delete
$date_post = '';
[14] Fix | Delete
if ( array_key_exists( 'post_date', $the_post ) ) {
[15] Fix | Delete
$date = new DateTime( trim( $the_post['post_date'] ) );
[16] Fix | Delete
$date_post = date_i18n( $format, $date->getTimestamp() );
[17] Fix | Delete
}
[18] Fix | Delete
$meta_width = $shortcode_mgr->get( 'meta_width' );
[19] Fix | Delete
if ( $meta_width == "100%" ) {
[20] Fix | Delete
$width = 'width: 100%;';
[21] Fix | Delete
} else {
[22] Fix | Delete
$width = "width: " . $meta_width . "px;";
[23] Fix | Delete
}
[24] Fix | Delete
if ( ! $shortcode_mgr->get_boolean( 'hide_source' ) ) {
[25] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'wrap_source' ) ) {
[26] Fix | Delete
$html .= '<div class="netsposts-source" style="margin-bottom: 5px;' . $width . '">';
[27] Fix | Delete
}
[28] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'meta_info' ) ) {
[29] Fix | Delete
if ( ! $shortcode_mgr->get_boolean( 'hide_post_date_meta_info' ) ) {
[30] Fix | Delete
if ( $shortcode_mgr->has_value( 'wrap_post_date_start' ) ) {
[31] Fix | Delete
$html .= $shortcode_mgr->get( 'wrap_post_date_start' );
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$html .= '<span>' . __( 'Published', 'netsposts' ) . '</span><span>' . ' ' . $date_post . '' . '</span>' . ' ' . '<span>' . __( 'in', 'netsposts' ) . '</span> ';
[35] Fix | Delete
[36] Fix | Delete
if ( $shortcode_mgr->has_value( 'wrap_post_date_end' ) ) {
[37] Fix | Delete
$html .= $shortcode_mgr->get( 'wrap_post_date_end' );
[38] Fix | Delete
}
[39] Fix | Delete
}
[40] Fix | Delete
$html .= '<span>' . NetsPostsHtmlHelper::create_link( $blog_url, $blog_name, $open_link_in_new_tab, 'netsposts-source-link' ) . '</span><br/>';
[41] Fix | Delete
}
[42] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'show_order' ) ) {
[43] Fix | Delete
if ( isset( $tab_order_by1 ) && count( $tab_order_by1 ) > 0 && isset( $the_post[ $tab_order_by1[0] ] ) ) {
[44] Fix | Delete
$fieldname = $tab_order_by1[0];
[45] Fix | Delete
$fullname = netsposts_create_label_from_id( $fieldname );
[46] Fix | Delete
$html .= "<span>" . $fullname . ": " . $the_post[ $tab_order_by1[0] ] . "</span><br/>";
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
$show_date = false;
[50] Fix | Delete
$date_column = '';
[51] Fix | Delete
if( $shortcode_mgr->has_value( 'order_post_by_acf_date' ) ){
[52] Fix | Delete
$show_date = true;
[53] Fix | Delete
$data = $shortcode_mgr->split_array( 'order_post_by_acf_date', ' ' );
[54] Fix | Delete
$date_column = $data[0];
[55] Fix | Delete
}
[56] Fix | Delete
if( $shortcode_mgr->has_value( 'exclude_all_past_events' ) ){
[57] Fix | Delete
$show_date = true;
[58] Fix | Delete
$date_column = $shortcode_mgr->get( 'exclude_all_past_events' );
[59] Fix | Delete
}
[60] Fix | Delete
if( $shortcode_mgr->has_value( 'show_past_events' ) ){
[61] Fix | Delete
$show_date = true;
[62] Fix | Delete
$date_column = $shortcode_mgr->get( 'show_past_events' );
[63] Fix | Delete
}
[64] Fix | Delete
if ( $shortcode_mgr->has_value( 'show_before_date' ) ) {
[65] Fix | Delete
$show_date = true;
[66] Fix | Delete
$data = $shortcode_mgr->split_array( 'show_before_date', '::' );
[67] Fix | Delete
$date_column = $data[0];
[68] Fix | Delete
}
[69] Fix | Delete
if ( $shortcode_mgr->has_value( 'show_after_date' ) ) {
[70] Fix | Delete
$show_date = true;
[71] Fix | Delete
$data = $shortcode_mgr->split_array( 'show_after_date', '::' );
[72] Fix | Delete
$date_column = $data[0];
[73] Fix | Delete
}
[74] Fix | Delete
if ( $shortcode_mgr->has_value( 'show_for_today' ) ) {
[75] Fix | Delete
$show_date = true;
[76] Fix | Delete
$date_column = $shortcode_mgr->get( 'show_for_today' );
[77] Fix | Delete
}
[78] Fix | Delete
if ( $show_date && isset( $the_post[ $date_column ] ) ) {
[79] Fix | Delete
$date_meta = $the_post[ $date_column ];
[80] Fix | Delete
if ( is_numeric( $date_meta ) ) {
[81] Fix | Delete
$date = date( $format, $date_meta );
[82] Fix | Delete
} else {
[83] Fix | Delete
$date = new DateTime( $the_post[ $date_column ] );
[84] Fix | Delete
$date = date_i18n( $format, $date->getTimestamp() );
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
if( $shortcode_mgr->get_boolean( 'add_link_to_date' ) ){
[88] Fix | Delete
$date = NetsPostsHtmlHelper::create_link( $the_post['guid'], $date );
[89] Fix | Delete
}
[90] Fix | Delete
$html .= NetsPostsHtmlHelper::create_span( $date ) . '<br/>';
[91] Fix | Delete
}
[92] Fix | Delete
## Full metadata
[93] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'show_author' ) ) {
[94] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'show_author_avatar' ) ) {
[95] Fix | Delete
$author_display_name = get_avatar( $the_post['post_author'], $shortcode_mgr->get_int( 'author_avatar_size' ) );
[96] Fix | Delete
$author_display_name .= get_the_author_meta( 'display_name', $the_post['post_author'] );
[97] Fix | Delete
} else {
[98] Fix | Delete
$author_display_name = get_the_author_meta( 'display_name', $the_post['post_author'] );
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
$author_url = get_author_posts_url( $the_post['post_author'] );
[102] Fix | Delete
$html .= NetsPostsHtmlHelper::create_author_link( $author_url, $author_display_name, $open_link_in_new_tab );
[103] Fix | Delete
}
[104] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'wrap_source' ) ) {
[105] Fix | Delete
$html .= '</div>'; //end of netsposts-source
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_categories' ) ) {
[109] Fix | Delete
if ( isset( $the_post['categories'] ) &&
[110] Fix | Delete
! empty( $the_post['categories'] ) ) {
[111] Fix | Delete
$html .= '<div class="netsposts-categories" style="margin-bottom: 5px; ' . $width . '">';
[112] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_category_icon' ) ){
[113] Fix | Delete
$html .= '<span class="icon ic-category"></span>';
[114] Fix | Delete
}
[115] Fix | Delete
foreach ( $the_post['categories'] as $category ) {
[116] Fix | Delete
$category_name = $category->name;
[117] Fix | Delete
if( $the_post['post_type'] === 'product' ) {
[118] Fix | Delete
$link = NetsPostsHtmlHelper::create_term_link( $category->term_id, $category_name, $open_link_in_new_tab );
[119] Fix | Delete
} else {
[120] Fix | Delete
$link = NetsPostsHtmlHelper::create_term_link( $category->term_id, $category_name, $open_link_in_new_tab );
[121] Fix | Delete
}
[122] Fix | Delete
$html .= $link;
[123] Fix | Delete
}
[124] Fix | Delete
$html .= '</div>';
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
if( $shortcode_mgr->has_value( 'show_custom_taxonomies' ) ){
[128] Fix | Delete
if( isset( $the_post['custom_taxonomies'] ) &&
[129] Fix | Delete
! empty( $the_post['custom_taxonomies'] ) ){
[130] Fix | Delete
$custom_categories = $the_post['custom_taxonomies'];
[131] Fix | Delete
$html .= '<div class="netsposts-custom-taxonomies" style="margin-bottom: 5px; ' . $width . '">';
[132] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_custom_taxonomy_icon' ) ){
[133] Fix | Delete
$html .= '<span class="icon ic-custom-taxonomy"></span>';
[134] Fix | Delete
}
[135] Fix | Delete
foreach ( $custom_categories as $category ){
[136] Fix | Delete
$category_name = $category->name;
[137] Fix | Delete
$link = NetsPostsHtmlHelper::create_link( $category->url, $category_name, $open_link_in_new_tab );
[138] Fix | Delete
$html .= $link;
[139] Fix | Delete
}
[140] Fix | Delete
$html .= '</div>';
[141] Fix | Delete
}
[142] Fix | Delete
}
[143] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_tags' ) ) {
[144] Fix | Delete
if ( isset( $the_post['terms'] ) &&
[145] Fix | Delete
! empty( $the_post['terms'] ) ) {
[146] Fix | Delete
$html .= '<div class="netsposts-terms" style="margin-bottom: 5px; ' . $width . '">';
[147] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_tag_icon' ) ){
[148] Fix | Delete
$html .= '<span class="icon ic-tag"></span>';
[149] Fix | Delete
}
[150] Fix | Delete
foreach ( $the_post['terms'] as $term ) {
[151] Fix | Delete
if( $the_post['post_type'] === 'product' ){
[152] Fix | Delete
$link = NetsPostsHtmlHelper::create_term_link( $term->term_id, $term->name, $open_link_in_new_tab );
[153] Fix | Delete
} else {
[154] Fix | Delete
$link = NetsPostsHtmlHelper::create_term_link( $term->term_id, $term->name, $open_link_in_new_tab );
[155] Fix | Delete
}
[156] Fix | Delete
$html .= $link;
[157] Fix | Delete
}
[158] Fix | Delete
$html .= '</div>';
[159] Fix | Delete
}
[160] Fix | Delete
}
[161] Fix | Delete
if( $shortcode_mgr->has_value( 'include_post_meta' ) ){
[162] Fix | Delete
$meta_keys = $shortcode_mgr->split_array( 'include_post_meta', ',' );
[163] Fix | Delete
// Remove acf fields from meta
[164] Fix | Delete
if( $shortcode_mgr->has_value( 'include_acf_fields' ) ){
[165] Fix | Delete
$acf_fields = $shortcode_mgr->split_array( 'include_acf_fields', ',' );
[166] Fix | Delete
$meta_keys = array_diff( $meta_keys, $acf_fields );
[167] Fix | Delete
}
[168] Fix | Delete
$text = apply_filters( 'netsposts_get_meta_html', $the_post, $meta_keys );
[169] Fix | Delete
$html .= '<div class="netsposts-extra-meta">';
[170] Fix | Delete
if( is_string( $text ) ){
[171] Fix | Delete
$html .= $text;
[172] Fix | Delete
}
[173] Fix | Delete
else{
[174] Fix | Delete
foreach ($meta_keys as $key){
[175] Fix | Delete
if( isset( $the_post[$key] ) ) {
[176] Fix | Delete
$html .= '<span>';
[177] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'show_meta_label' ) ) {
[178] Fix | Delete
$html .= '<span class="post-meta-key">' . $key . '</span>: ';
[179] Fix | Delete
}
[180] Fix | Delete
$html .= '<span class="post-meta-value">' . $the_post[ $key ] . '</span></span>';
[181] Fix | Delete
}
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
$html .= '</div>';
[185] Fix | Delete
}
[186] Fix | Delete
if( $shortcode_mgr->has_value( 'include_acf_fields' ) ) {
[187] Fix | Delete
if ( function_exists( 'get_field_objects' ) ) {
[188] Fix | Delete
$fields = array();
[189] Fix | Delete
$registered_fields = get_field_objects( $the_post['ID'], array( 'format_value' => true, 'load_value' => true ) );
[190] Fix | Delete
if( $registered_fields ){
[191] Fix | Delete
$fields = array_merge( $fields, $registered_fields );
[192] Fix | Delete
}
[193] Fix | Delete
$local_fields = netsposts_get_local_fields( $the_post['ID'] );
[194] Fix | Delete
if( $local_fields ){
[195] Fix | Delete
$fields = array_merge( $fields, $local_fields );
[196] Fix | Delete
}
[197] Fix | Delete
if ( $fields ) {
[198] Fix | Delete
$fields_result = array();
[199] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'include_acf_fields' ) ) {
[200] Fix | Delete
$filter_fields = array_keys( $fields );
[201] Fix | Delete
} else {
[202] Fix | Delete
$filter_fields = $shortcode_mgr->split_array( 'include_acf_fields', ',' );
[203] Fix | Delete
}
[204] Fix | Delete
if( $shortcode_mgr->has_value( 'add_link_to_acf' ) ){
[205] Fix | Delete
$add_link_to_acf = $shortcode_mgr->split_array( 'add_link_to_acf', ',' );
[206] Fix | Delete
}
[207] Fix | Delete
else{
[208] Fix | Delete
$add_link_to_acf = array();
[209] Fix | Delete
}
[210] Fix | Delete
foreach ( $filter_fields as $name ) {
[211] Fix | Delete
if ( isset( $fields[ $name ] ) ) {
[212] Fix | Delete
$field = $fields[ $name ];
[213] Fix | Delete
if( $field['type'] === 'date_picker' &&
[214] Fix | Delete
$shortcode_mgr->has_value( 'acf_date_format' ) ){
[215] Fix | Delete
$date = date_create_from_format( $field['return_format'], $field['value'] );
[216] Fix | Delete
$value = $date->format( $shortcode_mgr->get( 'acf_date_format' ) );
[217] Fix | Delete
}
[218] Fix | Delete
else{
[219] Fix | Delete
$value = $field['value'];
[220] Fix | Delete
}
[221] Fix | Delete
if( in_array( $name, $add_link_to_acf ) ){
[222] Fix | Delete
$value = NetsPostsHtmlHelper::create_link( $the_post['guid'], $value );
[223] Fix | Delete
}
[224] Fix | Delete
$fields_result[ $name ] = array( 'label' => $field['label'], 'value' => $value );
[225] Fix | Delete
}
[226] Fix | Delete
}
[227] Fix | Delete
$text = apply_filters( 'netsposts_get_acf_html', $fields_result, $the_post );
[228] Fix | Delete
$html .= '<div class="netsposts-acf-fields">';
[229] Fix | Delete
if ( is_string( $text ) ) {
[230] Fix | Delete
$html .= $text;
[231] Fix | Delete
} else {
[232] Fix | Delete
foreach ( $fields_result as $name => $field ) {
[233] Fix | Delete
$label = $field['label'];
[234] Fix | Delete
$value = $field['value'];
[235] Fix | Delete
if ( is_string( $value ) ) {
[236] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'hide_acf_labels' ) ) {
[237] Fix | Delete
$html .= '<span class="acf-value">' . $value . '</span>';
[238] Fix | Delete
} else {
[239] Fix | Delete
$html .= '<span><span class="acf-label">' . $label . '</span><span class="acf-label-colon">:</span> <span class="acf-value">' . $value . '</span></span>';
[240] Fix | Delete
}
[241] Fix | Delete
} elseif ( is_array( $value ) ) {
[242] Fix | Delete
$str = '';
[243] Fix | Delete
if ( is_array( $value[0] ) ) {
[244] Fix | Delete
$str = join( ', ', $value );
[245] Fix | Delete
} elseif ( $value[0] instanceof WP_Post ) {
[246] Fix | Delete
$str = '';
[247] Fix | Delete
foreach ( $value as $inner_post ) {
[248] Fix | Delete
$str .= $inner_post->post_title . ', ';
[249] Fix | Delete
}
[250] Fix | Delete
$str = mb_substr( $str, 0, - 2 );
[251] Fix | Delete
}
[252] Fix | Delete
if ( $shortcode_mgr->get_boolean( 'hide_acf_labels' ) ) {
[253] Fix | Delete
$html .= '<span>' . $str . '</span>';
[254] Fix | Delete
} else {
[255] Fix | Delete
$html .= '<span>' . $name . '<span class="acf-label-colon">:</span> ' . $str . '</span>';
[256] Fix | Delete
}
[257] Fix | Delete
}
[258] Fix | Delete
}
[259] Fix | Delete
}
[260] Fix | Delete
$html .= '</div>';
[261] Fix | Delete
}
[262] Fix | Delete
}
[263] Fix | Delete
}
[264] Fix | Delete
if( $shortcode_mgr->get_boolean( 'show_rating' ) ) {
[265] Fix | Delete
if ( ! empty( $the_post['rating'] ) ) {
[266] Fix | Delete
$html .= '<div class="br-wrapper br-theme-fontawesome-stars">';
[267] Fix | Delete
$html .= '<div class="br-widget">';
[268] Fix | Delete
for ( $i = 1; $i <= $the_post['rating']; $i ++ ) {
[269] Fix | Delete
$html .= '<a class="br-selected"></a>';
[270] Fix | Delete
}
[271] Fix | Delete
$html .= '</div>';
[272] Fix | Delete
$html .= '</div>';
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function