Created
October 28, 2014 23:33
-
-
Save zackkatz/bb6373847a96b4a20fa0 to your computer and use it in GitHub Desktop.
Use an alternative source for DataTables files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: GravityView - Use Alternate DataTables Sources | |
* Description: Use CDNJS.com sources for the DataTables library | |
* Version: 1.0 | |
* Author: Katz Web Services, Inc. | |
* Author URI: https://gravityview.co | |
*/ | |
class Replace_GV_DataTables_Scripts { | |
function init() { | |
new Replace_GV_DataTables_Scripts; | |
} | |
function __construct() { | |
add_filter('gravityview_datatables_script_src', array( $this, 'datatables_js') ); | |
add_filter('gravityview_datatables_style_src', array( $this, 'datatables_css') ); | |
add_filter('gravityview_dt_tabletools_script_src', array( $this, 'tabletools_js' ) ); | |
add_filter('gravityview_dt_tabletools_style_src', array( $this, 'tabletools_css' ) ); | |
} | |
function datatables_js() { | |
return '//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.1/js/jquery.dataTables.min.js'; | |
} | |
function datatables_css() { | |
return '//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.1/css/jquery.dataTables.min.css'; | |
} | |
function tabletools_js() { | |
return '//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/js/TableTools.min.js'; | |
} | |
function tabletools_css() { | |
return '//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/css/TableTools.css'; | |
} | |
} | |
add_action( 'init', array('Replace_GV_DataTables_Scripts', 'init' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment