/
functions.php
10476 lines (8179 loc) · 332 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* functions and constants for Raindrops theme
*
*
* @package Raindrops
* @since Raindrops 0.1
*/
if ( !defined( 'ABSPATH' ) ) {
exit;
}
do_action( 'raindrops_before' );
/**
* move from hooks.php
* and change from load_textdomain( ) to load_theme_text_domain( )
*
*
* @since 0.988
*
* When child theme has languages/raindrops_[lang].mo
* Raindrops Theme read this language file.
* You can override parent themes language file from child theme.
*/
load_theme_textdomain( 'Raindrops', apply_filters( 'raindrops_load_text_domain', get_template_directory() . '/languages' ) );
/**
* include raindrops custom settings
*
*
*
*/
if ( file_exists( get_template_directory() . '/raindrops-config.php' ) ) {
require_once( get_template_directory() . '/raindrops-config.php' );
}
if ( file_exists( get_stylesheet_directory() . '/lib/alias_functions.php' ) ) {
require_once ( get_stylesheet_directory() . '/lib/alias_functions.php' );
} else {
require_once ( get_template_directory() . '/lib/alias_functions.php' );
}
if ( false !== ( $path = raindrops_locate_url( 'lib/vars.php', 'path' ) ) ) {
require_once ( $path );
}
if ( false !== ( $path = raindrops_locate_url( 'lib/validate.php', 'path' ) ) ) {
require_once ( $path );
}
if ( false !== ( $path = raindrops_locate_url( 'plugins/plugins-presentation.php', 'path' ) ) ) {
require_once ( $path );
}
if ( !class_exists( 'raindrops_menu_create' ) ) {
if ( false !== ( $path = raindrops_locate_url( 'lib/option-panel.php', 'path' ) ) ) {
require_once ( $path );
}
}
if ( $raindrops_show_theme_option == true ) {
$is_submenu = new raindrops_menu_create;
add_action( 'admin_menu', array( $is_submenu, 'raindrops_add_menus' ) );
}
if ( false !== ( $path = raindrops_locate_url( 'lib/csscolor/csscolor.php', 'path' ) ) ) {
require_once ( $path );
}
if ( false !== ( $path = raindrops_locate_url( 'lib/csscolor.css.php', 'path' ) ) ) {
require_once ( $path );
}
if ( false !== ( $path = raindrops_locate_url( 'lib/widgets.php', 'path' ) ) ) {
require_once ( $path );
}
if ( get_locale() == 'ja' ) {
if ( false !== ( $path = raindrops_locate_url( 'languages/scripts/ja.php', 'path' ) ) ) {
require_once ( $path );
}
}
$jetpack_active_modules = get_option( 'jetpack_active_modules' );
if ( class_exists( 'Jetpack', false ) && $jetpack_active_modules ) {
if ( false !== ( $path = raindrops_locate_url( 'lib/jetpack.php', 'path' ) ) ) {
require_once ( $path );
}
}
/**
* Featured Image Prezentation
* @since 1.274
*/
if ( false !== ( $path = raindrops_locate_url( 'lib/featured-image.php', 'path' ) ) ) {
require_once ( $path );
}
if ( is_admin() && $raindrops_recommend_plugins !== false ) {
$raindrops_is_include_tgm_config = false;
if ( false !== ( $path = raindrops_locate_url( 'plugins/tgm-config.php', 'path' ) ) ) {
require_once ( $path );
$raindrops_is_include_tgm_config = true;
}
if ( true == $raindrops_is_include_tgm_config && file_exists( get_template_directory() . '/plugins/class-tgm-plugin-activation.php' ) ) {
if ( !class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
require_once ( get_template_directory() . '/plugins/class-tgm-plugin-activation.php' );
}
add_action( 'tgmpa_register', 'raindrops_theme_register_required_plugins' );
}
if( true == $raindrops_new_customizer && isset( $wp_customize ) ) {
if ( false !== ( $path = raindrops_locate_url( 'lib/customize.php', 'path' ) ) ) {
require_once ( $path );
}
}
/**
*
*
*
* @since 1.138
*/
do_action( 'raindrops_include_after' );
/**
*
* Add enable keyboard focus
*
* uses true no use false
* @since 1.229
*/
if( raindrops_warehouse_clone( 'raindrops_disable_keyboard_focus' ) !== 'disable' && !isset( $raindrops_enable_keyboard )) {
$raindrops_enable_keyboard = true;
} elseif ( ! isset( $raindrops_enable_keyboard ) ) {
$raindrops_enable_keyboard = false;
}
/* when wp_nav_menu using fallback_cb keyboard accessibility desable why menu structure issue */
$raindrops_nav_menu_nothing_check = wp_get_nav_menus();
if( empty( $raindrops_nav_menu_nothing_check ) ) {
$raindrops_enable_keyboard = false;
}
/**
*
*/
add_action( 'wp_enqueue_scripts', 'raindrops_add_stylesheet' );
/**
*
*/
register_nav_menus( array( 'primary' => esc_html__( 'Primary Navigation', 'Raindrops' ), ) );
/**
* Custom image header
* $raindrops_custom_header_args
*/
add_filter('raindrops_header_image_width','raindrops_responsive_width_ajust');
if ( ! function_exists( 'raindrops_responsive_width_ajust') ) {
function raindrops_responsive_width_ajust( $width ) {
$page_type_check = raindrops_warehouse_clone( 'raindrops_page_width' );
if( $page_type_check == 'doc3' ) {
$width = absint( raindrops_detect_header_image_size_clone( 'width' ) );
$max_width = raindrops_warehouse_clone( 'raindrops_fluid_max_width' );
if ( $width < $max_width ) {
return $width;
}
return raindrops_warehouse_clone( 'raindrops_fluid_max_width' );
}
return $width;
}
}
add_filter('raindrops_header_image_height', 'raindrops_responsive_height_ajust');
if ( ! function_exists( 'raindrops_responsive_height_ajust') ) {
function raindrops_responsive_height_ajust( $height ) {
$page_type_check = raindrops_warehouse_clone( 'raindrops_page_width' );
if( $page_type_check == 'doc3' ) {
$max_width = raindrops_warehouse_clone( 'raindrops_fluid_max_width' );
$width = absint( raindrops_detect_header_image_size_clone( 'width' ) );
if( $width < $max_width ) {
$orrection_amount = $width / $max_width;
return round( $height * $orrection_amount );
}
if( $width > $max_width ) {
$orrection_amount = $max_width / $width;
return round( $height * $orrection_amount );
}
return $height;
}
return $height;
}
}
if ( !isset( $raindrops_custom_header_args ) ) {
$raindrops_custom_header_width = apply_filters( 'raindrops_header_image_width', absint( raindrops_detect_header_image_size_clone( 'width' ) ) );
$raindrops_custom_header_height = apply_filters( 'raindrops_header_image_height', absint( raindrops_detect_header_image_size_clone( 'height' ) ) );
$raindrops_custom_header_args = array( 'default-text-color' => 'bbbbbb',
'width' => $raindrops_custom_header_width,
'flex-width' => true,
'height' => $raindrops_custom_header_height ,
'flex-height' => true,
'header-text' => true,
'default-image' => '%1$s/images/headers/wp3.jpg',
'wp-head-callback' => apply_filters( 'raindrops_wp-head-callback', 'raindrops_embed_meta' ),
);
if ( version_compare( $wp_version, '4.1', '<' ) ) {
$raindrops_custom_header_args['admin-preview-callback'] = 'raindrops_admin_header_image';
$raindrops_custom_header_args['admin-head-callback'] = 'raindrops_admin_header_style';
}
add_theme_support( 'custom-header', apply_filters( 'raindrops_custom_header_args', $raindrops_custom_header_args ) );
/**
* Add for WordPress 4.1
* @since 1.260
*/
register_default_headers( array(
'raindrops' => array(
'url' => '%s/images/headers/wp3.jpg',
'thumbnail_url' => '%s/images/headers/wp3-thumbnail.jpg',
),
) );
}
/**
* It has hooks.
*
*
*
*
*/
if ( false !== ( $path = raindrops_locate_url( 'lib/hooks.php', 'path' ) ) ) {
require_once ( $path );
}
/**
* Accessibility Settings
*
* When true
* Add to hidden text for identify entry-title link text, comment link text, more link
*
* @since 1.116
*/
function raindrops_extend_query( $vars ) {
$vars[] = 'raindrops_color_type';
$vars[] = 'raindrops_pid';
return $vars;
}
if ( !isset( $raindrops_link_unique_text ) ) {
if ( 'yes' == raindrops_warehouse_clone( 'raindrops_accessibility_settings' ) ) {
$raindrops_link_unique_text = true;
} else {
$raindrops_link_unique_text = false;
}
}
if ( 'yes' == raindrops_warehouse_clone( 'raindrops_accessibility_settings' ) ) {
$raindrops_accessibility_link = false;
}
if ( ! function_exists( 'raindrops_current_url' ) ) {
function raindrops_current_url() {
$url = 'http';
if ( isset( $_SERVER[ "HTTPS" ] ) && $_SERVER[ "HTTPS" ] == "on" ) {
$url .= "s";
}
$url .= "://";
if ( isset( $_SERVER[ "SERVER_PORT" ] ) && $_SERVER[ "SERVER_PORT" ] != "80" ) {
$url .= $_SERVER[ "SERVER_NAME" ] . ":" . $_SERVER[ "SERVER_PORT" ] . $_SERVER[ "REQUEST_URI" ];
} else {
$url .= $_SERVER[ "SERVER_NAME" ] . $_SERVER[ "REQUEST_URI" ];
}
$url = esc_url( $url );
return apply_filters( 'raindrops_current_url', $url );
}
}
/**
* home link
*
* ver 1.116 default value change
* if you need home link then $raindrops_nav_menu_home_link set true.
*/
if ( !isset( $raindrops_nav_menu_home_link ) ) {
if ( true == $raindrops_link_unique_text ) {
$raindrops_nav_menu_home_link = false;
} else {
$raindrops_nav_menu_home_link = true;
}
}
/**
* HTML document type
*
*
*
* Now only 'xhtml'
* ver 0.999 add type 'html5'
*/
if ( !isset( $raindrops_document_type ) ) {
if ( 'xhtml' == raindrops_warehouse_clone( 'raindrops_doc_type_settings' ) ) {
$raindrops_document_type = 'xhtml';
} else {
$raindrops_document_type = 'html5';
// html5
add_theme_support( 'html5', array( 'gallery', 'caption' ) );
}
}
if( ! function_exists( 'raindrops_gallery_atts' ) ) {
/**
*
* @global type $raindrops_extend_galleries
* @param type $out
* @param type $pairs
* @param type $atts
* @return gallery default attribute value
* @since 1.269
*/
function raindrops_gallery_atts( $out, $pairs, $atts ) {
global $raindrops_extend_galleries;
if ( $raindrops_extend_galleries !== true ){
return $out;
}
if ( empty( $atts["columns"] ) || $atts["columns"] < 4 ) {
$atts = shortcode_atts( array(
'size' => 'medium',
), $atts );
$out['size'] = $atts['size'];
}
return $out;
}
}
add_filter( 'shortcode_atts_gallery', 'raindrops_gallery_atts', 10, 3 );
/**
* Force Document type for lt IE9 Old Browser
* Note: This setting is SERVER_SIDE Setting, I recommend that the browser is set when the cache of less than IE9 as not performed
*
* Raindrops 1.204 remove from header.php
* <!--[if IE]>
* <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
* <![endif]-->
*
*
* ver 1.204
*/
if ( $is_IE ) {
preg_match( "|(MSIE )([0-9]{1,2})(\.)|si", $_SERVER[ 'HTTP_USER_AGENT' ], $raindrops_regs );
if ( isset( $raindrops_regs[ 2 ] ) && $raindrops_regs[ 2 ] < 9 ) {
$raindrops_document_type = 'xhtml';
remove_theme_support( 'html5' );
}
}
/**
*
*
* $raindrops_post_formats_args
* add ver0.991 gallery,status
*/
if ( !isset( $raindrops_post_formats_args ) ) {
$raindrops_post_formats_args = apply_filters( 'raindrops_post_formats_args', array( 'aside', 'gallery', 'chat', 'link', 'image', 'status', 'quote', 'video' ) );
add_theme_support( 'post-formats', $raindrops_post_formats_args );
}
/**
*
*
*
* $raindrops_custom_background_args
*
*/
if ( !isset( $raindrops_custom_background_args ) ) {
$raindrops_custom_background_args = apply_filters( 'raindrops_custom_background_args', array(
'default-color' => '',
'default-image' => '',
//'wp-head-callback' => apply_filters( 'raindrops_wp-head-callback', 'raindrops_embed_meta' )
) );
add_theme_support( 'custom-background', $raindrops_custom_background_args );
}
/**
*
*
*
* $raindrops_post_thumbnails_args
*
*/
if ( !isset( $raindrops_post_thumbnails_args ) ) {
$raindrops_post_thumbnails_args = array( 'post', 'page' );
add_theme_support( 'post-thumbnails', apply_filters( 'raindrops_post_thumbnails_args', $raindrops_post_thumbnails_args ) );
}
/**
*
*
*
*
*
*/
add_theme_support( 'automatic-feed-links' );
/**
* Your extend function , settings write below.
*
*
*
*
*/
/**
* Content width implementation by manual labor
*
* If you need specific $content_width.
* value set 400 When not setting or empty.
*
*/
//$content_width = '';
/**
* $raindrops_fluid_minimum_width for IE
*
* IE browser not support responsive
*
* $raindrops_fluid_minimum_width
*
*/
if ( $is_IE ) {
preg_match( "|(MSIE )([0-9]{1,2})(\.)|si", $_SERVER[ 'HTTP_USER_AGENT' ], $regs );
if ( isset( $regs[ 2 ] ) && $regs[ 2 ] < 9 ) {
$raindrops_fluid_minimum_width = apply_filters( 'raindrops_fluid_minimum_width_lt_ie9', '640');
}
}
/**
* fluid page main column maximum width px
*
*
*
* $raindrops_fluid_maximum_width
*
*/
if ( !isset( $raindrops_fluid_maximum_width ) ) {
$raindrops_fluid_maximum_width = raindrops_warehouse_clone( 'raindrops_fluid_max_width' );
}
/**
*
*
*
* @since 1.127
*/
if ( !function_exists( 'raindrops_detect_display_none_condition' ) ) {
function raindrops_detect_display_none_condition() {
global $raindrops_where_display_none;
if ( !isset( $raindrops_where_display_none ) ) {
$raindrops_display_none_pages = array();
if ( raindrops_warehouse_clone( 'raindrops_entry_content_is_home' ) == 'none' ) {
$raindrops_display_none_pages[] = 'is_home';
}
if ( raindrops_warehouse_clone( 'raindrops_entry_content_is_category' ) == 'none' ) {
$raindrops_display_none_pages[] = 'is_category';
}
if ( raindrops_warehouse_clone( 'raindrops_entry_content_is_search' ) == 'none' ) {
$raindrops_display_none_pages[] = 'is_search';
}
$raindrops_where_display_none = $raindrops_display_none_pages;
}
if ( !empty( $raindrops_where_display_none ) && is_array( $raindrops_where_display_none ) ) {
foreach ( $raindrops_where_display_none as $excerpt ) {
if ( true == $excerpt() ) {
return true;
}
}
}
return false;
}
}
if ( !function_exists( 'raindrops_detect_excerpt_condition' ) ) {
function raindrops_detect_excerpt_condition() {
global $raindrops_where_excerpts, $post;
if ( !isset( $raindrops_where_excerpts ) ) {
$raindrops_excerpt_pages = array();
if ( raindrops_warehouse_clone( 'raindrops_entry_content_is_home' ) == 'excerpt' ) {
$raindrops_excerpt_pages[] = 'is_home';
}
if ( raindrops_warehouse_clone( 'raindrops_entry_content_is_category' ) == 'excerpt' ) {
$raindrops_excerpt_pages[] = 'is_category';
}
if ( raindrops_warehouse_clone( 'raindrops_entry_content_is_search' ) == 'excerpt' ) {
$raindrops_excerpt_pages[] = 'is_search';
}
$raindrops_where_excerpts = $raindrops_excerpt_pages;
}
if ( RAINDROPS_USE_LIST_EXCERPT !== true ) {
return false;
}
if ( !empty( $raindrops_where_excerpts ) ) {
foreach ( $raindrops_where_excerpts as $excerpt ) {
if ( true == $excerpt() ) {
return true;
}
}
}
return false;
}
}
if ( !defined( 'RAINDROPS_TABLE_TITLE' ) ) {
define( "RAINDROPS_TABLE_TITLE", 'options' );
}
if ( !defined( 'RAINDROPS_PLUGIN_TABLE' ) ) {
define( 'RAINDROPS_PLUGIN_TABLE', $wpdb->prefix . RAINDROPS_TABLE_TITLE );
}
if ( !isset( $raindrops_theme_settings ) ) {
$raindrops_theme_settings = get_option( 'raindrops_theme_settings', 'no' );
}
/**
* widget settings
*
* Registered Default Sidebar, Extra Sidebar, Sticky Widget, Footer Widget, Category Blog Widget
*
* @since 1.119 Widget label change from Category Blog Widget to Status Sidebar
*
*/
if ( !function_exists( 'raindrops_widgets_init' ) ) {
function raindrops_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Default Sidebar', 'Raindrops' ),
'id' => 'sidebar-1',
'before_widget' => '<li id="%1$s" class="%2$s widget default" '. raindrops_doctype_elements( '', 'tabindex="-1"', false ) . '>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle default h2"><span>',
'after_title' => '</span></h2>',
'widget_id' => 'default',
'widget_name' => 'default',
'text' => "1" ) );
register_sidebar( array(
'name' => esc_html__( 'Extra Sidebar', 'Raindrops' ),
'id' => 'sidebar-2',
'before_widget' => '<li id="%1$s" class="%2$s widget extra" '. raindrops_doctype_elements( '', 'tabindex="-1"', false ) . '>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle extra h2"><span>',
'after_title' => '</span></h2>',
'widget_id' => 'extra',
'widget_name' => 'extra',
'text' => "2" ) );
register_sidebar( array(
'name' => esc_html__( 'Sticky Widget', 'Raindrops' ),
'id' => 'sidebar-3',
'before_widget' => '<li id="%1$s" class="%2$s widget sticky-widget" '. raindrops_doctype_elements( '', 'tabindex="-1"', false ) . '>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle home-top-content h2"><span>',
'after_title' => '</span></h2>',
'widget_id' => 'toppage2',
'widget_name' => 'toppage2',
'text' => "3" ) );
register_sidebar( array(
'name' => esc_html__( 'Footer Widget', 'Raindrops' ),
'id' => 'sidebar-4',
'before_widget' => '<li id="%1$s" class="%2$s widget footer-widget" '. raindrops_doctype_elements( '', 'tabindex="-1"', false ) . '>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle footer-widget h2"><span>',
'after_title' => '</span></h2>',
'widget_id' => 'footer',
'widget_name' => 'footer',
'text' => "4" ) );
register_sidebar( array(
'name' => esc_html__( 'Post Format Status Sidebar', 'Raindrops' ),
'id' => 'sidebar-5',
'before_widget' => '<li id="%1$s" class="%2$s widget category-blog-widget status-side-bar" '. raindrops_doctype_elements( '', 'tabindex="-1"', false ) . '>',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle category-blog-widget h2 status-side-bar">',
'after_title' => '</h2>',
'widget_id' => 'categoryblog',
'widget_name' => 'categoryblog',
'text' => "5" ) );
}
}
/**
*
*
*
*
*
*/
if ( !isset( $raindrops_base_setting ) ) {
$raindrops_base_setting = $raindrops_base_setting_args;
}
/**
*
*
*
*
* @since 1.238
*/
if ( isset( $raindrops_base_font_size ) ) {
raindrops_update_theme_option( 'raindrops_basefont_settings', $raindrops_base_font_size );
}
/**
* @since 1.278
*/
if ( raindrops_warehouse_clone( 'raindrops_show_right_sidebar' ) == 'hide' ) {
$rsidebar_show = false;
} else {
$rsidebar_show = true;
}
if ( !isset( $raindrops_current_style_type ) ) {
$raindrops_current_style_type = raindrops_warehouse_clone( "raindrops_style_type" );
}
/**
* Content width setup
*
*
*
*
*
*/
if ( !isset( $content_width ) || empty( $content_width ) ) {
$content_width = raindrops_content_width_clone();
}
add_action( 'widgets_init', 'raindrops_widgets_init' );
/**
* Add option helper
*
*
*
*
*
*/
foreach ( $raindrops_base_setting as $setting ) {
$function_name = $setting[ 'option_name' ] . '_validate';
if ( !function_exists( $function_name ) ) {
$message = sprintf( esc_html__( 'If you add %s when you must create function %s for data validation', 'Raindrops' ), $setting[ 'option_name' ], $function_name );
printf( '<script type="text/javascript">alert( \'%s\' );</script>', $message );
return;
}
}
/**
* Extend body_class( )
*
*
* add browser class, languages class,
*
*
*/
if ( !function_exists( 'raindrops_add_body_class' ) ) {
function raindrops_add_body_class( $classes ) {
global $post, $current_blog, $raindrops_link_unique_text, $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $raindrops_browser_detection, $raindrops_status_bar, $raindrops_enable_keyboard, $raindrops_current_column;
$classes[] = get_locale();
if ( isset( $raindrops_status_bar ) || empty( $raindrops_status_bar ) ) {
$raindrops_status_bar = raindrops_warehouse_clone( 'raindrops_status_bar' );
}
if ( $raindrops_enable_keyboard == true && true !== $raindrops_link_unique_text ) {
$classes[] = 'enable-keyboard';
}
/**
* @since 1.289
*/
$classes[] = esc_attr( "rd-pw-" . raindrops_warehouse( 'raindrops_page_width' ) );
if( isset( $raindrops_current_column ) && !empty( $raindrops_current_column ) ) {
$classes[] = 'rd-col-'. $raindrops_current_column;
}
if ( is_single() || is_page() ) {
$raindrops_options = get_option( "raindrops_theme_settings" );
if ( isset( $raindrops_options[ "raindrops_style_type" ] ) && !empty( $raindrops_options[ "raindrops_style_type" ] ) ) {
$color_type = "rd-type-" . $raindrops_options[ "raindrops_style_type" ];
}
$raindrops_content_check = get_post( $post->ID );
$raindrops_content_check = $raindrops_content_check->post_content;
if ( preg_match( "!\[raindrops[^\]]+(color_type)=(\"|')*?([^\"' ]+)(\"|' )*?[^\]]*\]!si", $raindrops_content_check, $regs ) ) {
$color_type = "rd-type-" . trim( $regs[ 3 ] );
}
if ( preg_match( "!\[raindrops[^\]]+(col)=(\"|')*?([^\"' ]+)(\"|')*?[^\]]*\]!si", $raindrops_content_check, $regs ) ) {
$color_type .= ' ';
/** escaped 1.290 see line:794
* $color_type .= "rd-col-" . $regs[ 3 ];
*/
}
if ( !isset( $color_type ) ) { // When not using database
$color_type = "rd-type-" . raindrops_warehouse( 'raindrops_style_type' );
}
$classes[] = $color_type;
} else {
$raindrops_options = get_option( "raindrops_theme_settings" );
if ( isset( $raindrops_options[ "raindrops_style_type" ] ) && !empty( $raindrops_options[ "raindrops_style_type" ] ) ) {
$classes[] = "rd-type-" . $raindrops_options[ "raindrops_style_type" ];
} else {
$classes[] = "rd-type-" . raindrops_warehouse( 'raindrops_style_type' );
}
}
if ( true == $raindrops_browser_detection ) {
if ( isset( $_SERVER[ "HTTP_ACCEPT_LANGUAGE" ] ) ) {
$browser_lang = $_SERVER[ "HTTP_ACCEPT_LANGUAGE" ];
$browser_lang = explode( ",", $browser_lang );
$browser_lang = esc_html( $browser_lang[ 0 ] );
$browser_lang = 'accept-lang-' . $browser_lang;
$classes[] = $browser_lang;
}
switch ( true ) {
case ( $is_lynx ):
$classes[] = 'lynx';
break;
case ( $is_gecko ):
if ( preg_match( '!Trident/.*rv:([0-9]{1,}\.[\.0-9]{0,})!', $_SERVER[ 'HTTP_USER_AGENT' ], $regs ) ) {
$classes[] = 'ie' . (int) $regs[ 1 ];
} else {
$classes[] = 'gecko';
}
break;
case ( $is_IE ):
preg_match( "|(MSIE )([0-9]{1,2})(\.)|si", $_SERVER[ 'HTTP_USER_AGENT' ], $regs );
if ( isset( $regs[ 2 ] ) ) {
$classes[] = 'ie' . $regs[ 2 ];
}
break;
case ( $is_opera ):
$classes[] = 'opera';
break;
case ( $is_NS4 ):
$classes[] = 'ns4';
break;
case ( $is_safari ):
$classes[] = 'safari';
break;
case ( $is_chrome ):
$classes[] = 'chrome';
break;
case ( $is_iphone ):
$classes[] = 'iphone';
break;
default:
$classes[] = 'unknown2';
break;
}
}
if ( isset( $current_blog ) ) {
$classes[] = "b" . absint( $current_blog->blog_id );
}
if ( true == $raindrops_link_unique_text ) {
$classes[] = 'raindrops-accessible-mode';
}
if ( $raindrops_status_bar == true ) {
$classes[] = 'raindrops-status-bar-active';
}
return apply_filters( "raindrops_add_body_class", $classes );
}
}
/**
* wp_list_comments callback function
*
*
*
* comments.php
*
*/
if ( !function_exists( 'raindrops_comment' ) ) {
function raindrops_comment( $comment, $args, $depth ) {
$GLOBALS[ 'comment' ] = $comment;
if ( '' == $comment->comment_type ) {
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<div class="raindrops-comment-avatar">
<?php echo get_avatar( $comment, 32, '', esc_attr__( 'Avatar', 'Raindrops' ) . ' ' . esc_attr( strip_tags( get_comment_author_link() ) ) ); ?> </div>
<div class="raindrops-comment-author-meta">
<?php
printf( '%1$s <span class="says">%2$s</span>', sprintf( '<cite class="fn">%s</cite> ', get_comment_author_link() ), esc_html__( 'says:', 'Raindrops' ) );
?>
</div>
<div class="comment-meta commentmetadata clearfix">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( esc_html__( '%1$s at %2$s', 'Raindrops' ), get_comment_date(), get_comment_time() ); ?></a>
<?php
edit_comment_link( esc_html__( ' Edit ', 'Raindrops' ) . raindrops_link_unique( 'Comment', $comment->comment_ID ), ' ' );
?>
</div>
</div>
<!-- .comment-author .vcard -->
<?php
if ( '0' == $comment->comment_approved ) {
?>
<div class="clearfix awaiting"> <em><?php esc_html_e( 'Your comment is awaiting moderation.', 'Raindrops' ); ?></em>
<br />
</div>
<?php
} //endif
?>
<!-- .comment-meta .commentmetadata -->
<div class="comment-body">
<?php
comment_text();
?>
</div>
<div class="reply">
<?php
$raindrops_comment_reply_text = esc_html__( 'Reply', 'Raindrops' ) . raindrops_link_unique( 'Comment', $comment->comment_ID );
comment_reply_link( array_merge( $args, array( 'reply_text' => $raindrops_comment_reply_text, 'depth' => $depth, 'max_depth' => $args[ 'max_depth' ] ) ) );
?>
</div>
<!-- .reply -->
</div>
<!-- #comment-## -->
<?php
} else {
?>
<li class="post pingback">
<p>
<?php
esc_html_e( 'Pingback:', 'Raindrops' );
comment_author_link();
echo ' ';
edit_comment_link( esc_html__( ' Edit ', 'Raindrops' ) . raindrops_link_unique( 'Comment', $comment->comment_ID ), ' ' );
?>
</p>
<?php
} //endif
}
}
/**
* Template function posted in
*
*
*
* loop.php
*