]> _ Git - couzy.git/blob
d785eec93a223bef6357170eb5abe3ca369d0c55
[couzy.git] /
1 <?php
2 /**
3  * @package WPSEO\Admin\Bulk Editor
4  * @since      1.5.0
5  */
6
7 /**
8  * Implements table for bulk description editing.
9  */
10 class WPSEO_Bulk_Description_List_Table extends WPSEO_Bulk_List_Table {
11
12         /**
13          * Current type for this class will be (meta) description.
14          *
15          * @var string
16          */
17         protected $page_type = 'description';
18
19         /**
20          * Settings with are used in __construct
21          *
22          * @var array
23          */
24         protected $settings = array(
25                 'singular' => 'wpseo_bulk_description',
26                 'plural'   => 'wpseo_bulk_descriptions',
27                 'ajax'     => true,
28         );
29
30         /**
31          * The field in the database where meta field is saved.
32          * @var string
33          */
34         protected $target_db_field = 'metadesc';
35
36         /**
37          * The columns shown on the table
38          *
39          * @return array
40          */
41         public function get_columns() {
42                 $columns = array(
43                         'col_existing_yoast_seo_metadesc' => __( 'Existing Yoast Meta Description', 'wordpress-seo' ),
44                         'col_new_yoast_seo_metadesc'      => __( 'New Yoast Meta Description', 'wordpress-seo' ),
45                 );
46
47                 return $this->merge_columns( $columns );
48         }
49
50         /**
51          * Parse the metadescription
52          *
53          * @param string $column_name
54          * @param object $record
55          * @param string $attributes
56          *
57          * @return string
58          */
59         protected function parse_page_specific_column( $column_name, $record, $attributes ) {
60                 switch ( $column_name ) {
61                         case 'col_new_yoast_seo_metadesc':
62                                 return sprintf(
63                                         '<textarea id="%1$s" name="%1$s" class="wpseo-new-metadesc" data-id="%2$s"></textarea>',
64                                         'wpseo-new-metadesc-' . $record->ID,
65                                         $record->ID
66                                 );
67                                 break;
68
69                         case 'col_existing_yoast_seo_metadesc':
70                                 // TODO inconsistent return/echo behavior R.
71                                 echo $this->parse_meta_data_field( $record->ID, $attributes );
72                                 break;
73                 }
74         }
75
76 } /* End of class */