Pocket::parseRepeat PHP Method

parseRepeat() public static method

public static parseRepeat ( $Repeat ) : array
$Repeat
return array
    public static function parseRepeat($Repeat)
    {
        if (StringBeginsWith($Repeat, Pocket::REPEAT_EVERY)) {
            $RepeatType = Pocket::REPEAT_EVERY;
            $Frequency = substr($Repeat, strlen(Pocket::REPEAT_EVERY));
        } elseif (StringBeginsWith($Repeat, Pocket::REPEAT_INDEX)) {
            $RepeatType = Pocket::REPEAT_INDEX;
            $Frequency = substr($Repeat, strlen(Pocket::REPEAT_INDEX));
        } elseif (StringBeginsWith($Repeat, Pocket::REPEAT_ONCE)) {
            $RepeatType = Pocket::REPEAT_ONCE;
        } elseif (StringBeginsWith($Repeat, Pocket::REPEAT_BEFORE)) {
            $RepeatType = Pocket::REPEAT_BEFORE;
        } elseif (StringBeginsWith($Repeat, Pocket::REPEAT_AFTER)) {
            $RepeatType = Pocket::REPEAT_AFTER;
        }
        if (isset($Frequency)) {
            $Frequency = explode(',', $Frequency);
            $Frequency = array_map('trim', $Frequency);
        } else {
            $Frequency = array();
        }
        return array($RepeatType, $Frequency);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Load the pocket's data from an array.
  *
  * @param array $Data
  */
 public function load($Data)
 {
     $this->Body = $Data['Body'];
     $this->Disabled = $Data['Disabled'];
     $this->Format = $Data['Format'];
     $this->Location = $Data['Location'];
     $this->Name = $Data['Name'];
     $this->Page = $Data['Page'];
     $this->MobileOnly = $Data['MobileOnly'];
     $this->MobileNever = $Data['MobileNever'];
     $this->Type = val('Type', $Data, Pocket::TYPE_DEFAULT);
     $this->EmbeddedNever = val('EmbeddedNever', $Data);
     $this->ShowInDashboard = val('ShowInDashboard', $Data);
     // parse the frequency.
     $Repeat = $Data['Repeat'];
     list($this->RepeatType, $this->RepeatFrequency) = Pocket::parseRepeat($Repeat);
 }
All Usage Examples Of Pocket::parseRepeat