Current Path : /storage/v11800/testtest/public_html/wp-content/plugins/facebook-for-woocommerce/

Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64

Upload File :
Current File : /storage/v11800/testtest/public_html/wp-content/plugins/facebook-for-woocommerce/class-wc-facebookcommerce.php
<?php
// phpcs:ignoreFile
/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
 *
 * This source code is licensed under the license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @package FacebookCommerce
 */

require_once __DIR__ . '/includes/fbutils.php';

use Automattic\WooCommerce\Admin\Features\Features as WooAdminFeatures;
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists;
use WooCommerce\Facebook\Admin\Tasks\Setup;
use WooCommerce\Facebook\Admin\Notes\SettingsMoved;
use WooCommerce\Facebook\Framework\Api\Exception as ApiException;
use WooCommerce\Facebook\Framework\Helper;
use WooCommerce\Facebook\Framework\Plugin\Compatibility;
use WooCommerce\Facebook\Integrations\Bookings as BookingsIntegration;
use WooCommerce\Facebook\Lifecycle;
use WooCommerce\Facebook\ProductSync\ProductValidator as ProductSyncValidator;
use WooCommerce\Facebook\Utilities\Background_Handle_Virtual_Products_Variations;
use WooCommerce\Facebook\Utilities\Background_Remove_Duplicate_Visibility_Meta;
use WooCommerce\Facebook\Utilities\DebugTools;
use WooCommerce\Facebook\Utilities\Heartbeat;

class WC_Facebookcommerce extends WooCommerce\Facebook\Framework\Plugin {
	/** @var string the plugin version */
	const VERSION = WC_Facebook_Loader::PLUGIN_VERSION;

	/** @var string for backwards compatibility TODO: remove this in v2.0.0 {CW 2020-02-06} */
	const PLUGIN_VERSION = self::VERSION;

	/** @var string the plugin ID */
	const PLUGIN_ID = 'facebook_for_woocommerce';

	/** @var string the integration ID */
	const INTEGRATION_ID = 'facebookcommerce';

	/** @var string the product set categories meta name */
	const PRODUCT_SET_META = '_wc_facebook_product_cats';

	/** @var string the plugin user agent name to use for HTTP calls within User-Agent header */
	const PLUGIN_USER_AGENT_NAME = 'Facebook-for-WooCommerce';

	/** @var WC_Facebookcommerce singleton instance */
	protected static $instance;

	/** @var WooCommerce\Facebook\API instance */
	private $api;

	/** @var \WC_Facebookcommerce_Integration instance */
	private $integration;

	/** @var WooCommerce\Facebook\Admin admin handler instance */
	private $admin;

	/** @var WooCommerce\Facebook\Admin\Settings */
	private $admin_settings;

	/** @var WooCommerce\Facebook\AJAX Ajax handler instance */
	private $ajax;

	/** @var WooCommerce\Facebook\Products\Feed product feed handler */
	private $product_feed;

	/** @var Background_Handle_Virtual_Products_Variations instance */
	protected $background_handle_virtual_products_variations;

	/** @var Background_Remove_Duplicate_Visibility_Meta job handler instance */
	protected $background_remove_duplicate_visibility_meta;

	/** @var WooCommerce\Facebook\Products\Stock products stock handler */
	private $products_stock_handler;

	/** @var WooCommerce\Facebook\Products\Sync products sync handler */
	private $products_sync_handler;

	/** @var WooCommerce\Facebook\Products\Sync\Background background sync handler */
	private $sync_background_handler;

	/** @var WooCommerce\Facebook\ProductSets\Sync product sets sync handler */
	private $product_sets_sync_handler;

	/** @var WooCommerce\Facebook\Handlers\Connection connection handler */
	private $connection_handler;

	/** @var WooCommerce\Facebook\Handlers\WebHook webhook handler */
	private $webhook_handler;

	/** @var WooCommerce\Facebook\Commerce commerce handler */
	private $commerce_handler;

	/** @var WooCommerce\Facebook\Utilities\Tracker */
	private $tracker;

	/** @var WooCommerce\Facebook\Jobs\JobManager */
	public $job_manager;

	/** @var WooCommerce\Facebook\Utilities\Heartbeat */
	public $heartbeat;

	/** @var WooCommerce\Facebook\ExternalVersionUpdate */
	private $external_version_update;

	/** @var WooCommerce\Facebook\Feed\FeedConfigurationDetection instance. */
	private $configuration_detection;

	/** @var WooCommerce\Facebook\Products\FBCategories instance. */
	private $fb_categories;

	/**
	 * The Debug tools instance.
	 *
	 * @var WooCommerce\Facebook\Utilities\DebugTools
	 */
	private $debug_tools;

	/**
	 * Constructs the plugin.
	 *
	 * @since 1.0.0
	 */
	public function __construct() {
		parent::__construct(
			self::PLUGIN_ID,
			self::VERSION,
			[ 'text_domain' => 'facebook-for-woocommerce' ]
		);
		$this->init();
		$this->init_admin();
	}

