Set URL to Post

URL format is set in post file, with such variable that can be used
:date, :month, :year -> taken from date section
:title -> title of file, taken from filename

@param string $urlFormat
@param string $date
@return void
762649
public function setUrl($date, $urlFormat = ':year/:month/:date/:title')
	{
		// $this->url = '/' . implode('/', explode('-', $this->getFileName(), 4)) . '.html';

		$year = date('Y', strtotime($date));
		$month = date('m', strtotime($date));
		$day = date('d', strtotime($date));
		$title = explode('-', $this->getFileName(), 4);

		// replacing variable in the comment above with proper value
		$this->url = '/' . str_replace(array(':date', ':month', ':year', ':title'), array($day, $month, $year, $title[3] . '.html'), $urlFormat);
	}
727641
protected function setPublicationDate($date)
    {
        self::writeFullTag(
            $date,
            'publication_date',
            false,
            'news:publication_date',
            $this->validator,
            'validatePublicationDate',
            $this->exception,
            'Provided publication date is not a valid value.'
        );

        return $this;
    }
1292725
public function setDate($date = null)
    {
        if ($this->_date === null) {
            if ($date === null) {
                $date = date('r');
            } else if (is_int($date)) {
                $date = date('r', $date);
            } else if (is_string($date)) {
                $date = strtotime($date);
                if ($date === false || $date < 0) {
                    /**
                     * @see Zend_Mail_Exception
                     */
                    // require_once 'Zend/Mail/Exception.php';
                    throw new Zend_Mail_Exception('String representations of Date Header must be ' .
                                                  'strtotime()-compatible');
                }
                $date = date('r', $date);
            } else if ($date instanceof Zend_Date) {
                $date = $date->get(Zend_Date::RFC_2822);
            } else {
                /**
                 * @see Zend_Mail_Exception
                 */
                // require_once 'Zend/Mail/Exception.php';
                throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' .
                                              ' and strtotime()-compatible strings');
            }
            $this->_date = $date;
            $this->_storeHeader('Date', $date);
        } else {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('Date Header set twice');
        }
        return $this;
    }
18859
private static Date toDateWithFormatString(String date, String format) {
    if (date == null) {
      return null;
    }

    try {
      return strategy.formatFor(format).parse(date);
    } catch (ParseException e) {
      UTILS_LOGGER.trace("Unable to parse date '{}' using format string '{}': {}", date, format, e);

      return null;
    }
  }
542567
public void setDate(Date date) {
		for (int i = 0; i < 4; i++) {
			((JDateChooser) components[i]).setDate(date);
		}
	}
793641
function setEndDate($date)
    {
        /*
          To indicate that a certificate has no well-defined expiration date,
          the notAfter SHOULD be assigned the GeneralizedTime value of
          99991231235959Z.

          -- http://tools.ietf.org/html/rfc5280#section-4.1.2.5
        */
        if (strtolower($date) == 'lifetime') {
            $temp = '99991231235959Z';
            $asn1 = new File_ASN1();
            $temp = chr(FILE_ASN1_TYPE_GENERALIZED_TIME) . $asn1->_encodeLength(strlen($temp)) . $temp;
            $this->endDate = new File_ASN1_Element($temp);
        } else {
            $this->endDate = @date('D, d M Y H:i:s O', @strtotime($date));
        }
    }
1357724
public function setPublishedFrom( $date, $format = null )
    {
        $this->publishedFrom = empty( $date ) ? null : $this->inputDate( $date, $format );
        return $this;
    }
1032446
public void setYearlyAbsoluteFromDate(Date date)
   {
      if (date != null)
      {
         Calendar cal = DateHelper.popCalendar(date);
         m_dayNumber = Integer.valueOf(cal.get(Calendar.DAY_OF_MONTH));
         m_monthNumber = Integer.valueOf(cal.get(Calendar.MONTH) + 1);
         DateHelper.pushCalendar(cal);
      }
   }
465865
function urlFormat(obj) {
  // ensure it's an object, and not a string url.
  // If it's an obj, this is a no-op.
  // this way, you can call url_format() on strings
  // to clean up potentially wonky urls.
  if (typeof(obj) === 'string') obj = urlParse(obj);

  var auth = obj.auth || '';
  if (auth) {
    auth = auth.split('@').join('%40');
    for (var i = 0, l = nonAuthChars.length; i < l; i++) {
      var nAC = nonAuthChars[i];
      auth = auth.split(nAC).join(encodeURIComponent(nAC));
    }
    auth += '@';
  }

  var protocol = obj.protocol || '',
      host = (obj.host !== undefined) ? auth + obj.host :
          obj.hostname !== undefined ? (
              auth + obj.hostname +
              (obj.port ? ':' + obj.port : '')
          ) :
          false,
      pathname = obj.pathname || '',
      query = obj.query &&
              ((typeof obj.query === 'object' &&
                objectKeys(obj.query).length) ?
                 querystring.stringify(obj.query) :
                 '') || '',
      search = obj.search || (query && ('?' + query)) || '',
      hash = obj.hash || '';

  if (protocol && protocol.substr(-1) !== ':') protocol += ':';

  // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.
  // unless they had them to begin with.
  if (obj.slashes ||
      (!protocol || slashedProtocol[protocol]) && host !== false) {
    host = '//' + (host || '');
    if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
  } else if (!host) {
    host = '';
  }

  if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
  if (search && search.charAt(0) !== '?') search = '?' + search;

  return protocol + host + pathname + search + hash;
}
741735
public function setPublishDate($dateFormat = 'F d, Y')
	{
		$name_separate = explode('-', $this->getFileName(), 4);
		$originalDate = $name_separate[0] . '-' . $name_separate[1] . '-' .$name_separate[2];
		$this->publishDate = date($dateFormat, strtotime($originalDate));
	}
648113
public function valid_date($sDate, $sFormat)
    {
        //  If blank, then assume the date is not required
        if (empty($sDate)) {
            return true;
        }

        if (empty($sFormat)) {
            $sFormat = 'Y-m-d';
        }

        if (!array_key_exists('valid_date', $this->_error_messages)) {
            $this->set_message('valid_date', lang('fv_valid_date_field'));
        }

        try {

            $oDate = \DateTime::createFromFormat($sFormat, $sDate);

            if (empty($oDate)) {
                return false;
            }

            return $oDate->format($sFormat) == $sDate;

        } catch (\Exception $e) {

            return false;
        }
    }
871616
public function setDate($date = null)
    {
        if (!$date) {
            $date = date('d.m.Y H:i:s', time());
        }

        // format date
        $date = $this->formatDate($date);

        // get timestamp from date
        $date = $this->_getTimestamp(
            $date[0], // hour
            $date[1], // minute
            $date[2], // second
            $date[3], // month
            $date[4], // day
            $date[5]  // year
        );

        // update current date/time
        $this->dateTime->setTimestamp($date);
    }
