[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-admin/ -> import.php (source)

   1  <?php
   2  class MP_AdminPage extends MP_adminpage_list_
   3  {
   4      const screen         = MailPress_page_import;
   5      const capability     = 'MailPress_import';
   6      const help_url        = 'http://blog.mailpress.org/tutorials/add-ons/import/';
   7      const file            = __FILE__;
   8  
   9      const per_page         = false;
  10  
  11  ////  Title  ////
  12  
  13  	public static function title() 
  14      {
  15          new MP_Import_importers();
  16      }
  17  
  18  ////  Columns  ////
  19  
  20  	public static function get_columns() 
  21      {
  22          $columns = array(    'name'     => __('Name', MP_TXTDOM), 
  23                      'desc'    => __('Description', MP_TXTDOM));
  24          return $columns;
  25      }
  26  
  27  //// List ////
  28  
  29  	public static function get_list($args = array()) 
  30      {
  31          $importers = MP_Import_importers::get_all();
  32  
  33          return ( empty($importers) ) ? false : $importers;
  34      }
  35  
  36  ////  Row  ////
  37  
  38  	public static function get_row( $id, $data ) 
  39      {
  40  
  41          static $row_class = '';
  42  
  43  // url's
  44          $url_parms = array();
  45          $url_parms['mp_import']     = $id;
  46          $import_url = esc_url(self::url( MailPress_import, $url_parms ));
  47  // actions
  48          $actions = array();
  49          $actions['import'] = "<a href='$import_url' title='" . wptexturize(strip_tags($data[1])) . "'>" . ((strpos($id, 'export') !== false) ?  __('Export', MP_TXTDOM) : __('Import', MP_TXTDOM) ) . '</a>';
  50  
  51          $row_class = 'alternate active' == $row_class ? '' : 'alternate active';
  52  
  53          $out = '';
  54          $out .= "<tr class='$row_class'>";
  55  
  56          $columns = self::get_columns();
  57          $hidden  = self::get_hidden_columns();
  58  
  59          foreach ( $columns as $column_name => $column_display_name ) 
  60          {
  61              $class = "class='$column_name column-$column_name'";
  62  
  63              $style = '';
  64              if ( in_array($column_name, $hidden) )
  65                  $style = ' style="display:none;"';
  66  
  67              $attributes = "$class$style";
  68  
  69              switch ($column_name) 
  70              {
  71                  case 'name':
  72                      $out .= "<td $attributes><strong><a class='row-title' href='$import_url' title='" . esc_attr(sprintf(__('Import "%s"', MP_TXTDOM), $data[1])) . "'>{$data[0]}</a></strong>";
  73                      $out .= self::get_actions($actions);
  74                      $out .= '</td>';
  75                  break;
  76                  case 'desc' :
  77                      $out .= "<td $attributes>" . $data[1] . "</td>";
  78                  break;
  79              }
  80          }
  81          $out .= '</tr>';
  82  
  83          return $out;
  84      }
  85  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1