	/**
	 * __get method for backward compatibility.
	 *
	 * @param string $key property name
	 * @return mixed
	 * @since 3.0.32
	 */
	public function __get( $key ) {
		// Add warning for private properties.
		if ( in_array( $key, array( 'configuration_detection', 'fb_categories' ), true ) ) {
			/* translators: %s property name. */
			_doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'The %s property is private and should not be accessed outside its class.', 'facebook-for-woocommerce' ), esc_html( $key ) ), '3.0.32' );
			return $this->$key;
		}

		return null;
	}

	/**
	 * Initializes the plugin.
	 *
	 * @internal
	 */
	public function init() {
		add_action( 'init', array( $this, 'get_integration' ) );
		add_action( 'init', array( $this, 'register_custom_taxonomy' ) );
		add_action( 'add_meta_boxes_product', array( $this, 'remove_product_fb_product_set_metabox' ), 50 );
		add_filter( 'fb_product_set_row_actions', array( $this, 'product_set_links' ) );
		add_filter( 'manage_edit-fb_product_set_columns', array( $this, 'manage_fb_product_set_columns' ) );

		// Hook the setup task. The hook admin_init is not triggered when the WC fetches the tasks using the endpoint: wp-json/wc-admin/onboarding/tasks and hence hooking into init.
		add_action( 'init', array( $this, 'add_setup_task' ), 20 );
		add_action( 'admin_notices', array( $this, 'add_inbox_notes' ) );

		// Product Set breadcrumb filters
		add_filter( 'woocommerce_navigation_is_connected_page', array( $this, 'is_current_page_conected_filter' ), 99, 2 );
		add_filter( 'woocommerce_navigation_get_breadcrumbs', array( $this, 'wc_page_breadcrumbs_filter' ), 99 );

		add_filter(
			'wc_' . WC_Facebookcommerce::PLUGIN_ID . '_http_request_args',
			array( $this, 'force_user_agent_in_latin' )
		);

		if ( \WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
			include_once 'facebook-commerce.php';

			require_once __DIR__ . '/includes/fbproductfeed.php';

			$this->heartbeat = new Heartbeat( WC()->queue() );
			$this->heartbeat->init();

			$this->product_feed              = new WooCommerce\Facebook\Products\Feed();
			$this->products_stock_handler    = new WooCommerce\Facebook\Products\Stock();
			$this->products_sync_handler     = new WooCommerce\Facebook\Products\Sync();
			$this->sync_background_handler   = new WooCommerce\Facebook\Products\Sync\Background();
			$this->configuration_detection   = new WooCommerce\Facebook\Feed\FeedConfigurationDetection();
			$this->product_sets_sync_handler = new WooCommerce\Facebook\ProductSets\Sync();
			$this->commerce_handler          = new WooCommerce\Facebook\Commerce();
			$this->fb_categories             = new WooCommerce\Facebook\Products\FBCategories();
			$this->external_version_update   = new WooCommerce\Facebook\ExternalVersionUpdate\Update();

			if ( wp_doing_ajax() ) {
				$this->ajax = new WooCommerce\Facebook\AJAX();
			}

			// Load integrations.
			require_once __DIR__ . '/includes/fbwpml.php';
			new WC_Facebook_WPML_Injector();
			new BookingsIntegration();

			if ( 'yes' !== get_option( 'wc_facebook_background_handle_virtual_products_variations_complete', 'no' ) ) {
				$this->background_handle_virtual_products_variations = new Background_Handle_Virtual_Products_Variations();
			}

			if ( 'yes' !== get_option( 'wc_facebook_background_remove_duplicate_visibility_meta_complete', 'no' ) ) {
				$this->background_remove_duplicate_visibility_meta = new Background_Remove_Duplicate_Visibility_Meta();
			}

			$this->connection_handler = new WooCommerce\Facebook\Handlers\Connection( $this );
			$this->webhook_handler    = new WooCommerce\Facebook\Handlers\WebHook( $this );
			$this->tracker            = new WooCommerce\Facebook\Utilities\Tracker();

			// Init jobs
			$this->job_manager = new WooCommerce\Facebook\Jobs\JobManager();
			add_action( 'init', [ $this->job_manager, 'init' ] );

			// Instantiate the debug tools.
			$this->debug_tools = new DebugTools();

			// load admin handlers, before admin_init
			if ( is_admin() ) {
				$this->admin_settings = new WooCommerce\Facebook\Admin\Settings( $this->connection_handler->is_connected() );
			}
		}
	}


	/**
	 * Initializes the admin handling.
	 *
	 * @internal
	 *
	 * @since 1.10.0
	 */
	public function init_admin() {
		add_action(
			'admin_init',
			function () {
				$this->admin = new WooCommerce\Facebook\Admin();
			},
			0
		);
	}

	/**
	 * Add Inbox notes.
	 */
	public function add_inbox_notes() {
		if ( Compatibility::is_enhanced_admin_available() ) {
			if ( class_exists( WooAdminFeatures::class ) ) {
				$is_marketing_enabled = WooAdminFeatures::is_enabled( 'marketing' );
			} else {
				$is_marketing_enabled = is_callable( '\Automattic\WooCommerce\Admin\Loader::is_feature_enabled' )
					&& \Automattic\WooCommerce\Admin\Loader::is_feature_enabled( 'marketing' );
			}

			if ( $is_marketing_enabled && class_exists( '\Automattic\WooCommerce\Admin\Notes\Note' ) ) { // Checking for Note class is for backward compatibility.
				SettingsMoved::possibly_add_or_delete_note();
			}
		}
	}

	/**
	 * Gets deprecated and removed hooks.
	 *
	 * @since 2.1.0
	 *
	 * @return array
	 */
	protected function get_deprecated_hooks() {
		return array(
			'wc_facebook_page_access_token' => array(
				'version'     => '2.1.0',
				'replacement' => false,
			),
		);
	}

	/**
	 * Adds the setup task to the Tasklists.
	 *
	 * @since 2.6.29
	 */
	public function add_setup_task() {
		if ( class_exists( TaskLists::class ) ) { // This is added for backward compatibility.
			TaskLists::add_task(
				'extended',
				new Setup(
					TaskLists::get_list( 'extended' )
				)
			);
		}
	}

	/**
	 * Get the last event from the plugin lifecycle.
	 *
	 * @since 2.6.29
	 * @return array
	 */
	public function get_last_event_from_history() {
		$last_event     = array();
		$history_events = $this->lifecycle_handler->get_event_history();

		if ( isset( $history_events[0] ) ) {
			$last_event = $history_events[0];
		}
		return $last_event;
	}

	public function add_wordpress_integration() {
		new WP_Facebook_Integration();
	}

	/**
	 * Saves errors or messages to WooCommerce Log (woocommerce/logs/plugin-id-xxx.txt)
	 *
	 * @since 2.3.3
	 * @param string $message error or message to save to log
	 * @param string $log_id optional log id to segment the files by, defaults to plugin id
	 */
	public function log( $message, $log_id = null ) {
		// Bail if site is connected and user has disabled logging.
		// If site is disconnected, force-enable logging so merchant can diagnose connection issues.
		if ( ( ! $this->get_integration() || ! $this->get_integration()->is_debug_mode_enabled() ) && $this->get_connection_handler()->is_connected() ) {
			return;
		}

		parent::log( $message, $log_id );
	}

	/**
	 * Logs an API request.
	 *
	 * @since 2.0.0
	 *
	 * @param array $request request data
	 * @param array $response response data
	 * @param null  $log_id log ID
	 */
	public function log_api_request( $request, $response, $log_id = null ) {
		// bail if logging isn't enabled
		if ( ! $this->get_integration() || ! $this->get_integration()->is_debug_mode_enabled() ) {
			return;
		}

		// Maybe remove headers from the debug log.
		if( ! $this->get_integration()->are_headers_requested_for_debug() ) {
			unset( $request['headers'] );
			unset( $response['headers'] );
		}

		$this->log( $this->get_api_log_message( $request ), $log_id );

		if ( ! empty( $response ) ) {
			$this->log( $this->get_api_log_message( $response ), $log_id );
		}
	}

	/**
	 * Remove Product Set metabox from Product edit page
	 *
	 * @since 2.3.0
	 */
	public function remove_product_fb_product_set_metabox() {
		remove_meta_box( 'fb_product_setdiv', 'product', 'side' );
	}

	/**
	 * Register Facebook Product Set Taxonomy
	 *
	 * @since 2.3.0
	 */
	public function register_custom_taxonomy() {
		$plural   = esc_html__( 'Facebook Product Sets', 'facebook-for-woocommerce' );
		$singular = esc_html__( 'Facebook Product Set', 'facebook-for-woocommerce' );

		$args = array(
			'labels'            => array(
				'name'                       => $plural,
				'singular_name'              => $singular,
				'menu_name'                  => $plural,
				// translators: Edit item label
				'edit_item'                  => sprintf( esc_html__( 'Edit %s', 'facebook-for-woocommerce' ), $singular ),
				// translators: Add new label
				'add_new_item'               => sprintf( esc_html__( 'Add new %s', 'facebook-for-woocommerce' ), $singular ),
				// translators: No items found text
				'not_found'                  => sprintf( esc_html__( 'No %s found.', 'facebook-for-woocommerce' ), $plural ),
				// translators: Search label
				'search_items'               => sprintf( esc_html__( 'Search %s.', 'facebook-for-woocommerce' ), $plural ),
				// translators: Text label
				'separate_items_with_commas' => sprintf( esc_html__( 'Separate %s with commas', 'facebook-for-woocommerce' ), $plural ),
				// translators: Text label
				'choose_from_most_used'      => sprintf( esc_html__( 'Choose from the most used %s', 'facebook-for-woocommerce' ), $plural ),
				// translators: Backlink item label
				'back_to_items'              => sprintf( esc_html__( '&larr; Go to %s', 'facebook-for-woocommerce' ), $plural ),
			),
			'hierarchical'      => true,
			'public'            => true,
			'show_in_nav_menus' => false,
			'show_tagcloud'     => false,
			'show_in_menu'      => false,
		);

		register_taxonomy( 'fb_product_set', array( 'product' ), $args );
	}


	/**
	 * Filter Facebook Product Set Taxonomy table links
	 *
	 * @since 2.3.0
	 *
	 * @param array $actions Item Actions.
	 *
	 * @return array
	 */
	public function product_set_links( $actions ) {
		unset( $actions['inline hide-if-no-js'] );
		unset( $actions['view'] );
		return $actions;
	}


	/**
	 * Remove posts count column from Facebook Product Set custom taxonomy
	 *
	 * @since 2.3.0
	 *
	 * @param array $columns Taxonomy columns.
	 *
	 * @return array
	 */
	public function manage_fb_product_set_columns( $columns ) {
		unset( $columns['posts'] );
		return $columns;
	}


	/**
	 * Filter WC Breadcrumbs when the page is Facebook Product Sets
	 *
	 * @since 2.3.0
	 *
	 * @param array $breadcrumbs Page breadcrumbs.
	 *
	 * @return array
	 */
	public function wc_page_breadcrumbs_filter( $breadcrumbs ) {

		if ( 'edit-fb_product_set' !== $this->get_current_page_id() ) {
			return $breadcrumbs;
		}

		$breadcrumbs = array(
			array( 'admin.php?page=wc-admin', 'WooCommerce' ),
			array( 'edit.php?post_type=product', 'Products' ),
		);

		$term_id = empty( $_GET['tag_ID'] ) ? '' : wc_clean( wp_unslash( $_GET['tag_ID'] ) ); //phpcs:ignore WordPress.Security
		if ( ! empty( $term_id ) ) {
			$breadcrumbs[] = array( 'edit-tags.php?taxonomy=fb_product_set&post_type=product', 'Products Sets' );
		}

		$breadcrumbs[] = ( empty( $term_id ) ? 'Product Sets' : 'Edit Product Set' );
		return $breadcrumbs;
	}


	/**
	 * Return that Facebook Product Set page is a WC Conected Page
	 *
	 * @since 2.3.0
	 *
	 * @param boolean $is_conected If it's connected or not.
	 *
	 * @return boolean
	 */
	public function is_current_page_conected_filter( $is_conected ) {
		if ( 'edit-fb_product_set' === $this->get_current_page_id() ) {
			return true;
		}

		return $is_conected;
	}

	/**
	 * Filter is responsible to always set latin user agent header value, because translated plugin names
	 * may contain characters which Facebook does not accept and return 400 response for requests with such
	 * header values.
	 * Applying either sanitize_title() nor remove_accents() on header value will not work for all the languages
	 * we support translations to e.g. Hebrew is going to convert into something %d7%90%d7%a8%d7%99%d7%92 which is
	 * not acceptable neither.
	 *
	 * @param array $http_request_headers - http request headers
	 * @return array
	 */
	public function force_user_agent_in_latin( array $http_request_headers ) {
		if ( isset( $http_request_headers['user-agent'] ) ) {
			$http_request_headers['user-agent'] = sprintf(
				'%s/%s (WooCommerce/%s; WordPress/%s)',
				WC_Facebookcommerce::PLUGIN_USER_AGENT_NAME,
				WC_Facebookcommerce::PLUGIN_VERSION,
				defined( 'WC_VERSION' ) ? WC_VERSION : WC_Facebook_Loader::MINIMUM_WC_VERSION,
				$GLOBALS['wp_version']
			);
		}
		return $http_request_headers;
	}


	/** Getter methods ********************************************************************************************/


	/**
	 * Gets the API instance.
	 *
	 * @since 2.0.0
	 *
	 * @param string $access_token access token to use for this API request
	 * @return WooCommerce\Facebook\API
	 * @throws ApiException
	 */
	public function get_api( string $access_token = '' ): WooCommerce\Facebook\API {
		// if none provided, use the general access token
		if ( ! $access_token ) {
			$access_token = $this->get_connection_handler()->get_access_token();
		}
		if ( ! is_object( $this->api ) ) {
			if ( ! $access_token ) {
				throw new ApiException( __( 'Cannot create the API instance because the access token is missing.', 'facebook-for-woocommerce' ) );
			}
			$this->api = new WooCommerce\Facebook\API( $access_token );
		} else {
			$this->api->set_access_token( $access_token );
		}
		return $this->api;
	}

	/**
	 * Gets the category handler.
	 *
	 * @since 1.11.0
	 *
	 * @return WooCommerce\Facebook\Products\FBCategories
	 */
	public function get_facebook_category_handler() {
		return $this->fb_categories;
	}

	/**
	 * Gets the background handle virtual products and variations handler instance.
	 *
	 * @since 2.0.0
	 *
	 * @return Background_Handle_Virtual_Products_Variations
	 */
	public function get_background_handle_virtual_products_variations_instance() {
		return $this->background_handle_virtual_products_variations;
	}


	/**
	 * Gets the background remove duplicate visibility meta data handler instance.
	 *
	 * @since 2.0.3
	 *
	 * @return Background_Remove_Duplicate_Visibility_Meta
	 */
	public function get_background_remove_duplicate_visibility_meta_instance() {
		return $this->background_remove_duplicate_visibility_meta;
	}


	/**
	 * Gets the products sync handler.
	 *
	 * @since 2.0.0
	 *
	 * @return WooCommerce\Facebook\Products\Sync
	 */
	public function get_products_sync_handler() {
		return $this->products_sync_handler;
	}


	/**
	 * Gets the products sync background handler.
	 *
	 * @since 2.0.0
	 *
	 * @return WooCommerce\Facebook\Products\Sync\Background
	 */
	public function get_products_sync_background_handler() {
		return $this->sync_background_handler;
	}


	/**
	 * Gets the connection handler.
	 *
	 * @since 2.0.0
	 *
	 * @return WooCommerce\Facebook\Handlers\Connection
	 */
	public function get_connection_handler() {
		return $this->connection_handler;
	}


	/**
	 * Gets the integration instance.
	 *
	 * @since 1.10.0
	 *
	 * @return WC_Facebookcommerce_Integration instance
	 */
	public function get_integration() {
		if ( null === $this->integration ) {
			$this->integration = new WC_Facebookcommerce_Integration( $this );
		}

		return $this->integration;
	}


	/**
	 * Gets the commerce handler instance.
	 *
	 * @since 2.1.0
	 *
	 * @return WooCommerce\Facebook\Commerce commerce handler instance
	 */
	public function get_commerce_handler() {
		return $this->commerce_handler;
	}

	/**
	 * Gets tracker instance.
	 *
	 * @since 2.6.0
	 *
	 * @return WooCommerce\Facebook\Utilities\Tracker
	 */
	public function get_tracker() {
		return $this->tracker;
	}

	/**
	 * Gets the debug profiling logger instance.
	 *
	 * @return WooCommerce\Facebook\Debug\ProfilingLogger
	 */
	public function get_profiling_logger() {
		static $instance = null;
		if ( null === $instance ) {
			$is_enabled = defined( 'FACEBOOK_FOR_WOOCOMMERCE_PROFILING_LOG_ENABLED' ) && FACEBOOK_FOR_WOOCOMMERCE_PROFILING_LOG_ENABLED;
			$instance   = new WooCommerce\Facebook\Debug\ProfilingLogger( $is_enabled );
		}

		return $instance;
	}

	/**
	 * Get the product sync validator class.
	 *
	 * @param WC_Product $product A product object to be validated.
	 *
	 * @return ProductSyncValidator
	 */
	public function get_product_sync_validator( WC_Product $product ) {
		return new ProductSyncValidator( $this->get_integration(), $product );
	}

	/**
	 * Gets the advertise tab page URL.
	 *
	 * @since 2.6.29
	 *
	 * @return string
	 */
	public function get_advertise_tab_url() {
		return admin_url( 'admin.php?page=wc-facebook&tab=advertise' );
	}

	/**
	 * Gets the settings page URL.
	 *
	 * @since 1.10.0
	 *
	 * @param null $plugin_id unused
	 * @return string
	 */
	public function get_settings_url( $plugin_id = null ) {
		return admin_url( 'admin.php?page=wc-facebook' );
	}

	/**
	 * Gets the plugin's documentation URL.
	 *
	 * @since 1.10.0
	 *
	 * @return string
	 */
	public function get_documentation_url() {
		return 'https://woocommerce.com/document/facebook-for-woocommerce/';
	}


	/**
	 * Gets the plugin's support URL.
	 *
	 * @since 1.10.0
	 *
	 * @return string
	 */
	public function get_support_url() {
		return 'https://wordpress.org/support/plugin/facebook-for-woocommerce/';
	}


	/**
	 * Gets the plugin's sales page URL.
	 *
	 * @since 1.10.0
	 *
	 * @return string
	 */
	public function get_sales_page_url() {
		return 'https://woocommerce.com/products/facebook/';
	}


	/**
	 * Gets the plugin's reviews URL.
	 *
	 * @since 1.10.0
	 *
	 * @return string
	 */
	public function get_reviews_url() {
		return 'https://wordpress.org/support/plugin/facebook-for-woocommerce/reviews/';
	}


	/**
	 * Gets the plugin name.
	 *
	 * @since 1.10.0
	 *
	 * @return string
	 */
	public function get_plugin_name() {
		return __( 'Facebook for WooCommerce', 'facebook-for-woocommerce' );
	}

	/**
	 * Gets the url for the assets build directory.
	 *
	 * @since 2.3.4
	 *
	 * @return string
	 */
	public function get_asset_build_dir_url() {
		return $this->get_plugin_url() . '/assets/build';
	}


	/** Conditional methods ***************************************************************************************/


	/**
	 * Determines if viewing the plugin settings in the admin.
	 *
	 * @since 1.10.0
	 *
	 * @return bool
	 */
	public function is_plugin_settings() {
		return is_admin() && WooCommerce\Facebook\Admin\Settings::PAGE_ID === Helper::get_requested_value( 'page' );
	}


	/** Utility methods *******************************************************************************************/


	/**
	 * Initializes the lifecycle handler.
	 *
	 * @since 1.10.0
	 */
	protected function init_lifecycle_handler() {
		$this->lifecycle_handler = new Lifecycle( $this );
	}


	/**
	 * Gets the plugin singleton instance.
	 *
	 * @see \facebook_for_woocommerce()
	 *
	 * @since 1.10.0
	 *
	 * @return \WC_Facebookcommerce the plugin singleton instance
	 */
	public static function instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}


	/**
	 * Gets the plugin file.
	 *
	 * @since 1.10.0
	 *
	 * @return string
	 */
	protected function get_file() {
		return __FILE__;
	}


	/**
	 * Return current page ID
	 *
	 * @since 2.3.0
	 *
	 * @return string
	 */
	protected function get_current_page_id() {
		$current_screen_id = '';
		$current_screen    = get_current_screen();
		if ( ! empty( $current_screen ) ) {
			$current_screen_id = $current_screen->id;
		}
		return $current_screen_id;
	}
}


