Move is_a_date_arg to DateTimeFormat::isYearMonth
- Improved functionality - Added tests
This commit is contained in:
		
					parent
					
						
							
								52c42491c4
							
						
					
				
			
			
				commit
				
					
						ad67fd3aa8
					
				
			
		
					 5 changed files with 107 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -5,6 +5,7 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
use Friendica\App;
 | 
			
		||||
use Friendica\BaseObject;
 | 
			
		||||
use Friendica\Content\Feature;
 | 
			
		||||
use Friendica\Content\ForumManager;
 | 
			
		||||
use Friendica\Content\Nav;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,9 +52,12 @@ function network_init(App $a)
 | 
			
		|||
		$group_id = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/** @var DateTimeFormat $dtFormat */
 | 
			
		||||
	$dtFormat = BaseObject::getClass(DateTimeFormat::class);
 | 
			
		||||
 | 
			
		||||
	if ($a->argc > 1) {
 | 
			
		||||
		for ($x = 1; $x < $a->argc; $x ++) {
 | 
			
		||||
			if (is_a_date_arg($a->argv[$x])) {
 | 
			
		||||
			if ($dtFormat->isYearMonth($a->argv[$x])) {
 | 
			
		||||
				$is_a_date_query = true;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -461,9 +465,12 @@ function networkThreadedView(App $a, $update, $parent)
 | 
			
		|||
 | 
			
		||||
	$default_permissions = [];
 | 
			
		||||
 | 
			
		||||
	/** @var DateTimeFormat $dtFormat */
 | 
			
		||||
	$dtFormat = BaseObject::getClass(DateTimeFormat::class);
 | 
			
		||||
 | 
			
		||||
	if ($a->argc > 1) {
 | 
			
		||||
		for ($x = 1; $x < $a->argc; $x ++) {
 | 
			
		||||
			if (is_a_date_arg($a->argv[$x])) {
 | 
			
		||||
			if ($dtFormat->isYearMonth($a->argv[$x])) {
 | 
			
		||||
				if ($datequery) {
 | 
			
		||||
					$datequery2 = Strings::escapeHtml($a->argv[$x]);
 | 
			
		||||
				} else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue