本文整理汇总了PHP中unknown_type类的典型用法代码示例。如果您正苦于以下问题:PHP unknown_type类的具体用法?PHP unknown_type怎么用?PHP unknown_type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了unknown_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_sugar_replace_vars
/**
* This function will replace fields taken from the fields variable
* and insert them into the passed string replacing [variableName]
* tokens where found.
*
* @param unknown_type $params
* @param unknown_type $smarty
* @return unknown
*/
function smarty_function_sugar_replace_vars($params, &$smarty)
{
if (empty($params['subject'])) {
$smarty->trigger_error("sugarvar: missing 'subject' parameter");
return;
}
$fields = $smarty->get_template_vars('fields');
$subject = $params['subject'];
$matches = array();
$count = preg_match_all('/\\[([^\\]]*)\\]/', $subject, $matches);
for ($i = 0; $i < $count; $i++) {
$match = $matches[1][$i];
if (!empty($fields[$match]) && isset($fields[$match]['value'])) {
$value = $fields[$match]['value'];
if (isset($fields[$match]['type']) && $fields[$match]['type'] == 'enum' && isset($fields[$match]['options']) && isset($fields[$match]['options'][$value])) {
$subject = str_replace($matches[0][$i], $fields[$match]['options'][$value], $subject);
} else {
$subject = str_replace($matches[0][$i], $value, $subject);
}
}
}
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $subject);
return '';
}
return $subject;
}
示例2: array
/**
* Generated all outputformats
*
* @param unknown_type $objectVersion
* @return array
*/
function getAllOutputFormatTextByContentObjectVersion($objectVersion, $forceSettingImageIncludeTo = -1)
{
$outputFormatTextArray = array();
$dataMap = $objectVersion->attribute('data_map');
$editionAttribute = $dataMap['newsletter_edition'];
$editionAttributeContent = $editionAttribute->attribute('content');
$listAttributeContent = $editionAttributeContent->attribute('list_attribute_content');
$outputFormatArray = $listAttributeContent->attribute('output_format_array');
$mainSiteAccess = $listAttributeContent->attribute('main_siteaccess');
$skinName = $listAttributeContent->attribute('skin_name');
$editionContentObjectId = $objectVersion->attribute('contentobject_id');
$versionId = $objectVersion->attribute('version');
$emailSender = $listAttributeContent->attribute('email_sender');
$emailSenderName = $listAttributeContent->attribute('email_sender_name');
$emailReplyTo = $listAttributeContent->attribute('email_reply_to');
$emailReturnPath = $listAttributeContent->attribute('email_return_path');
foreach ($outputFormatArray as $outputFormatId => $outputName) {
$newsletterContentArray = CjwNewsletterEdition::getOutput($editionContentObjectId, $versionId, $outputFormatId, $mainSiteAccess, $skinName, $forceSettingImageIncludeTo);
$newsletterContentArray['email_sender'] = $emailSender;
$newsletterContentArray['email_sender_name'] = $emailSenderName;
$newsletterContentArray['email_reply_to'] = $emailReplyTo;
$newsletterContentArray['email_return_path'] = $emailReturnPath;
$outputFormatTextArray[$outputName] = $newsletterContentArray;
}
return $outputFormatTextArray;
}
示例3: createFacebookLikePoints
/**
* Creates customer points transfers
*
* @param unknown_type $customer
* @param unknown_type $like_id
* @param unknown_type $rule
* @return unknown
*/
public function createFacebookLikePoints($customer, $like_id, $rule)
{
$num_points = $rule->getPointsAmount();
$currency_id = $rule->getPointsCurrencyId();
$rule_id = $rule->getId();
$transfer = $this->initTransfer($num_points, $currency_id, $rule_id);
$store = $customer->getStore();
if (!$transfer) {
return false;
}
//get On-Hold initial status override
if ($rule->getOnholdDuration() > 0) {
$transfer->setEffectiveStart(date('Y-m-d H:i:s', strtotime("+{$rule->getOnholdDuration()} days")))->setStatus(null, TBT_Rewards_Model_Transfer_Status::STATUS_PENDING_TIME);
} else {
//get the default starting status
$initial_status = Mage::getStoreConfig('rewards/InitialTransferStatus/AfterFacebookLike', $store);
if (!$transfer->setStatus(null, $initial_status)) {
return false;
}
}
// Translate the message through the core translation engine (nto the store view system) in case people want to use that instead
// This is not normal, but we found that a lot of people preferred to use the standard translation system insteaed of the
// store view system so this lets them use both.
$initial_transfer_msg = Mage::getStoreConfig('rewards/transferComments/facebookLike', $store);
$comments = Mage::helper('rewards')->__($initial_transfer_msg);
$this->setFacebookLikeId($like_id)->setComments($comments)->setCustomerId($customer->getId())->save();
return true;
}
示例4: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
if ($event->get('source')) {
$s = owa_coreAPI::entityFactory('base.source_dim');
$new_id = $s->generateId(trim(strtolower($event->get('source'))));
$s->getByPk('id', $new_id);
$id = $s->get('id');
if (!$id) {
$s->set('id', $new_id);
$s->set('source_domain', $event->get('source'));
$ret = $s->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Persisting. Source already exists.');
return OWA_EHS_EVENT_HANDLED;
}
} else {
owa_coreAPI::debug('Noting to handle. No source properties found on event.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例5: filterCheckAdmin
/**
*
* 过滤器
* @param unknown_type $filterChain
*/
public function filterCheckAdmin($filterChain)
{
//未登录,跳转
if (!($uid = $this->isAdmin())) {
$this->redirect(Yii::app()->baseUrl . "/");
}
//获取用户详细资料
$adminModel = new AdminModel();
$this->_userInfo = $adminModel->getInfoByUid($uid);
$this->username = $this->_userInfo['username'];
$this->hospital = $this->_userInfo['hospital'];
$this->role = $this->_userInfo['role'];
//账号错误
if (!$this->_userInfo) {
$this->_output("302", 'access deny', 'text');
}
$roleModel = new RoleModel();
$role = $roleModel->getInfoByCode($this->_userInfo['role']);
if ($role && $role['permission']) {
$permission = explode(',', $role['permission']);
//生成菜单
$menuModel = new MenuModel();
$this->menus = $menuModel->getInfoByGroup($permission);
foreach ($this->menus as $key => $value) {
$this->menuGroup[$value['group']] = $value['group'];
}
} else {
header("HTTP/1.1 401");
exit;
}
$filterChain->run();
}
示例6: payForShippingWithPoints
/**
* @deprecated unused
* Enter description here ...
* @param unknown_type $observer
*/
public function payForShippingWithPoints($observer)
{
$this->setRequest($observer->getControllerAction()->getRequest());
$pay_for_shipping_with_points = $this->getRequest()->getParam('pay_for_shipping_with_points', '');
if ($pay_for_shipping_with_points) {
$quote = Mage::getSingleton('rewards/session')->getQuote();
$shipaddr = $quote->getShippingAddress();
$total_shipping_value = $shipaddr->getShippingAmount();
$current_points_spending = Mage::getSingleton('rewards/session')->getPointsSpending();
Mage::log("Paying for shipping with points...");
$rule_ids = explode(',', $quote->getAppliedRedemptions());
foreach ($rule_ids as $rid) {
$salesrule = Mage::helper('rewards/transfer')->getSalesRule($rid);
if ($salesrule->getPointsAction() != 'discount_by_points_spent') {
continue;
}
if (!$salesrule->getDiscountAmount()) {
continue;
}
// discount amount should not be empty (so we dont divide by zero)
Mage::log("Points step according to quote is {$quote->getPointsStep()}");
if ($salesrule->getPointsAmount() == $quote->getPointsStep()) {
$uses_to_zero_shipping = ceil($total_shipping_value / $salesrule->getDiscountAmount());
Mage::getSingleton('rewards/session')->setPointsSpending($uses_to_zero_shipping + $current_points_spending);
Mage::log("Added {$uses_to_zero_shipping} to existing points uage of {$current_points_spending}");
break;
}
}
}
return $this;
}
示例7: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
if ($event->get('ad')) {
$d = owa_coreAPI::entityFactory('base.ad_dim');
$new_id = $d->generateId(trim(strtolower($event->get('ad'))));
$d->getByPk('id', $new_id);
$id = $d->get('id');
if (!$id) {
$d->set('id', $new_id);
$d->set('name', trim(strtolower($event->get('ad'))));
$d->set('type', trim(strtolower($event->get('ad_type'))));
$ret = $d->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Persisting. Ad already exists.');
return OWA_EHS_EVENT_HANDLED;
}
} else {
owa_coreAPI::debug('Noting to handle. No Ad properties found on event.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例8: getSyntenyRegionIDs
/**
*
* Enter description here ...
* @param unknown_type $db
* @param array $bp start ende chr ens_species
*/
function getSyntenyRegionIDs($db, $bp)
{
$species = strtolower($bp[3]);
if ($species == 'mus_musculus') {
$genome_db_id = 57;
} elseif ($species == 'rattus_norvegicus') {
$genome_db_id = 3;
} elseif ($species == 'homo_sapiens') {
$genome_db_id = 90;
}
$sqlDnafrag = 'SELECT dfr.synteny_region_id FROM dnafrag_region as dfr INNER JOIN
dnafrag as df ON (dfr.dnafrag_start <= ' . $bp[1] . ' AND
dfr.dnafrag_end >= ' . $bp[0] . ' AND
dfr.dnafrag_id = df.dnafrag_id AND
df.name = "' . $bp[2] . '" AND
df.genome_db_id = ' . $genome_db_id . ');';
$fragQuery = $db->query($sqlDnafrag) or fatal_error('Query failed: ' . $db->error);
//$frag_table = $fragQuery->fetch_all();
$str = "";
$first = true;
while ($row = $fragQuery->fetch_assoc()) {
if ($first) {
$str .= $row['synteny_region_id'];
$first = false;
} else {
$str .= "," . $row['synteny_region_id'];
}
}
$fragQuery->close();
return $str;
}
示例9: addLesson
/**
* 添加一个lesson
* @param unknown_type $lesson
*/
public function addLesson($lesson)
{
$owner = $this->getOwner();
$lesson->userId = Yii::app()->user->id;
$lesson->courseId = $owner->id;
$lesson->addTime = time();
//处理外链类型的视频
if ($lesson->mediaSource && $lesson->mediaSource != "self" && $lesson->mediaSource != "cloud" && $lesson->mediaType != "text") {
if (strpos($lesson->mediaUri, 'http://') !== 0) {
$lesson->mediaUri = 'http://' . $lesson->mediaUri;
}
if (strpos($lesson->mediaUri, '.swf') === false) {
Yii::import('ext.videolink.VideoLink');
$video = new VideoLink();
$result = $video->parse($lesson->mediaUri);
if ($result) {
$lesson->mediaUri = $result['swf'];
$lesson->mediaSource = $result['source'];
$lesson->mediaName = $result['title'];
$lesson->mediaType = "video";
}
}
}
if (!$lesson->title) {
$lesson->title = $lesson->mediaName;
}
$lesson->status = Lesson::STATUS_HIDDEN;
return $lesson->save();
}
示例10: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
$terms = trim(strtolower($event->get('search_terms')));
if ($terms) {
$st = owa_coreAPI::entityFactory('base.search_term_dim');
$st_id = owa_lib::setStringGuid($terms);
$st->getByPk('id', $st_id);
$id = $st->get('id');
if (!$id) {
$st->set('id', $st_id);
$st->set('terms', $terms);
$ret = str_replace("", "", $terms, $count);
$st->set('term_count', $count);
$ret = $st->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Logging. Search term already exists.');
return OWA_EHS_EVENT_HANDLED;
}
} else {
return OWA_EHS_EVENT_HANDLED;
}
}
示例11: getRealShippedQtyForItem
/**
* Return real shipped qty for an item
* Welcome in magento.....
*
* @param unknown_type $item
*/
public function getRealShippedQtyForItem($item)
{
//init vars
$qty = $item->getQty();
$orderItem = $item->getOrderItem();
$orderItemParentId = $orderItem->getparent_item_id();
//define if we have to multiply qty by parent qty
$mustMultiplyByParentQty = false;
if ($orderItemParentId > 0) {
$parentOrderItem = mage::getmodel('sales/order_item')->load($orderItemParentId);
if ($parentOrderItem->getId()) {
//if shipped together
if ($parentOrderItem->getproduct_type() == 'bundle' && !$parentOrderItem->isShipSeparately()) {
$mustMultiplyByParentQty = true;
$qty = $orderItem->getqty_ordered() / $parentOrderItem->getqty_ordered();
}
}
}
//if multiply by parent qty
if ($mustMultiplyByParentQty) {
$parentShipmentItem = null;
foreach ($item->getShipment()->getAllItems() as $ShipmentItem) {
if ($ShipmentItem->getorder_item_id() == $orderItemParentId) {
$parentShipmentItem = $ShipmentItem;
}
}
if ($parentShipmentItem) {
$qty = $qty * $parentShipmentItem->getQty();
}
}
return $qty;
}
示例12: initControllerRouters
/**
* Override?
*
* @param unknown_type $observer
*/
public function initControllerRouters($observer)
{
$front = $observer->getEvent()->getFront();
/** @var Mage_Core_Controller_Varien_Front $front * */
$rewards = new TBT_Rewards_Controller_Router();
//$front->addRouter('rewards', $rewards);
}
示例13: getObjectType
/**
* Return object type
*
* @param unknown_type $object
*/
public function getObjectType($object)
{
$retour = '';
$resourceName = $object->getResourceName();
$resourceName = strtolower($resourceName);
return strtolower($resourceName);
}
示例14: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
$v = owa_coreAPI::entityFactory('base.visitor');
$v->load($event->get('visitor_id'));
if (!$v->wasPersisted()) {
$v->setProperties($event->getProperties());
// Set Primary Key
$v->set('id', $event->get('visitor_id'));
$v->set('first_session_id', $event->get('session_id'));
$v->set('first_session_year', $event->get('year'));
$v->set('first_session_month', $event->get('month'));
$v->set('first_session_day', $event->get('day'));
$v->set('first_session_dayofyear', $event->get('dayofyear'));
$v->set('first_session_timestamp', $event->get('timestamp'));
$ret = $v->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug("Not persisting. Visitor already exists.");
return OWA_EHS_EVENT_HANDLED;
}
}
示例15: core_dimensions_after_update
/**
* @author Ignacio Vazquez - elpepe.uy at gmail.com
* @param unknown_type $object
* @param unknown_type $ignored
*/
function core_dimensions_after_update($object, &$ignored)
{
static $objectsProcessed = array();
if ($object instanceof Contact && !array_var($objectsProcessed, $object->getId())) {
$person_dim = Dimensions::findOne(array("conditions" => "`code` = 'feng_persons'"));
$person_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'person'"));
$company_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'company'"));
$members = Members::findByObjectId($object->getId(), $person_dim->getId());
if (count($members) == 1) {
/* @var $member Member */
$member = $members[0];
$member->setName($object->getObjectName());
$parent_member_id = $member->getParentMemberId();
$depth = $member->getDepth();
if ($object->getCompanyId() > 0) {
$pmember = Members::findOne(array('conditions' => '`object_id` = ' . $object->getCompanyId() . ' AND `object_type_id` = ' . $company_ot->getId() . ' AND `dimension_id` = ' . $person_dim->getId()));
$member->setParentMemberId($pmember->getId());
$member->setDepth($pmember->getDepth() + 1);
} else {
//Is first level
$member->setDepth(1);
$member->setParentMemberId(0);
}
$object->modifyMemberValidations($member);
$member->save();
// reload only if not disabling or enabling user
if (!(array_var($_REQUEST, 'c') == 'account' && (array_var($_REQUEST, 'a') == 'disable' || array_var($_REQUEST, 'a') == 'restore_user'))) {
evt_add("reload dimension tree", $member->getDimensionId());
}
$objectsProcessed[$object->getId()] = true;
}
}
}