p =& $plugin; if ( $this->p->debug->enabled ) { $this->p->debug->mark(); $this->p->debug->log( 'form options name is ' . $opts_name ); } $this->plugin_id = $this->p->id; $this->opts_name =& $opts_name; $this->options =& $opts; $this->defaults =& $defs; $this->ext_id = empty( $ext_id ) ? $this->plugin_id : $ext_id; // Lowercase acronyn for plugin or add-on. $this->set_admin_l10n(); $this->set_text_domain( $this->ext_id ); $this->set_default_text_domain( $this->plugin_id ); } public function get_options_name() { return $this->opts_name; } public function get_options( $opt_key = false, $def_val = null ) { if ( false !== $opt_key ) { if ( $this->in_options( $opt_key ) ) { return $this->options[ $opt_key ]; } return $def_val; } return $this->options; } public function get_defaults( $opt_key = false, $def_val = null ) { if ( false !== $opt_key ) { if ( $this->in_defaults( $opt_key ) ) { return $this->defaults[ $opt_key ]; } return $def_val; } return $this->defaults; } public function in_options( $opt_key ) { if ( isset( $this->options[ $opt_key ] ) ) { return true; } elseif ( 0 === strpos( $opt_key, '/' ) ) { // Regular expression. if ( ! is_array( $this->options ) ) { // Just in case. return false; } $opts = SucomUtil::preg_grep_keys( $opt_key, $this->options ); return empty( $opts ) ? false : true; } return false; } public function in_defaults( $opt_key ) { if ( isset( $this->defaults[ $opt_key ] ) ) { return true; } elseif ( false !== strpos( $opt_key, '#' ) ) { // Localized option name. $opt_key_locale = SucomUtilOptions::get_key_locale( $opt_key, $this->defaults, 'default' ); if ( isset( $this->defaults[ $opt_key_locale ] ) ) { $this->defaults[ $opt_key ] = $this->defaults[ $opt_key_locale ]; return true; } } return false; } /* * $ext_id is the lowercase acronyn for the plugin or add-on. */ public function get_ext_id() { return $this->ext_id; } public function get_text_domain() { return $this->text_domain; } public function get_default_text_domain() { return $this->def_text_domain; } public function set_admin_l10n() { $this->admin_l10n = $this->get_plugin_admin_l10n(); } /* * $ext_id is the lowercase acronyn for the plugin or add-on. */ public function set_text_domain( $ext_id ) { $this->text_domain = $this->get_plugin_text_domain( $ext_id ); } /* * Get the text domain for the main plugin. * * $plugin_id is the lowercase acronyn for the main plugin. */ public function set_default_text_domain( $plugin_id ) { $this->def_text_domain = $this->get_plugin_text_domain( $plugin_id ); } /* * $ext_id is the lowercase acronyn for the plugin or add-on. */ public function get_plugin_text_domain( $ext_id ) { if ( isset( $this->p->cf[ 'plugin' ][ $ext_id ][ 'text_domain' ] ) ) { // Return the main plugin or add-on text domain. return $this->p->cf[ 'plugin' ][ $ext_id ][ 'text_domain' ]; } elseif ( isset( $this->p->cf[ 'plugin' ][ $this->plugin_id ][ 'text_domain' ] ) ) { // Fallback to the main plugin text domain. return $this->p->cf[ 'plugin' ][ $this->plugin_id ][ 'text_domain' ]; } return $this->def_text_domain; // Return false or the (previously set) main plugin text domain. } public function get_plugin_admin_l10n() { if ( isset( $this->p->cf[ 'plugin' ][ $this->plugin_id ][ 'admin_l10n' ] ) ) { return $this->p->cf[ 'plugin' ][ $this->plugin_id ][ 'admin_l10n' ]; } return $this->admin_l10n; } public function get_option_value_transl( $value, $context = 'option value' ) { if ( $this->text_domain ) { // Just in case. $value_transl = _x( $value, $context, $this->text_domain ); // Use text domain of main plugin or add-on. if ( $value === $value_transl ) { // No translation. if ( $this->text_domain !== $this->def_text_domain ) { // Fallback to default text domain of main plugin. $value_transl = _x( $value, $context, $this->def_text_domain ); } } return $value_transl; } elseif ( $this->def_text_domain ) { // Fallback to default text domain of main plugin. return _x( $value, $context, $this->def_text_domain ); } return $value; } public function get_tr_hide( $in_view, $opt_keys = array() ) { $css_class = $this->get_css_class_hide( $in_view, $opt_keys ); return empty( $css_class ) ? '' : '
| ' . $col_header . ' | '; } $list_cols .= ''; $list_cols .= ' | |
|---|---|---|
| ' . $this->get_checkbox( $opt_key, $css_class = '', $css_id = '', $is_disabled ) . ' | '; } else { $list_cols .= ''; } } $list_cols .= ' | ' . $label_transl . ' | ';
$list_cols .= '