includes(); $this->init_hooks(); $this->init_freemius(); register_activation_hook( AJAX_PRESS_FILE, array( $this, 'activate' ) ); } public function activate() { include_once AJAX_PRESS_INCLUDES . '/class-install.php'; Ajax_Press\Install::activate(); } public function init_hooks(){ add_action( 'admin_notices', [ $this, 'print_notices' ], 15 ); add_filter( 'plugin_action_links_' . plugin_basename( AJAX_PRESS_FILE ), [ $this, 'plugin_action_links' ] ); } public function plugin_action_links( $links ) { $links[] = '' . __( 'Settings', 'ajax-press' ) . ''; return $links; } public function init_freemius(){ if ( ! function_exists( 'ap_fs' ) ) { // Create a helper function for easy SDK access. function ap_fs() { global $ap_fs; if ( ! isset( $ap_fs ) ) { // Include Freemius SDK. require_once dirname(__FILE__) . '/freemius/start.php'; $ap_fs = fs_dynamic_init( array( 'id' => '10249', 'slug' => 'ajax-press', 'type' => 'plugin', 'public_key' => 'pk_89cfc20908b6ca94af4d3dd95577a', 'is_premium' => false, 'has_addons' => false, 'has_paid_plans' => false, 'menu' => array( 'slug' => 'ajax-press', 'first-path' => 'admin.php?page=ajax-press-getting-started', 'account' => false, 'support' => false, ), ) ); } return $ap_fs; } // Init Freemius. ap_fs(); // Signal that SDK was initiated. do_action( 'ap_fs_loaded' ); } } public function includes() { require_once AJAX_PRESS_INCLUDES . '/class-enqueue.php'; if(is_admin()) { require_once AJAX_PRESS_INCLUDES . '/class-admin.php'; include_once AJAX_PRESS_INCLUDES . '/class-theme-configs.php'; } } public function add_notice( $class, $message ) { $notices = get_option( sanitize_key( 'ajax_press_notices' ), [] ); if ( is_string( $message ) && is_string( $class ) && ! wp_list_filter( $notices, array( 'message' => $message ) ) ) { $notices[] = array( 'message' => $message, 'class' => $class, ); update_option( sanitize_key( 'ajax_press_notices' ), $notices ); } } /** * Prince admin notice * * @return void * @since 1.0.0 * */ public function print_notices() { $notices = get_option( sanitize_key( 'ajax_press_notices' ), [] ); foreach ( $notices as $notice ) { ?>