Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sp-api/sp-api-class-spcdatetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function nice_date($postdate) {
} else {
$format = SP()->primitives->front_text('%d %s ago');
$nicedate = sprintf($format, $difference, $periods[$j]);
$nicedate = apply_filters('sph_nicedate', $nicedate, $difference, $periods[$j], $tense);
$nicedate = apply_filters('sph_nicedate', $nicedate, $difference, $periods[$j], $format);
}

return $nicedate;
Expand Down
13 changes: 11 additions & 2 deletions sp-api/sp-api-class-spcdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,17 @@ public function truncate($table) {
*/
public function connectionExists() {
global $wpdb;
$connection = (is_object($wpdb)) ? $wpdb->check_connection(false) : false;
return $connection;
if(empty($wpdb->dbh)) return false;
if ($wpdb->dbh instanceof mysqli) return mysqli_ping($wpdb->dbh);
if ($wpdb->dbh instanceof PDO) {
try {
$wpdb->dbh->query('SELECT 1');
return true;
} catch (PDOException $e) {
return false;
}
}
return true;
}

#
Expand Down