File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Promos.tar
Base.php 0000644 00000006170 15154023502 0006130 0 ustar 00 <?php
/**
* Base Promos class.
*
* @since 2.10.0
*
* @package OMAPI
* @author Justin Sternberg
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Base Promos class.
*
* @since 2.10.0
*/
abstract class OMAPI_Promos_Base {
/**
* Holds the class object.
*
* @since 2.10.0
*
* @var object
*/
public static $instance;
/**
* Holds the base class object.
*
* @since 2.10.0
*
* @var object
*/
public $base;
/**
* Holds the welcome slug.
*
* @since 2.10.0
*
* @var string
*/
public $hook;
/**
* SeedProd plugin data.
*
* @since 2.10.0
*
* @var array
*/
public $plugin_data = array();
/**
* The promo id.
*
* @since 2.10.0
*
* @var string
*/
protected $promo = '';
/**
* The plugin id (from OMAPI_Plugins).
*
* @since 2.10.0
*
* @var string
*/
protected $plugin_id = '';
/**
* OMAPI_Plugins_Plugin instance.
*
* @since 2.10.0
*
* @var OMAPI_Plugins_Plugin
*/
public $plugin;
/**
* Primary class constructor.
*
* @since 2.10.0
*/
public function __construct() {
// If we are not in admin or admin ajax, return.
if ( ! is_admin() ) {
return;
}
// If user is in admin ajax or doing cron, return.
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
return;
}
// If user is not logged in, return.
if ( ! is_user_logged_in() ) {
return;
}
// return;
// If user cannot manage_options, return.
if ( ! OMAPI::get_instance()->can_access( $this->promo ) ) {
return;
}
// Set our object.
$this->set();
// Register the menu item.
add_action( 'admin_menu', array( $this, '_register_page' ) );
}
/**
* Sets our object instance and base class instance.
*
* @since 2.10.0
*/
public function set() {
self::$instance = $this;
$this->base = OMAPI::get_instance();
$this->plugin = OMAPI_Plugins_Plugin::get( $this->plugin_id );
}
/**
* Loads the OptinMonster admin menu and page.
*
* @since 2.10.0
*/
abstract protected function register_page();
/**
* Loads the OptinMonster admin menu and page.
*
* @since 2.10.0
*/
public function _register_page() {
$hook = $this->register_page();
// If SeedProd is active, we want to redirect to its own landing page.
if ( ! empty( $this->plugin['active'] ) ) {
add_action( 'load-' . $hook, array( $this, 'redirect_plugin' ) );
}
// Load settings page assets.
add_action( 'load-' . $hook, array( $this, 'assets' ) );
}
/**
* Redirects to the seedprod admin page.
*
* @since 2.10.0
*/
abstract public function redirect_plugin();
/**
* Outputs the OptinMonster settings page.
*
* @since 2.10.0
*/
abstract public function display_page();
/**
* Loads assets for the settings page.
*
* @since 2.10.0
*/
public function assets() {
add_filter( 'admin_body_class', array( $this, 'add_body_classes' ) );
$this->base->menu->styles();
$this->base->menu->scripts();
}
/**
* Add body classes.
*
* @since 2.10.0
*/
public function add_body_classes( $classes ) {
$classes .= " omapi-{$this->promo} ";
return $classes;
}
}
SeedProd.php 0000644 00000004471 15154023502 0006765 0 ustar 00 <?php
/**
* SeedProd class.
*
* @since 2.10.0
*
* @package OMAPI
* @author Justin Sternberg
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* SeedProd class.
*
* @since 2.10.0
*/
class OMAPI_Promos_SeedProd extends OMAPI_Promos_Base {
/**
* The promo id.
*
* @var string
*/
protected $promo = 'seedprod';
/**
* The plugin id.
*
* @var string
*/
protected $plugin_id = 'coming-soon/coming-soon.php';
/**
* Loads the OptinMonster admin menu.
*
* @since 2.10.0
*/
protected function register_page() {
return add_submenu_page(
$this->base->menu->parent_slug(), // Parent slug
esc_html__( 'SeedProd', 'optin-monster-api' ), // Page title
esc_html__( 'Landing Pages', 'optin-monster-api' ),
$this->base->access_capability( 'optin-monster-seedprod' ), // Cap
'optin-monster-seedprod', // Slug
array( $this, 'display_page' ) // Callback
);
}
/**
* Redirects to the seedprod admin page.
*
* @since 2.10.0
*/
public function redirect_plugin() {
$slug = ! empty( $this->plugin['which'] ) && 'default' !== $this->plugin['which']
? 'seedprod_pro'
: 'seedprod_lite';
$url = add_query_arg( 'page', $slug, admin_url( 'admin.php' ) );
wp_safe_redirect( esc_url_raw( $url ) );
exit;
}
/**
* Outputs the OptinMonster settings page.
*
* @since 2.10.0
*/
public function display_page() {
$plugin_search_url = is_multisite()
? network_admin_url( 'plugin-install.php?tab=search&type=term&s=seedprod' )
: admin_url( 'plugin-install.php?tab=search&type=term&s=seedprod' );
$this->base->output_view(
'seedprod-settings-page.php',
array(
'plugin' => $this->plugin,
'plugin_search_url' => $plugin_search_url,
'button_activate' => __( 'Start Creating Landing Pages', 'optin-monster-api' ),
'button_install' => __( 'Start Creating Landing Pages', 'optin-monster-api' ),
)
);
}
/**
* Loads assets for the settings page.
*
* @since 2.10.0
*/
public function assets() {
parent::assets();
wp_enqueue_style( 'om-tp-admin-css', $this->base->url . 'assets/dist/css/seedprod.min.css', false, $this->base->asset_version() );
}
/**
* Add body classes.
*
* @since 2.10.0
*/
public function add_body_classes( $classes ) {
$classes .= ' omapi-seedprod ';
return $classes;
}
}
TrustPulse.php 0000644 00000006270 15154023502 0007411 0 ustar 00 <?php
/**
* TrustPulse class.
*
* @since 1.9.0
*
* @package OMAPI
* @author Justin Sternberg
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* TrustPulse class.
*
* @since 1.9.0
*/
class OMAPI_Promos_TrustPulse extends OMAPI_Promos_Base {
/**
* The promo id.
*
* @var string
*/
protected $promo = 'trustpulse';
/**
* The plugin id.
*
* @var string
*/
protected $plugin_id = 'trustpulse-api/trustpulse.php';
/**
* Whether the TrustPulse plugin has been setup.
*
* @since 1.9.0
*
* @var bool
*/
public $trustpulse_setup;
/**
* Primary class constructor.
*
* @since 1.9.0
*/
public function __construct() {
if ( ! defined( 'TRUSTPULSE_APP_URL' ) ) {
define( 'TRUSTPULSE_APP_URL', 'https://app.trustpulse.com/' );
}
if ( ! defined( 'TRUSTPULSE_URL' ) ) {
define( 'TRUSTPULSE_URL', 'https://trustpulse.com/' );
}
parent::__construct();
}
/**
* Sets our object instance and base class instance.
*
* @since 1.9.0
*/
public function set() {
parent::set();
$account_id = get_option( 'trustpulse_script_id', null );
$this->trustpulse_setup = ! empty( $account_id );
}
/**
* Loads the OptinMonster admin menu.
*
* @since 1.9.0
*/
protected function register_page() {
return add_submenu_page(
// If trustpulse is active/setup, don't show the TP sub-menu item under OM.
! empty( $this->plugin['active'] ) && $this->trustpulse_setup
? $this->base->menu->parent_slug() . '-no-menu'
: $this->base->menu->parent_slug(), // Parent slug
esc_html__( 'TrustPulse', 'optin-monster-api' ), // Page title
esc_html__( 'Social Proof Widget', 'optin-monster-api' ),
$this->base->access_capability( 'optin-monster-trustpulse' ), // Cap
'optin-monster-trustpulse', // Slug
array( $this, 'display_page' ) // Callback
);
}
/**
* Redirects to the trustpulse admin page.
*
* @since 1.9.0
*/
public function redirect_plugin() {
$url = esc_url_raw( admin_url( 'admin.php?page=trustpulse' ) );
wp_safe_redirect( $url );
exit;
}
/**
* Outputs the OptinMonster settings page.
*
* @since 1.9.0
*/
public function display_page() {
$plugin_search_url = is_multisite()
? network_admin_url( 'plugin-install.php?tab=search&type=term&s=trustpulse' )
: admin_url( 'plugin-install.php?tab=search&type=term&s=trustpulse' );
$this->base->output_view(
'trustpulse-settings-page.php',
array(
'plugin' => $this->plugin,
'plugin_search_url' => $plugin_search_url,
'button_activate' => __( 'Activate the TrustPulse Plugin', 'optin-monster-api' ),
'button_install' => __( 'Install & Activate the TrustPulse Plugin', 'optin-monster-api' ),
)
);
}
/**
* Loads assets for the settings page.
*
* @since 1.9.0
*/
public function assets() {
parent::assets();
wp_enqueue_style( 'om-tp-admin-css', $this->base->url . 'assets/dist/css/trustpulse.min.css', false, $this->base->asset_version() );
add_action( 'in_admin_header', array( $this, 'render_banner' ) );
}
/**
* Renders TP banner in the page header
*
* @return void
*/
public function render_banner() {
$this->base->output_view( 'trustpulse-banner.php' );
}
}