本文整理汇总了PHP中Version类的典型用法代码示例。如果您正苦于以下问题:PHP Version类的具体用法?PHP Version怎么用?PHP Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 <[email protected]>
*/
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
示例16: getVersion
/**
* @return Version
*/
public function getVersion()
{
if (false === isset(self::$m_versions[$this->m_component])) {
self::$m_versions[$this->m_component] = Version::parse($this->initialized()->version);
}
return self::$m_versions[$this->m_component];
}
开发者ID:evalcodenet,项目名称:net.evalcode.components.runtime,代码行数:10,代码来源:manifest.php
示例17: from_upload
public static function from_upload(array $data, $key_mode = false)
{
$create = array();
$file = $data['file'];
$user = $data['user'];
if ($key_mode) {
$keys = collect(function ($key) {
return $key->key;
}, Pki::find('all', array('select' => '`key`', 'conditions' => array('user_id' => $user->id))));
$sig = $data['sig'];
if (!static::verify($file, $sig, $keys)) {
throw new NimbleException('Invalid package signature');
}
}
$package_data = new PackageExtractor($file);
if ($user->pear_farm_url() !== $package_data->data['channel']) {
throw new Exception('Package channel ' . $package_data->data['channel'] . ' does not match ' . $user->pear_farm_url());
}
$name = $package_data->data['name'];
$version = $package_data->data['version']['release'];
$stability = $package_data->data['stability']['release'];
if (!Package::exists(array('name' => $name, 'user_id' => $user->id))) {
$package = new Package(array('name' => $name, 'user_id' => $user->id, 'category_id' => Category::find_by_name('Default')->id));
} else {
$package = Package::find('first', array('conditions' => array('name' => $name, 'user_id' => $user->id)));
}
if (!$package->new_record && Version::exists(array('version' => $version, 'package_id' => $package->id))) {
throw new NimbleException("There is already a {$version}. You cannot replace existing packages. Please bump the version number and try again." . " You can delete a version from the web interface if needed.");
}
$package->move_uploaded_file($file, $version);
$type = VersionType::find_by_name($stability);
$package->versions = array(array('raw_xml' => $package_data->get_package_xml(), 'version' => $version, 'meta' => serialize($package_data->data), 'version_type_id' => $type->id, 'summary' => $package_data->data['summary'], 'description' => $package_data->data['description'], 'min_php' => $package_data->data['dependencies']['required']['php']['min']));
$package->save();
return $package;
}
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:35,代码来源:package.php
示例18: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Version::create([]);
}
}
开发者ID:arwinjp,项目名称:ODTS,代码行数:7,代码来源:VersionsTableSeeder.php
示例19: indexAction
public function indexAction()
{
$panel = Bootstrap::panel('Search for crash reports')->color('blue');
$form = Bootstrap::form(Url::href('reports', 'search'))->horizontal()->method('get')->add(BootstrapUI::select2('package_id', 'package', Package::getSelectOptions(true)))->add(BootstrapUI::select2('brand_id', 'brand', Brand::getSelectOptions(true)))->add(BootstrapUI::select2('os_version_id', 'OS and version', Version::getSelectOptions(true)))->add(BootstrapUI::select2('country_id', 'country', Country::getSelectOptions(true)))->add(Bootstrap::textfield('date_from', null, 'date and time from')->type('datetime-local'))->add(Bootstrap::textfield('date_to', null, 'date and time to')->type('datetime-local'))->addSubmit('Search');
$panel->content($form);
return View::create('base')->with('title', 'Search for reports')->with('content', Bootstrap::row()->add(12, $panel));
}
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:7,代码来源:ReportsController.php
示例20: get_all_data
/**
* Returns all theme information -- dir, path, theme.xml, screenshot url
* @return array An array of Theme data
**/
public static function get_all_data()
{
if ( !isset( self::$all_data ) ) {
foreach ( self::get_all() as $theme_dir => $theme_path ) {
$themedata = array();
$themedata['dir'] = $theme_dir;
$themedata['path'] = $theme_path;
$themedata['theme_dir'] = $theme_path;
$themedata['info'] = simplexml_load_file( $theme_path . '/theme.xml' );
if ( $themedata['info']->getName() != 'pluggable' || (string) $themedata['info']->attributes()->type != 'theme' ) {
$themedata['screenshot'] = Site::get_url( 'admin_theme' ) . "/images/screenshot_default.png";
$themedata['info']->description = '<span class="error">' . _t( 'This theme is a legacy theme that is not compatible with Habari ' ) . Version::get_habariversion() . '. <br><br>Please update your theme.</span>';
$themedata['info']->license = '';
}
else {
foreach ( $themedata['info'] as $name=>$value ) {
$themedata[$name] = (string) $value;
}
if ( $screenshot = Utils::glob( $theme_path . '/screenshot.{png,jpg,gif}', GLOB_BRACE ) ) {
$themedata['screenshot'] = Site::get_url( 'habari' ) . dirname( str_replace( HABARI_PATH, '', $theme_path ) ) . '/' . basename( $theme_path ) . "/" . basename( reset( $screenshot ) );
}
else {
$themedata['screenshot'] = Site::get_url( 'admin_theme' ) . "/images/screenshot_default.png";
}
}
self::$all_data[$theme_dir] = $themedata;
}
}
return self::$all_data;
}
开发者ID:rynodivino,项目名称:system,代码行数:37,代码来源:themes.php
注:本文中的Version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论