*/ 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;c