PluginProbe
oik / 1.7
oik v1.7
1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.2 1.3 1.3.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.0.1 2.1 2.2 2.3 2.4 2.5 2.5.1 All 71 releases
oik / oik-button-shortcodes.php

oik-button-shortcodes.php in oik 1.7, at oik-button-shortcodes.php

100 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: oik [bw_button] shortcodes
4 Plugin URI: http://www.oik-plugins.com/oik
5 Description: [oik] button shortcodes - Call to action style buttons for Artisteer themes
6 Version: 1.7
7 Author: bobbingwide
8 Author URI: http://www.bobbingwide.com/content/herb-miller
9
10 Notes & Limitations:
11
12
13 */
14
15 if ( ! defined( 'ABSPATH' ) )
16 die( "Can't load this file directly" );
17 require_once( "bobbfunc.inc" );
18
19 class BWButton
20 {
21 function __construct() {
22 // add_action('admin_menu', array($this, 'bw_button_create_menu'));
23 add_action('admin_init', array($this, 'bw_button_admin_init'));
24 add_shortcode('bw_button', array($this, 'bw_button_shortcodes'));
25 add_shortcode('bw_contact_button', array($this, 'bw_contact_button'));
26
27 }
28
29 function bw_button_admin_init() {
30 if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
31 add_filter('mce_buttons', array($this, 'filter_mce_button'));
32 add_filter('mce_external_plugins', array($this, 'filter_mce_plugin'));
33 }
34 }
35
36 function filter_mce_button($buttons) {
37 array_push($buttons, '|', 'bwbutton_button' );
38 return $buttons;
39 }
40
41 function filter_mce_plugin($plugins) {
42 $plugins['bwbutton'] = plugin_dir_url( __FILE__ ) . 'oik_button_plugin.js';
43 return $plugins;
44 }
45
46 /* [bw_button link="" text="" title="" class="" ]
47 bw_button_shortcodes calls art_button
48 art_button includes redundant classes for Artisteer 2.x and 3
49
50 */
51
52
53
54
55 function bw_button_shortcodes($atts) {
56 $link = $atts['link'];
57 $text = $atts['text'];
58 $title = $atts['title'];
59 $class = $atts['class'];
60 bw_trace( $atts, __FUNCTION__, __LINE__, __FILE__, "atts" );
61 art_button( $link, $text, $title, $class );
62 return( bw_ret());
63 }
64
65 /* Create a Contact me button
66
67 Create a contact me button which links to the contact form page.
68 Parameters are:
69 [bw_contact_button link='URL' text='button text' title='button tooltip text']
70
71 Defaults:
72 Field option field used hardcoded default
73 link bw_contact_link /contact/
74 text bw_contact_text Contact
75 title bw_contact_title Contact $contact
76
77
78 */
79 function bw_contact_button( $atts ) {
80 bw_trace( $atts, __FUNCTION__, __LINE__, __FILE__, "atts" );
81 $contact = bw_default_empty_att( NULL, "contact", "me" );
82
83
84 $link = bw_default_empty_arr( $atts, 'link', "contact-link", "/contact/" );
85
86 bw_trace( $link, __FUNCTION__, __LINE__, __FILE__, "link" );
87 $text = bw_default_empty_arr( $atts, 'text', "contact-text", "Contact" );
88 $title = bw_default_empty_arr( $atts, 'title', "contact-title", "Contact " . $contact);
89
90 $class = bw_array_get( $atts, 'class', NULL ) . "contact" ;
91 art_button( $link, $text, $title, $class );
92
93 return( bw_ret());
94 }
95
96 } // end of class;
97
98 $bwbutton = new BWbutton();
99
100