Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Modules_Reviews::triggers( null $group = null, null $code = null )

Gets a list of triggers.


Description Description


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Parameters Parameters

$group

(Optional)

Default value: null

$code

(Optional)

Default value: null


Top ↑

Return Return

(bool|mixed)


Top ↑

Source Source

File: includes/modules/reviews.php

	public static function triggers( $group = null, $code = null ) {
		static $triggers;

		if ( ! isset( $triggers ) ) {

			$time_message = __( 'Hi there! You\'ve been using Popup Maker on your site for %s - I hope it\'s been helpful. If you\'re enjoying my plugin, would you mind rating it 5-stars to help spread the word?', 'popup-maker' );
			$triggers     = array(
				'time_installed' => array(
					'triggers' => array(
						'one_week'     => array(
							'message'    => sprintf( $time_message, __( '1 week', 'popup-maker' ) ),
							'conditions' => array(
								strtotime( self::installed_on() . ' +1 week' ) < time(),
							),
							'link'       => 'https://wordpress.org/support/plugin/popup-maker/reviews/?rate=5#rate-response',
							'pri'        => 10,
						),
						'one_month'    => array(
							'message'    => sprintf( $time_message, __( '1 month', 'popup-maker' ) ),
							'conditions' => array(
								strtotime( self::installed_on() . ' +1 month' ) < time(),
							),
							'link'       => 'https://wordpress.org/support/plugin/popup-maker/reviews/?rate=5#rate-response',
							'pri'        => 20,
						),
						'three_months' => array(
							'message'    => sprintf( $time_message, __( '3 months', 'popup-maker' ) ),
							'conditions' => array(
								strtotime( self::installed_on() . ' +3 months' ) < time(),
							),
							'link'       => 'https://wordpress.org/support/plugin/popup-maker/reviews/?rate=5#rate-response',
							'pri'        => 30,
						),

					),
					'pri'      => 10,
				),
				'open_count'     => array(
					'triggers' => array(),
					'pri'      => 50,
				),
			);

			$pri          = 10;
			$open_message = __( 'Hi there! You\'ve recently hit %s popup views on your site – that’s awesome!! If you\'d like to celebrate this milestone, rate Popup Maker 5-stars to help spread the word!', 'popup-maker' );
			foreach ( array( 50, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000, 5000000 ) as $num ) {
				$triggers['open_count']['triggers'][ $num . '_opens' ] = array(
					'message'    => sprintf( $open_message, number_format( $num ) ),
					'conditions' => array(
						get_option( 'pum_total_open_count', 0 ) > $num,
					),
					'link'       => 'https://wordpress.org/support/plugin/popup-maker/reviews/?rate=5#rate-response',
					'pri'        => $pri,
				);

				$pri += 10;
			}

			$triggers = apply_filters( 'pum_reviews_triggers', $triggers );

			// Sort Groups
			uasort( $triggers, array( __CLASS__, 'rsort_by_priority' ) );

			// Sort each groups triggers.
			foreach ( $triggers as $k => $v ) {
				uasort( $triggers[ $k ]['triggers'], array( __CLASS__, 'rsort_by_priority' ) );
			}
		}

		if ( isset( $group ) ) {
			if ( ! isset( $triggers[ $group ] ) ) {
				return false;
			}

			if ( ! isset( $code ) ) {
				return $triggers[ $group ];
			} else {
				return isset( $triggers[ $group ]['triggers'][ $code ] ) ? $triggers[ $group ]['triggers'][ $code ] : false;
			}
		}

		return $triggers;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.