/**
 * Gets the Facebook for WooCommerce plugin instance.
 *
 * @since 1.10.0
 *
 * @return \WC_Facebookcommerce instance of the plugin
 */
function facebook_for_woocommerce() {
	return \WC_Facebookcommerce::instance();
}

SPERA Medicare – Affy Pharma Pvt Ltd

SPEROXIME

POWDER FOR ORAL SUSPENSION
30ML (HDPE BOTTLE)

Composition

Cefpodoxime 50mg/5ml

Indications & Uses

UTIs, LRTs

SPEROXIME-CV

POWDER FOR ORAL SUSPENSION
30ML (GLASS BOTTLE)

Composition

Cefpodoxime 50mg + Potassium Clavulanate 31.25mg/ 5ml

Indications & Uses

Upper & lower respiratory infections, Uncomplicated skin infections, Urinary Tract Infections

SPERACLAV

POWDER FOR ORAL SUSPENSION
30ML (GLASS +HDPE BOTTLE)

Composition

Amoxycillin 200mg + Potassium clavulanate 28.50 mg/ 5ml

Indications & Uses

Community Acquired Pneumonia, Acute Exacerbations of Chronic Bronchitis, Upper Respiratory Tract Infections, Urinary Tract Infections

SPERIXIME-CV

POWDER FOR ORAL SUSPENSION

