Menu Icons by ThemeIsle - Version 0.11.1

Version Description

  • 2018-02-24
Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Menu Icons by ThemeIsle
Version 0.11.1
Comparing to
See all releases

Code changes from version 0.11.0 to 0.11.1

CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
2
- ### v0.11.0 - 2018-01-29
3
**Changes:**
4
5
### v0.11.0 - 2018-01-05
6
**Changes:**
7
* Change ownership to ThemeIsle.
1
2
+ ### v0.11.1 - 2018-02-26
3
**Changes:**
4
5
+ ### v0.11.1 - 2018-02-24
6
+ **Changes:**
7
+ * Add recommendation boxes in the menu icon popup.
8
+
9
### v0.11.0 - 2018-01-05
10
**Changes:**
11
* Change ownership to ThemeIsle.
css/admin.css CHANGED
@@ -141,3 +141,33 @@
141
.attachment .svg-icon img {
142
max-width: 100%;
143
}
141
.attachment .svg-icon img {
142
max-width: 100%;
143
}
144
+
145
+ .menu-icons-upgrade-hestia {
146
+ width: 90%;
147
+ margin-top: 0;
148
+ padding: 15px;
149
+ }
150
+
151
+
152
+ #menu-icons-sidebar div.new-card {
153
+ width: auto;
154
+ min-width: initial;
155
+ max-width: initial;
156
+ margin: 10px auto;
157
+ }
158
+
159
+ .menu-icons-subscribe {
160
+ padding: 15px;
161
+ }
162
+
163
+ .menu-icons-submit-mail {
164
+ width: auto;
165
+ }
166
+
167
+ #success{
168
+ display: none;
169
+ }
170
+
171
+ #failure{
172
+ display: none;
173
+ }
css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .menu-icons-settings ._extensions ul a,.menu-icons-wrap a,.mi-preview.menu-item a{text-decoration:none}.menu-icons-wrap{margin-top:5px;margin-bottom:5px}.menu-icons-wrap p{min-height:2.2em;margin-bottom:0}.menu-icons-wrap p a,.menu-icons-wrap p label{display:inline-block;height:100%;line-height:2.2em;vertical-align:middle}.menu-icons-wrap a{cursor:pointer}.menu-icons-wrap .submitdelete{display:inline-block;float:none;height:100%;margin:0;padding:0;line-height:2.2em}.menu-icons-wrap .hidden{display:none}.menu-icons-wrap ._icon{width:auto;height:auto;margin:-.1em .2em 0;color:#666;font-size:1.9em;vertical-align:middle}.menu-icons-wrap img._icon{max-width:24px}.menu-icons-wrap a._select:focus ._icon,.menu-icons-wrap a._select:hover ._icon{color:#101010}.mi-preview.menu-item{min-height:0;font-size:1.2em}.mi-preview.menu-item a>*{display:inline-block;height:100%;line-height:100%;vertical-align:middle}.mi-preview.menu-item ._icon{margin-right:.25em}.rtl .mi-preview.menu-item ._icon{margin-right:0}.media-sidebar .mi-settings .setting input[type=number],.menu-icons-settings input[type=number]{float:none;width:auto;max-width:5em}.media-sidebar .mi-settings .setting input,.media-sidebar .mi-settings span.description{float:none}.menu-icons-settings ._field{padding:.5em 0}.menu-icons-settings ._field ._main{display:block;margin-bottom:.25em;font-weight:700}#menu-settings-column .menu-icons-settings .inside{margin-top:0}.menu-icons-settings .taxonomydiv .tabs-panel{max-height:none;margin-bottom:.75em;padding-top:.3em;padding-bottom:.4em}.js .menu-icons-settings .taxonomydiv .tabs-panel{margin-bottom:0}.menu-icons-settings h4{margin:0}.menu-icons-settings ._menu span.description{margin-left:.5em}.menu-icons-settings ._extensions ul{margin-top:.75em;padding-left:1.5em;list-style:disc}.menu-icons-settings .spinner{float:none;margin:0 5px 0 0;vertical-align:middle}.attachment .svg-icon img{max-width:100%}
1
+ .menu-icons-settings ._extensions ul a,.menu-icons-wrap a,.mi-preview.menu-item a{text-decoration:none}.menu-icons-wrap{margin-top:5px;margin-bottom:5px}.menu-icons-wrap p{min-height:2.2em;margin-bottom:0}.menu-icons-wrap p a,.menu-icons-wrap p label{display:inline-block;height:100%;line-height:2.2em;vertical-align:middle}.menu-icons-wrap a{cursor:pointer}.menu-icons-wrap .submitdelete{display:inline-block;float:none;height:100%;margin:0;padding:0;line-height:2.2em}.menu-icons-wrap .hidden{display:none}.menu-icons-wrap ._icon{width:auto;height:auto;margin:-.1em .2em 0;color:#666;font-size:1.9em;vertical-align:middle}.menu-icons-wrap img._icon{max-width:24px}.menu-icons-wrap a._select:focus ._icon,.menu-icons-wrap a._select:hover ._icon{color:#101010}.mi-preview.menu-item{min-height:0;font-size:1.2em}.mi-preview.menu-item a>*{display:inline-block;height:100%;line-height:100%;vertical-align:middle}.mi-preview.menu-item ._icon{margin-right:.25em}.rtl .mi-preview.menu-item ._icon{margin-right:0}.media-sidebar .mi-settings .setting input[type=number],.menu-icons-settings input[type=number]{float:none;width:auto;max-width:5em}.media-sidebar .mi-settings .setting input,.media-sidebar .mi-settings span.description{float:none}.menu-icons-settings ._field{padding:.5em 0}.menu-icons-settings ._field ._main{display:block;margin-bottom:.25em;font-weight:700}#menu-settings-column .menu-icons-settings .inside{margin-top:0}.menu-icons-settings .taxonomydiv .tabs-panel{max-height:none;margin-bottom:.75em;padding-top:.3em;padding-bottom:.4em}.js .menu-icons-settings .taxonomydiv .tabs-panel{margin-bottom:0}.menu-icons-settings h4{margin:0}.menu-icons-settings ._menu span.description{margin-left:.5em}.menu-icons-settings ._extensions ul{margin-top:.75em;padding-left:1.5em;list-style:disc}.menu-icons-settings .spinner{float:none;margin:0 5px 0 0;vertical-align:middle}.attachment .svg-icon img{max-width:100%}.menu-icons-upgrade-hestia{width:90%;margin-top:0;padding:15px}#menu-icons-sidebar div.new-card{width:auto;min-width:initial;max-width:initial;margin:10px auto}.menu-icons-subscribe{padding:15px}.menu-icons-submit-mail{width:auto}#failure,#success{display:none}
includes/settings.php CHANGED
@@ -4,7 +4,7 @@
4
* Settings
5
*
6
* @package Menu_Icons
7
- * @author Dzikri Aziz <kvcrvt@gmail.com>
8
*/
9
10
/**
@@ -21,7 +21,7 @@ final class Menu_Icons_Settings {
21
/**
22
* Default setting values
23
*
24
- * @since 0.3.0
25
* @var array
26
* @access protected
27
*/
@@ -34,7 +34,7 @@ final class Menu_Icons_Settings {
34
/**
35
* Setting values
36
*
37
- * @since 0.3.0
38
* @var array
39
* @access protected
40
*/
@@ -49,66 +49,6 @@ final class Menu_Icons_Settings {
49
*/
50
protected static $script_deps = array( 'jquery' );
51
52
-
53
- /**
54
- * Get setting value
55
- *
56
- * @since 0.3.0
57
- * @return mixed
58
- */
59
- public static function get() {
60
- $args = func_get_args();
61
-
62
- return kucrut_get_array_value_deep( self::$settings, $args );
63
- }
64
-
65
-
66
- /**
67
- * Get menu settings
68
- *
69
- * @since 0.3.0
70
- * @param int $menu_id
71
- * @return array
72
- */
73
- public static function get_menu_settings( $menu_id ) {
74
- $menu_settings = self::get( sprintf( 'menu_%d', $menu_id ) );
75
- $menu_settings = apply_filters( 'menu_icons_menu_settings', $menu_settings, $menu_id );
76
-
77
- if ( ! is_array( $menu_settings ) ) {
78
- $menu_settings = array();
79
- }
80
-
81
- return $menu_settings;
82
- }
83
-
84
-
85
- /**
86
- * Check if menu icons is disabled for a menu
87
- *
88
- * @since 0.8.0
89
- *
90
- * @param int $menu_id Menu ID. Defaults to current menu being edited.
91
- *
92
- * @return bool
93
- */
94
- public static function is_menu_icons_disabled_for_menu( $menu_id = 0 ) {
95
- if ( empty( $menu_id ) ) {
96
- $menu_id = self::get_current_menu_id();
97
- }
98
-
99
- // When we're creating a new menu or the recently edited menu
100
- // could not be found.
101
- if ( empty( $menu_id ) ) {
102
- return true;
103
- }
104
-
105
- $menu_settings = self::get_menu_settings( $menu_id );
106
- $is_disabled = ! empty( $menu_settings['disabled'] );
107
-
108
- return $is_disabled;
109
- }
110
-
111
-
112
/**
113
* Settings init
114
*
@@ -119,6 +59,7 @@ final class Menu_Icons_Settings {
119
* Allow themes/plugins to override the default settings
120
*
121
* @since 0.9.0
122
* @param array $default_settings Default settings.
123
*/
124
self::$defaults = apply_filters( 'menu_icons_settings_defaults', self::$defaults );
@@ -128,10 +69,12 @@ final class Menu_Icons_Settings {
128
foreach ( self::$settings as $key => &$value ) {
129
if ( 'global' === $key ) {
130
// Remove unregistered icon types.
131
- $value['icon_types'] = array_values( array_intersect(
132
- array_keys( Menu_Icons::get( 'types' ) ),
133
- array_filter( (array) $value['icon_types'] )
134
- ) );
135
} else {
136
// Backward-compatibility.
137
if ( isset( $value['width'] ) && ! isset( $value['svg_width'] ) ) {
@@ -148,6 +91,7 @@ final class Menu_Icons_Settings {
148
* Allow themes/plugins to override the settings
149
*
150
* @since 0.9.0
151
* @param array $settings Menu Icons settings.
152
*/
153
self::$settings = apply_filters( 'menu_icons_settings', self::$settings );
@@ -166,6 +110,87 @@ final class Menu_Icons_Settings {
166
add_action( 'wp_ajax_menu_icons_update_settings', array( __CLASS__, '_ajax_menu_icons_update_settings' ) );
167
}
168
169
170
/**
171
* Prepare wp-admin/nav-menus.php page
@@ -180,6 +205,7 @@ final class Menu_Icons_Settings {
180
* Allow settings meta box to be disabled.
181
*
182
* @since 0.4.0
183
* @param bool $disabled Defaults to FALSE.
184
*/
185
$settings_disabled = apply_filters( 'menu_icons_disable_settings', false );
@@ -193,7 +219,6 @@ final class Menu_Icons_Settings {
193
add_action( 'admin_notices', array( __CLASS__, '_admin_notices' ) );
194
}
195
196
-
197
/**
198
* Update settings
199
*
@@ -211,13 +236,14 @@ final class Menu_Icons_Settings {
211
}
212
}
213
214
-
215
/**
216
* Update settings
217
*
218
* @since 0.7.0
219
* @access protected
220
- * @param array $values Settings values.
221
* @return string Redirect URL.
222
*/
223
protected static function _update_settings( $values ) {
@@ -238,7 +264,6 @@ final class Menu_Icons_Settings {
238
return $redirect_url;
239
}
240
241
-
242
/**
243
* Reset settings
244
*
@@ -258,6 +283,23 @@ final class Menu_Icons_Settings {
258
return $redirect_url;
259
}
260
261
262
/**
263
* Update settings via ajax
@@ -276,7 +318,6 @@ final class Menu_Icons_Settings {
276
wp_send_json_success( array( 'redirectUrl' => $redirect_url ) );
277
}
278
279
-
280
/**
281
* Print admin notices
282
*
@@ -301,62 +342,155 @@ final class Menu_Icons_Settings {
301
delete_transient( self::TRANSIENT_KEY );
302
}
303
304
-
305
/**
306
* Settings meta box
307
*
308
- * @since 0.3.0
309
- * @access private
310
*/
311
- private static function _add_settings_meta_box() {
312
- add_meta_box(
313
- 'menu-icons-settings',
314
- __( 'Menu Icons Settings', 'menu-icons' ),
315
- array( __CLASS__, '_meta_box' ),
316
- 'nav-menus',
317
- 'side',
318
- 'low',
319
- array()
320
- );
321
- }
322
323
324
/**
325
- * Get ID of menu being edited
326
- *
327
- * @since 0.7.0
328
- * @since 0.8.0 Get the recently edited menu from user option.
329
*
330
- * @return int
331
*/
332
- public static function get_current_menu_id() {
333
- global $nav_menu_selected_id;
334
335
- if ( ! empty( $nav_menu_selected_id ) ) {
336
- return $nav_menu_selected_id;
337
- }
338
339
- if ( is_admin() && isset( $_REQUEST['menu'] ) ) {
340
- $menu_id = absint( $_REQUEST['menu'] );
341
- } else {
342
- $menu_id = absint( get_user_option( 'nav_menu_recently_edited' ) );
343
}
344
345
- return $menu_id;
346
}
347
348
-
349
/**
350
* Get settings fields
351
*
352
* @since 0.4.0
353
- * @param array $values Values to be applied to each field.
354
* @uses apply_filters() Calls 'menu_icons_settings_fields'.
355
* @return array
356
*/
357
public static function get_settings_fields( array $values = array() ) {
358
$fields = array(
359
- 'hide_label' => array(
360
'id' => 'hide_label',
361
'type' => 'select',
362
'label' => __( 'Hide Label', 'menu-icons' ),
@@ -372,7 +506,7 @@ final class Menu_Icons_Settings {
372
),
373
),
374
),
375
- 'position' => array(
376
'id' => 'position',
377
'type' => 'select',
378
'label' => __( 'Position', 'menu-icons' ),
@@ -428,7 +562,7 @@ final class Menu_Icons_Settings {
428
),
429
),
430
),
431
- 'font_size' => array(
432
'id' => 'font_size',
433
'type' => 'number',
434
'label' => __( 'Font Size', 'menu-icons' ),
@@ -439,7 +573,7 @@ final class Menu_Icons_Settings {
439
'step' => '0.1',
440
),
441
),
442
- 'svg_width' => array(
443
'id' => 'svg_width',
444
'type' => 'number',
445
'label' => __( 'SVG Width', 'menu-icons' ),
@@ -450,7 +584,7 @@ final class Menu_Icons_Settings {
450
'step' => '.1',
451
),
452
),
453
- 'image_size' => array(
454
'id' => 'image_size',
455
'type' => 'select',
456
'label' => __( 'Image Size', 'menu-icons' ),
@@ -476,59 +610,6 @@ final class Menu_Icons_Settings {
476
return $fields;
477
}
478
479
-
480
- /**
481
- * Get settings sections
482
- *
483
- * @since 0.3.0
484
- * @uses apply_filters() Calls 'menu_icons_settings_sections'.
485
- * @return array
486
- */
487
- public static function get_fields() {
488
- $menu_id = self::get_current_menu_id();
489
- $icon_types = wp_list_pluck( Menu_Icons::get( 'types' ), 'name' );
490
-
491
- asort( $icon_types );
492
-
493
- $sections = array(
494
- 'global' => array(
495
- 'id' => 'global',
496
- 'title' => __( 'Global', 'menu-icons' ),
497
- 'description' => __( 'Global settings', 'menu-icons' ),
498
- 'fields' => array(
499
- array(
500
- 'id' => 'icon_types',
501
- 'type' => 'checkbox',
502
- 'label' => __( 'Icon Types', 'menu-icons' ),
503
- 'choices' => $icon_types,
504
- 'value' => self::get( 'global', 'icon_types' ),
505
- ),
506
- ),
507
- 'args' => array(),
508
- ),
509
- );
510
-
511
- if ( ! empty( $menu_id ) ) {
512
- $menu_term = get_term( $menu_id, 'nav_menu' );
513
- $menu_key = sprintf( 'menu_%d', $menu_id );
514
- $menu_settings = self::get_menu_settings( $menu_id );
515
-
516
- $sections['menu'] = array(
517
- 'id' => $menu_key,
518
- 'title' => __( 'Current Menu', 'menu-icons' ),
519
- 'description' => sprintf(
520
- __( '"%s" menu settings', 'menu-icons' ),
521
- apply_filters( 'single_term_title', $menu_term->name )
522
- ),
523
- 'fields' => self::get_settings_fields( $menu_settings ),
524
- 'args' => array( 'inline_description' => true ),
525
- );
526
- }
527
-
528
- return apply_filters( 'menu_icons_settings_sections', $sections, $menu_id );
529
- }
530
-
531
-
532
/**
533
* Get processed settings fields
534
*
@@ -560,92 +641,6 @@ final class Menu_Icons_Settings {
560
return $sections;
561
}
562
563
-
564
- /**
565
- * Settings meta box
566
- *
567
- * @since 0.3.0
568
- */
569
- public static function _meta_box() {
570
- ?>
571
- <div class="taxonomydiv">
572
- <ul id="menu-icons-settings-tabs" class="taxonomy-tabs add-menu-item-tabs hide-if-no-js">
573
- <?php foreach ( self::get_fields() as $section ) : ?>
574
- <?php
575
- printf(
576
- '<li><a href="#" title="%s" class="mi-settings-nav-tab" data-type="menu-icons-settings-%s">%s</a></li>',
577
- esc_attr( $section['description'] ),
578
- esc_attr( $section['id'] ),
579
- esc_html( $section['title'] )
580
- );
581
- ?>
582
- <?php endforeach; ?>
583
- <?php
584
- printf(
585
- '<li><a href="#" class="mi-settings-nav-tab" data-type="menu-icons-settings-extensions">%s</a></li>',
586
- esc_html__( 'Extensions', 'menu-icons' )
587
- );
588
- ?>
589
- </ul>
590
- <?php foreach ( self::_get_fields() as $section_index => $section ) : ?>
591
- <div id="menu-icons-settings-<?php echo esc_attr( $section['id'] ) ?>" class="tabs-panel _<?php echo esc_attr( $section_index ) ?>">
592
- <h4 class="hide-if-js"><?php echo esc_html( $section['title'] ) ?></h4>
593
- <?php foreach ( $section['fields'] as $field ) : ?>
594
- <div class="_field">
595
- <?php
596
- printf(
597
- '<label for="%s" class="_main">%s</label>',
598
- esc_attr( $field->id ),
599
- esc_html( $field->label )
600
- );
601
- ?>
602
- <?php $field->render() ?>
603
- </div>
604
- <?php endforeach; ?>
605
- </div>
606
- <?php endforeach; ?>
607
- <div id="menu-icons-settings-extensions" class="tabs-panel _extensions">
608
- <h4 class="hide-if-js"><?php echo esc_html__( 'Extensions', 'menu-icons' ) ?></h4>
609
- <ul>
610
- <li><a target="_blank" href="http://wordpress.org/plugins/menu-icons-icomoon/">IcoMoon</a></li>
611
- </ul>
612
- </div>
613
- </div>
614
- <p class="submitbox button-controls">
615
- <?php wp_nonce_field( self::UPDATE_KEY, self::UPDATE_KEY ) ?>
616
- <span class="list-controls">
617
- <?php
618
- printf(
619
- '<a href="%s" title="%s" class="select-all submitdelete">%s</a>',
620
- esc_url(
621
- wp_nonce_url(
622
- admin_url( '/nav-menus.php' ),
623
- self::RESET_KEY,
624
- self::RESET_KEY
625
- )
626
- ),
627
- esc_attr__( 'Discard all changes and reset to default state', 'menu-icons' ),
628
- esc_html__( 'Reset', 'menu-icons' )
629
- );
630
- ?>
631
- </span>
632
-
633
- <span class="add-to-menu">
634
- <span class="spinner"></span>
635
- <?php
636
- submit_button(
637
- __( 'Save Settings', 'menu-icons' ),
638
- 'secondary',
639
- 'menu-icons-settings-save',
640
- false
641
- );
642
- ?>
643
- </span>
644
- </p>
645
- <?php
646
- }
647
-
648
-
649
/**
650
* Enqueue scripts & styles for Appearance > Menus page
651
*
@@ -689,8 +684,85 @@ final class Menu_Icons_Settings {
689
* Allow plugins/themes to filter the settings' JS data
690
*
691
* @since 0.9.0
692
* @param array $js_data JS Data.
693
*/
694
$js_data = apply_filters(
695
'menu_icons_settings_js_data',
696
array(
@@ -702,13 +774,14 @@ final class Menu_Icons_Settings {
702
'all' => __( 'All', 'menu-icons' ),
703
'preview' => __( 'Preview', 'menu-icons' ),
704
'settingsInfo' => sprintf(
705
- esc_html__( 'Please note that the actual look of the icons on the front-end will also be affected by the style of your active theme. You can add your own CSS using %1$s or a plugin such as %2$s if you need to override it.', 'menu-icons' ),
706
sprintf(
707
'<a href="%s">%s</a>',
708
esc_url( $customizer_url ),
709
esc_html__( 'the customizer', 'menu-icons' )
710
),
711
- '<a target="_blank" href="https://wordpress.org/plugins/advanced-css-editor/">Advanced CSS Editor</a>'
712
),
713
),
714
'settingsFields' => self::get_settings_fields(),
4
* Settings
5
*
6
* @package Menu_Icons
7
+ * @author Dzikri Aziz <kvcrvt@gmail.com>
8
*/
9
10
/**
21
/**
22
* Default setting values
23
*
24
+ * @since 0.3.0
25
* @var array
26
* @access protected
27
*/
34
/**
35
* Setting values
36
*
37
+ * @since 0.3.0
38
* @var array
39
* @access protected
40
*/
49
*/
50
protected static $script_deps = array( 'jquery' );
51
52
/**
53
* Settings init
54
*
59
* Allow themes/plugins to override the default settings
60
*
61
* @since 0.9.0
62
+ *
63
* @param array $default_settings Default settings.
64
*/
65
self::$defaults = apply_filters( 'menu_icons_settings_defaults', self::$defaults );
69
foreach ( self::$settings as $key => &$value ) {
70
if ( 'global' === $key ) {
71
// Remove unregistered icon types.
72
+ $value['icon_types'] = array_values(
73
+ array_intersect(
74
+ array_keys( Menu_Icons::get( 'types' ) ),
75
+ array_filter( (array) $value['icon_types'] )
76
+ )
77
+ );
78
} else {
79
// Backward-compatibility.
80
if ( isset( $value['width'] ) && ! isset( $value['svg_width'] ) ) {
91
* Allow themes/plugins to override the settings
92
*
93
* @since 0.9.0
94
+ *
95
* @param array $settings Menu Icons settings.
96
*/
97
self::$settings = apply_filters( 'menu_icons_settings', self::$settings );
110
add_action( 'wp_ajax_menu_icons_update_settings', array( __CLASS__, '_ajax_menu_icons_update_settings' ) );
111
}
112
113
+ /**
114
+ * Check if menu icons is disabled for a menu
115
+ *
116
+ * @since 0.8.0
117
+ *
118
+ * @param int $menu_id Menu ID. Defaults to current menu being edited.
119
+ *
120
+ * @return bool
121
+ */
122
+ public static function is_menu_icons_disabled_for_menu( $menu_id = 0 ) {
123
+ if ( empty( $menu_id ) ) {
124
+ $menu_id = self::get_current_menu_id();
125
+ }
126
+
127
+ // When we're creating a new menu or the recently edited menu
128
+ // could not be found.
129
+ if ( empty( $menu_id ) ) {
130
+ return true;
131
+ }
132
+
133
+ $menu_settings = self::get_menu_settings( $menu_id );
134
+ $is_disabled = ! empty( $menu_settings['disabled'] );
135
+
136
+ return $is_disabled;
137
+ }
138
+
139
+ /**
140
+ * Get ID of menu being edited
141
+ *
142
+ * @since 0.7.0
143
+ * @since 0.8.0 Get the recently edited menu from user option.
144
+ *
145
+ * @return int
146
+ */
147
+ public static function get_current_menu_id() {
148
+ global $nav_menu_selected_id;
149
+
150
+ if ( ! empty( $nav_menu_selected_id ) ) {
151
+ return $nav_menu_selected_id;
152
+ }
153
+
154
+ if ( is_admin() && isset( $_REQUEST['menu'] ) ) {
155
+ $menu_id = absint( $_REQUEST['menu'] );
156
+ } else {
157
+ $menu_id = absint( get_user_option( 'nav_menu_recently_edited' ) );
158
+ }
159
+
160
+ return $menu_id;
161
+ }
162
+
163
+ /**
164
+ * Get menu settings
165
+ *
166
+ * @since 0.3.0
167
+ *
168
+ * @param int $menu_id
169
+ *
170
+ * @return array
171
+ */
172
+ public static function get_menu_settings( $menu_id ) {
173
+ $menu_settings = self::get( sprintf( 'menu_%d', $menu_id ) );
174
+ $menu_settings = apply_filters( 'menu_icons_menu_settings', $menu_settings, $menu_id );
175
+
176
+ if ( ! is_array( $menu_settings ) ) {
177
+ $menu_settings = array();
178
+ }
179
+
180
+ return $menu_settings;
181
+ }
182
+
183
+ /**
184
+ * Get setting value
185
+ *
186
+ * @since 0.3.0
187
+ * @return mixed
188
+ */
189
+ public static function get() {
190
+ $args = func_get_args();
191
+
192
+ return kucrut_get_array_value_deep( self::$settings, $args );
193
+ }
194
195
/**
196
* Prepare wp-admin/nav-menus.php page
205
* Allow settings meta box to be disabled.
206
*
207
* @since 0.4.0
208
+ *
209
* @param bool $disabled Defaults to FALSE.
210
*/
211
$settings_disabled = apply_filters( 'menu_icons_disable_settings', false );
219
add_action( 'admin_notices', array( __CLASS__, '_admin_notices' ) );
220
}
221
222
/**
223
* Update settings
224
*
236
}
237
}
238
239
/**
240
* Update settings
241
*
242
* @since 0.7.0
243
* @access protected
244
+ *
245
+ * @param array $values Settings values.
246
+ *
247
* @return string Redirect URL.
248
*/
249
protected static function _update_settings( $values ) {
264
return $redirect_url;
265
}
266
267
/**
268
* Reset settings
269
*
283
return $redirect_url;
284
}
285
286
+ /**
287
+ * Settings meta box
288
+ *
289
+ * @since 0.3.0
290
+ * @access private
291
+ */
292
+ private static function _add_settings_meta_box() {
293
+ add_meta_box(
294
+ 'menu-icons-settings',
295
+ __( 'Menu Icons Settings', 'menu-icons' ),
296
+ array( __CLASS__, '_meta_box' ),
297
+ 'nav-menus',
298
+ 'side',
299
+ 'low',
300
+ array()
301
+ );
302
+ }
303
304
/**
305
* Update settings via ajax
318
wp_send_json_success( array( 'redirectUrl' => $redirect_url ) );
319
}
320
321
/**
322
* Print admin notices
323
*
342
delete_transient( self::TRANSIENT_KEY );
343
}
344
345
/**
346
* Settings meta box
347
*
348
+ * @since 0.3.0
349
*/
350
+ public static function _meta_box() {
351
+ ?>
352
+ <div class="taxonomydiv">
353
+ <ul id="menu-icons-settings-tabs" class="taxonomy-tabs add-menu-item-tabs hide-if-no-js">
354
+ <?php foreach ( self::get_fields() as $section ) : ?>
355
+ <?php
356
+ printf(
357
+ '<li><a href="#" title="%s" class="mi-settings-nav-tab" data-type="menu-icons-settings-%s">%s</a></li>',
358
+ esc_attr( $section['description'] ),
359
+ esc_attr( $section['id'] ),
360
+ esc_html( $section['title'] )
361
+ );
362
+ ?>
363
+ <?php endforeach; ?>
364
+ <?php
365
+ printf(
366
+ '<li><a href="#" class="mi-settings-nav-tab" data-type="menu-icons-settings-extensions">%s</a></li>',
367
+ esc_html__( 'Extensions', 'menu-icons' )
368
+ );
369
+ ?>
370
+ </ul>
371
+ <?php foreach ( self::_get_fields() as $section_index => $section ) : ?>
372
+ <div id="menu-icons-settings-<?php echo esc_attr( $section['id'] ) ?>"
373
+ class="tabs-panel _<?php echo esc_attr( $section_index ) ?>">
374
+ <h4 class="hide-if-js"><?php echo esc_html( $section['title'] ) ?></h4>
375
+ <?php foreach ( $section['fields'] as $field ) : ?>
376
+ <div class="_field">
377
+ <?php
378
+ printf(
379
+ '<label for="%s" class="_main">%s</label>',
380
+ esc_attr( $field->id ),
381
+ esc_html( $field->label )
382
+ );
383
+ ?>
384
+ <?php $field->render() ?>
385
+ </div>
386
+ <?php endforeach; ?>
387
+ </div>
388
+ <?php endforeach; ?>
389
+ <div id="menu-icons-settings-extensions" class="tabs-panel _extensions">
390
+ <h4 class="hide-if-js"><?php echo esc_html__( 'Extensions', 'menu-icons' ) ?></h4>
391
+ <ul>
392
+ <li><a target="_blank" href="http://wordpress.org/plugins/menu-icons-icomoon/">IcoMoon</a></li>
393
+ </ul>
394
+ </div>
395
+ </div>
396
+ <p class="submitbox button-controls">
397
+ <?php wp_nonce_field( self::UPDATE_KEY, self::UPDATE_KEY ) ?>
398
+ <span class="list-controls">
399
+ <?php
400
+ printf(
401
+ '<a href="%s" title="%s" class="select-all submitdelete">%s</a>',
402
+ esc_url(
403
+ wp_nonce_url(
404
+ admin_url( '/nav-menus.php' ),
405
+ self::RESET_KEY,
406
+ self::RESET_KEY
407
+ )
408
+ ),
409
+ esc_attr__( 'Discard all changes and reset to default state', 'menu-icons' ),
410
+ esc_html__( 'Reset', 'menu-icons' )
411
+ );
412
+ ?>
413
+ </span>
414
415
+ <span class="add-to-menu">
416
+ <span class="spinner"></span>
417
+ <?php
418
+ submit_button(
419
+ __( 'Save Settings', 'menu-icons' ),
420
+ 'secondary',
421
+ 'menu-icons-settings-save',
422
+ false
423
+ );
424
+ ?>
425
+ </span>
426
+ </p>
427
+ <?php
428
+ }
429
430
/**
431
+ * Get settings sections
432
*
433
+ * @since 0.3.0
434
+ * @uses apply_filters() Calls 'menu_icons_settings_sections'.
435
+ * @return array
436
*/
437
+ public static function get_fields() {
438
+ $menu_id = self::get_current_menu_id();
439
+ $icon_types = wp_list_pluck( Menu_Icons::get( 'types' ), 'name' );
440
441
+ asort( $icon_types );
442
443
+ $sections = array(
444
+ 'global' => array(
445
+ 'id' => 'global',
446
+ 'title' => __( 'Global', 'menu-icons' ),
447
+ 'description' => __( 'Global settings', 'menu-icons' ),
448
+ 'fields' => array(
449
+ array(
450
+ 'id' => 'icon_types',
451
+ 'type' => 'checkbox',
452
+ 'label' => __( 'Icon Types', 'menu-icons' ),
453
+ 'choices' => $icon_types,
454
+ 'value' => self::get( 'global', 'icon_types' ),
455
+ ),
456
+ ),
457
+ 'args' => array(),
458
+ ),
459
+ );
460
+
461
+ if ( ! empty( $menu_id ) ) {
462
+ $menu_term = get_term( $menu_id, 'nav_menu' );
463
+ $menu_key = sprintf( 'menu_%d', $menu_id );
464
+ $menu_settings = self::get_menu_settings( $menu_id );
465
+
466
+ $sections['menu'] = array(
467
+ 'id' => $menu_key,
468
+ 'title' => __( 'Current Menu', 'menu-icons' ),
469
+ 'description' => sprintf(
470
+ __( '"%s" menu settings', 'menu-icons' ),
471
+ apply_filters( 'single_term_title', $menu_term->name )
472
+ ),
473
+ 'fields' => self::get_settings_fields( $menu_settings ),
474
+ 'args' => array( 'inline_description' => true ),
475
+ );
476
}
477
478
+ return apply_filters( 'menu_icons_settings_sections', $sections, $menu_id );
479
}
480
481
/**
482
* Get settings fields
483
*
484
* @since 0.4.0
485
+ *
486
+ * @param array $values Values to be applied to each field.
487
+ *
488
* @uses apply_filters() Calls 'menu_icons_settings_fields'.
489
* @return array
490
*/
491
public static function get_settings_fields( array $values = array() ) {
492
$fields = array(
493
+ 'hide_label' => array(
494
'id' => 'hide_label',
495
'type' => 'select',
496
'label' => __( 'Hide Label', 'menu-icons' ),
506
),
507
),
508
),
509
+ 'position' => array(
510
'id' => 'position',
511
'type' => 'select',
512
'label' => __( 'Position', 'menu-icons' ),
562
),
563
),
564
),
565
+ 'font_size' => array(
566
'id' => 'font_size',
567
'type' => 'number',
568
'label' => __( 'Font Size', 'menu-icons' ),
573
'step' => '0.1',
574
),
575
),
576
+ 'svg_width' => array(
577
'id' => 'svg_width',
578
'type' => 'number',
579
'label' => __( 'SVG Width', 'menu-icons' ),
584
'step' => '.1',
585
),
586
),
587
+ 'image_size' => array(
588
'id' => 'image_size',
589
'type' => 'select',
590
'label' => __( 'Image Size', 'menu-icons' ),
610
return $fields;
611
}
612
613
/**
614
* Get processed settings fields
615
*
641
return $sections;
642
}
643
644
/**
645
* Enqueue scripts & styles for Appearance > Menus page
646
*
684
* Allow plugins/themes to filter the settings' JS data
685
*
686
* @since 0.9.0
687
+ *
688
* @param array $js_data JS Data.
689
*/
690
+ $menu_current_theme = '';
691
+ $theme = wp_get_theme();
692
+ if ( ! empty( $theme ) ) {
693
+ if ( is_child_theme() ) {
694
+ $menu_current_theme = $theme->parent()->get( 'Name' );
695
+ } else {
696
+ $menu_current_theme = $theme->get( 'Name' );
697
+ }
698
+ }
699
+ $box_data = '<div id="menu-icons-sidebar">';
700
+ if ( ( $menu_current_theme != 'Hestia' ) && ( $menu_current_theme != 'Hestia Pro' ) ) {
701
+
702
+ $menu_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>';
703
+
704
+ if ( $menu_current_theme == 'Zerif Lite' ) {
705
+ $menu_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>, your Zerif Lite content will be imported automatically! ';
706
+ }
707
+
708
+ $menu_upgrade_hestia_url = add_query_arg(
709
+ array(
710
+ 'theme' => 'hestia',
711
+ ), admin_url( 'theme-install.php' )
712
+ );
713
+ $box_data .= '<div class="menu-icons-upgrade-hestia postbox new-card">';
714
+ $box_data .= '<p>' . wp_kses_post( $menu_upgrade_hestia_box_text ) . '</p>';
715
+ $box_data .= '<a class="button" href="' . $menu_upgrade_hestia_url . '" target="_blank">Preview Hestia</a>';
716
+ $box_data .= '</div>';
717
+ }
718
+
719
+ if ( ! empty( $_POST['menu_icons_mail'] ) ) {
720
+ require( plugin_dir_path( __DIR__ ) . 'mailin.php' );
721
+ $user_info = get_userdata( 1 );
722
+ $mailin = new Mailin( 'https://api.sendinblue.com/v2.0', 'cHW5sxZnzE7mhaYb' );
723
+ $data = array(
724
+ 'email' => $_POST['menu_icons_mail'],
725
+ 'attributes' => array(
726
+ 'NAME' => $user_info->first_name,
727
+ 'SURNAME' => $user_info->last_name,
728
+ ),
729
+ 'blacklisted' => 0,
730
+ 'listid' => array( 145 ),
731
+ 'blacklisted_sms' => 0,
732
+ );
733
+ $status = $mailin->create_update_user( $data );
734
+ if ( $status['code'] == 'success' ) {
735
+ update_option( 'menu_icons_subscribe', true );
736
+ }
737
+ }
738
+ $email_output = '<div id="formdata"><p>' . esc_html__( 'Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'menu-icons' ) . ' </p><form class="menu-icons-submit-mail" method="post"><input name="menu_icons_mail" type="email" value="' . get_option( 'admin_email' ) . '" /><input id="ebutton" class="button" type="submit" value="Submit"></form></div>';
739
+ $email_output .= '<p id="success">' . esc_html__( 'Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the "Unsubscribe" link included in each newsletter.', 'menu-icons' ) . '</p>';
740
+ $email_output .= '<p id="failiure">' . esc_html__( 'Unable to Subscribe.', 'menu-icons' ) . '</p>';
741
+ $box_data .= '<div class="menu-icons-subscribe postbox new-card">';
742
+ $box_data .= '<h3 class="title">' . esc_html__( 'Get Our Free Email Course', 'menu-icons' ) . '</h3>';
743
+ $box_data .= $email_output;
744
+ $box_data .= '</div>';
745
+ $box_data .= '</div>';
746
+ $box_data .= '<script>';
747
+ $box_data .= '$( \'#failiure\' ).hide();';
748
+ $box_data .= '$( \'#success\' ).hide();';
749
+ $box_data .= '$( \'form.menu-icons-submit-mail\' ).submit(function(event) {';
750
+ $box_data .= 'event.preventDefault();';
751
+ $box_data .= '$.ajax({';
752
+ $box_data .= 'type: \'POST\',';
753
+ $box_data .= 'data: $( \'form.menu-icons-submit-mail\' ).serialize(),';
754
+ $box_data .= 'success: function(result) {';
755
+ $box_data .= '$( \'#formdata\' ).hide();';
756
+ $box_data .= '$( \'#success\' ).show();';
757
+ $box_data .= '},';
758
+ $box_data .= 'error: function(result) { $( \'#failiure\' ).show(); }';
759
+ $box_data .= '}); });';
760
+ $box_data .= '</script>';
761
+ $shown = (bool) get_option( 'menu_icons_subscribe', false );
762
+
763
+ if ( $shown === true ) {
764
+ $box_data = '';
765
+ }
766
$js_data = apply_filters(
767
'menu_icons_settings_js_data',
768
array(
774
'all' => __( 'All', 'menu-icons' ),
775
'preview' => __( 'Preview', 'menu-icons' ),
776
'settingsInfo' => sprintf(
777
+ '<p>' . esc_html__( 'Please note that the actual look of the icons on the front-end will also be affected by the style of your active theme. You can add your own CSS using %1$s or a plugin such as %2$s if you need to override it. %3$s', 'menu-icons' ) . '</p>',
778
sprintf(
779
'<a href="%s">%s</a>',
780
esc_url( $customizer_url ),
781
esc_html__( 'the customizer', 'menu-icons' )
782
),
783
+ '<a target="_blank" href="https://wordpress.org/plugins/advanced-css-editor/">Advanced CSS Editor</a>',
784
+ $box_data
785
),
786
),
787
'settingsFields' => self::get_settings_fields(),
js/admin.js CHANGED
@@ -595,7 +595,7 @@ var MenuIconsSidebar = wp.media.view.IconPickerSidebar.extend({
595
});
596
597
var info = new wp.media.View({
598
- tagName: 'p',
599
className: '_info',
600
priority: 1000
601
});
595
});
596
597
var info = new wp.media.View({
598
+ tagName: 'div',
599
className: '_info',
600
priority: 1000
601
});
js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(a){a("#menu-icons-settings-tabs").on("click","a.mi-settings-nav-tab",function(b){var c=a(this).blur(),d=a("#"+c.data("type"));b.preventDefault(),b.stopPropagation(),c.parent().addClass("tabs").siblings().removeClass("tabs"),d.removeClass("tabs-panel-inactive").addClass("tabs-panel-active").show().siblings("div.tabs-panel").hide().addClass("tabs-panel-inactive").removeClass("tabs-panel-active")}).find("a.mi-settings-nav-tab").first().click(),a("#menu-icons-settings-save").on("click",function(b){var c=a(this).prop("disabled",!0),d=c.siblings("span.spinner");b.preventDefault(),b.stopPropagation(),d.css({display:"inline-block",visibility:"visible"}),a.ajax({type:"POST",url:menuIcons.ajaxUrls.update,data:a("#menu-icons-settings :input").serialize(),success:function(a){!0===a.success&&a.data.redirectUrl?window.location=a.data.redirectUrl:c.prop("disabled",!1)},always:function(){d.hide()}})})}(jQuery),function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){wp.media.model.MenuIconsItemSettingField=a("./models/item-setting-field.js"),wp.media.model.MenuIconsItemSettings=a("./models/item-settings.js"),wp.media.model.MenuIconsItem=a("./models/item.js"),wp.media.view.MenuIconsItemSettingField=a("./views/item-setting-field.js"),wp.media.view.MenuIconsItemSettings=a("./views/item-settings.js"),wp.media.view.MenuIconsItemPreview=a("./views/item-preview.js"),wp.media.view.MenuIconsSidebar=a("./views/sidebar.js"),wp.media.view.MediaFrame.MenuIcons=a("./views/frame.js")},{"./models/item-setting-field.js":2,"./models/item-settings.js":3,"./models/item.js":4,"./views/frame.js":5,"./views/item-preview.js":6,"./views/item-setting-field.js":7,"./views/item-settings.js":8,"./views/sidebar.js":9}],2:[function(a,b,c){var d=Backbone.Model.extend({defaults:{id:"",label:"",value:"",type:"text"}});b.exports=d},{}],3:[function(a,b,c){var d=Backbone.Collection.extend({model:wp.media.model.MenuIconsItemSettingField});b.exports=d},{}],4:[function(a,b,c){var d=Backbone.Model.extend({initialize:function(){this.on("change",this.updateValues,this)},updateValues:function(){_.each(this.get("$inputs"),function(a,b){a.val(this.get(b))},this),this.get("$el").trigger("mi:update")}});b.exports=d},{}],5:[function(a,b,c){var d=wp.media.view.MediaFrame.IconPicker.extend({initialize:function(){this.menuItems=new Backbone.Collection([],{model:wp.media.model.MenuIconsItem}),wp.media.view.MediaFrame.IconPicker.prototype.initialize.apply(this,arguments),this.listenTo(this.target,"change",this.miUpdateItemProps),this.on("select",this.miClearTarget,this)},miUpdateItemProps:function(a){var b=this.menuItems.get(a.id);b.set(a.changed)},miClearTarget:function(){this.target.clear({silent:!0})}});b.exports=d},{}],6:[function(a,b,c){var d=wp.media.View.extend({tagName:"p",className:"mi-preview menu-item attachment-info",events:{"click a":"preventDefault"},initialize:function(){wp.media.View.prototype.initialize.apply(this,arguments),this.model.on("change",this.render,this)},render:function(){var a=this.controller,b=a.state(),c=b.get("selection").single(),d=this.model.toJSON(),e=_.extend(d,{type:b.id,icon:c.id,title:this.model.get("$title").val(),url:b.ipGetIconUrl(c,d.image_size)}),f="menu-icons-item-sidebar-preview-"+iconPicker.types[b.id].templateId+"-";return f+=e.hide_label?"hide_label":e.position,this.template=wp.media.template(f),this.$el.html(this.template(e)),this},preventDefault:function(a){a.preventDefault()}});b.exports=d},{}],7:[function(a,b,c){var d,e=jQuery;d=wp.media.View.extend({tagName:"label",className:"setting",events:{"change :input":"_update"},initialize:function(){wp.media.View.prototype.initialize.apply(this,arguments),this.template=wp.media.template("menu-icons-settings-field-"+this.model.get("type")),this.model.on("change",this.render,this)},prepare:function(){return this.model.toJSON()},_update:function(a){var b=e(a.currentTarget).val();this.model.set("value",b),this.options.item.set(this.model.id,b)}}),b.exports=d},{}],8:[function(a,b,c){var d=wp.media.view.PriorityList.extend({className:"mi-settings attachment-info",prepare:function(){_.each(this.collection.map(this.createField,this),function(a){this.set(a.model.id,a)},this)},createField:function(a){var b=new wp.media.view.MenuIconsItemSettingField({item:this.model,model:a,collection:this.collection});return b}});b.exports=d},{}],9:[function(a,b,c){var d=wp.media.view.IconPickerSidebar.extend({initialize:function(){var a=new wp.media.View({tagName:"h3",priority:-10}),b=new wp.media.View({tagName:"p",className:"_info",priority:1e3});wp.media.view.IconPickerSidebar.prototype.initialize.apply(this,arguments),a.$el.text(menuIcons.text.preview),this.set("title",a),b.$el.html(menuIcons.text.settingsInfo),this.set("info",b)},createSingle:function(){this.createPreview(),this.createSettings()},disposeSingle:function(){this.unset("preview"),this.unset("settings")},createPreview:function(){var a=this,b=a.controller,c=b.state();return c.dfd&&"pending"===c.dfd.state()?void c.dfd.done(function(){a.createPreview()}):void a.set("preview",new wp.media.view.MenuIconsItemPreview({controller:b,model:b.target,priority:80}))},createSettings:function(){var a=this.controller,b=a.state(),c=b.get("data").settingsFields,d=[];_.each(c,function(b){var c,e=menuIcons.settingsFields[b];e&&(c=_.defaults({value:a.target.get(b)||e["default"]},e),d.push(c))}),d.length&&this.set("settings",new wp.media.view.MenuIconsItemSettings({controller:this.controller,collection:new wp.media.model.MenuIconsItemSettings(d),model:a.target,type:this.options.type,priority:120}))}});b.exports=d},{}]},{},[1]),function(a){"use strict";var b;menuIcons.activeTypes&&!_.isEmpty(menuIcons.activeTypes)&&(b={templates:{},wrapClass:"div.menu-icons-wrap",frame:null,target:new wp.media.model.IconPickerTarget,typesFilter:function(b){return-1<a.inArray(b.id,menuIcons.activeTypes)},createFrame:function(){b.frame=new wp.media.view.MediaFrame.MenuIcons({target:b.target,ipTypes:_.filter(iconPicker.types,b.typesFilter),SidebarView:wp.media.view.MenuIconsSidebar})},pickIcon:function(a){b.frame.target.set(a,{silent:!0}),b.frame.open()},setUnset:function(c){var d=a(c.currentTarget),e=a(c.target);c.preventDefault(),e.hasClass("_select")||e.hasClass("_icon")?b.setIcon(d):e.hasClass("_remove")&&b.unsetIcon(d)},setIcon:function(c){var d=c.data("id"),e=b.frame,f=e.menuItems,g=f.get(d);return g?void b.pickIcon(g.toJSON()):(g={id:d,$el:c,$title:a("#edit-menu-item-title-"+d),$inputs:{}},c.find("div._settings input").each(function(){var b=a(this),c=b.attr("class").replace("_mi-",""),d=b.val();d||(_.has(menuIcons.menuSettings,c)?d=menuIcons.menuSettings[c]:_.has(menuIcons.settingsFields,c)&&(d=menuIcons.settingsFields[c]["default"])),g[c]=d,g.$inputs[c]=b}),f.add(g),void b.pickIcon(g))},unsetIcon:function(a){var c=a.data("id");a.find("div._settings input").val(""),a.trigger("mi:update"),b.frame.menuItems.remove(c)},updateField:function(c){var d,e=a(c.currentTarget),f=e.find("a._select"),g=e.find("a._remove"),h=e.find("input._mi-type").val(),i=e.find("input._mi-icon").val(),j=e.find("input._mi-url").val();return""===h||""===i||0>_.indexOf(menuIcons.activeTypes,h)?(f.text(menuIcons.text.select).attr("title",""),void g.addClass("hidden")):(d=b.templates[h]?b.templates[h]:b.templates[h]=wp.template("menu-icons-item-field-preview-"+iconPicker.types[h].templateId),g.removeClass("hidden"),f.attr("title",menuIcons.text.change),void f.html(d({type:h,icon:i,url:j})))},init:function(){b.createFrame(),a(document).on("click",b.wrapClass,b.setUnset).on("mi:update",b.wrapClass,b.updateField),a(b.wrapClass).trigger("mi:update")}},b.init())}(jQuery);
1
+ !function(a){a("#menu-icons-settings-tabs").on("click","a.mi-settings-nav-tab",function(b){var c=a(this).blur(),d=a("#"+c.data("type"));b.preventDefault(),b.stopPropagation(),c.parent().addClass("tabs").siblings().removeClass("tabs"),d.removeClass("tabs-panel-inactive").addClass("tabs-panel-active").show().siblings("div.tabs-panel").hide().addClass("tabs-panel-inactive").removeClass("tabs-panel-active")}).find("a.mi-settings-nav-tab").first().click(),a("#menu-icons-settings-save").on("click",function(b){var c=a(this).prop("disabled",!0),d=c.siblings("span.spinner");b.preventDefault(),b.stopPropagation(),d.css({display:"inline-block",visibility:"visible"}),a.ajax({type:"POST",url:menuIcons.ajaxUrls.update,data:a("#menu-icons-settings :input").serialize(),success:function(a){!0===a.success&&a.data.redirectUrl?window.location=a.data.redirectUrl:c.prop("disabled",!1)},always:function(){d.hide()}})})}(jQuery),function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){wp.media.model.MenuIconsItemSettingField=a("./models/item-setting-field.js"),wp.media.model.MenuIconsItemSettings=a("./models/item-settings.js"),wp.media.model.MenuIconsItem=a("./models/item.js"),wp.media.view.MenuIconsItemSettingField=a("./views/item-setting-field.js"),wp.media.view.MenuIconsItemSettings=a("./views/item-settings.js"),wp.media.view.MenuIconsItemPreview=a("./views/item-preview.js"),wp.media.view.MenuIconsSidebar=a("./views/sidebar.js"),wp.media.view.MediaFrame.MenuIcons=a("./views/frame.js")},{"./models/item-setting-field.js":2,"./models/item-settings.js":3,"./models/item.js":4,"./views/frame.js":5,"./views/item-preview.js":6,"./views/item-setting-field.js":7,"./views/item-settings.js":8,"./views/sidebar.js":9}],2:[function(a,b,c){var d=Backbone.Model.extend({defaults:{id:"",label:"",value:"",type:"text"}});b.exports=d},{}],3:[function(a,b,c){var d=Backbone.Collection.extend({model:wp.media.model.MenuIconsItemSettingField});b.exports=d},{}],4:[function(a,b,c){var d=Backbone.Model.extend({initialize:function(){this.on("change",this.updateValues,this)},updateValues:function(){_.each(this.get("$inputs"),function(a,b){a.val(this.get(b))},this),this.get("$el").trigger("mi:update")}});b.exports=d},{}],5:[function(a,b,c){var d=wp.media.view.MediaFrame.IconPicker.extend({initialize:function(){this.menuItems=new Backbone.Collection([],{model:wp.media.model.MenuIconsItem}),wp.media.view.MediaFrame.IconPicker.prototype.initialize.apply(this,arguments),this.listenTo(this.target,"change",this.miUpdateItemProps),this.on("select",this.miClearTarget,this)},miUpdateItemProps:function(a){var b=this.menuItems.get(a.id);b.set(a.changed)},miClearTarget:function(){this.target.clear({silent:!0})}});b.exports=d},{}],6:[function(a,b,c){var d=wp.media.View.extend({tagName:"p",className:"mi-preview menu-item attachment-info",events:{"click a":"preventDefault"},initialize:function(){wp.media.View.prototype.initialize.apply(this,arguments),this.model.on("change",this.render,this)},render:function(){var a=this.controller,b=a.state(),c=b.get("selection").single(),d=this.model.toJSON(),e=_.extend(d,{type:b.id,icon:c.id,title:this.model.get("$title").val(),url:b.ipGetIconUrl(c,d.image_size)}),f="menu-icons-item-sidebar-preview-"+iconPicker.types[b.id].templateId+"-";return f+=e.hide_label?"hide_label":e.position,this.template=wp.media.template(f),this.$el.html(this.template(e)),this},preventDefault:function(a){a.preventDefault()}});b.exports=d},{}],7:[function(a,b,c){var d,e=jQuery;d=wp.media.View.extend({tagName:"label",className:"setting",events:{"change :input":"_update"},initialize:function(){wp.media.View.prototype.initialize.apply(this,arguments),this.template=wp.media.template("menu-icons-settings-field-"+this.model.get("type")),this.model.on("change",this.render,this)},prepare:function(){return this.model.toJSON()},_update:function(a){var b=e(a.currentTarget).val();this.model.set("value",b),this.options.item.set(this.model.id,b)}}),b.exports=d},{}],8:[function(a,b,c){var d=wp.media.view.PriorityList.extend({className:"mi-settings attachment-info",prepare:function(){_.each(this.collection.map(this.createField,this),function(a){this.set(a.model.id,a)},this)},createField:function(a){var b=new wp.media.view.MenuIconsItemSettingField({item:this.model,model:a,collection:this.collection});return b}});b.exports=d},{}],9:[function(a,b,c){var d=wp.media.view.IconPickerSidebar.extend({initialize:function(){var a=new wp.media.View({tagName:"h3",priority:-10}),b=new wp.media.View({tagName:"div",className:"_info",priority:1e3});wp.media.view.IconPickerSidebar.prototype.initialize.apply(this,arguments),a.$el.text(menuIcons.text.preview),this.set("title",a),b.$el.html(menuIcons.text.settingsInfo),this.set("info",b)},createSingle:function(){this.createPreview(),this.createSettings()},disposeSingle:function(){this.unset("preview"),this.unset("settings")},createPreview:function(){var a=this,b=a.controller,c=b.state();return c.dfd&&"pending"===c.dfd.state()?void c.dfd.done(function(){a.createPreview()}):void a.set("preview",new wp.media.view.MenuIconsItemPreview({controller:b,model:b.target,priority:80}))},createSettings:function(){var a=this.controller,b=a.state(),c=b.get("data").settingsFields,d=[];_.each(c,function(b){var c,e=menuIcons.settingsFields[b];e&&(c=_.defaults({value:a.target.get(b)||e["default"]},e),d.push(c))}),d.length&&this.set("settings",new wp.media.view.MenuIconsItemSettings({controller:this.controller,collection:new wp.media.model.MenuIconsItemSettings(d),model:a.target,type:this.options.type,priority:120}))}});b.exports=d},{}]},{},[1]),function(a){"use strict";var b;menuIcons.activeTypes&&!_.isEmpty(menuIcons.activeTypes)&&(b={templates:{},wrapClass:"div.menu-icons-wrap",frame:null,target:new wp.media.model.IconPickerTarget,typesFilter:function(b){return-1<a.inArray(b.id,menuIcons.activeTypes)},createFrame:function(){b.frame=new wp.media.view.MediaFrame.MenuIcons({target:b.target,ipTypes:_.filter(iconPicker.types,b.typesFilter),SidebarView:wp.media.view.MenuIconsSidebar})},pickIcon:function(a){b.frame.target.set(a,{silent:!0}),b.frame.open()},setUnset:function(c){var d=a(c.currentTarget),e=a(c.target);c.preventDefault(),e.hasClass("_select")||e.hasClass("_icon")?b.setIcon(d):e.hasClass("_remove")&&b.unsetIcon(d)},setIcon:function(c){var d=c.data("id"),e=b.frame,f=e.menuItems,g=f.get(d);return g?void b.pickIcon(g.toJSON()):(g={id:d,$el:c,$title:a("#edit-menu-item-title-"+d),$inputs:{}},c.find("div._settings input").each(function(){var b=a(this),c=b.attr("class").replace("_mi-",""),d=b.val();d||(_.has(menuIcons.menuSettings,c)?d=menuIcons.menuSettings[c]:_.has(menuIcons.settingsFields,c)&&(d=menuIcons.settingsFields[c]["default"])),g[c]=d,g.$inputs[c]=b}),f.add(g),void b.pickIcon(g))},unsetIcon:function(a){var c=a.data("id");a.find("div._settings input").val(""),a.trigger("mi:update"),b.frame.menuItems.remove(c)},updateField:function(c){var d,e=a(c.currentTarget),f=e.find("a._select"),g=e.find("a._remove"),h=e.find("input._mi-type").val(),i=e.find("input._mi-icon").val(),j=e.find("input._mi-url").val();return""===h||""===i||0>_.indexOf(menuIcons.activeTypes,h)?(f.text(menuIcons.text.select).attr("title",""),void g.addClass("hidden")):(d=b.templates[h]?b.templates[h]:b.templates[h]=wp.template("menu-icons-item-field-preview-"+iconPicker.types[h].templateId),g.removeClass("hidden"),f.attr("title",menuIcons.text.change),void f.html(d({type:h,icon:i,url:j})))},init:function(){b.createFrame(),a(document).on("click",b.wrapClass,b.setUnset).on("mi:update",b.wrapClass,b.updateField),a(b.wrapClass).trigger("mi:update")}},b.init())}(jQuery);
mailin.php ADDED
@@ -0,0 +1,867 @@
1
+ <?php
2
+
3
+ /**
4
+ * SendinBlue REST client
5
+ */
6
+
7
+ class Mailin {
8
+
9
+ public $api_key;
10
+ public $base_url;
11
+ public $curl_opts = array();
12
+ public function __construct( $base_url, $api_key ) {
13
+ if ( ! function_exists( 'curl_init' ) ) {
14
+ throw new Exception( 'Mailin requires CURL module' );
15
+ }
16
+ $this->base_url = $base_url;
17
+ $this->api_key = $api_key;
18
+ }
19
+ /**
20
+ * Do CURL request with authorization
21
+ */
22
+ private function do_request( $resource, $method, $input ) {
23
+ $called_url = $this->base_url . '/' . $resource;
24
+ $ch = curl_init( $called_url );
25
+ $auth_header = 'api-key:' . $this->api_key;
26
+ $content_header = 'Content-Type:application/json';
27
+ if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
28
+ // Windows only over-ride
29
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
30
+ }
31
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, array($auth_header, $content_header) );
32
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
33
+ curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $method );
34
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
35
+ curl_setopt( $ch, CURLOPT_HEADER, 0 );
36
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $input );
37
+ $data = curl_exec( $ch );
38
+ if ( curl_errno( $ch ) ) {
39
+ echo 'Curl error: ' . curl_error( $ch ) . '\n';
40
+ }
41
+ curl_close( $ch );
42
+ return json_decode( $data, true );
43
+ }
44
+ public function get( $resource, $input ) {
45
+ return $this->do_request( $resource, 'GET', $input );
46
+ }
47
+ public function put( $resource, $input ) {
48
+ return $this->do_request( $resource, 'PUT', $input );
49
+ }
50
+ public function post( $resource, $input ) {
51
+ return $this->do_request( $resource, 'POST', $input );
52
+ }
53
+ public function delete( $resource, $input ) {
54
+ return $this->do_request( $resource, 'DELETE', $input );
55
+ }
56
+
57
+ /*
58
+ Get Account.
59
+ No input required
60
+ */
61
+ public function get_account() {
62
+ return $this->get( 'account', '' );
63
+ }
64
+
65
+ /*
66
+ Get SMTP details.
67
+ No input required
68
+ */
69
+ public function get_smtp_details() {
70
+ return $this->get( 'account/smtpdetail', '' );
71
+ }
72
+
73
+ /*
74
+ Create Child Account.
75
+ @param {Array} data contains php array with key value pair.
76
+ @options data {String} child_email: Email address of Reseller child [Mandatory]
77
+ @options data {String} password: Password of Reseller child to login [Mandatory]
78
+ @options data {String} company_org: Name of Reseller child’s company [Mandatory]
79
+ @options data {String} first_name: First name of Reseller child [Mandatory]
80
+ @options data {String} last_name: Last name of Reseller child [Mandatory]
81
+ @options data {Array} credits: Number of email & sms credits respectively, which will be assigned to the Reseller child’s account [Optional]
82
+ - email_credit {Integer} number of email credits
83
+ - sms_credit {Integer} Number of sms credts
84
+ @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
85
+ */
86
+ public function create_child_account( $data ) {
87
+ return $this->post( 'account', json_encode( $data ) );
88
+ }
89
+
90
+ /*
91
+ Update Child Account.
92
+ @param {Array} data contains php array with key value pair.
93
+ @options data {String} auth_key: 16 character authorization key of Reseller child to be modified [Mandatory]
94
+ @options data {String} company_org: Name of Reseller child’s company [Optional]
95
+ @options data {String} first_name: First name of Reseller child [Optional]
96
+ @options data {String} last_name: Last name of Reseller child [Optional]
97
+ @options data {String} password: Password of Reseller child to login [Optional]
98
+ @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
99
+ @options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can use commas to separate multiple IPs [Optional]
100
+ */
101
+ public function update_child_account( $data ) {
102
+ return $this->put( 'account', json_encode( $data ) );
103
+ }
104
+
105
+ /*
106
+ Delete Child Account.
107
+ @param {Array} data contains php array with key value pair.
108
+ @options data {String} auth_key: 16 character authorization key of Reseller child to be deleted [Mandatory]
109
+ */
110
+ public function delete_child_account( $data ) {
111
+ return $this->delete( 'account/' . $data['auth_key'], '' );
112
+ }
113
+
114
+ /*
115
+ Get Reseller child Account.
116
+ @param {Array} data contains php array with key value pair.
117
+ @options data {String} auth_key: 16 character authorization key of Reseller child. Example : To get the details of more than one child account, use, {"key1":"abC01De2fGHI3jkL","key2":"mnO45Pq6rSTU7vWX"} [Mandatory]
118
+ */
119
+ public function get_reseller_child( $data ) {
120
+ return $this->post( 'account/getchildv2', json_encode( $data ) );
121
+ }
122
+
123
+ /*
124
+ Add/Remove Reseller child's Email/Sms credits.
125
+ @param {Array} data contains php array with key value pair.
126
+ @options data {String} auth_key: 16 character authorization key of Reseller child to modify credits [Mandatory]
127
+ @options data {Array} add_credit: Number of email & sms credits to be added. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if rmv_credit is empty]
128
+ - email_credit {Integer} number of email credits
129
+ - sms_credit {Integer} Number of sms credts
130
+ @options data {Array} rmv_credit: Number of email & sms credits to be removed. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if add_credits is empty]
131
+ - email_credit {Integer} number of email credits
132
+ - sms_credit {Integer} Number of sms credts
133
+ */
134
+ public function add_remove_child_credits( $data ) {
135
+ return $this->post( 'account/addrmvcredit', json_encode( $data ) );
136
+ }
137
+
138
+ /*
139
+ Get a particular campaign detail.
140
+ @param {Array} data contains php array with key value pair.
141
+ @options data {Integer} id: Unique Id of the campaign [Mandatory]
142
+ */
143
+ public function get_campaign_v2( $data ) {
144
+ return $this->get( 'campaign/' . $data['id'] . '/detailsv2', '' );
145
+ }
146
+
147
+ /*
148
+ Get all campaigns detail.
149
+ @param {Array} data contains php array with key value pair.
150
+ @options data {String} type: Type of campaign. Possible values – classic, trigger, sms, template ( case sensitive ) [Optional]
151
+ @options data {String} status: Status of campaign. Possible values – draft, sent, archive, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional]
152
+ @options data {Integer} page: Maximum number of records per request is 500, if there are more than 500 campaigns then you can use this parameter to get next 500 results [Optional]
153
+ @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
154
+ */
155
+ public function get_campaigns_v2( $data ) {
156
+ return $this->get( 'campaign/detailsv2', json_encode( $data ) );
157
+ }
158
+
159
+ /*
160
+ Create and Schedule your campaigns. It returns the ID of the created campaign.
161
+ @param {Array} data contains php array with key value pair.
162
+ @options data {String} category: Tag name of the campaign [Optional]
163
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
164
+ @options data {String} name: Name of the campaign [Mandatory]
165
+ @options data {String} bat: Email address for test mail [Optional]
166
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
167
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
168
+ @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
169
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
170
+ @options data {String} subject: Subject of the campaign [Mandatory]
171
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
172
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
173
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM] To use the contact attributes here, these should already exist in SendinBlue account [Optional]
174
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
175
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
176
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
177
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
178
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
179
+
180
+ */
181
+ public function create_campaign( $data ) {
182
+ return $this->post( 'campaign', json_encode( $data ) );
183
+ }
184
+
185
+ /*
186
+ Update your campaign.
187
+ @param {Array} data contains php array with key value pair.
188
+ @options data {Integer} id: Id of campaign to be modified [Mandatory]
189
+ @options data {String} category: Tag name of the campaign [Optional]
190
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
191
+ @options data {String} name: Name of the campaign [Optional]
192
+ @options data {String} bat: Email address for test mail [Optional]
193
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Optional]
194
+ @options data {String} html_url: Url which content is the body of content [Optional]
195
+ @options data {Array} listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
196
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
197
+ @options data {String} subject: Subject of the campaign.
198
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
199
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
200
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
201
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
202
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
203
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
204
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
205
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
206
+ */
207
+ public function update_campaign( $data ) {
208
+ $id = $data['id'];
209
+ unset( $data['id'] );
210
+ return $this->put( 'campaign/' . $id, json_encode( $data ) );
211
+ }
212
+
213
+ /*
214
+ Delete your campaigns.
215
+ @param {Array} data contains php array with key value pair.
216
+ @options data {Integer} id: Id of campaign to be deleted [Mandatory]
217
+ */
218
+ public function delete_campaign( $data ) {
219
+ return $this->delete( 'campaign/' . $data['id'], '' );
220
+ }
221
+
222
+ /*
223
+ Send report of Sent and Archived campaign.
224
+ @param {Array} data contains php array with key value pair.
225
+ @options data {Integer} id: Id of campaign to send its report [Mandatory]
226
+ @options data {String} lang: Language of email content. Possible values – fr (default), en, es, it & pt [Optional]
227
+ @options data {String} email_subject: Message subject [Mandatory]
228
+ @options data {Array} email_to: Email address of the recipient(s). Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
229
+ @options data {String} email_content_type: Body of the message in text/HTML version. Possible values – text & html [Mandatory]
230
+ @options data {Array} email_bcc: Same as email_to but for Bcc [Optional]
231
+ @options data {Array} email_cc: Same as email_to but for Cc [Optional]
232
+ @options data {String} email_body: Body of the message [Mandatory]
233
+ */
234
+ public function campaign_report_email( $data ) {
235
+ $id = $data['id'];
236
+ unset( $data['id'] );
237
+ return $this->post( 'campaign/' . $id . '/report', json_encode( $data ) );
238
+ }
239
+
240
+ /*
241
+ Export the recipients of a specified campaign.
242
+ @param {Array} data contains php array with key value pair.
243
+ @options data {Integer} id: Id of campaign to export its recipients [Mandatory]
244
+ @options data {String} notify_url: URL that will be called once the export process is finished [Mandatory]
245
+ @options data {String} type: Type of recipients. Possible values – all, non_clicker, non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory]
246
+ */
247
+ public function campaign_recipients_export( $data ) {
248
+ $id = $data['id'];
249
+ unset( $data['id'] );
250
+ return $this->post( 'campaign/' . $id . '/recipients', json_encode( $data ) );
251
+ }
252
+
253
+ /*
254
+ Get the Campaign name, subject and share link of the classic type campaigns only which are sent, for those which are not sent and the rest of campaign types like trigger, template & sms, will return an error message of share link not available.
255
+ @param {Array} data contains php array with key value pair.
256
+ @options data {Array} camp_ids: Id of campaign to get share link. You can use commas to separate multiple ids [Mandatory]
257
+ */
258
+
259
+ public function share_campaign( $data ) {
260
+ return $this->post( 'campaign/sharelinkv2', json_encode( $data ) );
261
+ }
262
+
263
+ /*
264
+ Send a Test Campaign.
265
+ @param {Array} data contains php array with key value pair.
266
+ @options data {Integer} id: Id of the campaign [Mandatory]
267
+ @options data {Array} emails: Email address of recipient(s) existing in the one of the lists & should not be blacklisted. Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
268
+ */
269
+ public function send_bat_email( $data ) {
270
+ $id = $data['id'];
271
+ unset( $data['id'] );
272
+ return $this->post( 'campaign/' . $id . '/test', json_encode( $data ) );
273
+ }
274
+
275
+ /*
276
+ Update the Campaign status.
277
+ @param {Array} data contains php array with key value pair.
278
+ @options data {Integer} id: Id of campaign to update its status [Mandatory]
279
+ @options data {String} status: Types of status. Possible values – suspended, archive, darchive, sent, queued, replicate and replicate_template ( case sensitive ) [Mandatory]
280
+ */
281
+ public function update_campaign_status( $data ) {
282
+ $id = $data['id'];
283
+ unset( $data['id'] );
284
+ return $this->put( 'campaign/' . $id . '/updatecampstatus', json_encode( $data ) );
285
+ }
286
+
287
+ /*
288
+ Create and schedule your Trigger campaigns.
289
+ @param {Array} data contains php array with key value pair.
290
+ @options data {String} category: Tag name of the campaign [Optional]
291
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
292
+ @options data {String} trigger_name: Name of the campaign [Mandatory]
293
+ @options data {String} bat: Email address for test mail [Optional]
294
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
295
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
296
+ @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
297
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
298
+ @options data {String} subject: Subject of the campaign [Mandatory]
299
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
300
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
301
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
302
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
303
+ @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
304
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
305
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
306
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
307
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
308
+ */
309
+ public function create_trigger_campaign( $data ) {
310
+ return $this->post( 'campaign', json_encode( $data ) );
311
+ }
312
+
313
+ /*
314
+ Update and schedule your Trigger campaigns.
315
+ @param {Array} data contains php array with key value pair.
316
+ @options data {Integer} id: Id of Trigger campaign to be modified [Mandatory]
317
+ @options data {String} category: Tag name of the campaign [Optional]
318
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
319
+ @options data {String} trigger_name: Name of the campaign [Mandatory]
320
+ @options data {String} bat Email address for test mail [Optional]
321
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
322
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
323
+ @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
324
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
325
+ @options data {String} subject: Subject of the campaign [Mandatory]
326
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
327
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
328
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
329
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
330
+ @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
331
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
332
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
333
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
334
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
335
+ */
336
+ public function update_trigger_campaign( $data ) {
337
+ $id = $data['id'];
338
+ unset( $data['id'] );
339
+ return $this->put( 'campaign/' . $id, json_encode( $data ) );
340
+ }
341
+
342
+ /*
343
+ Get all folders detail.
344
+ @param {Array} data contains php array with key value pair.
345
+ @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 folders then you can use this parameter to get next 50 results [Mandatory]
346
+ @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
347
+ */
348
+ public function get_folders( $data ) {
349
+ return $this->get( 'folder', json_encode( $data ) );
350
+ }
351
+
352
+ /*
353
+ Get a particular folder detail.
354
+ @param {Array} data contains php array with key value pair.
355
+ @options data {Integer} id: Id of folder to get details [Mandatory]
356
+ */
357
+ public function get_folder( $data ) {
358
+ return $this->get( 'folder/' . $data['id'], '' );
359
+ }
360
+
361
+ /*
362
+ Create a new folder.
363
+ @param {Array} data contains php array with key value pair.
364
+ @options data {String} name: Desired name of the folder to be created [Mandatory]
365
+ */
366
+ public function create_folder( $data ) {
367
+ return $this->post( 'folder', json_encode( $data ) );
368
+ }
369
+
370
+ /*
371
+ Delete a specific folder information.
372
+ @param {Array} data contains php array with key value pair.
373
+ @options data {Integer} id: Id of folder to be deleted [Mandatory]
374
+ */
375
+ public function delete_folder( $data ) {
376
+ return $this->delete( 'folder/' . $data['id'], '' );
377
+ }
378
+
379
+ /*
380
+ Update an existing folder.
381
+ @param {Array} data contains php array with key value pair.
382
+ @options data {Integer} id: Id of folder to be modified [Mandatory]
383
+ @options data {String} name: Desired name of the folder to be modified [Mandatory]
384
+ */
385
+ public function update_folder( $data ) {
386
+ $id = $data['id'];
387
+ unset( $data['id'] );
388
+ return $this->put( 'folder/' . $id, json_encode( $data ) );
389
+ }
390
+
391
+ /*
392
+ Get all lists detail.
393
+ @param {Array} data contains php array with key value pair.
394
+ @options data {Integer} list_parent: This is the existing folder id & can be used to get all lists belonging to it [Optional]
395
+ @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
396
+ @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
397
+ */
398
+ public function get_lists( $data ) {
399
+ return $this->get( 'list', json_encode( $data ) );
400
+ }
401
+
402
+ /*
403
+ Get a particular list detail.
404
+ @param {Array} data contains php array with key value pair.
405
+ @options data {Integer} id: Id of list to get details [Mandatory]
406
+ */
407
+ public function get_list( $data ) {
408
+ return $this->get( 'list/' . $data['id'], '' );
409
+ }
410
+
411
+ /*
412
+ Create a new list.
413
+ @param {Array} data contains php array with key value pair.
414
+ @options data {String} list_name: Desired name of the list to be created [Mandatory]
415
+ @options data {Integer} list_parent: Folder ID [Mandatory]
416
+ */
417
+ public function create_list( $data ) {
418
+ return $this->post( 'list', json_encode( $data ) );
419
+ }
420
+
421
+ /*
422
+ Update a list.
423
+ @param {Array} data contains php array with key value pair.
424
+ @options data {Integer} id: Id of list to be modified [Mandatory]
425
+ @options data {String} list_name: Desired name of the list to be modified [Optional]
426
+ @options data {Integer} list_parent: Folder ID [Mandatory]
427
+ */
428
+ public function update_list( $data ) {
429
+ $id = $data['id'];
430
+ unset( $data['id'] );
431
+ return $this->put( 'list/' . $id, json_encode( $data ) );
432
+ }
433
+
434
+ /*
435
+ Delete a specific list.
436
+ @param {Array} data contains php array with key value pair.
437
+ @options data {Integer} id: Id of list to be deleted [Mandatory]
438
+ */
439
+ public function delete_list( $data ) {
440
+ return $this->delete( 'list/' . $data['id'], '' );
441
+ }
442
+
443
+ /*
444
+ Display details of all users for the given lists.
445
+ @param {Array} data contains php array with key value pair.
446
+ @options data {Array} listids: These are the list ids to get their data. The ids found will display records [Mandatory]
447
+ @options data {String} timestamp: This is date-time filter to fetch modified user records >= this time. Valid format Y-m-d H:i:s. Example: "2015-05-22 14:30:00" [Optional]
448
+ @options data {Integer} page: Maximum number of records per request is 500, if in your list there are more than 500 users then you can use this parameter to get next 500 results [Optional]
449
+ @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
450
+ */
451
+ public function display_list_users( $data ) {
452
+ return $this->post( 'list/display', json_encode( $data ) );
453
+ }
454
+
455
+ /*
456
+ Add already existing users in the SendinBlue contacts to the list.
457
+ @param {Array} data contains php array with key value pair.
458
+ @options data {Integer} id: Id of list to link users in it [Mandatory]
459
+ @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
460
+ */
461
+
462
+ public function add_users_list( $data ) {
463
+ $id = $data['id'];
464
+ unset( $data['id'] );
465
+ return $this->post( 'list/' . $id . '/users', json_encode( $data ) );
466
+ }
467
+
468
+ /*
469
+ Delete already existing users in the SendinBlue contacts from the list.
470
+ @param {Array} data contains php array with key value pair.
471
+ @options data {Integer} id: Id of list to unlink users from it [Mandatory]
472
+ @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts to be modified. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
473
+ */
474
+ public function delete_users_list( $data ) {
475
+ $id = $data['id'];
476
+ unset( $data['id'] );
477
+ return $this->delete( 'list/' . $id . '/delusers', json_encode( $data ) );
478
+ }
479
+
480
+ /*
481
+ Access all the attributes information under the account.
482
+ No input required
483
+ */
484
+ public function get_attributes() {
485
+ return $this->get( 'attribute', '' );
486
+ }
487
+
488
+ /*
489
+ Access the specific type of attribute information.
490
+ @param {Array} data contains php array with key value pair.
491
+ @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global [Optional]
492
+ */
493
+ public function get_attribute( $data ) {
494
+ return $this->get( 'attribute/' . $data['type'], '' );
495
+ }
496
+
497
+ /*
498
+ Create an Attribute.
499
+ @param {Array} data contains php array with key value pair.
500
+ @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global ( case sensitive ) [Mandatory]
501
+ @options data {Array} data: The name and data type of ‘normal’ & ‘transactional’ attribute to be created in your SendinBlue account. It should be sent as an associative array. Example: array(‘ATTRIBUTE_NAME1′ => ‘DATA_TYPE1′, ‘ATTRIBUTE_NAME2’=> ‘DATA_TYPE2′).
502
+ The name and data value of ‘category’, ‘calculated’ & ‘global’, should be sent as JSON string. Example: ‘[{ "name":"ATTRIBUTE_NAME1", "value":"Attribute_value1" }, { "name":"ATTRIBUTE_NAME2", "value":"Attribute_value2" }]’. You can use commas to separate multiple attributes [Mandatory]
503
+ */
504
+ public function create_attribute( $data ) {
505
+ return $this->post( 'attribute/', json_encode( $data ) );
506
+ }
507
+
508
+ /*
509
+ Delete a specific type of attribute information.
510
+ @param {Array} data contains php array with key value pair.
511
+ @options data {Integer} type: Type of attribute to be deleted [Mandatory]
512
+ */
513
+ public function delete_attribute( $type, $data ) {
514
+ $type = $data['type'];
515
+ unset( $data['type'] );
516
+ return $this->post( 'attribute/' . $type, json_encode( $data ) );
517
+ }
518
+
519
+ /*
520
+ Create a new user if an email provided as input, doesn’t exists in the contact list of your SendinBlue account, otherwise it will update the existing user.
521
+ @param {Array} data contains php array with key value pair.
522
+ @options data {String} email: Email address of the user to be created in SendinBlue contacts. Already existing email address of user in the SendinBlue contacts to be modified [Mandatory]
523
+ @options data {Array} attributes: The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
524
+ @options data {Integer} blacklisted: This is used to blacklist/ Unblacklist a user. Possible values – 0 & 1. blacklisted = 1 means user has been blacklisted [Optional]
525
+ @options data {Array} listid: The list id(s) to be linked from user [Optional]
526
+ @options data {Array} listid_unlink: The list id(s) to be unlinked from user [Optional]
527
+ @options data {Array} blacklisted_sms: This is used to blacklist/ Unblacklist a user’s SMS number. Possible values – 0 & 1. blacklisted_sms = 1 means user’s SMS number has been blacklisted [Optional]
528
+ */
529
+ public function create_update_user( $data ) {
530
+ return $this->post( 'user/createdituser', json_encode( $data ) );
531
+ }
532
+
533
+ /*
534
+ Get Access a specific user Information.
535
+ @param {Array} data contains php array with key value pair.
536
+ @options data {String} email: Email address of the already existing user in the SendinBlue contacts [Mandatory]
537
+ */
538
+ public function get_user( $data ) {
539
+ return $this->get( 'user/' . $data['email'], '' );
540
+ }
541
+
542
+ /*
543
+ Unlink existing user from all lists.
544
+ @param {Array} data contains php array with key value pair.
545
+ @options data {String} email: Email address of the already existing user in the SendinBlue contacts to be unlinked from all lists [Mandatory]
546
+ */
547
+ public function delete_user( $data ) {
548
+ return $this->delete( 'user/' . $data['email'], '' );
549
+ }
550
+
551
+ /*
552
+ Import Users Information.
553
+ @param {Array} data contains php array with key value pair.
554
+ @options data {String} url: The URL of the file to be imported. Possible file types – .txt, .csv [Mandatory: if body is empty]
555
+ @options data {String} body: The Body with csv content to be imported. Example: ‘NAME;SURNAME;EMAIL\n"Name1";"Surname1";"example1@example.net"\n"Name2";"Surname2";"example2@example.net"‘, where \n separates each user data. You can use semicolon to separate multiple attributes [Mandatory: if url is empty]
556
+ @options data {Array} listids: These are the list ids in which the the users will be imported [Mandatory: if name is empty]
557
+ @options data {String} notify_url: URL that will be called once the import process is finished [Optional] In notify_url, we are sending the content using POST method
558
+ @options data {String} name: This is new list name which will be created first & then users will be imported in it [Mandatory: if listids is empty]
559
+ @options data {Integer} list_parent: This is the existing folder id & can be used with name parameter to make newly created list’s desired parent [Optional]
560
+ */
561
+ public function import_users( $data ) {
562
+ return $this->post( 'user/import', json_encode( $data ) );
563
+ }
564
+
565
+ /*
566
+ Export Users Information.
567
+ @param {Array} data contains php array with key value pair.
568
+ @options data {String} export_attrib: The name of attribute present in your SendinBlue account. You can use commas to separate multiple attributes. Example: "EMAIL,NAME,SMS" [Optional]
569
+ @options data {String} filter: Filter can be added to export users. Example: "{\"blacklisted\":1}", will export all blacklisted users [Mandatory]
570
+ @options data {String} notify_url: URL that will be called once the export process is finished [Optional]
571
+ */
572
+ public function export_users( $data ) {
573
+ return $this->post( 'user/export', json_encode( $data ) );
574
+ }
575
+
576
+ /*
577
+ Get all the processes information under the account.
578
+ @param {Array} data contains php array with key value pair.
579
+ @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
580
+ @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
581
+ */
582
+ public function get_processes( $data ) {
583
+ return $this->get( 'process', json_encode( $data ) );
584
+ }
585
+
586
+ /*
587
+ Get the process information.
588
+ @param {Array} data contains php array with key value pair.
589
+ @options data {Integer} id: Id of process to get details [Mandatory]
590
+ */
591
+ public function get_process( $data ) {
592
+ return $this->get( 'process/' . $data['id'], '' );
593
+ }
594
+
595
+ /*
596
+ To retrieve details of all webhooks.
597
+ @param {Array} data contains php array with key value pair.
598
+ @options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all webhooks, use $is_plat="" [Optional]
599
+ */
600
+ public function get_webhooks( $data ) {
601
+ return $this->get( 'webhook', json_encode( $data ) );
602
+ }
603
+
604
+ /*
605
+ To retrieve details of any particular webhook.
606
+ @param {Array} data contains php array with key value pair.
607
+ @options data {Integer} id: Id of webhook to get details [Mandatory]
608
+ */
609
+ public function get_webhook( $data ) {
610
+ return $this->get( 'webhook/' . $data['id'], '' );
611
+ }
612
+
613
+ /*
614
+ Create a Webhook.
615
+ @param {Array} data contains php array with key value pair.
616
+ @options data {String} url: URL that will be triggered by a webhook [Mandatory]
617
+ @options data {String} description: Webook description [Optional]
618
+ @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
619
+ @options data {Integer} is_plat: Flag to create webhook type. Possible values – 0 (default) & 1. Example: to create Transactional webhooks, use $is_plat=0, & to create Marketing webhooks, use $is_plat=1 [Optional]
620
+ */
621
+ public function create_webhook( $data ) {
622
+ return $this->post( 'webhook', json_encode( $data ) );
623
+ }
624
+
625
+ /*
626
+ Delete a webhook.
627
+ @param {Array} data contains php array with key value pair.
628
+ @options data {Integer} id: Id of webhook to be deleted [Mandatory]
629
+ */
630
+ public function delete_webhook( $data ) {
631
+ return $this->delete( 'webhook/' . $data['id'], '' );
632
+ }
633
+
634
+ /*
635
+ Update a webhook.
636
+ @param {Array} data contains php array with key value pair.
637
+ @options data {Integer} id: Id of webhook to be modified [Mandatory]
638
+ @options data {String} url: URL that will be triggered by a webhook [Mandatory]
639
+ @options data {String} description: Webook description [Optional]
640
+ @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
641
+ */
642
+ public function update_webhook( $data ) {
643
+ $id = $data['id'];
644
+ unset( $data['id'] );
645
+ return $this->put( 'webhook/' . $id, json_encode( $data ) );
646
+ }
647
+
648
+ /*
649
+ Get Access of created senders information.
650
+ @param {Array} data contains php array with key value pair.
651
+ @options data {String} option: Options to get senders. Possible options – IP-wise, & Domain-wise ( only for dedicated IP clients ). Example: to get senders with specific IP, use $option=’1.2.3.4′, to get senders with specific domain use, $option=’domain.com’, & to get all senders, use $option="" [Optional]
652
+ */
653
+ public function get_senders( $data ) {
654
+ return $this->get( 'advanced', json_encode( $data ) );
655
+ }
656
+
657
+ /*
658
+ Create your Senders.
659
+ @param {Array} data contains php array with key value pair.
660
+ @options data {String} name: Name of the sender [Mandatory]
661
+ @options data {String} email: Email address of the sender [Mandatory]
662
+ @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
663
+ */
664
+ public function create_sender( $data ) {
665
+ return $this->post( 'advanced', json_encode( $data ) );
666
+ }
667
+
668
+ /*
669
+ Update your Senders.
670
+ @param {Array} data contains php array with key value pair.
671
+ @options data {Integer} id: Id of sender to be modified [Mandatory]
672
+ @options data {String} name: Name of the sender [Mandatory]
673
+ @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
674
+ */
675
+ public function update_sender( $data ) {
676
+ $id = $data['id'];
677
+ unset( $data['id'] );
678
+ return $this->put( 'advanced/' . $id, json_encode( $data ) );
679
+ }
680
+
681
+ /*
682
+ Delete your Sender Information.
683
+ @param {Array} data contains php array with key value pair.
684
+ @options data {Integer} id: Id of sender to be deleted [Mandatory]
685
+ */
686
+ public function delete_sender( $data ) {
687
+ return $this->delete( 'advanced/' . $data['id'], '' );
688
+ }
689
+
690
+ /*
691
+ Send Transactional Email.
692
+ @param {Array} data contains php array with key value pair.
693
+ @options data {Array} to: Email address of the recipient(s). It should be sent as an associative array. Example: array("to@example.net"=>"to whom"). You can use commas to separate multiple recipients [Mandatory]
694
+ @options data {String} subject: Message subject [Mandatory]
695
+ @options data {Array} from Email address for From header. It should be sent as an array. Example: array("from@email.com","from email") [Mandatory]
696
+ @options data {String} html: Body of the message. (HTML version) [Mandatory]. To send inline images, use <img src="{YourFileName.Extension}" alt="image" border="0" >, the 'src' attribute value inside {} (curly braces) should be same as the filename used in 'inline_image' parameter
697
+ @options data {String} text: Body of the message. (text version) [Optional]
698
+ @options data {Array} cc: Same as to but for Cc. Example: array("cc@example.net","cc whom") [Optional]
699
+ @options data {Array} bcc: Same as to but for Bcc. Example: array("bcc@example.net","bcc whom") [Optional]
700
+ @options data {Array} replyto: Same as from but for Reply To. Example: array("from@email.com","from email") [Optional]
701
+ @options data {Array} attachment: Provide the absolute url of the attachment/s. Possible extension values = gif, png, bmp, cgm, jpg, jpeg, txt, css, shtml, html, htm, csv, zip, pdf, xml, doc, xls, ppt, tar, and ez. To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple attachments [Optional]
702
+ @options data {Array} headers: The headers will be sent along with the mail headers in original email. Example: array("Content-Type"=>"text/html; charset=iso-8859-1"). You can use commas to separate multiple headers [Optional]
703
+ @options data {Array} inline_image: Pass your inline image/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple inline images [Optional]
704
+ */
705
+ public function send_email( $data ) {
706
+ return $this->post( 'email', json_encode( $data ) );
707
+ }
708
+
709
+ /*
710
+ Aggregate / date-wise report of the SendinBlue SMTP account.
711
+ @param {Array} data contains php array with key value pair.
712
+ @options data {Integer} aggregate: This is used to indicate, you are interested in all-time totals. Possible values – 0 & 1. aggregate = 0 means it will not aggregate records, and will show stats per day/date wise [Optional]
713
+ @options data {String} start_date: The start date to look up statistics. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
714
+ @options data {String} end_date: The end date to look up statistics. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
715
+ @options data {Integer} days: Number of days in the past to include statistics ( Includes today ). It must be an integer greater than 0 [Optional]
716
+ @options data {String} tag: The tag you will specify to retrieve detailed stats. It must be an existing tag that has statistics [Optional]
717
+ */
718
+ public function get_statistics( $data ) {
719
+ return $this->post( 'statistics', json_encode( $data ) );
720
+ }
721
+
722
+ /*
723
+ Get Email Event report.
724
+ @param {Array} data contains php array with key value pair.
725
+ @options data {Integer} limit: To limit the number of results returned. It should be an integer [Optional]
726
+ @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
727
+ @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
728
+ @options data {Integer} offset: Beginning point in the list to retrieve from. It should be an integer [Optional]
729
+ @options data {String} date: Specific date to get its report. Date must be in YYYY-MM-DD format and should be earlier than todays date [Optional]
730
+ @options data {Integer} days: Number of days in the past (includes today). If specified, must be an integer greater than 0 [Optional]
731
+ @options data {String} email: Email address to search report for [Optional]
732
+ */
733
+ public function get_report( $data ) {
734
+ return $this->post( 'report', json_encode( $data ) );
735
+ }
736
+
737
+ /*
738
+ Delete any hardbounce, which actually would have been blocked due to some temporary ISP failures.
739
+ @param {Array} data contains php array with key value pair.
740
+ @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
741
+ @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
742
+ @options data {String} email: Email address to delete its bounces [Optional]
743
+ */
744
+ public function delete_bounces( $data ) {
745
+ return $this->post( 'bounces', json_encode( $data ) );
746
+ }
747
+
748
+ /*
749
+ Send templates created on SendinBlue, through SendinBlue SMTP (transactional mails).
750
+ @param {Array} data contains php array with key value pair.
751
+ @options data {Integer} id: Id of the template created on SendinBlue account [Mandatory]
752
+ @options data {String} to: Email address of the recipient(s). You can use pipe ( | ) to separate multiple recipients. Example: "to-example@example.net|to2-example@example.net" [Mandatory]
753
+ @options data {String} cc: Same as to but for Cc [Optional]
754
+ @options data {String} bcc: Same as to but for Bcc [Optional]
755
+ @options data {Array} attrv The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
756
+ @options data {String} attachment_url: Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere [Optional]
757
+ @options data {Array} attachment: To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array [Optional]
758
+ */
759
+ public function send_transactional_template( $data ) {
760
+ $id = $data['id'];
761
+ unset( $data['id'] );
762
+ return $this->put( 'template/' . $id, json_encode( $data ) );
763
+ }
764
+
765
+ /*
766
+ Create a Template.
767
+ @param {Array} data contains php array with key value pair.
768
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
769
+ @options data {String} template_name: Name of the Template [Mandatory]
770
+ @options data {String} bat: Email address for test mail [Optional]
771
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
772
+ @options data {String} html_url Url: which content is the body of content [Mandatory: if html_content is empty]
773
+ @options data {String} subject: Subject of the campaign [Mandatory]
774
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
775
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
776
+ @options data {String} to_fieldv This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
777
+ @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
778
+ @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
779
+ */
780
+ public function create_template( $data ) {
781
+ return $this->post( 'template', json_encode( $data ) );
782
+ }
783
+
784
+ /*
785
+ Update a Template.
786
+ @param {Array} data contains php array with key value pair.
787
+ @options data {Integer} id: Id of Template to be modified [Mandatory]
788
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
789
+ @options data {String} template_name: Name of the Template [Mandatory]
790
+ @options data {String} bat: Email address for test mail [Optional]
791
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
792
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
793
+ @options data {String} subject: Subject of the campaign [Mandatory]
794
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
795
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
796
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
797
+ @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
798
+ @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
799
+ */
800
+ public function update_template( $data ) {
801
+ $id = $data['id'];
802
+ unset( $data['id'] );
803
+ return $this->put( 'template/' . $id, json_encode( $data ) );
804
+ }
805
+
806
+ /*
807
+ Send a transactional SMS.
808
+ @param {Array} data contains php array with key value pair.
809
+ @options data {String} to: The mobile number to send SMS to with country code [Mandatory]
810
+ @options data {String} from: The name of the sender. The number of characters is limited to 11 (alphanumeric format) [Mandatory]
811
+ @options data {String} text: The text of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Mandatory]
812
+ @options data {String} web_url: The web URL that can be called once the message is successfully delivered [Optional]
813
+ @options data {String} tag: The tag that you can associate with the message [Optional]
814
+ @options data {String} type: Type of message. Possible values – marketing (default) & transactional. You can use marketing for sending marketing SMS, & for sending transactional SMS, use transactional type [Optional]
815
+ */
816
+ public function send_sms( $data ) {
817
+ return $this->post( 'sms', json_encode( $data ) );
818
+ }
819
+
820
+ /*
821
+ Create & Schedule your SMS campaigns.
822
+ @param {Array} data contains php array with key value pair.
823
+ @options data {String} name: Name of the SMS campaign [Mandatory]
824
+ @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
825
+ @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
826
+ @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
827
+ @options data {Array} listid: These are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
828
+ @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
829
+ @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
830
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
831
+ */
832
+ public function create_sms_campaign( $data ) {
833
+ return $this->post( 'sms', json_encode( $data ) );
834
+ }
835
+
836
+ /*
837
+ Update your SMS campaigns.
838
+ @param {Array} data contains php array with key value pair.
839
+ @options data {Integer} id: Id of the SMS campaign [Mandatory]
840
+ @options data {String} name: Name of the SMS campaign [Optional]
841
+ @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
842
+ @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
843
+ @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
844
+ @options data {Array} listid: hese are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
845
+ @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
846
+ @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
847
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
848
+ */
849
+ public function update_sms_campaign( $data ) {
850
+ $id = $data['id'];
851
+ unset( $data['id'] );
852
+ return $this->put( 'sms/' . $id, json_encode( $data ) );
853
+ }
854
+
855
+ /*
856
+ Send a Test SMS.
857
+ @param {Array} data contains php array with key value pair.
858
+ @options data {Integer} id: Id of the SMS campaign [Mandatory]
859
+ @options data {String} to: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Mandatory]
860
+ */
861
+ public function send_bat_sms( $data ) {
862
+ $id = $data['id'];
863
+ unset( $data['id'] );
864
+ return $this->get( 'sms/' . $id, json_encode( $data ) );
865
+ }
866
+
867
+ }
menu-icons.php CHANGED
@@ -11,7 +11,7 @@
11
* Plugin name: Menu Icons
12
* Plugin URI: https://github.com/Codeinwp/wp-menu-icons
13
* Description: Spice up your navigation menus with pretty icons, easily.
14
- * Version: 0.11.0
15
* Author: ThemeIsle
16
* Author URI: https://themeisle.com
17
* License: GPLv2
@@ -27,7 +27,7 @@
27
*/
28
final class Menu_Icons {
29
30
- const VERSION = '0.11.0';
31
32
/**
33
* Holds plugin data
11
* Plugin name: Menu Icons
12
* Plugin URI: https://github.com/Codeinwp/wp-menu-icons
13
* Description: Spice up your navigation menus with pretty icons, easily.
14
+ * Version: 0.11.1
15
* Author: ThemeIsle
16
* Author URI: https://themeisle.com
17
* License: GPLv2
27
*/
28
final class Menu_Icons {
29
30
+ const VERSION = '0.11.1';
31
32
/**
33
* Holds plugin data
readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # Menu Icons #
2
**Contributors:** [codeinwp](https://profiles.wordpress.org/codeinwp), [themeisle](https://profiles.wordpress.org/themeisle)
3
**Tags:** menu, nav-menu, icons, navigation
4
**Requires at least:** 4.3
@@ -224,6 +224,11 @@ Add this block of code to your [mu-plugin file](http://codex.wordpress.org/Must_
224
Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/).
225
226
## Changelog ##
227
### 0.11.0 - 2018-01-05 ###
228
229
* Change ownership to ThemeIsle.
1
+ # Menu Icons by ThemeIsle #
2
**Contributors:** [codeinwp](https://profiles.wordpress.org/codeinwp), [themeisle](https://profiles.wordpress.org/themeisle)
3
**Tags:** menu, nav-menu, icons, navigation
4
**Requires at least:** 4.3
224
Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/).
225
226
## Changelog ##
227
+ ### 0.11.1 - 2018-02-24 ###
228
+
229
+ * Add recommendation boxes in the menu icon popup.
230
+
231
+
232
### 0.11.0 - 2018-01-05 ###
233
234
* Change ownership to ThemeIsle.
readme.txt CHANGED
@@ -1,4 +1,4 @@
1
- === Menu Icons ===
2
Contributors: codeinwp, themeisle
3
Tags: menu, nav-menu, icons, navigation
4
Requires at least: 4.3
@@ -224,6 +224,11 @@ add_filter( 'menu_icons_menu_settings', 'my_menu_icons_menu_settings', 10, 2 );
224
Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/).
225
226
== Changelog ==
227
= 0.11.0 - 2018-01-05 =
228
229
* Change ownership to ThemeIsle.
1
+ === Menu Icons by ThemeIsle ===
2
Contributors: codeinwp, themeisle
3
Tags: menu, nav-menu, icons, navigation
4
Requires at least: 4.3
224
Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/).
225
226
== Changelog ==
227
+ = 0.11.1 - 2018-02-24 =
228
+
229
+ * Add recommendation boxes in the menu icon popup.
230
+
231
+
232
= 0.11.0 - 2018-01-05 =
233
234
* Change ownership to ThemeIsle.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
5
require_once __DIR__ . '/composer' . '/autoload_real.php';
6
7
- return ComposerAutoloaderInit5f3dc85ad03b077b3908690abe36328d::getLoader();
4
5
require_once __DIR__ . '/composer' . '/autoload_real.php';
6
7
+ return ComposerAutoloaderInitbaffda83ee24a5c0baf5adf89e1821f0::getLoader();
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-endpoints.php CHANGED
@@ -235,7 +235,7 @@ if ( ! class_exists( 'ThemeIsle_SDK_Endpoints' ) ) :
235
236
// fetch the calculated hashes.
237
if ( ! $wp_filesystem->is_readable( $path . '/' . self::HASH_FILE ) ) {
238
- return new WP_Error( 'themeisle_sdk_hash_not_found', sprintf( __( '%s not found', 'themeisle-sdk' ), self::HASH_FILE ) );
239
}
240
241
$hashes = json_decode( $wp_filesystem->get_contents( $path . '/' . self::HASH_FILE ), true );
@@ -296,7 +296,7 @@ if ( ! class_exists( 'ThemeIsle_SDK_Endpoints' ) ) :
296
$value = sanitize_text_field( $data[ $param ] );
297
if ( empty( $value ) ) {
298
return new WP_Error(
299
- 'themeisle_' . $param . '_invalid', sprintf( __( 'Invalid %', 'themeisle-sdk' ), $param ), array(
300
'status' => 403,
301
)
302
);
235
236
// fetch the calculated hashes.
237
if ( ! $wp_filesystem->is_readable( $path . '/' . self::HASH_FILE ) ) {
238
+ return new WP_Error( 'themeisle_sdk_hash_not_found', sprintf( '%s not found', self::HASH_FILE ) );
239
}
240
241
$hashes = json_decode( $wp_filesystem->get_contents( $path . '/' . self::HASH_FILE ), true );
296
$value = sanitize_text_field( $data[ $param ] );
297
if ( empty( $value ) ) {
298
return new WP_Error(
299
+ 'themeisle_' . $param . '_invalid', sprintf( 'Invalid %', $param ), array(
300
'status' => 403,
301
)
302
);
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
3
// autoload_real.php @generated by Composer
4
5
- class ComposerAutoloaderInit5f3dc85ad03b077b3908690abe36328d
6
{
7
private static $loader;
8
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit5f3dc85ad03b077b3908690abe36328d
19
return self::$loader;
20
}
21
22
- spl_autoload_register(array('ComposerAutoloaderInit5f3dc85ad03b077b3908690abe36328d', 'loadClassLoader'), true, true);
23
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5f3dc85ad03b077b3908690abe36328d', 'loadClassLoader'));
25
26
$map = require __DIR__ . '/autoload_namespaces.php';
27
foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit5f3dc85ad03b077b3908690abe36328d
42
43
$includeFiles = require __DIR__ . '/autoload_files.php';
44
foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequire5f3dc85ad03b077b3908690abe36328d($fileIdentifier, $file);
46
}
47
48
return $loader;
49
}
50
}
51
52
- function composerRequire5f3dc85ad03b077b3908690abe36328d($fileIdentifier, $file)
53
{
54
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
require $file;
2
3
// autoload_real.php @generated by Composer
4
5
+ class ComposerAutoloaderInitbaffda83ee24a5c0baf5adf89e1821f0
6
{
7
private static $loader;
8
19
return self::$loader;
20
}
21
22
+ spl_autoload_register(array('ComposerAutoloaderInitbaffda83ee24a5c0baf5adf89e1821f0', 'loadClassLoader'), true, true);
23
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitbaffda83ee24a5c0baf5adf89e1821f0', 'loadClassLoader'));
25
26
$map = require __DIR__ . '/autoload_namespaces.php';
27
foreach ($map as $namespace => $path) {
42
43
$includeFiles = require __DIR__ . '/autoload_files.php';
44
foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequirebaffda83ee24a5c0baf5adf89e1821f0($fileIdentifier, $file);
46
}
47
48
return $loader;
49
}
50
}
51
52
+ function composerRequirebaffda83ee24a5c0baf5adf89e1821f0($fileIdentifier, $file)
53
{
54
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
require $file;
vendor/composer/installed.json CHANGED
@@ -6,15 +6,15 @@
6
"source": {
7
"type": "git",
8
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
9
- "reference": "032c9dcc34c7c8589eebe3e0b3c72418fcbd3d76"
10
},
11
"dist": {
12
"type": "zip",
13
- "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/032c9dcc34c7c8589eebe3e0b3c72418fcbd3d76",
14
- "reference": "032c9dcc34c7c8589eebe3e0b3c72418fcbd3d76",
15
"shasum": ""
16
},
17
- "time": "2018-01-13 12:07:08",
18
"type": "library",
19
"installation-source": "dist",
20
"autoload": {
@@ -85,7 +85,8 @@
85
"icons",
86
"plugin",
87
"wordpress"
88
- ]
89
},
90
{
91
"name": "kucrut/menu-item-custom-fields",
6
"source": {
7
"type": "git",
8
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
9
+ "reference": "9d866559c6090f0e7e70fe3e5a4be8672461a11a"
10
},
11
"dist": {
12
"type": "zip",
13
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/9d866559c6090f0e7e70fe3e5a4be8672461a11a",
14
+ "reference": "9d866559c6090f0e7e70fe3e5a4be8672461a11a",
15
"shasum": ""
16
},
17
+ "time": "2018-02-16 16:31:29",
18
"type": "library",
19
"installation-source": "dist",
20
"autoload": {
85
"icons",
86
"plugin",
87
"wordpress"
88
+ ],
89
+ "abandoned": true
90
},
91
{
92
"name": "kucrut/menu-item-custom-fields",