Skip to content

Commit

Permalink
version 0.3.2, htmlbuilder, support for maxlength og size
Browse files Browse the repository at this point in the history
  • Loading branch information
dmattke committed Nov 1, 2017
1 parent 245163d commit c31ec20
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
6 changes: 4 additions & 2 deletions admin/AdminConsignmentOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ function loadParcelOptions(){
),
array(
'name' => 'consignment_message',
'label' => __('Message', 'wc-cargonizer'),
'type' => 'textarea',
'label' => __('Message (max. 56 chars)', 'wc-cargonizer'),
'type' => 'text',
'maxlength' => 56,
'size' => 60,
'value' => $this->Consignment->Message,
),

Expand Down
3 changes: 2 additions & 1 deletion admin/CargonizerHtmlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public static function buildOption( $option, $default_value=null ){?>
'class' => gi($option, 'css'),
'max' => gi($option, 'max'),
'min' => gi($option, 'min'),
'size' => 50,
'size' => gi($option, 'size', 50),
'maxlength' => gi($option, 'maxlength', ''),
);

if ( isset($option['readonly']) && $option['readonly'] ){
Expand Down
15 changes: 8 additions & 7 deletions include/util/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@


if ( !function_exists('gi') ){
function gi( $array, $index ){
function gi( $array, $index, $default=null ){
$value = $default;

if ( is_array($array) && isset($array[$index]) ){
if ( is_string($array[$index]) or is_numeric($array[$index]) ){
return $array[$index];
$value = $array[$index];
}
elseif ( is_string($array[$index][0]) ){
return $array[$index][0];
$value = $array[$index][0];
}
}
else if ( is_object($array) && isset($array->$index) ){
return $array->$index;
}
else{
return null;
$value = $array->$index;
}

return $value;
}
}

Expand Down
2 changes: 1 addition & 1 deletion woocommerce-cargonizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*woo
Plugin Name: Woocommerce Cargonizer
Description:
Version: 0.3.1
Version: 0.3.2
Author: Mediebruket AS
Author URI: http://mediebruket.no
*/
Expand Down

0 comments on commit c31ec20

Please sign in to comment.