コード例 #1
0
 /**
  * adds a new format to the list of supported formats.
  * handles removing conflicting and less specific
  * formats at the same time.
  *
  * @param string $format one of PORTFOLIO_FORMAT_XX
  *
  * @return void
  */
 protected function add_format($format)
 {
     if (in_array($format, $this->supportedformats)) {
         return;
     }
     $this->supportedformats = portfolio_most_specific_formats(array($format), $this->supportedformats);
 }
コード例 #2
0
 public function set_formats($formats = null)
 {
     if (is_string($formats)) {
         $formats = array($formats);
     }
     if (empty($formats)) {
         $formats = array();
     }
     if (empty($this->callbackclass)) {
         throw new portfolio_button_exception('noclassbeforeformats', 'portfolio');
     }
     $callerformats = call_user_func(array($this->callbackclass, 'base_supported_formats'));
     $this->formats = portfolio_most_specific_formats($formats, $callerformats);
 }