| Conditions | 3 |
| Paths | 4 |
| Total Lines | 63 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 78 | public function enqueue_assets() { |
||
| 79 | global $wp_scripts; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Runs just before enqueuing scripts and styles in all Bulk WP admin pages. |
||
| 83 | * |
||
| 84 | * This action is primarily for registering or deregistering additional scripts or styles. |
||
| 85 | * |
||
| 86 | * @since 5.5.1 |
||
| 87 | */ |
||
| 88 | do_action( 'bd_before_admin_enqueue_scripts' ); |
||
| 89 | |||
| 90 | wp_enqueue_script( |
||
| 91 | 'jquery-ui-timepicker-addon', |
||
| 92 | $this->get_plugin_dir_url() . 'assets/js/jquery-ui-timepicker-addon.min.js', |
||
| 93 | array( 'jquery-ui-slider', 'jquery-ui-datepicker' ), |
||
| 94 | '1.6.3', |
||
| 95 | true |
||
| 96 | ); |
||
| 97 | wp_enqueue_style( 'jquery-ui-timepicker', $this->get_plugin_dir_url() . 'assets/css/jquery-ui-timepicker-addon.min.css', array(), '1.6.3' ); |
||
| 98 | |||
| 99 | wp_enqueue_script( 'select2', $this->get_plugin_dir_url() . 'assets/js/select2.min.js', array( 'jquery' ), '4.0.5', true ); |
||
| 100 | wp_enqueue_style( 'select2', $this->get_plugin_dir_url() . 'assets/css/select2.min.css', array(), '4.0.5' ); |
||
| 101 | |||
| 102 | $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
||
| 103 | wp_enqueue_script( |
||
| 104 | 'bulk-delete', |
||
| 105 | $this->get_plugin_dir_url() . 'assets/js/bulk-delete' . $postfix . '.js', |
||
| 106 | array( 'jquery-ui-timepicker-addon', 'jquery-ui-tooltip', 'postbox' ), |
||
| 107 | \Bulk_Delete::VERSION, |
||
| 108 | true |
||
| 109 | ); |
||
| 110 | wp_enqueue_style( 'bulk-delete', $this->get_plugin_dir_url() . 'assets/css/bulk-delete' . $postfix . '.css', array( 'select2' ), \Bulk_Delete::VERSION ); |
||
| 111 | |||
| 112 | $ui = $wp_scripts->query( 'jquery-ui-core' ); |
||
| 113 | $url = "//ajax.googleapis.com/ajax/libs/jqueryui/{$ui->ver}/themes/smoothness/jquery-ui.css"; |
||
| 114 | wp_enqueue_style( 'jquery-ui-smoothness', $url, array(), $ui->ver ); |
||
| 115 | |||
| 116 | /** |
||
| 117 | * Filter JavaScript array. |
||
| 118 | * |
||
| 119 | * This filter can be used to extend the array that is passed to JavaScript |
||
| 120 | * |
||
| 121 | * @since 5.4 |
||
| 122 | */ |
||
| 123 | $translation_array = apply_filters( 'bd_javascript_array', array( |
||
| 124 | 'msg' => array(), |
||
| 125 | 'validators' => array(), |
||
| 126 | 'dt_iterators' => array(), |
||
| 127 | 'pre_action_msg' => array(), |
||
| 128 | 'error_msg' => array(), |
||
| 129 | 'pro_iterators' => array(), |
||
| 130 | ) ); |
||
| 131 | wp_localize_script( 'bulk-delete', 'BulkWP', $translation_array ); // TODO: Change JavaScript variable to BulkWP.BulkDelete. |
||
| 132 | |||
| 133 | /** |
||
| 134 | * Runs just after enqueuing scripts and styles in all Bulk WP admin pages. |
||
| 135 | * |
||
| 136 | * This action is primarily for registering additional scripts or styles. |
||
| 137 | * |
||
| 138 | * @since 5.5.1 |
||
| 139 | */ |
||
| 140 | do_action( 'bd_after_admin_enqueue_scripts' ); |
||
| 141 | } |
||
| 219 |