/home/desid573/verdenaturopathy.com.au/site3/wp-content/plugins/meta-box/inc/about
Edit: /home/desid573/verdenaturopathy.com.au/site3/wp-content/plugins/meta-box/inc/about/dashboard.php (3174B)
feed_url = $feed_url;
$this->link = $link;
$this->translations = $translations;
$this->slug = sanitize_title( $translations['title'] );
$transient_name = $this->get_transient_name();
add_filter( "transient_$transient_name", array( $this, 'add_news' ) );
add_action( "wp_ajax_{$this->slug}-dismiss-news", array( $this, 'ajax_dismiss' ) );
}
private function get_transient_name() {
include ABSPATH . WPINC . '/version.php';
global $wp_version;
$locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
$prefix = version_compare( $wp_version, '4.8', '>=') ? 'dash_v2_' : 'dash_';
$widget_id = 'dashboard_primary';
return version_compare( $wp_version, '4.3', '>=' ) ? $prefix . md5( "{$widget_id}_{$locale}" ) : 'dash_' . md5( $widget_id );
}
public function add_news( $value ) {
$is_dismissed = get_user_meta( get_current_user_id(), $this->slug . '_dismiss_news', true );
if ( $is_dismissed ) {
return $value;
}
ob_start();
$this->output_script();
$script = ob_get_clean();
return $value . $this->get_html() . $script;
}
private function get_html() {
$cache_key = $this->slug . '-news';
$output = get_transient( $cache_key );
if ( false !== $output) {
return $output;
}
$feeds = array(
$this->slug => array(
'link' => $this->link,
'url' => $this->feed_url,
'title' => $this->translations['title'],
'items' => 3,
'show_summary' => 0,
'show_author' => 0,
'show_date' => 0,
)
);
ob_start();
wp_dashboard_primary_output( 'dashboard_primary', $feeds );
$output = ob_get_clean();
$output = preg_replace( '/
(.+?)<\/a>/i', '' . esc_html( $this->translations['title'] ) . ': $2', $output );
$output = str_replace( '
', '', $output );
set_transient( $cache_key, $output, DAY_IN_SECONDS );
return $output;
}
private function output_script() {
?>
slug . '_dismiss_news', 1 );
wp_send_json_success();
}
}