Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/init.php.tar

xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/social-sharing/init.php000060400000026311151120506110031212 0ustar00home<?php
/**
 * Social Sharing Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Social_Sharing_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Social_Sharing_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Social_Sharing_OBFX_Module extends Orbit_Fox_Module_Abstract {

	private $social_share_links = array();

	/**
	 * Social_Sharing_OBFX_Module  constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name               = __( 'Social Sharing Module', 'themeisle-companion' );
		$this->description        = sprintf( __( 'Add basic social sharing to your posts and pages. Check out the %s to learn more!', 'themeisle-companion' ), sprintf( '<a href="https://demo.themeisle.com/orbit-fox/2018/01/15/social-sharing-modules/" rel="nofollow" target="_blank">%s</a>', __( 'demo', 'themeisle-companion' ) ) );
	}

	/**
	 * Define the array that contains the social networks.
	 */
	private function define_networks() {
    	$post_categories = strip_tags( get_the_category_list( ',' ) );
		$post_title = get_the_title();
		$post_link = get_the_permalink();

		$this->social_share_links = array(
			'facebook'  => array(
				'link'     => 'https://www.facebook.com/sharer.php?u=' . $post_link,
				'nicename' => 'Facebook',
				'icon'     => 'facebook',
			),
			'twitter'   => array(
				'link'     => 'https://twitter.com/intent/tweet?url=' . $post_link . '&text=' . $post_title . '&hashtags=' . $post_categories,
				'nicename' => 'Twitter',
				'icon'     => 'twitter',
			),
			'g-plus'    => array(
				'link'     => 'https://plus.google.com/share?url=' . $post_link,
				'nicename' => 'Google Plus',
				'icon'     => 'googleplus',
			),
			'pinterest' => array(
				'link'     => 'https://pinterest.com/pin/create/bookmarklet/?media=' . get_the_post_thumbnail_url() . '&url=' . $post_link . '&description=' . $post_title,
				'nicename' => 'Pinterest',
				'icon'     => 'pinterest',
			),
			'linkedin'  => array(
				'link'     => 'https://www.linkedin.com/shareArticle?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'LinkedIn',
				'icon'     => 'linkedin',
			),
			'tumblr'    => array(
				'link'     => 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Tumblr',
				'icon'     => 'tumblr',
			),
			'reddit'    => array(
				'link'     => 'https://reddit.com/submit?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Reddit',
				'icon'     => 'reddit',
			),
			'whatsapp'     => array(
				'link'     => 'whatsapp://send?text=' . $post_link,
				'nicename' => 'WhatsApp',
				'icon'     => 'whatsapp',
				'target'   => '0',
			),
			'mail'     => array(
				'link'     => 'mailto:?&subject=' . $post_title . '&body=' . $post_link,
				'nicename' => 'Email',
				'icon'     => 'mail',
				'target'   => '0'
			),
			'sms'     => array(
				'link'     => 'sms://?&body=' . $post_title . ' - ' . $post_link,
				'nicename' => 'SMS',
				'icon'     => 'viber',
				'target'   => '0',
			),
			'vk'        => array(
				'link'     => 'http://vk.com/share.php?url=' . $post_link,
				'nicename' => 'VKontakte',
				'icon'     => 'vkontakte',
			),
			'okru'      => array(
				'link'     => 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'OK.ru',
				'icon'     => 'odnoklassniki',
			),
			'douban'    => array(
				'link'     => 'http://www.douban.com/recommend/?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Douban',
				'icon'     => 'douban',
			),
			'baidu'     => array(
				'link'     => 'http://cang.baidu.com/do/add?it=' . $post_title . '&iu=' . $post_link,
				'nicename' => 'Baidu',
				'icon'     => 'baidu',
			),
			'xing'      => array(
				'link'     => 'https://www.xing.com/app/user?op=share&url=' . $post_link,
				'nicename' => 'Xing',
				'icon'     => 'xing',
			),
			'renren'    => array(
				'link'     => 'http://widget.renren.com/dialog/share?resourceUrl=' . $post_link . '&srcUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'RenRen',
				'icon'     => 'renren',
			),
			'weibo'     => array(
				'link'     => 'http://service.weibo.com/share/share.php?url=' . $post_link . '&appkey=&title=' . $post_title . '&pic=&ralateUid=',
				'nicename' => 'Weibo',
				'icon'     => 'weibo',
			),
		);
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
    }

    /**
     * Method to define hooks needed.
     *
     * @since   1.0.0
     * @access  public
     * @return mixed | array
     */
    public function hooks() {
	    $this->loader->add_filter('kses_allowed_protocols', $this, 'custom_allowed_protocols', 1000 );

	    if( $this -> get_option( 'socials_position' ) == 2 ) {
		    $this->loader->add_filter('hestia_filter_blog_social_icons', $this, 'social_sharing_function' );
		    return true;
	    }
	    $this->loader->add_action('wp_footer', $this, 'social_sharing_function' );
    }

	/**
     * Display method for the Social Sharing.
     *
     * @since   1.0.0
     * @access  public
     */
    public function social_sharing_function() {
        if ( ( $this->get_option('display_on_posts') && is_single() ) || ( $this->get_option('display_on_pages') && is_page() ) ) {
        	$class_desktop = 'obfx-sharing-left ';
        	switch ( $this->get_option( 'socials_position' ) ) {
		        case '1':
			        $class_desktop = 'obfx-sharing-right ';
			        break;
		        case '2':
		        	$class_desktop = 'obfx-sharing-inline ';
	        }

	        $class_mobile = '';
        	if( $this->get_option( 'mobile_position' ) == '0' ) {
	            $class_mobile = 'obfx-sharing-bottom';
	        }
		    $data = array(
		    	'desktop_class' => $class_desktop,
		    	'mobile_class'  => $class_mobile,
		    	'show_name' => $this->get_option( 'network_name' ),
		    	'social_links_array' => $this->social_links_array(),
		    );

	        if( $this -> get_option( 'socials_position' ) == 2 ) {
	            return $this->render_view( 'hestia-social-sharing', $data );
	        }
		        echo $this->render_view( 'social-sharing', $data );
	    }
    }

	/**
	 * Create the social links array to be passed to the front end view.
	 *
	 * @since   1.0.0
	 * @access  private
	 * @return array
	 */
    private function social_links_array() {
    	$social_links = array();
		foreach ( $this->social_share_links as $network => $network_links ) {
			if( $this->get_option( $network ) ) {
				$social_links[ $network ] = $network_links;
				$social_links[ $network ][ 'show_mobile' ] = $this->get_option( $network . '-mobile-show' );
				$social_links[ $network ][ 'show_desktop' ] = $this->get_option( $network . '-desktop-show' );
			}
		}
	    return $social_links;
    }

    /**
     * Add extra protocols to list of allowed protocols.
     *
	 * @param array $protocols List of protocols from core.
     *
     * @return array Updated list including extra protocols added.
     */
    public function custom_allowed_protocols( $protocols ){
    	$protocols[] = 'whatsapp';
	    $protocols[] = 'sms';
	    return $protocols;
    }

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
	    return array(
		    'css' => array(
				'public' => false,
				'vendor/socicon/socicon' => false,
		    ),
		    'js' => array(
				'public' => array( 'jquery' ),
		    ),
	    );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array(
			'css' => array(
				'admin' => false,
				'vendor/socicon/socicon' => false,
			),
			'js' => array(
				'admin' => array( 'jquery' ),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$options = array(
			array(
				'id'      => 'display_on_posts',
				'title'   => 'Display On',
				'name'    => 'display_on_posts',
				'type'    => 'checkbox',
				'label'   => 'Posts',
				'class'   => 'inline-setting',
				'default' => '1',
			),
			array(
				'id'      => 'display_on_pages',
				'title'   => '',
				'name'    => 'display_on_pages',
				'type'    => 'checkbox',
				'label'   => 'Pages',
				'class'   => 'inline-setting',
				'default' => '0',
			),
			array(
				'id'      => 'socials_position',
				'title'   => 'Desktop Position',
				'name'    => 'socials_position',
				'type'    => 'radio',
				'options' => array(
					'0' => 'Left',
					'1' => 'Right',
				),
				'default' => '0',
			),
			array(
				'id'      => 'mobile_position',
				'name'    => 'mobile_position',
				'title'   => 'Mobile Position',
				'type'    => 'radio',
				'options' => array(
					'0' => 'Pinned to bottom',
					'1' => 'Same as desktop',
				),
				'default' => '1',
			),
			array(
				'id'      => 'network_name',
				'name'    => 'network_name',
				'title'   => 'Show name',
				'type'    => 'toggle',
				'label'   => 'Show network name on hover',
				'default' => '0',
			),
		);

		$this->define_networks();

		foreach ( $this->social_share_links as $network => $data_array ) {
			$options[] = array(
				'before_wrap' => '<div class="obfx-row">',
				'title'       => ( $network == 'facebook' ) ? 'Networks' : '',
				'id'          => $network,
				'name'        => $network,
				'label'       => '<i class="socicon-' . $data_array['icon'] . '"></i>  - ' . $data_array['nicename'],
				'type'        => 'toggle',
				'default'     => ( $network == 'facebook' ) ? '1' : '',
				'class'       => 'inline-setting network-toggle',
			);

			$options[] = array(
				'title'   => ( $network == 'facebook' ) ? 'Show on' : '',
				'id'      => $network . '-desktop-show',
				'name'    => $network . '-desktop-show',
				'label'   => 'desktop',
				'type'    => 'checkbox',
				'default' => '1',
				'class'   => 'inline-setting show',
			);

			$options[] = array(
				'id'         => $network . '-mobile-show',
				'name'       => $network . '-mobile-show',
				'label'      => 'mobile',
				'type'       => 'checkbox',
				'default'    => '1',
				'class'      => 'inline-setting show last',
				'after_wrap' => '</div>',
			);
		}

		$options = $this->add_hestia_options( $options );

		return $options;
	}

	/**
	 * Add hestia options.
	 */
	private function add_hestia_options( $options ) {
		if( defined( 'HESTIA_VERSION' ) ) {
			$option_id = $this->search_for_id( 'socials_position', $options );
			$options[$option_id]['options']['2'] = 'Inline after content';
		}
		return $options;
	}

	/**
	 * Search for module option by id.
	 *
	 * @param $index
	 *
	 * @return int|null|string
	 */
	private function search_for_id( $index, $options ) {
		foreach ( $options as $key => $val ) {
			if ( $val['id'] === $index ) {
				return $key;
			}
		}
		return null;
	}

}xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/policy-notice/init.php000060400000022712151132764500031102 0ustar00home<?php
/**
 * A module to display a notification bar which will inform users about the website Private Policy.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Policy_Notice_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Policy_Notice_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Policy_Notice_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();

		$this->name        = __( 'Policy Notice', 'themeisle-companion' );
		$this->description = __( 'A simple notice bar which will help you inform users about your website policy.', 'themeisle-companion' );
	}

	/**
	 * Method to determine if the module is enabled or not.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The method for the module load logic.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed
	 */
	public function load() {
		return;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {

		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {

		return array(
			array(
				'id'      => 'enable_policy_notice',
				'name'    => 'enable_policy_notice',
				'title'   => '',
				'type'    => 'toggle',
				'label'   => esc_html__( 'Allow OrbitFox to display a bottom bar with info about the website Private Policy.', 'themeisle-companion' ),
				'default' => '0',
			),

			array(
				'id'      => 'policy_notice_text',
				'name'    => 'policy_notice_text',
				'title'   => esc_html__( 'Policy description', 'themeisle-companion' ),
				'type'    => 'text',
				'default' => esc_html__( 'This website uses cookies to improve your experience. We\'ll assume you accept this policy as long as you are using this website', 'themeisle-companion' ),
			),
			array(
				'id'      => 'policy_page',
				'name'    => 'policy_page',
				'title'   => esc_html__( 'Policy Page', 'themeisle-companion' ),
				'type'    => 'select',
				'default' => 0,
				'options' =>  $this->get_policy_pages_array()
			),
			array(
				'id'      => 'notice_link_label',
				'name'    => 'notice_link_label',
				'title'   => esc_html__( 'Policy Button Label', 'themeisle-companion' ),
				'type'    => 'text',
				'default' => esc_html__( 'View Policy', 'themeisle-companion' ),
			),
			array(
				'id'      => 'notice_accept_label',
				'name'    => 'notice_accept_label',
				'title'   => esc_html__( 'Accept Cookie Button Label', 'themeisle-companion' ),
				'type'    => 'text',
				'default' => esc_html__( 'Accept', 'themeisle-companion' ),
			),
		);
	}

	/**
	 * Method to define actions and filters needed for the module.
	 *
	 * @codeCoverageIgnore
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		// if the module is enabled
		if ( ! $this->is_policy_notice_active() ) {
			return;
		}

		$this->loader->add_action( 'update_option_wp_page_for_privacy_policy', $this, 'on_page_for_privacy_policy_save', 10, 3 );
		$this->loader->add_action( $this->get_slug() . '_before_options_save', $this, 'before_options_save', 10, 1 );

		// if the cookie policy is already accepted we quit.
		if ( isset( $_COOKIE['obfx-policy-consent'] ) && 'accepted' === $_COOKIE['obfx-policy-consent'] ) {
			return;
		}

		// only front-end hooks from now on
		$this->loader->add_action( 'wp_print_footer_scripts', $this, 'wp_print_footer_scripts' );
		$this->loader->add_action( 'wp_print_footer_scripts', $this, 'wp_print_footer_style' );
		$this->loader->add_action( 'wp_footer', $this, 'display_cookie_notice' );
	}

	/**
	 * Here we display the cookie bar template based on the given options.
	 */
	public function display_cookie_notice() {
		$policy_link   = get_option( 'wp_page_for_privacy_policy' ) ? get_permalink( (int) get_option( 'wp_page_for_privacy_policy' ) ) : '#';

		$policy_page   = $this->get_option( 'policy_page' );

		if ( ! empty( $policy_page ) ) {
			$policy_link = get_permalink( (int) get_option( 'wp_page_for_privacy_policy' ) );
		}

		$policy_text   = $this->get_option( 'policy_notice_text' );
		$policy_button = $this->get_option( 'notice_link_label' );
		$accept_button = $this->get_option( 'notice_accept_label' );

		$options = array(
			'policy_link'   => $policy_link,
			'policy_text'   => $policy_text,
			'policy_button' => $policy_button,
			'accept_button' => $accept_button,
		);

		// @TODO maybe think at some template system for a further hookable customization.

		// message output will start with a wrapper and an input tag which will decide if the template is visible or not
		$output = '<div class="obfx-cookie-bar-container"><input class="obfx-checkbox-cb" id="obfx-checkbox-cb" type="checkbox" />';

		// we'll add the buttons as a separate var and we'll start with the close button
		$buttons = '<label for="obfx-checkbox-cb" class="obfx-close-cb">X</label>';
		// the "Acceptance" button
		$buttons .= '<a href="#" id="obfx-accept-cookie-policy" >' . $accept_button . '</a>';
		// the "View Policy button"
		$buttons .= '<a href="' . $policy_link . '" >' . $policy_button . '</a>';

		// combine the buttons with the bar and close the wrapper.
		$output .= '<span class="obfx-cookie-bar">' . $policy_text . $buttons . '</span></div>';

		echo apply_filters( 'obfx_cookie_notice_output', $output, $options );
	}

	/**
	 * This script takes care of the cookie bar handling.
	 * For the moment we'll bind a cookie save to the "Agree" button click.
	 */
	public function wp_print_footer_scripts() { ?>
		<script>
			(function (window) {

				document.getElementById('obfx-accept-cookie-policy').addEventListener('click', function( e ) {
					e.preventDefault();
					var days = 365;
					var date = new Date();
					// @TODO add an option to select expiry days
					date.setTime(date.getTime() + 24 * days * 60 * 60 * 1e3);

					// save the cookie
					document.cookie = 'obfx-policy-consent=accepted; expires=' + date.toGMTString() + '; path=/';

					// after we get the acceptance cookie we can close the box
					document.getElementById('obfx-checkbox-cb').checked = true;

				}, false);

			})(window);
		</script><?php
	}

	/**
	 * This modules needs a few CSS lines so there is no need to load a file for it.
	 */
	public function wp_print_footer_style() { ?>
		<style>
			.obfx-cookie-bar-container {
				height: 0;
			}
			
			.obfx-checkbox-cb {
				display: none;
			}

			.obfx-cookie-bar {
				padding: 12px 25px;
				position: fixed;
				z-index: 9999;
				text-align: center;
				bottom: 0;
				left: 0;
				right: 0;
				display: block;
				min-height: 40px;
				background: #fff;
				border: 1px solid #333;
			}

			.obfx-cookie-bar a {
				padding: 0 8px;
				text-decoration: underline;
				font-weight: bold;
			}

			.obfx-checkbox-cb:checked + .obfx-cookie-bar {
				display: none;
			}

			.obfx-close-cb {
				position: absolute;
				right: 5px;
				top: 12px;
				width: 20px;
				cursor: pointer;
			}
		</style>
	<?php }

	/**
	 * When the core privacy page is changed, we'll also change the option within our module.
	 *
	 * @param $old_value
	 * @param $value
	 * @param $option
	 *
	 * @return mixed
	 */
	public function on_page_for_privacy_policy_save( $old_value, $value, $option ){

		// if this action comes from our dashboard we need to stop and avoid a save loop.
		if( doing_action( $this->get_slug() . '_before_options_save' ) ){
			return $value;
		}

		$this->set_option( 'policy_page', $value );

		return $value;
	}

	/**
	 * When the OrbitFox Module changes it's value, we also need to change the core version.
	 * @param $options
	 */
	public function before_options_save( $options ){

		// the default option doesn't need a a change.
		if ( empty( $options ) ) {
			return;
		}

		// there is no need to change something to it's own value.
		if ( $options['policy_page'] === get_option( 'wp_page_for_privacy_policy' ) ) {
			return;
		}

		update_option( 'wp_page_for_privacy_policy', $options['policy_page'] );

	}

	/**
	 * Check if safe updates is turned on.
	 *
	 * @return bool Safe updates status.
	 */
	private function is_policy_notice_active() {
		return (bool) $this->get_option( 'enable_policy_notice' );
	}

	/**
	 * Return an array with all the pages but the first entry is an indicator to the policy selected in core.
	 *
	 * @return array
	 */
	private function get_policy_pages_array(){
		$core_policy_suffix	= '';
		$url = get_option( 'wp_page_for_privacy_policy' );
		if ( empty( $url ) ) {
			$core_policy_suffix	= ' (' . esc_html__( 'Not Set', 'themeisle-companion' ) . ')';
		}
		$options = array(
			'0' => esc_html__( 'Default Core Policy', 'themeisle-companion' ) . $core_policy_suffix
		);

		$pages = get_pages( array(
			'echo'              => '0',
			'post_status'       => array( 'draft', 'publish' ),
			'depth' => 0,
			'child_of' => 0,
			'selected' => 0,
			'value_field' => 'ID',
		) );

		if ( empty( $pages ) ) {
			return $options;
		}

		foreach ( $pages as $page ) {
			$options[ $page->ID ] = $page->post_title;
		}

		return $options;
	}
}crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/init.php000060400000035336151136426660031565 0ustar00home/xbodynamge<?php
/**
 * ThemeIsle Companion Legacy Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Companion_Legacy_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Companion_Legacy_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Companion_Legacy_OBFX_Module extends Orbit_Fox_Module_Abstract {

	private $inc_dir;

	/**
	 * Companion_Legacy_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();

		$this->active_default = true;

		$this->inc_dir = $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR;
		if ( ! defined( 'THEMEISLE_COMPANION_PATH' ) ) {
			define( 'THEMEISLE_COMPANION_PATH', $this->inc_dir );
		}
		if ( ! defined( 'THEMEISLE_COMPANION_URL' ) ) {
			define( 'THEMEISLE_COMPANION_URL', plugin_dir_url( $this->inc_dir ) );
		}
		$theme_name = '';
		if ( $this->is_zerif() ) {
			$theme_name = 'Zerif';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-focus.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-testimonial.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-clients.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-team.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'functions.php';
		}

		if ( $this->is_rhea() ) {
			$theme_name = 'Rhea';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'features.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'about.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'hours.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'contact.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'progress-bar.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'icon-box.widget.php';
		}

		if ( $this->is_hestia() ) {
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'functions.php';
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php';
			$theme_name = 'Hestia';

		}

		if ( $this->is_hestia_pro() ) {
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php';
			$theme_name = 'Hestia Pro';

		}
		if( $this->is_shop_isle() ) {
			$theme_name = 'Shop Isle';
		}

		if ( $this->is_azera_shop() ) {
			$theme_name = 'Azera Shop';
		}

		if ( $this->is_llorix_one_lite() ) {
			$theme_name = 'Llorix One Lite';
		}

		$this->name        = sprintf( __( '%s enhancements ', 'themeisle-companion' ), $theme_name );
		$this->description = sprintf( __( 'Module containing frontpage improvements for %s theme.', 'themeisle-companion' ), $theme_name );
	}

	private function is_zerif() {
		if ( $this->get_active_theme_dir() == 'zerif-lite' ) {
			return true;
		}

		return false;
	}

	private function is_rhea() {
		if ( $this->get_active_theme_dir( true ) == 'rhea' ) {
			return true;
		}

		return false;
	}

	private function is_hestia() {
		if ( $this->get_active_theme_dir() == 'hestia' ) {
			return true;
		}

		return false;
	}

	private function is_hestia_pro(){
		if ( $this->get_active_theme_dir() == 'hestia-pro' ) {
			return true;
		}

		return false;
	}

	private function is_shop_isle() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if( is_plugin_active( 'shop-isle-companion/shop-isle-companion.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'shop-isle' ) {
			return true;
		}

		return false;
	}

	private function is_azera_shop() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if ( is_plugin_active( 'azera-shop-companion/azera-shop-companion.php' ) ) {
			return false;
		}
		if ( is_plugin_active( 'azera-shop-plus/azera-shop-plus.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'azera-shop' ) {
			return true;
		}

		return false;
	}

	private function is_llorix_one_lite() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if ( is_plugin_active( 'llorix-one-companion/llorix-one-companion.php' ) ) {
			return false;
		}
		if ( is_plugin_active( 'llorix-one-plus/llorix_one_plus.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'llorix-one-lite' ) {
			return true;
		}

		return false;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		if ( $this->is_hestia() || $this->is_rhea() || $this->is_zerif() || $this->is_hestia_pro() || $this->is_shop_isle() || $this->is_azera_shop() || $this->is_llorix_one_lite() ) {
			return true;
		} else {
			return false;
		}
	}

	public function zerif_register_widgets() {
		register_widget( 'zerif_ourfocus' );
		register_widget( 'zerif_testimonial_widget' );
		register_widget( 'zerif_clients_widget' );
		register_widget( 'zerif_team_widget' );

		$themeisle_companion_flag = get_option( 'themeisle_companion_flag' );
		if ( empty( $themeisle_companion_flag ) && function_exists( 'themeisle_populate_with_default_widgets' ) ) {
			themeisle_populate_with_default_widgets();
		}
	}

	public function rhea_register_widgets() {
		register_widget( 'rhea_features_block' );
		register_widget( 'Rhea_Progress_Bar' );
		register_widget( 'Rhea_Icon_Box' );
		register_widget( 'Rhea_About_Company' );
		register_widget( 'Rhea_Hours' );
		register_widget( 'Rhea_Contact_Company' );
	}

	function rhea_load_custom_wp_admin_style() {
		wp_enqueue_style( 'fontawesome-style', get_template_directory_uri() . '/css/font-awesome.min.css' );
		wp_enqueue_style( 'rhea-admin-style', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/css/admin-style.css' );
		wp_enqueue_script( 'fontawesome-icons', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/js/icons.js', false, '1.0.0' );
		wp_enqueue_script( 'jquery-ui-dialog' );
		wp_enqueue_script( 'fontawesome-script', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/js/fontawesome.jquery.js', false, '1.0.0' );
	}

	public function rhea_add_html_to_admin_footer() {
		$output = '
        <div id="fontawesome-popup">
            <div class="left-side">
                <label for="fontawesome-live-search">' . esc_html_e( 'Search icon', 'themeisle-companion' ) . ':</label>
                <ul class="filter-icons">
                    <li data-filter="all" class="active">' . esc_html_e( 'All Icons', 'themeisle-companion' ) . '</li>
                </ul>
            </div>
            <div class="right-side">
            </div>
        </div>
        ';

		echo $output;
	}

	/**
	 * Function to import customizer big title settings into first slide.
	 */
	public function shop_isle_get_wporg_options() {
		/* import shop isle options */
		$shop_isle_mods = get_option('theme_mods_shop-isle');

		if (!empty($shop_isle_mods)) {

			$new_slider = new stdClass();

			foreach ($shop_isle_mods as $shop_isle_mod_k => $shop_isle_mod_v) {

				/* migrate Big title section to Slider section */
				if (($shop_isle_mod_k == 'shop_isle_big_title_image') || ($shop_isle_mod_k == 'shop_isle_big_title_title') || ($shop_isle_mod_k == 'shop_isle_big_title_subtitle') || ($shop_isle_mod_k == 'shop_isle_big_title_button_label') || ($shop_isle_mod_k == 'shop_isle_big_title_button_link')) {

					if ($shop_isle_mod_k == 'shop_isle_big_title_image') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->image_url = $shop_isle_mod_v;
						} else {
							$new_slider->image_url = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_title') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->text = $shop_isle_mod_v;
						} else {
							$new_slider->text = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_subtitle') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->subtext = $shop_isle_mod_v;
						} else {
							$new_slider->subtext = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_button_label') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->label = $shop_isle_mod_v;
						} else {
							$new_slider->label = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_button_link') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->link = $shop_isle_mod_v;
						} else {
							$new_slider->link = '';
						}
					}

					if ( !empty($new_slider->image_url) || !empty($new_slider->text) || !empty($new_slider->subtext) || !empty($new_slider->link) ) {
						$new_slider_encode = json_encode(array($new_slider));
						set_theme_mod('shop_isle_slider', $new_slider_encode);
					}

				} else {

					set_theme_mod($shop_isle_mod_k, $shop_isle_mod_v);
				}
			}
		}

	}

	/**
	 * Wrapper method for themeisle_hestia_require function call.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hestia_require() {
		themeisle_hestia_require();
	}

	/**
	 * Wrapper method for themeisle_hestia_fix_duplicate_widgets function call.
	 *
	 * @since 2.4.5
	 * @access  public
	 */
	public function hestia_fix_duplicate_widgets(){
		themeisle_hestia_fix_duplicate_widgets();
	}

	/**
	 * Wrapper method for themeisle_hestia_clients_default_content function call.
	 *
	 * @since   2.1.1
	 * @access  public
	 */
	public function hestia_load_clients_default_content(){
		return themeisle_hestia_clients_default_content();
	}

	/**
	 * Wrapper method for themeisle_hestia_enqueue_clients_style function call.
	 *
	 * @access  public
	 */
	public function hestia_enqueue_clients_style(){
		themeisle_hestia_enqueue_clients_style();
	}

	/**
	 * Wrapper method for themeisle_hestia_top_bar_default_alignment function call.
	 * 
	 * @since   2.1.1
	 * @access  public
	 */
	public function hestia_top_bar_default_alignment(){
		return themeisle_hestia_top_bar_default_alignment();
	}

	/**
	 * Wrapper method for themeisle_hestia_load_controls function call.
	 *
	 * @since   2.0.4
	 * @access  public
	 */
	public function hestia_require_customizer() {
		themeisle_hestia_load_controls();
	}

	/**
	 * Wrapper method for themeisle_hestia_set_frontpage function call.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hestia_set_front_page() {
		themeisle_hestia_set_frontpage();
	}

	/**
	 * Wrapper method for Azera Shop Companion styles
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function azera_shop_companion_register_plugin_styles() {
		azera_shop_companion_register_plugin_styles();
	}

	/**
	 * Wrapper method for Azera Shop Companion sections
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function azera_shop_companion_load_sections() {
		azera_shop_companion_load_sections();
	}

	/**
	 * Wrapper method for Llorix One Companion styles
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function llorix_one_companion_register_plugin_styles() {
		llorix_one_companion_register_plugin_styles();
	}

	/**
	 * Wrapper method for Llorix One Companion sections
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function llorix_one_companion_load_sections() {
		llorix_one_companion_load_sections();
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		define( 'THEMEISLE_COMPANION_VERSION', '2.0.0' );
		if ( $this->is_zerif() ) {
			$this->loader->add_action( 'widgets_init', $this, 'zerif_register_widgets' );
		}

		if ( $this->is_rhea() ) {
			$this->loader->add_action( 'widgets_init', $this, 'rhea_register_widgets' );
			$this->loader->add_action( 'admin_enqueue_scripts', $this, 'rhea_load_custom_wp_admin_style' );
			$this->loader->add_action( 'admin_footer', $this, 'rhea_add_html_to_admin_footer' );
			$this->loader->add_action( 'customize_controls_print_footer_scripts', $this, 'rhea_add_html_to_admin_footer' );
		}

		if ( $this->is_hestia() ) {
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_require' );
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' );
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'hestia_enqueue_clients_style' );
			$this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' );
			$this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' );
			$this->loader->add_action( 'customize_register', $this, 'hestia_require_customizer', 0 );
			$this->loader->add_action( 'after_switch_theme', $this, 'hestia_set_front_page' );
		}

		if ( $this->is_hestia_pro() ) {
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' );
			$this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' );
			$this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' );
		}

		if( $this->is_shop_isle() ) {
			require_once $this->inc_dir . 'shop-isle' . DIRECTORY_SEPARATOR . 'functions.php';
		}

		if ( $this->is_azera_shop() ) {
			require_once  $this->inc_dir . 'azera-shop' . DIRECTORY_SEPARATOR . 'functions.php';
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'azera_shop_companion_register_plugin_styles' );
			$this->loader->add_action( 'plugins_loaded', $this, 'azera_shop_companion_load_sections' );
		}

		if ( $this->is_llorix_one_lite() ) {
			require_once  $this->inc_dir . 'llorix-one-companion' . DIRECTORY_SEPARATOR . 'functions.php';
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'llorix_one_companion_register_plugin_styles' );
			$this->loader->add_action( 'plugins_loaded', $this, 'llorix_one_companion_load_sections' );
		}
	}

	/**
	 * Import mods if is shop isle.
	 */
	public function activate() {
		if( $this->is_shop_isle() ) {
			$this->shop_isle_get_wporg_options();
		}
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}
}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/template-directory/init.php000064400000010512151137000020030071 0ustar00<?php

/**
 * The Orbit Fox Template Directory Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Template_Directory_OBFX_Module
 */

