/**
    Displayed how many days it has been since a certain date.

   */
  function days_since($date1, $return_number = false) {
    if (empty($date1))
      return "";

    if (is_array($date1))
      $date1 = $date1[year] . "-" . $date1[month] . "-" . $date1[day];

    $date2 = date("Y-m-d");
    $date1 = date("Y-m-d", strtotime($date1));


    // determine if future or past
    if (strtotime($date2) < strtotime($date1))
      $future = true;

    $difference = abs(strtotime($date2) - strtotime($date1));
    $days = round(((($difference / 60) / 60) / 24), 0);

    if ($return_number)
      return $days;

    if ($days == 0) {
      return __('Today', WPI);
    } elseif ($days == 1) {
      return($future ? __(" Tomorrow ", WPI) : __(" Yesterday ", WPI));
    } elseif ($days > 1 && $days <= 6) {
      return ($future ? __sprintf(__(" in %s days ", WPI), $days) : " ".$days." ".__("days ago", WPI));
    } elseif ($days > 6) {
      return date(get_option('date_format'), strtotime($date1));
    }
  }
Exemplo n.º 2
0
 /**
  * Remove the current or specified user to a group.
  * 
  * This method is an abstraction.  The group and user are ignored, and error
  * is sent, and false (not removed) is always returned.
  * @param string $group User removed from this group.
  * @param string $user Username to remove from the group (default = current user).
  * @return bool On true user was removed, false if not.
  */
 function removeMemberOf($group, $user = false)
 {
     trigger_error(__sprintf("Method '%s' not implemented in this GROUP_METHOD %s", 'removeMemberOf', GROUP_METHOD), E_USER_WARNING);
     return false;
 }
Exemplo n.º 3
0
 function _get_content()
 {
     $cache =& $this->_wikidb->_cache;
     $pagename = $this->_pagename;
     $version = $this->_version;
     assert($version > 0);
     $newdata = $cache->get_versiondata($pagename, $version, true);
     if ($newdata) {
         assert(is_string($newdata['%content']));
         return $newdata['%content'];
     } else {
         // else revision has been deleted... What to do?
         return __sprintf("Oops! Revision %s of %s seems to have been deleted!", $version, $pagename);
     }
 }
Exemplo n.º 4
0
 /**
  * common code used by the two JPEG adding functions
  *
  * @access private
  */
 public function addJpegImage_common(&$data, $x, $y, $w = 0, $h = 0, $imageWidth, $imageHeight, $channels = 3)
 {
     // note that this function is not to be called externally
     // it is just the common code between the GD and the file options
     $this->numImages++;
     $im = $this->numImages;
     $label = 'I' . $im;
     $this->numObj++;
     $this->o_image($this->numObj, 'new', array('label' => $label, 'data' => $data, 'iw' => $imageWidth, 'ih' => $imageHeight, 'channels' => $channels));
     $this->objects[$this->currentContents]['c'] .= "\nq";
     $this->objects[$this->currentContents]['c'] .= "\n" . __sprintf('%.3f', $w) . " 0 0 " . __sprintf('%.3f', $h) . " " . __sprintf('%.3f', $x) . " " . __sprintf('%.3f', $y) . " cm";
     $this->objects[$this->currentContents]['c'] .= "\n/" . $label . ' Do';
     $this->objects[$this->currentContents]['c'] .= "\nQ";
 }