| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Admin |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Enqueue admin scripts and styles |
| 8 |
*/ |
| 9 |
function catchwebtools_admin_enqueue_scripts( $hook_suffix ) { |
| 10 |
//Scripts |
| 11 |
wp_enqueue_script( 'catchwebtools-plugin-options', CATCHWEBTOOLS_URL . 'admin/js/admin.js', array( 'jquery', 'farbtastic' ), '2013-10-05' ); |
| 12 |
|
| 13 |
wp_enqueue_script( 'catchwebtools-upload', CATCHWEBTOOLS_URL . 'admin/js/add_image_scripts.js', array( 'jquery','media-upload','thickbox' ) ); |
| 14 |
|
| 15 |
wp_enqueue_script( 'catchwebtools-equal-height', CATCHWEBTOOLS_URL . 'admin/js/equal_height.js', array( 'jquery' ) ); |
| 16 |
|
| 17 |
//CSS Styles |
| 18 |
wp_enqueue_style( 'catchwebtools-genericons', CATCHWEBTOOLS_URL . 'css/genericons.css', false ); |
| 19 |
wp_enqueue_style( 'catchwebtools-plugin-css', CATCHWEBTOOLS_URL . 'admin/css/admin.css', array( 'farbtastic', 'thickbox' ), '2013-10-05' ); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Only enqueue scripts on catchwebtools pages |
| 24 |
*/ |
| 25 |
if ( isset($_GET['page'] ) && ( $_GET['page'] == 'catch-web-tools' |
| 26 |
|| $_GET['page'] == 'catch-web-tools-webmasters' |
| 27 |
|| $_GET['page'] == 'catch-web-tools-opengraph' |
| 28 |
|| $_GET['page'] == 'catch-web-tools-custom-css' |
| 29 |
|| $_GET['page'] == 'catch-web-tools-seo' |
| 30 |
|| $_GET['page'] == 'catch-web-tools-social-icons' |
| 31 |
|| $_GET['page'] == 'catch-web-tools-catchids' |
| 32 |
) ) { |
| 33 |
add_action( 'admin_enqueue_scripts', 'catchwebtools_admin_enqueue_scripts' ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Admin Social Links |
| 38 |
* use facebook and twitter scripts only on dashboard, hence condition before add_action hook |
| 39 |
*/ |
| 40 |
function catchwebtools_admin_social() { ?> |
| 41 |
<!-- Start Social scripts --> |
| 42 |
<div id="fb-root"></div> |
| 43 |
<script>(function(d, s, id) { |
| 44 |
var js, fjs = d.getElementsByTagName(s)[0]; |
| 45 |
if (d.getElementById(id)) return; |
| 46 |
js = d.createElement(s); js.id = id; |
| 47 |
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=276203972392824"; |
| 48 |
fjs.parentNode.insertBefore(js, fjs); |
| 49 |
}(document, 'script', 'facebook-jssdk'));</script> |
| 50 |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> |
| 51 |
<!-- End Social scripts --> |
| 52 |
<?php |
| 53 |
} |
| 54 |
if ( isset($_GET['page'] ) && ( $_GET['page'] == 'catch-web-tools' ) ) { |
| 55 |
add_action( 'admin_enqueue_scripts', 'catchwebtools_admin_social' ); |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
require_once 'inc/core.php'; |
| 60 |
|
| 61 |
require_once 'inc/metabox.php'; |
| 62 |
|
| 63 |
require_once 'inc/catch-ids.php'; |
| 64 |
|
| 65 |
require_once 'inc/social-icons.php'; |