本文整理汇总了PHP中type类的典型用法代码示例。如果您正苦于以下问题:PHP type类的具体用法?PHP type怎么用?PHP type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: folderToZip
/**
* Taken from php.net
*
* @param type $folder
* @param type $zipFile
* @param type $subfolder
* @return boolean
*/
public static function folderToZip($folder, &$zipFile, $subfolder = null)
{
if ($zipFile == null) {
// no resource given, exit
return false;
}
// we check if $folder has a slash at its end, if not, we append one
$folder .= end(str_split($folder)) == "/" ? "" : "/";
$subfolder .= end(str_split($subfolder)) == "/" ? "" : "/";
// we start by going through all files in $folder
$handle = opendir($folder);
while ($f = readdir($handle)) {
if ($f != "." && $f != "..") {
if (is_file($folder . $f)) {
// if we find a file, store it
// if we have a subfolder, store it there
if ($subfolder != null) {
$zipFile->addFile($folder . $f, $subfolder . $f);
} else {
$zipFile->addFile($folder . $f);
}
} elseif (is_dir($folder . $f)) {
// if we find a folder, create a folder in the zip
$zipFile->addEmptyDir($f);
// and call the function again
self::folderToZip($folder . $f, $zipFile, $f);
}
}
}
}
开发者ID:apexstudios,项目名称:yamwlib,代码行数:38,代码来源:Zip.php
示例2: connectToDatabase
/**
* connect to database -- using Eloquent
* @param type $capsule
* @return type
*/
public function connectToDatabase($capsule)
{
// Register Eloquent configuration
$capsule->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'ch', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci']);
$capsule->bootEloquent();
return $capsule;
}
开发者ID:urukalo,项目名称:chpoll,代码行数:12,代码来源:bootstrapApp.php
示例3: afterFTPReceived
/**
* (dispatcher hook)
* Check recieved file sequences
* @param type $receiver
* @param type $filepaths
* @param type $hostname
* @return type
*/
public function afterFTPReceived($receiver, $filepaths, $hostname)
{
if ($receiver->getType() != $this->getName()) {
return;
}
$this->checkFilesSeq($filepaths, $hostname);
}
开发者ID:kalburgimanjunath,项目名称:system,代码行数:15,代码来源:nsn.php
示例4: label
/**
* Oštítkuje danou stránku (nebo skupinu stránek) lokálním / globálním
* štítkem.
*
* Pokud je štítek rekurzivní, tak podstránky štítkuje pasivně.
*
* @param type $page
* @param type $level
* @param type $data
* @return type
*/
public function label($page, $level, $data)
{
$depthOfRecursion = $this->label['depth_of_recursion'];
$maxLevelOfRecursion = $this->label['depth_of_recursion'] + 1;
if ($level == 1) {
if ($this->assign) {
$page->assignActiveLabel($this->label['label_id']);
// if ($this->label['is_global']) {
// $pm = $page->presenter->context->pageManager;
// $pages = $pm->getPageGroup($page->getProperty('lg'));
// foreach ($pages as $page) {
// $page->assignActiveLabel($this->label['label_id']);
// }
// } else {
// $page->assignActiveLabel($this->label['label_id']);
// }
} else {
$page->removeActiveLabel($this->label['label_id']);
// if ($this->label['is_global']) {
// $pm = $page->presenter->context->pageManager;
// $pages = $pm->getPageGroup($page->getProperty('lg'));
// foreach ($pages as $page) {
// $page->removeActiveLabel($this->label['label_id']);
// }
// } else {
// $page->removeActiveLabel($this->label['label_id']);
// }
}
} else {
if ($depthOfRecursion === NULL) {
return NULL;
}
if ($depthOfRecursion == 0 || $level <= $maxLevelOfRecursion) {
if ($this->assign) {
$page->assignPassiveLabel($this->label['label_id']);
// if ($this->label['is_global']) {
// $pm = $page->presenter->context->pageManager;
// $pages = $pm->getPageGroup($page->getProperty('lg'));
// foreach ($pages as $page) {
// $page->assignPassiveLabel($this->label['label_id']);
// }
// } else {
// $page->assignPassiveLabel($this->label['label_id']);
// }
} else {
$page->removePassiveLabel($this->label['label_id']);
// if ($this->label['is_global']) {
// $pm = $page->presenter->context->pageManager;
// $pages = $pm->getPageGroup($page->getProperty('lg'));
// foreach ($pages as $page) {
// $page->removePassiveLabel($this->label['label_id']);
// }
// } else {
// $page->removePassiveLabel($this->label['label_id']);
// }
}
}
}
$page->refresh();
}
开发者ID:jurasm2,项目名称:bubo,代码行数:71,代码来源:ToggleActiveLabelAtPageCommand.php
示例5: login_event
/**
* Called on the login user event
* Checks for spammers
*
* @param type $event
* @param type $type
* @param type $user
* @return boolean
*/
function login_event($event, $type, $user)
{
$check_login = elgg_get_plugin_setting('event_login', PLUGIN_ID);
$ip = get_ip();
$user->ip_address = $ip;
if ($check_login != 'no' || !$user->last_login) {
// do it by default
if (!check_spammer($user->email, $ip, true) && !$user->isAdmin()) {
register_error(elgg_echo('spam_login_filter:access_denied_mail_blacklist'));
notify_admin($user->email, $ip, "Existing member identified as spammer has tried to login, check this account");
return false;
}
}
// check user metadata for banned words/phrases
$banned = get_banned_strings();
$metadata = get_metadata_names();
if ($banned && $metadata) {
foreach ($metadata as $m) {
foreach ($banned as $str) {
if (strpos($user->{$m}, $str) !== false) {
return false;
}
}
}
}
}
开发者ID:bgunn,项目名称:spam_login_filter,代码行数:35,代码来源:events.php
示例6: generateAdminLinks
/**
*
* @param type $oObj
* @param type $sCss
* @return type
*/
public function generateAdminLinks($oObj, $sCss)
{
JCH_DEBUG ? JchPlatformProfiler::start('GenerateAdminLinks') : null;
$params = clone $this->params;
$params->set('javascript', '1');
$params->set('css', '1');
$params->set('excludeAllExtensions', '0');
$params->set('css_minify', '0');
$params->set('debug', '0');
$params->set('bottom_js', '2');
##<procode>##
$params->set('pro_phpAndExternal', '1');
$params->set('pro_inlineScripts', '1');
$params->set('pro_lazyload', '0');
##</procode>##
$sHtml = $oObj->getOriginalHtml();
$oParser = new JchOptimizeParser($params, $sHtml, JchOptimizeFileRetriever::getInstance());
$aLinks = $oParser->getReplacedFiles();
if ($sCss == '' && !empty($aLinks['css'][0])) {
$oCombiner = new JchOptimizeCombiner($params, $this->bBackend);
$oCssParser = new JchOptimizeCssParser($params, $this->bBackend);
$oCombiner->combineFiles($aLinks['css'][0], 'css', $oCssParser);
$sCss = $oCombiner->css;
}
$oSpriteGenerator = new JchOptimizeSpriteGenerator($params);
$aLinks['images'] = $oSpriteGenerator->processCssUrls($sCss, TRUE);
##<procode>##
$sRegex = $oParser->getLazyLoadRegex();
preg_match_all($sRegex, $oParser->getBodyHtml(), $aMatches);
$aLinks['lazyload'] = $aMatches[1];
##</procode>##
JCH_DEBUG ? JchPlatformProfiler::stop('GenerateAdminLinks', TRUE) : null;
return $aLinks;
}
开发者ID:grlf,项目名称:eyedock,代码行数:40,代码来源:admin.php
示例7: applyCmsBlock
/**
* CMS block cache, must use the block id from the database
*
* @param type $block
*/
public function applyCmsBlock($block)
{
// The "messages" block is session-dependent, don't cache
if (Mage::helper('cache')->responseHasMessages()) {
$block->setData('cache_lifetime', null);
return;
}
// Set cache tags
$tags = array();
$blockId = $block->getData('block_id');
if ($blockId) {
$cmsBlock = Mage::getModel('cms/block')->setStoreId(Mage::app()->getStore()->getId())->load($blockId);
if ($cmsBlock->getIsActive()) {
$tags = $block->getCacheTags();
$tags[] = Mage_Cms_Model_Block::CACHE_TAG . '_' . $cmsBlock->getId();
}
}
$block->setData('cache_tags', $tags);
// Set cache key
$keys = $block->getCacheKeys();
$blockId = $block->getData('block_id');
if ($blockId) {
$cmsBlock = Mage::getModel('cms/block')->setStoreId(Mage::app()->getStore()->getId())->load($blockId);
if ($cmsBlock->getIsActive()) {
$keys = $block->getCacheKeyInfo();
if (!is_array($keys)) {
$keys = array();
}
$keys[] = $blockId;
$keys[] = $block->getLayout()->getUpdate()->getCacheId();
}
}
$block->setData('cache_keys', $keys);
}
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:39,代码来源:Cms.php
示例8: beforeAction
/**
* check product options when version >= 1.5
* @param type $itemId
* @param type $option
* @param type $qty
* @param type $cartService
* @return boolean
* @author hujs
*/
public function beforeAction($itemId, $option, $qty, $cartService)
{
$error = $cartService->checkMinimunOrder($itemId, (int) $qty);
if (sizeof($error)) {
return $error;
}
$this->language->load('checkout/cart');
$this->load->model('catalog/product');
$productOptions = $this->model_catalog_product->getProductOptions($itemId);
foreach ($productOptions as $productOption) {
$optionId = $productOption['product_option_id'];
if ($productOption['required'] && (!isset($option[$optionId]) || !$option[$optionId])) {
$error[] = sprintf($this->language->get('error_required'), $productOption['name']);
} else {
switch ($productOption['type']) {
case 'date':
case 'time':
case 'datetime':
$date = str_replace('//', '/', $option[$optionId]);
$result = date_parse($date);
$result['error_count'] > 0 && ($error[] = $productOption['name'] . ' Invalid.');
break;
case 'file':
$this->uploadFile($option[$optionId], $error);
break;
default:
break;
}
}
}
return sizeof($error) ? $error : true;
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:41,代码来源:add_action.php
示例9: transform
/**
* Convert to form value.
*
* @param type $value
*/
public function transform($value)
{
if ($value === null) {
return;
}
return $value->getId();
}
开发者ID:symedit,项目名称:symedit,代码行数:12,代码来源:RepositoryTransformer.php
示例10: execute
/**
*
* @param type $request
*/
public function execute($request)
{
$request->setParameter('initialActionName', $this->getInitalAction());
$this->_setListComponent($this->getPerformanceTrackList(), $this->getTrackerListCount());
$params = array();
$this->parmetersForListCompoment = $params;
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:11,代码来源:viewPerformanceTrackerListAction.class.php
示例11: registrarActividad
/**
* Método estático que permite registrar una actividad
* @param type $model modelo en donde se realiza la actividad
* @param type $tipo tipo de actividad (update,create,delete)
* @param type $usuario_id usuario que realiza la actividad, opcional
* @param type $detalle mensaje extra sobre el detalle de la actividad, opcional
* @return type Boolean devuelve un true o false si guarda o no la actividad
*/
public static function registrarActividad($model, $tipo, $usuario_id = null, $detalle = null)
{
$actividad = new ActividadSistema();
$actividad->attributes = array('entidad_tipo' => $model->tableName(), 'entidad_id' => $model->id, 'tipo' => $tipo, 'usuario_id' => $usuario_id ? $usuario_id : $model->usuario_creacion_id, 'fecha' => Util::FechaActual());
$actividad->detalle = $detalle ? $detalle : null;
return $actividad->save();
}
开发者ID:Wladimir89,项目名称:software1grh,代码行数:15,代码来源:ActividadSistema.php
示例12: paypalPrepareLineItems
/**
* transfer reward points discount to Paypal gateway
*
* @param type $observer
*/
public function paypalPrepareLineItems($observer)
{
if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
if ($paypalCart = $observer->getPaypalCart()) {
$salesEntity = $paypalCart->getSalesEntity();
$baseDiscount = $salesEntity->getRewardpointsInvitedBaseDiscount();
if ($baseDiscount < 0.0001 && $salesEntity instanceof Mage_Sales_Model_Quote) {
$baseDiscount = Mage::getSingleton('checkout/session')->getRewardpointsInvitedBaseDiscount();
}
if ($baseDiscount > 0.0001) {
$paypalCart->updateTotal(Mage_Paypal_Model_Cart::TOTAL_DISCOUNT, (double) $baseDiscount, Mage::helper('rewardpointsreferfriends')->__('Offer Discount'));
}
}
return $this;
}
$salesEntity = $observer->getSalesEntity();
$additional = $observer->getAdditional();
if ($salesEntity && $additional) {
$baseDiscount = $salesEntity->getRewardpointsBaseDiscount();
if ($baseDiscount > 0.0001) {
$items = $additional->getItems();
$items[] = new Varien_Object(array('name' => Mage::helper('rewardpointsreferfriends')->__('Offer Discount'), 'qty' => 1, 'amount' => -(double) $baseDiscount));
$additional->setItems($items);
}
}
}
开发者ID:sshegde123,项目名称:wmp8,代码行数:31,代码来源:Observer.php
示例13: mpp_taxonomy_filter_clauses
/**
* Sortable taxonomy columns
* Credit: http://scribu.net/wordpress/sortable-taxonomy-columns.html
* Modified to suit our purpose
* Allows us to sort the gallery listing by
* Slightly modified to fit our purpose
*
* @global type $wpdb
* @param type $clauses
* @param type $wp_query
* @return type
*/
function mpp_taxonomy_filter_clauses($clauses, $wp_query)
{
//only apply if we are on the mpp gallery list screen
if (!mpp_admin_is_gallery_list()) {
return $clauses;
}
if (!isset($wp_query->query['orderby'])) {
return $clauses;
}
$order_by = $wp_query->query['orderby'];
$order_by_tax = mpp_translate_to_taxonomy($order_by);
if (!$order_by_tax || !in_array($order_by, array('component', 'status', 'type'))) {
return $clauses;
}
global $wpdb;
//if we are here, It is for one of our taxonomy
$clauses['join'] .= <<<SQL
LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb->term_relationships}.object_id
LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id)
LEFT OUTER JOIN {$wpdb->terms} USING (term_id)
SQL;
$clauses['where'] .= $wpdb->prepare(" AND (taxonomy = %s OR taxonomy IS NULL)", $order_by_tax);
$clauses['groupby'] = "object_id";
$clauses['orderby'] = "GROUP_CONCAT({$wpdb->terms}.name ORDER BY name ASC) ";
$clauses['orderby'] .= 'ASC' == strtoupper($wp_query->get('order')) ? 'ASC' : 'DESC';
return $clauses;
}
开发者ID:enboig,项目名称:mediapress,代码行数:39,代码来源:mpp-admin-functions.php
示例14: orderState
/**
* Sets order STATE based on status.
*
* @param type $o
*/
public function orderState($o)
{
$order = $o->getEvent()->getOrder();
if (!is_object($order->getPayment())) {
return $o;
}
$_c = $order->getPayment()->getMethod();
if (Mage::helper('sagepaysuite')->isSagePayMethod($_c) === false) {
return $o;
}
$methodInstance = $order->getPayment()->getMethodInstance();
$methodInstance->setStore($order->getStoreId());
$action = $methodInstance->getConfigPaymentAction();
$state = Mage_Sales_Model_Order::STATE_NEW;
if ($action == Ebizmarts_SagePaySuite_Model_Api_Payment::ACTION_AUTHORIZE_CAPTURE or $action == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
}
$order->setState($state);
/* Set order status based on ReD response.
* $sagedata = $this->_getTransactionsModel()->loadByParent($order->getId());
$ReD = $sagedata->getRedFraudResponse();
if(strtoupper($ReD) == 'DENY') {
$order->setStatus('security_check');
}*/
}
开发者ID:MadMaxAi,项目名称:sage-pay-suite-ce,代码行数:30,代码来源:Sales.php
示例15: checkResult
/**
* Checks that a result is successful
*
* @param type $result
* @throws CMError
*/
protected function checkResult($result)
{
if (!$result->was_successful()) {
throw new CMError($result->response->Message, $result->http_status_code);
}
return true;
}
开发者ID:tractorcow,项目名称:silverstripe-campaignmonitor,代码行数:13,代码来源:CMBase.php
示例16: populateDogodekSplosni
/**
*
* @param type $manager
* @param type $v
*/
public function populateDogodekSplosni($manager, $v)
{
$rep = $manager->getRepository('Koledar\\Entity\\DogodekSplosni');
$o = null;
$nov = false;
if (!$o) {
$o = new \Koledar\Entity\DogodekSplosni();
$nov = true;
}
$o->setTitle($v[1]);
$o->setStatus($v[2]);
$date = empty($v[3]) ? null : date_create($v[3]);
$o->setZacetek($date);
$date = empty($v[4]) ? null : date_create($v[4]);
$o->setKonec($date);
$ref = $v[5] ? $this->getReference($v[5]) : null;
$o->setProstor($ref);
$ref = $v[6] ? $this->getReference($v[6]) : null;
// $o->setSezona($ref);
if ($nov) {
$rep->create($o);
} else {
$rep->update($o);
}
$referenca = 'DogodekSplosni-' . $v[0];
// var_dump($referenca);
$this->addReference($referenca, $o);
$referencaDog = 'DogodekSpl-' . $v[0];
$this->addReference($referencaDog, $o->getDogodek());
}
开发者ID:ifigenija,项目名称:server,代码行数:35,代码来源:DogodekSplosniFixture.php
示例17: __construct
/**
* Constructor
* @param type $a_parent_obj
* @param type $a_parent_cmd
* @param type $a_template_context
*/
public function __construct($a_parent_obj_gui, $a_parent_obj, $a_parent_cmd)
{
$this->parent_container = $a_parent_obj;
$this->setId('lomemtstres_' . $a_parent_obj->getId());
parent::__construct($a_parent_obj_gui, $a_parent_cmd);
$this->settings = ilLOSettings::getInstanceByObjId($a_parent_obj->getId());
}
开发者ID:bheyser,项目名称:qplskl,代码行数:13,代码来源:class.ilLOMemberTestResultTableGUI.php
示例18: event_user_login
/**
* Called on successful user login
* If they are not in stormpath lets add them
*
* @param type $event
* @param type $type
* @param type $user
*/
function event_user_login($event, $type, $user)
{
$access_status = access_get_show_hidden_status();
access_show_hidden_entities(TRUE);
if ($user instanceof ElggUser && !$user->isEnabled() && !$user->validated) {
// send new validation email
uservalidationbyemail_request_validation($user->getGUID());
// restore hidden entities settings
access_show_hidden_entities($access_status);
// throw error so we get a nice error message
throw new LoginException(elgg_echo('uservalidationbyemail:login:fail'));
}
access_show_hidden_entities($access_status);
if ($user->__stormpath_user) {
return true;
}
// search stormpath for a matching account
// may be in stormpath by manual addition, or from another application
// with shared login
$application = get_application();
if ($application) {
$accts = $application->getAccounts(array('email' => $user->email));
foreach ($accts as $a) {
$user->__stormpath_user = $a->href;
return true;
}
$password = get_input('password');
if ($password) {
add_to_stormpath($user, $password);
}
}
return true;
}
开发者ID:arckinteractive,项目名称:elgg_stormpath,代码行数:41,代码来源:events.php
示例19: generateAdminLinks
/**
*
* @param type $oObj
* @param type $sCss
* @return type
*/
public function generateAdminLinks($oObj, $sCss)
{
JCH_DEBUG ? JchPlatformProfiler::start('GenerateAdminLinks') : null;
$params = clone $this->params;
$params->set('combine_files_enable', '1');
$params->set('javascript', '1');
$params->set('css', '1');
$params->set('gzip', '0');
$params->set('css_minify', '0');
$params->set('js_minify', '0');
$params->set('html_minify', '0');
$params->set('defer_js', '0');
$params->set('debug', '0');
$params->set('bottom_js', '2');
$params->set('includeAllExtensions', '1');
$params->set('excludeCss', array());
$params->set('excludeJs', array());
$params->set('excludeCssComponents', array());
$params->set('excludeJsComponents', array());
$params->set('csg_exclude_images', array());
$params->set('csg_include_images', array());
$sHtml = $oObj->getOriginalHtml();
$oParser = new JchOptimizeParser($params, $sHtml, JchOptimizeFileRetriever::getInstance());
$aLinks = $oParser->getReplacedFiles();
if ($sCss == '' && !empty($aLinks['css'][0])) {
$oCombiner = new JchOptimizeCombiner($params, $this->bBackend);
$oCssParser = new JchOptimizeCssParser($params, $this->bBackend);
$oCombiner->combineFiles($aLinks['css'][0], 'css', $oCssParser);
$sCss = $oCombiner->css;
}
$oSpriteGenerator = new JchOptimizeSpriteGenerator($params);
$aLinks['images'] = $oSpriteGenerator->processCssUrls($sCss, TRUE);
JCH_DEBUG ? JchPlatformProfiler::stop('GenerateAdminLinks', TRUE) : null;
return $aLinks;
}
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:41,代码来源:admin.php
示例20: execute
/**
* Execute /../stock/listItem
*
* @param type $request
*/
public function execute($request)
{
$head = sfYaml::load(sfConfig::get('sf_app_dir') . '/lib/list/item_list.yml');
$itemlist_headers = array($head['listItem']['header1'], $head['listItem']['header2'], $head['listItem']['header3'], $head['listItem']['header6']);
$columns = 'id,name,sales_unit_price,stock_available';
$recordsLimit = 5;
//have to take from lists
if (!$request->hasParameter('pageNo')) {
$pageNo = 1;
} else {
$pageNo = $request->getParameter('pageNo', 1);
}
$pager = new SimplePager('Item', $recordsLimit);
$pager->setPage($pageNo);
$pager->setNumResults($this->getItemService()->countItems());
$pager->init();
$offset = $pager->getOffset();
$offset = empty($offset) ? 0 : $offset;
$paramHolder = new sfParameterHolder();
$paramHolder->set('columns', $columns);
$paramHolder->set('offset', $offset);
$paramHolder->set('limit', $recordsLimit);
$itemlist_data = $this->getItemService()->getItems($paramHolder);
$listContainer = new ListContainer();
$listContainer->setListName('ItemList');
$listContainer->setListHeaders($itemlist_headers);
$listContainer->setListContent($itemlist_data);
$listContainer->setRowLink("stock/showItem?id=");
$listContainer->setPager($pager);
$this->listcontainer = $listContainer;
}
开发者ID:GarraouiMarwen,项目名称:open-stock-management,代码行数:36,代码来源:listItemAction.class.php
注:本文中的type类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论