當前位置: 首頁>>代碼示例>>PHP>>正文


PHP type類代碼示例

本文整理匯總了PHP中type的典型用法代碼示例。如果您正苦於以下問題:PHP type類的具體用法?PHP type怎麽用?PHP type使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了type類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的type類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。