Skip to content

Instantly share code, notes, and snippets.

View thaboklass's full-sized avatar

Thabo David Nyakallo Klass thaboklass

View GitHub Profile
<?php
/**
* Connect the widget to the user's RobberBaron account by
* sending a JSON reguest that will return the user's IS
*
* @param none
* @return none
*/
function robber_baron_tv_connect() {
<?php
// Outputs pertinent nonces, actions and options for
// the section
settings_fields('robber_baron_tv_settings');
// Renders the setting sections added to the page
// 'Configuration Settings'
do_settings_sections('robber-baron-tv-configuration');
// Renders a submit button that saves all of the options
<?php
/**
* Register section, fields and page
*
* Registers a new settings section and settings fields on the
* 'RobberBaron.TV' page of the WordPress dashboard.
*
* @param none
* @return none
*/
<?php
/**
* Adds 'RobberBaron.TV' menu item
*
* Adds the 'Settings' menu titled 'Ethereum Settings'
* as a top level menu item in the dashboard.
*
* @param none
* @return none
*/
<?php
public function __construct() {
// Add RobberBaron.TV options
$this->robber_baron_tv_add_options();
// Set the option to true, if is in fact connected
if (get_option('robber_baron_tv_connected') == 'true') {
$this->robber_baron_tv_connected = 'true';
}
<?php
// If uninstall is not called from WordPress, exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit();
}
// delete options from options table
delete_option('robber_baron_tv_connected');
delete_option('robber_baron_tv_email_address');
delete_option('robber_baron_tv_user_id');
<?php
/**
* Widget callback: registers RobberBaron.TV
* widget
*
* @param none
* @return none
*/
function robber_baron_tv_widget_reg() {
<?php
/**
* Add options for new activation
*
* This checks whether or not backend options that define the basic
* functionality have been added and if not, they are added
* with what have been determined as the most efficient defaults
*
* @param none
* @return none
<?php
/**
* Load scripts
*
* Load all relevant styles and scripts - in this case we load just
* one stylesheet and two javascript files
*
* @param none
* @return none
*/
<?php
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/