30ML (GLASS BOTTLE)

Composition

Cefixime 50mg + Potassium clavulanate 31.25mg/5ml

Indications & Uses

Urinary Tract Inefctions, AECB, Otitis Media, Typhoid

SPERIXIME

POWDER FOR ORAL SUSPENSION
30ML (HDPE BOTTLE)

Composition

Cefixime 50mg/5ml

Indications & Uses

Urinary Tract Inefctions, Gastroenteritis

SPAZIT

ORAL SUSPENSION
15 ml

Composition

Azithromycin 200mg/5ml

Indications & Uses

Community Acquired Pneumonia, Acute Exacerbations of Chronic Bronchitis,

SPENOMOL-DS

ORAL SUSPENSION
60 ml

Composition

Paracetamol 250mg/5ml

Indications & Uses

Fever, Pain

SPENOMOLM

ORAL SUSPENSION
60 ml

Composition

Paracetamol 125mg + Mefenamic Acid 50mg/5ml

Indications & Uses

Pain, Fever

SPEROF

ORAL SUSPENSION
30 ml

Composition

Ofloxacin 50mg/5ml

Indications & Uses

Acute exacerbations of chronic Bronchitis, Diarrhoea

SPENOMOL-CP

SYRUP
60 ml

Composition

Paracetamol 125mg + PPH 5mg + Cetirizine HCI 2mg/5ml

