插件目录

变更集1411293


忽略:
时间戳:
2016年5月5日09:11:20 PM(8年(之前)
作者:
AeonOfTime公司
消息:

已将属性移动到单独的表中。

位置:
eve-shipinfo/trunk
文件夹:
6已编辑

图例:

未修改
补充
远离的
  • eve-shipinfo/trunk/classes/EVEShipInfo.php

    1411207元 1411293兰特  
    11961196受保护的$tables=数组(
    11971197“元”,
     1198“属性”,
    11981199“模块”,
    11991200'模块_插槽',
     
    12271228            )
    12281229        );
    1229        
     1230
     1231$queries[]=数组(
     1232“table”=>“attributes”,
     1233“数据”=>“属性”,
     1234“字段”=>数组(
     1235'attributeName=%s',
     1236'属性ID=%d',
     1237“defaultValue=%s”,
     1238'显示名称=%s',
     1239'可堆叠=%d',
     1240“highIsGood=%d”
     1241            )
     1242        );
     1243         
    12301244$queries[]=数组(
    12311245“table”=>“modules_slots”,
     
    12831297'fields'=>数组(
    12841298'类型ID=%d',
    1285 'attributeName=%s',
    12861299'属性ID=%d',
    12871300“valueInt=%d”,
    1288 “valueFloat=%f”,
    1289 “defaultValue=%s”,
    1290 '显示名称=%s',
    1291 '可堆叠=%d',
    1292 “highIsGood=%d”
     1301'valueFloat=%f'
    12931302                )
    12941303            );
     
    12991308$query=“INSERT INTO”$this->getTableName($def['table'])。“SET”.内爆(',',$def['fields']);
    13001309$entries=$this->loadDataJSON($def['data']);
     1310           
    13011311foreach($entries作为$entry){
    13021312$this->dbQuery($query,$entry);
  • eve-shipinfo/trunk/classes/EVEShipInfo/Collection/Ship/Attribute.php

    1411207元 1411293兰特  
    类EVEShipInfo_Collection_Ship_Attribute
    44{
     5常量ERROR_UNKNOWN_ATTRIBUTE=17001;
     6   
    57受保护的$rawData;
    68   
     
    2224受保护的$plugin;
    2325   
     26受保护的静态$globalData;
     27   
    2428公共函数__construct(EVEShipInfo_Collection_Ship$Ship,$name)
    2529    {
     
    2933$this->name=$name;
    3034       
    31 $this->rawData=$this->插件->dbFetch(
    32 “”选择“
    33 *
    34 发件人
    35 “.$this->plugin->getTableName('ships_attributes')。”
    36 何处
    37 类型ID=%d
    38 
    39 attributeName=%s“,
    40 阵列(
    41 $this->ship->getID(),
    42 $名称
    43             )
     35if(!$this->register()){
     36回报;
     37        }
     38       
     39$values=$this->plugin->dbFetch(
     40“”选择“
     41                *
     42发件人
     43“.$this->plugin->getTableName('ships_attributes')。”
     44何处
     45类型ID=%d
     46
     47attributeID=%d“,
     48阵列(
     49$this->ship->getID(),
     50self::$globalData[$name]['attributeID']
     51            )
    4452        );
     53       
     54$this->rawData=array_merge(self::$globalData[$name],$values);
     55    }
     56   
     57受保护函数寄存器()
     58    {
     59if(isset(self::$globalData[$this->name]){
     60回报;
     61        }
     62       
     63$global=$this->plugin->dbFetch(
     64“”选择“
     65                *
     66发件人
     67“.$this->plugin->getTableName('attributes')。”
     68何处
     69attributeName=%s“,
     70阵列(
     71$this->名称
     72            )
     73        );
     74             
     75if(空($global)){
     76抛出新的EVEShipInfo_Exception(
     77'未知属性['.$this->name.'].',
     78'在数据库中找不到属性['.$this->name.']。',
     79自身::ERROR_UNKNOWN_ATTRIBUTE
     80            );
     81        }
     82         
     83self::$globalData[$this->name]=$global;
    4584    }
    4685   
     
    5291受保护函数getProperty($name)
    5392    {
    54       if(isset($this->rawData[$name])){
    55           return$this->rawData[$name];
    56       }
    57       
    58       返回null;
     93      if(isset($this->rawData[$name])){
     94          return$this->rawData[$name];
     95      }
     96      
     97      返回null;
    5998    }
    6099   
     
    63102公共函数getUnitName()
    64103    {
    65       if(!isset($this->unitName)){
    66           //单元名称为英文,以便支持翻译
    67           //我们在本地翻译本机字符串。
    68           $this->unitName=$this->translateNativeString(
    69               $this->getProperty('displayName')
    70           );
    71       }
    72       
    73       return$this->unitName;
     104      if(!isset($this->unitName)){
     105          //单元名称为英文,以便支持翻译
     106          //我们在本地翻译本机字符串。
     107          $this->unitName=$this->translateNativeString(
     108              $this->getProperty('displayName')
     109          );
     110      }
     111      
     112      return$this->unitName;
    74113    }
    75114   
    76115公共函数getCategoryName()
    77116    {
    78       return$this->getProperty('categoryName');
     117      return$this->getProperty('categoryName');
    79118    }
    80119   
    81120公共函数getIconID()
    82121    {
    83       return$this->getProperty('iconID');
     122      return$this->getProperty('iconID');
    84123    }
    85124   
    86125公共函数getValue($pretty=false)
    87126    {
    88       $int=$this->getProperty('valueInt');
    89       $float=$this->getProperty('valueFloat');
    90       $value=$int;
     127      $int=$this->getProperty('valueInt');
     128      $float=$this->getProperty('valueFloat');
     129      $value=$int;
    91130
    92    if(strlen($value)<1) {
    93           $value=浮动美元;
    94       }
    95       
    96       if($漂亮){
    97           $tokens=爆炸('.',$value);
    98           if(isset($令牌[1])){
    99               返回number_format($value,2);
    100           }
    101           
    102           返回number_format($value);
    103       }
    104       
    105       返回$value;
     131   如果($float>$value) {
     132          $value=$float;
     133      }
     134      
     135      if($漂亮){
     136          $tokens=爆炸('.',$value);
     137          if(isset($令牌[1])){
     138              返回number_format($value,2);
     139          }
     140          
     141          返回number_format($value);
     142      }
     143      
     144      返回$value;
    106145    }
    107146   
     
    116155公共函数getValuePretty()
    117156    {
    118       $result=$this->getValue(true);
    119       
    120       $units=$this->getUnitName();
    121       if(!空($单位)){
    122           $result.=“”$单位;
    123       }
    124       
    125       返回$result;
     157      $result=$this->getValue(true);
     158      
     159      $units=$this->getUnitName();
     160      if(!空($单位)){
     161          $result.=“”$单位;
     162      }
     163      
     164      返回$result;
    126165    }
    127166   
    128167公共函数__toString()
    129168    {
    130       $value=$this->getValue();
    131       返回$value;
     169      $value=$this->getValue();
     170      返回$value;
    132171    }
    133172   
     
    136175受保护的函数translateNativeString($string)
    137176    {
    138       if(!isset(self::$stringTranslations)){
    139           self::$stringTranslations=数组(
    140               “HP”=>__(“HP”,“eve-shipinfo”),
    141               ‘MW’=>__(‘MW’,‘eve-shipinfo’),
    142               “m/sec”=>__(“m/sec”,“eve-shipinfo”),
    143               'tf'=>__('tf','eve shipinfo'),
    144               “m”=>__(“m”,“eve-shipinfo”),
    145               's'=>__('s','eve-shipinfo'),
    146               ‘GJ’=>__(‘GJ’,‘eve shipinfo’),
    147               “mm”=>__(“mm”,“eve-shipinfo”),
    148               “m3”=>__(“m3”,“eve-shipinfo”),
    149               “Mbit/sec”=>__(“MB/S”,“eve-shipinfo”)
    150           );
    151       }
    152       
    153       if(isset(self::$stringTranslations[$string]){
    154           return self::$stringTranslations[$string];
    155       }
    156       
    157       返回$string;
     177      if(!isset(self::$stringTranslations)){
     178          self::$stringTranslations=数组(
     179              “HP”=>__(“HP”,“eve-shipinfo”),
     180              ‘MW’=>__(‘MW’,‘eve-shipinfo’),
     181              “m/sec”=>__(“m/sec”,“eve-shipinfo”),
     182              'tf'=>__('tf','eve-shipinfo'),
     183              “m”=>__(“m”,“eve-shipinfo”),
     184              's'=>__('s','eve-shipinfo'),
     185              ‘GJ’=>__(‘GJ',‘eve-shipinfo’),
     186              “mm”=>__(“mm”,“eve-shipinfo”),
     187              “m3”=>__(“m3”,“eve-shipinfo”),
     188              “Mbit/sec”=>__(“MB/S”,“eve-shipinfo”)
     189          );
     190      }
     191      
     192      if(isset(self::$stringTranslations[$string]){
     193          return self::$stringTranslations[$string];
     194      }
     195      
     196      返回$string;
    158197    }
    159198}
  • eve-shipinfo/trunk/classes/EVEShipInfo/Plugin.php

    1411207元 1411293兰特  
    212212    }
    213213
    214 公共函数dbQuery($query,$params=array())
     214公共函数dbQuery($query,$params=array(),$dump=假)
    215215    {
    216216全局$wpdb;
     
    218218if(!空($params)){
    219219$query=$wpdb->prepare($query,$params);
     220        }
     221       
     222if($dump){
     223echo'<pre-style=“background:#fff;color:#000;padding:17px;”>'.print_r($query,true)'</预>';
    220224        }
    221225       
  • eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode.php

    1202080兰特 1411293兰特  
    4040$this->attributes=shortcode_atts($this->getDefaultAttributes(),$attributies);
    4141$this->content=$content;
    42        
    43 $this->process();
     42
     43尝试
     44        {
     45$this->process();
     46        }
     47catch(EVEShipInfo_Exception$e)
     48        {
     49$this->content=“EVEShipino错误号”$e->getCode().''$e->getMessage();
     50        }
    4451       
    4552返回$this->内容;
  • eve-shipinfo/trunk/errorcodes.txt

    1236586兰特 1411293兰特  
    1 1001
    2 1101
     1201
    4 1301
    5 1401
    6 1501
    7 1601
     117001
注:请参见TracChangeset(跟踪变更集)获取有关使用变更集查看器的帮助。