use  Elementor\TemplateLibrary\Classes;

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Template_Directory_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Template_Directory_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Template_Directory_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Template Directory Module', 'themeisle-companion' );
		$this->description    = __( 'The awesome template directory is aiming to provide a wide range of templates that you can import straight into your website.', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
		return true;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		// Get the full-width pages feature
		$this->loader->add_action( 'init', $this, 'load_template_directory_library' );
		$this->loader->add_action( 'init', $this, 'load_full_width_page_templates' );
		$this->loader->add_filter( 'obfx_template_dir_products',$this, 'add_page', 90 );
	}

	/**
	 * Enqueue the scripts for the dashboard page of the
	 */
	public function enqueue_template_dir_scripts() {
		$current_screen = get_current_screen();
		if ( $current_screen->id == 'orbit-fox_page_obfx_template_dir' ) {
			$script_handle = $this->slug . '-script';
			wp_enqueue_script( 'plugin-install' );
			wp_enqueue_script( 'updates' );
			wp_register_script( $script_handle, plugin_dir_url( $this->get_dir() ) . $this->slug . '/js/script.js', array( 'jquery' ), $this->version );
			wp_localize_script( $script_handle, 'importer_endpoint',
				array(
					'url'   => $this->get_endpoint_url( '/import_elementor' ),
					'nonce' => wp_create_nonce( 'wp_rest' ),
				) );
			wp_enqueue_script( $script_handle );
		}
	}

	/**
	 * Add the menu page.
	 *
	 * @param $products
	 *
	 * @return array
	 */
	public function add_page( $products ) {
		$sizzify = array(
			'obfx' => array(
				'directory_page_title' => __( 'Orbit Fox Template Directory', 'themeisle-companion' ),
				'parent_page_slug'     => 'obfx_companion',
				'page_slug'            => 'obfx_template_dir',
			)
		);
		return array_merge($products, $sizzify );
	}

	/**
	 *
	 *
	 * @param string $path
	 *
	 * @return string
	 */
	public function get_endpoint_url( $path = '' ) {
		return rest_url( $this->slug . $path );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}


	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		return array();
	}


	/**
	 * If the composer library is present let's try to init.
	 */
	public function load_full_width_page_templates() {
		if ( class_exists( '\ThemeIsle\FullWidthTemplates' ) ) {
			\ThemeIsle\FullWidthTemplates::instance();
		}
	}

	/**
	 * Call the Templates Directory library
	 */
	public function load_template_directory_library() {
		if ( class_exists( '\ThemeIsle\PageTemplatesDirectory' ) ) {
			\ThemeIsle\PageTemplatesDirectory::instance();
		}
	}

	/**
	 * By default the composer library "Full Width Page Templates" comes with two page templates: a blank one and a full
	 * width one with the header and footer inherited from the active theme.
	 * OBFX Template directory doesn't need the blonk one, so we are going to ditch it.
	 *
	 * @param array $list
	 *
	 * @return array
	 */
	public function filter_fwpt_templates_list( $list ){
		unset( $list['templates/builder-fullwidth.php'] );
		return $list;
	}
}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/safe-updates/init.php000064400000035365151137207630026672 0ustar00<?php
/**
 * A module to check changes before theme updates.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Theme_Update_Check_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Theme_Update_Check_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Safe_Updates_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * @var string ThemeCheck api endpoint.
	 */
	const API_ENDPOINT = 'https://dashboard.orbitfox.com/api/obfxhq/v1/updates/create/';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->beta        = false;
		$this->no_save     = true;
		$this->name        = __( 'Safe Updates', 'themeisle-companion' );
		$this->description = __( 'OrbitFox will give you visual feedback on how your current theme updates will affect your site. For the moment this is available only for wordpress.org themes.', 'themeisle-companion' );
	}

	/**
	 * Method to determine if the module is enabled or not.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {

		return ( $this->beta ) ? $this->is_lucky_user() : true;
	}

	/**
	 * The method for the module load logic.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed
	 */
	public function load() {
		return;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		if ( ! $this->is_safe_updates_active() ) {
			return array();
		}
		$current_screen = get_current_screen();
		if ( $current_screen->id != 'themes' && $current_screen->id != 'update-core' ) {
			return array();
		}
		$info = $this->is_update_available();

		if ( empty( $info ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return array();
		}
		$this->localized = array(
			'theme-update-check' => array(
				'slug' => $this->get_active_theme_dir(),
			),
		);
		$changes_info    = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$this->localized['theme-update-check']['check_msg'] = $changes_info;

		return array(
			'js' => array(
				'theme-update-check' => array( 'jquery', 'wp-lists', 'backbone' ),
			),
		);
	}

	/**
	 * Check if safe updates is turned on.
	 *
	 * @return bool Safe updates status.
	 */
	private function is_safe_updates_active() {

		return (bool) $this->get_option( 'auto_update_checks' );
	}

	/**
	 * Check if there is an update available.
	 *
	 * @param null $transient Transient to check.
	 *
	 * @return bool Is update available?
	 */
	private function is_update_available( $transient = null ) {

		if ( $transient === null ) {
			$transient = get_site_transient( 'update_themes' );
		}

		$slug = $this->get_active_theme_dir();

		if ( ! isset( $transient->response[ $slug ]['new_version'] ) ) {
			return false;
		}
		if ( version_compare( $transient->response[ $slug ]['new_version'], $transient->checked[ $slug ], '>' ) ) {
			$transient->response[ $slug ]['current_version'] = $transient->checked[ $slug ];

			$this->changes_check( $transient->response[ $slug ] );

			return $transient->response[ $slug ];
		}

		return false;
	}

	/**
	 * Check remote api for safe updates data.
	 *
	 * @param array $info Theme details.
	 *
	 * @return array Remote api message.
	 */
	private function changes_check( $info ) {
		if ( ! isset( $info['theme'] ) || empty( $info['theme'] ) ) {
			return array();
		}
		if ( ! isset( $info['new_version'] ) || empty( $info['new_version'] ) ) {
			return array();
		}
		if ( ! isset( $info['current_version'] ) || empty( $info['current_version'] ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( ! empty( $data ) ) {
			return $data;
		}
		/**
		 * Set lock and prevent calling the api for the next 30s.
		 */
		ksort( $request_data );
		$cache_key = 'obfx_su_' . md5( serialize( $request_data ) );
		$lock      = get_transient( $cache_key );
		if ( $lock === 'yes' ) {
			return array();
		}
		$response = wp_remote_post( self::API_ENDPOINT, array(
				'method'  => 'POST',
				'timeout' => 2,
				'body'    => $request_data,
			)
		);
		if ( is_wp_error( $response ) ) {
			return array();
		}
		$response_data = json_decode( wp_remote_retrieve_body( $response ), true );
		if ( ! is_array( $response_data ) ) {
			return array();
		}

		set_transient( $cache_key, 'yes', 30 );

		if ( strval( $response_data['code'] ) !== '200' ) {
			return array();
		}
		$response_data = $response_data['data'];
		if ( ! is_array( $response_data ) ) {
			return array();
		}
		$option_data = array(
			$this->get_safe_updates_hash( $request_data ) => $response_data,
		);

		$this->set_option( 'checks', $option_data );

		return $response_data;
	}

	/**
	 * Get cached safe updates api data.
	 *
	 * @param array $args Args to check.
	 *
	 * @return array Api data.
	 */
	private function get_safe_updates_data( $args = array() ) {

		$payload_sha = $this->get_safe_updates_hash( $args );
		$checks      = $this->get_option( 'checks' );

		if ( ! isset( $checks[ $payload_sha ] ) || empty( $checks[ $payload_sha ] ) || ! is_array( $checks[ $payload_sha ] ) || $checks[ $payload_sha ]['theme'] !== $args['theme'] ) {
			return array();
		}

		return $checks[ $payload_sha ];
	}

	/**
	 * Get hash key based on the request data.
	 *
	 * @param array $args Arguments used to generate hash.
	 *
	 * @return string Hash key.
	 */
	private function get_safe_updates_hash( $args = array() ) {
		ksort( $args );

		$payload_sha = hash_hmac( 'sha256', json_encode( $args ), self::API_ENDPOINT );

		return $payload_sha;
	}

	/**
	 * Return message string for safe updates notice.
	 *
	 * @param array $args Message placeholder.
	 *
	 * @return string Message string.
	 */
	public function get_message_notice( $args ) {
		$diff    = floatval( $args['global_diff'] );
		$message = sprintf(
			__( 'According to OrbitFox<sup>&copy;</sup> there is a visual difference of %1$s &#37; between your current version and the latest one. ', 'themeisle-companion' ),
			number_format( $diff, 2 )
		//$args['new_version']
		);
		if ( $diff > 0.1 ) {
			$message .= sprintf( '<a href="%1$s" target="_blank">', add_query_arg( array( 'from_orbitfox' => 'yes' ), $args['gallery_url'] ) ) . __( 'View report', 'themeisle-companion' ) . '</a> ';
		} else {
			$message .= __( 'Is very likely that the update is safe. ', 'themeisle-companion' );
		}

		return $message;

	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {

		add_filter( 'obfx_custom_control_auto_update_toggle', array( $this, 'render_custom_control' ) );

		add_action( 'admin_footer', array( $this, 'admin_inline_js' ) );
		add_action( 'rest_api_init', array( $this, 'register_endpoints' ) );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'auto_update_checks', '0' );
		}

		return array(
			array(
				'name'    => 'checks',
				'type'    => 'custom',
				'default' => array(),
			),
			array(
				'id'   => 'auto_update_toggle',
				'name' => 'auto_update_toggle',
				'type' => 'custom',
			),
		);
	}

	/**
	 * Render custom control outpu.
	 *
	 * @return string Custom control output.
	 */
	public function render_custom_control() {

		if ( ! $this->is_wp_available() ) {
			add_action( 'shutdown', function () {
				$this->set_status( 'active', false );
			} );

			return __( 'Unfortunately, our service is available only if your are using an wordpress.org theme. We are still working to extend this feature to custom and premium themes soon. ', 'themeisle-companion' );
		}

		$output = '<label>' . __( 'OrbitFox<sup>&copy;</sup> will need your current theme slug in order to run a visual comparison report between your current and latest version. We will need your consent in order to do this. <br/>Read <a href="https://orbitfox.com/safe-updates/" target="_blank"><b>more</b></a> about this process.', 'themeisle-companion' ) . '';
		if ( ! $this->is_safe_updates_active() ) {
			$output .= '</label></br></br><a  id="obfx-safe-updates-allow" class="btn btn-success" href="#"><span class="dashicons dashicons-yes"></span>   <span>' . __( 'Allow', 'themeisle-companion' ) . '</span></a>';
		} else {
			$output .= '  If want to disable the update feedback, you can disable the module from the upper module list 	&#8593;</label><br/><br/>';
			$output .= $this->get_safe_updates_status();

		}

		return $output;
	}

	/**
	 * Check if theme is available on wp.org.
	 *
	 * @return bool Check result.
	 */
	private function is_wp_available() {

		$slug      = $this->get_active_theme_dir();
		$cache_key = $slug . '_wporg_check';
		$cache     = get_transient( $cache_key );
		if ( $cache !== false ) {
			return $cache === 'yes';
		}
		$response = wp_remote_get( 'http://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]=' . $slug );
		if ( is_wp_error( $response ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = wp_remote_retrieve_body( $response );
		if ( empty( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = json_decode( $body, true );
		if ( ! is_array( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}

		set_transient( $cache_key, 'yes', HOUR_IN_SECONDS );

		return true;
	}

	/**
	 * Get safe update process message.
	 *
	 * @return string Safe updates process message.
	 */
	private function get_safe_updates_status() {
		$theme_data = $this->is_update_available();
		if ( $theme_data === false ) {
			return __( 'For the moment there is no update for your current theme. We will display a notice on the themes page as soon as there is one.', 'themeisle-companion' );

		}
		$changes = $this->changes_check( $theme_data );
		if ( empty( $changes ) ) {
			return __( 'OrbitFox<sup>&copy;</sup> is now running a visual report for your theme update. Please check the themes <a href="' . admin_url( 'themes.php' ) . '" target="_blank">update</a> page in a few minutes to see the result.', 'themeisle-companion' );
		}

		return '<pre class=" obfx-sf-feedback-notice  mb-10">' . $this->get_message_notice( $changes ) . '</pre>';

	}

	/**
	 * Method to define actions and filters needed for the module.
	 *
	 * @codeCoverageIgnore
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		if ( ! $this->is_safe_updates_active() ) {
			return;
		}

		$this->loader->add_filter( 'wp_prepare_themes_for_js', $this, 'theme_update_message' );
	}

	/**
	 * Register module safe updates feedback.
	 */
	public function register_endpoints() {
		register_rest_route(
			'obfx', '/enable_safe_updates', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'safe_updates_enabler' ),
				),
			)
		);
	}

	/**
	 * Enable safe updates feedback.
	 *
	 * @param WP_REST_Request $request Rest request.
	 *
	 * @return WP_REST_Response Feedback response.
	 */
	public function safe_updates_enabler( WP_REST_Request $request ) {
		$status   = $request->get_param( 'status' );
		$response = array(
			'message' => '',
			'data'    => '',
			'code'    => 'error',

		);
		if ( $status !== 'activate' && $status !== 'deactivate' ) {
			return new WP_REST_Response( $response );
		}
		if ( $status === 'deactivate' ) {
			$this->set_option( 'auto_update_checks', '0' );
			$response = wp_parse_args( array(
				'code'    => 'success',
				'message' => __( 'Safe updates disabled', 'themeisle-companion' )
			) );

			return new WP_REST_Response( $response );
		}
		$this->set_option( 'auto_update_checks', '1' );

		$status   = $this->get_safe_updates_status();
		$response = wp_parse_args( array(
			'code'    => 'success',
			'message' => $status
		) );

		return new WP_REST_Response( $response );

	}

	/**
	 * Add logic for module options.
	 */
	public function admin_inline_js() {
		wp_enqueue_script( 'wp-api' );

		$enable_safe_updates = get_rest_url( null, 'obfx/enable_safe_updates' );
		?>
		<script type='text/javascript'>
			(function ($) {
				$('#obfx-safe-updates-allow').on('click', function (event) {
					var btn = $(this);
					btn.addClass('loading');
					$("#obfx-sf-update-error").remove();
					wp.apiRequest({
						url: "<?php echo esc_url( $enable_safe_updates ); ?>",
						data: {status: 'activate'},
						type: 'POST',
						dataType: 'json'
					}).done(function (response) {
						btn.removeClass('loading');
						if (response.code === 'success') {
							btn.hide();
							btn.after(response.message);
						} else {
							btn.after('<p class="label label-error mb-10" id="obfx-sf-update-error">' + response.message + '</p>');
						}

					}).fail(function (e) {
						btn.removeClass('loading');
						$("#obfx-sf-update-error").remove();
						btn.after('<p class="label label-error">Can not activate the option. Please try again later.</p>');
					});
					return false;
				});
			})(jQuery)
		</script>
		<?php
	}

	/**
	 * Alter theme update message.
	 *
	 * @param array $themes List of themes.
	 *
	 * @return mixed Altered message.
	 */
	public function theme_update_message( $themes ) {

		if ( ! $this->is_safe_updates_active() ) {
			return $themes;
		}
		$info = $this->is_update_available();
		if ( empty( $info ) ) {
			return $themes;
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return $themes;
		}
		$changes_info = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$themes[ $info['theme'] ]['update'] = $themes[ $info['theme'] ]['update'] . $changes_info;

		return $themes;
	}

}xbodynamge/lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/safe-updates/init.php000064400000035365151137217270030516 0ustar00home<?php
/**
 * A module to check changes before theme updates.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Theme_Update_Check_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Theme_Update_Check_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Safe_Updates_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * @var string ThemeCheck api endpoint.
	 */
	const API_ENDPOINT = 'https://dashboard.orbitfox.com/api/obfxhq/v1/updates/create/';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->beta        = false;
		$this->no_save     = true;
		$this->name        = __( 'Safe Updates', 'themeisle-companion' );
		$this->description = __( 'OrbitFox will give you visual feedback on how your current theme updates will affect your site. For the moment this is available only for wordpress.org themes.', 'themeisle-companion' );
	}

	/**
	 * Method to determine if the module is enabled or not.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {

		return ( $this->beta ) ? $this->is_lucky_user() : true;
	}

	/**
	 * The method for the module load logic.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed
	 */
	public function load() {
		return;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		if ( ! $this->is_safe_updates_active() ) {
			return array();
		}
		$current_screen = get_current_screen();
		if ( $current_screen->id != 'themes' && $current_screen->id != 'update-core' ) {
			return array();
		}
		$info = $this->is_update_available();

		if ( empty( $info ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return array();
		}
		$this->localized = array(
			'theme-update-check' => array(
				'slug' => $this->get_active_theme_dir(),
			),
		);
		$changes_info    = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$this->localized['theme-update-check']['check_msg'] = $changes_info;

		return array(
			'js' => array(
				'theme-update-check' => array( 'jquery', 'wp-lists', 'backbone' ),
			),
		);
	}

	/**
	 * Check if safe updates is turned on.
	 *
	 * @return bool Safe updates status.
	 */
	private function is_safe_updates_active() {

		return (bool) $this->get_option( 'auto_update_checks' );
	}

	/**
	 * Check if there is an update available.
	 *
	 * @param null $transient Transient to check.
	 *
	 * @return bool Is update available?
	 */
	private function is_update_available( $transient = null ) {

		if ( $transient === null ) {
			$transient = get_site_transient( 'update_themes' );
		}

		$slug = $this->get_active_theme_dir();

		if ( ! isset( $transient->response[ $slug ]['new_version'] ) ) {
			return false;
		}
		if ( version_compare( $transient->response[ $slug ]['new_version'], $transient->checked[ $slug ], '>' ) ) {
			$transient->response[ $slug ]['current_version'] = $transient->checked[ $slug ];

			$this->changes_check( $transient->response[ $slug ] );

			return $transient->response[ $slug ];
		}

		return false;
	}

	/**
	 * Check remote api for safe updates data.
	 *
	 * @param array $info Theme details.
	 *
	 * @return array Remote api message.
	 */
	private function changes_check( $info ) {
		if ( ! isset( $info['theme'] ) || empty( $info['theme'] ) ) {
			return array();
		}
		if ( ! isset( $info['new_version'] ) || empty( $info['new_version'] ) ) {
			return array();
		}
		if ( ! isset( $info['current_version'] ) || empty( $info['current_version'] ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( ! empty( $data ) ) {
			return $data;
		}
		/**
		 * Set lock and prevent calling the api for the next 30s.
		 */
		ksort( $request_data );
		$cache_key = 'obfx_su_' . md5( serialize( $request_data ) );
		$lock      = get_transient( $cache_key );
		if ( $lock === 'yes' ) {
			return array();
		}
		$response = wp_remote_post( self::API_ENDPOINT, array(
				'method'  => 'POST',
				'timeout' => 2,
				'body'    => $request_data,
			)
		);
		if ( is_wp_error( $response ) ) {
			return array();
		}
		$response_data = json_decode( wp_remote_retrieve_body( $response ), true );
		if ( ! is_array( $response_data ) ) {
			return array();
		}

		set_transient( $cache_key, 'yes', 30 );

		if ( strval( $response_data['code'] ) !== '200' ) {
			return array();
		}
		$response_data = $response_data['data'];
		if ( ! is_array( $response_data ) ) {
			return array();
		}
		$option_data = array(
			$this->get_safe_updates_hash( $request_data ) => $response_data,
		);

		$this->set_option( 'checks', $option_data );

		return $response_data;
	}

	/**
	 * Get cached safe updates api data.
	 *
	 * @param array $args Args to check.
	 *
	 * @return array Api data.
	 */
	private function get_safe_updates_data( $args = array() ) {

		$payload_sha = $this->get_safe_updates_hash( $args );
		$checks      = $this->get_option( 'checks' );

		if ( ! isset( $checks[ $payload_sha ] ) || empty( $checks[ $payload_sha ] ) || ! is_array( $checks[ $payload_sha ] ) || $checks[ $payload_sha ]['theme'] !== $args['theme'] ) {
			return array();
		}

		return $checks[ $payload_sha ];
	}

	/**
	 * Get hash key based on the request data.
	 *
	 * @param array $args Arguments used to generate hash.
	 *
	 * @return string Hash key.
	 */
	private function get_safe_updates_hash( $args = array() ) {
		ksort( $args );

		$payload_sha = hash_hmac( 'sha256', json_encode( $args ), self::API_ENDPOINT );

		return $payload_sha;
	}

	/**
	 * Return message string for safe updates notice.
	 *
	 * @param array $args Message placeholder.
	 *
	 * @return string Message string.
	 */
	public function get_message_notice( $args ) {
		$diff    = floatval( $args['global_diff'] );
		$message = sprintf(
			__( 'According to OrbitFox<sup>&copy;</sup> there is a visual difference of %1$s &#37; between your current version and the latest one. ', 'themeisle-companion' ),
			number_format( $diff, 2 )
		//$args['new_version']
		);
		if ( $diff > 0.1 ) {
			$message .= sprintf( '<a href="%1$s" target="_blank">', add_query_arg( array( 'from_orbitfox' => 'yes' ), $args['gallery_url'] ) ) . __( 'View report', 'themeisle-companion' ) . '</a> ';
		} else {
			$message .= __( 'Is very likely that the update is safe. ', 'themeisle-companion' );
		}

		return $message;

	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {

		add_filter( 'obfx_custom_control_auto_update_toggle', array( $this, 'render_custom_control' ) );

		add_action( 'admin_footer', array( $this, 'admin_inline_js' ) );
		add_action( 'rest_api_init', array( $this, 'register_endpoints' ) );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'auto_update_checks', '0' );
		}

		return array(
			array(
				'name'    => 'checks',
				'type'    => 'custom',
				'default' => array(),
			),
			array(
				'id'   => 'auto_update_toggle',
				'name' => 'auto_update_toggle',
				'type' => 'custom',
			),
		);
	}

	/**
	 * Render custom control outpu.
	 *
	 * @return string Custom control output.
	 */
	public function render_custom_control() {

		if ( ! $this->is_wp_available() ) {
			add_action( 'shutdown', function () {
				$this->set_status( 'active', false );
			} );

			return __( 'Unfortunately, our service is available only if your are using an wordpress.org theme. We are still working to extend this feature to custom and premium themes soon. ', 'themeisle-companion' );
		}

		$output = '<label>' . __( 'OrbitFox<sup>&copy;</sup> will need your current theme slug in order to run a visual comparison report between your current and latest version. We will need your consent in order to do this. <br/>Read <a href="https://orbitfox.com/safe-updates/" target="_blank"><b>more</b></a> about this process.', 'themeisle-companion' ) . '';
		if ( ! $this->is_safe_updates_active() ) {
			$output .= '</label></br></br><a  id="obfx-safe-updates-allow" class="btn btn-success" href="#"><span class="dashicons dashicons-yes"></span>   <span>' . __( 'Allow', 'themeisle-companion' ) . '</span></a>';
		} else {
			$output .= '  If want to disable the update feedback, you can disable the module from the upper module list 	&#8593;</label><br/><br/>';
			$output .= $this->get_safe_updates_status();

		}

		return $output;
	}

	/**
	 * Check if theme is available on wp.org.
	 *
	 * @return bool Check result.
	 */
	private function is_wp_available() {

		$slug      = $this->get_active_theme_dir();
		$cache_key = $slug . '_wporg_check';
		$cache     = get_transient( $cache_key );
		if ( $cache !== false ) {
			return $cache === 'yes';
		}
		$response = wp_remote_get( 'http://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]=' . $slug );
		if ( is_wp_error( $response ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = wp_remote_retrieve_body( $response );
		if ( empty( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = json_decode( $body, true );
		if ( ! is_array( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}

		set_transient( $cache_key, 'yes', HOUR_IN_SECONDS );

		return true;
	}

	/**
	 * Get safe update process message.
	 *
	 * @return string Safe updates process message.
	 */
	private function get_safe_updates_status() {
		$theme_data = $this->is_update_available();
		if ( $theme_data === false ) {
			return __( 'For the moment there is no update for your current theme. We will display a notice on the themes page as soon as there is one.', 'themeisle-companion' );

		}
		$changes = $this->changes_check( $theme_data );
		if ( empty( $changes ) ) {
			return __( 'OrbitFox<sup>&copy;</sup> is now running a visual report for your theme update. Please check the themes <a href="' . admin_url( 'themes.php' ) . '" target="_blank">update</a> page in a few minutes to see the result.', 'themeisle-companion' );
		}

		return '<pre class=" obfx-sf-feedback-notice  mb-10">' . $this->get_message_notice( $changes ) . '</pre>';

	}

	/**
	 * Method to define actions and filters needed for the module.
	 *
	 * @codeCoverageIgnore
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		if ( ! $this->is_safe_updates_active() ) {
			return;
		}

		$this->loader->add_filter( 'wp_prepare_themes_for_js', $this, 'theme_update_message' );
	}

	/**
	 * Register module safe updates feedback.
	 */
	public function register_endpoints() {
		register_rest_route(
			'obfx', '/enable_safe_updates', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'safe_updates_enabler' ),
				),
			)
		);
	}

	/**
	 * Enable safe updates feedback.
	 *
	 * @param WP_REST_Request $request Rest request.
	 *
	 * @return WP_REST_Response Feedback response.
	 */
	public function safe_updates_enabler( WP_REST_Request $request ) {
		$status   = $request->get_param( 'status' );
		$response = array(
			'message' => '',
			'data'    => '',
			'code'    => 'error',

		);
		if ( $status !== 'activate' && $status !== 'deactivate' ) {
			return new WP_REST_Response( $response );
		}
		if ( $status === 'deactivate' ) {
			$this->set_option( 'auto_update_checks', '0' );
			$response = wp_parse_args( array(
				'code'    => 'success',
				'message' => __( 'Safe updates disabled', 'themeisle-companion' )
			) );

			return new WP_REST_Response( $response );
		}
		$this->set_option( 'auto_update_checks', '1' );

		$status   = $this->get_safe_updates_status();
		$response = wp_parse_args( array(
			'code'    => 'success',
			'message' => $status
		) );

		return new WP_REST_Response( $response );

	}

	/**
	 * Add logic for module options.
	 */
	public function admin_inline_js() {
		wp_enqueue_script( 'wp-api' );

		$enable_safe_updates = get_rest_url( null, 'obfx/enable_safe_updates' );
		?>
		<script type='text/javascript'>
			(function ($) {
				$('#obfx-safe-updates-allow').on('click', function (event) {
					var btn = $(this);
					btn.addClass('loading');
					$("#obfx-sf-update-error").remove();
					wp.apiRequest({
						url: "<?php echo esc_url( $enable_safe_updates ); ?>",
						data: {status: 'activate'},
						type: 'POST',
						dataType: 'json'
					}).done(function (response) {
						btn.removeClass('loading');
						if (response.code === 'success') {
							btn.hide();
							btn.after(response.message);
						} else {
							btn.after('<p class="label label-error mb-10" id="obfx-sf-update-error">' + response.message + '</p>');
						}

					}).fail(function (e) {
						btn.removeClass('loading');
						$("#obfx-sf-update-error").remove();
						btn.after('<p class="label label-error">Can not activate the option. Please try again later.</p>');
					});
					return false;
				});
			})(jQuery)
		</script>
		<?php
	}

	/**
	 * Alter theme update message.
	 *
	 * @param array $themes List of themes.
	 *
	 * @return mixed Altered message.
	 */
	public function theme_update_message( $themes ) {

		if ( ! $this->is_safe_updates_active() ) {
			return $themes;
		}
		$info = $this->is_update_available();
		if ( empty( $info ) ) {
			return $themes;
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return $themes;
		}
		$changes_info = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$themes[ $info['theme'] ]['update'] = $themes[ $info['theme'] ]['update'] . $changes_info;

		return $themes;
	}

}lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/template-directory/init.php000064400000010512151137604330031732 0ustar00home/xbodynamge<?php

/**
 * The Orbit Fox Template Directory Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Template_Directory_OBFX_Module
 */

use  Elementor\TemplateLibrary\Classes;

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Template_Directory_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Template_Directory_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Template_Directory_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Template Directory Module', 'themeisle-companion' );
		$this->description    = __( 'The awesome template directory is aiming to provide a wide range of templates that you can import straight into your website.', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
		return true;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		// Get the full-width pages feature
		$this->loader->add_action( 'init', $this, 'load_template_directory_library' );
		$this->loader->add_action( 'init', $this, 'load_full_width_page_templates' );
		$this->loader->add_filter( 'obfx_template_dir_products',$this, 'add_page', 90 );
	}

	/**
	 * Enqueue the scripts for the dashboard page of the
	 */
	public function enqueue_template_dir_scripts() {
		$current_screen = get_current_screen();
		if ( $current_screen->id == 'orbit-fox_page_obfx_template_dir' ) {
			$script_handle = $this->slug . '-script';
			wp_enqueue_script( 'plugin-install' );
			wp_enqueue_script( 'updates' );
			wp_register_script( $script_handle, plugin_dir_url( $this->get_dir() ) . $this->slug . '/js/script.js', array( 'jquery' ), $this->version );
			wp_localize_script( $script_handle, 'importer_endpoint',
				array(
					'url'   => $this->get_endpoint_url( '/import_elementor' ),
					'nonce' => wp_create_nonce( 'wp_rest' ),
				) );
			wp_enqueue_script( $script_handle );
		}
	}

	/**
	 * Add the menu page.
	 *
	 * @param $products
	 *
	 * @return array
	 */
	public function add_page( $products ) {
		$sizzify = array(
			'obfx' => array(
				'directory_page_title' => __( 'Orbit Fox Template Directory', 'themeisle-companion' ),
				'parent_page_slug'     => 'obfx_companion',
				'page_slug'            => 'obfx_template_dir',
			)
		);
		return array_merge($products, $sizzify );
	}

	/**
	 *
	 *
	 * @param string $path
	 *
	 * @return string
	 */
	public function get_endpoint_url( $path = '' ) {
		return rest_url( $this->slug . $path );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}


	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		return array();
	}


	/**
	 * If the composer library is present let's try to init.
	 */
	public function load_full_width_page_templates() {
		if ( class_exists( '\ThemeIsle\FullWidthTemplates' ) ) {
			\ThemeIsle\FullWidthTemplates::instance();
		}
	}

	/**
	 * Call the Templates Directory library
	 */
	public function load_template_directory_library() {
		if ( class_exists( '\ThemeIsle\PageTemplatesDirectory' ) ) {
			\ThemeIsle\PageTemplatesDirectory::instance();
		}
	}

	/**
	 * By default the composer library "Full Width Page Templates" comes with two page templates: a blank one and a full
	 * width one with the header and footer inherited from the active theme.
	 * OBFX Template directory doesn't need the blonk one, so we are going to ditch it.
	 *
	 * @param array $list
	 *
	 * @return array
	 */
	public function filter_fwpt_templates_list( $list ){
		unset( $list['templates/builder-fullwidth.php'] );
		return $list;
	}
}
xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/uptime-monitor/init.php000060400000010275151142172550031314 0ustar00home<?php
/**
 * The Mock-up to demonstrate and test module use.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Uptime_Monitor_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Uptime_Monitor_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Uptime_Monitor_OBFX_Module extends Orbit_Fox_Module_Abstract {
	/**
	 * @var string Uptime api endpoint.
	 */
	private $monitor_url = 'https://monitor.orbitfox.com';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Uptime Monitor', 'themeisle-companion' );
		$this->description    = __( 'A module to notify when you website goes down.', 'themeisle-companion' );
		$this->confirm_intent = '<h4>' . __( 'One more step...', 'themeisle-companion' ) . '</h4><p>' . __( 'In order to use the uptime service, we will need your e-mail address, where we will send downtime alerts.', 'themeisle-companion' ) . '</p>';
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method called on module activation.
	 * Calls the API to register an url to monitor.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function after_options_save() {
		$this->activate();
	}

	/**
	 * Method invoked after options save.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function activate() {
		$email = sanitize_email( $this->get_option( 'monitor_email' ) );
		if ( ! is_email( $email ) ) {
			return;
		}

		$monitor_url = $this->monitor_url . '/api/monitor/create';
		$url         = home_url();
		$args        = array(
			'body' => array( 'url' => $url, 'email' => $email )
		);
		$response    = wp_remote_post( $monitor_url, $args );
	}

	/**
	 * Method invoked before options save.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function before_options_save( $options ) {
		$this->deactivate();
	}

	/**
	 * Method called on module deactivation.
	 * Calls the API to unregister an url from the monitor.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function deactivate() {
		$this->set_option( 'monitor_email', '' );
		$monitor_url  = $this->monitor_url . '/api/monitor/remove';
		$url          = home_url();
		$args         = array(
			'body' => array( 'url' => $url )
		);
		$response     = wp_remote_post( $monitor_url, $args );
		$api_response = json_decode( $response['body'] );
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( $this->get_slug() . '_before_options_save', $this, 'before_options_save', 10, 1 );
		$this->loader->add_action( $this->get_slug() . '_after_options_save', $this, 'after_options_save' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( $current_screen->id != 'dashboard' ) {
			return array();
		}

		return array(
			'js'  => array(
				'stats' => array( 'jquery' ),
			),
			'css' => array(
				'stats' => false,
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array(
			array(
				'id'          => 'monitor_email',
				'name'        => 'monitor_email',
				'title'       => 'Notification email',
				'description' => 'Email where we should notify you when the site goes down.',
				'type'        => 'email',
				'default'     => '',
				'placeholder' => 'Add your email.',
			)
		);
	}
}crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/gutenberg-blocks/init.php000060400000005076151142257650031571 0ustar00home/xbodynamge<?php
/**
 * Gutenberg Blocks modules Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      2.2.5
 */

/**
 * Class Gutenberg_Blocks_OBFX_Module
 */
class Gutenberg_Blocks_OBFX_Module extends Orbit_Fox_Module_Abstract {

	protected $blocks_classes = array();

	/**
	 * Gutenberg_Blocks_OBFX_Module constructor.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Gutenberg Blocks', 'themeisle-companion' );
		$this->description    = __( 'A set of awesome Gutenberg Blocks!', 'themeisle-companion' );
		$this->active_default = false;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		global $wp_version;

		if ( version_compare( $wp_version, '5.0', '>=' ) ) {
			return true;
		}

		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
			return true;
		}

		return false;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'enqueue_block_assets', $this, 'enqueue_block_assets' );
		$this->loader->add_action( 'init', $this, 'load_gutenberg_blocks' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Load assets for our blocks.
	 */
	function enqueue_block_assets() {
		wp_enqueue_style( 'font-awesome-5', plugins_url( 'assets/fontawesome/css/all.min.css', __FILE__ ) );
		wp_enqueue_style( 'font-awesome-4-shims', plugins_url( 'assets/fontawesome/css/v4-shims.min.css', __FILE__ ) );
	}

	/**
	 * If the composer library is present let's try to init.
	 */
	function load_gutenberg_blocks() {
		if ( class_exists( '\ThemeIsle\GutenbergBlocks' ) ) {
			\ThemeIsle\GutenbergBlocks::instance( __( 'Orbit Fox', 'themeisle-companion' ) );
		}
	}

}
xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/menu-icons/init.php000060400000025747151142452220030406 0ustar00home<?php
/**
 * The module for menu icons.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Menu_Icons_OBFX_Module
 */

/**
 * The class for menu icons.
 *
 * @package    Menu_Icons_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Menu_Icons_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * The default icon to use.
	 */
	const DEFAULT_ICON	= 'dashicons-obfx-default-icon';

	/**
	 * Menu_Icons_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Menu Icons', 'themeisle-companion' );
		$this->description = __( 'Module to define menu icons for navigation.', 'themeisle-companion' );
		$this->active_default = true;

		add_action( 'admin_init', array( $this, 'check_conflict' ) , 99 );
	}


	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool	
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'wp_update_nav_menu_item', $this, 'save_fields', 10, 3 );
		// Do not change the priority of this from 1.
		$this->loader->add_filter( 'wp_edit_nav_menu_walker', $this, 'custom_walker', 1 );
		$this->loader->add_filter( 'wp_setup_nav_menu_item', $this, 'show_menu', 10, 1 );

	}

	/**
	 * Show the menu item.
	 *
	 * @access  public
	 * @return WP_Post $menu the menu object.
	 */
	public function show_menu( $menu ) {
		$icon	= get_post_meta( $menu->ID, 'obfx_menu_icon', true );
		if ( ! empty( $icon ) ) {
			$menu->icon = $icon;
			if ( ! is_admin() ) {
				// usually, icons are of the format fa-x or dashicons-x and when displayed they are displayed with classes 'fa fa-x' or 'dashicons dashicons-x'.
				// so let's determine the prefix class.
				$array			= explode( '-', $icon );
				$prefix			= reset( $array );
				$prefix			= apply_filters( 'obfx_menu_icons_icon_class', $prefix, $icon );
				$menu->title	= sprintf( '<i class="obfx-menu-icon %s %s"></i>%s', $prefix, $icon, $menu->title );
			}
		}
		return $menu;
	}

	/**
	 * Return the custom walker.
	 *
	 * @access  public
	 * @return Walker_Nav_Menu_Edit $walker the walker.
	 */
	public function custom_walker( $walker ) {
		if ( ! class_exists( 'Menu_Icons_OBFX_Walker' ) ) {
			require_once $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class-menu-icons-obfx-walker.php';
		}
		$walker = 'Menu_Icons_OBFX_Walker';
		return $walker;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array(
			'css' => array(
				'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' => array( 'dashicons' ),
				'public' => false,
			),
		);
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( $current_screen->id != 'nav-menus' ) {
			return array();
		}

		// Our walker has not been registered because another custom walker exists.
		if ( ! class_exists( 'Menu_Icons_OBFX_Walker' ) ) {
			return array();
		}

		$this->localized	= array(
			'admin'		=> array(
				'icons'	=> apply_filters( 'obfx_menu_icons_icon_list', $this->get_dashicons() ),
				'icon_default' => self::DEFAULT_ICON,
				'i10n' => array(
					'powered_by' => sprintf( __( 'Powered by %s plugin', 'themeisle-companion' ), '<b>' . apply_filters( 'themeisle_companion_friendly_name', '' ) . '</b>' ),
				),
			),
		);

		return array(
			'css' => array(
				'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' => false,
				'vendor/fontawesome-iconpicker.min' => array( 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' ),
				'admin' => array( 'vendor/fontawesome-iconpicker.min' ),
			),
			'js' => array(
				'vendor/bootstrap.min' => array( 'jquery' ),
				'vendor/fontawesome-iconpicker.min' => array( 'vendor/bootstrap.min' ),
				'admin' => array( 'vendor/fontawesome-iconpicker.min', 'jquery' ),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Return all the dashicons.
	 *
	 * @access  private
	 * @return array
	 */
	private function get_dashicons() {
		return array( 'dashicons-menu', 'dashicons-admin-site', 'dashicons-dashboard', 'dashicons-admin-post', 'dashicons-admin-media', 'dashicons-admin-links', 'dashicons-admin-page', 'dashicons-admin-comments', 'dashicons-admin-appearance', 'dashicons-admin-plugins', 'dashicons-admin-users', 'dashicons-admin-tools', 'dashicons-admin-settings', 'dashicons-admin-network', 'dashicons-admin-home', 'dashicons-admin-generic', 'dashicons-admin-collapse', 'dashicons-welcome-write-blog', 'dashicons-welcome-add-page', 'dashicons-welcome-view-site', 'dashicons-welcome-widgets-menus', 'dashicons-welcome-comments', 'dashicons-welcome-learn-more', 'dashicons-format-aside', 'dashicons-format-image', 'dashicons-format-gallery', 'dashicons-format-video', 'dashicons-format-status', 'dashicons-format-quote', 'dashicons-format-chat', 'dashicons-format-audio', 'dashicons-camera', 'dashicons-images-alt', 'dashicons-images-alt2', 'dashicons-video-alt', 'dashicons-video-alt2', 'dashicons-video-alt3', 'dashicons-image-crop', 'dashicons-image-rotate-left', 'dashicons-image-rotate-right', 'dashicons-image-flip-vertical', 'dashicons-image-flip-horizontal', 'dashicons-undo', 'dashicons-redo', 'dashicons-editor-bold', 'dashicons-editor-italic', 'dashicons-editor-ul', 'dashicons-editor-ol', 'dashicons-editor-quote', 'dashicons-editor-alignleft', 'dashicons-editor-aligncenter', 'dashicons-editor-alignright', 'dashicons-editor-insertmore', 'dashicons-editor-spellcheck', 'dashicons-editor-distractionfree', 'dashicons-editor-kitchensink', 'dashicons-editor-underline', 'dashicons-editor-justify', 'dashicons-editor-textcolor', 'dashicons-editor-paste-word', 'dashicons-editor-paste-text', 'dashicons-editor-removeformatting', 'dashicons-editor-video', 'dashicons-editor-customchar', 'dashicons-editor-outdent', 'dashicons-editor-indent', 'dashicons-editor-help', 'dashicons-editor-strikethrough', 'dashicons-editor-unlink', 'dashicons-editor-rtl', 'dashicons-align-left', 'dashicons-align-right', 'dashicons-align-center', 'dashicons-align-none', 'dashicons-lock', 'dashicons-calendar', 'dashicons-visibility', 'dashicons-post-status', 'dashicons-edit', 'dashicons-trash', 'dashicons-arrow-up', 'dashicons-arrow-down', 'dashicons-arrow-right', 'dashicons-arrow-left', 'dashicons-arrow-up-alt', 'dashicons-arrow-down-alt', 'dashicons-arrow-right-alt', 'dashicons-arrow-left-alt', 'dashicons-arrow-up-alt2', 'dashicons-arrow-down-alt2', 'dashicons-arrow-right-alt2', 'dashicons-arrow-left-alt2', 'dashicons-sort', 'dashicons-leftright', 'dashicons-list-view', 'dashicons-exerpt-view', 'dashicons-share', 'dashicons-share-alt', 'dashicons-share-alt2', 'dashicons-twitter', 'dashicons-rss', 'dashicons-email', 'dashicons-email-alt', 'dashicons-facebook', 'dashicons-facebook-alt', 'dashicons-googleplus', 'dashicons-networking', 'dashicons-hammer', 'dashicons-art', 'dashicons-migrate', 'dashicons-performance', 'dashicons-wordpress', 'dashicons-wordpress-alt', 'dashicons-pressthis', 'dashicons-update', 'dashicons-screenoptions', 'dashicons-info', 'dashicons-cart', 'dashicons-feedback', 'dashicons-cloud', 'dashicons-translation', 'dashicons-tag', 'dashicons-category', 'dashicons-yes', 'dashicons-no', 'dashicons-no-alt', 'dashicons-plus', 'dashicons-minus', 'dashicons-dismiss', 'dashicons-marker', 'dashicons-star-filled', 'dashicons-star-half', 'dashicons-star-empty', 'dashicons-flag', 'dashicons-location', 'dashicons-location-alt', 'dashicons-vault', 'dashicons-shield', 'dashicons-shield-alt', 'dashicons-sos', 'dashicons-search', 'dashicons-slides', 'dashicons-analytics', 'dashicons-chart-pie', 'dashicons-chart-bar', 'dashicons-chart-line', 'dashicons-chart-area', 'dashicons-groups', 'dashicons-businessman', 'dashicons-id', 'dashicons-id-alt', 'dashicons-products', 'dashicons-awards', 'dashicons-forms', 'dashicons-testimonial', 'dashicons-portfolio', 'dashicons-book', 'dashicons-book-alt', 'dashicons-download', 'dashicons-upload', 'dashicons-backup', 'dashicons-clock', 'dashicons-lightbulb', 'dashicons-desktop', 'dashicons-tablet', 'dashicons-smartphone', 'dashicons-smiley' );
	}

	/**
	 * Save menu item's icon.
	 *
	 * @access  public
	 *
	 * @param int   $menu_id         Nav menu ID.
	 * @param int   $menu_item_db_id Menu item ID.
	 * @param array $menu_item_args  Menu item data.
	 */
	public static function save_fields( $menu_id, $menu_item_db_id, $menu_item_args ) {
		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			return;
		}

		if ( ! function_exists( 'get_current_screen' ) ) {
		    return;
        }

		$screen = get_current_screen();
		if ( ! $screen instanceof WP_Screen || 'nav-menus' !== $screen->id ) {
			return;
		}

		check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );

		if ( isset( $_POST['menu-item-icon'][ $menu_item_db_id ] ) ) {
			$icon	= $_POST['menu-item-icon'][ $menu_item_db_id ];
			if ( self::DEFAULT_ICON === $icon ) {
				$icon	= '';
			}
			update_post_meta( $menu_item_db_id, 'obfx_menu_icon', $icon );
		}

	}

	/**
	 * Checks if there is any conflict with a theme/plugin.
	 */
	public function check_conflict() {
		// We need to include this so that the wp_edit_nav_menu_walker filter does not misbehave.
		require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );

		// Let's check if another walker has been defined.
		$walker = apply_filters( 'wp_edit_nav_menu_walker', '' );

		// Yes, a conflict!
		if ( ! empty( $walker ) && $walker !== 'Menu_Icons_OBFX_Walker' ) {
			$reflector	= new ReflectionClass( $walker );
			$path		= str_replace( '\\', '/', $reflector->getFileName() );

			$name		= '';
			$type		= '';
			if ( false !== strpos( $path, 'themes' ) ) {
				$type	= __( 'theme', 'themeisle-companion' );
				$theme	= wp_get_theme();
				$name	= $theme->get( 'Name' );
			} else {
				require_once( ABSPATH . 'wp-admin/includes/file.php' );
				WP_Filesystem();
				global $wp_filesystem;

				$plugin_path	= str_replace( str_replace( '\\', '/', trailingslashit( dirname( OBX_PATH ) ) ), '', $path );
				$array			= explode( '/', $path );
				$name			= reset( $array );
				$type			= __( 'plugin', 'themeisle-companion' );
			}

			$this->description .= '<br><i class="chip">' . sprintf( __( 'There appears to be a conflict with the %s %s. This module may not work as expected.', 'themeisle-companion' ), $type, $name ) . '</i>';
			$this->active_default = false;
		}
	}
}xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/mystock-import/init.php000060400000017344151142514140031324 0ustar00home<?php
/**
 * The module for mystock import.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Mystock_Import_OBFX_Module
 */

/**
 * The class for mystock import.
 *
 * @package    Mystock_Import_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Mystock_Import_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * The api key.
	 */
	const API_KEY = '97d007cf8f44203a2e578841a2c0f9ac';

	/**
	 * The number of images to fetch. Only the first page will be fetched.
	 */
	const MAX_IMAGES = 40;

	/**
	 * The username of the flickr account.
	 */
	const USER_NAME = 'themeisle';

	/**
	 * The cache time.
	 */
	const CACHE_DAYS = 7;


	/**
	 * Mystock_Import_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Mystock Import', 'themeisle-companion' );
		$this->description    = __( 'Module to import images directly from', 'themeisle-companion' ) . sprintf( ' <a href="%s" target="_blank">mystock.photos</a>', 'https://mystock.photos' );
		$this->active_default = true;
	}


	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		/*Get tab content*/
		$this->loader->add_action( 'wp_ajax_get-tab-' . $this->slug, $this, 'get_tab_content' );
		$this->loader->add_action( 'wp_ajax_infinite-' . $this->slug, $this, 'infinite_scroll' );
		$this->loader->add_action( 'wp_ajax_handle-request-' . $this->slug, $this, 'handle_request' );
		$this->loader->add_filter( 'media_view_strings', $this, 'media_view_strings' );
	}

	/**
	 * Display tab content.
	 */
	public function get_tab_content() {
		$urls = $this->get_images();
		require $this->get_dir() . "/inc/photos.php";
		wp_die();
	}

	/**
	 * Request images from flickr.
	 *
	 * @param int $page Page to load.
	 *
	 * @return array
	 */
	private function get_images( $page = 1 ) {
		$photos = get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_' . $page );
		if ( ! $photos ) {
			require_once $this->get_dir() . '/vendor/phpflickr/phpflickr.php';
			$api    = new phpFlickr( self::API_KEY );
			$user   = $api->people_findByUsername( self::USER_NAME );
			$photos = array();
			if ( $user && isset( $user['nsid'] ) ) {
				$photos = $api->people_getPublicPhotos( $user['nsid'], null, 'url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', self::MAX_IMAGES, $page );
				if ( ! empty( $photos ) ) {
					$pages = get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages' );
					if ( false === $pages ) {
						set_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages', $photos['photos']['pages'], self::CACHE_DAYS * DAY_IN_SECONDS );
					}
					$photos = $photos['photos']['photo'];
				}
			}
			set_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_' . $page, $photos, self::CACHE_DAYS * DAY_IN_SECONDS );
		}

		return $photos;
	}

	/**
	 * Upload image.
	 */
	function handle_request() {
		check_ajax_referer( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ), 'security' );

		if ( ! isset( $_POST['url'] ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}

		$url      = $_POST['url'];
		$name     = basename( $url );
		$tmp_file = download_url( $url );
		if ( is_wp_error( $tmp_file ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		$file             = array();
		$file['name']     = $name;
		$file['tmp_name'] = $tmp_file;
		$image_id         = media_handle_sideload( $file, 0 );
		if ( is_wp_error( $image_id ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		$attach_data = wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) );
		if ( is_wp_error( $attach_data ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		wp_update_attachment_metadata( $image_id, $attach_data );

		wp_send_json_success( array( 'id' => $image_id ) );
	}

	/**
	 * Ajax function to load new images.
	 */
	function infinite_scroll() {
		check_ajax_referer( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ), 'security' );

		if ( ! isset( $_POST['page'] ) ) {
			wp_die();
		}

		//Update last page that was loaded
		$req_page = (int) $_POST['page'] + 1;

		//Request new page
		$response    = '';
		$new_request = $this->get_images( $req_page );
		if ( ! empty( $new_request ) ) {
			foreach ( $new_request as $photo ) {
				$response .= '<li class="obfx-image" data-page="' . esc_attr( $req_page ) . '" data-pid="' . esc_attr( $photo['id'] ) . '">';
				$response .= '<div class="obfx-preview"><div class="thumbnail"><div class="centered">';
				$response .= '<img src="' . esc_url( $photo['url_m'] ) . '">';
				$response .= '</div></div></div>';
				$response .= '<button type="button" class="check obfx-image-check" tabindex="0"><span class="media-modal-icon"></span><span class="screen-reader-text">' . esc_html__( 'Deselect', 'themeisle-companion' ) . '</span></button>';
				$response .= '</li>';
			}
		}

		echo $response;
		wp_die();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( ! in_array( $current_screen->id, array( 'post', 'page', 'post-new', 'upload' ) ) ) {
			return array();
		}

		$this->localized = array(
			'admin' => array(
				'ajaxurl' => admin_url( 'admin-ajax.php' ),
				'nonce'   => wp_create_nonce( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ),
				'l10n'    => array(
					'fetch_image_sizes'     => esc_html__( 'Fetching data', 'themeisle-companion' ),
					'upload_image'          => esc_html__( 'Downloading image. Please wait...', 'themeisle-companion' ),
					'upload_image_complete' => esc_html__( 'Your image was imported. Go to Media Library tab to use it.', 'themeisle-companion' ),
					'load_more'             => esc_html__( 'Loading more photos...', 'themeisle-companion' ),
					'tab_name'              => esc_html__( 'MyStock Library', 'themeisle-companion' ),
					'featured_image_new'    => esc_html__( 'Import & set featured image', 'themeisle-companion' ),
					'insert_image_new'      => esc_html__( 'Import & insert image', 'themeisle-companion' ),
					'featured_image'        => isset( $this->strings['setFeaturedImage'] ) ? $this->strings['setFeaturedImage'] : '',
					'insert_image'          => isset( $this->strings['insertIntoPost'] ) ? $this->strings['insertIntoPost'] : '',
				),
				'slug'    => $this->slug,
				'pages'   => get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages' ),
			),
		);

		return array(
			'js'  => array(
				'admin' => array( 'media-views' ),
			),
			'css' => array(
				'media' => array(),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	public function media_view_strings( $strings ) {
		$this->strings = $strings;

		return $strings;
	}
}xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/safe-updates/init.php000060400000035365151143112410030702 0ustar00home<?php
/**
 * A module to check changes before theme updates.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Theme_Update_Check_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Theme_Update_Check_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Safe_Updates_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * @var string ThemeCheck api endpoint.
	 */
	const API_ENDPOINT = 'https://dashboard.orbitfox.com/api/obfxhq/v1/updates/create/';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->beta        = false;
		$this->no_save     = true;
		$this->name        = __( 'Safe Updates', 'themeisle-companion' );
		$this->description = __( 'OrbitFox will give you visual feedback on how your current theme updates will affect your site. For the moment this is available only for wordpress.org themes.', 'themeisle-companion' );
	}

	/**
	 * Method to determine if the module is enabled or not.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {

		return ( $this->beta ) ? $this->is_lucky_user() : true;
	}

	/**
	 * The method for the module load logic.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed
	 */
	public function load() {
		return;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		if ( ! $this->is_safe_updates_active() ) {
			return array();
		}
		$current_screen = get_current_screen();
		if ( $current_screen->id != 'themes' && $current_screen->id != 'update-core' ) {
			return array();
		}
		$info = $this->is_update_available();

		if ( empty( $info ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return array();
		}
		$this->localized = array(
			'theme-update-check' => array(
				'slug' => $this->get_active_theme_dir(),
			),
		);
		$changes_info    = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$this->localized['theme-update-check']['check_msg'] = $changes_info;

		return array(
			'js' => array(
				'theme-update-check' => array( 'jquery', 'wp-lists', 'backbone' ),
			),
		);
	}

	/**
	 * Check if safe updates is turned on.
	 *
	 * @return bool Safe updates status.
	 */
	private function is_safe_updates_active() {

		return (bool) $this->get_option( 'auto_update_checks' );
	}

	/**
	 * Check if there is an update available.
	 *
	 * @param null $transient Transient to check.
	 *
	 * @return bool Is update available?
	 */
	private function is_update_available( $transient = null ) {

		if ( $transient === null ) {
			$transient = get_site_transient( 'update_themes' );
		}

		$slug = $this->get_active_theme_dir();

		if ( ! isset( $transient->response[ $slug ]['new_version'] ) ) {
			return false;
		}
		if ( version_compare( $transient->response[ $slug ]['new_version'], $transient->checked[ $slug ], '>' ) ) {
			$transient->response[ $slug ]['current_version'] = $transient->checked[ $slug ];

			$this->changes_check( $transient->response[ $slug ] );

			return $transient->response[ $slug ];
		}

		return false;
	}

	/**
	 * Check remote api for safe updates data.
	 *
	 * @param array $info Theme details.
	 *
	 * @return array Remote api message.
	 */
	private function changes_check( $info ) {
		if ( ! isset( $info['theme'] ) || empty( $info['theme'] ) ) {
			return array();
		}
		if ( ! isset( $info['new_version'] ) || empty( $info['new_version'] ) ) {
			return array();
		}
		if ( ! isset( $info['current_version'] ) || empty( $info['current_version'] ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( ! empty( $data ) ) {
			return $data;
		}
		/**
		 * Set lock and prevent calling the api for the next 30s.
		 */
		ksort( $request_data );
		$cache_key = 'obfx_su_' . md5( serialize( $request_data ) );
		$lock      = get_transient( $cache_key );
		if ( $lock === 'yes' ) {
			return array();
		}
		$response = wp_remote_post( self::API_ENDPOINT, array(
				'method'  => 'POST',
				'timeout' => 2,
				'body'    => $request_data,
			)
		);
		if ( is_wp_error( $response ) ) {
			return array();
		}
		$response_data = json_decode( wp_remote_retrieve_body( $response ), true );
		if ( ! is_array( $response_data ) ) {
			return array();
		}

		set_transient( $cache_key, 'yes', 30 );

		if ( strval( $response_data['code'] ) !== '200' ) {
			return array();
		}
		$response_data = $response_data['data'];
		if ( ! is_array( $response_data ) ) {
			return array();
		}
		$option_data = array(
			$this->get_safe_updates_hash( $request_data ) => $response_data,
		);

		$this->set_option( 'checks', $option_data );

		return $response_data;
	}

	/**
	 * Get cached safe updates api data.
	 *
	 * @param array $args Args to check.
	 *
	 * @return array Api data.
	 */
	private function get_safe_updates_data( $args = array() ) {

		$payload_sha = $this->get_safe_updates_hash( $args );
		$checks      = $this->get_option( 'checks' );

		if ( ! isset( $checks[ $payload_sha ] ) || empty( $checks[ $payload_sha ] ) || ! is_array( $checks[ $payload_sha ] ) || $checks[ $payload_sha ]['theme'] !== $args['theme'] ) {
			return array();
		}

		return $checks[ $payload_sha ];
	}

	/**
	 * Get hash key based on the request data.
	 *
	 * @param array $args Arguments used to generate hash.
	 *
	 * @return string Hash key.
	 */
	private function get_safe_updates_hash( $args = array() ) {
		ksort( $args );

		$payload_sha = hash_hmac( 'sha256', json_encode( $args ), self::API_ENDPOINT );

		return $payload_sha;
	}

	/**
	 * Return message string for safe updates notice.
	 *
	 * @param array $args Message placeholder.
	 *
	 * @return string Message string.
	 */
	public function get_message_notice( $args ) {
		$diff    = floatval( $args['global_diff'] );
		$message = sprintf(
			__( 'According to OrbitFox<sup>&copy;</sup> there is a visual difference of %1$s &#37; between your current version and the latest one. ', 'themeisle-companion' ),
			number_format( $diff, 2 )
		//$args['new_version']
		);
		if ( $diff > 0.1 ) {
			$message .= sprintf( '<a href="%1$s" target="_blank">', add_query_arg( array( 'from_orbitfox' => 'yes' ), $args['gallery_url'] ) ) . __( 'View report', 'themeisle-companion' ) . '</a> ';
		} else {
			$message .= __( 'Is very likely that the update is safe. ', 'themeisle-companion' );
		}

		return $message;

	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {

		add_filter( 'obfx_custom_control_auto_update_toggle', array( $this, 'render_custom_control' ) );

		add_action( 'admin_footer', array( $this, 'admin_inline_js' ) );
		add_action( 'rest_api_init', array( $this, 'register_endpoints' ) );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'auto_update_checks', '0' );
		}

		return array(
			array(
				'name'    => 'checks',
				'type'    => 'custom',
				'default' => array(),
			),
			array(
				'id'   => 'auto_update_toggle',
				'name' => 'auto_update_toggle',
				'type' => 'custom',
			),
		);
	}

	/**
	 * Render custom control outpu.
	 *
	 * @return string Custom control output.
	 */
	public function render_custom_control() {

		if ( ! $this->is_wp_available() ) {
			add_action( 'shutdown', function () {
				$this->set_status( 'active', false );
			} );

			return __( 'Unfortunately, our service is available only if your are using an wordpress.org theme. We are still working to extend this feature to custom and premium themes soon. ', 'themeisle-companion' );
		}

		$output = '<label>' . __( 'OrbitFox<sup>&copy;</sup> will need your current theme slug in order to run a visual comparison report between your current and latest version. We will need your consent in order to do this. <br/>Read <a href="https://orbitfox.com/safe-updates/" target="_blank"><b>more</b></a> about this process.', 'themeisle-companion' ) . '';
		if ( ! $this->is_safe_updates_active() ) {
			$output .= '</label></br></br><a  id="obfx-safe-updates-allow" class="btn btn-success" href="#"><span class="dashicons dashicons-yes"></span>   <span>' . __( 'Allow', 'themeisle-companion' ) . '</span></a>';
		} else {
			$output .= '  If want to disable the update feedback, you can disable the module from the upper module list 	&#8593;</label><br/><br/>';
			$output .= $this->get_safe_updates_status();

		}

		return $output;
	}

	/**
	 * Check if theme is available on wp.org.
	 *
	 * @return bool Check result.
	 */
	private function is_wp_available() {

		$slug      = $this->get_active_theme_dir();
		$cache_key = $slug . '_wporg_check';
		$cache     = get_transient( $cache_key );
		if ( $cache !== false ) {
			return $cache === 'yes';
		}
		$response = wp_remote_get( 'http://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]=' . $slug );
		if ( is_wp_error( $response ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = wp_remote_retrieve_body( $response );
		if ( empty( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = json_decode( $body, true );
		if ( ! is_array( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}

		set_transient( $cache_key, 'yes', HOUR_IN_SECONDS );

		return true;
	}

	/**
	 * Get safe update process message.
	 *
	 * @return string Safe updates process message.
	 */
	private function get_safe_updates_status() {
		$theme_data = $this->is_update_available();
		if ( $theme_data === false ) {
			return __( 'For the moment there is no update for your current theme. We will display a notice on the themes page as soon as there is one.', 'themeisle-companion' );

		}
		$changes = $this->changes_check( $theme_data );
		if ( empty( $changes ) ) {
			return __( 'OrbitFox<sup>&copy;</sup> is now running a visual report for your theme update. Please check the themes <a href="' . admin_url( 'themes.php' ) . '" target="_blank">update</a> page in a few minutes to see the result.', 'themeisle-companion' );
		}

		return '<pre class=" obfx-sf-feedback-notice  mb-10">' . $this->get_message_notice( $changes ) . '</pre>';

	}

	/**
	 * Method to define actions and filters needed for the module.
	 *
	 * @codeCoverageIgnore
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		if ( ! $this->is_safe_updates_active() ) {
			return;
		}

		$this->loader->add_filter( 'wp_prepare_themes_for_js', $this, 'theme_update_message' );
	}

	/**
	 * Register module safe updates feedback.
	 */
	public function register_endpoints() {
		register_rest_route(
			'obfx', '/enable_safe_updates', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'safe_updates_enabler' ),
				),
			)
		);
	}

	/**
	 * Enable safe updates feedback.
	 *
	 * @param WP_REST_Request $request Rest request.
	 *
	 * @return WP_REST_Response Feedback response.
	 */
	public function safe_updates_enabler( WP_REST_Request $request ) {
		$status   = $request->get_param( 'status' );
		$response = array(
			'message' => '',
			'data'    => '',
			'code'    => 'error',

		);
		if ( $status !== 'activate' && $status !== 'deactivate' ) {
			return new WP_REST_Response( $response );
		}
		if ( $status === 'deactivate' ) {
			$this->set_option( 'auto_update_checks', '0' );
			$response = wp_parse_args( array(
				'code'    => 'success',
				'message' => __( 'Safe updates disabled', 'themeisle-companion' )
			) );

			return new WP_REST_Response( $response );
		}
		$this->set_option( 'auto_update_checks', '1' );

		$status   = $this->get_safe_updates_status();
		$response = wp_parse_args( array(
			'code'    => 'success',
			'message' => $status
		) );

		return new WP_REST_Response( $response );

	}

	/**
	 * Add logic for module options.
	 */
	public function admin_inline_js() {
		wp_enqueue_script( 'wp-api' );

		$enable_safe_updates = get_rest_url( null, 'obfx/enable_safe_updates' );
		?>
		<script type='text/javascript'>
			(function ($) {
				$('#obfx-safe-updates-allow').on('click', function (event) {
					var btn = $(this);
					btn.addClass('loading');
					$("#obfx-sf-update-error").remove();
					wp.apiRequest({
						url: "<?php echo esc_url( $enable_safe_updates ); ?>",
						data: {status: 'activate'},
						type: 'POST',
						dataType: 'json'
					}).done(function (response) {
						btn.removeClass('loading');
						if (response.code === 'success') {
							btn.hide();
							btn.after(response.message);
						} else {
							btn.after('<p class="label label-error mb-10" id="obfx-sf-update-error">' + response.message + '</p>');
						}

					}).fail(function (e) {
						btn.removeClass('loading');
						$("#obfx-sf-update-error").remove();
						btn.after('<p class="label label-error">Can not activate the option. Please try again later.</p>');
					});
					return false;
				});
			})(jQuery)
		</script>
		<?php
	}

	/**
	 * Alter theme update message.
	 *
	 * @param array $themes List of themes.
	 *
	 * @return mixed Altered message.
	 */
	public function theme_update_message( $themes ) {

		if ( ! $this->is_safe_updates_active() ) {
			return $themes;
		}
		$info = $this->is_update_available();
		if ( empty( $info ) ) {
			return $themes;
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return $themes;
		}
		$changes_info = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$themes[ $info['theme'] ]['update'] = $themes[ $info['theme'] ]['update'] . $changes_info;

		return $themes;
	}

}xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/beaver-widgets/init.php000060400000005427151143126350031235 0ustar00home<?php
/**
 * Beaver Builder modules Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      2.2.5
 */

define( 'BEAVER_WIDGETS_PATH', plugin_dir_path( __FILE__ ) );
define( 'BEAVER_WIDGETS_URL', plugins_url( '/', __FILE__ ) );

/**
 * Class Beaver_Widgets_OBFX_Module
 */
class Beaver_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Beaver_Widgets_OBFX_Module constructor.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active('bb-plugin/fl-builder.php');
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'init', $this, 'load_widgets_modules' );
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Require Beaver Builder modules
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load_widgets_modules(){
		if ( class_exists( 'FLBuilder' ) ) {
			require_once 'modules/pricing-table/pricing-table.php';
			require_once 'modules/services/services.php';
			require_once 'modules/post-grid/post-grid.php';
		}
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {
		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}
}home/xbodynamge/crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/image-cdn/init.php000060400000030700151143330250030214 0ustar00<?php

/**
 * The Orbit Fox Image CDN Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Image_CDN_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Image_CDN_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Image_CDN_OBFX_Module extends Orbit_Fox_Module_Abstract {
	/**
	 * Dashboard related data.
	 *
	 * @var null|array Dashboard related data.
	 */
	protected $connect_data = null;
	/**
	 * @var \OrbitFox\Connector $connector Orbitfox Api connector.
	 */
	private $connector;

	/**
	 * Image_CDN_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		if ( isset( $_GET['loggedin'] ) && $_GET['loggedin'] == 'true' ) {
			$this->show = true;
		}
		$this->no_save     = true;
		$this->name        = sprintf( __( 'Image Optimization &amp; CDN Module <sup class="obfx-title-new">NEW</sup>', 'themeisle-companion' ) );
		$this->description = sprintf( __( 'Let us take care of your images sizes. With this feature we\'ll compress and resize every image on your website. <i>This service is powered by <b>%sOptimole%s</b></i>. <br/> <strong>* Requires account on orbitfox.com</strong>', 'themeisle-companion' ), '<a href="https://optimole.com" class="obfx-no-link" target="_blank">', '</a>' );
		add_action( 'obfx_module_tile_after', [ $this, 'tryout' ], 10, 2 );
	}

	public function tryout( $slug = '', $active = false ) {
		if ( $slug !== 'image-cdn' ) {
			return;
		}
		if ( $active ) {
			return;
		}
		echo sprintf( __( '%sTest your site%s','themeisle-companion' ), '<span class="obfx-tryout-message"><a href="' . esc_url( sprintf( 'https://speedtest.optimole.com/?url=%s', get_site_url() ) ) . '" target="_blank">', '</a></span>' );
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Add top admin bar notice of traffic quota/usage.
	 *
	 * @param WP_Admin_Bar $wp_admin_bar Admin bar resource.
	 */
	public function add_traffic_node( $wp_admin_bar ) {
		if ( ! is_user_logged_in() ) {
			return;
		}
		$obfx_user_data = $this->get_api_data();
		$args           = array(
			'id'    => 'obfx_img_quota',
			'title' => 'OrbitFox' . __( ' Image Traffic', 'themeisle-companion' ) . ': ' . number_format( floatval( ( $obfx_user_data['image_cdn']['usage'] / 1000 ) ), 3 ) . ' / ' . number_format( floatval( ( $obfx_user_data['image_cdn']['quota'] / 1000 ) ), 0 ) . 'GB',
			'href'  => 'https://dashboard.orbitfox.com/',
			'meta'  => array( 'target' => '_blank' )
		);
		$wp_admin_bar->add_node( $args );

	}

	/**
	 * Return api data.
	 *
	 * @return mixed|string APi data.
	 */
	private function get_api_data() {

		if ( ! $this->get_is_active() ) {
			return '';
		}

		return class_exists( '\OrbitFox\Connector' ) ? get_option( \OrbitFox\Connector::API_DATA_KEY, '' ) : '';
	}

	/**
	 * Render data from dashboard of orbitfox.com.
	 */
	public function render_connect_data( $html ) {

		$obfx_user_data = $this->get_api_data();
		$class          = '';
		if ( ! empty( $obfx_user_data ) ) {
			$class = 'obfx-img-logged-in';
		}
		$display_name = isset( $obfx_user_data['display_name'] ) ? $obfx_user_data['display_name'] : '';
		$usage        = ( isset( $obfx_user_data['image_cdn'] ) && isset( $obfx_user_data['image_cdn']['usage'] ) ) ? $obfx_user_data['image_cdn']['usage'] : 0;
		$quota        = ( isset( $obfx_user_data['image_cdn'] ) && isset( $obfx_user_data['image_cdn']['quota'] ) ) ? $obfx_user_data['image_cdn']['quota'] : 0;
		$html         = '<div class="obfx-img-logged-in-data obfx-loggedin-show ' . $class . '" > ';
		$html         .= '<h5>' . __( 'Logged in as', 'themeisle-companion' ) . ' : <b id="obfx-img-display-name">' . esc_attr( $display_name ) . '</b></h5>';
		$html         .= '<p>' . __( 'Your private CDN url', 'themeisle-companion' ) . ' : <code id="obfx-img-cdn-url">' . $this->get_cdn_url() . '</code></p> ';
		$html         .= '<p>' . __( 'This month traffic usage', 'themeisle-companion' ) . ' : <code id="obfx-img-traffic-usage">' . number_format( floatval( ( $usage / 1000 ) ), 3 ) . ' GB</code>';
		$html         .= ' ' . __( 'Your traffic quota', 'themeisle-companion' ) . ' : <code class="obfx-img-traffic-quota">' . number_format( floatval( ( $quota / 1000 ) ), 3 ) . ' GB / month</code></p>';
		$html         .= '<p><i>' . __( 'You can use our image service and CDN in the limit of <span class="obfx-img-traffic-quota">', 'themeisle-companion' ) . number_format( floatval( ( $quota / 1000 ) ), 0 ) . '</span> per month.  </i></p>';
		$html         .= '</div>';

		return $html;
	}

	/**
	 * Get CDN private url.
	 *
	 * @return string Get CDN private url.
	 */
	private function get_cdn_url() {
		$obfx_user_data = $this->get_api_data();
		if ( empty( $obfx_user_data ) ) {
			return '';
		}
		if ( ! isset( $obfx_user_data['image_cdn']['key'] ) ) {
			return '';
		}

		return sprintf( '%s.i.optimole.com', strtolower( $obfx_user_data['image_cdn']['key'] ) );

	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		//Hack to allow binding of img module connect button as the view for the module options is loaded either if the module is active or not.

		//TODO Remove this when we have a way of loading module options async.
		if ( is_admin() ) {
			$this->hooks();
		}
		$obfx_user_data = $this->get_api_data();
		if ( empty( $obfx_user_data ) ) {
			$this->set_option( 'obfx_connect_api_key', '' );
			$this->set_option( 'enable_cdn_replacer', '0' );

		}
		$class = '';
		if ( ! empty( $obfx_user_data ) ) {
			$class = 'obfx-img-logged-in';
		}
		$fields   = array(
			array(
				'type'  => 'title',
				'name'  => 'Tooltip',
				'title' => sprintf( 'In order to get access to free image optimization service you will need an account on <a href="https://dashboard.orbitfox.com/register" target="_blank">orbitfox.com</a>. You will get access to our image optimization and CDN service for free in the limit of 1GB traffic per month.<br/> <i>Note: This is just a basic integration of the <a href="%s" target="_blank"> Optimole </a> service. For a more in-depth experience, try out the dedicated <a href="%s" target="_blank" >plugin</a>.</i>', 'https://optimole.com', 'http://wordpress.org/plugins/optimole-wp' )
			),
			array(
				'id'          => 'obfx_connect_api_key',
				'name'        => 'obfx_connect_api_key',
				'type'        => 'password',
				'default'     => isset( $obfx_user_data['api_key'] ) ? $obfx_user_data['api_key'] : '',
				'placeholder' => __( 'Your OrbitFox api key', 'themeisle-companion' ),
				'text'        => '<span class="dashicons dashicons-share"></span>' . __( 'Connect with Orbitfox', 'themeisle-companion' ),
			),
			array(
				'id'     => 'obfx-register-service',
				'type'   => 'link',
				'target' => '_blank',
				'class'  => 'obfx-loggedin-hide ' . $class,
				'url'    => 'https://dashboard.orbitfox.com/register',
				'text'   => ' Sign-Up for your API key',
				'name'   => 'obfx-register-service',
			),

		);
		$fields[] = array(
			'id'         => 'obfx_connect',
			'name'       => 'obfx_connect',
			'type'       => 'link',
			'url'        => '#',
			'class'      => 'obfx-loggedin-hide ' . $class,
			'link-class' => 'btn btn-success',
			'text'       => '<span class="dashicons dashicons-share"></span>' . __( 'Connect to OrbitFox service', 'themeisle-companion' ),
		);
		$fields[] = array(
			'type' => 'custom',
			'id'   => 'cdn_logged_in_data',
			'name' => 'cdn_logged_in_data',
		);
		$fields[] = array(
			'id'         => 'obfx_disconnect',
			'name'       => 'obfx_disconnect',
			'type'       => 'link',
			'class'      => 'obfx-loggedin-show ' . $class,
			'url'        => '#',
			'link-class' => 'btn btn-danger float-right  mb-10 obfx-img-logout ',
			'text'       => '<span class="dashicons dashicons-share"></span>' . __( 'Clear OrbitFox API key', 'themeisle-companion' ),
		);

		$fields[] = array(
			'id'      => 'enable_cdn_replacer',
			'title'   => '',
			'name'    => 'enable_cdn_replacer',
			'type'    => 'toggle',
			'class'   => ' obfx-img-cdn-replacer-switch obfx-loggedin-show ' . $class,
			'label'   => 'Serve all images optimised through OrbitFox CDN for a boost in speed.',
			'default' => '0',
		);

		return $fields;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		/**
		 * Init the connector object and load deps.
		 */
		require_once __DIR__ . '/inc/class-request.php';
		require_once __DIR__ . '/inc/class-orbit-fox-connector.php';
		add_filter( 'obfx_custom_control_cdn_logged_in_data', array( $this, 'render_connect_data' ) );
		$this->connector = \OrbitFox\Connector::instance();

		$this->loader->add_action( 'rest_api_init', $this, 'register_url_endpoints' );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'enable_cdn_replacer', '0' );
			$this->clear_api_data();
		}
		/**
		 * Load the image replacement logic if we are on the frontend,
		 * connected to the api and the replacement options is on.
		 */
		if ( ! is_admin() && $this->is_replacer_enabled() && $this->is_connected() ) {
			require_once __DIR__ . '/inc/class-orbit-fox-image-replacer.php';
			\OrbitFox\Image_CDN_Replacer::instance();
			$this->loader->add_filter( 'wp_resource_hints', $this, 'add_dns_prefetch', 10, 2 );

		}
		/**
		 * Adds top admin bar notice of traffic, if the module is connected.
		 */
		if ( $this->is_connected() ) {
			$this->loader->add_action( 'obfx_img_quota_sync', $this->connector, 'daily_check' );

			if ( ! wp_next_scheduled( 'obfx_img_quota_sync' ) ) {
				wp_schedule_event( time() + 10, 'daily', 'obfx_img_quota_sync', array() );
			}
			$this->loader->add_action( 'admin_bar_menu', $this, 'add_traffic_node', 9999 );
		}

	}

	/**
	 * Return api data.
	 *
	 * @return mixed|string APi data.
	 */
	private function clear_api_data() {


		return update_option( \OrbitFox\Connector::API_DATA_KEY, '' );
	}

	/**
	 * Check if the image replacement is enabled.
	 *
	 * @return bool Connection status.
	 */
	private function is_replacer_enabled() {
		if ( ! $this->get_is_active() ) {
			return false;
		}
		$enabled = $this->get_option( 'enable_cdn_replacer' );

		return boolval( $enabled );

	}

	/**
	 * Check if the module is connected to the api.
	 *
	 * @return bool Connection status.
	 */
	private function is_connected() {

		$obfx_user_data = $this->get_api_data();

		return ! empty( $obfx_user_data );

	}

	/**
	 * Adds cdn url for prefetch.
	 *
	 * @param array  $hints Hints array.
	 * @param string $relation_type Type of relation.
	 *
	 * @return array Altered hints array.
	 */
	public function add_dns_prefetch( $hints, $relation_type ) {
		if ( 'dns-prefetch' !== $relation_type ) {
			return $hints;
		}
		$cdn_url = $this->get_cdn_url();
		if ( empty( $cdn_url ) ) {
			return $hints;
		}
		$hints[] = sprintf( '//%s', $cdn_url );

		return $hints;
	}

	/**
	 * Update replacer callback.
	 */
	public function update_replacer( WP_REST_Request $request ) {
		$flag = $request->get_param( 'update_replacer' );
		$this->set_option( 'enable_cdn_replacer', $flag === 'yes' ? '1' : '0' );

		return new WP_REST_Response( 'Replacer updated' );
	}

	/**
	 * Register module rest methods.
	 */
	public function register_url_endpoints() {
		register_rest_route(
			'obfx', '/connector-url', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this->connector, 'rest_handle_connector_url' ),
				),
			)
		);
		register_rest_route(
			'obfx', '/update_replacer', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'update_replacer' ),
				),
			)
		);
	}

}
crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/template-directory/init.php000060400000010512151144116450032132 0ustar00home/xbodynamge<?php

