예제 #1
0
function wpinventory_get_the_label($field)
{
    $labels = WPIMLabel::getInstance();
    $label = $labels->get_label($field);
    if ($label) {
        return $label;
    } else {
        return $field;
    }
}
예제 #2
0
 private static function load_labels()
 {
     if (!self::$label) {
         self::$label = WPIMLabel::getInstance();
     }
 }
예제 #3
0
 private function load()
 {
     $label_data = $this->wpdb->get_results('SELECT * FROM ' . $this->label_table . ' AS l');
     // Load defaults
     $labels = self::default_labels();
     foreach ($labels as $field => $default) {
         $labels[$field] = array("default" => $default, "label" => $default, "is_used" => TRUE, "is_numeric" => FALSE);
     }
     // Overload any set labels
     foreach ($label_data as $label) {
         $labels[$label->label_field]['label'] = $label->label_label;
         $labels[$label->label_field]['is_used'] = $this->is_always_on($label->label_field) || $label->is_used ? TRUE : FALSE;
         $labels[$label->label_field]['is_numeric'] = $label->is_numeric ? TRUE : FALSE;
     }
     // We don't want the id set up in this configuration
     if (isset($labels['inventory_id'])) {
         unset($labels['inventory_id']);
     }
     uasort($labels, array(__CLASS__, 'sortNotUsed'));
     self::$labels = $labels;
 }