本文整理汇总了PHP中false类的典型用法代码示例。如果您正苦于以下问题:PHP false类的具体用法?PHP false怎么用?PHP false使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了false类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDevice
/**
* Get device features
*
* @return Application_Model_Device
*/
public function getDevice()
{
if ($this->device == null) {
$this->device = false;
$devices = Application_Model_DevicesMapper::i()->fetchAll();
/* @var Application_Model_Device $device */
foreach ($devices as $device) {
// if exact do an == comparison
if ($device->isExact() && $device->getPattern() == $_SERVER['HTTP_USER_AGENT'] || !$device->isExact() && preg_match($device->getPattern(), $_SERVER['HTTP_USER_AGENT']) > 0) {
// valid $device found;
$this->device = $device;
break;
}
}
if ($this->device == false) {
// load things from default
$this->device = new Application_Model_Device();
if (X_VlcShares_Plugins::broker()->isRegistered('wiimc')) {
$this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WiimcPlxRenderer'));
} else {
$this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WebkitRenderer'));
}
$this->device->setIdProfile($this->options->get('profile', 1))->setLabel("Unknown device");
}
}
return $this->device;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:32,代码来源:Devices.php
示例2: pullApiKey
/**
* @return bool|\Dingo\Api\Models\ApiKey
*/
protected function pullApiKey()
{
$headers = ['ID', 'Service', 'Name', 'Token'];
$this->table($headers, $this->user->apiKeys()->get(['id', 'service', 'name', 'token']));
$key_id = $this->ask('What key are we using?');
if ($key_id === 'exit') {
exit;
}
if ($key = $this->user->apiKeys()->where('id', $key_id)->first()) {
return $key;
}
$this->error('ApiKey ' . $key_id . ' not found!');
return false;
}
开发者ID:ryanhungate,项目名称:api,代码行数:17,代码来源:ConsoleHelper.php
示例3: __construct
/**
* Migrate constructor
*
* @param string $dirname module directory name that defines the tables to be migrated
*
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
public function __construct($dirname)
{
$this->helper = Helper::getHelper($dirname);
if (false === $this->helper) {
throw new \InvalidArgumentException("Invalid module {$dirname} specified");
}
$module = $this->helper->getModule();
$this->moduleTables = $module->getInfo('tables');
if (empty($this->moduleTables)) {
throw new \RuntimeException("No tables established in module");
}
$version = $module->getInfo('version');
$this->tableDefinitionFile = $this->helper->path("sql/{$dirname}_{$version}_migrate.yml");
$this->tableHandler = new Tables();
}
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:23,代码来源:Migrate.php
示例4: storeImage
/**
* Save image information to DB.
*
* @param \Magento\Catalog\Model\Product $product
* @param array $images
* @return void
*/
protected function storeImage($product, $images)
{
$baseImage = '';
$i = 1;
$mediaAttribute = $this->eavConfig->getAttribute('catalog_product', 'media_gallery');
foreach ($images as $image) {
if (empty($image)) {
$this->errors[] = $product->getSku();
continue;
}
if (strpos($image, '_main') !== false) {
$baseImage = $image;
}
$id = $this->galleryResource->insertGallery(['attribute_id' => $mediaAttribute->getAttributeId(), 'entity_id' => $product->getId(), 'value' => $image]);
$this->galleryResource->insertGalleryValueInStore(['value_id' => $id, 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'entity_id' => $product->getId(), 'label' => 'Image', 'position' => $i, 'disables' => 0]);
$this->galleryResource->bindValueToEntity($id, $product->getId());
$i++;
}
if (empty($baseImage)) {
$baseImage = $images[0];
}
if ($baseImage) {
$imageAttribute = $product->getResource()->getAttribute('image');
$smallImageAttribute = $product->getResource()->getAttribute('small_image');
$thumbnailAttribute = $product->getResource()->getAttribute('thumbnail');
$adapter = $product->getResource()->getConnection();
foreach ([$imageAttribute, $smallImageAttribute, $thumbnailAttribute] as $attribute) {
$table = $imageAttribute->getBackend()->getTable();
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter*/
$data = [$attribute->getBackend()->getEntityIdField() => $product->getId(), 'attribute_id' => $attribute->getId(), 'value' => $baseImage];
$adapter->insertOnDuplicate($table, $data, ['value']);
}
}
}
开发者ID:koliaGI,项目名称:magento2,代码行数:41,代码来源:Gallery.php
示例5: getSite
/**
* Returns the site with provided global id, or false if there is no such site.
*
* @since 1.21
*
* @param string $globalId
* @param string $source
*
* @return Site|false
*/
public function getSite($globalId, $source = 'cache')
{
if ($source === 'cache' && $this->sites !== false) {
return $this->sites->hasSite($globalId) ? $this->sites->getSite($globalId) : false;
}
return SitesTable::singleton()->selectRow(null, array('global_key' => $globalId));
}
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:17,代码来源:Sites.php
示例6: send
/**
* Send a mail using this transport
*
* @param \Zend\Mail\Mail $mail
* @access public
* @return void
* @throws \Zend\Mail\Transport\Exception if mail is empty
*/
public function send(\Zend\Mail\Mail $mail)
{
$this->_isMultipart = false;
$this->_mail = $mail;
$this->_parts = $mail->getParts();
$mime = $mail->getMime();
// Build body content
$this->_buildBody();
// Determine number of parts and boundary
$count = count($this->_parts);
$boundary = null;
if ($count < 1) {
throw new Exception('Empty mail cannot be sent');
}
if ($count > 1) {
// Multipart message; create new MIME object and boundary
$mime = new Mime\Mime($this->_mail->getMimeBoundary());
$boundary = $mime->boundary();
} elseif ($this->_isMultipart) {
// multipart/alternative -- grab boundary
$boundary = $this->_parts[0]->boundary;
}
// Determine recipients, and prepare headers
$this->recipients = implode(',', $mail->getRecipients());
$this->_prepareHeaders($this->_getHeaders($boundary));
// Create message body
// This is done so that the same \Zend\Mail\Mail object can be used in
// multiple transports
$message = new Mime\Message();
$message->setParts($this->_parts);
$message->setMime($mime);
$this->body = $message->generateMessage($this->EOL);
// Send to transport!
$this->_sendMail();
}
开发者ID:alab1001101,项目名称:zf2,代码行数:43,代码来源:AbstractTransport.php
示例7: log
private static function log($level, $string, $statsLog = false)
{
if (php_sapi_name() === 'cli' || defined('STDIN')) {
// we are being executed from the CLI, nowhere to log
return;
}
if (self::$loggingHandler === null) {
// Initialize logging
self::createLoggingHandler();
if (!empty(self::$earlyLog)) {
error_log('----------------------------------------------------------------------');
// output messages which were logged before we properly initialized logging
foreach (self::$earlyLog as $msg) {
self::log($msg['level'], $msg['string'], $msg['statsLog']);
}
}
} elseif (self::$loggingHandler === false) {
// some error occurred while initializing logging
if (empty(self::$earlyLog)) {
// this is the first message
error_log('--- Log message(s) while initializing logging ------------------------');
}
error_log($string);
self::defer($level, $string, $statsLog);
return;
}
if (self::$captureLog) {
$ts = microtime(true);
$msecs = (int) (($ts - (int) $ts) * 1000);
$ts = GMdate('H:i:s', $ts) . sprintf('.%03d', $msecs) . 'Z';
self::$capturedLog[] = $ts . ' ' . $string;
}
if (self::$logLevel >= $level || $statsLog) {
if (is_array($string)) {
$string = implode(",", $string);
}
$formats = array('%trackid', '%msg', '%srcip', '%stat');
$replacements = array(self::$trackid, $string, $_SERVER['REMOTE_ADDR']);
$stat = '';
if ($statsLog) {
$stat = 'STAT ';
}
array_push($replacements, $stat);
if (self::$trackid === self::NO_TRACKID && !self::$shuttingDown) {
// we have a log without track ID and we are not still shutting down, so defer logging
self::defer($level, $string, $statsLog);
return;
} elseif (self::$trackid === self::NO_TRACKID) {
// shutting down without a track ID, prettify it
array_shift($replacements);
array_unshift($replacements, 'N/A');
}
// we either have a track ID or we are shutting down, so just log the message
$string = str_replace($formats, $replacements, self::$format);
self::$loggingHandler->log($level, $string);
}
}
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:57,代码来源:Logger.php
示例8: valid
/**
* Checks if current position is valid.
*
* @return bool Returns true on success, false otherwise
*/
public function valid()
{
if (is_null($this->current)) {
return !empty($this->branch);
}
if ($this->current instanceof RecursiveLeafInterface) {
return $this->current->valid();
}
return false;
}
开发者ID:easy-system,项目名称:es-container,代码行数:15,代码来源:RecursiveTree.php
示例9: show
/**
* Show the template to the user.
*/
public function show()
{
if ($this->twig !== false) {
$this->twigDefaultContext();
echo $this->twig->render($this->twig_template, $this->data);
} else {
$filename = $this->findTemplatePath($this->template);
require $filename;
}
}
开发者ID:simplesamlphp,项目名称:simplesamlphp,代码行数:13,代码来源:Template.php
示例10: purge
/**
* Purges the cache store, and loader if there is one.
*
* @return bool True on success, false otherwise
*/
public function purge()
{
// 1. Purge the persist cache.
$this->persistcache = array();
// 2. Purge the store.
$this->store->purge();
// 3. Optionally pruge any stacked loaders.
if ($this->loader) {
$this->loader->purge();
}
return true;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:17,代码来源:loaders.php
示例11: purge
/**
* Purges the cache store, and loader if there is one.
*
* @return bool True on success, false otherwise
*/
public function purge()
{
// 1. Purge the static acceleration array.
$this->static_acceleration_purge();
// 2. Purge the store.
$this->store->purge();
// 3. Optionally pruge any stacked loaders.
if ($this->loader) {
$this->loader->purge();
}
return true;
}
开发者ID:gabrielrosset,项目名称:moodle,代码行数:17,代码来源:loaders.php
示例12: send
/**
* Send a mail using this transport
*
* @param OpenPGP_Zend_Mail $mail
* @access public
* @return void
* @throws Zend_Mail_Transport_Exception if mail is empty
*/
public function send(OpenPGP_Zend_Mail $mail)
{
$this->_isMultipart = false;
$this->_mail = $mail;
$this->_parts = $mail->getParts();
$mime = $mail->getMime();
// Build body content
$this->_buildBody();
// Determine number of parts and boundary
$count = count($this->_parts);
$boundary = null;
if ($count < 1) {
throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
}
if ($count > 1) {
// Multipart message; create new MIME object and boundary
$mime = new Zend_Mime($this->_mail->getMimeBoundary());
$boundary = $mime->boundary();
} elseif ($this->_isMultipart) {
// multipart/alternative -- grab boundary
$boundary = $this->_parts[0]->boundary;
}
// Determine recipients, and prepare headers
$this->recipients = implode(',', $mail->getRecipients());
$this->_prepareHeaders($this->_getHeaders($boundary));
// Create message body
// This is done so that the same OpenPGP_Zend_Mail object can be used in
// multiple transports
$message = new Zend_Mime_Message();
$message->setParts($this->_parts);
$message->setMime($mime);
$this->body = $message->generateMessage($this->EOL);
////////////////////////////////////////////////////////
// //
// ALPHAFIELDS 2012-11-03: ADDED PGP/MIME ENCRYPTION //
// USING lib/openpgp/opepgplib.php //
// //
////////////////////////////////////////////////////////
// get from globals (set in tiki-setup.php)
global $openpgplib;
$pgpmime_msg = $openpgplib->prepareEncryptWithZendMail($this->header, $this->body, $mail->getRecipients());
$this->header = $pgpmime_msg[0];
// set pgp/mime headers from result array
$this->body = $pgpmime_msg[1];
// set pgp/mime encrypted message body from result array
////////////////////////////////////////////////////////
// //
// ALPHAFIELDS 2012-11-03: ..END PGP/MIME ENCRYPTION //
// //
////////////////////////////////////////////////////////
// Send to transport!
$this->_sendMail();
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:61,代码来源:OpenPGP_Zend_Mail_Transport_Abstract.php
示例13: handleException
/**
* Handle exception (uncatched).
*
* @param \Throwable $exception
*/
public function handleException($exception)
{
if (!$exception instanceof \Exception) {
$exception = new \Exception("Can't handle exception thrown!");
}
// Log
\Logger::error((string) $exception);
// Whoops
if ($this->whoops !== false) {
$this->whoops->handleException($exception);
}
}
开发者ID:arvici,项目名称:framework,代码行数:17,代码来源:ExceptionHandler.php
示例14: run
/**
* @param string $keyword
* @param int $keywordAdditionalWeight
*/
public function run($keyword, $keywordAdditionalWeight = 0)
{
if ($this->_databaseConnection) {
$prefix = config('coaster::blog.prefix');
$blogPosts = $this->_databaseConnection->query("\n SELECT wp.*, weights.search_weight FROM wp_posts wp RIGHT JOIN\n (\n SELECT ID, sum(search_weight) as search_weight\n FROM (\n SELECT ID, 4 AS search_weight FROM {$prefix}posts WHERE post_type = 'post' AND post_status = 'publish' AND post_title like '%" . $keyword . "%'\n UNION\n SELECT ID, 2 AS search_weight FROM {$prefix}posts WHERE post_type = 'post' AND post_status = 'publish' AND post_content like '%" . $keyword . "%'\n ) results\n GROUP BY ID\n ) weights\n ON weights.ID = wp.ID;\n ");
if ($blogPosts) {
$defaultSeparator = new Path(false);
foreach ($blogPosts as $blogPost) {
$postData = new \stdClass();
$postData->id = 'WP' . $blogPost['ID'];
unset($blogPost['ID']);
foreach ($blogPost as $field => $value) {
$postData->{$field} = $value;
}
$postData->content = $blogPost['post_content'];
$postData->fullName = ucwords(str_replace('/', ' ', config('coaster::blog.url'))) . $defaultSeparator->separator . $blogPost['post_title'];
$postData->fullUrl = config('coaster::blog.url') . $blogPost['post_name'];
self::_addWeight($postData, $blogPost['search_weight'] + $keywordAdditionalWeight);
}
}
}
}
开发者ID:web-feet,项目名称:coasterframework,代码行数:26,代码来源:WordPress.php
示例15: get_required_option_bool
/**
* Checks if login is required on this site. is_required for public access
*
* @since 0.1.0
*
* @return boolean Enabled or disabled
*/
protected function get_required_option_bool()
{
$setting = $this->get_option('require');
if ('enabled' === $setting) {
return true;
}
if ('disabled' === $setting) {
return false;
}
if ($this->network_admin) {
return (bool) $this->network_admin->get_option('enable_network_wide');
}
return false;
}
开发者ID:WebDevStudios,项目名称:WDS-Network-Require-Login,代码行数:21,代码来源:site-admin.php
示例16: log
/**
* Log an action.
*
* @since 0.1
*
* @param string $subType
*/
protected function log($subType)
{
if ($this->log) {
$info = $this->getLogInfo($subType);
if ($info !== false) {
if ($this->revAction !== false) {
$info['user'] = $this->revAction->getUser();
$info['comment'] = $this->revAction->getComment();
}
$info['subtype'] = $subType;
EPUtils::log($info);
}
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:21,代码来源:EPRevisionedObject.php
示例17: buildFrontControlForTaxon
/**
* @param UnicatConfigurationManager $ucm
* @param TaxonModel|false $lastTaxon
*
* @throws \Exception
*/
protected function buildFrontControlForTaxon(UnicatConfigurationManager $ucm, $lastTaxon = false)
{
$this->node->addFrontControl('create_item')->setTitle('Добавить запись')->setUri($this->generateUrl('unicat_admin.item_create_in_taxon', ['configuration' => $ucm->getConfiguration()->getName(), 'default_taxon_id' => empty($lastTaxon) ? 0 : $lastTaxon->getId()]));
if (!empty($lastTaxon)) {
$this->node->addFrontControl('create_taxon')->setIsDefault(false)->setTitle('Создать Taxon')->setUri($this->generateUrl('unicat_admin.structure_with_parent_id', ['configuration' => $ucm->getConfiguration()->getName(), 'parent_id' => empty($lastTaxon) ? 0 : $lastTaxon->getId(), 'id' => $lastTaxon->getStructure()->getId()]));
$this->node->addFrontControl('edit_taxon')->setIsDefault(false)->setTitle('Редактировать Taxon')->setUri($this->generateUrl('unicat_admin.taxon', ['configuration' => $ucm->getConfiguration()->getName(), 'id' => $lastTaxon->getId(), 'structure_id' => $lastTaxon->getStructure()->getId()]));
}
$this->node->addFrontControl('manage_configuration')->setIsDefault(false)->setTitle('Управление каталогом')->setUri($this->generateUrl('unicat_admin.configuration', ['configuration' => $ucm->getConfiguration()->getName()]));
}
开发者ID:smart-core,项目名称:module-unicat,代码行数:15,代码来源:UnicatController.php
示例18: purge
/**
* Purges the cache store, and loader if there is one.
*
* @return bool True on success, false otherwise
*/
public function purge()
{
// 1. Purge the static acceleration array.
$this->staticaccelerationarray = array();
if ($this->staticaccelerationsize !== false) {
$this->staticaccelerationkeys = array();
$this->staticaccelerationcount = 0;
}
// 2. Purge the store.
$this->store->purge();
// 3. Optionally pruge any stacked loaders.
if ($this->loader) {
$this->loader->purge();
}
return true;
}
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:21,代码来源:loaders.php
示例19: log
private static function log($level, $string, $statsLog = false)
{
if (php_sapi_name() === 'cli' || defined('STDIN')) {
// we are being executed from the CLI, nowhere to log
return;
}
if (self::$loggingHandler === null) {
/* Initialize logging. */
self::createLoggingHandler();
if (!empty(self::$earlyLog)) {
error_log('----------------------------------------------------------------------');
// output messages which were logged before we properly initialized logging
foreach (self::$earlyLog as $msg) {
self::log($msg['level'], $msg['string'], $msg['statsLog']);
}
}
} elseif (self::$loggingHandler === false) {
// some error occurred while initializing logging
if (empty(self::$earlyLog)) {
// this is the first message
error_log('--- Log message(s) while initializing logging ------------------------');
}
error_log($string);
self::$earlyLog[] = array('level' => $level, 'string' => $string, 'statsLog' => $statsLog);
return;
}
if (self::$captureLog) {
$ts = microtime(true);
$msecs = (int) (($ts - (int) $ts) * 1000);
$ts = GMdate('H:i:s', $ts) . sprintf('.%03d', $msecs) . 'Z';
self::$capturedLog[] = $ts . ' ' . $string;
}
if (self::$logLevel >= $level || $statsLog) {
if (is_array($string)) {
$string = implode(",", $string);
}
$formats = array('%trackid', '%msg', '%srcip', '%stat');
$replacements = array(self::getTrackId(), $string, $_SERVER['REMOTE_ADDR']);
$stat = '';
if ($statsLog) {
$stat = 'STAT ';
}
array_push($replacements, $stat);
$string = str_replace($formats, $replacements, self::$format);
self::$loggingHandler->log($level, $string);
}
}
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:47,代码来源:Logger.php
示例20: is_required_for_rest
/**
* Checks if REST API bypass is allowed on this site.
*
* @since 0.1.0
* @return boolean Enabled or disabled
*/
public function is_required_for_rest($is_required)
{
$setting = $this->get_option('allow_rest_api');
if ('bypass' === $setting) {
return false;
}
if ('require' === $setting) {
return true;
}
if ('use_require_login_setting' === $setting) {
return $is_required;
}
if ($this->network_admin) {
return (bool) $this->network_admin->is_required_for_rest();
}
return $is_required;
}
开发者ID:JPry,项目名称:WDS-Allow-REST-API,代码行数:23,代码来源:site-admin.php
注:本文中的false类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论