Location: PHPKode > scripts > Copy URL button > copyurlbutton/linkbutton.php
<?php
/*
Plugin Name: Copy URL button
Plugin URI: http://www.seoreviewtools.com/wordpress-copy-url-button-plugin/
Description: Add a, good looking, <strong>backlink button</strong> to your posts and pages using shortcodes.
Version: 1.0
Author: SEO Review Tools
Author URI: http://www.seoreviewtools.com
Author Email: hide@address.com
License:
 
  Copyright 2013  (hide@address.com)
 
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License, version 2, as
  published by the Free Software Foundation.
 
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
 
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
*/
 
// TODO: rename this class to a proper name for your plugin
class copyURL {
 
    /*--------------------------------------------*
     * Constructor
     *--------------------------------------------*/
 
    /**
     * Initializes the plugin by setting localization, filters, and administration functions.
     */
    function __construct() {
 
        // Register site styles and scripts
        add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) );
        add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) );
 
        // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
        register_activation_hook( __FILE__, array( $this, 'activate' ) );
        register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
        register_uninstall_hook( __FILE__, 'uninstall_removedata'); // weet niet waarom
 
      
        add_action( 'pre_get_posts', array( $this, 'copyurl_function' ) ); 
		
		// plugin Functionality //	
		function copyurl_function($atts, $content = null ) {
			if (is_array($atts) && ($atts['size'] == 'small' )){
				$output = '
				<ul class="link_wraper">
					<li class="link_button"><a href="#">URL</a>
						<ul><li class="url_txt"> <form id="WPlinkbutton"><input type="text" value="'.get_permalink().'" /></form></li></ul>
					</li>
				</ul>';
			}else { 
				$output = '
				<ul class="link_wraper">
				<li class="link_count"><img src="/wp-content/plugins/copyurlbutton/images/corner.gif" /></li>
				<li class="link_button"><a href="#">URL</a>
					<ul><li class="url_txt"> <form id="WPlinkbutton"><input type="text" value="'.get_permalink().'" /></form></li></ul>
				</li>
			</ul>';
			}
		
			return $output;
		}
		add_shortcode('copyurlbutton', 'copyurl_function');
		
		// plugin Menu //	
		add_action( 'admin_menu', 'copyurl_plugin_menu' );
		
		function copyurl_plugin_menu() {
			add_options_page( 'Copy URL button Options', 'Copy URL button', 'manage_options', 'copyurlbutton', 'copyurl_options' );
		}
		
		function copyurl_options() {
			if ( !current_user_can( 'manage_options' ) )  {
				wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
			}
			echo '<div class="wrap">';
			echo '
				<h2>Copy URL button plugin</h2>
				<p>With the <strong>Copy URL button</strong> plugin you can create some nice, social media like, backlink buttons.</p>
				<h2>You have the following options to create your buttons</h2>
				<p>Inside the post editor</p>
				<blockquote>
				<ul>
					<li>[copyurlbutton] = Default display (Like a social button including count).</li>
					<li>[copyurlbutton size=\'small\'] = Small display. </li>				
				</ul>  
				</blockquote>
				<p>Using PHP</p>
				<blockquote>
				<ul>
					<li>&lt;?php echo do_shortcode(\'[copyurlbutton]\'); ?&gt; = Default display (Like a social button including count).</li>
					<li>&lt;?php echo do_shortcode(\'[copyurlbutton size=\'small\']\'); ?&gt; = Small display. </li>				
				</ul>   
				</blockquote>
				<br /><br /><br />
				<p>More information about this:  <a href="http://www.seoreviewtools.com/wordpress-copy-url-button-plugin/" target="_blank">Plugin</a>.</p>
				  ';
			echo '</div>';
		}	
		
    } // end constructor
 
 
    public function activate( $network_wide ) {   
    } // end activate
 
    public function deactivate( $network_wide ) {     
    } // end deactivate
    
    public function uninstall( $network_wide ) {
    } // end uninstall
 
    public function register_plugin_styles() {
        wp_enqueue_style( 'copyurlbutton-plugin-styles', plugins_url( 'copyurlbutton/css/linkbutton.css' ) );
 
    } // end register_plugin_styles
 
    /**
     * Registers and enqueues plugin-specific scripts.
     */
    public function register_plugin_scripts() {
        wp_enqueue_script( 'copyurlbutton-plugin-script', plugins_url( 'copyurlbutton/js/linkbutton.js'), array('jquery')); 
    } // end register_plugin_scripts
 
    /*--------------------------------------------*
     * Core Functions
     *---------------------------------------------*/
 
    function copyurl_function() {   
    } // end action_method_name
 
  
    function filter_method_name() {
    } // end filter_method_name
 
} // end class
 
$plugin_name = new copyURL();
Return current item: Copy URL button