/**
 * The Orbit Fox Template Directory Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Template_Directory_OBFX_Module
 */

use  Elementor\TemplateLibrary\Classes;

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Template_Directory_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Template_Directory_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Template_Directory_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Template Directory Module', 'themeisle-companion' );
		$this->description    = __( 'The awesome template directory is aiming to provide a wide range of templates that you can import straight into your website.', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
		return true;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		// Get the full-width pages feature
		$this->loader->add_action( 'init', $this, 'load_template_directory_library' );
		$this->loader->add_action( 'init', $this, 'load_full_width_page_templates' );
		$this->loader->add_filter( 'obfx_template_dir_products',$this, 'add_page', 90 );
	}

	/**
	 * Enqueue the scripts for the dashboard page of the
	 */
	public function enqueue_template_dir_scripts() {
		$current_screen = get_current_screen();
		if ( $current_screen->id == 'orbit-fox_page_obfx_template_dir' ) {
			$script_handle = $this->slug . '-script';
			wp_enqueue_script( 'plugin-install' );
			wp_enqueue_script( 'updates' );
			wp_register_script( $script_handle, plugin_dir_url( $this->get_dir() ) . $this->slug . '/js/script.js', array( 'jquery' ), $this->version );
			wp_localize_script( $script_handle, 'importer_endpoint',
				array(
					'url'   => $this->get_endpoint_url( '/import_elementor' ),
					'nonce' => wp_create_nonce( 'wp_rest' ),
				) );
			wp_enqueue_script( $script_handle );
		}
	}

	/**
	 * Add the menu page.
	 *
	 * @param $products
	 *
	 * @return array
	 */
	public function add_page( $products ) {
		$sizzify = array(
			'obfx' => array(
				'directory_page_title' => __( 'Orbit Fox Template Directory', 'themeisle-companion' ),
				'parent_page_slug'     => 'obfx_companion',
				'page_slug'            => 'obfx_template_dir',
			)
		);
		return array_merge($products, $sizzify );
	}

	/**
	 *
	 *
	 * @param string $path
	 *
	 * @return string
	 */
	public function get_endpoint_url( $path = '' ) {
		return rest_url( $this->slug . $path );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}


	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		return array();
	}


	/**
	 * If the composer library is present let's try to init.
	 */
	public function load_full_width_page_templates() {
		if ( class_exists( '\ThemeIsle\FullWidthTemplates' ) ) {
			\ThemeIsle\FullWidthTemplates::instance();
		}
	}

	/**
	 * Call the Templates Directory library
	 */
	public function load_template_directory_library() {
		if ( class_exists( '\ThemeIsle\PageTemplatesDirectory' ) ) {
			\ThemeIsle\PageTemplatesDirectory::instance();
		}
	}

	/**
	 * By default the composer library "Full Width Page Templates" comes with two page templates: a blank one and a full
	 * width one with the header and footer inherited from the active theme.
	 * OBFX Template directory doesn't need the blonk one, so we are going to ditch it.
	 *
	 * @param array $list
	 *
	 * @return array
	 */
	public function filter_fwpt_templates_list( $list ){
		unset( $list['templates/builder-fullwidth.php'] );
		return $list;
	}
}
home/xbodynamge/namtation/wp-content/plugins/all-in-one-seo-pack/app/init/init.php000064400000002117151145062300024232 0ustar00<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! function_exists( 'aioseoMaybePluginIsDisabled' ) ) {
	/**
	 * Disable the AIOSEO if triggered externally.
	 *
	 * @since   4.1.5
	 * @version 4.5.0 Added the $file parameter and Lite check.
	 *
	 * @param  string $file The plugin file.
	 * @return bool         True if the plugin should be disabled.
	 */
	function aioseoMaybePluginIsDisabled( $file ) {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';
		if (
			'all-in-one-seo-pack/all_in_one_seo_pack.php' === plugin_basename( $file ) &&
			is_plugin_active( 'all-in-one-seo-pack-pro/all_in_one_seo_pack.php' )
		) {
			return true;
		}

		if ( ! defined( 'AIOSEO_DEV_VERSION' ) && ! isset( $_REQUEST['aioseo-dev'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
			return false;
		}

		if ( ! isset( $_REQUEST['aioseo-disable-plugin'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
			return false;
		}

		return true;
	}
}home/xbodynamge/lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/image-cdn/init.php000064400000031477151145424250030035 0ustar00<?php

/**
 * The Orbit Fox Image CDN Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Image_CDN_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Image_CDN_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Image_CDN_OBFX_Module extends Orbit_Fox_Module_Abstract {
	/**
	 * Dashboard related data.
	 *
	 * @var null|array Dashboard related data.
	 */
	protected $connect_data = null;
	/**
	 * @var \OrbitFox\Connector $connector Orbitfox Api connector.
	 */
	private $connector;

	/**
	 * Image_CDN_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		if ( isset( $_GET['loggedin'] ) && $_GET['loggedin'] == 'true' ) {
			$this->show = true;
		}
		$this->no_save     = true;
		$this->name        = sprintf( __( 'Image Optimization &amp; CDN Module', 'themeisle-companion' ).' <sup class="obfx-title-deprecated">DEPRECATED<sup>' );
		$this->description = sprintf( __( 'We are deprecating this module in favor of %sOptimole%s plugin for a more in depth integration and maintainability. You can safely disable this module and further use the dedicated plugin.', 'themeisle-companion' ), '<span class="dashicons dashicons-external"></span><a href="http://wordpress.org/plugins/optimole-wp"   target="_blank">', '</a>' );
		add_action( 'obfx_module_tile_after', [ $this, 'tryout' ], 10, 2 );
	}

	public function tryout( $slug = '', $active = false ) {
		if ( $slug !== 'image-cdn' ) {
			return;
		}
		if ( $active ) {
			return;
		}
		echo sprintf( __( '%sTest your site%s','themeisle-companion' ), '<span class="obfx-tryout-message"><a href="' . esc_url( sprintf( 'https://speedtest.optimole.com/?url=%s', get_site_url() ) ) . '" target="_blank">', '</a></span>' );
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		// Bail if we optimole already.
		if ( is_plugin_active( 'optimole-wp/optimole-wp.php' ) ) {
			return false;
		}
		return $this->is_replacer_enabled();
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Add top admin bar notice of traffic quota/usage.
	 *
	 * @param WP_Admin_Bar $wp_admin_bar Admin bar resource.
	 */
	public function add_traffic_node( $wp_admin_bar ) {
		if ( ! is_user_logged_in() ) {
			return;
		}
		$obfx_user_data = $this->get_api_data();
		$args           = array(
			'id'    => 'obfx_img_quota',
			'title' => 'OrbitFox' . __( ' Image Traffic', 'themeisle-companion' ) . ': ' .
			           number_format( floatval( (
			           isset( $obfx_user_data['image_cdn']['usage'] ) ? $obfx_user_data['image_cdn']['usage'] : 0 / 1000 ) ), 3 ) . ' / ' .
			           number_format( floatval( ( isset( $obfx_user_data['image_cdn']['quota'] ) ? $obfx_user_data['image_cdn']['quota'] : 0 / 1000 ) ), 0 ) . 'GB',
			'href'  => 'https://dashboard.orbitfox.com/',
			'meta'  => array( 'target' => '_blank' )
		);
		$wp_admin_bar->add_node( $args );

	}

	/**
	 * Return api data.
	 *
	 * @return mixed|string APi data.
	 */
	private function get_api_data() {

		if ( ! $this->get_is_active() ) {
			return '';
		}

		return class_exists( '\OrbitFox\Connector' ) ? get_option( \OrbitFox\Connector::API_DATA_KEY, '' ) : '';
	}

	/**
	 * Render data from dashboard of orbitfox.com.
	 */
	public function render_connect_data( $html ) {

		$obfx_user_data = $this->get_api_data();
		$class          = '';
		if ( ! empty( $obfx_user_data ) ) {
			$class = 'obfx-img-logged-in';
		}
		$display_name = isset( $obfx_user_data['display_name'] ) ? $obfx_user_data['display_name'] : '';
		$usage        = ( isset( $obfx_user_data['image_cdn'] ) && isset( $obfx_user_data['image_cdn']['usage'] ) ) ? $obfx_user_data['image_cdn']['usage'] : 0;
		$quota        = ( isset( $obfx_user_data['image_cdn'] ) && isset( $obfx_user_data['image_cdn']['quota'] ) ) ? $obfx_user_data['image_cdn']['quota'] : 0;
		$html         = '<div class="obfx-img-logged-in-data obfx-loggedin-show ' . $class . '" > ';
		$html         .= '<h5>' . __( 'Logged in as', 'themeisle-companion' ) . ' : <b id="obfx-img-display-name">' . esc_attr( $display_name ) . '</b></h5>';
		$html         .= '<p>' . __( 'Your private CDN url', 'themeisle-companion' ) . ' : <code id="obfx-img-cdn-url">' . $this->get_cdn_url() . '</code></p> ';
		$html         .= '<p>' . __( 'This month traffic usage', 'themeisle-companion' ) . ' : <code id="obfx-img-traffic-usage">' . number_format( floatval( ( $usage / 1000 ) ), 3 ) . ' GB</code>';
		$html         .= ' ' . __( 'Your traffic quota', 'themeisle-companion' ) . ' : <code class="obfx-img-traffic-quota">' . number_format( floatval( ( $quota / 1000 ) ), 3 ) . ' GB / month</code></p>';
		$html         .= '<p><i>' . __( 'You can use our image service and CDN in the limit of <span class="obfx-img-traffic-quota">', 'themeisle-companion' ) . number_format( floatval( ( $quota / 1000 ) ), 0 ) . '</span> per month.  </i></p>';
		$html         .= '</div>';

		return $html;
	}

	/**
	 * Get CDN private url.
	 *
	 * @return string Get CDN private url.
	 */
	private function get_cdn_url() {
		$obfx_user_data = $this->get_api_data();
		if ( empty( $obfx_user_data ) ) {
			return '';
		}
		if ( ! isset( $obfx_user_data['image_cdn']['key'] ) ) {
			return '';
		}

		return sprintf( '%s.i.optimole.com', strtolower( $obfx_user_data['image_cdn']['key'] ) );

	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		//Hack to allow binding of img module connect button as the view for the module options is loaded either if the module is active or not.

		//TODO Remove this when we have a way of loading module options async.
		if ( is_admin() ) {
			$this->hooks();
		}
		$obfx_user_data = $this->get_api_data();
		if ( empty( $obfx_user_data ) ) {
			$this->set_option( 'obfx_connect_api_key', '' );
			$this->set_option( 'enable_cdn_replacer', '0' );

		}
		$class = '';
		if ( ! empty( $obfx_user_data ) ) {
			$class = 'obfx-img-logged-in';
		}
		$fields   = array(
			array(
				'type'  => 'title',
				'name'  => 'Tooltip',
				'title' => sprintf( 'In order to get access to free image optimization service you will need an account on <a href="https://dashboard.orbitfox.com/register" target="_blank">orbitfox.com</a>. You will get access to our image optimization and CDN service for free in the limit of 1GB traffic per month.<br/> <i>Note: This is just a basic integration of the <a href="%s" target="_blank"> Optimole </a> service. For a more in-depth experience, try out the dedicated <a href="%s" target="_blank" >plugin</a>.</i>', 'https://optimole.com', 'http://wordpress.org/plugins/optimole-wp' )
			),
			array(
				'id'          => 'obfx_connect_api_key',
				'name'        => 'obfx_connect_api_key',
				'type'        => 'password',
				'default'     => isset( $obfx_user_data['api_key'] ) ? $obfx_user_data['api_key'] : '',
				'placeholder' => __( 'Your OrbitFox api key', 'themeisle-companion' ),
				'text'        => '<span class="dashicons dashicons-share"></span>' . __( 'Connect with Orbitfox', 'themeisle-companion' ),
			),
			array(
				'id'     => 'obfx-register-service',
				'type'   => 'link',
				'target' => '_blank',
				'class'  => 'obfx-loggedin-hide ' . $class,
				'url'    => 'https://dashboard.orbitfox.com/register',
				'text'   => ' Sign-Up for your API key',
				'name'   => 'obfx-register-service',
			),

		);
		$fields[] = array(
			'id'         => 'obfx_connect',
			'name'       => 'obfx_connect',
			'type'       => 'link',
			'url'        => '#',
			'class'      => 'obfx-loggedin-hide ' . $class,
			'link-class' => 'btn btn-success',
			'text'       => '<span class="dashicons dashicons-share"></span>' . __( 'Connect to OrbitFox service', 'themeisle-companion' ),
		);
		$fields[] = array(
			'type' => 'custom',
			'id'   => 'cdn_logged_in_data',
			'name' => 'cdn_logged_in_data',
		);
		$fields[] = array(
			'id'         => 'obfx_disconnect',
			'name'       => 'obfx_disconnect',
			'type'       => 'link',
			'class'      => 'obfx-loggedin-show ' . $class,
			'url'        => '#',
			'link-class' => 'btn btn-danger float-right  mb-10 obfx-img-logout ',
			'text'       => '<span class="dashicons dashicons-share"></span>' . __( 'Clear OrbitFox API key', 'themeisle-companion' ),
		);

		$fields[] = array(
			'id'      => 'enable_cdn_replacer',
			'title'   => '',
			'name'    => 'enable_cdn_replacer',
			'type'    => 'toggle',
			'class'   => ' obfx-img-cdn-replacer-switch obfx-loggedin-show ' . $class,
			'label'   => 'Serve all images optimised through OrbitFox CDN for a boost in speed.',
			'default' => '0',
		);

		return $fields;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		/**
		 * Init the connector object and load deps.
		 */
		require_once __DIR__ . '/inc/class-request.php';
		require_once __DIR__ . '/inc/class-orbit-fox-connector.php';
		add_filter( 'obfx_custom_control_cdn_logged_in_data', array( $this, 'render_connect_data' ) );
		$this->connector = \OrbitFox\Connector::instance();

		$this->loader->add_action( 'rest_api_init', $this, 'register_url_endpoints' );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'enable_cdn_replacer', '0' );
			$this->clear_api_data();
		}
		/**
		 * Load the image replacement logic if we are on the frontend,
		 * connected to the api and the replacement options is on.
		 */
		if ( ! is_admin() && $this->is_replacer_enabled() && $this->is_connected() ) {
			require_once __DIR__ . '/inc/class-orbit-fox-image-replacer.php';
			\OrbitFox\Image_CDN_Replacer::instance();
			$this->loader->add_filter( 'wp_resource_hints', $this, 'add_dns_prefetch', 10, 2 );

		}
		/**
		 * Adds top admin bar notice of traffic, if the module is connected.
		 */
		if ( $this->is_connected() ) {
			$this->loader->add_action( 'obfx_img_quota_sync', $this->connector, 'daily_check' );

			if ( ! wp_next_scheduled( 'obfx_img_quota_sync' ) ) {
				wp_schedule_event( time() + 10, 'daily', 'obfx_img_quota_sync', array() );
			}
			$this->loader->add_action( 'admin_bar_menu', $this, 'add_traffic_node', 9999 );
		}

	}

	/**
	 * Return api data.
	 *
	 * @return mixed|string APi data.
	 */
	private function clear_api_data() {


		return update_option( \OrbitFox\Connector::API_DATA_KEY, '' );
	}

	/**
	 * Check if the image replacement is enabled.
	 *
	 * @return bool Connection status.
	 */
	private function is_replacer_enabled() {
		if ( ! $this->get_is_active() ) {
			return false;
		}
		$enabled = $this->get_option( 'enable_cdn_replacer' );

		return boolval( $enabled );

	}

	/**
	 * Check if the module is connected to the api.
	 *
	 * @return bool Connection status.
	 */
	private function is_connected() {

		$obfx_user_data = $this->get_api_data();

		return ! empty( $obfx_user_data );

	}

	/**
	 * Adds cdn url for prefetch.
	 *
	 * @param array  $hints Hints array.
	 * @param string $relation_type Type of relation.
	 *
	 * @return array Altered hints array.
	 */
	public function add_dns_prefetch( $hints, $relation_type ) {
		if ( 'dns-prefetch' !== $relation_type ) {
			return $hints;
		}
		$cdn_url = $this->get_cdn_url();
		if ( empty( $cdn_url ) ) {
			return $hints;
		}
		$hints[] = sprintf( '//%s', $cdn_url );

		return $hints;
	}

	/**
	 * Update replacer callback.
	 */
	public function update_replacer( WP_REST_Request $request ) {
		$flag = $request->get_param( 'update_replacer' );
		$this->set_option( 'enable_cdn_replacer', $flag === 'yes' ? '1' : '0' );

		return new WP_REST_Response( 'Replacer updated' );
	}

	/**
	 * Register module rest methods.
	 */
	public function register_url_endpoints() {
		register_rest_route(
			'obfx', '/connector-url', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this->connector, 'rest_handle_connector_url' ),
				),
			)
		);
		register_rest_route(
			'obfx', '/update_replacer', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'update_replacer' ),
				),
			)
		);
	}

}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/init.php000064400000035336151145456220027534 0ustar00<?php
/**
 * ThemeIsle Companion Legacy Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Companion_Legacy_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Companion_Legacy_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Companion_Legacy_OBFX_Module extends Orbit_Fox_Module_Abstract {

	private $inc_dir;

	/**
	 * Companion_Legacy_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();

		$this->active_default = true;

		$this->inc_dir = $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR;
		if ( ! defined( 'THEMEISLE_COMPANION_PATH' ) ) {
			define( 'THEMEISLE_COMPANION_PATH', $this->inc_dir );
		}
		if ( ! defined( 'THEMEISLE_COMPANION_URL' ) ) {
			define( 'THEMEISLE_COMPANION_URL', plugin_dir_url( $this->inc_dir ) );
		}
		$theme_name = '';
		if ( $this->is_zerif() ) {
			$theme_name = 'Zerif';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-focus.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-testimonial.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-clients.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-team.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'functions.php';
		}

		if ( $this->is_rhea() ) {
			$theme_name = 'Rhea';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'features.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'about.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'hours.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'contact.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'progress-bar.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'icon-box.widget.php';
		}

		if ( $this->is_hestia() ) {
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'functions.php';
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php';
			$theme_name = 'Hestia';

		}

		if ( $this->is_hestia_pro() ) {
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php';
			$theme_name = 'Hestia Pro';

		}
		if( $this->is_shop_isle() ) {
			$theme_name = 'Shop Isle';
		}

		if ( $this->is_azera_shop() ) {
			$theme_name = 'Azera Shop';
		}

		if ( $this->is_llorix_one_lite() ) {
			$theme_name = 'Llorix One Lite';
		}

		$this->name        = sprintf( __( '%s enhancements ', 'themeisle-companion' ), $theme_name );
		$this->description = sprintf( __( 'Module containing frontpage improvements for %s theme.', 'themeisle-companion' ), $theme_name );
	}

	private function is_zerif() {
		if ( $this->get_active_theme_dir() == 'zerif-lite' ) {
			return true;
		}

		return false;
	}

	private function is_rhea() {
		if ( $this->get_active_theme_dir( true ) == 'rhea' ) {
			return true;
		}

		return false;
	}

	private function is_hestia() {
		if ( $this->get_active_theme_dir() == 'hestia' ) {
			return true;
		}

		return false;
	}

	private function is_hestia_pro(){
		if ( $this->get_active_theme_dir() == 'hestia-pro' ) {
			return true;
		}

		return false;
	}

	private function is_shop_isle() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if( is_plugin_active( 'shop-isle-companion/shop-isle-companion.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'shop-isle' ) {
			return true;
		}

		return false;
	}

	private function is_azera_shop() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if ( is_plugin_active( 'azera-shop-companion/azera-shop-companion.php' ) ) {
			return false;
		}
		if ( is_plugin_active( 'azera-shop-plus/azera-shop-plus.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'azera-shop' ) {
			return true;
		}

		return false;
	}

	private function is_llorix_one_lite() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if ( is_plugin_active( 'llorix-one-companion/llorix-one-companion.php' ) ) {
			return false;
		}
		if ( is_plugin_active( 'llorix-one-plus/llorix_one_plus.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'llorix-one-lite' ) {
			return true;
		}

		return false;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		if ( $this->is_hestia() || $this->is_rhea() || $this->is_zerif() || $this->is_hestia_pro() || $this->is_shop_isle() || $this->is_azera_shop() || $this->is_llorix_one_lite() ) {
			return true;
		} else {
			return false;
		}
	}

	public function zerif_register_widgets() {
		register_widget( 'zerif_ourfocus' );
		register_widget( 'zerif_testimonial_widget' );
		register_widget( 'zerif_clients_widget' );
		register_widget( 'zerif_team_widget' );

		$themeisle_companion_flag = get_option( 'themeisle_companion_flag' );
		if ( empty( $themeisle_companion_flag ) && function_exists( 'themeisle_populate_with_default_widgets' ) ) {
			themeisle_populate_with_default_widgets();
		}
	}

	public function rhea_register_widgets() {
		register_widget( 'rhea_features_block' );
		register_widget( 'Rhea_Progress_Bar' );
		register_widget( 'Rhea_Icon_Box' );
		register_widget( 'Rhea_About_Company' );
		register_widget( 'Rhea_Hours' );
		register_widget( 'Rhea_Contact_Company' );
	}

	function rhea_load_custom_wp_admin_style() {
		wp_enqueue_style( 'fontawesome-style', get_template_directory_uri() . '/css/font-awesome.min.css' );
		wp_enqueue_style( 'rhea-admin-style', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/css/admin-style.css' );
		wp_enqueue_script( 'fontawesome-icons', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/js/icons.js', false, '1.0.0' );
		wp_enqueue_script( 'jquery-ui-dialog' );
		wp_enqueue_script( 'fontawesome-script', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/js/fontawesome.jquery.js', false, '1.0.0' );
	}

	public function rhea_add_html_to_admin_footer() {
		$output = '
        <div id="fontawesome-popup">
            <div class="left-side">
                <label for="fontawesome-live-search">' . esc_html_e( 'Search icon', 'themeisle-companion' ) . ':</label>
                <ul class="filter-icons">
                    <li data-filter="all" class="active">' . esc_html_e( 'All Icons', 'themeisle-companion' ) . '</li>
                </ul>
            </div>
            <div class="right-side">
            </div>
        </div>
        ';

		echo $output;
	}

	/**
	 * Function to import customizer big title settings into first slide.
	 */
	public function shop_isle_get_wporg_options() {
		/* import shop isle options */
		$shop_isle_mods = get_option('theme_mods_shop-isle');

		if (!empty($shop_isle_mods)) {

			$new_slider = new stdClass();

			foreach ($shop_isle_mods as $shop_isle_mod_k => $shop_isle_mod_v) {

				/* migrate Big title section to Slider section */
				if (($shop_isle_mod_k == 'shop_isle_big_title_image') || ($shop_isle_mod_k == 'shop_isle_big_title_title') || ($shop_isle_mod_k == 'shop_isle_big_title_subtitle') || ($shop_isle_mod_k == 'shop_isle_big_title_button_label') || ($shop_isle_mod_k == 'shop_isle_big_title_button_link')) {

					if ($shop_isle_mod_k == 'shop_isle_big_title_image') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->image_url = $shop_isle_mod_v;
						} else {
							$new_slider->image_url = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_title') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->text = $shop_isle_mod_v;
						} else {
							$new_slider->text = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_subtitle') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->subtext = $shop_isle_mod_v;
						} else {
							$new_slider->subtext = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_button_label') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->label = $shop_isle_mod_v;
						} else {
							$new_slider->label = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_button_link') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->link = $shop_isle_mod_v;
						} else {
							$new_slider->link = '';
						}
					}

					if ( !empty($new_slider->image_url) || !empty($new_slider->text) || !empty($new_slider->subtext) || !empty($new_slider->link) ) {
						$new_slider_encode = json_encode(array($new_slider));
						set_theme_mod('shop_isle_slider', $new_slider_encode);
					}

				} else {

					set_theme_mod($shop_isle_mod_k, $shop_isle_mod_v);
				}
			}
		}

	}

	/**
	 * Wrapper method for themeisle_hestia_require function call.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hestia_require() {
		themeisle_hestia_require();
	}

	/**
	 * Wrapper method for themeisle_hestia_fix_duplicate_widgets function call.
	 *
	 * @since 2.4.5
	 * @access  public
	 */
	public function hestia_fix_duplicate_widgets(){
		themeisle_hestia_fix_duplicate_widgets();
	}

	/**
	 * Wrapper method for themeisle_hestia_clients_default_content function call.
	 *
	 * @since   2.1.1
	 * @access  public
	 */
	public function hestia_load_clients_default_content(){
		return themeisle_hestia_clients_default_content();
	}

	/**
	 * Wrapper method for themeisle_hestia_enqueue_clients_style function call.
	 *
	 * @access  public
	 */
	public function hestia_enqueue_clients_style(){
		themeisle_hestia_enqueue_clients_style();
	}

	/**
	 * Wrapper method for themeisle_hestia_top_bar_default_alignment function call.
	 * 
	 * @since   2.1.1
	 * @access  public
	 */
	public function hestia_top_bar_default_alignment(){
		return themeisle_hestia_top_bar_default_alignment();
	}

	/**
	 * Wrapper method for themeisle_hestia_load_controls function call.
	 *
	 * @since   2.0.4
	 * @access  public
	 */
	public function hestia_require_customizer() {
		themeisle_hestia_load_controls();
	}

	/**
	 * Wrapper method for themeisle_hestia_set_frontpage function call.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hestia_set_front_page() {
		themeisle_hestia_set_frontpage();
	}

	/**
	 * Wrapper method for Azera Shop Companion styles
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function azera_shop_companion_register_plugin_styles() {
		azera_shop_companion_register_plugin_styles();
	}

	/**
	 * Wrapper method for Azera Shop Companion sections
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function azera_shop_companion_load_sections() {
		azera_shop_companion_load_sections();
	}

	/**
	 * Wrapper method for Llorix One Companion styles
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function llorix_one_companion_register_plugin_styles() {
		llorix_one_companion_register_plugin_styles();
	}

	/**
	 * Wrapper method for Llorix One Companion sections
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function llorix_one_companion_load_sections() {
		llorix_one_companion_load_sections();
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		define( 'THEMEISLE_COMPANION_VERSION', '2.0.0' );
		if ( $this->is_zerif() ) {
			$this->loader->add_action( 'widgets_init', $this, 'zerif_register_widgets' );
		}

		if ( $this->is_rhea() ) {
			$this->loader->add_action( 'widgets_init', $this, 'rhea_register_widgets' );
			$this->loader->add_action( 'admin_enqueue_scripts', $this, 'rhea_load_custom_wp_admin_style' );
			$this->loader->add_action( 'admin_footer', $this, 'rhea_add_html_to_admin_footer' );
			$this->loader->add_action( 'customize_controls_print_footer_scripts', $this, 'rhea_add_html_to_admin_footer' );
		}

		if ( $this->is_hestia() ) {
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_require' );
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' );
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'hestia_enqueue_clients_style' );
			$this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' );
			$this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' );
			$this->loader->add_action( 'customize_register', $this, 'hestia_require_customizer', 0 );
			$this->loader->add_action( 'after_switch_theme', $this, 'hestia_set_front_page' );
		}

		if ( $this->is_hestia_pro() ) {
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' );
			$this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' );
			$this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' );
		}

		if( $this->is_shop_isle() ) {
			require_once $this->inc_dir . 'shop-isle' . DIRECTORY_SEPARATOR . 'functions.php';
		}

		if ( $this->is_azera_shop() ) {
			require_once  $this->inc_dir . 'azera-shop' . DIRECTORY_SEPARATOR . 'functions.php';
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'azera_shop_companion_register_plugin_styles' );
			$this->loader->add_action( 'plugins_loaded', $this, 'azera_shop_companion_load_sections' );
		}

		if ( $this->is_llorix_one_lite() ) {
			require_once  $this->inc_dir . 'llorix-one-companion' . DIRECTORY_SEPARATOR . 'functions.php';
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'llorix_one_companion_register_plugin_styles' );
			$this->loader->add_action( 'plugins_loaded', $this, 'llorix_one_companion_load_sections' );
		}
	}

	/**
	 * Import mods if is shop isle.
	 */
	public function activate() {
		if( $this->is_shop_isle() ) {
			$this->shop_isle_get_wporg_options();
		}
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}
}
xbodynamge/lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/beaver-widgets/init.php000064400000005427151145461070031037 0ustar00home<?php
/**
 * Beaver Builder modules Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      2.2.5
 */

