/** * Retrieve the deactivation date. * * @since 1.0 * * @param array $options * * @return string */ public function deactivation_date($options = array()) { $defaults = array('format' => 'html', 'df' => str_replace('F', 'M', get_option('date_format')), 'label' => __('Deactivation', ITELIC\Plugin::SLUG)); $options = ITUtility::merge_defaults($options, $defaults); if ($this->activation) { if ($this->activation->get_deactivation() === null) { $value = ''; } else { $value = \ITELIC\convert_gmt_to_local($this->activation->get_deactivation())->format($options['df']); } } else { $value = ''; } switch ($options['format']) { case 'html': return $value; break; case 'value': return $value; break; case 'label': return $options['label']; break; default: return $value; break; } }
/** * Get the activation row HTML. * * @since 1.0 * * @param Activation $activation * * @return string */ public function get_activation_row_html(Activation $activation) { $n_deactivate = wp_create_nonce('itelic-remote-deactivate-' . $activation->get_id()); $n_delete = wp_create_nonce('itelic-remote-delete-' . $activation->get_id()); ob_start(); ?> <tr> <td data-title="<?php _e("Location", Plugin::SLUG); ?> "> <?php echo $activation->get_location(); ?> </td> <td data-title="<?php _e("Status", Plugin::SLUG); ?> "> <?php echo $activation->get_status(true); ?> </td> <td data-title="<?php _e("Activation", Plugin::SLUG); ?> "> <?php echo \ITELIC\convert_gmt_to_local($activation->get_activation())->format($this->get_short_df()); ?> </td> <td data-title="<?php _e("Deactivation", Plugin::SLUG); ?> "> <?php if (null === ($d = $activation->get_deactivation())) { ?> <a href="javascript:" data-id="<?php echo esc_attr($activation->get_id()); ?> " data-nonce="<?php echo $n_deactivate; ?> " class="deactivate"> <?php _e("Deactivate", Plugin::SLUG); ?> </a> <?php } else { ?> <?php echo \ITELIC\convert_gmt_to_local($d)->format($this->get_short_df()); ?> <?php } ?> </td> <td data-title="<?php _e("Version", Plugin::SLUG); ?> "> <?php if (null === ($r = $activation->get_release())) { ?> <?php _e("Unknown", Plugin::SLUG); ?> <?php } else { ?> <?php printf('v%s', $r->get_version()); ?> <?php } ?> </td> <td data-title="<?php _e("Delete", Plugin::SLUG); ?> "> <button data-id="<?php echo esc_attr($activation->get_id()); ?> " class="remove-item" data-nonce="<?php echo $n_delete; ?> "> × </button> </td> </tr> <?php return ob_get_clean(); }
/** * Get data to display for a single key. * * @param \ITELIC\Activation $activation * @param bool $raw * * @return array */ protected function get_fields_for_object(\ITELIC\Activation $activation, $raw = false) { if ($activation->get_deactivation()) { $deactivated = $activation->get_deactivation()->format(DateTime::ISO8601); } else { $deactivated = '-'; } return array('id' => $activation->get_id(), 'key' => $activation->get_key()->get_key(), 'location' => $activation->get_location(), 'status' => $activation->get_status(!$raw), 'activated' => $activation->get_activation()->format(DateTime::ISO8601), 'deactivated' => $deactivated, 'version' => $activation->get_release() ? $activation->get_release()->get_version() : 'Unknown', 'track' => $activation->get_meta('track', true) ? $activation->get_meta('track', true) : 'stable'); }