369669
private function parseDate($date): AbstractCalendarDate
    {
        // Valid calendar escape specified? - use it
        if (preg_match('/^(@#D(?:GREGORIAN|JULIAN|HEBREW|HIJRI|JALALI|FRENCH R|ROMAN)+@) ?(.*)/', $date, $match)) {
            $cal  = $match[1];
            $date = $match[2];
        } else {
            $cal = '';
        }
        // A date with a month: DM, M, MY or DMY
        if (preg_match('/^(\d?\d?) ?(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|TSH|CSH|KSL|TVT|SHV|ADR|ADS|NSN|IYR|SVN|TMZ|AAV|ELL|VEND|BRUM|FRIM|NIVO|PLUV|VENT|GERM|FLOR|PRAI|MESS|THER|FRUC|COMP|MUHAR|SAFAR|RABI[AT]|JUMA[AT]|RAJAB|SHAAB|RAMAD|SHAWW|DHUAQ|DHUAH|FARVA|ORDIB|KHORD|TIR|MORDA|SHAHR|MEHR|ABAN|AZAR|DEY|BAHMA|ESFAN) ?((?:\d{1,4}(?: B\.C\.)?|\d\d\d\d\/\d\d)?)$/', $date, $match)) {
            $d = $match[1];
            $m = $match[2];
            $y = $match[3];
        } elseif (preg_match('/^(\d{1,4}(?: B\.C\.)?|\d\d\d\d\/\d\d)$/', $date, $match)) {
            // A date with just a year
            $d = '';
            $m = '';
            $y = $match[1];
        } else {
            // An invalid date - do the best we can.
            $d = '';
            $m = '';
            $y = '';
            // Look for a 3/4 digit year anywhere in the date
            if (preg_match('/\b(\d{3,4})\b/', $date, $match)) {
                $y = $match[1];
            }
            // Look for a month anywhere in the date
            if (preg_match('/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|TSH|CSH|KSL|TVT|SHV|ADR|ADS|NSN|IYR|SVN|TMZ|AAV|ELL|VEND|BRUM|FRIM|NIVO|PLUV|VENT|GERM|FLOR|PRAI|MESS|THER|FRUC|COMP|MUHAR|SAFAR|RABI[AT]|JUMA[AT]|RAJAB|SHAAB|RAMAD|SHAWW|DHUAQ|DHUAH|FARVA|ORDIB|KHORD|TIR|MORDA|SHAHR|MEHR|ABAN|AZAR|DEY|BAHMA|ESFAN)/', $date, $match)) {
                $m = $match[1];
                // Look for a day number anywhere in the date
                if (preg_match('/\b(\d\d?)\b/', $date, $match)) {
                    $d = $match[1];
                }
            }
        }

        // Unambiguous dates - override calendar escape
        if (preg_match('/^(TSH|CSH|KSL|TVT|SHV|ADR|ADS|NSN|IYR|SVN|TMZ|AAV|ELL)$/', $m)) {
            $cal = JewishDate::ESCAPE;
        } elseif (preg_match('/^(VEND|BRUM|FRIM|NIVO|PLUV|VENT|GERM|FLOR|PRAI|MESS|THER|FRUC|COMP)$/', $m)) {
            $cal = FrenchDate::ESCAPE;
        } elseif (preg_match('/^(MUHAR|SAFAR|RABI[AT]|JUMA[AT]|RAJAB|SHAAB|RAMAD|SHAWW|DHUAQ|DHUAH)$/', $m)) {
            $cal = HijriDate::ESCAPE; // This is a WT extension
        } elseif (preg_match('/^(FARVA|ORDIB|KHORD|TIR|MORDA|SHAHR|MEHR|ABAN|AZAR|DEY|BAHMA|ESFAN)$/', $m)) {
            $cal = JalaliDate::ESCAPE; // This is a WT extension
        } elseif (preg_match('/^\d{1,4}( B\.C\.)|\d\d\d\d\/\d\d$/', $y)) {
            $cal = JulianDate::ESCAPE;
        }

        // Ambiguous dates - don't override calendar escape
        if ($cal === '') {
            if (preg_match('/^(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)$/', $m)) {
                $cal =  GregorianDate::ESCAPE;
            } elseif (preg_match('/^[345]\d\d\d$/', $y)) {
                // Year 3000-5999
                $cal = JewishDate::ESCAPE;
            } else {
                $cal = GregorianDate::ESCAPE;
            }
        }
        // Now construct an object of the correct type
        switch ($cal) {
            case GregorianDate::ESCAPE:
                return new GregorianDate([
                    $y,
                    $m,
                    $d,
                ]);
            case JulianDate::ESCAPE:
                return new JulianDate([
                    $y,
                    $m,
                    $d,
                ]);
            case JewishDate::ESCAPE:
                return new JewishDate([
                    $y,
                    $m,
                    $d,
                ]);
            case HijriDate::ESCAPE:
                return new HijriDate([
                    $y,
                    $m,
                    $d,
                ]);
            case FrenchDate::ESCAPE:
                return new FrenchDate([
                    $y,
                    $m,
                    $d,
                ]);
            case JalaliDate::ESCAPE:
                return new JalaliDate([
                    $y,
                    $m,
                    $d,
                ]);
            case RomanDate::ESCAPE:
                return new RomanDate([
                    $y,
                    $m,
                    $d,
                ]);
            default:
                throw new DomainException('Invalid calendar');
        }
    }
716112
public function setDateDelivery( $date )
	{
		if ( $date === $this->getDateDelivery() ) { return; }

		$this->_checkDateFormat($date);

		$this->_values['datedelivery'] = (string) $date;
		$this->setModified();
	}
855594
public static String formatHttpDate(Date date) {
		if (null == date) {
			return null;
		}
		return DatePattern.HTTP_DATETIME_FORMAT.format(date);
	}
58096
public function date_future($sDate, $sFormat)
    {
        //  If blank, then assume the date is not required
        if (empty($sDate)) {
            return true;
        }

        if (empty($sFormat)) {
            $sFormat = 'Y-m-d';
        }

        if (!array_key_exists('date_future', $this->_error_messages)) {
            $this->set_message('date_future', lang('fv_valid_date_future_field'));
        }

        try {

            $oNow  = Factory::factory('DateTime');
            $oDate = \DateTime::createFromFormat($sFormat, $sDate);

            if (empty($oDate)) {
                return false;
            }

            $oNow->setTime(0, 0, 0);
            $oDate->setTime(0, 0, 0);

            return $oDate > $oNow;

        } catch (\Exception $e) {

            return false;
        }
    }
834385
function post($url, $post_data = null, $files = null) {
      $http = $this->getHandle($url);

      if($files) {
        curl_setopt($http, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data'));

        $counter = 1;

        foreach($files as $file) {
          $post_data['attachment_' . $counter++] = '@' . $file . ';type=application/octet-stream';
        } // foreach
      } // if

      curl_setopt($http, CURLOPT_POST, 1);
      curl_setopt($http, CURLOPT_POSTFIELDS, $post_data);

      return $this->execute($http);
    }