define( 'BEAVER_WIDGETS_PATH', plugin_dir_path( __FILE__ ) );
define( 'BEAVER_WIDGETS_URL', plugins_url( '/', __FILE__ ) );

/**
 * Class Beaver_Widgets_OBFX_Module
 */
class Beaver_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Beaver_Widgets_OBFX_Module constructor.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active('bb-plugin/fl-builder.php');
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'init', $this, 'load_widgets_modules' );
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Require Beaver Builder modules
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load_widgets_modules(){
		if ( class_exists( 'FLBuilder' ) ) {
			require_once 'modules/pricing-table/pricing-table.php';
			require_once 'modules/services/services.php';
			require_once 'modules/post-grid/post-grid.php';
		}
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {
		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}
}home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/beaver-widgets/init.php000064400000005427151145466670027227 0ustar00<?php
/**
 * Beaver Builder modules Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      2.2.5
 */

define( 'BEAVER_WIDGETS_PATH', plugin_dir_path( __FILE__ ) );
define( 'BEAVER_WIDGETS_URL', plugins_url( '/', __FILE__ ) );

/**
 * Class Beaver_Widgets_OBFX_Module
 */
class Beaver_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Beaver_Widgets_OBFX_Module constructor.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active('bb-plugin/fl-builder.php');
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'init', $this, 'load_widgets_modules' );
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Require Beaver Builder modules
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load_widgets_modules(){
		if ( class_exists( 'FLBuilder' ) ) {
			require_once 'modules/pricing-table/pricing-table.php';
			require_once 'modules/services/services.php';
			require_once 'modules/post-grid/post-grid.php';
		}
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {
		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}
}home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/image-cdn/init.php000064400000030700151146355410026121 0ustar00<?php

