post_status, array ('draft', 'pending', 'auto-draft', 'future' ) )) { $unixtime = strtotime ( $post->post_date ); $category = ''; if (strpos ( $permalink, '%category%' ) !== false) { $cats = get_the_category ( $post->ID ); if ($cats) { usort ( $cats, '_usort_terms_by_ID' ); // order by ID $category_object = apply_filters ( 'post_link_category', $cats [0], $cats, $post ); $category_object = get_term ( $category_object, 'category' ); $category = $category_object->slug; if ($parent = $category_object->parent) { $category = get_category_parents ( $parent, false, '/', true ) . $category; } } if (empty ( $category )) { $default_category = get_term ( get_option ( 'default_category' ), 'category' ); $category = is_wp_error ( $default_category ) ? '' : $default_category->slug; } } $author = ''; if (strpos ( $permalink, '%author%' ) !== false) { $authordata = get_userdata ( $post->post_author ); $author = $authordata->user_nicename; } $date = explode ( ' ', date ( 'Y m d H i s', $unixtime ) ); $rewritereplace = array ($date [0], $date [1], $date [2], $date [3], $date [4], $date [5], $post->post_name, $post->ID, $category, $author, $post->post_name ); $permalink = home_url ( str_replace ( $rewritecode, $rewritereplace, $permalink ) ); if ($structure != 'custom') { $permalink = user_trailingslashit ( $permalink, 'single' ); } } else { $permalink = home_url ( '?p=' . $post->ID ); } $url = apply_filters ( 'post_link', $permalink, $post, $leavename ); if (is_front_page ()) { $url = get_site_url (); } if (essb_option_value('counter_recover_domain') != '' && essb_option_value('counter_recover_newdomain')) { $url = str_replace ( essb_option_value('counter_recover_newdomain'), essb_option_value('counter_recover_domain'), $url ); } // Filter the Protocol if (essb_option_value('counter_recover_protocol') == 'http2https' && strpos ( $url, 'https' ) !== false) { $url = str_replace ( 'https', 'http', $url ); } else if (essb_option_value('counter_recover_protocol') == 'https2http' && strpos ( $url, 'https' ) === false) { $url = str_replace ( 'http', 'https', $url ); } if (essb_option_value('counter_recover_prefixdomain') == 'unchanged') { } else if (essb_option_value('counter_recover_prefixdomain') == 'www' && strpos ( $url, 'www' ) === false) { $url = str_replace ( 'http://', 'http://www.', $url ); $url = str_replace ( 'https://', 'https://www.', $url ); } else if (essb_option_value('counter_recover_prefixdomain') == 'nonwww' && strpos ( $url, 'www' ) !== false) { $url = str_replace ( 'http://www.', 'http://', $url ); $url = str_replace ( 'https://www.', 'https://', $url ); } // Filter out the subdomain if (essb_option_value('counter_recover_subdomain') != '') { $url = str_replace (essb_option_value('counter_recover_subdomain') . '.', '', $url ); } if (has_filter('essb4_recovery_filter')) { $url = apply_filters ( 'essb4_recovery_filter', $past_url); } $url = apply_filters('essb4_alt_permalink', $url); return $url; } } function essb_recovery_get_alternate_permalink($url, $id) { _deprecated_function( __FUNCTION__, 'ESSB 5.0', 'Please use essb_recovery_get_alt_permalink' ); return essb_recovery_get_alt_permalink($url, $id); } function essb_recovery_consolidate_results($share_values, $additional_values, $networks) { $new_result = array (); $new_result ['total'] = 0; foreach ( $networks as $k ) { $one_share = isset ( $share_values [$k] ) ? $share_values [$k] : 0; $two_share = isset ( $additional_values [$k] ) ? $additional_values [$k] : 0; $new_result [$k] = intval ( $one_share ) + intval ( $two_share ); $new_result ['total'] += intval ( $one_share ) + intval ( $two_share ); } return $new_result; }