Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chapdel committed Jan 2, 2023
0 parents commit 11e97a6
Show file tree
Hide file tree
Showing 24 changed files with 2,186 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nuxt.isNuxtApp": false
}
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

225 changes: 225 additions & 0 deletions admin/class-notchpay-give-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<?php

/**
* The admin-specific functionality of the plugin.
*
* @package Give
* @subpackage Gateways
* @author Chapdel KAMGA<[email protected]>
* @license https://opensource.org/licenses/gpl-license GNU Public License
* @link https://notchpay.co
* @since 1.0.0
*/

/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package NotchPay_Give
* @subpackage Gateways
* @author Chapdel <[email protected]>
*/
class NotchPay_Give_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;

add_filter( 'give_get_sections_gateways', [ $this, 'register_sections' ] );
add_filter( 'give_get_settings_gateways', [ $this, 'register_settings' ] );
}

/**
* 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 NotchPay_Give_Loader as all of the hooks are defined
* in that particular class.
*
* The NotchPay_Give_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/notchpay-give-admin.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 NotchPay_Give_Loader as all of the hooks are defined
* in that particular class.
*
* The NotchPay_Give_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/notchpay-give-admin.js', array( 'jquery' ), $this->version, false);

}

public function add_plugin_admin_menu()
{

/*
* Add a settings page for this plugin to the Settings menu.
*
* NOTE: Alternative menu locations are available via WordPress administration menu functions.
*
* Administration Menus: http://codex.wordpress.org/Administration_Menus
*
*/

}

/**
* Add settings action link to the plugins page.
*
* @since 1.0.0
*/

public function add_action_links( $links )
{
/*
* Documentation : https://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name)
*/
$settings_link = array(
'<a href="' . admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=notchpay') . '">' . __('Settings', $this->plugin_name) . '</a>',
);
return array_merge($settings_link, $links);

}

/**
* Render the settings page for this plugin.
*
* @since 1.0.0
*/

public function display_plugin_setup_page()
{
include_once 'partials/notchpay-give-admin-display.php';
}

/**
* Register Admin Section.
*
* @param array $sections List of sections.
*
* @since 1.2.1
* @access public
*
* @return array
*/
public function register_sections( $sections ) {
$sections['notchpay'] = esc_html__( 'Notch Pay', 'notchpay-give' );

return $sections;
}

/**
* Register Admin Settings.
*
* @param array $settings List of settings.
*
* @since 1.0.0
* @access public
*
* @return array
*/
public function register_settings( $settings ) {
$current_section = give_get_current_setting_section();

switch ( $current_section ) {
case 'notchpay':
$settings = [
[
'type' => 'title',
'id' => 'give_title_gateway_settings_notchpay',
],
[
'name' => esc_html__( 'Notch Pay', 'notchpay-give' ),
'desc' => '',
'type' => 'give_title',
'id' => 'give_title_notchpay',
],
[
'name' => esc_html__( 'Sandbox Public Key', 'notchpay-give' ),
'desc' => esc_html__( 'Enter your Notch Pay Test Public Key', 'notchpay-give' ),
'id' => 'notchpay_test_public_key',
'type' => 'password',
'row_classes' => 'give-notchpay-test-public-key',
],
[
'name' => esc_html__( 'Live Public Key', 'notchpay-give' ),
'desc' => esc_html__( 'Enter your Notch Pay Live Public Key', 'notchpay-give' ),
'id' => 'notchpay_live_public_key',
'type' => 'password',
'row_classes' => 'give-notchpay-live-public-key',
],
[
'name' => esc_html__( 'Billing Details', 'notchpay-give' ),
'desc' => esc_html__( 'This is not required by Notch Pay (except email)', 'notchpay-give' ),
'id' => 'notchpay_billing_details',
'type' => 'hidden',
'default' => 'disabled',
],
[
'type' => 'sectionend',
'id' => 'give_title_gateway_settings_notchpay',
]
];
break;
}
return $settings;
}
}
4 changes: 4 additions & 0 deletions admin/css/notchpay-give-admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* All of the CSS for your admin-specific functionality should be
* included in this file.
*/
1 change: 1 addition & 0 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden
32 changes: 32 additions & 0 deletions admin/js/notchpay-give-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(function ( $ ) {
'use strict';

/**
* All of the code for your admin-facing JavaScript source
* should reside in this file.
*
* Note: It has been assumed you will write jQuery code here, so the
* $ function reference has been prepared for usage within the scope
* of this function.
*
* This enables you to define handlers, for when the DOM is ready:
*
* $(function() {
*
* });
*
* When the window is loaded:
*
* $( window ).load(function() {
*
* });
*
* ...and/or other possibilities.
*
* Ideally, it is not considered best practise to attach more than a
* single DOM-ready or window-load handler for a particular page.
* Although scripts in the WordPress core, Plugins and Themes may be
* practising this, we should strive to set a better example in our own work.
*/

})(jQuery);
16 changes: 16 additions & 0 deletions admin/partials/notchpay-give-admin-display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* Provide a admin area view for the plugin
*
* This file is used to markup the admin-facing aspects of the plugin.
*
* @link https://notchpay.co
* @since 1.0.0
*
* @package NotchPay_Give
* @subpackage NotchPay_Give/admin/partials
*/
?>

<!-- This file should primarily consist of HTML with a little bit of PHP. -->
38 changes: 38 additions & 0 deletions includes/class-notchpay-give-activator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Fired during plugin activation
*
* @link https://notchpay.co
* @since 1.0.0
*
* @package NotchPay_Give
* @subpackage NotchPay_Give/includes
*/

/**
* Fired during plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @since 1.0.0
* @package NotchPay_Give
* @subpackage NotchPay_Give/includes
* @author Notch Pay <[email protected]>
*/
class NotchPay_Give_Activator
{

/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate()
{

}

}
38 changes: 38 additions & 0 deletions includes/class-notchpay-give-deactivator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Fired during plugin deactivation
*
* @link https://notchpay.co
* @since 1.0.0
*
* @package NotchPay_Give
* @subpackage NotchPay_Give/includes
*/

/**
* Fired during plugin deactivation.
*
* This class defines all code necessary to run during the plugin's deactivation.
*
* @since 1.0.0
* @package NotchPay_Give
* @subpackage NotchPay_Give/includes
* @author Notch Pay <[email protected]>
*/
class NotchPay_Give_Deactivator
{

/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function deactivate()
{

}

}
Loading

0 comments on commit 11e97a6

Please sign in to comment.