Indications & Uses

Fever, common cold & Flu

PROBILIN

ORAL SUSPENSION
200ml

Composition

Cyproheptadine HCI 2mg + Tricholine citrate 0.275mg/5ml

Indications & Uses

Stimulate Apetite, Induces Weight Gain, Cure Allergies

SPERAZOLE-DSR

CAPSULES ( HARD GELATIN)
10X10 (Alu-Alu)

Composition

Pantoprazole 40mg (EC) + Domperidone 30mg (SR)

Indications & Uses

GERD, Dyspepsia, Acid Peptic Disorders, Gastritis

SPERAB-DSR

CAPSULES ( HARD GELATIN)
11X10 (Alu-Alu)

Composition

Rabeprazole 20mg (EC) + Domperidone SR

Indications & Uses

GERD, Dyspepsia, Acid Peptic Disorders, Gastritis

SPERAZOLE 40

INJECTION

40ml

Composition

Pantoprazole Sodium 40mg + NaCL

Indications & Uses

Acid-peptic disorders in hospitalized patients, Zollinger – Ellison Syndrome, Treatment of GERD Associated with Erasive Esophagitis, GL Bleed

COOLRICH

SUSPENSION
170ml

Composition

Activated Dimethicone 25mg + Magnesium Hydroxide 200mg+ Aluminium Hydroxide Gel 200mg/10ml

