当前位置: 首页>>代码示例>>PHP>>正文


PHP Version类代码示例

本文整理汇总了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;
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:12,代码来源:SpecificMajorAndMinorVersionConstraint.php

示例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;
 }
开发者ID:jinchen891021,项目名称:paperwork,代码行数:42,代码来源:UserRegistrator.php

示例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;
}
开发者ID:Jopperi,项目名称:wiki,代码行数:79,代码来源:install.php

示例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");
 }
开发者ID:NeZanyat,项目名称:laravel-example,代码行数:9,代码来源:ApiController.php

示例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;
     });
 }
开发者ID:illuminate3,项目名称:larastaller,代码行数:10,代码来源:Definition.php

示例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);

	}
开发者ID:nhpatt,项目名称:gestor-de-estados,代码行数:12,代码来源:actions.class.php

示例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];
 }
开发者ID:jumong,项目名称:BaconQrCode,代码行数:18,代码来源:Mode.php

示例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));
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:14,代码来源:VersionController.php

示例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;
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:19,代码来源:VersionDAO.inc.php

示例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;
 }
开发者ID:LinuxJedi,项目名称:arastta,代码行数:14,代码来源:system_info.php

示例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;
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:14,代码来源:CheckVersions.php

示例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;
 }
开发者ID:Tiger66639,项目名称:symbiose-raspberrypi,代码行数:21,代码来源:Version.class.php

示例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;
 }
开发者ID:Liongold,项目名称:paperwork,代码行数:27,代码来源:AbstractImport.php

示例14: _open

 private static function _open()
 {
     $res = '<StampMaster>';
     $res .= '<version>' . Version::getVersion() . '</version>';
     $res .= '</StampMaster>';
     return $res;
 }
开发者ID:ArchangelDesign,项目名称:stampmaster,代码行数:7,代码来源:XmlResponder.php

示例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());
 }
开发者ID:habari,项目名称:tests,代码行数:7,代码来源:test_version.php


注:本文中的Version类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。