Optinmonster_Helpers::get_campaigns()

get_campaigns

Contents


Return Return

(void)


Source Source

File: src/integrations/optinmonster/helpers/optinmonster-helpers.php

	public function get_campaigns() {

		$omapi = OMAPI::get_instance();

		$om_campaigns = $omapi->get_campaigns();

		$options = array();

		foreach ( $om_campaigns as $campaign ) {

			if ( 'inline' === $campaign->campaign_type ) {
				continue;
			}

			if ( false === $campaign->enabled ) {
				continue;
			}

			$options[] = array(
				'value' => $campaign->post_name,
				'text'  => $campaign->post_title,
			);
		}

		usort( $options, array( $this, 'sortByName' ) );

		return $options;
	}