/**
 * The Orbit Fox Image CDN Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Image_CDN_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Image_CDN_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Image_CDN_OBFX_Module extends Orbit_Fox_Module_Abstract {
	/**
	 * Dashboard related data.
	 *
	 * @var null|array Dashboard related data.
	 */
	protected $connect_data = null;
	/**
	 * @var \OrbitFox\Connector $connector Orbitfox Api connector.
	 */
	private $connector;

	/**
	 * Image_CDN_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		if ( isset( $_GET['loggedin'] ) && $_GET['loggedin'] == 'true' ) {
			$this->show = true;
		}
		$this->no_save     = true;
		$this->name        = sprintf( __( 'Image Optimization &amp; CDN Module <sup class="obfx-title-new">NEW</sup>', 'themeisle-companion' ) );
		$this->description = sprintf( __( 'Let us take care of your images sizes. With this feature we\'ll compress and resize every image on your website. <i>This service is powered by <b>%sOptimole%s</b></i>. <br/> <strong>* Requires account on orbitfox.com</strong>', 'themeisle-companion' ), '<a href="https://optimole.com" class="obfx-no-link" target="_blank">', '</a>' );
		add_action( 'obfx_module_tile_after', [ $this, 'tryout' ], 10, 2 );
	}

	public function tryout( $slug = '', $active = false ) {
		if ( $slug !== 'image-cdn' ) {
			return;
		}
		if ( $active ) {
			return;
		}
		echo sprintf( __( '%sTest your site%s','themeisle-companion' ), '<span class="obfx-tryout-message"><a href="' . esc_url( sprintf( 'https://speedtest.optimole.com/?url=%s', get_site_url() ) ) . '" target="_blank">', '</a></span>' );
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Add top admin bar notice of traffic quota/usage.
	 *
	 * @param WP_Admin_Bar $wp_admin_bar Admin bar resource.
	 */
	public function add_traffic_node( $wp_admin_bar ) {
		if ( ! is_user_logged_in() ) {
			return;
		}
		$obfx_user_data = $this->get_api_data();
		$args           = array(
			'id'    => 'obfx_img_quota',
			'title' => 'OrbitFox' . __( ' Image Traffic', 'themeisle-companion' ) . ': ' . number_format( floatval( ( $obfx_user_data['image_cdn']['usage'] / 1000 ) ), 3 ) . ' / ' . number_format( floatval( ( $obfx_user_data['image_cdn']['quota'] / 1000 ) ), 0 ) . 'GB',
			'href'  => 'https://dashboard.orbitfox.com/',
			'meta'  => array( 'target' => '_blank' )
		);
		$wp_admin_bar->add_node( $args );

	}

	/**
	 * Return api data.
	 *
	 * @return mixed|string APi data.
	 */
	private function get_api_data() {

		if ( ! $this->get_is_active() ) {
			return '';
		}

		return class_exists( '\OrbitFox\Connector' ) ? get_option( \OrbitFox\Connector::API_DATA_KEY, '' ) : '';
	}

	/**
	 * Render data from dashboard of orbitfox.com.
	 */
	public function render_connect_data( $html ) {

		$obfx_user_data = $this->get_api_data();
		$class          = '';
		if ( ! empty( $obfx_user_data ) ) {
			$class = 'obfx-img-logged-in';
		}
		$display_name = isset( $obfx_user_data['display_name'] ) ? $obfx_user_data['display_name'] : '';
		$usage        = ( isset( $obfx_user_data['image_cdn'] ) && isset( $obfx_user_data['image_cdn']['usage'] ) ) ? $obfx_user_data['image_cdn']['usage'] : 0;
		$quota        = ( isset( $obfx_user_data['image_cdn'] ) && isset( $obfx_user_data['image_cdn']['quota'] ) ) ? $obfx_user_data['image_cdn']['quota'] : 0;
		$html         = '<div class="obfx-img-logged-in-data obfx-loggedin-show ' . $class . '" > ';
		$html         .= '<h5>' . __( 'Logged in as', 'themeisle-companion' ) . ' : <b id="obfx-img-display-name">' . esc_attr( $display_name ) . '</b></h5>';
		$html         .= '<p>' . __( 'Your private CDN url', 'themeisle-companion' ) . ' : <code id="obfx-img-cdn-url">' . $this->get_cdn_url() . '</code></p> ';
		$html         .= '<p>' . __( 'This month traffic usage', 'themeisle-companion' ) . ' : <code id="obfx-img-traffic-usage">' . number_format( floatval( ( $usage / 1000 ) ), 3 ) . ' GB</code>';
		$html         .= ' ' . __( 'Your traffic quota', 'themeisle-companion' ) . ' : <code class="obfx-img-traffic-quota">' . number_format( floatval( ( $quota / 1000 ) ), 3 ) . ' GB / month</code></p>';
		$html         .= '<p><i>' . __( 'You can use our image service and CDN in the limit of <span class="obfx-img-traffic-quota">', 'themeisle-companion' ) . number_format( floatval( ( $quota / 1000 ) ), 0 ) . '</span> per month.  </i></p>';
		$html         .= '</div>';

		return $html;
	}

	/**
	 * Get CDN private url.
	 *
	 * @return string Get CDN private url.
	 */
	private function get_cdn_url() {
		$obfx_user_data = $this->get_api_data();
		if ( empty( $obfx_user_data ) ) {
			return '';
		}
		if ( ! isset( $obfx_user_data['image_cdn']['key'] ) ) {
			return '';
		}

		return sprintf( '%s.i.optimole.com', strtolower( $obfx_user_data['image_cdn']['key'] ) );

	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		//Hack to allow binding of img module connect button as the view for the module options is loaded either if the module is active or not.

		//TODO Remove this when we have a way of loading module options async.
		if ( is_admin() ) {
			$this->hooks();
		}
		$obfx_user_data = $this->get_api_data();
		if ( empty( $obfx_user_data ) ) {
			$this->set_option( 'obfx_connect_api_key', '' );
			$this->set_option( 'enable_cdn_replacer', '0' );

		}
		$class = '';
		if ( ! empty( $obfx_user_data ) ) {
			$class = 'obfx-img-logged-in';
		}
		$fields   = array(
			array(
				'type'  => 'title',
				'name'  => 'Tooltip',
				'title' => sprintf( 'In order to get access to free image optimization service you will need an account on <a href="https://dashboard.orbitfox.com/register" target="_blank">orbitfox.com</a>. You will get access to our image optimization and CDN service for free in the limit of 1GB traffic per month.<br/> <i>Note: This is just a basic integration of the <a href="%s" target="_blank"> Optimole </a> service. For a more in-depth experience, try out the dedicated <a href="%s" target="_blank" >plugin</a>.</i>', 'https://optimole.com', 'http://wordpress.org/plugins/optimole-wp' )
			),
			array(
				'id'          => 'obfx_connect_api_key',
				'name'        => 'obfx_connect_api_key',
				'type'        => 'password',
				'default'     => isset( $obfx_user_data['api_key'] ) ? $obfx_user_data['api_key'] : '',
				'placeholder' => __( 'Your OrbitFox api key', 'themeisle-companion' ),
				'text'        => '<span class="dashicons dashicons-share"></span>' . __( 'Connect with Orbitfox', 'themeisle-companion' ),
			),
			array(
				'id'     => 'obfx-register-service',
				'type'   => 'link',
				'target' => '_blank',
				'class'  => 'obfx-loggedin-hide ' . $class,
				'url'    => 'https://dashboard.orbitfox.com/register',
				'text'   => ' Sign-Up for your API key',
				'name'   => 'obfx-register-service',
			),

		);
		$fields[] = array(
			'id'         => 'obfx_connect',
			'name'       => 'obfx_connect',
			'type'       => 'link',
			'url'        => '#',
			'class'      => 'obfx-loggedin-hide ' . $class,
			'link-class' => 'btn btn-success',
			'text'       => '<span class="dashicons dashicons-share"></span>' . __( 'Connect to OrbitFox service', 'themeisle-companion' ),
		);
		$fields[] = array(
			'type' => 'custom',
			'id'   => 'cdn_logged_in_data',
			'name' => 'cdn_logged_in_data',
		);
		$fields[] = array(
			'id'         => 'obfx_disconnect',
			'name'       => 'obfx_disconnect',
			'type'       => 'link',
			'class'      => 'obfx-loggedin-show ' . $class,
			'url'        => '#',
			'link-class' => 'btn btn-danger float-right  mb-10 obfx-img-logout ',
			'text'       => '<span class="dashicons dashicons-share"></span>' . __( 'Clear OrbitFox API key', 'themeisle-companion' ),
		);

		$fields[] = array(
			'id'      => 'enable_cdn_replacer',
			'title'   => '',
			'name'    => 'enable_cdn_replacer',
			'type'    => 'toggle',
			'class'   => ' obfx-img-cdn-replacer-switch obfx-loggedin-show ' . $class,
			'label'   => 'Serve all images optimised through OrbitFox CDN for a boost in speed.',
			'default' => '0',
		);

		return $fields;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		/**
		 * Init the connector object and load deps.
		 */
		require_once __DIR__ . '/inc/class-request.php';
		require_once __DIR__ . '/inc/class-orbit-fox-connector.php';
		add_filter( 'obfx_custom_control_cdn_logged_in_data', array( $this, 'render_connect_data' ) );
		$this->connector = \OrbitFox\Connector::instance();

		$this->loader->add_action( 'rest_api_init', $this, 'register_url_endpoints' );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'enable_cdn_replacer', '0' );
			$this->clear_api_data();
		}
		/**
		 * Load the image replacement logic if we are on the frontend,
		 * connected to the api and the replacement options is on.
		 */
		if ( ! is_admin() && $this->is_replacer_enabled() && $this->is_connected() ) {
			require_once __DIR__ . '/inc/class-orbit-fox-image-replacer.php';
			\OrbitFox\Image_CDN_Replacer::instance();
			$this->loader->add_filter( 'wp_resource_hints', $this, 'add_dns_prefetch', 10, 2 );

		}
		/**
		 * Adds top admin bar notice of traffic, if the module is connected.
		 */
		if ( $this->is_connected() ) {
			$this->loader->add_action( 'obfx_img_quota_sync', $this->connector, 'daily_check' );

			if ( ! wp_next_scheduled( 'obfx_img_quota_sync' ) ) {
				wp_schedule_event( time() + 10, 'daily', 'obfx_img_quota_sync', array() );
			}
			$this->loader->add_action( 'admin_bar_menu', $this, 'add_traffic_node', 9999 );
		}

	}

	/**
	 * Return api data.
	 *
	 * @return mixed|string APi data.
	 */
	private function clear_api_data() {


		return update_option( \OrbitFox\Connector::API_DATA_KEY, '' );
	}

	/**
	 * Check if the image replacement is enabled.
	 *
	 * @return bool Connection status.
	 */
	private function is_replacer_enabled() {
		if ( ! $this->get_is_active() ) {
			return false;
		}
		$enabled = $this->get_option( 'enable_cdn_replacer' );

		return boolval( $enabled );

	}

	/**
	 * Check if the module is connected to the api.
	 *
	 * @return bool Connection status.
	 */
	private function is_connected() {

		$obfx_user_data = $this->get_api_data();

		return ! empty( $obfx_user_data );

	}

	/**
	 * Adds cdn url for prefetch.
	 *
	 * @param array  $hints Hints array.
	 * @param string $relation_type Type of relation.
	 *
	 * @return array Altered hints array.
	 */
	public function add_dns_prefetch( $hints, $relation_type ) {
		if ( 'dns-prefetch' !== $relation_type ) {
			return $hints;
		}
		$cdn_url = $this->get_cdn_url();
		if ( empty( $cdn_url ) ) {
			return $hints;
		}
		$hints[] = sprintf( '//%s', $cdn_url );

		return $hints;
	}

	/**
	 * Update replacer callback.
	 */
	public function update_replacer( WP_REST_Request $request ) {
		$flag = $request->get_param( 'update_replacer' );
		$this->set_option( 'enable_cdn_replacer', $flag === 'yes' ? '1' : '0' );

		return new WP_REST_Response( 'Replacer updated' );
	}

	/**
	 * Register module rest methods.
	 */
	public function register_url_endpoints() {
		register_rest_route(
			'obfx', '/connector-url', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this->connector, 'rest_handle_connector_url' ),
				),
			)
		);
		register_rest_route(
			'obfx', '/update_replacer', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'update_replacer' ),
				),
			)
		);
	}

}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/elementor-widgets/init.php000064400000005504151146363500027736 0ustar00<?php
/**
 * Elementor Widgets Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Elementor_Widgets_OBFX_Module
 */

