| @@ -3,35 +3,20 @@ | ||
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class FrmFormsListHelper extends FrmListHelper { |
| 7 | - | |
| 8 | - /** | |
| 9 | - * @var string | |
| 10 | - */ | |
| 11 | 7 | public $status = ''; |
| 12 | 8 | |
| 13 | 9 | public $total_items = 0; |
| 14 | 10 | |
| 15 | - /** | |
| 16 | - * @param array $args | |
| 17 | - */ | |
| 18 | 11 | public function __construct( $args ) { |
| 19 | 12 | $this->status = self::get_param( array( 'param' => 'form_type' ) ); |
| 20 | 13 | |
| 21 | 14 | parent::__construct( $args ); |
| 22 | - $this->screen->set_screen_reader_content( | |
| 23 | - array( | |
| 24 | - 'heading_list' => esc_html__( 'Forms list', 'formidable' ), | |
| 25 | - ) | |
| 26 | - ); | |
| 27 | 15 | } |
| 28 | 16 | |
| 29 | - /** | |
| 30 | - * @return void | |
| 31 | - */ | |
| 32 | 17 | public function prepare_items() { |
| 33 | - global $per_page, $mode; | |
| 18 | + global $wpdb, $per_page, $mode; | |
| 34 | 19 | |
| 35 | 20 | $page = $this->get_pagenum(); |
| 36 | 21 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
| 37 | 22 | |
| @@ -52,12 +37,9 @@ | ||
| 52 | 37 | 'param' => 'order', |
| 53 | 38 | 'default' => 'ASC', |
| 54 | 39 | ) |
| 55 | 40 | ); |
| 56 | - | |
| 57 | - FrmAppController::apply_saved_sort_preference( $orderby, $order ); | |
| 58 | - | |
| 59 | - $start = self::get_param( | |
| 41 | + $start = self::get_param( | |
| 60 | 42 | array( |
| 61 | 43 | 'param' => 'start', |
| 62 | 44 | 'default' => ( $page - 1 ) * $per_page, |
| 63 | 45 | ) |
| @@ -89,14 +71,12 @@ | ||
| 89 | 71 | 'param' => 's', |
| 90 | 72 | 'sanitize' => 'sanitize_text_field', |
| 91 | 73 | ) |
| 92 | 74 | ); |
| 93 | - | |
| 94 | - if ( $s !== '' ) { | |
| 75 | + if ( $s != '' ) { | |
| 95 | 76 | preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches ); |
| 96 | 77 | $search_terms = array_map( 'trim', $matches[0] ); |
| 97 | - | |
| 98 | - foreach ( $search_terms as $term ) { | |
| 78 | + foreach ( (array) $search_terms as $term ) { | |
| 99 | 79 | $s_query[] = array( |
| 100 | 80 | 'or' => true, |
| 101 | 81 | 'name LIKE' => $term, |
| 102 | 82 | 'description LIKE' => $term, |
| @@ -107,10 +87,10 @@ | ||
| 107 | 87 | unset( $term ); |
| 108 | 88 | } |
| 109 | 89 | } |
| 110 | 90 | |
| 111 | - $this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page ); | |
| 112 | - $total_items = FrmDb::get_count( 'frm_forms', $s_query ); | |
| 91 | + $this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page ); | |
| 92 | + $total_items = FrmDb::get_count( 'frm_forms', $s_query ); | |
| 113 | 93 | $this->total_items = $total_items; |
| 114 | 94 | |
| 115 | 95 | $this->set_pagination_args( |
| 116 | 96 | array( |
| @@ -119,22 +99,17 @@ | ||
| 119 | 99 | ) |
| 120 | 100 | ); |
| 121 | 101 | } |
| 122 | 102 | |
| 123 | - /** | |
| 124 | - * @return void | |
| 125 | - */ | |
| 126 | 103 | public function no_items() { |
| 127 | 104 | if ( $this->status === 'trash' ) { |
| 128 | 105 | echo '<p>'; |
| 129 | 106 | esc_html_e( 'No forms found in the trash.', 'formidable' ); |
| 130 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 131 | 107 | ?> |
| 132 | 108 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable' ) ); ?>"> |
| 133 | 109 | <?php esc_html_e( 'See all forms.', 'formidable' ); ?> |
| 134 | 110 | </a> |
| 135 | 111 | <?php |
| 136 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 137 | 112 | echo '</p>'; |
| 138 | 113 | } else { |
| 139 | 114 | $title = __( 'No Forms Found', 'formidable' ); |
| 140 | 115 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_no_forms.php'; |
| @@ -143,9 +118,9 @@ | ||
| 143 | 118 | |
| 144 | 119 | public function get_bulk_actions() { |
| 145 | 120 | $actions = array(); |
| 146 | 121 | |
| 147 | - if ( 'trash' === $this->status ) { | |
| 122 | + if ( 'trash' == $this->status ) { | |
| 148 | 123 | if ( current_user_can( 'frm_edit_forms' ) ) { |
| 149 | 124 | $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
| 150 | 125 | } |
| 151 | 126 | |
| @@ -160,35 +135,24 @@ | ||
| 160 | 135 | |
| 161 | 136 | return $actions; |
| 162 | 137 | } |
| 163 | 138 | |
| 164 | - /** | |
| 165 | - * @param string $which | |
| 166 | - * | |
| 167 | - * @return void | |
| 168 | - */ | |
| 169 | 139 | public function extra_tablenav( $which ) { |
| 170 | - if ( 'top' !== $which ) { | |
| 140 | + if ( 'top' != $which ) { | |
| 171 | 141 | return; |
| 172 | 142 | } |
| 173 | 143 | |
| 174 | - if ( 'trash' !== $this->status || ! current_user_can( 'frm_delete_forms' ) ) { | |
| 175 | - return; | |
| 144 | + if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) { | |
| 145 | + ?> | |
| 146 | + <div class="alignleft actions frm_visible_overflow"> | |
| 147 | + <?php submit_button( __( 'Empty Trash', 'formidable' ), 'apply', 'delete_all', false ); ?> | |
| 148 | + </div> | |
| 149 | + <?php | |
| 176 | 150 | } |
| 177 | - | |
| 178 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 179 | - ?> | |
| 180 | - <div class="alignleft actions frm_visible_overflow"> | |
| 181 | - <?php submit_button( __( 'Empty Trash', 'formidable' ), 'apply', 'delete_all', false ); ?> | |
| 182 | - </div> | |
| 183 | - <?php | |
| 184 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 185 | 151 | } |
| 186 | 152 | |
| 187 | - /** | |
| 188 | - * @return array | |
| 189 | - */ | |
| 190 | 153 | public function get_views() { |
| 154 | + | |
| 191 | 155 | $statuses = array( |
| 192 | 156 | 'published' => __( 'My Forms', 'formidable' ), |
| 193 | 157 | 'draft' => __( 'Drafts', 'formidable' ), |
| 194 | 158 | 'trash' => __( 'Trash', 'formidable' ), |
| @@ -195,14 +159,8 @@ | ||
| 195 | 159 | ); |
| 196 | 160 | |
| 197 | 161 | $links = array(); |
| 198 | 162 | $counts = FrmForm::get_count(); |
| 199 | - $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); | |
| 200 | - | |
| 201 | - if ( isset( $statuses[ $form_type ] ) ) { | |
| 202 | - $counts->$form_type = $this->total_items; | |
| 203 | - } | |
| 204 | - | |
| 205 | 163 | $form_type = self::get_param( |
| 206 | 164 | array( |
| 207 | 165 | 'param' => 'form_type', |
| 208 | 166 | 'default' => 'published', |
| @@ -209,13 +167,18 @@ | ||
| 209 | 167 | ) |
| 210 | 168 | ); |
| 211 | 169 | |
| 212 | 170 | foreach ( $statuses as $status => $name ) { |
| 213 | - $class = $status == $form_type ? ' class="current"' : ''; // phpcs:ignore Universal.Operators.StrictComparisons | |
| 214 | 171 | |
| 172 | + if ( $status == $form_type ) { | |
| 173 | + $class = ' class="current"'; | |
| 174 | + } else { | |
| 175 | + $class = ''; | |
| 176 | + } | |
| 177 | + | |
| 215 | 178 | if ( $counts->{$status} || 'draft' !== $status ) { |
| 216 | 179 | /* translators: %1$s: Status, %2$s: Number of items */ |
| 217 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 180 | + $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; | |
| 218 | 181 | } |
| 219 | 182 | |
| 220 | 183 | unset( $status, $name ); |
| 221 | 184 | } |
| @@ -222,13 +185,8 @@ | ||
| 222 | 185 | |
| 223 | 186 | return $links; |
| 224 | 187 | } |
| 225 | 188 | |
| 226 | - /** | |
| 227 | - * @param string $which | |
| 228 | - * | |
| 229 | - * @return void | |
| 230 | - */ | |
| 231 | 189 | public function pagination( $which ) { |
| 232 | 190 | global $mode; |
| 233 | 191 | |
| 234 | 192 | parent::pagination( $which ); |
| @@ -240,13 +198,12 @@ | ||
| 240 | 198 | |
| 241 | 199 | /** |
| 242 | 200 | * @param stdClass $item |
| 243 | 201 | * @param string $style |
| 244 | - * | |
| 245 | 202 | * @return string |
| 246 | 203 | */ |
| 247 | 204 | public function single_row( $item, $style = '' ) { |
| 248 | - global $mode; | |
| 205 | + global $frm_vars, $mode; | |
| 249 | 206 | |
| 250 | 207 | // Set up the hover actions for this user |
| 251 | 208 | $actions = array(); |
| 252 | 209 | $edit_link = FrmForm::get_edit_link( $item->id ); |
| @@ -255,31 +212,24 @@ | ||
| 255 | 212 | |
| 256 | 213 | $action_links = $this->row_actions( $actions ); |
| 257 | 214 | |
| 258 | 215 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
| 259 | - $checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />'; | |
| 260 | - $checkbox_label_text = sprintf( | |
| 261 | - // translators: Form title | |
| 262 | - __( 'Select %s', 'formidable' ), | |
| 263 | - ! empty( $item->name ) ? $item->name : FrmFormsHelper::get_no_title_text() | |
| 264 | - ); | |
| 216 | + $checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />'; | |
| 265 | 217 | |
| 266 | - $checkbox .= '<label for="cb-item-action-' . absint( $item->id ) . '"><span class="screen-reader-text">' . esc_html( $checkbox_label_text ) . '</span></label>'; | |
| 267 | - $r = '<tr id="item-action-' . absint( $item->id ) . '"' . $style . '>'; | |
| 218 | + $r = '<tr id="item-action-' . absint( $item->id ) . '"' . $style . '>'; | |
| 268 | 219 | |
| 269 | 220 | list( $columns, $hidden ) = $this->get_column_info(); |
| 270 | 221 | |
| 271 | 222 | $format = 'Y/m/d'; |
| 272 | - | |
| 273 | - if ( 'list' !== $mode ) { | |
| 223 | + if ( 'list' != $mode ) { | |
| 274 | 224 | $format .= ' \<\b\r \/\> g:i:s a'; |
| 275 | 225 | } |
| 276 | 226 | |
| 277 | 227 | foreach ( $columns as $column_name => $column_display_name ) { |
| 278 | - $class = $column_name . ' column-' . $column_name . ( 'name' === $column_name ? ' post-title page-title column-title' : '' ); | |
| 228 | + $class = $column_name . ' column-' . $column_name . ( 'name' == $column_name ? ' post-title page-title column-title' : '' ); | |
| 229 | + | |
| 279 | 230 | $style = ''; |
| 280 | - | |
| 281 | - if ( in_array( $column_name, $hidden, true ) ) { | |
| 231 | + if ( in_array( $column_name, $hidden ) ) { | |
| 282 | 232 | $class .= ' frm_hidden'; |
| 283 | 233 | } |
| 284 | 234 | |
| 285 | 235 | if ( $column_name === 'name' ) { |
| @@ -298,9 +248,9 @@ | ||
| 298 | 248 | case 'form_key': |
| 299 | 249 | $val = $item->{$column_name}; |
| 300 | 250 | break; |
| 301 | 251 | case 'name': |
| 302 | - $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); | |
| 252 | + $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); | |
| 303 | 253 | $val .= $action_links; |
| 304 | 254 | break; |
| 305 | 255 | case 'created_at': |
| 306 | 256 | $date = gmdate( $format, strtotime( $item->created_at ) ); |
| @@ -306,9 +256,9 @@ | ||
| 306 | 256 | $date = gmdate( $format, strtotime( $item->created_at ) ); |
| 307 | 257 | $val = '<abbr title="' . esc_attr( gmdate( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
| 308 | 258 | break; |
| 309 | 259 | case 'entries': |
| 310 | - if ( ! empty( $item->options['no_save'] ) ) { | |
| 260 | + if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { | |
| 311 | 261 | $val = FrmAppHelper::icon_by_class( |
| 312 | 262 | 'frmfont frm_forbid_icon frm_bstooltip', |
| 313 | 263 | array( |
| 314 | 264 | 'title' => __( 'Saving entries is disabled for this form', 'formidable' ), |
| @@ -316,9 +266,9 @@ | ||
| 316 | 266 | ) |
| 317 | 267 | ); |
| 318 | 268 | } else { |
| 319 | 269 | $text = FrmEntry::getRecordCount( $item->id ); |
| 320 | - $val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 270 | + $val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; | |
| 321 | 271 | unset( $text ); |
| 322 | 272 | } |
| 323 | 273 | break; |
| 324 | 274 | default: |
| @@ -325,9 +275,9 @@ | ||
| 325 | 275 | if ( method_exists( $this, 'column_' . $column_name ) ) { |
| 326 | 276 | $val = call_user_func( array( $this, 'column_' . $column_name ), $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 327 | 277 | } |
| 328 | 278 | break; |
| 329 | - }//end switch | |
| 279 | + } | |
| 330 | 280 | |
| 331 | 281 | if ( isset( $val ) ) { |
| 332 | 282 | $r .= "<td $attributes>"; |
| 333 | 283 | $r .= $val; |
| @@ -333,10 +283,12 @@ | ||
| 333 | 283 | $r .= $val; |
| 334 | 284 | $r .= '</td>'; |
| 335 | 285 | } |
| 336 | 286 | unset( $val ); |
| 337 | - }//end foreach | |
| 338 | - return $r . '</tr>'; | |
| 287 | + } | |
| 288 | + $r .= '</tr>'; | |
| 289 | + | |
| 290 | + return $r; | |
| 339 | 291 | } |
| 340 | 292 | |
| 341 | 293 | /** |
| 342 | 294 | * Get the HTML for the Actions column in the form list. |
| @@ -344,19 +296,17 @@ | ||
| 344 | 296 | * |
| 345 | 297 | * @since 6.0 |
| 346 | 298 | * |
| 347 | 299 | * @param stdClass $form |
| 348 | - * | |
| 349 | 300 | * @return string |
| 350 | 301 | */ |
| 351 | 302 | protected function column_shortcode( $form ) { |
| 352 | - $val = '<a href="#" class="frm-embed-form" role="button" aria-label="' . esc_attr__( 'Embed Form', 'formidable' ) . '">' . FrmAppHelper::icon_by_class( 'frmfont frm_code_icon', array( 'echo' => false ) ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 303 | + $val = '<a href="#" class="frm-embed-form" role="button" aria-label="' . esc_html__( 'Embed Form', 'formidable' ) . '">' . FrmAppHelper::icon_by_class( 'frmfont frm_code_icon', array( 'echo' => false ) ) . '</a>'; | |
| 353 | 304 | $val .= $this->column_style( $form ); |
| 354 | - $val .= $this->column_views( $form ); | |
| 355 | 305 | $val = apply_filters( 'frm_form_list_actions', $val, array( 'form' => $form ) ); |
| 356 | - // Remove the space hard coded in Landing pages. | |
| 357 | - $val = str_replace( ' ', '', $val ); | |
| 358 | - return '<div>' . $val . '</div>'; | |
| 306 | + $val = str_replace( ' ', '', $val ); // Remove the space hard coded in Landing pages. | |
| 307 | + $val = '<div>' . $val . '</div>'; | |
| 308 | + return $val; | |
| 359 | 309 | } |
| 360 | 310 | |
| 361 | 311 | /** |
| 362 | 312 | * Get the HTML for the Style column in the form list. |
| @@ -363,13 +313,12 @@ | ||
| 363 | 313 | * |
| 364 | 314 | * @since 6.0 |
| 365 | 315 | * |
| 366 | 316 | * @param stdClass $form |
| 367 | - * | |
| 368 | 317 | * @return string |
| 369 | 318 | */ |
| 370 | 319 | protected function column_style( $form ) { |
| 371 | - $style_setting = $form->options['custom_style'] ?? ''; | |
| 320 | + $style_setting = isset( $form->options['custom_style'] ) ? $form->options['custom_style'] : ''; | |
| 372 | 321 | $frm_settings = FrmAppHelper::get_settings(); |
| 373 | 322 | |
| 374 | 323 | if ( $style_setting === '0' || 'none' === $frm_settings->load_style ) { |
| 375 | 324 | // Don't show a link if styling is off. |
| @@ -376,9 +325,8 @@ | ||
| 376 | 325 | return ''; |
| 377 | 326 | } |
| 378 | 327 | |
| 379 | 328 | $style = FrmStylesController::get_form_style( $form ); |
| 380 | - | |
| 381 | 329 | if ( ! $style ) { |
| 382 | 330 | // Do a second pass to avoid null values. |
| 383 | 331 | $frm_style = new FrmStyle( 'default' ); |
| 384 | 332 | $style = $frm_style->get_one(); |
| @@ -384,89 +332,53 @@ | ||
| 384 | 332 | $style = $frm_style->get_one(); |
| 385 | 333 | } |
| 386 | 334 | |
| 387 | 335 | $href = FrmStylesHelper::get_edit_url( $style, $form->id ); |
| 388 | - return '<a href="' . esc_url( $href ) . '" title="' . esc_attr( $style->post_title ) . '">' . FrmAppHelper::icon_by_class( 'frmfont frm_pallet_icon', array( 'echo' => false ) ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 336 | + return '<a href="' . esc_url( $href ) . '" title="' . esc_attr( $style->post_title ) . '">' . FrmAppHelper::icon_by_class( 'frmfont frm_pallet_icon', array( 'echo' => false ) ) . '</a>'; | |
| 389 | 337 | } |
| 390 | 338 | |
| 391 | 339 | /** |
| 392 | - * Generate the HTML for the form Views page. | |
| 393 | - * | |
| 394 | - * @since 6.19 | |
| 395 | - * | |
| 396 | - * @param stdClass $form Form object. | |
| 397 | - * | |
| 398 | - * @return string | |
| 399 | - */ | |
| 400 | - protected function column_views( $form ) { | |
| 401 | - $attributes = array( | |
| 402 | - 'href' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $form->id ) . '&show_nav=1' ), | |
| 403 | - 'title' => __( 'Link to list of all views for this form.', 'formidable' ), | |
| 404 | - 'target' => '_blank', | |
| 405 | - ); | |
| 406 | - | |
| 407 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 408 | - return '<a ' . FrmAppHelper::array_to_html_params( $attributes ) . '> | |
| 409 | - ' . FrmAppHelper::icon_by_class( 'frmfont frm_eye_icon', array( 'echo' => false ) ) . | |
| 410 | - '</a>'; | |
| 411 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 412 | - } | |
| 413 | - | |
| 414 | - /** | |
| 415 | - * @param array $actions | |
| 416 | - * @param object $item | |
| 417 | 340 | * @param string $edit_link |
| 418 | - * | |
| 419 | - * @return void | |
| 420 | 341 | */ |
| 421 | 342 | private function get_actions( &$actions, $item, $edit_link ) { |
| 422 | 343 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
| 423 | - | |
| 424 | 344 | foreach ( $new_actions as $link => $action ) { |
| 425 | 345 | $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
| 426 | 346 | } |
| 427 | 347 | |
| 428 | - if ( 'trash' === $this->status ) { | |
| 348 | + if ( 'trash' == $this->status ) { | |
| 429 | 349 | $actions = $new_actions; |
| 350 | + | |
| 430 | 351 | return; |
| 431 | 352 | } |
| 432 | 353 | |
| 433 | 354 | if ( current_user_can( 'frm_edit_forms' ) ) { |
| 434 | - $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . esc_html__( 'Edit', 'formidable' ) . '</a>'; | |
| 435 | - $actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . esc_html__( 'Settings', 'formidable' ) . '</a>'; | |
| 355 | + $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit', 'formidable' ) . '</a>'; | |
| 356 | + $actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; | |
| 436 | 357 | } |
| 437 | 358 | |
| 438 | 359 | $actions = array_merge( $actions, $new_actions ); |
| 439 | - $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . esc_html__( 'Preview', 'formidable' ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 360 | + $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview', 'formidable' ) . '</a>'; | |
| 440 | 361 | } |
| 441 | 362 | |
| 442 | 363 | /** |
| 443 | - * @param object $item | |
| 444 | - * @param array $actions | |
| 445 | 364 | * @param string $edit_link |
| 446 | - * @param string $mode | |
| 447 | - * | |
| 448 | - * @return string | |
| 449 | 365 | */ |
| 450 | 366 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
| 451 | 367 | $form_name = $item->name; |
| 452 | - | |
| 453 | - if ( is_null( $form_name ) || trim( $form_name ) === '' ) { | |
| 454 | - $form_name = FrmFormsHelper::get_no_title_text(); | |
| 368 | + if ( trim( $form_name ) == '' ) { | |
| 369 | + $form_name = __( '(no title)', 'formidable' ); | |
| 455 | 370 | } |
| 456 | - | |
| 457 | 371 | $form_name = FrmAppHelper::kses( $form_name ); |
| 458 | - | |
| 459 | - if ( 'excerpt' !== $mode ) { | |
| 372 | + if ( 'excerpt' != $mode ) { | |
| 460 | 373 | $form_name = FrmAppHelper::truncate( $form_name, 50 ); |
| 461 | 374 | } |
| 462 | 375 | |
| 463 | 376 | $val = '<strong>'; |
| 464 | - | |
| 465 | - if ( 'trash' === $this->status ) { | |
| 377 | + if ( 'trash' == $this->status ) { | |
| 466 | 378 | $val .= $form_name; |
| 467 | 379 | } else { |
| 468 | - $val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> '; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 380 | + $val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> '; | |
| 469 | 381 | } |
| 470 | 382 | |
| 471 | 383 | $this->add_draft_label( $item, $val ); |
| 472 | 384 | $val .= '</strong>'; |
| @@ -476,29 +388,22 @@ | ||
| 476 | 388 | return $val; |
| 477 | 389 | } |
| 478 | 390 | |
| 479 | 391 | /** |
| 480 | - * @param object $item | |
| 481 | 392 | * @param string $val |
| 482 | - * | |
| 483 | - * @return void | |
| 484 | 393 | */ |
| 485 | 394 | private function add_draft_label( $item, &$val ) { |
| 486 | - if ( 'draft' === $item->status && 'draft' !== $this->status ) { | |
| 487 | - $val .= ' - <span class="post-state">' . esc_html__( 'Draft', 'formidable' ) . '</span>'; | |
| 395 | + if ( 'draft' == $item->status && 'draft' != $this->status ) { | |
| 396 | + $val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>'; | |
| 488 | 397 | } |
| 489 | 398 | } |
| 490 | 399 | |
| 491 | 400 | /** |
| 492 | - * @param object $item | |
| 493 | 401 | * @param string $val |
| 494 | - * | |
| 495 | - * @return void | |
| 496 | 402 | */ |
| 497 | 403 | private function add_form_description( $item, &$val ) { |
| 498 | 404 | global $mode; |
| 499 | - | |
| 500 | - if ( 'excerpt' === $mode && ! is_null( $item->description ) ) { | |
| 405 | + if ( 'excerpt' == $mode ) { | |
| 501 | 406 | $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 ); |
| 502 | 407 | } |
| 503 | 408 | } |
| 504 | 409 | |