Indications & Uses

Heartburn, Acid Indigestion

SPERAZYME

SYRUP
200ml

Composition

Alpha Amylase (1:2000) 50mg, Pepsin(1:3000) 10mg/5ml

Indications & Uses

Dyspepsia, Flatulence, Anorexia, Pancreatic Insufficiency

SPUR-ON

CAPSULES (HARD GELATIN)
10X3X10

Composition

Vitamin C 75mg + Vitamin B12 5mcg + Carbonyl Iron 100mg + Folic Acid 1.5mg + Zinc Sulphate 61.8mg

Indications & Uses

Hyphocromic Anemia in Pregnancy, Chronic and / or Acute Blood Loss, Post-gynaesurgery, Iron Deficiency Anemia

SP-D3 60K

CAPSULES (SOFT GELATIN)
10X1X4

Composition

Cholecalciferol 60000 UI

Indications & Uses

Osteoporosis, Osteoarthritis, Musculoskeletal Pain, Type- 2 Diabetes, Menstrual Irregularities, Pre-eclampsia, IUGR

ERABONA

ORAL SUSPENSION
200ml

Composition

Calcium Carbonate 625mg, Vitamin D3 125 IU/5ml

Indications & Uses

Osteomalacia, Osteoporosis, Fractures, Premenstrual Syndrome

