File: /home/dtptviut/public_html/wp-content/plugins/comparisonfeed-wp/compare-feed-wp.php
<?php
include_once "functions.php";
require "inc/plugin-update-checker-4.10/plugin-update-checker.php";
/*
Plugin Name: Adservice Comparison Feed
Plugin URI: https://publisher.adservice.com/tools/comparisonfeed/wp-plugin
Version: 4.9
Author: <a href="https://www.adservice.com">Adservice A/S</a>
Description: The Adservice comparison feed makes it easy to create your own comparison sites while always keeping your data updated. Currently we have feeds on the Danish, Swedish, Norwegian and Finnish markets across multiple sectors.
Text Domain: adservice-comparison
License: GPLv3
*/
define( 'ADSERVICE_DIRECTORY', 'comparisonfeed-wp/');
define( 'CURRENT_VERSION', '4.9');
$adservice_options = get_option("adservice_options");
// Initialize update checker which handles all plugin update functionality.
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://api.adservice.com/v2/public/publisher/comparisonfeed/wordpress/details/raw',
__FILE__,
'comparisonfeed-wp'
);
// Add 'Settings' link to plugin action links.
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'add_settings_to_plugin_action_links' );
function add_settings_to_plugin_action_links( $links ) {
// Translation strings.
$settingsStrings = (object) array(
'en_US' => 'Settings',
'en_GB' => 'Settings',
'da_DK' => 'Indstillinger',
'fi' => 'Asetukset',
'nn_NO' => 'Innstillinger',
'sv_SE' => 'Inställningar'
);
$locale = (isset($settingsStrings->{get_locale()}) && $settingsStrings->{get_locale()}) ? get_locale() : 'en_US';
// Add the link before the default ones.
return array_merge(
array('settings' => '<a href="admin.php?page=comparisonfeed-wp/compare-admin.php">'.$settingsStrings->{$locale}.'</a>'),
$links
);
}
// Register activation and deactivation hooks for counting active installs and total installs.
register_activation_hook( __FILE__, 'custom_plugin_activation' );
register_deactivation_hook( __FILE__, 'custom_plugin_deactivation' );
function custom_plugin_activation() {
update_option('adservice_comparison_feed_version', CURRENT_VERSION);
$adservice_options = get_option("adservice_options");
$pid = ($adservice_options && isset($adservice_options['pid'])) ? $adservice_options['pid'] : 0;
$body = array('site' => get_site_url(), 'version' => CURRENT_VERSION, 'pid' => $pid);
$userData = json_remote_post("https://api.adservice.com/v2/public/publisher/comparisonfeed/wordpress/install", null, $body);
}
function custom_plugin_deactivation() {
$body = array('site' => get_site_url());
$userData = json_remote_delete("https://api.adservice.com/v2/public/publisher/comparisonfeed/wordpress/install", null, $body);
}
// Check plugin version to make sure we registered the latest one.
add_action('plugins_loaded', 'check_plugin_version');
function check_plugin_version() {
if (CURRENT_VERSION !== get_option('adservice_comparison_feed_version')) {
custom_plugin_activation();
}
}
if (!isset($adservice_options)) {
$adservice_options['login'] = 0;
$adservice_options['token'] = 0;
$adservice_options['accounts'] = 0;
add_option("adservice_options", $adservice_options);
}
if ( ! function_exists('adservice_options_menu') ) {
add_action( 'admin_menu', 'adservice_options_menu' );
function adservice_options_menu() {
add_menu_page( 'Adservice','Adservice', 'manage_options', ADSERVICE_DIRECTORY.'/compare-admin.php', '', plugins_url('/images/AD_logo.svg', __FILE__));
add_submenu_page( ADSERVICE_DIRECTORY.'/compare-admin.php', 'Adjust Style', 'Adjust Style', 'manage_options', ADSERVICE_DIRECTORY.'/compare-adjust-style.php');
add_submenu_page( ADSERVICE_DIRECTORY.'/compare-admin.php', 'iFrame Feeds', 'iFrame Feeds', 'manage_options', ADSERVICE_DIRECTORY.'/compare-iframe-feeds.php');
add_submenu_page( ADSERVICE_DIRECTORY.'/compare-admin.php', 'Comparison Feed Builder', 'Comparison Feed Builder', 'manage_options', 'https://publisher.adservice.com/tools/comparisonfeed/feed');
add_submenu_page( ADSERVICE_DIRECTORY.'/compare-admin.php', 'Product Feed Builder', 'Product Feed Builder', 'manage_options', 'https://publisher.adservice.com/tools/productfeeds/overview');
}
}
include( plugin_dir_path( __FILE__ ) . '/compare-feed-wp-scripts.php');
include( plugin_dir_path( __FILE__ ) . '/compare-feed-wp-alert-notice.php');
include( plugin_dir_path( __FILE__ ) . '/compare-feed-wp-metabox.php');
include( plugin_dir_path( __FILE__ ) . '/compare-feed-wp-shortcode.php');
?>