opzione window per ridurre la finestra da 6 anni a 60 giorni

This commit is contained in:
gine 2017-03-16 18:02:02 +01:00
parent a844cd0360
commit ddc918a4bc

View file

@ -61,6 +61,10 @@ class Ai1ec_Command_Export_Events extends Ai1ec_Command {
'xml',
false
);
$params['window'] = (bool)Ai1ec_Request_Parser::get_param(
'window',
false
);
$this->_params = $params;
return true;
}
@ -90,6 +94,7 @@ class Ai1ec_Command_Export_Events extends Ai1ec_Command {
$ai1ec_cat_ids = $this->_params['cat_ids'];
$ai1ec_tag_ids = $this->_params['tag_ids'];
$ai1ec_post_ids = $this->_params['post_ids'];
$window = $this->_params['window'];
if ( ! empty( $this->_params['lang'] ) ) {
$loc_helper = $this->_registry->get( 'p28n.wpml' );
$loc_helper->set_language( $this->_params['lang'] );
@ -115,9 +120,16 @@ class Ai1ec_Command_Export_Events extends Ai1ec_Command {
$ai1ec_post_ids
);
}
$my_start = '-3 years';
$my_end = '+3 years';
if ( $window ) {
$my_start = '-30 days';
$my_end = '+30 days';
}
$filter = apply_filters( 'ai1ec_export_filter', $filter );
$start = $this->_registry->get( 'date.time', '-3 years' );
$end = $this->_registry->get( 'date.time', '+3 years' );
$start = $this->_registry->get( 'date.time', $my_start );
$end = $this->_registry->get( 'date.time', $my_end );
$search = $this->_registry->get( 'model.search' );
$params = array(
'no_html' => $this->_params['no_html'],
@ -156,4 +168,4 @@ class Ai1ec_Command_Export_Events extends Ai1ec_Command {
return $output;
}
}
}