IRO-SPUR

SYRUP (IRON TONIC)
300 ml

Composition

Iron (III) Hydroxide Polymaltose 50mg, Folic Acid 0.5mg/15ml

Indications & Uses

Pregnancy and lactation, Iron Deficiency Anaemia, Anaemia due to Excessive Haemorrhage, Anaemia Associated with Infections and Malignant Disease

CALANTE-Z

CAPSULES (SOFT GELATIN)
5X2X15

Composition

Calcitriol 0.25mcg + Calcium Carbonate 500mg + Zinc Sulphate 7.5mg

Indications & Uses

Osteoporosis, Hypoparathyroidism, Pregnancy & Lactation, Premenstrual Syndrome

SPERA SPAS

TABLETS
20X10

Composition

Mefenamic Acid 250mg + Dicyclomine HCI 10mg

Indications & Uses

Dysmenorrhea, Irritable Bowel Syndrome, Colic and Bladder Spasm, Abdominal Pain

SPERAFEN

TABLETS (BLISTERS)
20X10

Composition

Nimeulide 100mg + Paracetamo; 325mg

Indications & Uses

Arthritis Pain, Soft Tissue Trauma Including Sprains, Musculoskeletal Pain, Pain Following Dental Extraction

PARADOL FORTE

TABLETS

20X10

Composition

Tramadol 37.5mg + Paracetamol 325mg

Indications & Uses

Chronic Back Pain, Osteoarthritis, Postoperative Pain

DIRABEN GEL

GEL
30g

Composition

Diclofenac Diethylamine 1.16% w/w + Oleum Linseed Oil 3 % w/w + Menthol 5% w/w +Methyl Salicylate 10% w/w

Indications & Uses

Sprains & Strains, Lower Back Pain, Joint Pain, Knee Pain

ULTISOFT

CREAM
20g

Composition

Urea 10% +Lactic Acid 10% + Propylene Glycol 10% + Liquid Paraffin 10%

Indications & Uses

Foot Cracks, Keratolytic

PERAZOB

OINTMENT
15g

Composition

Clotrimazole 1% w/w + Beclomethasone Dipropionate 0.025% w/w + Neomycin 0.5% w/w

Indications & Uses

Eczema, Psoriasis, Corticosteroid Responsive Dermatoses

SPARKETO

LOTION
100 ml

Composition

Ketoconazole 2% w/v

Indications & Uses

Pityriasis, Dandruff

SPARKETO-Z

LOTION
100 ml

Composition

Ketoconazole Shampoo 2% w/v + ZPTO 1% w/v

Indications & Uses

Pityriasis, Dandruff

SPARKETO

SOAP
75g

Composition

Ketoconazole 1% w/w

Indications & Uses

Tinea Versicolor, Prophylaxis of Pityriasis Versicolor

SPUKA

TABLETS
20X1X1

Composition

Fluconazole 200mg

Indications & Uses

Vaginal Candidiasis, Brochopulmonary Infections, Candiduria, Tinea Pedis, Corposis, Cruris, Versicolor

VITALAND

SYRUP
200ml

Composition

L-Iysine HCI 25mg + Vitamin B1 2.5mg + Vitamin B2 2.5mg + Vitamin B6 0.75mg + D-panthenol 3mg +Niacinamide 25mg + Mecobalamin 2mcg/10ml

Indications & Uses

Sub-optimal Growth, Poor Weight Gain, Malnutrition, Prolonged Illness

LYCOZIDE PLUS

SYRUP
225ml

Composition

