updated plugin Connect Matomo version 1.1.5
This commit is contained in:
@ -2,37 +2,42 @@
|
||||
|
||||
namespace WP_Piwik\Widget;
|
||||
|
||||
class Noresult extends \WP_Piwik\Widget {
|
||||
|
||||
public $className = __CLASS__;
|
||||
class Noresult extends \WP_Piwik\Widget {
|
||||
|
||||
protected function configure($prefix = '', $params = array()) {
|
||||
$timeSettings = $this->getTimeSettings();
|
||||
$this->parameter = array(
|
||||
'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
|
||||
'period' => $timeSettings['period'],
|
||||
'date' => $timeSettings['date']
|
||||
);
|
||||
$this->title = $prefix.__('Site Search', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
|
||||
$this->method = 'Actions.getSiteSearchNoResultKeywords';
|
||||
}
|
||||
|
||||
public function show() {
|
||||
$response = self::$wpPiwik->request($this->apiID[$this->method]);
|
||||
if (!empty($response['result']) && $response['result'] ='error')
|
||||
echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
|
||||
else {
|
||||
$tableHead = array(__('Keyword', 'wp-piwik'), __('Requests', 'wp-piwik'), __('Bounced', 'wp-piwik'));
|
||||
$tableBody = array();
|
||||
$count = 0;
|
||||
if (is_array($response))
|
||||
foreach ($response as $row) {
|
||||
$count++;
|
||||
$tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']);
|
||||
if ($count == 10) break;
|
||||
}
|
||||
$this->table($tableHead, $tableBody, null);
|
||||
public $class_name = __CLASS__;
|
||||
|
||||
protected function configure( $prefix = '', $params = array() ) {
|
||||
$time_settings = $this->get_time_settings();
|
||||
$this->parameter = array(
|
||||
'idSite' => self::$wp_piwik->get_piwik_site_id( $this->blog_id ),
|
||||
'period' => $time_settings['period'],
|
||||
'date' => $time_settings['date'],
|
||||
);
|
||||
$this->title = $prefix . __( 'Site Search', 'wp-piwik' ) . ' (' . $time_settings['description'] . ')';
|
||||
$this->method = 'Actions.getSiteSearchNoResultKeywords';
|
||||
}
|
||||
|
||||
public function show() {
|
||||
$response = self::$wp_piwik->request( $this->api_id[ $this->method ] );
|
||||
if (
|
||||
! empty( $response['result'] )
|
||||
&& 'error' === $response['result']
|
||||
) {
|
||||
echo '<strong>' . esc_html__( 'Piwik error', 'wp-piwik' ) . ':</strong> ' . esc_html( $response['message'] );
|
||||
} else {
|
||||
$table_head = array( __( 'Keyword', 'wp-piwik' ), __( 'Requests', 'wp-piwik' ), __( 'Bounced', 'wp-piwik' ) );
|
||||
$table_body = array();
|
||||
$count = 0;
|
||||
if ( is_array( $response ) ) {
|
||||
foreach ( $response as $row ) {
|
||||
++$count;
|
||||
$table_body[] = array( $row['label'], $row['nb_visits'], $row['bounce_rate'] );
|
||||
if ( 10 === $count ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->table( $table_head, $table_body, null );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user