*/ class adfoxly_Admin { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Initialize the class and set its properties. * * @since 1.0.0 * * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the admin area. * * @since 1.0.0 */ public function enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in adfoxly_Loader as all of the hooks are defined * in that particular class. * * The adfoxly_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ $server_request_uri = $_SERVER[ 'REQUEST_URI' ]; if ( strpos( $server_request_uri, 'adfoxly' ) !== false ) { // Stisla Admin Template - MIT // General CSS Files // wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-bootstrap', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/bootstrap/css/bootstrap.min.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-fontawesome', 'https://use.fontawesome.com/releases/v5.8.2/css/all.css', array(), $this->version, 'all' ); // Plugins wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/select2/dist/css/select2.min.css"', array(), $this->version, 'all' ); // wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-bootstrap-timepicker', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/bootstrap-timepicker/css/bootstrap-timepicker.min.css"', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-timepicki', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/timepicki/css/timepicki.css"', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-bootstrap-tagsinput', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.css"', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-codemirror', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/codemirror/lib/codemirror.css"', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-codemirror-theme', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/codemirror/theme/duotone-dark.css"', array(), $this->version, 'all' ); // Template CSS // wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-style', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/css/style.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-style', plugin_dir_url( dirname( __FILE__ ) ) . 'dist/css/style.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-stisla-components', plugin_dir_url( dirname( __FILE__ ) ) . 'dist/css/components.css', array(), $this->version, 'all' ); // AdFoxly Assets wp_enqueue_style( $this->plugin_name . '-adfoxly-wizard', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/wizard/dist/css/smart_wizard_theme_arrows.css', array(), $this->version, 'all' ); wp_enqueue_style( $this->plugin_name . '-adfoxly-admin', plugin_dir_url( __FILE__ ) . 'css/adfoxly-admin.css', array(), $this->version, 'all' ); // wp_enqueue_style( $this->plugin_name . '-adfoxly-style-1', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/css/core.css', array(), $this->version, 'all' ); // wp_enqueue_style( $this->plugin_name . '-adfoxly-style-2', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/css/style.css', array(), $this->version, 'all' ); } // todo: probably to remove wp_enqueue_style( $this->plugin_name . '-adfoxly-dashboard', plugin_dir_url( __FILE__ ) . 'css/adfoxly-dashboard.css', array(), $this->version, 'all' ); } public function dashboard_enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in adfoxly_Loader as all of the hooks are defined * in that particular class. * * The adfoxly_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_style( $this->plugin_name . '-adfoxly-dashboard', plugin_dir_url( __FILE__ ) . 'css/adfoxly-dashboard.css', array(), $this->version, 'all' ); } /** * Register the JavaScript for the admin area. * * @since 1.0.0 */ public function enqueue_scripts() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in adfoxly_Loader as all of the hooks are defined * in that particular class. * * The adfoxly_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_media(); // Stisla Admin Template - MIT // General JS Scripts wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-popper', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/popper.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/select2/dist/js/select2.full.min.js', '', $this->version, true ); // wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-bootstrap-timepicker', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/bootstrap-timepicker/js/bootstrap-timepicker.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-timepicki', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/timepicki/js/timepicki.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-bootstrap-tagsinput', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-tooltip', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/tooltip.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-bootstrap', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/bootstrap/js/bootstrap.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-nicescroll', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/nicescroll/jquery.nicescroll.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-moment', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/moment.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/js/stisla.js', '', $this->version, true ); // Plugins // Code Editor wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-codemirror-1', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/codemirror/lib/codemirror.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-codemirror-2', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/codemirror/mode/javascript/javascript.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-sparkline', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/jquery.sparkline.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-chart', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/modules/chart.min.js', '', $this->version, true ); // Template JS File wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-scripts', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/js/scripts.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-stisla-custom', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/stisla/dist/assets/js/custom.js', '', $this->version, true ); // AdFoxly Assets wp_enqueue_script( $this->plugin_name . '-adfoxly-smartwizard', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/wizard/dist/js/jquery.smartWizard.min.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-parsley', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/vendors/parsley/dist/parsley.min.js', '', $this->version, true ); // todo: only when loaded settings or banner form wp_enqueue_script( $this->plugin_name . '-adfoxly', plugin_dir_url( dirname( __FILE__ ) ) . 'public/js/ads.js', '', $this->version, true ); wp_enqueue_script( $this->plugin_name . '-adfoxly-admin-common', plugin_dir_url( __FILE__ ) . 'js/adfoxly-admin-common.js', array( 'jquery' ), $this->version, true ); } public function add_admin_adfoxly_body_classes() { return 'adfoxly-admin-page layout-2 sidebar-gone'; } public function adfoxly_analytics_inline_enqueue_script() { $this->settings = get_option( 'adfoxly_settings' ); if ( ( defined( 'ADFOXLY_HEAP_OPTIN' ) && ADFOXLY_HEAP_OPTIN === true ) || ( isset( $this->settings[ 'adfoxly-privacy-heap' ] ) && $this->settings[ 'adfoxly-privacy-heap' ] === 'yes' ) ) { wp_enqueue_script( $this->plugin_name . '-adfoxly-heap', plugin_dir_url( __FILE__ ) . 'js/adfoxly-admin-heap.js' ); wp_add_inline_script( $this->plugin_name . '-adfoxly-heap', 'window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;csettings[ 'adfoxly-privacy-hotjar' ] ) && $this->settings[ 'adfoxly-privacy-hotjar' ] === 'yes' ) ) { wp_enqueue_script( $this->plugin_name . '-adfoxly-hotjar', plugin_dir_url( __FILE__ ) . 'js/adfoxly-admin-hotjar.js' ); wp_add_inline_script( $this->plugin_name . '-adfoxly-hotjar', '(function(h,o,t,j,a,r){ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; h._hjSettings={hjid:1306680,hjsv:6}; a=o.getElementsByTagName(\'head\')[0]; r=o.createElement(\'script\');r.async=1; r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv; a.appendChild; })(window,document,\'https://static.hotjar.com/c/hotjar-\',\'.js?sv=\');' ); } if ( ( defined( 'ADFOXLY_GA_OPTIN' ) && ADFOXLY_GA_OPTIN === true ) || ( isset( $this->settings[ 'adfoxly-privacy-ga' ] ) && $this->settings[ 'adfoxly-privacy-ga' ] === 'yes' ) ) { wp_enqueue_script( $this->plugin_name . '-adfoxly-ga', 'https://www.googletagmanager.com/gtag/js?id=UA-138673497-3' ); wp_enqueue_script( $this->plugin_name . '-adfoxly-ga-inline', plugin_dir_url( __FILE__ ) . 'js/adfoxly-admin-ga.js' ); wp_add_inline_script( $this->plugin_name . '-adfoxly-ga-inline', 'window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(\'js\', new Date()); gtag(\'config\', \'UA-138673497-3\');' ); } if ( ( defined( 'ADFOXLY_YANDEX_OPTIN' ) && ADFOXLY_YANDEX_OPTIN === true ) || ( isset( $this->settings[ 'adfoxly-privacy-yandex' ] ) && $this->settings[ 'adfoxly-privacy-yandex' ] === 'yes' ) ) { wp_enqueue_script( $this->plugin_name . '-adfoxly-yandex', plugin_dir_url( __FILE__ ) . 'js/adfoxly-admin-yandex.js' ); wp_add_inline_script( $this->plugin_name . '-adfoxly-yandex', '(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)}) (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); ym(53604034, "init", { clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true });' ); add_filter('script_loader_tag', array($this, 'adfoxly_add_noscript_yandex_filter'), 10, 3); } if ( ( defined( 'ADFOXLY_SENTRY_OPTIN' ) && ADFOXLY_SENTRY_OPTIN === true ) || ( isset( $this->settings[ 'adfoxly-privacy-sentry' ] ) && $this->settings[ 'adfoxly-privacy-sentry' ] === 'yes' ) ) { wp_enqueue_script( $this->plugin_name . '-adfoxly-sentry', 'https://browser.sentry-cdn.com/5.2.1/bundle.min.js' ); wp_enqueue_script( $this->plugin_name . '-adfoxly-sentry-inline', plugin_dir_url( __FILE__ ) . 'js/adfoxly-admin-sentry.js' ); wp_add_inline_script( $this->plugin_name . '-adfoxly-sentry-inline', 'Sentry.init({ dsn: "https://5e3adf76e9e84f85ad5ca390cde350b0@sentry.io/1428644" });' ); } } static function adfoxly_add_noscript_yandex_filter( $tag, $handle, $src ) { if ( 'script-handle' === $handle ) { $noscript = ''; $tag = $tag . $noscript; } return $tag; } }