define( 'OBFX_MODULE_URL', __FILE__ );

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Elementor_Widgets_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Elementor_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Elementor_Widgets_OBFX_Module  constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'elementor/elementor.php' );
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed | array
	 */
	public function hooks() {
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
		$this->loader->add_action( 'plugins_loaded', $this, 'load_elementor_extra_widgets' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$options = array();

		return $options;
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {

		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}

	/**
	 * Call the ElementorExtraWidgets Library which will register its own actions.
	 */
	public function load_elementor_extra_widgets() {
		if ( class_exists( '\ThemeIsle\ElementorExtraWidgets' ) ) {
			\ThemeIsle\ElementorExtraWidgets::instance();
		}
	}

}home/xbodynamge/dev/wp-content/plugins/all-in-one-seo-pack/app/init/init.php000064400000002117151147501460023025 0ustar00<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! function_exists( 'aioseoMaybePluginIsDisabled' ) ) {
	/**
	 * Disable the AIOSEO if triggered externally.
	 *
	 * @since   4.1.5
	 * @version 4.5.0 Added the $file parameter and Lite check.
	 *
	 * @param  string $file The plugin file.
	 * @return bool         True if the plugin should be disabled.
	 */
	function aioseoMaybePluginIsDisabled( $file ) {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';
		if (
			'all-in-one-seo-pack/all_in_one_seo_pack.php' === plugin_basename( $file ) &&
			is_plugin_active( 'all-in-one-seo-pack-pro/all_in_one_seo_pack.php' )
		) {
			return true;
		}

		if ( ! defined( 'AIOSEO_DEV_VERSION' ) && ! isset( $_REQUEST['aioseo-dev'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
			return false;
		}

		if ( ! isset( $_REQUEST['aioseo-disable-plugin'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
			return false;
		}

		return true;
	}
}home/xbodynamge/lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/menu-icons/init.php000064400000027374151150024050030255 0ustar00<?php
/**
 * The module for menu icons.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Menu_Icons_OBFX_Module
 */

/**
 * The class for menu icons.
 *
 * @package    Menu_Icons_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Menu_Icons_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * The default icon to use.
	 */
	const DEFAULT_ICON	= 'dashicons-obfx-default-icon';

	/**
	 * Menu_Icons_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Menu Icons', 'themeisle-companion' );
		$this->description = __( 'Module to define menu icons for navigation.', 'themeisle-companion' );
		$this->active_default = true;

		add_action( 'admin_init', array( $this, 'check_conflict' ) , 99 );
	}


	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'wp_update_nav_menu_item', $this, 'save_fields', 10, 3 );
		// Do not change the priority of this from 1.
		$this->loader->add_filter( 'wp_edit_nav_menu_walker', $this, 'custom_walker', 1 );
		$this->loader->add_filter( 'wp_setup_nav_menu_item', $this, 'show_menu', 10, 1 );

	}

	/**
	 * Show the menu item.
	 *
	 * @access  public
	 * @return WP_Post $menu the menu object.
	 */
	public function show_menu( $menu ) {
		$icon	= get_post_meta( $menu->ID, 'obfx_menu_icon', true );
		if ( ! empty( $icon ) ) {
			$menu->icon = $icon;
			if ( ! is_admin() ) {
				// usually, icons are of the format fa-x or dashicons-x and when displayed they are displayed with classes 'fa fa-x' or 'dashicons dashicons-x'.
				// so let's determine the prefix class.
				$array			= explode( '-', $icon );
				$prefix			= reset( $array );
				$prefix			= apply_filters( 'obfx_menu_icons_icon_class', $prefix, $icon );
				$menu->title	= sprintf( '<i class="obfx-menu-icon %s %s"></i>%s', $prefix, $icon, $menu->title );
			}
		}
		return $menu;
	}

	/**
	 * Return the custom walker.
	 *
	 * @access  public
	 * @return Walker_Nav_Menu_Edit $walker the walker.
	 */
	public function custom_walker( $walker ) {
		if ( ! class_exists( 'Menu_Icons_OBFX_Walker' ) ) {
			require_once $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class-menu-icons-obfx-walker.php';
		}
		$walker = 'Menu_Icons_OBFX_Walker';
		return $walker;
	}

	/**
	 * Check if font awesome should load.
	 *
	 * @return bool
	 */
	private function should_load_fa(){

		// Get all locations
		$locations = get_nav_menu_locations();

		if( empty( $locations ) ){
			return false;
		}
		foreach ( $locations as $location => $menu_id ){
			$menu_items = wp_get_nav_menu_items( $menu_id );
			if ( ! is_array( $menu_items ) ) {
				continue;
			}
			foreach ( $menu_items as $menu_item ) {
				$icon = get_post_meta( $menu_item->ID, 'obfx_menu_icon', true );
				if ( !empty( $icon ) ){
					return true;
				}
			}
		}

		return false;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		if( $this->should_load_fa() === false ){
			return array();
		}

		return array(
			'css' => array(
				'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' => array( 'dashicons' ),
				'public' => false,
			),
		);
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( $current_screen->id != 'nav-menus' ) {
			return array();
		}

		// Our walker has not been registered because another custom walker exists.
		if ( ! class_exists( 'Menu_Icons_OBFX_Walker' ) ) {
			return array();
		}

		$this->localized	= array(
			'admin'		=> array(
				'icons'	=> apply_filters( 'obfx_menu_icons_icon_list', $this->get_dashicons() ),
				'icon_default' => self::DEFAULT_ICON,
				'i10n' => array(
					'powered_by' => sprintf( __( 'Powered by %s plugin', 'themeisle-companion' ), '<b>' . apply_filters( 'themeisle_companion_friendly_name', '' ) . '</b>' ),
				),
			),
		);

		$font_awesome = array(
			'vendor/font-awesome.min' => false,
			'vendor/fontawesome-iconpicker.min' => array( 'vendor/font-awesome.min' ),
		);
		if ( wp_style_is( 'font-awesome', 'registered' ) || wp_style_is( 'font-awesome', 'enqueued' ) ) {
			$font_awesome = array(
				'vendor/fontawesome-iconpicker.min' => array( 'font-awesome' ),
			);
		}

		return array(
			'css' => array_merge(
				$font_awesome,
				array(
					'admin' => array( 'vendor/fontawesome-iconpicker.min' ),
				)
			),
			'js' => array(
				'vendor/bootstrap.min' => array( 'jquery' ),
				'vendor/fontawesome-iconpicker.min' => array( 'vendor/bootstrap.min' ),
				'admin' => array( 'vendor/fontawesome-iconpicker.min', 'jquery' ),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Return all the dashicons.
	 *
	 * @access  private
	 * @return array
	 */
	private function get_dashicons() {
		return array( 'dashicons-menu', 'dashicons-admin-site', 'dashicons-dashboard', 'dashicons-admin-post', 'dashicons-admin-media', 'dashicons-admin-links', 'dashicons-admin-page', 'dashicons-admin-comments', 'dashicons-admin-appearance', 'dashicons-admin-plugins', 'dashicons-admin-users', 'dashicons-admin-tools', 'dashicons-admin-settings', 'dashicons-admin-network', 'dashicons-admin-home', 'dashicons-admin-generic', 'dashicons-admin-collapse', 'dashicons-welcome-write-blog', 'dashicons-welcome-add-page', 'dashicons-welcome-view-site', 'dashicons-welcome-widgets-menus', 'dashicons-welcome-comments', 'dashicons-welcome-learn-more', 'dashicons-format-aside', 'dashicons-format-image', 'dashicons-format-gallery', 'dashicons-format-video', 'dashicons-format-status', 'dashicons-format-quote', 'dashicons-format-chat', 'dashicons-format-audio', 'dashicons-camera', 'dashicons-images-alt', 'dashicons-images-alt2', 'dashicons-video-alt', 'dashicons-video-alt2', 'dashicons-video-alt3', 'dashicons-image-crop', 'dashicons-image-rotate-left', 'dashicons-image-rotate-right', 'dashicons-image-flip-vertical', 'dashicons-image-flip-horizontal', 'dashicons-undo', 'dashicons-redo', 'dashicons-editor-bold', 'dashicons-editor-italic', 'dashicons-editor-ul', 'dashicons-editor-ol', 'dashicons-editor-quote', 'dashicons-editor-alignleft', 'dashicons-editor-aligncenter', 'dashicons-editor-alignright', 'dashicons-editor-insertmore', 'dashicons-editor-spellcheck', 'dashicons-editor-distractionfree', 'dashicons-editor-kitchensink', 'dashicons-editor-underline', 'dashicons-editor-justify', 'dashicons-editor-textcolor', 'dashicons-editor-paste-word', 'dashicons-editor-paste-text', 'dashicons-editor-removeformatting', 'dashicons-editor-video', 'dashicons-editor-customchar', 'dashicons-editor-outdent', 'dashicons-editor-indent', 'dashicons-editor-help', 'dashicons-editor-strikethrough', 'dashicons-editor-unlink', 'dashicons-editor-rtl', 'dashicons-align-left', 'dashicons-align-right', 'dashicons-align-center', 'dashicons-align-none', 'dashicons-lock', 'dashicons-calendar', 'dashicons-visibility', 'dashicons-post-status', 'dashicons-edit', 'dashicons-trash', 'dashicons-arrow-up', 'dashicons-arrow-down', 'dashicons-arrow-right', 'dashicons-arrow-left', 'dashicons-arrow-up-alt', 'dashicons-arrow-down-alt', 'dashicons-arrow-right-alt', 'dashicons-arrow-left-alt', 'dashicons-arrow-up-alt2', 'dashicons-arrow-down-alt2', 'dashicons-arrow-right-alt2', 'dashicons-arrow-left-alt2', 'dashicons-sort', 'dashicons-leftright', 'dashicons-list-view', 'dashicons-exerpt-view', 'dashicons-share', 'dashicons-share-alt', 'dashicons-share-alt2', 'dashicons-twitter', 'dashicons-rss', 'dashicons-email', 'dashicons-email-alt', 'dashicons-facebook', 'dashicons-facebook-alt', 'dashicons-googleplus', 'dashicons-networking', 'dashicons-hammer', 'dashicons-art', 'dashicons-migrate', 'dashicons-performance', 'dashicons-wordpress', 'dashicons-wordpress-alt', 'dashicons-pressthis', 'dashicons-update', 'dashicons-screenoptions', 'dashicons-info', 'dashicons-cart', 'dashicons-feedback', 'dashicons-cloud', 'dashicons-translation', 'dashicons-tag', 'dashicons-category', 'dashicons-yes', 'dashicons-no', 'dashicons-no-alt', 'dashicons-plus', 'dashicons-minus', 'dashicons-dismiss', 'dashicons-marker', 'dashicons-star-filled', 'dashicons-star-half', 'dashicons-star-empty', 'dashicons-flag', 'dashicons-location', 'dashicons-location-alt', 'dashicons-vault', 'dashicons-shield', 'dashicons-shield-alt', 'dashicons-sos', 'dashicons-search', 'dashicons-slides', 'dashicons-analytics', 'dashicons-chart-pie', 'dashicons-chart-bar', 'dashicons-chart-line', 'dashicons-chart-area', 'dashicons-groups', 'dashicons-businessman', 'dashicons-id', 'dashicons-id-alt', 'dashicons-products', 'dashicons-awards', 'dashicons-forms', 'dashicons-testimonial', 'dashicons-portfolio', 'dashicons-book', 'dashicons-book-alt', 'dashicons-download', 'dashicons-upload', 'dashicons-backup', 'dashicons-clock', 'dashicons-lightbulb', 'dashicons-desktop', 'dashicons-tablet', 'dashicons-smartphone', 'dashicons-smiley' );
	}

	/**
	 * Save menu item's icon.
	 *
	 * @access  public
	 *
	 * @param int   $menu_id         Nav menu ID.
	 * @param int   $menu_item_db_id Menu item ID.
	 * @param array $menu_item_args  Menu item data.
	 */
	public static function save_fields( $menu_id, $menu_item_db_id, $menu_item_args ) {
		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			return;
		}

		if ( ! function_exists( 'get_current_screen' ) ) {
		    return;
        }

		$screen = get_current_screen();
		if ( ! $screen instanceof WP_Screen || 'nav-menus' !== $screen->id ) {
			return;
		}

		check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );

		if ( isset( $_POST['menu-item-icon'][ $menu_item_db_id ] ) ) {
			$icon	= $_POST['menu-item-icon'][ $menu_item_db_id ];
			if ( self::DEFAULT_ICON === $icon ) {
				$icon	= '';
			}
			update_post_meta( $menu_item_db_id, 'obfx_menu_icon', $icon );
		}

	}

	/**
	 * Checks if there is any conflict with a theme/plugin.
	 */
	public function check_conflict() {
		// We need to include this so that the wp_edit_nav_menu_walker filter does not misbehave.
		require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );

		// Let's check if another walker has been defined.
		$walker = apply_filters( 'wp_edit_nav_menu_walker', '' );

		// Yes, a conflict!
		if ( ! empty( $walker ) && $walker !== 'Menu_Icons_OBFX_Walker' ) {
			$reflector	= new ReflectionClass( $walker );
			$path		= str_replace( '\\', '/', $reflector->getFileName() );

			$name		= '';
			$type		= '';
			if ( false !== strpos( $path, 'themes' ) ) {
				$type	= __( 'theme', 'themeisle-companion' );
				$theme	= wp_get_theme();
				$name	= $theme->get( 'Name' );
			} else {
				$path = explode( 'plugins', $path );
				$path = explode( DIRECTORY_SEPARATOR, isset($path[1]) ? $path[1] : '' );
				$path = array_values( array_filter( $path ) );
				if ( isset( $path[0] ) ) {
					$name = '&nbsp; <b>' . esc_attr( $path[0] ) . '</b>';
				}
				$type = __( 'plugin', 'themeisle-companion' );
			}

			$this->description .= '<br><i class="chip">' . sprintf( __( 'There appears to be a conflict with the %s %s. This module may not work as expected.', 'themeisle-companion' ), $type, $name ) . '</i>';
			$this->active_default = false;
		}
	}
}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/menu-icons/init.php000064400000025747151150042100026351 0ustar00<?php
/**
 * The module for menu icons.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Menu_Icons_OBFX_Module
 */

/**
 * The class for menu icons.
 *
 * @package    Menu_Icons_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Menu_Icons_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * The default icon to use.
	 */
	const DEFAULT_ICON	= 'dashicons-obfx-default-icon';

	/**
	 * Menu_Icons_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Menu Icons', 'themeisle-companion' );
		$this->description = __( 'Module to define menu icons for navigation.', 'themeisle-companion' );
		$this->active_default = true;

		add_action( 'admin_init', array( $this, 'check_conflict' ) , 99 );
	}


	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool	
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'wp_update_nav_menu_item', $this, 'save_fields', 10, 3 );
		// Do not change the priority of this from 1.
		$this->loader->add_filter( 'wp_edit_nav_menu_walker', $this, 'custom_walker', 1 );
		$this->loader->add_filter( 'wp_setup_nav_menu_item', $this, 'show_menu', 10, 1 );

	}

	/**
	 * Show the menu item.
	 *
	 * @access  public
	 * @return WP_Post $menu the menu object.
	 */
	public function show_menu( $menu ) {
		$icon	= get_post_meta( $menu->ID, 'obfx_menu_icon', true );
		if ( ! empty( $icon ) ) {
			$menu->icon = $icon;
			if ( ! is_admin() ) {
				// usually, icons are of the format fa-x or dashicons-x and when displayed they are displayed with classes 'fa fa-x' or 'dashicons dashicons-x'.
				// so let's determine the prefix class.
				$array			= explode( '-', $icon );
				$prefix			= reset( $array );
				$prefix			= apply_filters( 'obfx_menu_icons_icon_class', $prefix, $icon );
				$menu->title	= sprintf( '<i class="obfx-menu-icon %s %s"></i>%s', $prefix, $icon, $menu->title );
			}
		}
		return $menu;
	}

	/**
	 * Return the custom walker.
	 *
	 * @access  public
	 * @return Walker_Nav_Menu_Edit $walker the walker.
	 */
	public function custom_walker( $walker ) {
		if ( ! class_exists( 'Menu_Icons_OBFX_Walker' ) ) {
			require_once $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'class-menu-icons-obfx-walker.php';
		}
		$walker = 'Menu_Icons_OBFX_Walker';
		return $walker;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array(
			'css' => array(
				'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' => array( 'dashicons' ),
				'public' => false,
			),
		);
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( $current_screen->id != 'nav-menus' ) {
			return array();
		}

		// Our walker has not been registered because another custom walker exists.
		if ( ! class_exists( 'Menu_Icons_OBFX_Walker' ) ) {
			return array();
		}

		$this->localized	= array(
			'admin'		=> array(
				'icons'	=> apply_filters( 'obfx_menu_icons_icon_list', $this->get_dashicons() ),
				'icon_default' => self::DEFAULT_ICON,
				'i10n' => array(
					'powered_by' => sprintf( __( 'Powered by %s plugin', 'themeisle-companion' ), '<b>' . apply_filters( 'themeisle_companion_friendly_name', '' ) . '</b>' ),
				),
			),
		);

		return array(
			'css' => array(
				'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' => false,
				'vendor/fontawesome-iconpicker.min' => array( 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' ),
				'admin' => array( 'vendor/fontawesome-iconpicker.min' ),
			),
			'js' => array(
				'vendor/bootstrap.min' => array( 'jquery' ),
				'vendor/fontawesome-iconpicker.min' => array( 'vendor/bootstrap.min' ),
				'admin' => array( 'vendor/fontawesome-iconpicker.min', 'jquery' ),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Return all the dashicons.
	 *
	 * @access  private
	 * @return array
	 */
	private function get_dashicons() {
		return array( 'dashicons-menu', 'dashicons-admin-site', 'dashicons-dashboard', 'dashicons-admin-post', 'dashicons-admin-media', 'dashicons-admin-links', 'dashicons-admin-page', 'dashicons-admin-comments', 'dashicons-admin-appearance', 'dashicons-admin-plugins', 'dashicons-admin-users', 'dashicons-admin-tools', 'dashicons-admin-settings', 'dashicons-admin-network', 'dashicons-admin-home', 'dashicons-admin-generic', 'dashicons-admin-collapse', 'dashicons-welcome-write-blog', 'dashicons-welcome-add-page', 'dashicons-welcome-view-site', 'dashicons-welcome-widgets-menus', 'dashicons-welcome-comments', 'dashicons-welcome-learn-more', 'dashicons-format-aside', 'dashicons-format-image', 'dashicons-format-gallery', 'dashicons-format-video', 'dashicons-format-status', 'dashicons-format-quote', 'dashicons-format-chat', 'dashicons-format-audio', 'dashicons-camera', 'dashicons-images-alt', 'dashicons-images-alt2', 'dashicons-video-alt', 'dashicons-video-alt2', 'dashicons-video-alt3', 'dashicons-image-crop', 'dashicons-image-rotate-left', 'dashicons-image-rotate-right', 'dashicons-image-flip-vertical', 'dashicons-image-flip-horizontal', 'dashicons-undo', 'dashicons-redo', 'dashicons-editor-bold', 'dashicons-editor-italic', 'dashicons-editor-ul', 'dashicons-editor-ol', 'dashicons-editor-quote', 'dashicons-editor-alignleft', 'dashicons-editor-aligncenter', 'dashicons-editor-alignright', 'dashicons-editor-insertmore', 'dashicons-editor-spellcheck', 'dashicons-editor-distractionfree', 'dashicons-editor-kitchensink', 'dashicons-editor-underline', 'dashicons-editor-justify', 'dashicons-editor-textcolor', 'dashicons-editor-paste-word', 'dashicons-editor-paste-text', 'dashicons-editor-removeformatting', 'dashicons-editor-video', 'dashicons-editor-customchar', 'dashicons-editor-outdent', 'dashicons-editor-indent', 'dashicons-editor-help', 'dashicons-editor-strikethrough', 'dashicons-editor-unlink', 'dashicons-editor-rtl', 'dashicons-align-left', 'dashicons-align-right', 'dashicons-align-center', 'dashicons-align-none', 'dashicons-lock', 'dashicons-calendar', 'dashicons-visibility', 'dashicons-post-status', 'dashicons-edit', 'dashicons-trash', 'dashicons-arrow-up', 'dashicons-arrow-down', 'dashicons-arrow-right', 'dashicons-arrow-left', 'dashicons-arrow-up-alt', 'dashicons-arrow-down-alt', 'dashicons-arrow-right-alt', 'dashicons-arrow-left-alt', 'dashicons-arrow-up-alt2', 'dashicons-arrow-down-alt2', 'dashicons-arrow-right-alt2', 'dashicons-arrow-left-alt2', 'dashicons-sort', 'dashicons-leftright', 'dashicons-list-view', 'dashicons-exerpt-view', 'dashicons-share', 'dashicons-share-alt', 'dashicons-share-alt2', 'dashicons-twitter', 'dashicons-rss', 'dashicons-email', 'dashicons-email-alt', 'dashicons-facebook', 'dashicons-facebook-alt', 'dashicons-googleplus', 'dashicons-networking', 'dashicons-hammer', 'dashicons-art', 'dashicons-migrate', 'dashicons-performance', 'dashicons-wordpress', 'dashicons-wordpress-alt', 'dashicons-pressthis', 'dashicons-update', 'dashicons-screenoptions', 'dashicons-info', 'dashicons-cart', 'dashicons-feedback', 'dashicons-cloud', 'dashicons-translation', 'dashicons-tag', 'dashicons-category', 'dashicons-yes', 'dashicons-no', 'dashicons-no-alt', 'dashicons-plus', 'dashicons-minus', 'dashicons-dismiss', 'dashicons-marker', 'dashicons-star-filled', 'dashicons-star-half', 'dashicons-star-empty', 'dashicons-flag', 'dashicons-location', 'dashicons-location-alt', 'dashicons-vault', 'dashicons-shield', 'dashicons-shield-alt', 'dashicons-sos', 'dashicons-search', 'dashicons-slides', 'dashicons-analytics', 'dashicons-chart-pie', 'dashicons-chart-bar', 'dashicons-chart-line', 'dashicons-chart-area', 'dashicons-groups', 'dashicons-businessman', 'dashicons-id', 'dashicons-id-alt', 'dashicons-products', 'dashicons-awards', 'dashicons-forms', 'dashicons-testimonial', 'dashicons-portfolio', 'dashicons-book', 'dashicons-book-alt', 'dashicons-download', 'dashicons-upload', 'dashicons-backup', 'dashicons-clock', 'dashicons-lightbulb', 'dashicons-desktop', 'dashicons-tablet', 'dashicons-smartphone', 'dashicons-smiley' );
	}

	/**
	 * Save menu item's icon.
	 *
	 * @access  public
	 *
	 * @param int   $menu_id         Nav menu ID.
	 * @param int   $menu_item_db_id Menu item ID.
	 * @param array $menu_item_args  Menu item data.
	 */
	public static function save_fields( $menu_id, $menu_item_db_id, $menu_item_args ) {
		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			return;
		}

		if ( ! function_exists( 'get_current_screen' ) ) {
		    return;
        }

		$screen = get_current_screen();
		if ( ! $screen instanceof WP_Screen || 'nav-menus' !== $screen->id ) {
			return;
		}

		check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );

		if ( isset( $_POST['menu-item-icon'][ $menu_item_db_id ] ) ) {
			$icon	= $_POST['menu-item-icon'][ $menu_item_db_id ];
			if ( self::DEFAULT_ICON === $icon ) {
				$icon	= '';
			}
			update_post_meta( $menu_item_db_id, 'obfx_menu_icon', $icon );
		}

	}

	/**
	 * Checks if there is any conflict with a theme/plugin.
	 */
	public function check_conflict() {
		// We need to include this so that the wp_edit_nav_menu_walker filter does not misbehave.
		require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );

		// Let's check if another walker has been defined.
		$walker = apply_filters( 'wp_edit_nav_menu_walker', '' );

		// Yes, a conflict!
		if ( ! empty( $walker ) && $walker !== 'Menu_Icons_OBFX_Walker' ) {
			$reflector	= new ReflectionClass( $walker );
			$path		= str_replace( '\\', '/', $reflector->getFileName() );

			$name		= '';
			$type		= '';
			if ( false !== strpos( $path, 'themes' ) ) {
				$type	= __( 'theme', 'themeisle-companion' );
				$theme	= wp_get_theme();
				$name	= $theme->get( 'Name' );
			} else {
				require_once( ABSPATH . 'wp-admin/includes/file.php' );
				WP_Filesystem();
				global $wp_filesystem;

				$plugin_path	= str_replace( str_replace( '\\', '/', trailingslashit( dirname( OBX_PATH ) ) ), '', $path );
				$array			= explode( '/', $path );
				$name			= reset( $array );
				$type			= __( 'plugin', 'themeisle-companion' );
			}

			$this->description .= '<br><i class="chip">' . sprintf( __( 'There appears to be a conflict with the %s %s. This module may not work as expected.', 'themeisle-companion' ), $type, $name ) . '</i>';
			$this->active_default = false;
		}
	}
}home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/social-sharing/init.php000064400000026311151150043770027201 0ustar00<?php
/**
 * Social Sharing Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Social_Sharing_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Social_Sharing_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Social_Sharing_OBFX_Module extends Orbit_Fox_Module_Abstract {

	private $social_share_links = array();

	/**
	 * Social_Sharing_OBFX_Module  constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name               = __( 'Social Sharing Module', 'themeisle-companion' );
		$this->description        = sprintf( __( 'Add basic social sharing to your posts and pages. Check out the %s to learn more!', 'themeisle-companion' ), sprintf( '<a href="https://demo.themeisle.com/orbit-fox/2018/01/15/social-sharing-modules/" rel="nofollow" target="_blank">%s</a>', __( 'demo', 'themeisle-companion' ) ) );
	}

	/**
	 * Define the array that contains the social networks.
	 */
	private function define_networks() {
    	$post_categories = strip_tags( get_the_category_list( ',' ) );
		$post_title = get_the_title();
		$post_link = get_the_permalink();

		$this->social_share_links = array(
			'facebook'  => array(
				'link'     => 'https://www.facebook.com/sharer.php?u=' . $post_link,
				'nicename' => 'Facebook',
				'icon'     => 'facebook',
			),
			'twitter'   => array(
				'link'     => 'https://twitter.com/intent/tweet?url=' . $post_link . '&text=' . $post_title . '&hashtags=' . $post_categories,
				'nicename' => 'Twitter',
				'icon'     => 'twitter',
			),
			'g-plus'    => array(
				'link'     => 'https://plus.google.com/share?url=' . $post_link,
				'nicename' => 'Google Plus',
				'icon'     => 'googleplus',
			),
			'pinterest' => array(
				'link'     => 'https://pinterest.com/pin/create/bookmarklet/?media=' . get_the_post_thumbnail_url() . '&url=' . $post_link . '&description=' . $post_title,
				'nicename' => 'Pinterest',
				'icon'     => 'pinterest',
			),
			'linkedin'  => array(
				'link'     => 'https://www.linkedin.com/shareArticle?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'LinkedIn',
				'icon'     => 'linkedin',
			),
			'tumblr'    => array(
				'link'     => 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Tumblr',
				'icon'     => 'tumblr',
			),
			'reddit'    => array(
				'link'     => 'https://reddit.com/submit?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Reddit',
				'icon'     => 'reddit',
			),
			'whatsapp'     => array(
				'link'     => 'whatsapp://send?text=' . $post_link,
				'nicename' => 'WhatsApp',
				'icon'     => 'whatsapp',
				'target'   => '0',
			),
			'mail'     => array(
				'link'     => 'mailto:?&subject=' . $post_title . '&body=' . $post_link,
				'nicename' => 'Email',
				'icon'     => 'mail',
				'target'   => '0'
			),
			'sms'     => array(
				'link'     => 'sms://?&body=' . $post_title . ' - ' . $post_link,
				'nicename' => 'SMS',
				'icon'     => 'viber',
				'target'   => '0',
			),
			'vk'        => array(
				'link'     => 'http://vk.com/share.php?url=' . $post_link,
				'nicename' => 'VKontakte',
				'icon'     => 'vkontakte',
			),
			'okru'      => array(
				'link'     => 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'OK.ru',
				'icon'     => 'odnoklassniki',
			),
			'douban'    => array(
				'link'     => 'http://www.douban.com/recommend/?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Douban',
				'icon'     => 'douban',
			),
			'baidu'     => array(
				'link'     => 'http://cang.baidu.com/do/add?it=' . $post_title . '&iu=' . $post_link,
				'nicename' => 'Baidu',
				'icon'     => 'baidu',
			),
			'xing'      => array(
				'link'     => 'https://www.xing.com/app/user?op=share&url=' . $post_link,
				'nicename' => 'Xing',
				'icon'     => 'xing',
			),
			'renren'    => array(
				'link'     => 'http://widget.renren.com/dialog/share?resourceUrl=' . $post_link . '&srcUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'RenRen',
				'icon'     => 'renren',
			),
			'weibo'     => array(
				'link'     => 'http://service.weibo.com/share/share.php?url=' . $post_link . '&appkey=&title=' . $post_title . '&pic=&ralateUid=',
				'nicename' => 'Weibo',
				'icon'     => 'weibo',
			),
		);
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
    }

    /**
     * Method to define hooks needed.
     *
     * @since   1.0.0
     * @access  public
     * @return mixed | array
     */
    public function hooks() {
	    $this->loader->add_filter('kses_allowed_protocols', $this, 'custom_allowed_protocols', 1000 );

	    if( $this -> get_option( 'socials_position' ) == 2 ) {
		    $this->loader->add_filter('hestia_filter_blog_social_icons', $this, 'social_sharing_function' );
		    return true;
	    }
	    $this->loader->add_action('wp_footer', $this, 'social_sharing_function' );
    }

	/**
     * Display method for the Social Sharing.
     *
     * @since   1.0.0
     * @access  public
     */
    public function social_sharing_function() {
        if ( ( $this->get_option('display_on_posts') && is_single() ) || ( $this->get_option('display_on_pages') && is_page() ) ) {
        	$class_desktop = 'obfx-sharing-left ';
        	switch ( $this->get_option( 'socials_position' ) ) {
		        case '1':
			        $class_desktop = 'obfx-sharing-right ';
			        break;
		        case '2':
		        	$class_desktop = 'obfx-sharing-inline ';
	        }

	        $class_mobile = '';
        	if( $this->get_option( 'mobile_position' ) == '0' ) {
	            $class_mobile = 'obfx-sharing-bottom';
	        }
		    $data = array(
		    	'desktop_class' => $class_desktop,
		    	'mobile_class'  => $class_mobile,
		    	'show_name' => $this->get_option( 'network_name' ),
		    	'social_links_array' => $this->social_links_array(),
		    );

	        if( $this -> get_option( 'socials_position' ) == 2 ) {
	            return $this->render_view( 'hestia-social-sharing', $data );
	        }
		        echo $this->render_view( 'social-sharing', $data );
	    }
    }

	/**
	 * Create the social links array to be passed to the front end view.
	 *
	 * @since   1.0.0
	 * @access  private
	 * @return array
	 */
    private function social_links_array() {
    	$social_links = array();
		foreach ( $this->social_share_links as $network => $network_links ) {
			if( $this->get_option( $network ) ) {
				$social_links[ $network ] = $network_links;
				$social_links[ $network ][ 'show_mobile' ] = $this->get_option( $network . '-mobile-show' );
				$social_links[ $network ][ 'show_desktop' ] = $this->get_option( $network . '-desktop-show' );
			}
		}
	    return $social_links;
    }

    /**
     * Add extra protocols to list of allowed protocols.
     *
	 * @param array $protocols List of protocols from core.
     *
     * @return array Updated list including extra protocols added.
     */
    public function custom_allowed_protocols( $protocols ){
    	$protocols[] = 'whatsapp';
	    $protocols[] = 'sms';
	    return $protocols;
    }

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
	    return array(
		    'css' => array(
				'public' => false,
				'vendor/socicon/socicon' => false,
		    ),
		    'js' => array(
				'public' => array( 'jquery' ),
		    ),
	    );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array(
			'css' => array(
				'admin' => false,
				'vendor/socicon/socicon' => false,
			),
			'js' => array(
				'admin' => array( 'jquery' ),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$options = array(
			array(
				'id'      => 'display_on_posts',
				'title'   => 'Display On',
				'name'    => 'display_on_posts',
				'type'    => 'checkbox',
				'label'   => 'Posts',
				'class'   => 'inline-setting',
				'default' => '1',
			),
			array(
				'id'      => 'display_on_pages',
				'title'   => '',
				'name'    => 'display_on_pages',
				'type'    => 'checkbox',
				'label'   => 'Pages',
				'class'   => 'inline-setting',
				'default' => '0',
			),
			array(
				'id'      => 'socials_position',
				'title'   => 'Desktop Position',
				'name'    => 'socials_position',
				'type'    => 'radio',
				'options' => array(
					'0' => 'Left',
					'1' => 'Right',
				),
				'default' => '0',
			),
			array(
				'id'      => 'mobile_position',
				'name'    => 'mobile_position',
				'title'   => 'Mobile Position',
				'type'    => 'radio',
				'options' => array(
					'0' => 'Pinned to bottom',
					'1' => 'Same as desktop',
				),
				'default' => '1',
			),
			array(
				'id'      => 'network_name',
				'name'    => 'network_name',
				'title'   => 'Show name',
				'type'    => 'toggle',
				'label'   => 'Show network name on hover',
				'default' => '0',
			),
		);

		$this->define_networks();

		foreach ( $this->social_share_links as $network => $data_array ) {
			$options[] = array(
				'before_wrap' => '<div class="obfx-row">',
				'title'       => ( $network == 'facebook' ) ? 'Networks' : '',
				'id'          => $network,
				'name'        => $network,
				'label'       => '<i class="socicon-' . $data_array['icon'] . '"></i>  - ' . $data_array['nicename'],
				'type'        => 'toggle',
				'default'     => ( $network == 'facebook' ) ? '1' : '',
				'class'       => 'inline-setting network-toggle',
			);

			$options[] = array(
				'title'   => ( $network == 'facebook' ) ? 'Show on' : '',
				'id'      => $network . '-desktop-show',
				'name'    => $network . '-desktop-show',
				'label'   => 'desktop',
				'type'    => 'checkbox',
				'default' => '1',
				'class'   => 'inline-setting show',
			);

			$options[] = array(
				'id'         => $network . '-mobile-show',
				'name'       => $network . '-mobile-show',
				'label'      => 'mobile',
				'type'       => 'checkbox',
				'default'    => '1',
				'class'      => 'inline-setting show last',
				'after_wrap' => '</div>',
			);
		}

		$options = $this->add_hestia_options( $options );

		return $options;
	}

	/**
	 * Add hestia options.
	 */
	private function add_hestia_options( $options ) {
		if( defined( 'HESTIA_VERSION' ) ) {
			$option_id = $this->search_for_id( 'socials_position', $options );
			$options[$option_id]['options']['2'] = 'Inline after content';
		}
		return $options;
	}

	/**
	 * Search for module option by id.
	 *
	 * @param $index
	 *
	 * @return int|null|string
	 */
	private function search_for_id( $index, $options ) {
		foreach ( $options as $key => $val ) {
			if ( $val['id'] === $index ) {
				return $key;
			}
		}
		return null;
	}

}crosstraining/wp-content/plugins/themeisle-companion/obfx_modules/elementor-widgets/init.php000060400000005504151150172000031746 0ustar00home/xbodynamge<?php
/**
 * Elementor Widgets Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Elementor_Widgets_OBFX_Module
 */

define( 'OBFX_MODULE_URL', __FILE__ );

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Elementor_Widgets_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Elementor_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Elementor_Widgets_OBFX_Module  constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'elementor/elementor.php' );
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed | array
	 */
	public function hooks() {
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
		$this->loader->add_action( 'plugins_loaded', $this, 'load_elementor_extra_widgets' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$options = array();

		return $options;
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {

		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}

	/**
	 * Call the ElementorExtraWidgets Library which will register its own actions.
	 */
	public function load_elementor_extra_widgets() {
		if ( class_exists( '\ThemeIsle\ElementorExtraWidgets' ) ) {
			\ThemeIsle\ElementorExtraWidgets::instance();
		}
	}

}home/xbodynamge/www/wp-content/plugins/themeisle-companion/obfx_modules/template-directory/init.php000064400000010512151150353060030151 0ustar00<?php

/**
 * The Orbit Fox Template Directory Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Template_Directory_OBFX_Module
 */

use  Elementor\TemplateLibrary\Classes;

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Template_Directory_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Template_Directory_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Template_Directory_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Template Directory Module', 'themeisle-companion' );
		$this->description    = __( 'The awesome template directory is aiming to provide a wide range of templates that you can import straight into your website.', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
		return true;
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		// Get the full-width pages feature
		$this->loader->add_action( 'init', $this, 'load_template_directory_library' );
		$this->loader->add_action( 'init', $this, 'load_full_width_page_templates' );
		$this->loader->add_filter( 'obfx_template_dir_products',$this, 'add_page', 90 );
	}

	/**
	 * Enqueue the scripts for the dashboard page of the
	 */
	public function enqueue_template_dir_scripts() {
		$current_screen = get_current_screen();
		if ( $current_screen->id == 'orbit-fox_page_obfx_template_dir' ) {
			$script_handle = $this->slug . '-script';
			wp_enqueue_script( 'plugin-install' );
			wp_enqueue_script( 'updates' );
			wp_register_script( $script_handle, plugin_dir_url( $this->get_dir() ) . $this->slug . '/js/script.js', array( 'jquery' ), $this->version );
			wp_localize_script( $script_handle, 'importer_endpoint',
				array(
					'url'   => $this->get_endpoint_url( '/import_elementor' ),
					'nonce' => wp_create_nonce( 'wp_rest' ),
				) );
			wp_enqueue_script( $script_handle );
		}
	}

	/**
	 * Add the menu page.
	 *
	 * @param $products
	 *
	 * @return array
	 */
	public function add_page( $products ) {
		$sizzify = array(
			'obfx' => array(
				'directory_page_title' => __( 'Orbit Fox Template Directory', 'themeisle-companion' ),
				'parent_page_slug'     => 'obfx_companion',
				'page_slug'            => 'obfx_template_dir',
			)
		);
		return array_merge($products, $sizzify );
	}

	/**
	 *
	 *
	 * @param string $path
	 *
	 * @return string
	 */
	public function get_endpoint_url( $path = '' ) {
		return rest_url( $this->slug . $path );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}


	/**
	 * Options array for the Orbit Fox module.
	 *
	 * @return array
	 */
	public function options() {
		return array();
	}


	/**
	 * If the composer library is present let's try to init.
	 */
	public function load_full_width_page_templates() {
		if ( class_exists( '\ThemeIsle\FullWidthTemplates' ) ) {
			\ThemeIsle\FullWidthTemplates::instance();
		}
	}

	/**
	 * Call the Templates Directory library
	 */
	public function load_template_directory_library() {
		if ( class_exists( '\ThemeIsle\PageTemplatesDirectory' ) ) {
			\ThemeIsle\PageTemplatesDirectory::instance();
		}
	}

	/**
	 * By default the composer library "Full Width Page Templates" comes with two page templates: a blank one and a full
	 * width one with the header and footer inherited from the active theme.
	 * OBFX Template directory doesn't need the blonk one, so we are going to ditch it.
	 *
	 * @param array $list
	 *
	 * @return array
	 */
	public function filter_fwpt_templates_list( $list ){
		unset( $list['templates/builder-fullwidth.php'] );
		return $list;
	}
}
lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/init.php000064400000035336151150521520031347 0ustar00home/xbodynamge<?php
/**
 * ThemeIsle Companion Legacy Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Companion_Legacy_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Companion_Legacy_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Companion_Legacy_OBFX_Module extends Orbit_Fox_Module_Abstract {

	private $inc_dir;

	/**
	 * Companion_Legacy_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();

		$this->active_default = true;

		$this->inc_dir = $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR;
		if ( ! defined( 'THEMEISLE_COMPANION_PATH' ) ) {
			define( 'THEMEISLE_COMPANION_PATH', $this->inc_dir );
		}
		if ( ! defined( 'THEMEISLE_COMPANION_URL' ) ) {
			define( 'THEMEISLE_COMPANION_URL', plugin_dir_url( $this->inc_dir ) );
		}
		$theme_name = '';
		if ( $this->is_zerif() ) {
			$theme_name = 'Zerif';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-focus.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-testimonial.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-clients.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-team.php';
			require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'functions.php';
		}

		if ( $this->is_rhea() ) {
			$theme_name = 'Rhea';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'features.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'about.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'hours.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'contact.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'progress-bar.widget.php';
			require_once $this->inc_dir . 'rhea' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'icon-box.widget.php';
		}

		if ( $this->is_hestia() ) {
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'functions.php';
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php';
			$theme_name = 'Hestia';

		}

		if ( $this->is_hestia_pro() ) {
			require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php';
			$theme_name = 'Hestia Pro';

		}
		if( $this->is_shop_isle() ) {
			$theme_name = 'Shop Isle';
		}

		if ( $this->is_azera_shop() ) {
			$theme_name = 'Azera Shop';
		}

		if ( $this->is_llorix_one_lite() ) {
			$theme_name = 'Llorix One Lite';
		}

		$this->name        = sprintf( __( '%s enhancements ', 'themeisle-companion' ), $theme_name );
		$this->description = sprintf( __( 'Module containing frontpage improvements for %s theme.', 'themeisle-companion' ), $theme_name );
	}

	private function is_zerif() {
		if ( $this->get_active_theme_dir() == 'zerif-lite' ) {
			return true;
		}

		return false;
	}

	private function is_rhea() {
		if ( $this->get_active_theme_dir( true ) == 'rhea' ) {
			return true;
		}

		return false;
	}

	private function is_hestia() {
		if ( $this->get_active_theme_dir() == 'hestia' ) {
			return true;
		}

		return false;
	}

	private function is_hestia_pro(){
		if ( $this->get_active_theme_dir() == 'hestia-pro' ) {
			return true;
		}

		return false;
	}

	private function is_shop_isle() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if( is_plugin_active( 'shop-isle-companion/shop-isle-companion.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'shop-isle' ) {
			return true;
		}

		return false;
	}

	private function is_azera_shop() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if ( is_plugin_active( 'azera-shop-companion/azera-shop-companion.php' ) ) {
			return false;
		}
		if ( is_plugin_active( 'azera-shop-plus/azera-shop-plus.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'azera-shop' ) {
			return true;
		}

		return false;
	}

	private function is_llorix_one_lite() {
		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		if ( is_plugin_active( 'llorix-one-companion/llorix-one-companion.php' ) ) {
			return false;
		}
		if ( is_plugin_active( 'llorix-one-plus/llorix_one_plus.php' ) ) {
			return false;
		}
		if ( $this->get_active_theme_dir() == 'llorix-one-lite' ) {
			return true;
		}

		return false;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		if ( $this->is_hestia() || $this->is_rhea() || $this->is_zerif() || $this->is_hestia_pro() || $this->is_shop_isle() || $this->is_azera_shop() || $this->is_llorix_one_lite() ) {
			return true;
		} else {
			return false;
		}
	}

	public function zerif_register_widgets() {
		register_widget( 'zerif_ourfocus' );
		register_widget( 'zerif_testimonial_widget' );
		register_widget( 'zerif_clients_widget' );
		register_widget( 'zerif_team_widget' );

		$themeisle_companion_flag = get_option( 'themeisle_companion_flag' );
		if ( empty( $themeisle_companion_flag ) && function_exists( 'themeisle_populate_with_default_widgets' ) ) {
			themeisle_populate_with_default_widgets();
		}
	}

	public function rhea_register_widgets() {
		register_widget( 'rhea_features_block' );
		register_widget( 'Rhea_Progress_Bar' );
		register_widget( 'Rhea_Icon_Box' );
		register_widget( 'Rhea_About_Company' );
		register_widget( 'Rhea_Hours' );
		register_widget( 'Rhea_Contact_Company' );
	}

	function rhea_load_custom_wp_admin_style() {
		wp_enqueue_style( 'fontawesome-style', get_template_directory_uri() . '/css/font-awesome.min.css' );
		wp_enqueue_style( 'rhea-admin-style', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/css/admin-style.css' );
		wp_enqueue_script( 'fontawesome-icons', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/js/icons.js', false, '1.0.0' );
		wp_enqueue_script( 'jquery-ui-dialog' );
		wp_enqueue_script( 'fontawesome-script', trailingslashit( THEMEISLE_COMPANION_URL ) . 'inc/rhea/assets/js/fontawesome.jquery.js', false, '1.0.0' );
	}

	public function rhea_add_html_to_admin_footer() {
		$output = '
        <div id="fontawesome-popup">
            <div class="left-side">
                <label for="fontawesome-live-search">' . esc_html_e( 'Search icon', 'themeisle-companion' ) . ':</label>
                <ul class="filter-icons">
                    <li data-filter="all" class="active">' . esc_html_e( 'All Icons', 'themeisle-companion' ) . '</li>
                </ul>
            </div>
            <div class="right-side">
            </div>
        </div>
        ';

		echo $output;
	}

	/**
	 * Function to import customizer big title settings into first slide.
	 */
	public function shop_isle_get_wporg_options() {
		/* import shop isle options */
		$shop_isle_mods = get_option('theme_mods_shop-isle');

		if (!empty($shop_isle_mods)) {

			$new_slider = new stdClass();

			foreach ($shop_isle_mods as $shop_isle_mod_k => $shop_isle_mod_v) {

				/* migrate Big title section to Slider section */
				if (($shop_isle_mod_k == 'shop_isle_big_title_image') || ($shop_isle_mod_k == 'shop_isle_big_title_title') || ($shop_isle_mod_k == 'shop_isle_big_title_subtitle') || ($shop_isle_mod_k == 'shop_isle_big_title_button_label') || ($shop_isle_mod_k == 'shop_isle_big_title_button_link')) {

					if ($shop_isle_mod_k == 'shop_isle_big_title_image') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->image_url = $shop_isle_mod_v;
						} else {
							$new_slider->image_url = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_title') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->text = $shop_isle_mod_v;
						} else {
							$new_slider->text = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_subtitle') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->subtext = $shop_isle_mod_v;
						} else {
							$new_slider->subtext = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_button_label') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->label = $shop_isle_mod_v;
						} else {
							$new_slider->label = '';
						}
					}

					if ($shop_isle_mod_k == 'shop_isle_big_title_button_link') {
						if (!empty($shop_isle_mod_v)) {
							$new_slider->link = $shop_isle_mod_v;
						} else {
							$new_slider->link = '';
						}
					}

					if ( !empty($new_slider->image_url) || !empty($new_slider->text) || !empty($new_slider->subtext) || !empty($new_slider->link) ) {
						$new_slider_encode = json_encode(array($new_slider));
						set_theme_mod('shop_isle_slider', $new_slider_encode);
					}

				} else {

					set_theme_mod($shop_isle_mod_k, $shop_isle_mod_v);
				}
			}
		}

	}

	/**
	 * Wrapper method for themeisle_hestia_require function call.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hestia_require() {
		themeisle_hestia_require();
	}

	/**
	 * Wrapper method for themeisle_hestia_fix_duplicate_widgets function call.
	 *
	 * @since 2.4.5
	 * @access  public
	 */
	public function hestia_fix_duplicate_widgets(){
		themeisle_hestia_fix_duplicate_widgets();
	}

	/**
	 * Wrapper method for themeisle_hestia_clients_default_content function call.
	 *
	 * @since   2.1.1
	 * @access  public
	 */
	public function hestia_load_clients_default_content(){
		return themeisle_hestia_clients_default_content();
	}

	/**
	 * Wrapper method for themeisle_hestia_enqueue_clients_style function call.
	 *
	 * @access  public
	 */
	public function hestia_enqueue_clients_style(){
		themeisle_hestia_enqueue_clients_style();
	}

	/**
	 * Wrapper method for themeisle_hestia_top_bar_default_alignment function call.
	 * 
	 * @since   2.1.1
	 * @access  public
	 */
	public function hestia_top_bar_default_alignment(){
		return themeisle_hestia_top_bar_default_alignment();
	}

	/**
	 * Wrapper method for themeisle_hestia_load_controls function call.
	 *
	 * @since   2.0.4
	 * @access  public
	 */
	public function hestia_require_customizer() {
		themeisle_hestia_load_controls();
	}

	/**
	 * Wrapper method for themeisle_hestia_set_frontpage function call.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hestia_set_front_page() {
		themeisle_hestia_set_frontpage();
	}

	/**
	 * Wrapper method for Azera Shop Companion styles
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function azera_shop_companion_register_plugin_styles() {
		azera_shop_companion_register_plugin_styles();
	}

	/**
	 * Wrapper method for Azera Shop Companion sections
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function azera_shop_companion_load_sections() {
		azera_shop_companion_load_sections();
	}

	/**
	 * Wrapper method for Llorix One Companion styles
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function llorix_one_companion_register_plugin_styles() {
		llorix_one_companion_register_plugin_styles();
	}

	/**
	 * Wrapper method for Llorix One Companion sections
	 *
	 * @since 2.4.5
	 * @access public
	 */
	public function llorix_one_companion_load_sections() {
		llorix_one_companion_load_sections();
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		define( 'THEMEISLE_COMPANION_VERSION', '2.0.0' );
		if ( $this->is_zerif() ) {
			$this->loader->add_action( 'widgets_init', $this, 'zerif_register_widgets' );
		}

		if ( $this->is_rhea() ) {
			$this->loader->add_action( 'widgets_init', $this, 'rhea_register_widgets' );
			$this->loader->add_action( 'admin_enqueue_scripts', $this, 'rhea_load_custom_wp_admin_style' );
			$this->loader->add_action( 'admin_footer', $this, 'rhea_add_html_to_admin_footer' );
			$this->loader->add_action( 'customize_controls_print_footer_scripts', $this, 'rhea_add_html_to_admin_footer' );
		}

		if ( $this->is_hestia() ) {
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_require' );
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' );
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'hestia_enqueue_clients_style' );
			$this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' );
			$this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' );
			$this->loader->add_action( 'customize_register', $this, 'hestia_require_customizer', 0 );
			$this->loader->add_action( 'after_switch_theme', $this, 'hestia_set_front_page' );
		}

		if ( $this->is_hestia_pro() ) {
			$this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' );
			$this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' );
			$this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' );
		}

		if( $this->is_shop_isle() ) {
			require_once $this->inc_dir . 'shop-isle' . DIRECTORY_SEPARATOR . 'functions.php';
		}

		if ( $this->is_azera_shop() ) {
			require_once  $this->inc_dir . 'azera-shop' . DIRECTORY_SEPARATOR . 'functions.php';
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'azera_shop_companion_register_plugin_styles' );
			$this->loader->add_action( 'plugins_loaded', $this, 'azera_shop_companion_load_sections' );
		}

		if ( $this->is_llorix_one_lite() ) {
			require_once  $this->inc_dir . 'llorix-one-companion' . DIRECTORY_SEPARATOR . 'functions.php';
			$this->loader->add_action( 'wp_enqueue_scripts', $this, 'llorix_one_companion_register_plugin_styles' );
			$this->loader->add_action( 'plugins_loaded', $this, 'llorix_one_companion_load_sections' );
		}
	}

	/**
	 * Import mods if is shop isle.
	 */
	public function activate() {
		if( $this->is_shop_isle() ) {
			$this->shop_isle_get_wporg_options();
		}
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}
}
lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/elementor-widgets/init.php000064400000005504151150717550031564 0ustar00home/xbodynamge<?php
/**
 * Elementor Widgets Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Elementor_Widgets_OBFX_Module
 */

