Changeset 2489121
- Timestamp:
- 03/08/2021 12:23:44 AM (5 years ago)
- Location:
- live-blog-wp/trunk
- Files:
-
- 1 added
- 7 edited
-
acf/acf.php (modified) (1 diff)
-
customizer/customizer.php (modified) (41 diffs)
-
live-blog-wp.php (modified) (5 diffs)
-
readme.txt (modified) (4 diffs)
-
single-templates/alert.php (added)
-
single-templates/full-width.php (modified) (2 diffs)
-
single-templates/header.php (modified) (6 diffs)
-
single-templates/spinner.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
live-blog-wp/trunk/acf/acf.php
r2476538 r2489121 11 11 if( function_exists('acf_add_local_field_group') ): 12 12 13 acf_add_local_field_group(array( 14 'key' => 'group_602140b531b74', 15 'title' => 'Live Blog WP', 16 'fields' => array( 17 array( 18 'key' => 'field_6021413dc5343', 19 'label' => 'Attach to Post', 20 'name' => 'lbwp_attached_post', 21 'type' => 'post_object', 22 'instructions' => '', 23 'required' => 1, 24 'conditional_logic' => 0, 25 'wrapper' => array( 26 'width' => '', 27 'class' => '', 28 'id' => '', 29 ), 30 'post_type' => array( 31 0 => 'post', 32 ), 33 'taxonomy' => '', 34 'allow_null' => 1, 35 'multiple' => 0, 36 'return_format' => 'id', 37 'ui' => 1, 38 ), 39 array( 40 'key' => 'field_602402b41df9c', 41 'label' => 'Key Point', 42 'name' => 'lbwp_is_key_point', 43 'type' => 'true_false', 44 'instructions' => '', 45 'required' => 0, 46 'conditional_logic' => 0, 47 'wrapper' => array( 48 'width' => '', 49 'class' => '', 50 'id' => '', 51 ), 52 'message' => '', 53 'default_value' => 0, 54 'ui' => 1, 55 'ui_on_text' => '', 56 'ui_off_text' => '', 57 ), 58 ), 59 'location' => array( 60 array( 61 array( 62 'param' => 'post_type', 63 'operator' => '==', 64 'value' => 'lbwp_post', 65 ), 66 ), 67 ), 68 'menu_order' => 0, 69 'position' => 'side', 70 'style' => 'default', 71 'label_placement' => 'top', 72 'instruction_placement' => 'label', 73 'hide_on_screen' => '', 74 'active' => true, 75 'description' => 'Easy Live Blog Post Fields', 76 )); 13 acf_add_local_field_group(array( 14 'key' => 'group_602140b531b74', 15 'title' => 'Live Blog WP', 16 'fields' => array( 17 array( 18 'key' => 'field_6021413dc5343', 19 'label' => 'Attach to Post', 20 'name' => 'lbwp_attached_post', 21 'type' => 'post_object', 22 'instructions' => '', 23 'required' => 0, 24 'conditional_logic' => 0, 25 'wrapper' => array( 26 'width' => '', 27 'class' => '', 28 'id' => '', 29 ), 30 'post_type' => array( 31 0 => 'post', 32 ), 33 'taxonomy' => '', 34 'allow_null' => 1, 35 'multiple' => 0, 36 'return_format' => 'id', 37 'ui' => 1, 38 ), 39 array( 40 'key' => 'field_602402b41df9c', 41 'label' => 'Key Point', 42 'name' => 'lbwp_is_key_point', 43 'type' => 'true_false', 44 'instructions' => '', 45 'required' => 0, 46 'conditional_logic' => 0, 47 'wrapper' => array( 48 'width' => '', 49 'class' => '', 50 'id' => '', 51 ), 52 'message' => '', 53 'default_value' => 0, 54 'ui' => 1, 55 'ui_on_text' => '', 56 'ui_off_text' => '', 57 ), 58 ), 59 'location' => array( 60 array( 61 array( 62 'param' => 'post_type', 63 'operator' => '==', 64 'value' => 'lbwp_post', 65 ), 66 ), 67 ), 68 'menu_order' => 0, 69 'position' => 'side', 70 'style' => 'default', 71 'label_placement' => 'top', 72 'instruction_placement' => 'label', 73 'hide_on_screen' => '', 74 'active' => true, 75 'description' => 'Live Blog WP Post Fields', 76 )); 77 78 acf_add_local_field_group(array( 79 'key' => 'group_60315b5b1735c', 80 'title' => 'Live Blog WP', 81 'fields' => array( 82 array( 83 'key' => 'field_60315b929b829', 84 'label' => 'Pinned Post' . \Live_Blog_WP\Instance::instance()->pro_tag(), 85 'name' => 'lbwp_pinned_post', 86 'type' => 'post_object', 87 'instructions' => 'The pinned post is shown at the top the live blog feed, it updates at the same interval as the live blog but does not change position. It is a good place to show important information such as the current sports teams scores.', 88 'required' => 0, 89 'conditional_logic' => 0, 90 'wrapper' => array( 91 'width' => '', 92 'class' => '', 93 'id' => '', 94 ), 95 'post_type' => array( 96 0 => 'lbwp_post', 97 ), 98 'taxonomy' => '', 99 'allow_null' => 1, 100 'multiple' => 0, 101 'return_format' => 'id', 102 'ui' => 1, 103 ), 104 ), 105 'location' => array( 106 array( 107 array( 108 'param' => 'post_type', 109 'operator' => '==', 110 'value' => 'post', 111 ), 112 ), 113 ), 114 'menu_order' => 0, 115 'position' => 'normal', 116 'style' => 'default', 117 'label_placement' => 'top', 118 'instruction_placement' => 'label', 119 'hide_on_screen' => '', 120 'active' => true, 121 'description' => '', 122 )); 77 123 78 124 endif; -
live-blog-wp/trunk/customizer/customizer.php
r2481145 r2489121 17 17 'description' => __( 'Settings and options related to Live Blog WP.', 'lbwp'), 18 18 'capability' => 'edit_theme_options', 19 'priority' => 50000,19 'priority' => 9999, 20 20 ) ); 21 21 … … 28 28 'description' => __( 'Adjust how LIve Blog WP operates.', 'lbwp' ), 29 29 'panel' => 'lbwp_panel_main', 30 'priority' => 1 0,30 'priority' => 1, 31 31 )); 32 32 … … 40 40 $wp_customize->add_control( 'lbwp_options[single_template]', array( 41 41 'type' => 'select', 42 'priority' => 1 0,42 'priority' => 1, 43 43 'section' => 'lbwp_section_functionality', 44 44 'label' => __( 'Single Template', 'lbwp' ), … … 59 59 $wp_customize->add_control( 'lbwp_options[post_template]', array( 60 60 'type' => 'select', 61 'priority' => 20,61 'priority' => 1, 62 62 'section' => 'lbwp_section_functionality', 63 63 'label' => __( 'Post Template', 'lbwp' ), … … 78 78 $wp_customize->add_control( 'lbwp_options[get_posts_interval]', array( 79 79 'type' => 'number', 80 'priority' => 50,80 'priority' => 1, 81 81 'section' => 'lbwp_section_functionality', 82 82 'label' => __( 'Get Posts Interval (seconds)', 'lbwp' ), … … 93 93 $wp_customize->add_control( 'lbwp_options[step_offset]', array( 94 94 'type' => 'number', 95 'priority' => 55,95 'priority' => 1, 96 96 'section' => 'lbwp_section_functionality', 97 97 'label' => __( 'Step Offset', 'lbwp' ), … … 108 108 $wp_customize->add_control( 'lbwp_options[label_js_suffixAgo]', array( 109 109 'type' => 'text', 110 'priority' => 60,110 'priority' => 1, 111 111 'section' => 'lbwp_section_functionality', 112 112 'label' => __( 'Ago Text', 'lbwp' ), … … 123 123 $wp_customize->add_control( 'lbwp_options[label_js_seconds]', array( 124 124 'type' => 'text', 125 'priority' => 70,125 'priority' => 1, 126 126 'section' => 'lbwp_section_functionality', 127 127 'label' => __( 'Seconds Text', 'lbwp' ), … … 138 138 $wp_customize->add_control( 'lbwp_options[label_js_minute]', array( 139 139 'type' => 'text', 140 'priority' => 80,140 'priority' => 1, 141 141 'section' => 'lbwp_section_functionality', 142 142 'label' => __( 'Minute Text', 'lbwp' ), … … 153 153 $wp_customize->add_control( 'lbwp_options[label_js_minutes]', array( 154 154 'type' => 'text', 155 'priority' => 90,155 'priority' => 1, 156 156 'section' => 'lbwp_section_functionality', 157 157 'label' => __( 'Minutes Text', 'lbwp' ), … … 168 168 $wp_customize->add_control( 'lbwp_options[label_js_hour]', array( 169 169 'type' => 'text', 170 'priority' => 1 00,170 'priority' => 1, 171 171 'section' => 'lbwp_section_functionality', 172 172 'label' => __( 'Hour Text', 'lbwp' ), … … 183 183 $wp_customize->add_control( 'lbwp_options[label_js_hours]', array( 184 184 'type' => 'text', 185 'priority' => 1 10,185 'priority' => 1, 186 186 'section' => 'lbwp_section_functionality', 187 187 'label' => __( 'Hours Text', 'lbwp' ), … … 198 198 $wp_customize->add_control( 'lbwp_options[label_js_day]', array( 199 199 'type' => 'text', 200 'priority' => 1 20,200 'priority' => 1, 201 201 'section' => 'lbwp_section_functionality', 202 202 'label' => __( 'Day Text', 'lbwp' ), … … 213 213 $wp_customize->add_control( 'lbwp_options[label_js_days]', array( 214 214 'type' => 'text', 215 'priority' => 1 30,215 'priority' => 1, 216 216 'section' => 'lbwp_section_functionality', 217 217 'label' => __( 'Days Text', 'lbwp' ), … … 228 228 $wp_customize->add_control( 'lbwp_options[label_js_month]', array( 229 229 'type' => 'text', 230 'priority' => 1 40,230 'priority' => 1, 231 231 'section' => 'lbwp_section_functionality', 232 232 'label' => __( 'Month Text', 'lbwp' ), … … 243 243 $wp_customize->add_control( 'lbwp_options[label_js_months]', array( 244 244 'type' => 'text', 245 'priority' => 1 50,245 'priority' => 1, 246 246 'section' => 'lbwp_section_functionality', 247 247 'label' => __( 'Months Text', 'lbwp' ), … … 258 258 $wp_customize->add_control( 'lbwp_options[label_js_year]', array( 259 259 'type' => 'text', 260 'priority' => 1 60,260 'priority' => 1, 261 261 'section' => 'lbwp_section_functionality', 262 262 'label' => __( 'Year Text', 'lbwp' ), … … 273 273 $wp_customize->add_control( 'lbwp_options[label_js_years]', array( 274 274 'type' => 'text', 275 'priority' => 1 70,275 'priority' => 1, 276 276 'section' => 'lbwp_section_functionality', 277 277 'label' => __( 'Years Text', 'lbwp' ), … … 287 287 'description' => __( 'Adjust how Live Blog WP spinner operates.', 'lbwp' ), 288 288 'panel' => 'lbwp_panel_main', 289 'priority' => 20,289 'priority' => 1, 290 290 )); 291 291 … … 301 301 'label' => __( 'Color', 'lbwp' ), 302 302 'section' => 'lbwp_section_spinner', 303 'priority' => 1 0303 'priority' => 1 304 304 ) ) 305 305 ); … … 314 314 $wp_customize->add_control( 'lbwp_options[spinner_size]', array( 315 315 'type' => 'number', 316 'priority' => 20,316 'priority' => 1, 317 317 'section' => 'lbwp_section_spinner', 318 318 'label' => __( 'Size', 'lbwp' ), … … 327 327 'description' => __( 'Adjust how Live Blog WP toolbar operates.', 'lbwp' ), 328 328 'panel' => 'lbwp_panel_main', 329 'priority' => 30,329 'priority' => 1, 330 330 )); 331 331 … … 358 358 $wp_customize->add_control( 'lbwp_options[support_blog_page]', array( 359 359 'type' => 'dropdown-pages', 360 'priority' => 2,360 'priority' => 1, 361 361 'section' => 'lbwp_section_toolbar', 362 362 'label' => __( 'Support Blog Page', 'lbwp' ), … … 373 373 $wp_customize->add_control( 'lbwp_options[support_blog_text]', array( 374 374 'type' => 'text', 375 'priority' => 3,375 'priority' => 1, 376 376 'section' => 'lbwp_section_toolbar', 377 377 'label' => __( 'Support Blog Text', 'lbwp' ), … … 390 390 'label' => __( 'Background Color', 'lbwp' ), 391 391 'section' => 'lbwp_section_toolbar', 392 'priority' => 1 0392 'priority' => 1 393 393 ) ) 394 394 ); … … 405 405 'label' => __( 'Icon Color', 'lbwp' ), 406 406 'section' => 'lbwp_section_toolbar', 407 'priority' => 20407 'priority' => 1 408 408 ) ) 409 409 ); … … 420 420 'label' => __( 'Icon Hover Color', 'lbwp' ), 421 421 'section' => 'lbwp_section_toolbar', 422 'priority' => 30422 'priority' => 1 423 423 ) ) 424 424 ); … … 433 433 $wp_customize->add_control( 'lbwp_options[toolbar_icon_size]', array( 434 434 'type' => 'number', 435 'priority' => 35,435 'priority' => 1, 436 436 'section' => 'lbwp_section_toolbar', 437 437 'label' => __( 'Icon Size', 'lbwp' ), … … 449 449 'label' => __( 'Border Color', 'lbwp' ), 450 450 'section' => 'lbwp_section_toolbar', 451 'priority' => 40451 'priority' => 1 452 452 ) ) 453 453 ); … … 462 462 $wp_customize->add_control( 'lbwp_options[toolbar_border_width]', array( 463 463 'type' => 'number', 464 'priority' => 50,464 'priority' => 1, 465 465 'section' => 'lbwp_section_toolbar', 466 466 'label' => __( 'Border Width (px)', 'lbwp' ), … … 476 476 $wp_customize->add_control( 'lbwp_options[toolbar_padding]', array( 477 477 'type' => 'number', 478 'priority' => 60,478 'priority' => 1, 479 479 'section' => 'lbwp_section_toolbar', 480 480 'label' => __( 'Padding (px)', 'lbwp' ), … … 490 490 $wp_customize->add_control( 'lbwp_options[toolbar_box_shadow]', array( 491 491 'type' => 'select', 492 'priority' => 80,492 'priority' => 1, 493 493 'section' => 'lbwp_section_toolbar', 494 494 'label' => __( 'Box Shadow', 'lbwp' ), … … 510 510 $wp_customize->add_control( 'lbwp_options[toolbar_z_index]', array( 511 511 'type' => 'number', 512 'priority' => 90,512 'priority' => 1, 513 513 'section' => 'lbwp_section_toolbar', 514 514 'label' => __( 'Z Index', 'lbwp' ), … … 524 524 $wp_customize->add_control( 'lbwp_options[toolbar_offset]', array( 525 525 'type' => 'number', 526 'priority' => 1 00,526 'priority' => 1, 527 527 'section' => 'lbwp_section_toolbar', 528 528 'label' => __( 'Offset', 'lbwp' ), … … 538 538 $wp_customize->add_control( 'lbwp_options[toolbar_new_text]', array( 539 539 'type' => 'text', 540 'priority' => 1 05,540 'priority' => 1, 541 541 'section' => 'lbwp_section_toolbar', 542 542 'label' => __( 'New Text', 'lbwp' ), … … 552 552 $wp_customize->add_control( 'lbwp_options[toolbar_new_text_size]', array( 553 553 'type' => 'number', 554 'priority' => 1 06,554 'priority' => 1, 555 555 'section' => 'lbwp_section_toolbar', 556 556 'label' => __( 'New Text Size (px)', 'lbwp' ), … … 562 562 563 563 $wp_customize->add_section( 'lbwp_section_points', array( 564 'title' => __( ' KeyPoints' . \Live_Blog_WP\Instance::instance()->pro_tag(), 'lbwp' ),564 'title' => __( 'Points' . \Live_Blog_WP\Instance::instance()->pro_tag(), 'lbwp' ), 565 565 'description' => __( 'Adjust how Live Blog WP key points operate.', 'lbwp' ), 566 566 'panel' => 'lbwp_panel_main', 567 'priority' => 40,567 'priority' => 1, 568 568 )); 569 569 … … 662 662 ) ); 663 663 664 $wp_customize->add_setting( 'lbwp_options[points_columns]', array( 665 'type' => 'option', 666 'capability' => 'manage_options', 667 'default' => 'uk-child-width-1-3@m', 668 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 669 ) ); 670 671 $wp_customize->add_control( 'lbwp_options[points_columns]', array( 672 'type' => 'select', 673 'priority' => 1, 674 'section' => 'lbwp_section_points', 675 'label' => __( 'Full Width Columns', 'lbwp' ), 676 'choices' => array( 677 'uk-child-width-1-1@m' => __( '1', 'lbwp' ), 678 'uk-child-width-1-2@m' => __( '2', 'lbwp' ), 679 'uk-child-width-1-3@m' => __( '3', 'lbwp' ), 680 'uk-child-width-1-4@m' => __( '4', 'lbwp' ), 681 ) 682 ) ); 683 664 684 $wp_customize->add_setting( 'lbwp_options[points_time_color]', array( 665 685 'type' => 'option', … … 719 739 'section' => 'lbwp_section_points', 720 740 'label' => __( 'Link Tag', 'lbwp' ), 741 'choices' => array( 742 'div' => __( 'DIV', 'lbwp' ), 743 'p' => __( 'P', 'lbwp' ), 744 'h1' => __( 'H1', 'lbwp' ), 745 'h2' => __( 'H2', 'lbwp' ), 746 'h3' => __( 'H3', 'lbwp' ), 747 'h4' => __( 'H4','lbwp' ), 748 'h5' => __( 'H5', 'lbwp' ), 749 'h6' => __( 'H6', 'lbwp' ), 750 ) 751 ) ); 752 753 $wp_customize->add_setting( 'lbwp_options[points_margin_bottom]', array( 754 'type' => 'option', 755 'capability' => 'manage_options', 756 'default' => '5', 757 'sanitize_callback' => 'absint', 758 )); 759 760 $wp_customize->add_control( 'lbwp_options[points_margin_bottom]', array( 761 'type' => 'number', 762 'priority' => 1, 763 'section' => 'lbwp_section_points', 764 'label' => __( 'Point Margin Bottom (px)', 'lbwp' ), 765 )); 766 767 $wp_customize->add_setting( 'lbwp_options[points_wrap_margin_bottom]', array( 768 'type' => 'option', 769 'capability' => 'manage_options', 770 'default' => '15', 771 'sanitize_callback' => 'absint', 772 )); 773 774 $wp_customize->add_control( 'lbwp_options[points_wrap_margin_bottom]', array( 775 'type' => 'number', 776 'priority' => 1, 777 'section' => 'lbwp_section_points', 778 'label' => __( 'Wrap Margin Bottom (px)', 'lbwp' ), 779 )); 780 781 /* 782 * SECTION: Alert 783 */ 784 785 $wp_customize->add_section( 'lbwp_section_alert', array( 786 'title' => __( 'Alert', 'lbwp' ), 787 'description' => __( 'Adjust how Live Blog WP key points operate.', 'lbwp' ), 788 'panel' => 'lbwp_panel_main', 789 'priority' => 1, 790 )); 791 792 $wp_customize->add_setting( 'lbwp_options[show_alert]', array( 793 'type' => 'option', 794 'capability' => 'manage_options', 795 'default' => '1', 796 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 797 ) ); 798 799 $wp_customize->add_control( 'lbwp_options[show_alert]', array( 800 'type' => 'select', 801 'priority' => 1, 802 'section' => 'lbwp_section_alert', 803 'label' => __( 'Show Alert', 'lbwp' ), 804 'description' => __( 'Show the new posts alert on the page.', 'lbwp' ), 805 'choices' => array( 806 '1' => __( 'Yes', 'lbwp' ), 807 '0' => __( 'No', 'lbwp' ), 808 ) 809 ) ); 810 811 $wp_customize->add_setting( 'lbwp_options[force_show_alert]', array( 812 'type' => 'option', 813 'capability' => 'manage_options', 814 'default' => '0', 815 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 816 ) ); 817 818 $wp_customize->add_control( 'lbwp_options[force_show_alert]', array( 819 'type' => 'select', 820 'priority' => 1, 821 'section' => 'lbwp_section_alert', 822 'label' => __( 'Force Show Alert', 'lbwp' ), 823 'description' => __( 'Force the alert to show to make styling easier.', 'lbwp' ), 824 'choices' => array( 825 '1' => __( 'Yes', 'lbwp' ), 826 '0' => __( 'No', 'lbwp' ), 827 ) 828 ) ); 829 830 $wp_customize->add_setting( 'lbwp_options[alert_text]', array( 831 'type' => 'option', 832 'capability' => 'manage_options', 833 'default' => 'NEW POSTS', 834 'sanitize_callback' => 'wp_filter_nohtml_kses', 835 )); 836 837 $wp_customize->add_control( 'lbwp_options[alert_text]', array( 838 'type' => 'text', 839 'priority' => 1, 840 'section' => 'lbwp_section_alert', 841 'label' => __( 'Alert Text', 'lbwp' ), 842 )); 843 844 $wp_customize->add_setting( 'lbwp_options[alert_tag]', array( 845 'type' => 'option', 846 'capability' => 'manage_options', 847 'default' => 'div', 848 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 849 ) ); 850 851 $wp_customize->add_control( 'lbwp_options[alert_tag]', array( 852 'type' => 'select', 853 'priority' => 1, 854 'section' => 'lbwp_section_alert', 855 'label' => __( 'Text Tag', 'lbwp' ), 856 'choices' => array( 857 'div' => __( 'DIV', 'lbwp' ), 858 'p' => __( 'P', 'lbwp' ), 859 'h1' => __( 'H1', 'lbwp' ), 860 'h2' => __( 'H2', 'lbwp' ), 861 'h3' => __( 'H3', 'lbwp' ), 862 'h4' => __( 'H4','lbwp' ), 863 'h5' => __( 'H5', 'lbwp' ), 864 'h6' => __( 'H6', 'lbwp' ), 865 ) 866 ) ); 867 868 $wp_customize->add_setting( 'lbwp_options[alert_background_color]', array( 869 'type' => 'option', 870 'capability' => 'manage_options', 871 'sanitize_callback' => 'sanitize_hex_color', 872 'default' => '#ffffff', 873 ) ); 874 875 $wp_customize->add_control( 876 new \WP_Customize_Color_Control( $wp_customize, 'lbwp_options[alert_background_color]', array( 877 'label' => __( 'Background Color', 'lbwp' ), 878 'section' => 'lbwp_section_alert', 879 'priority' => 1 880 ) ) 881 ); 882 883 $wp_customize->add_setting( 'lbwp_options[alert_text_color]', array( 884 'type' => 'option', 885 'capability' => 'manage_options', 886 'sanitize_callback' => 'sanitize_hex_color', 887 'default' => '#000000', 888 ) ); 889 890 $wp_customize->add_control( 891 new \WP_Customize_Color_Control( $wp_customize, 'lbwp_options[alert_text_color]', array( 892 'label' => __( 'Text Color', 'lbwp' ), 893 'section' => 'lbwp_section_alert', 894 'priority' => 1 895 ) ) 896 ); 897 898 $wp_customize->add_setting( 'lbwp_options[alert_text_hover_color]', array( 899 'type' => 'option', 900 'capability' => 'manage_options', 901 'sanitize_callback' => 'sanitize_hex_color', 902 'default' => '#000000', 903 ) ); 904 905 $wp_customize->add_control( 906 new \WP_Customize_Color_Control( $wp_customize, 'lbwp_options[alert_text_hover_color]', array( 907 'label' => __( 'Text Hover Color', 'lbwp' ), 908 'section' => 'lbwp_section_alert', 909 'priority' => 1 910 ) ) 911 ); 912 913 $wp_customize->add_setting( 'lbwp_options[alert_border_color]', array( 914 'type' => 'option', 915 'capability' => 'manage_options', 916 'sanitize_callback' => 'sanitize_hex_color', 917 'default' => '#000000', 918 ) ); 919 920 $wp_customize->add_control( 921 new \WP_Customize_Color_Control( $wp_customize, 'lbwp_options[alert_border_color]', array( 922 'label' => __( 'Border Color', 'lbwp' ), 923 'section' => 'lbwp_section_alert', 924 'priority' => 1 925 ) ) 926 ); 927 928 $wp_customize->add_setting( 'lbwp_options[alert_border_width]', array( 929 'type' => 'option', 930 'capability' => 'manage_options', 931 'default' => '1', 932 'sanitize_callback' => 'absint', 933 )); 934 935 $wp_customize->add_control( 'lbwp_options[alert_border_width]', array( 936 'type' => 'number', 937 'priority' => 1, 938 'section' => 'lbwp_section_alert', 939 'label' => __( 'Border Width (px)', 'lbwp' ), 940 )); 941 942 $wp_customize->add_setting( 'lbwp_options[alert_top_bottom_padding]', array( 943 'type' => 'option', 944 'capability' => 'manage_options', 945 'default' => '10', 946 'sanitize_callback' => 'absint', 947 )); 948 949 $wp_customize->add_control( 'lbwp_options[alert_top_bottom_padding]', array( 950 'type' => 'number', 951 'priority' => 1, 952 'section' => 'lbwp_section_alert', 953 'label' => __( 'Top / Bottom Padding (px)', 'lbwp' ), 954 )); 955 956 $wp_customize->add_setting( 'lbwp_options[alert_left_right_padding]', array( 957 'type' => 'option', 958 'capability' => 'manage_options', 959 'default' => '20', 960 'sanitize_callback' => 'absint', 961 )); 962 963 $wp_customize->add_control( 'lbwp_options[alert_left_right_padding]', array( 964 'type' => 'number', 965 'priority' => 1, 966 'section' => 'lbwp_section_alert', 967 'label' => __( 'Left / Right Padding (px)', 'lbwp' ), 968 )); 969 970 $wp_customize->add_setting( 'lbwp_options[alert_box_shadow]', array( 971 'type' => 'option', 972 'capability' => 'manage_options', 973 'default' => '0', 974 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 975 ) ); 976 977 $wp_customize->add_control( 'lbwp_options[alert_box_shadow]', array( 978 'type' => 'select', 979 'priority' => 1, 980 'section' => 'lbwp_section_alert', 981 'label' => __( 'Box Shadow', 'lbwp' ), 982 'choices' => array( 983 '0' => __( 'None', 'lbwp' ), 984 'uk-box-shadow-small' => __( 'Small', 'lbwp' ), 985 'uk-box-shadow-medium' => __( 'Medium', 'lbwp' ), 986 'uk-box-shadow-large' => __( 'Large', 'lbwp' ), 987 ) 988 ) ); 989 990 $wp_customize->add_setting( 'lbwp_options[alert_position]', array( 991 'type' => 'option', 992 'capability' => 'manage_options', 993 'default' => 'uk-position-bottom-right', 994 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 995 ) ); 996 997 $wp_customize->add_control( 'lbwp_options[alert_position]', array( 998 'type' => 'select', 999 'priority' => 1, 1000 'section' => 'lbwp_section_alert', 1001 'label' => __( 'Position', 'lbwp' ), 1002 'choices' => array( 1003 'uk-position-bottom-left' => __( 'Bottom Left', 'lbwp' ), 1004 'uk-position-bottom-right' => __( 'Bottom Right', 'lbwp' ), 1005 'uk-position-bottom-center' => __( 'Bottom Center', 'lbwp' ), 1006 'uk-position-top-left' => __( 'Top Left', 'lbwp' ), 1007 'uk-position-top-right' => __( 'Top Right', 'lbwp' ), 1008 'uk-position-top-center' => __( 'Top Center', 'lbwp' ), 1009 ) 1010 ) ); 1011 1012 /* 1013 * SECTION: Tab 1014 */ 1015 1016 $wp_customize->add_section( 'lbwp_section_tab', array( 1017 'title' => __( 'Tab' . \Live_Blog_WP\Instance::instance()->pro_tag(), 'lbwp' ), 1018 'description' => __( 'Adjust how Live Blog tab operates.', 'lbwp' ), 1019 'panel' => 'lbwp_panel_main', 1020 'priority' => 1, 1021 )); 1022 1023 $wp_customize->add_setting( 'lbwp_options[tab_text]', array( 1024 'type' => 'option', 1025 'capability' => 'manage_options', 1026 'default' => '(NEW POSTS)', 1027 'sanitize_callback' => 'wp_filter_nohtml_kses', 1028 )); 1029 1030 $wp_customize->add_control( 'lbwp_options[tab_text]', array( 1031 'type' => 'text', 1032 'priority' => 1, 1033 'section' => 'lbwp_section_tab', 1034 'label' => __( 'Tab Text', 'lbwp' ), 1035 )); 1036 1037 /* 1038 * SECTION: Pinned Post 1039 */ 1040 1041 $wp_customize->add_section( 'lbwp_section_pinned', array( 1042 'title' => __( 'Pinned', 'lbwp' ), 1043 'description' => __( 'Adjust how Live Blog pinned post operates.', 'lbwp' ), 1044 'panel' => 'lbwp_panel_main', 1045 'priority' => 1, 1046 )); 1047 1048 $wp_customize->add_setting( 'lbwp_options[show_pinned]', array( 1049 'type' => 'option', 1050 'capability' => 'manage_options', 1051 'default' => '0', 1052 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 1053 ) ); 1054 1055 $wp_customize->add_control( 'lbwp_options[show_pinned]', array( 1056 'type' => 'select', 1057 'priority' => 1, 1058 'section' => 'lbwp_section_pinned', 1059 'label' => __( 'Show Pinned Post', 'lbwp' ), 1060 'description' => __( 'Show the pinned post at the top of the feed.', 'lbwp' ), 1061 'choices' => array( 1062 '1' => __( 'Yes', 'lbwp' ), 1063 '0' => __( 'No', 'lbwp' ), 1064 ) 1065 ) ); 1066 1067 $wp_customize->add_setting( 'lbwp_options[pinned_margin_bottom]', array( 1068 'type' => 'option', 1069 'capability' => 'manage_options', 1070 'default' => '20', 1071 'sanitize_callback' => 'absint', 1072 )); 1073 1074 $wp_customize->add_control( 'lbwp_options[pinned_margin_bottom]', array( 1075 'type' => 'number', 1076 'priority' => 1, 1077 'section' => 'lbwp_section_pinned', 1078 'label' => __( 'Margin Bottom (px)', 'lbwp' ), 1079 )); 1080 1081 /* 1082 * SECTION: Card Templates 1083 */ 1084 1085 $wp_customize->add_section( 'lbwp_section_template_card_1', array( 1086 'title' => __( 'Template: Cards', 'lbwp' ), 1087 'description' => __( 'Adjust how Live Blog WP Card template operates.', 'lbwp' ), 1088 'panel' => 'lbwp_panel_main', 1089 'priority' => 1, 1090 )); 1091 1092 $wp_customize->add_setting( 'lbwp_options[template_card_1_avatars]', array( 1093 'type' => 'option', 1094 'capability' => 'manage_options', 1095 'default' => '1', 1096 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 1097 ) ); 1098 1099 $wp_customize->add_control( 'lbwp_options[template_card_1_avatars]', array( 1100 'type' => 'select', 1101 'priority' => 1, 1102 'section' => 'lbwp_section_template_card_1', 1103 'label' => __( 'Show Avatars', 'lbwp' ), 1104 'choices' => array( 1105 '1' => __( 'Yes', 'lbwp' ), 1106 '0' => __( 'No', 'lbwp' ) 1107 ) 1108 ) ); 1109 1110 $wp_customize->add_setting( 'lbwp_options[template_card_1_authors]', array( 1111 'type' => 'option', 1112 'capability' => 'manage_options', 1113 'default' => '1', 1114 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 1115 ) ); 1116 1117 $wp_customize->add_control( 'lbwp_options[template_card_1_authors]', array( 1118 'type' => 'select', 1119 'priority' => 1, 1120 'section' => 'lbwp_section_template_card_1', 1121 'label' => __( 'Show Authors', 'lbwp' ), 1122 'choices' => array( 1123 '1' => __( 'Yes', 'lbwp' ), 1124 '0' => __( 'No', 'lbwp' ) 1125 ) 1126 ) ); 1127 1128 $wp_customize->add_setting( 'lbwp_options[template_card_1_author_prefix]', array( 1129 'type' => 'option', 1130 'capability' => 'manage_options', 1131 'default' => '', 1132 'sanitize_callback' => 'wp_filter_nohtml_kses', 1133 )); 1134 1135 $wp_customize->add_control( 'lbwp_options[template_card_1_author_prefix]', array( 1136 'type' => 'text', 1137 'priority' => 1, 1138 'section' => 'lbwp_section_template_card_1', 1139 'label' => __( 'Author Prefix Text', 'lbwp' ), 1140 )); 1141 1142 $wp_customize->add_setting( 'lbwp_options[template_card_1_headings]', array( 1143 'type' => 'option', 1144 'capability' => 'manage_options', 1145 'default' => '0', 1146 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 1147 ) ); 1148 1149 $wp_customize->add_control( 'lbwp_options[template_card_1_headings]', array( 1150 'type' => 'select', 1151 'priority' => 1, 1152 'section' => 'lbwp_section_template_card_1', 1153 'label' => __( 'Show Headings', 'lbwp' ), 1154 'choices' => array( 1155 '1' => __( 'Yes', 'lbwp' ), 1156 '0' => __( 'No', 'lbwp' ) 1157 ) 1158 ) ); 1159 1160 $wp_customize->add_setting( 'lbwp_options[template_card_1_heading_tag]', array( 1161 'type' => 'option', 1162 'capability' => 'manage_options', 1163 'default' => 'h4', 1164 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select', 1165 ) ); 1166 1167 $wp_customize->add_control( 'lbwp_options[template_card_1_heading_tag]', array( 1168 'type' => 'select', 1169 'priority' => 1, 1170 'section' => 'lbwp_section_template_card_1', 1171 'label' => __( 'Heading Tag', 'lbwp' ), 721 1172 'choices' => array( 722 1173 'div' => __( 'DIV', 'lbwp' ), … … 730 1181 ) ); 731 1182 732 $wp_customize->add_setting( 'lbwp_options[points_margin_bottom]', array(733 'type' => 'option',734 'capability' => 'manage_options',735 'default' => '5',736 'sanitize_callback' => 'absint',737 ));738 739 $wp_customize->add_control( 'lbwp_options[points_margin_bottom]', array(740 'type' => 'number',741 'priority' => 1,742 'section' => 'lbwp_section_points',743 'label' => __( 'Point Margin Bottom (px)', 'lbwp' ),744 ));745 746 $wp_customize->add_setting( 'lbwp_options[points_wrap_margin_bottom]', array(747 'type' => 'option',748 'capability' => 'manage_options',749 'default' => '15',750 'sanitize_callback' => 'absint',751 ));752 753 $wp_customize->add_control( 'lbwp_options[points_wrap_margin_bottom]', array(754 'type' => 'number',755 'priority' => 1,756 'section' => 'lbwp_section_points',757 'label' => __( 'Wrap Margin Bottom (px)', 'lbwp' ),758 ));759 760 /*761 * SECTION: Card Templates762 */763 764 $wp_customize->add_section( 'lbwp_section_template_card_1', array(765 'title' => __( 'Template: Cards', 'lbwp' ),766 'description' => __( 'Adjust how Live Blog WP Card template operates.', 'lbwp' ),767 'panel' => 'lbwp_panel_main',768 'priority' => 50,769 ));770 771 $wp_customize->add_setting( 'lbwp_options[template_card_1_avatars]', array(772 'type' => 'option',773 'capability' => 'manage_options',774 'default' => '1',775 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select',776 ) );777 778 $wp_customize->add_control( 'lbwp_options[template_card_1_avatars]', array(779 'type' => 'select',780 'priority' => 1,781 'section' => 'lbwp_section_template_card_1',782 'label' => __( 'Show Avatars', 'lbwp' ),783 'choices' => array(784 '1' => __( 'Yes', 'lbwp' ),785 '0' => __( 'No', 'lbwp' )786 )787 ) );788 789 $wp_customize->add_setting( 'lbwp_options[template_card_1_authors]', array(790 'type' => 'option',791 'capability' => 'manage_options',792 'default' => '1',793 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select',794 ) );795 796 $wp_customize->add_control( 'lbwp_options[template_card_1_authors]', array(797 'type' => 'select',798 'priority' => 1,799 'section' => 'lbwp_section_template_card_1',800 'label' => __( 'Show Authors', 'lbwp' ),801 'choices' => array(802 '1' => __( 'Yes', 'lbwp' ),803 '0' => __( 'No', 'lbwp' )804 )805 ) );806 807 $wp_customize->add_setting( 'lbwp_options[template_card_1_author_prefix]', array(808 'type' => 'option',809 'capability' => 'manage_options',810 'default' => '',811 'sanitize_callback' => 'wp_filter_nohtml_kses',812 ));813 814 $wp_customize->add_control( 'lbwp_options[template_card_1_author_prefix]', array(815 'type' => 'text',816 'priority' => 60,817 'section' => 'lbwp_section_template_card_1',818 'label' => __( 'Author Prefix Text', 'lbwp' ),819 ));820 821 $wp_customize->add_setting( 'lbwp_options[template_card_1_headings]', array(822 'type' => 'option',823 'capability' => 'manage_options',824 'default' => '0',825 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select',826 ) );827 828 $wp_customize->add_control( 'lbwp_options[template_card_1_headings]', array(829 'type' => 'select',830 'priority' => 1,831 'section' => 'lbwp_section_template_card_1',832 'label' => __( 'Show Headings', 'lbwp' ),833 'choices' => array(834 '1' => __( 'Yes', 'lbwp' ),835 '0' => __( 'No', 'lbwp' )836 )837 ) );838 839 $wp_customize->add_setting( 'lbwp_options[template_card_1_heading_tag]', array(840 'type' => 'option',841 'capability' => 'manage_options',842 'default' => 'h4',843 'sanitize_callback' => '\Live_Blog_WP\Customizer\Customizer::sanitize_select',844 ) );845 846 $wp_customize->add_control( 'lbwp_options[template_card_1_heading_tag]', array(847 'type' => 'select',848 'priority' => 1,849 'section' => 'lbwp_section_template_card_1',850 'label' => __( 'Heading Tag', 'lbwp' ),851 'choices' => array(852 'div' => __( 'DIV', 'lbwp' ),853 'h1' => __( 'H1', 'lbwp' ),854 'h2' => __( 'H2', 'lbwp' ),855 'h3' => __( 'H3', 'lbwp' ),856 'h4' => __( 'H4','lbwp' ),857 'h5' => __( 'H5', 'lbwp' ),858 'h6' => __( 'H6', 'lbwp' ),859 )860 ) );861 862 1183 $wp_customize->add_setting( 'lbwp_options[template_card_1_background_color]', array( 863 1184 'type' => 'option', … … 1062 1383 1063 1384 public static function sanitize_select( $input, $setting ) { 1064 $input = sanitize_ key($input);1385 $input = sanitize_text_field($input); 1065 1386 $choices = $setting->manager->get_control( $setting->id )->choices; 1066 1387 return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); -
live-blog-wp/trunk/live-blog-wp.php
r2481147 r2489121 4 4 * Description: Turn any post into a real time auto updating live blog. 5 5 * Plugin URI: https://liveblogwp.com 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: Live Blog WP 8 8 * Text Domain: lbwp … … 25 25 * Holds the plugins current version 26 26 */ 27 const VERSION = '1.0. 3';27 const VERSION = '1.0.4'; 28 28 29 29 /* … … 269 269 $return['html'] = ''; 270 270 $return['points_html'] = ''; 271 $return['pinned_html'] = ''; 271 272 $return['has_new'] = false; 272 273 $return['new_count'] = 0; … … 288 289 289 290 /* 291 * Check for pinned html 292 */ 293 294 if ( $pinned_post = get_field( 'lbwp_pinned_post', $parent_id ) ) { 295 296 $return['pinned_html'] = apply_filters( 'the_content', get_the_content( '', false, $pinned_post ) ); 297 298 } 299 300 /* 290 301 * Get any new posts since last check 291 302 */ … … 506 517 padding-top: 20px; 507 518 } 508 </style> 509 510 <?php 511 512 } 513 514 515 /* 516 * Holds the defaults customizer options if they dont exist. 517 */ 518 public function get_options( $option_name = '' ) { 519 520 $defaults = array( 521 'single_template' => 'full_width', 522 'post_template' => 'card_1', 523 'show_toolbar' => '1', 524 'support_blog_page' => false, 525 'support_blog_text' => 'SUPPORT', 526 'get_posts_interval' => 60, 527 'step_offset' => 65, 528 'label_js_suffixAgo' => 'ago', 529 'label_js_seconds' => 'less than a minute', 530 'label_js_minute' => 'about a minute', 531 'label_js_minutes' => '%d minutes', 532 'label_js_hour' => 'about an hour', 533 'label_js_hours' => 'about %d hours', 534 'label_js_day' => 'about a day', 535 'label_js_days' => '%d days', 536 'label_js_month' => 'about a month', 537 'label_js_months' => '%d months', 538 'label_js_year' => 'about a year', 539 'label_js_years' => '%d years', 540 'toolbar_background_color' => '#1e87f0', 541 'toolbar_icon_color' => '#ffffff', 542 'toolbar_icon_hover_color' => '#e5e5e5', 543 'toolbar_icon_size' => '1.2', 544 'toolbar_border_color' => '#1e87f0', 545 'toolbar_border_width' => '0', 546 'toolbar_padding' => '15', 547 'toolbar_box_shadow' => '0', 548 'toolbar_z_index' => '980', 549 'toolbar_offset' => '0', 550 'toolbar_new_text' => 'NEW POSTS', 551 'toolbar_new_text_size' => '18', 552 'spinner_color' => '#1e87f0', 553 'spinner_size' => '2', 554 'show_points' => '1', 555 'show_points_heading' => '1', 556 'show_points_time' => '1', 557 'points_text' => 'Key Points', 558 'points_heading_tag' => 'h4', 559 'points_link_tag' => 'h5', 560 'points_time_color' => '#000000', 561 'points_link_color' => '#1e87f0', 562 'points_link_hover_color' => '#1e87f0', 563 'points_margin_bottom' => '5', 564 'points_wrap_margin_bottom' => '15', 565 'template_card_1_avatars' => '1', 566 'template_card_1_authors' => '1', 567 'template_card_1_author_prefix' => '', 568 'template_card_1_headings' => '0', 569 'template_card_1_heading_tag' => 'h4', 570 'template_card_1_background_color' => '#ffffff', 571 'template_card_1_border_color' => '#ffffff', 572 'template_card_1_border_width' => '0', 573 'template_card_1_icon_color' => '#000000', 574 'template_card_1_icon_hover_color' => '#1e87f0', 575 'template_card_1_icon_size' => '1.2', 576 'template_card_1_time_color' => '#000000', 577 'template_card_1_author_color' => '#000000', 578 'template_card_1_box_shadow' => '0', 579 'template_card_1_padding' => '0', 580 'template_card_1_margin_bottom' => '20', 581 'template_card_1_time_size' => '14', 582 'template_card_1_author_size' => '14', 583 584 ); 585 586 return wp_parse_args( get_option( 'lbwp_options' ), $defaults ); 587 588 } 589 590 /* 591 * Warning when the site doesn't have a minimum required PHP version. 592 */ 593 public function admin_notice_minimum_php_version() { 594 595 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 596 597 $message = sprintf( 598 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 599 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'lbwp' ), 600 '<strong>' . esc_html__( 'Live BLog WP', 'lbwp' ) . '</strong>', 601 '<strong>' . esc_html__( 'PHP', 'lbwp' ) . '</strong>', 602 self::MINIMUM_PHP_VERSION 603 ); 604 605 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message ); 606 607 } 608 609 /* 610 * Warning when the site doesn't have a minimum required WP version. 611 */ 612 public function admin_notice_minimum_wp_version() { 613 614 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 615 616 $message = sprintf( 617 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 618 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'lbwp' ), 619 '<strong>' . esc_html__( 'Live Blog WP', 'lbwp' ) . '</strong>', 620 '<strong>' . esc_html__( 'WordPress', 'lbwp' ) . '</strong>', 621 self::MINIMUM_WP_VERSION 622 ); 623 624 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message ); 625 626 } 627 628 /* 629 * Warning when the site doesn't ACF. 630 */ 631 public function admin_notice_missing_acf() { 632 633 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 634 635 $message = sprintf( 636 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 637 esc_html__( '"%1$s" requires "%2$s".', 'lbwp' ), 638 '<strong>' . esc_html__( 'Live Blog WP', 'lbwp' ) . '</strong>', 639 '<strong>' . esc_html__( 'Advanced Custom Fields.', 'lbwp' ) . '</strong>' 640 ); 641 642 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message ); 643 644 } 519 #lbwp-alert.lbwp-force-show { 520 visibility: visible !important; 521 } 522 #lbwp-alert { 523 background-color: <?php echo sanitize_hex_color( $options['alert_background_color'] ); ?>; 524 color: <?php echo sanitize_hex_color( $options['alert_text_color'] ); ?>; 525 border-style: solid; 526 border-width: <?php echo absint( $options['alert_border_width'] ); ?>px; 527 border-color: <?php echo sanitize_hex_color($options['alert_border_color'] ); ?>; 528 padding: <?php echo absint( $options['alert_top_bottom_padding'] ); ?>px <?php echo absint( $options['alert_left_right_padding'] ); ?>px; 529 z-index: 9999; 530 } 531 #lbwp-pinned { 532 margin-bottom: <?php echo absint( $options['pinned_margin_bottom'] ); ?>px; 533 } 534 </style> 535 536 <?php 645 537 646 538 } 647 539 540 541 /* 542 * Holds the defaults customizer options if they dont exist. 543 */ 544 public function get_options( $option_name = '' ) { 545 546 $defaults = array( 547 'single_template' => 'full_width', 548 'post_template' => 'card_1', 549 'show_toolbar' => '1', 550 'support_blog_page' => false, 551 'support_blog_text' => 'SUPPORT', 552 'get_posts_interval' => 60, 553 'step_offset' => 65, 554 'label_js_suffixAgo' => 'ago', 555 'label_js_seconds' => 'less than a minute', 556 'label_js_minute' => 'about a minute', 557 'label_js_minutes' => '%d minutes', 558 'label_js_hour' => 'about an hour', 559 'label_js_hours' => 'about %d hours', 560 'label_js_day' => 'about a day', 561 'label_js_days' => '%d days', 562 'label_js_month' => 'about a month', 563 'label_js_months' => '%d months', 564 'label_js_year' => 'about a year', 565 'label_js_years' => '%d years', 566 'toolbar_background_color' => '#1e87f0', 567 'toolbar_icon_color' => '#ffffff', 568 'toolbar_icon_hover_color' => '#e5e5e5', 569 'toolbar_icon_size' => '1.2', 570 'toolbar_border_color' => '#1e87f0', 571 'toolbar_border_width' => '0', 572 'toolbar_padding' => '15', 573 'toolbar_box_shadow' => '0', 574 'toolbar_z_index' => '980', 575 'toolbar_offset' => '0', 576 'toolbar_new_text' => 'NEW POSTS', 577 'toolbar_new_text_size' => '18', 578 'spinner_color' => '#1e87f0', 579 'spinner_size' => '2', 580 'show_points' => '1', 581 'show_points_heading' => '1', 582 'show_points_time' => '1', 583 'points_text' => 'Key Points', 584 'points_heading_tag' => 'h4', 585 'points_columns' => 'uk-child-width-1-3@m', 586 'points_link_tag' => 'h5', 587 'points_time_color' => '#000000', 588 'points_link_color' => '#1e87f0', 589 'points_link_hover_color' => '#1e87f0', 590 'points_margin_bottom' => '5', 591 'points_wrap_margin_bottom' => '15', 592 'show_alert' => '1', 593 'force_show_alert' => '0', 594 'alert_text' => 'NEW POSTS', 595 'alert_tag' => 'div', 596 'alert_background_color' => '#ffffff', 597 'alert_text_color' => '#000000', 598 'alert_text_hover_color' => '#000000', 599 'alert_border_color' => '#000000', 600 'alert_border_width' => '1', 601 'alert_top_bottom_padding' => '10', 602 'alert_left_right_padding' => '20', 603 'alert_box_shadow' => '0', 604 'alert_position' => 'uk-position-bottom-right', 605 'tab_text' => '(NEW POSTS)', 606 'show_pinned' => '0', 607 'pinned_margin_bottom' => '20', 608 'template_card_1_avatars' => '1', 609 'template_card_1_authors' => '1', 610 'template_card_1_author_prefix' => '', 611 'template_card_1_headings' => '0', 612 'template_card_1_heading_tag' => 'h4', 613 'template_card_1_background_color' => '#ffffff', 614 'template_card_1_border_color' => '#ffffff', 615 'template_card_1_border_width' => '0', 616 'template_card_1_icon_color' => '#000000', 617 'template_card_1_icon_hover_color' => '#1e87f0', 618 'template_card_1_icon_size' => '1.2', 619 'template_card_1_time_color' => '#000000', 620 'template_card_1_author_color' => '#000000', 621 'template_card_1_box_shadow' => '0', 622 'template_card_1_padding' => '0', 623 'template_card_1_margin_bottom' => '20', 624 'template_card_1_time_size' => '14', 625 'template_card_1_author_size' => '14', 626 627 ); 628 629 return wp_parse_args( get_option( 'lbwp_options' ), $defaults ); 630 631 } 632 633 /* 634 * Warning when the site doesn't have a minimum required PHP version. 635 */ 636 public function admin_notice_minimum_php_version() { 637 638 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 639 640 $message = sprintf( 641 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 642 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'lbwp' ), 643 '<strong>' . esc_html__( 'Live BLog WP', 'lbwp' ) . '</strong>', 644 '<strong>' . esc_html__( 'PHP', 'lbwp' ) . '</strong>', 645 self::MINIMUM_PHP_VERSION 646 ); 647 648 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message ); 649 650 } 651 652 /* 653 * Warning when the site doesn't have a minimum required WP version. 654 */ 655 public function admin_notice_minimum_wp_version() { 656 657 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 658 659 $message = sprintf( 660 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 661 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'lbwp' ), 662 '<strong>' . esc_html__( 'Live Blog WP', 'lbwp' ) . '</strong>', 663 '<strong>' . esc_html__( 'WordPress', 'lbwp' ) . '</strong>', 664 self::MINIMUM_WP_VERSION 665 ); 666 667 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message ); 668 669 } 670 671 /* 672 * Warning when the site doesn't ACF. 673 */ 674 public function admin_notice_missing_acf() { 675 676 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 677 678 $message = sprintf( 679 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 680 esc_html__( '"%1$s" requires "%2$s".', 'lbwp' ), 681 '<strong>' . esc_html__( 'Live Blog WP', 'lbwp' ) . '</strong>', 682 '<strong>' . esc_html__( 'Advanced Custom Fields.', 'lbwp' ) . '</strong>' 683 ); 684 685 printf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message ); 686 687 } 688 689 } 690 648 691 \Live_Blog_WP\Instance::instance(); -
live-blog-wp/trunk/readme.txt
r2481145 r2489121 22 22 Live Blog WP slips seamlessly into your current blog theme, but you can tweak it's look for a perfect fit. 23 23 24 ### Reader Alerts(Pro)25 Your readers are updated to new live posts automatically even if your blog is not their active tab . A new posts alert is added to the Live Blog tool bar and the pages title (the text shown in the tab) is updated.24 ### Tab Alert (Pro) 25 Your readers are updated to new live posts automatically even if your blog is not their active tab, when a new post is published the pages title (the text shown in the tab) is updated. 26 26 27 27 ### Toolbar (Pro) 28 28 The toolbar provides additional navigation options for the first and last post, plus a link to your sales, subscribe or any other page. 29 30 ### Positioned Alert 31 A small popup message that can be positioned around the screen to inform readers that new content is available at the top of the feed. Click the alert to be taken to the first feed item. 29 32 30 33 ### Key Points (Pro) … … 37 40 Navigating your live feed is made more intuitive without the need to scroll endlessly up or down. Each post has up and down navigation arrows to move between posts in the feed. 38 41 42 ### Pinned Posts (Pro) 43 Choose a Live Blog Post to pin at the top of the feed which updates automatically and is great for information that will be consistently relevant such as the current score of a sports match. To enable Pinned Posts see the Customizer > Live Blog WP > Pinned. To set a Pinned Post edit a blog post and see the Live Blog WP meta box down the right side of the screen. 44 39 45 ### Gutenberg 40 46 Live Blog posts use the built-in Gutenberg editor for a content rich reader experience. … … 45 51 ### Demo Links 46 52 [Free Version](https://liveblogwp.com/demo/1/2021/02/11/hello-world/) 47 [Pro Version Wide](https://liveblogwp.com/demo/2/2021/02/11/hello-world/)48 [ Pro Version Sidebar](https://liveblogwp.com/demo/3/2021/02/11/hello-world/)53 [Pro Version](https://liveblogwp.com/demo/2/2021/02/11/hello-world/) 54 [Development Preview](https://liveblogwp.com/demo/3/2021/02/11/hello-world/) 49 55 50 56 ### Live Blog Pro … … 65 71 == Changelog == 66 72 73 = 1.0.4 = 74 Added the Pinned Posts feature. 75 Added the Positioned Alert feature. 76 Added column selection for points in full width templates. 77 67 78 = 1.0.3 = 68 79 Updated the Card 1 template with option to show headings. 69 80 Added Card 2 template. 81 Updated the Customizer options. 70 82 71 83 = 1.0.2 = -
live-blog-wp/trunk/single-templates/full-width.php
r2476538 r2489121 9 9 public static function render() { 10 10 11 $options = \Live_Blog_WP\Instance::instance()->get_options(); 12 11 13 ?> 12 14 13 15 <?php \Live_Blog_WP\Single_Templates\Header::render(); ?> 16 17 <?php \Live_Blog_WP\Single_Templates\Alert::render(); ?> 14 18 15 19 <div class="lbwp-wrapper"> … … 19 23 <?php \Live_Blog_WP\Single_Templates\Spinner::render(); ?> 20 24 25 <div id="lbwp-inview-trigger"></div> 21 26 <div id="lbwp-posts"></div> 22 27 -
live-blog-wp/trunk/single-templates/header.php
r2478166 r2489121 18 18 19 19 /* 20 * Variables20 * Some globsl variables 21 21 */ 22 22 var lbwp_child_ids = [0]; 23 23 var lbwp_first_run = true; 24 24 25 <?php if ( defined( 'LIVE_BLOG_WP_PRO' ) ) : ?> 26 var lbwp_original_page_title = $(document).find("title").text(); 27 <?php endif; ?> 25 28 26 29 /* … … 28 31 */ 29 32 function lbwp_update() { 30 31 jQuery.ajax({ 33 $.ajax({ 32 34 type: "post", 33 35 dataType: "json", … … 35 37 data : { 36 38 action: "lbwp_get_posts", 37 lbwp_parent_id: "<?php echo get_the_ID(); ?>",39 lbwp_parent_id: "<?php echo absint( get_the_ID() ); ?>", 38 40 lbwp_child_ids: lbwp_child_ids, 39 41 }, 40 42 success: function( data, status, xhr ){ 41 lbwp_callback( data ); 42 } 43 }); 44 45 } 46 47 /* 48 * The the function the ajax runs after checking with the server 49 */ 50 function lbwp_callback( data ) { 51 43 lbwp_update_callback( data ); 44 } 45 }); 46 } 47 48 /* 49 * The function the ajax runs after checking with the server 50 */ 51 function lbwp_update_callback( data ) { 52 53 // Store the page height 54 var old_page_height = $(document).height(); 55 var old_scroll_position = $(window).scrollTop(); 56 57 // If the spinner is on the page remove it 52 58 if ( $( '#lbwp-spinner' ).length ) { 53 59 $( '#lbwp-spinner' ).remove() 54 60 } 55 61 62 // Update the entire contents of the point element 63 $("#lbwp-points").html( data.points_html ); 64 65 // Update the entire contents of the point element 66 $("#lbwp-pinned").html( data.pinned_html ); 67 68 // Check if the server gave us new posts to add 56 69 if ( data.has_new === true ) { 70 // update the used child IDs 71 lbwp_child_ids = data.child_ids; 72 57 73 $("#lbwp-posts").prepend( data.html ); 58 } 59 60 lbwp_child_ids = data.child_ids; 61 62 lbwp_timeago_settings = { 74 75 if ( lbwp_first_run === false ) { 76 if ( $(document).scrollTop() > 0 ) { 77 $(document).scrollTop(old_scroll_position + jQuery(document).height() - old_page_height); 78 } 79 } 80 81 UIkit.update(element = document.body, type = 'update'); 82 83 if ( lbwp_first_run === false ) { 84 lbwp_show_notifications(); 85 } 86 87 } 88 89 // Update the timeago text 90 lbwp_update_timeago(); 91 92 // Rebind listener for clicks 93 lbwp_rebind_ui(); 94 95 // Check if we need to scoll to an item based on the URL 96 if ( lbwp_first_run === true ) { 97 lbwp_scroll_to_item(); 98 } 99 100 // Update the first run var to be false 101 lbwp_first_run = false; 102 103 } 104 105 /* 106 * Clears all alerts and other data from the screen 107 */ 108 function lbwp_clear_screen() { 109 <?php if ( defined( 'LIVE_BLOG_WP_PRO' ) ) : ?> 110 $(document).prop('title', lbwp_original_page_title); 111 <?php endif; ?> 112 $('#lbwp-new-label').addClass('uk-invisible'); 113 $('#lbwp-alert').addClass('uk-invisible'); 114 } 115 116 /* 117 * Shows alerts and other notifications 118 */ 119 function lbwp_show_notifications() { 120 <?php if ( defined( 'LIVE_BLOG_WP_PRO' ) ) : ?> 121 $(document).prop('title', '<?php echo esc_attr( $options['tab_text']); ?> ' + lbwp_original_page_title); 122 <?php endif; ?> 123 $('#lbwp-new-label').removeClass('uk-invisible'); 124 $('#lbwp-alert').removeClass('uk-invisible'); 125 } 126 127 /* 128 * Updates the timeago text for all feed items. 129 */ 130 function lbwp_update_timeago() { 131 // force update of timeago 132 var timeago_settings = { 63 133 strings: { 64 134 prefixAgo: null, … … 81 151 } 82 152 83 $("time.timeago").timeago(lbwp_timeago_settings); 84 153 $("time.timeago").timeago(timeago_settings); 154 } 155 156 /* 157 * Rebinds the UI click listeners after ajax. 158 */ 159 function lbwp_rebind_ui() { 160 161 // key point link 162 $('.lbwp-point-link').off('click'); 163 $(".lbwp-point-link").click(function(e) { 164 e.preventDefault(); 165 var keypoint_href = $(this).attr("href"); 166 $('html,body').animate({scrollTop: $(keypoint_href).offset().top - <?php echo absint( $options['step_offset']); ?> }, 500); 167 return false; 168 }); 169 170 // next post arrow 85 171 $('.lbwp-next-post').off('click'); 86 87 172 $(".lbwp-next-post").on("click", function(e) { 88 89 var lbwp_next = $($(this).closest('.lbwp-post')).next('.lbwp-post'); 90 91 if ( lbwp_next.length ) { 92 93 $('html,body').animate({scrollTop: $(lbwp_next).offset().top - <?php echo esc_attr( $options['step_offset']); ?> }, 800); 94 95 } 96 97 return false; 98 99 }); 100 173 var next_post = $($(this).closest('.lbwp-post')).next('.lbwp-post'); 174 if ( next_post.length ) { 175 $('html,body').animate({scrollTop: $(next_post).offset().top - <?php echo absint( $options['step_offset']); ?> }, 500); 176 177 } 178 return false; 179 }); 180 181 // prev post arrow 101 182 $('.lbwp-prev-post').off('click'); 102 103 183 $(".lbwp-prev-post").on("click", function(e) { 104 105 var lbwp_prev = $($(this).closest('.lbwp-post')).prev('.lbwp-post'); 106 107 if ( lbwp_prev.length ) { 108 109 $('html,body').animate({scrollTop: $(lbwp_prev).offset().top - <?php echo esc_attr( $options['step_offset']); ?> }, 800); 110 111 } 112 113 return false; 114 184 var prev_post = $($(this).closest('.lbwp-post')).prev('.lbwp-post'); 185 if ( prev_post.length ) { 186 $('html,body').animate({scrollTop: $(prev_post).offset().top - <?php echo absint( $options['step_offset']); ?> }, 500); 187 } 188 return false; 115 189 }); 116 190 117 191 // copy url top clipboard 192 var clipboard = new ClipboardJS('.lbwp-clipboard'); 193 118 194 if ( lbwp_first_run == false ) { 119 195 lbwp_clipboard.destroy(); 120 } 121 var lbwp_clipboard = new ClipboardJS('.lbwp-clipboard'); 122 123 // check for scoll on parameter 124 lbwp_scroll_to_item(); 125 126 lbwp_first_run = false; 196 clipboard = new ClipboardJS('.lbwp-clipboard'); 197 } 198 199 $('#lbwp-alert').off('click'); 200 $('#lbwp-alert').on('click', function() { 201 lbwp_scroll_to_first_item(); 202 return false; 203 }); 204 205 $('#lbwp-new-label').off('click'); 206 $('#lbwp-new-label').on('click', function() { 207 lbwp_scroll_to_first_item(); 208 return false; 209 }); 127 210 128 211 } … … 132 215 */ 133 216 function lbwp_scroll_to_item() { 134 135 217 if ( lbwp_first_run === true ) { 136 137 218 var url_string = window.location.href; 138 219 var url = new URL(url_string); 139 var lbwp_scroll_to_item = url.searchParams.get("lbwp-item"); 140 141 if ( lbwp_scroll_to_item === 'true' ) { 142 143 var lbwp_item_to_scroll_to = $( '#lbwp-item-' + url.searchParams.get("lbwp-item-id") ); 144 220 var scroll_to_item = url.searchParams.get("lbwp-item"); 221 if ( scroll_to_item === 'true' ) { 222 var item_to_scroll_to = $( '#lbwp-item-' + url.searchParams.get("lbwp-item-id") ); 145 223 if ( lbwp_item_to_scroll_to.length ) { 146 147 $('html,body').animate({scrollTop: $(lbwp_item_to_scroll_to).offset().top - <?php echo esc_attr( $options['step_offset']); ?> }, 500); 148 224 $('html,body').animate({scrollTop: $(item_to_scroll_to).offset().top - <?php echo absint( $options['step_offset']); ?> }, 500); 149 225 } 150 151 } 152 153 } 154 226 } 227 } 228 } 229 230 /* 231 * Scrolls to the first item in the feed 232 */ 233 function lbwp_scroll_to_first_item() { 234 var first_item = $('#lbwp-posts').children().first(); 235 if ( first_item.length ) { 236 $('html,body').animate({scrollTop: $(first_item).offset().top - <?php echo esc_attr( $options['step_offset']); ?> }, 500); 237 } 238 lbwp_clear_screen(); 239 } 240 241 /* 242 * Scrolls to the last item in the feed 243 */ 244 function lbwp_scroll_to_last_item() { 245 var last_post = $('#lbwp-posts').children().last(); 246 if ( last_post.length ) { 247 $('html,body').animate({scrollTop: $(last_post).offset().top - <?php echo esc_attr( $options['step_offset']); ?> }, 800); 248 } 155 249 } 156 250 … … 163 257 lbwp_update(); 164 258 259 var util = UIkit.util; 260 var clear_screen_el = util.$( '#lbwp-inview-trigger' ); 261 262 UIkit.scrollspy( clear_screen_el, { repeat: true } ); 263 264 util.on(clear_screen_el,'inview', function() { 265 lbwp_clear_screen(); 266 }); 267 268 util.on(clear_screen_el,'outview', function() { 269 lbwp_clear_screen(); 270 }); 271 272 $('#lbwp-top-link').on('click', function() { 273 lbwp_scroll_to_first_item(); 274 }); 275 276 $('#lbwp-bottom-link').on('click', function() { 277 lbwp_scroll_to_last_item(); 278 }); 279 165 280 }); 166 281 -
live-blog-wp/trunk/single-templates/spinner.php
r2476538 r2489121 13 13 ?> 14 14 15 <div id="lbwp-spinner" class="lbwp- wp-spinner uk-text-center">15 <div id="lbwp-spinner" class="lbwp-spinner uk-text-center"> 16 16 <span uk-spinner="ratio: <?php echo esc_attr( $options['spinner_size']); ?>"></span> 17 17 </div>
Note: See TracChangeset
for help on using the changeset viewer.