Each 10ml Contains: Lycopene 6% 1000mcg + Vitamin A Palmitate 2500 IU + Vitamin E 10 IU + Ascorbic Acid 50mg + Selenium (as Sodium Selenate) 35mcg + Zinc (As Zinc Gluconate) 3mg + Manganese (as Manganese Gluconate) 2mg + Iodine ( As Potassium Iodine) 100mcg + Copper (As Copper Sulphate0 500mcg + Thiamine HCI 2mg + Riboflavine 3mg + Pyridoxine HCI 1.5mg

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

DENUM

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Antioxidant, Multivitamin & Multiminerals

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

NATOW

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Vitamin E (Natural) 400 IU + Wheat Germ Oil 100mg + Omega 3 Fatty Acids 30mg

Indications & Uses

Ulcerative colitis, Metabolic Syndrome, Rheumatoid Arthritis, Type-2 Diabetes, Cardiovascular Diseases

LYCOZIDE

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Each SG Contains Lycopene 6% 2000 IU + Vitamin A 2500 IU + Vitamin E Acetate 10 IU + Vitamin C 50 mg + Zinc sulphate Monohydrate 27.45mg + Selenium Dioxide 70mcg

Indications & Uses

Idiopathic Male Infertility, Pre-eclampsia, Prostate Cancer, Cardiovascular Diseases, Diabetes Mellitus

DENUM 4G

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Omega 3 Fatty Acid + Ginseng Extract + Ginkgo Bilaba Extract + Grape Seed Extract + Ginseng Extract + Multimineral + Multivitamin + Antioxidants + Trace Elements

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

DENUM G

CAPSULES (SOFT GELATIN)
10X1X11

Composition

Ginseng + Multivitamin + Multimineral

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

SPERIXIME – 200 LB

TABLETS (Alu-Alu)

20X10

Composition

Cefixime 200mg + Lactic Acid Bacilus 2.5 billion spores

Indications & Uses

Otitis Media, Pharyngitis & Tonsillitis, Uncomplicated Urinary Tract Infections, Acute Exacerbations of Chronic Bronchitis, Enteric Fever

SPERIXIME-CV 325

TABLETS (Alu-Alu)
10X1X6

Composition

Cefixime 200mg + Potassium Clavulanate 125mg

Indications & Uses

Respiratory Tract Infections, Urinary Tract Infections, Skin & Skin Structure Infections

SPERACLAV-625

TABLETS (Alu-Alu)
10X1X6

Composition

Amoxycillin 500mg + Potassium Clavulanate 125mg

Indications & Uses

Respiratory Tract Infections, Community Acquired Pneumonia, Gynaecological Infections, Acute Exacerbations of Chronic Bronchitis, Skin and Soft Tissue Infections

SPEROF-O

TABLETS (Blister)
20X10

Composition

Ofloxacin 200mg + Ornidazole 500mg

Indications & Uses

Surgical ions, Diarrheas of Mixed Etiology, Gynaecological Infections, Orofacial and Dental Infections

VEXACIN

TABLETS
10X10

Composition

Levofloxacin 500mg

Indications & Uses

Acute Bacterial Sinusitis, Acute Bacterial Exacerbations of Chronic Bronchitis, Skin & Skin Structure Infections, Chronic Bacterial Prostatitis, Urinary Tract Infections

SPERIXIME-O

TABLETS (Alu-Alu)
10X1X10

Composition

Cefixime 200mg + Ofloxacin 200mg

Indications & Uses

Community Acquired Pneumonia, Multiple Drug Resistant-TB, Typhoid

SPEROXIME-200

TABLETS (Alu-Alu)
10X1X6

Composition

Cefpodoxime Proxetil 200mg

Indications & Uses

Pharyngitis, CAP, Tonsilitis

SPERACLAV-1.2

INJECTIONS
1.2g

Composition

Amoxycillin 1000mg + Potassium Clavulanate 200mg + WFI

Indications & Uses

Community Acquired Pneumonia, Gynaecological Infections, Upper Respiratory Tract Infections, Skin and Soft Tissue Infections, Urinary Tract Infections, Acute Exacerbations of Chronic Bronchitis

SPERBACT-SB 1.5

INJECTIONS
1.5g

Composition

Ceftriaxone 1000mg + Sulbactam 500mg + WFI

Indications & Uses

Gynaecological Infections, Lower Respiratory Tract Infections, Intra-abdominal Infections with Aerobic Organisms, Surgical Prophylaxis

SPERBACT-TZ 1.125

INJECTIONS
1.125gm

Composition

Ceftriaxone 1000mg + Tazobactam 500 mg + WFI

Indications & Uses

Bone & Joint Infections, Intra-abdominal Infections, Bacterial Meningitis, Pre-operative Surgical Prophylaxis

SPERLIV

INJECTIONS
1gm

Composition

Meropenem 1gm + WFI

Indications & Uses

Complicated Intra-abdominal Infection (cIAI), Complicated Skin & Skin Structure Infections (cSSSI), Bacterial Meningitis, Noscocomial Pneumonia

SPIPER-Z 4.5

INJECTIONS
4.5gm

Composition

Piperacillin 4000mg + Tazobactam 500mg + WFI

Indications & Uses

Intra-abdominal Infections, Complicated Urinary Tract Infections, Febrile Neutropenia, Lower Respiratory Tract Infections

SPERBACT-C

INJECTIONS
1.5gm

Composition

Cefaperazone 1000mg + Sulbactam 500mg +WFI

Indications & Uses

Peritonitis, Bacterial Simusitis, Cholecystitis, Meningitis

BROXTAR

SYRUP
100ml

Composition

Ambroxol HCI 15mg + Guaiphensin 50mg + Terbutaline Sulphate 1.5mg + Mentholated Base/5ml

Indications & Uses

Bronchitis, Productive Cough, Emphysema, Bronchial Asthma

BROXTAR-BR

SYRUP

100ml

Composition

Terbutaline Sulphate 1.25mg + Bromhexine HCI 4mg + Guaiphenesin 50mg + Methalated Base/5ml

Indications & Uses

Acute Cough, Abnormal Mucus Secretion, Productive Cough

THROMET

SYRUP
100ml

Composition

Dextromethorphan Hydrobromide 10mg + Phenylpherine 5 mg + Cetrizine 5mg + Mentholated Base/5ml

Indications & Uses

Commom Cold and Flu, Nasal Congestion, Sore Throat

IRIDIE-M

TABLETS (Alu-Alu)
20X10

Composition

Levocetirizine 5mg + Montelukast 10mg

Indications & Uses

Allergic Rhinitis, Nasal Congestion, Asthma

IRIDIE

TABLETS (Alu-Alu)
20X11

Composition

Levocetirizine 5mg

Indications & Uses

Chronic Idiopathic Urticaria (CIU), Seasonal Allergic Rhinitis (SAR), Perennial Allergic Rhinitis (PAR)

Arrange A Callback
[]
1 Step 1
Full Name
Telephone
Departmentyour full name
Postal Address
Message
0 /
Previous
Next
Shopping Basket