| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Table Sorter |
| 4 |
* Plugin URI: http://tablesorter.oregasoft.com |
| 5 |
* Description: This plugin makes your standard HTML tables sortable. For more details, visit plugin's setting page |
| 6 |
* Version: 2.0 |
| 7 |
* Author: Farhan Noor |
| 8 |
* Author URI: http://linkedin.com/in/thenoors |
| 9 |
* License: GPLv2 or later |
| 10 |
*/ |
| 11 |
|
| 12 |
function tablesorter_enque_scripts(){ |
| 13 |
wp_register_script('table-sorter',plugins_url('table-sorter/jquery.tablesorter.min.js','table-sorter'),array('jquery')); |
| 14 |
wp_enqueue_script('table-sorter-metadata',plugins_url('table-sorter/jquery.metadata.js','table-sorter'),array('table-sorter')); |
| 15 |
wp_enqueue_script('table-sorter-custom-js',plugins_url('table-sorter/wp-script.js','table-sorter')); |
| 16 |
wp_enqueue_style('table-sorter-custom-css',plugins_url('table-sorter/wp-style.css')); |
| 17 |
} |
| 18 |
add_action( 'wp_enqueue_scripts', 'tablesorter_enque_scripts' ); |
| 19 |
|
| 20 |
|
| 21 |
function my_plugin_menu(){ |
| 22 |
add_options_page( 'Table Sorter', 'Table Sorter', 'manage_options', 'table-sorter', 'tablesorter_callback'); |
| 23 |
} |
| 24 |
add_action('admin_menu', 'my_plugin_menu'); |
| 25 |
function tablesorter_callback(){ |
| 26 |
require_once('wp-admin-page.php'); |
| 27 |
} |
| 28 |
|
| 29 |
function my_plugin_row_meta( $links, $file ) { |
| 30 |
if ( strpos( $file, 'table-sorter.php' ) !== false ) { |
| 31 |
$new_links = array('<a href="' . admin_url( 'options-general.php?page=table-sorter' ) . '">Settings</a>'); |
| 32 |
$links = array_merge( $links, $new_links ); |
| 33 |
} |
| 34 |
return $links; |
| 35 |
} |
| 36 |
add_filter( 'plugin_row_meta', 'my_plugin_row_meta', 10, 2 ); |
| 37 |
|
| 38 |
function add_action_links ( $links ) { |
| 39 |
$mylinks = array('<a href="' . admin_url( 'options-general.php?page=table-sorter' ) . '">Settings</a>'); |
| 40 |
return array_merge( $links, $mylinks ); |
| 41 |
} |
| 42 |
add_filter( 'plugin_action_links_table-sorter/table-sorter.php', 'add_action_links' ); |