Create WordPress widget template from scratch

I’ve save down the most basic widget code for WordPress, you can copy this to your plugin and modify it to start your first widget. You can save time on this tutorial to help you create wordpress widget from scratch.

<?php

class example_widget extends WP_Widget {
    function __construct() {
        parent::__construct(false, $name = 'Example Widget');	
    }
 
 	/** @see WP_Widget::widget -- do not rename this */
    function widget($args, $instance) {	
        extract( $args );
        $title 		= apply_filters('widget_title', $instance['title']);
        $message 	= $instance['message'];
        ?>
		<?php echo $before_widget; ?>
			<?php if ( $title )
			echo $before_title . $title . $after_title; ?>
			<ul>
				<li><?php echo $message; ?></li>
			</ul>
			<?php echo $after_widget; ?>
        <?php
    }
 
    /** @see WP_Widget::update -- do not rename this */
    function update($new_instance, $old_instance) {		
		$instance = $old_instance;
		$instance['title'] = strip_tags($new_instance['title']);
		$instance['message'] = strip_tags($new_instance['message']);
        return $instance;
    }
 
    /** @see WP_Widget::form -- do not rename this */
    function form($instance) {	
        $title 		= esc_attr($instance['title']);
        $message	= esc_attr($instance['message']);
        ?>
         <p>
          <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> 
          <input class="" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
        </p>
		<p>
          <label for="<?php echo $this->get_field_id('message'); ?>"><?php _e('Simple Message'); ?></label> 
          <input class="" id="<?php echo $this->get_field_id('message'); ?>" name="<?php echo $this->get_field_name('message'); ?>" type="text" value="<?php echo $message; ?>" />
        </p>
        <?php 
    }
 
 
} // end class example_widget
add_action('widgets_init', create_function('', 'return register_widget("example_widget");'));
?>

Install Tinyproxy on Centos 7

Tinyproxy is a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems.
Designed from the ground up to be fast and yet small, it is an ideal solution for use cases such as embedded deployments where a full featured HTTP proxy is required, but the system resources for a larger proxy are unavailable.

yum install -y epel-release
yum update -y
yum -y install tinyproxy
yum install vim -y

vim /etc/tinyproxy/tinyproxy.conf

Search for

Port 8888

Then
Search for:

Allow xxx.xxx.xxx.xxx

If you want to let it connect from anywhere then just comment it, but I’m not recommended, because it will allow other user connect in.

To test from the Allowed server to the TinyProxy Server

ssh [email protected] -L 1234:localhost:8888 -N

curl -I https://juzhax.com/ --proxy [email protected]:8888