define( 'OBFX_MODULE_URL', __FILE__ );

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Elementor_Widgets_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Elementor_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Elementor_Widgets_OBFX_Module  constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'elementor/elementor.php' );
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed | array
	 */
	public function hooks() {
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
		$this->loader->add_action( 'plugins_loaded', $this, 'load_elementor_extra_widgets' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$options = array();

		return $options;
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {

		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}

	/**
	 * Call the ElementorExtraWidgets Library which will register its own actions.
	 */
	public function load_elementor_extra_widgets() {
		if ( class_exists( '\ThemeIsle\ElementorExtraWidgets' ) ) {
			\ThemeIsle\ElementorExtraWidgets::instance();
		}
	}

}xbodynamge/lebauwcentre/wp-content/plugins/themeisle-companion/obfx_modules/social-sharing/init.php000064400000030101151150767750031027 0ustar00home<?php
/**
 * Social Sharing Core Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Social_Sharing_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Social_Sharing_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Social_Sharing_OBFX_Module extends Orbit_Fox_Module_Abstract {

	private $social_share_links = array();

	/**
	 * Social_Sharing_OBFX_Module  constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name               = __( 'Social Sharing Module', 'themeisle-companion' );
		$this->description        = sprintf( __( 'Add basic social sharing to your posts and pages. Check out the %s to learn more!', 'themeisle-companion' ), sprintf( '<a href="https://demo.themeisle.com/orbit-fox/2018/01/15/social-sharing-modules/" rel="nofollow" target="_blank">%s</a>', __( 'demo', 'themeisle-companion' ) ) );
	}

	/**
	 * Define the array that contains the social networks.
	 */
	private function define_networks() {
    	$post_categories = strip_tags( get_the_category_list( ',' ) );
		$post_title = get_the_title();
		$post_link = get_the_permalink();

		$this->social_share_links = array(
			'facebook'  => array(
				'link'     => 'https://www.facebook.com/sharer.php?u=' . $post_link,
				'nicename' => 'Facebook',
				'icon'     => 'facebook',
			),
			'twitter'   => array(
				'link'     => 'https://twitter.com/intent/tweet?url=' . $post_link . '&text=' . $post_title . '&hashtags=' . $post_categories,
				'nicename' => 'Twitter',
				'icon'     => 'twitter',
			),
			'g-plus'    => array(
				'link'     => 'https://plus.google.com/share?url=' . $post_link,
				'nicename' => 'Google Plus',
				'icon'     => 'googleplus',
			),
			'pinterest' => array(
				'link'     => 'https://pinterest.com/pin/create/bookmarklet/?media=' . get_the_post_thumbnail_url() . '&url=' . $post_link . '&description=' . $post_title,
				'nicename' => 'Pinterest',
				'icon'     => 'pinterest',
			),
			'linkedin'  => array(
				'link'     => 'https://www.linkedin.com/shareArticle?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'LinkedIn',
				'icon'     => 'linkedin',
			),
			'tumblr'    => array(
				'link'     => 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Tumblr',
				'icon'     => 'tumblr',
			),
			'reddit'    => array(
				'link'     => 'https://reddit.com/submit?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Reddit',
				'icon'     => 'reddit',
			),
			'whatsapp'     => array(
				'link'     => 'whatsapp://send?text=' . $post_link,
				'nicename' => 'WhatsApp',
				'icon'     => 'whatsapp',
				'target'   => '0',
			),
			'mail'     => array(
				'link'     => 'mailto:?&subject=' . $post_title . '&body=' . $post_link,
				'nicename' => 'Email',
				'icon'     => 'mail',
				'target'   => '0'
			),
			'sms'     => array(
				'link'     => 'sms://?&body=' . $post_title . ' - ' . $post_link,
				'nicename' => 'SMS',
				'icon'     => 'viber',
				'target'   => '0',
			),
			'vk'        => array(
				'link'     => 'http://vk.com/share.php?url=' . $post_link,
				'nicename' => 'VKontakte',
				'icon'     => 'vkontakte',
			),
			'okru'      => array(
				'link'     => 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'OK.ru',
				'icon'     => 'odnoklassniki',
			),
			'douban'    => array(
				'link'     => 'http://www.douban.com/recommend/?url=' . $post_link . '&title=' . $post_title,
				'nicename' => 'Douban',
				'icon'     => 'douban',
			),
			'baidu'     => array(
				'link'     => 'http://cang.baidu.com/do/add?it=' . $post_title . '&iu=' . $post_link,
				'nicename' => 'Baidu',
				'icon'     => 'baidu',
			),
			'xing'      => array(
				'link'     => 'https://www.xing.com/app/user?op=share&url=' . $post_link,
				'nicename' => 'Xing',
				'icon'     => 'xing',
			),
			'renren'    => array(
				'link'     => 'http://widget.renren.com/dialog/share?resourceUrl=' . $post_link . '&srcUrl=' . $post_link . '&title=' . $post_title,
				'nicename' => 'RenRen',
				'icon'     => 'renren',
			),
			'weibo'     => array(
				'link'     => 'http://service.weibo.com/share/share.php?url=' . $post_link . '&appkey=&title=' . $post_title . '&pic=&ralateUid=',
				'nicename' => 'Weibo',
				'icon'     => 'weibo',
			),
		);
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
    }

    /**
     * Method to define hooks needed.
     *
     * @since   1.0.0
     * @access  public
     * @return mixed | array
     */
    public function hooks() {
	    $this->loader->add_filter('kses_allowed_protocols', $this, 'custom_allowed_protocols', 1000 );

	    if( $this -> get_option( 'socials_position' ) == 2 ) {
		    $this->loader->add_filter('hestia_filter_blog_social_icons', $this, 'social_sharing_function' );
		    return true;
	    }
	    $this->loader->add_action('wp_footer', $this, 'social_sharing_function' );
    }

	/**
     * Display method for the Social Sharing.
     *
     * @since   1.0.0
     * @access  public
     */
    public function social_sharing_function() {
        if ( ( $this->get_option('display_on_posts') && is_single() ) || ( $this->get_option('display_on_pages') && is_page() ) ) {
        	$class_desktop = 'obfx-sharing-left ';
        	switch ( $this->get_option( 'socials_position' ) ) {
		        case '1':
			        $class_desktop = 'obfx-sharing-right ';
			        break;
		        case '2':
		        	$class_desktop = 'obfx-sharing-inline ';
	        }

	        $class_mobile = '';
        	if( $this->get_option( 'mobile_position' ) == '0' ) {
	            $class_mobile = 'obfx-sharing-bottom';
	        }
		    $data = array(
		    	'desktop_class' => $class_desktop,
		    	'mobile_class'  => $class_mobile,
		    	'show_name' => $this->get_option( 'network_name' ),
		    	'social_links_array' => $this->social_links_array(),
		    );

	        if( $this -> get_option( 'socials_position' ) == 2 ) {
	            return $this->render_view( 'hestia-social-sharing', $data );
	        }
		        echo $this->render_view( 'social-sharing', $data );
	    }
    }

	/**
	 * Create the social links array to be passed to the front end view.
	 *
	 * @since   1.0.0
	 * @access  private
	 * @return array
	 */
    private function social_links_array() {
    	$social_links = array();
		foreach ( $this->social_share_links as $network => $network_links ) {
			if( $this->get_option( $network ) ) {
				$social_links[ $network ] = $network_links;
				$social_links[ $network ][ 'show_mobile' ] = $this->get_option( $network . '-mobile-show' );
				$social_links[ $network ][ 'show_desktop' ] = $this->get_option( $network . '-desktop-show' );
			}
		}
	    return $social_links;
    }

    /**
     * Add extra protocols to list of allowed protocols.
     *
	 * @param array $protocols List of protocols from core.
     *
     * @return array Updated list including extra protocols added.
     */
    public function custom_allowed_protocols( $protocols ){
    	$protocols[] = 'whatsapp';
	    $protocols[] = 'sms';
	    return $protocols;
    }

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		$data = get_option( 'obfx_data' );
		$display_on_posts = true;
		$display_on_pages = false;
		if( isset( $data['module_settings']) && isset( $data['module_settings']['social-sharing']) ){
			if( isset( $data['module_settings']['social-sharing']['display_on_posts'] ) ){
				$display_on_posts = (bool)$data['module_settings']['social-sharing']['display_on_posts'];
			}
			if( isset( $data['module_settings']['social-sharing']['display_on_pages'] ) ){
				$display_on_pages = (bool)$data['module_settings']['social-sharing']['display_on_pages'];
			}
		}

		if( ( $display_on_posts === false || ! is_single() ) && ( $display_on_pages === false || ! is_page() ) ) {
			return array();
		}

	    return array(
		    'css' => array(
				'public' => false,
				'vendor/socicon/socicon' => false,
		    ),
		    'js' => array(
				'public' => array( 'jquery' ),
		    ),
	    );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {

		$current_screen = get_current_screen();
		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( $current_screen->id != 'toplevel_page_obfx_companion' ) {
			return array();
		}

		return array(
			'css' => array(
				'admin' => false,
				'vendor/socicon/socicon' => false,
			),
			'js' => array(
				'admin' => array( 'jquery' ),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$options = array(
			array(
				'id'      => 'display_on_posts',
				'title'   => 'Display On',
				'name'    => 'display_on_posts',
				'type'    => 'checkbox',
				'label'   => 'Posts',
				'class'   => 'inline-setting',
				'default' => '1',
			),
			array(
				'id'      => 'display_on_pages',
				'title'   => '',
				'name'    => 'display_on_pages',
				'type'    => 'checkbox',
				'label'   => 'Pages',
				'class'   => 'inline-setting',
				'default' => '0',
			),
			array(
				'id'      => 'socials_position',
				'title'   => 'Desktop Position',
				'name'    => 'socials_position',
				'type'    => 'radio',
				'options' => array(
					'0' => 'Left',
					'1' => 'Right',
				),
				'default' => '0',
			),
			array(
				'id'      => 'mobile_position',
				'name'    => 'mobile_position',
				'title'   => 'Mobile Position',
				'type'    => 'radio',
				'options' => array(
					'0' => 'Pinned to bottom',
					'1' => 'Same as desktop',
				),
				'default' => '1',
			),
			array(
				'id'      => 'network_name',
				'name'    => 'network_name',
				'title'   => 'Show name',
				'type'    => 'toggle',
				'label'   => 'Show network name on hover',
				'default' => '0',
			),
		);

		$this->define_networks();

		foreach ( $this->social_share_links as $network => $data_array ) {
			$options[] = array(
				'before_wrap' => '<div class="obfx-row">',
				'title'       => ( $network == 'facebook' ) ? 'Networks' : '',
				'id'          => $network,
				'name'        => $network,
				'label'       => '<i class="socicon-' . $data_array['icon'] . '"></i>  - ' . $data_array['nicename'],
				'type'        => 'toggle',
				'default'     => ( $network == 'facebook' ) ? '1' : '',
				'class'       => 'inline-setting network-toggle',
			);

			$options[] = array(
				'title'   => ( $network == 'facebook' ) ? 'Show on' : '',
				'id'      => $network . '-desktop-show',
				'name'    => $network . '-desktop-show',
				'label'   => 'desktop',
				'type'    => 'checkbox',
				'default' => '1',
				'class'   => 'inline-setting show',
			);

			$options[] = array(
				'id'         => $network . '-mobile-show',
				'name'       => $network . '-mobile-show',
				'label'      => 'mobile',
				'type'       => 'checkbox',
				'default'    => '1',
				'class'      => 'inline-setting show last',
				'after_wrap' => '</div>',
			);
		}

		$options = $this->add_hestia_options( $options );

		return $options;
	}

	/**
	 * Add hestia options.
	 */
	private function add_hestia_options( $options ) {
		if( defined( 'HESTIA_VERSION' ) ) {
			$option_id = $this->search_for_id( 'socials_position', $options );
			$options[$option_id]['options']['2'] = 'Inline after content';
		}
		return $options;
	}

	/**
	 * Search for module option by id.
	 *
	 * @param $index
	 *
	 * @return int|null|string
	 */
	private function search_for_id( $index, $options ) {
		foreach ( $options as $key => $val ) {
			if ( $val['id'] === $index ) {
				return $key;
			}
		}
		return null;
	}

}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/uptime-monitor/init.php000064400000010275151151771070027272 0ustar00<?php
/**
 * The Mock-up to demonstrate and test module use.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Uptime_Monitor_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Uptime_Monitor_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Uptime_Monitor_OBFX_Module extends Orbit_Fox_Module_Abstract {
	/**
	 * @var string Uptime api endpoint.
	 */
	private $monitor_url = 'https://monitor.orbitfox.com';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Uptime Monitor', 'themeisle-companion' );
		$this->description    = __( 'A module to notify when you website goes down.', 'themeisle-companion' );
		$this->confirm_intent = '<h4>' . __( 'One more step...', 'themeisle-companion' ) . '</h4><p>' . __( 'In order to use the uptime service, we will need your e-mail address, where we will send downtime alerts.', 'themeisle-companion' ) . '</p>';
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method called on module activation.
	 * Calls the API to register an url to monitor.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function after_options_save() {
		$this->activate();
	}

	/**
	 * Method invoked after options save.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function activate() {
		$email = sanitize_email( $this->get_option( 'monitor_email' ) );
		if ( ! is_email( $email ) ) {
			return;
		}

		$monitor_url = $this->monitor_url . '/api/monitor/create';
		$url         = home_url();
		$args        = array(
			'body' => array( 'url' => $url, 'email' => $email )
		);
		$response    = wp_remote_post( $monitor_url, $args );
	}

	/**
	 * Method invoked before options save.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function before_options_save( $options ) {
		$this->deactivate();
	}

	/**
	 * Method called on module deactivation.
	 * Calls the API to unregister an url from the monitor.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function deactivate() {
		$this->set_option( 'monitor_email', '' );
		$monitor_url  = $this->monitor_url . '/api/monitor/remove';
		$url          = home_url();
		$args         = array(
			'body' => array( 'url' => $url )
		);
		$response     = wp_remote_post( $monitor_url, $args );
		$api_response = json_decode( $response['body'] );
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( $this->get_slug() . '_before_options_save', $this, 'before_options_save', 10, 1 );
		$this->loader->add_action( $this->get_slug() . '_after_options_save', $this, 'after_options_save' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( $current_screen->id != 'dashboard' ) {
			return array();
		}

		return array(
			'js'  => array(
				'stats' => array( 'jquery' ),
			),
			'css' => array(
				'stats' => false,
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array(
			array(
				'id'          => 'monitor_email',
				'name'        => 'monitor_email',
				'title'       => 'Notification email',
				'description' => 'Email where we should notify you when the site goes down.',
				'type'        => 'email',
				'default'     => '',
				'placeholder' => 'Add your email.',
			)
		);
	}
}home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/policy-notice/init.php000064400000022712151151777010027057 0ustar00<?php
/**
 * A module to display a notification bar which will inform users about the website Private Policy.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Policy_Notice_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Policy_Notice_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Policy_Notice_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();

		$this->name        = __( 'Policy Notice', 'themeisle-companion' );
		$this->description = __( 'A simple notice bar which will help you inform users about your website policy.', 'themeisle-companion' );
	}

	/**
	 * Method to determine if the module is enabled or not.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The method for the module load logic.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed
	 */
	public function load() {
		return;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {

		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {

		return array(
			array(
				'id'      => 'enable_policy_notice',
				'name'    => 'enable_policy_notice',
				'title'   => '',
				'type'    => 'toggle',
				'label'   => esc_html__( 'Allow OrbitFox to display a bottom bar with info about the website Private Policy.', 'themeisle-companion' ),
				'default' => '0',
			),

			array(
				'id'      => 'policy_notice_text',
				'name'    => 'policy_notice_text',
				'title'   => esc_html__( 'Policy description', 'themeisle-companion' ),
				'type'    => 'text',
				'default' => esc_html__( 'This website uses cookies to improve your experience. We\'ll assume you accept this policy as long as you are using this website', 'themeisle-companion' ),
			),
			array(
				'id'      => 'policy_page',
				'name'    => 'policy_page',
				'title'   => esc_html__( 'Policy Page', 'themeisle-companion' ),
				'type'    => 'select',
				'default' => 0,
				'options' =>  $this->get_policy_pages_array()
			),
			array(
				'id'      => 'notice_link_label',
				'name'    => 'notice_link_label',
				'title'   => esc_html__( 'Policy Button Label', 'themeisle-companion' ),
				'type'    => 'text',
				'default' => esc_html__( 'View Policy', 'themeisle-companion' ),
			),
			array(
				'id'      => 'notice_accept_label',
				'name'    => 'notice_accept_label',
				'title'   => esc_html__( 'Accept Cookie Button Label', 'themeisle-companion' ),
				'type'    => 'text',
				'default' => esc_html__( 'Accept', 'themeisle-companion' ),
			),
		);
	}

	/**
	 * Method to define actions and filters needed for the module.
	 *
	 * @codeCoverageIgnore
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		// if the module is enabled
		if ( ! $this->is_policy_notice_active() ) {
			return;
		}

		$this->loader->add_action( 'update_option_wp_page_for_privacy_policy', $this, 'on_page_for_privacy_policy_save', 10, 3 );
		$this->loader->add_action( $this->get_slug() . '_before_options_save', $this, 'before_options_save', 10, 1 );

		// if the cookie policy is already accepted we quit.
		if ( isset( $_COOKIE['obfx-policy-consent'] ) && 'accepted' === $_COOKIE['obfx-policy-consent'] ) {
			return;
		}

		// only front-end hooks from now on
		$this->loader->add_action( 'wp_print_footer_scripts', $this, 'wp_print_footer_scripts' );
		$this->loader->add_action( 'wp_print_footer_scripts', $this, 'wp_print_footer_style' );
		$this->loader->add_action( 'wp_footer', $this, 'display_cookie_notice' );
	}

	/**
	 * Here we display the cookie bar template based on the given options.
	 */
	public function display_cookie_notice() {
		$policy_link   = get_option( 'wp_page_for_privacy_policy' ) ? get_permalink( (int) get_option( 'wp_page_for_privacy_policy' ) ) : '#';

		$policy_page   = $this->get_option( 'policy_page' );

		if ( ! empty( $policy_page ) ) {
			$policy_link = get_permalink( (int) get_option( 'wp_page_for_privacy_policy' ) );
		}

		$policy_text   = $this->get_option( 'policy_notice_text' );
		$policy_button = $this->get_option( 'notice_link_label' );
		$accept_button = $this->get_option( 'notice_accept_label' );

		$options = array(
			'policy_link'   => $policy_link,
			'policy_text'   => $policy_text,
			'policy_button' => $policy_button,
			'accept_button' => $accept_button,
		);

		// @TODO maybe think at some template system for a further hookable customization.

		// message output will start with a wrapper and an input tag which will decide if the template is visible or not
		$output = '<div class="obfx-cookie-bar-container"><input class="obfx-checkbox-cb" id="obfx-checkbox-cb" type="checkbox" />';

		// we'll add the buttons as a separate var and we'll start with the close button
		$buttons = '<label for="obfx-checkbox-cb" class="obfx-close-cb">X</label>';
		// the "Acceptance" button
		$buttons .= '<a href="#" id="obfx-accept-cookie-policy" >' . $accept_button . '</a>';
		// the "View Policy button"
		$buttons .= '<a href="' . $policy_link . '" >' . $policy_button . '</a>';

		// combine the buttons with the bar and close the wrapper.
		$output .= '<span class="obfx-cookie-bar">' . $policy_text . $buttons . '</span></div>';

		echo apply_filters( 'obfx_cookie_notice_output', $output, $options );
	}

	/**
	 * This script takes care of the cookie bar handling.
	 * For the moment we'll bind a cookie save to the "Agree" button click.
	 */
	public function wp_print_footer_scripts() { ?>
		<script>
			(function (window) {

				document.getElementById('obfx-accept-cookie-policy').addEventListener('click', function( e ) {
					e.preventDefault();
					var days = 365;
					var date = new Date();
					// @TODO add an option to select expiry days
					date.setTime(date.getTime() + 24 * days * 60 * 60 * 1e3);

					// save the cookie
					document.cookie = 'obfx-policy-consent=accepted; expires=' + date.toGMTString() + '; path=/';

					// after we get the acceptance cookie we can close the box
					document.getElementById('obfx-checkbox-cb').checked = true;

				}, false);

			})(window);
		</script><?php
	}

	/**
	 * This modules needs a few CSS lines so there is no need to load a file for it.
	 */
	public function wp_print_footer_style() { ?>
		<style>
			.obfx-cookie-bar-container {
				height: 0;
			}
			
			.obfx-checkbox-cb {
				display: none;
			}

			.obfx-cookie-bar {
				padding: 12px 25px;
				position: fixed;
				z-index: 9999;
				text-align: center;
				bottom: 0;
				left: 0;
				right: 0;
				display: block;
				min-height: 40px;
				background: #fff;
				border: 1px solid #333;
			}

			.obfx-cookie-bar a {
				padding: 0 8px;
				text-decoration: underline;
				font-weight: bold;
			}

			.obfx-checkbox-cb:checked + .obfx-cookie-bar {
				display: none;
			}

			.obfx-close-cb {
				position: absolute;
				right: 5px;
				top: 12px;
				width: 20px;
				cursor: pointer;
			}
		</style>
	<?php }

	/**
	 * When the core privacy page is changed, we'll also change the option within our module.
	 *
	 * @param $old_value
	 * @param $value
	 * @param $option
	 *
	 * @return mixed
	 */
	public function on_page_for_privacy_policy_save( $old_value, $value, $option ){

		// if this action comes from our dashboard we need to stop and avoid a save loop.
		if( doing_action( $this->get_slug() . '_before_options_save' ) ){
			return $value;
		}

		$this->set_option( 'policy_page', $value );

		return $value;
	}

	/**
	 * When the OrbitFox Module changes it's value, we also need to change the core version.
	 * @param $options
	 */
	public function before_options_save( $options ){

		// the default option doesn't need a a change.
		if ( empty( $options ) ) {
			return;
		}

		// there is no need to change something to it's own value.
		if ( $options['policy_page'] === get_option( 'wp_page_for_privacy_policy' ) ) {
			return;
		}

		update_option( 'wp_page_for_privacy_policy', $options['policy_page'] );

	}

	/**
	 * Check if safe updates is turned on.
	 *
	 * @return bool Safe updates status.
	 */
	private function is_policy_notice_active() {
		return (bool) $this->get_option( 'enable_policy_notice' );
	}

	/**
	 * Return an array with all the pages but the first entry is an indicator to the policy selected in core.
	 *
	 * @return array
	 */
	private function get_policy_pages_array(){
		$core_policy_suffix	= '';
		$url = get_option( 'wp_page_for_privacy_policy' );
		if ( empty( $url ) ) {
			$core_policy_suffix	= ' (' . esc_html__( 'Not Set', 'themeisle-companion' ) . ')';
		}
		$options = array(
			'0' => esc_html__( 'Default Core Policy', 'themeisle-companion' ) . $core_policy_suffix
		);

		$pages = get_pages( array(
			'echo'              => '0',
			'post_status'       => array( 'draft', 'publish' ),
			'depth' => 0,
			'child_of' => 0,
			'selected' => 0,
			'value_field' => 'ID',
		) );

		if ( empty( $pages ) ) {
			return $options;
		}

		foreach ( $pages as $page ) {
			$options[ $page->ID ] = $page->post_title;
		}

		return $options;
	}
}home/xbodynamge/www/wp-content/plugins/themeisle-companion/obfx_modules/safe-updates/init.php000064400000035363151152002200026715 0ustar00<?php
/**
 * A module to check changes before theme updates.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Theme_Update_Check_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Theme_Update_Check_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Safe_Updates_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * @var string ThemeCheck api endpoint.
	 */
	const API_ENDPOINT = 'https://dashboard.orbitfox.com/api/obfxhq/v1/updates/create/';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->beta        = true;
		$this->no_save     = true;
		$this->name        = __( 'Safe Updates', 'themeisle-companion' );
		$this->description = __( 'OrbitFox will give you visual feedback on how your current theme updates will affect your site. For the moment this is available only for wordpress.org themes.', 'themeisle-companion' );
	}

	/**
	 * Method to determine if the module is enabled or not.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return ( $this->beta ) ? $this->is_lucky_user() : true;
	}

	/**
	 * The method for the module load logic.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return mixed
	 */
	public function load() {
		return;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		if ( ! $this->is_safe_updates_active() ) {
			return array();
		}
		$current_screen = get_current_screen();
		if ( $current_screen->id != 'themes' && $current_screen->id != 'update-core' ) {
			return array();
		}
		$info = $this->is_update_available();

		if ( empty( $info ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return array();
		}
		$this->localized = array(
			'theme-update-check' => array(
				'slug' => $this->get_active_theme_dir(),
			),
		);
		$changes_info    = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$this->localized['theme-update-check']['check_msg'] = $changes_info;

		return array(
			'js' => array(
				'theme-update-check' => array( 'jquery', 'wp-lists', 'backbone' ),
			),
		);
	}

	/**
	 * Check if safe updates is turned on.
	 *
	 * @return bool Safe updates status.
	 */
	private function is_safe_updates_active() {

		return (bool) $this->get_option( 'auto_update_checks' );
	}

	/**
	 * Check if there is an update available.
	 *
	 * @param null $transient Transient to check.
	 *
	 * @return bool Is update available?
	 */
	private function is_update_available( $transient = null ) {

		if ( $transient === null ) {
			$transient = get_site_transient( 'update_themes' );
		}

		$slug = $this->get_active_theme_dir();

		if ( ! isset( $transient->response[ $slug ]['new_version'] ) ) {
			return false;
		}
		if ( version_compare( $transient->response[ $slug ]['new_version'], $transient->checked[ $slug ], '>' ) ) {
			$transient->response[ $slug ]['current_version'] = $transient->checked[ $slug ];

			$this->changes_check( $transient->response[ $slug ] );

			return $transient->response[ $slug ];
		}

		return false;
	}

	/**
	 * Check remote api for safe updates data.
	 *
	 * @param array $info Theme details.
	 *
	 * @return array Remote api message.
	 */
	private function changes_check( $info ) {
		if ( ! isset( $info['theme'] ) || empty( $info['theme'] ) ) {
			return array();
		}
		if ( ! isset( $info['new_version'] ) || empty( $info['new_version'] ) ) {
			return array();
		}
		if ( ! isset( $info['current_version'] ) || empty( $info['current_version'] ) ) {
			return array();
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( ! empty( $data ) ) {
			return $data;
		}
		/**
		 * Set lock and prevent calling the api for the next 30s.
		 */
		ksort( $request_data );
		$cache_key = 'obfx_su_' . md5( serialize( $request_data ) );
		$lock      = get_transient( $cache_key );
		if ( $lock === 'yes' ) {
			return array();
		}
		$response = wp_remote_post( self::API_ENDPOINT, array(
				'method'  => 'POST',
				'timeout' => 2,
				'body'    => $request_data,
			)
		);
		if ( is_wp_error( $response ) ) {
			return array();
		}
		$response_data = json_decode( wp_remote_retrieve_body( $response ), true );
		if ( ! is_array( $response_data ) ) {
			return array();
		}

		set_transient( $cache_key, 'yes', 30 );

		if ( strval( $response_data['code'] ) !== '200' ) {
			return array();
		}
		$response_data = $response_data['data'];
		if ( ! is_array( $response_data ) ) {
			return array();
		}
		$option_data = array(
			$this->get_safe_updates_hash( $request_data ) => $response_data,
		);

		$this->set_option( 'checks', $option_data );

		return $response_data;
	}

	/**
	 * Get cached safe updates api data.
	 *
	 * @param array $args Args to check.
	 *
	 * @return array Api data.
	 */
	private function get_safe_updates_data( $args = array() ) {

		$payload_sha = $this->get_safe_updates_hash( $args );
		$checks      = $this->get_option( 'checks' );

		if ( ! isset( $checks[ $payload_sha ] ) || empty( $checks[ $payload_sha ] ) || ! is_array( $checks[ $payload_sha ] ) || $checks[ $payload_sha ]['theme'] !== $args['theme'] ) {
			return array();
		}

		return $checks[ $payload_sha ];
	}

	/**
	 * Get hash key based on the request data.
	 *
	 * @param array $args Arguments used to generate hash.
	 *
	 * @return string Hash key.
	 */
	private function get_safe_updates_hash( $args = array() ) {
		ksort( $args );

		$payload_sha = hash_hmac( 'sha256', json_encode( $args ), self::API_ENDPOINT );

		return $payload_sha;
	}

	/**
	 * Return message string for safe updates notice.
	 *
	 * @param array $args Message placeholder.
	 *
	 * @return string Message string.
	 */
	public function get_message_notice( $args ) {
		$diff    = floatval( $args['global_diff'] );
		$message = sprintf(
			__( 'According to OrbitFox<sup>&copy;</sup> there is a visual difference of %1$s &#37; between your current version and the latest one. ', 'themeisle-companion' ),
			number_format( $diff, 2 )
		//$args['new_version']
		);
		if ( $diff > 0.1 ) {
			$message .= sprintf( '<a href="%1$s" target="_blank">', add_query_arg( array( 'from_orbitfox' => 'yes' ), $args['gallery_url'] ) ) . __( 'View report', 'themeisle-companion' ) . '</a> ';
		} else {
			$message .= __( 'Is very likely that the update is safe. ', 'themeisle-companion' );
		}

		return $message;

	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {

		add_filter( 'obfx_custom_control_auto_update_toggle', array( $this, 'render_custom_control' ) );

		add_action( 'admin_footer', array( $this, 'admin_inline_js' ) );
		add_action( 'rest_api_init', array( $this, 'register_endpoints' ) );
		if ( ! $this->get_is_active() ) {
			$this->set_option( 'auto_update_checks', '0' );
		}

		return array(
			array(
				'name'    => 'checks',
				'type'    => 'custom',
				'default' => array(),
			),
			array(
				'id'   => 'auto_update_toggle',
				'name' => 'auto_update_toggle',
				'type' => 'custom',
			),
		);
	}

	/**
	 * Render custom control outpu.
	 *
	 * @return string Custom control output.
	 */
	public function render_custom_control() {

		if ( ! $this->is_wp_available() ) {
			add_action( 'shutdown', function () {
				$this->set_status( 'active', false );
			} );

			return __( 'Unfortunately, our service is available only if your are using an wordpress.org theme. We are still working to extend this feature to custom and premium themes soon. ', 'themeisle-companion' );
		}

		$output = '<label>' . __( 'OrbitFox<sup>&copy;</sup> will need your current theme slug in order to run a visual comparison report between your current and latest version. We will need your consent in order to do this. <br/>Read <a href="https://orbitfox.com/safe-updates/" target="_blank"><b>more</b></a> about this process.', 'themeisle-companion' ) . '';
		if ( ! $this->is_safe_updates_active() ) {
			$output .= '</label></br></br><a  id="obfx-safe-updates-allow" class="btn btn-success" href="#"><span class="dashicons dashicons-yes"></span>   <span>' . __( 'Allow', 'themeisle-companion' ) . '</span></a>';
		} else {
			$output .= '  If want to disable the update feedback, you can disable the module from the upper module list 	&#8593;</label><br/><br/>';
			$output .= $this->get_safe_updates_status();

		}

		return $output;
	}

	/**
	 * Check if theme is available on wp.org.
	 *
	 * @return bool Check result.
	 */
	private function is_wp_available() {

		$slug      = $this->get_active_theme_dir();
		$cache_key = $slug . '_wporg_check';
		$cache     = get_transient( $cache_key );
		if ( $cache !== false ) {
			return $cache === 'yes';
		}
		$response = wp_remote_get( 'http://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]=' . $slug );
		if ( is_wp_error( $response ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = wp_remote_retrieve_body( $response );
		if ( empty( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}
		$body = json_decode( $body, true );
		if ( ! is_array( $body ) ) {
			set_transient( $cache_key, 'no', HOUR_IN_SECONDS );

			return false;
		}

		set_transient( $cache_key, 'yes', HOUR_IN_SECONDS );

		return true;
	}

	/**
	 * Get safe update process message.
	 *
	 * @return string Safe updates process message.
	 */
	private function get_safe_updates_status() {
		$theme_data = $this->is_update_available();
		if ( $theme_data === false ) {
			return __( 'For the moment there is no update for your current theme. We will display a notice on the themes page as soon as there is one.', 'themeisle-companion' );

		}
		$changes = $this->changes_check( $theme_data );
		if ( empty( $changes ) ) {
			return __( 'OrbitFox<sup>&copy;</sup> is now running a visual report for your theme update. Please check the themes <a href="' . admin_url( 'themes.php' ) . '" target="_blank">update</a> page in a few minutes to see the result.', 'themeisle-companion' );
		}

		return '<pre class=" obfx-sf-feedback-notice  mb-10">' . $this->get_message_notice( $changes ) . '</pre>';

	}

	/**
	 * Method to define actions and filters needed for the module.
	 *
	 * @codeCoverageIgnore
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		if ( ! $this->is_safe_updates_active() ) {
			return;
		}

		$this->loader->add_filter( 'wp_prepare_themes_for_js', $this, 'theme_update_message' );
	}

	/**
	 * Register module safe updates feedback.
	 */
	public function register_endpoints() {
		register_rest_route(
			'obfx', '/enable_safe_updates', array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'permission_callback' => function ( \WP_REST_Request $request ) {
						return current_user_can( 'manage_options' );
					},
					'callback'            => array( $this, 'safe_updates_enabler' ),
				),
			)
		);
	}

	/**
	 * Enable safe updates feedback.
	 *
	 * @param WP_REST_Request $request Rest request.
	 *
	 * @return WP_REST_Response Feedback response.
	 */
	public function safe_updates_enabler( WP_REST_Request $request ) {
		$status   = $request->get_param( 'status' );
		$response = array(
			'message' => '',
			'data'    => '',
			'code'    => 'error',

		);
		if ( $status !== 'activate' && $status !== 'deactivate' ) {
			return new WP_REST_Response( $response );
		}
		if ( $status === 'deactivate' ) {
			$this->set_option( 'auto_update_checks', '0' );
			$response = wp_parse_args( array(
				'code'    => 'success',
				'message' => __( 'Safe updates disabled', 'themeisle-companion' )
			) );

			return new WP_REST_Response( $response );
		}
		$this->set_option( 'auto_update_checks', '1' );

		$status   = $this->get_safe_updates_status();
		$response = wp_parse_args( array(
			'code'    => 'success',
			'message' => $status
		) );

		return new WP_REST_Response( $response );

	}

	/**
	 * Add logic for module options.
	 */
	public function admin_inline_js() {
		wp_enqueue_script( 'wp-api' );

		$enable_safe_updates = get_rest_url( null, 'obfx/enable_safe_updates' );
		?>
		<script type='text/javascript'>
			(function ($) {
				$('#obfx-safe-updates-allow').on('click', function (event) {
					var btn = $(this);
					btn.addClass('loading');
					$("#obfx-sf-update-error").remove();
					wp.apiRequest({
						url: "<?php echo esc_url( $enable_safe_updates ); ?>",
						data: {status: 'activate'},
						type: 'POST',
						dataType: 'json'
					}).done(function (response) {
						btn.removeClass('loading');
						if (response.code === 'success') {
							btn.hide();
							btn.after(response.message);
						} else {
							btn.after('<p class="label label-error mb-10" id="obfx-sf-update-error">' + response.message + '</p>');
						}

					}).fail(function (e) {
						btn.removeClass('loading');
						$("#obfx-sf-update-error").remove();
						btn.after('<p class="label label-error">Can not activate the option. Please try again later.</p>');
					});
					return false;
				});
			})(jQuery)
		</script>
		<?php
	}

	/**
	 * Alter theme update message.
	 *
	 * @param array $themes List of themes.
	 *
	 * @return mixed Altered message.
	 */
	public function theme_update_message( $themes ) {

		if ( ! $this->is_safe_updates_active() ) {
			return $themes;
		}
		$info = $this->is_update_available();
		if ( empty( $info ) ) {
			return $themes;
		}
		$request_data = array(
			'theme'           => $info['theme'],
			'current_version' => $info['current_version'],
			'next_version'    => $info['new_version'],
		);

		$data = $this->get_safe_updates_data( $request_data );
		if ( empty( $data ) ) {
			return $themes;
		}
		$changes_info = $this->get_message_notice( array(
			'global_diff'     => $data['global_diff'],
			'current_version' => $info['current_version'],
			'new_version'     => $info['new_version'],
			'gallery_url'     => $data['gallery_url'],
		) );

		$themes[ $info['theme'] ]['update'] = $themes[ $info['theme'] ]['update'] . $changes_info;

		return $themes;
	}

}home/xbodynamge/www/wp-content/plugins/themeisle-companion/obfx_modules/beaver-widgets/init.php000064400000005427151152016040027251 0ustar00<?php
/**
 * Beaver Builder modules Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      2.2.5
 */

define( 'BEAVER_WIDGETS_PATH', plugin_dir_path( __FILE__ ) );
define( 'BEAVER_WIDGETS_URL', plugins_url( '/', __FILE__ ) );

/**
 * Class Beaver_Widgets_OBFX_Module
 */
class Beaver_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * Beaver_Widgets_OBFX_Module constructor.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Page builder widgets', 'themeisle-companion' );
		$this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' );
		$this->active_default = true;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		return is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active('bb-plugin/fl-builder.php');
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'init', $this, 'load_widgets_modules' );
		$this->loader->add_action( 'init_themeisle_content_forms', $this, 'load_content_forms' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Require Beaver Builder modules
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load_widgets_modules(){
		if ( class_exists( 'FLBuilder' ) ) {
			require_once 'modules/pricing-table/pricing-table.php';
			require_once 'modules/services/services.php';
			require_once 'modules/post-grid/post-grid.php';
		}
	}

	/**
	 * If the content-forms library is available we should make the forms available for elementor
	 */
	public function load_content_forms() {
		if ( class_exists( '\ThemeIsle\ContentForms\ContactForm' ) ) {
			\ThemeIsle\ContentForms\ContactForm::instance();
			\ThemeIsle\ContentForms\NewsletterForm::instance();
			\ThemeIsle\ContentForms\RegistrationForm::instance();
		}
	}
}home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/google-analytics/init.php000064400000022401151154141210027523 0ustar00<?php
/**
 * The Mock-up to demonstrate and test module use.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Uptime_Monitor_OBFX_Module
 */

/**
 * The class defines a new module to be used by Orbit Fox plugin.
 *
 * @package    Uptime_Monitor_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 */
class Google_Analytics_OBFX_Module extends Orbit_Fox_Module_Abstract {
	/**
	 * @var string Uptime api endpoint.
	 */
	private $api_url = 'https://analytics.orbitfox.com/api/pirate-bridge/v1';

	/**
	 * Test_OBFX_Module constructor.
	 *
	 * @since   4.0.3
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name        = __( 'Analytics Integration', 'themeisle-companion' );
		$this->description = __( 'A module to integrate Google Analytics into your site easily.', 'themeisle-companion' );
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method called on module activation.
	 * Calls the API to register an url to monitor.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function after_options_save() {
	}

	/**
	 * Method invoked before options save.
	 *
	 * @since   2.3.3
	 * @access  public
	 */
	public function before_options_save() {
		$this->deactivate();
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'rest_api_init', $this, 'register_endpoints' );
		$this->loader->add_action( 'current_screen', $this, 'maybe_save_obfx_token' );
		$this->loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_analytics_scripts' );
		$this->loader->add_action( 'wp_head', $this, 'output_analytics_code', 0 );
	}

	/**
	 * Register endpoint for refreshing analytics.
	 */
	public function register_endpoints() {
		register_rest_route( 'obfx-' . $this->slug, '/obfx-analytics', array(
			array(
				'methods'  => WP_REST_Server::CREATABLE,
				'callback' => array( $this, 'refresh_tracking_links' )
			),
		) );
	}

	/**
	 * Refresh Tracking links.
	 *
	 * @return array|bool|WP_Error
	 */
	public function refresh_tracking_links() {

		if ( ! current_user_can( 'manage_options' ) ) {
			return false;
		}

		$obfx_token = get_option( 'obfx_token', '' );

		if ( ( $_POST['deactivate'] === 'unregister' ) ) {
			return $this->unregister_website( $obfx_token );
		}
		if ( empty( $obfx_token ) ) {
			return new WP_Error( '200', 'Your site is not registered.' );
		}
		$this->get_tracking_codes( $obfx_token, true );
	}

	/**
	 * Unregister website.
	 *
	 * @param $obfx_token
	 *
	 * @return array|bool|WP_Error
	 */
	public function unregister_website( $obfx_token ) {
		if ( ! isset( $obfx_token ) ) {
			return false;
		}
		delete_option( 'obfx_token' );
		delete_option( 'obfx_google_accounts_tracking_codes' );
		$req_headers = array( 'x-obfx-auth' => $obfx_token );
		$req_body    = array( 'site_url' => home_url(), 'site_hash' => $this->get_site_hash() );

		$request = wp_remote_post( $this->api_url . '/remove_website',
			array(
				'headers' => $req_headers,
				'body'    => $req_body,
			) );

		return $request;
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Enqueue JavaScript that requires localization.
	 */
	public function enqueue_analytics_scripts() {
		$script_handle = $this->slug . '-script';
		wp_register_script( $script_handle, plugin_dir_url( $this->get_dir() ) . $this->slug . '/js/script.js', array( 'jquery' ), $this->version );
		wp_localize_script( $script_handle, 'obfxAnalyticsObj',
			array(
				'url'   => $this->get_endpoint_url( '/obfx-analytics' ),
				'nonce' => wp_create_nonce( 'wp_rest' ),
			) );
		wp_enqueue_script( $script_handle );
	}

	/**
	 * Returns rest endpoint url.
	 *
	 * @param string $path
	 *
	 * @return string
	 */
	public function get_endpoint_url( $path = '' ) {
		return rest_url( 'obfx-' . $this->slug . $path );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array|boolean
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		$token = get_option( 'obfx_token', '' );
		if ( empty( $token ) ) {
			$url = $this->api_url . '/auth';
			$url = add_query_arg( array(
				'site_hash'   => $this->get_site_hash(),
				'site_url'    => home_url(),
				'site_return' => admin_url( 'admin.php?page=obfx_companion#obfx-mod-google-analytics' ),
			), $url );

			return array(
				array(
					'id'         => 'google_signin',
					'name'       => 'google_signin',
					'type'       => 'link',
					'url'        => $url,
					'link-class' => 'btn btn-success',
					'text'       => '<span class="dashicons dashicons-googleplus obfx-google"></span>' . __( 'Authenticate with Google', 'themeisle-companion' ),
				),
			);
		}

		$options = array( '-' => __( 'Select a tracking code', 'themeisle-companion' ) . '...' );

		$accounts = get_option( 'obfx_google_accounts_tracking_codes', array() );

		if ( ! empty ( $accounts ) ) {
			foreach ( $accounts as $account ) {
				$options[ $account->tracking_code ] = $account->account_name . ' - ' . $account->tracking_code;
			}
		}

		return array(

			array(
				'id'         => 'analytics_accounts_refresh',
				'name'       => 'analytics_accounts_refresh',
				'type'       => 'link',
				'link-class' => 'btn btn-primary btn-sm',
				'link-id'    => 'refresh-analytics-accounts',
				'text'       => '<i class="dashicons dashicons-update"></i> ' . __( 'Refresh Accounts', 'themeisle-companion' ),
				'url'        => ''
			),
			array(
				'id'      => 'analytics_accounts_select',
				'name'    => 'analytics_accounts_select',
				'type'    => 'select',
				'options' => $options,
				'default' => '-',
			),
			array(
				'id'         => 'analytics_accounts_unregister',
				'name'       => 'analytics_accounts_unregister',
				'type'       => 'link',
				'link-class' => 'btn btn-sm',
				'link-id'    => 'unregister-analytics',
				'text'       => '<i class="dashicons dashicons-no"></i>' . __( 'Unregister Site', 'themeisle-companion' ),
				'url'        => ''
			)
		);
	}

	/**
	 * Get tracking codes from server.
	 *
	 * @param string $obfx_token
	 * @param bool $forced
	 *
	 * @return bool|string
	 */
	public function get_tracking_codes( $obfx_token = '', $forced = false ) {

		if ( empty( $obfx_token ) ) {
			return false;
		}

		$req_headers = array( 'x-obfx-auth' => $obfx_token );
		$req_body    = array(
			'site_url'      => home_url(),
			'site_hash'     => $this->get_site_hash(),
			'forced_update' => 'not_forced'
		);

		if ( $forced === true ) {
			$req_body['forced_update'] = 'forced_update';
		}

		$request = wp_remote_post( $this->api_url . '/get_tracking_links',
			array(
				'headers' => $req_headers,
				'body'    => $req_body,
			) );

		if ( empty ( $request['body'] ) ) {
			return false;
		}
		$accounts = json_decode( $request['body'] );
		if ( empty( $accounts ) ) {
			return false;
		}

		update_option( 'obfx_google_accounts_tracking_codes', $accounts );
	}

	/**
	 * Generate a website hash.
	 *
	 * @return string
	 */
	private final function get_site_hash() {
	    $hash_base = '';
        if( defined ( 'AUTH_KEY' ) && defined ('SECURE_AUTH_KEY' ) && defined ('LOGGED_IN_KEY' ) ){
            $hash_base = AUTH_KEY . SECURE_AUTH_KEY . LOGGED_IN_KEY;
        }else{
            $hash_base = sha1(ABSPATH ) . sha1( get_site_url( ) );
        }
		$pre_hash = rtrim( ltrim( sanitize_text_field( preg_replace( '/[^a-zA-Z0-9]/', '', $hash_base ) ) ) );
		if ( function_exists( 'mb_strimwidth' ) ) {
			return mb_strimwidth( $pre_hash, 0, 100 );
		}

		return substr( $pre_hash, 0, 100 );
	}

	public final function maybe_save_obfx_token() {
		$obfx_token = isset( $_GET['obfx_token'] ) ? sanitize_text_field( $_GET['obfx_token'] ) : '';
		if ( empty( $obfx_token ) ) {
			return '';
		}
		if ( ! is_admin() ) {
			return '';
		}
		$current_screen = get_current_screen();
		if ( ! isset( $current_screen->id ) ) {
			return '';
		}
		if ( $current_screen->id !== 'toplevel_page_obfx_companion' ) {
			return '';
		}
		if ( ! current_user_can( 'manage_options' ) ) {
			return '';
		}
		update_option( 'obfx_token', $obfx_token );
		$this->get_tracking_codes( $obfx_token );
		wp_safe_redirect( admin_url( 'admin.php?page=obfx_companion' ) );

	}

	public final function output_analytics_code() {
		$ua_code = $this->get_option( 'analytics_accounts_select' ); ?>
		<!-- Google Analytics -->
		<!-- Global site tag (gtag.js) - Google Analytics -->
		<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_attr( $ua_code ); ?>"></script>
		<script>
			window.dataLayer = window.dataLayer || [];

			function gtag() {
				dataLayer.push( arguments );
			}

			gtag( 'js', new Date() );

			gtag( 'config', '<?php echo esc_attr( $ua_code ); ?>' );
		</script>
		<!-- End Google Analytics -->
		<?php
	}
}home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/gutenberg-blocks/init.php000064400000005076151156350310027535 0ustar00<?php
/**
 * Gutenberg Blocks modules Orbit Fox Module.
 *
 * @link       https://themeisle.com
 * @since      2.2.5
 */

/**
 * Class Gutenberg_Blocks_OBFX_Module
 */
class Gutenberg_Blocks_OBFX_Module extends Orbit_Fox_Module_Abstract {

	protected $blocks_classes = array();

	/**
	 * Gutenberg_Blocks_OBFX_Module constructor.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Gutenberg Blocks', 'themeisle-companion' );
		$this->description    = __( 'A set of awesome Gutenberg Blocks!', 'themeisle-companion' );
		$this->active_default = false;
	}

	/**
	 * Determine if module should be loaded.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		global $wp_version;

		if ( version_compare( $wp_version, '5.0', '>=' ) ) {
			return true;
		}

		require_once( ABSPATH . 'wp-admin' . '/includes/plugin.php' );
		if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
			return true;
		}

		return false;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   2.2.5
	 * @access  public
	 */
	public function hooks() {
		$this->loader->add_action( 'enqueue_block_assets', $this, 'enqueue_block_assets' );
		$this->loader->add_action( 'init', $this, 'load_gutenberg_blocks' );
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		return array();
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   2.2.5
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	/**
	 * Load assets for our blocks.
	 */
	function enqueue_block_assets() {
		wp_enqueue_style( 'font-awesome-5', plugins_url( 'assets/fontawesome/css/all.min.css', __FILE__ ) );
		wp_enqueue_style( 'font-awesome-4-shims', plugins_url( 'assets/fontawesome/css/v4-shims.min.css', __FILE__ ) );
	}

	/**
	 * If the composer library is present let's try to init.
	 */
	function load_gutenberg_blocks() {
		if ( class_exists( '\ThemeIsle\GutenbergBlocks' ) ) {
			\ThemeIsle\GutenbergBlocks::instance( __( 'Orbit Fox', 'themeisle-companion' ) );
		}
	}

}
home/xbodynamge/dev/wp-content/plugins/themeisle-companion/obfx_modules/mystock-import/init.php000064400000017344151156577720027322 0ustar00<?php
/**
 * The module for mystock import.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Mystock_Import_OBFX_Module
 */

/**
 * The class for mystock import.
 *
 * @package    Mystock_Import_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Mystock_Import_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * The api key.
	 */
	const API_KEY = '97d007cf8f44203a2e578841a2c0f9ac';

	/**
	 * The number of images to fetch. Only the first page will be fetched.
	 */
	const MAX_IMAGES = 40;

	/**
	 * The username of the flickr account.
	 */
	const USER_NAME = 'themeisle';

	/**
	 * The cache time.
	 */
	const CACHE_DAYS = 7;


	/**
	 * Mystock_Import_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Mystock Import', 'themeisle-companion' );
		$this->description    = __( 'Module to import images directly from', 'themeisle-companion' ) . sprintf( ' <a href="%s" target="_blank">mystock.photos</a>', 'https://mystock.photos' );
		$this->active_default = true;
	}


	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		/*Get tab content*/
		$this->loader->add_action( 'wp_ajax_get-tab-' . $this->slug, $this, 'get_tab_content' );
		$this->loader->add_action( 'wp_ajax_infinite-' . $this->slug, $this, 'infinite_scroll' );
		$this->loader->add_action( 'wp_ajax_handle-request-' . $this->slug, $this, 'handle_request' );
		$this->loader->add_filter( 'media_view_strings', $this, 'media_view_strings' );
	}

	/**
	 * Display tab content.
	 */
	public function get_tab_content() {
		$urls = $this->get_images();
		require $this->get_dir() . "/inc/photos.php";
		wp_die();
	}

	/**
	 * Request images from flickr.
	 *
	 * @param int $page Page to load.
	 *
	 * @return array
	 */
	private function get_images( $page = 1 ) {
		$photos = get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_' . $page );
		if ( ! $photos ) {
			require_once $this->get_dir() . '/vendor/phpflickr/phpflickr.php';
			$api    = new phpFlickr( self::API_KEY );
			$user   = $api->people_findByUsername( self::USER_NAME );
			$photos = array();
			if ( $user && isset( $user['nsid'] ) ) {
				$photos = $api->people_getPublicPhotos( $user['nsid'], null, 'url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', self::MAX_IMAGES, $page );
				if ( ! empty( $photos ) ) {
					$pages = get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages' );
					if ( false === $pages ) {
						set_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages', $photos['photos']['pages'], self::CACHE_DAYS * DAY_IN_SECONDS );
					}
					$photos = $photos['photos']['photo'];
				}
			}
			set_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_' . $page, $photos, self::CACHE_DAYS * DAY_IN_SECONDS );
		}

		return $photos;
	}

	/**
	 * Upload image.
	 */
	function handle_request() {
		check_ajax_referer( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ), 'security' );

		if ( ! isset( $_POST['url'] ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}

		$url      = $_POST['url'];
		$name     = basename( $url );
		$tmp_file = download_url( $url );
		if ( is_wp_error( $tmp_file ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		$file             = array();
		$file['name']     = $name;
		$file['tmp_name'] = $tmp_file;
		$image_id         = media_handle_sideload( $file, 0 );
		if ( is_wp_error( $image_id ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		$attach_data = wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) );
		if ( is_wp_error( $attach_data ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		wp_update_attachment_metadata( $image_id, $attach_data );

		wp_send_json_success( array( 'id' => $image_id ) );
	}

	/**
	 * Ajax function to load new images.
	 */
	function infinite_scroll() {
		check_ajax_referer( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ), 'security' );

		if ( ! isset( $_POST['page'] ) ) {
			wp_die();
		}

		//Update last page that was loaded
		$req_page = (int) $_POST['page'] + 1;

		//Request new page
		$response    = '';
		$new_request = $this->get_images( $req_page );
		if ( ! empty( $new_request ) ) {
			foreach ( $new_request as $photo ) {
				$response .= '<li class="obfx-image" data-page="' . esc_attr( $req_page ) . '" data-pid="' . esc_attr( $photo['id'] ) . '">';
				$response .= '<div class="obfx-preview"><div class="thumbnail"><div class="centered">';
				$response .= '<img src="' . esc_url( $photo['url_m'] ) . '">';
				$response .= '</div></div></div>';
				$response .= '<button type="button" class="check obfx-image-check" tabindex="0"><span class="media-modal-icon"></span><span class="screen-reader-text">' . esc_html__( 'Deselect', 'themeisle-companion' ) . '</span></button>';
				$response .= '</li>';
			}
		}

		echo $response;
		wp_die();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( ! in_array( $current_screen->id, array( 'post', 'page', 'post-new', 'upload' ) ) ) {
			return array();
		}

		$this->localized = array(
			'admin' => array(
				'ajaxurl' => admin_url( 'admin-ajax.php' ),
				'nonce'   => wp_create_nonce( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ),
				'l10n'    => array(
					'fetch_image_sizes'     => esc_html__( 'Fetching data', 'themeisle-companion' ),
					'upload_image'          => esc_html__( 'Downloading image. Please wait...', 'themeisle-companion' ),
					'upload_image_complete' => esc_html__( 'Your image was imported. Go to Media Library tab to use it.', 'themeisle-companion' ),
					'load_more'             => esc_html__( 'Loading more photos...', 'themeisle-companion' ),
					'tab_name'              => esc_html__( 'MyStock Library', 'themeisle-companion' ),
					'featured_image_new'    => esc_html__( 'Import & set featured image', 'themeisle-companion' ),
					'insert_image_new'      => esc_html__( 'Import & insert image', 'themeisle-companion' ),
					'featured_image'        => isset( $this->strings['setFeaturedImage'] ) ? $this->strings['setFeaturedImage'] : '',
					'insert_image'          => isset( $this->strings['insertIntoPost'] ) ? $this->strings['insertIntoPost'] : '',
				),
				'slug'    => $this->slug,
				'pages'   => get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages' ),
			),
		);

		return array(
			'js'  => array(
				'admin' => array( 'media-views' ),
			),
			'css' => array(
				'media' => array(),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	public function media_view_strings( $strings ) {
		$this->strings = $strings;

		return $strings;
	}
}