AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/optinmonster/assets/js/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/html/wp-content/plugins/optinmonster/assets/js/Utils/campaigns.js
import get from 'lodash/get';
import { hasSites } from './sites';

/**
 * Get available inline campaign select options.
 *
 * @since  [since]
 *
 * @param  {string}  type       The campaign generic type (inline or other).
 * @param  {string}  slug       The campaign slug.
 * @param  {boolean} checkSites Whether to check for sites (return empty result if no sites connected).
 *
 * @returns {Array}              Array of campaign options for select elements.
 *                              Includes value, label, and selected/disabled properties.
 */
export const getOptions = (type, slug = null, checkSites = true) => {
	if (checkSites && !hasSites()) {
		return [];
	}

	const campaigns = get(OMAPI, `campaigns.${type}`, {});
	if (Object.keys(campaigns).length < 1 || !OMAPI.omUserId) {
		return [];
	}

	let available = Object.keys(campaigns).map((value) => {
		let label = get(campaigns, `${value}.title`, '');
		if (get(campaigns, `${value}.pending`)) {
			label += ' [Pending]';
		}

		const selected = null !== slug && slug === value;
		const disabled = null !== slug && get(OMAPI, `_usedSlugs.${value}`) && value !== slug;

		return { value, label, selected, disabled };
	});

	if (available.length > 0) {
		available.unshift({ value: '', label: OMAPI.i18n.campaign_select });
	}

	return available;
};

/**
 * Get the global campaign object from OM API for given slug.
 *
 * @since 2.3.0
 *
 * @param  {string} slug The campaign slug.
 *
 * @returns {Object|null} The global campaign object or null.
 */
export const getCampaign = (slug = '') => {
	const key = `om${slug}`;
	return window[key] ? window[key] : null;
};

Anon7 - 2022
AnonSec Team