| @@ -13,11 +13,8 @@ | ||
| 13 | 13 | |
| 14 | 14 | parent::__construct( $args ); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - /** | |
| 18 | - * @return void | |
| 19 | - */ | |
| 20 | 17 | public function prepare_items() { |
| 21 | 18 | global $wpdb, $per_page, $mode; |
| 22 | 19 | |
| 23 | 20 | $page = $this->get_pagenum(); |
| @@ -102,11 +99,8 @@ | ||
| 102 | 99 | ) |
| 103 | 100 | ); |
| 104 | 101 | } |
| 105 | 102 | |
| 106 | - /** | |
| 107 | - * @return void | |
| 108 | - */ | |
| 109 | 103 | public function no_items() { |
| 110 | 104 | if ( $this->status === 'trash' ) { |
| 111 | 105 | echo '<p>'; |
| 112 | 106 | esc_html_e( 'No forms found in the trash.', 'formidable' ); |
| @@ -141,11 +135,8 @@ | ||
| 141 | 135 | |
| 142 | 136 | return $actions; |
| 143 | 137 | } |
| 144 | 138 | |
| 145 | - /** | |
| 146 | - * @return void | |
| 147 | - */ | |
| 148 | 139 | public function extra_tablenav( $which ) { |
| 149 | 140 | if ( 'top' != $which ) { |
| 150 | 141 | return; |
| 151 | 142 | } |
| @@ -168,14 +159,8 @@ | ||
| 168 | 159 | ); |
| 169 | 160 | |
| 170 | 161 | $links = array(); |
| 171 | 162 | $counts = FrmForm::get_count(); |
| 172 | - $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); | |
| 173 | - | |
| 174 | - if ( isset( $statuses[ $form_type ] ) ) { | |
| 175 | - $counts->$form_type = $this->total_items; | |
| 176 | - } | |
| 177 | - | |
| 178 | 163 | $form_type = self::get_param( |
| 179 | 164 | array( |
| 180 | 165 | 'param' => 'form_type', |
| 181 | 166 | 'default' => 'published', |
| @@ -200,11 +185,8 @@ | ||
| 200 | 185 | |
| 201 | 186 | return $links; |
| 202 | 187 | } |
| 203 | 188 | |
| 204 | - /** | |
| 205 | - * @return void | |
| 206 | - */ | |
| 207 | 189 | public function pagination( $which ) { |
| 208 | 190 | global $mode; |
| 209 | 191 | |
| 210 | 192 | parent::pagination( $which ); |
| @@ -213,13 +195,8 @@ | ||
| 213 | 195 | $this->view_switcher( $mode ); |
| 214 | 196 | } |
| 215 | 197 | } |
| 216 | 198 | |
| 217 | - /** | |
| 218 | - * @param stdClass $item | |
| 219 | - * @param string $style | |
| 220 | - * @return string | |
| 221 | - */ | |
| 222 | 199 | public function single_row( $item, $style = '' ) { |
| 223 | 200 | global $frm_vars, $mode; |
| 224 | 201 | |
| 225 | 202 | // Set up the hover actions for this user |
| @@ -249,12 +226,8 @@ | ||
| 249 | 226 | if ( in_array( $column_name, $hidden ) ) { |
| 250 | 227 | $class .= ' frm_hidden'; |
| 251 | 228 | } |
| 252 | 229 | |
| 253 | - if ( $column_name === 'name' ) { | |
| 254 | - $class .= ' column-primary'; | |
| 255 | - } | |
| 256 | - | |
| 257 | 230 | $class = 'class="' . esc_attr( $class ) . '"'; |
| 258 | 231 | $data_colname = ' data-colname="' . esc_attr( $column_display_name ) . '"'; |
| 259 | 232 | $attributes = $class . $style . $data_colname; |
| 260 | 233 | |
| @@ -268,13 +241,20 @@ | ||
| 268 | 241 | break; |
| 269 | 242 | case 'name': |
| 270 | 243 | $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
| 271 | 244 | $val .= $action_links; |
| 245 | + | |
| 272 | 246 | break; |
| 273 | 247 | case 'created_at': |
| 274 | 248 | $date = gmdate( $format, strtotime( $item->created_at ) ); |
| 275 | 249 | $val = '<abbr title="' . esc_attr( gmdate( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
| 276 | 250 | break; |
| 251 | + case 'shortcode': | |
| 252 | + $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>'; | |
| 253 | + if ( 'excerpt' == $mode ) { | |
| 254 | + $val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />'; | |
| 255 | + } | |
| 256 | + break; | |
| 277 | 257 | case 'entries': |
| 278 | 258 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
| 279 | 259 | $val = FrmAppHelper::icon_by_class( |
| 280 | 260 | 'frmfont frm_forbid_icon frm_bstooltip', |
| @@ -287,14 +267,8 @@ | ||
| 287 | 267 | $text = FrmEntry::getRecordCount( $item->id ); |
| 288 | 268 | $val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
| 289 | 269 | unset( $text ); |
| 290 | 270 | } |
| 291 | - break; | |
| 292 | - default: | |
| 293 | - if ( method_exists( $this, 'column_' . $column_name ) ) { | |
| 294 | - $val = call_user_func( array( $this, 'column_' . $column_name ), $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 295 | - } | |
| 296 | - break; | |
| 297 | 271 | } |
| 298 | 272 | |
| 299 | 273 | if ( isset( $val ) ) { |
| 300 | 274 | $r .= "<td $attributes>"; |
| @@ -308,59 +282,9 @@ | ||
| 308 | 282 | return $r; |
| 309 | 283 | } |
| 310 | 284 | |
| 311 | 285 | /** |
| 312 | - * Get the HTML for the Actions column in the form list. | |
| 313 | - * This includes multiple icons for triggering the embed modal, the visual styler, and an active landing page. | |
| 314 | - * | |
| 315 | - * @since 6.0 | |
| 316 | - * | |
| 317 | - * @param stdClass $form | |
| 318 | - * @return string | |
| 319 | - */ | |
| 320 | - protected function column_shortcode( $form ) { | |
| 321 | - $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>'; | |
| 322 | - $val .= $this->column_style( $form ); | |
| 323 | - $val = apply_filters( 'frm_form_list_actions', $val, array( 'form' => $form ) ); | |
| 324 | - $val = str_replace( ' ', '', $val ); // Remove the space hard coded in Landing pages. | |
| 325 | - $val = '<div>' . $val . '</div>'; | |
| 326 | - return $val; | |
| 327 | - } | |
| 328 | - | |
| 329 | - /** | |
| 330 | - * Get the HTML for the Style column in the form list. | |
| 331 | - * | |
| 332 | - * @since 6.0 | |
| 333 | - * | |
| 334 | - * @param stdClass $form | |
| 335 | - * @return string | |
| 336 | - */ | |
| 337 | - protected function column_style( $form ) { | |
| 338 | - $style_setting = isset( $form->options['custom_style'] ) ? $form->options['custom_style'] : ''; | |
| 339 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 340 | - | |
| 341 | - if ( $style_setting === '0' || 'none' === $frm_settings->load_style ) { | |
| 342 | - // Don't show a link if styling is off. | |
| 343 | - return ''; | |
| 344 | - } | |
| 345 | - | |
| 346 | - $style = FrmStylesController::get_form_style( $form ); | |
| 347 | - if ( ! $style ) { | |
| 348 | - // Do a second pass to avoid null values. | |
| 349 | - $frm_style = new FrmStyle( 'default' ); | |
| 350 | - $style = $frm_style->get_one(); | |
| 351 | - } | |
| 352 | - | |
| 353 | - $href = FrmStylesHelper::get_edit_url( $style, $form->id ); | |
| 354 | - return '<a href="' . esc_url( $href ) . '" title="' . esc_attr( $style->post_title ) . '">' . FrmAppHelper::icon_by_class( 'frmfont frm_pallet_icon', array( 'echo' => false ) ) . '</a>'; | |
| 355 | - } | |
| 356 | - | |
| 357 | - /** | |
| 358 | 286 | * @param string $edit_link |
| 359 | - * @param array $actions | |
| 360 | - * @param stdClass $item | |
| 361 | - * | |
| 362 | - * @return void | |
| 363 | 287 | */ |
| 364 | 288 | private function get_actions( &$actions, $item, $edit_link ) { |
| 365 | 289 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
| 366 | 290 | foreach ( $new_actions as $link => $action ) { |
| @@ -383,11 +307,8 @@ | ||
| 383 | 307 | } |
| 384 | 308 | |
| 385 | 309 | /** |
| 386 | 310 | * @param string $edit_link |
| 387 | - * @param stdClass $item | |
| 388 | - * | |
| 389 | - * @return string | |
| 390 | 311 | */ |
| 391 | 312 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
| 392 | 313 | $form_name = $item->name; |
| 393 | 314 | if ( trim( $form_name ) == '' ) { |
| @@ -414,10 +335,8 @@ | ||
| 414 | 335 | } |
| 415 | 336 | |
| 416 | 337 | /** |
| 417 | 338 | * @param string $val |
| 418 | - * | |
| 419 | - * @return void | |
| 420 | 339 | */ |
| 421 | 340 | private function add_draft_label( $item, &$val ) { |
| 422 | 341 | if ( 'draft' == $item->status && 'draft' != $this->status ) { |
| 423 | 342 | $val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>'; |
| @@ -425,10 +344,8 @@ | ||
| 425 | 344 | } |
| 426 | 345 | |
| 427 | 346 | /** |
| 428 | 347 | * @param string $val |
| 429 | - * | |
| 430 | - * @return void | |
| 431 | 348 | */ |
| 432 | 349 | private function add_form_description( $item, &$val ) { |
| 433 | 350 | global $mode; |
| 434 | 351 | if ( 'excerpt' == $mode ) { |