-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap-shortcode-ultimate.php
More file actions
118 lines (104 loc) · 3.82 KB
/
bootstrap-shortcode-ultimate.php
File metadata and controls
118 lines (104 loc) · 3.82 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/*
Plugin Name: Bootstrap Shortcodes Ultimate
Plugin URI: https://devshuvo.com
Author: Akhtarujjaman Shuvo
Author URI: https://www.facebook.com/akhterjshuvo
Version: 4.2.3
Description: Simple Plugin for Enqueue Bootstrap 4 CSS, JS, and Some Helpful WordPress Shortcodes for visual usages.
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
// don't load directly
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
define('BSTU_VERSION', '4.2.3');
/**
* Including Plugin file for security
* Include_once
*
* @since 1.0.0
*/
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
function btsu_scripts(){
wp_register_style('bootstrap', plugin_dir_url(__FILE__).'assets/css/bootstrap.min.css', null, BSTU_VERSION);
wp_register_script('bootstrap', plugin_dir_url(__FILE__).'assets/js/bootstrap.min.js', array('jquery'), BSTU_VERSION);
wp_enqueue_style('bootstrap');
wp_enqueue_script('bootstrap');
}
add_action('wp_enqueue_scripts','btsu_scripts');
// Shortcodes
include_once( dirname( __FILE__ ) . '/inc/shortcodes.php' );
// Notice
include_once( dirname( __FILE__ ) . '/inc/class-admin-notice.php' );
/**
* Remove extra paragraphs and line breaks
*/
add_filter('the_content','btsu_fix_shortcodes');
function btsu_fix_shortcodes($content){
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']',
']<br>' => ']'
);
$content = strtr($content, $array);
return $content;
}
/**
* Add plugin action links.
*
* @since 1.0.0
* @version 4.0.0
*/
function btsu_plugin_action_links( $links ) {
$plugin_links = array(
'<a target="_blank" href="'.esc_url('https://wordpress.org/plugins/bs-shortcode-ultimate/#tab-description').'">' . esc_html__( 'Shortcodes', 'btsu' ) . '</a>',
'<a target="_blank" title="'.esc_attr('If you need help just create a support ticket').'" href="'.esc_url('https://wordpress.org/support/plugin/bs-shortcode-ultimate/#new-topic-0').'">' . esc_html__( 'Need Helps?', 'btsu' ) . '</a>',
'<a target="_blank" title="'.esc_attr('We hope you\'re enjoying This plugin! Could you please do us a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?').'" href="'.esc_url('https://wordpress.org/support/plugin/bs-shortcode-ultimate/reviews/?filter=5#new-post').'">' . esc_html__( '★★★★★', 'btsu' ) . '</a>',
);
return array_merge( $plugin_links, $links );
}
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'btsu_plugin_action_links' );
/**
* Example Function for add notice
*/
function my_admin_notices($args){
$args[] = array(
'id' => "btsu_admin_notice",
'text' => "We hope you're enjoying this plugin! Could you please give a 5-star rating on WordPress to inspire us?",
'logo' => "https://ps.w.org/bs-shortcode-ultimate/assets/icon-256x256.png",
'border_color' => "#5b26a6",
'is_dismissable' => "true",
'dismiss_text' => "Dismiss",
'buttons' => array(
array(
'text' => "Shortcodes",
'link' => "https://wordpress.org/plugins/bs-shortcode-ultimate/#tab-description",
'icon' => "dashicons dashicons-external",
'class' => "button button-secondary",
),
array(
'text' => "Need Helps?",
'link' => "https://wordpress.org/support/plugin/bs-shortcode-ultimate/#new-topic-0",
'icon' => "dashicons dashicons-admin-comments",
'class' => "button button-secondary",
),
array(
'text' => "Need Custom Shortcode",
'link' => "mailto:info@addonmaster.com",
'icon' => "dashicons dashicons-email",
'class' => "button button-secondary",
),
array(
'text' => "Rate us 5*",
'link' => "https://wordpress.org/support/plugin/bs-shortcode-ultimate/#new-topic-0",
'icon' => "dashicons dashicons-external",
'class' => "button button-secondary",
),
)
);
return $args;
}
add_filter( 'addonmaster_admin_notice', 'my_admin_notices' );