-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfontawesome.php
More file actions
75 lines (62 loc) · 1.92 KB
/
fontawesome.php
File metadata and controls
75 lines (62 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
Plugin Name: Font Awesome Experiment
Plugin URI: -
Description: -
Version: 0.1
Author: Edvin Brobeck
Author URI: http://www.raketwebbyra.se
*/
/*
* Shortcode function
*/
function dws_icons($params, $content = null){
extract(shortcode_atts(array(
'name' => 'default'
), $params));
$content = preg_replace('/<br class="nc".\/>/', '', $content);
$result = '<i class="'.$name.'"></i>';
return force_balance_tags( $result );
}
add_shortcode('icon', 'dws_icons');
class fontawesome_raket{
function __construct()
{
add_action('init',array(&$this, 'init'));
}
function init(){
//Add font awesome to BackEnd And FrontEnd
if(!is_admin()){
wp_enqueue_style("fontawesome", 'http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css');
} else {
wp_enqueue_style("fontawesome", 'http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css');
wp_enqueue_style("dws_admin_style", plugins_url('assets/css/admin.css', __FILE__ ));
}
//Fail safe - Kick out 'dat Cheater!
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
return;
}
//Register TMCE Plugin
add_filter( 'mce_external_plugins', array(&$this, 'regplugins') );
add_filter( 'mce_buttons_3', array(&$this, 'regbtns') );
//Add Fontawesome to the Editor Iframe
function plugin_mce_css( $mce_css ) {
if ( ! empty( $mce_css ) )
$mce_css .= ',';
$mce_css .= 'http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css';
return $mce_css;
}
add_filter( 'mce_css', 'plugin_mce_css' );
}
function regbtns($buttons)
{
array_push($buttons, 'dws_icons');
return $buttons;
}
function regplugins($plgs)
{
$plgs['dws_icons'] = plugins_url('assets/js/plugins/icons.js', __FILE__ );
return $plgs;
}
}
$fontawesome_raket = new fontawesome_raket();