| @@ -487,9 +487,9 @@ | ||
| 487 | 487 | $actions['clone'] = sprintf( |
| 488 | 488 | '<a href="%s" class="automatorwp-clone-automation" aria-label="%s">%s</a>', |
| 489 | 489 | add_query_arg( array( 'automatorwp-action' => 'clone_automation' ), $url ), |
| 490 | 490 | esc_attr( __( 'Clone', 'automatorwp' ) ), |
| 491 | - __( 'Clone', 'automatorwp' ) | |
| 491 | + esc_html__( 'Clone', 'automatorwp' ) | |
| 492 | 492 | ); |
| 493 | 493 | |
| 494 | 494 | $actions['url_export'] = sprintf( |
| 495 | 495 | '<a href="%s" class="automatorwp-url-export-automation" aria-label="%s">%s</a>', |
| @@ -494,9 +494,9 @@ | ||
| 494 | 494 | $actions['url_export'] = sprintf( |
| 495 | 495 | '<a href="%s" class="automatorwp-url-export-automation" aria-label="%s">%s</a>', |
| 496 | 496 | add_query_arg( array( 'automatorwp-action' => 'url_export_automation' ), $url ), |
| 497 | 497 | esc_attr( __( 'Export', 'automatorwp' ) ), |
| 498 | - __( 'Export', 'automatorwp' ) | |
| 498 | + esc_html__( 'Export', 'automatorwp' ) | |
| 499 | 499 | ); |
| 500 | 500 | |
| 501 | 501 | if( isset( $actions['delete'] ) ) { |
| 502 | 502 | |
| @@ -510,9 +510,9 @@ | ||
| 510 | 510 | "return confirm('" . |
| 511 | 511 | esc_attr( __( "Are you sure you want to delete this automation?\\n\\nClick \\'Cancel\\' to go back, \\'OK\\' to confirm the delete.", 'automatorwp' ) ) . |
| 512 | 512 | "');", |
| 513 | 513 | esc_attr( __( 'Delete', 'automatorwp' ) ), |
| 514 | - __( 'Delete', 'automatorwp' ) | |
| 514 | + esc_html__( 'Delete', 'automatorwp' ) | |
| 515 | 515 | ); |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | return $actions; |
| @@ -643,9 +643,9 @@ | ||
| 643 | 643 | |
| 644 | 644 | $default_data['type'] = $type; |
| 645 | 645 | $default_data['user_id'] = get_current_user_id(); |
| 646 | 646 | $default_data['sequential'] = 0; |
| 647 | - $default_data['times_per_user'] = 1; | |
| 647 | + $default_data['times_per_user'] = 0; | |
| 648 | 648 | $default_data['times'] = 0; |
| 649 | 649 | $default_data['status'] = 'inactive'; |
| 650 | 650 | $default_data['date'] = date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ); |
| 651 | 651 | $default_data['expiration'] = ''; |
| @@ -733,9 +733,9 @@ | ||
| 733 | 733 | 'name' => __( 'Title', 'automatorwp' ), |
| 734 | 734 | 'type' => 'text', |
| 735 | 735 | 'classes' => 'automatorwp-auto-save', |
| 736 | 736 | 'attributes' => array( |
| 737 | - 'placeholder' => __( 'Enter title here', 'automatorwp' ), | |
| 737 | + 'placeholder' => __( 'Enter title here', 'automatorwp' ) . '...', | |
| 738 | 738 | ) |
| 739 | 739 | ), |
| 740 | 740 | ), |
| 741 | 741 | array( |
| @@ -752,14 +752,9 @@ | ||
| 752 | 752 | 'type' => array( |
| 753 | 753 | 'name' => __( 'Type', 'automatorwp' ), |
| 754 | 754 | 'type' => 'select', |
| 755 | 755 | 'options' => automatorwp_get_automation_types_labels(), |
| 756 | - 'js_controls' => array( | |
| 757 | - 'icon' => 'dashicons-star-filled', | |
| 758 | - 'edit_button' => false, | |
| 759 | - 'save_button_classes' => 'button button-primary', | |
| 760 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 761 | - ), | |
| 756 | + 'js_controls' => automatorwp_js_controls_options( 'star-filled' ), | |
| 762 | 757 | 'before_row' => 'js_controls_before', |
| 763 | 758 | 'after_row' => 'js_controls_after', |
| 764 | 759 | ), |
| 765 | 760 | 'times_per_user' => array( |
| @@ -771,14 +766,9 @@ | ||
| 771 | 766 | 'min' => '0', |
| 772 | 767 | ), |
| 773 | 768 | 'classes' => 'automatorwp-has-tooltip', |
| 774 | 769 | 'after_field' => 'automatorwp_tooltip_cb', |
| 775 | - 'js_controls' => array( | |
| 776 | - 'icon' => 'dashicons-filter', | |
| 777 | - 'save_button' => __( 'Save', 'automatorwp' ), | |
| 778 | - 'save_button_classes' => 'button button-primary', | |
| 779 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 780 | - ), | |
| 770 | + 'js_controls' => automatorwp_js_controls_options( 'update' ), | |
| 781 | 771 | 'before_row' => 'js_controls_before', |
| 782 | 772 | 'after_row' => 'js_controls_after', |
| 783 | 773 | ), |
| 784 | 774 | 'times' => array( |
| @@ -790,14 +780,9 @@ | ||
| 790 | 780 | 'min' => '0', |
| 791 | 781 | ), |
| 792 | 782 | 'classes' => 'automatorwp-has-tooltip', |
| 793 | 783 | 'after_field' => 'automatorwp_tooltip_cb', |
| 794 | - 'js_controls' => array( | |
| 795 | - 'icon' => 'dashicons-admin-site', | |
| 796 | - 'save_button' => __( 'Save', 'automatorwp' ), | |
| 797 | - 'save_button_classes' => 'button button-primary', | |
| 798 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 799 | - ), | |
| 784 | + 'js_controls' => automatorwp_js_controls_options( 'admin-site' ), | |
| 800 | 785 | 'before_row' => 'js_controls_before', |
| 801 | 786 | 'after_row' => 'js_controls_after', |
| 802 | 787 | ), |
| 803 | 788 | 'user_id' => array( |
| @@ -805,14 +790,9 @@ | ||
| 805 | 790 | 'type' => 'select', |
| 806 | 791 | 'classes' => 'automatorwp-user-selector', |
| 807 | 792 | 'options_cb' => 'automatorwp_options_cb_users', |
| 808 | 793 | 'display_cb' => 'automatorwp_display_cb_users', |
| 809 | - 'js_controls' => array( | |
| 810 | - 'icon' => 'dashicons-admin-users', | |
| 811 | - 'save_button' => __( 'Save', 'automatorwp' ), | |
| 812 | - 'save_button_classes' => 'button button-primary', | |
| 813 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 814 | - ), | |
| 794 | + 'js_controls' => automatorwp_js_controls_options( 'admin-users' ), | |
| 815 | 795 | 'before_row' => 'js_controls_before', |
| 816 | 796 | 'after_row' => 'js_controls_after', |
| 817 | 797 | ), |
| 818 | 798 | 'status' => array( |
| @@ -821,10 +801,10 @@ | ||
| 821 | 801 | 'options_cb' => 'automatorwp_options_cb_automation_statuses', |
| 822 | 802 | 'js_controls' => array( |
| 823 | 803 | 'icon' => 'dashicons-post-status', |
| 824 | 804 | 'save_button' => __( 'Save', 'automatorwp' ), |
| 825 | - 'save_button_classes' => 'button button-primary', | |
| 826 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 805 | + 'save_button_classes' => 'button button-compact button-primary', | |
| 806 | + 'cancel_button_classes' => 'button button-compact automatorwp-button-danger', | |
| 827 | 807 | ), |
| 828 | 808 | 'before_row' => 'js_controls_before', |
| 829 | 809 | 'after_row' => 'js_controls_after', |
| 830 | 810 | ), |
| @@ -841,14 +821,9 @@ | ||
| 841 | 821 | 'autocomplete' => 'off' |
| 842 | 822 | ), |
| 843 | 823 | 'classes' => 'automatorwp-has-tooltip', |
| 844 | 824 | 'after_field' => 'automatorwp_tooltip_cb', |
| 845 | - 'js_controls' => array( | |
| 846 | - 'icon' => 'dashicons-calendar', | |
| 847 | - 'save_button' => __( 'Save', 'automatorwp' ), | |
| 848 | - 'save_button_classes' => 'button button-primary', | |
| 849 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 850 | - ), | |
| 825 | + 'js_controls' => automatorwp_js_controls_options( 'calendar' ), | |
| 851 | 826 | 'before_row' => 'js_controls_before', |
| 852 | 827 | 'after_row' => 'js_controls_after', // Handled on automatorwp_automations_publishing_actions() |
| 853 | 828 | ), |
| 854 | 829 | 'expiration' => array( |
| @@ -863,14 +838,9 @@ | ||
| 863 | 838 | 'autocomplete' => 'off' |
| 864 | 839 | ), |
| 865 | 840 | 'classes' => 'automatorwp-has-tooltip', |
| 866 | 841 | 'after_field' => 'automatorwp_tooltip_cb', |
| 867 | - 'js_controls' => array( | |
| 868 | - 'icon' => 'dashicons-clock', | |
| 869 | - 'save_button' => __( 'Save', 'automatorwp' ), | |
| 870 | - 'save_button_classes' => 'button button-primary', | |
| 871 | - 'cancel_button_classes' => 'button automatorwp-button-danger', | |
| 872 | - ), | |
| 842 | + 'js_controls' => automatorwp_js_controls_options( 'clock' ), | |
| 873 | 843 | 'before_row' => 'js_controls_before', |
| 874 | 844 | //'after_row' => 'js_controls_after', // Handled on automatorwp_automations_publishing_actions() |
| 875 | 845 | 'after_row' => 'automatorwp_automations_publishing_actions', |
| 876 | 846 | |
| @@ -881,12 +851,49 @@ | ||
| 881 | 851 | 'context' => 'side', |
| 882 | 852 | ) |
| 883 | 853 | ); |
| 884 | 854 | |
| 855 | + // Notes | |
| 856 | + automatorwp_add_meta_box( | |
| 857 | + 'automatorwp-automations-notes', | |
| 858 | + __( 'Notes', 'automatorwp' ) . cmb_tooltip_get_html( __( 'Use this box to add internal notes about this automation.', 'automatorwp' ) ), | |
| 859 | + 'automatorwp_automations', | |
| 860 | + array( | |
| 861 | + 'notes' => array( | |
| 862 | + 'name' => __( 'Notes', 'automatorwp' ), | |
| 863 | + 'type' => 'textarea', | |
| 864 | + 'classes' => 'automatorwp-auto-save', | |
| 865 | + 'attributes' => array( | |
| 866 | + 'rows' => 8, | |
| 867 | + 'placeholder' => __( 'Internal notes here', 'automatorwp' ) . '...', | |
| 868 | + ) | |
| 869 | + ), | |
| 870 | + ), | |
| 871 | + array( | |
| 872 | + 'priority' => 'default', | |
| 873 | + 'context' => 'side', | |
| 874 | + ) | |
| 875 | + ); | |
| 876 | + | |
| 885 | 877 | } |
| 886 | 878 | add_action( 'cmb2_admin_init', 'automatorwp_automations_meta_boxes' ); |
| 887 | 879 | |
| 888 | 880 | /** |
| 881 | + * Helper function to reduce code | |
| 882 | + * | |
| 883 | + * @param string $icon | |
| 884 | + * @return array | |
| 885 | + */ | |
| 886 | +function automatorwp_js_controls_options( $icon = 'automatorwp' ) { | |
| 887 | + return array( | |
| 888 | + 'icon' => 'dashicons-' . $icon, | |
| 889 | + 'save_button' => __( 'Save', 'automatorwp' ), | |
| 890 | + 'save_button_classes' => 'button button-compact button-primary', | |
| 891 | + 'cancel_button_classes' => 'button button-compact automatorwp-button-danger', | |
| 892 | + ); | |
| 893 | +} | |
| 894 | + | |
| 895 | +/** | |
| 889 | 896 | * Expiration escape callback. |
| 890 | 897 | * |
| 891 | 898 | * @param string $value Field value. |
| 892 | 899 | * @param array $field_args Array of field arguments. |
| @@ -956,9 +963,9 @@ | ||
| 956 | 963 | $actions['clone'] = sprintf( |
| 957 | 964 | '<a href="%s" class="automatorwp-clone-automation" aria-label="%s">%s</a>', |
| 958 | 965 | add_query_arg( array( 'automatorwp-action' => 'clone_automation' ), $url ), |
| 959 | 966 | esc_attr( __( 'Clone', 'automatorwp' ) ), |
| 960 | - __( 'Clone', 'automatorwp' ) | |
| 967 | + automatorwp_dashicon( 'admin-page' ) . esc_html__( 'Clone', 'automatorwp' ) | |
| 961 | 968 | ); |
| 962 | 969 | |
| 963 | 970 | $actions['url_export'] = sprintf( |
| 964 | 971 | '<a href="%s" class="automatorwp-url-export-automation" aria-label="%s">%s</a>', |
| @@ -963,9 +970,9 @@ | ||
| 963 | 970 | $actions['url_export'] = sprintf( |
| 964 | 971 | '<a href="%s" class="automatorwp-url-export-automation" aria-label="%s">%s</a>', |
| 965 | 972 | add_query_arg( array( 'automatorwp-action' => 'url_export_automation' ), $url ), |
| 966 | 973 | esc_attr( __( 'Export', 'automatorwp' ) ), |
| 967 | - __( 'Export', 'automatorwp' ) | |
| 974 | + automatorwp_dashicon( 'cloud-upload' ) . esc_html__( 'Export', 'automatorwp' ) | |
| 968 | 975 | ); |
| 969 | 976 | |
| 970 | 977 | /** |
| 971 | 978 | * Filters the array of edit action links on the automation edit page. |
| @@ -980,14 +987,8 @@ | ||
| 980 | 987 | $actions = apply_filters( 'automatorwp_automations_edit_actions', $actions, $automation ) |
| 981 | 988 | ?> |
| 982 | 989 | <div id="major-publishing-actions"> |
| 983 | 990 | |
| 984 | - <div id="automatorwp-automation-actions"> | |
| 985 | - <?php foreach( $actions as $action => $action_html ) : ?> | |
| 986 | - <div id="automatorwp-automation-action-<?php echo esc_attr( $action ); ?>" class="automatorwp-automation-action"><?php echo $action_html; ?></div> | |
| 987 | - <?php endforeach; ?> | |
| 988 | - </div> | |
| 989 | - | |
| 990 | 991 | <?php if( $automation->status === 'inactive' ) : ?> |
| 991 | 992 | |
| 992 | 993 | <div class="automatorwp-save-and-activate"> |
| 993 | 994 | <?php submit_button( __( 'Save & Activate', 'automatorwp' ), ' primary large', 'automatorwp-save-and-activate', false ); ?> |
| @@ -1006,8 +1007,14 @@ | ||
| 1006 | 1007 | </div> |
| 1007 | 1008 | |
| 1008 | 1009 | <?php endif; ?> |
| 1009 | 1010 | |
| 1011 | + <div id="automatorwp-automation-actions"> | |
| 1012 | + <?php foreach( $actions as $action => $action_html ) : ?> | |
| 1013 | + <div id="automatorwp-automation-action-<?php echo esc_attr( $action ); ?>" class="automatorwp-automation-action"><?php echo $action_html; ?></div> | |
| 1014 | + <?php endforeach; ?> | |
| 1015 | + </div> | |
| 1016 | + | |
| 1010 | 1017 | <div id="delete-action"> |
| 1011 | 1018 | <?php |
| 1012 | 1019 | printf( |
| 1013 | 1020 | '<a href="%s" class="submitdelete deletion" onclick="%s" aria-label="%s">%s</a>', |
| @@ -1015,9 +1022,9 @@ | ||
| 1015 | 1022 | "return confirm('" . |
| 1016 | 1023 | esc_attr( __( "Are you sure you want to delete this automation?\\n\\nClick \\'Cancel\\' to go back, \\'OK\\' to confirm the delete.", 'automatorwp' ) ) . |
| 1017 | 1024 | "');", |
| 1018 | 1025 | esc_attr( __( 'Delete', 'automatorwp' ) ), |
| 1019 | - __( 'Delete', 'automatorwp' ) | |
| 1026 | + automatorwp_dashicon( 'trash' ) . esc_html__( 'Delete', 'automatorwp' ) | |
| 1020 | 1027 | ); |
| 1021 | 1028 | ?> |
| 1022 | 1029 | </div> |
| 1023 | 1030 | |