| Conditions | 3 |
| Paths | 4 |
| Total Lines | 90 |
| Code Lines | 66 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| Bugs | 0 | Features | 2 |
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 |
||
| 109 | public function enqueue_scripts() { |
||
| 110 | $locale = get_locale(); |
||
| 111 | $short_locale = substr( $locale, 0, 2 ); |
||
| 112 | $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
||
| 113 | |||
| 114 | wp_enqueue_style( 'carbon-fields-core', \Carbon_Fields\URL . '/assets/dist/carbon.css', array(), \Carbon_Fields\VERSION ); |
||
| 115 | |||
| 116 | wp_enqueue_script( 'carbon-fields-vendor', \Carbon_Fields\URL . '/assets/dist/carbon.vendor' . $suffix . '.js', array( 'jquery' ), \Carbon_Fields\VERSION ); |
||
| 117 | wp_enqueue_script( 'carbon-fields-core', \Carbon_Fields\URL . '/assets/dist/carbon.core' . $suffix . '.js', array( 'carbon-fields-vendor', 'quicktags', 'editor' ), \Carbon_Fields\VERSION ); |
||
| 118 | wp_enqueue_script( 'carbon-fields-boot', \Carbon_Fields\URL . '/assets/dist/carbon.boot' . $suffix . '.js', array( 'carbon-fields-core' ), \Carbon_Fields\VERSION ); |
||
| 119 | |||
| 120 | wp_localize_script( 'carbon-fields-vendor', 'carbonFieldsConfig', apply_filters( 'carbon_fields_config', array( |
||
| 121 | 'compactInput' => \Carbon_Fields\COMPACT_INPUT, |
||
| 122 | 'compactInputKey' => \Carbon_Fields\COMPACT_INPUT_KEY, |
||
| 123 | ) ) ); |
||
| 124 | wp_localize_script( 'carbon-fields-vendor', 'carbonFieldsL10n', apply_filters( 'carbon_fields_l10n', array( |
||
| 125 | 'locale' => $locale, |
||
| 126 | 'shortLocale' => $short_locale, |
||
| 127 | |||
| 128 | 'container' => array( |
||
| 129 | 'pleaseFillTheRequiredFields' => __( 'Please fill out all required fields highlighted below.', 'carbon-fields' ), |
||
| 130 | 'changesMadeSaveAlert' => __( 'The changes you made will be lost if you navigate away from this page.', 'carbon-fields' ), |
||
| 131 | ), |
||
| 132 | |||
| 133 | 'field' => array( |
||
| 134 | 'geocodeZeroResults' => __( 'The address could not be found. ', 'carbon-fields' ), |
||
| 135 | 'geocodeNotSuccessful' => __( 'Geocode was not successful for the following reason: ', 'carbon-fields' ), |
||
| 136 | 'mapLocateAddress' => __( 'Locate address on the map:', 'carbon-fields' ), |
||
| 137 | 'minNumItemsNotReached' => __( 'Minimum number of items not reached (%s items)', 'carbon-fields' ), |
||
| 138 | 'maxNumItemsReached' => __( 'Maximum number of items reached (%s items)', 'carbon-fields' ), |
||
| 139 | |||
| 140 | 'complexNoRows' => __( 'There are no %s yet. Click <a href="#">here</a> to add one.', 'carbon-fields' ), |
||
| 141 | 'complexMinNumRowsNotReached' => __( 'Minimum number of rows not reached (%1$d %2$s)', 'carbon-fields' ), |
||
| 142 | 'complexMaxNumRowsExceeded' => __( 'Maximum number of rows exceeded (%1$d %2$s)', 'carbon-fields' ), |
||
| 143 | 'complexAddButton' => _x( 'Add %s', 'Complex field', 'carbon-fields' ), |
||
| 144 | 'complexCloneButton' => _x( 'Clone', 'Complex field', 'carbon-fields' ), |
||
| 145 | 'complexRemoveButton' => _x( 'Remove', 'Complex field', 'carbon-fields' ), |
||
| 146 | 'complexCollapseExpandButton' => _x( 'Collapse/Expand', 'Complex field', 'carbon-fields' ), |
||
| 147 | 'complexCollapseAllButton' => _x( 'Collapse All', 'Complex field groups', 'carbon-fields' ), |
||
| 148 | 'complexExpandAllButton' => _x( 'Expand All', 'Complex field groups', 'carbon-fields' ), |
||
| 149 | |||
| 150 | 'messageFormValidationFailed' => __( 'Please fill out all fields correctly. ', 'carbon-fields' ), |
||
| 151 | 'messageRequiredField' => __( 'This field is required. ', 'carbon-fields' ), |
||
| 152 | 'messageChooseOption' => __( 'Please choose an option. ', 'carbon-fields' ), |
||
| 153 | |||
| 154 | 'enterNameOfNewSidebar' => __( 'Please enter the name of the new sidebar:', 'carbon-fields' ), |
||
| 155 | |||
| 156 | 'selectTime' => __( 'Select Time', 'carbon-fields' ), |
||
| 157 | 'selectDate' => __( 'Select Date', 'carbon-fields' ), |
||
| 158 | |||
| 159 | 'associationSelectedItem' => __( '%1$d selected item', 'carbon-fields' ), |
||
| 160 | 'associationSelectedItems' => __( '%1$d selected items', 'carbon-fields' ), |
||
| 161 | 'associationSelectedItemOutOf' => __( '%1$d selected item out of %2$d', 'carbon-fields' ), |
||
| 162 | 'associationSelectedItemsOutOf' => __( '%1$d selected items out of %2$d', 'carbon-fields' ), |
||
| 163 | |||
| 164 | 'colorSelectColor' => __( 'Select a color', 'carbon-fields' ), |
||
| 165 | |||
| 166 | 'noOptions' => __( 'No options.', 'carbon-fields' ), |
||
| 167 | |||
| 168 | 'setShowAll' => __( 'Show all options', 'carbon-fields' ), |
||
| 169 | |||
| 170 | 'searchPlaceholder' => __( 'Search...', 'carbon-fields' ), |
||
| 171 | |||
| 172 | 'editAttachmentUrl' => _x( 'URL', 'WordPress media attachment', 'carbon-fields' ), |
||
| 173 | 'editAttachmentTitle' => _x( 'Title', 'WordPress media attachment', 'carbon-fields' ), |
||
| 174 | 'editAttachmentArtist' => _x( 'Artist', 'WordPress media attachment', 'carbon-fields' ), |
||
| 175 | 'editAttachmentAlbum' => _x( 'Album', 'WordPress media attachment', 'carbon-fields' ), |
||
| 176 | 'editAttachmentCaption' => _x( 'Caption', 'WordPress media attachment', 'carbon-fields' ), |
||
| 177 | 'editAttachmentAlt' => _x( 'Alt Text', 'WordPress media attachment', 'carbon-fields' ), |
||
| 178 | 'editAttachmentDescription' => _x( 'Description', 'WordPress media attachment', 'carbon-fields' ), |
||
| 179 | 'editAttachmentClose' => _x( 'Close', 'WordPress media attachment', 'carbon-fields' ), |
||
| 180 | 'editAttachmentSave' => _x( 'Save', 'WordPress media attachment', 'carbon-fields' ), |
||
| 181 | |||
| 182 | 'oembedNotFound' => _x( 'Not Found', 'oEmbed field', 'carbon-fields' ), |
||
| 183 | |||
| 184 | 'mediaGalleryNoFiles' => __( 'No files selected.', 'carbon-fields' ), |
||
| 185 | 'mediaGalleryButtonLabel' => __( 'Add File', 'carbon-fields' ), |
||
| 186 | 'mediaGalleryBrowserTitle' => _x( 'Files', 'WordPress Media Browser', 'carbon-fields' ), |
||
| 187 | 'mediaGalleryBrowserButtonLabel' => _x( 'Select File', 'WordPress Media Browser', 'carbon-fields' ), |
||
| 188 | |||
| 189 | 'fileButtonLabel' => __( 'Select File', 'carbon-fields' ), |
||
| 190 | 'fileBrowserTitle' => _x( 'Files', 'WordPress Media Browser', 'carbon-fields' ), |
||
| 191 | 'fileBrowserButtonLabel' => _x( 'Select File', 'WordPress Media Browser', 'carbon-fields' ), |
||
| 192 | |||
| 193 | 'imageButtonLabel' => __( 'Select Image', 'carbon-fields' ), |
||
| 194 | 'imageBrowserTitle' => _x( 'Images', 'WordPress Media Browser', 'carbon-fields' ), |
||
| 195 | 'imageBrowserButtonLabel' => _x( 'Select Image', 'WordPress Media Browser', 'carbon-fields' ), |
||
| 196 | ), |
||
| 197 | ) ) ); |
||
| 198 | } |
||
| 199 | |||
| 269 |