Download ffe80540/ffe80540.php from WealthFromAI/devops-infrastructure-loyalty-program-and-rewards-wordpress-plugin-ffe8: direct link, hf CLI and curl.
- Browser
- Download file 5.04 kB
-
https://huggingface.co/spaces/WealthFromAI/devops-infrastructure-loyalty-program-and-rewards-wordpress-plugin-ffe8/resolve/main/ffe80540/ffe80540.php
- Command line
-
hf download hf://spaces/WealthFromAI/devops-infrastructure-loyalty-program-and-rewards-wordpress-plugin-ffe8/ffe80540/ffe80540.php
-
curl -L -o ffe80540.php https://huggingface.co/spaces/WealthFromAI/devops-infrastructure-loyalty-program-and-rewards-wordpress-plugin-ffe8/resolve/main/ffe80540/ffe80540.php
5.04 kB
| /** | |
| * Plugin Name: DevOps & Infrastructure Loyalty Program and Rewards WordPress Plugin | |
| * Description: Points, tiers, referrals, and exclusive access for repeat DevOps & Infrastructure customers. Drive repeat purchases without third-party loyalty apps. | |
| * Version: 1.0.0 | |
| * Author: Digital Forge | |
| * Text Domain: ffe80540 | |
| * License: GPL-2.0+ | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) exit; | |
| define( 'FFE80540_VERSION', '1.0.0' ); | |
| define( 'FFE80540_DIR', plugin_dir_path( __FILE__ ) ); | |
| class Ffe80540 { | |
| private static $instance = null; | |
| public static function instance() { | |
| if ( null === self::$instance ) { | |
| self::$instance = new self(); | |
| } | |
| return self::$instance; | |
| } | |
| private function __construct() { | |
| add_action( 'init', [ $this, 'init' ] ); | |
| add_action( 'admin_menu', [ $this, 'admin_menu' ] ); | |
| add_action( 'admin_init', [ $this, 'settings_init' ] ); | |
| add_action( 'rest_api_init', [ $this, 'register_routes' ] ); | |
| add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] ); | |
| load_plugin_textdomain( 'ffe80540', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); | |
| } | |
| public function init() {} | |
| public function admin_menu() { | |
| add_options_page( | |
| esc_html__( 'DevOps & Infrastructure Loyalty Program and Rewards WordPress Plugin Settings', 'ffe80540' ), | |
| esc_html__( 'DevOps & Infrastructure Loyalty Program and Rewards WordPress Plugin', 'ffe80540' ), | |
| 'manage_options', | |
| 'ffe80540-settings', | |
| [ $this, 'settings_page' ] | |
| ); | |
| } | |
| public function settings_init() { | |
| register_setting( 'ffe80540_options', 'ffe80540_options', [ $this, 'sanitize_options' ] ); | |
| add_settings_section( 'ffe80540_main', '', '__return_false', 'ffe80540-settings' ); | |
| add_settings_field( 'enabled', esc_html__( 'Enable', 'ffe80540' ), [ $this, 'field_enabled' ], 'ffe80540-settings', 'ffe80540_main' ); | |
| } | |
| public function sanitize_options( $input ) { | |
| $clean = []; | |
| $clean['enabled'] = ! empty( $input['enabled'] ) ? 1 : 0; | |
| return $clean; | |
| } | |
| public function field_enabled() { | |
| $opts = get_option( 'ffe80540_options', [] ); | |
| $val = ! empty( $opts['enabled'] ) ? 1 : 0; | |
| echo '<input type="checkbox" name="ffe80540_options[enabled]" value="1"' . checked( $val, 1, false ) . ' />'; | |
| } | |
| public function settings_page() { | |
| if ( ! current_user_can( 'manage_options' ) ) return; | |
| <div class="wrap"> | |
| <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> | |
| <form method="post" action="options.php"> | |
| <?php settings_fields( 'ffe80540_options' ); ?> | |
| <?php do_settings_sections( 'ffe80540-settings' ); ?> | |
| <?php submit_button(); ?> | |
| </form> | |
| </div> | |
| <?php | |
| } | |
| public function register_routes() { | |
| register_rest_route( 'ffe80540/v1', '/data', [ | |
| [ 'methods' => 'GET', 'callback' => [ $this, 'rest_get' ], 'permission_callback' => '__return_true' ], | |
| [ 'methods' => 'POST', 'callback' => [ $this, 'rest_post' ], 'permission_callback' => function() { return current_user_can( 'manage_options' ); } ], | |
| ] ); | |
| } | |
| public function rest_get( $request ) { | |
| return rest_ensure_response( [ 'status' => 'ok', 'plugin' => 'ffe80540' ] ); | |
| } | |
| public function rest_post( $request ) { | |
| $data = $request->get_json_params(); | |
| return rest_ensure_response( [ 'received' => $data ] ); | |
| } | |
| public function enqueue_admin_assets( $hook ) { | |
| if ( 'settings_page_ffe80540-settings' !== $hook ) return; | |
| wp_enqueue_style( 'ffe80540-admin', plugin_dir_url( __FILE__ ) . 'assets/css/admin.css', [], '1.0.0' ); | |
| wp_enqueue_script( 'ffe80540-admin', plugin_dir_url( __FILE__ ) . 'assets/js/admin.js', [ 'jquery' ], '1.0.0', true ); | |
| wp_localize_script( 'ffe80540-admin', 'ffe80540_vars', [ 'nonce' => wp_create_nonce( 'ffe80540-nonce' ), 'ajax_url' => admin_url( 'admin-ajax.php' ) ] ); | |
| } | |
| public static function activate() { | |
| global $wpdb; | |
| $table = $wpdb->prefix . 'ffe80540'; | |
| $charset = $wpdb->get_charset_collate(); | |
| $sql = "CREATE TABLE IF NOT EXISTS $table ( | |
| id bigint(20) NOT NULL AUTO_INCREMENT, | |
| data longtext NOT NULL, | |
| created_at datetime DEFAULT CURRENT_TIMESTAMP, | |
| PRIMARY KEY (id) | |
| ) $charset;"; | |
| require_once ABSPATH . 'wp-admin/includes/upgrade.php'; | |
| dbDelta( $sql ); | |
| add_option( 'ffe80540_db_version', '1.0.0' ); | |
| } | |
| public static function deactivate() {} | |
| } | |
| register_activation_hook( __FILE__, [ 'Ffe80540', 'activate' ] ); | |
| register_deactivation_hook( __FILE__, [ 'Ffe80540', 'deactivate' ] ); | |
| Ffe80540::instance(); | |