p =& $plugin; if ( $this->p->debug->enabled ) { $this->p->debug->mark(); } $this->menu_id = $id; $this->menu_name = $name; $this->menu_lib = $lib; $this->menu_ext = $ext; $this->menu_metaboxes = array( 'licenses' => _x( 'Plugin and Add-on Licenses', 'metabox title', 'wpsso' ), ); } /* * Remove the "Change to View" button from this settings page. */ protected function add_form_buttons_change_show_options( &$form_button_rows ) { } /* * Callback method must be public for add_meta_box() hook. * * See WpssoAdmin->add_settings_page_metaboxes(). */ public function show_metabox_licenses( $obj, $mb ) { if ( $this->p->debug->enabled ) { $this->p->debug->mark(); } $args = isset( $mb[ 'args' ] ) ? $mb[ 'args' ] : array(); $network = isset( $args[ 'network' ] ) ? $args[ 'network' ] : false; $ext_sorted = WpssoConfig::get_ext_sorted(); foreach ( $ext_sorted as $ext => $info ) { if ( empty( $info[ 'update_auth' ] ) ) { // Only show plugins with Premium packages. unset( $ext_sorted[ $ext ] ); } } $tabindex = 0; $ext_num = 0; $ext_total = count( $ext_sorted ); $pkg_info = $this->p->util->get_pkg_info(); // Uses a local cache. $charset = get_bloginfo( $show = 'charset', $filter = 'raw' ); $icon_px = 100; echo '
| ' . $this->p->msgs->get( 'info-plugin-tid' . ( $network ? '-network' : '' ) ) . ' | ' .
'' . $ext_name_html .
( empty( $ext_links ) ? '' : ' ' . implode( $glue = ' | ', $ext_links ) . ' ' ) .
' | ';
/*
* Authentication ID.
*/
$table_rows[ 'plugin_tid' ] = '' .
$this->form->get_th_html( sprintf( _x( '%s Authentication ID', 'option label', 'wpsso' ), $info[ 'short' ] ), 'medium nowrap' ) .
'' . $this->form->get_input( 'plugin_' . $ext . '_tid', $css_class = 'tid mono', $css_id = '', $len = 0, $placeholder, $is_disabled = false, ++$tabindex ) . ' | '; $table_rows[ 'site_use' ] = self::get_option_site_use( 'plugin_' . $ext . '_tid', $this->form, $network ); /* * License information. */ $table_rows[ 'home_url' ] = '' . '' . _x( 'Current Site Address', 'option label', 'wpsso' ) . ' | ' . '' . $home_path . ' ' . $edit_link . ' | ';
if ( ! empty( $this->p->options[ 'plugin_' . $ext . '_tid' ] ) && class_exists( 'SucomUpdate' ) ) {
$show_update_opts = array(
'exp_date' => _x( 'Support and Updates Expire', 'option label', 'wpsso' ),
'qty_used' => _x( 'License Information', 'option label', 'wpsso' ),
);
foreach ( $show_update_opts as $key => $label ) {
$val = SucomUpdate::get_option( $ext, $key );
if ( empty( $val ) ) { // Add an empty row for empty values.
$val = _x( 'Not available', 'option value', 'wpsso' );
} elseif ( 'exp_date' === $key ) {
if ( '0000-00-00 00:00:00' === $val ) {
$val = _x( 'Never (Nontransferable Lifetime License)', 'option value', 'wpsso' );
}
} elseif ( 'qty_used' === $key ) {
$qty_reg = SucomUpdate::get_option( $ext, 'qty_reg' );
$qty_total = SucomUpdate::get_option( $ext, 'qty_total' );
if ( null !== $qty_reg && null !== $qty_total ) { // Just in case.
$val = sprintf( __( '%d of %d site addresses registered', 'wpsso' ), $qty_reg, $qty_total );
} else $val = sprintf( __( '%s site addresses registered', 'wpsso' ), $val );
if ( ! empty( $info[ 'url' ][ 'info' ] ) ) {
$info_url = add_query_arg( array(
'tid' => $this->p->options[ 'plugin_' . $ext . '_tid' ],
'user_direction' => is_rtl() ? 'rtl' : 'ltr',
'user_locale' => SucomUtilWP::get_locale(),
'TB_iframe' => 'true',
'width' => $this->p->cf[ 'wp' ][ 'tb_iframe' ][ 'width' ],
'height' => $this->p->cf[ 'wp' ][ 'tb_iframe' ][ 'height' ],
), $info[ 'url' ][ 'purchase' ] . 'info/' );
$val = '' . $val . '';
}
}
$table_rows[ $key ] = '' . $label . ' | ' . $val . ' | ';
}
} else $table_rows[] = ''; /* * Plugin separator. */ if ( $ext_num < $ext_total ) { $table_rows[ 'dotted_line' ] = ' | '; } else $table_rows[] = ' | '; /* * Show the plugin icon and table rows. */ foreach ( $table_rows as $key => $row ) { if ( ! empty( $row ) ) { echo ' |
|---|---|---|
| '; echo $this->get_ext_img_icon( $ext, $icon_px ); echo ' | '; } echo $row . '||