浏览代码

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

gine 7 年之前
父节点
当前提交
ddc918a4bc
共有 1 个文件被更改,包括 15 次插入3 次删除
  1. 15 3
      lib/command/export-events.php

+ 15 - 3
lib/command/export-events.php

@@ -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;
 	}
 
-}
+}