Use new code style
This commit is contained in:
@ -29,8 +29,7 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
parent::__construct();
|
||||
|
||||
$this->current_mode = 'list';
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
@ -45,8 +44,7 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the inside column responsive.
|
||||
@ -62,46 +60,54 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
echo wu_responsive_table_row(array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url($redirect, array(
|
||||
'id' => $item->get_id(),
|
||||
)),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
), array(
|
||||
'link' => array(
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
'value' => $item->get_active_site_url(),
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
'dashboard' => array(
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
array(
|
||||
'link' => array(
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
'value' => $item->get_active_site_url(),
|
||||
),
|
||||
'dashboard' => array(
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
),
|
||||
'membership' => array(
|
||||
'icon' => 'dashicons-wu-rotate-ccw wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Membership', 'wp-ultimo'),
|
||||
'value' => $m ? $m->get_hash() : '',
|
||||
'url' => $m ? wu_network_admin_url(
|
||||
'wp-ultimo-edit-membership',
|
||||
array(
|
||||
'id' => $m->get_id(),
|
||||
)
|
||||
) : '',
|
||||
),
|
||||
),
|
||||
'membership' => array(
|
||||
'icon' => 'dashicons-wu-rotate-ccw wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Membership', 'wp-ultimo'),
|
||||
'value' => $m ? $m->get_hash() : '',
|
||||
'url' => $m ? wu_network_admin_url('wp-ultimo-edit-membership', array(
|
||||
'id' => $m->get_id(),
|
||||
)) : '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
/* translators: the placeholder is a date */
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
));
|
||||
|
||||
} // end column_responsive;
|
||||
array(
|
||||
'date_created' => array(
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
/* translators: the placeholder is a date */
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent method to add pending sites.
|
||||
@ -118,10 +124,8 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
$sites = parent::get_items($per_page, $page_number, $count);
|
||||
|
||||
if ($count) {
|
||||
|
||||
return $sites;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$pending_sites = array();
|
||||
|
||||
@ -129,14 +133,11 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
|
||||
$id = wu_request('id');
|
||||
|
||||
if (!$id) {
|
||||
|
||||
if ( ! $id) {
|
||||
return $sites;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
switch ($page) {
|
||||
|
||||
case 'wp-ultimo-edit-membership':
|
||||
$membership = wu_get_membership($id);
|
||||
$pending_sites = $membership && $membership->get_pending_site() ? array($membership->get_pending_site()) : array();
|
||||
@ -145,18 +146,13 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
$customer = wu_get_customer($id);
|
||||
$pending_sites = $customer ? $customer->get_pending_sites() : array();
|
||||
break;
|
||||
|
||||
} // end switch;
|
||||
}
|
||||
|
||||
foreach ($pending_sites as &$site) {
|
||||
|
||||
$site->set_type('pending');
|
||||
$site->set_blog_id('--');
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
return array_merge($pending_sites, $sites);
|
||||
|
||||
} // end get_items;
|
||||
|
||||
} // end class Customers_Site_List_Table;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user