Plugin Directory

Changeset 1515844


Ignore:
Timestamp:
10/16/2016 10:37:48 AM (9 years ago)
Author:
AeonOfTime
Message:
  • Fixed a weird PHP bug related to, for unexplainable reasons, the method name
  • Added ship mass to ordering and columns
Location:
eve-shipinfo/trunk/classes/EVEShipInfo
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • eve-shipinfo/trunk/classes/EVEShipInfo/Collection/Filter.php

    r1515807 r1515844  
    7777    public function orderByLauncherSlots($ascending=true) { return $this->setOrderBy('launchers', $ascending); }
    7878    public function orderByTechLevel($ascending=true) { return $this->setOrderBy('techlevel', $ascending); }
     79    public function orderByMass($ascending=true) { return $this->setOrderBy('mass', $ascending); }
    7980   
    8081    public function secondOrderByGroup() { return $this->setSecondOrderBy('group'); }
     
    9293    public function secondOrderByLauncherSlots() { return $this->setSecondOrderBy('launchers'); }
    9394    public function secondOrderByTechLevel() { return $this->setSecondOrderBy('techlevel'); }
     95    public function secondOrderByMass() { return $this->setSecondOrderBy('mass'); }
    9496   
    9597    public function setOrderBy($field, $ascending=true)
     
    612614                'turrets' => __('Turret slots', 'eve-shipinfo'),
    613615                'launchers' => __('Launcher slots', 'eve-shipinfo'),
    614                 'techlevel' => __('Tech level', 'eve-shipinfo')
     616                'techlevel' => __('Tech level', 'eve-shipinfo'),
     617                'mass' => __('Mass', 'eve-shipinfo')
    615618            );
    616619        }
     
    736739                break;
    737740               
     741            case 'mass':
     742                $aVal = $a->getMass();
     743                $bVal = $b->getMass();
     744                break;
     745               
    738746            case 'name':
    739747            default:
  • eve-shipinfo/trunk/classes/EVEShipInfo/Collection/List.php

    r1296717 r1515844  
    3838            'launchers' => __('Launcher slots', 'eve-shipinfo'),
    3939            'velocity' => __('Max velocity', 'eve-shipinfo'),
    40             'techlevel' => __('Tech level', 'eve-shipinfo')
     40            'techlevel' => __('Tech level', 'eve-shipinfo'),
     41            'mass' => __('Mass', 'eve-shipinfo')
    4142        );
    4243    }
     
    195196    }
    196197   
     198    protected function renderColumn_mass(EVEShipInfo_Collection_Ship $ship)
     199    {
     200        return $ship->getMass($this->showUnits);
     201    }
     202   
    197203    protected function renderColumn_warpspeed(EVEShipInfo_Collection_Ship $ship)
    198204    {
  • eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode.php

    r1512895 r1515844  
    88    protected $plugin;
    99   
    10     protected $attributes;
     10    protected $attribs;
    1111   
    1212    protected $content;
     
    4242        }
    4343       
    44         $this->attributes = shortcode_atts($this->getDefaultAttributes(), $attributes);
     44        $this->attribs = shortcode_atts($this->getDefaultAttributes(), $attributes);
    4545        $this->content = $content;
    4646
    4747        try
    4848        {
    49             $this->process();
     49            $this->renderShortcode();
    5050        }
    5151        catch(EVEShipInfo_Exception $e)
     
    5757    }
    5858   
     59    abstract protected function renderShortcode();
     60   
     61   
    5962    protected function getAttribute($name, $default=null)
    6063    {
    61         if(isset($this->attributes[$name])) {
    62             return $this->attributes[$name];
     64        if(isset($this->attribs[$name])) {
     65            return $this->attribs[$name];
    6366        }
    6467       
     
    7477        return admin_url('admin.php?page=eveshipinfo_shortcodes&shortcode='.$this->getID());
    7578    }
    76    
    77     abstract protected function process();
    7879   
    7980    abstract public function getName();
  • eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode/EFTFit.php

    r1296717 r1515844  
    2525    }
    2626   
    27     public function process()
     27    protected function renderShortcode()
    2828    {
    2929        $fitID = $this->getAttribute('id');
  • eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode/Gallery.php

    r1296717 r1515844  
    7474    }
    7575   
    76     public function process()
     76    protected function process()
    7777    {
    7878        $galleryFolder = $this->plugin->getGalleryPath();
     
    8484        // we do not use this attribute, but we have to remove it to make
    8585        // sure it is not used by the shared list configuration method.
    86         $this->attributes['show'] = '';
     86        $this->attribs['show'] = '';
    8787       
    8888        parent::process();
  • eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode/ShipInfo.php

    r1296717 r1515844  
    1818    }
    1919   
    20     public function process()
     20    protected function renderShortcode()
    2121    {
    2222        $name = $this->getAttribute('name');
  • eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode/ShipList.php

    r1515807 r1515844  
    2323    protected $filter;
    2424   
    25     public function process()
     25    protected function renderShortcode()
    2626    {
    2727        // is this list disabled?
     
    7373            'techlevel' => '',
    7474            'ships' => '',
    75             'mass' => ''
     75            'mass' => '',
    7676        );
    7777    }
     
    444444    {
    445445        $this->filter->setOrderBy($this->getAttribute('order_by'), $this->isAscending());
    446        
     446
    447447        $show = $this->getAttribute('show');
    448448        if(is_numeric($show)) {
Note: See TracChangeset for help on using the changeset viewer.