# depicter/trunk/app/src/Rules/Condition/Advanced/URL.php

Depicter — Popup &amp; Slider Builder, version trunk. 61 lines.

- Page: https://pluginprobe.com/plugins/depicter/trunk/code/app/src/Rules/Condition/Advanced/URL.php
- Raw: https://pluginprobe.com/plugins/depicter/trunk/raw/app/src/Rules/Condition/Advanced/URL.php
- Modified: 2024-06-20T07:07:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/depicter/trunk/code/app/src/Rules/Condition/Advanced/URL.php#L10-L20`.

```php
<?php

namespace Depicter\Rules\Condition\Advanced;

use Averta\Core\Utility\Arr;
use Depicter\Rules\Condition\Base as ConditionBase;

class URL extends ConditionBase
{
	/**
	 * @inheritdoc
	 */
	public $slug = 'Advanced_URL';

	/**
	 * @inheritdoc
	 */
	public $control = 'comparison';

	/**
	 * @inheritdoc
	 */
	protected $belongsTo = 'Advanced';


	/**
	 * @inheritdoc
	 */
	public function getLabel(): ?string{
		return __('Page URL', 'depicter' );
	}

	/**
	 * @inheritDoc
	 */
	public function getControlOptions(): array{
		return [];
	}

	/**
	 * @inheritdoc
	 */
	public function check( $value = null ): bool{

		$value = $value ?? $this->value;
		$isIncluded = empty( $value );
		if ( ! $isIncluded ) {
			global $wp;
			$value = Arr::merge( $value, [
				'targetParam' => home_url( $wp->request ),
				'comparisonFunction' => 'equal',
				'targetValue' => ''
			]);

			$isIncluded = $this->compare( trim( $value['targetParam'], '/'), $value['comparisonFunction'], trim( $value['targetValue'], '/') );
		}

		return $this->selectionMode === 'include' ? $isIncluded : ! $isIncluded;
	}
}

```
