コード例 #1
0
 /**
  * Get shortcode parameters for Pricing Option
  *
  * @param string $attribute     The ID of attribute
  * @param bool   $include_value Whether or not including Value parameter (true if call for WR_Item_Pricing_Table_Attr_Value)
  *
  * @return string
  */
 static function get_option($attribute, $include_value = false)
 {
     // get all Predefined Attributes
     $attributes = WR_Pricing_Table::$attributes;
     // get index of current Option/Attribute
     $idx = WR_Pricing_Table::$index = WR_Pricing_Table::$index % 3;
     $title = isset($attributes[$attribute]) ? isset($attributes[$attribute]['title']) ? $attributes[$attribute]['title'] : '' : '';
     $type = isset($attributes[$attribute]) ? isset($attributes[$attribute]['type']) ? $attributes[$attribute]['type'] : '' : '';
     if ($include_value) {
         $value = isset($attributes[$attribute]) ? isset($attributes[$attribute]['value'][$idx]) ? $attributes[$attribute]['value'][$idx] : '' : '';
     }
     $result = array('std' => '', 'prtbl_item_attr_id' => $attribute, 'prtbl_item_attr_title' => $title, 'prtbl_item_attr_type' => $type);
     if (!$include_value) {
         $result['prtbl_item_attr_desc'] = $title;
     } else {
         $result['prtbl_item_attr_value'] = $result['prtbl_item_attr_desc'] = $value;
     }
     return $result;
 }