本文整理汇总了PHP中Version类的典型用法代码示例。如果您正苦于以下问题:PHP Version类的具体用法?PHP Version怎么用?PHP Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: complies
/**
* @param Version $version
*
* @return bool
*/
public function complies(Version $version)
{
if ($version->getMajor()->getValue() != $this->major) {
return false;
}
return $version->getMinor()->getValue() == $this->minor;
}
示例2: registerUser
/**
* This function will create a new user object and return the newly created user object.
*
* @param array $userInfo This should have the properties: username, firstname, lastname, password, ui_language
*
* @return mixed
*/
public function registerUser(array $userInfo, $userLanguage)
{
$user = \User::create($userInfo);
//make the first user an admin
if (\User::all()->count() <= 1) {
$user->is_admin = 1;
}
// Trim trailing whitespace from user first and last name.
$user->firstname = trim($user->firstname);
$user->lastname = trim($user->lastname);
$user->save();
\Setting::create(['ui_language' => $userLanguage, 'user_id' => $user->id]);
/* Add welcome note to user - create notebook, tag and note */
//$notebookCreate = Notebook::create(array('title' => Lang::get('notebooks.welcome_notebook_title')));
$notebookCreate = new \Notebook();
$notebookCreate->title = Lang::get('notebooks.welcome_notebook_title');
$notebookCreate->save();
$notebookCreate->users()->attach($user->id, ['umask' => \PaperworkHelpers::UMASK_OWNER]);
//$tagCreate = Tag::create(array('title' => Lang::get('notebooks.welcome_note_tag'), 'visibility' => 0));
$tagCreate = new \Tag();
$tagCreate->title = Lang::get('notebooks.welcome_note_tag');
$tagCreate->visibility = 0;
$tagCreate->user_id = $user->id;
$tagCreate->save();
//$tagCreate->users()->attach($user->id);
$noteCreate = new \Note();
$versionCreate = new \Version(['title' => Lang::get('notebooks.welcome_note_title'), 'content' => Lang::get('notebooks.welcome_note_content'), 'content_preview' => mb_substr(strip_tags(Lang::get('notebooks.welcome_note_content')), 0, 255), 'user_id' => $user->id]);
$versionCreate->save();
$noteCreate->version()->associate($versionCreate);
$noteCreate->notebook_id = $notebookCreate->id;
$noteCreate->save();
$noteCreate->users()->attach($user->id, ['umask' => \PaperworkHelpers::UMASK_OWNER]);
$noteCreate->tags()->sync([$tagCreate->id]);
return $user;
}
示例3: wiki_install
/**
* Wiki for phpWebSite
*
* See docs/CREDITS for copyright information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package Wiki
* @author Greg Meiste <greg.meiste+github@gmail.com>
*/
function wiki_install(&$content)
{
PHPWS_Core::initModClass('wiki', 'WikiManager.php');
PHPWS_Core::initModClass('wiki', 'WikiPage.php');
PHPWS_Core::initModClass('version', 'Version.php');
// Adding pages that ship with the module
if (file_exists(PHPWS_SOURCE_DIR . 'mod/wiki/boost/frontpage.txt')) {
$frontpage = new WikiPage('FrontPage');
$frontpage->setPagetext(implode('', file(PHPWS_SOURCE_DIR . 'mod/wiki/boost/frontpage.txt')));
$frontpage->setOwnerId(Current_User::getId());
$frontpage->setEditorId(Current_User::getId());
$frontpage->setCreated(mktime());
$frontpage->setUpdated(mktime());
$frontpage->setComment('Provided by Wiki install');
$frontpage->save();
$version1 = new Version('wiki_pages');
$version1->setSource($frontpage);
$version1->setApproved(1);
$version1->save();
}
if (file_exists(PHPWS_SOURCE_DIR . 'mod/wiki/boost/samplepage.txt')) {
$samplepage = new WikiPage('SamplePage');
$samplepage->setPagetext(implode('', file(PHPWS_SOURCE_DIR . 'mod/wiki/boost/samplepage.txt')));
$samplepage->setOwnerId(Current_User::getId());
$samplepage->setEditorId(Current_User::getId());
$samplepage->setCreated(mktime());
$samplepage->setUpdated(mktime());
$samplepage->setComment('Provided by Wiki install');
$samplepage->allow_edit = 0;
$samplepage->save();
$version2 = new Version('wiki_pages');
$version2->setSource($samplepage);
$version2->setApproved(1);
$version2->save();
}
if (file_exists(PHPWS_SOURCE_DIR . 'mod/wiki/boost/sandbox.txt')) {
$sandbox = new WikiPage('WikiSandBox');
$sandbox->setPagetext(implode('', file(PHPWS_SOURCE_DIR . 'mod/wiki/boost/sandbox.txt')));
$sandbox->setOwnerId(Current_User::getId());
$sandbox->setEditorId(Current_User::getId());
$sandbox->setCreated(mktime());
$sandbox->setUpdated(mktime());
$sandbox->setComment('Provided by Wiki install');
$sandbox->save();
$version3 = new Version('wiki_pages');
$version3->setSource($sandbox);
$version3->setApproved(1);
$version3->save();
}
// Adding first interwiki link
PHPWS_Core::initModClass('wiki', 'InterWiki.php');
$interwiki = new InterWiki();
$interwiki->setLabel('Wikipedia');
$interwiki->setUrl('http://en.wikipedia.org/wiki/%s');
$interwiki->save(FALSE);
return TRUE;
}
示例4: getApplications
public function getApplications(Version $versionm)
{
$apps = $versionm->builds()->get();
foreach ($apps as $app) {
$app_address = "/builds/android/{$app->version->label->label_name}/{$app->version->version}/{$app->build}/{$app->bundle}";
$result[] = array("name" => $app->name, "link_to_file" => Config::get('app.base_url') . $app_address . ".apk", "icon" => Config::get('app.base_url') . $app_address . ".png", "version" => $app->version->version, "build" => $app->build, "bundle" => $app->bundle, "date" => $app->created_at);
}
return Response::json($result)->header("Content-type", "application/json");
}
示例5: setVersions
public function setVersions($versions = [])
{
$this->versions = collect($versions)->map(function ($value, $version) {
$obj = new Version($version);
$obj->setChanges($value['changes']);
$obj->setRequirements($value['requirements']);
$obj->setTasks($value['tasks']);
return $obj;
});
}
示例6: executeNew
public function executeNew(sfWebRequest $request)
{
$version = new Version();
sfContext::getInstance()->getUser()->setAttribute('inclusion', false);
$this->estado = Estado::crearEstado(Estado::CREADA);
$version->setValidada(false);
$version->setEstado($this->estado);
$version->setArtefacto($this->buscarArtefacto($request));
$this->forward404Unless($version->tramitable());
$this->form = new VersionForm($version);
}
示例7: getCharacterCountBits
/**
* Gets the number of bits used in a specific QR code version.
*
* @param Version $version
* @return integer
*/
public function getCharacterCountBits(Version $version)
{
$number = $version->getVersionNumber();
if ($number <= 9) {
$offset = 0;
} elseif ($number <= 26) {
$offset = 1;
} else {
$offset = 2;
}
return self::$characterCountBitsForVersions[$this->value][$offset];
}
示例8: actionIndex
public function actionIndex()
{
$model = new Version();
if (isset($_POST['Version'])) {
$model->setAttributes($_POST['Version'], false);
if ($model->save()) {
echo '成功';
}
} else {
$data = $model->findAll(null);
$this->send(ERROR_NONE, $data[0]);
}
$this->render('index', array('model' => $model));
}
示例9: Version
/**
* Internal function to return a Version object from a row.
* @param $row array
* @return Version
*/
function &_returnVersionFromRow(&$row)
{
$version = new Version();
$version->setMajor($row['major']);
$version->setMinor($row['minor']);
$version->setRevision($row['revision']);
$version->setBuild($row['build']);
$version->setDateInstalled($this->datetimeFromDB($row['date_installed']));
$version->setCurrent($row['current']);
$version->setProductType(isset($row['product_type']) ? $row['product_type'] : null);
$version->setProduct(isset($row['product']) ? $row['product'] : null);
HookRegistry::call('VersionDAO::_returnVersionFromRow', array(&$version, &$row));
return $version;
}
示例10: getGeneral
public function getGeneral()
{
$data = array();
$version = new Version();
$data['platform'] = $version->getLongVersion();
$data['php_version'] = phpversion();
$data['php_build'] = php_uname();
$data['db_version'] = $this->db->getVersion();
$data['db_collation'] = $this->db->getCollation();
$data['server'] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : getenv('SERVER_SOFTWARE');
$data['sapi'] = php_sapi_name();
$data['user_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
return $data;
}
示例11: get_invalid_versions
function get_invalid_versions()
{
$invalid = array();
require_once 'modules/Versions/ExpectedVersions.php';
foreach ($expect_versions as $expect) {
$version = new Version();
$result = $version->db->query("Select * from {$version->table_name} where name='" . $expect['name'] . "'");
$valid = $version->db->fetchByAssoc($result);
if ($valid == null || !$version->is_expected_version($expect) && !empty($version->name)) {
$invalid[$expect['name']] = $expect;
}
}
return $invalid;
}
示例12: isNewerThan
/**
* Determine si cette version est plus recente qu'une autre.
* @param Version $version La version a comparer.
* @return bool Vrai si cette version est plus recente que celle specifiee.
*/
public function isNewerThan(Version $version)
{
$otherFetchedVersion = $version->getFetchedVersion();
foreach ($this->fetchedVersion as $id => $no) {
if (!array_key_exists($id, $otherFetchedVersion)) {
return true;
} elseif ($no == $otherFetchedVersion[$id]) {
continue;
} elseif ($no > $otherFetchedVersion[$id]) {
return true;
} else {
return false;
}
}
return false;
}
示例13: createNote
/**
* Create Note and Version instances
*
* $created_at and $updated_at values we have from parsed xml
*
* @param $title
* @param $content
* @param $created_at
* @param $updated_at
* @return \Note
*/
protected function createNote($title, $content, $created_at, $updated_at)
{
$noteCreate = new \Note();
$noteCreate->created_at = $created_at;
$noteCreate->updated_at = $updated_at;
// Add spaces for strip_tags
$contentPreview = preg_replace('/(<[^>]+>)/', '$1 ', $content);
$contentPreview = strip_tags($contentPreview);
$versionCreate = new \Version(['title' => $title, 'content' => $content, 'content_preview' => mb_substr($contentPreview, 0, 255), 'created_at' => $created_at, 'updated_at' => $updated_at, 'user_id' => \Auth::user()->id]);
$versionCreate->save();
$noteCreate->version()->associate($versionCreate);
$noteCreate->notebook_id = $this->notebook->id;
$noteCreate->save();
$noteCreate->users()->attach(\Auth::user()->id, array('umask' => \PaperworkHelpers::UMASK_OWNER));
return $noteCreate;
}
示例14: _open
private static function _open()
{
$res = '<StampMaster>';
$res .= '<version>' . Version::getVersion() . '</version>';
$res .= '</StampMaster>';
return $res;
}
示例15: test_requires_upgrade
function test_requires_upgrade()
{
Options::set('db_version', Version::DB_VERSION - 1);
$this->assert_equal(true, Version::requires_upgrade());
Options::set('db_version', Version::DB_VERSION);
$this->assert_equal(false, Version::requires_upgrade());
}