query
stringlengths 9
43.3k
| document
stringlengths 17
1.17M
| metadata
dict | negatives
listlengths 0
30
| negative_scores
listlengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Assemble recalculate order event | protected function assembleRecalculateOrderEvent(\XLite\Model\Order $order)
{
$result = array(
'subtotal' => $order->getSubtotal(),
'total' => $order->getTotal(),
'modifiers' => array(),
);
foreach ($this->getSurchargeTotals(true) as $surcharge) {
$result['modifiers'][$surcharge['code']] = abs($surcharge['cost']);
}
if ($this->isForbiddenOrderChanges($order)) {
$result['forbidden'] = true;
}
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function calc(Order $order);",
"protected function needSendRecalculateEvent(\\XLite\\Model\\Order $order)\n {\n return true;\n }",
"private function calculateOrderAmount()\n {\n if ($this->getOffer() instanceof Offer) {\n //recalculates the new amount\n $this->getOffer()->calculateInvoiceAmount();\n Shopware()->Models()->persist($this->getOffer());\n }\n }",
"public function createCustomOrder()\n {\n AutoEvent::select('custom_order')->increment('custom_order', 1);\n $this->custom_order = 0;\n }",
"public function process(object $event)\n {\n if (!($event->order instanceof Order)) {\n return;\n }\n $order = $event->order;\n $logger = $this->container->get(LoggerFactory::class)->get('log', 'robot');\n\n // 清理订单缓存\n $this->container->get(EventDispatcherInterface::class)->dispatch(new DeleteListenerEvent('OrderUpdate', [$order->order_no]));\n\n switch ($order->status) {\n case 1: // 出发\n $logger->info($order->order_no . ': 已出发');\n // 通知用户机器人已触发...\n break;\n\n case 2: // 到达\n $logger->info($order->order_no . ': 已到达');\n // 通知用户机器人已到达\n // 发送上门服务提醒\n $this->container->get(SubscribeMessageService::class)->sendServiceReminder($order);\n break;\n\n case 3: // 完成\n $logger->info($order->order_no . ': 订单完成');\n break;\n\n case 4: // 异常\n // 通知用户机器人异常...\n // 执行退款逻辑\n $logger->info($order->order_no . ': 机器人异常');\n break;\n\n case 5: // 订单取消\n break;\n default:\n }\n }",
"protected static function on_change_order_state($order)\n {\n \n }",
"public function finalizeOrder();",
"public function actualize()\n {\n\n $orders = $this->gdaxService->getOpenOrders();\n if (count($orders)) {\n $this->msg[] = $this->timestamp . ' .... <info>actualize orders</info>';\n $this->orderService->fixUnknownOrdersFromGdax($orders);\n }\n }",
"function processPaymentFieldsSpecialEvents($entry)\n{\n global $dbPriceSingleTicket;\n global $dbPricePartHigh;\n global $dbPricePartHighBtw;\n global $dbTicketPricePart;\n global $dbTicketPricePartBtw;\n global $dbTicketPricePartTotal;\n global $dbBtwHigh;\n\n global $dbFoodPrice;\n $price_ticket_ex_food = $dbPriceSingleTicket - $dbFoodPrice;\n\n // If there is a reduction price which is smaller than the food price the price part high will be below zero\n if ($price_ticket_ex_food < 0) {\n $price_ticket_ex_food = 0;\n }\n\n global $dbParticipants;\n $dbTicketPricePart = $price_ticket_ex_food * count($dbParticipants);\n\n $dbTicketPricePartBtw = $dbTicketPricePart * $dbBtwHigh;\n $dbTicketPricePartTotal = $dbTicketPricePart + $dbTicketPricePartBtw;\n\n $dbPricePartHigh = $dbTicketPricePart + $dbParkingPricePart;\n $dbPricePartHighBtw = $dbPricePartHigh * $dbBtwHigh;\n\n global $dbPricePartHighTotal;\n $dbPricePartHighTotal = $dbPricePartHigh + $dbPricePartHighBtw;\n \n // Calculate low btw\n // When the reduction price is smaller than the food price take the reduction price\n global $dbPricePartLow;\n $dbPricePartLow = $dbFoodPrice;\n if ($dbTicketPrice < $dbFoodPrice) {\n $dbPricePartLow = $dbTicketPrice;\n }\n\n global $dbPricePartLowBtw;\n global $dbPricePartLowTotal;\n global $dbFoodPartPriceLow;\n global $dbFoodPartPriceLowBtw;\n global $dbFoodPartPriceLowTotal;\n\n global $dbBtwLow;\n\n $dbPricePartLow = count($dbParticipants) * $dbPricePartLow;\n $dbFoodPartPriceLow = $dbPricePartLow;\n $dbPricePartLowBtw = $dbPricePartLow * $dbBtwLow;\n $dbFoodPartPriceLowBtw = $dbPricePartLowBtw;\n $dbPricePartLowTotal = $dbPricePartLow + $dbPricePartLowBtw;\n $dbFoodPartPriceLowTotal = $dbPricePartLowTotal;\n\n // Payment details\n global $dbTotalBtw;\n $dbTotalBtw = $dbPricePartLowBtw + $dbPricePartHighBtw;\n global $dbTotalPrice;\n $dbTotalPrice = ($dbPriceSingleTicket * count($dbParticipants)) + $dbParkingPricePart + $dbMembershipPricePart;\n\n $rounded_total_price = number_format($dbTotalPrice * 100, 0, ',', '');\n $rounded_btw_part_low = number_format(($dbPricePartLowBtw) * 100, 0, ',', '');\n $rounded_btw_part_high = number_format(($dbPricePartHighBtw) * 100, 0, ',', '');\n\n global $dbTotalPriceBtw;\n $dbTotalPriceBtw = ($rounded_total_price + $rounded_btw_part_low + $rounded_btw_part_high) / 100;\n}",
"public function process()\n {\n // Get all orders not yet sent to Flow within the valid time period\n $orders = Order::get()\n ->filter([\n 'Scheduled' => 0,\n 'IsCart' => 0\n ]);\n\n // run through and schedule\n /** @var Order|\\Isobar\\Flow\\Extensions\\OrderExtension $order */\n foreach ($orders as $order) {\n if ($order->UnpaidTotal()->getDecimalValue() <= 0) {\n echo 'Order #' . $order->ID . ' to be scheduled' . \"\\n\";\n\n $order->scheduleOrder();\n }\n }\n }",
"public function testUpdateOrder()\n {\n }",
"public function regenerateOrderNumber()\n {\n \n }",
"public static function execute( Order &$order ): void\n {\n $instance = new self;\n $instance -> calculate( $order );\n $instance -> update ( $order );\n }",
"public function reCalculateOrderTotals ( \\Maven\\Core\\Domain\\Order $order ) {\n\n\t\t\\Maven\\Loggers\\Logger::log()->message( 'Maven/OrderManager/reCalculateOrderTotals' );\n\n\t\t// Recalculate the promotions\n\t\t//$promotionManager = new PromotionManager( );\n\n\t\t$order->recalculateSubtotal();\n\n\t\t// First we need to reset the total amount \n\t\t$order->setTotal( $order->getSubtotal() );\n\n\t\t//$promotionManager->reCalculatePromotions( $order );\n\n\t\t$taxesManager = new TaxManager( );\n\n\t\t//Calculate taxes\n\t\t$taxesManager->applyTaxes( $order );\n\n\t\t// Recalculate the total amount\n\t\t$order->calculateTotal();\n\n\t\t// We need to verify if there is a shipping method available\n\t\t$this->applyShipping( $order );\n\n\t\treturn $order;\n\t}",
"public function execute(\\Magento\\Framework\\Event\\Observer $observer){ \r\n try{\r\n $customer_data = array();\r\n $eventkey = $this->_scopeConfig->getValue('blueshiftconnect/Step1/eventapikey');\r\n $password = '';\r\n $data = array();\r\n $objectManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\r\n $storeManager = $objectManager->get('\\Magento\\Store\\Model\\StoreManagerInterface');\r\n $baseUrl = $storeManager->getStore()->getBaseUrl();\r\n $order = $observer->getOrder();\r\n $order_details = $order->getData();\r\n $billStreet = $order->getBillingAddress();\r\n $shipStreet = $order->getShippingAddress();\r\n $orders = $order->getAllItems();\r\n $i=0;\r\n $orderRepository = $this->orderRepository->get($order_details['id']);\r\n // $items = $observer->getQuote()->getAllItems();\r\n foreach ($orders as $orderItem) {\r\n $orderItems = $orderItem->getData();\r\n $data['events'][$i]['order_id']=$order_details['id'];\r\n $data['events'][$i]['customer_id']=$order_details['customer_id'];\r\n $data['events'][$i]['ip']=$order_details['remote_ip'];\r\n $data['events'][$i]['event']= \"purchase\"; \r\n $data['events'][$i]['storeUrl']=$baseUrl;\r\n $data['events'][$i]['email']=$order_details['customer_email'];\r\n $data['events'][$i]['products']['sku']=$orderItems['sku'];\r\n $data['events'][$i]['products']['qty']=$orderItems['qty_ordered'];\r\n $data['events'][$i]['products']['price']=$orderItems['price'];\r\n $data['events'][$i]['products']['product_id']=$orderItems['product_id'];\r\n $data['events'][$i]['products']['discounted_price']=$orderItems['original_price'];\r\n $data['events'][$i]['revenue']=$orderRepository->getGrandTotal();\r\n $data['events'][$i]['bill_address']=$billStreet->getData();\r\n $data['events'][$i]['ship_address']=$shipStreet->getData();\r\n $i++;\r\n } \r\n $json_data = json_encode($data);\r\n $path = \"bulkevents\";\r\n $method = \"POST\";\r\n $result = $this->blueshiftConfig->curlFunc($json_data,$path,$method,$password,$eventkey);\r\n if($result['status']== 200){\r\n $this->blueshiftConfig->loggerWrite(\"Order creation: status = ok\",'observer');\r\n }else{\r\n $result = json_encode($result);\r\n $this->blueshiftConfig->loggerWrite(\"Order creation: \".$result,'observer');\r\n } \r\n }catch (\\Exception $e) {\r\n $this->blueshiftConfig->loggerWrite($e->getMessage(),'observer');\r\n }\r\n }",
"protected function assembleRecalculateShippingEvent(\\XLite\\Model\\Order $order)\n {\n $result = array(\n 'options' => array(),\n );\n\n $modifier = $order->getModifier(\\XLite\\Model\\Base\\Surcharge::TYPE_SHIPPING, 'SHIPPING');\n $modifier->setMode(\\XLite\\Logic\\Order\\Modifier\\AModifier::MODE_CART);\n\n foreach ($modifier->getRates() as $rate) {\n $result['options'][$rate->getMethod()->getMethodId()] = array(\n 'name' => html_entity_decode(\n strip_tags($rate->getMethod()->getName()),\n ENT_COMPAT,\n 'UTF-8'\n ),\n 'fullName' => html_entity_decode(\n $rate->getMethod()->getName(),\n ENT_COMPAT,\n 'UTF-8'\n ),\n );\n }\n\n return $result;\n }",
"private function _ratepayEvent($type, $order)\n {\n switch($type){\n case 'invoice':\n $invoice = $order->prepareInvoice();\n $invoice->register()->save();\n $order->setTotalInvoiced($order->getTotalInvoiced() + $invoice->getGrandTotal());\n $order->setBaseTotalInvoiced($order->getBaseTotalInvoiced() + $invoice->getBaseGrandTotal());\n $order->save();\n break;\n case 'creditmemo':\n $creditmemo = Mage::getModel('sales/service_order', $order)->prepareCreditmemo();\n $creditmemo->register()->save();\n $order->setTotalRefunded($order->getTotalRefunded() + $creditmemo->getGrandTotal());\n $order->setBaseTotalRefunded($order->getBaseTotalRefunded() + $creditmemo->getGrandTotal());\n $order->setBaseTotalRefunded($creditmemo->getGrandTotal());\n $order->save();\n break;\n case 'cancel':\n $order->cancel()->save();\n break;\n default:\n throw new Exception('Wrong operation!');\n }\n }",
"public function orderUpdate()\n {\n $this->helper->logOrder('Beginning Order Update.');\n $stores = $this->storeManager->getStores();\n\n $enabledStores = [];\n\n foreach ($stores as $store) {\n if ($store->isActive() && $this->helper->isEnabled($store->getId())) {\n $enabledStores[] = $store->getId();\n }\n }\n\n if ($enabledStores) {\n $ordersToProcess = null;\n\n $ordersToProcess = $this->orderCollectionFactory\n ->create()\n ->addFieldToSelect('*')\n ->addFieldToFilter(\n 'store_id',\n [\n 'in' => [$enabledStores],\n ]\n )\n ->addFieldToFilter(\n 'state',\n [\n 'in' => [\n \\Magento\\Sales\\Model\\Order::STATE_NEW,\n \\Magento\\Sales\\Model\\Order::STATE_PROCESSING,\n ],\n ]\n )\n ->addFieldToFilter('fulfilled_by_amazon', true)\n ->addFieldToFilter(\n 'amazon_order_status',\n [\n 'in' => [\n $this->helper::ORDER_STATUS_RECEIVED,\n $this->helper::ORDER_STATUS_PLANNING,\n $this->helper::ORDER_STATUS_PROCESSING,\n ],\n ]\n );\n\n if (!empty($ordersToProcess) && $ordersToProcess->count()) {\n $this->helper->logOrder('Beginning Order Update for ' . $ordersToProcess->count() . ' orders.');\n\n foreach ($ordersToProcess as $order) {\n $this->helper->logOrder('Updating order #' . $order->getIncrementId());\n\n $result = $this->outbound->getFulfillmentOrder($order);\n if ($result) {\n $fulfillmentOrderResult = $result->getGetFulfillmentOrderResult();\n\n // Amazon Statuses: RECEIVED / INVALID / PLANNING / PROCESSING / CANCELLED / COMPLETE\n // / COMPLETE_PARTIALLED / UNFULFILLABLE\n $amazonStatus = $fulfillmentOrderResult->getFulfillmentOrder()\n ->getFulfillmentOrderStatus();\n\n $amazonOrderId = $fulfillmentOrderResult->getFulfillmentOrder()\n ->getDisplayableOrderId();\n\n $id = $order->getIncrementId();\n if ($order->getIncrementId() == $amazonOrderId) {\n $this->helper->logOrder(\n 'Status of order #' . $order->getIncrementId() . ': ' . $amazonStatus\n );\n\n if ($amazonStatus) {\n switch ($amazonStatus) {\n case 'COMPLETE':\n case 'COMPLETE_PARTIALLED':\n $this->magentoOrderUpdate($order, $fulfillmentOrderResult);\n break;\n case 'INVALID':\n case 'CANCELLED':\n case 'UNFULFILLABLE':\n $this->cancelFBAShipment($order, $fulfillmentOrderResult);\n break;\n }\n }\n }\n }\n }\n\n $this->helper->logOrder(__('Get Order status called. Orders to process: ') . $ordersToProcess->count());\n } else {\n $this->helper->logOrder(__('Get Order status called. No orders to process'));\n }\n }\n }",
"public function getCalculationOrderArray($create = false) {}",
"private function _recalcAdvGroup() {\n $this->_recalcEntity($this->advGroup, $this->advGroup->click_price); // @TODO Price is on advGroup. But this can be in the near future on every adv\n }",
"public function generateOrder();",
"function detect_dispensing_changes($order) {\n\n $day_changes = [];\n $qty_changes = [];\n $mysql = new Mysql_Wc();\n\n //Normall would run this in the update_order_items.php but we want to wait for all the items to change so that we don't rerun multiple times\n foreach ($order as $item) {\n\n //! $updated['order_date_dispensed'] otherwise triggered twice, once one stage: Printed/Processed and again on stage:Dispensed\n if ($item['days_dispensed_default'] != $item['days_dispensed_actual'])\n $day_changes[] = \"rx:$item[rx_number] qty:$item[qty_dispensed_default] >>> $item[qty_dispensed_actual] days:$item[days_dispensed_default] >>> $item[days_dispensed_actual] refills:$item[refills_dispensed_default] >>> $item[refills_dispensed_actual] item:\".json_encode($item);\n\n //! $updated['order_date_dispensed'] otherwise triggered twice, once one stage: Printed/Processed and again on stage:Dispensed\n if ($item['qty_dispensed_default'] != $item['qty_dispensed_actual'] OR (( ! is_null($item['refills_dispensed_actual']) AND $item['refills_dispensed_default']+0) != $item['refills_dispensed_actual']))\n $qty_changes[] = \"rx:$item[rx_number] qty:$item[qty_dispensed_default] >>> $item[qty_dispensed_actual] days:$item[days_dispensed_default] >>> $item[days_dispensed_actual] refills:$item[refills_dispensed_default] >>> $item[refills_dispensed_actual] item:\".json_encode($item);\n\n //! $updated['order_date_dispensed'] otherwise triggered twice, once one stage: Printed/Processed and again on stage:Dispensed\n $sig_qty_per_day_actual = $item['days_dispensed_actual'] ? round($item['qty_dispensed_actual']/$item['days_dispensed_actual'], 1) : 'NULL';\n $mysql->run(\"\n UPDATE gp_rxs_single SET sig_qty_per_day_actual = $sig_qty_per_day_actual WHERE rx_number = $item[rx_number]\n \");\n\n if ($item['days_dispensed_actual'] AND $item['refills_dispensed'] AND ! $item['qty_left'] AND ($item['days_dispensed_actual'] > DAYS_MAX OR $item['days_dispensed_actual'] < DAYS_MIN))\n log_error(\"check days dispensed is not within limits and it's not out of refills: \".DAYS_MIN.\" < $item[days_dispensed_actual] < \".DAYS_MAX, $item);\n else if ($sig_qty_per_day_actual != 'NULL' AND $sig_qty_per_day_actual != round($item['sig_qty_per_day_default'], 1) AND $sig_qty_per_day_actual != round($item['sig_qty_per_day_default']*2, 1)) { // *2 is a hack for \"as needed\" being different right now\n log_error(\"sig parsing error Updating to Actual Qty_Per_Day '$item[sig_actual]' $item[sig_qty_per_day_default] (default) != $sig_qty_per_day_actual $item[qty_dispensed_actual]/$item[days_dispensed_actual] (actual)\", $item);\n }\n }\n\n log_notice(\"update_order_cp detect_dispensing_changes\", ['order' => $order, 'day_changes' => $day_changes, 'qty_changes' => $qty_changes]);\n return ['day_changes' => $day_changes, 'qty_changes' => $qty_changes];\n }",
"function getOrder()\n{\n\n}",
"public function onOrderTransition(WorkflowTransitionEvent $event) {\n /** @var \\Drupal\\Core\\Config\\ImmutableConfig Qb Enterprise $config */\n $config = \\Drupal::config('commerce_quickbooks_enterprise.QuickbooksAdmin');\n\n /** @var \\Drupal\\commerce_order\\Entity\\OrderInterface $order */\n $order = $event->getEntity();\n\n\n }",
"public function handle(QuoteModified $event)\n {\n $this->quoteCalculate->calculate($event->quote);\n }",
"public function postUpdateHandler (Order $order, LifecycleEventArgs $event)\n {\n $changeSet = $event->getEntityManager()->getUnitOfWork()->getEntityChangeSet($event->getEntity());\n\n // If the sku has changed search for orders and run them through the approval process\n if (isset($changeSet['status']))\n {\n if ($changeSet['status'][1]->getId() == OrderStatusUtility::PENDING_FULFILLMENT_ID)\n $this->handleOrderShipmentLogic($order);\n }\n }",
"public function followUp0 (OrderEvent $event)\n {\n $order = $event->getOrder();\n $this->followUp ( $order, SendinBlue::TEMPLATE_ID_ORDER_RATING, \"TEMPLATE_ID_ORDER_RATING_F0\");\n\n }",
"public function order_finalized_callback($array)\n {\n\n $this->load->model('disputes_model');\n $this->load->model('bitcoin_model');\n\n foreach ($array as $record) {\n $order = $this->get_order_by_address($record['address']);\n\n $complete = false;\n // If progress is 6, then a disputed order is completed.\n\n if ($order['progress'] == '8') {\n $update = array('progress' => '7',\n 'time' => time(),\n 'refund_completed_time' => time());\n if ($this->update_order($order['id'], $update) == TRUE)\n $complete = TRUE;\n\n } elseif ($order['progress'] == '6') {\n $dispute = $this->disputes_model->get_by_order_id($order['id']);\n\n if ($this->progress_order($order['id'], '6', '7') == TRUE) {\n $dispute_update = array('posting_user_id' => '',\n 'order_id' => $order['id'],\n 'dispute_id' => $dispute['id'],\n 'message' => 'Dispute closed, payment was broadcast.');\n $this->disputes_model->post_dispute_update($dispute_update);\n // Set final response. Prevents further posts in the\n // dispute. This is the only way an escrow dispute\n // can be finalized.\n $this->disputes_model->set_final_response($order['id']);\n\n $complete = true;\n }\n } else {\n // Otherwise, progress depending on whether the transaction is escrow, or upfront.\n // Escrow\n if ($order['vendor_selected_upfront'] == '0')\n if ($this->progress_order($order['id'], '5', '7', array('received_time' => time(), 'time' => time())) == TRUE)\n $complete = true;\n\n // Upfront payment. Vendor takes money to confirm dispatch.\n if ($order['vendor_selected_upfront'] == '1') {\n $update = array('dispatched_time' => time(),\n 'dispatched' => '1',\n 'time' => time());\n if ($this->progress_order($order['id'], '4', '5', $update) == TRUE)\n $complete = true;\n }\n }\n\n // If complete, then record the details.\n if ($complete) {\n $update = array('finalized' => '1',\n 'finalized_time' => time(),\n 'final_transaction_id' => $record['final_id'],\n 'finalized_correctly' => (int)$record['valid']);\n\n $this->update_order($order['id'], $update);\n $this->bitcoin_model->delete_watch_address($order['address']);\n }\n }\n }",
"public function applyPromotion()\n {\n $this->promotion->setOrder($this);\n }",
"private function trackConversion($order) {\n\t}"
]
| [
"0.5913695",
"0.5834544",
"0.56779265",
"0.5595583",
"0.5581191",
"0.547935",
"0.5399504",
"0.5381217",
"0.5375817",
"0.5350725",
"0.534685",
"0.53288466",
"0.5279536",
"0.52537924",
"0.52350146",
"0.5215311",
"0.51973087",
"0.51849604",
"0.51752436",
"0.5161005",
"0.51560426",
"0.5147703",
"0.51376235",
"0.51341957",
"0.5116104",
"0.5104511",
"0.5100864",
"0.51008236",
"0.5087851",
"0.508325"
]
| 0.61891323 | 0 |
Return true if order changes can not be saved | protected function isForbiddenOrderChanges(\XLite\Model\Order $order)
{
$result = false;
if (0 > $order->getTotal()) {
$result = true;
\XLite\Core\TopMessage::addError('Order changes cannot be saved due to negative total value');
}
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function canStoreOrder();",
"protected function isValidOrder()\n {\n return true;\n }",
"public function isDirty();",
"public function checkIsSaved()\n {\n if (isset($this->owner->primaryKey) == false) {\n throw new ModelIsUnsaved();\n }\n }",
"public function has_changes() {\n\t\t\t$properties = array_keys(get_object_vars($this));\n\t\t\t$order = SalesOrderEdit::load($this->sessionid, $this->orderno);\n\n\t\t\tforeach ($properties as $property) {\n\t\t\t\tif ($this->$property != $order->$property) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}",
"protected abstract function canSave();",
"public static function isAllowedWrite(): bool\n {\n if (!isset(self::$definition)) {\n self::$definition = Splash::object(\"Order\")->description();\n }\n if (is_array(self::$definition) && !empty(self::$definition[\"allow_push_updated\"])) {\n return true;\n }\n\n return false;\n }",
"public function isDirty()\r\n\t{\r\n\t\treturn (count($this->changelog)>0) ? true : false;\r\n\t}",
"public function hasChanges () {\n return !!$this->dirty;\n }",
"function beforesave(){\n\t\t// if it returns true, the item will be saved; if it returns false, it won't\n\t\treturn true;\n\t}",
"public function isOrderEditable()\n {\n return !\\XLite::isFreeLicense();\n }",
"protected function canSave()\n {\n if( $this->ticket != null and\n $this->filename != null)\n {\n return true;\n }\n else\n return false;\n }",
"public function isDirty(): bool;",
"protected function afterSave()\n {\n return true;\n }",
"public function canChangeOrderWarehouse();",
"public function hasChange()\n {\n return (\n count($this->getFieldsWithUpdate()) > 0\n || count($this->getIndexesWithUpdate()) > 0\n || $this->addSoftDelete\n || $this->dropSoftDelete\n || $this->addTimestamps\n || $this->dropTimestamps);\n }",
"public function validOrder() {\n\t\t\tif ($this->order->validOrder()) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"public function isDirty()\n {\n if (count($this->errors)) {\n return true;\n }\n\n return false;\n }",
"public function save()\n {\n return false;\n }",
"protected function onSaving()\n {\n return true;\n }",
"protected function isUnchanged() {}",
"protected function autosave_check() {\n\t\t\tif ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}",
"public function _isAllowed()\n {\n return $this->_authorization->isAllowed('Aitoc_OrdersExportImport::save');\n }",
"protected function onSaved()\n {\n return true;\n }",
"public function areDirty()\n {\n return !empty($this->current) || !empty($this->remove);\n }",
"function isSaveAllowed() {\n\t\t\treturn $this->isAllowedAction( 'save' );\n\t\t}",
"public function canSave()\n {\n return $this->save;\n }",
"protected function preSave() {\n return TRUE;\n }",
"protected function _fcpoMarkOrderAsProblematic() {\n $this->_blOrderHasProblems = true;\n }",
"public function beforeSave()\n {\n if (!$this->checkPermissions()) {\n return $this->modx->lexicon('access_denied');\n }\n\n return true;\n }"
]
| [
"0.698637",
"0.67312485",
"0.66255057",
"0.6571852",
"0.6566529",
"0.65186507",
"0.65000397",
"0.64947104",
"0.6460624",
"0.6460462",
"0.64440274",
"0.63586",
"0.6350329",
"0.62997407",
"0.6269696",
"0.6269112",
"0.62424123",
"0.6240188",
"0.622356",
"0.62089396",
"0.61735034",
"0.6169746",
"0.61503136",
"0.6135299",
"0.61319417",
"0.613053",
"0.61277896",
"0.61205053",
"0.6113126",
"0.60926616"
]
| 0.71938646 | 0 |
Send order changed notification | protected function sendOrderChangeNotification()
{
if ($this->getSendNotificationFlag()) {
\XLite\Core\Mailer::getInstance()->sendOrderAdvancedChangedCustomer($this->getOrder());
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"final public function notifyOrderUpdated(): void\n {\n $this->dirtyIndex = true;\n }",
"public function sendStatusUpdateNotifications(OrderEvent $event)\n {\n $order = $event->getOrder();\n switch ($order->getStatus()) {\n\n case Order::STATUS_AWAITING_SEPA:\n // send customer e-mail\n $customerEmailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'shippingType' => Shipping::getReadableShippingType($order->getShippingType()),\n 'accountUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountTaxIncl() / 100), 2)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_AWAITING_SEPA,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $customerEmailVars\n );\n\n break;\n\n case Order::STATUS_NEW:\n // get payment\n $payment = $order->getPayments()->first();\n\n // is transport\n $isTransport = true;\n if (Shipping::TYPE_NOT_SHIPPED === $order->getShippingType()) {\n $isTransport = false;\n }\n\n // send customer e-mail\n $customerEmailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'invoiceUrl' => $this->router->generate('order_invoice_download', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'paymentId' => $payment->getChargeId(),\n 'shippingType' => Shipping::getReadableShippingType($order->getShippingType()),\n 'BoolTransport' => $isTransport,\n 'shippingAddress' => $order->getShippingAddress()->getFlatAddress(),\n 'accountUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'expectedDeliveryDate' => null !== $order->getExpectedDeliveryDate() ? $order->getExpectedDeliveryDate()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y') : '',\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountTaxIncl() / 100), 2)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_CONFIRMATION_CUSTOMER,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $customerEmailVars\n );\n\n // send maker e-mail\n $makerEmailVars = array(\n 'makerName' => $order->getMaker()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'shippingType' => Shipping::getReadableShippingType($order->getShippingType()),\n 'BoolTransport' => $isTransport,\n 'accountUrl' => $this->router->generate('order_maker_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'shippingLimitDate' => null !== $order->getShouldBeReadyAt() ? $order->getShouldBeReadyAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y') . ' avant 17h' : '',\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountForMakerTaxIncl() / 100), 2)// only display production amount - coupon amount to maker\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_CONFIRMATION_MAKER,\n $order->getMaker()->getUser()->getEmail(),\n $order->getMaker()->getFullname(),\n $makerEmailVars\n );\n\n break;\n\n case Order::STATUS_CANCELED:\n // order has been canceled by the customer\n if (OrderEvent::ORIGIN_CUSTOMER === $event->getOrigin()) {\n\n // get order payment id\n $paymentId = 'n/a';\n $payments = $order->getPayments();\n if (0 < count($payments)) {\n /** @var Payment $payment */\n $payment = $payments[0];\n $paymentId = $payment->getChargeId();\n }\n\n // send customer e-mail\n $customerEmailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'paymentId' => $paymentId,\n 'accountUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountTaxIncl() / 100), 2)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_CANCELLATION_CUSTOMER,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $customerEmailVars\n );\n\n // send maker e-mail\n $makerEmailVars = array(\n 'makerName' => $order->getMaker()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountForMakerTaxIncl() / 100), 2)// only display production amount - coupon amount to maker\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_CANCELLATION_MAKER,\n $order->getMaker()->getUser()->getEmail(),\n $order->getMaker()->getFullname(),\n $makerEmailVars\n );\n }\n break;\n\n case Order::STATUS_TRANSIT:\n\n // get shipment\n $shipments = $order->getShipments();\n /** @var Shipment $shipment */\n $shipment = $shipments[0];\n\n // send customer e-mail\n $emailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'shippingType' => Shipping::getReadableShippingType($order->getShippingType()),\n 'shippingAddress' => $order->getShippingAddress()->getFlatAddress(),\n 'trackingUrl' => $shipment->getTrackingUrl(),\n 'trackingNumber' => $shipment->getParcelNumber(),\n 'accountUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountTaxIncl() / 100), 2)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_SHIPPED,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $emailVars\n );\n\n break;\n\n case Order::STATUS_READY_FOR_PICKUP:\n\n // send customer e-mail\n $emailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'shippingType' => Shipping::getReadableShippingType($order->getShippingType()),\n 'shippingAddress' => $order->getShippingAddress()->getFlatAddress(),\n 'accountUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL),\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountTaxIncl() / 100), 2)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_READY_FOR_PICKUP,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $emailVars\n );\n\n break;\n\n case Order::STATUS_REFUNDED:\n\n // get order payment id\n $paymentId = 'n/a';\n $payments = $order->getPayments();\n if (0 < count($payments)) {\n /** @var Payment $payment */\n $payment = $payments[0];\n $paymentId = $payment->getChargeId();\n }\n\n // get order refund id\n $refundId = 'n/a';\n $refunds = $order->getRefunds();\n if (0 < count($refunds)) {\n /** @var Refund $refund */\n $refund = $refunds[0];\n $refundId = $refund->getRefundId();\n }\n\n // send customer e-mail\n $customerEmailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'paymentId' => $paymentId,\n 'refundId' => $refundId,\n 'orderTotalAmountTaxIncl' => number_format(($order->getTotalAmountTaxIncl() / 100), 2)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_REFUNDED,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $customerEmailVars\n );\n\n break;\n\n case Order::STATUS_DELIVERED:\n\n // send customer e-mail\n /* There is no longer any immediate notification sending when the order is delivered. The notification is made on D + 1 via the reminder system\n $customerEmailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n //'ratingUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL) . '#rating'\n 'ratingUrl' => $this->router->generate('order_rating', array('token' => $order->getToken()), $this->router::ABSOLUTE_URL) . '#rating'\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_RATING,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $customerEmailVars\n );\n */\n break;\n\n case Order::STATUS_CLOSED:\n\n if ($order->getRating()->getEnabled() == True ) {\n // send maker e-mail\n $makerEmailVars = array(\n 'makerName' => $order->getMaker()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'orderDate' => $order->getCreatedAt()->setTimezone(new \\DateTimeZone('Europe/Paris'))->format('d/m/Y à H:i'),\n 'orderRateValue' => $order->getRating()->getRate(),\n 'orderRateValue' => $order->getRating()->getComment(),\n 'accountUrl' => $this->router->generate('order_maker_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL)\n\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_RATE,\n $order->getMaker()->getUser()->getEmail(),\n $order->getMaker()->getFullname(),\n $makerEmailVars\n );\n }\n break;\n\n\n\n\n case Order::STATUS_FILE_AVAILABLE:\n\n // send customer e-mail\n $customerEmailVars = array(\n 'customerName' => $order->getCustomer()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'accountUrl' => $this->router->generate('order_customer_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_FILE_AVAILABLE_CUSTOMER,\n $order->getCustomer()->getEmail(),\n $order->getCustomer()->getFullname(),\n $customerEmailVars\n );\n\n break;\n\n case Order::STATUS_FILE_REJECTED:\n\n // send maker e-mail\n $makerEmailVars = array(\n 'makerName' => $order->getMaker()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'accountUrl' => $this->router->generate('order_maker_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_FILE_REJECTED_MAKER,\n $order->getMaker()->getUser()->getEmail(),\n $order->getMaker()->getFullname(),\n $makerEmailVars\n );\n\n break;\n\n case Order::STATUS_FILE_VALIDATED:\n\n // send maker e-mail\n $makerEmailVars = array(\n 'makerName' => $order->getMaker()->getFullname(),\n 'orderReference' => $order->getReference(),\n 'BoolTransport' => $order->getQuotation()->getProject()->getType()->isShipping(),\n 'accountUrl' => $this->router->generate('order_maker_see', array('reference' => $order->getReference()), $this->router::ABSOLUTE_URL)\n );\n $this->sendinBlue->sendTransactional(\n SendinBlue::TEMPLATE_ID_ORDER_FILE_VALIDATED_MAKER,\n $order->getMaker()->getUser()->getEmail(),\n $order->getMaker()->getFullname(),\n $makerEmailVars\n );\n\n break;\n }\n }",
"public function updateOrder($order)\n { \n event(new UpdateOrderNotification([\n 'id' => $order->id,\n 'status' => $order->status,\n ]));\n }",
"public function handleOrderUpdated(OrderChangedEvent $event) {\n $order = $event->order;\n $user = $order->user;\n if( null != $user ) {\n $user->notify(new OrderStatusNotification($order, 'updated'));\n }\n }",
"protected static function on_change_order_state($order)\n {\n \n }",
"public function updated(Order $Order)\n {\n //code...\n }",
"public function salesOrderSaveAfter($observer)\n\t{\n\t\t// Get the settings\n\t\t$settings = Mage::helper('smsnotifications/data')->getSettings();\n\n\t\t// Get the new order object\n\t\t$order = $observer->getEvent()->getOrder();\n\n\t\t// Get the old order data\n\t\t$oldOrder = $order->getOrigData();\n\n\t\t// If the order status hasn't changed, don't do anything\n\t\tif($oldOrder['status'] === $order->getStatus()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the order status has changed, check if a notification should be sent\n\t\t// for the new status. If not, don't do anything\n\t\tif($order->getStatus() !== $settings['order_notification_status']) {\n\t\t\treturn;\n\t\t}\n\n\t\tMage::log('sending', null, 'm.txt');\n\n\t\t// Generate the body for the notification\n\t\t$store_name = Mage::app()->getStore()->getFrontendName();\n\t\t$customer_name = $order->getCustomerFirstname();\n\t\t$customer_name .= ' ' . $order->getCustomerLastname();\n\t\t$order_amount = $order->getBaseCurrencyCode();\n\t\t$order_amount .= ' ' . $order->getBaseGrandTotal();\n\n\t\t$body = sprintf('%s: %s has just placed an order for %s', $store_name, $customer_name, $order_amount);\n\n\t\t// If no recipients have been set, we can't do anything\n\t\tif(!count($settings['order_noficication_recipients'])) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Send the order notification by SMS\n\t\t$result = Mage::helper('smsnotifications/data')->sendSms($body, $settings['order_noficication_recipients']);\n\n\t\t// Check if the sending was successful\n\t\tif(!$result) {\n\t\t\t// If an error occured, notify the administrator\n\t\t\tMage::helper('smsnotifications/data')->sendAdminEmail(sprintf('%s was unable to send one or more order notifications to the specified number(s). Please check your configuration to make sure that your Twilio API settings are correct!', Mage::helper('smsnotifications/data')->app_name));\n\t\t}\n\t}",
"public function updated(Order $order)\n\t{\n\t\t$oldStatus = $order->getOriginal();\n\t\tif ($order->status_id != $oldStatus['status_id'] && $order->status->notification != 0) {\n\t\t\t// example of usage: (be sure that a notification template mail with the slug \"example-slug\" exists in db)\n\t\t\treturn Mail::to($order->user->email)->send(new NotificationTemplateMail($order, \"order-status-changed\"));\n\t\t}\n\t}",
"public function updated(Order $order)\n {\n //\n }",
"public function updated(Order $order)\n {\n //\n }",
"public function sendOrderChange($senderOrg, $order, $changed = [], $deleted = [], $additionalParams = [])\n {\n /** @var Mailer $mailer */\n /** @var Message $message */\n $mailer = Yii::$app->mailer;\n $mailer->htmlLayout = '@mail_views/order';\n // send email\n $subject = Yii::t('message', 'frontend.controllers.order.change_in_order', ['ru' => \"Измененения в заказе №\"]) . $order->id;\n\n $searchModel = new OrderContentSearch();\n $params['OrderContentSearch']['order_id'] = $order->id;\n $dataProvider = $searchModel->search($params);\n $dataProvider->pagination = false;\n\n /**\n * Отправка сообщения в чат\n */\n if ($senderOrg->id == $order->client_id) {\n $senderUser = $order->createdBy;\n } else {\n $senderUser = $order->acceptedBy ?? User::findOne(1);\n }\n\n if (!empty($changed) || !empty($deleted) || !empty($additionalParams)) {\n $systemMessage = \\Yii::$app->view->renderFile('@mail_views/chat/order_change.php', [\n 'changed' => $changed,\n 'deleted' => $deleted,\n 'additionalParams' => $additionalParams\n ]);\n\n $this->sendSystemMessage($senderUser, $order->id, $systemMessage, false, $subject);\n $recipient_org_id = $senderOrg->id == $order->client_id ? $order->vendor_id : $order->client_id;\n Notice::init('Chat')->updateCountMessageAndDialog($recipient_org_id, $order, $subject);\n }\n\n $orgs[] = $order->vendor_id;\n $orgs[] = $order->client_id;\n foreach ($order->recipientsList as $recipient) {\n $email = $recipient->email;\n foreach ($orgs as $org) {\n $notification = $recipient->getEmailNotification($org);\n if ($notification)\n if ($notification->order_changed && !empty($email)) {\n $mailer->compose('@mail_views/orderChange', compact(\"subject\", \"senderOrg\", \"order\", \"dataProvider\", \"recipient\", \"changed\", \"deleted\"))\n ->setTo($email)\n ->setSubject($subject)\n ->send();\n }\n $notification = $recipient->getSmsNotification($org);\n if ($notification)\n if ($recipient->profile->phone && $notification->order_changed) {\n $text = Yii::$app->sms->prepareText('sms.order_changed', [\n 'client_name' => $senderOrg->name,\n 'url' => $order->getUrlForUser($recipient, Yii::$app->params['app_version'])\n ]);\n Yii::$app->sms->send($text, $recipient->profile->phone, $order->id);\n }\n }\n }\n\n }",
"public function updateOrder() {\n\n echo \"ok\";\n }",
"public function lockDeliveredOrder() {\n\n // auto debit unconfirmed order list if it has been delivered for over an hour\n $unconfirmedOrderList = Order::byStatus(Order::STATUS_DELIVERED)\n ->where(\n DB::raw(\"DATE_ADD(updated_at, INTERVAL 1 HOUR)\"),\n \"<=\",\n date(\"Y-m-d H:i:s\")\n )\n ->get();\n\n $affectedTravels = [];\n foreach ($unconfirmedOrderList as $order) {\n\n $order->status = Order::STATUS_RECEIVED;\n $order->save();\n\n $affectedTravels[$order->travel->id] = CourierTravelRecord::find($order->travel_id);\n\n Event::fire(new OrderReceived($order, User::find($order->user_id)));\n }\n\n foreach ($affectedTravels as $travel) {\n Event::fire(new TravelProfitChanged($travel));\n }\n\n $this->info(\"Order changed from delivered to received: \".\n count($unconfirmedOrderList) .\" item(s)\");\n\n }",
"public function hookActionOrderStatusUpdate($params)\n {\n if (!empty($params['id_order'])) {\n $lastOrderStatus = OrderHistory::getLastOrderState($params['id_order']);\n $config = Tools::jsonDecode(Configuration::get('KB_PUSH_NOTIFICATION'), true);\n if (!empty($config) && isset($config['module_config']['enable'])) {\n if (!empty($lastOrderStatus)) {\n $order = new Order($params['id_order']);\n $current_order_status = $params['newOrderStatus']->id;\n $old_order_status = $order->current_state;\n $module_config = $config['module_config'];\n $id_shop = $params['cart']->id_shop;\n $id_lang = $params['cart']->id_lang;\n if ($module_config['enable'] && $module_config['enable_order_status']) {\n $orderStatus_old = new OrderState($old_order_status, $id_lang);\n $orderStatus_new = new OrderState($current_order_status, $id_lang);\n $current_status = $orderStatus_new->name;\n $old_status = $orderStatus_old->name;\n $id_guest = Db::getInstance()->getValue('SELECT id_guest FROM `'._DB_PREFIX_.'guest` WHERE `id_customer` ='.(int)$params['cart']->id_customer);\n $reg_id = KbPushSubscribers::getSubscriberRegIDs($id_guest, $id_shop);\n\n if (empty($reg_id)) {\n $id_guest = $params['cart']->id_guest;\n $reg_id = KbPushSubscribers::getSubscriberRegIDs($id_guest, $id_shop);\n }\n if (!empty($reg_id) && count($reg_id) > 0) {\n $reg_id = $reg_id[count($reg_id)-1]['reg_id'];\n $fcm_setting = Tools::jsonDecode(Configuration::get('KB_PUSH_FCM_SERVER_SETTING'), true);\n if (!empty($fcm_setting)) {\n $fcm_server_key = $fcm_setting['server_key'];\n $headers = array(\n 'Authorization:key=' . $fcm_server_key,\n 'Content-Type:application/json'\n );\n $id_template = KbPushTemplates::getNotificationTemplateIDByType(self::KBPN_ORDER_STATUS_UPDATE);\n if (!empty($id_template)) {\n $fields = array();\n $fields = $this->getNotificationPushData($id_template, $id_lang, $id_shop);\n if (!empty($fields)) {\n $kbTemplate = new KbPushTemplates($id_template, false, $id_shop);\n $message = '';\n if (isset($fields['data']['body'])) {\n $message = $fields['data']['body'];\n if ($kbTemplate->notification_type == self::KBPN_ORDER_STATUS_UPDATE) {\n $orderTotal = $order->getOrdersTotalPaid();\n $orderTotal = Tools::displayPrice($orderTotal);\n $message = str_replace('{{kb_order_reference}}', $order->reference, $message);\n $message = str_replace('{{kb_order_amount}}', $orderTotal, $message);\n $message = str_replace('{{kb_order_before_status}}', $old_status, $message);\n $message = str_replace('{{kb_order_after_status}}', $current_status, $message);\n $fields['data']['body'] = $message;\n }\n }\n $is_sent = 1;\n $push_id = $this->savePushNotification($kbTemplate, $is_sent, array($reg_id));\n if (!empty($push_id)) {\n $fields['to'] = $reg_id;\n $fields[\"data\"][\"base_url\"] = $this->getBaseUrl();\n $fields[\"data\"][\"click_url\"] = $this->context->link->getModuleLink($this->name, 'serviceworker', array('action' => 'updateClickPush'), (bool) Configuration::get('PS_SSL_ENABLED'));\n $fields[\"data\"]['push_id'] = $push_id;\n $result = $this->sendPushRequestToFCM($headers, $fields);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }",
"public function testUpdateOrder()\n {\n }",
"function deliverOrder($orderNum)\n\t\t{\n\t\t\t$db = dbConnect::getInstance();\n \t\t $mysqli = $db->getConnection();\n\t\t\t $query = \" update check_tb set status = '2' where id='\".$orderNum.\"' \"; \n $res=$mysqli->query($query) or die (mysqli_error($mysqli));\n $mysqli->query(\"CREATE EVENT updateStatus\".$orderNum.\" ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE DO \n \tupdate check_tb set status = '1' where id='\".$orderNum.\"' ;\n \t\") or die (mysqli_error($mysqli));\n\t\t\tif($res)\n\t\t\t{\n\n\t\t\t\treturn true;\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\t\n\t\t\t}\n\t\t}",
"function wcfm_mark_as_recived() {\r\n\t\tglobal $WCFM, $WCFMu, $woocommerce, $wpdb;\r\n\t\t\r\n\t\tif ( !empty( $_POST['orderitemid'] ) ) {\r\n $order_id = $_POST['orderid']; \r\n\t\t\t$order = wc_get_order( $order_id );\r\n\t\t\t$product_id = $_POST['productid'];\r\n $order_item_id = $_POST['orderitemid'];\r\n \r\n //$comment_id = $order->add_order_note( sprintf( __( 'Item(s) <b>%s</b> received by customer.', 'wc-frontend-manager-ultimate' ), get_the_title( $product_id ) ), '1');\r\n \r\n // Keep Tracking URL as Order Item Meta\r\n\t\t\t$sql = \"INSERT INTO {$wpdb->prefix}woocommerce_order_itemmeta\";\r\n\t\t\t$sql .= ' ( `meta_key`, `meta_value`, `order_item_id` )';\r\n\t\t\t$sql .= ' VALUES ( %s, %s, %s )';\r\n\t\t\t\r\n\t\t\t$confirm_message = __( 'YES', 'wc-frontend-manager-ultimate' );\r\n\t\r\n\t\t\t$wpdb->get_var( $wpdb->prepare( $sql, 'wcfm_mark_as_recived', $confirm_message, $order_item_id ) );\r\n\t\t\t\r\n\t\t\t$vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );\r\n\t\t\t\r\n\t\t\t// WCfM Marketplace Table Update\r\n\t\t\tif( $vendor_id && (wcfm_is_marketplace() == 'wcfmmarketplace') ) {\r\n\t\t\t\t$wpdb->query(\"UPDATE {$wpdb->prefix}wcfm_marketplace_orders SET shipping_status = 'completed' WHERE order_id = $order_id and vendor_id = $vendor_id and item_id = $order_item_id\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Notification\r\n\t\t\t$wcfm_messages = sprintf( __( 'Customer marked <b>%s</b> received.', 'wc-frontend-manager-ultimate' ), get_the_title( $product_id ) );\r\n\t\t\t$WCFM->wcfm_notification->wcfm_send_direct_message( -1, 0, 0, 1, $wcfm_messages, 'shipment_received' );\r\n\t\t\t\r\n\t\t\t// Vendor Notification\r\n\t\t\tif( $vendor_id ) {\r\n\t\t\t\t$WCFM->wcfm_notification->wcfm_send_direct_message( -2, $vendor_id, 0, 1, $wcfm_messages, 'shipment_received' );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// WC Order Note\r\n\t\t\t$comment_id = $order->add_order_note( $wcfm_messages, '1');\r\n\t\t\t\r\n\t\t\tdo_action( 'wcfm_after_order_mark_received', $order_id, $order_item_id, $product_id );\r\n }\r\n die;\r\n\t}",
"public function execute() {\n $request = $this->getRequest()->getParams();\n \n $order_id = strip_tags($request[\"orderId\"]);\n $order = $this->objectManagement->create('Magento\\Sales\\Model\\Order')->loadByIncrementId($order_id);\n $validateOrder = $this->validateWebhook($request, $order);\n\n $transactionId = $request['referenceId'];\n\n $mageOrderStatus = $order->getStatus();\n\n if($mageOrderStatus === 'pending') {\n\n if(!empty($validateOrder['status']) && $validateOrder['status'] === true) {\n if($request['txStatus'] == 'SUCCESS') {\n $request['additional_data']['cf_transaction_id'] = $transactionId;\n $this->logger->info(\"Cashfree Notify processing started for cashfree transaction_id(:$transactionId)\");\n $this->processPayment($transactionId, $order);\n $this->logger->info(\"Cashfree Notify processing complete for cashfree transaction_id(:$transactionId)\");\n return;\n } elseif($request['txStatus'] == 'FAILED' || $request['txStatus'] == 'CANCELLED') {\n $orderStatus = self::STATE_CANCELED;\n $this->processWebhookStatus($orderStatus, $order);\n $this->logger->info(\"Cashfree Notify change magento order status to (:$orderStatus) cashfree transaction_id(:$transactionId)\");\n return;\n } elseif($request['txStatus'] == 'USER_DROPPED') {\n $orderStatus = self::STATE_CLOSED;\n $this->processWebhookStatus($orderStatus, $order);\n $this->logger->info(\"Cashfree Notify change magento order status to (:$orderStatus) cashfree transaction_id(:$transactionId)\");\n return;\n } else {\n $orderStatus = self::STATE_PENDING_PAYMENT;\n $this->processWebhookStatus($orderStatus, $order);\n $this->logger->info(\"Cashfree Notify change magento order status to (:$orderStatus) cashfree transaction_id(:$transactionId)\");\n return;\n }\n } else {\n $errorMsg = $validateOrder['errorMsg'];\n $this->logger->info(\"Cashfree Notify processing payment for cashfree transaction_id(:$transactionId) is failed due to ERROR(: $errorMsg)\");\n return;\n }\n } else {\n $this->logger->info(\"Order has been already in processing state for cashfree transaction_id(:$transactionId)\");\n return;\n }\n }",
"public function markOrderReceived() {\r\n global $wpdb;\r\n \r\n $client = new Client(\r\n str_replace('/public', '', get_site_url()),\r\n // get_site_url(),\r\n $this->consumer_key,\r\n $this->consumer_secret,\r\n [\r\n 'wp_api' => true,\r\n 'version' => 'wc/v3',\r\n 'query_string_auth' => true,\r\n 'timeout' => PADBSYNC_CURL_TIMEOUT\r\n ]\r\n );\r\n \r\n $postData = $_POST['data'];\r\n \r\n $decoded = json_decode($postData, true);\r\n \r\n if (isset($postData) && $postData) {\r\n $strRep = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"\", stripslashes($postData));\r\n $data = json_decode($strRep, true);\r\n }\r\n \r\n //check if item exists\r\n try {\r\n $order = $client->get('orders/'.$data['order_id']);\r\n } catch (HttpClientException $e) {\r\n return new WP_REST_Response(['message' => \"Something went wrong!\"]);\r\n }\r\n \r\n if (!$order) {\r\n return new WP_REST_Response(['message' => \"No order found for such query!\"]);\r\n }\r\n \r\n $result = $wpdb->update(\r\n $wpdb->prefix . \"posts\", \r\n [ 'profaktura_status' => $data['profaktura_status'] ],\r\n [ 'ID' => $data['order_id'] ]\r\n );\r\n \r\n if (!$result) {\r\n return new WP_REST_Response(['message' => \"Something went wrong!\"]);\r\n }\r\n \r\n return new WP_REST_Response(['message' => \"Status succesfully updated!\"]);\r\n }",
"public function editorderAction()\r\n {\r\n $orderid = $this->getRequest()->getParam('orderid');\r\n $deliverydate = $this->getRequest()->getPost('codesbug_delivery_date');\r\n $deliverytime = $this->getRequest()->getPost('time_interval');\r\n $deliverycomment = $this->getRequest()->getPost('deliverycomment');\r\n $storecomment = $this->getRequest()->getPost('storecomment');\r\n $notifyemail = $this->getRequest()->getPost('notifyemail');\r\n\r\n $deliverycomment = preg_replace(\"/\\r\\n|\\r/\", \"<br/>\", $deliverycomment);\r\n $deliverycomment = trim($deliverycomment);\r\n\r\n $a = explode('-', $deliverytime);\r\n $model = Mage::getModel('sales/order')->load($orderid);\r\n $deliverydatebefore = $model->getCodesbugDeliveryDate();\r\n $deliverytimefirstbefore = $model->getCodesbugDeliveryTimefirst();\r\n $deliverytimelastbefore = $model->getCodesbugDeliveryTimelast();\r\n $customername = $model->getCustomerName();\r\n $status = $model->getStatus();\r\n\r\n $currtime = date(\"Y-m-d H:i:s\", Mage::getModel('core/date')->timestamp(time()));\r\n\r\n $model->setCodesbugDeliveryDate($deliverydate);\r\n $model->setCodesbugDeliveryComment($deliverycomment);\r\n $model->setCodesbugDeliveryTimefirst($a[0]);\r\n $model->setCodesbugDeliveryTimelast($a[1]);\r\n\r\n /*\r\n * order comment\r\n */\r\n $comment = 'Delivery Information Changes From ' . $deliverydatebefore . ' ' . $deliverytimefirstbefore . '-' . $deliverytimelastbefore . ' To ' . $deliverydate . ' ' . $deliverytime . ' By ' . $customername . ' at ' . $currtime . '<br/>';\r\n $comment .= $storecomment;\r\n\r\n $deliveryinformation = 'Delivery Date:' . $deliverydate . '<br/>';\r\n $deliveryinformation .= 'Delivery Time:' . $deliverytime . '<br/>';\r\n $deliveryinformation .= 'Delivery Comment:' . $deliverycomment . '<br/><br/>';\r\n $deliveryinformation .= $comment;\r\n\r\n if (isset($notifyemail)) { //check the notify email is checked or not ,checked then email send\r\n try {\r\n //$data = array();\r\n //$data['comment'] = $comment;\r\n //$data['status'] = $status;\r\n $model->addStatusHistoryComment($comment, $status);\r\n // $comment = trim(strip_tags($data['comment']));\r\n\r\n $model->save();\r\n $model->sendOrderUpdateEmail($status, $deliveryinformation);\r\n } catch (Mage_Core_Exception $e) {\r\n $response = array(\r\n 'error' => true,\r\n 'message' => $e->getMessage(),\r\n );\r\n } catch (Exception $e) {\r\n $response = array(\r\n 'error' => true,\r\n 'message' => $this->__('Cannot add order history.'),\r\n );\r\n }\r\n }\r\n\r\n $this->_redirectReferer();\r\n\r\n }",
"public function commitOrderChanges(Mage_Sales_Model_Order $order)\r\n {\r\n $text = '';\r\n $labelPrefix = '';\r\n $helper = $this->getHelper();\r\n $store = $this->getStore($order);\r\n $this->setOrder($order);\r\n\r\n $changes = $this->getChanges($order);\r\n foreach ($this->_getAdditionalSources($order) as $code => $source) {\r\n if (!($source instanceof Varien_Object)) {\r\n continue;\r\n }\r\n\r\n $addChanges = $this->getChanges($source);\r\n\r\n if ($source instanceof Mage_Sales_Model_Order_Address) {\r\n foreach ($addChanges as $k => $change) {\r\n if ($source->getAddressType() == 'shipping') {\r\n $addChanges[$k]['label_prefix'] = $helper->__('Shipping') . ' ';\r\n } elseif ($source->getAddressType() == 'billing') {\r\n $addChanges[$k]['label_prefix'] = $helper->__('Billing') . ' ';\r\n }\r\n }\r\n }\r\n\r\n $changes = array_merge($changes, $addChanges);\r\n }\r\n\r\n foreach ($changes as $code => $diff) {\r\n $label = $labelPrefix . $this->_possibleChanges[$code];\r\n $labelPrefix = (isset($diff['label_prefix'])) ? $diff['label_prefix'] : '';\r\n\r\n $text .= $labelPrefix;\r\n $text .= $helper->__(\"%s has been changed from \\\"%s\\\" to \\\"%s\\\"\", $label, $diff['from'], $diff['to']);\r\n $text .= $this->eol();\r\n }\r\n\r\n if (count($this->_itemsChanges)) {\r\n foreach ($this->_itemsChanges as $item) {\r\n\r\n // Qty changes\r\n if (empty($item['qty_after'])) {\r\n $text .= $helper->__(\"\\\"%s\\\" has been removed from the order\", $item['name']) . $this->eol();\r\n } elseif (empty($item['qty_before'])) {\r\n $text .= $helper->__(\"\\\"%s\\\" has been added to the order (Qty: %s)\", $item['name'],\r\n $item['qty_after']) . $this->eol();\r\n } elseif ($item['qty_after'] > $item['qty_before']) {\r\n $qtyDiff = $item['qty_after'] - $item['qty_before'];\r\n $text .= $helper->__(\"%s item(s) of \\\"%s\\\" have been added to the order\", $qtyDiff,\r\n $item['name']) . $this->eol();\r\n } elseif ($item['qty_before'] > $item['qty_after']) {\r\n $qtyDiff = $item['qty_before'] - $item['qty_after'];\r\n $text .= $helper->__(\"%s item(s) of \\\"%s\\\" have been removed from the order\", $qtyDiff,\r\n $item['name']) . $this->eol();\r\n }\r\n\r\n // Price changes\r\n if (isset($item['price_after']) && isset($item['price_before']) && $item['price_after'] != $item['price_before']) {\r\n $text .= $helper->__(\"Price of \\\"%s\\\" has been changed from %s to %s\",\r\n $item['name'],\r\n $store->formatPrice($item['price_before'], false),\r\n $store->formatPrice($item['price_after'], false))\r\n . $this->eol();\r\n }\r\n\r\n // Discount changes\r\n if (isset($item['discount'])) {\r\n if ($item['discount'] == 1) {\r\n $text .= $helper->__(\"Discount for \\\"%s\\\" have been applied\", $item['name']) . $this->eol();\r\n } elseif ($item['discount'] == -1) {\r\n $text .= $helper->__(\"Discount of \\\"%s\\\" have been removed\", $item['name']) . $this->eol();\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (empty($text)) {\r\n return $this;\r\n }\r\n\r\n // 0 - no one; 1 - only admin; 2 - notify all;\r\n /** @var int $notify */\r\n $notify = intval($this->getHelper()->isSendUpdateEmail());\r\n /** @var MageWorx_OrdersBase_Model_Logger $logger */\r\n $logger = Mage::getModel('mageworx_ordersbase/logger');\r\n $logger->log($text, $order, $notify);\r\n\r\n /** Begin: Update Grand total during order update from BE */\r\n if ($notify) {\r\n $order->sendOrderUpdateEmail($notify > 1, $text);\r\n }\r\n\r\n $cod = 0;\r\n $cod_base = 0;\r\n\r\n // Add COD value, if order has products and COD doesn't have any value\r\n if ($order->getTotalQtyOrdered() > 0 && !$order->getMspCashondelivery()) {\r\n $cod = $order->getMspCashondelivery();\r\n $cod_base = $order->getMspBaseCashondelivery();\r\n }\r\n\r\n $order->setGrandTotal($order->getGrandTotal() + $cod);\r\n $order->setBaseGrandTotal($order->getBaseGrandTotal() + $cod_base);\r\n $order->save();\r\n /** End: Update Grand total during order update from BE */\r\n\r\n return $this;\r\n }",
"function detect_dispensing_changes($order) {\n\n $day_changes = [];\n $qty_changes = [];\n $mysql = new Mysql_Wc();\n\n //Normall would run this in the update_order_items.php but we want to wait for all the items to change so that we don't rerun multiple times\n foreach ($order as $item) {\n\n //! $updated['order_date_dispensed'] otherwise triggered twice, once one stage: Printed/Processed and again on stage:Dispensed\n if ($item['days_dispensed_default'] != $item['days_dispensed_actual'])\n $day_changes[] = \"rx:$item[rx_number] qty:$item[qty_dispensed_default] >>> $item[qty_dispensed_actual] days:$item[days_dispensed_default] >>> $item[days_dispensed_actual] refills:$item[refills_dispensed_default] >>> $item[refills_dispensed_actual] item:\".json_encode($item);\n\n //! $updated['order_date_dispensed'] otherwise triggered twice, once one stage: Printed/Processed and again on stage:Dispensed\n if ($item['qty_dispensed_default'] != $item['qty_dispensed_actual'] OR (( ! is_null($item['refills_dispensed_actual']) AND $item['refills_dispensed_default']+0) != $item['refills_dispensed_actual']))\n $qty_changes[] = \"rx:$item[rx_number] qty:$item[qty_dispensed_default] >>> $item[qty_dispensed_actual] days:$item[days_dispensed_default] >>> $item[days_dispensed_actual] refills:$item[refills_dispensed_default] >>> $item[refills_dispensed_actual] item:\".json_encode($item);\n\n //! $updated['order_date_dispensed'] otherwise triggered twice, once one stage: Printed/Processed and again on stage:Dispensed\n $sig_qty_per_day_actual = $item['days_dispensed_actual'] ? round($item['qty_dispensed_actual']/$item['days_dispensed_actual'], 1) : 'NULL';\n $mysql->run(\"\n UPDATE gp_rxs_single SET sig_qty_per_day_actual = $sig_qty_per_day_actual WHERE rx_number = $item[rx_number]\n \");\n\n if ($item['days_dispensed_actual'] AND $item['refills_dispensed'] AND ! $item['qty_left'] AND ($item['days_dispensed_actual'] > DAYS_MAX OR $item['days_dispensed_actual'] < DAYS_MIN))\n log_error(\"check days dispensed is not within limits and it's not out of refills: \".DAYS_MIN.\" < $item[days_dispensed_actual] < \".DAYS_MAX, $item);\n else if ($sig_qty_per_day_actual != 'NULL' AND $sig_qty_per_day_actual != round($item['sig_qty_per_day_default'], 1) AND $sig_qty_per_day_actual != round($item['sig_qty_per_day_default']*2, 1)) { // *2 is a hack for \"as needed\" being different right now\n log_error(\"sig parsing error Updating to Actual Qty_Per_Day '$item[sig_actual]' $item[sig_qty_per_day_default] (default) != $sig_qty_per_day_actual $item[qty_dispensed_actual]/$item[days_dispensed_actual] (actual)\", $item);\n }\n }\n\n log_notice(\"update_order_cp detect_dispensing_changes\", ['order' => $order, 'day_changes' => $day_changes, 'qty_changes' => $qty_changes]);\n return ['day_changes' => $day_changes, 'qty_changes' => $qty_changes];\n }",
"public function updating(Order $Order)\n {\n //code...\n }",
"function ProcessOrderStateChangeNotification($dom_response_obj) {\n /*\n * +++ CHANGE ME +++\n * Order state change notifications signal an update to an order's\n * financial status or its fulfillment status. An\n * <order-state-change-notification> identifies the new financial\n * and fulfillment statuses for an order. It also identifies the\n * previous statuses for the order. Google Checkout will send an\n * <order-state-change-notification> to confirm status changes that\n * you trigger by using the Order Processing API requests. For\n * example, if you send Google Checkout a <cancel-order> request,\n * Google Checkout will respond through the Notification API to inform\n * you that the order's status has been changed to \"canceled\".\n *\n * If you are implementing the Notification API, you need to\n * modify this function to relay the information in the\n * <order-state-change-notification> to your internal systems that\n * process financial or fulfillment status information.\n */\n // Now we process only DELIVERED state from Google, all another states are marked as Google Checkout Processing\n $dom_data_root = $dom_response_obj->document_element();\n $google_order_number = $dom_data_root->get_elements_by_tagname(\"google-order-number\");\n $number = $google_order_number[0]->get_content();\n $order_status1 = $dom_data_root->get_elements_by_tagname(\"new-fulfillment-order-state\");\n $order_status2 = $dom_data_root->get_elements_by_tagname(\"new-financial-order-state\");\n $status1 = $order_status1[0]->get_content();\n $status2 = $order_status2[0]->get_content();\n $status = '';\n if ($status1=='NEW') $status = 'NEW';\n if ($status1=='PROCESSING' && $status2=='CHARGED') $status = 'CHARGED';\n if ($status1=='DELIVERED') $status = 'DELIVERED';\n if ($status2=='CANCELLED') $status = 'CANCELLED';\n\n $sql_data_array = false;\n $order_id = tep_db_fetch_array(tep_db_query(\"select orders_id from \" . TABLE_ORDERS . \" where google_orders_id='\" . $number . \"'\"));\n if ( (int)$order_id['orders_id']!=0 ) {\n $sql_data_array = array('orders_id' => (int)$order_id['orders_id'],\n 'orders_status_id' => 0,\n 'date_added' => 'now()',\n 'customer_notified' => '0',\n 'comments' => 'Google Checkout status change');\n }\n\n switch($status)\n {\n case 'CHARGED':\n // update order status, 3 - Shipped status in shop system\n tep_db_query(\"update \" . TABLE_ORDERS . \" set orders_status='\".(int)MODULE_PAYMENT_GOOGLECHECKOUT_STATUS.\"' where google_orders_id='\" . $number . \"'\");\n if ( is_array($sql_data_array) ) {\n $sql_data_array['orders_status_id'] = (int)MODULE_PAYMENT_GOOGLECHECKOUT_STATUS;\n tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);\n }\n break;\n case 'DELIVERED':\n // update order status, 3 - Shipped status in shop system\n tep_db_query(\"update \" . TABLE_ORDERS . \" set orders_status='\".(int)MODULE_PAYMENT_GOOGLECHECKOUT_DELIVERED_STATUS_ID.\"' where google_orders_id='\" . $number . \"'\");\n if ( is_array($sql_data_array) ) {\n $sql_data_array['orders_status_id'] = (int)MODULE_PAYMENT_GOOGLECHECKOUT_DELIVERED_STATUS_ID;\n tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);\n }\n break;\n case 'CANCELLED':\n // update order status, 3 - Shipped status in shop system\n tep_db_query(\"update \" . TABLE_ORDERS . \" set orders_status='\".(int)MODULE_PAYMENT_GOOGLECHECKOUT_CANCELLED_STATUS_ID.\"' where google_orders_id='\" . $number . \"'\");\n if ( is_array($sql_data_array) ) {\n $sql_data_array['orders_status_id'] = (int)MODULE_PAYMENT_GOOGLECHECKOUT_CANCELLED_STATUS_ID;\n tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);\n }\n break;\n }\n SendNotificationAcknowledgment();\n}",
"public static function delivery_time_changed(User $user, Order $order)\n {\n $notification = new Notification;\n $notification->user_id = $user->id;\n $notification->order_id = $order->id;\n $notification->type = 'Deadline update';\n $notification->message ='Deadline has been updated';\n\n $notification->save();\n\n Mail::queue('emails.time_updated_order',['user'=>$user, 'order'=>$order], function($m)use ($user, $order)\n {\n $m->from('[email protected]', 'ARA');\n\n $m->to($user->email, $user->first_name)->subject('Deadline updated on Order '.$order->order_no);\n\n });\n\n\n //We send an sms notification to the User for the time update;\n $txt = 'Greetings '.$user->first_name.' Order '.$order->order_no.' deadline has been updated to '.$order->deadline.' Kindly have a look at it and take not of the the chagnes. Academicresearchasistants.com';\n $send_sms =self::sendSMSnotice($user,$txt);\n }",
"public function notifyPayment()\n {\n }",
"public function notifyNewOrder(Varien_Event_Observer $observer)\n {\n //Mage::log($observer->getEvent());\n\n //Check to see if module is enabled\n if (!Mage::helper('twilio')->isEnabled() || !Mage::helper('twilio')->sendSmsForNewOrders()) {\n Mage::log(\"Magento Twilio module is not enabled or should not send SMS for new orders.\");\n return;\n }\n\n //Send SMS via twilio\n // try {\n // \t$sms = $this->account->messages->sendMessage(\n // \t\t$this->twilioNumber,\n // \t\t$this->smsNotificationNumber,\n // \t\t$this->message\n // \t);\n // } catch (Exception $e) {\n // \tMage::logException($e);\n // }\n\n //Send SMS via twilio\n try {\n $sms = $this->account->messages->create(\n array(\n 'To' => $this->twilioNumber,\n 'From' => $this->smsNotificationNumber,\n 'Body' => $this->message,\n 'StatusCallback' => Mage::helper('twilio')->getStatusCallbackUrl() //TODO: Verify this is set first\n )\n );\n } catch (Exception $e) {\n\n }\n\n return $this;\n }",
"public function notify()\n\t{\n\t\t// Check the sender is 2Checkout\n\t\t$key = Context::get('md5_hash');\n\n\t\t$sale_id = Context::get('sale_id');\n\t\t$vendor_id = $this->sid;\n\t\t$invoice_id = Context::get('invoice_id');\n\t\t$secret_word = $this->secret_word;\n\t\t$expected_key = strtoupper(md5($sale_id . $vendor_id . $invoice_id . $secret_word));\n\n\t\tif(strtoupper($key) != $expected_key)\n\t\t{\n\t\t\tShopLogger::log(\"Invalid 2checkout IPN message received - key \" . $key . ' ' . print_r($_REQUEST, TRUE));\n\t\t\treturn;\n\t\t}\n\n\t\t$message_type = Context::get('message_type');\n\t\tif($message_type != 'ORDER_CREATED')\n\t\t{\n\t\t\tShopLogger::log(\"Unsupported IPN 2checkout message received: \" . print_r($_REQUEST, TRUE));\n\t\t\treturn;\n\t\t}\n\n\t\t$cart_srl = Context::get('vendor_order_id');\n\t\t$transaction_id = $sale_id; // Hopefully, this is order number\n\n\t\t$order_repository = new OrderRepository();\n\n\t\t// Check if order has already been created for this transaction\n\t\t$order = $order_repository->getOrderByTransactionId($transaction_id);\n\t\tif(!$order) // If not, create it\n\t\t{\n\t\t\t$cart = new Cart($cart_srl);\n\t\t\t$this->createNewOrderAndDeleteExistingCart($cart, $transaction_id);\n\n // get created order\n $model = getModel('shop');\n $orderRepository = $model->getOrderRepository();\n $order_srl = Context::get('order_srl');\n $order = $orderRepository->getOrderBySrl($order_srl);\n\t\t}\n\n // generate invoice\n $args = new StdClass();\n $args->order_srl = $order->order_srl;\n $args->module_srl = $order->module_srl;\n $invoice = new Invoice($args);\n $invoice->save();\n if ($invoice->invoice_srl) {\n if (isset($order->shipment))\n $order->order_status = Order::ORDER_STATUS_COMPLETED;\n else\n $order->order_status = Order::ORDER_STATUS_PROCESSING;\n try {\n $order->save();\n }\n catch(Exception $e) {\n return new Object(-1, $e->getMessage());\n }\n } else {\n throw new ShopException('Something whent wrong when adding invoice');\n }\n\t}",
"public function salesOrderInvoiceSaveAfter($observer)\n {\n\n // Get the settings\n $settings = Mage::helper('smsnotifications/data')->getSettings();\n $arr = $settings['order_status'];\n $a = explode(',', $settings['order_status']);\n $b = explode(',', $settings['order_status']);\n $final_array = array_combine($a, $b);\n\n $text = Mage::getStoreConfig('smsnotifications/invoice_notification/message');\n // If no invoice notification has been specified, no notification can be sent\n if (!$text) {\n return;\n }\n\n $order = $observer->getEvent()->getInvoice()->getOrder();\n $order_id = $order->getIncrementId();\n\n $invoice = $order->getInvoiceCollection()->getFirstItem();\n $invoiceId = $invoice->getIncrementId();\n\n $store_name = Mage::app()->getStore()->getFrontendName();\n\n $billingAdress = $order->getBillingAddress();\n $shippingAdress = $order->getShippingAddress();\n\n if ($order->getCustomerFirstname()) {\n $customer_name = $order->getCustomerFirstname();\n $customer_name .= ' '.$order->getCustomerLastname();\n } elseif ($billingAdress->getFirstname()) {\n $customer_name = $billingAdress->getFirstname();\n $customer_name .= ' '.$billingAdress->getLastname();\n } else {\n $customer_name = $shippingAdress->getFirstname();\n $customer_name .= ' '.$shippingAdress->getLastname();\n }\n\n $order_amount = $order->getBaseCurrencyCode();\n $order_amount .= ' '.$order->getBaseGrandTotal();\n\n $telephoneNumber = trim($shippingAdress->getTelephone());\n\n // Check if a telephone number has been specified\n if(in_array('invoice', $final_array)){\n if ($telephoneNumber) {\n $text = Mage::getStoreConfig('smsnotifications/invoice_notification/message');\n $text = $settings['invoice_notification_message'];\n $text = str_replace('{{name}}', $customer_name, $text);\n $text = str_replace('{{order}}', $order_id, $text);\n $text = str_replace('{{amount}}', $order_amount, $text);\n $text = str_replace('{{invoiceno}}', $invoiceId, $text);\n\n array_push($settings['order_noficication_recipients'], $telephoneNumber );\n\n $result = Mage::helper('smsnotifications/data')->sendSms($text, $settings['order_noficication_recipients']);\n if ($result) {\n $recipients_string = implode(',', $settings['order_noficication_recipients']);\n Mage::getSingleton('adminhtml/session')->addSuccess(sprintf('The invoice notification has been sent via SMS to: %s', $recipients_string));\n } else {\n Mage::getSingleton('adminhtml/session')->addError('There has been an error sending the invoice notification SMS.');\n }\n }\n }\n}",
"private function saveOrder() {\n $currentDate = new Zend_Date();\n $customer = Customer::findByEmail($this->getRequest()->getParam('email'));\n $customer->name = $this->getRequest()->getParam('name');\n $customer->phone = $this->getRequest()->getParam('phone');\n\n $ord = new Order();\n $ord->Customer = $customer;\n $ord->date = $currentDate->get();\n //TODO Take product id from param and check if it is available (not in future, still on sales, etc)\n $product = Product::getCurrentProduct();\n $ord->Product = $product;\n $customer->save();\n $ord->save();\n $product->takeFromStock();\n $customer->sendOrderNotification($ord);\n }"
]
| [
"0.71911144",
"0.7125652",
"0.70401776",
"0.67497915",
"0.6749666",
"0.67492604",
"0.6747845",
"0.6726744",
"0.66682905",
"0.66682905",
"0.6634167",
"0.66267884",
"0.6330931",
"0.63096744",
"0.6281023",
"0.62567556",
"0.6236327",
"0.6232668",
"0.6211969",
"0.62016195",
"0.6194245",
"0.61922485",
"0.6151139",
"0.6135544",
"0.6104281",
"0.6103878",
"0.6094436",
"0.6081413",
"0.6037085",
"0.6023515"
]
| 0.82093114 | 0 |
Get 'sendNotification' flag from request | protected function getSendNotificationFlag()
{
return (bool) \XLite\Core\Request::getInstance()->sendNotification;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNotification(){\n\n\n}",
"public function getNotification()\n {\n return $this->notification;\n }",
"public function getNotification()\n\t{\n\t\treturn $this->notification;\n\t}",
"public function UpdateCustomerNotificationStatus()\n {\n if (isset($this->request->type) && ($this->request->type == \"on\")) {\n $customer_id = $this->authUser->id;\n $notificationStatus = $this->_customer->where('id', $customer_id)->update([ 'notification_status' => 1 ]);\n } elseif (isset($this->request->type) && ($this->request->type == \"off\")) {\n $customer_id = $this->authUser->id;\n $notificationStatus = $this->_customer->where('id', $customer_id)->update([ 'notification_status' => 0 ]);\n }\n return $notificationStatus;\n }",
"function _wp_privacy_send_request_confirmation_notification($request_id)\n {\n }",
"function getNotify() {\r\r\n\t\treturn $this->notify;\r\r\n\t}",
"function mark_notification() {\n\t\tif ( check_ajax_referer( 'ht-dms', 'nonce' ) ) {\n\t\t\t$nID = pods_v_sanitized( 'nID', $_REQUEST );\n\t\t\t$value = ( pods_v( 'mark', $_REQUEST ) );\n\n\t\t\tif ( $nID && in_array( $value, array( 1, 0 ) ) ) {\n\t\t\t\t$id = ht_dms_notification_class()->viewed( $nID, null, $value );\n\n\t\t\t\tif ( $id == $nID ) {\n\t\t\t\t\twp_die( 1 );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\twp_die( 0 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t}",
"public function notification();",
"public function notification();",
"function notificationEnabled(){\n\t\treturn false;\n\t}",
"public function get_notification_get(){\n $notification = $this->model->getAllwhere('notification');\n\n $resp = array(\n 'rccode' => 1,\n 'message' => 'SUCCESS',\n 'notification' => (!empty($notification) ) ? $notification: [],\n );\n $this->response($resp);\n }",
"public function getNotify()\n {\n return $this->notify;\n }",
"public function isPending(): bool;",
"function getNotificationMessage($request, $notification) {\n\t\t// Allow hooks to override default behavior\n\t\t$message = null;\n\t\tHookRegistry::call('NotificationManager::getNotificationMessage', array(&$notification, &$message));\n\t\tif($message) return $message;\n\n\t\tswitch ($notification->getType()) {\n\t\t\tcase NOTIFICATION_TYPE_PUBLISHED_ISSUE:\n\t\t\t\treturn __('notification.type.issuePublished');\n\t\t\tcase NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_SUCCESS:\n\t\t\t\treturn __('gifts.giftRedeemed');\n\t\t\tcase NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_NO_GIFT_TO_REDEEM:\n\t\t\t\treturn __('gifts.noGiftToRedeem');\n\t\t\tcase NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_GIFT_ALREADY_REDEEMED:\n\t\t\t\treturn __('gifts.giftAlreadyRedeemed');\n\t\t\tcase NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_GIFT_INVALID:\n\t\t\t\treturn __('gifts.giftNotValid');\n\t\t\tcase NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_SUBSCRIPTION_TYPE_INVALID:\n\t\t\t\treturn __('gifts.subscriptionTypeNotValid');\n\t\t\tcase NOTIFICATION_TYPE_GIFT_REDEEM_STATUS_ERROR_SUBSCRIPTION_NON_EXPIRING:\n\t\t\t\treturn __('gifts.subscriptionNonExpiring');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_REQUESTED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.bookRequested');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_CREATED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.bookCreated');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_UPDATED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.bookUpdated');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_DELETED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.bookDeleted');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_MAILED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.bookMailed');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_SETTINGS_SAVED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.settingsSaved');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_SUBMISSION_ASSIGNED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.submissionAssigned');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_AUTHOR_ASSIGNED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.authorAssigned');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_AUTHOR_DENIED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.authorDenied');\n\t\t\tcase NOTIFICATION_TYPE_BOOK_AUTHOR_REMOVED:\n\t\t\t\treturn __('plugins.generic.booksForReview.notification.authorRemoved');\n\t\t\tdefault:\n\t\t\t\treturn parent::getNotificationMessage($request, $notification);\n\t\t}\n\t}",
"public function broadcastOn()\n {\n// Log::info($this->pickup_trip);\n// Log::info($this->trip);\n// Log::info(gettype($this->pickup_trip));\n $x= PickUpRequest::where('id',$this->pickup_trip->id)->first();\n if (is_null($x->trip_id))\n return new Channel('notification-driver'.$this->trip->drive_id);\n }",
"public function getSendNotificationsOnLeads() {\n\n return (bool) $this->send_notifications_on_leads;\n\n }",
"public abstract function sendNotification($notification);",
"public function isTrackingNotification()\n {\n return (1 == $this->getConfig('notification/tracking_notification'));\n }",
"static public function GetGETSaveInSent() {\n if (isset(self::$saveInSent))\n return self::$saveInSent;\n else\n return true;\n }",
"public function setRPCNotification($notification) {\n\t\tempty($notification) ?\n\t\t\t\t\t\t\t$this->notification = false\n\t\t\t\t\t\t\t:\n\t\t\t\t\t\t\t$this->notification = true;\n\t}",
"function wd_notification() {\n return WeDevs_Notification::init();\n}",
"public function getEmailTriggerRequested(){\n return $this->email_requested;\n }",
"public function getNotifyAction() {\r\n $this->view->notification = $notification = $this->_getParam('notification', 0);\r\n $suggObj = Engine_Api::_()->getItem('suggestion', $notification->object_id);\r\n if (!empty($suggObj)) {\r\n\t\t\t$this->view->suggObj = $suggObj;\r\n\r\n if( strstr($suggObj->entity, \"sitereview\") ) {\r\n $getListingTypeId = Engine_Api::_()->getItem('sitereview_listing', $suggObj->entity_id)->listingtype_id;\r\n $getModId = Engine_Api::_()->suggestion()->getReviewModInfo($getListingTypeId);\r\n $modInfoArray = Engine_Api::_()->getApi('modInfo', 'suggestion')->getPluginDetailed(\"sitereview_\" . $getModId);\r\n $this->view->modInfoArray = $modInfoArray = $modInfoArray[\"sitereview_\" . $getModId];\r\n }else {\r\n $modInfoArray = Engine_Api::_()->getApi('modInfo', 'suggestion')->getPluginDetailed($suggObj->entity);\r\n $this->view->modInfoArray = $modInfoArray = $modInfoArray[$suggObj->entity];\r\n }\r\n \r\n if ($this->isModuleEnabled($modInfoArray['pluginName'])) {\r\n if ( $suggObj->entity == 'photo' ) {\r\n $modItemId = $suggObj->sender_id;\r\n } else {\r\n $modItemId = $suggObj->entity_id;\r\n }\r\n $modObj = Engine_Api::_()->getItem($modInfoArray['itemType'], $modItemId);\r\n\r\n\t// Check Sender exist on site or not.\r\n\t$isSenderExist= Engine_Api::_()->getItem('user', $suggObj->sender_id)->getIdentity();\r\n\tif( empty($isSenderExist) ) {\r\n\t Engine_Api::_()->getDbtable('suggestions', 'suggestion')->removeSuggestion($suggObj->entity, $suggObj->entity_id, $modInfoArray['notificationType']);\r\n\t $this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t $this->view->modObj = null;\r\n\t}\r\n\r\n\t// If Loggden user have \"Friend Suggestion\" Which already his friend then that friend suggestion should be delete.\r\n\tif( empty($modObj) || (( $suggObj->entity != 'photo' ) && ($modInfoArray['itemType'] == 'user') && !empty($modItemId)) ) {\r\n\t\t$is_user = Engine_Api::_()->getItem('user', $suggObj->entity_id)->getIdentity();\r\n\t\t$isFriend = Engine_Api::_()->getApi('coreFun', 'suggestion')->isMember($modItemId);\r\n\t\tif( empty($is_user) || !empty($isFriend) || empty($modObj) ) {\r\n\t\t Engine_Api::_()->getDbtable('suggestions', 'suggestion')->removeSuggestion($suggObj->entity, $suggObj->entity_id, $modInfoArray['notificationType']);\r\n\t\t $this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t\t $this->view->modObj = null;\r\n\t\t}\r\n\t}\r\n\r\n // It would be \"NULL\", If that entry already deleteed from the table.\r\n if (empty($modObj)) {\r\n Engine_Api::_()->getDbtable('suggestions', 'suggestion')->removeSuggestion($suggObj->entity, $suggObj->entity_id, $modInfoArray['notificationType']);\r\n $this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n $this->view->modObj = null;\r\n } else {\r\n\t\t\t\t\t$this->view->modObj = $modObj;\r\n $this->view->senderObj = $senderObj = Engine_Api::_()->getItem('user', $suggObj->sender_id);\r\n $this->view->sender_name = $this->view->htmlLink($senderObj->getHref(), $senderObj->displayname);\r\n }\r\n }else {\r\n\t$this->view->modNotEnable = true;\r\n }\r\n }else {\r\n\t\t\t// If suggestion are not available in \"Suggestion\" table but available in \"Notifications table\" then we are deleting from \"Notifications Table\".\r\n\t\t\tEngine_Api::_()->getDbtable('notifications', 'activity')->delete(array('notification_id = ?' => $notification->notification_id));\r\n\t\t\t$this->_helper->redirector->gotoRoute(array('route' => 'default'));\r\n\t\t}\r\n }",
"public function getProcNotif(){\n return $this->_data['proc_notif'];\n }",
"function friend_request_notification($logged_user_id)\n\t{\n\t\t$select = array('id');\n\t\t$where = array('uid_to' => $logged_user_id, 'notification' => 0);\n\t\t$this->db->select($select)->from('friend_request')->where($where);\n\t $query = $this->db->get();\n\n\t\treturn $query->num_rows();\n\t}",
"function sendNotification($requestedLock, $requestedUser, $registeredUser, $request_id){\n\t$fcm = $registeredUser['fcm'];\n\n\t//notification array\n\t$notification = array();\n\t$notification['title'] = \"Access Request\";\n\t$notification['body'] = $requestedUser['userName'] . \" has send you request to grant access to \" . $requestedLock['name'];\n\t$notification['icon'] = \"appicon\";\n\n\n\t//payload array\n\t$data = array();\n\t// $data['title'] = \"Lock Access Request\";\n\t$data['reqLockName'] = $requestedLock['name'];\n\t$data['reqUserName'] = $requestedUser['userName'];\n\t$data['reqRMN'] = $requestedUser['RMN'];\n\t$data['request_id'] = $request_id;\n\n\n\t$fields = array(\n\t\t'to' => $fcm,\n\t\t'notification' => $notification,\n\t\t'data' => $data,\n\t\t);\n\n\t// echo json_encode($fields);\n\tinclude \"sendFcm.php\";\n\tsendPushNotification($fields);\n}",
"public function hasRequest(): bool;",
"public function hasRequest(): bool;",
"function updateNotification(){\n $id= $_GET['id'];\n $userid = $_SESSION[ADMIN_USER_SESS_KEY]['userId'];\n $where = array('referenceId'=>$id,'notificationFor'=>$userid);\n $data = array('isRead'=>1); \n $update = $this->common_model->updateFields(NOTIFICATIONS, $data, $where);\n if($update){\n echo json_encode(array('status'=>1));die(); \n }\n }",
"public function hasPendingNotification($data_id);"
]
| [
"0.6643674",
"0.6101347",
"0.60970205",
"0.5939515",
"0.58575726",
"0.58271044",
"0.58033174",
"0.5793336",
"0.5793336",
"0.57884216",
"0.57669735",
"0.56056947",
"0.55920595",
"0.55623966",
"0.5541666",
"0.5529624",
"0.5497646",
"0.5479427",
"0.54531026",
"0.54439074",
"0.5432694",
"0.54132485",
"0.53526133",
"0.5348556",
"0.5341955",
"0.5327824",
"0.53276294",
"0.53276294",
"0.53085834",
"0.5308559"
]
| 0.7802735 | 0 |
Send tracking information action | protected function doActionSendTracking()
{
\XLite\Core\Mailer::sendOrderTrackingInformationCustomer($this->getOrder());
\XLite\Core\TopMessage::addInfo('Tracking information has been sent');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function send() {\n\n\t\t$current_time = time();\n\t\tif ( ! $this->should_send_tracking( $current_time ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$collector = $this->get_collector();\n\n\t\t$request = new WPSEO_Remote_Request( $this->endpoint );\n\t\t$request->set_body( $collector->get_as_json() );\n\t\t$request->send();\n\n\t\tupdate_option( $this->option_name, $current_time, 'yes' );\n\t}",
"public function tracking()\n {\n if (Request::has('h')) {\n $track = Tracking::getByHash(Request::input('h'));\n if ($track->isActive()) {\n $data = [\n 'tracking_id' => $track->tracking_id,\n 'data' => json_encode(Request::except('h'))\n ];\n Tracking::log($data);\n }\n }\n\n // if we have a mail_id, we update the mail status and the date where it is opened\n if (Request::has(Tracking::MAIL_ID)) {\n if (Mail::exists(uuid('bytes', Request::input(Tracking::MAIL_ID)))) {\n $mail = Mail::getById(uuid('bytes', Request::input(Tracking::MAIL_ID)));\n\n if ($mail->mail_status_id != Mail::STATUS_OPENED) {\n $mail->mail_status_id = Mail::STATUS_OPENED;\n $mail->opened_at = Carbon::now();\n $mail->save();\n }\n }\n }\n\n header('Content-type:image/jpg');\n header(\"Pragma: no-cache\");\n header(\"Cache-Control: must-revalidate, post-check=0, pre-check=0, public\");\n header(\"Expires: 0\");\n exit;\n }",
"public function track($params) {\n if (ENVIRONMENT !== 'development') {\n return $this->mp->track($params['message'], array(\"label\" => $params['action'], \"ip\" => $this->CI->input->ip_address()));\n }\n }",
"public function send(): void\n {\n $requiredParams = [\n 'v' => $this->client->getVersion(),\n 'tid' => $this->client->getTrackingId(),\n 'cid' => $this->client->getClientId(),\n 't' => $this->getHitType(),\n ];\n $paramValues = array_merge(\n $requiredParams,\n $this->parameters\n );\n \n $url = $this->getBaseUrl();\n\n $guzzle = new \\GuzzleHttp\\Client();\n $result = $guzzle->request('POST', $url, ['form_params' => $paramValues]);\n\n if ($this->client->isDebug()) {\n var_dump((string) $result->getBody());\n }\n }",
"private function track(string $action) : void {\n if (filter_input(INPUT_SERVER, 'HTTP_DNT') === '1') {\n return;\n }\n $matomoTracker = new MatomoTracker(4, 'https://stats.codepoints.net/');\n /* make sure this blocks the API as little as possible */\n $matomoTracker->setRequestTimeout(1);\n $matomoTracker->setUrlReferrer($_SERVER['HTTP_REFERER'] ?? '');\n $matomoTracker->setUserAgent($_SERVER['HTTP_USER_AGENT'] ?? '');\n $matomoTracker->disableCookieSupport();\n $matomoTracker->doTrackPageView('API v1: '.$action);\n }",
"public function track($trackingNumber);",
"public function tracking_field() {\n\t\techo cyprus_get_settings( 'mts_analytics_code' );\n\t}",
"function track(){\n\n\t\tif($params = $this->getURLParams()) {\n\n\t\t\t//different link versions, for maintaining backwards compatability\n\t\t\tif(isset($params['Version']) && $params['Version'] == \"v2\"){\n\n\t\t\t\tif($decrypted = $this->decryptHash()){\n\n\t\t\t\t\tif($recipient = DataObject::get_one(\"Newsletter_SentRecipient\",\"\\\"Email\\\" = '\".$decrypted['e'].\"' AND \\\"ParentID\\\" = \".$decrypted['nl'])){\n\t\t\t\t\t\t$recipient->recordClick();\n\t\t\t\t\t}\n\t\t\t\t\tif(isset($decrypted['l']) && is_numeric($decrypted['l']) && $link = DataObject::get_by_id('Newsletter_TrackedLink', (int)$decrypted['l'])){\n\t\t\t\t\t\t$link->recordClick();\n\t\t\t\t\t\treturn $this->redirect($link->Original, 301);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}elseif(isset($params['Hash']) && ($hash = Convert::raw2sql($params['Hash']))) {\n\t\t\t\t$link = DataObject::get_one('Newsletter_TrackedLink', \"\\\"Hash\\\" = '$hash'\");\n\t\t\t\tif($link) {\n\t\t\t\t\t// check for them visiting this link before\n\t\t\t\t\t$link->recordClick();\n\t\t\t\t\treturn $this->redirect($link->Original, 301);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn $this->httpError(404);\n\t}",
"public function sendTrackback()\n\t{\n\t\t$blog = $this->registry->getClass('blogFunctions')->loadBlog( $this->entry['blog_id'] );\n\n\t\tif ( $blog['member_id'] != $this->memberData['member_id'] )\n\t\t{\n\t\t\t$this->registry->output->showError( 'no_permission', 10693, null, null, 403 );\n\t\t}\n\n\t\tif ( !$this->settings['blog_allow_trackbackping'] )\n\t\t{\n\t\t\t$this->registry->output->showError( 'no_permission', 10694, null, null, 403 );\n\t\t}\n\n\t $this->entry['entry_sent_trackbacks'] = implode ( \"<br />\", $this->entry['entry_sent_trackbacks'] );\n\n\t\t$this->output = $this->registry->getClass('output')->getTemplate('blog_trackback')->sendTrackbackForm( $this->entry, implode ( \"<br />\", $this->ping_errors ) );\n\t\n\t\t$this->registry->output->setTitle( $this->lang->words['send_trackback_title'] );\n\t\t$this->registry->output->addContent( $this->output );\n\t\t$this->registry->getClass('blogFunctions')->sendBlogOutput( $this->blog, $this->lang->words['send_trackback_for'] .' \"' . $this->entry['entry_name'] . '\"' );\n\t}",
"public function send() {\n // listing was reported\n }",
"public static function optin_track_usage() {\n\n\t\t/** update week day for tracking */\n\t\t$track_week_day = date( 'w' );\n\t\tupdate_option( 'xl_track_day', $track_week_day, false );\n\n\t\t$data = self::collect_data();\n\n\t\t//posting data to api\n\t\tXL_API::post_tracking_data( $data );\n\t}",
"public static function maybe_track_usage() {\n\n\t\t/** checking optin state */\n\t\tif ( 'yes' == self::get_optIn_state() ) {\n\t\t\t$data = self::collect_data();\n\n\t\t\t//posting data to api\n\t\t\tXL_API::post_tracking_data( $data );\n\t\t}\n\t}",
"public function tracking() {\n\n\t\t// Return if user is logged in\n\t\tif ( is_user_logged_in() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Display tracking code\n\t\tif ( $tracking = get_theme_mod( 'tracking' ) ) {\n\t\t\techo $tracking;\n\t\t}\n\n\t}",
"function goDetail(){\n\t\t$track = new trackModel();\n\t\t$sp_id = $_POST[\"sp_id\"];\n\t\theader(\"location: ../../ApplicationLayer/ProvideTrackingAndAnalysis/ViewDeliveryDetail.php?sp_id=$sp_id\");\n\t}",
"function logAnalytics($tid,$cid,$t,$ec,$ea,$ev,$uip,$ua,$av) {\n $v=\"1\"; //version number 1\n $url = \"http://www.google-analytics.com/collect?\".\n \"v=\".urlencode($v).\n \"&tid=\".urlencode($tid).\n \"&cid=\".urlencode($cid).\n \"&t=\".urlencode($t).\n \"&ec=\".urlencode($ec).\n \"&ea=\".urlencode($ea).\n \"&el=\".urlencode($ev).\n \"&ev=\".urlencode(\"1\").\n \"&uip=\".urlencode($uip).\n \"&ua=\".urlencode($ua).\n \"&an=\".urlencode($_ENV['APP_NAME']).\n \"&av=\".urlencode($av);\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_TIMEOUT, 60);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_POST, 0 );\n $response = curl_exec($ch);\n}",
"public function track_outgoing() {\n\t\tif ( 'true' == $this->_get_options( 'log_outgoing' ) && (!defined('XMLRPC_REQUEST') || !XMLRPC_REQUEST) && ( ! is_admin() || 'false' == $this->_get_options( 'ignore_admin_area' ) ) )\n\t\t\twp_enqueue_script( 'wp-google-analytics', plugin_dir_url( __FILE__ ) . 'wp-google-analytics.js', array( 'jquery' ), '0.0.3' );\n\t}",
"function track($event, $properties=array()) {\n $params = array(\n 'event' => $event,\n 'properties' => $properties\n );\n\t\t//Check if token is passed in properties array\n if (!isset($params['properties']['token'])){\n $params['properties']['token'] = $this->token;\n }\n //create url to send an HTTP POST Request\n $url = $this->host . 'track/?data=' . base64_encode(json_encode($params));\n //Execute HTTP POST in the background\n exec(\"curl '\" . $url . \"' >/dev/null 2>&1 &\"); \n }",
"function trackPageView() {\n $timeStamp = time();\n $domainName = $_SERVER[\"SERVER_NAME\"];\n if (empty($domainName)) {\n $domainName = \"\";\n }\n\n // Get the referrer from the utmr parameter, this is the referrer to the\n // page that contains the tracking pixel, not the referrer for tracking\n // pixel.\n $documentReferer = $_GET[\"utmr\"];\n if (empty($documentReferer) && $documentReferer !== \"0\") {\n $documentReferer = \"-\";\n } else {\n $documentReferer = urldecode($documentReferer);\n }\n $documentPath = $_GET[\"utmp\"];\n if (empty($documentPath)) {\n $documentPath = \"\";\n } else {\n $documentPath = urldecode($documentPath);\n }\n\n $account = $_GET[\"utmac\"];\n $userAgent = $_SERVER[\"HTTP_USER_AGENT\"];\n if (empty($userAgent)) {\n $userAgent = \"\";\n }\n\n // Try and get visitor cookie from the request.\n $cookie = isset($_COOKIE[COOKIE_NAME]) ? $_COOKIE[COOKIE_NAME] : '';\n\n $dcmguid = isset($_SERVER[\"HTTP_X_DCMGUID\"]) ? $_SERVER[\"HTTP_X_DCMGUID\"] : '';\n $visitorId = getVisitorId(\n $dcmguid, $account, $userAgent, $cookie);\n\n // Always try and add the cookie to the response.\n setrawcookie(\n COOKIE_NAME,\n $visitorId,\n $timeStamp + COOKIE_USER_PERSISTENCE,\n COOKIE_PATH);\n\n $utmGifLocation = \"http://www.google-analytics.com/__utm.gif\";\n\n // Construct the gif hit url.\n $utmUrl = $utmGifLocation . \"?\" .\n \"utmwv=\" . VERSION .\n \"&utmn=\" . getRandomNumber() .\n \"&utmhn=\" . urlencode($domainName) .\n \"&utmr=\" . urlencode($documentReferer) .\n \"&utmp=\" . urlencode($documentPath) .\n \"&utmac=\" . $account .\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" .\n \"&utmvid=\" . $visitorId .\n \"&utmip=\" . getIP($_SERVER[\"REMOTE_ADDR\"]);\n\n sendRequestToGoogleAnalytics($utmUrl);\n\n // If the debug parameter is on, add a header to the response that contains\n // the url that was used to contact Google Analytics.\n if (!empty($_GET[\"utmdebug\"])) {\n header(\"X-GA-MOBILE-URL:\" . $utmUrl);\n }\n // Finally write the gif data to the response.\n writeGifData();\n }",
"function ga_send_pageview($hostname=null, $page=null, $title=null) {\n\tif ( $GLOBALS['ga_v'] === null ) {\n\t\t$GLOBALS['ga_v'] = 1;\n\t}\n\n\tif ( $GLOBALS['ga_cid'] === null ) {\n\t\t$GLOBALS['ga_cid'] = gaParseCookie();\n\t}\n\n\tif ( $hostname === null ) {\n\t\t$hostname = nebula_url_components('hostname');\n\t}\n\n\tif ( $page === null ) {\n\t\t$page = nebula_url_components('all');\n\t}\n\n\tif ( $title === null ) {\n\t\t$title = get_the_title();\n\t}\n\n\t$data = array(\n\t\t'v' => $GLOBALS['ga_v'],\n\t\t'tid' => $GLOBALS['ga'],\n\t\t'cid' => $GLOBALS['ga_cid'],\n\t\t't' => 'pageview',\n\t\t'dh' => $hostname, //Document Hostname \"gearside.com\"\n\t\t'dp' => $page, //Page \"/something\"\n\t\t'dt' => $title //Title\n\t);\n\tgaSendData($data);\n}",
"public function log_activity() {\n\t\t$data = array();\n\t\t$data['page'] = current_url();\n\t\t$data['ip_address'] = $this->_ci->input->ip_address();\n\t\t$data['user_agent'] = $this->_ci->agent->agent_string(); \n\t\t$data['request_method'] = $this->_ci->input->server('REQUEST_METHOD');\n\t\t$data['request_params'] = serialize($this->_ci->input->get_post(NULL, TRUE)); \n\t\t$data['uri_string'] = $this->_ci->uri->uri_string();\n\t\t$data['created_at'] = date('Y-m-d h:i:s');\n\n\t\tif($this->verify_activity()) {\n\t\t\t// And write it to the database\n\t\t\t$this->_ci->db->insert('hooks', $data);\n\t\t}\n\t}",
"public function trackOrder($trackingNo);",
"function ga_send_event($category=null, $action=null, $label=null) {\n\tif ( $GLOBALS['ga_v'] === null ) {\n\t\t$GLOBALS['ga_v'] = 1;\n\t}\n\n\tif ( $GLOBALS['ga_cid'] === null ) {\n\t\t$GLOBALS['ga_cid'] = gaParseCookie();\n\t}\n\n\t$data = array(\n\t\t'v' => $GLOBALS['ga_v'],\n\t\t'tid' => $GLOBALS['ga'],\n\t\t'cid' => $GLOBALS['ga_cid'],\n\t\t't' => 'event',\n\t\t'ec' => $category, //Category (Required)\n\t\t'ea' => $action, //Action (Required)\n\t\t'el' => $label //Label\n\t);\n\tgaSendData($data);\n}",
"public function locationTrackAction(){\n\t // Get the Request parameters\n\t\t$params = $this->getRequest()->getParams();\n\t\t$secretkey = $this->secretkey;\n\t\t$db = $this->db;\n\t\t// Genaral Information of the user login details\n\t\t$appkey\t= isset($params['appkey'])?$params['appkey']:\"\" ;\n\t\t$LoginID\t= isset($params['LoginID'])?$params['LoginID']:\"\";\n\t\t$device_id\t= isset($params['device_id'])?$params['device_id']:\"\";\n\t\t$lat\t= isset($params['lat'])?$params['lat']:\"\";\n\t\t$long\t= isset($params['long'])?$params['long']:\"\";\n\t\t$offline_sink_datetime\t= isset($params['offline_sink_datetime'])?$params['offline_sink_datetime']:\"\";\n\t\t$curr_date\t= isset($params['curr_date'])?$params['curr_date']:\"\";\n\t\t$error_code = 1;\n\t\t$succes = FALSE;\n\n\t\ttry{\n\n\t\t\t$db->beginTransaction();\n\t\t\tif($secretkey != $appkey){\n\t\t\t\tthrow new Exception(\"Invalid request.\");\n\t\t\t}\t\n\t\t\tif(!$LoginID || !$device_id || !$lat || !$long){\n\t\t\t\tthrow new Exception(\"Required parameter missing.\");\n\t\t\t}\t\t\t\n\t\t\t$user = new Application_Model_Users();\n\t\t\t$alldata = $user->getUserDataByLoginId($LoginID);\n\t\t\t$count = count($alldata);\n\t\t\tif(!empty($alldata['LoginID']) != $LoginID)\n\t\t\t{\n\t\t\t\tthrow new Exception('Invalid user.');\n\t\t\t}\n\t\t\tif(strtoupper($alldata['StaffStatus']) != 'AC'){\n\t\t\t\tthrow new Exception('Your account is not active.');\n\t\t\t}\t\n\n\t\t\t\n\n\t\t\t$StaffName = $alldata['StaffName'];\n\t\t\t$insert = array();\n\t\t\t$insert['mob_user_staff_code'] = $alldata['LoginID'];\n\t\t\t$insert['lat'] = $lat;\n\t\t\t$insert['longitude'] = $long;\n\t\t\t$insert['add_date_time'] = $offline_sink_datetime;\n\t\t\t$insertId = $user->insertLocationTrackByStaffCode($insert);\n\n\t\t\t// update user table\n\n\t\t\tif($alldata['live_on_date'] != $curr_date){\n\t\t\t\t$update['Current_latitude'] = $lat;\n\t\t\t\t$update['Current_longitude'] = $long; \n\t\t\t\t$update['live_on_date'] = $curr_date;\n\t\t\t\t$user->updateSingleTableData('logi_field_users',$update,'LoginID',$alldata['LoginID']);\n\t\t\t}\t\n\n\t\t\t$db->commit();\n\t\t\t$succes = TRUE;\t\n\t\t}\n\n\t\tcatch(Exception $e){\n\n\t\t\t//Rollback transaction\n\n\t\t\t$db->rollBack();\n\t\t\t$error= $e->getMessage();\n\t\t}\n\t\tif($succes == TRUE ){\n\t\t\techo json_encode(array(\"error_code\"=>'0', 'response_string'=>'Location track added successfully.'));\n\t\t\texit;\n\t\t}\n\n\t\telse{\n\t\t\techo json_encode(array(\"error_code\"=>$error_code, 'response_string'=>$error ));\n\t\t\texit;\n\t\t}\n\n\t}",
"function recordAnalytics() {\n\t\t//Is your user agent any of my business? Not really, but don't worry about it.\n\t\texecuteQuery(\"\n\t\t\tINSERT INTO dwm2r_activitymonitor\n\t\t\t(IPAddress,UserAgent,Flags,Seed,CreatedDTS)\n\t\t\tVALUES (\n\t\t\t\t'\".$_SERVER['REMOTE_ADDR'].\"',\n\t\t\t\t'\".$_SERVER['HTTP_USER_AGENT'].\"',\n\t\t\t\t'\".trim($_REQUEST[\"Flags\"]).\"',\n\t\t\t\t'\".$this->modder->flags[\"Seed\"].\"',\n\t\t\t\tNOW()\n\t\t\t)\n\t\t\");\n\t}",
"public function track_status_view() {\n\t\tif ( isset( $_GET['page'] ) && 'wc-status' === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) {\n\n\t\t\t$tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'status';\n\n\t\t\tWC_Tracks::record_event(\n\t\t\t\t'status_view',\n\t\t\t\tarray(\n\t\t\t\t\t'tab' => $tab,\n\t\t\t\t\t'tool_used' => isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : null,\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tif ( 'status' === $tab ) {\n\t\t\t\twc_enqueue_js(\n\t\t\t\t\t\"\n\t\t\t\t\t$( 'a.debug-report' ).click( function() {\n\t\t\t\t\t\twindow.wcTracks.recordEvent( 'status_view_reports' );\n\t\t\t\t\t} );\n\t\t\t\t\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}",
"public function requestAnalysis() {\n $this->getTransaction()->tagAsAnalysisSent($this);\n }",
"public function getAction()\n {\n $id = $this->_request->getParam('id');\n\n $item = $this->trackingService->getTrackingItem($id);\n\n if (is_null($item))\n {\n $this->sendAlteredResponse(404, 'No Tracking Term for This ID');\n }\n else\n {\n $this->view->item = $item;\n $this->render('tracking-fulfillment');\n }\n }",
"public function push_point_info() {\n\t\t$this->_check_access(); //拒绝非法IP执行任务\n\t\t$this->_write_log(__FUNCTION__);\n\t\t$this->load->model('soma/sales_point_model', 'sp_model');\n\t\t$res = $this->sp_model->push_point_info();\n\t\techo $res ? 'SUCCESS' : 'Failed';\n\t}",
"function owa_newAttachmentActionTracker($post_id) {\r\n\r\n\t$owa = owa_getInstance();\r\n\t$post = get_post($post_id);\r\n\t$label = $post->post_title;\r\n\t$owa->trackAction('wordpress', 'Attachment Created', $label);\r\n}",
"function action_track() {\n if(model_user::userLoggedIn()) {\n // Include view for this page.\n @include_once APP_PATH . 'view/track_page.tpl.php';\n } else {\n header('Location: /home/login');\n }\n }"
]
| [
"0.7096486",
"0.69358945",
"0.682453",
"0.66931885",
"0.6634788",
"0.6488563",
"0.6303943",
"0.6158637",
"0.61554414",
"0.60706013",
"0.6038399",
"0.6023353",
"0.59689826",
"0.5925139",
"0.58939123",
"0.588489",
"0.582733",
"0.58154535",
"0.58126307",
"0.58042836",
"0.57786304",
"0.5767827",
"0.5760873",
"0.57496136",
"0.57428324",
"0.56907237",
"0.56240153",
"0.5621222",
"0.5613195",
"0.5580811"
]
| 0.8014362 | 0 |
Get prepared order item by item ID | protected function getPreparedItemByItemId()
{
$order = $this->getOrder();
$request = \XLite\Core\Request::getInstance();
$attributeValues = array();
$item = $order->getItemByItemId($request->item_id);
if (
$item
&& !empty($request->order_items[$request->item_id])
&& !empty($request->order_items[$request->item_id]['attribute_values'])
) {
$attributeValues = $request->order_items[$request->item_id]['attribute_values'];
}
return array($item, $attributeValues);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function orderItem(): OrderItem\n {\n return $this->order_item;\n }",
"abstract protected function get_item_from_db($item_id);",
"function get ($id) {\n // PARAM $id : order ID\n\n $order = $this->fetch(\n \"SELECT * FROM `orders` WHERE `order_id`=?\", [$id]\n );\n $order['items'] = $this->fetch(\n \"SELECT * FROM `orders_items` LEFT JOIN `products` USING (`product_id`) WHERE `orders_items`.order_id=?\", \n [$id], \"product_id\"\n );\n return $order;\n }",
"protected function getPreparedItemByProductId()\n {\n $order = $this->getOrder();\n $request = \\XLite\\Core\\Request::getInstance();\n $item = new \\XLite\\Model\\OrderItem;\n $item->setOrder($order);\n $item->setProduct(\\XLite\\Core\\Database::getRepo('XLite\\Model\\Product')->find($request->product_id));\n\n $attributes = $request->new;\n $attributes = reset($attributes);\n $attributeValues = array();\n if (!empty($attributes['attribute_values'])) {\n $attributeValues = $attributes['attribute_values'];\n }\n\n return array($item, $attributeValues);\n }",
"protected function getOrderItemObjectByIdOrUuid($id)\n {\n \n if ($this->orderItem == null) {\n \n if (preg_match('/^\\d{1,}$/', $id, $res)) {\n $orderItem = OrderItemPeer::retrieveById($id);\n }\n else {\n $orderItem = OrderItemPeer::retrieveByUuid($id);\n }\n \n $this->forward404Unless($orderItem);\n $this->forward404Unless($orderItem->getMemberId() == $this->getUser()->getUserId());\n $this->orderItem = $orderItem;\n }\n \n return $this->orderItem;\n }",
"private function insertOrdemItem($item, $orderID) {\n $ordemItem = new OrderItem();\n $ordemItem->orderID = $orderID;\n $ordemItem->ISBN = $item['ISBN'];\n $ordemItem->qty = $item['quantity'];\n $ordemItem->price = $item['price'];\n $ordemItem->save();\n }",
"public function getId()\n {\n return $this->source['order_item_id'];\n }",
"public function getorderitembyid($orderid){\n\t\t$this->db->where('OrdId', $orderid);\n\t\t$this->db->select('LintItemId,OrdId,ItemId,ItemName,ItemEdition,ItemAuther,ItemQuantity,ItemRetailPrice,ItemSellingPrice,ItemDiscount,ProductThumbImage,ProductLanguage');\n\t\t$this->db->from('tbl_order_lineitems');\n\t\t$this->db->join('tbl_products', 'tbl_products.ProductId = tbl_order_lineitems.ItemId', 'inner');\n\t\t$query=$this->db->get();\n\t\treturn $query->result();\n\t\t// $query=$this->db->get('tbl_order_lineitems');\n\t\t// return $query->result();\n\t}",
"public function orderItem($param) { \n if (!$this->aaa->has_right('openruth', 500))\n $res->orderItemError->_value = 'authentication_error';\n else {\n $targets = $this->config->get_value('ruth', 'ztargets');\n $agencyId = self::strip_agency($param->agencyId->_value);\n if ($tgt = $targets[$agencyId]) {\n // build order\n $ord = &$order->Reservation->_value;\n $ord->LibraryNo->_value = $agencyId;\n $ord->BorrowerTicketNo->_value = $param->userId->_value;\n $ord->DisposalNote->_value = $param->orderNote->_value;\n $ord->LastUseDate->_value = self::to_zruth_date($param->orderLastInterestDate->_value);\n $ord->ServiceCounter->_value = $param->agencyCounter->_value;\n $ord->Override->_value = (self::xs_true($param->agencyCounter->_value) ? 'Y' : 'N');\n $ord->Priority->_value = $param->orderPriority->_value;\n // ?????? $ord->DisposalType->_value = $param->xxxx->_value;\n $itemIds = &$param->orderItemId;\n if (is_array($itemIds))\n foreach ($itemIds as $oid) {\n $mrid->ID->_value = $oid->_value->itemId->_value;\n if (!$mrid->TitlePartNo->_value = $oid->_value->itemSerialPartId->_value)\n $mrid->TitlePartNo->_value = 0;\n $ord->MRIDS->_value->MRID[]->_value = $mrid;\n }\n else {\n $mrid->ID->_value = $itemIds->_value->itemId->_value;\n if (!$mrid->TitlePartNo->_value = $itemIds->_value->itemSerialPartId->_value)\n $mrid->TitlePartNo->_value = 0;\n $ord->MRIDS->_value->MRID->_value = $mrid;\n }\n $xml = '<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?'.'>' . utf8_decode($this->objconvert->obj2xml($order));\n \n//print_r($ord);\n//print_r($xml);\n \n $z = new z3950();\n $z->set_target($tgt['host']);\n $z->set_database($tgt['database'].'-ophelia');\n $z->set_authentication($tgt['authentication']);\n if ($tgt['proxy']) {\n $z->set_proxy($tgt['proxy']);\n }\n $xml_ret = $z->z3950_xml_update($xml, $tgt['timeout']);\n if ($z->get_errno() == 0 && $xml_ret['xmlUpdateDoc']) {\n $dom = new DomDocument();\n $dom->preserveWhiteSpace = false;\n if ($dom->loadXML($xml_ret['xmlUpdateDoc'])) {\n if ($err = &$dom->getElementsByTagName('ErrorResponse')->item(0)) {\n verbose::log(ERROR, __FUNCTION__ . ' (' . __LINE__ . ') errno: ' . $err->getAttribute('Err') . \n ' error: ' . $err->nodeValue);\n $res->orderItemError->_value = 'unspecified error, order not possible';\n } else {\n // order at least partly ok \n foreach ($dom->getElementsByTagName('MRID') as $mrid) {\n unset($ir);\n $ir->orderItemId->_value->itemId->_value = $mrid->getAttribute('Id');\n if ($mrid->getAttribute('Tp'))\n $ir->orderItemId->_value->itemSerialPartId->_value = $mrid->getAttribute('Tp');\n if (!$mrid->nodeValue)\n $ir->orderItemOk->_value = 'true';\n elseif (!($ir->orderItemError->_value = $this->errs[$mrid->nodeValue])) \n $ir->orderItemError->_value = 'unknown error: ' . $mrid->nodeValue;\n $res->orderItem[]->_value = $ir;\n }\n }\n }\n } else {\n self::log_z_error(__FUNCTION__, __LINE__, $agencyId, $z->get_errno(), $z->get_error_string());\n $res->orderItemError->_value = 'system error';\n }\n//echo \"\\n\";\n//print_r($xml_ret);\n//print_r(\"\\nError: \" . $z->get_errno());\n } else\n $res->orderItemError->_value = 'unknown agencyId';\n }\n\n $ret->orderItemResponse->_value = $res;\n //var_dump($param); var_dump($res); die();\n return $ret;\n }",
"function getItemById($itemID) {\n global $dbh;\n $stmt = $dbh->prepare(\"SELECT * FROM ITEM WHERE itemID = ?\");\n $stmt->execute(array($itemID));\n return $stmt->fetch();\n }",
"public function getItem( $id );",
"public function item($order)\n {\n return SiteMaintenanceItem::where('main_id', $this->id)->where('order', $order)->first();\n }",
"abstract public function getByItemId($itemId);",
"function wcs_get_order_items_product_id( $item_id ) {\n\tglobal $wpdb;\n\n\t$product_id = $wpdb->get_var( $wpdb->prepare(\n\t\t\"SELECT meta_value FROM {$wpdb->prefix}woocommerce_order_itemmeta\n\t\t WHERE order_item_id = %d\n\t\t AND meta_key = '_product_id'\",\n\t\t$item_id\n\t) );\n\n\treturn $product_id;\n}",
"protected function getOrderItem()\n\t{\n\t\t$search = $this->object->createSearch();\n\n\t\t$expr = [];\n\t\t$expr[] = $search->compare( '==', 'order.base.rebate', 14.50 );\n\t\t$expr[] = $search->compare( '==', 'order.base.sitecode', 'unittest' );\n\t\t$expr[] = $search->compare( '==', 'order.base.price', 53.50 );\n\t\t$expr[] = $search->compare( '==', 'order.base.editor', $this->editor );\n\t\t$search->setConditions( $search->combine( '&&', $expr ) );\n\t\t$results = $this->object->searchItems( $search );\n\n\t\tif( ( $item = reset( $results ) ) === false ) {\n\t\t\tthrow new \\RuntimeException( 'No order found' );\n\t\t}\n\n\t\treturn $item;\n\t}",
"public function getItem ($id);",
"public function addItem($order_id)\n\t{\n\n\n\t\t$order = Order::where('id',$order_id)->first();\n\t\t\n\t\t$product = Product::where('id',Input::get('id'))->first();\n\t\t\n\t\t$item = array(\n\t\t\t\t\t'order_id' => $order_id,\n\t\t\t\t\t'product_id' => Input::get('id'),\n\t\t\t\t\t'quantity' => Input::get('quantity'),\n\t\t\t\t\t'name' => $product['name'],\n\t\t\t\t\t'price' => $product['price'],\n\t\t\t\t\t'cost' => $product['cost']\n\n\t\t\t\t);\n\n\t\t$order_item = OrderItem::create($item);\n\t\t\t$order->sync();\n\t\treturn $order_id;\n\t}",
"public function obtenerItem($id) {\n return $this\n ->reiniciar()\n ->donde([\n 'id'=>$id\n ])\n ->obtenerUno();\n }",
"public function retrieveItem($id) {\n return $this->itemsDB->retrieve($id);\n }",
"function eZOrderItem( $id=\"\", $fetch=true )\n {\n $this->IsConnected = false;\n\n if ( $id != \"\" )\n {\n $this->ID = $id;\n if ( $fetch == true )\n {\n \n $this->get( $this->ID );\n }\n else\n {\n $this->State_ = \"Dirty\";\n }\n }\n else\n {\n $this->State_ = \"New\";\n }\n }",
"function getItem($db, $resource_pk, $item_pk) {\r\n\r\n $item = new Item();\r\n\r\n if (!empty($item_pk)) {\r\n $prefix = DB_TABLENAME_PREFIX;\r\n $sql = <<< EOD\r\nSELECT i.item_pk, i.item_title, i.item_text, i.item_url, i.max_rating mr, i.step st, i.visible vis, i.sequence seq, i.created cr, i.updated upd\r\nFROM {$prefix}item i\r\nWHERE (i.resource_link_pk = :resource_pk) AND (i.item_pk = :item_pk)\r\nEOD;\r\n\r\n $query = $db->prepare($sql);\r\n $query->bindValue('resource_pk', $resource_pk, PDO::PARAM_INT);\r\n $query->bindValue('item_pk', $item_pk, PDO::PARAM_INT);\r\n $query->setFetchMode(PDO::FETCH_CLASS, 'Item');\r\n $query->execute();\r\n\r\n $row = $query->fetch();\r\n if ($row !== FALSE) {\r\n $item = $row;\r\n }\r\n }\r\n\r\n return $item;\r\n\r\n }",
"function getId_item()\n {\n if (!isset($this->iid_item) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iid_item;\n }",
"function getId_item()\n {\n if (!isset($this->iid_item) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iid_item;\n }",
"function getId_item()\n {\n if (!isset($this->iid_item) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iid_item;\n }",
"function getPlayerWarehouseItem($player_id, $item_id)\n{\n global $db;\n return $db->where(\"player_id\", $player_id)\n ->where(\"item_id\", $item_id)\n ->getOne(\"warehouse\", \"quantity\");\n}",
"function getOrderbyId($order_id){\n\t\t$conn \t= connectDB();\n\t\t$sth \t= $conn \t-> prepare('SELECT *\n\t\t\t\t\t\t\t\t\t\tFROM `order`\n\t\t\t\t\t\t\t\t\t\tWHERE `id` = ? ');\n\t\t$sth \t-> execute(array($order_id));\n\t\treturn \t$sth;\n\t}",
"function getItemInfo($id){\n $item = $this->order_model->getItemById($id);\n if($item == NULL) return $item;\n\n // get provider information\n $providerinfo = $this->user_model->getUserInfoByid($item->provider);\n $item->provider_id = $providerinfo->userid;\n $item->provider_name = $providerinfo->username;\n\n // get ship man information\n $shipman_info = $this->user_model->getUserInfoByid($item->ship_man);\n $item->shipman_name = isset($shipman_info->username) ? $shipman_info->username : '';\n $item->shipman_phone = isset($shipman_info->contact_phone) ? $shipman_info->contact_phone : '';\n\n // get activity information\n $activity = $this->activity_model->getItemById($item->activity_ids);\n $activity->products = json_decode($item->product_info);\n $activity->cnt = $item->activity_cnts;\n // $activity->products = $this->activity_model->getProductsFromIds($activity->product_id, $activity->provider_id);\n\n $item->activity = $activity;\n\n return $item;\n }",
"public function getItemById($it_id)\n\t{\n\t\treturn \\ORM::for_table($this->table)->where('it_id', $it_id)->find_one();\n\t}",
"protected function getOrderItemRequest($order_id, $order_item_id)\n {\n // verify the required parameter 'order_id' is set\n if ($order_id === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $order_id when calling getOrderItem'\n );\n }\n if ($order_id < 1) {\n throw new \\InvalidArgumentException('invalid value for \"$order_id\" when calling DefaultApi.getOrderItem, must be bigger than or equal to 1.');\n }\n // verify the required parameter 'order_item_id' is set\n if ($order_item_id === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $order_item_id when calling getOrderItem'\n );\n }\n if ($order_item_id < 1) {\n throw new \\InvalidArgumentException('invalid value for \"$order_item_id\" when calling DefaultApi.getOrderItem, must be bigger than or equal to 1.');\n }\n $resourcePath = '/orders/{orderId}/items/{orderItemId}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // path params\n if ($order_id !== null) {\n $resourcePath = str_replace(\n '{' . 'orderId' . '}',\n ObjectSerializer::toPathValue($order_id),\n $resourcePath\n );\n }\n // path params\n if ($order_item_id !== null) {\n $resourcePath = str_replace(\n '{' . 'orderItemId' . '}',\n ObjectSerializer::toPathValue($order_item_id),\n $resourcePath\n );\n }\n // body params\n $_tempBody = null;\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n \n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n \n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function get_item_by_item_id($itemID) {\n return $this->query(\"SELECT * FROM items WHERE item_id = '\" . $itemID . \"'\");\n }"
]
| [
"0.6799751",
"0.6791881",
"0.67702055",
"0.67607194",
"0.64836586",
"0.6447149",
"0.6423919",
"0.63694566",
"0.6281316",
"0.6258854",
"0.62148386",
"0.6195342",
"0.6160584",
"0.61438626",
"0.6110145",
"0.60998774",
"0.6099098",
"0.6088165",
"0.60572946",
"0.6036679",
"0.60159665",
"0.5996656",
"0.5996656",
"0.5996656",
"0.5995707",
"0.5990153",
"0.5989782",
"0.5983698",
"0.5982591",
"0.59787667"
]
| 0.70900923 | 0 |
Get prepared order item by product ID | protected function getPreparedItemByProductId()
{
$order = $this->getOrder();
$request = \XLite\Core\Request::getInstance();
$item = new \XLite\Model\OrderItem;
$item->setOrder($order);
$item->setProduct(\XLite\Core\Database::getRepo('XLite\Model\Product')->find($request->product_id));
$attributes = $request->new;
$attributes = reset($attributes);
$attributeValues = array();
if (!empty($attributes['attribute_values'])) {
$attributeValues = $attributes['attribute_values'];
}
return array($item, $attributeValues);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get ($id) {\n // PARAM $id : order ID\n\n $order = $this->fetch(\n \"SELECT * FROM `orders` WHERE `order_id`=?\", [$id]\n );\n $order['items'] = $this->fetch(\n \"SELECT * FROM `orders_items` LEFT JOIN `products` USING (`product_id`) WHERE `orders_items`.order_id=?\", \n [$id], \"product_id\"\n );\n return $order;\n }",
"function wcs_get_order_items_product_id( $item_id ) {\n\tglobal $wpdb;\n\n\t$product_id = $wpdb->get_var( $wpdb->prepare(\n\t\t\"SELECT meta_value FROM {$wpdb->prefix}woocommerce_order_itemmeta\n\t\t WHERE order_item_id = %d\n\t\t AND meta_key = '_product_id'\",\n\t\t$item_id\n\t) );\n\n\treturn $product_id;\n}",
"function LoadProduct($orderid) {\n\t$proids = array();\n\t$factory = \\woo\\mapper\\PersistenceFactory::getFactory(\"orderproduct\",array('id','orderid','proid','number','price','returnnow','modlcharge'));\n\t$finder = new \\woo\\mapper\\DomainObjectAssembler($factory);\n\t$idobj = $factory->getIdentityObject()->field('orderid')->eq($orderid);\n\t$order_pro = $finder->find($idobj);\n\n\t$factory = \\woo\\mapper\\PersistenceFactory::getFactory(\"product\",array('id','classid','length','width','think','unitlen','unitwid','unitthi','unit','sharp','note'));\n\t$finder = new \\woo\\mapper\\DomainObjectAssembler($factory);\n\t$pro = $order_pro->next();\n\t$i = 0;\n\t$data = array();\n\twhile($pro){\n\t\t$data[$i][0] = $i+1;\n\t\t$idobj = $factory->getIdentityObject()->field('id')->eq($pro->getProid());\n\t\t$collection = $finder->find($idobj);\n\t\t$product = $collection->current();\n\t\t$data[$i][1] = $product->getSize();\n\t\t$data[$i][2] = $pro->getNumber();\n\t\t$price = $pro->getPrice()-$pro->getReturnnow();\n\t\t$data[$i][3] = sprintf(\"%.2f\",$price);\n\t\t$data[$i][4] = sprintf(\"%.2f\",$price*$data[$i][2]);\n\t\t$i++;\n\t\t$pro = $order_pro->next();\n\t}\n\treturn $data;\n}",
"static function get_orders_by_product_id($product_id, $offset = null, $per_page = null ) {\n\n global $wpdb;\n $tabelaOrderItemMeta = $wpdb->prefix . 'woocommerce_order_itemmeta';\n $tabelaOrderItems = $wpdb->prefix . 'woocommerce_order_items';\n $limiter_str = '';\n\n if( $offset !== null && $per_page !== null ) {\n $limiter_str = \" LIMIT $offset, $per_page \";\n }\n\n if( is_array( $product_id ) ) {\n\n echo \"SELECT b.order_id, a.meta_value as product_id\nFROM {$tabelaOrderItemMeta} a, {$tabelaOrderItems} b\nWHERE a.meta_key = '_product_id'\nAND a.meta_value IN (%s)\nAND a.order_item_id = b.order_item_id\nORDER BY b.order_id DESC $limiter_str\";\n\n $results = $wpdb->get_results(\n $wpdb->prepare(\n \"SELECT b.order_id, a.meta_value as product_id\nFROM {$tabelaOrderItemMeta} a, {$tabelaOrderItems} b\nWHERE a.meta_key = '_product_id'\nAND a.meta_value IN (%s)\nAND a.order_item_id = b.order_item_id\nORDER BY b.order_id DESC $limiter_str\",\n\n implode(',', $product_id ) //array('336','378')\n )\n );\n } else {\n $results = $wpdb->get_results(\n $wpdb->prepare(\n \"SELECT b.order_id\nFROM {$tabelaOrderItemMeta} a, {$tabelaOrderItems} b\nWHERE a.meta_key = '_product_id'\nAND a.meta_value = %s\nAND a.order_item_id = b.order_item_id\nORDER BY b.order_id DESC $limiter_str\",\n $product_id\n )\n );\n }\n\n\n if ($results) {\n\n $order_ids = array();\n foreach ($results as $item)\n array_push($order_ids, $item->order_id);\n\n if ($order_ids) {\n $args = array(\n 'post_type' => 'shop_order',\n 'post_status' => array('wc-processing', 'wc-completed'),\n 'posts_per_page' => -1,\n 'post__in' => $order_ids,\n 'fields' => 'ids'\n );\n $query = new WP_Query($args);\n return $query;\n }\n }\n\n return false;\n }",
"protected function getOrderProduct()\n\t{\n\t\t$priceManager = \\Aimeos\\MShop\\Factory::createManager( $this->context, 'price' );\n\t\t$productManager = \\Aimeos\\MShop\\Factory::createManager( $this->context, 'product' );\n\t\t$orderProductManager = \\Aimeos\\MShop\\Factory::createManager( $this->context, 'order/base/product' );\n\n\t\t$price = $priceManager->createItem();\n\t\t$price->setValue( '20.00' );\n\n\t\t$product = $productManager->createItem();\n\t\t$product->setCode( 'test' );\n\n\t\t$orderProduct = $orderProductManager->createItem();\n\t\t$orderProduct->copyFrom( $product );\n\t\t$orderProduct->setPrice( $price );\n\n\t\treturn $orderProduct;\n\t}",
"public function getorderitembyid($orderid){\n\t\t$this->db->where('OrdId', $orderid);\n\t\t$this->db->select('LintItemId,OrdId,ItemId,ItemName,ItemEdition,ItemAuther,ItemQuantity,ItemRetailPrice,ItemSellingPrice,ItemDiscount,ProductThumbImage,ProductLanguage');\n\t\t$this->db->from('tbl_order_lineitems');\n\t\t$this->db->join('tbl_products', 'tbl_products.ProductId = tbl_order_lineitems.ItemId', 'inner');\n\t\t$query=$this->db->get();\n\t\treturn $query->result();\n\t\t// $query=$this->db->get('tbl_order_lineitems');\n\t\t// return $query->result();\n\t}",
"function get_product_by_id($product_id) {\r\n try {\r\n $params[0] = array(\"name\" => \":prod_id\", \"value\" => &$product_id);\r\n return $this->DBObject->readCursor(\"product_actions.get_product_by_id(:prod_id)\", $params);\r\n } catch (Exception $ex) {\r\n echo \">>\" . ex;\r\n }\r\n }",
"public function orderItem(): OrderItem\n {\n return $this->order_item;\n }",
"function get_product_by_id($id)\n{\n $db = get_connection();\n\n $sql = <<<SQL\n SELECT *\n FROM products\n WHERE\n id = :id\nSQL;\n\n $statement = $db->prepare($sql);\n $statement->execute([\n ':id' => $id,\n ]);\n\n $product = (array) $statement->fetch(PDO::FETCH_ASSOC);\n $product['images'] = get_images($product['id']);\n\n return $product;\n}",
"public function getOrder()\n {\n echo json_encode($this->Inventory_model->getProductById($_POST['idJson']));\n }",
"protected function getPreparedItemByItemId()\n {\n $order = $this->getOrder();\n $request = \\XLite\\Core\\Request::getInstance();\n $attributeValues = array();\n $item = $order->getItemByItemId($request->item_id);\n\n if (\n $item\n && !empty($request->order_items[$request->item_id])\n && !empty($request->order_items[$request->item_id]['attribute_values'])\n ) {\n $attributeValues = $request->order_items[$request->item_id]['attribute_values'];\n }\n\n return array($item, $attributeValues);\n }",
"public function getProductById(int $id);",
"public function GetProductAccordingToProductID($productID){\n\t\n\ttry\n\t{\n\t\t$conn = DBConnection::GetConnection();\n\t\t$myquery= \"SELECT product_id,product_name,unit_price,image_name,description,category,quantity_in_stock FROM product where product_id='\".$productID.\"' \";\n\t\t$result= $conn->query($myquery);\n\t\t\n\t\t$p1= new Product();\n\t\tforeach($result as $item){\n\t\t\t\t\t\t\n\t\t\t $p1->productCode =$item[\"product_id\"];\n\t\t\t $p1->productName =$item[\"product_name\"];\n\t\t\t $p1->price =$item[\"unit_price\"];\n\t\t\t $p1->imageName=$item[\"image_name\"];\t\t\t \n\t\t\t $p1->description =$item[\"description\"];\n\t\t\t $p1->cate=$item[\"category\"];\n\t\t\t $p1->qty=$item[\"quantity_in_stock\"];\t\t\t\n\t\t\t\n\t\t}\n\t\t$conn =null;//To close the connection \n\t\treturn $p1;\n\t}\n\tcatch(PDOException $e)\n\t{\n\t\techo 'Fail to connect';\n\t\techo $e->getMessage();\n\t}\t\n\t\t\n\t}",
"public function getOrderProductData($sellerId,$orderId,$productId){\r\n \t/**\r\n \t * Load commission model\r\n \t */\r\n $productData = Mage::getModel('marketplace/commission')->getCollection()\r\n ->addFieldToFilter('seller_id',$sellerId)\r\n ->addFieldToFilter('order_id',$orderId) \r\n ->addFieldToFilter('product_id',$productId)->getFirstItem();\r\n /**\r\n * Return product data\r\n */\r\n return $productData; \r\n }",
"public static function getOrderPurchase($id)\n {\n $orders = DB::query(\"SELECT orderproducts.*, products.strName, products.strDescription, products.strFeatures, products.price, products.category_id, products.status_id, orders.totalAmount, orders.date, inventoryproducts.name AS inventoryproductsname\n FROM orderproducts\n LEFT JOIN orders ON orderproducts.orderId=orders.id\n LEFT JOIN products ON orderproducts.productId=products.id\n LEFT JOIN inventoryproducts ON products.inventoryproductsId=inventoryproducts.id\n WHERE orderproducts.orderId=\".$id);\n //if no id given\n if($orders == \"\"){\n $ordersArray =(object) array(\n \"id\" => \"0\",\n \"userId\" => \"0\",\n \"orderId\" => \"0\",\n 'productId' => '0',\n 'quantity' => \"0\",\n 'total' => \"0\",\n 'strName' => 'No patch',\n 'strDescription' => '',\n 'strFeatures' => '',\n 'price' => '',\n 'countryId' => '',\n 'category_id' => '',\n 'status_id' => '',\n 'totalAmount' => '',\n 'date' => '',\n 'inventoryproductsname'=>'',\n );\n return $ordersArray;\n }\n\n // acting as a factory\n // empty array to avoid errors when nothing was found\n $ordersArray = array();\n foreach($orders as $order)\n {\n // create an instance / object for this SPECIFIC \n $ordersArray[] = new OrdersAdmin($order); // put this object onto the array\n }\n // return the list of objects\n return $ordersArray;\n }",
"public function addItem($order_id)\n\t{\n\n\n\t\t$order = Order::where('id',$order_id)->first();\n\t\t\n\t\t$product = Product::where('id',Input::get('id'))->first();\n\t\t\n\t\t$item = array(\n\t\t\t\t\t'order_id' => $order_id,\n\t\t\t\t\t'product_id' => Input::get('id'),\n\t\t\t\t\t'quantity' => Input::get('quantity'),\n\t\t\t\t\t'name' => $product['name'],\n\t\t\t\t\t'price' => $product['price'],\n\t\t\t\t\t'cost' => $product['cost']\n\n\t\t\t\t);\n\n\t\t$order_item = OrderItem::create($item);\n\t\t\t$order->sync();\n\t\treturn $order_id;\n\t}",
"public function getId()\n {\n return $this->source['order_item_id'];\n }",
"function getOrderProducts($order_id){\n\t\t$conn \t= connectDB();\n\t\t$sth \t= $conn \t-> prepare('SELECT *\n\t\t\t\t\t\t\t\t\t\tFROM `order_products`\n\t\t\t\t\t\t\t\t\t\tWHERE `order_id` = ? ');\n\t\t$sth \t-> execute(array($order_id));\n\t\treturn \t$sth;\n\t}",
"function apptivo_ecommerce_product( $id) {\n\t\t\n\t\t$this->id = (int)$id;\t\t\n\t\t$app_item_id = get_post_meta($this->id,'_apptivo_item_id',true); \n\t\t$app_item_uom_id = get_post_meta($this->id,'_apptivo_item_uom_id',true);\n\t\t$app_item_manufactured_id = get_post_meta($this->id,'_apptivo_item_manufactured_id',true); \n\t\t$this->product_custom_fields = get_post_custom( $this->id );\t\t\n\t\t$this->exists = (sizeof($this->product_custom_fields)>0) ? true : false;\n\t\t// Define the data we're going to load: Key => Default value\n\t\t$load_data = array(\n\t\t\t'_apptivo_item_code'\t\t\t=> $this->id,\n\t\t '_apptivo_track_color' => '',\n\t\t '_apptivo_track_size' => '',\t\n\t\t\t'_apptivo_sale_price'\t=> '',\n\t\t\t'_apptivo_regular_price' => '',\t\t\t\n\t\t '_apptivo_item_id' => $awpItemId,//$app_item_id,\n\t\t '_apptivo_item_uom_id' => $awpItem_UOMId,//$_apptivo_item_uom_id\n\t\t\t'_apptivo_item_manufactured_id' => $app_item_manufactured_id\t \n\t\t);\n\t\t\n\t\t// Load the data from the custom fields\n\t\tforeach ($load_data as $key => $default) :\n\t\t\t$this->$key = (isset($this->product_custom_fields[$key][0]) && $this->product_custom_fields[$key][0]!=='') ? $this->product_custom_fields[$key][0] : $default;\n\t\tendforeach;\n\t\t\n\t\t// Load serialised data, unserialise twice to fix WP bug\n\t\tif (isset($this->product_custom_fields['product_attributes'][0])) $this->attributes = maybe_unserialize( maybe_unserialize( $this->product_custom_fields['product_attributes'][0] )); else $this->attributes = array();\t\t\n\t\t\t\t\t\t\n\t\t\n\t}",
"public function getOrderProduct($id)\n\t {\n\t\t $this->db->select(\"COP.*\");\n\t\t $this->db->from(\"client_order_prodcts AS COP\");\n\t\t $this->db->where(\"COP.id\", $id);\n\t\t $this->db->limit(1);\n\t\t $query_order_prod_row = $this->db->get();\n\t\t\t\n\t\t\tif($query_order_prod_row->num_rows()>0)\n\t\t\t{\n\t\t\t\treturn $query_order_prod_row->result_array();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn array();\n\t\t\t}\n\t }",
"public function getConcreteProduct(int $id): ApiItemTransfer;",
"public function getProduct($id)\n {\n }",
"protected function getOrderItem()\n\t{\n\t\t$search = $this->object->createSearch();\n\n\t\t$expr = [];\n\t\t$expr[] = $search->compare( '==', 'order.base.rebate', 14.50 );\n\t\t$expr[] = $search->compare( '==', 'order.base.sitecode', 'unittest' );\n\t\t$expr[] = $search->compare( '==', 'order.base.price', 53.50 );\n\t\t$expr[] = $search->compare( '==', 'order.base.editor', $this->editor );\n\t\t$search->setConditions( $search->combine( '&&', $expr ) );\n\t\t$results = $this->object->searchItems( $search );\n\n\t\tif( ( $item = reset( $results ) ) === false ) {\n\t\t\tthrow new \\RuntimeException( 'No order found' );\n\t\t}\n\n\t\treturn $item;\n\t}",
"public function create(OrderProduct $item): OrderProduct;",
"public function getProductData()\n {\n // use\n //$this->request->getParams(); // all params\n $id= $this->request->getParam('param');\n $product = $this->_product->create()->load($id);\n return $product;\n\n }",
"public function getById($id)\n {\n return $this->product->find($id);\n \n }",
"function getProductbyId($id){\n\t\t$conn \t= connectDB();\n\t\t$sth \t= $conn->prepare(\"\tSELECT * \n\t\t\t\t\t\t\t\t\tFROM `product` \n\t\t\t\t\t\t\t\t\tWHERE `stock` > 0 AND `id` = ?\");\n\t\t$sth \t->execute(array($id));\n\n\t\treturn \t$sth;\n\t}",
"function get_product($product_id){\n\t\t\n\t\treturn $this->_make_api_call($product_id,'products');\n\t}",
"protected function getOrderItemObjectByIdOrUuid($id)\n {\n \n if ($this->orderItem == null) {\n \n if (preg_match('/^\\d{1,}$/', $id, $res)) {\n $orderItem = OrderItemPeer::retrieveById($id);\n }\n else {\n $orderItem = OrderItemPeer::retrieveByUuid($id);\n }\n \n $this->forward404Unless($orderItem);\n $this->forward404Unless($orderItem->getMemberId() == $this->getUser()->getUserId());\n $this->orderItem = $orderItem;\n }\n \n return $this->orderItem;\n }",
"function getItemFromProducts($id) {\n\t\t$saleData = array();\n\t\t\t\tif($stmt = $this->connection->prepare(\"select * from products WHERE id = \" . $id . \";\")) {\n\t\t\t\t\t\t$stmt -> execute();\n\n\t\t\t\t\t\t$stmt->store_result();\n\t\t\t\t\t\t$stmt->bind_result($id, $itemName, $itemImage, $itemDesc, $salePrice, $regularPrice, $numberLeft);\n\n\t\t\t\t\t\tif($stmt ->num_rows >0){\n\t\t\t\t\t\t\twhile($stmt->fetch() ){\n\t\t\t\t\t\t\t\t$saleData[] = array(\n\t\t\t\t\t\t\t\t\t'id' =>$id,\n\t\t\t\t\t\t\t\t\t'itemName' => $itemName,\n\t\t\t\t\t\t\t\t\t'itemImage' => $itemImage,\n\t\t\t\t\t\t\t\t\t'itemDesc' => $itemDesc,\n\t\t\t\t\t\t\t\t\t'salePrice' => $salePrice,\n\t\t\t\t\t\t\t\t\t'regularPrice' => $regularPrice,\n\t\t\t\t\t\t\t\t\t'numberLeft' => $numberLeft\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn $saleData;\n\t}"
]
| [
"0.6987807",
"0.6941106",
"0.6567726",
"0.65455526",
"0.6513611",
"0.64331913",
"0.6419966",
"0.63701236",
"0.6341698",
"0.6336752",
"0.63304436",
"0.63212365",
"0.63177216",
"0.6311726",
"0.6239149",
"0.621374",
"0.62045896",
"0.6192897",
"0.61899745",
"0.618471",
"0.6162",
"0.615811",
"0.61477077",
"0.6135461",
"0.6123493",
"0.61077315",
"0.60950905",
"0.60831666",
"0.6054225",
"0.6029633"
]
| 0.748813 | 0 |
Prepare order item before price calculation | protected function prepareItemBeforePriceCalculation(\XLite\Model\OrderItem $item, array $attributes)
{
\XLite\Core\Request::getInstance()->oldAmount = $item->getAmount();
$item->setAmount(\XLite\Core\Request::getInstance()->amount);
if ($attributes) {
$attributeValues = $item->getProduct()->prepareAttributeValues($attributes);
$item->setAttributeValues($attributeValues);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function salesConvertQuoteItemToOrderItem(Varien_Event_Observer $observer)\n{\n$quoteItem = $observer->getItem();\n if ($additionalOptions = $quoteItem->getOptionByCode('additional_options')) {\n $orderItem = $observer->getOrderItem();\n $options = $orderItem->getProductOptions();\n $options['additional_options'] = unserialize($additionalOptions->getValue());\n$var;\nif (count($options['additional_options'] > 0)) {\n if ($options['additional_options'][0]['value'] != '') \n $i = 0;\n $val = $options['additional_options'][0]['value'];\n\n}\n//Mage::log($val.\" trgy\");\n$orderItem->setCredits($val);\n $orderItem->setProductOptions($options);\n }\n\n}",
"public function item_setprice($item)\n {\n if ($item['product_type'] != 2 || $item['product_payment'] != 'prepay') return;\n\n $db = db(config('db'));\n\n if ($_POST)\n {\n $db -> beginTrans();\n\n switch ($item['objtype'])\n {\n case 'room':\n $data = $this -> _format_room_price($item);\n\n // close old price\n $where = \"`supply`='EBK' AND `supplyid`=:sup AND `payment`=3 AND `hotel`=:hotel AND `room`=:room AND `date`>=:start AND `date`<=:end\";\n $condition = array(':sup'=>$item['pid'], ':hotel'=>$item['objpid'], ':room'=>$item['id'], ':start'=>$_POST['start'], ':end'=>$_POST['end']);\n $rs = $db -> prepare(\"UPDATE `ptc_hotel_price_date` SET `close`=1, `price`=0 WHERE {$where}\") -> execute($condition);\n if ($rs === false)\n json_return(null, 6, '保存失败,请重试');\n\n if ($data)\n {\n $data = array_values($data);\n list($column, $sql, $value) = array_values(insert_array($data));\n\n $_columns = update_column(array_keys($data[0]));\n $rs = $db -> prepare(\"INSERT INTO `ptc_hotel_price_date` {$column} VALUES {$sql} ON DUPLICATE KEY UPDATE {$_columns};\") -> execute($value); //var_dump($rs); exit;\n if (false == $rs)\n {\n $db -> rollback();\n json_return(null, 7, '数据保存失败,请重试~');\n }\n }\n break;\n\n case 'auto':\n $data = $this -> _format_auto_price($item);\n\n // close old price\n $where = \"`auto`=:auto AND `date`>=:start AND `date`<=:end\";\n $condition = array(':auto'=>$item['objpid'], ':start'=>$_POST['start'], ':end'=>$_POST['end']);\n $rs = $db -> prepare(\"UPDATE `ptc_auto_price_date` SET `close`=1, `price`=0 WHERE {$where}\") -> execute($condition);\n if ($rs === false)\n json_return(null, 6, '保存失败,请重试');\n\n if ($data)\n {\n $data = array_values($data);\n list($column, $sql, $value) = array_values(insert_array($data));\n\n $_columns = update_column(array_keys($data[0]));\n $rs = $db -> prepare(\"INSERT INTO `ptc_auto_price_date` {$column} VALUES {$sql} ON DUPLICATE KEY UPDATE {$_columns};\") -> execute($value); //var_dump($rs); exit;\n if (false == $rs)\n {\n $db -> rollback();\n json_return(null, 7, '数据保存失败,请重试~');\n }\n }\n break;\n }\n\n if (false === $db -> commit())\n json_return(null, 9, '数据保存失败,请重试~');\n else\n json_return($rs);\n }\n\n $month = !empty($_GET['month']) ? $_GET['month'] : date('Y-m');\n\n $first = strtotime($month.'-1');\n $first_day = date('N', $first);\n\n $start = $first_day == 7 ? $first : $first - $first_day * 86400;\n $end = $start + 41 * 86400;\n\n switch ($item['objtype'])\n {\n case 'room':\n $_date = $db -> prepare(\"SELECT `key`,`date`,`price`,`breakfast`,`allot`,`sold`,`filled`,`standby`,`close` FROM `ptc_hotel_price_date` WHERE `supply`='EBK' AND `supplyid`=:sup AND `hotel`=:hotel AND `room`=:room AND `date`>=:start AND `date`<=:end AND `close`=0\")\n -> execute(array(':sup'=>$item['pid'], ':hotel'=>$item['objpid'], ':room'=>$item['id'], ':start'=>$start, ':end'=>$end));\n break;\n\n case 'auto':\n $_date = $db -> prepare(\"SELECT `key`,`date`,`price`,`child`,`baby`,`allot`,`sold`,`filled`,`close` FROM `ptc_auto_price_date` WHERE `auto`=:auto AND `date`>=:start AND `date`<=:end AND `close`=0\")\n -> execute(array(':auto'=>$item['objpid'], ':start'=>$start, ':end'=>$end));\n break;\n }\n\n $date = array();\n foreach ($_date as $v)\n {\n $date[$v['date']] = $v;\n }\n unset($_date);\n\n include dirname(__FILE__).'/product/price_'.$item['objtype'].'.tpl.php';\n }",
"function before_order_itemmeta($item_id, $item, $_product) {\r\r\n\t\r\r\n\t\tglobal $bookyourtravel_accommodation_helper, $bookyourtravel_tour_helper, $bookyourtravel_cruise_helper, $bookyourtravel_car_rental_helper;\r\r\n\t\t\r\r\n\t\t$product_id \t= $item['product_id'];\r\r\n\t\t$variation_id = $item['variation_id'];\r\r\n\t\t\r\r\n\t\t$variation = new WC_Product_Variation($variation_id);\r\r\n\t\t\r\r\n\t\t$accommodation_booking_id = wc_get_order_item_meta($item_id, BOOKYOURTRAVEL_WOOCOMMERCE_ACCOMMODATION_BOOKING_ID, true);\r\r\n\t\tif ($accommodation_booking_id) {\r\r\n\t\t\r\r\n\t\t\t$booking_entry = $bookyourtravel_accommodation_helper->get_accommodation_booking($accommodation_booking_id);\r\r\n\t\t\t\r\r\n\t\t\tif ($booking_entry != null && $variation != null) {\r\r\n\t\t\t\r\r\n\t\t\t\t$accommodation_id = $booking_entry->accommodation_id;\r\r\n\t\t\t\t$accommodation_obj = new BookYourTravel_Accommodation($accommodation_id);\r\r\n\t\t\t\t$room_type_obj = null;\r\r\n\t\t\t\t$room_type_id = $booking_entry->room_type_id;\r\r\n\t\t\t\tif ($room_type_id > 0) {\r\r\n\t\t\t\t\t$room_type_obj = new BookYourTravel_Room_Type($room_type_id);\r\r\n\t\t\t\t}\r\r\n\t\t\t\t$adults = $booking_entry->adults;\r\r\n\t\t\t\t$children = $booking_entry->children;\r\r\n\t\t\t\t$room_count = $booking_entry->room_count;\r\r\n\t\t\t\t$date_from = $booking_entry->date_from;\r\r\n\t\t\t\t$date_from = date($this->date_format, strtotime($date_from));\r\r\n\t\t\t\t$date_to = $booking_entry->date_to;\r\r\n\t\t\t\t$date_to = date($this->date_format, strtotime($date_to));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$extra_items_string = '';\t\t\t\t\r\r\n\t\t\t\t$extra_items_array = array();\r\r\n\t\t\t\tif (!empty($booking_entry->extra_items)) {\r\r\n\t\t\t\t\t$extra_items_array = unserialize($booking_entry->extra_items);\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\tif ($extra_items_array != null) {\r\r\n\t\t\t\t\tforeach ($extra_items_array as $extra_item_id => $extra_item_quantity) {\r\r\n\t\t\t\t\t\t$extra_item_obj = new BookYourTravel_Extra_Item($extra_item_id);\r\r\n\t\t\t\t\t\t$extra_items_string .= $extra_item_quantity . ' x ' . $extra_item_obj->get_title() . ', ';\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}\r\r\n\t\t\t\r\r\n\t\t\t\t$extra_items_string = trim(rtrim($extra_items_string, ', '));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$item_text = '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('%s', 'bookyourtravel'), $accommodation_obj->get_title()) . '<br />';\r\r\n\t\t\t\tif ($room_type_obj) {\r\r\n\t\t\t\t\t$item_text .= sprintf(esc_html__('%s', 'bookyourtravel'), $room_type_obj->get_title()) . '<br />';\r\r\n\t\t\t\t}\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('Dates: %s to %s', 'bookyourtravel'), $date_from, $date_to) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('People: %d adults, %d children', 'bookyourtravel'), $adults, $children) . '<br />';\r\r\n\t\t\t\t\r\r\n\t\t\t\tif (!empty($extra_items_string)) {\r\r\n\t\t\t\t\t$item_text .= esc_html__('Extras: ', 'bookyourtravel') . $extra_items_string;\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\techo $item_text;\r\r\n\t\t\t}\r\r\n\t\t}\r\r\n\r\r\n\t\t$tour_booking_id = wc_get_order_item_meta($item_id, BOOKYOURTRAVEL_WOOCOMMERCE_TOUR_BOOKING_ID, true);\r\r\n\t\tif ($tour_booking_id) {\r\r\n\t\t\r\r\n\t\t\t$booking_entry = $bookyourtravel_tour_helper->get_tour_booking($tour_booking_id);\r\r\n\t\t\t\r\r\n\t\t\tif ($booking_entry != null && $variation != null) {\r\r\n\t\t\t\r\r\n\t\t\t\t$tour_schedule = $bookyourtravel_tour_helper->get_tour_schedule($booking_entry->tour_schedule_id);\r\r\n\t\t\t\t$booking_entry->tour_id = $tour_schedule->tour_id;\r\r\n\r\r\n\t\t\t\t$tour_id = $booking_entry->tour_id;\r\r\n\t\t\t\t$tour_obj = new BookYourTravel_Tour($tour_id);\r\r\n\t\t\t\t$adults = $booking_entry->adults;\r\r\n\t\t\t\t$children = $booking_entry->children;\r\r\n\t\t\t\t$tour_date = $booking_entry->tour_date;\r\r\n\t\t\t\t$tour_date = date($this->date_format, strtotime($tour_date));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$extra_items_string = '';\t\t\t\t\r\r\n\t\t\t\t$extra_items_array = array();\r\r\n\t\t\t\tif (!empty($booking_entry->extra_items)) {\r\r\n\t\t\t\t\t$extra_items_array = unserialize($booking_entry->extra_items);\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\tif ($extra_items_array != null) {\r\r\n\t\t\t\t\tforeach ($extra_items_array as $extra_item_id => $extra_item_quantity) {\r\r\n\t\t\t\t\t\t$extra_item_obj = new BookYourTravel_Extra_Item($extra_item_id);\r\r\n\t\t\t\t\t\t$extra_items_string .= $extra_item_quantity . ' x ' . $extra_item_obj->get_title() . ', ';\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}\r\r\n\t\t\t\r\r\n\t\t\t\t$extra_items_string = trim(rtrim($extra_items_string, ', '));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$item_text = '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('%s', 'bookyourtravel'), $tour_obj->get_title()) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('Tour date: %s', 'bookyourtravel'), $tour_date) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('People: %d adults, %d children', 'bookyourtravel'), $adults, $children) . '<br />';\r\r\n\t\t\t\t\r\r\n\t\t\t\tif (!empty($extra_items_string)) {\r\r\n\t\t\t\t\t$item_text .= esc_html__('Extras: ', 'bookyourtravel') . $extra_items_string;\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\techo $item_text;\r\r\n\t\t\t}\r\r\n\t\t}\r\r\n\t\t\r\r\n\t\t$cruise_booking_id = wc_get_order_item_meta($item_id, BOOKYOURTRAVEL_WOOCOMMERCE_CRUISE_BOOKING_ID, true);\r\r\n\t\tif ($cruise_booking_id) {\r\r\n\t\t\r\r\n\t\t\t$booking_entry = $bookyourtravel_cruise_helper->get_cruise_booking($cruise_booking_id);\r\r\n\t\t\t\r\r\n\t\t\tif ($booking_entry != null && $variation != null) {\r\r\n\t\t\t\r\r\n\t\t\t\t$cruise_schedule = $bookyourtravel_cruise_helper->get_cruise_schedule($booking_entry->cruise_schedule_id);\r\r\n\t\t\t\t$booking_entry->tour_id = $cruise_schedule->cruise_id;\r\r\n\t\t\t\t$booking_entry->cabin_type_id = $cruise_schedule->cabin_type_id;\r\r\n\t\t\t\t\r\r\n\t\t\t\t$cruise_id = $booking_entry->cruise_id;\r\r\n\t\t\t\t$cruise_obj = new BookYourTravel_Cruise($cruise_id);\r\r\n\t\t\t\t$cabin_type_obj = null;\r\r\n\t\t\t\t$cabin_type_id = $booking_entry->cabin_type_id;\r\r\n\t\t\t\tif ($cabin_type_id > 0) {\r\r\n\t\t\t\t\t$cabin_type_obj = new BookYourTravel_Cabin_Type($cabin_type_id);\r\r\n\t\t\t\t}\r\r\n\t\t\t\t$adults = $booking_entry->adults;\r\r\n\t\t\t\t$children = $booking_entry->children;\r\r\n\t\t\t\t$cruise_date = $booking_entry->cruise_date;\r\r\n\t\t\t\t$cruise_date = date($this->date_format, strtotime($cruise_date));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$extra_items_string = '';\t\t\t\t\r\r\n\t\t\t\t$extra_items_array = array();\r\r\n\t\t\t\tif (!empty($booking_entry->extra_items)) {\r\r\n\t\t\t\t\t$extra_items_array = unserialize($booking_entry->extra_items);\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\tif ($extra_items_array != null) {\r\r\n\t\t\t\t\tforeach ($extra_items_array as $extra_item_id => $extra_item_quantity) {\r\r\n\t\t\t\t\t\t$extra_item_obj = new BookYourTravel_Extra_Item($extra_item_id);\r\r\n\t\t\t\t\t\t$extra_items_string .= $extra_item_quantity . ' x ' . $extra_item_obj->get_title() . ', ';\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}\r\r\n\t\t\t\r\r\n\t\t\t\t$extra_items_string = trim(rtrim($extra_items_string, ', '));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$item_text = '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('%s', 'bookyourtravel'), $cruise_obj->get_title()) . '<br />';\r\r\n\t\t\t\tif ($cabin_type_obj) {\r\r\n\t\t\t\t\t$item_text .= sprintf(esc_html__('%s', 'bookyourtravel'), $cabin_type_obj->get_title()) . '<br />';\r\r\n\t\t\t\t}\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('Cruise date: %s', 'bookyourtravel'), $cruise_date) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('People: %d adults, %d children', 'bookyourtravel'), $adults, $children) . '<br />';\r\r\n\t\t\t\t\r\r\n\t\t\t\tif (!empty($extra_items_string)) {\r\r\n\t\t\t\t\t$item_text .= esc_html__('Extras: ', 'bookyourtravel') . $extra_items_string;\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\techo $item_text;\r\r\n\t\t\t}\r\r\n\t\t}\r\r\n\t\t\r\r\n\t\t$car_rental_booking_id = wc_get_order_item_meta($item_id, BOOKYOURTRAVEL_WOOCOMMERCE_CAR_RENTAL_BOOKING_ID, true);\r\r\n\t\tif ($car_rental_booking_id) {\r\r\n\t\t\r\r\n\t\t\t$booking_entry = $bookyourtravel_car_rental_helper->get_car_rental_booking($car_rental_booking_id);\r\r\n\t\t\t\r\r\n\t\t\tif ($booking_entry != null && $variation != null) {\r\r\n\t\t\t\r\r\n\t\t\t\t$car_rental_id = $booking_entry->car_rental_id;\r\r\n\t\t\t\t$car_rental_obj = new BookYourTravel_Car_Rental($car_rental_id);\r\r\n\r\r\n\t\t\t\t$start_date = $booking_entry->from_day;\r\r\n\t\t\t\t$start_date = date($this->date_format, strtotime($start_date));\r\r\n\t\t\t\t$end_date = $booking_entry->to_day;\r\r\n\t\t\t\t$end_date = date($this->date_format, strtotime($end_date));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$extra_items_string = '';\t\t\t\t\r\r\n\t\t\t\t$extra_items_array = array();\r\r\n\t\t\t\tif (!empty($booking_entry->extra_items)) {\r\r\n\t\t\t\t\t$extra_items_array = unserialize($booking_entry->extra_items);\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\tif ($extra_items_array != null) {\r\r\n\t\t\t\t\tforeach ($extra_items_array as $extra_item_id => $extra_item_quantity) {\r\r\n\t\t\t\t\t\t$extra_item_obj = new BookYourTravel_Extra_Item($extra_item_id);\r\r\n\t\t\t\t\t\t$extra_items_string .= $extra_item_quantity . ' x ' . $extra_item_obj->get_title() . ', ';\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}\r\r\n\t\t\t\r\r\n\t\t\t\t$extra_items_string = trim(rtrim($extra_items_string, ', '));\r\r\n\t\t\t\t\r\r\n\t\t\t\t$item_text = '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('%s', 'bookyourtravel'), $car_rental_obj->get_title()) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('From date: %s', 'bookyourtravel'), $start_date) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('To date: %s', 'bookyourtravel'), $end_date) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('Pick up: %s', 'bookyourtravel'), $booking_entry->pick_up_title) . '<br />';\r\r\n\t\t\t\t$item_text .= sprintf(esc_html__('Drop off: %s', 'bookyourtravel'), $booking_entry->drop_off_title) . '<br />';\r\r\n\t\t\t\t\r\r\n\t\t\t\tif (!empty($extra_items_string)) {\r\r\n\t\t\t\t\t$item_text .= esc_html__('Extras: ', 'bookyourtravel') . $extra_items_string;\r\r\n\t\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t\techo $item_text;\r\r\n\t\t\t}\r\r\n\t\t}\r\r\n\t}",
"function builder_price() {\n\n $this->Item->recursive = 0;\n\n if( !isset($this->params['named']['limit']) ) {\n $this->paginate['limit'] = REPORT_LIMIT;\n $this->paginate['maxLimit'] = REPORT_LIMIT;\n }\n elseif( isset($this->params['named']['limit']) && $this->params['named']['limit'] != 'All' ) {\n $this->paginate['limit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n $this->paginate['maxLimit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n }\n else {\n $this->paginate['limit'] = 0;\n $this->paginate['maxLimit'] = 0;\n }\n $this->Prg->commonProcess();\n $this->paginate['conditions'] = $this->Item->parseCriteria($this->passedArgs);\n $this->paginate['conditions']['Item.base_item']['base_item'] = 0;\n\n $items = $this->paginate();\n $paginate = true;\n $legend = \"Items\";\n\n $this->set(compact('items', 'paginate', 'legend'));\n }",
"public function preparePayment() {\n\n $order = $this->getOrder();\n $payment = $this->getPaymentModule();\n\n $amount = $order->getTotalAmount();\n $amount = (int) round($amount * 100);\n $orderId = $order->get(\"id\");\n\n $payment->setId($orderId);\n $payment->setCurrency($this->modules->get(\"PadCart\")->currency);\n\n $url = $this->page->httpUrl;\n $payment->setProcessUrl($url . \"process/\" . $orderId . \"/\");\n $payment->setFailureUrl($url . \"fail/\");\n $payment->setCancelUrl($url . \"cancel/\");\n\n $customer = Array();\n $customer['givenName'] = $order->pad_firstname;\n $customer['familyName'] = $order->pad_lastname;\n $customer['streetAddress'] = $order->pad_address;\n $customer['streetAddress2'] = $order->pad_address2;\n $customer['locality'] = $order->pad_city;\n $customer['postalCode'] = $order->pad_postcode;\n $customer['country'] = $order->pad_countrycode;\n $customer['email'] = $order->email;\n $payment->setCustomerData($customer);\n\n foreach ($order->pad_products as $p) {\n $amount = $p->pad_price * 100; // Amount in payment modules always in cents\n if ($this->cart->prices_without_tax) $amount = $amount + ($p->pad_tax_amount * 100 / $p->pad_quantity); // TODO: currently we have only\n $payment->addProduct($p->title, $amount, $p->pad_quantity, $p->pad_percentage, $p->pad_product_id);\n }\n }",
"function setItem_price($price){\n $this->item_price = $price;\n }",
"protected function calculatePrices()\n {\n }",
"private function makeItemPurchase() : void\n {\n $this->item->available = $this->item->available - 1;\n $this->coinService->setCoinCount(\n $this->coinService->getCurrenCoinCount() - $this->item->cost\n );\n $this->item->save();\n }",
"public function initOrderDetail(&$orderItem, $item) {\n $payMethod = array('pm_id' => '',\n 'title' => $item['payment_method'],\n 'description' => '');\n\n $orderItem = array('order_id' => $item['order_id'],\n 'display_id' => $item['order_id'], //show id\n 'uname' => $item['shipping_firstname'] . ' ' . $item['shipping_lastname'],\n 'currency' => $item['currency_code'],\n 'shipping_address' => array(),\n 'billing_address' => array(),\n 'payment_method' => $payMethod,\n 'shipping_insurance' => '',\n 'coupon' => $item['coupon_id'],\n 'order_status' => array(),\n 'last_status_id' => $item['order_status_id'], //get current status from history\n 'order_tax' => $item['fax'],\n 'order_date_start' => $item['date_added'],\n 'order_date_finish' => '',\n 'order_date_purchased' => $item['date_modified']);\n }",
"function hj_preorder_item_data( $item_data, $cart_item ) {\n // return $item_data;\n //\n // // get title text\n // $name = 'Estimated release';\n //\n // // don't add if empty\n // if ( ! $name )\n // return $item_data;\n //\n // $pre_order_meta = array(\n // 'name' => $name,\n // 'display' => $cart_item['data'],\n // );\n //\n // // add title and localized date\n // if ( ! empty( $pre_order_meta ) )\n // $item_data[] = $pre_order_meta;\n //\n // return $item_data;\n\n if ( HJPO::can_preorder( $cart_item['product_id'] ) ) {\n $timestamp = HJPO::preorder_date( $cart_item['product_id'] );\n if ( $timestamp ) {\n // $date = date_i18n( get_option( 'date_format' ), $timestamp );\n $date = HJPO::preorder_date_diff( $cart_item['product_id'] );\n }\n else {\n $date = 'Soon';\n }\n $item_data[] = array(\n 'name' => 'Estimated Release',\n 'display' => $date\n );\n }\n\n return $item_data;\n}",
"public function prepare_items()\n {\n }",
"public function prepare_items()\n {\n }",
"public function prepare_items()\n {\n }",
"public function prepare_items()\n {\n }",
"public function prepare_items()\n {\n }",
"function fix_order_amount_item_total( $price, $order, $item, $inc_tax = false, $round = true ) {\n $qty = ( ! empty( $item[ 'qty' ] ) && $item[ 'qty' ] != 0 ) ? $item[ 'qty'] : 1;\n if( $inc_tax ) {\n $price = ( $item[ 'line_total' ] + $item[ 'line_tax' ] ) / $qty;\n } else {\n $price = $item[ 'line_total' ] / $qty;\n }\n $price = $round ? round( $price, 2 ) : $price;\n return $price;\n}",
"private function calculateOrderAmount()\n {\n if ($this->getOffer() instanceof Offer) {\n //recalculates the new amount\n $this->getOffer()->calculateInvoiceAmount();\n Shopware()->Models()->persist($this->getOffer());\n }\n }",
"public function testOrderItem() {\n /** @var \\Drupal\\commerce_order\\Entity\\OrderItemInterface $order_item */\n $order_item = OrderItem::create([\n 'type' => 'test',\n ]);\n $order_item->save();\n\n $order_item->setTitle('My order item');\n $this->assertEquals('My order item', $order_item->getTitle());\n\n $this->assertEquals(1, $order_item->getQuantity());\n $order_item->setQuantity('2');\n $this->assertEquals(2, $order_item->getQuantity());\n\n $this->assertEquals(NULL, $order_item->getUnitPrice());\n $this->assertFalse($order_item->isUnitPriceOverridden());\n $unit_price = new Price('9.99', 'USD');\n $order_item->setUnitPrice($unit_price, TRUE);\n $this->assertEquals($unit_price, $order_item->getUnitPrice());\n $this->assertTrue($order_item->isUnitPriceOverridden());\n\n $adjustments = [];\n $adjustments[] = new Adjustment([\n 'type' => 'custom',\n 'label' => '10% off',\n 'amount' => new Price('-1.00', 'USD'),\n 'percentage' => '0.1',\n ]);\n $adjustments[] = new Adjustment([\n 'type' => 'fee',\n 'label' => 'Random fee',\n 'amount' => new Price('2.00', 'USD'),\n ]);\n $order_item->addAdjustment($adjustments[0]);\n $order_item->addAdjustment($adjustments[1]);\n $adjustments = $order_item->getAdjustments();\n $this->assertEquals($adjustments, $order_item->getAdjustments());\n $this->assertEquals($adjustments, $order_item->getAdjustments(['custom', 'fee']));\n $this->assertEquals([$adjustments[0]], $order_item->getAdjustments(['custom']));\n $this->assertEquals([$adjustments[1]], $order_item->getAdjustments(['fee']));\n $order_item->removeAdjustment($adjustments[0]);\n $this->assertEquals([$adjustments[1]], $order_item->getAdjustments());\n $this->assertEquals(new Price('21.98', 'USD'), $order_item->getAdjustedTotalPrice());\n $this->assertEquals(new Price('10.99', 'USD'), $order_item->getAdjustedUnitPrice());\n $order_item->setAdjustments($adjustments);\n $this->assertEquals($adjustments, $order_item->getAdjustments());\n $this->assertEquals(new Price('9.99', 'USD'), $order_item->getUnitPrice());\n $this->assertEquals(new Price('19.98', 'USD'), $order_item->getTotalPrice());\n $this->assertEquals(new Price('20.98', 'USD'), $order_item->getAdjustedTotalPrice());\n $this->assertEquals(new Price('18.98', 'USD'), $order_item->getAdjustedTotalPrice(['custom']));\n $this->assertEquals(new Price('21.98', 'USD'), $order_item->getAdjustedTotalPrice(['fee']));\n // The adjusted unit prices are the adjusted total prices divided by 2.\n $this->assertEquals(new Price('10.49', 'USD'), $order_item->getAdjustedUnitPrice());\n $this->assertEquals(new Price('9.49', 'USD'), $order_item->getAdjustedUnitPrice(['custom']));\n $this->assertEquals(new Price('10.99', 'USD'), $order_item->getAdjustedUnitPrice(['fee']));\n\n $this->assertEquals('default', $order_item->getData('test', 'default'));\n $order_item->setData('test', 'value');\n $this->assertEquals('value', $order_item->getData('test', 'default'));\n $order_item->unsetData('test');\n $this->assertNull($order_item->getData('test'));\n $this->assertEquals('default', $order_item->getData('test', 'default'));\n\n $order_item->setCreatedTime(635879700);\n $this->assertEquals(635879700, $order_item->getCreatedTime());\n\n $this->assertFalse($order_item->isLocked());\n $order_item->lock();\n $this->assertTrue($order_item->isLocked());\n $order_item->unlock();\n $this->assertFalse($order_item->isLocked());\n }",
"function ciniki_sapos_itemCalcAmount($ciniki, $item) {\n\n if( !isset($item['quantity']) || !isset($item['unit_amount']) ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.sapos.30', 'msg'=>'Unable to calculate the item amount, missing quantity or unit amount'));\n }\n\n $unit_amount = $item['unit_amount'];\n //\n // Apply the dollar amount discount first\n //\n if( isset($item['unit_discount_amount']) && $item['unit_discount_amount'] > 0 ) {\n $unit_amount = bcsub($unit_amount, $item['unit_discount_amount'], 4);\n }\n //\n // Apply the percentage discount second\n //\n if( isset($item['unit_discount_percentage']) && $item['unit_discount_percentage'] > 0 ) {\n $percentage = bcdiv($item['unit_discount_percentage'], 100, 4);\n $unit_amount = bcsub($unit_amount, bcmul($unit_amount, $percentage, 4), 4);\n }\n\n //\n // Calculate what the amount should have been without discounts\n //\n $subtotal = bcmul($item['quantity'], $item['unit_amount'], 2);\n\n //\n // Apply the quantity\n //\n $total = bcmul($item['quantity'], $unit_amount, 2);\n\n //\n // Calculate the total discount on the item\n //\n $discount = bcsub(bcmul($item['quantity'], $item['unit_amount'], 2), $total, 2);\n\n //\n // Calculate the preorder_amount, after all discount calculations because this amount will be paid later\n //\n $preorder = 0;\n if( isset($item['unit_preorder_amount']) ) {\n $preorder = bcmul($item['quantity'], $item['unit_preorder_amount'], 2);\n if( $preorder > 0 ) {\n $total = bcsub($total, $preorder, 2);\n }\n }\n\n return array('stat'=>'ok', 'subtotal'=>$subtotal, 'preorder'=>$preorder, 'discount'=>$discount, 'total'=>$total);\n}",
"public function apply(OrderItem $item)\n {\n $product = $item->model;\n $order = $item->order;\n\n $originalPrice = $product->getPrice($order->currency, $item->options);\n\n $discount = 0;\n if ($this->type == self::TYPE_FIXED) {\n $discount = $this->discount;\n } elseif ($this->type == self::TYPE_PERCENTAGE) {\n $discount = ($originalPrice / 100) * $this->discount;\n }\n $item->update([\n 'title' => $product->getTitle(),\n 'price' => $originalPrice,\n 'discount' => $discount,\n ]);\n }",
"private function calculate_item_prices()\r\n\t{\r\n\t\t// Loop through cart items.\r\n\t\tforeach($this->flexi->cart_contents['items'] as $row_id => $row)\r\n\t\t{\r\n\t\t\t// Check if the item has a specific tax rate set.\r\n\t\t\t$item_tax_rate = $this->get_item_tax_rate($row_id, FALSE); \r\n\r\n\t\t\t// Calculate the internal item price.\r\n\t\t\t$item_internal_tax_data = $this->calculate_tax($row[$this->flexi->cart_columns['item_internal_price']], $item_tax_rate);\r\n\r\n\t\t\t// Calculate the tax on the item price using the carts current location settings.\r\n\t\t\t$item_tax_data = $this->calculate_tax($item_internal_tax_data['value_ex_tax'], $item_tax_rate, FALSE, TRUE);\r\n\t\t\t\t\t\t\r\n\t\t\t// Update the item price.\r\n\t\t\t$row[$this->flexi->cart_columns['item_price']] = $this->format_calculation($item_tax_data['value_inc_tax']);\r\n\r\n\t\t\t// Save item pricing.\r\n\t\t\t$this->flexi->cart_contents['items'][$row_id] = $row;\r\n\t\t}\r\n\t}",
"private function _createOrderLines($virtuemart_order_id, $cart)\n {\n $_orderItems = $this->getTable('order_items');\n\n foreach ($cart->products as $priceKey => $product) {\n\n if (!empty($product->customProductData)) {\n $_orderItems->product_attribute = vmJsApi::safe_json_encode($product->customProductData);\n } else {\n $_orderItems->product_attribute = '';\n }\n\n\n $_orderItems->virtuemart_order_item_id = null;\n $_orderItems->virtuemart_order_id = $virtuemart_order_id;\n\n $_orderItems->virtuemart_vendor_id = $product->virtuemart_vendor_id;\n $_orderItems->virtuemart_product_id = $product->virtuemart_product_id;\n $_orderItems->order_item_sku = $product->product_sku;\n $_orderItems->order_item_name = $product->product_name;\n $_orderItems->product_quantity = $product->quantity;\n $_orderItems->product_item_price = $product->allPrices[$product->selectedPrice]['basePriceVariant'];\n $_orderItems->product_basePriceWithTax = $product->allPrices[$product->selectedPrice]['basePriceWithTax'];\n\n //$_orderItems->product_tax = $_cart->pricesUnformatted[$priceKey]['subtotal_tax_amount'];\n $_orderItems->product_tax = $product->allPrices[$product->selectedPrice]['taxAmount'];\n $_orderItems->product_final_price = $product->allPrices[$product->selectedPrice]['salesPrice'];\n $_orderItems->product_subtotal_discount = $product->allPrices[$product->selectedPrice]['subtotal_discount'];\n $_orderItems->product_subtotal_with_tax = $product->allPrices[$product->selectedPrice]['subtotal_with_tax'];\n $_orderItems->product_priceWithoutTax = $product->allPrices[$product->selectedPrice]['priceWithoutTax'];\n $_orderItems->product_discountedPriceWithoutTax = $product->allPrices[$product->selectedPrice]['discountedPriceWithoutTax'];\n $_orderItems->order_status = 'P';\n\n if (!$_orderItems->check()) {\n return false;\n }\n //The check may set here a wrong vendorId, we replace it again with the right one.\n $_orderItems->virtuemart_vendor_id = $product->virtuemart_vendor_id;\n\n // Save the record to the database\n if (!$_orderItems->store()) {\n return false;\n }\n\n $product->virtuemart_order_item_id = $_orderItems->virtuemart_order_item_id;\n\n $this->handleStockAfterStatusChangedPerProduct($_orderItems->order_status, 'N', $_orderItems, $_orderItems->product_quantity);\n }\n\n return true;\n }",
"public function orderItem($param) { \n if (!$this->aaa->has_right('openruth', 500))\n $res->orderItemError->_value = 'authentication_error';\n else {\n $targets = $this->config->get_value('ruth', 'ztargets');\n $agencyId = self::strip_agency($param->agencyId->_value);\n if ($tgt = $targets[$agencyId]) {\n // build order\n $ord = &$order->Reservation->_value;\n $ord->LibraryNo->_value = $agencyId;\n $ord->BorrowerTicketNo->_value = $param->userId->_value;\n $ord->DisposalNote->_value = $param->orderNote->_value;\n $ord->LastUseDate->_value = self::to_zruth_date($param->orderLastInterestDate->_value);\n $ord->ServiceCounter->_value = $param->agencyCounter->_value;\n $ord->Override->_value = (self::xs_true($param->agencyCounter->_value) ? 'Y' : 'N');\n $ord->Priority->_value = $param->orderPriority->_value;\n // ?????? $ord->DisposalType->_value = $param->xxxx->_value;\n $itemIds = &$param->orderItemId;\n if (is_array($itemIds))\n foreach ($itemIds as $oid) {\n $mrid->ID->_value = $oid->_value->itemId->_value;\n if (!$mrid->TitlePartNo->_value = $oid->_value->itemSerialPartId->_value)\n $mrid->TitlePartNo->_value = 0;\n $ord->MRIDS->_value->MRID[]->_value = $mrid;\n }\n else {\n $mrid->ID->_value = $itemIds->_value->itemId->_value;\n if (!$mrid->TitlePartNo->_value = $itemIds->_value->itemSerialPartId->_value)\n $mrid->TitlePartNo->_value = 0;\n $ord->MRIDS->_value->MRID->_value = $mrid;\n }\n $xml = '<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?'.'>' . utf8_decode($this->objconvert->obj2xml($order));\n \n//print_r($ord);\n//print_r($xml);\n \n $z = new z3950();\n $z->set_target($tgt['host']);\n $z->set_database($tgt['database'].'-ophelia');\n $z->set_authentication($tgt['authentication']);\n if ($tgt['proxy']) {\n $z->set_proxy($tgt['proxy']);\n }\n $xml_ret = $z->z3950_xml_update($xml, $tgt['timeout']);\n if ($z->get_errno() == 0 && $xml_ret['xmlUpdateDoc']) {\n $dom = new DomDocument();\n $dom->preserveWhiteSpace = false;\n if ($dom->loadXML($xml_ret['xmlUpdateDoc'])) {\n if ($err = &$dom->getElementsByTagName('ErrorResponse')->item(0)) {\n verbose::log(ERROR, __FUNCTION__ . ' (' . __LINE__ . ') errno: ' . $err->getAttribute('Err') . \n ' error: ' . $err->nodeValue);\n $res->orderItemError->_value = 'unspecified error, order not possible';\n } else {\n // order at least partly ok \n foreach ($dom->getElementsByTagName('MRID') as $mrid) {\n unset($ir);\n $ir->orderItemId->_value->itemId->_value = $mrid->getAttribute('Id');\n if ($mrid->getAttribute('Tp'))\n $ir->orderItemId->_value->itemSerialPartId->_value = $mrid->getAttribute('Tp');\n if (!$mrid->nodeValue)\n $ir->orderItemOk->_value = 'true';\n elseif (!($ir->orderItemError->_value = $this->errs[$mrid->nodeValue])) \n $ir->orderItemError->_value = 'unknown error: ' . $mrid->nodeValue;\n $res->orderItem[]->_value = $ir;\n }\n }\n }\n } else {\n self::log_z_error(__FUNCTION__, __LINE__, $agencyId, $z->get_errno(), $z->get_error_string());\n $res->orderItemError->_value = 'system error';\n }\n//echo \"\\n\";\n//print_r($xml_ret);\n//print_r(\"\\nError: \" . $z->get_errno());\n } else\n $res->orderItemError->_value = 'unknown agencyId';\n }\n\n $ret->orderItemResponse->_value = $res;\n //var_dump($param); var_dump($res); die();\n return $ret;\n }",
"public function calculatePrices(): void\n {\n $orders = ServiceContainer::orders();\n $pizzaPrice = $orders->calculatePizzaPrice($this->items);\n $deliveryPrice = $orders->calculateDeliveryPrice($pizzaPrice, $this->outside, $this->currency);\n $this->delivery_price = $deliveryPrice;\n $this->total_price = $pizzaPrice + $deliveryPrice;\n }",
"private function getItemXml($item)\n {\n $qty = (int)$item->getQty() ? (int)$item->getQty() : 1;\n $product = Mage::getModel('catalog/product')->load( $item->getProductId() );\n\n\n\n //$this->_totalPrice += $product->getFinalPrice() * $qty;\n if($this->getConfig('product_cost') && $product->getCost() > 0)\n {\n $this->_totalPrice += $product->getCost() * $qty;\n }\n else\n {\n $this->log(\"p p \" . $product->getFinalPrice() . \" and i P \". $product->getPrice());\n $this->_totalPrice += $product->getFinalPrice() * $qty;\n }\n\n $height = $this->getConvertedMeasure($product->getHeight(), $product->getDimensionUnits());\n //$weight = $this->getConvertedWeight($product->getWeight(),$product->getWeightUnits())*$qty;\n $weight = $this->getConvertedWeight($product->getWeight(),$product->getWeightMeasure());\n $width = $this->getConvertedMeasure($product->getWidth(), $product->getDimensionUnits());\n $length = $this->getConvertedMeasure($product->getLength(), $product->getDimensionUnits());\n $title = substr($product->getSku().';'.preg_replace('/[^a-z0-9\\s\\'\\.\\_]/i','',substr($product->getName(),0,32).\" ...\"),0,32);\n $Readytoship = $product->getReadytoship();\n\n if(intval($length) < 1 || intval($width) < 1 || intval($height) < 1 )\n {\n $length = $width = $height = 1;\n }\n\n $Readytoship = \"\";\n if($product->getReadytoship() != 1)\n {\n $Readytoship = '';\n\t\t\t\n }\n\n if(ceil($weight) <= 0.0000)\n {\n $weight = .7; //default to 7.7 kg\n }\n\n if($height < 1 || !is_numeric($height))\n {\n $height = $this->_default_heightlow; // just a low default\n if($weight >= $this->_weight_low) // less than 1k no height (default 2)\n {\n $height = $this->_default_heighthigh;\n }\n\n }\n\n if($width < 1 || !is_numeric($width))\n {\n $width = $this->_default_widthlow; // just a low default\n if($weight >= $this->_weight_low)\n {\t\t\t // less than 1k no height (default 2)\n $width = $this->_default_widthhigh;\n }\n }\n\n // Create default value for length should value be missing\n if($length < 1 || !is_numeric($length))\n {\n $length = $this->_default_lengthlow; // just a low default\n if($weight >= $this->_weight_low) // less than 1k no height (default 2)\n {\n $length = $this->_default_lengthhigh;\n }\n }\n$aweight = $weight;\n/*$aheight = $height*$qty;*/\n\nif($product->getReadytoship() != 1)\n {\n \n\t\t$this->_package_height += $height; \n\t\tif($width > $this->_package_width) $this->_package_width = $width; \n\t\tif($length > $this->_package_length) $this->_package_length = $length;\n\t\t$this->shipping_weight += $aweight; \n\t\t \n\t\n\n\t\t\t\n\t\t\t $items_xml = \"\\n\n <parcel>\n <weight>{$this->shipping_weight}</weight>\n <length>{$this->_package_length}</length>\n <width>{$this->_package_width}</width>\n <height>{$this->_package_height}</height>\n</parcel>\n\";\n\t\t\t\n }\n\t\telse\n\t\t{\n\t\t\t $items_xml = \"\\n\n <parcel>\n <weight>{$aweight}</weight>\n <length>{$length}</length>\n <width>{$width}</width>\n <height>{$height}</height>\n</parcel>\n\";\n\t\t}\n\n\n \n return $items_xml;\n }",
"public function processOrderItem(OrderItem $item)\n {\n // since we are create a subscription, we delegate the subscription creation to that model\n Subscription::createFromOrderItem($item);\n\n return $item;\n }",
"private function prepareSimpleProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setDownloadOptions();\n $this->setSKU();\n $this->setStockOptions();\n $this->setSoldIndividually();\n $this->setShippingOptions();\n $this->setPurchaseNote();\n $this->setEnableReviews();\n $this->setMenuOrder();\n }\n\n $this->setTags();\n $this->setAttributes();\n }",
"private function prepareExternalProduct() {\n if ($this->getSaverData()->isFirstPage()) {\n $this->setPrice();\n $this->setSKU();\n $this->setEnableReviews();\n $this->setMenuOrder();\n $this->setExternalProductDetails();\n }\n\n $this->setTags();\n $this->setAttributes();\n }",
"function load_avaialable_special_offers($order) {\n $special_offers = array();\n if (!empty($order->commerce_line_items)) {\n $order_wrapper = entity_metadata_wrapper('commerce_order', $order);\n foreach ($order_wrapper->commerce_line_items as $line_item_wrapper) {\n if (!empty($line_item_wrapper->value()->commerce_product)) {\n $product = $line_item_wrapper->commerce_product->value();\n if (!empty($product->field_special_offers)) {\n $offers = $line_item_wrapper->commerce_product->field_special_offers->value();\n foreach($offers as $offer) {\n $special_offers[$offer->product_id] = $offer;\n }\n }\n }\n }\n }\n return array('special_offers' => $special_offers);\n}",
"public function execute(\\Magento\\Framework\\Event\\Observer $observer)\n {\n $product = $observer->getProduct();\n $_pricePerPound = $product->getPricePerPound();\n if($_pricePerPound > 0){\n $weight = $product->getWeight() ? $product->getWeight() : 1;\n $_pricePerPound = str_replace(',', '', $_pricePerPound);\n $price = $_pricePerPound * $weight;\n $product->setPrice($price);\n }\n }"
]
| [
"0.63047725",
"0.6180514",
"0.6149615",
"0.61193794",
"0.5991304",
"0.5957268",
"0.59539807",
"0.5925711",
"0.5876281",
"0.5870512",
"0.58057696",
"0.58048147",
"0.58048147",
"0.58048147",
"0.58042705",
"0.58041745",
"0.5777608",
"0.57629603",
"0.57337576",
"0.57266265",
"0.5693364",
"0.56811476",
"0.5663498",
"0.5661896",
"0.5661034",
"0.5652214",
"0.56189615",
"0.5616854",
"0.5561598",
"0.5555036"
]
| 0.61973554 | 1 |
Display recalculate item price | protected function displayRecalculateItemPrice(\XLite\Model\OrderItem $item)
{
\XLite\Core\Event::recalculateItem($this->assembleRecalculateItemEvent($item));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function calculatePrices()\n {\n }",
"public function viewPrice()\n {\n return number_format($this->price/100, 2);\n }",
"public function profit() : void {\n\t\techo ($this->price - $this->cost);\n\t}",
"protected function calculatePrice()\n {\n $amount = 5 * $this->rate;\n $this->outputPrice($amount);\n }",
"public function calItem($quantity,$item_price){\n $cal_price=$quantity*$item_price;\n return $cal_price;\n }",
"function calculate(){\r\n global $item_price, $item_qty, $item_total;\r\n $item_price = number_format($item_price, 2);\r\n $item_total = number_format(($item_price * $item_qty), 2);\r\n}",
"private function calculate_item_prices()\r\n\t{\r\n\t\t// Loop through cart items.\r\n\t\tforeach($this->flexi->cart_contents['items'] as $row_id => $row)\r\n\t\t{\r\n\t\t\t// Check if the item has a specific tax rate set.\r\n\t\t\t$item_tax_rate = $this->get_item_tax_rate($row_id, FALSE); \r\n\r\n\t\t\t// Calculate the internal item price.\r\n\t\t\t$item_internal_tax_data = $this->calculate_tax($row[$this->flexi->cart_columns['item_internal_price']], $item_tax_rate);\r\n\r\n\t\t\t// Calculate the tax on the item price using the carts current location settings.\r\n\t\t\t$item_tax_data = $this->calculate_tax($item_internal_tax_data['value_ex_tax'], $item_tax_rate, FALSE, TRUE);\r\n\t\t\t\t\t\t\r\n\t\t\t// Update the item price.\r\n\t\t\t$row[$this->flexi->cart_columns['item_price']] = $this->format_calculation($item_tax_data['value_inc_tax']);\r\n\r\n\t\t\t// Save item pricing.\r\n\t\t\t$this->flexi->cart_contents['items'][$row_id] = $row;\r\n\t\t}\r\n\t}",
"function get_price( $force_refresh=false ){\r\n\t\tif( $force_refresh || $this->price == 0 ){\r\n\t\t\t//get the ticket, clculate price on spaces\r\n\t\t\t$this->price = $this->get_ticket()->get_price() * $this->spaces;\r\n\t\t}\r\n\t\treturn apply_filters('em_booking_get_prices',$this->price,$this);\r\n\t}",
"public function getItemPrice($item)\n {\n $block = $this->getLayout()->getBlock('item_price');\n $block->setItem($item);\n return $block->toHtml();\n }",
"public function getTotalPrice();",
"public function getTotalPrice();",
"public function showPrice() {\n return 'This ' .$this->getColor() .' vehicle cost ' . $this->getPrice() ;\n }",
"private function HTML_SumUp_Price() : string\n {\n return $this->HTML_TxPart(\n 'Prix ' . ($this->infos['tx_type'] == 'buy' ? 'd\\'achat' : 'de vente'),\n self::AutoFloatFormat($this->infos['tx_price']) . ' ' . $this->Index()->infos['symbol']\n );\n }",
"public function getPrice(){ return $this->price_rur; }",
"abstract function total_price($price_summary);",
"public function getPrice(): float;",
"public function getPrice(): float;",
"public function getPrice()\n {\n return parent::getPrice();\n }",
"public function format() {\n\t\treturn elgg_echo('payments:price', [$this->getConvertedAmount(), $this->getCurrency()]);\n\t}",
"public function getTotalPrice(): float;",
"function get_list_product_price() {\n\n global $product;\n\n if ( $price_html = $product->get_price_html() ) :\n \t\n \techo '<span class=\"price uk-margin-small-bottom\" style=\"float: right\">';\n \techo $price_html;\n \techo '</span>';\n \t\n endif; \n\n }",
"public function itemTotal(): float;",
"function builder_price() {\n\n $this->Item->recursive = 0;\n\n if( !isset($this->params['named']['limit']) ) {\n $this->paginate['limit'] = REPORT_LIMIT;\n $this->paginate['maxLimit'] = REPORT_LIMIT;\n }\n elseif( isset($this->params['named']['limit']) && $this->params['named']['limit'] != 'All' ) {\n $this->paginate['limit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n $this->paginate['maxLimit'] = isset($this->params['named']['limit']) ? $this->params['named']['limit'] : REPORT_LIMIT;\n }\n else {\n $this->paginate['limit'] = 0;\n $this->paginate['maxLimit'] = 0;\n }\n $this->Prg->commonProcess();\n $this->paginate['conditions'] = $this->Item->parseCriteria($this->passedArgs);\n $this->paginate['conditions']['Item.base_item']['base_item'] = 0;\n\n $items = $this->paginate();\n $paginate = true;\n $legend = \"Items\";\n\n $this->set(compact('items', 'paginate', 'legend'));\n }",
"function price( )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n return $this->Price;\n }",
"public function getPrice();",
"public function getPrice();",
"public function getPrice();",
"public function getPrice();",
"public static function price_box() {\n\t\t\t\n\t\t\tglobal $post;\n\t\t\n\t\t\t$price = explode(\".\",get_post_meta($post->ID, 'post_dishprice', true ));\n\t\t\t\n\t\t\tif(empty($price[0])){\n\t\t\t\t$price[0] = \"0\";\n\t\t\t}\n\t\t\tif(empty($price[1])){\n\t\t\t\t$price[1] = \"00\";\n\t\t\t}\n\t\t\t$price2 = explode(\".\",get_post_meta($post->ID, 'post_dishprice2', true ));\n\t\t\t\n\t\t\tif(empty($price2[0])){\n\t\t\t\t$price2[0] = \"0\";\n\t\t\t}\n\t\t\tif(empty($price2[1])){\n\t\t\t\t$price2[1] = \"00\";\n\t\t\t}\t\t\t\n\t\t\t?>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\tfunction isNumber(evt) {\n\t\t\t\t\tevt = (evt) ? evt : window.event;\n\t\t\t\t\tvar charCode = (evt.which) ? evt.which : evt.keyCode;\n\t\t\t\t\tif (charCode > 31 && (charCode < 48 || charCode > 57)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}</script>\n\t\t\t\n\t\t\t<label for=\"siteurl\">Set the current price of this dish.<br /></label>\n\t\t\t<p>\n\t\t\t\t$ <input type=\"text\" id=\"dish_price\" onkeypress=\"return isNumber(event)\" style=\"width:100px; text-align:right\" name=\"dish_price\" value=\"<?php echo $price[0]; ?>\">\n\t\t\t\t. <input type=\"text\" id=\"dish_price_cents\" onkeypress=\"return isNumber(event)\" maxlength=\"2\" style=\"width:25px;\" name=\"dish_price_cents\" value=\"<?php echo $price[1]; ?>\">\n\t\t\t</p>\n\t\t\t<label for=\"siteurl\">Set the Discounted price here or leave it as \"$0.00\" if there is no discounted price.Any value equal or over than $0.01 will be automatically considered as the new discounted price.<br /></label>\n\t\t\t<p>\n\t\t\t\t$ <input type=\"text\" id=\"dish_price2\" onkeypress=\"return isNumber(event)\" style=\"width:100px; text-align:right\" name=\"dish_price2\" value=\"<?php echo $price2[0]; ?>\">\n\t\t\t\t. <input type=\"text\" id=\"dish_price_cents2\" onkeypress=\"return isNumber(event)\" maxlength=\"2\" style=\"width:25px;\" name=\"dish_price_cents2\" value=\"<?php echo $price2[1]; ?>\">\n\t\t\t</p>\n\t\t\t<?php\n\t\t}",
"public function getCurrentPrice() : float;"
]
| [
"0.7004675",
"0.68093044",
"0.67928725",
"0.6758861",
"0.6666877",
"0.6584289",
"0.6584166",
"0.65273637",
"0.6521449",
"0.65157646",
"0.65157646",
"0.6499512",
"0.6447349",
"0.6447214",
"0.6436683",
"0.6380756",
"0.6380756",
"0.63705325",
"0.6361042",
"0.63405836",
"0.6335403",
"0.63336915",
"0.631977",
"0.63026303",
"0.6299503",
"0.6299503",
"0.6299503",
"0.6299503",
"0.62880814",
"0.62784463"
]
| 0.73609847 | 0 |
Assemble recalculate item event | protected function assembleRecalculateItemEvent(\XLite\Model\OrderItem $item)
{
$maxAmount = $item->getProductAvailableAmount();
if ($item->isPersistent() && \XLite\Core\Request::getInstance()->oldAmount) {
$maxAmount += \XLite\Core\Request::getInstance()->oldAmount;
\XLite\Core\Request::getInstance()->oldAmount = null;
}
return array(
'item_id' => $item->getItemId(),
'requestId' => \XLite\Core\Request::getInstance()->requestId,
'price' => $item->getNetPrice(),
'max_qty' => $maxAmount,
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function calculateSaleItem(Model\\SaleItemInterface $item);",
"public function recalc() {\n $this->_recalcBanner();\n $this->_recalcAdv();\n $this->_recalcAdvGroup();\n $this->_recalcCampaign();\n $this->_recalcProject();\n $this->_recalcSite();\n }",
"protected function displayRecalculateItemPrice(\\XLite\\Model\\OrderItem $item)\n {\n \\XLite\\Core\\Event::recalculateItem($this->assembleRecalculateItemEvent($item));\n }",
"private function _recalcAdv() {\n $this->_recalcEntity($this->adv, $this->advGroup->click_price); // @TODO Price is on advGroup. But this can be in the near future on every adv\n }",
"function calculate()\n {\n $this->first_period = $this->second_period = $this->rebill_times = null;\n foreach ($this->getCalculators() as $calc)\n $calc->calculate($this);\n // now summarize all items to invoice totals\n $priceFields = array(\n 'first_subtotal' => null,\n 'first_discount' => 'first_discount',\n 'first_tax' => 'first_tax',\n 'first_shipping' => 'first_shipping',\n 'first_total' => 'first_total',\n 'second_subtotal' => null,\n 'second_discount' => 'second_discount',\n 'second_tax' => 'second_tax',\n 'second_shipping' => 'second_shipping',\n 'second_total' => 'second_total',\n );\n foreach ($priceFields as $k => $kk)\n $this->$k = 0.0;\n foreach ($this->getItems() as $item) {\n $this->first_subtotal += moneyRound($item->first_price * $item->qty);\n $this->second_subtotal += moneyRound($item->second_price * $item->qty);\n foreach ($priceFields as $k => $kk)\n $this->$k += $kk ? $item->$kk : 0;\n }\n foreach ($priceFields as $k => $kk)\n $this->$k = moneyRound($this->$k);\n /// set periods, it has been checked for compatibility in @see add()\n $mostExpensiveItem = null;\n foreach ($this->getItems() as $item) {\n if (!$mostExpensiveItem || $item->first_price > $mostExpensiveItem->first_price) {\n $mostExpensiveItem = $item;\n }\n $this->currency = $item->currency;\n if (empty($this->first_period) && $item->rebill_times)\n $this->first_period = $item->first_period;\n if (empty($this->second_period))\n $this->second_period = $item->second_period;\n if (empty($this->rebill_times))\n $this->rebill_times = $item->rebill_times;\n $this->rebill_times = max($this->rebill_times, $item->rebill_times);\n }\n\n // First period is empty, invoice has only one time items,\n // set first period from most expensive item.\n if (empty($this->first_period) && $mostExpensiveItem) {\n $this->first_period = $mostExpensiveItem->first_period;\n }\n\n if ($this->currency == Am_Currency::getDefault())\n $this->base_currency_multi = 1.0;\n else {\n $this->base_currency_multi = $this->getDi()->currencyExchangeTable->getRate($this->currency,\n sqlDate(!empty($this->tm_added) ? $this->tm_added : $this->getDi()->sqlDateTime));\n if (!$this->base_currency_multi)\n $this->base_currency_multi = 1;\n }\n $this->getDi()->hook->call(Am_Event::INVOICE_CALCULATE, array('invoice' => $this));\n\n $this->terms = null;\n if ((count($this->getItems()) == 1) &&\n ($item = $this->getItem(0)) &&\n ($item->item_type == 'product') &&\n ($pr = $item->tryLoadProduct()) &&\n ($bp = $pr->getBillingPlan()) &&\n $bp->terms) {\n\n if (((float)$bp->first_price == (float)$this->first_total) &&\n ($bp->first_period == $this->first_period) &&\n ((float)$bp->second_price == (float)$this->second_total) &&\n ($bp->second_period == $this->second_period) &&\n ($bp->rebill_times == $this->rebill_times)\n ) {\n $this->terms = $bp->terms;\n }\n }\n\n $this->terms = $this->getDi()->hook->filter($this->terms,\n Am_Event::INVOICE_TERMS, array('invoice' => $this));\n\n return $this;\n }",
"protected function calculate() {\n\t\t$this->calculate_item_totals();\n\t\t$this->calculate_shipping_totals();\n\t\t$this->calculate_fee_totals();\n\t\t$this->calculate_totals();\n\t}",
"private function _recalcBanner() {\n // @TODO Here is no params for recalc...?\n }",
"private function compute()\n {\n if ($this->computed) {\n return true;\n }\n\n $this->load('items');\n\n foreach ($this->items as $item) {\n $this->_total += ($item->amount) / 100;\n $this->_gst += ($item->gst) / 100;\n $this->_pst += ($item->pst) / 100;\n }\n\n $this->computed = true;\n }",
"private function _recalcAdvGroup() {\n $this->_recalcEntity($this->advGroup, $this->advGroup->click_price); // @TODO Price is on advGroup. But this can be in the near future on every adv\n }",
"public function calculate();",
"public function calculate();",
"protected function calculatePrices()\n {\n }",
"public function calItem($quantity,$item_price){\n $cal_price=$quantity*$item_price;\n return $cal_price;\n }",
"protected function ensurePopulated() {\n if (empty($this->isCalculated)) {\n $items = $this->computeItems();\n foreach ($items as $item) {\n $this->appendItem($item);\n }\n $this->isCalculated = TRUE;\n }\n }",
"private function _recalcCampaign() {\n $this->_recalcEntity($this->campaign, $this->advGroup->click_price); // @TODO Price is on advGroup. But this can be in the near future on every adv\n }",
"private function calculate_item_prices()\r\n\t{\r\n\t\t// Loop through cart items.\r\n\t\tforeach($this->flexi->cart_contents['items'] as $row_id => $row)\r\n\t\t{\r\n\t\t\t// Check if the item has a specific tax rate set.\r\n\t\t\t$item_tax_rate = $this->get_item_tax_rate($row_id, FALSE); \r\n\r\n\t\t\t// Calculate the internal item price.\r\n\t\t\t$item_internal_tax_data = $this->calculate_tax($row[$this->flexi->cart_columns['item_internal_price']], $item_tax_rate);\r\n\r\n\t\t\t// Calculate the tax on the item price using the carts current location settings.\r\n\t\t\t$item_tax_data = $this->calculate_tax($item_internal_tax_data['value_ex_tax'], $item_tax_rate, FALSE, TRUE);\r\n\t\t\t\t\t\t\r\n\t\t\t// Update the item price.\r\n\t\t\t$row[$this->flexi->cart_columns['item_price']] = $this->format_calculation($item_tax_data['value_inc_tax']);\r\n\r\n\t\t\t// Save item pricing.\r\n\t\t\t$this->flexi->cart_contents['items'][$row_id] = $row;\r\n\t\t}\r\n\t}",
"function processPaymentFieldsSpecialEvents($entry)\n{\n global $dbPriceSingleTicket;\n global $dbPricePartHigh;\n global $dbPricePartHighBtw;\n global $dbTicketPricePart;\n global $dbTicketPricePartBtw;\n global $dbTicketPricePartTotal;\n global $dbBtwHigh;\n\n global $dbFoodPrice;\n $price_ticket_ex_food = $dbPriceSingleTicket - $dbFoodPrice;\n\n // If there is a reduction price which is smaller than the food price the price part high will be below zero\n if ($price_ticket_ex_food < 0) {\n $price_ticket_ex_food = 0;\n }\n\n global $dbParticipants;\n $dbTicketPricePart = $price_ticket_ex_food * count($dbParticipants);\n\n $dbTicketPricePartBtw = $dbTicketPricePart * $dbBtwHigh;\n $dbTicketPricePartTotal = $dbTicketPricePart + $dbTicketPricePartBtw;\n\n $dbPricePartHigh = $dbTicketPricePart + $dbParkingPricePart;\n $dbPricePartHighBtw = $dbPricePartHigh * $dbBtwHigh;\n\n global $dbPricePartHighTotal;\n $dbPricePartHighTotal = $dbPricePartHigh + $dbPricePartHighBtw;\n \n // Calculate low btw\n // When the reduction price is smaller than the food price take the reduction price\n global $dbPricePartLow;\n $dbPricePartLow = $dbFoodPrice;\n if ($dbTicketPrice < $dbFoodPrice) {\n $dbPricePartLow = $dbTicketPrice;\n }\n\n global $dbPricePartLowBtw;\n global $dbPricePartLowTotal;\n global $dbFoodPartPriceLow;\n global $dbFoodPartPriceLowBtw;\n global $dbFoodPartPriceLowTotal;\n\n global $dbBtwLow;\n\n $dbPricePartLow = count($dbParticipants) * $dbPricePartLow;\n $dbFoodPartPriceLow = $dbPricePartLow;\n $dbPricePartLowBtw = $dbPricePartLow * $dbBtwLow;\n $dbFoodPartPriceLowBtw = $dbPricePartLowBtw;\n $dbPricePartLowTotal = $dbPricePartLow + $dbPricePartLowBtw;\n $dbFoodPartPriceLowTotal = $dbPricePartLowTotal;\n\n // Payment details\n global $dbTotalBtw;\n $dbTotalBtw = $dbPricePartLowBtw + $dbPricePartHighBtw;\n global $dbTotalPrice;\n $dbTotalPrice = ($dbPriceSingleTicket * count($dbParticipants)) + $dbParkingPricePart + $dbMembershipPricePart;\n\n $rounded_total_price = number_format($dbTotalPrice * 100, 0, ',', '');\n $rounded_btw_part_low = number_format(($dbPricePartLowBtw) * 100, 0, ',', '');\n $rounded_btw_part_high = number_format(($dbPricePartHighBtw) * 100, 0, ',', '');\n\n global $dbTotalPriceBtw;\n $dbTotalPriceBtw = ($rounded_total_price + $rounded_btw_part_low + $rounded_btw_part_high) / 100;\n}",
"public function update(): void\n {\n // Update quality\n if ($this->item->sell_in > 10) {\n $this->item->quality++;\n }\n\n if ($this->item->sell_in <= 10 && $this->item->sell_in > 5) {\n $this->item->quality += 2;\n }\n\n if ($this->item->sell_in <= 5 && $this->item->sell_in > 0) {\n $this->item->quality += 3;\n }\n\n // Update Sell in\n $this->updateSellIn();\n\n if ($this->item->sell_in < 0) {\n $this->item->quality = 0;\n }\n\n $this->checkAndUpdateQualityByRange();\n }",
"public function emitEvolve()\n {\n //$this->emit('evolve');\n\n // Will update itself and parent\n $this->emitUp('evolve');\n }",
"public function execute()\r\n {\r\n $response = [\r\n 'errors' => false,\r\n 'message' => 'Re-calculate successful.'\r\n ];\r\n try {\r\n $this->quoteRepository->get($this->_checkoutSession->getQuoteId());\r\n $quote = $this->_checkoutSession->getQuote();\r\n\r\n $quote->collectTotals();\r\n $this->quoteRepository->save($quote);\r\n\r\n\r\n } catch (Exception $e) {\r\n $response = [\r\n 'errors' => true,\r\n 'message' => $e->getMessage()\r\n ];\r\n }\r\n\r\n /** @var Raw $resultRaw */\r\n $resultJson = $this->_resultJson->create();\r\n return $resultJson->setData($response);\r\n }",
"private function expandItems() {\n\t\t$items_cache = zbx_toHash($this->items, 'itemid');\n\t\t$items = $this->items;\n\n\t\tdo {\n\t\t\t$master_itemids = [];\n\n\t\t\tforeach ($items as $item) {\n\t\t\t\tif ($item['type'] == ITEM_TYPE_DEPENDENT && !array_key_exists($item['master_itemid'], $items_cache)) {\n\t\t\t\t\t$master_itemids[$item['master_itemid']] = true;\n\t\t\t\t}\n\t\t\t\t$items_cache[$item['itemid']] = $item;\n\t\t\t}\n\t\t\t$master_itemids = array_keys($master_itemids);\n\n\t\t\t$items = API::Item()->get([\n\t\t\t\t'output' => ['itemid', 'type', 'master_itemid', 'delay'],\n\t\t\t\t'itemids' => $master_itemids\n\t\t\t]);\n\t\t} while ($items);\n\n\t\t$update_interval_parser = new CUpdateIntervalParser();\n\n\t\tforeach ($this->items as &$graph_item) {\n\t\t\tif ($graph_item['type'] == ITEM_TYPE_DEPENDENT) {\n\t\t\t\t$master_item = $graph_item;\n\n\t\t\t\twhile ($master_item && $master_item['type'] == ITEM_TYPE_DEPENDENT) {\n\t\t\t\t\t$master_item = $items_cache[$master_item['master_itemid']];\n\t\t\t\t}\n\t\t\t\t$graph_item['type'] = $master_item['type'];\n\t\t\t\t$graph_item['delay'] = $master_item['delay'];\n\t\t\t}\n\n\t\t\t$graph_items = CMacrosResolverHelper::resolveItemNames([$graph_item]);\n\t\t\t$graph_items = CMacrosResolverHelper::resolveTimeUnitMacros($graph_items, ['delay']);\n\t\t\t$graph_item = reset($graph_items);\n\t\t\t$graph_item['name'] = $graph_item['name_expanded'];\n\t\t\t// getItemDelay will internally convert delay and flexible delay to seconds.\n\t\t\t$update_interval_parser->parse($graph_item['delay']);\n\t\t\t$graph_item['delay'] = getItemDelay($update_interval_parser->getDelay(),\n\t\t\t\t$update_interval_parser->getIntervals(ITEM_DELAY_FLEXIBLE)\n\t\t\t);\n\t\t\t$graph_item['has_scheduling_intervals']\n\t\t\t\t= (bool) $update_interval_parser->getIntervals(ITEM_DELAY_SCHEDULING);\n\n\t\t\tif (strpos($graph_item['units'], ',') === false) {\n\t\t\t\t$graph_item['unitsLong'] = '';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlist($graph_item['units'], $graph_item['unitsLong']) = explode(',', $graph_item['units']);\n\t\t\t}\n\t\t}\n\t\tunset($graph_item);\n\t}",
"public function update(): void\n {\n // Update quality\n $this->item->quality--;\n\n // Update Sell in\n $this->updateSellIn();\n\n // Check if we need to decrease quality again\n if ($this->item->sell_in < 0) {\n $this->item->quality--;\n }\n\n $this->checkAndUpdateQualityByRange();\n }",
"public static function recalc_event_income($req = []){\n\n\t\t// mandatory\n\t\t$mand = h::eX($req, [\n\t\t\t'from'\t\t=> '~Y-m-d H:i:s/d',\n\t\t\t'to'\t\t=> '~Y-m-d H:i:s/d',\n\t\t\t'step'\t\t=> '~^\\+[0-9]{1,2} (?:month|week|day|hour|min)$',\n\t\t\t], $error);\n\n\t\t// optional\n\t\t$opt = h::eX($req, [\n\t\t\t'abo'\t\t=> '~/b',\n\t\t\t'otp'\t\t=> '~/b',\n\t\t\t'smspay'\t=> '~/b',\n\t\t\t], $error, true);\n\n\t\t// on error\n\t\tif($error) return self::response(400, $error);\n\t\tif(empty($opt['abo']) and empty($opt['otp']) and empty($opt['smspay'])) return self::response(400, 'Need at least one of param abo, otp, smspay set to true');\n\n\n\t\t// step range\n\t\t$step_range = $mand['step'];\n\n\t\t// init times\n\t\t$from = $mand['from'];\n\t\t$end_time = h::date($mand['to']);\n\n\t\t// result array\n\t\t$stat = (object)[\n\t\t\t'interval'\t=> 0,\n\t\t\t'entries'\t=> 0,\n\t\t\t'skipped'\t=> 0,\n\t\t\t'nopayout'\t=> 0,\n\t\t\t'noupdate'\t=> 0,\n\t\t\t'updated'\t=> 0,\n\t\t\t'error'\t\t=> [],\n\t\t\t];\n\n\t\t// do for each step\n\t\tdo{\n\n\t\t\t// calc and convert next \"to\" time\n\t\t\t$to = h::date($from.' '.$step_range.' -1 sec');\n\t\t\t$to = h::dtstr($to < $end_time ? $to : $end_time);\n\n\t\t\t// increment interval\n\t\t\t$stat->interval++;\n\n\t\t\t// for each type\n\t\t\tforeach(['abo','otp','smspay'] as $type){\n\n\t\t\t\t// skip if event type should not be calculated\n\t\t\t\tif(empty($opt[$type])) continue;\n\n\t\t\t\t// load list\n\t\t\t\t$list = self::pdo('l_'.$type.'_stat_intime', [$from, $to]);\n\n\t\t\t\t// on error\n\t\t\t\tif($list === false) return self::response(560);\n\n\t\t\t\t// for each entry\n\t\t\t\tforeach($list as $entry){\n\n\t\t\t\t\t// count\n\t\t\t\t\t$stat->entries++;\n\n\t\t\t\t\t// skip entries without persistID\n\t\t\t\t\tif(!$entry->persistID){\n\n\t\t\t\t\t\t// count and continue\n\t\t\t\t\t\t$stat->skipped++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// load payout\n\t\t\t\t\t$res = nexus_service::get_service_payout([\n\t\t\t\t\t\t'operatorID'\t\t\t=> $entry->operatorID,\n\t\t\t\t\t\t'productID'\t\t\t\t=> $entry->productID,\n\t\t\t\t\t\t'product_type'\t\t\t=> $type,\n\t\t\t\t\t\t'fallback_operatorID'\t=> 0,\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t// if not found\n\t\t\t\t\tif($res->status == 400){\n\n\t\t\t\t\t\t// count and continue\n\t\t\t\t\t\t$stat->nopayout++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// on unexpected error\n\t\t\t\t\tif($res->status != 200){\n\n\t\t\t\t\t\t// count and continue\n\t\t\t\t\t\tif(!isset($stat->error['get_service_payout_'.$res->status])) $stat->error['get_service_payout_'.$res->status] = 0;\n\t\t\t\t\t\t$stat->error['get_service_payout_'.$res->status]++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// define payout and update\n\t\t\t\t\t$payout = $res->data->payout;\n\t\t\t\t\t$update = [];\n\n\t\t\t\t\t// for type abo\n\t\t\t\t\tif($type == 'abo'){\n\n\t\t\t\t\t\t// define update\n\t\t\t\t\t\t$update = [\n\t\t\t\t\t\t\t'aboID'\t\t=> $entry->aboID,\n\t\t\t\t\t\t\t'type'\t\t=> $type,\n\t\t\t\t\t\t\t'charges'\t=> $entry->charges_paid,\n\t\t\t\t\t\t\t'charges_max'=> $entry->charges,\n\t\t\t\t\t\t\t'income'\t=> round($entry->charges_paid * $payout, 2),\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// for type otp\n\t\t\t\t\tif($type == 'otp'){\n\n\t\t\t\t\t\t// define update\n\t\t\t\t\t\t$update = [\n\t\t\t\t\t\t\t'otpID'\t\t=> $entry->otpID,\n\t\t\t\t\t\t\t'type'\t\t=> $type,\n\t\t\t\t\t\t\t'income'\t=> round($payout, 2),\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// for type smspay\n\t\t\t\t\tif($type == 'smspay'){\n\n\t\t\t\t\t\t// load product\n\t\t\t\t\t\t$res = nexus_service::get_product([\n\t\t\t\t\t\t\t'type'\t\t=> 'smspay',\n\t\t\t\t\t\t\t'productID'\t=> $entry->productID,\n\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t// on error\n\t\t\t\t\t\tif($res->status != 200){\n\n\t\t\t\t\t\t\t// count and continue\n\t\t\t\t\t\t\tif(!isset($stat->error['get_product_'.$res->status])) $stat->error['get_product_'.$res->status] = 0;\n\t\t\t\t\t\t\t$stat->error['get_product_'.$res->status]++;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// take product\n\t\t\t\t\t\t$product = $res->data;\n\n\t\t\t\t\t\t// define billing type\n\t\t\t\t\t\t$billing_type = in_array($entry->operatorID, h::gX($product->param, 'mt_billing_operator') ?: []) ? 'mt' : 'mo';\n\n\t\t\t\t\t\t// define update\n\t\t\t\t\t\t$update = [\n\t\t\t\t\t\t\t'smspayID'\t=> $entry->smspayID,\n\t\t\t\t\t\t\t'type'\t\t=> $type,\n\t\t\t\t\t\t\t'mo'\t\t=> $entry->mo,\n\t\t\t\t\t\t\t'mt'\t\t=> $entry->mt,\n\t\t\t\t\t\t\t'billing'\t=> ($billing_type == 'mt') ? $entry->mt_paid : $entry->mo,\n\t\t\t\t\t\t\t'income'\t=> round((($billing_type == 'mt') ? $entry->mt_paid : $entry->mo) * $payout, 2),\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// if nothing to update\n\t\t\t\t\tif(!$update){\n\n\t\t\t\t\t\t// count and continue\n\t\t\t\t\t\t$stat->noupdate++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// update event\n\t\t\t\t\t$res = traffic_event::update_event($update);\n\n\t\t\t\t\t// on unexpected error\n\t\t\t\t\tif($res->status != 204){\n\n\t\t\t\t\t\t// count and continue\n\t\t\t\t\t\tif(!isset($stat->error['update_event_'.$res->status])) $stat->error['update_event_'.$res->status] = 0;\n\t\t\t\t\t\t$stat->error['update_event_'.$res->status]++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// count and continue\n\t\t\t\t\t$stat->updated++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t// take \"to\" as new \"from\" time\n\t\t\t$from = h::dtstr($to.' +1 sec');\n\n\t\t\t} while (h::date($to) < $end_time);\n\n\t\t// return result\n\t\treturn self::response(200, (object)['request' => $mand, 'stats' => $stat]);\n\t\t}",
"public function calculate()\n {\n\n $yesterday = Carbon::now()->subDay();\n $seven_days_ago = $yesterday->copy()->subDay(7);\n $twenty_eight_days_ago = $yesterday->copy()->subDay(28);\n\n $this->seven_day_food = $this->site->foodExpenses($seven_days_ago->toDateString(), $yesterday->toDateString())\n / $this->site->foodSales($seven_days_ago->toDateString(), $yesterday->toDateString());\n $this->twenty_eight_day_food = $this->site->foodExpenses($twenty_eight_days_ago->toDateString(), $yesterday->toDateString())\n / $this->site->foodSales($twenty_eight_days_ago->toDateString(), $yesterday->toDateString());\n // etc...\n\n\n }",
"public function calc() {\n $this->getChildNodes(0, 0, 0);\n }",
"private function setCalculate() {\n\n if($this->getType() == 2) {\n $det = new CalculateTwo($this->array);\n $this->result = $det->getResult();\n $this->rule = $det->getRule();\n $this->ruleExplanation = $det->getRuleExplanation();\n }\n elseif($this->getType() == 3) {\n\n $det = new CalculateThree($this->array);\n $this->result = $det->getResult();\n $this->rule = $det->getRule();\n $this->ruleExplanation = $det->getRuleExplanation();\n }\n else {\n $this->getPivot();\n $this->result = $this->setResult();\n $this->rule = $this->getPivotRule();\n $this->ruleExplanation = $this->process;\n }\n }",
"public function calculate(Component $interview)\n {\n }",
"abstract protected function calculateValue();",
"public function getItemsCollection()\r\n {\r\n $items = array();\r\n\r\n $colletions = $this->getOrder()->getItemsCollection();\r\n foreach($colletions as $item){\r\n $models = Mage::getModel(\"vendorsrma/item\")->getCollection()->addFieldToFilter(\"order_item_id\",$item->getId());\r\n $qty_rma_old = 0;\r\n $rmas = null;\r\n $options = Mage::getModel(\"vendorsrma/status\")->getOptions();\r\n foreach($models as $rma_item){\r\n $request = Mage::getModel(\"vendorsrma/request\")->load($rma_item->getRequestId());\r\n if($request->getData(\"status\") == $options[3][\"value\"]) continue;\r\n /* check request not complete */\r\n $qty_rma_old += $rma_item->getQty();\r\n\r\n $rmas[] = array($request->getId() => $request->getData(\"increment_id\"));\r\n }\r\n \r\n if( $this->getOrder()->getStatus() == Mage_Sales_Model_Order::STATE_COMPLETE){\r\n if($qty_rma_old == 0){\r\n $qty = $item->getData(\"qty_shipped\") - $item->getData(\"qty_refunded\") > 0 ? $item->getData(\"qty_shipped\") - $item->getData(\"qty_refunded\") : 0;\r\n $item->setData(\"qty_rma\",(int)$qty);\r\n $item->setData(\"allow_per_item_order\",$this->allowPerItem());\r\n }\r\n else{\r\n $qty = $item->getData(\"qty_shipped\") - $item->getData(\"qty_refunded\") - $qty_rma_old > 0 ? $item->getData(\"qty_shipped\") - $item->getData(\"qty_refunded\") - $qty_rma_old : 0;\r\n $item->setData(\"qty_rma\",(int)$qty);\r\n $item->setData(\"request_rma\",$rmas);\r\n $item->setData(\"allow_per_item_order\",$this->allowPerItem());\r\n }\r\n }\r\n else{\r\n if($qty_rma_old == 0){\r\n $qty = $item->getData(\"qty_invoiced\") > 0 ? $item->getData(\"qty_invoiced\") : 0;\r\n $item->setData(\"qty_rma\",(int)$qty);\r\n $item->setData(\"allow_per_item_order\",$this->allowPerItem());\r\n }\r\n else{\r\n $qty = $item->getData(\"qty_invoiced\") - $qty_rma_old > 0 ? $item->getData(\"qty_invoiced\") - $qty_rma_old : 0;\r\n $item->setData(\"qty_rma\",(int)$qty);\r\n $item->setData(\"request_rma\",$rmas);\r\n $item->setData(\"allow_per_item_order\",$this->allowPerItem());\r\n }\r\n }\r\n \r\n\r\n $items[] = $item;\r\n }\r\n\r\n\r\n return $items;\r\n }",
"protected function _aggregateTaxPerRate(\n $item, $rate, &$taxGroups, $taxId = null, $recalculateRowTotalInclTax = false, $amountReedemItem = 0\n )\n {\n $inclTax = $item->getIsPriceInclTax();\n $rateKey = ($taxId == null) ? (string)$rate : $taxId;\n $taxSubtotal = $subtotal = $item->getTaxableAmount();\n $baseTaxSubtotal = $baseSubtotal = $item->getBaseTaxableAmount();\n if(version_compare(Mage::getVersion(), '1.8', '>='))\n {\n //version is 1.6 or greater\n $isWeeeEnabled = $this->_weeeHelper->isEnabled();\n $isWeeeTaxable = $this->_weeeHelper->isTaxable();\n }\n\n if(!isset($taxGroups[$rateKey]['totals']))\n {\n $taxGroups[$rateKey]['totals'] = array();\n $taxGroups[$rateKey]['base_totals'] = array();\n $taxGroups[$rateKey]['weee_tax'] = array();\n $taxGroups[$rateKey]['base_weee_tax'] = array();\n }\n\n $hiddenTax = null;\n $baseHiddenTax = null;\n $weeeTax = null;\n $baseWeeeTax = null;\n $discount = 0;\n $rowTaxBeforeDiscount = 0;\n $baseRowTaxBeforeDiscount = 0;\n $weeeRowTaxBeforeDiscount = 0;\n $baseWeeeRowTaxBeforeDiscount = 0;\n\n\n switch ($this->_helper->getCalculationSequence($this->_store))\n {\n case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:\n case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:\n $rowTaxBeforeDiscount = $this->_calculator->calcTaxAmount($subtotal - $amountReedemItem, $rate, $inclTax, false);\n $baseRowTaxBeforeDiscount = $this->_calculator->calcTaxAmount($baseSubtotal - $amountReedemItem, $rate, $inclTax, false);\n if(version_compare(Mage::getVersion(), '1.8', '>='))\n {\n if($isWeeeEnabled && $isWeeeTaxable)\n {\n $weeeRowTaxBeforeDiscount = $this->_calculateRowWeeeTax(0, $item, $rate, false);\n $baseWeeeRowTaxBeforeDiscount = $this->_calculateRowWeeeTax(0, $item, $rate);\n $rowTaxBeforeDiscount += $weeeRowTaxBeforeDiscount;\n $baseRowTaxBeforeDiscount += $baseWeeeRowTaxBeforeDiscount;\n $taxGroups[$rateKey]['weee_tax'][] = $this->_deltaRound($weeeRowTaxBeforeDiscount,\n $rateKey, $inclTax);\n $taxGroups[$rateKey]['base_weee_tax'][] = $this->_deltaRound($baseWeeeRowTaxBeforeDiscount,\n $rateKey, $inclTax);\n }\n }\n\n $taxBeforeDiscountRounded = $rowTax = $this->_deltaRound($rowTaxBeforeDiscount, $rateKey, $inclTax);\n $baseTaxBeforeDiscountRounded = $baseRowTax = $this->_deltaRound($baseRowTaxBeforeDiscount,\n $rateKey, $inclTax, 'base');\n $item->setTaxAmount($item->getTaxAmount() + max(0, $rowTax));\n $item->setBaseTaxAmount($item->getBaseTaxAmount() + max(0, $baseRowTax));\n break;\n case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:\n case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:\n if($this->_helper->applyTaxOnOriginalPrice($this->_store))\n {\n $discount = $item->getOriginalDiscountAmount();\n $baseDiscount = $item->getBaseOriginalDiscountAmount();\n }\n else\n {\n $discount = $item->getDiscountAmount();\n $baseDiscount = $item->getBaseDiscountAmount();\n }\n\n if(version_compare(Mage::getVersion(), '1.8', '>='))\n {\n //We remove weee discount from discount if weee is not taxed\n if($isWeeeEnabled)\n {\n $discount = $discount - $item->getWeeeDiscount();\n $baseDiscount = $baseDiscount - $item->getBaseWeeeDiscount();\n }\n }\n\n $taxSubtotal = max($subtotal - $discount, 0);\n $baseTaxSubtotal = max($baseSubtotal - $baseDiscount, 0);\n\n $rowTax = $this->_calculator->calcTaxAmount($taxSubtotal - $amountReedemItem, $rate, $inclTax, false);\n $baseRowTax = $this->_calculator->calcTaxAmount($baseTaxSubtotal - $amountReedemItem, $rate, $inclTax, false);\n if(version_compare(Mage::getVersion(), '1.8', '>='))\n {\n if($isWeeeEnabled && $this->_weeeHelper->isTaxable())\n {\n $weeeTax = $this->_calculateRowWeeeTax($item->getWeeeDiscount(), $item, $rate, false);\n $rowTax += $weeeTax;\n $baseWeeeTax = $this->_calculateRowWeeeTax($item->getBaseWeeeDiscount(), $item, $rate);\n $baseRowTax += $baseWeeeTax;\n $taxGroups[$rateKey]['weee_tax'][] = $weeeTax;\n $taxGroups[$rateKey]['base_weee_tax'][] = $baseWeeeTax;\n }\n }\n\n $rowTax = $this->_deltaRound($rowTax, $rateKey, $inclTax);\n $baseRowTax = $this->_deltaRound($baseRowTax, $rateKey, $inclTax, 'base');\n\n $item->setTaxAmount($item->getTaxAmount() + max(0, $rowTax));\n $item->setBaseTaxAmount($item->getBaseTaxAmount() + max(0, $baseRowTax));\n\n //Calculate the Row taxes before discount\n $rowTaxBeforeDiscount = $this->_calculator->calcTaxAmount(\n $subtotal,\n $rate,\n $inclTax,\n false\n );\n $baseRowTaxBeforeDiscount = $this->_calculator->calcTaxAmount(\n $baseSubtotal,\n $rate,\n $inclTax,\n false\n );\n\n if(version_compare(Mage::getVersion(), '1.8', '>='))\n {\n if($isWeeeTaxable)\n {\n $weeeRowTaxBeforeDiscount = $this->_calculateRowWeeeTax(0, $item, $rate, false);\n $rowTaxBeforeDiscount += $weeeRowTaxBeforeDiscount;\n $baseWeeeRowTaxBeforeDiscount = $this->_calculateRowWeeeTax(0, $item, $rate);\n $baseRowTaxBeforeDiscount += $baseWeeeRowTaxBeforeDiscount;\n }\n }\n\n $taxBeforeDiscountRounded = max(\n 0,\n $this->_deltaRound($rowTaxBeforeDiscount, $rateKey, $inclTax, 'tax_before_discount')\n );\n $baseTaxBeforeDiscountRounded = max(\n 0,\n $this->_deltaRound($baseRowTaxBeforeDiscount, $rateKey, $inclTax, 'tax_before_discount_base')\n );\n\n if(!$item->getNoDiscount())\n {\n if($item->getWeeeTaxApplied())\n {\n $item->setDiscountTaxCompensation($item->getDiscountTaxCompensation() +\n $taxBeforeDiscountRounded - max(0, $rowTax));\n }\n }\n\n if($inclTax && $discount > 0)\n {\n $roundedHiddenTax = $taxBeforeDiscountRounded - max(0, $rowTax);\n $baseRoundedHiddenTax = $baseTaxBeforeDiscountRounded - max(0, $baseRowTax);\n $this->_hiddenTaxes[] = array(\n 'rate_key' => $rateKey,\n 'qty' => 1,\n 'item' => $item,\n 'value' => $roundedHiddenTax,\n 'base_value' => $baseRoundedHiddenTax,\n 'incl_tax' => $inclTax,\n );\n }\n break;\n }\n\n $rowTotalInclTax = $item->getRowTotalInclTax();\n if(!isset($rowTotalInclTax) || $recalculateRowTotalInclTax)\n {\n if($this->_config->priceIncludesTax($this->_store))\n {\n $item->setRowTotalInclTax($subtotal);\n $item->setBaseRowTotalInclTax($baseSubtotal);\n }\n else\n {\n $item->setRowTotalInclTax(\n $item->getRowTotalInclTax() + $taxBeforeDiscountRounded - $weeeRowTaxBeforeDiscount);\n $item->setBaseRowTotalInclTax(\n $item->getBaseRowTotalInclTax()\n + $baseTaxBeforeDiscountRounded\n - $baseWeeeRowTaxBeforeDiscount);\n }\n }\n $taxGroups[$rateKey]['totals'][] = max(0, $taxSubtotal);\n $taxGroups[$rateKey]['base_totals'][] = max(0, $baseTaxSubtotal);\n $taxGroups[$rateKey]['tax'][] = max(0, $rowTax);\n $taxGroups[$rateKey]['base_tax'][] = max(0, $baseRowTax);\n\n return $this;\n }"
]
| [
"0.57332504",
"0.566894",
"0.56579477",
"0.56414235",
"0.551623",
"0.55134463",
"0.5492954",
"0.53774244",
"0.53244734",
"0.5293547",
"0.5293547",
"0.52848476",
"0.51634645",
"0.51411337",
"0.5082443",
"0.50754374",
"0.5037552",
"0.50178355",
"0.49364346",
"0.49313438",
"0.4925189",
"0.4899776",
"0.48844975",
"0.4883032",
"0.4860336",
"0.4860192",
"0.48461682",
"0.4845732",
"0.48441848",
"0.48331785"
]
| 0.63777065 | 0 |
Assemble shipping dump surcharge | protected function assembleShippingDumpSurcharge()
{
return $this->assembleDefaultDumpSurcharge(
\XLite\Model\Base\Surcharge::TYPE_SHIPPING,
\XLite\Logic\Order\Modifier\Shipping::MODIFIER_CODE,
'\XLite\Logic\Order\Modifier\Shipping',
static::t('Shipping cost')
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function saveShippingAction() {\n\t\tif ($this->getRequest ()->isPost ()) {\n\t\t\t$preAddr = Mage::getSingleton ( 'customer/session' )->getPreaddress ();\n\t\t\t\n\t\t\tif ($preAddr) {\n\t\t\t\t$data = array ();\n\t\t\t\tif (! empty ( $preAddr ['ShippingAddress'] [0] )) {\n\t\t\t\t\t$preData = $preAddr ['ShippingAddress'];\n\t\t\t\t} else {\n\t\t\t\t\t$preData = $preAddr;\n\t\t\t\t}\n\t\t\t\t$dataId = $this->getRequest ()->getPost ( 'addressid' );\n\t\t\t\t\n\t\t\t\t$mpData = Mage::getModel ( 'masterpass/masterpass' );\n\t\t\t\tforeach ( $preData as $value ) {\n\t\t\t\t\tif ($dataId == $value ['AddressId']) {\n\t\t\t\t\t\t$reecipientName = $value ['RecipientName'];\n\t\t\t\t\t\t$name = Mage::helper ( 'masterpass' )->getRecipienName ( $reecipientName );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (! is_array ( $value ['Line2'] )) {\n\t\t\t\t\t\t\t$lin2 = $value ['Line2'];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$lin2 = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (! is_array ( $value ['Line3'] )) {\n\t\t\t\t\t\t\t$lin3 = $value ['Line3'];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$lin3 = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$regionIdS = Mage::helper ( 'masterpass' )->checkMasterpassData ( $mpData->statesMapping ( $value ['CountrySubdivision'] ) );\n\t\t\t\t\t\t$regionS = Mage::helper ( 'masterpass' )->checkMasterpassData ( $mpData->getMasterpassRegion ( $value ['CountrySubdivision'] ) );\n\t\t\t\t\t\t$shippingPhone = $mpData->getRemoveDash ( Mage::helper ( 'masterpass' )->checkMasterpassData ( $value ['RecipientPhoneNumber'] ) );\n\t\t\t\t\t\t$data = array (\n\t\t\t\t\t\t\t\t'firstname' => $name [0],\n\t\t\t\t\t\t\t\t'lastname' => $name [1],\n\t\t\t\t\t\t\t\t'street' => array (\n\t\t\t\t\t\t\t\t\t\t0 => $value ['Line1'],\n\t\t\t\t\t\t\t\t\t\t1 => $lin2,\n\t\t\t\t\t\t\t\t\t\t2 => $lin3 \n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'city' => $value ['City'],\n\t\t\t\t\t\t\t\t'region_id' => $regionIdS,\n\t\t\t\t\t\t\t\t'region' => $regionS,\n\t\t\t\t\t\t\t\t'postcode' => $value ['PostalCode'],\n\t\t\t\t\t\t\t\t'country_id' => $value ['Country'],\n\t\t\t\t\t\t\t\t'telephone' => $shippingPhone \n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$customerAddressId = $this->getRequest ()->getPost ( 'shipping_address_id', false );\n\t\t\t\t$this->getOnepage ()->saveShipping ( $data, $customerAddressId );\n\t\t\t}\n\t\t}\n\t\t$this->loadLayout ( false );\n\t\t$this->renderLayout ();\n\t}",
"function getShipping()\n {\n return array('name'=>'test','cost'=>4.5);\n }",
"public function _makeXML(Mage_Shipping_Model_Rate_Request $request, $items)\n {\n $consignorID = Mage::getStoreConfig('carriers/'.$this->_code.'/consignorID');\n\t\t$consignorkey = Mage::getStoreConfig('carriers/'.$this->_code.'/consignorkey');\n $store_currency = Mage::app()->getStore()-> getCurrentCurrencyCode();\n\n //added var checks + instantiations for cases like !request\n $issues = 0;\n $hasaddress = false;\n $customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping();\n if ($customerAddressId){\n $mainAddress = Mage::getModel('customer/address')->load($customerAddressId);\n $hasaddres = true;\n }\n\n //city\n if ($request->getDestCity()) {\n $city = $request->getDestCity();\n } elseif ($hasaddress) {\n $city = $mainAddress->getCity();\n } else {\n $city = \"\";\n //$issues++;\n }\n\n //region code\n if ($request->getDestRegionCode()) {\n $prov = $request->getDestRegionCode();\n } elseif ($hasaddress) {\n $prov = $mainAddress->getRegionId();\n } else {\n $prov = \"\";\n //$issues++;\n }\n\n //street line\nif ($request->getDestStreet()) {\n $streetline = $request->getDestStreet();\n } elseif ($hasaddress) {\n $streetline = $mainAddress->getStreet1();\n\t\t\t$streetline1 = $mainAddress->getStreet2();\n } else {\n $streetline = \"\";\n\t\t\t$streetline1 = \"\";\n //$issues++;\n }\n\n \n\n //country code\n if ($request->getDestCountryId()) {\n $destCountry = $request->getDestCountryId();\n } elseif ($hasaddress) {\n $destCountry = $mainAddress->getCountryId();\n } else {\n $destCountry = \"\";\n $issues++;\n }\n\n\n $country = Mage::getModel('directory/country')->load($destCountry)->getIso2Code();\n\n $postal = '';\n\n //postal code\n if (($request->getDestPostcode()) && ($request->getDestPostcode() != \"-\")) {\n $postal = $request->getDestPostcode();\n } elseif ($hasaddress) {\n $postal = $mainAddress->getPostcode();\n } else {\n $postal = \"\";\n $issues++;\n }\n\n\n\n if ($request->getOrigPostcode())\n {\n $spostalcode = $request->getOrigPostcode();\n }\n else\n {\n $spostalcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());\n }\n\n // later this can be switched based on customers selected language on site (EN || SV)\n $return_lang = 'EN';\n if($this->returnSwedish())\n {\n $return_lang = 'sv';\n }\n //mage::log($issues);\n if ($issues == 0) {\n\t\t\t\n\n $xml_bits = '<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>';\n\t\t\t $xml_bits.='\n<shipment xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <value>'.sprintf(\"%01.2f\", $this->_totalfinalp).'</value>\n ';\n $xml_bits.= \"\n <consignor>\n <id>\".$consignorID.\"</id>\n <key>\".$consignorkey.\"</key>\n <currency>\".$store_currency.\"</currency>\n <language>\".$return_lang.\"</language>\n\t<encoding>ISO 8859-1</encoding>\n </consignor>\n <no_agents>0</no_agents>\n <agents_in>1</agents_in>\n <parcels>\n \".$items.\"\n </parcels>\n <address>\n <street_address_1>\".$streetline.\"</street_address_1>\n <street_address_2>\".$streetline1.\"</street_address_2>\n <postal_code>\".$postal.\"</postal_code>\n <city_name>\".$city.\"</city_name>\n <residential>1</residential>\n <country_code>\".$country.\"</country_code>\n <country_subdivision_code>F</country_subdivision_code>\n </address>\n <referrer_code></referrer_code>\n</shipment>\n\";\n\n\n\n /*echo $xml_bits;\n\t exit;*/\n unset($return_lang);\n\t\t\tunset($consignorID);\n\t\t\tunset($consignorkey);\n unset($spostalcode);\n unset($items);\n unset($city);\n unset($prov);\n\t\t\tunset($streetline);\n\t\t\tunset($streetline1);\n unset($country);\n unset($postal);\n\n return $xml_bits;\n } else {\n unset($return_lang);\n \tunset($consignorID);\n\t\t\tunset($consignorkey);\n unset($spostalcode);\n unset($items);\n unset($city);\n unset($prov);\n\t\t\tunset($streetline);\n\t\t\tunset($streetline1);\n unset($country);\n unset($postal);\n\n return false;\n }\n\n }",
"public function actionUkrainepostShipping()\n {\n echo 20.14;\n }",
"private function _generateShippingData(){\n \n $shipping = new PagSeguroShipping();\n $shipping->setAddress($this->_generateShippingAddressData());\n $shipping->setType($this->_generateShippingType());\n $shipping->setCost(number_format($this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 2));\n \n return $shipping;\n }",
"public function shippingPaymentAction()\r\n {\r\n // Load payment options, select option and details\r\n $this->View()->sPayments = $this->getPayments();\r\n $this->View()->sFormData = array('payment' => $this->View()->sUserData['additional']['user']['paymentID']);\r\n $getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->sFormData['payment']);\r\n\r\n $paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);\r\n if ($paymentClass instanceof \\ShopwarePlugin\\PaymentMethods\\Components\\BasePaymentMethod) {\r\n $data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->sUserId);\r\n if (!empty($data)) {\r\n $this->View()->sFormData += $data;\r\n }\r\n }\r\n if ($this->Request()->isPost()) {\r\n $values = $this->Request()->getPost();\r\n $values['payment'] = $this->Request()->getPost('payment');\r\n $values['isPost'] = true;\r\n $this->View()->sFormData = $values;\r\n }\r\n\r\n $this->View()->sBasket = $this->getBasket();\r\n\r\n // Load current and all shipping methods\r\n $this->View()->sDispatch = $this->getSelectedDispatch();\r\n $this->View()->sDispatches = $this->getDispatches($this->View()->sFormData['payment']);\r\n\r\n $this->View()->sLaststock = $this->basket->sCheckBasketQuantities();\r\n $this->View()->sShippingcosts = $this->View()->sBasket['sShippingcosts'];\r\n $this->View()->sShippingcostsDifference = $this->View()->sBasket['sShippingcostsDifference'];\r\n $this->View()->sAmount = $this->View()->sBasket['sAmount'];\r\n $this->View()->sAmountWithTax = $this->View()->sBasket['sAmountWithTax'];\r\n $this->View()->sAmountTax = $this->View()->sBasket['sAmountTax'];\r\n $this->View()->sAmountNet = $this->View()->sBasket['AmountNetNumeric'];\r\n $this->View()->sRegisterFinished = !empty($this->session['sRegisterFinished']);\r\n $this->View()->sTargetAction = 'shippingPayment';\r\n $this->View()->sKUZOOffer = true;\r\n if ($this->Request()->getParam('isXHR')) {\r\n return $this->View()->loadTemplate('frontend/s_k_u_z_o_offer/shipping_payment_core.tpl');\r\n }\r\n }",
"public function save_shippingAction() {\r\n\t\t$shipping_method = $this->getRequest()->getPost('shipping_method', '');\r\n\t\t$payment_method = $this->getRequest()->getPost('payment_method', false);\r\n\t\t$old_shipping_method = $this->getOnepage()->getQuote()->getShippingAddress()->getShippingMethod();\r\n\t\t$billing_data = $this->getRequest()->getPost('billing', false);\r\n\t\tif($billing_data['country_id']){\r\n\t\t\tMage::getModel('checkout/session')->getQuote()->getBillingAddress()->setData('country_id',$billing_data['country_id'])->save();\r\n\t\t}\r\n\t\t// if ($shipping_method && $shipping_method != '' && $shipping_method != $old_shipping_method) {\r\n\t\t\tMage::helper('onestepcheckout')->saveShippingMethod($shipping_method);\r\n\t\t\t$this->getOnepage()->saveShippingMethod($shipping_method);\r\n\t\t// }\r\n\t\t\r\n\t\t// if ($payment_method != '') {\r\n\t\t\ttry{\r\n\t\t\t\t$payment = $this->getRequest()->getPost('payment', array());\r\n\t\t\t\t$payment['method'] = $payment_method;\r\n\t\t\t\t$this->getOnepage()->savePayment($payment);\r\n\t\t\t\tMage::helper('onestepcheckout')->savePaymentMethod($payment);\r\n\t\t\t}\r\n\t\t\tcatch(Exception $e) {\r\n\t\t\t\t//\r\n\t\t\t}\r\n\t\t// }\r\n\t\t\r\n\t\t// $paymentHtml = $this->_getPaymentMethodsHtml();\r\n\t\t// $reviewHtml = $this->_getReviewTotalHtml();\r\n\t\t// $result = array('payment' => $paymentHtml, \r\n\t\t\t\t\t\t\t\t\t\t// 'review' => $reviewHtml);\r\n\t\t// $this->getResponse()->setBody(Zend_Json::encode($result));\r\n\t\t$this->loadLayout(false);\r\n\t\t$this->renderLayout();\r\n\t}",
"public function getShippingDetails();",
"private function getShippingInformation()\n {\n $street = \"\";\n $number = \"\";\n $complement = \"\";\n $district = \"\";\n\n $fullAddress = $this->addressConfig($this->shippingData['street']);\n $street = $fullAddress[0] != '' ? $fullAddress[0] : $this->addressConfig($this->shippingData['street']);\n $number = is_null($fullAddress[1]) ? '' : $fullAddress[1];\n $complement = is_null($fullAddress[2]) ? '' : $fullAddress[2];\n $district = is_null($fullAddress[3]) ? '' : $fullAddress[3];\n\n $PagSeguroShipping = new PagSeguroShipping();\n $PagSeguroAddress = new PagSeguroAddress();\n $PagSeguroAddress->setCity($this->shippingData['city']);\n $PagSeguroAddress->setPostalCode(self::fixPostalCode($this->shippingData['postcode']));\n $PagSeguroAddress->setState($this->shippingData['region']);\n $PagSeguroAddress->setStreet($street);\n $PagSeguroAddress->setNumber($number);\n $PagSeguroAddress->setComplement($complement);\n $PagSeguroAddress->setDistrict($district);\n $PagSeguroShipping->setAddress($PagSeguroAddress);\n\n return $PagSeguroShipping;\n }",
"public function getShippingInfo();",
"public function calculate_shipping($package){\n \n $calc = $this->distance * $this->priceperkm;\n $cost = round( $calc, 2 );\n \n if($cost < $this->minimumprice) {\n $cost = $this->minimumprice;\n }\n \n// Calculating the % of the unloading variable\n global $woocommerce;\n $cartsubtotal = $woocommerce->cart->cart_contents_total;\n $unloadingtotal = ( $this->unloadingprice / 100 ) * $cartsubtotal;\n \n $cost2 = $cost + $unloadingtotal;\n \n \n \n// Sending the final rate to the user \n $this->add_rate( \n array(\n 'id' => $this->id,\n 'label' => $this->title,\n 'cost' => $cost\n )\n );\n \n $this->add_rate(\n array(\n 'id' => $this->id2,\n 'label' => $this->title2,\n 'cost' => $cost2\n ) \n );\n }",
"private function _generateShippingAddressData(){\n \n $address = new PagSeguroAddress();\n $delivery_address = new Address($this->context->cart->id_address_delivery);\n \n if (!is_null($delivery_address)){\n $address->setCity($delivery_address->city);\n $address->setPostalCode($delivery_address->postcode);\n $address->setStreet($delivery_address->address1);\n $address->setDistrict($delivery_address->address2);\n $address->setComplement($delivery_address->other);\n $address->setCity($delivery_address->city);\n \n $country = new Country($delivery_address->id_country);\n $address->setCountry($country->iso_code);\n \n $state = new State($delivery_address->id_state);\n $address->setState($state->iso_code);\n }\n \n return $address;\n }",
"public function getShipping();",
"function tariffplan_old() {\n $this->layout = 'public-package';\n $this->loadModel('Package');\n $this->loadModel('Psetting');\n if ($this->request->is('post')) {\n\n// http://production.shippingapis.com/ShippingAPI.dll?API= CityStateLookup&XML=<CityStateLookupRequest USERID=\"138TOTAL1122\"><ZipCode ID=\"0\">\n//<Zip5>90210</Zip5>\n//</ZipCode></CityStateLookupRequest>\n //90210\n\n $params = '<CityStateLookupRequest USERID=\"138TOTAL1122\"><ZipCode ID=\"0\"><Zip5>' . $this->request->data['Usps']['zipcode'] . '</Zip5></ZipCode></CityStateLookupRequest>';\n $HttpSocket = new HttpSocket();\n $results = $HttpSocket->post('http://production.shippingapis.com/ShippingAPI.dll', array('API' => 'CityStateLookup',\n 'XML' => $params\n )\n );\n $xml = new SimpleXMLElement($results);\n $state = (string) $xml->ZipCode->State;\n $this->loadModel('TariffCountry');\n\n\n $countries = $this->TariffCountry->find('list');\n if (in_array($state, $countries)) {\n $sql = \"SELECT psettings.* FROM packages\n LEFT JOIN psettings ON packages.id=psettings.package_id \n WHERE packages.name = 'Full package'\n \";\n $packageName = 'Full package';\n $packages = $this->Package->query($sql);\n // $packages = $this->Package->find('all');\n } else {\n $sql = \"SELECT psettings.*,packages.name FROM packages\n LEFT JOIN psettings ON packages.id=psettings.package_id \n WHERE packages.name = 'NABC special package'\n \";\n $packages = $this->Package->query($sql);\n $packageName = 'NABC special package';\n }\n $this->set(compact('packages', 'packageName'));\n } else {\n $sql = \"SELECT psettings.*,packages.name FROM packages\n LEFT JOIN psettings ON packages.id=psettings.package_id \n WHERE packages.name = 'NABC special package'\n \";\n $packages = $this->Package->query($sql);\n $packageName = 'NABC special package';\n $this->set(compact('packages', 'packageName'));\n }\n }",
"public function createShipment() {\n\t\t// create a Shipment object\n\t\ttry {\n\t\t $this->Shipment = new Ship\\Shipment( $this->shipmentData ); \n\t\t}\n\t\t// catch any exceptions \n\t\tcatch(\\Exception $e) {\n\t\t exit( WC_Shipping_Labels_Error( $e->getMessage() ) ); \n\t\t}\n\t}",
"function process()\n\t{\n\t\t\n\t\tif (isset($_REQUEST['id']) && !empty($_REQUEST['id']))\n\t\t{\n\t\t\tif (isset($_REQUEST['action']))\n\t\t\t{\n\t\t\t\tif ('edit' == $_REQUEST['action'])\n\t\t\t\t{\n\t\t\t\t\t$data = $GLOBALS['core.sql']->getRow(\"select * from #p#shipping where id = ? \",$_REQUEST['id']);\n\t\t\t\t\t$GLOBALS['core.smarty']->assign('data',$data);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ('delete' == $_REQUEST['action'])\n\t\t\t\t{\n\t\t\t\t\t$GLOBALS['core.store']->delete('shipping',array('key_name' => 'id','key_value' => $_REQUEST['id']));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (isset($_REQUEST['save']) && !empty($_REQUEST['save']))\n\t\t{\n\t\t\t$data = array();\n\t\t\tif (isset($_REQUEST['method']) && !empty($_REQUEST['method'])) $data['method'] = $_REQUEST['method'];\n\t\t\tif (isset($_REQUEST['price']) && !empty($_REQUEST['price'])) $data['price'] = $_REQUEST['price'];\n\t\t\tif (isset($_REQUEST['from_w'])) $data['from_w'] = $_REQUEST['from_w'];\n\t\t\tif (isset($_REQUEST['to_w'])) $data['to_w'] = $_REQUEST['to_w'];\n\t\t\t\n\t\t\t$key_info = array('key_name' => 'id');\n\t\t\tif (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) $key_info['key_value'] = $_REQUEST['id'];\n\t\t\t$GLOBALS['core.store']->save('shipping',$data,$key_info);\n\t\t}\n\t\t\n\t\t$list = $GLOBALS['core.sql']->getAll(\"select * from #p#shipping order by created \");\n\t\t$GLOBALS['core.smarty']->assign('list',$list);\t\t\n\t\t\n\t\t//end of shipping by weight code\n\t\t\n\t\t//fixed shipping code\n\t\t\n\t\tif (isset($_REQUEST['id']) && !empty($_REQUEST['id']))\n\t\t{\n\t\t\tif (isset($_REQUEST['action']))\n\t\t\t{\n\t\t\t\tif ('fixed_edit' == $_REQUEST['action'])\n\t\t\t\t{\n\t\t\t\t\t$data = $GLOBALS['core.sql']->getRow(\"select * from #p#fixed_shipping where id = ? \",$_REQUEST['id']);\n\t\t\t\t\t$GLOBALS['core.smarty']->assign('fixed_data',$data);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ('fixed_delete' == $_REQUEST['action'])\n\t\t\t\t{\n\t\t\t\t\t$GLOBALS['core.store']->delete('fixed_shipping',array('key_name' => 'id','key_value' => $_REQUEST['id']));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t\n\t\tif (isset($_REQUEST['save_fixed']) && !empty($_REQUEST['save_fixed']))\n\t\t{\n\t\t\t$data = array();\n\t\t\tif (isset($_REQUEST['method']) && !empty($_REQUEST['method'])) $data['method'] = $_REQUEST['method'];\n\t\t\tif (isset($_REQUEST['price']) && !empty($_REQUEST['price'])) $data['price'] = $_REQUEST['price'];\n\t\t\t\t\t\t\n\t\t\t$key_info = array('key_name' => 'id');\n\t\t\tif (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) $key_info['key_value'] = $_REQUEST['id'];\n\t\t\t$GLOBALS['core.store']->save('fixed_shipping',$data,$key_info);\n\t\t}\n\t\t\n\t\t$list = $GLOBALS['core.sql']->getAll(\"select * from #p#fixed_shipping order by created \");\n\t\t$GLOBALS['core.smarty']->assign('fixed_list',$list);\t\n\t\t\n\t\t//end of fixed shipping code\n\t\t\n\t\t//shipping by items code\n\t\t\n\t\tif (isset($_REQUEST['id']) && !empty($_REQUEST['id']))\n\t\t{\n\t\t\tif (isset($_REQUEST['action']))\n\t\t\t{\n\t\t\t\tif ('item_edit' == $_REQUEST['action'])\n\t\t\t\t{\n\t\t\t\t\t$data = $GLOBALS['core.sql']->getRow(\"select * from #p#item_shipping where id = ? \",$_REQUEST['id']);\n\t\t\t\t\t$GLOBALS['core.smarty']->assign('item_data',$data);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ('item_delete' == $_REQUEST['action'])\n\t\t\t\t{\n\t\t\t\t\t$GLOBALS['core.store']->delete('item_shipping',array('key_name' => 'id','key_value' => $_REQUEST['id']));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (isset($_REQUEST['save_item']) && !empty($_REQUEST['save_item']))\n\t\t{\n\t\t\t$data = array();\n\t\t\tif (isset($_REQUEST['method']) && !empty($_REQUEST['method'])) $data['method'] = $_REQUEST['method'];\n\t\t\tif (isset($_REQUEST['price']) && !empty($_REQUEST['price'])) $data['price'] = $_REQUEST['price'];\n\t\t\tif (isset($_REQUEST['from_w'])) $data['from_w'] = $_REQUEST['from_w'];\n\t\t\tif (isset($_REQUEST['to_w'])) $data['to_w'] = $_REQUEST['to_w'];\n\t\t\t\n\t\t\t$key_info = array('key_name' => 'id');\n\t\t\tif (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) $key_info['key_value'] = $_REQUEST['id'];\n\t\t\t$GLOBALS['core.store']->save('item_shipping',$data,$key_info);\n\t\t}\n\t\t\n\t\t$list = $GLOBALS['core.sql']->getAll(\"select * from #p#item_shipping order by created \");\n\t\t$GLOBALS['core.smarty']->assign('item_list',$list);\t\n\t\t\n\t\t//end of shipping by items code\n\t\t\n\t\treturn Admin_Header::out('admin_shipping');\n\t}",
"function calculate($shipping) {\n\t\t\t// Packages - make sure they don't exceed maximum\n\t\t\t$packages = $shipping->packages;\n\t\t\tif($this->package_max) $packages = $shipping->packages_max($packages,$this->package_max);\n\t\t\t\n\t\t\t// Missing credentials\n\t\t\tif(!$this->username) {\n\t\t\t\tthrow new \\Exception(\"USPS username is missing.\");\t\n\t\t\t}\n\t\t\t// Missing shipping object\n\t\t\tif(!$shipping) {\n\t\t\t\tthrow new \\Exception(\"No 'shipping' object passed.\");\n\t\t\t}\n\t\t\t// No methods\n\t\t\tif(!$this->methods) {\n\t\t\t\tthrow new \\Exception(\"No shipping methods defined.\");\n\t\t\t}\n\t\t\t\n\t\t\t// Rates\n\t\t\t$rates = NULL;\n\t\t\t\t\n\t\t\t// Strip - characters they add in to their 'codes' that we don't want\n\t\t\t$strip = array(\n\t\t\t\t'&lt;sup&gt;&amp;reg;&lt;/sup&gt;',\n\t\t\t\t'&lt;sup&gt;&amp;trade;&lt;/sup&gt;',\n\t\t\t\t'&lt;sup&gt;&#174;&lt;/sup&gt;',\n\t\t\t\t'&lt;sup&gt;&#8482;&lt;/sup&gt;',\n\t\t\t\t' 1-Day',\n\t\t\t\t' 2-Day',\n\t\t\t\t' 3-Day',\n\t\t\t\t' Military',\n\t\t\t\t' DPO',\n\t\t\t\t'*',\n\t\t\t\t' ',\n\t\t\t\t' ',\n\t\t\t\t' ',\n\t\t\t);\n\t\t\t\n\t\t\t// Countries - United States - US territories that have their own country code\n\t\t\t$countries_us = array(\n\t\t\t\t'AS', // Samoa American\n\t\t\t\t'GU', // Guam\n\t\t\t\t'MP', // Northern Mariana Islands\n\t\t\t\t'PW', // Palau\n\t\t\t\t'PR', // Puerto Rico\n\t\t\t\t'VI' // Virgin Islands US\n\t\t\t);\n\t\t\t\n\t\t\t// United States (and US territories)\n\t\t\tif($shipping->to_country == \"US\" or in_array($shipping->to_country,$countries_us)) {\n\t\t\t\t$url = \"http://production.shippingapis.com/ShippingAPI.dll\";\n\t\t\t\t$xml = '\n\t<RateV4Request USERID=\"'.$this->username.'\">';\n\t\t\t\tforeach($packages as $x => $package) {\n\t\t\t\t\t// Weight (in lbs) - already in lbs, but just in case\n\t\t\t\t\t$weight = $shipping->convert_weight($package['weight'],$package['weight_unit'],'lb');\n\t\t\t\t\t// Split into lbs and ozs\n\t\t\t\t\t$lbs = floor($weight);\n\t\t\t\t\t$ozs = ($weight - $lbs) * 16;\n\t\t\t\t\tif($lbs == 0 and $ozs < 1) $ozs = 1;\n\t\t\t\t\t\n\t\t\t\t\t// Dimensions - have to re-convert here because requires a minimum of 1\n\t\t\t\t\t$width = $shipping->convert_dimensions($package['dimensions_width'],$package['dimensions_unit'],\"in\",1);\n\t\t\t\t\t$length = $shipping->convert_dimensions($package['dimensions_length'],$package['dimensions_unit'],\"in\",1);\n\t\t\t\t\t$height = $shipping->convert_dimensions($package['dimensions_height'],$package['dimensions_unit'],\"in\",1);\n\t\t\t\t\t// Package size\n\t\t\t\t\t$size = 'REGULAR';\n\t\t\t\t\tif($width > 12 or $length > 12 or $height > 12) $size = \"LARGE\";\n\t\t\t\t\t// Package container\n\t\t\t\t\tif($size == \"LARGE\") $container = 'RECTANGULAR';\n\t\t\t\t\t\n\t\t\t\t\t// XML\n\t\t\t\t\t$xml .= '\n\t\t<Package ID=\"'.($x + 1).'\">\n\t\t\t<Service>'.(/*count($this->methods) == 1 ? reset($this->methods) : */\"ALL\").'</Service>\n\t\t\t<ZipOrigination>'.$shipping->from_zip.'</ZipOrigination>\n\t\t\t<ZipDestination>'.$shipping->to_zip.'</ZipDestination>\n\t\t\t<Pounds>'.$lbs.'</Pounds>\n\t\t\t<Ounces>'.$ozs.'</Ounces>\n\t\t\t<Container>'.(isset($container) ? $container : '').'</Container>\n\t\t\t<Size>'.$size.'</Size>\n\t\t\t<Width>'.$width.'</Width> \n\t\t\t<Length>'.$length.'</Length> \n\t\t\t<Height>'.$height.'</Height> \n\t\t\t<Machinable>TRUE</Machinable>\n\t\t</Package>';\n\t\t\t\t}\n\t\t\t\t$xml .= '\n\t</RateV4Request>';\n\t\t\t\t$data = \"API=RateV4&XML=\".$xml;\n\t\t\t\n\t\t\t\t// Curl\n\t\t\t\t$results = $shipping->curl($url,$data);\n\t\t\t\t\n\t\t\t\t// Debug\n\t\t\t\tif($shipping->debug) {\n\t\t\t\t\tprint \"xml: <xmp>\".$xml.\"</xmp><br />\";\n\t\t\t\t\tprint \"results: <xmp>\".$results.\"</xmp><br />\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Match rate(s)\n\t\t\t\tpreg_match_all('/<Package ID=\"([0-9]{1,3})\">(.+?)<\\/Package>/s',$results,$results_packages);\n\t\t\t\tforeach($results_packages[2] as $x => $results_package) {\n\t\t\t\t\tpreg_match_all('/<Postage CLASSID=\"([0-9]{1,3})\">(.+?)<\\/Postage>/s',$results_package,$results_methods);\n\t\t\t\t\tforeach($results_methods[2] as $y => $results_method) {\n\t\t\t\t\t\t// Name\n\t\t\t\t\t\tpreg_match('/<MailService>(.+?)<\\/MailService>/',$results_method,$name);\n\t\t\t\t\t\t$name = str_replace($strip,'',$name[1]);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Use name, get rate\n\t\t\t\t\t\tif($name and in_array($name,$this->methods)) {\n\t\t\t\t\t\t\tpreg_match('/<Rate>(.+?)<\\/Rate>/',$results_method,$rate);\n\t\t\t\t\t\t\tif($rate[1]) {\n\t\t\t\t\t\t\t\tif($this->package_fits($shipping,$packages,$name)) {\n\t\t\t\t\t\t\t\t\tif(!isset($rates['rates'][$name])) $rates['rates'][$name] = 0;\n\t\t\t\t\t\t\t\t\t$rates['rates'][$name] += $rate[1];\n\t\t\t\t\t\t\t\t\t$rates['packages'][$x]['package'] = $packages[$x];\n\t\t\t\t\t\t\t\t\tif(!isset($rates['packages'][$x]['rates'][$name])) $rates['packages'][$x]['rates'][$name] = 0;\n\t\t\t\t\t\t\t\t\t$rates['packages'][$x]['rates'][$name] += $rate[1];\n\t\t\t\t\t\t\t\t\tif(!isset($rates['names'][$name])) $rates['names'][$name] = $this->name($name);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// International\n\t\t\telse {\n\t\t\t\t// Counties - need to pass country name, not code\n\t\t\t\t $countries = array(\n\t\t\t\t\t'AF' => 'Afghanistan',\n\t\t\t\t\t'AL' => 'Albania',\n\t\t\t\t\t'AX' => 'Aland Island (Finland)',\n\t\t\t\t\t'DZ' => 'Algeria',\n\t\t\t\t\t'AD' => 'Andorra',\n\t\t\t\t\t'AO' => 'Angola',\n\t\t\t\t\t'AI' => 'Anguilla',\n\t\t\t\t\t'AG' => 'Antigua and Barbuda',\n\t\t\t\t\t'AR' => 'Argentina',\n\t\t\t\t\t'AM' => 'Armenia',\n\t\t\t\t\t'AW' => 'Aruba',\n\t\t\t\t\t'AU' => 'Australia',\n\t\t\t\t\t'AT' => 'Austria',\n\t\t\t\t\t'AZ' => 'Azerbaijan',\n\t\t\t\t\t'BS' => 'Bahamas',\n\t\t\t\t\t'BH' => 'Bahrain',\n\t\t\t\t\t'BD' => 'Bangladesh',\n\t\t\t\t\t'BB' => 'Barbados',\n\t\t\t\t\t'BY' => 'Belarus',\n\t\t\t\t\t'BE' => 'Belgium',\n\t\t\t\t\t'BZ' => 'Belize',\n\t\t\t\t\t'BJ' => 'Benin',\n\t\t\t\t\t'BM' => 'Bermuda',\n\t\t\t\t\t'BT' => 'Bhutan',\n\t\t\t\t\t'BO' => 'Bolivia',\n\t\t\t\t\t'BA' => 'Bosnia-Herzegovina',\n\t\t\t\t\t'BW' => 'Botswana',\n\t\t\t\t\t'BR' => 'Brazil',\n\t\t\t\t\t'VG' => 'British Virgin Islands',\n\t\t\t\t\t'BN' => 'Brunei Darussalam',\n\t\t\t\t\t'BG' => 'Bulgaria',\n\t\t\t\t\t'BF' => 'Burkina Faso',\n\t\t\t\t\t'MM' => 'Burma',\n\t\t\t\t\t'BI' => 'Burundi',\n\t\t\t\t\t'KH' => 'Cambodia',\n\t\t\t\t\t'CM' => 'Cameroon',\n\t\t\t\t\t'CA' => 'Canada',\n\t\t\t\t\t'CV' => 'Cape Verde',\n\t\t\t\t\t'KY' => 'Cayman Islands',\n\t\t\t\t\t'CF' => 'Central African Republic',\n\t\t\t\t\t'TD' => 'Chad',\n\t\t\t\t\t'CL' => 'Chile',\n\t\t\t\t\t'CN' => 'China',\n\t\t\t\t\t'CX' => 'Christmas Island (Australia)',\n\t\t\t\t\t'CC' => 'Cocos Island (Australia)',\n\t\t\t\t\t'CO' => 'Colombia',\n\t\t\t\t\t'KM' => 'Comoros',\n\t\t\t\t\t'CG' => 'Congo, Republic of the',\n\t\t\t\t\t'CD' => 'Congo, Democratic Republic of the',\n\t\t\t\t\t'CK' => 'Cook Islands (New Zealand)',\n\t\t\t\t\t'CR' => 'Costa Rica',\n\t\t\t\t\t'CI' => 'Cote d Ivoire (Ivory Coast)',\n\t\t\t\t\t'HR' => 'Croatia',\n\t\t\t\t\t'CU' => 'Cuba',\n\t\t\t\t\t'CY' => 'Cyprus',\n\t\t\t\t\t'CZ' => 'Czech Republic',\n\t\t\t\t\t'DK' => 'Denmark',\n\t\t\t\t\t'DJ' => 'Djibouti',\n\t\t\t\t\t'DM' => 'Dominica',\n\t\t\t\t\t'DO' => 'Dominican Republic',\n\t\t\t\t\t'EC' => 'Ecuador',\n\t\t\t\t\t'EG' => 'Egypt',\n\t\t\t\t\t'SV' => 'El Salvador',\n\t\t\t\t\t'GQ' => 'Equatorial Guinea',\n\t\t\t\t\t'ER' => 'Eritrea',\n\t\t\t\t\t'EE' => 'Estonia',\n\t\t\t\t\t'ET' => 'Ethiopia',\n\t\t\t\t\t'FK' => 'Falkland Islands',\n\t\t\t\t\t'FO' => 'Faroe Islands',\n\t\t\t\t\t'FJ' => 'Fiji',\n\t\t\t\t\t'FI' => 'Finland',\n\t\t\t\t\t'FR' => 'France',\n\t\t\t\t\t'GF' => 'French Guiana',\n\t\t\t\t\t'PF' => 'French Polynesia',\n\t\t\t\t\t'GA' => 'Gabon',\n\t\t\t\t\t'GM' => 'Gambia',\n\t\t\t\t\t'GE' => 'Georgia, Republic of',\n\t\t\t\t\t'DE' => 'Germany',\n\t\t\t\t\t'GH' => 'Ghana',\n\t\t\t\t\t'GI' => 'Gibraltar',\n\t\t\t\t\t'GB' => 'Great Britain and Northern Ireland',\n\t\t\t\t\t'GR' => 'Greece',\n\t\t\t\t\t'GL' => 'Greenland',\n\t\t\t\t\t'GD' => 'Grenada',\n\t\t\t\t\t'GP' => 'Guadeloupe',\n\t\t\t\t\t'GT' => 'Guatemala',\n\t\t\t\t\t'GN' => 'Guinea',\n\t\t\t\t\t'GW' => 'Guinea-Bissau',\n\t\t\t\t\t'GY' => 'Guyana',\n\t\t\t\t\t'HT' => 'Haiti',\n\t\t\t\t\t'HN' => 'Honduras',\n\t\t\t\t\t'HK' => 'Hong Kong',\n\t\t\t\t\t'HU' => 'Hungary',\n\t\t\t\t\t'IS' => 'Iceland',\n\t\t\t\t\t'IN' => 'India',\n\t\t\t\t\t'ID' => 'Indonesia',\n\t\t\t\t\t'IR' => 'Iran',\n\t\t\t\t\t'IQ' => 'Iraq',\n\t\t\t\t\t'IE' => 'Ireland',\n\t\t\t\t\t'IL' => 'Israel',\n\t\t\t\t\t'IT' => 'Italy',\n\t\t\t\t\t'JM' => 'Jamaica',\n\t\t\t\t\t'JP' => 'Japan',\n\t\t\t\t\t'JO' => 'Jordan',\n\t\t\t\t\t'KZ' => 'Kazakhstan',\n\t\t\t\t\t'KE' => 'Kenya',\n\t\t\t\t\t'KI' => 'Kiribati',\n\t\t\t\t\t'KW' => 'Kuwait',\n\t\t\t\t\t'KG' => 'Kyrgyzstan',\n\t\t\t\t\t'LA' => 'Laos',\n\t\t\t\t\t'LV' => 'Latvia',\n\t\t\t\t\t'LB' => 'Lebanon',\n\t\t\t\t\t'LS' => 'Lesotho',\n\t\t\t\t\t'LR' => 'Liberia',\n\t\t\t\t\t'LY' => 'Libya',\n\t\t\t\t\t'LI' => 'Liechtenstein',\n\t\t\t\t\t'LT' => 'Lithuania',\n\t\t\t\t\t'LU' => 'Luxembourg',\n\t\t\t\t\t'MO' => 'Macao',\n\t\t\t\t\t'MK' => 'Macedonia, Republic of',\n\t\t\t\t\t'MG' => 'Madagascar',\n\t\t\t\t\t'MW' => 'Malawi',\n\t\t\t\t\t'MY' => 'Malaysia',\n\t\t\t\t\t'MV' => 'Maldives',\n\t\t\t\t\t'ML' => 'Mali',\n\t\t\t\t\t'MT' => 'Malta',\n\t\t\t\t\t'MQ' => 'Martinique',\n\t\t\t\t\t'MR' => 'Mauritania',\n\t\t\t\t\t'MU' => 'Mauritius',\n\t\t\t\t\t'YT' => 'Mayotte (France)',\n\t\t\t\t\t'MX' => 'Mexico',\n\t\t\t\t\t'FM' => 'Micronesia, Federated States of',\n\t\t\t\t\t'MD' => 'Moldova',\n\t\t\t\t\t'MC' => 'Monaco (France)',\n\t\t\t\t\t'MN' => 'Mongolia',\n\t\t\t\t\t'MS' => 'Montserrat',\n\t\t\t\t\t'MA' => 'Morocco',\n\t\t\t\t\t'MZ' => 'Mozambique',\n\t\t\t\t\t'NA' => 'Namibia',\n\t\t\t\t\t'NR' => 'Nauru',\n\t\t\t\t\t'NP' => 'Nepal',\n\t\t\t\t\t'NL' => 'Netherlands',\n\t\t\t\t\t'AN' => 'Netherlands Antilles',\n\t\t\t\t\t'NC' => 'New Caledonia',\n\t\t\t\t\t'NZ' => 'New Zealand',\n\t\t\t\t\t'NI' => 'Nicaragua',\n\t\t\t\t\t'NE' => 'Niger',\n\t\t\t\t\t'NG' => 'Nigeria',\n\t\t\t\t\t'KP' => 'North Korea (Korea, Democratic People\\'s Republic of)',\n\t\t\t\t\t'NO' => 'Norway',\n\t\t\t\t\t'OM' => 'Oman',\n\t\t\t\t\t'PK' => 'Pakistan',\n\t\t\t\t\t'PA' => 'Panama',\n\t\t\t\t\t'PG' => 'Papua New Guinea',\n\t\t\t\t\t'PY' => 'Paraguay',\n\t\t\t\t\t'PE' => 'Peru',\n\t\t\t\t\t'PH' => 'Philippines',\n\t\t\t\t\t'PN' => 'Pitcairn Island',\n\t\t\t\t\t'PL' => 'Poland',\n\t\t\t\t\t'PT' => 'Portugal',\n\t\t\t\t\t'QA' => 'Qatar',\n\t\t\t\t\t'RE' => 'Reunion',\n\t\t\t\t\t'RO' => 'Romania',\n\t\t\t\t\t'RU' => 'Russia',\n\t\t\t\t\t'RW' => 'Rwanda',\n\t\t\t\t\t'SH' => 'Saint Helena',\n\t\t\t\t\t'KN' => 'Saint Kitts (St. Christopher and Nevis)',\n\t\t\t\t\t'LC' => 'Saint Lucia',\n\t\t\t\t\t'PM' => 'Saint Pierre and Miquelon',\n\t\t\t\t\t'VC' => 'Saint Vincent and the Grenadines',\n\t\t\t\t\t'SM' => 'San Marino',\n\t\t\t\t\t'ST' => 'Sao Tome and Principe',\n\t\t\t\t\t'SA' => 'Saudi Arabia',\n\t\t\t\t\t'SN' => 'Senegal',\n\t\t\t\t\t'RS' => 'Serbia',\n\t\t\t\t\t'SC' => 'Seychelles',\n\t\t\t\t\t'SL' => 'Sierra Leone',\n\t\t\t\t\t'SG' => 'Singapore',\n\t\t\t\t\t'SK' => 'Slovak Republic',\n\t\t\t\t\t'SI' => 'Slovenia',\n\t\t\t\t\t'SB' => 'Solomon Islands',\n\t\t\t\t\t'SO' => 'Somalia',\n\t\t\t\t\t'ZA' => 'South Africa',\n\t\t\t\t\t'GS' => 'South Georgia (Falkland Islands)',\n\t\t\t\t\t'KR' => 'South Korea (Korea, Republic of)',\n\t\t\t\t\t'ES' => 'Spain',\n\t\t\t\t\t'LK' => 'Sri Lanka',\n\t\t\t\t\t'SD' => 'Sudan',\n\t\t\t\t\t'SR' => 'Suriname',\n\t\t\t\t\t'SZ' => 'Swaziland',\n\t\t\t\t\t'SE' => 'Sweden',\n\t\t\t\t\t'CH' => 'Switzerland',\n\t\t\t\t\t'SY' => 'Syrian Arab Republic',\n\t\t\t\t\t'TW' => 'Taiwan',\n\t\t\t\t\t'TJ' => 'Tajikistan',\n\t\t\t\t\t'TZ' => 'Tanzania',\n\t\t\t\t\t'TH' => 'Thailand',\n\t\t\t\t\t'TL' => 'East Timor (Indonesia)',\n\t\t\t\t\t'TG' => 'Togo',\n\t\t\t\t\t'TK' => 'Tokelau (Union) Group (Western Samoa)',\n\t\t\t\t\t'TO' => 'Tonga',\n\t\t\t\t\t'TT' => 'Trinidad and Tobago',\n\t\t\t\t\t'TN' => 'Tunisia',\n\t\t\t\t\t'TR' => 'Turkey',\n\t\t\t\t\t'TM' => 'Turkmenistan',\n\t\t\t\t\t'TC' => 'Turks and Caicos Islands',\n\t\t\t\t\t'TV' => 'Tuvalu',\n\t\t\t\t\t'UG' => 'Uganda',\n\t\t\t\t\t'UA' => 'Ukraine',\n\t\t\t\t\t'AE' => 'United Arab Emirates',\n\t\t\t\t\t'UY' => 'Uruguay',\n\t\t\t\t\t'UZ' => 'Uzbekistan',\n\t\t\t\t\t'VU' => 'Vanuatu',\n\t\t\t\t\t'VA' => 'Vatican City',\n\t\t\t\t\t'VE' => 'Venezuela',\n\t\t\t\t\t'VN' => 'Vietnam',\n\t\t\t\t\t'WF' => 'Wallis and Futuna Islands',\n\t\t\t\t\t'WS' => 'Western Samoa',\n\t\t\t\t\t'YE' => 'Yemen',\n\t\t\t\t\t'ZM' => 'Zambia',\n\t\t\t\t\t'ZW' => 'Zimbabwe'\n\t\t\t\t);\n\t\t\t\t \n\t\t\t\t$url = \"http://production.shippingapis.com/ShippingAPI.dll\";\n\t\t\t\t$xml = '\n\t<IntlRateV2Request USERID=\"'.$this->username.'\">';\n\t\t\t\tforeach($packages as $x => $package) {\n\t\t\t\t\t// Weight (in lbs) - already in lbs, but just in case\n\t\t\t\t\t$weight = $shipping->convert_weight($package['weight'],$package['weight_unit'],'lb');\n\t\t\t\t\t// Split into lbs and ozs\n\t\t\t\t\t$lbs = floor($weight);\n\t\t\t\t\t$ozs = ($weight - $lbs) * 16;\n\t\t\t\t\tif($lbs == 0 and $ozs < 1) $ozs = 1;\n\t\t\t\t\t\n\t\t\t\t\t// XML\n\t\t\t\t\t$xml .= '\n\t\t<Package ID=\"'.($x + 1).'\">\n\t\t\t<Pounds>'.$lbs.'</Pounds>\n\t\t\t<Ounces>'.$ozs.'</Ounces>\n\t\t\t<Machinable>TRUE</Machinable>\n\t\t\t<MailType>Package</MailType>\n\t\t\t<GXG>\n\t\t\t\t<POBoxFlag>N</POBoxFlag>\n\t\t\t\t<GiftFlag>N</GiftFlag>\n\t\t\t</GXG>\n\t\t\t<ValueOfContents>0.00</ValueOfContents>\n\t\t\t<Country>'.$countries[$shipping->to_country].'</Country>\n\t\t\t<Container>RECTANGULAR</Container>\n\t\t\t<Size>REGULAR</Size>';\n\t\t\t\t\t// Dimensions - have to re-convert here because requires a minimum of 1\n\t\t\t\t\t$xml .= '\n\t\t\t<Width>'.$shipping->convert_dimensions($package['dimensions_width'],$package['dimensions_unit'],\"in\",1).'</Width> \n\t\t\t<Length>'.$shipping->convert_dimensions($package['dimensions_length'],$package['dimensions_unit'],\"in\",1).'</Length> \n\t\t\t<Height>'.$shipping->convert_dimensions($package['dimensions_height'],$package['dimensions_unit'],\"in\",1).'</Height> \n\t\t\t<Girth>10</Girth> \n\t\t</Package>';\n\t\t\t\t}\n\t\t\t\t$xml .= '\n\t</IntlRateV2Request>';\n\t\t\t\t$data = \"API=IntlRateV2&XML=\".$xml;\n\t\t\t\n\t\t\t\t// Curl\n\t\t\t\t$results = $shipping->curl($url,$data);\n\t\t\t\t\n\t\t\t\t// Debug\n\t\t\t\tif($shipping->debug) {\n\t\t\t\t\tprint \"xml: <xmp>\".$xml.\"</xmp><br />\";\n\t\t\t\t\tprint \"results: <xmp>\".$results.\"</xmp><br />\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Rate(s)\n\t\t\t\tpreg_match_all('/<Package ID=\"([0-9]{1,3})\">(.+?)<\\/Package>/s',$results,$results_packages);\n\t\t\t\tforeach($results_packages[2] as $x => $results_package) {\n\t\t\t\t\tpreg_match_all('/<Service ID=\"([0-9]{1,3})\">(.+?)<\\/Service>/s',$results_package,$results_methods);\n\t\t\t\t\tforeach($results_methods[2] as $y => $results_method) {\n\t\t\t\t\t\t// Name\n\t\t\t\t\t\tpreg_match('/<SvcDescription>(.+?)<\\/SvcDescription>/',$results_method,$name);\n\t\t\t\t\t\t$name = str_replace($strip,'',$name[1]);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Use name, get rate\n\t\t\t\t\t\tif($name and in_array($name,$this->methods)) {\n\t\t\t\t\t\t\tpreg_match('/<Postage>(.+?)<\\/Postage>/',$results_method,$rate);\n\t\t\t\t\t\t\tif($rate[1]) {\n\t\t\t\t\t\t\t\tif($this->package_fits($shipping,$packages,$name)) {\n\t\t\t\t\t\t\t\t\t$rates['rates'][$name] += $rate[1];\n\t\t\t\t\t\t\t\t\t$rates['packages'][$x]['package'] = $packages[$x];\n\t\t\t\t\t\t\t\t\t$rates['packages'][$x]['rates'][$name] += $rate[1];\n\t\t\t\t\t\t\t\t\tif(!isset($rates['names'][$name])) $rates['names'][$name] = $name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Return\n\t\t\treturn $rates;\n\t\t}",
"public function actionNovaPostaShipping()\n {\n echo 35.46;\n }",
"public function get_drop_shipment_order($Dropshipping)\n {\n if (!empty($Dropshipping)) {\n\n foreach ($Dropshipping as $item_id => $value) {\n\n\n\n $item = $value['item'];\n\n $w = $item->get_width();\n\n $l = $item->get_length();\n\n $h = $item->get_height();\n\n $wt = $item->get_weight();\n\n $wtoz = $item->get_weight() * 16;\n\n $qty = $value['qty'];\n\n $parcel = null;\n\n for ($z = 0; $z < $qty; $z++) {\n\n $parcel = $this->create_parcel_from_array(\n array(\n 'width' => $w,\n 'length' => $l,\n 'height' => $h,\n 'weightoz' => $wtoz\n )\n );\n\n $drop_shipments[] = $parcel;\n\n $domestic = in_array($package['destination']['country'], $this->domestic) ? true : false;\n \n if ($domestic) {\n\n\n\n $requestdrop['Rate'] = $this->create_domestic_drop_rate($package, $value['vendor_name'], $value['vendor_address'], $value['vendor_city'], $value['vendor_st'], $value['vendor_zip'], $l, $w, $h, $wt, $wtoz);\n } else {\n\n\n\n $requestdrop['Rate'] = $this->create_non_domestic_drop_rate($package, $value['vendor_name'], $value['vendor_address'], $value['vendor_city'], $value['vendor_st'], $value['vendor_zip'], $l, $w, $h, $wt, $wtoz);\n }\n }\n }\n }\n }",
"function get_item_shipping() {\n\t}",
"function ShipToAddress()\r\n\t{\r\n\t\r\n\t}",
"public function shipping()\n\t{\n\t\t\n\t\t$this->templateFileName = 'shipping.tpl';\n\t\t\n\t\t// Make sure there is something in the user's cart.\n\t\t$cartID = $this->session->cartID;\n\t\t\n\t\t$cart = $this->dbConnection->prepareRecordSet(\"SELECT * FROM b_cart WHERE cart_id = ? AND record_status = 'A'\", $cartID);\n\t\t\n\t\tif ( !$cart )\n\t\t{\n\t\t\t// There is nothing in the cart, so display an error message\n\t\t\t$errormessage = urlencode('There is nothing in your cart');\n\t\t\theader(\"Location: /cart?emsg={$errormessage}\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\t// Get the list of shipping addresses to display on the page\n\t\t\t$addresses = $this->getAddresses();\n\t\t\t$this->set('addresses', $addresses);\n\t\t\t\n\t\t\t// Determine what to do based on user input\n\t\t\tif ( count($_POST) > 0 && isset($_POST['submit_shipping_address']) )\n\t\t\t{\n\t\t\t\t// A form was submitted, so handle the form input\n\t\t\t\t\n\t\t\t\tif (!isset($_POST['addressSelect']) || empty($_POST['addressSelect']))\n\t\t\t\t{\n\t\t\t\t\t$errors[] = 'Please select an address or create a new one.';\n\t\t\t\t}\n\t\t\t\telseif ( $_POST['addressSelect'] == 'new' )\n\t\t\t\t{\n\t\t\t\t\t// The user has selected to enter a new address\n\t\t\t\t\t// Make sure the address is complete\n\t\t\t\t\t\n\t\t\t\t\t$formComplete = true;\n\t\t\t\t\t\n\t\t\t\t\tif ( ! isset($_POST['address_name']) || empty($_POST['address_name']) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$fieldErrors['address_name'] = 'Address Name is required';\n\t\t\t\t\t\t$formComplete = false;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! isset($_POST['address_1']) || empty($_POST['address_1']) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$fieldErrors['address_1'] = 'Address Line 1 is required';\n\t\t\t\t\t\t$formComplete = false;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! isset($_POST['city']) || empty($_POST['city']) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$fieldErrors['city'] = 'City is required';\n\t\t\t\t\t\t$formComplete = false;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! isset($_POST['state']) || empty($_POST['state']) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$fieldErrors['state'] = 'State is required';\n\t\t\t\t\t\t$formComplete = false;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! isset($_POST['zip']) || empty($_POST['zip']) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$fieldErrors['zip'] = 'Zip is required';\n\t\t\t\t\t\t$formComplete = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$sanitized_zip = preg_replace('/\\D/', '', (string)$_POST['zip']);\n\t\t\t\t\t\t$zip_length = strlen($sanitized_zip);\n\t\t\t\t\t\tif ( $zip_length != 5 && $zip_length != 9 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$formComplete = false;\n\t\t\t\t\t\t\t$fieldErrors['zip'] = 'Zip must be 5 or 9 digits.';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ($zip_length == 9)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$_POST['zip'] = substr($sanitized_zip, 0, 5) . '-' . substr($sanitized_zip, 5, 4);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$_POST['zip'] = $sanitized_zip;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ($formComplete)\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\t// The form is complete, so create the record\n\t\t\t\t\t\t$insertSQL = \"INSERT INTO b_user_address (user_id, address_name, address_1, address_2, city, state, zip, record_status) \"\n\t\t\t\t\t\t . \"VALUES(?, ?, ?, ?, ?, ?, ?, 'A')\";\n\t\t\t\t\t\tif ( ! $this->dbConnection->prepareCommand($insertSQL, $this->session->userID, $_POST['address_name'], $_POST['address_1'], $_POST['address_2'], $_POST['city'], $_POST['state'], $_POST['zip']) )\n\t\t\t\t\t\t\t$errors[] = 'Error creating record. Please try again.';\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// The record was successfully created, so set the shipping address ID and move on to the next step\n\t\t\t\t\t\t\t$this->session->shippingAddressID = $this->dbConnection->insert_id;\n\t\t\t\t\t\t\t// Have the address be automatically selected in the billing page\n\t\t\t\t\t\t\t$_POST['addressSelect'] = $this->dbConnection->insert_id;\n\t\t\t\t\t\t\t$this->__default();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->set('fieldErrors', $fieldErrors);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// The user selected an existing address for shipping\n\t\t\t\t\t// Verify it is a valid record ID\n\t\t\t\t\t$address = $this->dbConnection->prepareRecord(\"SELECT * FROM b_user_address WHERE address_id = ?\", $_POST['addressSelect']);\n\t\t\t\t\tif (!$address)\n\t\t\t\t\t\t$errors[] = 'Error selecting address. This address does not exist.';\n\t\t\t\t\telseif ( $address['user_id'] != $this->session->userID )\n\t\t\t\t\t\t$errors[] = 'Error: The selected address is for a different user.';\n\t\t\t\t\telseif ( $address['record_status'] != 'A')\n\t\t\t\t\t\t$errors[] = 'Error: The selected address is not active.';\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// The address is valid, so use it.\n\t\t\t\t\t\t// set the shipping address and move on to the next step\n\t\t\t\t\t\t$this->session->shippingAddressID = $_POST['addressSelect'];\n\t\t\t\t\t\t$this->__default();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\t\n\n\t\t\t// Set address ID for output, so the field is pre-selected\n\t\t\tif ( $this->session->shippingAddressID )\n\t\t\t\t$this->set('addressSelect', $this->session->shippingAddressID);\n\n\n\t\t\t// Set all of the view data for post data so the form will be reloaded\n\t\t\tforeach ($_POST as $id => $val)\n\t\t\t{\n\t\t\t\t$this->set($id, $val);\n\t\t\t}\n\n\t\t\t// Set the error list for output\n\t\t\t$this->set('errors', $errors);\n\t\t\t\n\t\t\t\n\t\t\t// Get the list of state codes to output\n\t\t\t$states = $this->dbConnection->recordSet(\"SELECT short_description AS code, long_description AS name FROM b_value WHERE data_member = 'STATE' ORDER BY short_description\");\n\t\t\t$this->set('states', $states);\n\t\t\t\n\t\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}",
"private function shipping_batch()\n\t{\n\t\t// load the sync db\n\t\tee()->sync_db = ee()->load->database('sync_db', true);\n\n\t\t// find the most recent unprocessed shipments\n\t\t$query = ee()->sync_db->where('processed !=', '1')->order_by('id', 'asc')->get('orders_shipping', 200);\n\n\t\t// create arrays for shipment ids and tracking numbers\n\t\t$ids_processed = array();\n\n\t\t// find our shipped status\n\t\t$status = Store\\Model\\Status::where('name', 'Shipped')->first();\n\n\t\t// load the order_map config file\n\t\tinclude_once dirname(dirname(__FILE__)).'/bmi_custom/config/order_map.php';\n\n\t\t// loop through each shipment\n\t\tforeach($query->result() as $shipment)\n\t\t{\n\t\t\t// add id to the processed array\n\t\t\t$ids_processed[] = $shipment->id;\n\n\t\t\tif(!empty($shipping_carriers[$shipment->carrier]))\n\t\t\t{\n\t\t\t\t$tracking = $shipping_carriers[$shipment->carrier] .'|'. $shipment->tracking_number;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$tracking = $shipment->tracking_number;\n\t\t\t}\t\n\n\t\t\t// update the status of each order with the tracking numbers\n\t\t\t$order_object = Store\\Model\\Order::find($shipment->order_id);\n\t\t\t$order_object->updateStatus($status, 0, $tracking);\n\n\t\t}\n\n\t\t// update the shipment records to indicate they've been processed\n\t\tif(count($ids_processed) > 0)\n\t\t{\n\t\t\tee()->sync_db->where_in('id', $ids_processed)->set('processed', 1)->update('orders_shipping');\n\t\t}\t\n\t\t\n\t\t\n\t}",
"public function saveShippingAction()\n {\n if (!$this->_isActive()) {\n parent::saveShippingAction();\n return;\n }\n\n if ($this->_expireAjax()) {\n return;\n }\n if ($this->getRequest()->isPost()) {\n $data = $this->getRequest()->getPost('shipping', array());\n $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);\n $result = $this->getOnepage()->saveShipping($data, $customerAddressId);\n\n $this->_addHashInfo($result);\n $this->getResponse()->setBody(\n Mage::helper('core')->jsonEncode($result)\n );\n }\n }",
"public function appendPackingstationToShipping($observer)\n {\n $block = $observer->getBlock();\n if ($block instanceof Mage_Checkout_Block_Onepage_Shipping\n && false == $block instanceof Mage_Paypal_Block_Express_Review_Shipping\n && Mage::getModel('intraship/config')->isEnabled()\n && Mage::getModel('dhlaccount/config')->isPackstationEnabled($block->getQuote()->getStoreId())\n ) {\n $transport = $observer->getTransport();\n $layout = $block->getLayout();\n $html = $transport->getHtml();\n $parcelAnnouncementHtml = $layout->createBlock(\n 'dhlaccount/checkout_onepage_packingstation', 'onepage_packingstation')\n ->setTemplate('account/checkout/onepage/packingstation.phtml')\n ->renderView();\n $html = $html . $parcelAnnouncementHtml;\n $transport->setHtml($html);\n }\n }",
"private function _collectShippingInfo(){\n\t\tif(!empty($this->_shippingPriceCache)) return $this->_shippingPriceCache;\n\t\t$return = Mage::getSingleton(\"ultracart/cart\")->_collectShippingInfo();\n\t\t$this->_shippingPriceCache = $return;\n\t\t\n\t\treturn $return;\n\t\t\n\t}",
"public function getBaseShippingRefunded();",
"public function collection_information(){\n\n\n\n\t\t$shippingid = $this->session->userdata('shipping_id');\n\n $data='';\n\n $data['shippingid']= $shippingid;\n\n $data['pickup_location']= $this->shipping->get_pickup_location();\n\n $data['delivery_location']= $this->shipping->get_delivery_location();\n\n //$data['delivery_information']= $this->shipping->get_delivery_information($shippingid);\n\n\t\t$this->load->view('shipment/collection-delivery-information',$data);\n\n\n\n\t}",
"public function shipping_tab() {\n global $wpdb, $post;\n\n $vendor_id = $post->post_author;\n\n $shipping_zone = $wpdb->get_results(\n $wpdb->prepare(\n \"SELECT locations.zone_id, locations.seller_id, locations.location_type as vendor_location_type, locations.location_code as vendor_location_code, wc_zones.location_code, wc_zones.location_type FROM {$wpdb->prefix}dokan_shipping_zone_locations as locations INNER JOIN {$wpdb->prefix}woocommerce_shipping_zone_locations as wc_zones ON locations.zone_id = wc_zones.zone_id INNER JOIN {$wpdb->prefix}dokan_shipping_zone_methods as dokan_methods ON dokan_methods.zone_id = locations.zone_id AND dokan_methods.seller_id = locations.seller_id WHERE locations.seller_id =%d AND locations.location_type != 'postcode' ORDER BY wc_zones.zone_id ASC\", $vendor_id\n ), ARRAY_A\n );\n\n $_overwrite_shipping = get_post_meta( $post->ID, '_overwrite_shipping', true );\n $dps_processing = get_user_meta( $vendor_id, '_dps_pt', true );\n $from = get_user_meta( $vendor_id, '_dps_form_location', true );\n $dps_country_rates = get_user_meta( $vendor_id, '_dps_country_rates', true );\n $shipping_policy = get_user_meta( $vendor_id, '_dps_ship_policy', true );\n $refund_policy = get_user_meta( $vendor_id, '_dps_refund_policy', true );\n $product_processing_time = get_post_meta( $post->ID, '_dps_processing_time', true );\n $processing_time = $dps_processing;\n\n if ( 'yes' === $_overwrite_shipping ) {\n $processing_time = ( $product_processing_time ) ? $product_processing_time : $dps_processing;\n }\n\n $country_obj = new WC_Countries();\n $countries = $country_obj->countries;\n $states = $country_obj->states;\n\n $shipping_countries = '';\n $shipping_states = '';\n $location_code = '';\n $check_countries = array();\n $check_states = array();\n\n if ( $shipping_zone ) {\n foreach ( $shipping_zone as $zone ) {\n $location_code = $zone['vendor_location_code'];\n\n if ( $zone['vendor_location_type'] === 'state' ) {\n $location_codes = explode( ':', $location_code );\n $country_code = isset( $location_codes[0] ) ? $location_codes[0] : '';\n $state_code = isset( $location_codes[1] ) ? $location_codes[1] : '';\n\n if ( isset( $states[ $country_code ][ $state_code ] ) && isset( $countries[ $country_code ] ) && ! in_array( $states[ $country_code ][ $state_code ], $check_states, true ) ) {\n $get_state_name = $states[ $country_code ][ $state_code ];\n\n $check_states[ $get_state_name ] = $get_state_name;\n $shipping_states .= $get_state_name . ' (' . $countries[ $country_code ] . '), ';\n }\n }\n\n if ( $zone['vendor_location_type'] === 'country' && $countries[ $location_code ] && ! in_array( $countries[ $location_code ], $check_countries, true ) ) {\n $location_code = $countries[ $location_code ];\n $check_countries[ $location_code ] = $location_code;\n $shipping_countries .= $location_code . ', ';\n }\n }\n }\n ?>\n\n <?php if ( $shipping_countries ) { ?>\n <p>\n <?php esc_html_e( 'Shipping Countries', 'dokan' ); ?>:\n <strong><?php echo rtrim( $shipping_countries, ', ' ); ?></strong>\n </p>\n <hr>\n <?php } ?>\n\n <?php if ( $shipping_states ) { ?>\n <p>\n <?php esc_html_e( 'Shipping States', 'dokan' ); ?>:\n <strong><?php echo rtrim( $shipping_states, ', ' ); ?></strong>\n </p>\n <hr>\n <?php } ?>\n\n <?php if ( $processing_time ) { ?>\n <p>\n <strong>\n <?php esc_html_e( 'Ready to ship in', 'dokan' ); ?> <?php echo dokan_get_processing_time_value( $processing_time ); ?>\n\n <?php\n if ( $from ) {\n echo __( 'from', 'dokan' ) . ' ' . $countries[ $from ];\n }\n ?>\n </strong>\n </p>\n <hr>\n <?php } ?>\n\n <?php if ( $shipping_policy ) { ?>\n <p> </p>\n <strong><?php esc_html_e( 'Shipping Policy', 'dokan' ); ?></strong>\n <hr>\n <?php echo wpautop( $shipping_policy ); ?>\n <?php } ?>\n\n <?php if ( $refund_policy ) { ?>\n <hr>\n <p> </p>\n <strong><?php esc_html_e( 'Refund Policy', 'dokan' ); ?></strong>\n <hr>\n <?php echo wpautop( $refund_policy ); ?>\n <?php } ?>\n <?php\n }",
"public function toString()\n {\n return \"Shipping section fits\";\n }"
]
| [
"0.60295635",
"0.58761275",
"0.5868066",
"0.5841104",
"0.58006096",
"0.5737936",
"0.5722899",
"0.57149225",
"0.5676178",
"0.56671757",
"0.56558",
"0.5641882",
"0.56399703",
"0.5519016",
"0.55131835",
"0.54946744",
"0.54752105",
"0.54737425",
"0.5462623",
"0.5445418",
"0.5413181",
"0.5408733",
"0.5407762",
"0.5386995",
"0.53817904",
"0.53433365",
"0.5342899",
"0.5337681",
"0.52854997",
"0.52694213"
]
| 0.8042508 | 0 |
Explode any singledimensional array into a full blown tree structure, based on the delimiters found in it's keys. | public static function explodeTree($array, $delimiter ='_', $baseval =false) {
if(!is_array($array)) return false;
$splitRE='/'.preg_quote($delimiter,'/').'/';
$returnArr=array();
foreach($array as $key=>$val) {
// Get parent parts and the current leaf
$parts=preg_split($splitRE, $key, -1, PREG_SPLIT_NO_EMPTY);
$leafPart=array_pop($parts);
// Build parent structure
// Might be slow for really deep and large structures
$parentArr=&$returnArr;
foreach($parts as $part) {
if(!isset($parentArr[$part])){
$parentArr[$part] = array();
}elseif(!is_array($parentArr[$part])){
if($baseval)
$parentArr[$part] = array('__base_val' => $parentArr[$part]);
else
$parentArr[$part] = array();
}
$parentArr = &$parentArr[$part];
}
// Add the final part to the structure
if(empty($parentArr[$leafPart]))
$parentArr[$leafPart] = $val;
elseif($baseval && is_array($parentArr[$leafPart]))
$parentArr[$leafPart]['__base_val'] = $val;
}
return $returnArr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function explodeTree($array, $delimiter = '_', $baseval = false)\n {\n if(!is_array($array)) return false;\n $splitRE = '/' . preg_quote($delimiter, '/') . '/';\n $returnArr = array();\n foreach ($array as $key => $val) {\n // Get parent parts and the current leaf\n $parts = preg_split($splitRE, $key, -1, PREG_SPLIT_NO_EMPTY);\n $leafPart = array_pop($parts);\n // Build parent structure\n // Might be slow for really deep and large structures\n $parentArr = &$returnArr;\n foreach ($parts as $part) {\n if (!isset($parentArr[$part])) {\n $parentArr[$part] = array();\n } elseif (!is_array($parentArr[$part])) {\n if ($baseval) {\n $parentArr[$part] = array('__base_val' => $parentArr[$part]);\n } else {\n $parentArr[$part] = array();\n }\n }\n $parentArr = &$parentArr[$part];\n }\n\n // Add the final part to the structure\n if (empty($parentArr[$leafPart])) {\n $parentArr[$leafPart] = $val;\n } elseif ($baseval && is_array($parentArr[$leafPart])) {\n $parentArr[$leafPart]['__base_val'] = $val;\n }\n }\n return $returnArr;\n }",
"public static function nest(array $flat, string $delimiter = '.') : array\n {\n $tree = [];\n\n foreach ($flat as $key => $val) {\n\n // Get parent parts and the current leaf\n $parts = self::splitPath($key, $delimiter);\n $leafPart = array_pop($parts);\n\n // Build parent structure\n $parent = &$tree;\n\n foreach ($parts as $part) {\n if (!isset($parent[$part])) {\n $parent[$part] = [];\n } elseif (!is_array($parent[$part])) {\n $parent[$part] = [];\n }\n\n $parent = &$parent[$part];\n }\n\n // Add the final part to the structure\n if (empty($parent[$leafPart])) {\n $parent[$leafPart] = $val;\n }\n }\n\n return $tree;\n }",
"public static function unflatten(array $array, $delimiter = '.')\n {\n $unflattenedArray = [ ];\n\n\n foreach ( $array as $key => $value ) {\n $keyList = explode($delimiter, $key);\n $firstKey = array_shift($keyList);\n\n if ( sizeof($keyList) > 0 ) {\n $subArray = static::unflatten([ implode($delimiter, $keyList) => $value ], $delimiter);\n\n foreach ( $subArray as $subArrayKey => $subArrayValue ) {\n $unflattenedArray[ $firstKey ][ $subArrayKey ] = $subArrayValue;\n }\n } else {\n $unflattenedArray[ $firstKey ] = $value;\n }\n }\n\n return $unflattenedArray;\n }",
"function array_as_hierarchy(iterable $array, string $separator = '.'): array\n{\n $hierarchy = [];\n foreach ($array as $key => $value) {\n $segments = explode($separator, $key);\n if (false === $segments) {\n continue;\n }\n\n $valueSegment = array_pop($segments);\n $branch = &$hierarchy;\n foreach ($segments as $segment) {\n if (!isset($branch[$segment])) {\n $branch[$segment] = [];\n }\n $branch = &$branch[$segment];\n }\n $branch[$valueSegment] = $value;\n }\n\n return $hierarchy;\n}",
"protected function _tree($array)\n {\n $root = [\n \"children\" => []\n ];\n $current =& $root;\n\n foreach ($array as $i => $node) {\n $result = $this->_tag($node);\n\n if ($result) {\n $tag = $result[\"tag\"] ?? \"\";\n $arguments = $result[\"arguments\"] ?? \"\";\n\n if ($tag) {\n if (!$result[\"closer\"]) {\n $last = ArrayMethods::last($current[\"children\"]);\n\n if ($result[\"isolated\"] && is_string($last)) {\n array_pop($current[\"children\"]);\n }\n\n $current[\"children\"][] = [\n \"index\" => $i,\n \"parent\" => &$current,\n \"children\" => [],\n \"raw\" => $result[\"source\"],\n \"tag\" => $tag,\n \"arguments\" => $arguments,\n \"delimiter\" => $result[\"delimiter\"],\n \"number\" => sizeof($current[\"children\"])\n ];\n $current =& $current[\"children\"][sizeof($current[\"children\"]) - 1];\n }\n elseif (isset($current[\"tag\"]) && $result[\"tag\"] == $current[\"tag\"]) {\n $start = $current[\"index\"] + 1;\n $length = $i - $start;\n $current[\"source\"] = implode(\" \", array_slice($array, $start, $length));\n $current =& $current[\"parent\"];\n }\n } else {\n $current[\"children\"][] = [\n \"index\" => $i,\n \"parent\" => &$current,\n \"children\" => [],\n \"raw\" => $result[\"source\"],\n \"tag\" => $tag,\n \"arguments\" => $arguments,\n \"delimiter\" => $result[\"delimiter\"],\n \"number\" => sizeof($current[\"children\"])\n ];\n }\n } else {\n $current[\"children\"][] = $node;\n }\n }\n\n return $root;\n }",
"protected function _tree($array) {\n\n\t\t\t$root = array(\n\t\t\t\t'children' => array()\n\t\t\t);\n\t\t\t$current = &$root;\n\n\t\t\tforeach ($array as $i => $node) {\n\n\t\t\t\t$result = $this->_tag($node);\n\t\t\t\t\n\t\t\t\tif ($result) {\n\t\t\t\t\t\n\t\t\t\t\tif (isset($result['tag'])) {\n\t\t\t\t\t\t$tag = $result['tag'];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$tag = \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isset($result['arguments'])) {\n\t\t\t\t\t\t$arguments = $result['arguments'];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$arguments = \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($tag) {\n\t\t\t\t\t\t// If segment does not contain a closer\n\t\t\t\t\t\tif (!$result['closer']) {\n\t\t\t\t\t\t\t// clean up syntax if segment is isolated and \n\t\t\t\t\t\t\t// preceded by an plain text segment\n\t\t\t\t\t\t\t$last = ArrayMethods::last($current['children']);\n\t\t\t\t\t\t\tif ($result['isolated'] && is_string($last)) {\n\t\t\t\t\t\t\t\tarray_pop($current['children']);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$current['children'][] = array(\n\t\t\t\t\t\t\t\t'index' => $i,\n\t\t\t\t\t\t\t\t'parent' => &$current,\n\t\t\t\t\t\t\t\t'children' => array(),\n\t\t\t\t\t\t\t\t'raw' => $result['source'],\n\t\t\t\t\t\t\t\t'tag' => $tag,\n\t\t\t\t\t\t\t\t'arguments' => $arguments,\n\t\t\t\t\t\t\t\t'delimiter' => $result['delimiter'],\n\t\t\t\t\t\t\t\t'number' => count($current['children'])\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t$current = &$current['children'][count($current['children']) - 1];\n\t\t\t\t\t\t} else if (isset($current['tag']) && $result['tag'] == $current['tag']) {\n\t\t\t\t\t\t\t$start = $current['index'] + 1;\n\t\t\t\t\t\t\t$length = $i - $start;\n\t\t\t\t\t\t\t$current['source'] = implode(array_slice($array, $start, $length));\n\t\t\t\t\t\t\t$current = &$current['parent'];\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$current['children'][] = array(\n\t\t\t\t\t\t\t'index' => $i,\n\t\t\t\t\t\t\t'parent' => &$current,\n\t\t\t\t\t\t\t'children' => array(),\n\t\t\t\t\t\t\t'raw' => $result['source'],\n\t\t\t\t\t\t\t'tag' => $tag,\n\t\t\t\t\t\t\t'arguments' => $arguments,\n\t\t\t\t\t\t\t'delimiter' => $result['delimiter'],\n\t\t\t\t\t\t\t'number' => count($current['children'])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$current['children'][] = $node;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $root;\n\t\t}",
"static public function DotsToMulti($arr) {\n\n if (is_array($arr)) {\n\n $ikeys = array_keys($arr);\n $icount = count($ikeys);\n\n for ($i = 0; $i < $icount; $i++) {\n\n if (is_array($arr[$ikeys[$i]])) {\n\n $jkeys = array_keys($arr[$ikeys[$i]]);\n $jcount = count($jkeys);\n\n for ($j = 0; $j < $jcount; $j++) {\n\n if (is_array($arr[$ikeys[$i]][$jkeys[$j]])) {\n\n $kkeys = array_keys($arr[$ikeys[$i]][$jkeys[$j]]);\n $kcount = count($kkeys);\n\n for ($k = 0; $k < $kcount; $k++) {\n\n if (is_array($arr[$ikeys[$i]][$jkeys[$j]][$kkeys[$k]])) {\n\n }\n\n $kkeyexp = explode('.', $kkeys[$k]);\n\n $kkeyexpcount = count($kkeyexp);\n\n if ($kkeyexpcount > 1) {\n\n $kvalue = array($kkeyexp[$kkeyexpcount - 1] => $arr[$ikeys[$i]][$jkeys[$j]][$kkeys[$k]]);\n unset($arr[$ikeys[$i]][$jkeys[$j]][$kkeys[$k]]);\n\n for ($c = $kkeyexpcount - 2; $c > 0; $c--) {\n\n $kvalue_tmp = array($kkeyexp[$c] => $kvalue);\n $kvalue = $kvalue_tmp;\n }\n\n $arr[$ikeys[$i]][$jkeys[$j]][$kkeyexp[0]] = array_replace_recursive(isset($arr[$ikeys[$i]][$jkeys[$j]][$kkeyexp[0]]) ? $arr[$ikeys[$i]][$jkeys[$j]][$kkeyexp[0]] : array(), $kvalue);\n }\n }\n }\n\n $jkeyexp = explode('.', $jkeys[$j]);\n\n $jkeyexpcount = count($jkeyexp);\n\n if ($jkeyexpcount > 1) {\n\n $jvalue = array($jkeyexp[$jkeyexpcount - 1] => $arr[$ikeys[$i]][$jkeys[$j]]);\n unset($arr[$ikeys[$i]][$jkeys[$j]]);\n\n for ($b = $jkeyexpcount - 2; $b > 0; $b--) {\n\n $jvalue_tmp = array($jkeyexp[$b] => $jvalue);\n $jvalue = $jvalue_tmp;\n }\n\n $arr[$ikeys[$i]][$jkeyexp[0]] = array_replace_recursive(isset($arr[$ikeys[$i]][$jkeyexp[0]]) ? $arr[$ikeys[$i]][$jkeyexp[0]] : array(), $jvalue);\n }\n }\n }\n\n $ikeyexp = explode('.', $ikeys[$i]);\n\n $ikeyexpcount = count($ikeyexp);\n\n if ($ikeyexpcount > 1) {\n\n $ivalue = array($ikeyexp[$ikeyexpcount - 1] => $arr[$ikeys[$i]]);\n unset($arr[$ikeys[$i]]);\n\n for ($a = $ikeyexpcount - 2; $a > 0; $a--) {\n\n $ivalue_tmp = array($ikeyexp[$a] => $ivalue);\n $ivalue = $ivalue_tmp;\n }\n\n $arr[$ikeyexp[0]] = array_replace_recursive(isset($arr[$ikeyexp[0]]) ? $arr[$ikeyexp[0]] : array(), $ivalue);\n }\n }\n }\n\n return $arr;\n }",
"static function restruct2MultilevelArray(&$vals, $separator='/')\n\t{\n\t\tforeach($vals as $id => $data)\n\t\t{\n\t\t\tif(strpos($id, $separator)!==false){\n\t\t\t\t\n\t\t\t\t$p =& GW_Array_Helper::getPointer2XlevelAssocArr($vals, explode($separator, $id));\n\t\t\t\t$p = $data;\n\t\t\t\t\n\t\t\t\tunset($vals[$id]);\n\t\t\t}\n\t\t}\t\n\t}",
"function convertToFlatArray($Array,$Separator='.',$FlattenedKey='') {\t\t\n\t\t$FlattenedArray=Array();\n\t\tforeach($Array as $Key => $Value) {\n\t\t\tif(is_Array($Value)) {\n\t\t\t\t$_FlattenedKey=(strlen($FlattenedKey)>0?$FlattenedKey.$Separator:\"\").$Key;\n \t\t\t$FlattenedArray=array_merge(\n\t \t\t\t\t$FlattenedArray,\n \t\t\tcmfcArray::convertToFlatArray($Value,$Separator,$_FlattenedKey)\n );\t\t\t\t\n\t\t\t} else {\n\t\t\t\t$_FlattenedKey=(strlen($FlattenedKey)>0?$FlattenedKey.$Separator:\"\").$Key;\n\t\t\t\t$FlattenedArray[$_FlattenedKey]=$Value;\n\t\t\t}\n\t\t}\n\t\treturn $FlattenedArray;\n\t}",
"private function flattenArray($name,$array,$delim)\n\t{\n\t\t$result = array();\n\t\tforeach($array as $key=>$value)\n\t\t{\n\t\t\tif(is_array($value))\n\t\t\t{\n\t\t\t\t$this->flattenArray($name.$delim.$key,$value,$delim);\n\t\t\t}else{\n\t\t\t\t$result[$name.$delim.$key] = $value;\n\t\t\t}\n\t\t}\n\treturn $result;\n\t}",
"private function flatten(\n array $array,\n array &$result,\n string $keySeparator = '.',\n string $parentKey = ''\n ) {\n foreach ($array as $key => $value) {\n if (\\is_array($value)) {\n $this->flatten($value, $result, $keySeparator,\n $parentKey . $key . $keySeparator);\n } else {\n $result[$parentKey . $key] = $value;\n }\n }\n }",
"function array_flatten($elevated, $delimiter = '.')\r\n{\r\n $factory = ElevatorFactory::getInstance();\r\n $elevator = $factory->create();\r\n\r\n return $elevator->down($elevated, $delimiter);\r\n}",
"public static function flatten(array $data, $separator = '.')\n {\n $result = [];\n $stack = [];\n $path = null;\n \n reset($data);\n while (!empty($data)) {\n $key = key($data);\n $element = $data[$key];\n unset($data[$key]);\n \n if (is_array($element) && !empty($element)) {\n if (!empty($data)) {\n $stack[] = [$data, $path];\n }\n $data = $element;\n reset($data);\n $path .= $key . $separator;\n } else {\n $result[$path . $key] = $element;\n }\n \n if (empty($data) && !empty($stack)) {\n list($data, $path) = array_pop($stack);\n reset($data);\n }\n }\n return $result;\n }",
"function flat(&$ary) {\n for ($i = 0; $i < count($ary); $i++) {\n while (is_array($ary[$i])) {\n array_splice($ary, $i, 1, $ary[$i]);\n }\n }\n}",
"function stage_flatten($array, $prefix = '')\n{\n $result = array();\n foreach ($array as $key => $value) {\n if (is_array($value)) {\n $result = $result + stage_flatten($value, $prefix . $key . '.');\n } else {\n $result[$prefix . $key] = $value;\n }\n }\n return $result;\n}",
"function tmall_array_dot($array, $prepend = '')\n {\n $results = [];\n foreach ($array as $key => $value) {\n if (is_array($value) && !empty($value)) {\n $results = array_merge($results, tmall_array_dot($value, $prepend . $key . '.'));\n } else {\n $results[$prepend . $key] = $value;\n }\n }\n return $results;\n }",
"function arrayToTree($a) {\n if (!empty($a) && !empty($a[0])) {\n $T = new Tree();\n $T->x = $a[0];\n $T->l = arrayToTree($a[1]);\n $T->r = arrayToTree($a[2]);\n return $T;\n }\n return null;\n}",
"public static function flatten(array $nested, string $delimiter = '.') : array\n {\n $result = [];\n static::flattenArray($result, $nested, $delimiter);\n return $result;\n }",
"public static function makeHierarchy( array $array, $format, $keepKey = false )\n\t{\n\t\tpreg_match( '#([^=\\[]+)((?:\\[(?:[^\\]]*)\\])*)=>(.+)#', $format, $matches );\n\n\t\ttry {\n\t\t\tlist( , $key, $braces, $columns ) = $matches;\n\t\t} catch ( Exception $e ) {\n\t\t\tthrow new ErrException( 'Invalid format pattern', get_defined_vars() );\n\t\t}\n\n\t\tif ( $braces ) {\n\t\t\tpreg_match_all( '#\\[([^\\]]*)\\]#', $braces, $matches );\n\t\t\t$nestedKeys = $matches[1];\n\t\t}\n\n\n\t\t$values = $columns === '*' ? $columns : explode( ';', $columns );\n\n\t\t$hasMultipleValues = $values === '*' || isset( $values[1] );\n\n\t\t$rows = array();\n\t\tforeach ( $array as $row ) {\n\t\t\tif ( $hasMultipleValues ) {\n\n\t\t\t\tif ( $values === '*' ) {\n\t\t\t\t\t$result = $row;\n\t\t\t\t} else {\n\t\t\t\t\tforeach ( $values as $v ) {\n\t\t\t\t\t\t$result[$v] = $row[$v];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$result = $row[$columns];\n\t\t\t}\n\n\t\t\tif ( $braces ) {\n\t\t\t\tisset( $rows[$row[$key]] ) or $rows[$row[$key]] = array();\n\n\t\t\t\t$cont = &$rows[$row[$key]];\n\n\t\t\t\tforeach ( $nestedKeys as $nestedKey ) {\n\n\t\t\t\t\tif ( $values === '*' ) {\n\t\t\t\t\t\tif ( !$keepKey ) {\n\t\t\t\t\t\t\tunset( $result[$nestedKey] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( $nestedKey ) {\n\t\t\t\t\t\tisset( $cont[$row[$nestedKey]] ) or $cont[$row[$nestedKey]] = array();\n\t\t\t\t\t\t$cont = &$cont[$row[$nestedKey]];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$cont[] = array();\n\t\t\t\t\t\t$cont = &$cont[Arr::last( $cont, TRUE )];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\t$cont = $result;\n\t\t\t} else {\n\t\t\t\t$rows[$row[$key]] = $result;\n\n\t\t\t}\n\n\n\t\t}\n\t\treturn $rows;\n\n\t}",
"public function format($arr)\n\t{\n\t\t$result = [];\n\t\t$temp = [];\n\t\t$hand = -1;\n\t\tforeach ($arr as $key => $value) {\n\t\t\t$str = str_replace($this->rootPath.'/',\"\",$value);\n\t\t\t$temp = explode(\"/\", $str);\n\t\t\t$len = sizeof($temp);\n\t\t\tif ($len == 1){\n\t\t\t\t$hand++;\n\t\t\t\t$result[$hand]['value'] = $temp[0];\n\t\t\t\t$result[$hand]['label'] = $temp[0];\n\t\t\t\tcontinue;\n\t\t\t}else{\n\t\t\t\tif (!isset($result[$hand]['children'])){\n\t\t\t\t\t$result[$hand]['children'] = [];\n\t\t\t\t}\n\t\t\t\t$child = &$result[$hand]['children'];\n\t\t\t\tforeach ($temp as $sKey => $sValue) {\n\t\t\t\t\tif ($sKey == $len - 1){\n\t\t\t\t\t\tarray_push($child,['value'=> $sValue,'label'=>$sValue]);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tforeach ($child as $tKey => $tValue) {\n\t\t\t\t\t\t\tif ($tValue['value'] == $sValue){\n\t\t\t\t\t\t\t\tif (!isset($child[$tKey]['children'])){\n\t\t\t\t\t\t\t\t\t$child[$tKey]['children'] = [];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$child = &$child[$tKey]['children'];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}",
"function array_elevate($flattened, $delimiter = '.')\r\n{\r\n $factory = ElevatorFactory::getInstance();\r\n $elevator = $factory->create();\r\n\r\n return $elevator->up($flattened, $delimiter);\r\n}",
"function flattenArray($array)\n{\n\t$flatArray = array();\n\tforeach ($array as $subElement) {\n \tif (is_array($subElement)) {\n\t\t\t$flatArray = array_merge($flatArray, flattenArray($subElement));\n\t\t} else {\n\t\t\t$flatArray[] = $subElement;\n\t\t}\n\t}\n\n\treturn $flatArray;\n}",
"protected function recursiveArrayHandler($arrayText)\n {\n $matches = [];\n $arrayToBuild = [];\n if (preg_match_all(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS, $arrayText, $matches, PREG_SET_ORDER)) {\n foreach ($matches as $singleMatch) {\n $arrayKey = $this->unquoteString($singleMatch['Key']);\n if (!empty($singleMatch['VariableIdentifier'])) {\n $arrayToBuild[$arrayKey] = new ObjectAccessorNode($singleMatch['VariableIdentifier']);\n } elseif (array_key_exists('Number', $singleMatch) && (!empty($singleMatch['Number']) || $singleMatch['Number'] === '0')) {\n // Note: this method of casting picks \"int\" when value is a natural number and \"float\" if any decimals are found. See also NumericNode.\n $arrayToBuild[$arrayKey] = $singleMatch['Number'] + 0;\n } elseif ((array_key_exists('QuotedString', $singleMatch) && !empty($singleMatch['QuotedString']))) {\n $argumentString = $this->unquoteString($singleMatch['QuotedString']);\n $arrayToBuild[$arrayKey] = $this->buildArgumentObjectTree($argumentString);\n } elseif (array_key_exists('Subarray', $singleMatch) && !empty($singleMatch['Subarray'])) {\n $arrayToBuild[$arrayKey] = new ArrayNode($this->recursiveArrayHandler($singleMatch['Subarray']));\n }\n }\n }\n return $arrayToBuild;\n }",
"public function testFlattenKeysRecursively()\n {\n $multiDimensional = array(\n 'Hello' => array(\n 'World' => array(\n 'How' => array(\n \"Are\" => \"You?\"\n )\n )\n )\n );\n\n $flatten = array('Hello.World.How.Are' => 'You?');\n\n $this\n ->given($array = new classToTest())\n ->then\n ->array($array::flattenKeysRecursively($multiDimensional))\n ->isEqualTO($flatten)\n\n ;\n }",
"public static function tree(string $path, string $delimiter = '/'): array\n {\n $output = [];\n $parts = explode($delimiter, $path);\n\n $previousElement = '';\n foreach ($parts as $element) {\n if (!empty($element)) {\n $output[] = $previousElement . $element;\n }\n\n $previousElement .= $element . $delimiter;\n }\n\n return $output;\n }",
"function envKeySplit($array)\n{\n\t$lists = explode(';', $array);\n\tforeach ($lists as $list) {\n\t\tlist($k, $v) = explode(':', $list);\n\t\t$final[$k] = $v;\n\t}\n\n\treturn $final;\n}",
"public function explodeAndClean($array, $delimiter = ','): array\n {\n $array = explode($delimiter, $array); // Explode fields to array\n $array = array_map('trim', $array); // Trim array's values\n $array = array_keys(array_flip($array)); // Remove duplicate fields\n $array = array_filter($array); // Remove empty values from array\n\n return $array;\n }",
"public function buildTree($arr)\n\t{\n\t\t$count = count($arr);\n\t\tif(!$count) return array();\n\n\t\t$first = $arr[0];\n\t\t$entryLevel = $first->level;\n\t\t$tree = new stdClass();\n\t\t$tree->type = $first->type;\n\t\t$tree->content = null;\n\t\t$tree->parent = null;\n\t\t$tree->key = 'root';\n\t\t$tree->level = $entryLevel - 1;\n\t\t$tree->children = array();\n\t\t$lastNode = $tree;\n\t\t// store the relations\n\t\t$parentList = array();\n\t\tforeach($arr as $key => $val){\n\t\t\t$level = $val->level;\n\t\t\t$lastLevel = $lastNode->level;\n\t\t\tif($level > $lastLevel){\n\t\t\t\t$lastNode->children[] = $val;\n\t\t\t\t$parentList[$key] = $lastNode;\n\t\t\t\t$lastNode = $val;\n\t\t\t} elseif($level < $lastLevel) { \n\t\t\t\t// look for the node has same level \n\t\t\t\twhile($level < $lastNode->level){\n\t\t\t\t\t$lastNode = $parentList[$lastNode->key];\n\t\t\t\t}\n\t\t\t\t$parent = $parentList[$lastNode->key];\n\t\t\t\t$parent->children[] = $val;\n\t\t\t\t$parentList[$key] = $parent;\n\t\t\t\t$lastNode = $val;\n\t\t\t} else { // $level == $lastLevel\n\t\t\t\t$parent = $parentList[$lastNode->key];\n\t\t\t\t$parent->children[] = $val;\n\t\t\t\t$parentList[$key] = $parent;\n\t\t\t\t$lastNode = $val;\n\t\t\t}\n\t\t}\n\t\treturn $tree;\n\t}",
"function nest($array = false, $field='post_parent') {\n\t\tif(!$array || !$field) return;\n\t\t$_array = array();\n\t\t$_array_children = array();\n\t\t\n\t\t// separate children from parents\n\t\tforeach($array as $a) {\n\t\t\tif(!$a->post_parent) {\n\t\t\t\t$_array[] = $a;\n\t\t\t} else {\n\t\t\t\t$_array_children[$a->post_parent][] = $a;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// nest children and parents\n\t\tforeach($_array as $a) {\n\t\t\t$a->children = array();\n\t\t\tif(isset($_array_children[$a->ID])) $a->children = $_array_children[$a->ID];\n\t\t}\n\t\treturn $_array;\n\t}",
"public function testImplodeArrayWithInnerArray()\n {\n $this->assertEquals(\n StringUtils::OPEN_SQUARE_BRACKET . StringUtils::CLOSE_SQUARE_BRACKET,\n StringUtils::implodeRecursively(array(array()))\n );\n }"
]
| [
"0.6990624",
"0.6527906",
"0.6333582",
"0.6314539",
"0.62843144",
"0.61114323",
"0.6083682",
"0.6000311",
"0.5868188",
"0.5834122",
"0.58098644",
"0.57742167",
"0.5675566",
"0.55847526",
"0.5542865",
"0.55192226",
"0.5499703",
"0.54374826",
"0.54350615",
"0.54139453",
"0.5403378",
"0.5330038",
"0.5325353",
"0.52999747",
"0.52754",
"0.5270769",
"0.52525574",
"0.52285427",
"0.5223158",
"0.52093333"
]
| 0.6796295 | 1 |
Find a key the value of a property : a[key][propName] === value $array = array( 'a'=>array('prop'=>'test'), 'b'=>array('prop'=>'test2') ); assert(UArray::findKeyBy($array,'prop','test') === 'a'); | public static function findKeyBy($a,$propName,$val){
foreach($a as $k=>$v){
if($v[$propName] == $val) return $k;
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getKeyByValue($arr,$value) {\n\t $n=-1;\n\t foreach ($arr as $aKey=>$aItem) {\n\t\t $n++;\n\t\t //if (!isset($akey)) $aKey=$n;\n\t\t if (!is_array($aItem)) {\n\t\t\t if ($Item==$value) return $aKey;\n\t\t } else {\n\t\t\t if ($aItem[$value['key']]==$value['value']) {\n\t\t\t\t return $aKey;\n\t\t\t }\n\t\t }\n\t }\n }",
"function searchByKey($keyVal, $array) {\n\t foreach ($array as $key => $val) {\n\t\t\t if ($keyVal == $key) {\n\t\t\t\t return $val;\n\t\t\t }\n\t }\n\t return null;\n }",
"public function find($property, $value, $key = false) {\n foreach ($this->list as $index => $model) {\n if ($model->$property === $value) {\n return $key ? $index : $model;\n }\n }\n\n return null;\n }",
"public function propfind($key=null,$value=null){\n return $this->methodsData(\"propfind\",$key,$value);\n }",
"function search_nested_array($key = 'id', $value, $arr = [])\n{\n foreach ($arr as $k => $a) {\n $s_value = $a[$key];\n if ($s_value == $value) {\n return $k;\n }\n if (is_array($s_value)) {\n if (in_array($value, $s_value)) return $k;\n }\n }\n return -1;\n}",
"function getKeyByValue($str, $arr) {\n foreach ($arr as $key => $value) {\n if ($str == $value) {\n return $key;\n }\n }\n }",
"function fnGet(&$array, $key, $default = null, $separator = '/')\n{\n if (($sub_key_pos = strpos($key, $separator)) === false) {\n if (is_object($array)) {\n return property_exists($array, $key) ? $array->$key : $default;\n }\n return isset($array[$key]) ? $array[$key] : $default;\n } else {\n $first_key = substr($key, 0, $sub_key_pos);\n if (is_object($array)) {\n $tmp = property_exists($array, $first_key) ? $array->$first_key : null;\n } else {\n $tmp = isset($array[$first_key]) ? $array[$first_key] : null;\n }\n return fnGet($tmp, substr($key, $sub_key_pos + 1), $default, $separator);\n }\n}",
"function findPropertyBy(array $criteria);",
"function get_key_match($array, $keyPartialName){\n\t$matches = array();\n\tforeach($array as $key => $value){\n\t\tif (preg_match(\"/\".$keyPartialName.\"/i\", $key)) {\n\t\t\t$matches[$key] = $value[0];\n\t\t}\n\t}\n\tusort($matches, \"cmp\");\n\treturn $matches;\t\n}",
"public function find ($key);",
"function getKeyByValueWildcard($arr,$value,$multiValue=false) {\n\t $n=-1;\n\t foreach ($arr as $aKey=>$aItem) {\n\t\t $n++;\n\t\t //if (!isset($akey)) $aKey=$n;\n\t\t if (!is_array($aItem)) {\n\t\t\t if ($Item==$value) return $aKey;\n\t\t } else {\n\t\t\t if (fnmatch($value['value'],$aItem[$value['key']])===true) {\n\t\t\t\t\tif($multiValue)\n\t\t\t\t\t\t$aKeyArray[]=$aKey;\n\t\t\t\t\telse\n\t\t\t\t \treturn $aKey;\n\t\t\t }\n\t\t }\n\t }\n\t\treturn $aKeyArray;\n }",
"function types_get_array_key_search_in_sub( $array, $search ) {\n foreach( $array as $key => $sub_array ) {\n if( in_array( $search, $sub_array ) )\n return $key;\n }\n\n return false;\n}",
"function getValueByPath($arr,$path) {\n\t\t$r=$arr;\n\t\tif (!is_array($path)) return false;\n\t\tforeach ($path as $key) {\n\t\t\tif (isset($r[$key]))\n\t\t\t\t$r=$r[$key];\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\treturn $r;\n\t}",
"function array_get_key_val($value, $heystack) {\r\n if (is_array($heystack)) {\r\n foreach ($heystack as $k => $v) {\r\n if ($v == $value) {\r\n return $k;\r\n } elseif (is_array($v)) {\r\n return array_get_key_val($value, $v);\r\n }\r\n }\r\n return -1;\r\n }\r\n return -1;\r\n}",
"public function psc_val_arr_key( $key, $array ) {\n\n\t\tif( array_key_exists( $key, $array ) && !empty( $array[ $key ] ) ) {\n\t\t\treturn $array[ $key ];\n\t\t} else {\n\t\t\treturn FALSE; // return nothing\n\t\t}\n\n\t}",
"public function find($array, $value, $key = 'id'){\n \n foreach($array as $obj){\n \n if(is_array($obj) && $obj[$key] == $value) return $obj;\n else if(is_object($obj) && $obj->{$key} == $value) return $obj;\n \n }\n \n return null;\n \n }",
"function get_array_value($arr, $props = array()) {\n\tif ($arr == null) {\n\t\treturn null;\n\t}\n\n\tforeach($props as $prop) {\n\t\tif (array_key_exists($prop, $arr)) {\n\t\t\t$arr = $arr[$prop];\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn $arr;\n}",
"static function valByArrKey($arr, $key_arr)\n\t{\n\t\t$x = & $arr;\n\n\t\tif (is_string($key_arr))\n\t\t\t$key_arr = self::strKeyToArrKey($key_arr);\n\n\t\tforeach ($key_arr as $key) {\n\t\t\tif (!isset($x[$key]))\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\t$x = & $x[$key];\n\t\t}\n\n\t\treturn $x;\n\t}",
"private function GetElementOfKey($key, $array)\n\t{\n\t\tforeach ($array as $key_actual => $value)\n\t\t{\n\t\t\tif ($key_actual === $key)\n\t\t\t{\n\t\t\t\treturn $value;\n\t\t\t}\n\t\t\telseif (is_array($value))\n\t\t\t{\n\t\t\t\t$return = $this->GetElementOfKey($key, $value);\n\t\t\t\tif ($return !== FALSE )\n\t\t\t\t{\n\n\t\t\t\t\treturn $return;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn(FALSE);\n }",
"public function testGetReturnsValueFromArrayBySinglePath()\n {\n $array = ['a' => 1];\n $actual = $this->property->get($array, 'a');\n $this->assertEquals(1, $actual);\n }",
"function propFind($path, PropFind $propFind);",
"private function getArrayItemByPath($array)\n\t{\n\t\t$p = $array;\n\t\t$argc = func_num_args();\n\t\tfor ($i = 1; $i < $argc; $i++) {\n\t\t\t$k = func_get_arg($i);\n\t\t\tif ($k === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (is_array($k)) {\n\t\t\t\tforeach ($k as $kk) {\n\t\t\t\t\tif (isset($p[$kk])) {\n\t\t\t\t\t\t$p = $p[$kk];\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (isset($p[$k])) {\n\t\t\t\t\t$p = $p[$k];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $p;\n\t}",
"public function keyByOffset($offset) {\n\t\tif (1==1) {\n\t\t\n\t\t}\n\t\t$keys = array_keys($this->elems);\n\t\treturn $keys[$offset];\n\t}",
"function findProperty($id);",
"function array_get($key, $array)\n {\n return arr::get($key, $array);\n }",
"function search_in_array($array,$field,$search,$retval)\n {\n $cnt = count($array);\n $value = 0;\n for ($i=0; $i < $cnt; $i++) {\n if ($array[$i][$field]==$search) {\n $value = $array[$i][$retval];\n }\n }\n\n return $value;\n }",
"function get_key($arr, $action, $param1, $param2){\n\t\tif(is_array($arr)){\n\t\t\tforeach($arr as $key => $row){\n\t\t\t\tif ($row->action == $action and\n\t\t\t\t\t$row->param1 == $param1 and\n\t\t\t\t\t$row->param2 == $param2)\n\t\t\t\t\treturn $key;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}",
"function searchArray($array,$key,$value,$startingIndex=0) {\n\t$result = false;\n\tif (count($array) ) {\n\t\tfor ($i = $startingIndex; $i <= max(array_keys($array)); $i++) {\n\t\t\tif ( $array[$i][$key] == $value ) {\n\t\t\t\t$result = $i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn $result;\n}",
"function array_multi_search($array,$key,$value=''){\n\t$key = strtolower($key);\n\t$value = strtolower($value);\n\tif(!is_array($array)){\n\t\treturn false;\n\t}\n\tforeach($array as $sub_array){\n\t\tif(!is_array($sub_array)){\n\t\t\tif(strtolower($sub_array) == $key){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tforeach($sub_array as $k=>$v){\n\t\t\tif(strtolower($k) == $key){\n\t\t\t\tif(strtolower($v) == $value){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}",
"function findKey($array, $keySearch)\n {\n if (!is_array($array)) return false;\n\n // key exists\n if (array_key_exists($keySearch, $array)) return true;\n\n // key isn't in this array, go deeper\n foreach($array as $key => $val)\n {\n // return true if it's found\n if ($this->findKey($val, $keySearch)) return true;\n }\n\n return false;\n }"
]
| [
"0.66127586",
"0.62396",
"0.6164314",
"0.6109069",
"0.6093656",
"0.60645014",
"0.6030728",
"0.60175455",
"0.6011658",
"0.59614265",
"0.5938352",
"0.5916363",
"0.58514863",
"0.584443",
"0.5830338",
"0.5829741",
"0.5827913",
"0.58062315",
"0.57938236",
"0.57807684",
"0.5771194",
"0.57532656",
"0.570436",
"0.5703193",
"0.5701394",
"0.56957567",
"0.56910706",
"0.5676547",
"0.5655837",
"0.5650072"
]
| 0.7644024 | 0 |
return the first value of an array or false if the array is empty | public static function firstValue($array){
foreach($array as $elt) return $elt;
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function first(array $array): mixed\n{\n return $array ? reset($array) : null; // No falses.\n}",
"public static function first($array)\n {\n $newArr = array_slice($array, 0, 1);\n\n return !empty($newArr[0]) ? $newArr[0] : false;\n }",
"function first($target)\n {\n // target must be an array\n if (!is_array($target)) {\n $target = (array)$target;\n }\n // target is required to have a value.\n if (count($target)) {\n return array_values($target)[0];\n } else {\n return false;\n }\n }",
"function array_first($array)\n{\n if( is_array($array) )\n {\n $keys = array_keys($array);\n if( isset($keys[0]) )\n return $array[$keys[0]];\n }\n return null;\n}",
"public function first(): mixed\n {\n return array_first($this->data);\n }",
"function array_first($array)\n {\n return arr::first($array);\n }",
"public function getFirstItemValue()\n {\n $slab = $this->getFirstSlab();\n\n if (empty($slab)) {\n return false;\n }\n\n return $this->getFirstItemValueInSlab($slab);\n }",
"public function first()\n {\n return ($this->pointer == 0);\n }",
"public static function first($array) {\n\t\treturn $array[0];\n\t}",
"private function oneFromArray($array, $key = 0) {\n if (ISSET($array[$key]))\n {\n return $array[$key];\n }\n }",
"function array_first($array, $callback, $default = null)\n\t{\n\t\tforeach ($array as $key => $value)\n\t\t{\n\t\t\tif (call_user_func($callback, $key, $value)) return $value;\n\t\t}\n\n\t\treturn value($default);\n\t}",
"public static function first($array) {\n if (count($array) == 0) {\n return null;\n }\n $keys = array_keys($array);\n return $array[$keys[0]];\n }",
"function first_value_from_array(array $array, mixed $default = null): mixed\n {\n return \\Midnite81\\Core\\Functions\\first_value_from_array($array);\n }",
"public static function first(array $array)\n {\n return !empty($array) ? reset($array) : null;\n }",
"protected function first() {\n if (!$this->query_failed) {\n return $this->results[0] ?? null;\n }\n\n return false;\n }",
"public function first()\n {\n $copy = $this->array;\n return reset($copy);\n }",
"function array_first($array, $callback, $default = null)\n {\n return Arr::first($array, $callback, $default);\n }",
"public static function first( $array, $getKey = FALSE )\n\t{\n\t\tif ( $getKey ) {\n\t\t\t$array = array_keys( $array );\n\t\t}\n\t\treturn is_array( $array ) ? reset( $array ) : NULL;\n\t}",
"public function array_first( $array, $get_key = false ) {\n\t\tif ( is_array( $array ) && ! empty( $array ) ) {\n\t\t\t$keys = array_keys( $array );\n\n\t\t\t// Get array key\n\t\t\tif ( $get_key ) {\n\t\t\t\treturn $keys[0];\n\t\t\t}\n\n\t\t\t// Get array value\n\t\t\treturn $array[ $keys[0] ];\n\t\t}\n\n\t\treturn null;\n\t}",
"protected function get_first_array_item( $val ) {\n\t\tif ( $val && is_array( $val ) ) {\n\t\t\treturn $val[0];\n\t\t}\n\t\treturn $val;\n\t}",
"public function first(){\n return (!empty($this->_result)) ? $this->_result[0] : [];\n }",
"public function scalar() {\n if($this->result_array) {\n $keys = array_keys($this->result_array[0]);\n return $this->result_array[0][$keys[0]];\n }\n return false;\n }",
"public function hasFirstItem() {}",
"public function first(){\n $where_clause = $this->getWhereClause();\n\n $this->sql = \"SELECT * FROM \".$this->table.\" \".$where_clause. $this->order_by;\n\n $result = mysqli_query($this->connection,$this->sql);\n if(mysqli_num_rows($result) > 0){\n return mysqli_fetch_array($result);\n }\n return false;\n\n // $new = array_map(function($param1,$parm1){\n // return\n // },$arr1,$arr2);\n\n\n }",
"function _first($ar){\n\treturn array_shift(array_values($ar));\t\n}",
"function array_first($array, callable $callback = null, $default = null)\n {\n return Arr::first($array, $callback, $default);\n }",
"protected function is_single($data){\n foreach ($data as $value){\n if (is_array($value)){\n return false;\n }\n return true;\n }\n }",
"public static function end($array)\n {\n $count = count($array);\n $count = $count > 0 ? $count - 1 : 0;\n $newArr = array_slice($array, $count, 1);\n\n return !empty($newArr[0]) ? $newArr[0] : false;\n }",
"function getFirstElement($array){\n\n /*\n * convert object to array first\n */\n\n if(is_object($array)){\n $array = (array) $array;\n }\n\n\n /*\n * check if this array is\n * php array\n */\n\n if(is_array($array)){\n return getElement($array);\n }\n\n /*\n * if json array\n * check if json is valid\n * and decode the array\n */\n\n $array = jsonDecode($array);\n\n /*\n * return with the first element\n */\n\n return getElement($array);\n\n}",
"public function first()\n {\n if (!isset($this->manuallyAddedData[0])) {\n return false;\n }\n\n return $this->manuallyAddedData[0];\n }"
]
| [
"0.7752601",
"0.77378595",
"0.7166476",
"0.69457716",
"0.6910956",
"0.69018996",
"0.67264545",
"0.6688218",
"0.66717577",
"0.6659745",
"0.6597155",
"0.6571985",
"0.6570781",
"0.6542186",
"0.6526536",
"0.6518935",
"0.6496269",
"0.641664",
"0.63952726",
"0.6390363",
"0.63297534",
"0.6328495",
"0.6304822",
"0.6302927",
"0.62786824",
"0.6265211",
"0.6241827",
"0.62368256",
"0.6235216",
"0.6180258"
]
| 0.8042722 | 0 |
Call the callback for each elements in the array and set the result into a new array | public static function map($array,$callback){
$newArray = array();
foreach($array as $key=>$value)
$newArray[$key] = $callback($key,$value);
return $newArray;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static function apply($array,$callback,$parameters = []){\n\t\t$parameters = (array)$parameters;\n\t\t$newArray = [];\n\t\tforeach($array as $k=>$v){\n\t\t\t$newArray[$k] = call_user_func_array($callback,array_merge([$k,$v],$parameters));\n\t\t}\n\t\treturn $newArray;\n\t}",
"function array_build($array, Closure $callback)\n\t{\n\t\t$results = array();\n\n\t\tforeach ($array as $key => $value)\n\t\t{\n\t\t\tlist($innerKey, $innerValue) = call_user_func($callback, $key, $value);\n\n\t\t\t$results[$innerKey] = $innerValue;\n\t\t}\n\n\t\treturn $results;\n\t}",
"function array_transform($array, $function)\n{\n\tforeach ($array as &$element)\n\t\t$element = $function($element);\n\treturn $array;\n}",
"public function each($callback)\n {\n array_walk($this->items, $callback);\n }",
"function each(array $array, callable $func): void\n{\n Arrays::each($array, $func);\n}",
"public static function map( $callback, $array, $applyToKeys = FALSE )\n\t{\n\t\tif ( $applyToKeys ) {\n\t\t\t$newArr = array();\n\t\t}\n\t\tforeach ( $array as $key => $val ) {\n\t\t\tif ( is_array( $val ) ) {\n\t\t\t\tif ( $applyToKeys ) {\n\t\t\t\t\t$newArr[call_user_func( $callback, $key )] = self::map( $callback, $val, $applyToKeys );\n\t\t\t\t} else {\n\t\t\t\t\t$array[$key] = self::map( $callback, $val );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ( $applyToKeys ) {\n\t\t\t\t\t$newArr[call_user_func( $callback, $key )] = $val;\n\t\t\t\t} else {\n\t\t\t\t\t$array[$key] = call_user_func( $callback, $val );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ( $applyToKeys ) {\n\t\t\treturn $newArr;\n\t\t} else {\n\t\t\treturn $array;\n\t\t}\n\t}",
"function array_build($array, callable $callback)\n {\n return Arr::build($array, $callback);\n }",
"function array_build($array, Closure $callback)\n {\n return Arr::build($array, $callback);\n }",
"public function forEach(callable $callback): void {\n\t\tforeach ($this as $value) {\n\t\t\t$callback($value);\n\t\t}\n\t}",
"public function map(callable $callback) : self\n {\n $b = [];\n\n foreach ($this->a as $rowA) {\n $b[] = array_map($callback, $rowA);\n }\n\n return self::quick($b);\n }",
"static function build(array $array, callable $callback) {\n $ret = [];\n\n foreach ($array as $key => $value) {\n list($innerKey, $innerValue) = $callback($key, $value);\n $ret[$innerKey] = $innerValue;\n }\n\n return $ret;\n }",
"public function transform(Closure $callback)\n {\n $array = $this->toArray();\n\n $array = array_map($callback, $array);\n\n $indexedArray = static::createFormArray($array);\n $indexedArray->bucketSize = $this->getSize();\n\n return $indexedArray;\n }",
"function apply(callable $cb) {\n\t\tarray_walk($this->rows, $cb, $this);\n\t\treturn $this;\n\t}",
"public static function build($array, callable $callback)\n {\n $results = [];\n\n foreach ($array as $key => $value)\n {\n list($innerKey, $innerValue) = call_user_func($callback, $key, $value);\n\n $results[$innerKey] = $innerValue;\n }\n\n return $results;\n }",
"function array_filter_use_both($array, $callback)\n {\n $items = [];\n\n foreach ($array as $key => $value) {\n if (! $callback($value, $key)) {\n continue;\n }\n\n $items[$key] = $value;\n }\n\n return $items;\n }",
"public function map($callback, $callbackArg = null) {\n\treturn array_walk($this->_elArray, $callback, $callbackArg);\n}",
"public static function build($array, callable $callback)\n {\n $results = [];\n\n foreach ($array as $key => $value) {\n list($innerKey, $innerValue) = call_user_func($callback, $key, $value);\n\n $results[$innerKey] = $innerValue;\n }\n\n return $results;\n }",
"function map_array($arr, $fn) {\n\t$result = array();\n\tforeach($arr as $k => $v) {\n\t\t$result[$k] = $fn($v);\n\t}\n\treturn $result;\n}",
"static function filter_morph($array, $callback){\n\t\t$result = [];\n\t\tforeach($array as $k=>$v){\n\t\t\t$value = $callback($v, $k);\n\t\t\tif($value){\n\t\t\t\t$result[$k] = $v;\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}",
"public static function transformWithKeys($array, $callback) {\n $args = func_get_args();\n array_shift($args);\n array_shift($args);\n\n $out = [];\n foreach ($array as $key => $item) {\n $currentArgs = array_merge([$item, $key], $args);\n list($key, $value) = call_user_func_array($callback, $currentArgs);\n $out[$key] = $value;\n }\n\n return $out;\n }",
"public function each(callable $callback);",
"public function each(callable $callback);",
"public function each(callable $callback);",
"public function each(callable $callback);",
"public function each($callback)\n {\n foreach ($this->_data as $key => $val) {\n $this->_data[$key] = $callback($val, $key, $this);\n }\n return $this;\n }",
"public function each(\\Closure $callback);",
"private function arrayWalk(array $array, $function)\n {\n array_walk($array, $function);\n\n return $array;\n }",
"public function map(callable $callback): self {\n\t\treturn new static(array_map($callback, $this->array));\n\t}",
"public function each(callable $callback): void\n {\n Tools::each($callback, $this->entries());\n }",
"public function reduce($callback, $initial = null)\n {\n return array_reduce($this->toArray(), $callback, $initial);\n }"
]
| [
"0.6396588",
"0.6331523",
"0.6231229",
"0.6175843",
"0.6165185",
"0.60502803",
"0.5946489",
"0.5926521",
"0.58838344",
"0.58466697",
"0.5808983",
"0.5777217",
"0.5769271",
"0.5757129",
"0.57395077",
"0.5739354",
"0.5716901",
"0.567011",
"0.5661662",
"0.5643416",
"0.5582149",
"0.5582149",
"0.5582149",
"0.5582149",
"0.5567817",
"0.54629993",
"0.5438662",
"0.5438334",
"0.5427172",
"0.54182655"
]
| 0.6726077 | 0 |
Dispatch goes through each slot with the signal and call the given function name for the object | public function dispatch($signalName) {
$messages = '';
foreach ($this->slots[$signalName] as $slot) {
if (method_exists($slot['obj'], $slot['method'])) {
$messages .= $slot['obj']->{$slot['method']}();
}
}
return $messages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function dispatch($object);",
"public function dispatch()\r\n {\r\n foreach($this->broadcast as $event => $data) {\r\n $this->execute($event);\r\n }\r\n }",
"public function testDispatchEvents($eventName, $methodName, $objectName)\n {\n $isCalledWithRightPrefix = 0;\n $isObjectNameRight = 0;\n $this->eventDispatcher->expects($this->any())->method('dispatch')->with(\n $this->callback(function ($arg) use (&$isCalledWithRightPrefix, $eventName) {\n $isCalledWithRightPrefix |= ($arg === $eventName);\n return true;\n }),\n $this->callback(function ($data) use (&$isObjectNameRight, $objectName) {\n $isObjectNameRight |= isset($data[$objectName]);\n return true;\n })\n );\n \n $this->stockModel->$methodName();\n $this->assertTrue(\n ($isCalledWithRightPrefix && $isObjectNameRight),\n sprintf('Event \"%s\" with object name \"%s\" doesn\\'t dispatched properly', $eventName, $objectName)\n );\n }",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"protected function getSignalSlotDispatcher() {}",
"public function dispatch()\n\t{\n\t\t$this->{$this->_action}();\n\t}",
"public function dispatch();",
"public function dispatch();",
"private function dispatchSig()\n\t{\n\t\tswitch ( $this->signal ) {\n\t\t\t// reload\n\t\t\tcase 'reload':\n\t\t\t\t$this->workerExitFlag = true;\n\t\t\t\tbreak;\n\n\t\t\t// stop\n\t\t\tcase 'stop':\n\t\t\t\t$this->workerExitFlag = true;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tbreak;\n\t\t}\n\t}",
"protected static function getSignalSlotDispatcher() {}",
"protected static function getSignalSlotDispatcher() {}",
"public function postDispatch();",
"public function getEventDispatch();",
"public function postDispatch(){\n\t\t\n }",
"public function dispatch(): void {}",
"protected function callHandlers()\n {\n // Iterate handlers and run them\n foreach ($this->handlers as $i => $handler) {\n // Create handler params array with first parameter pointing to this query object\n $params = array(& $this);\n\n // Combine params with existing ones in one array\n $params = array_merge($params, $this->params[$i]);\n\n // Execute handler\n call_user_func_array($handler, $params);\n }\n }",
"public function dispatch(Request $request) {\n\n $uri = $request->uri();\n $method = $request->method();\n\n if (in_array($uri, self::$routes)) {\n if (self::$methods[$uri] == $method || self::$methods[$uri] == 'ANY') {\n if (is_object(self::$callbacks[$uri])) {\n call_user_func(self::$callbacks[$uri]);\n } else {\n $s = explode('@', self::$callbacks[$uri]);\n call_user_func(array((new $s[0]), $s[1]));\n }\n }\n } else {\n header($_SERVER['SERVER_PROTOCOL'].\" 404 Not Found\");\n echo '404';\n }\n }",
"public function __invoke()\n {\n pcntl_signal_dispatch();\n }",
"public function postDispatch()\n {\n //...\n }",
"private function dispatch($data)\n {\n foreach ($this->eventListeners as $eventListener)\n $eventListener->handle($data);\n }",
"public function postDispatch()\n {\n\n }",
"final private function dispatch($string, ...$args) {\n return $this->{static::$functionMap[$string]}(...$args);\n }"
]
| [
"0.5774872",
"0.56293905",
"0.54975164",
"0.54476726",
"0.54476726",
"0.54476726",
"0.54476726",
"0.54476726",
"0.54476726",
"0.544451",
"0.5443855",
"0.5443855",
"0.5443855",
"0.54388916",
"0.54261917",
"0.54261917",
"0.54188544",
"0.52808666",
"0.52804357",
"0.51442474",
"0.49358296",
"0.49313235",
"0.49235475",
"0.49186525",
"0.4913328",
"0.48880124",
"0.4881593",
"0.4862747",
"0.48041937",
"0.47258785"
]
| 0.6226511 | 0 |
The "booted" method of the model. | protected static function booted()
{
//
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function booted()\n {\n }",
"public static function booted()\n {\n }",
"public static function booted()\n {\n }",
"protected static function booting()\n {\n //\n }",
"public function boot()\n\t{\t\n\t}",
"public function boot()\r\n {\r\n parent::boot();\r\n\r\n //\r\n }",
"public function boot()\r\n {\r\n parent::boot();\r\n\r\n //\r\n }",
"public function boot()\n {}",
"public function boot()\n {}",
"public function boot()\n\t{\n\t\t\n\t}",
"public function boot()\n\t{\n\t\t\n\t}",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n //\n\n parent::boot();\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }",
"public function boot()\n {\n parent::boot();\n\n //\n }"
]
| [
"0.74500155",
"0.74482244",
"0.74482244",
"0.731309",
"0.7271187",
"0.72643036",
"0.72643036",
"0.71871316",
"0.71871316",
"0.71850294",
"0.71850294",
"0.71707904",
"0.71706986",
"0.71706986",
"0.71706986",
"0.71706986",
"0.71706986",
"0.71706986",
"0.71706986",
"0.71706986",
"0.71706986",
"0.7152197",
"0.7152197",
"0.7152197",
"0.7152197",
"0.7152197",
"0.7152197",
"0.7152197",
"0.7152197",
"0.7152197"
]
| 0.76181376 | 1 |
Get an array of files attached to an inquiry. | function getInquiryFiles($inquiryId) {
$sql = "
SELECT
F.Id AS Id,
F.Name AS Name
FROM ServiceRequestFiles SRF, Files F
WHERE
SRF.ServiceRequest_Id = ".$inquiryId." AND
SRF.File_Id = F.Id";
$result = mysql_query($sql);
if (!$result) {
return;
}
$files = array();
while ($row = mysql_fetch_assoc($result)) {
$files[] = array('name' => $row['Name'], 'idAndChecksum' => $row['Id'].':'.CheckSum($row['Id']));
}
mysql_free_result($result);
return $files;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getFiles()\n {\n $files = [];\n if($attachmentData = $this->setAttachmentData()){\n $files['attachment'] = $this->setAttachmentData();\n }\n return $files;\n }",
"public function getFiles() {\r\n\r\n $files = array();\r\n\r\n $userId= $this->userId;\r\n $trackingId = $this->trackingFormId;\r\n $dir = FILEPATH . $userId. '/' . $trackingId;\r\n\r\n if (is_dir($dir)) {\r\n if ($dh = opendir($dir)) {\r\n while (($file = readdir($dh)) !== false) {\r\n if($file != '.' && $file != '..') {\r\n $size = $this->Size($dir . '/' . $file);\r\n array_push($files, array('name'=>$file,\r\n 'urlfilename'=>urlencode($file),\r\n 'size'=>$size));\r\n }\r\n }\r\n closedir($dh);\r\n }\r\n }\r\n\r\n return $files;\r\n }",
"public function getFiles(): array;",
"public function getFiles(): array\n {\n return [$this->file];\n }",
"public function getFiles() {\n return $this->getPartFiles(0);\n }",
"public function getOtherFiles(): array;",
"public function getFiles(): array\n {\n return $this->files;\n }",
"public function getFiles()\n {\n $request = $this->getRequest();\n return (array)$request->getFiles();\n }",
"public function getAttachments(): array;",
"public function getFiles();",
"public function getFiles();",
"public function getFiles();",
"public function getFiles() : array\n {\n return $this->files;\n }",
"public function files()\n {\n return $this->_array[\"files\"];\n }",
"public function getFiles ();",
"public function getFiles() {}",
"protected function getFiles(): array\n {\n return [];\n }",
"public function getAttachments()\n\t{\n\t\t$app = Factory::getApplication();\n\t\t$data = $app->input->post->get('jform', array(), 'array');\n\t\t$files = $app->input->files->get('jform');\n\t\t$allowed_extensions = ComponentHelper::getParams('com_tkdclub')->get('allowed_extensions', 'pdf');\n\t\t$allowed_extensions_array = explode(',', $allowed_extensions);\n\n\t\t$attachments = array();\n\t\t$paths = array();\n\t\t$filenames = array();\n\n\t\tforeach($files as $file)\n\t\t{\n\t\t\tif($file['name'] != '' && $file['error'] == (int) 0)\n\t\t\t{\t\n\t\t\t\t// Check for right file extension\n\t\t\t\tif(!in_array(File::getExt($file['name']), $allowed_extensions_array))\n\t\t\t\t{\n\t\t\t\t\t$app->enqueueMessage(Text::_('COM_TKDCLUB_EMAIL_ATTACHMENT_NOT_ALLOWED') . $allowed_extensions, 'error');\n\t\t\t\t\t$app->setUserState('com_tkdclub.email.data', $data);\n\t\t\t\t\t\n\t\t\t\t\treturn false;\t\n\t\t\t\t}\n\n\t\t\t\t$paths[] = $file['tmp_name'];\n\t\t\t\t$filenames[] = $file['name'];\n\t\t\t}\n\t\t}\n\n\t\tif(empty($paths))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$attachments['paths'] = $paths;\n\t\t$attachments['filenames'] = $filenames;\n\n\t\treturn $attachments;\n\t}",
"public function getFiles(): array\n {\n try {\n if (count($this->_filesCollection) === 0) {\n $path = $this->_flysystemHelper->getCurrentPath();\n\n $contents = $this->_flysystemManager->getAdapter()->listContents($path);\n foreach ($contents as $file) {\n if ($this->validateFile($file)) {\n $this->_filesCollection[] = $file;\n }\n }\n }\n } catch (\\Exception $e) {\n $this->_messageManager->addErrorMessage($e->getMessage());\n return [];\n }\n\n return $this->_filesCollection;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"public function getFiles()\n {\n return $this->files;\n }",
"function &getFiles() {\n\t\tif (!isset($this->files)) {\n\t\t\t$res = db_query_params ('SELECT id,artifact_id,description,filename,filesize,' .\n\t\t\t\t\t'filetype,adddate,submitted_by,user_name,realname\n\t\t\t\t\t FROM artifact_file_user_vw WHERE artifact_id=$1',\n\t\t\t\t\t\tarray ($this->getID())) ;\n\t\t\t$rows=db_numrows($res);\n\t\t\tif ($rows > 0) {\n\t\t\t\tfor ($i=0; $i < $rows; $i++) {\n\t\t\t\t\t$this->files[$i]=new ArtifactFile($this,db_fetch_array($res));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->files=array();\n\t\t\t}\n\t\t}\n\t\treturn $this->files;\n\t}"
]
| [
"0.7066114",
"0.70325184",
"0.67984945",
"0.66662216",
"0.65669227",
"0.65216726",
"0.650381",
"0.6479447",
"0.6453248",
"0.6441419",
"0.6441419",
"0.6441419",
"0.64338845",
"0.6391936",
"0.638207",
"0.63806206",
"0.6374391",
"0.6305988",
"0.6293139",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6285561",
"0.6280053"
]
| 0.7831341 | 0 |
Verifies that $result isn't false. This is a utility function to keep the code a bit cleaner/shorter. If $result is false this function will do the following: 1. Perform a mysql_query("ROLLBACK"). 2. Send a header with supplied error message. 3. exit(0). If $result isn't false this function does nothing. | function verifyOrRollback($result, $message) {
if (!$result) {
mysql_query("ROLLBACK");
header("Status: 400 " . $message );
exit(0);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static function is_void($result) {\r\n if ($result != false) {\r\n if ($result->rowCount() > 0)\r\n return false;\r\n else\r\n return true;\r\n }\r\n else\r\n return true;\r\n //Functions::RegisterError($libError, $detail);\r\n }",
"private function confirm_query($result){\n if(!$result){\n $output = \"Database failed on query: \" . mysql_error() . \"<br />\";\n die($output);\n }\n }",
"function confirm_result_set($result_set){\n if (!$result_set) {\n exit(\"Database query failed.\");\n }\n}",
"private function confirm_query($result)\n\t{\n\t\tif(!$result):\n\t\t\tdie('Query Failed' . $this->connection->error);\n\t\tendif;\n\t}",
"function confirm($result)\r\n{\r\n global $dataBaseConnection;\r\n if (!$result) {\r\n die(\"QUERY FAILED\" . mysqli_error($dataBaseConnection));\r\n }\r\n}",
"function confirm($result){\n global $Connection;\n if(!$result){\n die(\"QUERY FAILED \" . mysqli_error($Connection));\n }\n}",
"public function checkResult() {\n\t\treturn ($this->_query_result !== false);\n\t}",
"function confirmQuery($result)\n {\n global $connection;\n if(!$result)\n {\n die(\"QUERY ERROR: \" . mysqli_error($connection));\n }\n }",
"private function confirmQuery($result){\n if (!$result) {\n die(\"Database query failed!\");\n }\n }",
"function confirm($result) {\n\tglobal $connection;\n\n\tif (!$result) {\n\t\tdie(\"Query Failed : \" . mysqli_error($connection));\n\t}\n}",
"private function checkError($result)\n\t{\n\t\tif($result->errno == '0')\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}",
"function check_results($results) {\n global $dbc;\n if($results != true)\n echo '<p>SQL ERROR = ' . mysqli_error( $dbc ) . '</p>' ; \n}",
"function check_results($results) {\n global $dbc;\n\n if($results != true)\n echo '<p>SQL ERROR = ' . mysqli_error( $dbc ) . '</p>' ;\n}",
"function check_results($results) {\n global $dbc;\n\n if($results != true)\n echo '<p>SQL ERROR = ' . mysqli_error( $dbc ) . '</p>' ;\n}",
"function check_results($results) {\r\n global $dbc;\r\n\r\n if($results != true)\r\n echo '<p>SQL ERROR = ' . mysqli_error( $dbc ) . '</p>' ; \r\n}",
"private function confirm_query($result){\n if(!$result){\n die(\"Query failed \" . $this->connection->error);\n }\n }",
"public function confirm_query($result) {\n if (!$result) {\n $output = \"Database query Failed: \" . mysqli_error($this->connection) . \"<br /><br />\";\n $output .= \"Last query: \" . $this->last_query;\n die($output);\n }\n }",
"function check_results($results) {\n global $dbc;\n\n if($results != true)\n echo '<p>SQL ERROR = ' . mysqli_error( $dbc ) . '</p>' ;\n\n\n}",
"private function confirm_query($result) {\n\t\tif(!$result) {\n\t\t\t$output = \"Database query failed: \" . mysqli_error() . \"<br /><br />\";\n\t\t\t$output .= \"Last SQL query: \" . $this->last_query;\n\t\t\tdie($output);\n\t\t}\n\t}",
"function confirm_query($result_set) {\n\tif (!$result_set) {\n\t\tdie(\"Database query failed.\");\n\t}\n}",
"function confirm_query($result_set) {\n\tif (!$result_set) {\n\t\tdie(\"Database query failed.\");\n\t}\n}",
"function confirm_query($result_set) {\r\n\t\tif(!$result_set) {\r\n\t\t\tdie(\"Database query failed.\");\r\n\t\t}\r\n\t}",
"private function confirm_query($result) {\n if(!$result) {\n die(\"Query failed\" . $this->connection->error);\n }\n }",
"function confirm($result){\n \n global $connection;\n \n if(!$result){\n die('Query failed' . mysqli_error($connection));\n }\n}",
"private function checkResult($result) {\n if ($result === false) {\n throw new Exception(\n 'Socket operation failed: ' . $this->getLastError()\n );\n }\n }",
"function cSsql_write_error($sql_query_result)\r\n{\r\n if (!$sql_query_result)\r\n {\r\n return_error('mysql', mysql_errno(), mysql_error());\r\n //echo('<error type=\"mysql\" no=\"'.mysql_errno().'\">'.mysql_error().'</error>');\r\n }\r\n return !$sql_query_result;\r\n}",
"private function confirm_query($result)\n {\n if(!$result)\n {\n // if (mysqli_connect_errno()) \n // {\n // echo 'Connect failed: '. mysqli_connect_error();\n // }\n die(\"Database Query Failed: \" . mysqli_error($connection));\n }\n }",
"function validate ($results) {\n\t\tglobal $mysqli;\n\t\tif (!$results) {\n\t\t\techo \"MySQL Query Error: \" . $mysqli->error;\n\t\t\t$mysqli->close();\n\t\t\texit();\n\t\t}\n\t}",
"function confirm_query($result_set) {\n if (!$result_set) {\n die(\"Database query failed: \" . sqlite_error());\n }\n }",
"function check(array $result, $die = false) {\n if(is_array($result[0])) {\n foreach($result as $result_next) {\n check($result_next, $die);\n }\n }\n\n $date_str = date('d/m/y H:i:s').\" \";\n\n if($result[0] === false) {\n echo $date_str.B_RED.\"FAIL: \".CLEAR.trim($result[1]).\"\\r\\n\";\n if($die) {\n die;\n }\n }\n\n if($result[0] === true && isset($result[1]) && is_string($result[1]) && strlen($result[1]) > 0) {\n echo $date_str.B_GREEN.\"SUCCESS: \".CLEAR.trim($result[1]).\"\\r\\n\";\n }\n}"
]
| [
"0.71678555",
"0.67734647",
"0.6767018",
"0.6710429",
"0.669215",
"0.66411895",
"0.66334313",
"0.66061234",
"0.65976506",
"0.65634394",
"0.6486703",
"0.6430389",
"0.642947",
"0.642947",
"0.64215004",
"0.6418571",
"0.6409997",
"0.6357039",
"0.6351108",
"0.6333726",
"0.6333726",
"0.63300824",
"0.63230264",
"0.6308343",
"0.62798876",
"0.6257711",
"0.6191922",
"0.5929685",
"0.58880025",
"0.58647734"
]
| 0.7652367 | 0 |
START: Population of organization combobox items $sql : source query of the combobox list $id_column : the column name where that will be used as ID of every list item $name_column : the column name where the text of each list item will be based from. | function GetComboboxItems($div_name, $span_name, $sql, $id_column, $name_column){
//$sql = "select id, category from priside.BusinessServiceCategory where parent_id = 0 order by category";
$result = mysql_query($sql);
$list_html = "";
while($row = mysql_fetch_assoc($result)){
$list_html .= "<li id=\"org_".$row[$id_column]."\" value=\"".$row[$id_column]."\" onclick=\"displaySelectedItem('".$div_name."', '".$span_name."', '".$row[$name_column]."');\">".$row[$name_column]."</li>\n";
}
mysql_free_result( $result );
return $list_html;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function\tdropdown_list($dbconn) {\n\t$sqlcom=\"select distinct spec_id,name from info;\";\n\t$dbres = pg_exec($dbconn, $sqlcom );\n\tif ( ! $dbres ) {echo \"Error : \" + pg_errormessage( $dbconn ); exit();} \n\t$row=0;\n\t$rowmax=pg_NumRows($dbres);\n\tprint \"<form method=\\\"post\\\" action=\\\"libSpec.php\\\"><select name=\\\"organism\\\" onchange=\\\"this.form.submit();\\\">\\n<option value=\\\"select\\\">Select an organism...</option>\\n\"; \n\twhile ($row<$rowmax) {\n\t $do = pg_Fetch_Object($dbres, $row);\n\t $name=$do->name;\n\t print \"<option value=\\\"$name\\\">$name</option>\\n\";\n\t $row++;\n\t}\n\tprint(\"</select></form>\\n\\n\");\n}",
"function cmdacc_mst($name, $caption, $key = null, $key2 = null, $width2 = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/acc_mst&pk=part_code&sk=part_name\";\n //remotecombobox($name,$caption,100,$url,'sgrp_code','sgrp_name');\n $field = array\n (\n array(\"part_code\", \"Code\", 100),\n array(\"part_name\", \"Name\", 220)\n );\n cmbGridSingle2($name, $caption, $url, $field, 350, $key, $key2, $width2);\n}",
"function cmdSalesLevel($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/srep_lev&pk=slev_code&sk=slev_name&order=slev_name\";\n //remotecombobox($name,$caption,100,$url,'slev_code','slev_name');\n $field = array\n (\n array(\"slev_code\", \"Code\", 100),\n array(\"slev_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"function part139339_c_facilitycombobox_limitedtomu($suppliedid, $archived, $nameofinput, $showcombobox, $default) {\r\n\t// $archived\t\t, do you want to list all menu items, or just the archived ones;\r\n\t// $nameofinout\t\t, what is the name of the select box that 'could' be ceated by this function;\r\n\t// $showcombobox\t, Do you want to show the combo box select input style or just the text without the input box;\r\n\t// $default\t\t\t, What is the default group to display in the combobox when it is displayed;\r\n\r\n\t// Examples\r\n\t\r\n\t//\t$adataselect[$i]($objarray[$adatafieldid[$i]], \"all\", $adatafield[$i], \"hide\", \"\");\r\n\t// This example will only show one record, and it will not be in a combobox input box, but rather be displayed as text.\r\n\t\r\n\t\r\n\t$sql\t= \"\";\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Define the sql variable, just in case\r\n\t$nsql \t= \"\";\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Define the nsql variable, just in case\r\n\t\r\n\t$sql = \"SELECT * FROM tbl_139_339_sub_c_f \r\n\t\t\tWHERE 139339_f_rwy_yn != 2 AND 139339_f_rwy_yn != 3 \";\r\n\t\t\t\t\t\t\t\t\t// start the SQL Statement with the common syntax\r\n\r\n\t\r\n\t$objconn_support = mysqli_connect($GLOBALS['hostdomain'], $GLOBALS['hostusername'], $GLOBALS['passwordofdatabase'], $GLOBALS['nameofdatabase']);\r\n\t\r\n\tif (mysqli_connect_errno()) {\r\n\t\t\tprintf(\"connect failed: %s\\n\", mysqli_connect_error());\r\n\t\t\texit();\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$objrs_support = mysqli_query($objconn_support, $sql);\r\n\t\t\tif ($objrs_support) {\r\n\t\t\t\t\t$number_of_rows = mysqli_num_rows($objrs_support);\r\n\t\t\t\t\t//printf(\"result set has %d rows. \\n\", $number_of_rows);\r\n\t\t\t\t\tif ($showcombobox==\"show\") {\r\n\t\t\t\t\t\t\t?>\r\n\t<SELECT class=\"Commonfieldbox\" name=\"<?php echo $nameofinput?>\" ID=\"<?php echo $nameofinput?>\">\r\n\t\t<option value=\"all\">All Surfaces</option>\r\n\t\t\t\t\t<?php \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\twhile ($objfields = mysqli_fetch_array($objrs_support, MYSQLI_ASSOC)) {\r\n\t\t\t\t\t\t\t$tmpsuppliedid \t\t= $objfields['139339_f_id'];\r\n\t\t\t\t\t\t\t$tmpsuppliedname \t= $objfields['139339_f_name'];\r\n\t\t\t\t\t\t\t$tmpsuppliedarch\t= $objfields['139339_f_archived_yn'];\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($showcombobox==\"show\") {\r\n\t\t\t\t\t\t\t\t?>\r\n\t\t<option \r\n\t\t\t\t\t\t\t\t<?php \r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif ($suppliedid = \"all\") {\r\n\t\t\t\t\t\t\t\t\t$intsuppliedid\t= (double) $default;\r\n\t\t\t\t\t\t\t\t\tif ($tmpsuppliedid == $intsuppliedid) {\r\n\t\t\t\t\t\t\t\t\t\t\tif ($showcombobox==\"show\") {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t?>\r\n\t\t\t\tSELECTED\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php \r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\t// There is no user specified so we dont need to set a defualt value\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif ($showcombobox==\"show\") {\r\n\t\t\t\t\t\t\t\t\t\t?>\r\n\t\t\t\tvalue=\"<?php echo $tmpsuppliedid;?>\"><?php echo $tmpsuppliedname;?></option>\r\n\t\t\t\t\t\t\t\t\t\t<?php \r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t?>\r\n\t\t\t\t<?php echo $tmpsuppliedname?>\r\n\t\t\t\t\t\t\t\t\t\t<?php \r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\t// End of while loop\r\n\t\t\t\t\t\t\t\tmysqli_free_result($objrs_support);\r\n\t\t\t\t\t\t\t\tmysqli_close($objconn_support);\r\n\t\t\t\t\t\t\t\tif ($showcombobox==\"show\") {\r\n\t\t\t\t\t\t\t\t\t\t?>\r\n\t\t</SELECT>\r\n\t\t\t\t\t\t\t\t\t\t<?php \r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\t// end of Res Record Object\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\treturn \t$tmpsuppliedname;\t\r\n\t\t\t\t\r\n\t}",
"function cmdBusProd($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/bus_item&pk=item_code&sk=item_name&order=item_name\";\n //remotecombobox($name,$caption,100,$url,'item_code','item_name');\n $field = array\n (\n array(\"item_code\", \"Code\", 100),\n array(\"item_name\", \"Name\", 220),\n );\n\n if ($width == null) {\n $width = 170;\n }\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"function populateDropDownItems($dropDownSql, $onClick, $parent) {\n\n $html = \"\";\n $lookuplist = [];\n $lookuprow = $this->DEB->getRows($dropDownSql, DEB_ARRAY);\n foreach ($lookuprow as $irow => $row) {\n $lookuplist[$irow] = $row[0] . \",\" . $row[1];\n }\n\n foreach ($lookuplist as $lid => $option) {\n $option = explode(\",\", $option);\n $option[0] = trim($option[0]);\n $html .= li([\"role\" => \"presentation\"], area([\"role\" => \"menuitem\",\n \"tabindex\" => \"-1\",\n \"href\" => \"javascript:void(0);\",\n \"onclick\" => \" $('#{$parent}').text($(this).text()); $('#{$parent}').append(' <span class=\\'caret\\'></span>'); {$onClick}\",\n \"optionId\" => \"{$option[0]}\"\n ], \"{$option[1]}\")\n );\n }\n\n return $html;\n }",
"function cmdPurLev($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/prep_lev&pk=plev_code&sk=plev_name&order=plev_name\";\n //remotecombobox($name,$caption,100,$url,'plev_code','plev_name');\n $field = array\n (\n array(\"plev_code\", \"Code\", 100),\n array(\"plev_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"function cmdMarital($name, $caption) {\n $optmarital = array\n (\n array(\"\", \"\"),\n array(\"Single\", \"1\"),\n array(\"Married\", \"2\"),\n );\n ?>\n <tr>\n <td><?php getCaption($caption); ?> :</td>\n <td>\n <select class=\"easyui-combobox\"\n id=\"<?php echo $name; ?>\"\n name=\"<?php echo $name; ?>\"\n style=\"width:120px;\"\n data-options=\"panelHeight:100,editable:false,width:200\"\n disabled=true\n >\n <?php\n foreach ($optmarital as $val) {\n echo '<option value=\"' . $val[1] . '\">' . $val[0] . '</option>';\n }\n ?>\n </select>\n </td>\n </tr>\n <?php\n}",
"public function coconutComboBoxStart_long($name) {\necho \"<select name='$name' class='comboBox'>\";\n}",
"function cmdSoSrc($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/so_source&pk=sosrc_code&sk=sosrc_name&order=id\";\n //remotecombobox($name,$caption,100,$url,'sosrc_code','sosrc_name');\n $field = array\n (\n array(\"sosrc_code\", \"Code\", 100),\n array(\"sosrc_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width, 1, 1);\n}",
"function category_dropdown($title)\n{\n require 'orcl_user_passwd.php';\n $connection = oci_connect($username = $orcl_username,\n\t\t\t $password = $orcl_password,\n\t\t\t $connection_string = '//oracle.cise.ufl.edu/orcl');\n if(!$connection) {\n $e = oci_error();\n echo $e['message'];\n }\n $html='<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n \t <td width=\"200px\"><div id=\"pagetitle\">' .$title. '</div></td>\n\t <td>\n\t <div id=\"dropdown\">\n\t <label for=\"sort\" class=\"netscape4\" style=\"font-size:12px;\">Sort By: </label>\n\t <select id=\"sort\" title=\"sort\" name=\"sort\" onchange=\"optionchange(this)\">\n <option value=\"-1\">ALL</option>';\n\n $statement = oci_parse($connection, 'SELECT * FROM cat');\n oci_execute($statement);\n\n while (($row = oci_fetch_object($statement))) {\n\t $html .= '<option value=\"' .$row->CATEGORYID. '\">' .$row->CATEGORYNAME. '</option>';\n }\n\n $html.='</select></div></td></table>';\n\n // VERY important to close Oracle Database Connections and free statements!\n oci_free_statement($statement);\n oci_close($connection);\n return $html;\n}",
"public function getJobTitleToCombobox() {\n /*\n print \"<pre>\";\n print_r($ctypel);\n print \"</pre>\";\n exit(); */\n return $this->db->selectObjList('SELECT jobtitle_id, shortname, longname FROM jobtitle ORDER BY shortname;', $array = array(), \"Jobtitle\");\n }",
"function cmdCity($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/city&pk=city_code&sk=city_name&order=city_name\";\n //remotecombobox($name,$caption,100,$url,'city_code','city_name');\n $field = array\n (\n array(\"city_code\", \"Code\", 100),\n array(\"city_name\", \"Name\", 220),\n );\n if ($width == null) {\n $width = 170;\n }\n cmbGridSingle($name, $caption, $url, $field, $width, 1, 1);\n}",
"function cmbPoNo($name1, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=trx/veh_prh\";\n //remotecombobox($name,$caption,180,$url,'wrhs_code','wrhs_name');\n $field = array\n (\n array(\"po_date\", \"Date\", 220, 'formatDate'),\n array(\"po_no\", \"Code\", 100),\n );\n cmbGridSingle($name1, $caption, $url, $field, $width);\n}",
"function cmdUangMuka($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/pay_type&pk=pay_type&sk=pay_name&order=pay_type\";\n //remotecombobox($name,$caption,100,$url,'pay_code','pay_name');\n $field = array\n (\n array(\"pay_code\", \"Code\", 100),\n array(\"pay_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"public function getCpnyToCombobox() {\n return $this->db->selectObjList('SELECT company_id, shortname, longname FROM company ORDER BY shortname;', $array = array(), \"Company\");\n }",
"function cmdCollectorLevel($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/coll_lev&pk=clev_code&sk=clev_name&order=clev_name\";\n //remotecombobox($name,$caption,100,$url,'clev_code','clev_name');\n $field = array\n (\n array(\"clev_code\", \"Code\", 100),\n array(\"clev_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"function FillDynamicCombo($query,$datafield,$textfield,$selectvalue) {\n\n\t $model=new Model;\n\t\t$rs =$model->find_query_all($query);\n\t\t$i=1;\n\t\t$selectvalue1=\"\";\n if(count($rs)>0){\n\t\tforeach($rs as $row){\n\t\t if($i==1)\n\t\t $selectvalue1=$row->$datafield;\n\t\t \n\t\t if($selectvalue==$row->$datafield){\n\t\t\t echo\"<option value='\".$row->$datafield.\"' selected>\".$row->$textfield.\"</option>\";\n\t\t\t $selectvalue1=$selectvalue;\n\t\t\t}\n\t\t else {\n\t\t\techo\"<option value='\".$row->$datafield.\"'>\".$row->$textfield.\"</option>\";\n\t\t }\n\t\t $i++;\n\t\t }\n\t\t}\n\t\t return $selectvalue1;\n\t}",
"function cmdJob($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/job_fld&pk=job_code&sk=job_name&order=job_name\";\n //remotecombobox($name,$caption,100,$url,'job_code','job_name');\n $field = array\n (\n array(\"job_code\", \"Code\", 100),\n array(\"job_name\", \"Name\", 220),\n );\n\n if ($width == null) {\n $width = 170;\n }\n\n cmbGridSingle($name, $caption, $url, $field, $width);\n // remotecombobox($name,$caption, $width,$url,'job_code','job_name');\n}",
"function cmdCustType($name, $caption) {\n $optcust_type = array\n (\n array(\"\", \"\"),\n array(\"End User\", \"1\"),\n array(\"Dealer / Reseller\", \"2\"),\n array(\"Goverment / BUMN\", \"3\"),\n );\n ?>\n <tr>\n <td><?php getCaption($caption); ?> :</td>\n <td>\n <select class=\"easyui-combobox\"\n id=\"<?php echo $name; ?>\"\n name=\"<?php echo $name; ?>\"\n style=\"width:120px;\"\n data-options=\"panelHeight:100,editable:false,width:200\"\n disabled=true\n >\n <?php\n foreach ($optcust_type as $val) {\n echo '<option value=\"' . $val[1] . '\">' . $val[0] . '</option>';\n }\n ?>\n </select>\n </td>\n </tr>\n <?php\n}",
"function LUPE_criar_lista_rs($rs, $NomeCombo, $size = '', $JS = '', $Style = '', $multiple = true)\r\n{\r\n\r\n $multiple = $multiple ? 'multiple' : '';\r\n $tam_lst = $size == '' ? mssql_num_rows($rs) : $size;\r\n\r\n if ($size == '') {\r\n $tam_lst = $tam_lst < 6 ? 6 : $tam_lst;\r\n $tam_lst = $tam_lst > 15 ? 15 : $tam_lst;\r\n }\r\n\r\n echo \"<select id='$NomeCombo' name='$NomeCombo' size='$tam_lst' $multiple $JS style='$Style'>\\n\";\r\n\r\n if (mssql_num_rows($rs) > 0) {\r\n mssql_data_seek($rs, 0);\r\n\r\n While ($row = mssql_fetch_array($rs)) {\r\n echo \"<option value='\".$row[0].\"'>\";\r\n\r\n for ($x = 1; $x < mssql_num_fields($rs); $x++) {\r\n echo $row[$x];\r\n if ($x < mssql_num_fields($rs) - 1)\r\n echo ' - ';\r\n }\r\n echo\"</option>\\n\";\r\n }\r\n }\r\n\r\n echo '</select>';\r\n\r\n return 0;\r\n}",
"function selectList($name,$table,$option_name,$value_name,$curr_id,$script=\"\",$cond=\"\",$empty_option=0,$empty_value=\"\",$empty_str=\"\") {\n\n\t\tglobal $db, $db;\n\n\t\t$output\t\t = \"<select name=\\\"$name\\\" id=\\\"$name\\\" $script>\\n\";\n\t\tif ($empty_option) $output\t\t.= \"<option value=\\\"$empty_value\\\">$empty_str</option>\\n\";\n\n\t\tif(eregi(\"\\|\",$curr_id)){\n\t\t\t$curr_id_array=split(\"\\|\",$curr_id);\n\t\t}\n\n\t\tif(eregi(\"\\|\",$value_name)){\n\t\t\t$value_array=split(\"\\|\",$value_name);\n\t\t\t$value_query=preg_replace(\"#\\|#\",\",\",$value_name);\n\t\t}else{\n\t\t\t$value_query=$value_name;\n\t\t\t#echo\"<h1>value: $value_query | $value_name</h1>\";\n\t\t}\n\t\t$value_query=preg_replace(\"#,$#\",\"\",$value_query);\n\n\t\t$sql=\"select $option_name,$value_query from \".$table.\" $cond\";\n \n\t\t$result = $db->Execute(\"$sql\");\n\t\tif (!$result){\n\t\t\techo\"$sql\";\n\t\t\tprint $conn->ErrorMsg();\n\n\t\t}\n\t\twhile ( $row = $result->FetchRow() ) {\n\t\t\t//echo $curr_id.\"|\".$row[$this->fmtCase($option_name)].\"<br>\\n\";\n\t\t\tif(eregi(\"\\|\",$curr_id)){\n\t\t\t\t$selected= ((in_array($row[$this->fmtCase($option_name)],$curr_id_array))?\"selected \":\"\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$selected= (($curr_id==$row[$this->fmtCase($option_name)])?\"selected \":\"\");\n\t\t\t}\n\t\t\tif(eregi(\"\\|\",$value_name)){\n\n\t\t\t\tfor($i=0;$i<count($value_array);$i++){\n\t\t\t\t\t$each_value=strtolower($value_array[$i]);\n\t\t\t\t\t$_value .= $row[$each_value].\" -\";\n\t\t\t\t}\n\t\t\t\t$_value=preg_replace(\"#-$#\",\"\",$_value);\n\t\t\t}else{\n\t\t\t\t$value_name=strtolower($value_name);\n\t\t\t\t$_value=$row[$value_name];\n\t\t\t}\n\n\n\t\t\t$output .= \"<option value=\\\"\".$row[$this->fmtCase($option_name)].\"\\\" $selected>$_value</option>\\n\";\n\t\t\tunset($selected);\n\t\t\tunset($_value);\n\t\t}\n\t\t$result->Close();\n\n\t\t$output .= \"</SELECT>\\n\";\n\n\t\treturn $output;\n\t}",
"function cmdLastEdu($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/educ_lev&pk=educ_code&sk=educ_name&order=educ_name\";\n //remotecombobox($name,$caption,100,$url,'educ_code','educ_name');\n $field = array\n (\n array(\"educ_code\", \"Code\", 100),\n array(\"educ_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"function ShowInComboBox( $Table, $name_fld, $val, $width=40, $default_val = ' ', $sort_name = 'move', $asc_desc = 'asc', $params=NULL )\n {\n if (empty($name_fld)) $name_fld=$Table;\n if ($width==0) $width=250;\n\n $tmp_db = DBs::getInstance();\n $q = \"SELECT * FROM `\".$Table.\"` WHERE 1 LIMIT 1\";\n $res = $tmp_db->db_Query($q);\n //echo '<br>q='.$q.' res='.$res.' $tmp_db->result='.$tmp_db->result;\n if ( !$res ) return false;\n if ( !$tmp_db->result ) return false;\n $fields_col = mysql_num_fields($tmp_db->result);\n\n if ($fields_col>4) $q = \"SELECT * FROM `\".$Table.\"` WHERE `lang_id`='\"._LANG_ID.\"' order by `$sort_name` $asc_desc\";\n else $q = \"SELECT * FROM `\".$Table.\"` WHERE `lang_id`='\"._LANG_ID.\"'\";\n\n $res = $tmp_db->db_Query($q);\n //echo '<br>q='.$q.' res='.$res.' $tmp_db->result='.$tmp_db->result;\n if (!$res) return false;\n $rows = $tmp_db->db_GetNumRows();\n\n $mas_spr['']=$default_val;\n for($i=0; $i<$rows; $i++)\n {\n $row_spr=$tmp_db->db_FetchAssoc();\n $mas_spr[$row_spr['cod']]=stripslashes($row_spr['name']);\n }\n $this->Form->Select( $mas_spr, $name_fld, $val, $width, $params );\n }",
"function cmdStdopt($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/veh_stdopt&pk=stdoptcode&sk=stdoptname&order=stdoptname\";\n //remotecombobox($name,$caption,100,$url,'brnd_code','brnd_name');\n $field = array\n (\n array(\"stdoptcode\", \"Code\", 100),\n array(\"stdoptname\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"public function sublistcombo()\n\t{\n\t\techo'\n\t\t\t<select name=\"sublistcombo\" style=\"width: 180px;\">\n\t\t\t\t\t\n\t\t\t <option value=\"None\">None</option>\n\t\t\t <option value=\"Hindi\">Hindi</option>\n\t\t\t <option value=\"English\">English</option>\n\t\t\t <option value=\"Maths\">Maths</option>\n\t\t\t <option value=\"Social Science\">Social Science</option>\n\t\t\t <option value=\"General Science\">General Science</option>\n\t\t\t <option value=\"Sanscrit\">Sanscrit</option>\n\t\t\t <option value=\"Computer Science\">Computer Science</option>\n\t\t\t <option value=\"Physics\">Physics</option>\n\t\t\t <option value=\"Chemistry\">Chemistry</option>\n\t\t\t <option value=\"Higher Math\">Higher Math</option>\n\t\t\t <option value=\"Biology\">Biology</option>\n\t\t\t <option value=\"Sociology\">Sociology</option>\n\t\t\t <option value=\"Economics\">Economics</option>\n\t\t\t <option value=\"Accounts\">Accounts</option>\n\t\t\t <option value=\"History\">History</option>\n\t\t\t <option value=\"Finance\">Finance</option>\n\t\t\t <option value=\"Statistics\">Statistics</option>\n\t\t\t <option value=\"Civics\">Civics</option>\n\t\t\t <option value=\"Music\">Music</option>\n\t\t\t</select>\n\n\n\t\t';\n\t}",
"function LUPE_criar_combo_rs($rs, $NomeCombo, $PreSelect, $LinhaFixa, $JS, $Style = '')\r\n{\r\n\r\n echo \"<select id='$NomeCombo' name='$NomeCombo' $JS style='$Style'>\\n\";\r\n\r\n if ($LinhaFixa != '')\r\n echo \"<option value=''>$LinhaFixa</option>\\n\";\r\n\r\n if (mssql_num_rows($rs) == 0) {\r\n echo \"<option value=''>Não há informação no sistema</option>\\n\";\r\n } else {\r\n mssql_data_seek($rs, 0);\r\n\r\n While ($row = mssql_fetch_array($rs)) {\r\n echo \"<option value='\".$row[0].\"'\";\r\n\r\n if ($PreSelect == $row[0])\r\n echo 'selected >';\r\n else\r\n echo '>';\r\n\r\n for ($x = 1; $x < mssql_num_fields($rs); $x++) {\r\n echo $row[$x];\r\n if ($x < mssql_num_fields($rs) - 1)\r\n echo ' - ';\r\n }\r\n echo\"</option>\\n\";\r\n }\r\n }\r\n\r\n echo '</select>';\r\n\r\n return 0;\r\n}",
"function cmdBrndAcc($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/brand&pk=brand_code&sk=brand_name&order=brand_name\";\n //remotecombobox($name,$caption,100,$url,'brand_code','brand_name');\n $field = array\n (\n array(\"brand_code\", \"Code\", 100),\n array(\"brand_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"function cmdSubGroup($name, $caption, $width = null) {\n $url = \"services/runCRUD.php?func=datasource&lookup=mst/prt_sgrp&pk=sgrp_code&sk=sgrp_name&order=sgrp_name\";\n //remotecombobox($name,$caption,100,$url,'sgrp_code','sgrp_name');\n $field = array\n (\n array(\"sgrp_code\", \"Code\", 100),\n array(\"sgrp_name\", \"Name\", 220),\n );\n cmbGridSingle($name, $caption, $url, $field, $width);\n}",
"public function consumablesDropdown()\n {\n $sql = \"SELECT `materials`.`material_id`,`materials`.`material_name`,`materials`.`material_grade`\n FROM `materials`\n\t\t\t\tWHERE `injection` = 1 AND `consumables` = 1\n ORDER BY `materials`.`material_name`;\";\n if($stmt = $this->_db->prepare($sql))\n {\n $stmt->execute();\n while($row = $stmt->fetch())\n {\n $ID = $row['material_id'];\n $NAME = $row['material_name'];\n $GRADE = $row['material_grade'];\n echo '<li><a id=\"'. $NAME .'\" onclick=\"selectConsumable(\\''. $ID .'\\',\\''. $NAME .'\\')\">'. $NAME .'</a></li>'; \n }\n $stmt->closeCursor();\n }\n else\n {\n echo '<li>Something went wrong.'. $db->errorInfo .'</li>'; \n }\n }"
]
| [
"0.64213943",
"0.6167869",
"0.6125558",
"0.60950184",
"0.60944116",
"0.59681785",
"0.59601563",
"0.5942208",
"0.5929476",
"0.5928548",
"0.5922223",
"0.59216356",
"0.59192896",
"0.591603",
"0.59115344",
"0.58675784",
"0.584209",
"0.580934",
"0.5800739",
"0.5797972",
"0.5797271",
"0.57413155",
"0.57392704",
"0.57086694",
"0.5690886",
"0.5666393",
"0.5662784",
"0.56408775",
"0.5636473",
"0.5615774"
]
| 0.7383489 | 0 |
/ Espera notificaciones de pago desde Mercado pago y la envia por correo a un programador | public function recibir_notificacion_prueba()
{
Log::info('PagosController.recibir_notificacion_prueba entrada de datos');
if (Request::isMethod('POST'))
{
//Recibimos el status por correo y lo ponemos en la url para que crear el pago
$exref = Input::get('exref');
$status = Input::get('status');
$response = array("external_reference" => $exref, "status" => $status);
if (isset($response))
{
$external_reference = $response['external_reference'];
$status = $response['status'];
$ids = explode("-", rtrim($external_reference, "-"));
foreach ($ids as $id) {
$pago = Pago::find($id);
if ($status == "approved")
{
$pago->pagado = true;
$pago->status = $status;
$pago->metodo = "Mercado Pago";
}
else
{
$pago->status = $status;
}
$pago->update();
}
$email = $pago->cliente->user->email;
$nombre = $pago->cliente->nombre;
switch ($status) {
case 'approved':
Mail::queue('emails.publicacion_contenido_pago', array(), function($message) use ($email, $nombre) {
$message->to($email, $nombre)->subject('Publicación de contenido en Sphellar');
});
echo "cambios realizados";
break;
case "cenceled":
Mail::queue('emails.pago_cancelado', array(), function($message) use ($email, $nombre) {
$message->to($email, $nombre)->subject('Pago cancelado');
});
break;
default:
echo "status diferente a aprobado";
break;
}
}
else
{
Log::error('PagosController.obtenerIPNMercadoPago No se recibio informacion de pago ID:' . $id);
echo "no recibido";
}
}
else
{
return View::make('pagos.index');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function enviar_repuestos(){\n\t\t$this->asignar_valores2();\n\t\t$cuerpo =\"<img width='200' height='100' src='http://www.vehiculosvenezuela.com/imagenes/logon.jpg' />\n\t\t<br /><u>DATOS PERSONALES:</u><br />\";\n\t\t$cuerpo .=\"<br />\";\n\t\t$cuerpo .= \"<strong>Nombre: <strong/>\".$this->nombre.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>Apellido: <strong/>\".$this->apellido.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>Teléfono: <strong/>\".$this->telefono.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>E-mail: <strong/>\".$this->email.\"<br />\" ;\n\t\t$cuerpo .= \"<br />\";\n\t\t$cuerpo .= \"---- DATOD DE REPUESTO ----\";\n\t\t$cuerpo .= \"<br />\";\n\t\t$cuerpo .= \"<strong>Marca: <strong/>\".$this->marca.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>Modelo: <strong/>\".$this->modelo.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>Año: <strong/>\".$this->ano.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>Tipo: <strong/>\".$this->tipo.\"<br />\" ;\n\t\t$cuerpo .= \"<strong>Descripción: <strong/>\".$this->descripcion.\"<br />\" ;\n\t\t$cuerpo .= \"<br />\";\n\t\t$cuerpo .= \"---- END DATA ----\";\n\t\t$cuerpo .= \"<br />\";\n\t\t$subject= \"Solicitud de Repuesto desde www.vehiculosvenezuela.com\";\n\t\t$subject2= \"Solicitud desde www.vehiculosvenezuela.com\";\n\t\t$basemailfor=\"[email protected]\";\n\t\t//$basemailfor=\"[email protected]\";\n\t\t$basemailfrom = $this->email;\n\t\t$respuesta =\"<img width='200' height='100' src='http://www.vehiculosvenezuela.com/imagenes/logon.jpg' /><br /><br />\n\t\t<strong>Reciba un cordial saludo: \".$this->nombre.\" \".$this->apellido.\"<strong/><br /><br />\n\t\tHemos recibido su solicitud con éxito y le damos gracias por contactarnos, en este momento la estamos procesando y obtendrá una respuesta a la brevedad posible.\n\t\t<br><br> \n\t\t Muchas Gracias\n\t\t<br /><br />\n\t\tAtentamente,<br /><br />\n\t\tVehículosVenezuela<br />\n\t\twww.vehiculosvenezuela.com\";\n\t\t$this->mensaje=\"Su solicitud de repuesto ha sido enviado satisfactoriamente!\";\n\t\tif(mail (\"$basemailfor\", \"$subject2\", \"$cuerpo\", \"From: $basemailfrom\\nContent-Type: text/html\" )){\n\t\t mail (\"$basemailfrom\", \"$subject\", \"$respuesta\", \"From: $basemailfor\\nContent-Type: text/html\" );\n\t\t \n\t\t}\n\t}",
"private function respuesta_provincias(){\n\t\t\n\t\t$user = $this->session->userdata('cliente_id');\n\n\t\t//Crear mensaje preguntando\n\n\t\t$data_in = array(\n 'from_id' \t=> 0,\n 'to_id' \t=> $user,\n 'mensaje' => 'Para brindarle más información, por favor indique la ubicación del proyecto en el que está interesado.',\n 'date'\t\t=> applib::fecha()\n );\n\n applib::create(applib::$mensajes_table,$data_in);\n\n\t\t//Crear mensaje de botones\n\n\t\t$mensaje = $this->load->view('frontend/comunes/botones_provincia',null,true);\n\n\t\t$data_in['mensaje'] = $mensaje;\n\t\t$data_in['sin_fondo'] = 1;\n \n applib::create(applib::$mensajes_table,$data_in);\n\n return true;\n\t}",
"function enviar_mail_mov($datos)\r\n{\r\n\tglobal $db,$titulo_pagina;\r\n\t//ver el origen y destino\r\n\t$sql = \"select temp1.nombre as origen, temp1.id_deposito as id_origen,temp2.nombre as destino, temp2.id_deposito as id_destino from movimiento_material join depositos as temp1 on (temp1.id_deposito = deposito_origen) join depositos as temp2 on (temp2.id_deposito = deposito_destino) where id_movimiento_material = \".$datos['Id'];\r\n $result = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail\");\r\n\r\n $origen = $result->fields['origen'];\r\n\t$destino = $result->fields['destino'];\r\n $id_origen = $result->fields['id_origen'];\r\n $id_destino = $result->fields['id_destino'];\r\n\r\n\t//buscar el responsable del deposito origen\r\n\t$sql = \"select usuarios.mail from depositos join responsable_deposito using (id_deposito) join usuarios using (id_usuario) where id_deposito = \".$id_origen;\r\n\t$result = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail\");\r\n\t$responsable_origen = array();\r\n\twhile (!$result->EOF) {\r\n\t\t$responsable_origen[] = $result->fields['mail'];\r\n\t\t$result->MoveNext();\r\n\t}\r\n\r\n\t//buscar el responsable del deposito origen\r\n\t$sql = \"select usuarios.mail from depositos join responsable_deposito using (id_deposito) join usuarios using (id_usuario) where id_deposito = \".$id_destino;\r\n $result = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail\");\r\n\t$responsable_destino = array();\r\n\twhile (!$result->EOF) {\r\n\t\t$responsable_destino[] = $result->fields['mail'];\r\n\t\t$result->MoveNext();\r\n\t}\r\n\r\n\t//tengo que prepara el \"para\" para enviar el mail\r\n\t//el problema es que se pueden repetir los mail\r\n\t//armo un arreglo con los mail\r\n\t$mail_para = array ();\r\n //la variable \"$responsable_origen\" es arreglo por eso hago un merge para que me quede solo un arreglo\r\n $mail_para= array_merge($mail_para,$responsable_origen);\r\n //la variable \"$responsable_destino\" es arreglo por eso hago un merge para que me quede solo un arreglo\r\n $mail_para= array_merge($mail_para,$responsable_destino);\r\n //saco el tamaño del arreglo por que no se como me quedo despues de los merge\r\n $i=sizeof($mail_para);\r\n\t//$para = \"[email protected],\".join(\",\",$responsable_origen).\",\".join(\",\",$responsable_destino);\r\n\tif($origen==\"New Tree\" || $destino==\"New Tree\"){\r\n\t $mail_para[$i]=\"[email protected]\";\r\n\t $i++;\r\n\t $mail_para[$i]=\"[email protected]\";\r\n\t $i++;\r\n\t //$para.=\",[email protected],[email protected]\";\r\n\t}\r\n\t//agregar responsables\r\n\r\n\t$asunto = \"$titulo_pagina Nº: \".$datos['Id'];\r\n\t$contenido = \"$titulo_pagina Nº \".$datos['Id'].\".\\n\";\r\n\t$contenido.= \"Depósito de Origen: \".$origen.\".\\n\";\r\n\t$contenido.= \"Depósito de Destino: \".$destino.\".\\n\";\r\n\t$contenido.= \"Autorizado por \".$datos['Usuario'].\" el día \".fecha($datos[\"Fecha\"]).\".\\n\";\r\n\t$contenido.= \"\\nDetalle del movimiento: \\n\";\r\n\r\n\r\n\t//obtener el detalle del movimiento\r\n\t$sql = \"select cantidad,descripcion from detalle_movimiento where id_movimiento_material = \".$datos['Id'];\r\n $result = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail\");\r\n\r\n $contenido.= \"Cantidad | Descripción \\n\";\r\n $contenido.= \"--------------------------------------------------------------\\n\";\r\n\r\n while (!$result->EOF) {\r\n \t$contenido.=\" \".$result->fields['cantidad'].\" \".$result->fields['descripcion'].\"\\n\";\r\n \t$result->MoveNext();\r\n }\r\n\r\n\t//agrego datos si tiene logistica integrada\r\n\tif ($datos['id_logistica_integrada']!=''){\r\n\t\t//todo lo que sigue es para el para\r\n\r\n\t\t$mail_para[$i]=\"[email protected]\";\r\n\t\t$i++;\r\n\t\t$mail_para[$i]=\"[email protected]\";\r\n\t\t$i++;\r\n\t\t//$para = $para. \" [email protected]\";\r\n\t\t//$para = $para. \", [email protected]\";\r\n\t\t$sql = \"select * from\r\n\t\t\t\t (select (nombre|| ' ' ||apellido) as usuario, mail from sistema.usuarios)as lado_a\r\n\t\t\t\tjoin\r\n\t\t\t\t (select usuario from mov_material.log_movimiento where id_movimiento_material = \".$datos['Id'].\"\r\n\t\t\t\t group by usuario\r\n\t\t\t\t )as lado_b\r\n\t\t\t\tusing (usuario)\";\r\n \t$result_mail = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail (consulta trae mail a partir de log)\");\r\n\r\n \twhile (!$result_mail->EOF){\r\n \t\t//$para = $para. \", \" . $result_mail->fields['mail'];\r\n \t\t$mail_para[$i]=$result_mail->fields['mail'];\r\n \t\t$i++;\r\n \t\t$result_mail->MoveNext();\r\n \t}\r\n\r\n \t//saco el tamaño del arreglo para asegurarme que esta en la posicion correcta para seguir\r\n\t\t$i=sizeof($mail_para);\r\n\r\n \t//si esta asociado a una licitacion\r\n\t\tif ($datos['asociado_a']=='lic') {\r\n\t\t\t$sql = \"select mail as mail_patrocinador, mail_lider from (\r\n\t\t\t\t\tselect mail as mail_lider, patrocinador from\r\n\t\t\t\t\t(\r\n\t\t\t\t\tselect id_licitacion, lider, patrocinador from\r\n\t\t\t\t\t (select id_licitacion from mov_material.movimiento_material where id_movimiento_material = \".$datos['Id'].\") as a\r\n\t\t\t\t\tjoin\r\n\t\t\t\t\t licitaciones.licitacion\r\n\t\t\t\t\tusing (id_licitacion)\r\n\t\t\t\t\t)as b\r\n\t\t\t\t\tleft join sistema.usuarios\r\n\t\t\t\t\ton id_usuario = lider\r\n\t\t\t\t\t)as c\r\n\t\t\t\t\tleft join sistema.usuarios\r\n\t\t\t\t\ton id_usuario = patrocinador\";\r\n\t\t $result_mail = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail (consulta trae mail a partir de log)\");\r\n\t\t if ($result_mail->fields['mail_lider']!=''){\r\n\t\t \t$mail_para[$i]=$result_mail->fields['mail_lider'];\r\n\t\t\t\t$i++;\r\n\t\t \t//$para = $para. \", \".$result_mail->fields['mail_lider'];\r\n\t\t }\r\n\t\t if ($result_mail->fields['mail_patrocinador']!=''){\r\n\t\t \t$mail_para[$i]=$result_mail->fields['mail_patrocinador'];\r\n\t\t\t\t$i++;\r\n\t\t \t//$para = $para. \", \".$result_mail->fields['mail_patrocinador'];\r\n\t\t }\r\n\t\t}\r\n\r\n\t\t//si esta asociado a un caso\r\n\t\tif ($datos['asociado_a']=='caso'){\r\n\t\t\t$mail_para[$i]=\"[email protected]\";\r\n\t\t\t$i++;\r\n\t\t\t$mail_para[$i]=\"[email protected]\";\r\n\t\t\t$i++;\r\n\t\t\t//$para = $para. \", [email protected], [email protected] \";\r\n\t\t}\r\n\r\n\t\t//todo lo que sigue es para el contenido\r\n\t\t$sql = \"select * from mov_material.logistica_integrada where id_logistica_integrada = \". $datos['id_logistica_integrada'];\r\n\t\t$result = $db->Execute($sql) or die($db->ErrorMsg().\"<br>Error Enviando mail (consulta trae mail a partir de log)\");\r\n\t\t$contenido.=\"\\n\\n\\n\";\r\n\t\t$contenido.=\"----------------------- Logistica Integrada -------------------\\n\\n\";\r\n\t\t$contenido.=\"Dirección: \". $result->fields['direccion'] .\"\\n\";\r\n\t\t$contenido.=\"Fecha de envio: \". fecha ($result->fields['fecha_envio_logis']) .\"\\n\";\r\n\t\t$contenido.=\"Contacto: \". $result->fields['contacto'] .\"\\n\";\r\n\t\t$contenido.=\"Telefono: \". $result->fields['telefono'] .\"\\n\";\r\n\t\t$contenido.=\"Código Postal: \". $result->fields['cod_pos'] .\"\\n\\n\";\r\n\t\t$contenido.= \"--------------------------------------------------------------\\n\";\r\n\t}\r\n\t//fin de agrego datos si tiene logistica integrada\r\n\t//print_r ($mail_para);\r\n\t$para=elimina_repetidos($mail_para,0);\r\n\t//no envia el mail a juan manuel lo saco del string, en caso que se encuentre ultimo el mail\r\n\t$para=ereg_replace(\"[email protected]\",\"\",$para);\r\n\t//no envia el mail a juan manuel lo saco del string, en caso que se encuentre distinto del ultimo el mail\r\n\t$para=ereg_replace(\"[email protected],\",\"\",$para);\r\n/*\techo \"<br> los ok: \".$para;\r\n\tdie();*/\r\n\tenviar_mail($para, $asunto, $contenido,'','','',0);\r\n}",
"function redsys_ok($id_reserva,$pagar,$order_id){\n // $orden = $redsys->getParameter(\"DS_MERCHANT_ORDER\");\n // var_dump($id_reserva);\n $id_usuario = $this->session->userdata('id_usuario');\n if($pagar==1){\n\n\n\n\n $datos = array\n (\n 'primer_pago' =>1,\n 'recibo_primer_pago' =>$order_id,\n\n );\n\n\n\n\n $this->load->library(\"email\");\n\n\n$reserva_pago=$this->M_cama->listar_usuarios_pago_web($id_reserva,$id_usuario);\n\n$qry_usu = $this->M_Usuario->obtener_usuario($id_usuario);\n\n$totaldeuda=$reserva_pago->row()->monto_total-$reserva_pago->row()->monto_senal;\n\n $titulo = 'Primer pago realizado';\n $mensaje = \"<div align='center' style='background-color: #f4f4f4; padding-top: 20px; padding-bottom: 20px; border-top: 5px solid #167d78;'>\n <center><img style='padding-bottom: 15px;' src='\".base_url().\"assets/componentes/images/logo_planenjoy.png'></center>\n <div style='background-color: #ffffff;width: 600px; box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.8);padding: 10px 10px 10px;color: black;'><table class='m_5549614554202543165m_5058279827257242077MsoNormalTable' border='0' cellspacing='0' cellpadding='0' width='557' style='width:334.15pt;background:white'><tbody><tr style='height:33.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:33.6pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:28.5pt'><span><b><span style='font-size:26.5pt;font-family:"Arial",sans-serif;color:#4b4b4b'>¡Hola \".$qry_usu->row()->nombre.\"! <u></u><u></u></span></b></span></p></td><td><span></span></td></tr><tr style='height:21.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:21.6pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Hemos recibido correctamente el primer pago del viaje \".$reserva_pago->row()->nombre.\".<u></u><u></u></span></span></p><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Para que tus amigos se unan a tu habitación, tienes que enviarles el siguiente código de reserva:<u></u><u></u></span></span></p><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Código grupo \".$reserva_pago->row()->nombre_grupo.\":\".$reserva_pago->row()->codigo_reserva.\"<u></u><u></u></span></span></p></td><td><span></span></td></tr><tr style='height:10.8pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:10.8pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Aquí tienes tu resumen de viajes:<u></u><u></u></span></span></p><p class='m_5549614554202543165m_5058279827257242077MsoListParagraph' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><span>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Primer pago realizado: \".$reserva_pago->row()->monto_senal.\"€ <u></u><u></u></span></span></p><p class='m_5549614554202543165m_5058279827257242077MsoListParagraph' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><span>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Segundo pago por realizar: \".$totaldeuda.\"€<u></u><u></u></span></span></p><p class='m_5549614554202543165m_5058279827257242077MsoListParagraph' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><span>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Nº de recibo:\".$order_id.\"<u></u><u></u></span></span></p><p class='MsoNormal' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><u></u> <u></u></span></span></p><p class='MsoNormal' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>También puedes consultar todos los detalles de <span> </span>viaje en tu perfil de </span></span><a href='https://www.planenjoy.com/PerfilDetalle' target='_blank' data-saferedirecturl='https://www.google.com/url?hl=es&q=https://www.planenjoy.com/PerfilDetalle&source=gmail&ust=1537440840271000&usg=AFQjCNHHDdaprMx43VIR-VjJEpqMbTqDaw'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif'>Planenjoy.com/<span class='m_5549614554202543165m_5058279827257242077SpellE'>PerfilDetalle</span></span></span><span></span></a><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>.<u></u><u></u></span></span></p></td><td><span></span></td></tr><tr style='height:10.8pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:10.8pt'><span></span></td><td><span></span></td></tr><tr style='height:21.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:21.6pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' align='center' style='margin-bottom:6.0pt;text-align:center;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Un saludo,<br>El equipo de Planenjoy. <u></u><u></u></span></span></p></td><td><span></span></td></tr><tr style='height:21.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:21.6pt'><span></span></td><td><span></span></td></tr></tbody></table></div><p class='MsoNormal'style='margin-bottom:6.0pt;padding-top:20px;line-height:15.0pt'><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#6d6d6d'>¿Te echamos una mano? Puedes escribirnos a </span></span><span></span><a href='mailto:[email protected]' target='_blank'><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif'>[email protected]</span></span><span></span></a><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#6d6d6d'>, mandarnos un WhatsApp con </span></span><span></span><a href='https://api.whatsapp.com/send?phone=34642847567' target='_blank' data-saferedirecturl='https://www.google.com/url?hl=es&q=https://api.whatsapp.com/send?phone%3D34642847567&source=gmail&ust=1537291422373000&usg=AFQjCNEnCtlR2FUHoMsn6ZYpVo1ou1BzZA'><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#00b4e6;text-decoration:none'>este enlace</span></span><span></span></a><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#6d6d6d'>, o llamarnos al teléfono +34 642 84 75.<u></u><u></u></span></span></p></div>\";\n //correo\n $configMail = array(\n 'protocol' => 'smtp',\n 'smtp_host' => 'smtp.mailgun.org',\n 'smtp_port' => 587,\n 'smtp_crypto' => 'tls',\n 'smtp_user' => '[email protected]',\n 'smtp_pass' => 'Correo-2017@',\n 'smtp_timeout' => 7,\n 'mailtype' => 'html',\n 'charset' => 'utf-8',\n 'newline' => \"\\r\\n\"\n );\n\n $message = $mensaje;\n //cargamos la configuración para enviar con smtp\n // $this->email->initialize($configMail)\n // ->from('[email protected]', $titulo)\n // ->to($qry_usu->row()->correo)\n // ->cc(CORREO)\n // ->subject($titulo)\n // ->message($message)\n // ->send();\n\n\n}else{\n \n\n $datos = array\n (\n 'primer_pago' =>1,\n 'segundo_pago' =>1,\n 'fecha_segundo_pago' =>date(\"Y-m-d\"),\n 'recibo_primer_pago' =>$order_id,\n 'recibo_segundo_pago' =>$order_id,\n\n );\n\n\n\n $this->load->library(\"email\");\n\n\n$reserva_pago=$this->M_cama->listar_usuarios_pago_web($id_reserva,$id_usuario);\n\n$qry_usu = $this->M_Usuario->obtener_usuario($id_usuario);\n$totaldeuda=$reserva_pago->row()->monto_total-$reserva_pago->row()->monto_senal;\n\n $titulo = 'Pago completo realizado';\n $mensaje = \"<center><img src='\".base_url().\"assets/componentes/images/logo_planenjoy.png'></center><div align='center' style='background-color: #f4f4f4; padding-top: 20px; padding-bottom: 20px; border-top: 5px solid #167d78;'><div style='background-color: #ffffff;width: 600px; box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.8);padding: 10px 10px 10px;color: black;'><table class='m_5549614554202543165m_5058279827257242077MsoNormalTable' border='0' cellspacing='0' cellpadding='0' width='557' style='width:334.15pt;background:white'><tbody><tr style='height:33.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:33.6pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:28.5pt'><span><b><span style='font-size:26.5pt;font-family:"Arial",sans-serif;color:#4b4b4b'>¡Hola \".$qry_usu->row()->nombre.\"! <u></u><u></u></span></b></span></p></td><td><span></span></td></tr><tr style='height:21.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:21.6pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Hemos recibido correctamente el pago completo del viaje \".$reserva_pago->row()->nombre.\".<u></u><u></u></span></span></p><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Para que tus amigos se unan a tu habitación, tienes que enviarles el siguiente código de reserva:<u></u><u></u></span></span></p><p class='MsoNormal' style='margin-bottom:6.0pt;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Código grupo \".$reserva_pago->row()->nombre_grupo.\":\".$reserva_pago->row()->codigo_reserva.\"<u></u><u></u></span></span></p></td><td><span></span></td></tr><tr style='height:10.8pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:10.8pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Aquí tienes tu resumen de viajes:<u></u><u></u></span></span></p><p class='m_5549614554202543165m_5058279827257242077MsoListParagraph' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><span>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Primer pago realizado: \".$reserva_pago->row()->monto_senal.\"€ <u></u><u></u></span></span></p><p class='m_5549614554202543165m_5058279827257242077MsoListParagraph' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><span>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Segundo pago realizado: \".$totaldeuda.\"€<u></u><u></u></span></span></p><p class='m_5549614554202543165m_5058279827257242077MsoListParagraph' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><span>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><u></u><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Nº de recibo:\".$order_id.\"<u></u><u></u></span></span></p><p class='MsoNormal' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'><u></u> <u></u></span></span></p><p class='MsoNormal' style='margin-bottom:6.0pt;text-align:justify;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>También puedes consultar todos los detalles de <span> </span>viaje en tu perfil de </span></span><a href='https://www.planenjoy.com/PerfilDetalle' target='_blank' data-saferedirecturl='https://www.google.com/url?hl=es&q=https://www.planenjoy.com/PerfilDetalle&source=gmail&ust=1537440840271000&usg=AFQjCNHHDdaprMx43VIR-VjJEpqMbTqDaw'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif'>Planenjoy.com/<span class='m_5549614554202543165m_5058279827257242077SpellE'>PerfilDetalle</span></span></span><span></span></a><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>.<u></u><u></u></span></span></p></td><td><span></span></td></tr><tr style='height:10.8pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:10.8pt'><span></span></td><td><span></span></td></tr><tr style='height:21.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:21.6pt'><span></span></td><td><span></span></td></tr><tr><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm'><p class='MsoNormal' align='center' style='margin-bottom:6.0pt;text-align:center;line-height:18.0pt'><span><span style='font-size:14.0pt;font-family:"Arial",sans-serif;color:#4b4b4b'>Un saludo,<br>El equipo de Planenjoy. <u></u><u></u></span></span></p></td><td><span></span></td></tr><tr style='height:21.6pt'><td width='557' style='width:334.15pt;padding:0cm 0cm 0cm 0cm;height:21.6pt'><span></span></td><td><span></span></td></tr></tbody></table></div><p class='MsoNormal'style='margin-bottom:6.0pt;padding-top:20px;line-height:15.0pt'><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#6d6d6d'>¿Te echamos una mano? Puedes escribirnos a </span></span><span></span><a href='mailto:[email protected]' target='_blank'><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif'>[email protected]</span></span><span></span></a><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#6d6d6d'>, mandarnos un WhatsApp con </span></span><span></span><a href='https://api.whatsapp.com/send?phone=34642847567' target='_blank' data-saferedirecturl='https://www.google.com/url?hl=es&q=https://api.whatsapp.com/send?phone%3D34642847567&source=gmail&ust=1537291422373000&usg=AFQjCNEnCtlR2FUHoMsn6ZYpVo1ou1BzZA'><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#00b4e6;text-decoration:none'>este enlace</span></span><span></span></a><span><span style='font-size:9.0pt;font-family:"Arial",sans-serif;color:#6d6d6d'>, o llamarnos al teléfono +34 642 84 75.<u></u><u></u></span></span></p></div>\";\n //correo\n $configMail = array(\n 'protocol' => 'smtp',\n 'smtp_host' => 'smtp.mailgun.org',\n 'smtp_port' => 587,\n 'smtp_crypto' => 'tls',\n 'smtp_user' => '[email protected]',\n 'smtp_pass' => 'Correo-2017@',\n 'smtp_timeout' => 7,\n 'mailtype' => 'html',\n 'charset' => 'utf-8',\n 'newline' => \"\\r\\n\"\n );\n\n $message = $mensaje;\n //cargamos la configuración para enviar con smtp\n // $this->email->initialize($configMail)\n // ->from('[email protected]', $titulo)\n // ->to($qry_usu->row()->correo)\n // ->cc(CORREO)\n // ->subject($titulo)\n // ->message($message)\n // ->send();\n\n \n}\n\n\n$this->M_cama->actualizar_cama_cambio($id_usuario, $id_reserva, $datos);\n $fecha_actual = date('Y-m-d');\n $terminoss = $this->M_terminos->listar_terminos()->row();\n $num_filas = $this->M_terminos->contar_terminos();\n $this->data['terminos'] = $terminoss;\n //$this->data['modulo'] = BUS;\n $this->data['CI'] =& get_instance(); // nucleo del framework\n $bannerad = $this->M_banner->listar_banner()->result();\n \n $this->data['banner'] = $bannerad;\n $foto_instagramad = $this->M_foto_instagram->listar_foto_instagram()->result();\n $this->data['foto_instagram'] = $foto_instagramad;\n\n $id_usuario = $this->session->userdata('id_usuario');\n\n $qry_contador= $this->M_cama->obtener_contador($id_usuario, $fecha_actual)->row();\n $this->data['horas']= $qry_contador;\n $this->data['modulo'] = ADM;\n $this->load->view('home_web/cabecera', $this->data);\n // $this->load->view('plantilla/left-menu', $this->data);\n $this->load->view('home_web/gracias', $this->data);\n $this->load->view('home_web/pie', $this->data);\n// var_dump($id_usuario.\"aquiseparo\".$id_reserva);\n// $this->data['modulo'] = ADM;\n// $this->data['CI'] =& get_instance(); \n// $this->load->view('home_web/cabecera', $this->data);\n// $this->load->view('home_web/gracias', $this->data);\n// $this->load->view('home_web/pie', $this->data);\n$extras_data = $this->input->post('extra');\n // redirect('PerfilDetalle');\n // var_dump($extras_data);\n }",
"function enviar_contacto(){\n $this->asignar_ingreso();\n $nombre_sede = $this->sede;\n\n $resultado = $this->datoSede($nombre_sede);\n $cuerpo =\"<img src='http://prevaler.diazcreativos.net.ve/imagenes/PREVALER.png' /><br /><br />\n\t\t<u>Datos de Entrada:</u><br />\";\n $cuerpo .=\"<br />\";\n $cuerpo .= \"<strong>Nombre Completo: </strong>\".utf8_decode($this->nombre).\"<br />\" ;\n $cuerpo .= \"<strong>Número de telefono: </strong>\".$this->telefono.\"<br />\" ;\n $cuerpo .= \"<strong>E-mail: </strong>\".$this->email.\"<br />\" ;\n $cuerpo .= \"<strong>Mensaje: </strong>\".$this->comentario.\"<br />\";\n $cuerpo .= \"<br />\";\n $cuerpo .= \"---- Fin ----\";\n $cuerpo .= \"<br />\";\n $subject= \"Contacto Web Prevaler\";\n $subject2= \"Contacto Web Prevaler\";\n $basemailfor=$resultado['email_sede'];\n //$basemailfor=\"[email protected]\";\n $basemailfrom = $this->email;\n $respuesta =\"<img src='http://prevaler.diazcreativos.net.ve/imagenes/PREVALER.png' /><br />\n\t\t<strong>Saludos Sr(a).: $this->nombre $this->apellido</strong><br /><br />\n\t\tNosotros hemos recibido su mensaje, nuestro departamento de atención al cliente le responderá lo más pronto posible<br />\n\t\tGracias por contactar a Prevaler.<br />\n\t\tPrevaler<br /><br />\n\t\tTeléfonos: <br/>\n\t\t\".$resultado['telefono_sede'].\"<br />\n\t\tTwitter: <a href='https://twitter.com/Prevaler_VE'>@Prevaler_VE</a><br />\n\t\tInstagram: <a href='https://www.instagram.com/prevaler_ve/'>@prevaler_ve</a><br />\n\t\t\".$resultado['email_sede'].\"\n\t\t<br /><br />\n\t\tAtentamente,<br />\n\t\tClínica Prevaler.\";\n $this->mensaje=\"<strong>¡Excelente!</strong> Su Mensaje ha sido enviado exitosamente.\";\n\n $mail = new PHPMailer();\n $mail->From = $basemailfrom;\n $mail->FromName = utf8_decode($subject);\n $mail->AddAddress($basemailfor, $this->nombre.\" \".$this->apellido);\n $mail->Subject = utf8_decode($subject);\n $mail->Body = $cuerpo;\n $mail->AltBody = $cuerpo;\n $exito = $mail->Send();\n\n $mail2 = new PHPMailer();\n $mail2->From = $basemailfor;\n $mail2->FromName = utf8_decode($subject2);\n $mail2->AddAddress($basemailfrom, $this->nombre.\" \".$this->apellido);\n $mail2->Subject = utf8_decode($subject2);\n $mail2->Body = $respuesta;\n $mail2->AltBody = $respuesta;\n $exito = $mail2->Send();\n }",
"public function calificacionPendiente($changuita, $usuario, $contraparte) {\n $sql = \"select nombre, mail, aviso_ca from usuarios where id = $usuario and activo = '2'\";\n $res = $this->bd->query($sql);\n $fila = $res->fetch_assoc();\n if ($fila[\"aviso_ca\"] == 1) {\n $mail = $fila[\"mail\"];\n $nombre = $fila[\"nombre\"];\n $sql = \"select nombre, apellido, mail, celular_area, celular from usuarios where id = $contraparte\";\n $res = $this->bd->query($sql);\n $fila = $res->fetch_assoc();\n //$cNombre = $fila[\"nombre\"].\" \".$fila[\"apellido\"];\n $cNombre = $fila[\"nombre\"];\n $cMail = $fila[\"mail\"];\n // $cTel = $fila[\"telefono_area\"].\" \".$fila[\"telefono\"];\n $cCel = $fila[\"celular_area\"] . \" \" . $fila[\"celular\"];\n $sql = \"select usuario, titulo from changuitas where id = $changuita\";\n $res = $this->bd->query($sql);\n $fila = $res->fetch_assoc();\n $titulo = $fila[\"titulo\"];\n $txtContrato = \"fuiste elegido por\";\n if ($usuario == $fila[\"usuario\"])\n $txtContrato = \"elegiste a\";\n $this->mailer->Subject = \"Tenés que calificar a $cNombre por la changuita $titulo\";\n $this->mailer->Body = $this->bodyIni;\n $this->mailer->Body .= \"Estimado/a $nombre:<br/><br/>Ya pasaron varios días desde que $txtContrato $cNombre para realizar la changuita <a href='\" . Sitio . \"/#/changuita|\" . $changuita . \"'><strong>$titulo</strong></a>. Por este motivo, te pedimos que lo/a califiques por su amabilidad, claridad y efectividad en el intercambio. Si la changuita ya fue concretada, podés <a href='\" . Sitio . \"/#/changuita|\" . $changuita . \"'>calificarlo/a ahora</a>. De no haberse concretado el intercambio en el tiempo indicado, podés indicarlo y calificar a tu contraparte para obtener una bonificación de los cargos. En ese caso, la reputación de $cNombre se verá afectada negativamente.<br/>Te recordamos sus datos de contacto:<br/>E-mail: $cMail<br/>\";\n // if(trim($cTel) != \"\")\n // $this->mailer->Body .= \"Tel.: $cTel<br/>\";\n if (trim($cCel) != \"\")\n $this->mailer->Body .= \"Cel.: $cCel<br/>\";\n $this->mailer->Body .= \"<br/>\" . $this->bodyFin;\n $this->mailer->ClearAddresses();\n $this->mailer->AddAddress($mail);\n $this->mailer->Send();\n }\n }",
"public function EnviarMailPruebaPublicada($centroId){\n require_once('notificacion_controller.php');\n $_notificacion = new notificacion;\n $listacorreos = $_notificacion->ListaCorreos_enviar();\n if(empty($listacorreos)){\n $listacorreos = array();\n }\n /*obeneter la plantilla de mail a enviar */\n $_SESSION['centromail'] = $centroId;\n ob_start();\n require '../utilidades/mails/alerta_nuevaprueba_admin.php';\n $html =ob_get_clean(); \n\n /* enviar los correos*/\n foreach($listacorreos as $key=>$value){\n $correo = $value['Correo'];\n $para = $correo;\n $titulo = 'Nueva prueba pendiente - KARDI-ON';\n $mensaje = $html;\n $cabeceras = 'From: [email protected]' . \"\\r\\n\" .\n 'Reply-To: [email protected]' . \"\\r\\n\" .\n 'Content-type:text/html'. \"\\r\\n\" .\n 'X-Mailer: PHP/' . phpversion();\n mail($para, $titulo, $mensaje, $cabeceras); \n }\n return $html;\n\n }",
"public function recibir_notificacion()\n {\n Log::info('PagosController.recibir_notificacion entrada de datos');\n Log::error(\"PagosController.recibir_notificacion\" . print_r(Input::all(), true));\n\n if (Config::get('params.prueba_pago'))\n {\n $id = Input::get('id');\n if (isset($id))\n {\n $response = $this->checkout->recibir_notificacion($id);\n if (isset($response))\n {\n $mensaje = $response;\n }\n else\n {\n $mensaje = \"no se recibio notificacion\";\n }\n Log::info('PagosController@recibir_notificacion_prueba: ' . print_r($mensaje, true) . \"/n\" . \\Carbon\\Carbon::now()->toDateString());\n }\n else\n {\n $mensaje = \"no hubo id\";\n }\n\n\n $data = array(\n 'mensaje' => $mensaje,\n );\n Mail::queue('emails.notificacion_pago_prueba', $data, function($message) {\n $message->to('[email protected]', 'Carlos Juarez')->subject('Notificación de mercado pago');\n });\n echo \"Mensaje enviado\";\n }\n else\n {\n $id = Input::get('id');\n if (isset($id))\n {\n $response = $this->checkout->recibir_notificacion($id);\n if (isset($response))\n {\n\n $external_reference = $response['collection']['external_reference'];\n $status = $response['collection']['status'];\n\n $ids = explode(\"-\", rtrim($external_reference, \"-\"));\n\n foreach ($ids as $id) {\n $pago = Pago::find($id);\n if ($status == \"approved\")\n {\n $pago->pagado = true;\n $pago->status = $status;\n $pago->metodo = \"Mercado Pago\";\n }\n else\n {\n $pago->status = $status;\n }\n $pago->update();\n }\n $email = $pago->cliente->user->email;\n $nombre = $pago->cliente->nombre;\n\n switch ($status) {\n case 'approved':\n Mail::queue('emails.publicacion_contenido_pago', array(), function($message) use ($email, $nombre) {\n $message->to($email, $nombre)->subject('Publicación de contenido en Sphellar');\n });\n echo \"cambios realizados\";\n break;\n default:\n echo \"status diferente a aprobado\";\n break;\n }\n }\n else\n {\n Log::error('PagosController.obtenerIPNMercadoPago No se recibio informacion de pago ID:' . $id);\n echo \"no recibido\";\n }\n }\n else\n {\n echo \"no recibi nada\";\n }\n }\n }",
"function indicadores(){\n\n//echo \"sesioni:\".$_SESSION['fechai'].\"<br>\";\n//echo \"posti:\".$_POST['fechai'].\"<br>\";\n//echo \"fechac:\".$fechac.\"<br>\";\n $fecha=$_POST['fechai'];\n $dia=substr($fecha,0,2);\n $mes=substr($fecha,3,2);\n $ano=substr($fecha,6,4);\n $fechac=$ano.\"-\".$mes.\"-\".$dia;\n $_SESSION['fechai']=$_POST['fechai'];\n//echo \"sesioni:\".$_SESSION['fechai'].\"<br>\";\n//echo \"posti:\".$_POST['fechai'].\"<br>\";\n//echo \"fechac:\".$fechac.\"<br>\";\n $fecha=$_POST['fechat'];\n $dia=substr($fecha,0,2);\n $mes=substr($fecha,3,2);\n $ano=substr($fecha,6,4);\n $fechaf=$ano.\"-\".$mes.\"-\".$dia;\n $_SESSION['fechat']=$_POST['fechat'];\n trabajo();\n// Link a correo\n if(strcmp($_SESSION['nivelautorizado'],'administrador')==0 ||strcmp($_SESSION['nivelautorizado'],'direccion')==0 ){ \n echo \"<a href=\\\"index.php?page=indicadores&file=index&func=correo\\\">\"\n .\"<font color=\\\"blue\\\" size=\\\"1\\\">Correo a ISP</font></a>\";\n }\n}",
"function activacion_cuenta($correo,$propietario,$id){\n\t\t$email = new correo();\n\t\t$url = $email->url_();\n\t\t// print_r($email);\n\n\t\t// mensaje html\n\t\t$html='\n\t\t\t\t<!doctype html>\n\t\t\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n\t\t\t\t\t<head>\n\t\t\t\t\t <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n\t\t\t\t\t <meta name=\"viewport\" content=\"initial-scale=1.0\" />\n\t\t\t\t\t <meta name=\"format-detection\" content=\"telephone=no\" />\n\t\t\t\t\t <title></title>\n\t\t\t\t\t <style type=\"text/css\">\n\t\t\t\t\t body {\n\t\t\t\t\t width: 100%;\n\t\t\t\t\t margin: 0;\n\t\t\t\t\t padding: 0;\n\t\t\t\t\t -webkit-font-smoothing: antialiased;\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t\t @media only screen and (max-width: 600px) {\n\t\t\t\t\t table[class=\"table-row\"] {\n\t\t\t\t\t float: none !important;\n\t\t\t\t\t width: 98% !important;\n\t\t\t\t\t padding-left: 20px !important;\n\t\t\t\t\t padding-right: 20px !important;\n\t\t\t\t\t }\n\t\t\t\t\t table[class=\"table-row-fixed\"] {\n\t\t\t\t\t float: none !important;\n\t\t\t\t\t width: 98% !important;\n\t\t\t\t\t }\n\t\t\t\t\t table[class=\"table-col\"],\n\t\t\t\t\t table[class=\"table-col-border\"] {\n\t\t\t\t\t float: none !important;\n\t\t\t\t\t width: 100% !important;\n\t\t\t\t\t padding-left: 0 !important;\n\t\t\t\t\t padding-right: 0 !important;\n\t\t\t\t\t table-layout: fixed;\n\t\t\t\t\t }\n\t\t\t\t\t td[class=\"table-col-td\"] {\n\t\t\t\t\t width: 100% !important;\n\t\t\t\t\t }\n\t\t\t\t\t table[class=\"table-col-border\"] + table[class=\"table-col-border\"] {\n\t\t\t\t\t padding-top: 12px;\n\t\t\t\t\t margin-top: 12px;\n\t\t\t\t\t border-top: 1px solid #E8E8E8;\n\t\t\t\t\t }\n\t\t\t\t\t table[class=\"table-col\"] + table[class=\"table-col\"] {\n\t\t\t\t\t margin-top: 15px;\n\t\t\t\t\t }\n\t\t\t\t\t td[class=\"table-row-td\"] {\n\t\t\t\t\t padding-left: 0 !important;\n\t\t\t\t\t padding-right: 0 !important;\n\t\t\t\t\t }\n\t\t\t\t\t table[class=\"navbar-row\"],\n\t\t\t\t\t td[class=\"navbar-row-td\"] {\n\t\t\t\t\t width: 100% !important;\n\t\t\t\t\t }\n\t\t\t\t\t img {\n\t\t\t\t\t max-width: 100% !important;\n\t\t\t\t\t display: inline !important;\n\t\t\t\t\t }\n\t\t\t\t\t img[class=\"pull-right\"] {\n\t\t\t\t\t float: right;\n\t\t\t\t\t margin-left: 11px;\n\t\t\t\t\t max-width: 125px !important;\n\t\t\t\t\t padding-bottom: 0 !important;\n\t\t\t\t\t }\n\t\t\t\t\t img[class=\"pull-left\"] {\n\t\t\t\t\t float: left;\n\t\t\t\t\t margin-right: 11px;\n\t\t\t\t\t max-width: 125px !important;\n\t\t\t\t\t padding-bottom: 0 !important;\n\t\t\t\t\t }\n\t\t\t\t\t table[class=\"table-space\"],\n\t\t\t\t\t table[class=\"header-row\"] {\n\t\t\t\t\t float: none !important;\n\t\t\t\t\t width: 98% !important;\n\t\t\t\t\t }\n\t\t\t\t\t td[class=\"header-row-td\"] {\n\t\t\t\t\t width: 100% !important;\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t\t @media only screen and (max-width: 480px) {\n\t\t\t\t\t table[class=\"table-row\"] {\n\t\t\t\t\t padding-left: 16px !important;\n\t\t\t\t\t padding-right: 16px !important;\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t\t @media only screen and (max-width: 320px) {\n\t\t\t\t\t table[class=\"table-row\"] {\n\t\t\t\t\t padding-left: 12px !important;\n\t\t\t\t\t padding-right: 12px !important;\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t\t @media only screen and (max-width: 458px) {\n\t\t\t\t\t td[class=\"table-td-wrap\"] {\n\t\t\t\t\t width: 100% !important;\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t </style>\n\t\t\t\t\t</head>\n\n\t\t\t\t\t<body style=\"font-family: Arial, sans-serif; font-size:13px; color: #444444; min-height: 200px;\" bgcolor=\"#E4E6E9\" leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\n\t\t\t\t\t <table width=\"100%\" height=\"100%\" bgcolor=\"#E4E6E9\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td width=\"100%\" align=\"center\" valign=\"top\" bgcolor=\"#E4E6E9\" style=\"background-color:#E4E6E9; min-height: 200px;\">\n\t\t\t\t\t <table>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-td-wrap\" align=\"center\" width=\"458\">\n\t\t\t\t\t <table class=\"table-space\" height=\"18\" style=\"height: 18px; font-size: 0px; line-height: 0; width: 450px; background-color: #e4e6e9;\" width=\"450\" bgcolor=\"#E4E6E9\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"18\" style=\"height: 18px; width: 450px; background-color: #e4e6e9;\" width=\"450\" bgcolor=\"#E4E6E9\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t <table class=\"table-space\" height=\"8\" style=\"height: 8px; font-size: 0px; line-height: 0; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"8\" style=\"height: 8px; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\n\t\t\t\t\t <table class=\"table-row\" width=\"450\" bgcolor=\"#FFFFFF\" style=\"table-layout: fixed; background-color: #ffffff;\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-row-td\" style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; font-weight: normal; padding-left: 36px; padding-right: 36px;\" valign=\"top\" align=\"left\">\n\t\t\t\t\t <table class=\"table-col\" align=\"left\" width=\"378\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"table-layout: fixed;\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-col-td\" width=\"378\" style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; font-weight: normal; width: 378px;\" valign=\"top\" align=\"left\">\n\t\t\t\t\t <table class=\"header-row\" width=\"378\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"table-layout: fixed;\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"header-row-td\" width=\"378\" style=\"font-family: Arial, sans-serif; font-weight: normal; line-height: 19px; color: #478fca; margin: 0px; font-size: 18px; padding-bottom: 10px; padding-top: 15px;\" valign=\"top\" align=\"left\">Gracias por registrarte!</td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t <div style=\"font-family: Arial, sans-serif; line-height: 20px; color: #444444; font-size: 13px;\">\n\t\t\t\t\t <b style=\"color: #478fca;\">Estimad@ '.$propietario.'</b>\n\t\t\t\t\t <b style=\"color: #777777;\">\n\t\t\t\t\t Estamos muy contentos de que te unas a nosotros Asociación Promoda\n\t\t\t\t\t </b>\n\t\t\t\t\t <br> Por favor confirmar su registro para continuar\n\t\t\t\t\t </div>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\n\t\t\t\t\t <table class=\"table-space\" height=\"12\" style=\"height: 12px; font-size: 0px; line-height: 0; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"12\" style=\"height: 12px; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t <table class=\"table-space\" height=\"12\" style=\"height: 12px; font-size: 0px; line-height: 0; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"12\" style=\"height: 12px; width: 450px; padding-left: 16px; padding-right: 16px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" align=\"center\"> \n\t\t\t\t\t <table bgcolor=\"#E8E8E8\" height=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td bgcolor=\"#E8E8E8\" height=\"1\" width=\"100%\" style=\"height: 1px; font-size:0;\" valign=\"top\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t <table class=\"table-space\" height=\"16\" style=\"height: 16px; font-size: 0px; line-height: 0; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"16\" style=\"height: 16px; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\n\t\t\t\t\t <table class=\"table-row\" width=\"450\" bgcolor=\"#FFFFFF\" style=\"table-layout: fixed; background-color: #ffffff;\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-row-td\" style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; font-weight: normal; padding-left: 36px; padding-right: 36px;\" valign=\"top\" align=\"left\">\n\t\t\t\t\t <table class=\"table-col\" align=\"left\" width=\"378\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"table-layout: fixed;\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-col-td\" width=\"378\" style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; font-weight: normal; width: 378px;\" valign=\"top\" align=\"left\">\n\t\t\t\t\t <div style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; text-align: center;\">\n\t\t\t\t\t <a href=\"http://'.$url.'active_count/'.$id.'\" target=\"_blank\" style=\"text-decoration:none; color:#4285F4\">Confirmar </a>\n\t\t\t\t\t </div>\n\t\t\t\t\t <table class=\"table-space\" height=\"16\" style=\"height: 16px; font-size: 0px; line-height: 0; width: 378px; background-color: #ffffff;\" width=\"378\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"16\" style=\"height: 16px; width: 378px; background-color: #ffffff;\" width=\"378\" bgcolor=\"#FFFFFF\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\n\t\t\t\t\t <table class=\"table-space\" height=\"6\" style=\"height: 6px; font-size: 0px; line-height: 0; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"6\" style=\"height: 6px; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\n\t\t\t\t\t <table class=\"table-row-fixed\" width=\"450\" bgcolor=\"#FFFFFF\" style=\"table-layout: fixed; background-color: #ffffff;\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-row-fixed-td\" style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; font-weight: normal; padding-left: 1px; padding-right: 1px;\" valign=\"top\" align=\"left\">\n\t\t\t\t\t <table class=\"table-col\" align=\"left\" width=\"448\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"table-layout: fixed;\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-col-td\" width=\"448\" style=\"font-family: Arial, sans-serif; line-height: 19px; color: #444444; font-size: 13px; font-weight: normal;\" valign=\"top\" align=\"left\">\n\t\t\t\t\t <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"table-layout: fixed;\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td width=\"100%\" align=\"center\" bgcolor=\"#f5f5f5\" style=\"font-family: Arial, sans-serif; line-height: 24px; color: #bbbbbb; font-size: 13px; font-weight: normal; text-align: center; padding: 9px; border-width: 1px 0px 0px; border-style: solid; border-color: #e3e3e3; background-color: #f5f5f5;\" valign=\"top\">\n\t\t\t\t\t <a href=\"#\" style=\"color: #428bca; text-decoration: none; background-color: transparent;\">promoda © 2016, por david criollo</a>\n\t\t\t\t\t <br>\n\t\t\t\t\t <a href=\"#\" style=\"color: #478fca; text-decoration: none; background-color: transparent;\">twitter</a> .\n\t\t\t\t\t <a href=\"#\" style=\"color: #5b7a91; text-decoration: none; background-color: transparent;\">facebook</a> .\n\t\t\t\t\t <a href=\"#\" style=\"color: #dd5a43; text-decoration: none; background-color: transparent;\">google+</a>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t <table class=\"table-space\" height=\"1\" style=\"height: 1px; font-size: 0px; line-height: 0; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"1\" style=\"height: 1px; width: 450px; background-color: #ffffff;\" width=\"450\" bgcolor=\"#FFFFFF\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t <table class=\"table-space\" height=\"36\" style=\"height: 36px; font-size: 0px; line-height: 0; width: 450px; background-color: #e4e6e9;\" width=\"450\" bgcolor=\"#E4E6E9\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t\t\t <tbody>\n\t\t\t\t\t <tr>\n\t\t\t\t\t <td class=\"table-space-td\" valign=\"middle\" height=\"36\" style=\"height: 36px; width: 450px; background-color: #e4e6e9;\" width=\"450\" bgcolor=\"#E4E6E9\" align=\"left\"> </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </tbody>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </table>\n\t\t\t\t\t </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t </table>\n\t\t\t\t\t</body>\n\t\t\t\t</html>\n\t\t';\n\t\t// Contenido\n\t\t$titulo = utf8_decode('Acivación cuenta');\n\t\t$html=utf8_decode($html);\n\t\t// Mail it\n\t\t$acu=0;\n\t\tif ($email->enviar($correo,$propietario,$titulo,$html)) {\n\t\t\t$acu=1;\n\t\t};\n\t\treturn $acu;\n\t}",
"function enviar_presupuesto(){\n $this->asignar_ingreso3();\n $nombre_sede = $this->sede;\n $resultado = $this->datoSede($nombre_sede);\n $cuerpo =\"<img src='http://prevaler.diazcreativos.net.ve/imagenes/logo_admin.png' /><br /><br />\n\t\t<u>Datos de Entrada:</u><br />\";\n $cuerpo .=\"<br />\";\n $cuerpo .= \"<strong>Nombre: </strong>\".utf8_decode($this->nombre1).\"<br />\" ;\n $cuerpo .= \"<strong>Apellido: </strong>\".$this->apellido1.\"<br />\" ;\n $cuerpo .= \"<strong>RIF/Cédula: </strong>\".$this->cedula1.\"<br />\" ;\n $cuerpo .= \"<strong>Fecha de Nacimiento: </strong>\".$this->fecha1.\"<br />\";\n $cuerpo .= \"<strong>E-mail: </strong>\".$this->email.\"<br />\" ;\n $cuerpo .= \"<strong>Teléfono: </strong>\".$this->telefono.\"<br />\" ;\n $cuerpo .= \"<strong>Domicilio: </strong>\".$this->direccion1.\"<br />\" ;\n $cuerpo .= \"<strong>Empresa: </strong>\".$this->empresa.\"<br />\";\n $cuerpo .= \"<strong>Especialidad Médica: </strong>\".$this->especialidad.\"<br />\";\n $cuerpo .= \"<strong>Médico Elegido: </strong>\".$this->medico.\"<br />\";\n $cuerpo .= \"<strong>Diagnóstico: </strong>\".$this->diagnostico.\"<br />\";\n $cuerpo .= \"<strong>Procedimiento: </strong>\".$this->procedimiento.\"<br /><br />\";\n if ($this->seguro != null) {\n $cuerpo .= \"<strong>Presupuesto Con Póliza de Seguro </strong><br /><br />\";\n $cuerpo .= \"<strong>Titular de la Póliza: </strong>\".utf8_decode($this->nombre_pol).\"<br />\" ;\n $cuerpo .= \"<strong>Cédula del Titular de la Póliza: </strong>\".$this->cedula_pol.\"<br />\" ;\n $cuerpo .= \"<strong>Empresa Aseguradora: </strong>\".$this->seguro.\"<br />\" ;\n }else{\n $cuerpo .= \"<strong>Presupuesto Sin Póliza de Seguro </strong><br /><br />\";\n $cuerpo .= \"<strong>Datos de Facturación </strong><br /><br />\";\n $cuerpo .= \"<strong>Nombre: </strong>\".utf8_decode($this->nombre2).\"<br />\" ;\n $cuerpo .= \"<strong>Apellido: </strong>\".$this->apellido2.\"<br />\" ;\n $cuerpo .= \"<strong>RIF/Cédula: </strong>\".$this->cedula2.\"<br />\" ;\n $cuerpo .= \"<strong>Fecha de Nacimiento: </strong>\".$this->fecha2.\"<br />\";\n $cuerpo .= \"<strong>Dirección: </strong>\".$this->direccion2.\"<br />\" ;\n }\n\n $cuerpo .= \"<br />\";\n $cuerpo .= \"---- Fin ----\";\n $cuerpo .= \"<br />\";\n $subject= \"Solicitud de Presupuesto Web Prevaler\";\n $subject2= \"Solicitud de Presupuesto Web Prevaler\";\n\n switch ($resultado['id_sede']) {\n case '1':\n $correo_envio=\"[email protected]\";\n break;\n case '2':\n $correo_envio=\"[email protected]\";\n break;\n case '3':\n $correo_envio=\"[email protected]\";\n break;\n case '4':\n $correo_envio=\"[email protected]\";\n break;\n case '8':\n $correo_envio=\"[email protected]\";\n break;\n\n default:\n $correo_envio=\"[email protected]\";\n break;\n }\n\n $basemailfor=$resultado['email_sede'];\n //$basemailfor=$correo_envio;\n $basemailfrom = $this->email;\n $respuesta =\"<img src='http://prevaler.diazcreativos.net.ve/imagenes/logo_admin.png' /><br />\n\t\t<strong>Saludos Sr(a).: $this->nombre1 $this->apellido1</strong><br /><br />\n\t\tNosotros hemos recibido su Solicitud de Presupuesto, nuestro departamento de atención al cliente le responderá lo más pronto posible<br />\n\t\tGracias por contactar a Prevaler.<br />\n\t\tPrevaler<br /><br />\n\t\tTeléfonos: <br/>\n\t\t\".$resultado['telefono_sede'].\"<br />\n\t\tTwitter: <a href='https://twitter.com/Prevaler_VE'>@Prevaler_VE</a><br />\n\t\tInstagram: <a href='https://www.instagram.com/prevaler_ve/'>@prevaler_ve</a><br />\n\t\t\".$resultado['email_sede'].\"\n\t\t<br /><br />\n\t\tAtentamente,<br />\n\t\tClínica Prevaler.\";\n $this->mensaje=\"<strong>¡Excelente!</strong> Su Solicitud de Presupuesto ha sido enviado exitosamente.\";\n\n $mail = new PHPMailer();\n $mail->From = $basemailfrom;\n $mail->FromName = utf8_decode($subject);\n $mail->AddAddress($basemailfor, $this->nombre.\" \".$this->apellido);\n $mail->Subject = utf8_decode($subject);\n $mail->Body = $cuerpo;\n $mail->AltBody = $cuerpo;\n $mail->isHTML(true);\n $exito = $mail->Send();\n\n $mail2 = new PHPMailer();\n $mail2->From = $basemailfor;\n $mail2->FromName = utf8_decode($subject2);\n $mail2->AddAddress($basemailfrom, $this->nombre.\" \".$this->apellido);\n $mail2->Subject = utf8_decode($subject2);\n $mail2->Body = $respuesta;\n $mail2->AltBody = $respuesta;\n $mail2->isHTML(true);\n $exito = $mail2->Send();\n }",
"function enviarMensaje($datos = array(), $id_usuario_destinatario) {\n global $textos, $sql, $sesion_usuarioSesion;\n\n $usuario = new Contacto();\n $destino = \"/ajax\".$usuario->urlBase.\"/sendMessage\";\n\n if (empty($datos)) {\n \n $nombre = $sql->obtenerValor(\"lista_usuarios\", \"nombre\", \"id = '\".$id_usuario_destinatario.\"'\"); \n \n $sobre = HTML::contenedor(\"\", \"fondoSobre\", \"fondoSobre\");\n \n $codigo = HTML::campoOculto(\"procesar\", \"true\");\n $codigo .= HTML::parrafo($textos->id(\"CONTACTO\"), \"negrilla margenSuperior\");\n $codigo .= HTML::campoTexto(\"\", 50, 255, $nombre, \"\", \"\", array(\"readOnly\" => \"true\"));\n $codigo .= HTML::campoOculto(\"datos[id_usuario_destinatario]\", $id_usuario_destinatario);\n $codigo .= HTML::parrafo($textos->id(\"TITULO\"), \"negrilla margenSuperior\");\n $codigo .= HTML::campoTexto(\"datos[titulo]\", 50, 255);\n $codigo .= HTML::parrafo($textos->id(\"CONTENIDO\"), \"negrilla margenSuperior\");\n $codigo .= HTML::areaTexto(\"datos[contenido]\", 10, 60, \"\", \"\", \"txtAreaLimitado511\");\n $codigo .= HTML::parrafo($textos->id(\"MAXIMO_TEXTO_511\"), \"maximoTexto\", \"maximoTexto\");\n $codigo .= HTML::parrafo(HTML::boton(\"chequeo\", $textos->id(\"ACEPTAR\"), \"botonOk\", \"botonOk\"), \"margenSuperior\");\n $codigo .= HTML::parrafo($sobre.\"<br>\");\n $codigo .= HTML::parrafo($textos->id(\"REGISTRO_AGREGADO\"), \"textoExitoso\", \"textoExitoso\"); \n $codigo = HTML::forma($destino, $codigo);\n\n $respuesta[\"generar\"] = true;\n $respuesta[\"codigo\"] = $codigo;\n $respuesta[\"destino\"] = \"#cuadroDialogo\";\n $respuesta[\"titulo\"] = HTML::contenedor(HTML::frase(HTML::parrafo($textos->id(\"ENVIAR_MENSAJE\"), \"letraNegra negrilla\"), \"bloqueTitulo-IS\"), \"encabezadoBloque-IS\");\n $respuesta[\"ancho\"] = 430;\n $respuesta[\"alto\"] = 450;\n\n } else {\n $respuesta[\"error\"] = true;\n\n if (empty($datos[\"id_usuario_destinatario\"])) {\n $respuesta[\"mensaje\"] = $textos->id(\"ERROR_FALTA_CONTACTO\");\n\n } elseif (empty($datos[\"titulo\"])) {\n $respuesta[\"mensaje\"] = $textos->id(\"ERROR_FALTA_TITULO\");\n\n } elseif (empty($datos[\"contenido\"])) {\n $respuesta[\"mensaje\"] = $textos->id(\"ERROR_FALTA_CONTENIDO\");\n\n } else {\n \n $datos[\"id_usuario_remitente\"] = $sesion_usuarioSesion->id;\n $datos[\"titulo\"] = strip_tags($datos[\"titulo\"]);\n $datos[\"contenido\"] = strip_tags($datos[\"contenido\"]);\n $datos[\"fecha\"] = date(\"Y-m-d G:i:s\");\n $datos[\"leido\"] = 0;\n\n $mensaje = $sql->insertar(\"mensajes\", $datos);\n\n if ($mensaje) {\n $respuesta[\"error\"] = false;\n $respuesta[\"accion\"] = \"insertar\";\n $respuesta[\"insertarAjax\"] = true;\n\n } else {\n $respuesta[\"mensaje\"] = $textos->id(\"ERROR_DESCONOCIDO\");\n }\n \n }\n }\n\n Servidor::enviarJSON($respuesta);\n}",
"public function enviar_correo($correo_usuario, $proceso)\n {\n $consulta_correo_usuario = $this->ci->db->query(\"SELECT * FROM MA_LOGIN WHERE correo = '$correo_usuario'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n\n //respuesa inicializada en false\n $respuesta = false;\n\n //varaibles vacias que sera rellenadas segun el caso de su uso\n $html = '';\n $asunto = '';\n\n\n //validacion de si existe el correo en la tabla de MA_LOGIN\n if ($respuesta_correo_usuario == null) {\n\n $respuesta = false;\n \n return $respuesta;\n\n }\n\n //consulta para saber el usuario smtp del cliente segun sea elegido\n $consulta_reglas_correo = $this->ci->db->query(\"SELECT * FROM REGLASDENEGOCIO WHERE Campo = 'Correo_Direccion'\");\n $repuesta_reglas_correo = $consulta_reglas_correo->row();\n\n //consulta para saber la clave smtp del cliente segun sea elegido\n $consulta_reglas_pass = $this->ci->db->query(\"SELECT * FROM REGLASDENEGOCIO WHERE Campo = 'Correo_Password'\");\n $repuesta_reglas_pass = $consulta_reglas_pass->row();\n\n //variables para inicio de sesion en SMTP\n $host_user = $repuesta_reglas_correo->Valor;\n $host_pass = $repuesta_reglas_pass->Valor;\n \n \n $config = Array(\n\n 'protocol' => 'smtp',\n 'smtp_host' => 'ssl://smtp.gmail.com',\n 'smtp_port' => '465',\n 'smtp_user' => $host_user,\n 'smtp_pass' => $host_pass,\n 'mailtype' => 'html', \n 'charset' => 'utf-8'\n );\n\n //-------------------------------------\n\n\n //en caso de recuperacion de contraseña desde el perfil del usaurio\n if ($proceso == \"1\") {\n\n $asunto = 'Modificación de Contraseña, Ceresfresh Web';\n\n $html = '<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <title>Ceresfresh Web</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n </head>\n <body>\n <div class=\"container\">\n <div style=\"text-align:center;\">\n <br><br>\n \n <h2>Modificación de contraseña Ceres<span style=\"color:#7cbd41\">Fresh</span></h2>\n \n <p>Se ha detectado que hubo una modificación de su <b>Contraseña</b>, en caso de que sea una modificación no autorizada por favor comuníquese con nuestro personal de Soporte.</p>\n \n </div>\n </div>\n </body>\n </html>';\n \n $this->ci->email->initialize($config);\n $this->ci->email->set_newline(\"\\r\\n\");\n\n $this->ci->email->from('[email protected]', 'Ceresfresh Web');\n $this->ci->email->to($correo_usuario); \n $this->ci->email->subject($asunto);\n $this->ci->email->message($html);\n // Set to, from, message, etc.\n \n\n if ($this->ci->email->send()) {\n\n\n //respuesta para el usuario en caso de que el correo se envie satisfactoriamente\n $respuesta = true; \n \n return $respuesta;\n\n }else{\n\n //respuesta para el usuario en caso de que el correo no se envie de manera satisfactoria\n $respuesta = false; \n \n return $respuesta;\n \n }\n\n }\n\n //-------------------------------------------\n\n\n //en caso de recuperacion de contraseña desde el perfil del usaurio\n if ($proceso == \"2\") {\n\n $asunto = 'Afiliación Exitosa, Ceresfresh Web';\n\n $html = '<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <title>Ceresfresh Web</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n </head>\n <body>\n <div class=\"container\">\n <div style=\"text-align:center;\">\n <br><br>\n \n <h2>Afiliación Exitosa, Ceres<span style=\"color:#7cbd41\">Fresh</span></h2>\n \n <p>El proceso de <b>Afiliación</b> se ha completado de manera Satisfactoria.</p>\n \n </div>\n </div>\n </body>\n </html>';\n \n $this->ci->email->initialize($config);\n $this->ci->email->set_newline(\"\\r\\n\");\n\n $this->ci->email->from('[email protected]', 'Ceresfresh Web');\n $this->ci->email->to($correo_usuario); \n $this->ci->email->subject($asunto);\n $this->ci->email->message($html);\n // Set to, from, message, etc.\n \n\n if ($this->ci->email->send()) {\n\n\n //respuesta para el usuario en caso de que el correo se envie satisfactoriamente\n $respuesta = true; \n \n return $respuesta;\n\n }else{\n\n //respuesta para el usuario en caso de que el correo no se envie de manera satisfactoria\n $respuesta = false; \n \n return $respuesta;\n \n }\n\n }\n }",
"public function pasar_a_pendientes_enviar()\n\t{\n\n $num_registro = $_REQUEST['num_registro'];\n $code = $_REQUEST['code'];\n $estatus = $_REQUEST['estatus'];\n\n $data_pago = array(\n\n 'estatus' => $estatus\n\n );\n\n $respuesta = false;\n\n //actualizacion de estatus segun la opcion que se selecciono\n $this->db->where('codeorden', $code);\n\n if ($this->db->update('PAGO_MA', $data_pago)){\n\n $consulta_correo_usuario = $this->db->query(\"SELECT correo FROM MA_LOGIN WHERE num_registro = '$num_registro'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n \n $correo_usuario = $respuesta_correo_usuario->correo;\n\n //data que se enviara a la taba de notificaciones para actualizar la notificacion del usuario\n $data_notificacion = array(\n\n 'correo' => $correo_usuario,\n 'tipo' => $estatus,\n 'num_registro' => $num_registro\n );\n\n //insercion de la notificaicion en la tabla de notificaicones para e usuario \n $this->db->insert('NOTIFICACIONES', $data_notificacion);\n\n //definicion de datos para llamar al servico de envio de correos electronicos de notificacion\n $this->load->model('admin/Correoservice_model');\n\n $respuesta_correo = $this->Correoservice_model->enviar_correo($correo_usuario, $estatus);\n\n //----------------------------\n\n $respuesta = true;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n \n }else{\n\n $respuesta = false;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n\n }\n \n }",
"public function aprobar_rechazar_pago()\n\t{\n //coreeo del usuario que esta en sesion\n $num_registro = $_REQUEST['num_registro'];\n\n $code = $_REQUEST['code'];\n $estatus = $_REQUEST['estatus'];\n\n $data_pago = array(\n\n 'estatus' => $estatus\n\n );\n\n $respuesta = false;\n\n //actualizacion de estatus segun la opcion que se selecciono\n $this->db->where('codeorden', $code);\n\n if ($this->db->update('PAGO_MA', $data_pago)){\n\n $consulta_correo_usuario = $this->db->query(\"SELECT correo FROM MA_LOGIN WHERE num_registro = '$num_registro'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n \n $correo_usuario = $respuesta_correo_usuario->correo;\n\n\n //data que se enviara a la taba de notificaciones para actualizar la notificacion del usuario\n $data_notificacion = array(\n\n 'correo' => $correo_usuario,\n 'tipo' => $estatus,\n 'num_registro' => $num_registro\n );\n\n //insercion de la notificaicion en la tabla de notificaicones para e usuario \n $this->db->insert('NOTIFICACIONES', $data_notificacion);\n\n //definicion de datos para llamar al servico de envio de correos electronicos de notificacion\n $this->load->model('admin/Correoservice_model');\n\n $respuesta_correo = $this->Correoservice_model->enviar_correo($correo_usuario, $estatus);\n\n if ($respuesta_correo == true) {\n //----------------------------\n\n $respuesta = true;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response); \n }else{\n\n //----------------------------\n\n $respuesta = false;\n\n $response = array(\n \n 'respuesta' => $respuesta\n \n );\n \n echo json_encode($response);\n\n }\n \n }else {\n \n //-----------------------------\n\n $respuesta = false;\n $response = array(\n 'respuesta' => $respuesta\n );\n echo json_encode($response); \n \n }\n \n }",
"function mailConfirmaPersona($datos=null){\t\t\t\n\t\t\t\t$mail = new PHPMailer;\n\t\t\t\t\t$mail->isSMTP();\n\t\t\t\t\t$mail->SMTPDebug = 0;\n\t\t\t\t\t$mail->Debugoutput = 'html';\n\t\t\t\t\t$mail->Host =@$this->config->item('anfitrion');\n\t\t\t\t\t$mail->Port =@$this->config->item('puerto');\n\t\t\t\t\t$mail->Username =@$this->config->item('usuario');\n\t\t\t\t\t$mail->Password =@$this->config->item('clave');\n\t\t\t\t\t$mail->SMTPAuth = true;\n\t\t\t\t\t$mail->SMTPSecure = 'ssl';\n\t\t\t\t\t$mail->setFrom(@$this->config->item('correoSistema'),utf8_decode(@$this->config->item('usuarioSistema')));\n\t\t\t\t\t$mail->addReplyTo(@$this->config->item('correoSistema'),utf8_decode(@$this->config->item('usuarioSistema')));\n\t\t\t\t$mail->addAddress($datos['correoUsuario']);\t\t\t\t\n\t\t\n\t\t\t\t$subject = utf8_decode('Confirmación, ANALISIS');\n\t\t\t\t$pagina=\"<a style='color:#4257F9' href='\".@$this->config->item('enlaceSistema').\"'>\".\"www.madeinbarter.com</a>\".\"<br><br>\";\n\t\t\t\t\t$mensaje = \"<h3> Estimado/a, \n\t\t\t\t\t\t\t\t<br>\".utf8_encode($datos['nombresUsuario']).\"<br><br>\n\t\t\t\t\t\t\t\tSu registro fue exitoso<br> \n\t\t\t\t\t\t\t\t<br>E_mail: \".$datos['correoUsuario'].\"<br>\".\"Puede Ingresar en la siguiente página: \".$pagina;\n\t\t\t\t\t$mail->Subject = $subject;\n\t\t\t\t\t$mail->msgHTML($mensaje);\t\n\t\t\t\t\tif (!$mail->send()) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\t\t\n\t}",
"public function main(){\n $headers = (isset($_GET[\"headers\"]))? $_GET[\"headers\"] : \"per_numero_documento, per_apellidos, per_nombres, per_genero, per_cuil, no_localidad, no_direccion, no_codigo_postal, per_email, per_telefono, no_escuela_fines_partido, no_escuela_fines_localidad, no_escuela_fines_institucion\"; \n require_once(\"class/script/ProcesarInscripcionNacionForm.html\");\n }",
"function SolicitarContrato(){\n $this->procedimiento = 'adq.f_cotizacion_ime';\n $this->transaccion = 'ADQ_SOLCON_IME';\n $this->tipo_procedimiento='IME';\n \n //Define los parametros para la funcion\n $this->setParametro('id_proceso_wf','id_proceso_wf','int4');\n\n //Ejecuta la instruccion\n $this->armarConsulta();\n $this->ejecutarConsulta();\n\n //Devuelve la respuesta\n return $this->respuesta;\n }",
"function reporteCotizacion(){\n\t\t$this->procedimiento='adq.f_cotizacion_sel';\n\t\t$this->transaccion='ADQ_COTREP_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t$this->setCount(false);\n\t\t\n\t\t$this->setParametro('id_cotizacion','id_cotizacion','int4');\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('estado','varchar');\n\t\t$this->captura('fecha_adju','date');\n\t\t$this->captura('fecha_coti','date');\n\t\t$this->captura('fecha_entrega','date');\n\t\t$this->captura('fecha_venc','date');\n\t\t$this->captura('id_moneda','int4');\n\t\t$this->captura('moneda','varchar');\n\t\t$this->captura('id_proceso_compra','int4');\n\t\t$this->captura('codigo_proceso','varchar');\n\t\t$this->captura('num_cotizacion','varchar');\n\t\t$this->captura('num_tramite','varchar');\n\t\t$this->captura('id_proveedor','int4');\n\t\t$this->captura('desc_proveedor','varchar');\n\t\t$this->captura('id_persona','int4');\n\t\t$this->captura('id_institucion','int4');\n\t\t$this->captura('dir_per', 'varchar');\n\t\t$this->captura('tel_per1', 'varchar');\n\t\t$this->captura('tel_per2', 'varchar');\n\t\t$this->captura('cel_per','varchar');\n\t\t$this->captura('correo','varchar');\n\t\t$this->captura('nombre_ins','varchar');\n\t\t$this->captura('cel_ins','varchar');\n\t\t$this->captura('dir_ins','varchar');\n\t\t$this->captura('fax','varchar');\n\t\t$this->captura('email_ins','varchar');\n\t\t$this->captura('tel_ins1','varchar');\n\t\t$this->captura('tel_ins2','varchar');\t\t\n\t\t$this->captura('lugar_entrega','varchar');\n\t\t$this->captura('nro_contrato','varchar');\t\t\n\t\t$this->captura('numero_oc','varchar');\n\t\t$this->captura('obs','text');\n\t\t$this->captura('tipo_entrega','varchar');\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}",
"public function informacionPayu($datos)\n {\n $fecha = Carbon::createFromFormat('Y-m-d H:i:s', Carbon::now());\n\n //$apiKey=\"4Vj8eK4rloUd272L48hsrarnUA\";\n $apiKey=\"NDzo4w71RkoV65mpP4Fj3lI82v\";\n $infoPago = new stdClass();\n //$infoPago->merchantId=\"508029\";\n $infoPago->merchantId=\"708186\";\n $infoPago->accountId=\"711450\";\n //$infoPago->accountId=\"512321\";\n $infoPago->description=\"Cobro Proyecto \".$datos['proyecto']->PRY_Nombre_Proyecto;\n $infoPago->referenceCode=\"Pago\".$datos['factura'].'-'.$fecha->format(\"U\");\n $infoPago->amount=$datos['total']->Costo;\n $infoPago->tax=\"0\";\n $infoPago->taxReturnBase=\"0\";\n $infoPago->currency=\"COP\";\n $infoPago->signature=md5($apiKey.\"~\".$infoPago->merchantId.\"~\".$infoPago->referenceCode.\"~\".$datos['total']->Costo.\"~COP\");\n $infoPago->test=\"0\";\n //$infoPago->test=\"1\";\n $infoPago->buyerFullName=$datos['proyecto']->USR_Nombres_Usuario.\" \".$datos['proyecto']->USR_Apellidos_Usuario;\n $infoPago->buyerEmail=$datos['proyecto']->USR_Correo_Usuario;\n $infoPago->responseUrl=route(\"respuesta_pago_cliente\");\n $infoPago->confirmationUrl=route(\"confirmacion_pago_cliente\");\n\n return $infoPago;\n }",
"public function respuestaPago()\n {\n if($_REQUEST) {\n session([\n 'buyerEmail' => $_REQUEST['buyerEmail'],\n 'merchantId' => $_REQUEST['merchantId'],\n 'referenceCode' => $_REQUEST['referenceCode'],\n 'TX_VALUE' => $_REQUEST['TX_VALUE'],\n 'currency' => $_REQUEST['currency'],\n 'transactionState' => $_REQUEST['transactionState'],\n 'signature' => $_REQUEST['signature'],\n 'reference_pol' => $_REQUEST['reference_pol'],\n 'cus' => $_REQUEST['cus'],\n 'description' => $_REQUEST['description'],\n 'pseBank' => $_REQUEST['pseBank'],\n 'lapPaymentMethod' => $_REQUEST['lapPaymentMethod'],\n 'transactionId' => $_REQUEST['transactionId']\n ]);\n\n return redirect()->route('respuesta_pago_cliente');\n } else if (session('buyerEmail') == null){\n return redirect()->route('inicio_cliente')->withErrors('Error en la transacción');\n } else {\n $correo = session('buyerEmail');\n $fechaPago = Carbon::now();\n $estadoTx = $this->datosRespuesta();\n\n $usuario = Usuarios::where('USR_Correo_Usuario', '=', $correo)->first();\n\n session([\n 'buyerEmail' => null,\n 'merchantId' => null,\n 'referenceCode' => null,\n 'TX_VALUE' => null,\n 'currency' => null,\n 'transactionState' => null,\n 'signature' => null,\n 'reference_pol' => null,\n 'cus' => null,\n 'description' => null,\n 'pseBank' => null,\n 'lapPaymentMethod' => null,\n 'transactionId' => null\n ]);\n\n if ($estadoTx == \"Transacción aprobada\") {\n $actividades = Actividades::obtenerActividadesPendientesPago($usuario->id);\n \n foreach ($actividades as $actividad) {\n Actividades::actualizarEstadoPago($actividad->id, 10, $fechaPago);\n }\n\n return redirect()\n ->route('inicio_cliente')\n ->with('mensaje', 'Pago exitoso.');\n } else if ($estadoTx == \"Transacción rechazada\") {\n return redirect()\n ->route('inicio_cliente')\n ->withErrors('Transacción Rechazada.');\n } else if ($estadoTx == \"Error\") {\n return redirect()\n ->route('inicio_cliente')\n ->withErrors('Error al pagar.');\n } else if ($estadoTx == \"Transacción pendiente\" ) {\n $actividades = Actividades::obtenerActividadesPendientesPago($usuario->id);\n \n foreach ($actividades as $actividad) {\n Actividades::actualizarEstadoPago($actividad->id, 14, $fechaPago);\n }\n\n return redirect()\n ->route('inicio_cliente')\n ->with('mensaje', 'Pago Pendiente.');\n } else {\n return redirect()\n ->route('inicio_cliente')\n ->withErrors('Otro.');\n }\n }\n }",
"public function nueva_correspondencia(Request $request){\r\n $id_usuario_destino = $request->id_usuario_destino;\r\n $id_instruccion = $request->id_instruccion;\r\n $referencia = $request->referencia;\r\n $contenido = $request->contenido;\r\n //$id_documento = $request->id_documento;\r\n $id_documento = 0;\r\n $nro_paginas_agregadas = $request->nro_paginas_agregadas;\r\n $prioridad = $request->prioridad;\r\n $switch_copia = $request->switch_copia; //Si esta en \"on\" es seleccionado\r\n $id_usuarios_copia = $request->id_usuario_copia;\r\n\r\n //Establecemos el campo plazo segun corresponda\r\n if ($request->plazo > 0) {$plazo = $request->plazo;}\r\n else {$plazo = 0;}\r\n\r\n //Tomamos otros campos necesarios para el registro de la derivacion\r\n //Tomamos los datos de la persona logueada\r\n $usuario_logueado = $this->datos_persona_logueada();\r\n foreach ($usuario_logueado as $usuario) {\r\n $id_persona_origen = $usuario->id_persona;\r\n $id_cargo_origen = $usuario->id_cargo;\r\n $id_area_origen = $usuario->id_area;\r\n }\r\n\r\n //Tomamos los datos del destinatario\r\n $id_persona_destino = \\DB::table('users')\r\n ->where('users.id', $id_usuario_destino)\r\n ->where('users.activo', 1)\r\n ->value('users.id_persona');\r\n\r\n $id_cargo_destino = \\DB::table('users')\r\n ->join('servidores_publicos', 'servidores_publicos.id_servidor_publico', '=', 'users.id_servidor_publico')\r\n ->where('users.id', $id_usuario_destino)\r\n ->where('users.activo', 1)\r\n ->value('servidores_publicos.id_cargo');\r\n\r\n //Tomamos la fecha y horactual actual y gestion\r\n $date = new Carbon();\r\n $hoy = Carbon::now();\r\n $fecha_creacion = $hoy->format('Y-m-d H');\r\n $gestion = $hoy->format('Y');\r\n\r\n //Dado que dos personas pudieron haber obtenido el mismo cite por demorar, obtenemos el cite disponible en este momento\r\n $cite = $this->get_cite_comunicacion_interna();\r\n\r\n //Lo utlizamos e incrementamos en 1 el valor del correlativo para comunicaciones internas\r\n //Tomamos el valor actual del correlativo\r\n $correlativo_cite = \\DB::table('chasqui_correlativos')\r\n ->where('id_area', $id_area_origen)\r\n ->where('id_tipo_documento', 1)\r\n ->where('gestion', $gestion)\r\n ->value('correlativo');\r\n\r\n $nuevo_correlativo_disponible = $correlativo_cite+1;\r\n //fabri\r\n \\DB::table('chasqui_correlativos')\r\n ->where('id_area', $id_area_origen)\r\n ->where('id_tipo_documento', 1)\r\n ->where('gestion', $gestion)\r\n ->update(['correlativo' => $nuevo_correlativo_disponible]);\r\n\r\n //Realizamos el registro de la derivacion\r\n \\DB::table('chasqui_derivaciones')->insert([\r\n ['cite' => $cite,\r\n 'id_cargo_origen' => $id_cargo_origen,\r\n 'id_persona_origen' => $id_persona_origen,\r\n 'id_cargo_destino' => $id_cargo_destino,\r\n 'id_persona_destino' => $id_persona_destino,\r\n 'id_instruccion' => $id_instruccion,\r\n 'referencia' => $referencia,\r\n 'contenido' => $contenido,\r\n 'id_documento' => $id_documento,\r\n 'nro_paginas_agregadas' => $nro_paginas_agregadas,\r\n 'prioridad' => $prioridad,\r\n 'plazo' => $plazo,\r\n 'tipo' => 'Original',\r\n 'recibido' => 0,\r\n 'fecha_recibido' => 'NULL',\r\n 'derivado' => 0,\r\n 'fecha_derivado' => 'NULL',\r\n 'gestion' => $gestion,\r\n 'anulado' => 0]\r\n ]);\r\n\r\n //Verficamos si se debe enviar el documento como copia\r\n if ($switch_copia == \"on\") {\r\n\r\n //Agregamos la palabra COPIA a la referencia\r\n $referencia_copia = $referencia.\" - COPIA\";\r\n\r\n //Para cada usuario como copia\r\n for ($i=0;$i<count($id_usuarios_copia);$i++)\r\n {\r\n //Tomamos los datos de las personas a enviar como copia\r\n $id_persona_destino_copia = \\DB::table('users')\r\n ->where('users.id', $id_usuarios_copia[$i])\r\n ->where('users.activo', 1)\r\n ->value('users.id_persona');\r\n\r\n $id_cargo_destino_copia = \\DB::table('users')\r\n ->join('servidores_publicos', 'servidores_publicos.id_servidor_publico', '=', 'users.id_servidor_publico')\r\n ->where('users.id', $id_usuarios_copia[$i])\r\n ->where('users.activo', 1)\r\n ->value('servidores_publicos.id_cargo');\r\n\r\n //Realizamos el registro de las copias, solo si es diferente al destinatario original\r\n if ($id_cargo_destino_copia != $id_usuario_destino && $id_persona_destino_copia != $id_persona_destino) {\r\n \\DB::table('chasqui_derivaciones')->insert([\r\n ['cite' => $cite,\r\n 'id_cargo_origen' => $id_cargo_origen,\r\n 'id_persona_origen' => $id_persona_origen,\r\n 'id_cargo_destino' => $id_cargo_destino_copia,\r\n 'id_persona_destino' => $id_persona_destino_copia,\r\n 'id_instruccion' => $id_instruccion,\r\n 'referencia' => $referencia_copia,\r\n 'contenido' => $contenido,\r\n 'id_documento' => $id_documento,\r\n 'nro_paginas_agregadas' => $nro_paginas_agregadas,\r\n 'prioridad' => $prioridad,\r\n 'plazo' => $plazo,\r\n 'tipo' => 'Copia',\r\n 'recibido' => 0,\r\n 'fecha_recibido' => 'NULL',\r\n 'derivado' => 0,\r\n 'fecha_derivado' => 'NULL',\r\n 'gestion' => $gestion,\r\n 'anulado' => 0]\r\n ]);\r\n }\r\n }\r\n }\r\n\r\n\r\n echo \"<script>window.open('http://www.yahoo.com');</script>\";\r\n\r\n //Tomamos todos los campos para enviar a la vista bandeja de entrada\r\n //Enviamos la variable folder para marcar en azul el folder en el que se encuentra\r\n $folder = \"bandeja_de_entrada\";\r\n //Tomamos la cantidad de correspondencia nueva (sin recepcionar)\r\n $bandeja_nuevos_cantidad = $this->bandeja_nuevos_cantidad();\r\n //Tomamos las derivaciones a mostrar\r\n $derivaciones = $this->derivaciones_recibidas();\r\n //Tomamos el plazo que se tiene para responder cada derivacion\r\n $array_plazo = $this->plazo_restante_derivaciones();\r\n //Establecemos el mensaje de exito a mostrar\r\n $mensaje_exito = \"La correspondencia fue derivada correctamente.\";\r\n\r\n //unset($request);\r\n //$_POST = NULL;\r\n //unset($_POST);\r\n //Devolvemos la vista con los parametros necesarios\r\n\r\n //Establecemos el valor de la variable accion_exitosa, la cual definira el mensaje de exito a mostrar en la funcion msj_exitoso\r\n $accion_exitosa = \"cie\";\r\n //return $this->vista_exitoso();\r\n return redirect('msj_exitoso/'.$accion_exitosa);\r\n\r\n /*return view(\"chasqui.bandeja_de_entrada\")\r\n ->with(\"folder\", $folder)\r\n ->with(\"bandeja_nuevos_cantidad\", $bandeja_nuevos_cantidad)\r\n ->with(\"derivaciones\", $derivaciones)\r\n ->with(\"array_plazo\", $array_plazo)\r\n ->with(\"mensaje_exito\", $mensaje_exito);*/\r\n\r\n\r\n //Si todo salio bien, devolvemos 'ok' (cuando usabamos ajax)\r\n //return 'ok';\r\n }",
"function evt__procesar(){\n $m = $this->dep('datos')->tabla('mesa')->get();\n $p = array_search('junta_electoral', $this->s__perfil);\n if($p !== false){//Ingreso con perfil junta_electoral\n $m['estado'] = 3;//Cambia el estado de la mesa a Confirmado\n }\n else{\n $p = array_search('secretaria', $this->s__perfil);\n if($p !== false){//Ingreso con perfil secretaria\n $m['estado'] = 4;//Cambia el estado de la mesa a Definitivo\n }\n else{\n $p = array_search('autoridad_mesa', $this->s__perfil); \n if($p !== false){//Ingreso con perfil autoridad de mesa\n $m['estado'] = 1;//Cambia el estado de la mesa a Cargado\n }\n }\n }\n $this->dep('datos')->tabla('mesa')->set($m);\n// print_r($m['id_mesa']);\n $this->dep('datos')->tabla('mesa')->sincronizar();\n $this->dep('datos')->tabla('mesa')->resetear();\n \n \n if(isset($this->s__retorno)){//debe retornar a confirmar\n if($this->s__retorno_estado=='')\n $dato = true;\n else\n $dato['f'] = $this->s__retorno_estado;\n toba::vinculador()->navegar_a(\"\",$this->s__retorno,$dato); \n $this->s__retorno = null; \n $this->s__id_mesa = null;\n $this->s__retorno_estado = null;\n }\n }",
"public function pasar_a_enviados()\n\t{\n\n $num_registro = $_REQUEST['num_registro'];\n $code = $_REQUEST['code'];\n $estatus = $_REQUEST['estatus'];\n\n $data_pago = array(\n\n 'estatus' => $estatus\n\n );\n\n $respuesta = false;\n\n //actualizacion de estatus segun la opcion que se selecciono\n $this->db->where('codeorden', $code);\n\n if ($this->db->update('PAGO_MA', $data_pago)){\n\n\n $consulta_correo_usuario = $this->db->query(\"SELECT correo FROM MA_LOGIN WHERE num_registro = '$num_registro'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n \n $correo_usuario = $respuesta_correo_usuario->correo;\n\n //data que se enviara a la taba de notificaciones para actualizar la notificacion del usuario\n $data_notificacion = array(\n\n 'correo' => $correo_usuario,\n 'tipo' => $estatus,\n 'num_registro' => $num_registro\n );\n\n //insercion de la notificaicion en la tabla de notificaicones para e usuario \n $this->db->insert('NOTIFICACIONES', $data_notificacion);\n\n //definicion de datos para llamar al servico de envio de correos electronicos de notificacion\n $this->load->model('admin/Correoservice_model');\n\n $respuesta_correo = $this->Correoservice_model->enviar_correo($correo_usuario, $estatus);\n\n //----------------------------\n\n $respuesta = true;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n \n }else{\n\n $respuesta = false;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n\n }\n \n }",
"function enviarCorreoCliente(){\r\n\t$nombre \t\t = $_POST['nombre'];\r\n\t$body = '<p>Estimado ' . $nombre . ' , </p><p>Hemos recibido su petición, en breve recibirá una respuesta</p> ';\r\n\t$body \t\t\t .=\"<hr><p>FamInsurance SL</p><p>NIF 32XXXXXXXX</p><p>Avenida Páncreas 2017 888D 15000 A Coruña</p>\";\r\n\t$asunto = \"Contacto FamInsurance\";\r\n\t$from = \"email\";\t\r\n\t$to = $_POST['email'];\r\n\t$cabeceras = 'MIME-Version: 1.0' . \"\\r\\n\";\r\n $cabeceras .= 'Content-type: text/html; charset=utf-8' . \"\\r\\n\";\r\n\t$cabeceras .=\"From: FamInsurance SL <$from>\\r\\n\";\r\n\tmail($to, $asunto, $body,$cabeceras);\r\n\techo \"</br></br>Un mensaje automático ha sido enviado a su dirección de correo\";\r\n}",
"public function enviarMailDoc() {\n $obj_con = new cls_Base();\n $obj_var = new cls_Global();\n $objEmpData= new EMPRESA();\n $dataMail = new mailSystem();\n $rep = new REPORTES();\n //$con = $obj_con->conexionVsRAd();\n $objEmp=$objEmpData->buscarDataEmpresa(cls_Global::$emp_id,cls_Global::$est_id,cls_Global::$pemi_id);//recuperar info deL Contribuyente\n $con = $obj_con->conexionIntermedio();\n \n $dataMail->file_to_attachXML=$obj_var->rutaXML.'NC/';//Rutas FACTURAS\n $dataMail->file_to_attachPDF=$obj_var->rutaPDF;//Ructa de Documentos PDF\n try {\n $cabDoc = $this->buscarMailNcRAD($con,$obj_var,$obj_con);//Consulta Documentos para Enviar\n //Se procede a preparar con los correos para enviar.\n for ($i = 0; $i < sizeof($cabDoc); $i++) {\n //Retorna Informacion de Correos\n $rowUser=$obj_var->buscarCedRuc($cabDoc[$i]['CedRuc']);//Verifico si Existe la Cedula o Ruc\n if($rowUser['status'] == 'OK'){\n //Existe el Usuario y su Correo Listo para enviar\n $row=$rowUser['data'];\n $cabDoc[$i]['CorreoPer']=$row['CorreoPer'];\n $cabDoc[$i]['Clave']='';//No genera Clave\n }else{\n //No Existe y se crea uno nuevo\n $rowUser=$obj_var->insertarUsuarioPersona($obj_con,$cabDoc,'MG0031',$i);//Envia la Tabla de Dadtos de Person ERP\n $row=$rowUser['data'];\n $cabDoc[$i]['CorreoPer']=$row['CorreoPer'];\n $cabDoc[$i]['Clave']=$row['Clave'];//Clave Generada\n }\n }\n //Envia l iformacion de Correos que ya se completo\n for ($i = 0; $i < sizeof($cabDoc); $i++) {\n if(strlen($cabDoc[$i]['CorreoPer'])>0){ \n //if(1>0){ \n $mPDF1=$rep->crearBaseReport();\n //Envia Correo \n include('mensaje.php');\n $htmlMail=$mensaje;\n\n $dataMail->Subject='Ha Recibido un(a) Documento Nuevo(a)!!! ';\n $dataMail->fileXML='NOTA DE CREDITO-'.$cabDoc[$i][\"NumDocumento\"].'.xml';\n $dataMail->filePDF='NOTA DE CREDITO-'.$cabDoc[$i][\"NumDocumento\"].'.pdf';\n //CREAR PDF\n $mPDF1->SetTitle($dataMail->filePDF);\n $cabFact = $this->mostrarCabNc($con,$obj_con,$cabDoc[$i][\"Ids\"]);\n $detDoc = $this->mostrarDetNc($con,$obj_con,$cabDoc[$i][\"Ids\"]);\n $impDoc = $this->mostrarNcImp($con,$obj_con,$cabDoc[$i][\"Ids\"]);\n $adiDoc = $this->mostrarNcDataAdicional($con,$obj_con,$cabDoc[$i][\"Ids\"]);\n \n $usuData=array();\n //$usuData=$objEmpData->buscarDatoVendedor($cabFact[0][\"USU_ID\"]);//Correo del Usuario que Autoriza\n include('formatNc/ncPDF.php');\n \n //COMETAR EN CASO DE NO PRESENTAR ESTA INFO\n $mPDF1->SetWatermarkText('ESTA INFORMACIÓN ES UNA PRUEBA');\n $mPDF1->watermark_font= 'DejaVuSansCondensed';\n $mPDF1->watermarkTextAlpha = 0.5;\n $mPDF1->showWatermarkText=($cabDoc[$i][\"Ambiente\"]==1)?TRUE:FALSE; // 1=Pruebas y 2=Produccion\n //****************************************\n \n $mPDF1->WriteHTML($mensajePDF); //hacemos un render partial a una vista preparada, en este caso es la vista docPDF\n $mPDF1->Output($obj_var->rutaPDF.$dataMail->filePDF, 'F');//I en un naverdoad F=ENVIA A UN ARCHVIO\n\n $resulMail=$dataMail->enviarMail($htmlMail,$cabDoc,$obj_var,$usuData,$i);\n if($resulMail[\"status\"]=='OK'){\n $cabDoc[$i]['EstadoEnv']=6;//Correo Envia\n }else{\n $cabDoc[$i]['EstadoEnv']=7;//Correo No enviado\n }\n \n }else{\n //No envia Correo \n //Error COrreo no EXISTE\n $cabDoc[$i]['EstadoEnv']=7;//Correo No enviado\n }\n \n }\n $con->close();\n $obj_var->actualizaEnvioMailRAD($cabDoc,\"NC\");\n //echo \"ERP Actualizado\";\n return true;\n } catch (Exception $e) {\n //$trans->rollback();\n //$con->active = false;\n $con->rollback();\n $con->close();\n throw $e;\n return false;\n } \n }",
"function solicitarAprobacion(){\n $this->procedimiento='adq.f_cotizacion_ime';\n $this->transaccion='ADQ_SOLAPRO_IME';\n $this->tipo_procedimiento='IME';\n \n //Define los parametros para la funcion\n $this->setParametro('id_cotizacion','id_cotizacion','int4');\n \n\n //Ejecuta la instruccion\n $this->armarConsulta();\n $this->ejecutarConsulta();\n\n //Devuelve la respuesta\n return $this->respuesta;\n }",
"function autorizar_PM_MM($id_mov,$comentarios)\r\n{\r\n\tglobal $db,$_ses_user;\r\n\t\r\n\t $db->StartTrans();\r\n\r\n\t $query = \"update movimiento_material set comentarios='$comentarios',estado=2 where id_movimiento_material=$id_mov\";\r\n\t //die($query);\r\n\t sql($query) or fin_pagina();\r\n\t $usuario = $_ses_user['name'];\r\n\t $fecha_hoy = date(\"Y-m-d H:i:s\",mktime());\r\n\t //agregamos el log de creción del reclamo de partes\r\n\t $query=\"insert into log_movimiento(fecha,usuario,tipo,id_movimiento_material)\r\n\t values('$fecha_hoy','$usuario','autorización',$id_mov)\";\r\n\t sql($query) or fin_pagina();\r\n\t $datos_mail['Fecha'] = $fecha_hoy;\r\n\t $datos_mail['Usuario'] = $usuario;\r\n\t $datos_mail['Id'] = $id_mov;\r\n\t //variables que utilizo para el mail cuando tiene logistica integrada\r\n\t $datos_mail['id_logistica_integrada'] = $_POST['id_logistica_integrada'];\r\n\t $datos_mail['asociado_a'] = $_POST['asociado_a'];\r\n\t //fin de variables que utilizo cuando hay logistica integrada\r\n\t //enviar_mail_mov($datos_mail);\r\n\r\n\t $db->CompleteTrans();\r\n\r\n\t return \"<b>El $titulo_pagina Nº $id_mov, se autorizó con éxito.</b>\";\r\n\r\n}",
"public function recuperar()\r\n\t{\r\n\t\tView::template('default');\r\n\t\tif(Input::hasPost('correo')){\r\n\t\t\t//Si detecta el envio del formulario\r\n\t\t\t$correo = Input::post('correo');\r\n\t\t\t$resultado = (New Proveedor)->enviar($correo);\r\n\t\t\tif($resultado){\r\n\t\t\t\t//Si envio el codigo al correo es exitoso\r\n\t\t\t\tInput::delete();\r\n\t\t\t\tFlash::valid('Se le ha enviado un correo con las instrucciones');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tFlash::error('No se ha podido enviar el correo');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}",
"function mailConfirmaAnula($datos=null){\t\t\t\n\t\t\t\t$mail = new PHPMailer;\n\t\t\t\t\t$mail->isSMTP();\n\t\t\t\t\t$mail->SMTPDebug = 0;\n\t\t\t\t\t$mail->Debugoutput = 'html';\n\t\t\t\t\t$mail->Host =@$this->config->item('anfitrion');\n\t\t\t\t\t$mail->Port =@$this->config->item('puerto');\n\t\t\t\t\t$mail->Username =@$this->config->item('usuario');\n\t\t\t\t\t$mail->Password =@$this->config->item('clave');\n\t\t\t\t\t$mail->SMTPAuth = true;\n\t\t\t\t\t$mail->SMTPSecure = 'ssl';\n\t\t\t\t\t$mail->setFrom(@$this->config->item('correoSistema'),utf8_decode(@$this->config->item('usuarioSistema')));\n\t\t\t\t\t$mail->addReplyTo(@$this->config->item('correoSistema'),utf8_decode(@$this->config->item('usuarioSistema')));\n\t\t\t\t$mail->addAddress($datos['correoUsuario']);\t\t\t\t\n\t\t\n\t\t\t\t$subject = utf8_decode('Correo Anulación, ANALISIS');\n\t\t\t\t$pagina=\"<a style='color:#4257F9' href='\".@$this->config->item('enlaceSistema').\"'>\".\"www.madeinbarter.com</a>\".\"<br><br>\";\n\t\t\t\t\t$mensaje = \"<h3> Estimado/a, \n\t\t\t\t\t\t\t\t<br>\".utf8_encode($datos['nombresUsuario']).\"<br><br>\n\t\t\t\t\t\t\t\tLamentamos su decisión, estaremos prestos para otra ocasión<br>\n\t\t\t\t\t\t\t\tSi usted no realizo esta acción o desea regresar, favor cominiquese con soporte\".\"<br>\".\"Puede Ingresar en la siguiente página: \".$pagina;\n\t\t\t\t\t$mail->Subject = $subject;\n\t\t\t\t\t$mail->msgHTML($mensaje);\t\n\t\t\t\t\tif (!$mail->send()) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\t\t\n\t}"
]
| [
"0.66869116",
"0.6412237",
"0.63481665",
"0.63071597",
"0.628107",
"0.6279465",
"0.6275663",
"0.6240663",
"0.6166344",
"0.61526144",
"0.61481565",
"0.61049604",
"0.6039333",
"0.60338235",
"0.5987538",
"0.5975611",
"0.5973511",
"0.59701735",
"0.5966232",
"0.5963422",
"0.5942947",
"0.5931852",
"0.5910145",
"0.59035385",
"0.59018964",
"0.5875201",
"0.58740574",
"0.5867428",
"0.58548695",
"0.58453494"
]
| 0.66501373 | 1 |
/ Recibe notificaciones desde mercado pago Realiza el cambio de status y activa los servicios | public function recibir_notificacion()
{
Log::info('PagosController.recibir_notificacion entrada de datos');
Log::error("PagosController.recibir_notificacion" . print_r(Input::all(), true));
if (Config::get('params.prueba_pago'))
{
$id = Input::get('id');
if (isset($id))
{
$response = $this->checkout->recibir_notificacion($id);
if (isset($response))
{
$mensaje = $response;
}
else
{
$mensaje = "no se recibio notificacion";
}
Log::info('PagosController@recibir_notificacion_prueba: ' . print_r($mensaje, true) . "/n" . \Carbon\Carbon::now()->toDateString());
}
else
{
$mensaje = "no hubo id";
}
$data = array(
'mensaje' => $mensaje,
);
Mail::queue('emails.notificacion_pago_prueba', $data, function($message) {
$message->to('[email protected]', 'Carlos Juarez')->subject('Notificación de mercado pago');
});
echo "Mensaje enviado";
}
else
{
$id = Input::get('id');
if (isset($id))
{
$response = $this->checkout->recibir_notificacion($id);
if (isset($response))
{
$external_reference = $response['collection']['external_reference'];
$status = $response['collection']['status'];
$ids = explode("-", rtrim($external_reference, "-"));
foreach ($ids as $id) {
$pago = Pago::find($id);
if ($status == "approved")
{
$pago->pagado = true;
$pago->status = $status;
$pago->metodo = "Mercado Pago";
}
else
{
$pago->status = $status;
}
$pago->update();
}
$email = $pago->cliente->user->email;
$nombre = $pago->cliente->nombre;
switch ($status) {
case 'approved':
Mail::queue('emails.publicacion_contenido_pago', array(), function($message) use ($email, $nombre) {
$message->to($email, $nombre)->subject('Publicación de contenido en Sphellar');
});
echo "cambios realizados";
break;
default:
echo "status diferente a aprobado";
break;
}
}
else
{
Log::error('PagosController.obtenerIPNMercadoPago No se recibio informacion de pago ID:' . $id);
echo "no recibido";
}
}
else
{
echo "no recibi nada";
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function recibir_notificacion_prueba()\n {\n Log::info('PagosController.recibir_notificacion_prueba entrada de datos');\n\n if (Request::isMethod('POST'))\n {\n //Recibimos el status por correo y lo ponemos en la url para que crear el pago\n $exref = Input::get('exref');\n $status = Input::get('status');\n\n $response = array(\"external_reference\" => $exref, \"status\" => $status);\n if (isset($response))\n {\n\n $external_reference = $response['external_reference'];\n $status = $response['status'];\n\n $ids = explode(\"-\", rtrim($external_reference, \"-\"));\n\n foreach ($ids as $id) {\n $pago = Pago::find($id);\n if ($status == \"approved\")\n {\n $pago->pagado = true;\n $pago->status = $status;\n $pago->metodo = \"Mercado Pago\";\n }\n else\n {\n $pago->status = $status;\n }\n $pago->update();\n }\n $email = $pago->cliente->user->email;\n $nombre = $pago->cliente->nombre;\n\n switch ($status) {\n case 'approved':\n Mail::queue('emails.publicacion_contenido_pago', array(), function($message) use ($email, $nombre) {\n $message->to($email, $nombre)->subject('Publicación de contenido en Sphellar');\n });\n echo \"cambios realizados\";\n break;\n case \"cenceled\":\n Mail::queue('emails.pago_cancelado', array(), function($message) use ($email, $nombre) {\n $message->to($email, $nombre)->subject('Pago cancelado');\n });\n break;\n default:\n\n echo \"status diferente a aprobado\";\n break;\n }\n }\n else\n {\n Log::error('PagosController.obtenerIPNMercadoPago No se recibio informacion de pago ID:' . $id);\n echo \"no recibido\";\n }\n }\n else\n {\n\n return View::make('pagos.index');\n }\n }",
"public function getapidetailsAction() {\n\t\t$this->loadLayout();\n\t\t$this->getLayout()->getBlock('logicbrokernotification')->setConfigValue(array(\n\t\t\t\t\t\t'scope' => 'default',\n\t\t\t\t\t\t'scope_id' => '0',\n\t\t\t\t\t\t'path' => 'logicbroker_integration/integration/notificationstatus',\n\t\t\t\t\t\t'value' => '0',\n\t\t\t\t));\n\t\tMage::app()->getCacheInstance()->cleanType('config');\t\t\n\t\tMage::getSingleton('adminhtml/session')->setNotification(false);\n\t\t$this->_redirectReferer();\n\t}",
"function printNewRequests() {\r\n $criteria = array('status' => Appeal::$STATUS_NEW);\r\n return printAppealList($criteria);\r\n}",
"function evt__procesar(){\n $m = $this->dep('datos')->tabla('mesa')->get();\n $p = array_search('junta_electoral', $this->s__perfil);\n if($p !== false){//Ingreso con perfil junta_electoral\n $m['estado'] = 3;//Cambia el estado de la mesa a Confirmado\n }\n else{\n $p = array_search('secretaria', $this->s__perfil);\n if($p !== false){//Ingreso con perfil secretaria\n $m['estado'] = 4;//Cambia el estado de la mesa a Definitivo\n }\n else{\n $p = array_search('autoridad_mesa', $this->s__perfil); \n if($p !== false){//Ingreso con perfil autoridad de mesa\n $m['estado'] = 1;//Cambia el estado de la mesa a Cargado\n }\n }\n }\n $this->dep('datos')->tabla('mesa')->set($m);\n// print_r($m['id_mesa']);\n $this->dep('datos')->tabla('mesa')->sincronizar();\n $this->dep('datos')->tabla('mesa')->resetear();\n \n \n if(isset($this->s__retorno)){//debe retornar a confirmar\n if($this->s__retorno_estado=='')\n $dato = true;\n else\n $dato['f'] = $this->s__retorno_estado;\n toba::vinculador()->navegar_a(\"\",$this->s__retorno,$dato); \n $this->s__retorno = null; \n $this->s__id_mesa = null;\n $this->s__retorno_estado = null;\n }\n }",
"public function contarInventario(){\n\t}",
"public function changestatusAction()\n {\n $user_params=$this->_request->getParams();\n $automail=new Ep_Message_AutoEmails();\n $ftvrequest_obj = new Ep_Ftv_FtvRequests();\n $ftvcontacts_obj = new Ep_Ftv_FtvContacts();\n $ftvpausetime_obj = new Ep_Ftv_FtvPauseTime();\n\n if($user_params['status'] == 'closed')\n $data = array(\"status\"=>$user_params['status'], \"cancelled_at\"=>date('Y-m-d H:i:s'));////////updating\n elseif($user_params['status'] == 'done')\n $data = array(\"status\"=>$user_params['status'], \"closed_at\"=>date('Y-m-d H:i:s'));////////updating\n else\n $data = array(\"status\"=>$user_params['status'], \"closed_at\"=>NULL, \"cancelled_at\"=>NULL);////////updating\n $query = \"identifier= '\".$user_params['requestId'].\"'\";\n $requestdetails = $ftvrequest_obj->requestDetailsById($user_params['requestId']);\n $contactId = $requestdetails[0]['request_by'];\n $contactdetails = $ftvcontacts_obj->getFtvContactDetails($contactId);\n $contactName = $contactdetails[0]['first_name'].\" \".$contactdetails[0]['last_name'];\n $parameters['ftvobject'] = $requestdetails[0]['request_object'];\n $parameters['ftvcontactName'] = $contactName;\n $ftvrequest_obj->updateFtvRequests($data,$query);\n ////making the time resume if its in pause////\n $inpause = $ftvpausetime_obj->inPause($user_params['requestId']);\n if($inpause == 'yes')\n {\n $data = array(\"resume_at\"=>date('Y-m-d H:i:s'));////////updating\n $query = \"ftvrequest_id = '\".$user_params['requestId'].\"' AND resume_at IS NULL \";\n $ftvpausetime_obj->updateFtvPauseTime($data,$query);\n }\n if($user_params['status'] == 'done')\n {\n if($this->adminLogin->userId != '110823103540627' ) ///when not johny head of BO user for FTV changed\n {\n $parameters['ftvrequestlink'] = \"/ftvchaine/ftvch-requests?submenuId=ML11-SL6\";\n $parameters['ftvType'] = \"chaine\";\n $automail->messageToEPMail('110823103540627',114,$parameters);// to johny\n $parameters['ftvrequestlink'] = \"http://ep-test.edit-place.com/ftvchaine/index\";\n $automail->sendFtvChaineContactsPersonalEmail($contactId,114,$parameters); // to client contact\n }\n else // in case jhony change the status\n {\n $parameters['ftvrequestlink'] = \"http://ep-test.edit-place.com/ftvchaine/index\";\n $automail->sendFtvChaineContactsPersonalEmail($contactId,114,$parameters); // to client contact\n }\n }\n\n }",
"function ciniki_sapos_hooks_invoiceStatus($ciniki, $tnid, $args) {\n\n //\n // Load intl settings\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'tenants', 'private', 'intlSettings');\n $rc = ciniki_tenants_intlSettings($ciniki, $tnid);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $intl_timezone = $rc['settings']['intl-default-timezone'];\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'dateFormat');\n $date_format = ciniki_users_dateFormat($ciniki, 'php');\n\n //\n // Load the status maps for the text description of each status\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'sapos', 'private', 'maps');\n $rc = ciniki_sapos_maps($ciniki);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $maps = $rc['maps'];\n\n if( isset($args['invoice_ids']) && is_array($args['invoice_ids']) && count($args['invoice_ids']) > 0 ) {\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuoteIDs');\n $rsp = array('stat'=>'ok');\n $strsql = \"SELECT ciniki_sapos_invoices.id, \"\n . \"ciniki_sapos_invoices.customer_id, \"\n . \"ciniki_sapos_invoices.invoice_number, \"\n . \"ciniki_sapos_invoices.invoice_date, \"\n . \"ciniki_sapos_invoices.status, \"\n . \"CONCAT_WS('.', ciniki_sapos_invoices.invoice_type, ciniki_sapos_invoices.status) AS status_text, \"\n . \"ciniki_sapos_invoices.total_amount \"\n . \"FROM ciniki_sapos_invoices \"\n . \"WHERE ciniki_sapos_invoices.tnid = '\" . ciniki_core_dbQuote($ciniki, $tnid) . \"' \"\n . \"AND ciniki_sapos_invoices.id IN (\" . ciniki_core_dbQuoteIDs($ciniki, $args['invoice_ids']) . \") \"\n . \"\";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryIDTree');\n $rc = ciniki_core_dbHashQueryIDTree($ciniki, $strsql, 'ciniki.sapos', array(\n array('container'=>'invoices', 'fname'=>'id', \n 'fields'=>array('id', 'customer_id', 'invoice_number', 'invoice_date', 'status', 'status_text', 'total_amount'),\n 'maps'=>array('status_text'=>$maps['invoice']['typestatus']),\n 'utctotz'=>array('invoice_date'=>array('timezone'=>$intl_timezone, 'format'=>$date_format))), \n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( !isset($rc['invoices']) ) {\n $rsp['invoices'] = array();\n } else {\n $rsp['invoices'] = $rc['invoices'];\n }\n return $rsp;\n }\n\n if( isset($args['invoice_id']) && $args['invoice_id'] > 0 ) {\n $strsql = \"SELECT ciniki_sapos_invoices.id, \"\n . \"ciniki_sapos_invoices.customer_id, \"\n . \"ciniki_sapos_invoices.invoice_number, \"\n . \"ciniki_sapos_invoices.invoice_date, \"\n . \"ciniki_sapos_invoices.status, \"\n . \"ciniki_sapos_invoices.payment_status, \"\n . \"CONCAT_WS('.', ciniki_sapos_invoices.invoice_type, ciniki_sapos_invoices.status) AS status_text, \"\n . \"ciniki_sapos_invoices.total_amount \"\n . \"FROM ciniki_sapos_invoices \"\n . \"WHERE ciniki_sapos_invoices.tnid = '\" . ciniki_core_dbQuote($ciniki, $tnid) . \"' \"\n . \"AND ciniki_sapos_invoices.id = '\" . ciniki_core_dbQuote($ciniki, $args['invoice_id']) . \"' \"\n . \"\";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryIDTree');\n $rc = ciniki_core_dbHashQueryIDTree($ciniki, $strsql, 'ciniki.sapos', array(\n array('container'=>'invoices', 'fname'=>'id', \n 'fields'=>array('id', 'customer_id', 'invoice_number', 'invoice_date', 'status', 'status_text', 'total_amount'),\n 'maps'=>array('status_text'=>$maps['invoice']['typestatus']),\n 'utctotz'=>array('invoice_date'=>array('timezone'=>$intl_timezone, 'format'=>$date_format))), \n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( !isset($rc['invoices']) || count($rc['invoices']) == 0 ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.sapos.390', 'msg'=>'No invoice found'));\n }\n $invoice = $rc['invoices'][$args['invoice_id']];\n return array('stat'=>'ok', 'invoice'=>$invoice);\n }\n\n return array('stat'=>'ok');\n}",
"function updatestatus() {\n global $_lib;\n\n $dataH = array();\n $dataH['ID'] = $this->transaction->ID;\n $dataH['RemittanceSequence'] = $this->transaction->RemittanceSequence;\n $dataH['RemittanceDaySequence'] = $this->transaction->RemittanceDaySequence;\n $dataH['RemittanceSendtDateTime'] = $_lib['sess']->get_session('Datetime');\n $dataH['RemittanceSendtPersonID'] = $_lib['sess']->get_person('PersonID');\n $dataH['RemittanceStatus'] = 'sent';\n \n #Disse m fjernes nr vi har en godkjenningsprosess\n $dataH['RemittanceApprovedDateTime'] = $_lib['sess']->get_session('Datetime');\n $dataH['RemittanceApprovedPersonID'] = $_lib['sess']->get_person('PersonID');\n\n $_lib['storage']->store_record(array('data' => $dataH, 'table' => 'invoicein', 'debug' => false));\n }",
"public function aprobar_rechazar_pago()\n\t{\n //coreeo del usuario que esta en sesion\n $num_registro = $_REQUEST['num_registro'];\n\n $code = $_REQUEST['code'];\n $estatus = $_REQUEST['estatus'];\n\n $data_pago = array(\n\n 'estatus' => $estatus\n\n );\n\n $respuesta = false;\n\n //actualizacion de estatus segun la opcion que se selecciono\n $this->db->where('codeorden', $code);\n\n if ($this->db->update('PAGO_MA', $data_pago)){\n\n $consulta_correo_usuario = $this->db->query(\"SELECT correo FROM MA_LOGIN WHERE num_registro = '$num_registro'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n \n $correo_usuario = $respuesta_correo_usuario->correo;\n\n\n //data que se enviara a la taba de notificaciones para actualizar la notificacion del usuario\n $data_notificacion = array(\n\n 'correo' => $correo_usuario,\n 'tipo' => $estatus,\n 'num_registro' => $num_registro\n );\n\n //insercion de la notificaicion en la tabla de notificaicones para e usuario \n $this->db->insert('NOTIFICACIONES', $data_notificacion);\n\n //definicion de datos para llamar al servico de envio de correos electronicos de notificacion\n $this->load->model('admin/Correoservice_model');\n\n $respuesta_correo = $this->Correoservice_model->enviar_correo($correo_usuario, $estatus);\n\n if ($respuesta_correo == true) {\n //----------------------------\n\n $respuesta = true;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response); \n }else{\n\n //----------------------------\n\n $respuesta = false;\n\n $response = array(\n \n 'respuesta' => $respuesta\n \n );\n \n echo json_encode($response);\n\n }\n \n }else {\n \n //-----------------------------\n\n $respuesta = false;\n $response = array(\n 'respuesta' => $respuesta\n );\n echo json_encode($response); \n \n }\n \n }",
"public function booking_notifications() {\n $data = $this->class->get_all_active_classes();// model for data. \n log_message(\"debug\", \"Found active classes: \".count($data)); \n foreach ($data as $class) { \n log_message(\"debug\", \"Processing class ID: \" . $class->class_id);\n $current_date = date('Y-m-d');\n $freq1_date = NULL;\n $freq2_date = NULL;\n $freq3_date = NULL;\n $managers = NULL;\n if($class->min_reqd_noti_freq1 != 0) {\n $freq1_date = date ( 'Y-m-d', strtotime ( \"-$class->min_reqd_noti_freq1 day\" . $class->class_start_date) );\n } \n if($class->min_reqd_noti_freq2 != 0) {\n $freq2_date = date ( 'Y-m-d', strtotime ( \"-$class->min_reqd_noti_freq2 day\" . $class->class_start_date) );\n }\n if($class->min_reqd_noti_freq3 != 0) {\n $freq3_date = date ( 'Y-m-d', strtotime ( \"-$class->min_reqd_noti_freq3 day\" . $class->class_start_date) );\n }\n if(strtotime($freq1_date) == strtotime($current_date)) {\n $managers = $this->class->get_manager_details($class->crse_manager);\n } else if(strtotime($freq2_date) == strtotime($current_date)) {\n $managers = $this->class->get_manager_details($class->crse_manager);\n } else if(strtotime($freq3_date) == strtotime($current_date)) {\n $managers = $this->class->get_manager_details($class->crse_manager);\n }\n if (!empty($managers)) { \n foreach ($managers as $user) {\n $total_enrol_count = 0;\n $subject = NULL;\n $noti_msg_txt = NULL;\n log_message('debug', ' Sending notification to ' . $user->registered_email_id);\n if (!empty($user->registered_email_id)) {\n $total_enrol_count = $this->class->class_enrol_count($class->course_id, $class->class_id); \n $subject = \"Class booking notifications for '\".$class->class_name.\"'\";\n $noti_msg_txt = \"Dear \".$user->first_name.\" \".$user->last_name.\", <br/><br/>\"\n . \"Total seats booked in the class '\".$class->class_name.\"' as on '\".date('d-m-Y').\"' is: <b>'\".$total_enrol_count.\"'</b>\"; \n $send_result = $this->sendBookingEmail($user->registered_email_id, $noti_msg_txt, $subject);\n if (!$send_result) {\n log_message('error', ' ERROR sending notification to ' . $user->registered_email_id);\n $last_error = $this->email->print_debugger();\n log_message('error', $last_error); \n }\n } else {\n $error = ' User [ID:' . $user->user_id . '] email is empty.';\n log_message('error', $error); \n }\n }\n }\n } \n echo \"OK\";\n }",
"public function index()\n {\n $user_id = Auth::id();\n $notifs = Notification::where('user_id', $user_id)->orWhere('receiving_id', $user_id)->get();\n foreach ($notifs as $request) {\n if ($request->receiving_id === Auth::id()) {\n $request['received'] = true;\n $profile = Profile::where('user_id', $request->user_id)->first();\n if ($profile === null) {\n $profile = ['ign'=>\"User hasn't completed their profile.\", 'friendCode' => '0'];\n }\n } else {\n $request['received'] = false;\n $profile = Profile::where('user_id', $request->receiving_id)->first();\n }\n $request['profile'] = $profile;\n }\n return $notifs;\n }",
"function statusMessagesOn()\n\t{\n\t\t$this->bStatusMessages = true;\n\t}",
"function jx_mark_delivered_status_for_courier_traspost()\r\n\t{\r\n\t\t$user=$this->erpm->auth();\r\n\t\t\r\n\t\tif(!$_POST)\r\n\t\t\tdie();\r\n\t\t\r\n\t\t$send_log_id=$this->input->post('send_log_id');\r\n\t\t$invoices_list=$this->input->post('delivered');\r\n\t\t$received_by=$this->input->post('received_by');\r\n\t\t$received_on=$this->input->post('received_on');\r\n\t\t$contact_no=$this->input->post('contact_no');\r\n\t\t\r\n\t\tif($invoices_list)\r\n\t\t{\r\n\t\t\tforeach($invoices_list as $i=>$incoice)\r\n\t\t\t{\r\n\t\t\t\t$param=array();\r\n\t\t\t\t$param['sent_log_id']=$send_log_id;\r\n\t\t\t\t$param['invoice_no']=$incoice;\r\n\t\t\t\t$param['status']=3;\r\n\t\t\t\t$param['received_by']=$received_by[$i];\r\n\t\t\t\t$param['received_on']=$received_on[$i];\r\n\t\t\t\t$param['contact_no']=$contact_no[$i];\r\n\t\t\t\t$param['logged_on']=cur_datetime();\r\n\t\t\t\t$param['logged_by']=$user['userid'];\r\n\t\t\t\t\r\n\t\t\t\t$already=$this->db->query(\"select count(*) as ttl from pnh_invoice_transit_log where invoice_no=? and status=3\",array($incoice))->row()->ttl;\r\n\t\t\t\tif(!$already)\r\n\t\t\t\t{\r\n\t\t\t\t\t$this->db->insert('pnh_invoice_transit_log',$param);\r\n\t\t\t\t\t$this->session->set_flashdata(\"erp_pop_info\",\"Selected invoices status to be updated\");\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$this->session->set_flashdata(\"erp_pop_info\",\"Selected invoices status already updated\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\tredirect($_SERVER['HTTP_REFERER']);\r\n\t}",
"function showUserPendingNotifications($status){\n global $DB,$user_id;\n\n $sql = \"Select * from notifications where other_user_id=$user_id and status='$status' order by id desc limit 5\";\n $res_data_notification = $DB->RunSelectQuery($sql);\n\n foreach ($res_data_notification as $result)\n {\n $notification_data = (array)$result;\n $date = date(\"Y-m-d\", strtotime($notification_data[\"notification_date\"]));\n ?>\n\n <?php\n//echo $notification_data[\"notification_type\"] ;\n// Added here by Nitin Soni for status\n\n /*\nSHow Notification for updated event\n */\n //IF NOTIFICATION TYPE IS update event/ping\n if ($notification_data[\"notification_type\"] == \"ping_updated\"|| $notification_data[\"notification_type\"] == \"event_updated\")\n {\n\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data_event = $DB->RunSelectQuery($sql);\n foreach ($res_data_event as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n ?>\n <div class=\"is-notification\" id=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n if ($resulteventcomment['event_photo'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resulteventcomment[\"event_photo\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <?php if ($event_type == 'ping')\n {\n $var = 'The';\n }else{\n $var = 'An';\n } ?>\n <?php echo $var ?> <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> has been modified by organiser. Please review the changes.\n </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n /*UPdate event/ping work completed here */\n\n /* Cancel Event/Ping started */\n //IF NOTIFICATION TYPE IS cancel event/ping\n if ($notification_data[\"notification_type\"] == \"Cancel Ping\"|| $notification_data[\"notification_type\"] == \"Cancel Event\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data_event = $DB->RunSelectQuery($sql);\n foreach ($res_data_event as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n foreach ($res_data_publicUser as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\" id=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n if ($resulteventcomment['event_photo'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resulteventcomment[\"event_photo\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <?php if ($event_type == 'ping')\n {\n $var = 'The';\n }else{\n $var = 'An';\n } ?>\n <?php echo $var ?> <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> has been cancelled.</p>\n\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n /* Completed cancel event/ping */\n\n\n\n /*Reorganize event started*/\n /* Cancel Event/Ping started */\n //IF NOTIFICATION TYPE IS cancel event/ping\n if ($notification_data[\"notification_type\"] == \"Event Reorganize\" || $notification_data[\"notification_type\"] == \"Ping Reorganize\")\n {\n\n /*echo \"Hello\";\n exit;*/\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data_event = $DB->RunSelectQuery($sql);\n // 'event_status' => 'L'\n foreach ($res_data_event as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n foreach ($res_data_publicUser as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\" id=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n if ($resulteventcomment['event_photo'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resulteventcomment[\"event_photo\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <?php if ($event_type == 'ping')\n {\n $var = 'The';\n }else{\n $var = 'An';\n } ?>\n\n <?php echo $var ?> <?php echo $event_type ?> <strong><a href=<?php echo $event_link ?> style=\"color:#000000\"><?php echo $event_name ?></a></strong>\n has been reorganized.\n </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n /*Completed here*/\n /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/\n /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/\n /*Completed event update work*/\n\n //IF NOTIFICATION TYPE IS A COMMENT\n if ($notification_data[\"notification_type\"] == \"C\")\n {\n\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n foreach ($res_data_publicUser as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\" id=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $before_result = $DB->RunSelectQuery($sql);\n foreach ($before_result as $result)\n {\n $publicUserResult = (array)$result;\n if ($publicUserResult['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $publicUserResult[\"profile_pic\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n } ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $notification_data[\"$user_id\"]);\n ?>\" style=\"color:#000000\"><?php echo $user_name ?></a></strong> has commented on your <?php echo $event_type ?> <strong><a href=<?php echo $event_link ?> style=\"color:#000000\"><?php echo $event_name ?></a> </strong></p>\n <p id=\"notification-date\"><span class=\"has-noti-icon\"><img alt=\"notifocation-image\" src=\"images/comment_box.gif\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n\n//Completed work for show cancel Event notification\n\n //IF NOTIFICATION TYPE IS A COMMENT\n if ($notification_data[\"notification_type\"] == \"Comment\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div id=\"is-notification\" class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n //Query is changed by Nitin Soni\n /* $sql = \"SELECT * from public_users where id=$user_id\";*/\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $before_result = $DB->RunSelectQuery($sql);\n foreach ($before_result as $result)\n {\n $PublicUserData = (array)$result;\n if ($PublicUserData['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $PublicUserData[\"profile_pic\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n } ?>\n </div>\n <!-- <div class=\"who-sent-notification\">\n <img alt=\"event-image\" src=\"images/profile_img.jpg\" class=\"image-has-radius\">\n </div> -->\n <div class=\"notification-itself\">\n <p class=\"notification-content\" id=\"is-notification\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $notification_data[\"id\"]);\n ?>\" style=\"color:#000000\"><?php echo $user_name ?></a></strong> has commented on your <?php echo $event_type ?> <strong><a href=<?php echo $event_link ?> style=\"color:#000000\"><?php echo $event_name ?></a> </strong></p>\n <p id=\"notification-date\"><span class=\"has-noti-icon\"><img alt=\"notifocation-image\" src=\"images/comment_box.gif\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n //IF NOTIFICATION TYPE IS AN ADD BUDDY\n if ($notification_data[\"notification_type\"] == \"Add_Buddy\")\n {\n\n $sql = \"Select * from public_users where id=\" . $result->user_id;\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $data)\n {\n $publicUserInfo = (array)$data;\n\n $user_name = $publicUserInfo[\"firstname\"] . \" \" . $publicUserInfo[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\" id=\"is-notification\">\n\n <div class=\"who-sent-notification\">\n <?php\n if ($publicUserInfo['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $publicUserInfo[\"profile_pic\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n } ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $publicUserInfo[\"id\"]);\n ?>\" style=\"color:#000000\"><?php echo $user_name ?></a></strong> wants to add you as a buddy.\n\n <?php //Check if current user and event_organiser are buddies\n $sql = \"SELECT * from buddies where user_id=$user_id and buddy_id=\" . $publicUserInfo[\"id\"];\n $res_data = $DB->RunSelectQuery($sql);\n if ($res_data[0]->status =='Confirmed buddy')\n {\n\n ?>\n <img src=\"images/green_tick.gif\" style=\"vertical-align:middle\" width=\"15\" /> <span class=\"ArialVeryDarkGreyBold15\">Accepted</span>\n </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-user\"></span><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n <?php\n }\n else\n {\n ?>\n <div class=\"accept-req-dropdown\" id=\"confirm_add_buddy_status<?php\n echo $publicUserInfo[\"id\"];\n ?>\" style=\"display:inline-block\"><div onClick=\"confirm_add_buddy(<?php\n\n ?>)\" class=\"slimbuttonblue\" style=\"width:130px;\">Accept request</div></div>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-user\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n <?php\n } ?>\n </div>\n </div>\n <?php\n\n }\n //IF NOTIFICATION TYPE IS A CONFIRMED BUDDY\n if ($notification_data[\"notification_type\"] == \"Confirmed Buddy\")\n {\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resultuser)\n {\n $resultuserInfo = (array)$resultuser;\n $user_name = $resultuserInfo[\"firstname\"] . \" \" . $resultuserInfo[\"lastname\"];\n }\n ?>\n\n <div class=\"is-notification\" id=\"is-notification\">\n <div class=\"who-sent-notification\">\n <img width=\"37\" height=\"37\" src=\"<? echo ROOTURL . '/' . $resultuserInfo[\"profile_pic\"]; ?>\" class=\"image-has-radius\" alt=\"event-image\">\n </div>\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $resultuserInfo[\"id\"]);\n ?>\" style=\"color:#000000\"><?php\n echo $user_name;\n ?></a></strong> has accepted your buddy request.</p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-user\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n\n </div>\n <?php\n }\n if ($notification_data[\"notification_type\"] == \"Booking Request\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n\n\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n\n foreach ($res_data as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n } ?>\n <!-- Add new commented here -->\n <div class=\"is-notification\" id=\"is-notification\">\n <!-- Added by Nitin Soni for show user image 18Aug/2017 -->\n <div class=\"who-sent-notification\">\n <?php\n if ($resultusercomment['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resultusercomment['profile_pic']; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n <!-- Finsihed by Nitin Soni for user image -->\n <div class=\"notification-itself\" >\n <p class=\"notification-content\"><?php echo $user_name; ?> sent you a booking request for <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"> <?php\n echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"]));\n ?></span></p>\n </div>\n </div>\n <!-- Add new task completed -->\n\n <?php\n }\n if ($notification_data[\"notification_type\"] == \"Cancel Booking\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n\n\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n\n foreach ($res_data as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n } ?>\n <!-- Add new commented here -->\n <div class=\"is-notification\" id=\"is-notification\">\n <!-- Added by Nitin Soni for show user image 18Aug/2017 -->\n <div class=\"who-sent-notification\">\n <?php\n if ($resultusercomment['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resultusercomment['profile_pic']; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n <!-- Finsihed by Nitin Soni for user image -->\n <div class=\"notification-itself\" >\n <p class=\"notification-content\"><?php echo $user_name; ?> Left <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"> <?php\n echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"]));\n ?></span></p>\n </div>\n </div>\n <!-- Add new task completed -->\n\n <?php\n }\n\n\n ?>\n <?php\n }\n\n}",
"public function index()\n {\n\n if(!NotificationResource::collection(Notification::paginate(10))->isEmpty()){\n fetchLog(Notification::class);\n return response()->json(['content'=>Notification::orderBy('created_at','desc')->paginate(10),'message'=>'liste des Notifications'],200,['Content-Type'=>'application/json']);\n\n }\n fetchEmptyLog(Notification::class);\n return response()->json(['message'=>'Notifications empty']);\n\n }",
"public function respon(){\n //update 'status'\n }",
"function showUserNotifications($status,$limit){\n global $DB,$user_id;\n $limit;\n $sql = \"Select * from notifications where other_user_id=$user_id and status='$status' order by id desc limit $limit\";\n $res_data_notification = $DB->RunSelectQuery($sql);\n\n foreach ($res_data_notification as $result)\n {\n $notification_data = (array)$result;\n $date = date(\"Y-m-d\", strtotime($notification_data[\"notification_date\"]));\n ?>\n <?php\n// Added here by Nitin Soni for status\n\n /*\nSHow Notification for updated event\n */\n //IF NOTIFICATION TYPE IS update event/ping\n if ($notification_data[\"notification_type\"] == \"ping_updated\"|| $notification_data[\"notification_type\"] == \"event_updated\")\n {\n\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data_event = $DB->RunSelectQuery($sql);\n foreach ($res_data_event as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n ?>\n <div class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n if ($resulteventcomment['event_photo'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resulteventcomment[\"event_photo\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <?php if ($event_type == 'ping')\n {\n $var = 'The';\n }else{\n $var = 'An';\n } ?>\n <?php echo $var ?> <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> has been modified by organiser. Please review the changes.\n </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n /*UPdate event/ping work completed here */\n\n /* Cancel Event/Ping started */\n //IF NOTIFICATION TYPE IS cancel event/ping\n if ($notification_data[\"notification_type\"] == \"Cancel Ping\"|| $notification_data[\"notification_type\"] == \"Cancel Event\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data_event = $DB->RunSelectQuery($sql);\n foreach ($res_data_event as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n foreach ($res_data_publicUser as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n if ($resulteventcomment['event_photo'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resulteventcomment[\"event_photo\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <?php if ($event_type == 'ping')\n {\n $var = 'The';\n }else{\n $var = 'An';\n } ?>\n <?php echo $var ?> <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> has been cancelled.</p>\n\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n /* Completed cancel event/ping */\n\n\n\n /*Reorganize event started*/\n /* Cancel Event/Ping started */\n //IF NOTIFICATION TYPE IS cancel event/ping\n if ($notification_data[\"notification_type\"] == \"Event Reorganize\" || $notification_data[\"notification_type\"] == \"Ping Reorganize\")\n {\n\n /*echo \"Hello\";\n exit;*/\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data_event = $DB->RunSelectQuery($sql);\n // 'event_status' => 'L'\n foreach ($res_data_event as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n foreach ($res_data_publicUser as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n if ($resulteventcomment['event_photo'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resulteventcomment[\"event_photo\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\">\n <?php if ($event_type == 'ping')\n {\n $var = 'The';\n }else{\n $var = 'An';\n } ?>\n <?php echo $var ?> <?php echo $event_type ?> <strong><a href=<?php echo $event_link ?> style=\"color:#000000\"><?php echo $event_name ?></a></strong>\n has been reorganized.\n </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n /*Completed here*/\n /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/\n /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/\n /*Completed event update work*/\n\n //IF NOTIFICATION TYPE IS A COMMENT\n if ($notification_data[\"notification_type\"] == \"C\")\n {\n\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data_publicUser = $DB->RunSelectQuery($sql);\n foreach ($res_data_publicUser as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $before_result = $DB->RunSelectQuery($sql);\n foreach ($before_result as $result)\n {\n $publicUserResult = (array)$result;\n if ($publicUserResult['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $publicUserResult[\"profile_pic\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n } ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $notification_data[\"$user_id\"]);\n ?>\" style=\"color:#000000\"><?php echo $user_name ?></a></strong> has commented on your <?php echo $event_type ?><strong><a href=<?php echo $event_link ?> style=\"color:#000000\"><?php echo $event_name ?></a> </strong></p>\n <p id=\"notification-date\"><span class=\"has-noti-icon\"><img alt=\"notifocation-image\" src=\"images/comment_box.gif\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n\n//Completed work for show cancel Event notification\n\n //IF NOTIFICATION TYPE IS A COMMENT\n if ($notification_data[\"notification_type\"] == \"Comment\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <?php\n //Query is changed by Nitin Soni\n /* $sql = \"SELECT * from public_users where id=$user_id\";*/\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $before_result = $DB->RunSelectQuery($sql);\n foreach ($before_result as $result)\n {\n $PublicUserData = (array)$result;\n if ($PublicUserData['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $PublicUserData[\"profile_pic\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n } ?>\n </div>\n <!-- <div class=\"who-sent-notification\">\n <img alt=\"event-image\" src=\"images/profile_img.jpg\" class=\"image-has-radius\">\n </div> -->\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $notification_data[\"id\"]);\n ?>\" style=\"color:#000000\"><?php echo $user_name ?></a></strong> has commented on your <?php echo $event_type ?> <strong><a href=<?php echo $event_link ?> style=\"color:#000000\"><?php echo $event_name ?></a> </strong></p>\n <p id=\"notification-date\"><span class=\"has-noti-icon\"><img alt=\"notifocation-image\" src=\"images/comment_box.gif\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n\n <!-- --><? //\n\n }\n //IF NOTIFICATION TYPE IS AN ADD BUDDY\n if ($notification_data[\"notification_type\"]=='Add_Buddy')\n {\n// echo'hi mthree';exit;\n $sql = \"Select * from public_users where id=\" . $result->user_id;\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $data)\n {\n $publicUserInfo = (array)$data;\n\n $user_name = $publicUserInfo[\"firstname\"] . \" \" . $publicUserInfo[\"lastname\"];\n }\n ?>\n <div class=\"is-notification\">\n\n <div class=\"who-sent-notification\">\n <?php\n if ($publicUserInfo['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $publicUserInfo[\"profile_pic\"]; ?>\" width=\"37\" height=\"37\" />\n <?php\n } ?>\n </div>\n\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $publicUserInfo[\"id\"]);\n ?>\" style=\"color:#000000\"><?php echo $user_name ?></a></strong> wants to add you as a buddy.\n <?php //Check if current user and event_organiser are buddies\n $sql = \"SELECT * from buddies where user_id=$user_id and buddy_id=\" . $publicUserInfo[\"id\"];\n $res_data = $DB->RunSelectQuery($sql);\n if ($res_data[0]->status =='Confirmed buddy')\n {\n\n ?>\n <img src=\"images/green_tick.gif\" style=\"vertical-align:middle\" width=\"15\" /> <span class=\"ArialVeryDarkGreyBold15\">Accepted</span>\n </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-user\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n </div>\n <?php\n }\n else\n {\n ?>\n <div class=\"accept-req-dropdown\" id=\"confirm_add_buddy_status<?php\n echo $publicUserInfo[\"id\"];\n ?>\" style=\"display:inline-block\"><div onClick=\"confirm_add_buddy(<?php\n echo $publicUserInfo[\"id\"];\n ?>)\" class=\"slimbuttonblue\" style=\"width:130px;\">Accept request</div></div>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-user\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n <?php\n }?>\n\n <?php\n }\n //IF NOTIFICATION TYPE IS A CONFIRMED BUDDY\n if ($notification_data[\"notification_type\"] == \"Confirmed Buddy\")\n {\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resultuser)\n {\n $resultuserInfo = (array)$resultuser;\n $user_name = $resultuserInfo[\"firstname\"] . \" \" . $resultuserInfo[\"lastname\"];\n }\n ?>\n\n <div class=\"is-notification\">\n <div class=\"who-sent-notification\">\n <img width=\"37\" height=\"37\" src=\"<? echo ROOTURL . '/' . $resultuserInfo[\"profile_pic\"]; ?>\" class=\"image-has-radius\" alt=\"event-image\">\n </div>\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><strong><a href=\"<?php\n echo createURL('index.php', \"mod=user&do=profile&userid=\" . $resultuserInfo[\"id\"]);\n ?>\" style=\"color:#000000\"><?php\n echo $user_name;\n ?></a></strong> has accepted your buddy request.</p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-user\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"><?php echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"])) ?></span></p>\n </div>\n\n </div>\n <?php\n }\n if ($notification_data[\"notification_type\"] == \"Booking Request\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n\n\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n\n foreach ($res_data as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n } ?>\n <!-- Add new commented here -->\n <div class=\"is-notification\">\n <!-- Added by Nitin Soni for show user image 18Aug/2017 -->\n <div class=\"who-sent-notification\">\n <?php\n if ($resultusercomment['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resultusercomment['profile_pic']; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n <!-- Finsihed by Nitin Soni for user image -->\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><?php echo $user_name; ?> sent you a booking request for <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"> <?php\n echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"]));\n ?></span></p>\n </div>\n </div>\n <!-- Add new task completed -->\n\n <?php\n }\n if ($notification_data[\"notification_type\"] == \"Cancel Booking\")\n {\n $sql = \"Select * from events where event_id=\" . $notification_data[\"event_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n foreach ($res_data as $resulteventcomment)\n {\n $resulteventcomment = (array)$resulteventcomment;\n $event_name = $resulteventcomment[\"event_name\"];\n if ($resulteventcomment[\"entry_type\"] == \"\")\n {\n $event_type = \"event\";\n $event_link = createURL('index.php', \"mod=event&do=eventdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n else if ($resulteventcomment[\"entry_type\"] == \"Ping\")\n {\n $event_type = \"ping\";\n $event_link = createURL('index.php', \"mod=ping&do=pingdetails&eventid=\" . $resulteventcomment[\"event_id\"]);\n }\n }\n\n\n $sql = \"Select * from public_users where id=\" . $notification_data[\"user_id\"];\n $res_data = $DB->RunSelectQuery($sql);\n\n foreach ($res_data as $resultusercomment)\n {\n $resultusercomment = (array)$resultusercomment;\n\n $user_name = $resultusercomment[\"firstname\"] . \" \" . $resultusercomment[\"lastname\"];\n } ?>\n <!-- Add new commented here -->\n <div class=\"is-notification\">\n <!-- Added by Nitin Soni for show user image 18Aug/2017 -->\n <div class=\"who-sent-notification\">\n <?php\n if ($resultusercomment['profile_pic'] == null)\n {\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<?php echo ROOTURL; ?>/images/no_profile_pic.gif\" />\n <?php\n }\n else\n {\n\n ?>\n <img alt=\"event-image\" class=\"image-has-radius\" src=\"<? echo ROOTURL . '/' . $resultusercomment['profile_pic']; ?>\" width=\"37\" height=\"37\" />\n <?php\n }\n ?>\n </div>\n <!-- Finsihed by Nitin Soni for user image -->\n <div class=\"notification-itself\">\n <p class=\"notification-content\"><?php echo $user_name; ?> Left <?php echo $event_type; ?> <strong><a style=\"color:#000000\" href=\"<?php echo $event_link;?>\"><?php\n echo $event_name;\n ?></a></strong> </p>\n <p id=\"notification-date\"><span class=\"glyphicon glyphicon-calendar\"></span><span class=\"make-space\"></span><span class=\"has-noti-date-time\"> <?php\n echo date(\"j F, H:i a\", strtotime($notification_data[\"notification_date\"]));\n ?></span></p>\n </div>\n </div>\n <!-- Add new task completed -->\n\n <?php\n }\n\n ?>\n <?php\n }\n}",
"public function ftvchRequestsoldAction()\n {\n // $broadcast_array=$this->_arrayDb->loadArrayv2(\"EP_BROADCASTS\", $this->_lang);\n $ftvcontacts_obj = new Ep_Ftv_FtvContacts();\n $ftvrequest_obj = new Ep_Ftv_FtvRequests();\n $ftvcomments_obj = new Ep_Ftv_FtvComments();\n $ftvdocuments_obj = new Ep_Ftv_FtvDocuments();\n $ftvpausetime_obj = new Ep_Ftv_FtvPauseTime();\n $loginuser = $this->adminLogin->userId;\n $contacts = $ftvcontacts_obj->getRequestCreatedContacts(); // print_r($contacts); exit;\n $this->_view->contacts_array = $contacts;\n if($loginuser != \"\")\n {\n $ftv_params=$this->_request->getParams();\n if($ftv_params['search'] == 'search')\n { //echo \"mash\"; exit;\n $condition['search'] = $ftv_params['search'];\n $condition['contactId'] = $ftv_params['contactId'];\n $condition['containsId'] = $ftv_params['containsId'];\n $condition['broadcastId'] = $ftv_params['broadcastId'];\n $condition['quandId'] = $ftv_params['quandId'];\n $condition['startdate'] = $ftv_params['startdate'];\n $condition['enddate'] = $ftv_params['enddate'];\n $condition['dayrange'] = $ftv_params['dayrange'];\n }\n $requestsdetail=$ftvrequest_obj->getAllRequestsDetails($condition, 'chaine');\n //contains to modify\n\n $contains_array = array(1=>\"Unes tournantes\", 2=>\"Voir et Revoir\", 3=>\"Les émissions\", 4=>\"A découvrir\",5=>\"Les jeux\",\n 6=>\"Une\", 7=>\"Top 3\", 8=>\"Forums\", 9=>\"PAGE VIDEOS\", 10=>\"PAGES DOCUMENTAIRES\", 11=>\"PAGES FRANCE 5 & VOUS\", 12=>\"PAGES INFOS\");\n $duraiton_array = array(\"h\"=>\"Dans l'heure\", \"d\"=>\"Dans la journée\",\"nd\"=>\"Le lendemain\", \"w\"=>\"Dans la semaine\",\"nw\"=>\"La semaine prochaine\");\n $this->_view->contains_array = $contains_array;\n $this->_view->quands_array = $duraiton_array;\n $broadcast_array = array(\"1\"=>'France 2', \"2\"=>'France 3', \"3\"=>'France 4',\"4\"=>'France 5',\"5\"=>'France Ô' ,\"6\"=>'France TV');\n $demand_array = array(\"1\"=>'Intégration', \"2\"=>'Modification demandée par FTV', \"3\"=>'Correction erreur EP', \"4\"=>'Retours');\n $this->_view->broadcast_array = $broadcast_array;\n $this->_view->demand_array = $demand_array;\n // print_r($requestsdetail); exit;\n if($requestsdetail != 'NO')\n {\n $gtdays = '';$gthours = ''; $gtminutes = '';$gtdiff='';\n foreach ($requestsdetail as $key => $value)\n {\n\n $inpause = $ftvpausetime_obj->inPause($requestsdetail[$key]['identifier']);\n $requestsdetail[$key]['inpause'] = $inpause;\n\n $durationvalue = $duraiton_array[$requestsdetail[$key]['duration']];\n $requestsdetail[$key]['duration'] = $durationvalue;\n $requestsdetail[$key]['demand'] = $demand_array[$requestsdetail[$key]['demand']];\n /////getting modify contains display format///\n $contains = explode(\",\",$requestsdetail[$key]['modify_contains']);\n $finalcontains = array();\n foreach($contains as $code1 => $abb1)\n {\n $finalcontains[$code1] = $contains_array[$abb1];\n }\n $containvalue = implode(\" / \",$finalcontains);\n $requestsdetail[$key]['modify_contains'] = $containvalue;\n ////getting modify broadcast display format//\n $braodcast = explode(\",\",$requestsdetail[$key]['modify_broadcast']);\n $finalbroadcast = array();\n foreach($braodcast as $broadkey => $broadval)\n {\n $finalbroadcast[$broadkey] = $broadcast_array[$broadval];\n }\n $broadvalue = implode(\" / \",$finalbroadcast);\n $requestsdetail[$key]['modify_broadcast'] = $broadvalue;\n\n ////gettting recent comments ny BO user ////\n $commentDetails=$ftvcomments_obj->getRecentCommentsByBoUser($requestsdetail[$key]['identifier']);\n if($commentDetails != 'NO')\n $requestsdetail[$key]['comments'] = $commentDetails[0]['comments'];\n else\n $requestsdetail[$key]['comments'] = \"NILL\";\n ////gettting recent document BO user ////\n $documentDetails=$ftvdocuments_obj->getRecentDocument($requestsdetail[$key]['identifier']);\n if($documentDetails != 'NO')\n $requestsdetail[$key]['recent_document'] = $documentDetails[0]['document'];\n else\n $requestsdetail[$key]['recent_document'] = \"NILL\";\n //////color differentiation//////\n $requestsdetail[$key]['created_at'];\n $t=date('d-m-Y H:i', strtotime($requestsdetail[$key]['created_at']));\n $dayandtime = explode(\"-\", date(\"N-G-i\",strtotime($t)));//echo $requestsdetail[$key]['request_object'];print_r($dayandtime);\n $day = $dayandtime[0];\n $hour = $dayandtime[1];\n $minute = $dayandtime[2];\n $reddays = array(1,2,3,4); ///monday to thursday\n $bluedays = array(5,6,7); //friday to sunday\n\n if($hour >= 19 || $hour < 9)\n {\n if(in_array($day, $reddays))\n $requestsdetail[$key]['dayrange']=\"red\";\n else\n $requestsdetail[$key]['dayrange']=\"green\";\n }\n $ptimes = $ftvpausetime_obj->getPauseDuration($requestsdetail[$key]['identifier']);\n $assigntime = $requestsdetail[$key]['assigned_at'];\n\n if(($requestsdetail[$key]['status'] == 'done' || $inpause == 'yes') && ($requestsdetail[$key]['assigned_at'] != null && $requestsdetail[$key]['assigned_to'] != null))\n {\n if($requestsdetail[$key]['assigned_at'] != NULL)\n {\n if($requestsdetail[$key]['status'] == \"closed\")\n $time1 = ($requestsdetail[$key]['cancelled_at']); /// created time\n elseif ($requestsdetail[$key]['status'] == \"done\")\n $time1 = ($requestsdetail[$key]['closed_at']); /// created time\n else{\n if($inpause == 'yes') {\n $time1 = ($requestsdetail[$key]['pause_at']);\n }else {\n $time1 = (date('Y-m-d H:i:s'));///curent time\n }\n }\n\n // $totaltime2 = strtotime($requestsdetail[$key]['assigned_at']);\n $pausedrequests = $ftvpausetime_obj->pausedRequest($requestsdetail[$key]['identifier']);\n if($pausedrequests == 'yes')\n {\n $time2 = $this->subDiffFromDate($requestsdetail[$key]['identifier'], $requestsdetail[$key]['assigned_at']);\n }else{\n $time2 = $requestsdetail[$key]['assigned_at'];\n }\n $totaldiff = strtotime($time1) - strtotime($time2);\n\n $timestamp = new DateTime($time1);\n $diff = $timestamp->diff(new DateTime($time2));\n $days = $diff->format('%d');\n $hours = $diff->format('%h');\n $minutes = $diff->format('%i');\n $seconds = $diff->format('%s');\n $gtdiff+=$totaldiff;\n $difference = '';\n\n if($days != '')\n $difference.= \"<span class='label label-info' >\".$days.\"J </span> \";\n if($hours != '')\n $difference.= \"<span class='label label-info' >\".$hours.\"H </span> \";\n if($minutes != '')\n $difference.= \"<span class='label label-info' >\".$minutes.\"M </span> \";\n if($seconds != '')\n $difference.= \"<span class='label label-info' >\".$seconds.\"S </span> \";\n\n $requestsdetail[$key]['time_spent'] = $difference;\n }\n else\n $requestsdetail[$key]['time_spent'] = \"-NA-\";\n }\n else\n $requestsdetail[$key]['time_spent'] = \"-NA-\";\n $pausedrequests = $ftvpausetime_obj->pausedRequest($requestsdetail[$key]['identifier']);\n if($pausedrequests == 'yes')\n {\n $requestsdetail[$key]['assigned_at'] = $this->subDiffFromDate($requestsdetail[$key]['identifier'], $requestsdetail[$key]['assigned_at']);\n\n }else{\n $requestsdetail[$key]['assigned_at'] = $requestsdetail[$key]['assigned_at'];\n }\n ////subtracting 30 sec because adding 30 secs added by javascipt ///\n $minus30sec=new DateTime($requestsdetail[$key]['assigned_at']);\n $minus30sec->add(new DateInterval(\"PT35S\"));\n $requestsdetail[$key]['assigned_at'] = $minus30sec->format('Y-m-d H:i:s');\n }\n // print_r($ptimes);\n $d = floor($gtdiff/86400);\n $gtdays = ($d < 10 ? '0' : '').$d;\n\n $h = floor(($gtdiff-$d*86400)/3600);\n $gthours = ($h < 10 ? '0' : '').$h;\n\n $m = floor(($gtdiff-($d*86400+$h*3600))/60);\n $gtminutes = ($m < 10 ? '0' : '').$m;\n\n $gtdifference = '';\n if($gtdays != '')\n $gtdifference.= \"\".$gtdays.\"J \";\n if($gthours != '')\n $gtdifference.= \"\".$gthours.\"H \";\n if($gtminutes != '')\n $gtdifference.= \"\".$gtminutes.\"M \";\n $this->_view->globaltime = $gtdifference;\n // $this->_view->requestsdetail=$requestsdetail;\n $this->_view->paginator = $requestsdetail;\n } else\n $this->_view->nores = \"true\";\n $this->render(\"ftvchaine_ftvchrequests\");\n }\n }",
"function modificarServicio(){\r\n\t\t$this->procedimiento='gev.f_tgv_servicio_ime';\r\n\t\t$this->tipo_procedimiento='IME';\r\n\t\t\t\t\r\n\t\t\r\n\t\t$parametros = $this->aParam->getArregloParametros('asignacion');\r\n\t\t//si esdel tipo matriz verifica en la primera posicion el tipo de vista\r\n\t\tif($this->esMatriz){\r\n\t\t $tipo_operacion =$parametros[0]['tipo_operacion'];\t\r\n\t\t\t\r\n\t\t}else{\r\n\t\t\t$tipo_operacion =$parametros['tipo_operacion'];\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tif($tipo_operacion=='asignacion'){\r\n\t\t $this->transaccion='tgv_SERVIC_MOD';\r\n } \r\n elseif($tipo_operacion=='cambiar_estado'){ \r\n\t\t $this->transaccion='tgv_SERCAMEST_MOD';\r\n\t\t $this->setParametro('operacion','operacion','varchar');// cuando finaliza los requerimientos, su valor es fin_requerimiento\r\n\t\t //$this->setParametro('id_abogado','id_abogado','int4');\r\n\t\t}\r\n\t\telseif ($tipo_operacion=='def_fechas'){ \r\n\t\t $this->transaccion='tgv_DEFFECHA_MOD';\r\n\t\t // $this->setParametro('operacion','operacion','varchar');// cuando finaliza los requerimientos, su valor es fin_requerimiento\r\n\t\t //$this->setParametro('id_abogado','id_abogado','int4');\r\n\t\t}\r\n\t\t\r\n\t\t//Define los parametros para la funcion\r\n\t\t$this->setParametro('id_servicio','id_servicio','int4');\r\n\t\t$this->setParametro('estado','estado','varchar');\r\n\t\t$this->setParametro('estado_reg','estado_reg','varchar');\r\n\t\t$this->setParametro('id_lugar_destino','id_lugar_destino','int4');\r\n\t\t$this->setParametro('id_ep','id_ep','int4');\r\n\t\t$this->setParametro('fecha_asig_fin','fecha_asig_fin','date');\r\n\t\t$this->setParametro('fecha_sol_ini','fecha_sol_ini','date');\r\n\t\t$this->setParametro('descripcion','descripcion','varchar');\r\n\t\t$this->setParametro('id_lugar_origen','id_lugar_origen','int4');\r\n\t\t$this->setParametro('cant_personas','cant_personas','int4');\r\n\t\t$this->setParametro('fecha_sol_fin','fecha_sol_fin','date');\r\n\t\t$this->setParametro('id_funcionario','id_funcionario','int4');\r\n\t\t$this->setParametro('fecha_asig_ini','fecha_asig_ini','date');\r\n\t\t$this->setParametro('id_funcionario_autoriz','id_funcionario_autoriz','int4');\r\n\t\t$this->setParametro('observaciones','observaciones','varchar');\r\n\r\n\t\t//Ejecuta la instruccion\r\n\t\t$this->armarConsulta();\r\n\t\t$this->ejecutarConsulta();\r\n\r\n\t\t//Devuelve la respuesta\r\n\t\treturn $this->respuesta;\r\n\t}",
"public function pending()\n\t{\n\t\texit;\n\t\t$sub_app_id = $this->_get_app_id().\"02\";\n\t\t$_SESSION[\"LISTPAGE\"] = current_url().\"?\".$_SERVER['QUERY_STRING'];\n\n\t\tif ($this->input->post(\"posted\"))\n\t\t{\n\t\t\tif ($type = $this->input->post(\"type\"))\n\t\t\t{\n\t\t\t\t$this->so_service->get_dao()->trans_start();\n\t\t\t\tif ($so_obj = $this->so_service->get(array(\"so_no\"=>$this->input->post(\"so_no\"))))\n\t\t\t\t{\n\t\t\t\t\t$extends = 1;\n\t\t\t\t\tswitch ($type)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase \"b\":\n\t\t\t\t\t\t\t$so_obj->set_status('1');\n\t\t\t\t\t\t\t$this->so_service->get_socc_dao()->q_delete(array(\"so_no\"=>$this->input->post(\"so_no\")));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"c\":\n\t\t\t\t\t\t\tswitch($this->input->post('hold_reason'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcase 'cscc':\n\t\t\t\t\t\t\t\tcase 'csvv':\n\t\t\t\t\t\t\t\t\t$this->credit_check_model->fire_cs_request($this->input->post(\"so_no\"),$this->input->post(\"hold_reason\"));\n\t\t\t\t\t\t\t\t\t$sohr_obj = $this->so_service->get_sohr_dao()->get();\n\t\t\t\t\t\t\t\t\t$sohr_obj->set_so_no($this->input->post(\"so_no\"));\n\t\t\t\t\t\t\t\t\t$sohr_obj->set_reason($this->input->post(\"hold_reason\"));\n\t\t\t\t\t\t\t\t\t$extends = $this->so_service->get_sohr_dao()->insert($sohr_obj);\n\t\t\t\t\t\t\t\t\t$so_obj->set_hold_status('1');\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase 'confirm_fraud':\n\t\t\t\t\t\t\t\t\t$socc_obj = $this->so_service->get_socc_dao()->get(array(\"so_no\"=>$this->input->post(\"so_no\")));\n\t\t\t\t\t\t\t\t\t$socc_obj->set_fd_status(2);\n\t\t\t\t\t\t\t\t\t$extends = $this->so_service->get_socc_dao()->update($socc_obj);\n\t\t\t\t\t\t\t\t\t$sohr_obj = $this->so_service->get_sohr_dao()->get();\n\t\t\t\t\t\t\t\t\t$sohr_obj->set_so_no($this->input->post(\"so_no\"));\n\t\t\t\t\t\t\t\t\t$sohr_obj->set_reason($this->input->post(\"hold_reason\"));\n\t\t\t\t\t\t\t\t\t$extends = $extends && $this->so_service->get_sohr_dao()->insert($sohr_obj);\n\t\t\t\t\t\t\t\t\t$so_obj->set_status(0);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"p\":\n\t\t\t\t\t\tcase \"pe\":\n\t\t\t\t\t\t\t$so_obj->set_status('3');\n\t\t\t\t\t\t\tif (($promo_code = $so_obj->get_promotion_code()) != \"\")\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$this->promotion_code_service->promo_code = $promo_code;\n\t\t\t\t\t\t\t\t$this->promotion_code_service->update_no_taken();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (!$this->so_service->update($so_obj) || !$extends)\n\t\t\t\t\t{\n\t\t\t\t\t\t$_SESSION[\"NOTICE\"] = \"ERROR \".__LINE__.\" : \".$this->db->_error_message();\n\t\t\t\t\t\t$this->so_service->get_dao()->trans_complete();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->so_service->get_dao()->trans_complete();\n\t\t\t\t\t\tif($type == \"pe\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->pmgw->so = $so_obj;\n\t\t\t\t\t\t\t$this->pmgw->fire_success_event();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tredirect($_SESSION[\"LISTPAGE\"]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$_SESSION[\"NOTICE\"] = \"ERROR \".__LINE__.\" : \".$this->db->_error_message();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\t$where = array();\n\t\t$option = array();\n\n\t\tif ($this->input->get(\"so_no\") != \"\")\n\t\t{\n\t\t\t$where[\"so.so_no LIKE \"] = \"%\".$this->input->get(\"so_no\").\"%\";\n\t\t}\n\n\t\tif ($this->input->get(\"email\") != \"\")\n\t\t{\n\t\t\t$where[\"c.email LIKE \"] = \"%\".$this->input->get(\"email\").\"%\";\n\t\t}\n\n\t\tif ($this->input->get(\"delivery_charge\"))\n\t\t{\n\t\t\tfetch_operator($where, \"so.delivery_charge\", $this->input->get(\"delivery_charge\"));\n\t\t}\n\n\t\tif ($this->input->get(\"offline_fee\"))\n\t\t{\n\t\t\tfetch_operator($where, \"soe.offline_fee\", $this->input->get(\"offline_fee\"));\n\t\t}\n\n\t\tif ($this->input->get(\"amount\"))\n\t\t{\n\t\t\tfetch_operator($where, \"so.amount\", $this->input->get(\"amount\"));\n\t\t}\n\n\t\t$where[\"biz_type\"] = \"OFFLINE\";\n\t\t$where[\"so.status\"] = \"2\";\n\t\t$where[\"so.hold_status\"] = \"0\";\n\t\t$option[\"so_item\"] = \"1\";\n\t\t$option[\"hide_payment\"] = \"1\";\n\n\t\t$sort = $this->input->get(\"sort\");\n\t\t$order = $this->input->get(\"order\");\n\n\t\t$limit = '20';\n\n\t\t$pconfig['base_url'] = $_SESSION[\"LISTPAGE\"];\n\t\t$option[\"limit\"] = $pconfig['per_page'] = $limit;\n\t\tif ($option[\"limit\"])\n\t\t{\n\t\t\t$option[\"offset\"] = $this->input->get(\"per_page\");\n\t\t}\n\n\t\tif (empty($sort))\n\t\t\t$sort = \"so_no\";\n\n\t\tif (empty($order))\n\t\t\t$order = \"desc\";\n\n\t\t$option[\"orderby\"] = $sort.\" \".$order;\n\t\t$option[\"notes\"] = TRUE;\n\t\t$option[\"extend\"] = TRUE;\n\t\t$option[\"credit_chk\"] = TRUE;\n\t\t$option[\"hide_client\"] = FALSE;\n\n\t\t$data[\"objlist\"] = $this->so_service->get_dao()->get_list_w_name($where, $option);\n\t\t$data[\"total\"] = $this->so_service->get_dao()->get_list_w_name($where, array(\"notes\"=>1, \"extend\"=>1, \"num_rows\"=>1, \"credit_chk\"=>1));\n\n\t\tinclude_once(APPPATH.\"language/\".$sub_app_id.\"_\".$this->_get_lang_id().\".php\");\n\t\t$data[\"lang\"] = $lang;\n\n\t\t$pconfig['total_rows'] = $data['total'];\n\t\t$this->pagination_service->set_show_count_tag(TRUE);\n\t\t$this->pagination_service->initialize($pconfig);\n\n\t\t$data[\"notice\"] = notice($lang);\n\n\t\t$data[\"sortimg\"][$sort] = \"<img src='\".base_url().\"images/\".$order.\".gif'>\";\n\t\t$data[\"xsort\"][$sort] = $order==\"asc\"?\"desc\":\"asc\";\n\t\t$data[\"searchdisplay\"] = \"\";\n\n\t\t$this->load->view('order/phone_sales/phone_sales_pending_v', $data);\n\t}",
"private function getNotificaciones ($cantidad, $offset, $unread = false)\n {\n //ALTAS PROPIAS\n $altasPropias = DB::table('alertas')\n ->select(DB::raw('\"altasPropias\" AS type, alertas.updated_at AS orden, null AS author1, null AS author2, null AS author3, alertas.nombre AS content1, alertas.apellido AS content2, alertas.dni AS content3, instituciones.nombre AS content4, alertas.asistido_id AS content5'))\n ->leftJoin('instituciones', 'alertas.institucion_id', '=', 'instituciones.id')\n ->where('alertas.user_id', Auth::user()->id)\n ->whereNotNull('alertas.asistido_id');\n\n $sql = $altasPropias;\n\n //SOLCITUD ACEPTADA A UNA COMUNIDAD - link a la comunidad\n \t$solicitudAceptada = DB::table('comunidad_user')\n ->select(DB::raw('\"solicitudAceptada\" AS type, comunidad_user.created_at AS orden, NULL AS author1, NULL AS author2, NULL AS author3, comunidades.nombre AS content1, null AS content2, null AS content3,NULL AS content4, comunidad_user.comunidad_id AS content5'))\n ->leftJoin('comunidades', 'comunidad_user.comunidad_id', '=', 'comunidades.id')\n ->where('comunidad_user.user_id', '=', Auth::user()->id);\n\n $sql = $sql->union($solicitudAceptada);\n\n //SI ES SAMARITANO O PROFESIONAL O COORDINADOR O POSADERO O ADMINISTRADOR\n if (Auth::user()->tipoUsuario->slug == 'samaritano' || Auth::user()->tipoUsuario->slug == 'profesional' || Auth::user()->tipoUsuario->slug == 'coordinador' || Auth::user()->tipoUsuario->slug == 'posadero' || Auth::user()->tipoUsuario->slug == 'administrador') {\n \n\t //NUEVA ASOSIACION DE ASISTIDO A COMUNIDAD - link a la comunidad\n\t $asistidos = DB::table('asistido_comunidad')\n ->select(DB::raw('\"asistidos\" AS type, asistido_comunidad.created_at AS orden, NULL AS author1, NULL AS author2, NULL AS author3, asistidos.nombre AS content1, asistidos.apellido AS content2, comunidades.nombre AS content3, asistidos.id AS content4, asistido_comunidad.comunidad_id AS content5'))\n ->leftJoin('asistidos', 'asistido_comunidad.asistido_id', '=', 'asistidos.id')\n ->leftJoin('comunidades', 'asistido_comunidad.comunidad_id', '=', 'comunidades.id')\n ->whereRaw('asistido_comunidad.comunidad_id IN (SELECT comunidad_user.comunidad_id FROM comunidad_user WHERE user_id = ?)', [Auth::user()->id]);\n\n $sql = $sql->union($asistidos);\n \t \n \t //NUEVA ALERTA DE LA COMUNIDAD SI NO FUE EL MISMO - link a la comunidad\n \t$alertas = DB::table('alertas')\n ->select(DB::raw('\"alertas\" AS type, alertas.created_at AS orden, users.name AS author1, users.apellido AS author2, tiposUsuarios.nombre AS author3, alertas.nombre AS content1, alertas.apellido AS content2, alertas.observaciones AS content3, comunidades.nombre AS content4, alertas.comunidad_id AS content5'))\n ->leftJoin('users', 'alertas.user_id', '=', 'users.id')\n ->leftJoin('tiposUsuarios', 'users.tipoUsuario_id', '=', 'tiposUsuarios.id')\n\t\t\t->leftJoin('comunidades', 'alertas.comunidad_id', '=', 'comunidades.id') \n ->where('alertas.user_id', '<>', Auth::user()->id)\n ->whereRaw('alertas.comunidad_id IN (SELECT comunidad_user.comunidad_id FROM comunidad_user WHERE user_id = ?)', [Auth::user()->id]);\n\n $sql = $sql->union($alertas);\n\n \t//NUEVO MENSAJE DE LA COMUNIDAD SI NO FUE EL MISMO - link a la comunidad\n \t$mensajes = DB::table('mensajesComunidad')\n ->select(DB::raw('\"mensajes\" AS type, mensajesComunidad.created_at AS orden, users.name AS author1, users.apellido AS author2, tiposUsuarios.nombre AS author3, mensajesComunidad.mensaje AS content1, mensajesComunidad.adjunto AS content2, users.imagen AS content3, comunidades.nombre AS content4, mensajesComunidad.comunidad_id AS content5'))\n ->leftJoin('users', 'mensajesComunidad.created_by', '=', 'users.id')\n ->leftJoin('tiposUsuarios', 'users.tipoUsuario_id', '=', 'tiposUsuarios.id')\n ->leftJoin('comunidades', 'mensajesComunidad.comunidad_id', '=', 'comunidades.id')\n ->where('mensajesComunidad.created_by', '<>', Auth::user()->id)\n ->whereRaw('mensajesComunidad.comunidad_id IN (SELECT comunidad_user.comunidad_id FROM comunidad_user WHERE user_id = ?)', [Auth::user()->id]);\n\n \t$sql = $sql->union($mensajes);\n\n \t//NUEVO MIEMBRO EN LA COMUNIDAD SI NO FUE EL MISMO - link a la comunidad\n \t$miembros = DB::table('comunidad_user')\n ->select(DB::raw('\"miembros\" AS type, comunidad_user.created_at AS orden, NULL AS author1, NULL AS author2, NULL AS author3, users.name AS content1, users.apellido AS content2, users.email AS content3,NULL AS content4, comunidad_user.comunidad_id AS content5'))\n ->leftJoin('users', 'comunidad_user.user_id', '=', 'users.id')\n ->where('comunidad_user.user_id', '<>', Auth::user()->id)\n ->whereRaw('comunidad_user.comunidad_id IN (SELECT comunidad_user.comunidad_id FROM comunidad_user WHERE user_id = ?)', [Auth::user()->id]);\n\n $sql = $sql->union($miembros);\n\n }\n\n //SI ES COORDINADOR O POSADERO\n //NUEVAS SOLICITUDES EN SUS COMUNIDADES (coordinador segun comunidad id, posadero segun todas sus comunidades) - link a la comunidad\n \n\t\t//SI ES COORDINADOR O PROFESIONAL O POSADERO O ADMINISTRADOR\n \t//NUEVA CONSULTA PARA UN ASISTIDO DE LA COMUNDIAD SI NO FUE EL - link al asistido\n //NUEVA FICHA PARA UN ASISTIDO DE LA COMUNIDAD SI NO FUE EL - link al asistido \n \n //PENDIENTES:\n //NUEVA DONACION EN TU POSADERO?\n \t//NUEVA NECESIDAD EN LA COMUNIDAD SI NO FUE EL MISMO?\n\n if ($unread) {\n \t\n \t$resultados = DB::table(DB::raw('('.$sql->toSql().') as t1'))\n\t\t\t ->select('*')\n\t\t\t ->orderBy('orden', 'desc')\n\t\t\t //->where('orden', '>', Auth::user()->readNotif)\n\t\t\t ->whereRaw(\"orden > '\" . Auth::user()->readNotif . \"'\")\n\t\t\t ->mergeBindings($sql)\n\t\t\t ->get();\n\n } else {\n \t\n \t$resultados = DB::table(DB::raw('('.$sql->toSql().') as t1'))\n\t\t\t ->select('*')\n\t\t\t //->where('orden', '>', Auth::user()->created_at)\n\t\t\t ->whereRaw(\"orden > '\" . Auth::user()->created_at . \"'\")\n\t\t\t ->orderBy('orden', 'desc')\n\t\t\t ->offset($offset)\n\t\t\t ->limit($cantidad)\n\t\t\t ->mergeBindings($sql)\n\t\t\t ->get();\n \n }\n\n return $resultados;\n }",
"public function observaciones()\r\n {\r\n $data = new stdClass();\r\n $data->horario = $this->session->horario;\r\n\r\n $this->load->view('overall/head');\r\n $this->load->view('overall/header');\r\n $this->load->view('observaciones/content', $data);\r\n $this->load->view('overall/footer');\r\n }",
"function update_status()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\t\n\t\tif(!empty($data['t']) && !empty($data['list'])) $response = $this->_tender->update_status($data['t'], explode('--',$data['list']));\n\t\t\n\t\t# all good\n\t\tif(!empty($response) && $response['boolean']){\n\t\t\t$data['msg'] = 'The Invitation for Bids/Quotations status has been updated.';\n\t\t\t$data['area'] = 'refresh_list_msg';\n\t\t} \n\t\t# there was an error\n\t\telse {\n\t\t\t$data['msg'] = (!empty($data['t']) && !empty($data['list']))? 'ERROR: There was an error updating the Invitation for Bids/Quotations status.': 'ERROR: This action can not be resolved';\n\t\t\t$data['area'] = 'basic_msg';\n\t\t}\n\t\t\n\t\t$this->load->view('addons/basic_addons', $data);\n\t}",
"public function reescalarActi(){\n }",
"function listarServicio(){\r\n\t\t$this->procedimiento='gev.f_tgv_servicio_sel';\r\n\t\t$this->transaccion='tgv_SERVIC_SEL';\r\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\r\n\r\n\t\t$this->setParametro('tipo_interfaz','tipo_interfaz','varchar');\t\r\n\t\t//Definicion de la lista del resultado del query\r\n\t\t$this->captura('id_servicio','int4');\r\n\t\t$this->captura('estado','varchar');\r\n\t\t$this->captura('estado_reg','varchar');\r\n\t\t$this->captura('id_lugar_destino','int4');\r\n\t\t$this->captura('id_ep','int4');\r\n\t\t$this->captura('fecha_asig_fin','date');\r\n\t\t$this->captura('fecha_sol_ini','date');\r\n\t\t$this->captura('descripcion','varchar');\r\n\t\t$this->captura('id_lugar_origen','int4');\r\n\t\t$this->captura('cant_personas','int4');\r\n\t\t$this->captura('fecha_sol_fin','date');\r\n\t\t$this->captura('id_funcionario','int4');\r\n\t\t$this->captura('fecha_asig_ini','date');\r\n\t\t$this->captura('id_usuario_reg','int4');\r\n\t\t$this->captura('fecha_reg','timestamp');\r\n\t\t$this->captura('id_usuario_mod','int4');\r\n\t\t$this->captura('fecha_mod','timestamp');\r\n\t\t$this->captura('usr_reg','varchar');\r\n\t\t$this->captura('usr_mod','varchar');\r\n\t\t$this->captura('desc_funcionario','text');\r\n\t\t$this->captura('desc_lugar_ini','varchar');\r\n\t\t$this->captura('desc_lugar_des','varchar');\r\n\t\t$this->captura('id_funcionario_autoriz','int4');\r\n\t\t$this->captura('observaciones','varchar');\r\n\t\t$this->captura('desc_funcionario_autoriz','text');\r\n\t\t\r\n\t\t//Ejecuta la instruccion\r\n\t\t$this->armarConsulta();\r\n\t\t$this->ejecutarConsulta();\r\n\t\t//echo '--->'.$this->getConsulta(); exit;\r\n\t\t//Devuelve la respuesta\r\n\t\treturn $this->respuesta;\r\n\t}",
"public function Notify_owner_ready($requeridor, $vale)\n {\n if($this->email_check($requeridor['email'])){\n if($vale['id_estado']->id_estado_entrega == $this->CI->config->item('EnProcesoDeArmado')){\n\n $header = '[Sistema de Vales #'.$vale['id_vale'].'] Su vale se encuentra en proceso de armado';\n\n }elseif($vale['id_estado']->id_estado_entrega == $this->CI->config->item('ListoParaRetirar')){\n\n $header = '[Sistema de Vales #'.$vale['id_vale'].'] Su vale ya esta listo para ser retirado';\n\n }elseif($vale['id_estado']->id_estado_entrega == $this->CI->config->item('Retirado')){\n\n $header = '[Sistema de Vales #'.$vale['id_vale'].'] Su vale ha sido retirado';\n\n }elseif($vale['id_estado']->id_estado_entrega == $this->CI->config->item('RechazoPorFaltaDeStock')){\n\n $header = '[Sistema de Vales #'.$vale['id_vale'].'] Su vale ha sido Rechazado por falta de stock';\n }\n $body = $this->CI->load->view('email/update_status', $vale, TRUE);\n $dbdata = array(\n '_recipients' => $requeridor['email'],\n '_body' => $body,\n '_headers' => $header,\n );\n $this->CI->mailer->new_mail_queue($dbdata);\n }\n }",
"public function pasar_a_enviados()\n\t{\n\n $num_registro = $_REQUEST['num_registro'];\n $code = $_REQUEST['code'];\n $estatus = $_REQUEST['estatus'];\n\n $data_pago = array(\n\n 'estatus' => $estatus\n\n );\n\n $respuesta = false;\n\n //actualizacion de estatus segun la opcion que se selecciono\n $this->db->where('codeorden', $code);\n\n if ($this->db->update('PAGO_MA', $data_pago)){\n\n\n $consulta_correo_usuario = $this->db->query(\"SELECT correo FROM MA_LOGIN WHERE num_registro = '$num_registro'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n \n $correo_usuario = $respuesta_correo_usuario->correo;\n\n //data que se enviara a la taba de notificaciones para actualizar la notificacion del usuario\n $data_notificacion = array(\n\n 'correo' => $correo_usuario,\n 'tipo' => $estatus,\n 'num_registro' => $num_registro\n );\n\n //insercion de la notificaicion en la tabla de notificaicones para e usuario \n $this->db->insert('NOTIFICACIONES', $data_notificacion);\n\n //definicion de datos para llamar al servico de envio de correos electronicos de notificacion\n $this->load->model('admin/Correoservice_model');\n\n $respuesta_correo = $this->Correoservice_model->enviar_correo($correo_usuario, $estatus);\n\n //----------------------------\n\n $respuesta = true;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n \n }else{\n\n $respuesta = false;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n\n }\n \n }",
"public function pasar_a_pendientes_enviar()\n\t{\n\n $num_registro = $_REQUEST['num_registro'];\n $code = $_REQUEST['code'];\n $estatus = $_REQUEST['estatus'];\n\n $data_pago = array(\n\n 'estatus' => $estatus\n\n );\n\n $respuesta = false;\n\n //actualizacion de estatus segun la opcion que se selecciono\n $this->db->where('codeorden', $code);\n\n if ($this->db->update('PAGO_MA', $data_pago)){\n\n $consulta_correo_usuario = $this->db->query(\"SELECT correo FROM MA_LOGIN WHERE num_registro = '$num_registro'\");\n $respuesta_correo_usuario = $consulta_correo_usuario->row();\n \n $correo_usuario = $respuesta_correo_usuario->correo;\n\n //data que se enviara a la taba de notificaciones para actualizar la notificacion del usuario\n $data_notificacion = array(\n\n 'correo' => $correo_usuario,\n 'tipo' => $estatus,\n 'num_registro' => $num_registro\n );\n\n //insercion de la notificaicion en la tabla de notificaicones para e usuario \n $this->db->insert('NOTIFICACIONES', $data_notificacion);\n\n //definicion de datos para llamar al servico de envio de correos electronicos de notificacion\n $this->load->model('admin/Correoservice_model');\n\n $respuesta_correo = $this->Correoservice_model->enviar_correo($correo_usuario, $estatus);\n\n //----------------------------\n\n $respuesta = true;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n \n }else{\n\n $respuesta = false;\n\n $response = array(\n\n 'respuesta' => $respuesta\n\n );\n\n echo json_encode($response);\n\n }\n \n }",
"function ListaCuentasxpagarInactivas() {\n\n\t$sql = \"SELECT a.id, a.descripcion, a.fecha, a.total, b.descripcion AS nombre_proveedor\n\t\t\tFROM cuentaxpagar a\n\t\t\tINNER JOIN proveedor b ON a.proveedor_id = b.id\n\t\t\tWHERE a.estado = 'PAGADO'\";\n\n\t$db = new conexion();\n\t$result = $db->consulta($sql);\n\t$num = $db->encontradas($result);\n\n\t$respuesta->datos = [];\n\t$respuesta->mensaje = \"\";\n\t$respuesta->codigo = \"\";\n\n\tif ($num != 0) {\n\t\tfor ($i=0; $i < $num; $i++) {\n\t\t\t$respuesta->datos[] = mysql_fetch_array($result);\n\t\t}\n\n\t\t$respuesta->mensaje = \"Ok\";\n\t\t$respuesta->codigo = 1;\n\t} else {\n\t\t$respuesta->mensaje = \"No existen registros de cuentas por pagar!\";\n\t\t$respuesta->codigo = 0;\n\t}\n\n\treturn json_encode($respuesta);\n}",
"function RellenarIndice()\r\n {\r\n $this->AddPage();\r\n\r\n $this->Imprimir('2. Revisión y Análisis de las siguientes interrupciones:', 20, 10);\r\n\r\n $cont_causa500 = 1;\r\n $cont_imp = 1;\r\n $cont_pro = 1;\r\n\r\n foreach ($this->eventos as $evento)\r\n {\r\n if (Doctrine_Core::getTable('SAF_EVENTO_CONVOCATORIA')->getEventoConvocatoria($evento, $this->convocatoria)->getStatus() == 'analizado')\r\n {\r\n $this->ImprimirSubtituloIndice($evento, $cont_causa500, $cont_imp, $cont_pro);\r\n\r\n $fecha_evento = strftime(\"%A, %d/%m/%Y\", strtotime($evento->getFHoraIni()));\r\n $text = \"RI. \" . $evento->getCEventoD() . \" - Circuito \" . $evento->getCircuito() . \". \" . $fecha_evento . '. MVAmin: ' . $evento->getMvaMin();\r\n $this->Imprimir($text, 40, 10);\r\n }\r\n }\r\n }"
]
| [
"0.65694135",
"0.60701984",
"0.5975895",
"0.59224445",
"0.5905427",
"0.58851135",
"0.5815233",
"0.57684314",
"0.57457334",
"0.57273144",
"0.57076985",
"0.5697506",
"0.5679675",
"0.5657882",
"0.5654747",
"0.5643317",
"0.5640304",
"0.5611854",
"0.5601009",
"0.5590648",
"0.5582005",
"0.55753213",
"0.55417234",
"0.5528291",
"0.5522787",
"0.55145335",
"0.55110735",
"0.55100065",
"0.55095315",
"0.5504383"
]
| 0.6330012 | 1 |
ResourceIdentifier to the Associate that tried to perform the action. | public function getAssociate()
{
return $this->associate instanceof CustomerResourceIdentifierBuilder ? $this->associate->build() : $this->associate;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getResourceID()\n {\n return $this->get('ResourceID');\n }",
"public function getResourceID()\n {\n return $this->get('ResourceID');\n }",
"public function getResourceID()\n {\n return $this->get('ResourceID');\n }",
"public function getResourceID()\n {\n return $this->get('ResourceID');\n }",
"public function getResourceId()\n {\n $this->resourceId;\n }",
"public function getTargetResourceId()\n {\n if (array_key_exists(\"targetResourceId\", $this->_propDict)) {\n return $this->_propDict[\"targetResourceId\"];\n } else {\n return null;\n }\n }",
"public function getResourceId()\n {\n if (array_key_exists(\"resourceId\", $this->_propDict)) {\n return $this->_propDict[\"resourceId\"];\n } else {\n return null;\n }\n }",
"public function getRequestedId() {}",
"public function getResourceId();",
"public function getResourceId();",
"public function getResourceId()\n {\n return $this->resourceId;\n }",
"public function getResourceId()\n {\n return $this->resourceId;\n }",
"public function getUniqueObjectIdentifier();",
"public function getResourceAgentId()\n\t{\n\t\treturn 4;\n\t}",
"public function getId()\n {\n return $this->generateId($this->_active_controller, $this->_action);\n }",
"function getAssocId() {\n\t\treturn $this->getData('assocId');\n\t}",
"function getAssocId() {\n\t\treturn $this->getData('assocId');\n\t}",
"public function resourceId(): int\n {\n return $this->model->id;\n }",
"public function id()\n {\n return $this->resource->getKey();\n }",
"public function getIdentifier()\n {\n return TranslatableResourceIdentifier::forResource($this->type, $this->item->displayTitle($this->item->id()))\n ->setProject($this->project);\n }",
"public static function getResourceId($resource)\n {\n if (isset($resource->identifiers) || is_array($resource->identifiers)) {\n foreach ($resource->identifiers as $identifier) {\n if (substr($identifier, 0, 15) == 'action_network:') {\n return substr($identifier, 15);\n }\n }\n }\n }",
"function getAssociateId ( $locale )\n\t{\n\t\tif ( array_key_exists( $locale, $this->associate_table ) ) {\n\t\t\t$associatedid = $this->associate_table[$locale];\n\t\t} else {\n\t\t\t$associatedid = 'avh-amazon-20';\n\t\t}\n\t\treturn ($associatedid);\n\t}",
"public function getIdentifier() {}",
"public function getIdentifier() {}",
"public function getIdentifier() {}",
"public function getIdentifier() {}",
"public function getIdentifier() {}",
"public function getIdentifier() {}",
"public function getIdentifier() {}",
"public function getIdentifier() {}"
]
| [
"0.60011566",
"0.60011566",
"0.60010594",
"0.60010594",
"0.58655596",
"0.5842883",
"0.5798062",
"0.5776293",
"0.5731393",
"0.5731393",
"0.56962466",
"0.56962466",
"0.5688027",
"0.568266",
"0.56806403",
"0.5664145",
"0.5664145",
"0.56464344",
"0.56366056",
"0.56233793",
"0.5605649",
"0.56014085",
"0.55923575",
"0.55921346",
"0.55921346",
"0.55921346",
"0.55921346",
"0.55921346",
"0.55911624",
"0.55911624"
]
| 0.6232103 | 0 |
ResourceIdentifier to the BusinessUnit. | public function getBusinessUnit()
{
return $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getBusinessUnit()\n {\n if (is_null($this->businessUnit)) {\n /** @psalm-var stdClass|array<string, mixed>|null $data */\n $data = $this->raw(self::FIELD_BUSINESS_UNIT);\n if (is_null($data)) {\n return null;\n }\n\n $this->businessUnit = BusinessUnitResourceIdentifierModel::of($data);\n }\n\n return $this->businessUnit;\n }",
"public function getBusinessUnitID(): string;",
"public function getUnitId()\n {\n return $this->unit_id;\n }",
"public function getBusinessUnit();",
"public function getUnitId(): int\n {\n return $this->unitId;\n }",
"public function businessUnit() {\n return $this->belongsTo('Mr\\BusinessUnit');\n }",
"public function getOrganizationalUnitIdentifier()\n {\n return $this->organizational_unit_identifier;\n }",
"public function toUnit($toUnit) {\n\t\t\n\t\t\treturn call_user_func(array($this, $toUnit), array());\t\n\t\t}",
"public function getPurchaseUnitReferenceId()\n {\n return $this->purchase_unit_reference_id;\n }",
"public function setUnitId($var)\n {\n GPBUtil::checkInt32($var);\n $this->unit_id = $var;\n\n return $this;\n }",
"public function getBusinessUnitId(): ?int\n {\n return $this->businessUnitId;\n }",
"public function getUnitId(): ?string\n {\n return $this->unitId;\n }",
"public function setBusinessUnitId(?int $businessUnitId): self\n {\n $this->businessUnitId = $businessUnitId;\n\n return $this;\n }",
"public function getTopLevelUnit()\n {\n return $this->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit;\n }",
"public function getBunit()\n {\n return $this->bunit;\n }",
"public function getBusinessId()\n {\n return $this->id;\n }",
"public function setOrganizationalUnitIdentifier($var)\n {\n GPBUtil::checkString($var, True);\n $this->organizational_unit_identifier = $var;\n\n return $this;\n }",
"function getUnitId() {\n $ugl = KTUtil::getTableName(\"users_groups\");\n $g = KTUtil::getTableName(\"groups\");\n $aQuery = array(\n \"SELECT DISTINCT g.unit_id AS unit_id FROM $ugl AS ugl INNER JOIN $g AS g ON ugl.group_id = g.id WHERE ugl.user_id = ?\",\n array($this->iId),\n );\n return DBUtil::getOneResultKey($aQuery, 'unit_id');\n }",
"public function getParentUnit()\n {\n return $this->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit;\n }",
"public function getUnit()\n {\n return $this->hasOne(Unit::className(), ['unit_id' => 'unit_id']);\n }",
"public function setTargetUnitId($targetUnit)\n {\n if ($targetUnit instanceof axis\\IUnit) {\n $targetUnit = $targetUnit->getUnitId();\n }\n\n $targetUnit = (string)$targetUnit;\n\n if ($targetUnit != $this->_targetUnitId) {\n $this->_hasChanged = true;\n }\n\n $this->_targetUnitId = $targetUnit;\n return $this;\n }",
"public function getBusinessId()\n {\n return $this->business_id;\n }",
"public function getBusinessId()\n {\n return $this->business_id;\n }",
"public function getBusinessId()\n {\n return $this->business_id;\n }",
"public function getBusinessId()\n {\n return $this->business_id;\n }",
"public function getBusinessId()\n {\n return $this->business_id;\n }",
"public function getOrganizationalUnit()\n {\n return $this->organizational_unit;\n }",
"public function getUnit();",
"public function setUnitIdAttribute($input)\n {\n $this->attributes['unit_id'] = $input ? $input : null;\n }",
"public function getUnitName()\n {\n return $this->unit_name;\n }"
]
| [
"0.6930536",
"0.6637339",
"0.63044316",
"0.6227665",
"0.59934264",
"0.58898234",
"0.5874441",
"0.5657425",
"0.54857695",
"0.54387206",
"0.54315835",
"0.5357699",
"0.5284133",
"0.515719",
"0.5157045",
"0.5144215",
"0.51244456",
"0.5070365",
"0.50633174",
"0.5029309",
"0.50277185",
"0.49939957",
"0.49939957",
"0.49939957",
"0.49939957",
"0.49939957",
"0.49558988",
"0.49172527",
"0.4781188",
"0.47759616"
]
| 0.7044439 | 0 |
Doctype declaration of the theme. | function blog_way_doctype_action() {
?><!DOCTYPE html> <html <?php language_attributes(); ?>><?php
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function charity_create_doctype() {\n $content = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' . \"\\n\";\n $content .= '<html xmlns=\"http://www.w3.org/1999/xhtml\"';\n echo apply_filters('charity_create_doctype', $content);\n}",
"protected function printDoctype()\n {\n echo '<!DOCTYPE html>';\n echo \"\\n\";\n }",
"protected function _initDoctype()\r\n {\r\n// $this->bootstrap('view');\r\n// $view = $this->getResource('view');\r\n//\r\n// $view->headTitle('Module Frontend');\r\n// $view->headLink()->appendStylesheet('/css/clear.css');\r\n// $view->headLink()->appendStylesheet('/css/main.css');\r\n// $view->headScript()->appendFile('/js/jquery.js');\r\n// $view->doctype('XHTML1_STRICT');\r\n //$view->navigation = $this->buildMenu();\r\n }",
"function doctype(){\n\t\t\t$this->content['navigation']['ra_nav'] = ra_sub_nav();\n\t\t\tinclude( DUDE_THEME_DIR.'/inc/menu_icon.php'); // menu icons\n\t\t}",
"function _wraith_doctype() {\n return (module_exists('rdfx')) ? '<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML+RDFa 1.1//EN\"' . \"\\n\" . '\"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\">' : '<!DOCTYPE html>' . \"\\n\";\n}",
"public function setup_theme()\n {\n }",
"function catalyst_get_doctype() {\n $layout = catalyst_get_layout();\n return $layout->getDoctype();\n}",
"function autodidact_theme_setup() {\n\n}",
"function mydoctype() {\n\t\tprint '<!doctype html>';\n\t}",
"function doctype( $type = 'xhtml1-strict' )\n\t{\n\t\tstatic $doctypes;\n\n\t\tif ( ! is_array( $doctypes ) )\n\t\t{\n\t\t\tif ( is_file( APPSPATH . 'config/doctypes.php' ) )\n\t\t\t{\n\t\t\t\tinclude( APPSPATH . 'config/doctypes.php' );\n\t\t\t}\n\n\t\t\tif ( is_file( APPSPATH . 'config/' . strtolower( ENVIRONMENT ) . '/doctypes.php' ) )\n\t\t\t{\n\t\t\t\tinclude( APPSPATH . 'config/' . strtolower( ENVIRONMENT ) . '/doctypes.php' );\n\t\t\t}\n\n\t\t\tif ( empty( $_doctypes ) OR ! is_array( $_doctypes ) )\n\t\t\t{\n\t\t\t\t$doctypes = [ ];\n\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\t$doctypes = $_doctypes;\n\t\t}\n\n\t\treturn isset( $doctypes[ $type ] ) ? $doctypes[ $type ] : FALSE;\n\t}",
"public function theme()\n {\n }",
"public function theme_installer()\n {\n }",
"public function setDefaultDesignTheme();",
"public function theme() {\n // Do nothing by default\n }",
"protected function renderDoctype() {\n\t\t$doctype = $this->def->doctype;\n\t\t$ret = '';\n\t\t$ret .= $this->start( 'table' );\n\t\t$ret .= $this->element( 'caption', 'Doctype' );\n\t\t$ret .= $this->row( 'Name', $doctype->name );\n\t\t$ret .= $this->row( 'XML', $doctype->xml ? 'Yes' : 'No' );\n\t\t$ret .= $this->row( 'Default Modules', implode( $doctype->modules, ', ' ) );\n\t\t$ret .= $this->row( 'Default Tidy Modules', implode( $doctype->tidyModules, ', ' ) );\n\t\t$ret .= $this->end( 'table' );\n\n\t\treturn $ret;\n\t}",
"function doctype($html_ver)\n{\n if ($html_ver == '5') {\n $public = 'html' ;\n $link = '' ;\n }\n if ($html_ver == '4') {\n $public = 'HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" ' ;\n $link = '\"http://www.w3.org/TR/html4/loose.dtd\"' ;\n }\n if ($html_ver == '1.1') {\n $public = 'html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" ' ;\n $link = '\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"' ;\n }\n echo '<!DOCTYPE ' . $public . $link . '>' ;\n NL() ;\n}",
"public static function doctype($type = 'xhtml1-trans')\n\t{\n\t\tif(self::$doctypes === null)\n\t\t{\n\t\t\tself::$doctypes = Kohana::$config->load('doctypes')->as_array();\n\t\t}\n\n\t\tif(is_array(self::$doctypes) and isset(self::$doctypes[$type]))\n\t\t{\n\t\t\tif($type == \"html5\")\n\t\t\t{\n\t\t\t\tself::$html5 = true;\n\t\t\t}\n\t\t\treturn self::$doctypes[$type];\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}",
"public function setup_theme()\n {\n add_theme_support('title-tag');\n\n /* WP custom logo */\n add_theme_support(\n 'custom-logo',\n [\n 'header-text' => [\n 'site-title',\n 'site-description'\n ],\n 'height' => 100,\n 'width' => 100,\n ]\n );\n\n\n /* Add theme support for selective refresh for widgets */\n add_theme_support('customize-selective-refresh-widgets');\n\n /* Add default posts and comments RSS feed links to head */\n add_theme_support('automatic-feed-links');\n\n /**\n * Switch default core markup for search form, comment form, comment-list, gallery, caption, script and style\n * to output valid HTML5.\n */\n add_theme_support(\n 'html5',\n [\n 'search-form',\n 'comment-form',\n 'comment-list',\n 'gallery',\n 'caption',\n 'script',\n 'style',\n ]\n );\n\n /* Gutenberg theme support */\n add_theme_support('wp-block-styles');\n add_theme_support('align-wide');\n add_theme_support('editor-styles');\n\n global $content_width;\n if (!isset($content_width)) $content_width = 1240;\n }",
"function child_create_doctype() {\r\n\t$content = '<!DOCTYPE html>' . \"\\n\";\r\n\t$content .= '<html';\r\n\treturn $content;\r\n}",
"function setDoctype ($dt) {\n\t\t$this->_doctype = (array_key_exists($dt,$this->_dtd)) ? $dt : \"trans\";\n\t\treturn true;\n\t}",
"function tsd_setup() {\n\t\t// Add default posts and comments RSS feed links to head.\n\t\tadd_theme_support( 'automatic-feed-links' );\n\n\t\t/*\n\t\t * Let WordPress manage the document title.\n\t\t * By adding theme support, we declare that this theme does not use a\n\t\t * hard-coded <title> tag in the document head, and expect WordPress to\n\t\t * provide it for us.\n\t\t */\n\t\tadd_theme_support( 'title-tag' );\n\n\t\t/*\n\t\t * Enable support for Post Thumbnails on posts and pages.\n\t\t *\n\t\t * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/\n\t\t */\n\t\tadd_theme_support( 'post-thumbnails' );\n\n\t\t// This theme uses wp_nav_menu() in one location.\n\t\tregister_nav_menus( array(\n\t\t\t'menu-topbar' => esc_html__( 'Top Bar', 'tsd' ),\n\t\t\t'menu-primary' => esc_html__( 'Primary', 'tsd' ),\n\t\t) );\n\n\t\t/*\n\t\t * Switch default core markup for search form, comment form, and comments\n\t\t * to output valid HTML5.\n\t\t */\n\t\tadd_theme_support( 'html5', array(\n\t\t\t'search-form',\n\t\t\t'comment-form',\n\t\t\t'comment-list',\n\t\t\t'gallery',\n\t\t\t'caption',\n\t\t) );\n\t}",
"public function addDoctype ($type = 'html5')\n\t{\n\n\t\t$doctypes = array (\n\t\t\t'xhtml11' => '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">',\n\t\t\t'xhtml1-strict' => '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">',\n\t\t\t'xhtml1-trans' => '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">',\n\t\t\t'xhtml1-frame' => '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">',\n\t\t\t'html5' => '<!DOCTYPE html>',\n\t\t\t'html4-strict' => '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">',\n\t\t\t'html4-trans' => '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">',\n\t\t\t'html4-frame' => '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">',\n\t\t);\n\n\t\tif (is_array($doctypes) and isset($type)) {\n\t\t\treturn $doctypes[$type];\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"function writeDocumentType() {\n echo '<!DOCTYPE html>';\n}",
"protected function scanDoctype()\n {\n return $this->scanInput('/^!!! *(\\w+)?/', 'doctype');\n }",
"public function themeSetup()\n {\n add_theme_support('title-tag');\n add_theme_support('post-thumbnails');\n add_theme_support('html5', [\n 'search-form',\n 'comment-form',\n 'comment-list',\n 'gallery',\n 'caption',\n ]);\n\n add_theme_support('align-wide');\n\n add_theme_support('editor-color-palette', \\Fp\\Fabric\\fabric()->config('theme.colours'));\n\n // Disables custom colors in block color palette.\n add_theme_support('disable-custom-colors');\n }",
"public function getDesignTheme();",
"public function add_theme_support() {\n\t}",
"public function get_theme_root()\n {\n }",
"function MicroBuilder_Theme_Factory () {}",
"function um_theme_setup() {\n\t\tload_theme_textdomain( 'um-theme' );\n\n\t\t/*\n\t * Add default posts and comments RSS feed links to head.\n\t */\n\t\tadd_theme_support( 'automatic-feed-links' );\n\n\t\t/*\n\t\t * Let WordPress manage the document title.\n\t\t * By adding theme support, we declare that this theme does not use a\n\t\t * hard-coded <title> tag in the document head, and expect WordPress to\n\t\t * provide it for us.\n\t\t */\n\t\tadd_theme_support( 'title-tag' );\n\n\t\t/*\n\t\t * Enable support for Post Thumbnails on posts and pages.\n\t\t *\n\t\t * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails\n\t\t */\n\t\tadd_theme_support( 'post-thumbnails' );\n\t\tadd_image_size( 'um-theme-thumb', 820, 400, array( 'center', 'center' ) );\n\t\tset_post_thumbnail_size( 'um-theme-thumb', 820, 400 );\n\n\t\t/*\n\t\t * Enable support responsive embedded content\n\t\t * See: https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#responsive-embedded-content\n\t\t */\n\t\tadd_theme_support( 'responsive-embeds' );\n\n\t\t// Add support for default block styles.\n\t\tadd_theme_support( 'wp-block-styles' );\n\n\t\t// Add support for full and wide align images.\n\t\tadd_theme_support( 'align-wide' );\n\n\t\t// Adds support for editor color palette.\n\t\tadd_theme_support( 'editor-color-palette', array(\n\t\t array(\n\t\t 'name' \t=> __( 'sky blue', 'um-theme' ),\n\t\t 'slug' \t=> 'strong-magenta',\n\t\t 'color' => '#6596ff',\n\t\t ),\n\t\t array(\n\t\t 'name' \t=> __( 'light grayish magenta', 'um-theme' ),\n\t\t 'slug' \t=> 'light-grayish-magenta',\n\t\t 'color' => '#333333',\n\t\t ),\n\t\t array(\n\t\t 'name' \t=> __( 'very light gray', 'um-theme' ),\n\t\t 'slug' \t=> 'very-light-gray',\n\t\t 'color' => '#eeeeee',\n\t\t ),\n\t\t array(\n\t\t 'name' \t=> __( 'very dark gray', 'um-theme' ),\n\t\t 'slug' \t=> 'very-dark-gray',\n\t\t 'color' => '#444444',\n\t\t ),\n\t\t) );\n\n\t\t/**\n\t\t * Register custom Custom Navigation Menus.\n\t\t * This theme uses wp_nav_menu() in the following locations.\n\t\t *\n\t\t * @link https://developer.wordpress.org/reference/functions/register_nav_menus/\n\t\t * @since 1.0.0\n\t\t */\n\t\tregister_nav_menus(\n\t\t\t/**\n\t\t\t * Filter registered nav menus.\n\t\t\t *\n\t\t\t * @since 1.0.0\n\t\t\t *\n\t\t\t * @var array\n\t\t\t */\n\t\t\t(array) apply_filters( 'um_theme_nav_menus',\n\t\t\t\tarray(\n\t\t\t\t\t'header-top' \t\t=> esc_html__( 'Top Bar Menu', 'um-theme' ),\n\t\t\t\t\t'primary' \t\t\t=> esc_html__( 'Primary Menu', 'um-theme' ),\n\t\t\t\t\t'header-bottom' \t=> esc_html__( 'Bottom Bar Menu', 'um-theme' ),\n\t\t\t\t\t'profile-menu' \t\t=> esc_html__( 'User Header Menu', 'um-theme' ),\n\t\t\t\t\t'footer' \t\t\t=> esc_html__( 'Footer Menu', 'um-theme' ),\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t\t// Add theme support for Custom Logo.\n\t\tadd_theme_support( 'custom-logo' );\n\n\t\t/*\n\t\t * Switch default core yorkup for search form, comment form, and comments\n\t\t * to output valid HTML5.\n\t\t */\n\t\tadd_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );\n\n\t\tadd_theme_support( 'widget-customizer' );\n\n\t /*\n\t * Enable support for Customizer Selective Refresh.\n\t * See: https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/\n\t */\n\t\tadd_theme_support( 'customize-selective-refresh-widgets' );\n\n\t\tadd_theme_support( 'custom-background', (array) apply_filters( 'um_custom_background_args',\n\t\t\tarray(\n\t\t\t\t'default-color' => '#f6f9fc',\n\t\t\t\t'default-image' => '',\n\t\t\t)\n\t\t) );\n\n\t\t// Set the default content width.\n\t\t$GLOBALS['content_width'] = (int) apply_filters( 'um_content_width', 640 );\n\n\t\tadd_editor_style();\n\t}"
]
| [
"0.6592657",
"0.6511228",
"0.63849807",
"0.6384269",
"0.63479245",
"0.6294482",
"0.62421405",
"0.6236032",
"0.6170887",
"0.60617346",
"0.60143673",
"0.60125244",
"0.6009651",
"0.59949064",
"0.5977158",
"0.5935702",
"0.5901534",
"0.5829364",
"0.5809068",
"0.5804479",
"0.5796902",
"0.57746035",
"0.5750326",
"0.5718624",
"0.5657362",
"0.5646345",
"0.5601773",
"0.56000954",
"0.5570797",
"0.5511381"
]
| 0.65594906 | 1 |
/ $Id: cleanName.inc.php 2 20110606 12:08:34Z siekiera $ XTCommerce community made shopping Copyright (c) 2003 XTCommerce Released under the GNU General Public License | function cleanName($name) {
$search_array=array('Р Т‘','Р”','С†','Р В¦','РЎРЉ','Р В¬','ä','Ä','ö','Ö','ü','Ü');
$replace_array=array('ae','Ae','oe','Oe','ue','Ue','ae','Ae','oe','Oe','ue','Ue');
$name=str_replace($search_array,$replace_array,$name);
$replace_param='/[^a-zA-Z0-9]/';
$name=preg_replace($replace_param,'-',$name);
return $name;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sanitize_name( $name ) {\r\n\t\t$name = sanitize_title( $name ); // taken from WP's wp-includes/functions-formatting.php\r\n\t\t$name = str_replace( '-', '_', $name );\r\n\r\n\t\treturn $name;\r\n\t}",
"function sanitize($name)\n {\n return preg_replace('/[^A-Za-z0-9\\-]/', '', $name);\n }",
"public function cleanToName($name){\n // Remove empty space\n $name = str_replace(' ', '', $name);\n // Remove special character\n $name = preg_replace('/[^A-Za-z0-9\\-]/', '', $name);\n // Return without numbers\n return preg_replace('/[0-9]+/', '', $name);\n \n }",
"function get_name_sanitized():string{\n $sanitize_name = $this->name ;\n foreach (self::SANITIZED_WORDS as $old => $new) {\n $sanitize_name = str_replace($old, $new, $sanitize_name);\n }\n return $sanitize_name;\n }",
"protected function prepareName($name) {\n\t$name = strip_tags(trim($name));\n\t$name = preg_replace('/[^\\w\\s\\-А-Яа-я]/u', '', $name);\n\t$name = mb_strtolower($name, Yii()->charset);\n\t//$name = mb_ucfirst($name);\n\t$name = mb_ucwords($name);\n\treturn $name;\n }",
"function cp_make_custom_name($cname) {\r\n\r\n\t$cname = preg_replace('/[^a-zA-Z0-9\\s]/', '', $cname);\r\n\t$cname = 'cp_' . str_replace(' ', '_', strtolower(substr(appthemes_clean($cname), 0, 30)));\r\n\r\n\treturn $cname;\r\n}",
"function _fixName($field_or_value_name) {\r\n if ($field_or_value_name == \"\")\r\n return \"\";\r\n // convert space into underscore\r\n $result = preg_replace(\"/ /\", \"_\", strtolower($field_or_value_name));\r\n // strip all non alphanumeric chars\r\n $result = preg_replace(\"/\\W/\", \"\", $result);\r\n return $result;\r\n }",
"public function cleanName()\n {\n $name = strtolower($this->name);\n $name = str_replace('á', 'a', $name);\n $name = str_replace('é', 'e', $name);\n $name = str_replace('í', 'i', $name);\n $name = str_replace('ó', 'o', $name);\n $name = str_replace('ú', 'u', $name);\n $name = str_replace('Á', 'a', $name);\n\n return $name;\n }",
"function cleanName($newUname){\n\t\t$newUname = trim($newUname);\n\t\t$newUname = stripslashes($newUname);\n\t\t$newUname = htmlspecialchars($newUname);\n\t\treturn $newUname;\n\t}",
"private function cleanName($name): string\n {\n $name = filter_var(trim($name), FILTER_SANITIZE_STRING);\n return preg_replace(\"/\\s+/\", ' ', $name);\n }",
"function sanitizeName($string) {\n $name = $string;\n // squash whitespace\n $name = trim(preg_replace('#\\s+#', ' ', $name));\n // replace spacers with hyphens\n $name = preg_replace(\"#[\\._ ]#\", \"-\", $name);\n // crush everything else\n $name = strtolower(preg_replace(\"#[^A-Za-z0-9-]#\", \"\", $name));\n return $name;\n}",
"function validName($name) {\n \n return preg_replace('/\\s+/', '_',$name);\n\n}",
"function sanitizeName() {\n $pattern = \"/[0-9`!@#$%^&*()_+\\-=\\[\\]{};':\\\"\\\\|,.<>\\/?~]/\";\n if (!preg_match($pattern, $this->fname) && !preg_match($pattern, $this->lname)) {\n $this->fname = trim($this->fname);\n $this->lname = trim($this->lname);\n } else {\n die(\"Error. Check your form data\");\n }\n }",
"function MCW_make_name_acceptable($name) {\n \n $name = strtr($name,\" \",\"_\");\n $name=preg_replace(\"/[^a-zA-Z0-9_äöüÄÖÜ]/\" , \"\" , $name);\n return $name;\n }",
"public function fixerCleaner($name)\n\t{\n\t\t//Extensions.\n\t\t$cleanerName = preg_replace('/([-_](proof|sample|thumbs?))*(\\.part\\d*(\\.rar)?|\\.rar)?(\\d{1,3}\\.rev\"|\\.vol.+?\"|\\.[A-Za-z0-9]{2,4}$|$)/i',\n\t\t\t\t\t\t\t\t\t' ',\n\t\t\t\t\t\t\t\t\t$name);\n\t\t//Remove stuff from the start.\n\t\t$cleanerName = preg_replace('/^(Release Name|sample-)/i', ' ', $cleanerName);\n\t\t//Replace multiple spaces with 1 space\n\t\t$cleanerName = preg_replace('/\\s\\s+/i', ' ', $cleanerName);\n\t\t//Remove invalid characters.\n\t\t$cleanerName = trim(utf8_encode(preg_replace('/[^(\\x20-\\x7F)]*/', '', $cleanerName)));\n\t\treturn $cleanerName;\n\t}",
"private function filterName($name)\n {\n $name = ucfirst($name);\n $name = str_replace('_', ' ', $name);\n \n return $name;\n }",
"private static function _cleanName($text) \r\n {\r\n return $text;\r\n }",
"function clean($name, $max) {\n\t\t# fake other fields or extra entries\n\t\t$name = ereg_replace(\"[[:space:]]\", ' ', $name);\n\t\t# Escape < > and and & so they \n\t\t# can't mess withour HTML markup\n\t\t$name = ereg_replace('&', '&', $name);\n\t\t$name = ereg_replace('<', '<', $name);\n\t\t$name = ereg_replace('>', '>', $name);\n\t\t# Don't allow excessively long entries\n\t\t$name = substr($name, 0, $max);\n\t\t# Undo PHP's \"magic quotes\" feature, which has\n\t\t# inserted a \\ in front of any \" characters.\n\t\t# We undo this because we're using a file, not a\n\t\t# database, so we don't want \" escaped. Those\n\t\t# using databases should do the opposite:\n\t\t# call addslashes if get_magic_quotes_gpc()\n\t\t# returns false.\n\t\treturn $name;\n\t}",
"function safe_name($name) {\n return preg_replace(\"/\\W/\", \"_\", $name);\n }",
"private function cleanname($name)\n\t{\n\t\tdo {\n\t\t\t$original = $name;\n\t\t\t$name = preg_replace(\"/[\\{\\[\\(]\\d+[ \\.\\-\\/]+\\d+[\\]\\}\\)]/iU\", \" \", $name);\n\t\t\t$name = preg_replace(\"/[\\x01-\\x1f\\!\\?\\[\\{\\}\\]\\/\\:\\|]+/iU\", \" \", $name);\n\t\t\t$name = str_replace(\" \", \" \", $name);\n\t\t\t$name = preg_replace(\"/^[\\s\\.]+|[\\s\\.]{2,}$/iU\", \"\", $name);\n\t\t\t$name = str_replace(\" - - \", \" - \", $name);\n\t\t\t$name = preg_replace(\"/^[\\s\\-\\_\\.]/iU\", \"\", $name);\n\t\t\t$name = trim($name);\n\t\t} while ($original != $name);\n\n\t\treturn mb_strimwidth($name, 0, 255);\n\t}",
"function submitted_events_strip_surname($name) {\n\t$parts = explode ( ' ', $name );\n\tif (sizeof ( $parts ) > 1) {\n\t\treturn $parts [0] . ' ' . substr ( $parts [1], 0, 1 );\n\t} else {\n\t\treturn $name;\n\t}\n}",
"protected function _normalizeHeader($name) {\r\n\t\t$filtered = str_replace ( array (\r\n\t\t\t\t'-',\r\n\t\t\t\t'_' \r\n\t\t), ' ', ( string ) $name );\r\n\t\t$filtered = ucwords ( strtolower ( $filtered ) );\r\n\t\t$filtered = str_replace ( ' ', '-', $filtered );\r\n\t\treturn $filtered;\r\n\t}",
"function strip_url_console($name)\n\t{\n\t\t/*$name = trim($name);\n\t\t$name = preg_replace(\"/[^0-9a-zA-Z-]+/\", \"\", $name);\n\t\t$name = str_replace(\"---\",\"-\",$name);\n\t\t$name = str_replace(\"----\",\"-\",$name);\n\t\t$name = str_replace(\"--\",\"-\",$name);\n\t\treturn $name;*/\n\t\t$name = trim($name);\n\t\t$name = str_replace(\" \",\"-\",$name);\n\t\t$name = str_replace(\"_\",\"-\",$name);\n\t\t$name = preg_replace(\"/[^0-9a-zA-Z-]+/\", \"\", $name);\n\t\t$name = str_replace(\"----\",\"-\",$name);\n\t\t$name = str_replace(\"---\",\"-\",$name);\n\t\t$name = str_replace(\"--\",\"-\",$name);\n\t\t$name = str_replace(\".\",\"-\",$name);\n\t\treturn strtolower($name);\n\t}",
"function _name_check($str){\n }",
"function validateName()\n {\n global $inName, $validForm, $nameErrMsg;\t\t//Use the GLOBAL Version of these variables instead of making them local\n $nameErrMsg = \"\";\t\t\t\t\t\t\t\t//Clear the error message.\n if($inName==\"\")\n {\n $validForm = false;\t\t\t\t\t//Invalid name so the form is invalid\n $nameErrMsg = \"Name is required\";\t//Error message for this validation\n }\n\n else if(!preg_match(\"/^[a-zA-Z\\s]+$/\",$inName)){\n $validForm=false;\n $nameErrMsg=\"Please use only letters\";\n }\n\n else\n {\n $inLname = trim($inName);\t\t\t\t//Removes leading/trailing characters\n $inLname = htmlspecialchars($$inName);\t//converts special characters\n }\n }",
"function clean_filename($filename)\n\t{\n//replaces all characters that are not alphanumeric with the exception of the . for filename usage\n\t\t$realname = preg_replace(\"/[^a-zA-Z0-9\\.]/\", \"\", strtolower($filename));\n\t\treturn $realname;\n\t}",
"function formatName(array $name)\r\n {\r\n return $name['last_name'] . ' ' . preg_replace('/\\b([A-Z]).*?(?:\\s|$)+/','$1',$name['first_name']);\r\n }",
"function fixName($str = \"\") {\n\tif ( preg_match(\"/[A-Z]{3}/\", $str) ) {\n\t\t$str = strtolower($str);\n\t\t// First letter after hyphen\n\t\t$str = preg_replace(\"/(-[A-Z])/\", \"$1\", $str);\n\t\tif ( \"$1\" != \"\" ) {\n\t\t\t$upper1 = strtoupper(\"$1\");\n\t\t\t$str = str_replace(\"$1\", \"$upper1\", $str);\n\t\t}\n\t\t//$str = preg_replace(\"/(-[A-Z])/\", strtoupper($1), $str); // T_LNUMBER error\n\t\t$str = ucwords($str);\n\t}\n\t// Is all-lowercase + hyphen space apostrophe\n\telseif ( preg_match(\"/^[- 'a-z]+$/\", $str) ) {\n\t\t// Need exceptions: \"di\", \"de la\", ... ?\n\t\t$str = ucwords($str);\n\t}\n\t// Already mixed-case\n\telse {\n\t\t1;\n\t}\n\t$str = str_replace(\"'\", \"''\", $str);\n\treturn($str);\n//fixName\n}",
"protected function _normalizeHeader($name)\r\n\t{\r\n\t\t$filtered = str_replace(array('-', '_'), ' ', (string)$name);\r\n\t\t$filtered = ucwords(strtolower($filtered));\r\n\t\t$filtered = str_replace(' ', '-', $filtered);\r\n\t\treturn $filtered;\r\n\t}",
"private function cleanNameText($text)\n {\n // TODO: unfinished\n $result = qtype_kekule_mol_naming_utils::cleanName($text, array(\n 'replaceunstandardchars' => $this->replaceunstandardchars,\n 'removespaces' => $this->removespaces,\n\t 'strictstereoflags' => $this->strictstereoflags\n ));\n return $result;\n }"
]
| [
"0.73428327",
"0.7171061",
"0.7162467",
"0.7135334",
"0.7082427",
"0.704659",
"0.7044634",
"0.699476",
"0.69802916",
"0.6972818",
"0.69598013",
"0.6958894",
"0.6942777",
"0.6896016",
"0.6827018",
"0.6795058",
"0.6778622",
"0.6758495",
"0.6713417",
"0.6568364",
"0.65443236",
"0.64825463",
"0.6477636",
"0.6475776",
"0.64464587",
"0.6433876",
"0.64239925",
"0.6420524",
"0.64197195",
"0.6404011"
]
| 0.7192409 | 1 |
Returns the user's tag, e.g. "JamesBond0007" | function getTag(): string
{
return $this->username."#".$this->discriminator;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getUserTag()\n {\n return $this->UserTag;\n }",
"public function getTag(): string\n {\n return $this->tag;\n }",
"function get_tag_name( $tag ) {\n $tag_name = get_tag_data( $tag , 'tag_name' );\n return $tag_name;\n}",
"public function getTag()\n\t{\n\t\treturn $this->data['tag'];\n\t}",
"public function getTag(): string;",
"public function getTag()\n {\n return $this->get('tag');\n }",
"function getUserTags(){\n\n\t\t/* Fetch user info from Flickr */\n\t\t$tags = $this->askFlickr('tags.getListUserPopular','user_id='.$this->user);\n\n\t\t/* Return Tags */\n\t\treturn $tags;\n\t}",
"public function getTag()\n {\n return $this->_params['tag'];\n }",
"public function tag(): string\n {\n return $this->tag;\n }",
"public static function ADMIN_ARCHIVE_SEARCH_USER_TAG(){\n\t $SQL_String = \"SELECT * FROM user_tags WHERE owner=:owner AND tag_term=:tag;\";\n\t return $SQL_String;\n\t}",
"private function getTag()\n {\n return $this->tag;\n }",
"protected function getHumanTags()\n {\n $tags = explode('|', $this->get('tags'));\n\n return implode(' & ', $tags);\n }",
"public function getTag()\n {\n return $this->name;\n }",
"function translate_variable( $tag )\n{\n global $wgParser, $wgUser;\n \n switch ( strtoupper($tag) ) {\n \n case 'USERGROUPS': // @@USERGROUPS@@ pseudo-variable: Groups this user belongs to\n $wgParser->disableCache(); // Mark this content as uncacheable\n return( implode( \",\", $wgUser->getGroups() ) );\n \n case 'USERID': // @@USERID@@ pseudo-variable: User Name, blank if anonymous\n $wgParser->disableCache(); // Mark this content as uncacheable\n # getName() returns IP for anonymous users, so check if logged in first\n return( $wgUser->isLoggedIn() ? $wgUser->getName() : '' );\n \n }\n}",
"public function getTag();",
"public function getTag();",
"public function getNameIdentificationBd() {\n global $advancedCustomUser;\n if (!empty($this->name) && empty($advancedCustomUser->doNotIndentifyByName)) {\n return $this->name;\n }\n if (!empty($this->email) && empty($advancedCustomUser->doNotIndentifyByEmail)) {\n return $this->email;\n }\n if (!empty($this->user) && empty($advancedCustomUser->doNotIndentifyByUserName)) {\n return $this->user;\n }\n if (!empty($this->channelName)) {\n return $this->channelName;\n }\n return __(\"Unknown User\");\n }",
"public function tag(): string;",
"public function getTag()\n {\n return $this->tag;\n }",
"public function getTag()\n {\n return $this->tag;\n }",
"public function getTag()\n {\n return $this->tag;\n }",
"public\n\tfunction getTagLabel(): string {\n\t\treturn $this->tagLabel;\n\t}",
"public function tag()\r\n\t{\r\n\t\treturn $this->tag;\r\n\t}",
"public function tag()\r\n\t{\r\n\t\treturn $this->tag;\r\n\t}",
"public function getUserIdentifier(): string\n\t{\n\t\treturn (string)$this->siret;\n\t}",
"public function getUserIdentifier(): string\n {\n return ($this->token ?? ($this->appkey ?? ''));\n }",
"public function getUserIdentifier(): string\n {\n return (string) $this->username;\n }",
"public function tagsInUsername() {\n\t\t$this->messages[] = \"Användarnamnet innehållet ogiltiga tecken.\";\n\t}",
"public static function username() {\n return 'user_id';\n }",
"private static function user_id_tag($user_id){\n\t\tif ($user_id == NULL){\n\t\t\tthrow new Exception(\"User_id_tag for memcache can't be generated ... Current User_id not set\");\n\t\t\tKohana::$log->add(Log::ERROR, \"user_id for Memcache key generation is NULL\");\n\t\t}\n\t\treturn \"_\" . $user_id . \"_#\";\n\t}"
]
| [
"0.7834184",
"0.64298534",
"0.64107645",
"0.63278574",
"0.6307316",
"0.6268844",
"0.6222148",
"0.62217176",
"0.6199497",
"0.6147912",
"0.6125331",
"0.61216825",
"0.6113474",
"0.60477436",
"0.59766585",
"0.59766585",
"0.59397507",
"0.5933661",
"0.5917864",
"0.5917864",
"0.5917864",
"0.58562076",
"0.585107",
"0.585107",
"0.5849341",
"0.5842754",
"0.5839668",
"0.58316004",
"0.58303916",
"0.58034444"
]
| 0.7134426 | 1 |
Returns the string needed to mention this user. | function getMention(): string
{
return "<@".$this->id.">";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function mention() {\n\n return view('admin.mention');\n }",
"protected function author()\n {\n if ($this->presenter->wasByCurrentUser() || !$this->wrappedObject->user_id) {\n return 'You ';\n }\n\n if (!$this->wrappedObject->security) {\n return 'This user ';\n }\n\n return $this->presenter->author().' ';\n }",
"protected function user()\n {\n if ($this->wrappedObject->security) {\n return ' this user\\'s ';\n }\n\n $user = $this->wrappedObject->revisionable()->withTrashed()->first(['first_name', 'last_name']);\n\n return ' '.$user->first_name.' '.$user->last_name.'\\'s ';\n }",
"public function getUsername(): string\n {\n return (string) $this->pseudo;\n }",
"public function getUsernameMedico() {\n return parent::getUsernameUser();\n }",
"public function tryMention($escape_markdown = false)\n {\n //TryMention only makes sense for the User and Chat entity.\n// if (!($this instanceof User || $this instanceof Chat)) {\n// return null;\n// }\n\n\n //Try with the username first...\n $name = $this->getProperty('username');\n $is_username = $name !== null;\n\n if ($name === null) {\n //...otherwise try with the names.\n $name = $this->getProperty('first_name');\n $last_name = $this->getProperty('last_name');\n if ($last_name !== null) {\n $name .= ' ' . $last_name;\n }\n }\n\n\n if ($escape_markdown) {\n $name = $this->escapeMarkdown($name);\n }\n\n return ($is_username ? '@' : '') . $name;\n }",
"function mentionBuild($user)\n{\n\tif (!is_array($user) ||\n\t\tempty($user) ||\n\t\tstrlen($user['username']) == 0) {\n\t\treturn false;\n\t}\n\n\tglobal $mybb, $lang;\n\n\tif (!$lang->mention) {\n\t\t$lang->load('mention');\n\t}\n\n\t$username = htmlspecialchars_uni($user['username']);\n\t$title = $lang->sprintf($lang->mention_link_title, $username);\n\tif ($mybb->settings['mention_format_names']) {\n\t\t// set up the user name link so that it displays correctly for the display group of the user\n\t\t$username = format_name($username, $user['usergroup'], $user['displaygroup']);\n\t}\n\t$url = get_profile_link($user['uid']);\n\n\t$target = '';\n\tif ($mybb->settings['mention_open_link_in_new_window']) {\n\t\t$target = ' target=\"_blank\"';\n\t}\n\n\t// the HTML id property is used to store the uid of the mentioned user for MyAlerts (if installed)\n\treturn <<<EOF\n{$mybb->settings['mention_display_symbol']}<a id=\"mention_{$user['uid']}\" href=\"{$url}\" class=\"mentionme_mention\" title=\"{$title}\"{$target}>{$username}</a>\nEOF;\n}",
"public function mention()\n {\n $project_id = $this->request->getStringParam('project_id');\n $query = $this->request->getStringParam('search');\n $users = $this->projectPermissionModel->findUsernames($project_id, $query);\n\n $this->response->json($this->userMentionFormatter->withUsers($users)->format());\n }",
"public function getUsername(): string\n {\n return (string) $this->nickname;\n }",
"public function username(): string\n\t{\n\t\treturn \"username\";\n\t}",
"public function getDisplayHolderNameAttribute()\n {\n if ($this->user_id) return $this->user->displayName;\n return '<a href=\"http://'.$this->alias.'.deviantart.com\">'.$this->alias.'@dA</a>';\n }",
"function get_the_author_nickname()\n {\n }",
"public function getShareableUsername(): string\n {\n $username = $this->getUsername();\n $discriminator = $this->getDiscriminator();\n return \"${username}#${discriminator}\";\n }",
"public function getMemberName() {\n return Html::a( $this->user->username, Yii::$app->params['url_admin'].'/user/view?id='.$this->user->id );\n }",
"function mentionDetect($match)\n{\n\tstatic $nameCache, $myCache;\n\n\tif (!empty($match['quoted'])) {\n\t\t$username = $match['quoted'];\n\t} elseif (!empty($match['unquoted'])) {\n\t\t$username = $match['unquoted'];\n\t} else {\n\t\treturn $match[0];\n\t}\n\n\t$username = html_entity_decode(mb_strtolower($username));\n\n\t// cache names to reduce queries\n\tif ($myCache instanceof MentionMeCache == false) {\n\t\t$myCache = MentionMeCache::getInstance();\n\t}\n\n\tif (!isset($nameCache)) {\n\t\t$nameCache = $myCache->read('namecache');\n\t}\n\n\tif (isset($nameCache[$username])) {\n\t\treturn mentionBuild($nameCache[$username]);\n\t}\n\n\t// lookup the user name\n\t$user = mentionTryName($username);\n\tif ($user['uid'] == 0) {\n\t\treturn $match[0];\n\t}\n\n\t// store the mention\n\t$nameCache[$username] = $user;\n\t$myCache->update('namecache', $nameCache);\n\n\t// and return the mention\n\treturn mentionBuild($user);\n}",
"public function getUserIdentifier(): string\n {\n return (string) $this->username;\n }",
"public function author()\n {\n if ($this->user_id) {\n $field = config(\"binshopsblog.comments.user_field_for_author_name\",\"name\");\n return optional($this->user)->$field;\n }\n\n return $this->author_name;\n }",
"function getUserName() {\n return $this->userName . \".guest\";\n }",
"public function diviroids_user_displayname($atts)\n {\n return DiviRoids_Security::get_current_user('display_name');\n }",
"public static function username() {\n return 'user_id';\n }",
"public function username(){\n \treturn $this->users->name.' '.$this->users->ape;\n }",
"public function username()\n {\n return 'username';\n }",
"public function username()\n {\n return 'username';\n }",
"public function username()\n {\n return 'username';\n }",
"public function username()\n {\n return 'username';\n }",
"public static function getScreenName()\n\t{\n\t\t$screen_name = \\Twitter\\WordPress\\User\\Meta::getTwitterUsername( get_the_author_meta( 'ID' ) );\n\t\tif ( ! $screen_name ) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn $screen_name;\n\t}",
"public function get_screen_name()\n\t{\n\t\tif (empty($this->user))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $this->user[static::_column('id')];\n\t}",
"public function getUsername()\n {\n return $this->getNickname();\n }",
"public function getNickname(): string {\n return $this->nickname;\n }",
"function iu_mentionusername($string, $from, $posturl){\n\tinclude 'dbparams.php';\n\tpreg_match_all('/@[a-zA-Z0-9_]+/', $string, $matches);\n\t// print_r($matches[1]);\n\tforeach ($matches as $match) {\n\t\tif(in_array($match, $matches)){\n\t\t\tforeach ($match as $name) {\n\t\t\t\t$matchedname = str_replace(\"@\", \"\", $name);//remove '@' from username match\n\t\t\t\t$mentionQuery = @mysqli_query($dblink, \"SELECT user_id FROM users WHERE username = '$matchedname'\");\n\t\t\t\t$mentionRow = mysqli_fetch_assoc($mentionQuery);\n\t\t\t\t$mentionuserid = $mentionRow['user_id'];\n\n\t\t\t\tiu_send_notification($from, $mentionuserid, 'mentionpost', $posturl);\n\t\t\t}\n\t\t}\n\t}\n}"
]
| [
"0.68509287",
"0.67767334",
"0.67719644",
"0.67297167",
"0.66133535",
"0.6608691",
"0.65911883",
"0.65903133",
"0.6546033",
"0.6499235",
"0.64032614",
"0.63889927",
"0.6339222",
"0.6331108",
"0.63288414",
"0.62949866",
"0.6290399",
"0.62645614",
"0.6231987",
"0.6223681",
"0.6211096",
"0.6208623",
"0.6208623",
"0.6208623",
"0.6208623",
"0.6206577",
"0.6201596",
"0.6199443",
"0.61684704",
"0.6158389"
]
| 0.68355376 | 1 |
Set item link The URL of the item. | public function setLink($link); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setLink($url)\n\t{\n\t\t$this->link = $url;\n\t}",
"function setLink($link) {\r\n $this->_link = $link;\r\n }",
"function setLink($link) {\r\n $this->_link = $link;\r\n }",
"function setUrlLink(){\n if( $this->id == 0 ) return;\n $url = $this->aFields[\"url\"]->toString();\n if( $url == \"\" ) return;\n $url = strip_tags( preg_replace( \"/[\\\"']/\", \"\", $url ) );\n if( !$this->aFields[\"url\"]->editable ) $this->aFields[\"url\"]->display = false;\n $this->aFields[\"url_link\"]->display = true;\n $this->aFields[\"url_link\"]->value = \"<a href=\\\"\".$url.\"\\\">\".$url.\"</a>\";\n }",
"function setLink(&$link)\n {\n $this->_link = $link;\n }",
"public function setLink($link){\n\t\t$this->link = $link;\n\t}",
"public function set_link($link) \n\t{\n\t\tif($this->version == RSS2 || $this->version == RSS1)\n\t\t{\n\t\t\t$this->add_element('link', $link);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->add_element('link','',array('href'=>$link));\n\t\t\t$this->add_element('id', zajlib_feed::uuid($link,'urn:uuid:'));\n\t\t} \n\t\t\n\t}",
"public function setLink(string $link): void\n {\n $this->link = $link;\n }",
"public function set_link($link){\n\t\t$this->set_channel_element('link', $link);\n\t}",
"public function setLink($value)\n {\n return $this->set('Link', $value);\n }",
"public function setLink($value)\n {\n return $this->set('Link', $value);\n }",
"public function setLink($value)\n {\n return $this->set('Link', $value);\n }",
"public function setLink($value)\n {\n return $this->set('Link', $value);\n }",
"public function setLink($value)\n {\n return $this->set('Link', $value);\n }",
"public function setUrl($link)\n {\n if (!$this->characterLastHas($link, '/')) {\n $link .= '/';\n }\n $link = $link . self::$folder . '/';\n self::set('_url', $link);\n if (empty($this->linkBaseMapAssets))\n $this->linkBaseMapAssets = $link;\n }",
"public function setLink($link)\n {\n $this->setChannelElement('link', $link);\n }",
"public function setLink($link) {\n\t\t$this->addChannelTag('link', $link);\n\t}",
"public function setItem($item) {\n $this->item = $item;\n }",
"function setLinks($link) \n {\n $this->links = $link;\n }",
"public function url($item_url)\n {\n $this->item_url = $item_url;\n\n return $this;\n }",
"public function setLink($link){\n $this->link = $link;\n return $this;\n }",
"public function add(string $key, Link $item)\n {\n $this->links[$key] = $item;\n }",
"protected function _setLink(XMLWriter $xml)\n {\n $value = $this->feed->getLink();\n\n if (!$value) {\n throw new InvalidArgumentException(\n 'RSS 2.0 feed elements MUST contain exactly one link element but one has not been set'\n );\n }\n\n $xml->startElement('link');\n\n if (!Uri::factory($value)->isValid()) {\n $xml->writeAttribute('isPermaLink', 'false');\n }\n\n $xml->text($value);\n $xml->endElement(); // link\n }",
"protected function prepare_links($item)\n {\n }",
"public function set_url( $url ) {\n\t\t$this->items[ $this->id ]['url'] = $url;\n\t\treturn $this;\n\t}",
"public function getItemLinkUrl()\n {\n return $this->escapeXssInUrl($this->getEntity()->getData('list_item_url'));\n }",
"function setURL( $url ) \n {\n $this->setValueByFieldName( 'navbarlink_url', $url );\n }",
"function SetLink($link,$y=0,$page=-1)\n\t\t{\n\t\t\tif($y==-1) $y=$this->y;\n\t\t\tif($page==-1)\t$page=$this->page;\n\t\t\t$this->links[$link]=array($page,$y);\n\t\t}",
"protected function getItemLink($item)\n {\n return $this->linkToPage($item);\n }",
"public function setLink($url)\n\t{\n\t\t$this->link = $url;\n\n\t\treturn $this;\n\t}"
]
| [
"0.7421717",
"0.7329324",
"0.7329324",
"0.72769094",
"0.71106654",
"0.70349795",
"0.69137734",
"0.6890567",
"0.681104",
"0.6669389",
"0.6666909",
"0.66661954",
"0.66640425",
"0.66640425",
"0.6663832",
"0.664389",
"0.66187286",
"0.6503394",
"0.64773023",
"0.6470863",
"0.6443356",
"0.64083475",
"0.63513565",
"0.634195",
"0.6314174",
"0.62830585",
"0.62820625",
"0.626735",
"0.6215263",
"0.61833155"
]
| 0.7338796 | 1 |
Set item comments URL of a page for comments relating to the item. | public function setComments($url); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function SetItemcommentid($value) { $this->itemCommentId=$value; }",
"public function setComments( $url ) {\n\t\t$this->comments = RSSCreator::ensureLinkProtocol( $url );\n\t}",
"public function setComment($comment){\n\t\tif(FW_Validate::isValidUrl($comment)){\n\t\t\t$this->_comment = $comment;\n\t\t}\n\t}",
"public function setNbComments(\\Nos\\Orm\\Model $item, $nb)\n {\n $this->nb_comments[$item->id] = $nb;\n }",
"protected function prepare_links($item)\n {\n }",
"public function addComment(\\TYPO3\\Amazingcomments\\Domain\\Model\\Comment $item) {\n\t\t// this is a workaround as the object is sometimes empty with TYPO3 6.0 and then a \"called a member function on a non-object-function\" error shows up\n\t\tif(!$this->comments) {\n\t\t\t#$this->comments = new Tx_Extbase_Persistence_ObjectStorage();\n\t\t\t$this->comments = $this->objectManager->create('\\\\TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage');\n\t\t}\n\t\t$this->comments->attach($item);\n\t}",
"public function url($item_url)\n {\n $this->item_url = $item_url;\n\n return $this;\n }",
"protected function prepare_links($comment)\n {\n }",
"function setComment($comment)\n {\n $this->comment = $comment;\n }",
"function setComment($comment)\n {\n $this->comment = $comment;\n }",
"function set_comment($new_comment)\n {\n $this->comment = $new_comment;\n }",
"public function setItem($item) {\n $this->item = $item;\n }",
"function add_comments_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \\null)\n {\n }",
"private function replace_itemUrl( $conf_array, $uid, $item )\n {\n\n // RETURN no marker\n $pos = strpos( $item, '###URL###' );\n if ( $pos === false )\n {\n return $item;\n }\n // RETURN no marker\n // Set value of the first item to null: it won't become an additional parameter below\n if ( $uid == $conf_array[ 'first_item.' ][ 'option_value' ] )\n {\n $uid = null;\n }\n // Set value of the first item to null: it won't become an additional parameter below\n // Move value (10, 20, 30, ...) to url_stdWrap (i.e: 2011_Jan, 2011_Feb, 2011_Mar, ...)\n $uid = $this->pObj->objCal->area_get_urlPeriod( $conf_array, $this->curr_tableField, $uid );\n\n\n\n /////////////////////////////////////////////////////////\n //\n // Remove piVars temporarily\n // Store status\n $arr_currPiVars = $this->pObj->piVars;\n\n // Remove sort and pointer\n $pageBrowserPointerLabel = $this->conf[ 'navigation.' ][ 'pageBrowser.' ][ 'pointer' ];\n $arr_removePiVars = array( 'sort', $pageBrowserPointerLabel );\n\n // Remove 'plugin', if current plugin is the default plugin\n if ( !$this->pObj->objFlexform->bool_linkToSingle_wi_piVar_plugin )\n {\n $arr_removePiVars[] = 'plugin';\n }\n // Remove 'plugin', if current plugin is the default plugin\n // LOOP piVars for removing\n foreach ( ( array ) $arr_removePiVars as $piVar )\n {\n if ( isset( $this->pObj->piVars[ $piVar ] ) )\n {\n unset( $this->pObj->piVars[ $piVar ] );\n }\n }\n // LOOP piVars for removing\n // Remove piVars temporarily\n /////////////////////////////////////////////////////////\n //\n // Change $GLOBALS['TSFE']->id temporarily\n\n $int_tsfeId = $GLOBALS[ 'TSFE' ]->id;\n if ( !empty( $this->pObj->objFlexform->int_viewsListPid ) )\n {\n $GLOBALS[ 'TSFE' ]->id = $this->pObj->objFlexform->int_viewsListPid;\n }\n // Change $GLOBALS['TSFE']->id temporarily\n /////////////////////////////////////////////////////////\n //\n // Remove the filter fields temporarily\n // #9495, fsander\n $this->pObj->piVars = $this->pObj->objZz->removeFiltersFromPiVars\n (\n $this->pObj->piVars, $this->conf_view[ 'filter.' ]\n );\n // Remove the filter fields temporarily\n /////////////////////////////////////////////////////////\n //\n // Calculate additional params for the typolink\n\n $additionalParams = null;\n foreach ( ( array ) $this->pObj->piVars as $paramKey => $paramValue )\n {\n if ( !empty( $paramValue ) )\n {\n $additionalParams = $additionalParams . '&' .\n $this->pObj->prefixId . '[' . $paramKey . ']=' . $paramValue;\n }\n }\n if ( $uid )\n {\n $additionalParams = $additionalParams . '&' .\n $this->pObj->prefixId . '[' . $this->curr_tableField . ']=' . $uid;\n }\n // Calculate additional params for the typolink\n /////////////////////////////////////////////////////////\n //\n // Build and render the typolink\n\n $arr_typolink[ 'parameter' ] = $GLOBALS[ 'TSFE' ]->id;\n $arr_typolink[ 'additionalParams' ] = $additionalParams;\n $arr_typolink[ 'useCacheHash' ] = 1;\n $arr_typolink[ 'returnLast' ] = 'URL';\n\n $typolink = $this->pObj->local_cObj->typoLink_URL( $arr_typolink );\n // Build and render the typolink\n /////////////////////////////////////////////////////////\n //\n // Cleanup piVars and id\n // Reset $this->pObj->piVars\n $this->pObj->piVars = $arr_currPiVars;\n // Reset $GLOBALS['TSFE']->id\n $GLOBALS[ 'TSFE' ]->id = $int_tsfeId;\n // Cleanup piVars and id\n // Replace the marker\n $item = str_replace( '###URL###', $typolink, $item );\n\n // Return the item\n return $item;\n }",
"public function setComment($comment);",
"public function setComment($comment);",
"function editComments($item, $_options = false) {\n\t\tglobal $model;\n\n\t\t$_ = '';\n\n\t\t$_ .= '<div class=\"comments i:defaultComments i:collapseHeader item_id:'.$item[\"id\"].'\"'.$this->jsData([\"comments\"]).'>';\n\t\t$_ .= '<h2>Comments ('.($item[\"comments\"] ? count($item[\"comments\"]) : 0).')</h2>';\n\n\t\t$_ .= $this->commentList($item[\"comments\"]);\n\n\t\t$_ .= $model->formStart($this->path.\"/addComment/\".$item[\"id\"], array(\"class\" => \"labelstyle:inject\"));\n\t\t$_ .= '<fieldset>';\n\t\t$_ .= $model->input(\"item_comment\", array(\"id\" => \"comment_\".$item[\"id\"]));\n\t\t$_ .= '</fieldset>';\n\n\t\t$_ .= '<ul class=\"actions\">';\n\t\t$_ .= $model->submit(\"Add new comment\", array(\"class\" => \"primary\", \"wrapper\" => \"li.save\"));\n\t\t$_ .= '</ul>';\n\t\t$_ .= $model->formEnd();\n\t\t$_ .= '</div>';\n\n\t\treturn $_;\n\t}",
"public function setComment(Comment $comment): void;",
"function register_block_core_comment_edit_link()\n {\n }",
"function setUrl($url) {\n\t\t$this->_url = $url;\n\t}",
"function setUrl($url) {\n\t\t$this->_url = $url;\n\t}",
"public function set_url( $url ) {\n\t\t$this->items[ $this->id ]['url'] = $url;\n\t\treturn $this;\n\t}",
"function comments_link_feed()\n {\n }",
"protected function setUrl() {\r\n\t\t$this->url = htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), ENT_QUOTES);\r\n\t}",
"function process_comment_items($comments)\n{\n\t$ci =& get_instance();\n\n\tforeach($comments as &$comment)\n\t{\n\t\t// work out who did the commenting\n\t\tif($comment->user_id > 0)\n\t\t{\n\t\t\t$comment->name = anchor('admin/users/edit/' . $comment->user_id, $comment->name);\n\t\t}\n\n\t\t// What did they comment on\n\t\tswitch ($comment->module)\n\t\t{\n\t\t\tcase 'news': # Deprecated v1.1.0\n\t\t\t\t$comment->module = 'blog';\n\t\t\t\tbreak;\n\t\t\tcase 'gallery':\n\t\t\t\t$comment->module = plural($comment->module);\n\t\t\t\tbreak;\n\t\t\tcase 'gallery-image':\n\t\t\t\t$comment->module = 'galleries';\n\t\t\t\t$ci->load->model('galleries/gallery_images_m');\n\t\t\t\tif ($item = $ci->gallery_images_m->get($comment->module_id))\n\t\t\t\t{\n\t\t\t\t\t$comment->item = anchor('admin/' . $comment->module . '/image_preview/' . $item->id, $item->title, 'class=\"modal-large\"');\n\t\t\t\t\tcontinue 2;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (module_exists($comment->module))\n\t\t{\n\t\t\tif ( ! isset($ci->{$comment->module . '_m'}))\n\t\t\t{\n\t\t\t\t$ci->load->model($comment->module . '/' . $comment->module . '_m');\n\t\t\t}\n\n\t\t\tif ($item = $ci->{$comment->module . '_m'}->get($comment->module_id))\n\t\t\t{\n\t\t\t\t$comment->item = anchor('admin/' . $comment->module . '/preview/' . $item->id, $item->title, 'class=\"modal-large\"');\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$comment->item = $comment->module .' #'. $comment->module_id;\n\t\t}\n\t\t\n\t\t// Link to the comment\n\t\tif (strlen($comment->comment) > 30)\n\t\t{\n\t\t\t$comment->comment = character_limiter($comment->comment, 30);\n\t\t}\n\t}\n\t\n\treturn $comments;\n}",
"public static function get_cms_comment_url_list()\n\t{\n\t\treturn self::get_cms_post_url_list(Helper_PostType::COMMENT);\n\t}",
"function setUrl($url);",
"public function set_feed_url($url)\n {\n }",
"function setURL($url){\n $this->urltoopen = $url;\n }",
"function setLink($url)\n\t{\n\t\t$this->link = $url;\n\t}"
]
| [
"0.66855574",
"0.66657615",
"0.62092906",
"0.5678784",
"0.5658268",
"0.56418115",
"0.54873574",
"0.5425364",
"0.5395741",
"0.5395741",
"0.5367697",
"0.53513557",
"0.5287132",
"0.525803",
"0.5248687",
"0.5248687",
"0.5226939",
"0.52253",
"0.52248955",
"0.51783365",
"0.51783365",
"0.5111246",
"0.5102521",
"0.50846356",
"0.5081874",
"0.5066527",
"0.5053597",
"0.5043328",
"0.502237",
"0.50174165"
]
| 0.66978914 | 0 |
Set GUID A string that uniquely identifies the item. | public function setGuid($guid, $isPermalink = false); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function setGuid($guid)\n {\n self::$guid = $guid;\n\n return self;\n }",
"private function setItemId(string $itemId) {\n $this->itemId = $itemId;\n }",
"public function setItem($key, $item);",
"public function setGuid($guid)\n {\n $this->guid = $guid;\n\n return $this;\n }",
"public function setGuid($guid)\n {\n $this->guid = $guid;\n\n return $this;\n }",
"function setId_item($iid_item = '')\n {\n $this->iid_item = $iid_item;\n }",
"function setId_item($iid_item)\n {\n $this->iid_item = $iid_item;\n }",
"function setId_item($iid_item)\n {\n $this->iid_item = $iid_item;\n }",
"public function getGUID() {\n\t\t\treturn $this->guid;\n\t\t}",
"public function fromGuid(string $guid)\n {\n $guid = str_replace(\"-\", \"\", $guid);\n $guid = str_replace(\" \", \"\", $guid);\n // now the guid is just a standard hex, so convert it\n return $this->fromHex($guid);\n }",
"public function setItem($item) {\n $this->item = $item;\n }",
"function setItemId($a_item_id)\n\t{\n\t\t$this->item_id = $a_item_id;\n\t}",
"public static function GUID() \n {\n if (function_exists('com_create_guid') === true) {\n return strtolower(trim(com_create_guid(), '{}'));\n }\n return strtolower(sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)));\n }",
"function GUID() {\n if (function_exists('com_create_guid') === true) {\n return trim(com_create_guid(), '{}');\n }\n\n return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));\n }",
"function com_create_guid() {}",
"function guid($index)\n\t{\t\n\t\treturn $this->getItemTagValue($this->_isAtom ? \"id\" : \"guid\" , $index);\n\t}",
"public static function getGuid()\n {\n return self::$guid;\n }",
"public static function getGUIDProperty()\n {\n return '';\n }",
"public static function getGUIDProperty()\n {\n return '';\n }",
"public function withGuid(string $guid): self\n {\n $this->guid = $guid;\n $this->isPermaLink = true;\n return $this;\n }",
"abstract function set ($item, $data);",
"public function setUniqueId($uniqueId){\n $this->uniqueId = $uniqueId;\n }",
"private function UseExistingGUID()\n {\n $generateguid = $this->ReadPropertyInteger(\"generateguid\");\n $dataflowtype = $this->ReadPropertyInteger(\"dataflowtype\");\n $ownio = $this->ReadPropertyInteger(\"ownio\");\n if($generateguid == 1)\n {\n $form = '{ \"type\": \"ValidationTextBox\", \"name\": \"library_guid\", \"caption\": \"GUID library\" },';\n if($ownio == 1)\n {\n $form .= '{ \"type\": \"ValidationTextBox\", \"name\": \"io_guid\", \"caption\": \"GUID IO\" },\n { \"type\": \"ValidationTextBox\", \"name\": \"rx_guid\", \"caption\": \"GUID RX\" },\n { \"type\": \"ValidationTextBox\", \"name\": \"tx_guid\", \"caption\": \"GUID TX\" },';\n }\n\n if($dataflowtype == 0) // IO / Splitter / Device\n {\n $form .= '{ \"type\": \"ValidationTextBox\", \"name\": \"splitter_guid\", \"caption\": \"GUID splitter\" },\n { \"type\": \"ValidationTextBox\", \"name\": \"splitterinterface_guid\", \"caption\": \"GUID splitter interface\" },';\n }\n $form .= '{ \"type\": \"ValidationTextBox\", \"name\": \"device_guid\", \"caption\": \"GUID device\" },\n { \"type\": \"ValidationTextBox\", \"name\": \"deviceinterface_guid\", \"caption\": \"GUID device interface\" },';\n }\n else\n {\n $form = '';\n }\n return $form;\n }",
"public function set($key, $item)\n {\n $this->items[$key] = $item;\n }",
"public function setUuid(string $uuid)\n {\n $this->uuid = $uuid;\n }",
"public function setItemId($value)\n {\n return $this->set(self::_ITEM_ID, $value);\n }",
"public function setItemId($value)\n {\n return $this->set(self::_ITEM_ID, $value);\n }",
"public function setItemId($value)\n {\n return $this->set(self::_ITEM_ID, $value);\n }",
"public function setItemId($value)\n {\n return $this->set(self::_ITEM_ID, $value);\n }",
"public function setItemId($value)\n {\n return $this->set(self::_ITEM_ID, $value);\n }"
]
| [
"0.60445446",
"0.5768126",
"0.57662416",
"0.5626711",
"0.5626711",
"0.55573595",
"0.55504405",
"0.55504405",
"0.554708",
"0.5490284",
"0.5374645",
"0.53527397",
"0.5348733",
"0.5322756",
"0.5310657",
"0.5305581",
"0.52989846",
"0.5275618",
"0.5275618",
"0.5241813",
"0.5238367",
"0.51937497",
"0.51695025",
"0.51494396",
"0.5140335",
"0.51077676",
"0.51077676",
"0.51077676",
"0.51077676",
"0.51077676"
]
| 0.6207736 | 0 |
Append item to the channel | public function appendTo(ChannelInterface $channel); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function push($item)\n {\n $this->items[] = $item;\n }",
"public function append($item)\n {\n array_push($this->activeValue, $item);\n }",
"public function push($item)\n {\n $this->list[] = $item;\n }",
"public function add($item)\n {\n $this->queueItems[] = $item;\n }",
"public function append(MessageInterface $message): void\n {\n $this->items[$message::class] = $message;\n }",
"public function enqueue($item)\n {\n array_push($this->array, $item);\n }",
"public function writeItem($item)\n {\n $this->data[] = $item;\n }",
"public function append($value)\n {\n $this->items[] = $value;\n }",
"public function push($item): void;",
"function rec($log_item)\n\t{\n\t\t$this->items[] = $log_item;\n\t}",
"public function addItem($item){\n $this->items[] = $item;\n }",
"public function addAction() {\r\n\t\t$this->assign('channels', $this->channels);\r\n\t}",
"public function enqueue($item)\n {\n $this->items[] = $item;\n }",
"protected function push(Component $item)\n\t{\n\t\t$this->items[] = $item;\n\t}",
"public function appendItem(\\PB_Item $value)\n {\n return $this->append(self::ITEM, $value);\n }",
"public function push($item): void\n {\n $this->elements[] = $item;\n }",
"public function append(mixed $value) {\n $this->items[] = $value;\n return $this;\n }",
"public function add_item($zajlib_feed_item){\n\t\t$this->items[] = $zajlib_feed_item; \n\t}",
"public function add( $item )\n\t\t{\n\t\t\tarray_push( $this->items, $item );\n\t\t}",
"public function addItem($item)\n {\n // Push item into list of array\n array_push($this->items, $item);\n }",
"function push($x)\n {\n $this->items[] = $x;\n }",
"public function addChannel(Entities\\Channels\\Channel $channel): void\n\t{\n\t\tif (!$this->channels->contains($channel)) {\n\t\t\t// ...and assign it to collection\n\t\t\t$this->channels->add($channel);\n\t\t}\n\t}",
"public function append(...$items): self;",
"public function appendMessage(MessageInterface $message): void\n {\n $this->messages[] = $message;\n }",
"public function addItem($item)\n\t{\n\t\t$this->_items[] = $item;\n\t}",
"public function push($item)\n {\n if ($this->getCount() == static::MAX_ITEMS) {\n\n throw new QueueException(\"Queue is full\");\n \n }\n \n $this->items[] = $item;\n }",
"public function AddItem($item)\n {\n $this->_items[] = $item;\n }",
"public function addItem(Array $item)\n {\n $this->item[] = $item;\n }",
"public function add($item);",
"public function add($item);"
]
| [
"0.653608",
"0.64741987",
"0.63849366",
"0.6377925",
"0.62957996",
"0.6214277",
"0.61332846",
"0.61221683",
"0.6116131",
"0.6114877",
"0.60834205",
"0.6040669",
"0.60146755",
"0.59891856",
"0.5976898",
"0.5888219",
"0.5884099",
"0.58450043",
"0.5839053",
"0.58290565",
"0.5719158",
"0.5705985",
"0.5666603",
"0.5654261",
"0.56500727",
"0.56449354",
"0.5640777",
"0.5633177",
"0.56175053",
"0.56175053"
]
| 0.7123747 | 1 |
Get Account value An additional test has been added (isset) before returning the property value as this property may have been unset before, due to the fact that this property is removable from the request (nillable=true+minOccurs=0) | public function getAccount()
{
return isset($this->Account) ? $this->Account : null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getAccount()\n {\n return isset($this->account) ? $this->account : null;\n }",
"public function getAccount(): ?stdClass\n {\n return $this->account;\n }",
"public function getAccount(): ?string\n {\n return $this->account;\n }",
"public function getAccount()\n {\n return $this->account;\n }",
"public function getAccount()\n {\n return $this->account;\n }",
"public function getAccount()\n {\n return $this->account;\n }",
"public function getAccount()\n {\n return $this->account;\n }",
"public function getAccount()\n {\n return $this->account;\n }",
"public function getAccount()\n {\n return $this->account;\n }",
"public function getAccount() {\n return $this->account;\n }",
"function get_account() {\n\t\t// $pos = $this->add_request( __FUNCTION__ );\n\t\t$pos = $this->add_request( 'getaccount' );\n\t\t$this->send_request();\n\t\t$r = $this->response_part( $pos );\n\t\tif ( isset( $r->account ) && !is_null( $r->account->email ) )\n\t\t\treturn $r->account;\n\t\treturn false;\n\t}",
"protected function getPropertyValue() {}",
"public function getAccountEnabled()\n {\n if (array_key_exists(\"accountEnabled\", $this->_propDict)) {\n return $this->_propDict[\"accountEnabled\"];\n } else {\n return null;\n }\n }",
"public function convert()\n {\n if (isset($this->mapped[$this->index][$this->value])) {\n $account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);\n\n return $account;\n } else {\n if (strlen($this->value) > 0) {\n $account = $this->findAccount();\n if (!is_null($account)) {\n return $account;\n }\n }\n\n return $this->value;\n }\n }",
"public function getAccount(): ?Account\n\t{\n\t\treturn $this->client()->getAccount($this->accountId);\n\t}",
"public function getOwnAccountProperty()\n {\n return $this->staff->id == Auth::user()->id;\n }",
"public function getAccountNo()\n {\n return $this->account_no;\n }",
"public function getAccount();",
"public function account()\n {\n if ($response = $this->request('account')) {\n if (isset($response->success) && $response->success == true) {\n return $response->account;\n }\n }\n return false;\n }",
"public function getValue()\n {\n if (!$this->isActive()) {\n //value cannot be retrieved as it cannot be set if it is not active\n return false;\n }\n return $this->value;\n }",
"public function getUserAccount(): ?UserAccount {\n $val = $this->getBackingStore()->get('userAccount');\n if (is_null($val) || $val instanceof UserAccount) {\n return $val;\n }\n throw new \\UnexpectedValueException(\"Invalid type found in backing store for 'userAccount'\");\n }",
"public function getValue()\n {\n if (array_key_exists(\"value\", $this->_propDict)) {\n return $this->_propDict[\"value\"];\n } else {\n return null;\n }\n }",
"public function getValue()\n {\n if (array_key_exists(\"value\", $this->_propDict)) {\n return $this->_propDict[\"value\"];\n } else {\n return null;\n }\n }",
"public function getAccountNo()\n {\n return $this->accountNo;\n }",
"public function getAccount() {\n if (isset($this->account)) {\n return $this->account;\n }\n if (!$account = entity_load_single('fluxservice_account', $this->task['data']['account'])) {\n throw new \\RulesEvaluationException('The specified Toggl account cannot be loaded.', array(), NULL, \\RulesLog::ERROR);\n }\n $this->account = $account;\n return $this->account;\n }",
"public function value()\r\n\t{\r\n\t\tif ($this->isFetched() && $this->isValid())\r\n\t\t{\r\n\t\t\treturn $this->normalizedValue;\r\n\t\t}\t\r\n\t\treturn null;\r\n\t}",
"public function getValue()\n {\n return isset($this->value) ? $this->value : null;\n }",
"public function getPropertyValue() {\n\t\t$propertyValue = parent::getPropertyValue();\n\t\tif ($propertyValue === NULL)\n\t\t\treturn FALSE;\n\t\treturn $propertyValue;\n\t}",
"public function getBankAccount(): ?bool\n {\n return $this->bankAccount;\n }",
"public function getAuthAccountName() {\n return @$this->attributes['auth_account_name'];\n }"
]
| [
"0.6607195",
"0.66015375",
"0.6290767",
"0.6289871",
"0.6289871",
"0.6289871",
"0.6289871",
"0.6289871",
"0.6289871",
"0.62497056",
"0.6203015",
"0.61946136",
"0.6020716",
"0.5929251",
"0.5919524",
"0.59093785",
"0.5885591",
"0.58759016",
"0.5827541",
"0.58168167",
"0.5781576",
"0.5752143",
"0.5752143",
"0.5751446",
"0.57333857",
"0.57220376",
"0.56831366",
"0.5672837",
"0.56709874",
"0.5633757"
]
| 0.6680917 | 0 |
Get AffiliateCode value An additional test has been added (isset) before returning the property value as this property may have been unset before, due to the fact that this property is removable from the request (nillable=true+minOccurs=0) | public function getAffiliateCode()
{
return isset($this->AffiliateCode) ? $this->AffiliateCode : null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getCodeAffaire() {\n return $this->codeAffaire;\n }",
"public function setAffiliateCode($affiliateCode = null)\n {\n // validation for constraint: string\n if (!is_null($affiliateCode) && !is_string($affiliateCode)) {\n throw new \\InvalidArgumentException(sprintf('Invalid value, please provide a string, \"%s\" given', gettype($affiliateCode)), __LINE__);\n }\n if (is_null($affiliateCode) || (is_array($affiliateCode) && empty($affiliateCode))) {\n unset($this->AffiliateCode);\n } else {\n $this->AffiliateCode = $affiliateCode;\n }\n return $this;\n }",
"public function getCodeAffaire(): ?string {\n return $this->codeAffaire;\n }",
"public function getCodeAffaire(): ?string {\n return $this->codeAffaire;\n }",
"public function getCodeAffaire(): ?string {\n return $this->codeAffaire;\n }",
"public function getCodeAffaire(): ?string {\n return $this->codeAffaire;\n }",
"public function getCodeAffaire(): ?string {\n return $this->codeAffaire;\n }",
"public function getCodeAffaire(): ?string {\n return $this->codeAffaire;\n }",
"public function getCode() {\n return @$this->attributes['code'];\n }",
"function getPrimaryAffIDfromCode($affCode = NULL)\n\t\t{\n\t\t\t$query = \"select affiliate_id from tbl_affiliate where affiliate_code = '\".$affCode.\"'\";\n\t\t\t$affiliateID = 0;\n\t\t\t$rs = $this->Execute($query);\n\t\t\twhile($row = $rs->FetchRow()) {\n\t\t\t\t\t$affiliateID\t\t= $row[\"affiliate_id\"];\n\t\t\t\t}\n\t\t\treturn $affiliateID;\n\t\t}",
"public function getIdentificatiecode() : ?string\n {\n return $this->identificatiecode;\n }",
"public function getIdentificatiecode() : ?string\n {\n return $this->identificatiecode;\n }",
"private function hydrate_affiliate_code() {\n\t\tif ( Options::get_affiliate_code() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( FileSystem::file_exists( $file_name ) ) {\n\t\t\t$affiliate_code = trim( FileSystem::get_content( $file_name ) );\n\t\t\tadd_option( 'hubspot_affiliate_code', $affiliate_code );\n\t\t}\n\t}",
"private function get_coupon_affiliate_id() {\n\t\t$coupons = jigoshop_cart::get_coupons();\n\n\t\tif( empty( $coupons ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tforeach( $coupons as $code ) {\n\t\t\t$coupon = JS_Coupons::get_coupon( $code );\n\t\t\t$affiliate_id = get_post_meta( $coupon['id'], 'affwp_discount_affiliate', true );\n\n\t\t\tif( $affiliate_id ) {\n\n\t\t\t\tif( ! affiliate_wp()->tracking->is_valid_affiliate( $affiliate_id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\treturn $affiliate_id;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\t}",
"public function getCountryCode(): ?string;",
"public function getCode() { return $this->code; }",
"public function feide_affiliation() {\n\t\t\t$this->feide_affiliation = array_map('strtolower', $this->attributes['eduPersonAffiliation']);\n\n\t\t\treturn $this->feide_affiliation;\n\t\t}",
"public function getAwardeeCode()\n {\n return isset($this->awardeeCode) ? $this->awardeeCode : null;\n }",
"public function getCode() {return $this->code;}",
"public function getCountryCode()\n {\n return $this->code;\n }",
"public function getCode() {\r\n return $this->__code;\r\n }",
"public function getCodeQualif() {\n return $this->codeQualif;\n }",
"function getCode()\r\n {\r\n return $this->code;\r\n }",
"function getCode()\n {\n return $this->code;\n }",
"public function getCodeAttribute()\n {\n $auth_user = Auth::user();\n\n return $auth_user && $auth_user->id === $this->seller_id ? decrypt($this->confirmation_code) : null;\n }",
"public function getCountryCode(): string;",
"public function getCode()\n {\n return $this->values[\"code\"];\n }",
"public function getCountryCode();",
"public function getDiscountCode()\n {\n if (is_null($this->discountCode)) {\n /** @psalm-var stdClass|array<string, mixed>|null $data */\n $data = $this->raw(self::FIELD_DISCOUNT_CODE);\n if (is_null($data)) {\n return null;\n }\n\n $this->discountCode = DiscountCodeKeyReferenceModel::of($data);\n }\n\n return $this->discountCode;\n }",
"public function getCode() {\n return $this->code;\n }"
]
| [
"0.61893916",
"0.6005447",
"0.59055805",
"0.59055805",
"0.59055805",
"0.59055805",
"0.59055805",
"0.59055805",
"0.5766783",
"0.5697935",
"0.5566221",
"0.5566221",
"0.5518819",
"0.54831094",
"0.5479306",
"0.5467049",
"0.5432417",
"0.5419231",
"0.53856015",
"0.529826",
"0.52906346",
"0.52633995",
"0.5256318",
"0.52547246",
"0.5245329",
"0.523681",
"0.5233597",
"0.522562",
"0.52203935",
"0.5205634"
]
| 0.69564915 | 0 |
Set AffiliateCode value This property is removable from request (nillable=true+minOccurs=0), therefore if the value assigned to this property is null, it is removed from this object | public function setAffiliateCode($affiliateCode = null)
{
// validation for constraint: string
if (!is_null($affiliateCode) && !is_string($affiliateCode)) {
throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($affiliateCode)), __LINE__);
}
if (is_null($affiliateCode) || (is_array($affiliateCode) && empty($affiliateCode))) {
unset($this->AffiliateCode);
} else {
$this->AffiliateCode = $affiliateCode;
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setCode($code);",
"public function setCode($code);",
"function InfUpdateAffCode($inf_aff_id, $inf_aff_code) {\n\n\t$affiliate = new Infusionsoft_Affiliate();\n\t$affiliate->Id = $inf_aff_id;\n\t$affiliate->AffCode = $inf_aff_code;\n\t$affiliate->save(); // Update affiliate in Infusionsoft\n}",
"public function setCode($code) { $this->code = (int)$code; return $this; }",
"public function setCode($code)\n {\n $this->code = $code;\n }",
"public function setCouponCode($code);",
"public function setCode($code)\n\t{\n\t\t$this->code = (int) $code;\n\t}",
"function setCouponCode($code)\n {\n $this->_coupon = $this->coupon_id = $this->coupon_code = null;\n $this->_couponCode = $code;\n }",
"public function setCode($Code)\n {\n $this->__set(\"code\", $Code);\n }",
"public function setCodeAttribute($value)\n {\n $this->attributes['code'] = str_slug(trim($value));\n\n if (empty($value)) {\n $this->attributes['code'] = str_slug(trim($this->attributes['name']));\n }\n }",
"function setAmocrmCode(string $code): void {\n\t}",
"public function setCode($code)\r\n {\r\n $this->code = (int) $code;\r\n return $this;\r\n }",
"public function setCodeAttribute($value)\n {\n $this->attributes['code']=mb_strtoupper($value);\n }",
"public function setCode($code)\n {\n $this->code = $this->getApiErrorCode($code);\n }",
"public function setCodeAffaire(?string $codeAffaire): AffaireMtPrevisionnel {\n $this->codeAffaire = $codeAffaire;\n return $this;\n }",
"public function getAffiliateCode()\n {\n return isset($this->AffiliateCode) ? $this->AffiliateCode : null;\n }",
"public function setCodeAffaire(?string $codeAffaire): MouvementsStock {\n $this->codeAffaire = $codeAffaire;\n return $this;\n }",
"public function setCode($code) {\n\t\t$this->code = $code;\n\t\treturn $this;\n\t}",
"public function setAwardeeCode($awardeeCode = null)\n {\n // validation for constraint: string\n if (!is_null($awardeeCode) && !is_string($awardeeCode)) {\n throw new \\InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($awardeeCode, true), gettype($awardeeCode)), __LINE__);\n }\n if (is_null($awardeeCode) || (is_array($awardeeCode) && empty($awardeeCode))) {\n unset($this->awardeeCode);\n } else {\n $this->awardeeCode = $awardeeCode;\n }\n return $this;\n }",
"public function setCode($code) {\n $code = (string) $code;\n $this->fields[\"code\"] = $code;\n\n return $this;\n }",
"public function setAccountCode($value);",
"private function hydrate_affiliate_code() {\n\t\tif ( Options::get_affiliate_code() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( FileSystem::file_exists( $file_name ) ) {\n\t\t\t$affiliate_code = trim( FileSystem::get_content( $file_name ) );\n\t\t\tadd_option( 'hubspot_affiliate_code', $affiliate_code );\n\t\t}\n\t}",
"public function setCode($code)\n {\n $this->code = $code;\n return $this;\n }",
"public function setCode($code)\n {\n $this->code = $code;\n return $this;\n }",
"public function setCode($code)\n {\n $this->code = $code;\n return $this;\n }",
"public function setEventCode($value) \n {\n $this->_fields['EventCode']['FieldValue'] = $value;\n return $this;\n }",
"public function testSetCodeAffaire() {\n\n $obj = new ChantiersFrequencesControlesQualite();\n\n $obj->setCodeAffaire(\"codeAffaire\");\n $this->assertEquals(\"codeAffaire\", $obj->getCodeAffaire());\n }",
"public function setCode($code)\n\t{\n\t\t$this->code = $code;\n\n\t\treturn $this;\n\t}",
"public function setCode($code)\n {\n $this->code = (int) $code;\n\n return $this->mergeData([static::codeKey() => $this->code]);\n }",
"public function setCodeAffaire($codeAffaire) {\n $this->codeAffaire = $codeAffaire;\n return $this;\n }"
]
| [
"0.61074984",
"0.61074984",
"0.59664696",
"0.5823651",
"0.58101755",
"0.5804655",
"0.5722623",
"0.56595457",
"0.5619161",
"0.55918276",
"0.5580301",
"0.55520403",
"0.5503114",
"0.55030495",
"0.547616",
"0.5474998",
"0.54534817",
"0.54431343",
"0.54338324",
"0.53987366",
"0.5391117",
"0.5373418",
"0.5364989",
"0.5364989",
"0.5364989",
"0.53584266",
"0.5347806",
"0.53385186",
"0.5327222",
"0.5323022"
]
| 0.6986882 | 0 |
Get MatchCode value An additional test has been added (isset) before returning the property value as this property may have been unset before, due to the fact that this property is removable from the request (nillable=true+minOccurs=0) | public function getMatchCode()
{
return isset($this->MatchCode) ? $this->MatchCode : null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setMatchCode($matchCode = null)\n {\n // validation for constraint: string\n if (!is_null($matchCode) && !is_string($matchCode)) {\n throw new \\InvalidArgumentException(sprintf('Invalid value, please provide a string, \"%s\" given', gettype($matchCode)), __LINE__);\n }\n if (is_null($matchCode) || (is_array($matchCode) && empty($matchCode))) {\n unset($this->MatchCode);\n } else {\n $this->MatchCode = $matchCode;\n }\n return $this;\n }",
"public function getCode(): ?string\n {\n return $this->code;\n }",
"public function getCode(): ?string\n {\n return $this->code;\n }",
"public function getCode() { return $this->code; }",
"public function getCode(): ?string;",
"public function getCode() {return $this->code;}",
"public function getCode()\n {\n if (isset($this->data['response']['gatewayCode'])) {\n return $this->data['response']['gatewayCode'];\n }\n\n return null;\n }",
"function getCode()\r\n {\r\n return $this->code;\r\n }",
"public function getCode() {\n return @$this->attributes['code'];\n }",
"private function IsProperty($code) {\n\t\t$parent = '/^' . $this->bxPrefix . '[A-z\\d\\[\\]]+$/';\n\n\t\treturn preg_match($parent, $code);\n\t}",
"public function getCode() {\n return $this->code;\n }",
"public function getCode() {\n return $this->code;\n }",
"public function getCode()\r\n {\r\n return $this->code;\r\n }",
"function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->values[\"code\"];\n }",
"public function getCode() {\r\n return $this->__code;\r\n }",
"public function getCodeManif(): ?string {\n return $this->codeManif;\n }",
"protected static function phone_code(): mixed\n\t{\n\t\treturn self::$query->phone_code;\n\t}",
"public function getStatus(): ?FHIRCode\n\t{\n\t\treturn $this->status;\n\t}",
"public function getCode()\n {\n if (is_null($this->code)) {\n /** @psalm-var ?string $data */\n $data = $this->raw(self::FIELD_CODE);\n if (is_null($data)) {\n return null;\n }\n $this->code = (string) $data;\n }\n\n return $this->code;\n }",
"public function getCode() {\n return $this->code;\n }",
"public function getCode(): ?array\n\t{\n\t\treturn $this->code;\n\t}",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }",
"public function getCode()\n {\n return $this->code;\n }"
]
| [
"0.64541185",
"0.58730763",
"0.58730763",
"0.586467",
"0.57677764",
"0.5752052",
"0.5684378",
"0.5682252",
"0.56803536",
"0.5634089",
"0.5605693",
"0.5605693",
"0.5591706",
"0.5565673",
"0.5553285",
"0.55390334",
"0.55312115",
"0.5504667",
"0.5493855",
"0.5479927",
"0.545722",
"0.5456177",
"0.543732",
"0.543732",
"0.543732",
"0.543732",
"0.543732",
"0.543732",
"0.543732",
"0.543732"
]
| 0.75273037 | 0 |
Set MatchCode value This property is removable from request (nillable=true+minOccurs=0), therefore if the value assigned to this property is null, it is removed from this object | public function setMatchCode($matchCode = null)
{
// validation for constraint: string
if (!is_null($matchCode) && !is_string($matchCode)) {
throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($matchCode)), __LINE__);
}
if (is_null($matchCode) || (is_array($matchCode) && empty($matchCode))) {
unset($this->MatchCode);
} else {
$this->MatchCode = $matchCode;
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setCode($code);",
"public function setCode($code);",
"public function setMatcher(callable $code) : self\n {\n $this->matcher = $code;\n\n return $this;\n }",
"public function getMatchCode()\n {\n return isset($this->MatchCode) ? $this->MatchCode : null;\n }",
"public function setCode($code) { $this->code = (int)$code; return $this; }",
"public function setCode($code)\n {\n $this->code = $code;\n }",
"public function setOnMatch(callable $code) : self\n {\n $this->onMatch = $code;\n\n return $this;\n }",
"public function setCode($code)\n\t{\n\t\t$this->code = (int) $code;\n\t}",
"function setAmocrmCode(string $code): void {\n\t}",
"public function setCode($code)\r\n {\r\n $this->code = (int) $code;\r\n return $this;\r\n }",
"public function setCode($code) {\n\t\t$this->code = $code;\n\t\treturn $this;\n\t}",
"public function setCode($code)\n {\n $this->data[1] = (string)$code;\n return $this->data[1];\n }",
"public function setCode($code) {\n $code = (string) $code;\n $this->fields[\"code\"] = $code;\n\n return $this;\n }",
"public function setCode($code, $message);",
"public function setCode(string $code): self\n {\n $this->code = $code;\n return $this;\n }",
"public function setCode($code)\n {\n $this->code = $code;\n return $this;\n }",
"public function setCode($code)\n {\n $this->code = $code;\n return $this;\n }",
"public function setCode($code)\n {\n $this->code = $code;\n return $this;\n }",
"public function setCardcode($v)\n {\n if ($v !== null) {\n $v = (string) $v;\n }\n\n if ($this->cardcode !== $v) {\n $this->cardcode = $v;\n $this->modifiedColumns[OrdrhedTableMap::COL_CARDCODE] = true;\n }\n\n return $this;\n }",
"public function SetMatch ($match);",
"public function setCode(array $code = []): object\n\t{\n\t\tif ([] !== $this->code) {\n\t\t\t$this->_trackValuesRemoved(count($this->code));\n\t\t\t$this->code = [];\n\t\t}\n\t\tif ([] === $code) {\n\t\t\treturn $this;\n\t\t}\n\t\tforeach ($code as $v) {\n\t\t\tif ($v instanceof FHIRCoding) {\n\t\t\t\t$this->addCode($v);\n\t\t\t} else {\n\t\t\t\t$this->addCode(new FHIRCoding($v));\n\t\t\t}\n\t\t}\n\t\treturn $this;\n\t}",
"public function setCode($code)\n\t{\n\t\t$this->code = $code;\n\n\t\treturn $this;\n\t}",
"public function setCode($value) {\n return $this->set(self::CODE, $value);\n }",
"public function setCode($code)\n {\n $this->code = (int) $code;\n\n return $this->mergeData([static::codeKey() => $this->code]);\n }",
"public function setCode(string $code): self\n {\n $this->code = $code;\n\n return $this;\n }",
"public function setCode($Code)\n {\n $this->__set(\"code\", $Code);\n }",
"public function setCode($code)\n {\n $this->code = $this->getApiErrorCode($code);\n }",
"public function setCode($code)\n {\n // set the code\n $this->_code = $code;\n \n // reset the strings\n $this->trans = array();\n }",
"public function setCode($code)\n {\n $this->setProperty(self::CODE, $code);\n\n return $this;\n }",
"public function setcode($v)\n {\n if ($v !== null && is_numeric($v)) {\n $v = (string) $v;\n }\n\n if ($this->code !== $v) {\n $this->code = $v;\n $this->modifiedColumns[] = ActionTypePeer::CODE;\n }\n\n\n return $this;\n }"
]
| [
"0.6168038",
"0.6168038",
"0.5989979",
"0.5989541",
"0.5847256",
"0.58312285",
"0.5804223",
"0.57486296",
"0.5688502",
"0.5547329",
"0.54815644",
"0.5426024",
"0.5417964",
"0.5412028",
"0.5403882",
"0.53975195",
"0.53975195",
"0.53975195",
"0.5376611",
"0.5362782",
"0.5357583",
"0.5352309",
"0.5340026",
"0.53332037",
"0.5327276",
"0.53195894",
"0.5313719",
"0.53132623",
"0.53107977",
"0.5304485"
]
| 0.76919746 | 0 |
Set Remark value This property is removable from request (nillable=true+minOccurs=0), therefore if the value assigned to this property is null, it is removed from this object | public function setRemark($remark = null)
{
// validation for constraint: string
if (!is_null($remark) && !is_string($remark)) {
throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($remark)), __LINE__);
}
if (is_null($remark) || (is_array($remark) && empty($remark))) {
unset($this->Remark);
} else {
$this->Remark = $remark;
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setRemark(string $remark)\n {\n $this->Remark = $remark;\n return $this;\n }",
"public function setRemark(array $remark)\n {\n $this->remark = $remark;\n return $this;\n }",
"public function setRemark($remark)\n {\n $this->remark = $remark;\n\n return $this;\n }",
"public function save()\n {\n parent::save();\n\n $oRemark = oxNew(\"oxremark\");\n\n // try to load if exists\n $oRemark->load(oxRegistry::getConfig()->getRequestParameter(\"rem_oxid\"));\n\n $oRemark->oxremark__oxtext = new oxField(oxRegistry::getConfig()->getRequestParameter(\"remarktext\"));\n $oRemark->oxremark__oxheader = new oxField(oxRegistry::getConfig()->getRequestParameter(\"remarkheader\"));\n $oRemark->oxremark__oxparentid = new oxField($this->getEditObjectId());\n $oRemark->oxremark__oxtype = new oxField(\"r\");\n $oRemark->save();\n }",
"public function unsetRemark($index)\n {\n unset($this->remark[$index]);\n }",
"public function setRemark($Remark)\n {\n $this->remark = $Remark;\n\n return $this;\n }",
"public function getRemark()\n {\n return isset($this->Remark) ? $this->Remark : null;\n }",
"public function unsetRemarks($index)\n {\n unset($this->remarks[$index]);\n }",
"public function getRemark()\n {\n return $this->remark;\n }",
"public function getRemark()\n {\n return $this->remark;\n }",
"public function getRemark()\n {\n return $this->remark;\n }",
"public function setRemarks(array $remarks)\n {\n $this->remarks = $remarks;\n return $this;\n }",
"public function getRemarks()\n {\n return $this->remarks;\n }",
"public function getRemark(): ?string\n {\n return $this->Remark ?? null;\n }",
"public function remove()\n\t{\n\t\t$this->todo = 3 ;\n\t}",
"public static function __setRemarks($code, $score){\r\n if($score <= self::DEFAULT_LIMIT){\r\n self::$_remarks[] = $code;\r\n }\r\n }",
"public function setRecall($recall)\n {\n $this->_recall = $recall;\n }",
"public function unsetNote(): void\n {\n $this->note = [];\n }",
"public function unset(): void\n\t{\n\t\t$this->_value = $this->_allowNull ? null : self::setType('', gettype($this->_value));\n\t}",
"public function delete()\n {\n $oRemark = oxNew(\"oxRemark\");\n $oRemark->delete(oxRegistry::getConfig()->getRequestParameter(\"rem_oxid\"));\n }",
"function setRemoved( $value )\n {\n $this->Removed = $value;\n }",
"public function setNotes($value) {\n\t\tif ($value == NULL) {\n\t\t\t$this->_notes = \"\";\n\t\t} else {\n\t\t\t$this->_notes = $value;\n\t\t}\n\t}",
"public function hasRemark(){\n return $this->_has(4);\n }",
"public function setUnmodified()\n {\n\t$this->modified= false;\n }",
"public function addToRemark(\\Devlabs91\\TravelgateNotify\\Models\\Ota\\ParagraphType $remark)\n {\n $this->remark[] = $remark;\n return $this;\n }",
"public function setMetadataToRemove($val)\n {\n $this->_propDict[\"metadataToRemove\"] = $val;\n return $this;\n }",
"public function reset() {\n $this->values[self::NAME] = null;\n $this->values[self::TIP_RTBUS] = null;\n }",
"public function issetRemark($index)\n {\n return isset($this->remark[$index]);\n }",
"public function setReasonAttribute($value)\n {\n $this->reason = $value;\n }",
"public function issetRemarks($index)\n {\n return isset($this->remarks[$index]);\n }"
]
| [
"0.5907069",
"0.5710263",
"0.5695912",
"0.5652844",
"0.54290754",
"0.5393372",
"0.53709376",
"0.5327653",
"0.5324493",
"0.5324493",
"0.5324493",
"0.5245054",
"0.5224788",
"0.5216955",
"0.51282907",
"0.51281446",
"0.5123178",
"0.512297",
"0.50745773",
"0.5072192",
"0.49981117",
"0.49697414",
"0.47843468",
"0.4770776",
"0.4751264",
"0.46936923",
"0.46909186",
"0.46903586",
"0.46629673",
"0.4650586"
]
| 0.6438394 | 0 |
Seed the site survey questions and options | public function run()
{
foreach ($this->questions as $question) {
/** @var \App\Components\SiteSurvey\Models\SiteSurveyQuestion $existing */
$existing = DB::table('site_survey_questions')
->where('name', $question['name'])
->first();
if (!$existing) {
$questionId = DB::table('site_survey_questions')
->insertGetId([
'name' => $question['name'],
]);
if (!empty($question['options'])) {
foreach ($question['options'] as $option) {
DB::table('site_survey_question_options')
->insert([
'site_survey_question_id' => $questionId,
'name' => $option,
]);
}
}
} elseif (!empty($question['options'])) {
foreach ($question['options'] as $option) {
/** @var \App\Components\SiteSurvey\Models\SiteSurveyQuestionOption $existingOption */
$existingOption = DB::table('site_survey_question_options')
->where('name', $option)
->where('site_survey_question_id', $existing->id)
->first();
if (!$existingOption) {
DB::table('site_survey_question_options')
->insert([
'site_survey_question_id' => $existing->id,
'name' => $option,
]);
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function run()\n {\n $survey = \\App\\Models\\Survey::create([\n 'availability' => true,\n 'camunda_identifier' => 'survey_001',\n 'title' => 'Diabetes Quality of Life',\n 'description' => 'Diabetes Quality of Life survey captures your satisfaction, impact and worry related to living with the diagnosis of diabetes (Type 1 or 2).',\n 'explanation' => 'Please rate your answers from 1 (least impact on you) to 5 (highest impact on you). Please choose only one response for each question.',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'satisfaction_01',\n 'text' => 'How satisfied are you with the amount of time it takes to manage your diabetes?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'satisfaction_02',\n 'text' => 'How satisfied are you with the amount of time you spend getting checkups?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'satisfaction_03',\n 'text' => 'How satisfied are you with the time it takes to determine your sugar level?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'satisfaction_04',\n 'text' => 'How satisfied are you with your current treatment?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'satisfaction_05',\n 'text' => 'How satisfied are you with your knowledge about your diabetes?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'satisfaction_06',\n 'text' => 'How satisfied are you with life in general?',\n ]);\n\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_01',\n 'text' => 'How often do you feel pain associated with the treatment for your diabetes?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_02',\n 'text' => 'How often do you feel physically ill?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_03',\n 'text' => 'How often does your diabetes interfere with your family life?',\n ]);\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_04',\n 'text' => 'How often do you find your diabetes limiting your social relationships and friendships?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_05',\n 'text' => 'How often do you find your diabetes limiting your sexual life?',\n ]);\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_06',\n 'text' => 'How often do you find your diabetes limiting your life plans such as employment, education or training?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'impact_07',\n 'text' => 'How often do you find your diabetes limiting your leisure activities or travels?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'worry_01',\n 'text' => 'How often do you worry about whether you will pass out?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'worry_02',\n 'text' => 'How often do you worry that your body looks different because you have diabetes?',\n ]);\n\n \\App\\Models\\Question::create([\n 'survey_id' => $survey->id,\n 'type' => 'worry_03',\n 'text' => 'How often do your worry that you will get complications from your diabetes?',\n ]);\n\n\n $questions = \\App\\Models\\Question::where('survey_id', $survey->id)->get();\n\n foreach ($questions as $question) {\n $index = 0;\n\n while ($index <= 4) {\n $index++;\n \\App\\Models\\Answer::create([\n 'question_id' => $question->id,\n 'text' => $index,\n 'value' => $index,\n ]);\n }\n }\n }",
"function answerQuestions() {\n $this->layout = 'survey'; // use the more basic survey layout\n if (!$this->request->is('post')) {\n // if there is no data then show the initial view\n $survey = $this->Session->read('Survey.original'); // get the survey being used\n if (empty($survey['Question'])) { // if there are no questions then we don't need to show the question form at all\n $this->Session->write('Survey.progress', GDTA_ENTRY); // move progress forward and redirect to the runSurvey action\n $this->redirect(array('action' => 'runSurvey'));\n }\n $questions = $survey['Question'];\n $answers = ($this->Session->check('Survey.answers')) ? $this->Session->read('Survey.answers') : array(); // check to see if there are already answers in the session\n $choices = array(); // gather choices here keyed to each question id\n foreach ($questions as &$q) { // go through each question and look to see if there is an answer for it\n $checkId = $q['id'];\n $choices[$checkId] = array();\n if (isset($q['Choice'])) {\n foreach ($q['Choice'] as $choice) {\n $choices[$checkId][$choice['id']] = $choice['value'];\n }\n }\n foreach ($answers as $a) {\n if ($a['question_id'] == $checkId) {\n if ($q['type'] == MULTI_SELECT) {\n $q['answer'] = Set::extract('/id',$a['answer']);\n } else {\n $q['answer'] = $a['answer'];\n }\n break;\n }\n }\n }\n $this->set('questions', $questions); // send questions to the view\n $this->set('choices', $choices); // send choices for questions to the view, ordered for form elements\n } else { // we have form data so process it here\n if (isset($this->request->data['Answer'])) {\n // make sure we have answers in the data set\n $this->Session->write('Survey.answers', $this->request->data['Answer']); // write the answers to the session\n }\n $this->Session->write('Survey.progress', GDTA_ENTRY); // move progress forward and redirect to the runSurvey action\n $this->redirect(array('action' => 'runSurvey'));\n }\n }",
"public function run()\n {\n DB::table('survey_questions')->insert([\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'heading',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Informatie over de patiënt:',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Leeftijd:',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'textarea',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Onderliggend lijden welk invloed kan hebben op de wondgenezing: (indien niet aanwezig gelieve n.v.t te vermelden).',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'heading',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Informatie over de wond',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'radio',\n 'other' => false,\n 'other_label' => null,\n 'text' => null,\n 'required' => true,\n 'options' => json_encode(['Nieuwe wond', 'Bestaande wond']),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Sinds wanneer?',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => 6,\n 'survey_id' => 1,\n 'type' => 'radio',\n 'other' => false,\n 'other_label' => null,\n 'text' => null,\n 'required' => true,\n 'options' => json_encode(['dag(en)', 'week/weken']),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Welke verband is het meest recentelijk op deze wond aangebracht?',\n 'required' => true,\n 'options' => json_encode([\n ['Fiberverbanden met hoog absorptievermogen of alginaten, gelieve de naam van het product te vermelden:'],\n ['Schuimverband, gelieve de naam van het product te vermelden:'],\n ['Zilververband, gelieve de naam van het product te vermelden:'],\n ['Superabsorberend, gelieve de naam van het product te vermelden:'],\n ['Hydrocolloïde, gelieve de naam van het product te vermelden:'],\n ['Ander(e) type(n), gelieve de naam van het product te vermelden:'],\n 'Geen',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'radio',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Type wond:',\n 'required' => true,\n 'options' => json_encode([\n 'Acute wond',\n 'Chronische wond',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'radio',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Geïnfecteerd?',\n 'required' => true,\n 'options' => json_encode([\n 'Ja',\n 'Nee',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => true,\n 'other_label' => 'Andere acute wond, namelijk:',\n 'text' => '(Indien acute wond aangevinkt) het gaat in het bijzonder om een …',\n 'required' => true,\n 'options' => json_encode([\n 'Traumatische wond (oppervlakkige schaafwond, laceratie, flyctenen, oppervlakkige snijwonden en huidscheuren)',\n 'Tweedegraads brandwond',\n 'Dermabrasie / Ontvelling',\n 'Chirurgische wond',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => true,\n 'other_label' => 'Andere chronische wond, namelijk',\n 'text' => '(Indien chronische wond aangevinkt) het gaat in het bijzonder om een …',\n 'required' => true,\n 'options' => json_encode([\n 'Decubitus wond',\n 'Ulcus Cruris beenwond',\n 'Diabetische voetwond',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Wat is de hoeveelheid wondvocht?',\n 'required' => true,\n 'options' => json_encode([\n 'Droog',\n 'Vochtig',\n 'Nat',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Locatie van het wondbed',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => 14,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => '% Necrotisch (zwart)',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => 14,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => '% Granulerend (rood)',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => 14,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => '% Beslag (geel)',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => 14,\n 'survey_id' => 1,\n 'type' => 'text',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Anders, namelijk',\n 'required' => false,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => true,\n 'other_label' => null,\n 'text' => 'Toestand van de huid rondom de wond:',\n 'required' => true,\n 'options' => json_encode([\n 'Gezond',\n 'Geïrriteerd/rood',\n 'Droog/eczematisch',\n 'Gemacereerd',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'heading',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'D0 – 1e toepassing van AQUACEL Foam of Foam Lite™ ConvaTec:',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'date',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Datum (D0):',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Type verband:',\n 'required' => true,\n 'options' => json_encode([\n 'AQUACEL Foam',\n 'AQUACEL Ag Foam',\n 'Foam Lite ConvaTec',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'label',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Afmeting verbandkeuze:',\n 'required' => true,\n 'options' => null,\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'AQUACEL Foam – plakkend',\n 'required' => true,\n 'options' => json_encode([\n '8 x 8 cm',\n '10 x 10 cm',\n '12,5 x 12,5 cm',\n '17,5 x 17,5 cm',\n '21 x 21 cm',\n '25 x 30 cm',\n '8 x 13 cm',\n '10 x 20 cm',\n '10 x 25 cm',\n '10 x 30 cm',\n '19,8 x 14 cm',\n '20 x 16,9 cm',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'AQUACEL Foam - zonder kleefrand',\n 'required' => true,\n 'options' => json_encode([\n '5 x 5 cm',\n '10 x 10 cm',\n '15 x 15 cm',\n '10 x 20 cm',\n '15 x 20 cm',\n '20 x 20 cm',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'AQUACEL Foam – anatomische vormen',\n 'required' => true,\n 'options' => json_encode([\n 'Allround 19,8 x 14 cm',\n 'Sacrum 20 x 16,9 cm',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Foam Lite™ ConvaTec',\n 'required' => true,\n 'options' => json_encode([\n '5 x 5 cm',\n '8 x 8 cm',\n '10 x 10 cm',\n '10 x 20 cm',\n '15 x 15 cm',\n '5,5 x 12 cm',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => true,\n 'other_label' => 'Secundair verband, gelieve het primaire verband te vermelden:',\n 'text' => 'Op welke wijze gebruikt u het gekozen verband?',\n 'required' => true,\n 'options' => json_encode([\n 'Primair verband',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => true,\n 'other_label' => null,\n 'text' => 'Waarom heeft u voor dit specifieke verband gekozen? (Meerdere antwoorden zijn mogelijk)',\n 'required' => true,\n 'options' => json_encode([\n 'Vormbaar, zacht, comfortabel voor de patiënt',\n 'Vochtig wondmilieu met Hydrofiber',\n 'Bescherming van de wondranden (verticale absorptie)',\n 'Vasthouden van wondvocht en bacteriën (retentie)',\n 'Verbetering/ verkleining van de wond',\n 'Minder verbandwissels en/of draagtijd verlengd',\n 'Eenvoudig te gebruiken',\n 'Goede kennis van en ervaringen met schuimverbanden',\n 'Goede kennis van en ervaringen met Hydrofiber-verbanden',\n 'Type wond en hoeveelheid wondvocht',\n 'Fase van de wond',\n 'Locatie van de wond',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'checkbox',\n 'other' => true,\n 'other_label' => null,\n 'text' => 'Hoe ervaart u het aanbrengen van het verband?',\n 'required' => true,\n 'options' => json_encode([\n 'Gemakkelijk',\n ['Redelijk gemakkelijk (omschrijf)'],\n ['Niet gemakkelijk (omschrijf)'],\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'radio',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Kleeft het verband bij het aanbrengen aan de handschoenen of aan zichzelf?',\n 'required' => true,\n 'options' => json_encode([\n 'Ja',\n 'Nee',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n [\n 'parent_id' => null,\n 'survey_id' => 1,\n 'type' => 'radio',\n 'other' => false,\n 'other_label' => null,\n 'text' => 'Zo ja, is het herpositioneerbaar?',\n 'required' => true,\n 'options' => json_encode([\n 'Ja',\n 'Nee',\n ]),\n 'created_at' => new \\Carbon\\Carbon(),\n 'updated_at' => new \\Carbon\\Carbon(),\n ],\n ]);\n }",
"function testSimpleSurvey()\n\t{\n\t\t$this->loadAndCacheFixture();\n\t\t$this->switchUser(FORGE_ADMIN_USERNAME);\n\t\t$this->gotoProject('ProjectA');\n\n\t\t$this->clickAndWait(\"link=Surveys\");\n\t\t$this->clickAndWait(\"link=Administration\");\n\n\t\t// Create some questions\n\t\t$this->clickAndWait(\"link=Add Question\");\n\t\t$this->type(\"question\", \"This is my first question (radio) ?\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"This is my second question (text area) ?\");\n\t\t$this->select($this->byName(\"question_type\"))->selectOptionByLabel(\"Text Area\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"This is my third question (yes/no) ?\");\n\t\t$this->select($this->byName(\"question_type\"))->selectOptionByLabel(\"Radio Buttons Yes/No\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"This is a comment line of text\");\n\t\t$this->select($this->byName(\"question_type\"))->selectOptionByLabel(\"Comment Only\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"This is a my fifth question (text field) ?\");\n\t\t$this->select($this->byName(\"question_type\"))->selectOptionByLabel(\"Text Field\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"L'année dernière à Noël, 3 < 4, 中国 \\\" <em>, père & fils\");\n\t\t$this->select($this->byName(\"question_type\"))->selectOptionByLabel(\"Text Field\");\n\t\t$this->clickAndWait(\"submit\");\n\n\t\t// Create survey\n\t\t$this->clickAndWait(\"link=Add Survey\");\n\t\t$this->type(\"survey_title\", \"My first survey: L'année dernière à Noël, 3 < 4, 中国 \\\" <em>, père & fils\");\n\t\t$this->clickAndWait(\"to_add[]\");\n\t\t$this->clickAndWait(\"//input[@name='to_add[]' and @value='4']\");\n\t\t$this->clickAndWait(\"//input[@name='to_add[]' and @value='2']\");\n\t\t$this->clickAndWait(\"//input[@name='to_add[]' and @value='5']\");\n\t\t$this->clickAndWait(\"//input[@name='to_add[]' and @value='3']\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->clickAndWait(\"link=My first survey: L'année dernière à Noël, 3 < 4, 中国 \\\" <em>, père & fils\");\n\t\t$this->waitForPageToLoad();\n\t\t$this->assertTextPresent(\"This is a my fifth question (text field) ?\");\n\t\t$this->assertTextPresent(\"This is a comment line of text\");\n\t\t$this->assertTextPresent(\"This is my third question (yes/no) ?\");\n\t\t$this->assertTextPresent(\"This is my second question (text area) ?\");\n\t\t$this->clickAndWait(\"//input[@name='_1' and @value='3']\");\n\t\t$this->type(\"_2\", \"hello\");\n\t\t$this->clickAndWait(\"_3\");\n\t\t$this->clickAndWait(\"_5\");\n\t\t$this->type(\"_5\", \"text\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->clickAndWait(\"link=Administration\");\n\t\t$this->clickAndWait(\"link=Show Results\");\n\t\t$this->clickAndWait(\"link=My first survey: L'année dernière à Noël, 3 < 4, 中国 \\\" <em>, père & fils\");\n\t\t$this->waitForPageToLoad();\n\t\t$this->assertTextPresent(\"Warning - you are about to vote a second time on this survey.\");\n\t\t$this->clickAndWait(\"link=Administration\");\n\t\t$this->clickAndWait(\"link=Show Results\");\n\t\t$this->clickAndWait(\"link=Result\");\n\t\t$this->assertTextPresent(\"YES (1)\");\n\t\t$this->assertTextPresent(\"3 (1)\");\n\t\t$this->assertTextPresent(\"1, 2, 3, 4, 5\");\n\t\t// Check that the number of votes is 1\n\t\t$this->assertEquals(\"1\", $this->getText(\"//main[@id='maindiv']/table/tbody/tr/td[5]\"));\n\n\t\t// Now testing by adding new questions to the survey.\n\t\t$this->clickAndWait(\"link=Surveys\");\n\t\t$this->clickAndWait(\"link=Administration\");\n\t\t$this->clickAndWait(\"link=Add Survey\");\n\t\t$this->clickAndWait(\"link=Add Question\");\n\t\t$this->type(\"question\", \"Another added question ?\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->clickAndWait(\"link=Add Survey\");\n\t\t$this->clickAndWait(\"link=Edit\");\n\t\t$this->clickAndWait(\"to_add[]\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->clickAndWait(\"link=Add Survey\");\n\t\t$this->type(\"survey_title\", \"Q10 ?\");\n\t\t$this->clickAndWait(\"link=Add Question\");\n\t\t$this->type(\"question\", \"Q8 ?\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"Q9 ?\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->type(\"question\", \"Q10 ?\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->clickAndWait(\"link=Add Survey\");\n\t\t$this->clickAndWait(\"link=Edit\");\n\t\t$this->clickAndWait(\"to_add[]\");\n\t\t$this->clickAndWait(\"//input[@name='to_add[]' and @value='8']\");\n\t\t$this->clickAndWait(\"//input[@name='to_add[]' and @value='9']\");\n\t\t$this->clickAndWait(\"submit\");\n\t\t$this->assertTextPresent(\"1, 2, 3, 4, 5, 6, 7, 8, 9\");\n\n\t\t// Check that survey is public.\n\t\t$this->logout();\n\t\t$this->gotoProject('ProjectA');\n\t\t$this->clickAndWait(\"link=Surveys\");\n\t\t$this->assertTextPresent(\"My first survey: L'année dernière à Noël, 3 < 4, 中国 \\\" <em>, père & fils\");\n\n//\t\t// Set survey to private\n//\t\t$this->login(FORGE_ADMIN_USERNAME);\n//\n//\t\t$this->open(\"/survey/?group_id=6\");\n//\t\t$this->clickAndWait(\"link=Surveys\");\n//\t\t$this->clickAndWait(\"link=Administration\");\n//\t\t$this->clickAndWait(\"link=Add Survey\");\n//\t\t$this->clickAndWait(\"link=Edit\");\n//\t\t$this->clickAndWait(\"//input[@name='is_public' and @value='0']\");\n//\t\t$this->clickAndWait(\"submit\");\n//\t\t// Log out and check no survey is visible\n//\t\t$this->clickAndWait(\"link=Log Out\");\n//\t\t$this->select($this->byName(\"none\"))->selectOptionByLabel(\"projecta\");\n//\t\t$this->waitForPageToLoad();\n//\t\t$this->clickAndWait(\"link=Surveys\");\n//\t\t$this->assertTextPresent(\"No Survey is found\");\n//\n//\t\t// Check direct access to a survey.\n//\t\t$this->open(\"/survey/survey.php?group_id=6&survey_id=1\");\n//\t\t$this->waitForPageToLoad();\n//\t\t$this->assertFalse($this->isTextPresent(\"My first survey: L'année dernière à Noël, 3 < 4, 中国 \\\" <em>, père & fils\"));\n\t}",
"public function run()\n {\n factory(App\\Question::class, 5)->create()->each(function ($question) {\n for ($i = 0; $i < 3; $i++) {\n $question->choices()->save(factory(App\\Choice::class)->make());\n }\n });\n }",
"public function run()\n {\n DB::table('surveys')->truncate();\n\n foreach (range(1, 3) as $value)\n {\n $answers = [];\n\n foreach (range(1, 32) as $index)\n {\n $answers[] = ['yes', 'no'][mt_rand(0, 1)];\n }\n\n Survey::create([\n 'uuid' => Str::uuid(),\n 'name' => ['John', 'William', 'Tim', 'Dirk'][mt_rand(0, 3)],\n 'age' => mt_rand(20, 60),\n 'gender' => ['male', 'female'][mt_rand(0, 1)],\n 'answers' => json_encode($answers),\n ]);\n }\n\n }",
"public function testCreateSurveyQuestionChoice0()\n {\n }",
"public function testCreateSurveyQuestionChoice0()\n {\n }",
"public function run()\n {\n //Data Type\n $dataType = $this->dataType('name', 'survey_answer');\n if (!$dataType->exists) {\n $dataType->fill([\n 'name' => 'survey_answer',\n 'slug' => 'survey-answer',\n 'display_name_singular' => 'Survey Answer',\n 'display_name_plural' => 'Survey Answers',\n 'icon' => 'voyager-check',\n 'model_name' => 'Andalusia\\\\Survey\\\\Models\\\\SurveyAnswer',\n 'controller' => '',\n 'generate_permissions' => 1,\n 'description' => '',\n ])->save();\n }\n //Data Rows\n $questionDataType = DataType::where('slug', 'survey-answer')->firstOrFail();\n $dataRowOrder = 0;\n\n $dataRow = $this->dataRow($questionDataType, 'id');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'number',\n 'display_name' => __('voyager::seeders.data_rows.id'),\n 'required' => 1,\n 'browse' => 0,\n 'read' => 0,\n 'edit' => 0,\n 'add' => 0,\n 'delete' => 0,\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'question_id');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'text',\n 'display_name' => ucwords(str_replace(\"_\", \" \", \"question_id\")),\n 'required' => 1,\n 'browse' => 1,\n 'read' => 1,\n 'edit' => 1,\n 'add' => 1,\n 'delete' => 1,\n 'order' => $dataRowOrder++,\n 'details' => [\n 'validation' => [\n 'rule' => 'required'\n ]\n ],\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'survey_answer_belongsto_survey_question_relationship');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'relationship',\n 'display_name' => 'Question',\n 'required' => 1,\n 'browse' => 1,\n 'read' => 1,\n 'edit' => 1,\n 'add' => 1,\n 'delete' => 1,\n 'details' => [\n 'model' => 'Andalusia\\\\Survey\\\\Models\\\\SurveyQuestion',\n 'table' => 'survey_question',\n 'type' => 'belongsTo',\n 'column' => 'question_id',\n 'key' => 'id',\n 'label' => 'question',\n 'pivot_table' => 'admins',\n 'pivot' => '0',\n 'taggable' => '0'\n ],\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'order');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'number',\n 'display_name' => ucwords(str_replace(\"_\", \" \", \"order\")),\n 'required' => 0,\n 'browse' => 1,\n 'read' => 1,\n 'edit' => 1,\n 'add' => 1,\n 'delete' => 1,\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'answer');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'text',\n 'display_name' => ucwords(str_replace(\"_\", \" \", \"answer\")),\n 'required' => 1,\n 'browse' => 1,\n 'read' => 1,\n 'edit' => 1,\n 'add' => 1,\n 'delete' => 1,\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'points');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'number',\n 'display_name' => ucwords(str_replace(\"_\", \" \", \"points\")),\n 'required' => 0,\n 'browse' => 1,\n 'read' => 1,\n 'edit' => 1,\n 'add' => 1,\n 'delete' => 1,\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'created_at');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'timestamp',\n 'display_name' => __('voyager::seeders.data_rows.created_at'),\n 'required' => 0,\n 'browse' => 0,\n 'read' => 1,\n 'edit' => 0,\n 'add' => 0,\n 'delete' => 0,\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n $dataRow = $this->dataRow($questionDataType, 'updated_at');\n if (!$dataRow->exists) {\n $dataRow->fill([\n 'type' => 'timestamp',\n 'display_name' => __('voyager::seeders.data_rows.updated_at'),\n 'required' => 0,\n 'browse' => 0,\n 'read' => 0,\n 'edit' => 0,\n 'add' => 0,\n 'delete' => 0,\n 'order' => $dataRowOrder++,\n ])->save();\n }\n\n //Menu Item\n $menu = Menu::where('name', 'admin')->firstOrFail();\n $parent = MenuItem::where('title', 'Survey Module')->firstOrFail();\n $menuItem = MenuItem::firstOrNew([\n 'menu_id' => $menu->id,\n 'title' => 'Answers',\n 'url' => '',\n 'route' => 'voyager.survey-answer.index',\n ]);\n if (!$menuItem->exists) {\n $menuItem->fill([\n 'target' => '_self',\n 'icon_class' => 'voyager-check',\n 'color' => null,\n 'parent_id' => $parent->id,\n 'order' => 3,\n ])->save();\n }\n\n //Permissions\n Permission::generateFor('survey_answer');\n\n //Content\n SurveyAnswer::create([\n 'question_id' => 1,\n 'order' => 1,\n 'answer' => 'blue',\n 'points' => 20\n ]);\n }",
"public function run()\n {\n $question = HouseQuestion::create([\n 'title' => 'What will happen to the Night King?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Lives',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'Dies',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'Will we see Ice Spiders?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Yes',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'No',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'Please, God, no.',\n 'house_question_id' => $question->id\n ]);\n\n\n $question = HouseQuestion::create([\n 'title' => 'Cleganebowl?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'The Mountain wins',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'The Hound wins',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'Draw',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'Won\\'t take place',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'How many times will we hear the phrase \"Winter has come.\"?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Never',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'Fewer than 5 times',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'Between 5 and 10 times',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'More than 10 times',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'Will Jon ride a dragon (excluding Daenerys)?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Yes',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'No',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'Will Tyrion ride a dragon?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Yes',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'No',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'Will Arya ride a dragon?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Yes',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'No',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'Will King\\'s Landing still be standing when the season is over?',\n ]);\n HouseQuestionOption::create([\n 'label' => 'Yes',\n 'house_question_id' => $question->id\n ]);\n HouseQuestionOption::create([\n 'label' => 'No',\n 'house_question_id' => $question->id\n ]);\n\n $question = HouseQuestion::create([\n 'title' => 'Which character will be the first to die this season?',\n ]);\n foreach (\\App\\Character::all() as $character) {\n HouseQuestionOption::create([\n 'label' => $character->name,\n 'house_question_id' => $question->id\n ]);\n\n }\n foreach (\\App\\HouseCharacter::all() as $character) {\n HouseQuestionOption::create([\n 'label' => $character->name,\n 'house_question_id' => $question->id\n ]);\n }\n\n $question = HouseQuestion::create([\n 'title' => 'Which character will be the last to die this season?',\n ]);\n foreach (\\App\\Character::all() as $character) {\n HouseQuestionOption::create([\n 'label' => $character->name,\n 'house_question_id' => $question->id\n ]);\n\n }\n foreach (\\App\\HouseCharacter::all() as $character) {\n HouseQuestionOption::create([\n 'label' => $character->name,\n 'house_question_id' => $question->id\n ]);\n }\n }",
"public function run()\n {\n $question = new TemplateQuestion();\n $question->question = 'Conducted by?';\n $question->template_section_id = 1;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'date?';\n $question->template_section_id = 1;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'Location';\n $question->template_section_id = 1;\n $question->save();\n\n //seed another section\n\n $question = new TemplateQuestion();\n $question->question = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';\n $question->template_section_id = 2;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'trash empty?';\n $question->template_section_id = 2;\n $question->save();\n\n $question = new TemplateQuestion();\n $question->question = 'Water shut off?';\n $question->template_section_id = 2;\n $question->save();\n\n\n }",
"public function run()\n {\n $questions = Question::all();\n \n foreach ($questions as $question) {\n for ($i=1; $i <= 1; $i++) { \n factory(QuestionOption::class)->create([\n 'option' => \"opcion correcta\",\n 'correct' => true,\n 'question_id' => $question->id,\n ]);\n }\n for ($i=1; $i <= 3; $i++) { \n factory(QuestionOption::class)->create([\n 'option' => \"opcion\",\n 'correct' => false,\n 'question_id' => $question->id,\n ]);\n }\n }\n }",
"public function testCreateSurveyQuestion0()\n {\n }",
"public function testCreateSurveyQuestion0()\n {\n }",
"public function testCreateSurvey0()\n {\n }",
"public function testCreateSurvey0()\n {\n }",
"public function reset_survey_options_post()\n\t\t{\n\t\t\t$uuid = $this->post('uuid');\n\t\t\t$weekSend = $this->post('weekSend');\n\t\t\tif(!empty($uuid) && !empty($weekSend))\n\t\t\t{\n\t\t\t\t$this->db->where('tans_uuid' , $uuid)\n\t\t\t\t\t\t->where('tans_week' , $weekSend)\n\t\t\t\t\t\t->delete('plused_test_answers');\n\t\t\t\t$data['status'] = $this->lang->line('SUCCESS');\n\t\t\t\t$data['message'] = $this->lang->line('VALID_TOKEN_MESSAGE');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$data['status'] = $this->lang->line('FAIL');\n\t\t\t\t$data['message'] = $this->lang->line('please_pass_required');\n\t\t\t}\n\t\t\t$this->response($data , 200);\n\t\t}",
"public function run()\n {\n factory(Question::class, mt_rand(50, 80))\n ->make()\n ->each(function (Question $question) {\n $question->user_id = $this->getUserId();\n\n $question->save();\n\n $question->categories()->sync($this->getCategories());\n\n $this->makeAnswers($question);\n });\n }",
"function fillSurveyForUser($user_id = ANONYMOUS_USER_ID)\n\t{\n\t\tglobal $ilDB;\n\t\t// create an anonymous key\n\t\t$anonymous_id = $this->createNewAccessCode();\n\t\t$this->saveUserAccessCode($user_id, $anonymous_id);\n\t\t// create the survey_finished dataset and set the survey finished already\n\t\t$active_id = $ilDB->nextId('svy_finished');\n\t\t$affectedRows = $ilDB->manipulateF(\"INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp) \".\n\t\t\t\"VALUES (%s, %s, %s, %s, %s, %s)\",\n\t\t\tarray('integer','integer','integer','text','text','integer'),\n\t\t\tarray($active_id, $this->getSurveyId(), $user_id, $anonymous_id, 1, time())\n\t\t);\n\t\t// fill the questions randomly\n\t\t$pages =& $this->getSurveyPages();\n\t\tforeach ($pages as $key => $question_array)\n\t\t{\n\t\t\tforeach ($question_array as $question)\n\t\t\t{\n\t\t\t\t// instanciate question\n\t\t\t\trequire_once \"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php\";\n\t\t\t\t$question =& SurveyQuestion::_instanciateQuestion($question[\"question_id\"]);\n\t\t\t\t$question->saveRandomData($active_id);\n\t\t\t}\n\t\t}\t\t\n\t}",
"public function run()\n {\n DB::table('questions')->delete();\n DB::table('answers')->delete();\n\n $answers = [\n [\n 'answer_text' => 'Ответ 1',\n 'is_right' => false\n ],\n [\n 'answer_text' => 'Ответ 2',\n 'is_right' => true\n ],\n [\n 'answer_text' => 'Ответ 3',\n 'is_right' => false\n ],\n [\n 'answer_text' => 'Ответ 4',\n 'is_right' => false\n ],\n ];\n\n $question = Question::create([\n 'question_text' => 'Первый вопрос'\n ]);\n\n foreach ($answers as $answer)\n {\n $question->answers()->create($answer);\n }\n\n $question = Question::create([\n 'question_text' => 'Второй вопрос'\n ]);\n\n foreach ($answers as $answer)\n {\n $question->answers()->create($answer);\n }\n $question = Question::create([\n 'question_text' => 'Третий вопрос'\n ]);\n\n foreach ($answers as $answer)\n {\n $question->answers()->create($answer);\n }\n $question = Question::create([\n 'question_text' => 'Четвертый вопрос'\n ]);\n\n foreach ($answers as $answer)\n {\n $question->answers()->create($answer);\n }\n $question = Question::create([\n 'question_text' => 'Пятый вопрос'\n ]);\n\n foreach ($answers as $answer)\n {\n $question->answers()->create($answer);\n }\n $question = Question::create([\n 'question_text' => 'Шестой вопрос'\n ]);\n\n foreach ($answers as $answer)\n {\n $question->answers()->create($answer);\n }\n\n }",
"public function run()\n {\n DB::table('questions')->insert([\n \t'quiz_id' => str_random(1),\n \t'question_text' => str_random(10)\n ]);\n }",
"public function run()\n {\n foreach (\\ProductionSeeder::PRODUCTION_DATA as $data) {\n $shop = Shop::where('lang', $data['language'])->get()->first();\n\n for ($j = 1; $j <= 3; $j++) {\n Survey::create(['shop_id' => $shop->id ,'lang' => $data['language'], 'event_type' => $j, 'count' => 0, 'detractors' => 0, 'passives' => 0, 'promoters' => 0]);\n }\n }\n }",
"public function run() {\n DB::table('answers')->truncate();\n $completedSurveys = CompletedSurvey::all();\n foreach ($completedSurveys as $completedSurvey) {\n $questions = DB::table('question_survey')\n ->join('questions', 'question_survey.question_id', '=', 'questions.id')\n ->where('question_survey.survey_id', '=', $completedSurvey['survey_id'])\n ->get();\n foreach ($questions as $question) {\n $value = rand(1, $question->max_rate);\n Answer::create([\n 'completed_survey_id' => $completedSurvey['id'],\n 'question_id' => $question->id, \n 'value' => $value,\n ]);\n }\n }\n }",
"public function seed()\n {\n if(!(php_sapi_name() == 'cli-server'))\n return 403;\n\n if($this->request->server['REMOTE_ADDR'] != '127.0.0.1' && $this->request->server['REMOTE_ADDR'] != '::1')\n return 403;\n\n $matcher = new SurveyMatcher();\n $matcher->seed((isset($this->request->get['limit']) ? $this->request->get['limit'] : 150));\n\n $this->response->write('OK');\n }",
"public function run()\n {\n DB::table('survey_questionnaires')->insert([\n array(\n 'user_id' => 35,\n 'survey_header_id' => 1,\n 'question' => 'How satisfied are you with the performance of our customer service representative?',\n 'status' => 1,\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now()\n ),\n array(\n 'user_id' => 35,\n 'survey_header_id' => 1,\n 'question' => 'How responsive have we been to your questions or concerns about our products?',\n 'status' => 1,\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now()\n ),\n ]);\n }",
"public function testCreateSurvey()\n {\n $data = [\n 'year' => 2020,\n 'type' => Survey::TRAINER,\n 'title' => 'My Awesome Survey',\n 'prologue' => 'Take the survey',\n 'epilogue' => 'Did you take it?'\n ];\n\n $response = $this->json('POST', 'survey', [\n 'survey' => $data\n ]);\n\n $response->assertStatus(200);\n $this->assertDatabaseHas('survey', $data);\n }",
"public function questions($survey = \"\")\n {\n\n $surveyPrefix = \"\";\n $surveyData = $this->survey_model->getSurveyPrefix($survey);\n $data[\"valid_survey\"] = true;\n $data[\"show_questions\"] = true;\n $data[\"survey_errors\"] = false;\n\n // check if the provided slug was valid\n if($surveyData != null) {\n\n // populate survery information\n $surveyPrefix = $surveyData->prefix;\n $data[\"survey_title\"] = $surveyData->title;\n $data[\"survey_subtitle\"] = $surveyData->subtitle;\n }\n else {\n $data[\"valid_survey\"] = false; // display error\n }\n\n // check if the survey was submitted\n if($_SERVER['REQUEST_METHOD'] == 'POST' && $data[\"valid_survey\"]) {\n $result = $this->survey_model->validateSubmission($surveyPrefix);\n if(array_key_exists(\"errors\", $result)) {\n $data[\"errors\"] = $result[\"errors\"];\n $data[\"survey_errors\"] = true;\n }\n else {\n $data[\"show_questions\"] = false;\n }\n }\n\n // check if the user specified a valid survey\n if(!empty($surveyPrefix)) {\n\n $data[\"questions\"] = $this->survey_model->getSurveyData($surveyPrefix);\n ($data[\"questions\"] === null) ? $data[\"valid_survey\"] = false: \"\";\n }\n\n $data[\"active_surveys\"] = \"\";\n $this->load->view('templates/survey/header', $data);\n $this->load->view('templates/survey/nav');\n $this->load->view('templates/survey/survey', $data);\n $this->load->view('templates/survey/footer');\n }",
"public function run()\n {\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"3\";\n $question->question = \"What is Vaixel\";\n $question->answer = \"e are a transit advertising company headquartered in Casablanca, Morocco which services markets nationwide. As a new communication channel, we specialize in getting a brand’s message seen in geographies of interest through the means of car wrap advertising applied on everyday driver’s cars.\nWe work with our brand partners in understanding their marketing goals. If hyper-targeted brand-awareness is an important piece of the media plan, we will make an appropriate campaign recommendation regarding the wrap style, quantity of cars, and campaign duration.\nOnce confirmed, we then recruit, screen, and admit drivers into our brand partner’s campaign who drive in the region of interest and who hit all four of our needed driver quality check points. At a confirmed start date, all admitted drivers come to our facility and their vehicles are wrapped in our brand partner’s advertisement in a matter of hours. The car is then returned to the owner, and for the next several months the car is generating powerful impressions everywhere they drive in their community. Through the use of our phone app, all driving activity is tracked and reported back to our brand partner on a monthly basis.\n\";\n $question->save();\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"1\";\n $question->question = \"How am I paid as a Driver ?\";\n $question->answer = \"We take your bank details the day of the fitting. The payments are then made into your account via a secured transfer at the end of each month.\n Three weeks into the campaign you will be asked to complete a short form which will require you to upload photos of your car and a mileage reading. If this is returned by Thursday 5pm we will check it and payments will be made before the following Monday. If returned after this time then payments will be made the following Friday. This process repeats each month until the end of the campaign. \";\n $question->save();\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"1\";\n $question->question = \"How can I, as a driver, get paid ?\";\n $question->answer = \"It depends on the advertisers and length of a campaign that you are matched with as well as the size and type of advert applied to your car\";\n $question->save();\n\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"1\";\n $question->question = \"Is it free to register as a Driver ?\";\n $question->answer = \"It's completely free to register. You will never have to pay for anything throughout the campaign. Our income is from the brands that want to advertise on your car, never from car owners.\";\n $question->save();\n\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"1\";\n $question->question = \"Is my car suitable ?\";\n $question->answer = \"We have all sorts of cars on our campaigns. For the majority of campaigns, your car will need to be 2009 or newer, that's not to say there isn't a campaign for you if your car is older. It just might take a while longer to find the right one for you.\n\nWe do not accept motorbikes or convertibles unfortunately. This is because of the way in which we apply the adverts. We require the back window of a car to display an advert at all times.\";\n $question->save();\n\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"2\";\n $question->question = \"How can I, as a brand, verify the reliability of Vaixel drivers ?\";\n $question->answer = \"We use KYC/AML Application to get the best security possible for both the driver and the company. Using an AI-based identity verification software, we guarantee to both parties, the highest level of security. Also, a personal data protection is insured, no matter where you are located.\";\n $question->save();\n\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"3\";\n $question->question = \"How do you pick drivers for a campaign ?\";\n $question->answer = \"We select drivers for our brand partner’s campaign by reaching into our expansive driver network and hand selecting the drivers who generate the most exposure in the geographic areas we are targeting.\";\n $question->save();\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"3\";\n $question->question = \"Can we pick the drivers ?\";\n $question->answer = \"Due to the privacy policies we have in place with our network of registered drivers, we do not open sheet our inventory of drivers for our brand partners to select from. Our brand partner select the location and quantity of cars, and we screen and select the car drivers within our network that match the driver quality criteria.\";\n $question->save();\n\n $question = new \\App\\ContentModels\\Question();\n $question->question_category_id = \"3\";\n $question->question = \"How long does it take to set up a campaign ?\";\n $question->answer = \"Vaixel requires at least one month from agreement signing to having all cars wrapped and on the road. The driver screening and selection process requires at least two weeks, and, depending upon how many cars are being wrapped, another two weeks to wrap and roll-out all drivers we select for the campaign.\";\n $question->save();\n\n }",
"public function run()\n {\n $faker = Faker::create();\n for($i = 0; $i<40; $i++){\n Question::create([\n 'title' =>$faker->name,\n 'desc' => $faker->text,\n 'img' => $faker->name,\n 'visited' => rand(1, 10000),\n 'created' => \\Carbon\\Carbon::now(),\n 'status' => 'open',\n 'cat_id' => rand(1, 5),\n 'user_id' => rand(11, 20)\n ]);\n }\n }",
"function survey_data() {\n $surveys = array();\n foreach ( $this->sites as $name => $blog ) {\n $this->println(sprintf(\"Surveying Blog #%s: %s.\", $blog->id, $blog->name));\n $survey = $this->survey_site($blog->id);\n $surveys[$blog->name] = $survey;\n }\n\n // Compile meta survey.\n $posts = array();\n $site_counts = array();\n $meta_survey = array(\n 'posts' => 0,\n 'media-images' => 0,\n 'media-images-sans-alt' => 0,\n 'embedded-images' => 0,\n 'embedded-images-sans-alt' => 0,\n 'embedded-images-sans-media' => 0,\n 'embedded-images-external' => 0\n );\n foreach ( $surveys as $name => $survey ) {\n $posts += $survey['posts'];\n $counts = $survey['counts'];\n $meta_survey['posts'] += $counts['posts'];\n $meta_survey['media-images'] += $counts['media-images'];\n $meta_survey['media-images-sans-alt'] += $counts['media-images-sans-alt'];\n $meta_survey['embedded-images'] += $counts['embedded-images'];\n $meta_survey['embedded-images-sans-alt'] += $counts['embedded-images-sans-alt'];\n $meta_survey['embedded-images-sans-media'] += $counts['embedded-images-sans-media'];\n $site_counts[$name] = $counts;\n }\n\n // Count non-uploaded images\n foreach ( $posts as $post ) {\n $meta_survey['embedded-images-external'] += count($post->external_embedded_images());\n }\n\n $report_f = <<<EOB\nSITES:\n%s\n\nMETA:\n%s\nEOB;\n return sprintf($report_f, print_r($site_counts, 1), print_r($meta_survey, 1));\n }"
]
| [
"0.6794552",
"0.6496091",
"0.64505845",
"0.6353992",
"0.63290024",
"0.6280974",
"0.62331206",
"0.62331206",
"0.6232955",
"0.61869824",
"0.6175409",
"0.61639905",
"0.61443573",
"0.61443573",
"0.6116665",
"0.6116665",
"0.60886014",
"0.59637576",
"0.59228444",
"0.5886003",
"0.5859587",
"0.58335453",
"0.58283013",
"0.58217674",
"0.58066905",
"0.58058107",
"0.579743",
"0.5780687",
"0.5754444",
"0.5754259"
]
| 0.6801664 | 0 |
Mit dieser Funktion kann ich alle User auslesen. | public function getAllUsers(){
return $this->user;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function all_user()\n {\n $this->res->SetObject(RCD::SC, RCD::SC, FALSE, $this->db->get('user')->result());\n }",
"public function getUsers() {\n\n $users = $this->users_model->getallusers();\n exit;\n }",
"public function listarUser() {\n if(IDUSER) {\n $eval = \"SELECT id,nombre,apellidos,email FROM users\";\n $peticion = $this->db->prepare($eval);\n $peticion->execute();\n $resultado = $peticion->fetchAll(PDO::FETCH_OBJ);\n exit(json_encode($resultado));\n } else {\n http_response_code(401);\n exit(json_encode([\"error\" => \"Fallo de autorizacion\"])); \n }\n }",
"public function getAllUser(){\n return $this->users;\n }",
"function get_users()\n {\n //Unimplemented\n }",
"public function list_user()\n\t{\n\t\tcheck_access_level_superuser();\n\t\t$data = [\n\t\t\t'list_user' => $this->user_m->get_cabang(),\n\t\t\t'list_cabang' => $this->data_m->get('tb_cabang')\n\t\t];\n\t\t$this->template->load('template2', 'user/list_user', $data);\n\t}",
"function get_users()\n\t{\n\n\t\trequire_once('modules/Users/User.php');\n\t\t\n\t\t$query = \"SELECT user_id as id FROM roles_users WHERE role_id='$this->id' AND deleted=0\";\n\t\t\n\t\treturn $this->build_related_list($query, new User());\n\t}",
"public function getUsersList()\n {\n }",
"public function allUser(){\n\n\t\t\t$data=$this->all('oops');\n\t\t\treturn $data;\n\t\t}",
"function d4os_io_db_070_os_user_load_all() {\n $users = array();\n d4os_io_db_070_set_active('os_robust');\n $result = db_query(\"SELECT *, ua.FirstName AS username, ua.LastName AS lastname, ua.PrincipalID AS UUID, ua.Email AS email, CONCAT_WS(' ', FirstName, LastName) AS name FROM {UserAccounts} AS ua\");\n while ($user = db_fetch_object($result)) {\n $users[] = $user;\n }\n d4os_io_db_070_set_active('default');\n return $users;\n}",
"public static function getAllUser()\n\t{\n\t\treturn array(self::_getDao()->count(), self::_getDao()->getAll());\n\t}",
"public function allUsers()\n {\n $users = $this->user->findAll();\n $this->show('admin/allusers', ['users' => $users]);\n }",
"function getUsers(){\n }",
"function getUsers(){\n }",
"private function loadUsers() {\n\t\t\n\t\t\t$sql = \"SELECT usr_id FROM usr_cmp WHERE cmp_id='$companyID'\";\n\t\t\t\n\t\t\t$rawResult = $gremlin->query($sql);\n\t\t\t\n\t\t\tforeach($rawResult as $newCont) {\n\t\t\t\n\t\t\t\t$newUser = new User($newCont);\n\t\t\t\n\t\t\t\t$this->usersInCompany[] = $newUser;\n\t\t\t\n\t\t\t}\n\t\t\n\t\t}",
"function d4os_io_db_070_os_user_get_all_uid() {\n $list = array();\n $result = db_query(\"SELECT * FROM {d4os_ui_users}\");\n while ($user = db_fetch_object($result)) {\n $list[] = $user;\n }\n return $list;\n}",
"public function setUserFields() {\n $fields = $this->dictionary->toArray();\n /* allow overriding of class key */\n if (empty($fields['class_key'])) $fields['class_key'] = 'modUser';\n\n $fields = $this->filterAllowedFields($fields);\n\n /* set user and profile */\n $this->user->fromArray($fields);\n $this->user->set('username',$fields[$this->controller->getProperty('usernameField','username')]);\n $this->user->set('active',0);\n $version = $this->modx->getVersionData();\n /* 2.1.x+ */\n if (version_compare($version['full_version'],'2.1.0-rc1') >= 0) {\n $this->user->set('password',$fields[$this->controller->getProperty('passwordField','password')]);\n } else { /* 2.0.x */\n $this->user->set('password',md5($fields[$this->controller->getProperty('passwordField','password')]));\n }\n $this->profile->fromArray($fields);\n $this->profile->set('email',$this->dictionary->get($this->controller->getProperty('emailField','email')));\n $this->profile->set('fullname',$fields[$this->controller->getProperty('fullnameField','fullname')]);\n $this->user->addOne($this->profile,'Profile');\n\n /* add user groups, if set */\n $userGroupsField = $this->controller->getProperty('usergroupsField','');\n $userGroups = !empty($userGroupsField) && array_key_exists($userGroupsField,$fields) ? $fields[$userGroupsField] : array();\n $this->setUserGroups($userGroups);\n }",
"public function listUser() {\n\t\t$users = new Model_Users();\n\t\t$listeUsers = $users->listUsers();\n\t\trequire_once($_SERVER['DOCUMENT_ROOT'].\"/ecommerce/views/admin/users/liste_users.php\");\n\t}",
"Public Function getAllUsers()\n\t{\n\t\t$Output = array();\n\t\t$Users = $this->_db->fetchAll('SELECT * FROM bevomedia_user');\n\t\tforeach($Users as $User)\n\t\t\t$Output[] = new User($User->id);\n\t\t\t\n\t\treturn $Output;\n\t}",
"abstract public function user();",
"function get_user_list(){\n\t\treturn array();\n\t}",
"function XMLUserPeer() {\n global $g, $config;\n\n parent::AbstractUserPeer();\n\n if (isset($config['system']['user'])) {\n $i = 0;\n\n foreach($config['system']['user'] as $userent) {\n $this->user_index[$userent['name']] = $i;\n $this->addUserFromEnt($userent);\n $i++;\n }\n }\n }",
"public function refreshUserACLs() {\r\n if ($this->modx->getUser()) {\r\n $this->modx->user->getAttributes(array(), '', true);\r\n }\r\n }",
"public function buscarUsuarios(){\n\t\t}",
"public function getLTIUsers();",
"abstract protected function getUser();",
"public static function initFeUser() {}",
"public function __loadUser()\n {\n\t$facebook = $this->fb;\n\t$this->user = $facebook->api(\"/me\", \"GET\");\n\t$this->userid = $facebook->getUser();\n\treturn;\n }",
"public function getAllUsers(): array\n {\n return $this->em->getRepository('AppBundle:User')->findAll();\n }",
"protected function setupUsers() {\n $this->translator = $this->drupalCreateUser($this->getTranslatorPermissions(), 'translator');\n $this->editor = $this->drupalCreateUser($this->getEditorPermissions(), 'editor');\n $this->administrator = $this->drupalCreateUser($this->getAdministratorPermissions(), 'administrator');\n $this->drupalLogin($this->translator);\n }"
]
| [
"0.7165581",
"0.68616813",
"0.68533546",
"0.68479013",
"0.683198",
"0.6820137",
"0.6802775",
"0.67831945",
"0.6772477",
"0.6759042",
"0.6733296",
"0.6715137",
"0.66944456",
"0.66944456",
"0.6669951",
"0.6668016",
"0.6647128",
"0.6645296",
"0.66284746",
"0.65976834",
"0.658606",
"0.65712625",
"0.6566456",
"0.6563234",
"0.652692",
"0.65221393",
"0.6518133",
"0.6511679",
"0.6500801",
"0.6497636"
]
| 0.7200492 | 0 |
Returns the minimum and maximum dates based on a specific sensor's data points. | public function getMinMaxDates($userId, $sensorId) {
try {
$connection = Configuration::openConnection();
$statement = $connection->prepare("SELECT MIN(date_time) AS minDate, MAX(date_time) AS maxDate FROM dataPoints WHERE user_id=:userId AND sensor_id=:sensorId");
$statement->bindParam(":userId", $userId, PDO::PARAM_STR);
$statement->bindParam(":sensorId", $sensorId, PDO::PARAM_STR);
$statement->execute();
$results = $statement->fetch(PDO::FETCH_ASSOC);
$dates['minimum'] = $results['minDate'];
$dates['maximum'] = $results['maxDate'];
return json_encode($dates, JSON_PRETTY_PRINT);
}
catch (PDOException $pdo) {
return json_encode(array('error' => $pdo->getMessage()), JSON_PRETTY_PRINT);
}
finally {
Configuration::closeConnection();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMinMaxForRange($date_start, $date_end) {\n $query = \"SELECT MIN(price) AS minPrice,\n MAX(price) AS maxPrice\n FROM np_data\n WHERE (\n (date BETWEEN '$date_start' AND '$date_end' AND hour != '23')\n OR (date = ($date_start - INTERVAL 1 DAY) AND hour = '23')\n )\";\n if ($result = $this->link->query($query)) {\n /* free result set */\n $row = mysqli_fetch_array($result);\n $result->close();\n $resultArray = array (\n 'min' => $row['minPrice'],\n 'max' => $row['maxPrice']\n );\n return $resultArray;\n }\n }",
"public function getLimitsConsumptionDates(): array\n {\n if ($this->isLogged === false) {\n $this->login();\n }\n\n $response = $this->client->get(self::URI_LIMITS_CONSUMPTION_DATES);\n if ($response->getStatusCode() !== 200) {\n $this->isLogged = false;\n return false;\n }\n\n $data = json_decode($response->getBody()->getContents());\n $result = [\n 'min' => \\DateTime::createFromFormat('d-m-YH:i:s', $data->fechaMinima),\n 'max' => \\DateTime::createFromFormat('d-m-YH:i:s', $data->fechaMaxima),\n ];\n\n return $result;\n }",
"function availableDates($file=\"data/brislington_no2.xml\") {\n\t$xmlReader = new xmlReader();\n\t$xmlReader->open($file);\n\t$Values = [];\n\n\twhile($xmlReader->read()) {\n\t\tif($xmlReader->nodeType == XMLReader::ELEMENT && $xmlReader->localName == \"reading\") {\n\n\t\t\t$no2 = $xmlReader->getAttribute('no2');\n\n\t\t\t$date = $xmlReader->getAttribute('date');\n\t\t\t$date = str_replace('/', '-', $date);\n\t\t\t$d = strtotime($date);\n\n\t\t\t$Values[] = $d;\n\t\t}\n\t}\n\n\t$maxDate = max($Values);\n\t$minDate = min($Values);\n\n\t$max = date('Y-m-d', $maxDate);\n\t$min = date('Y-m-d', $minDate);\n\n\t$array = array(\n\t\t\t'min' => $min,\n\t\t\t'max' => $max\n\t\t);\n\n\treturn $array;\n}",
"protected function _getDateRange()\n {\n if (is_null($this->_dateRange)) {\n $this->_dateRange = array();\n $rules = $this->getAttributeObject()->getValidateRules();\n if (isset($rules[self::MIN_DATE_RANGE_KEY])) {\n $this->_dateRange[self::MIN_DATE_RANGE_KEY] = $rules[self::MIN_DATE_RANGE_KEY];\n }\n if (isset($rules[self::MAX_DATE_RANGE_KEY])) {\n $this->_dateRange[self::MAX_DATE_RANGE_KEY] = $rules[self::MAX_DATE_RANGE_KEY];\n }\n }\n return $this->_dateRange;\n }",
"public function setMinMaxDate($minDate, $maxDate) {\r\n $this->setMinMax($minDate->toDouble(), $maxDate->toDouble());\r\n }",
"private function getTimeExtent($dates)\n {\n if (count($dates) === 0 || !isset($dates[0])) {\n return array(\n 'startDate' => null,\n 'completionDate' => null\n );\n }\n\n $startDate = $dates[0];\n $competionDate = $dates[0];\n for ($i = 1, $ii = count($dates); $i < $ii; $i++) {\n if (isset($dates[$i])) {\n if ($startDate > $dates[$i]) {\n $startDate = $dates[$i];\n }\n if ($competionDate < $dates[$i]) {\n $competionDate = $dates[$i];\n }\n }\n }\n\n return array(\n 'startDate' => $startDate,\n 'completionDate' => $competionDate\n );\n }",
"function getMinHours($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour){\n\t\t//Declaring arrays\n\t\t$HOURS_IN_DAY = 24;\n\t\t$hourly_array = accessData($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour);\n\t\t$all_hours_array = array();\n\t\t$min_array = array();\n\t\t\n\t\t//Initializing the array that will hold every single count for each hour. \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\t$all_hours_array[$i] = array();\n\t\t}\n\t\t\n\t\t//This creates an associative array, with all the results for a specific hour stored in an array contained within the associative array.\n\t\t//A value indicates how many people triggered the sensor for that specific time period (year, month, day, hour).\n\t\tforeach($hourly_array as $year => $temp1){\n\t\t\tforeach($hourly_array[$year] as $month => $temp2){\n\t\t\t\tforeach($hourly_array[$year][$month] as $day => $temp3){\n\t\t\t\t\tforeach($hourly_array[$year][$month][$day] as $hour => $value){\n\t\t\t\t\t\tarray_push($all_hours_array[$hour], $value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//This will sort each array for each hour value in descending order, then it will set the minimum array value for that hour\n\t\t//by grabbing the first value for each array from $all_hours_array.\n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\tsort($all_hours_array[$i]);\n\t\t\t$min_array[$i] = $all_hours_array[$i][0];\n\t\t}\n\t\t\n\t\t//Any values that are still null will be set to 0. \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\tif($min_array[$i] == NULL)\n\t\t\t\t$min_array[$i] = 0;\n\t\t}\n\t\t\n\t\treturn $min_array;\n\t}",
"private function getSensorDefectiveDate($sensorID, $startDayDate, $endDayDate) {\n \t$displayType = \"0\";\n \t$generateAllSensors = \"false\";\n \t$dateList = $this->processDataRanges($displayType, $generateAllSensors, \n \t\t\t\t\t\t\t\t\t $startDayDate, $endDayDate);\n \t$fileDirectory = \"null\";\n \t$sensors = DB::table('tbl_sensors')->get();\n \t$categories = DB::table('tbl_categories')->get();\n \t$tempFileName = \"\";\n \t$sensorDefectiveDate = array();\n \t$categoryID = \"\";\n \t$categoryName = \"\";\n \t$dateToday = date(\"Y\") . \"/\" . sprintf(\"%02d\", date(\"m\")) . \"/\" . sprintf(\"%02d\", date(\"d\"));\n\n \tforeach ($dateList as $_date) {\n \t\t$date = explode(\"/\", $_date);\n\t\t\t$fileDir = \"data/\" . $date[0] . \"/\" . sprintf(\"%02d\", $date[1]) . \"/\" . \n\t\t\t\t\t sprintf(\"%02d\", $date[2]) . \"/\";\t\t\n\n\t\t\tforeach ($sensors as $sensor) {\n\t\t\t\tif ($sensor->id == $sensorID){\n\t\t\t\t\t$tempFileName = $sensor->assoc_file;\n\t\t\t\t\t$categoryID = $sensor->category_id;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tforeach ($categories as $category) {\n\t\t\t\tif ($categoryID == $category->id) {\n\t\t\t\t\t$categoryName = $category->name;\n\t\t\t\t\t$categoryName = strtoupper($categoryName);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (is_dir($fileDir)) {\n\t\t\t\t$fileNames = scandir($fileDir);\n\t\t\t\t$fileDirectory = \"null\";\n\n\t\t\t\tforeach ($fileNames as $fileName) {\n\t\t\t\t\tif(stripos($fileName, $tempFileName) !== false){\n\t\t\t\t\t\t$fileDirectory = $fileDir . $fileName;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($fileDirectory == \"null\") {\n\t\t\t\t\t$sensorDefectiveDate[] = \"$_date - No sensor data was transmitted.\";\n\t\t\t\t} else if ($fileDirectory != \"null\") {\n\t\t\t\t\t$file = fopen($fileDirectory, \"r\");\n\n\t\t\t\t\twhile(! feof($file)){\n\t\t\t\t\t\t$tempData[] = fgetcsv($file);\n\t\t\t\t\t}\n\n\t\t\t\t\tfclose($file);\n\n\t\t\t\t\t$countData = count($tempData) - 7;\n\t\t\t\t\tunset($tempData);\n\n\t\t\t\t\tif ($countData == 0) {\n\t\t\t\t\t\t$sensorDefectiveDate[] = \"$_date - No sensor data was transmitted.\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ($categoryName == \"AUTOMATED RAIN GAUGES\" && $_date != $dateToday) {\n\t\t\t\t\t\t\tif ($countData > 0 && $countData < 96) {\n\t\t\t\t\t\t\t\t$sensorDefectiveDate[] = \"$_date - There is transmitted sensor data but incomplete.\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if ($categoryName == \"AUTOMATED STREAM GAUGES\" || \n\t\t\t\t\t\t\t\t $categoryName == \"AUTOMATED RAIN AND STREAM GAUGES\" && \n\t\t\t\t\t\t\t\t $_date != $dateToday) {\n\n\t\t\t\t\t\t\tif ($countData > 0 && $countData < 144) {\n\t\t\t\t\t\t\t\t$sensorDefectiveDate[] = \"$_date - There is transmitted sensor data but incomplete.\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$sensorDefectiveDate[] = \"$_date - No sensor data was transmitted.\";\n\t\t\t}\n \t}\n\n \treturn $sensorDefectiveDate;\n }",
"public function dates()\n {\n \t$question_id = Question::idByName('Register Page Start Date');\n \t$dates = $this->pages()\n \t\t\t\t\t->join('htc_survey_page_questions', 'htc_survey_pages.id', '=', 'htc_survey_page_questions.htc_survey_page_id')\n \t\t\t\t->join('htc_survey_page_data', 'htc_survey_page_questions.id', '=', 'htc_survey_page_data.htc_survey_page_question_id')\n \t\t\t\t->where('question_id', $question_id)\n \t\t\t\t->lists('answer');\n if(!count($dates)>0)\n {\n \t$dates = [$this->date_submitted];\n }\n usort($dates, function($a, $b) {\n\t\t $dateTimestamp1 = strtotime($a);\n\t\t $dateTimestamp2 = strtotime($b);\n\n\t\t return $dateTimestamp1 < $dateTimestamp2 ? -1: 1;\n\t\t});\n return json_encode(['min' => $dates[0], 'max' => $dates[count($dates)-1]]);\n }",
"public function getPeriodDatesProperty()\n {\n $now = Carbon::now()->timezone(\"America/Bogota\");\n $min = $now->copy();\n $max = $now->copy();\n\n switch ($this->period) {\n case 'today':\n break;\n case 'yesterday':\n $min->subDay();\n $max->subDay();\n break;\n case 'thisWeek':\n $min->startOfWeek();\n $max->endOfWeek();\n break;\n case 'lastWeek':\n $min->subWeek()->startOfWeek();\n $max->subWeek()->endOfWeek();\n break;\n case 'thisFortnight':\n if ($min->day > 15) {\n $min->day(16);\n $max->endOfMonth();\n } else {\n $min->startOfMonth();\n $max->startOfMonth()->addDays(14);\n }\n break;\n case 'lastFortnight':\n if ($min->day > 15) {\n $min->startOfMonth();\n $max->startOfMonth()->addDays(14);\n } else {\n $min->subMonth()->day(16);\n $max->subMonth()->endOfMonth();\n }\n break;\n case 'thisMonth':\n $min->startOfMonth();\n $max->endOfMonth();\n break;\n case 'lastMonth':\n $min->subMonth()->startOfMonth();\n $max->subMonth()->endOfMonth();\n break;\n\n default:\n # code...\n break;\n }\n\n $min->startOfDay();\n $max->endOfDay();\n $format = 'd-m-y H:i:s';\n\n return [\n 'min' => $min,\n 'minView' => $min->format($format),\n 'max' => $max,\n 'maxView' => $max->format($format),\n ];\n }",
"public function setMinMaxDate($minDate = 'null', $maxDate = 'null') {\n \n if($minDate != 'null'){\n $this->_config_mapper(Array('minDate' => \"'\" . $minDate . \"'\")); \n }\n \n if($maxDate != 'null'){\n $this->_config_mapper(Array('maxDate' => \"'\" . $maxDate . \"'\")); \n }\n }",
"function getMinMaxLatLon(){\n global $mysqli;\n $sql = \"SELECT MIN( lat ) lat_min, MAX( lat ) lat_max, MIN( lon ) lon_min, MAX( lon ) lon_max FROM `osm_nodes`\";\n $retval = $mysqli->query($sql);\n if($retval && $row = $retval->fetch_assoc()){\n return array($row['lat_min'], $row['lat_max'], $row['lon_min'], $row['lon_max']);\n }\n else{\n return null;\n }\n}",
"public function sensorRecentReadings($sensorId, $datapoint)\n {\n $sensorDetail = Device::where('unique_id', '=', floatval($sensorId))->first();\n foreach($sensorDetail->data_points as $data_point){\n if($data_point['point'] == $datapoint){\n $minT = $data_point['minT'];\n $maxT = $data_point['maxT'];\n }\n }\n $reading = 0;\n //date_default_timezone_set(\"Europe/London\");\n $date = new DateTime(date(\"Y-m-d\"));\n $sensordataToday = array();\n $today = str_replace(\"+\",\".000+\", $date->format(DateTime::ATOM));\n $this_record = MongoSensorData::where('sensor_id', '=', floatval($sensorId))\n ->where('recordDay', '=', new DateTime($today))->first();\n\n if($this_record){\n $sensorDs = $this_record->dataSamples;\n for (end($sensorDs); key($sensorDs)!==null; prev($sensorDs)){\n $sensordata = current($sensorDs);\n // ...\n if(isset($sensordata[$datapoint])){\n $reading = $sensordata[$datapoint];\n //var_dump($reading);\n\n if($sensordata[$datapoint.'-minV'] == 1 || $sensordata[$datapoint.'-maxV'] == 1){\n $status = 'danger';\n }\n elseif($sensordata[$datapoint.'-minV'] == -1 || $sensordata[$datapoint.'-maxV'] == -1){\n $status = 'warning';\n }\n else{\n $status = 'success';\n }\n\n $min_T = $sensordata[$datapoint.'-minT'];\n $max_T = $sensordata[$datapoint.'-maxT'];\n }\n else{\n $reading = 0;\n $status = 'danger';\n $min_T = 0;\n $max_T = 0;\n }\n //var_dump($status);\n array_push($sensordataToday,\n array(\n 'sensorName' => $sensorDetail->name,\n 'sensorID' => $sensorId,\n 'dateTime' => $sensordata['recordDate']->toDateTime()->format('Y-m-d H:i:s'),\n 'reading' => round($reading, 2),\n 'status' => $status,\n 'min_threshold' => $min_T,\n 'max_threshold' => $max_T,\n 'n_min_violation' => 0,\n 'n_max_violation' => 0,\n\n )\n );\n\n if(key($sensorDs) == count($sensorDs) - 10)\n break;\n }\n }\n else{\n\n array_push($sensordataToday,\n array(\n 'sensorName' => $sensorDetail->name,\n 'sensorID' => $sensorId,\n 'dateTime' => date('Y-m-d H:i:s'),\n 'reading' => round($reading, 2),\n 'status' => 'danger',\n 'min_threshold' => isset($minT) ? $minT : 0,\n 'max_threshold' => isset($maxT) ? $maxT : 0,\n 'n_min_violation' => 0,\n 'n_max_violation' => 0,\n\n )\n );\n }\n\n\n\n\n\n\n\n $sensordataRecents = array();\n\n $sensorDRs = MongoSensorData::where('sensor_id', '=', floatval($sensorId))\n ->orderBy('recordDay', 'DESC')->take(10)->get();\n\n\n foreach($sensorDRs as $sensordata){\n $reading = $sensordata->$datapoint['average'];\n if($reading < $minT || $reading > $maxT){\n $status = 'danger';\n }\n elseif($reading == $minT || $reading == $maxT){\n $status = 'warning';\n }\n else{\n $status = 'success';\n }\n //var_dump(date_format(new DateTime($sensordata->recordDay), 'd-m-Y H:i:s'));\n //var_dump($sensordata->maxTime);\n //var_dump(date_format($sensordata->recordDay->toDateTime(), 'Y-m-d'));\n array_push($sensordataRecents,\n array(\n 'sensorName' => $sensorDetail->name,\n 'sensorID' => $sensordata->sensorId,\n 'dateTime' => date_format($sensordata->recordDay->toDateTime(), 'Y-m-d H:i:s'),\n 'reading' => round($reading, 2),\n 'status' => $status,\n 'min_threshold' => $minT,\n 'max_threshold' => $maxT,\n 'n_min_violation' => $sensordata->$datapoint['n-minV'],\n 'n_max_violation' => $sensordata->$datapoint['n-maxV'],\n )\n );\n //var_dump($sensordataRecents);\n\n }\n\n\n\n\n return response()->json(['today' => $sensordataToday, 'recents' => $sensordataRecents, 'reading' => $reading]);\n }",
"private function getPostDateRange() {\n \n switch($this->validFilter['postDate']) {\n case 'today' :\n $dateStart = new \\DateTime();\n $dateStart->setTime(0, 0, 1);\n $dateEnd = new \\DateTime();\n $dateEnd->setTime(23, 59, 59);\n break;\n\n case 'yesterday':\n $dateStart = new \\DateTime('yesterday');\n $dateStart->setTime(0, 0, 1);\n $dateEnd = new \\DateTime('yesterday');\n $dateEnd->setTime(23, 59, 59);\n break;\n\n case 'thisWeek':\n $today = new \\DateTime();\n if('Sunday' == $today->format('l')) {\n $dateStart = clone $today;\n $dateStart->modify('Monday last week');\n $dateStart->setTime(0, 0, 1);\n $dateEnd = $today;\n $dateEnd->setTime(23, 59, 59);\n } else {\n $dateStart = clone $today;\n $dateStart->modify('Monday this week');\n $dateStart->setTime(0, 0, 1);\n $dateEnd = clone $today;\n $dateEnd->modify('Sunday this week');\n $dateEnd->setTime(23, 59, 59);\n }\n break;\n\n case 'lastWeek':\n $dateStart = new \\DateTime();\n $dateStart->setTime(0, 0, 1);\n $dateStart->sub(new \\DateInterval('P7D'));\n $dateEnd = new \\DateTime();\n $dateEnd->setTime(23, 59, 59);\n break;\n\n case 'pastMonth':\n $dateStart = new \\DateTime();\n $dateStart->setTime(0, 0, 1);\n $dateStart->sub(new \\DateInterval('P1M'));\n $dateEnd = new \\DateTime();\n $dateEnd->setTime(23, 59, 59);\n break;\n default :\n $dateStart = new \\DateTime($this->validFilter['postDate']);\n $dateStart->setTime(0, 0, 1);\n $dateEnd = new \\DateTime($this->validFilter['postDate']);\n $dateEnd->setTime(23, 59, 59);\n break;\n } // end of switch\n \n return array($dateStart, $dateEnd);\n }",
"public function getMinDateRange()\n {\n return $this->_getBorderDateRange(self::MIN_DATE_RANGE_KEY);\n }",
"public function GetBarMinMax()\n\t{\n\t\t$start = 0;\n\t\t$n\t = safe_count($this->iObj);\n\t\twhile ($start < $n && $this->iObj[$start]->GetMaxDate() === false) {\n\t\t\t++$start;\n\t\t}\n\n\t\tif ($start >= $n) {\n\t\t\tUtil\\JpGraphError::RaiseL(6006);\n\t\t\t//('Cannot autoscale Gantt chart. No dated activities exist. [GetBarMinMax() start >= n]');\n\t\t}\n\n\t\t$max = $this->scale->NormalizeDate($this->iObj[$start]->GetMaxDate());\n\t\t$min = $this->scale->NormalizeDate($this->iObj[$start]->GetMinDate());\n\n\t\tfor ($i = $start + 1; $i < $n; ++$i) {\n\t\t\t$rmax = $this->scale->NormalizeDate($this->iObj[$i]->GetMaxDate());\n\t\t\tif ($rmax != false) {\n\t\t\t\t$max = max($max, $rmax);\n\t\t\t}\n\n\t\t\t$rmin = $this->scale->NormalizeDate($this->iObj[$i]->GetMinDate());\n\t\t\tif ($rmin != false) {\n\t\t\t\t$min = min($min, $rmin);\n\t\t\t}\n\t\t}\n\t\t$minDate = date('Y-m-d', $min);\n\t\t$min\t = strtotime($minDate);\n\t\t$maxDate = date('Y-m-d 23:59', $max);\n\t\t$max\t = strtotime($maxDate);\n\n\t\treturn [$min, $max];\n\t}",
"public function getDateInTheDatesRange(string $date, string $minDate, string $maxDate)\n {\n $dateTime = $this->createImmutable($date);\n if ($this->createImmutable($minDate) <= $dateTime && $dateTime <= $this->createImmutable($maxDate)) {\n return $dateTime;\n }\n return null;\n }",
"function get_month_min($date, $labels) {\n global $DB;\n\n $fechainicio = new DateTime(\"1-\".$date->month.\"-\".$date->year);\n $maxday = cal_days_in_month(CAL_GREGORIAN, $date->month, $date->year);\n $fechafin = new DateTime($maxday.\"-\".$date->month.\"-\".$date->year);\n $fechafin->setTime(23, 59, 59);\n $result = array();\n foreach ($labels as $label) {\n $result[] = 0;\n }\n\n $sql = \"SELECT id, connectedusers, date FROM {report_user_statistics} WHERE date >= ? AND date <= ? ORDER BY date;\";\n $todaslasconexiones = $DB->get_records_sql($sql, [$fechainicio->getTimestamp(), $fechafin->getTimestamp()]);\n $day = 0;\n $temp = array();\n $i = 1;\n foreach ($todaslasconexiones as $conexiones) {\n $fecha = new DateTime(\"@$conexiones->date\");\n if (($fecha->format('m') == $date->month) && ($fecha->format('Y') == $date->year)) {\n if ($day == 0) {\n $day = $fecha->format('d');\n $temp[] = $conexiones->connectedusers;\n } else if ($day == $fecha->format('d')) {\n $temp[] = $conexiones->connectedusers;\n } else if ($day < $fecha->format('d')) {\n foreach ($temp as $tempkey => $tempvalor) {\n if ($tempvalor == 0) {\n unset($temp[$tempkey]);\n }\n }\n $key = array_search($day, $labels);\n $result[$key] = min($temp);\n $temp = array();\n $day = $fecha->format('d');\n $temp[] = $conexiones->connectedusers;\n }\n if (count($todaslasconexiones) == $i) {\n foreach ($temp as $tempkey => $tempvalor) {\n if ($tempvalor == 0) {\n unset($temp[$tempkey]);\n }\n }\n $key = array_search($day, $labels);\n $result[$key] = min($temp);\n } else if (count($temp) > 1) {\n foreach ($temp as $tempkey => $tempvalor) {\n if ($tempvalor == 0) {\n unset($temp[$tempkey]);\n }\n }\n $key = array_search($day, $labels);\n $result[$key] = min($temp);\n }\n $i++;\n }\n }\n return $result;\n}",
"protected function calculateRange($data)\n {\n $data_range = array_fill(0, count(current($data)), ['min' => null, 'max' => null]);\n foreach ($data as $observation) {\n $key = 0;\n foreach ($observation as $value) {\n if ($data_range[$key]['min'] === null || $data_range[$key]['min'] > $value) {\n $data_range[$key]['min'] = $value;\n }\n if ($data_range[$key]['max'] === null || $data_range[$key]['max'] < $value) {\n $data_range[$key]['max'] = $value;\n }\n $key++;\n }\n }\n\n return $data_range;\n }",
"protected function get_time_range( ) {\n// Format is ddhhmmZ where dd = day, hh = hours, mm = minutes in UTC time.\n\n $found = 0;\n\n// date_default_timezone_set('UTC');\n\n $month_timestamp = date('m',$this->timestamp);\n $day_timestamp = date('d',$this->timestamp);\n $year_timestamp = date('Y',$this->timestamp);\n $hour_timestamp = date('H',$this->timestamp);\n $min_timestamp = date('i',$this->timestamp);\n\n $current_start_hour = $hour_timestamp;\n $current_start_min = $min_timestamp;\n $current_start_month = $month_timestamp;\n $current_start_year = $year_timestamp;\n\n $current_end_hour = $hour_timestamp;\n $current_end_min = $min_timestamp;\n $current_end_month = $month_timestamp;\n $current_end_year = $year_timestamp;\n// $day_start = $day_timestamp;\n// $day_end = $day_timestamp;\n\n\n//print \"$this->current_group_text\\n\";\n\n if (preg_match('#^FM([0-9]{2})([0-9]{2})([0-9]{2})$#',$this->current_group_text,$pieces)) {\n $this->wxInfo['ITEMS'][$this->tend]['CODE_DATE_RANGE'] = $this->current_group_text;\n\n $get_start_hour = $pieces[2];\n $get_start_minute = $pieces[3];\n $get_start_day = $pieces[1];\n\n $get_end_day = date(\"d\",$this->max_date_end);\n $get_end_hour = date(\"G\",$this->max_date_end);\n $get_end_minute = date(\"i\",$this->max_date_end);\n\n $found = 1;\n $this->current_ptr++;\n } else if (preg_match('#^([0-9]{2})([0-9]{2})([0-9]{2})$#',$this->current_group_text,$pieces)) {\n $this->wxInfo['ITEMS'][$this->tend]['CODE_DATE_RANGE'] = $this->current_group_text;\n\n $get_start_hour = $pieces[2];\n $get_start_minute = $pieces[3];\n $get_start_day = $pieces[1];\n\n $get_end_day = date(\"d\",$this->max_date_end);\n $get_end_hour = date(\"G\",$this->max_date_end);\n\n if ($day_timestamp>$start_day) {\n $current_start_month++;\n if ($current_start_month>12) {\n $current_start_month=1;\n $current_start_year++;\n }\n }\n\n\n $found = 1;\n $this->current_ptr++;\n } else if (preg_match('#^([0-9]{2})([0-9]{2})/([0-9]{2})([0-9]{2})$#',$this->current_group_text,$pieces)) {\n $get_start_day = $pieces[1];\n $get_start_hour = $pieces[2];\n $get_start_minute = 0;\n $get_end_day = $pieces[3];\n $get_end_hour = $pieces[4];\n $get_end_minute = 0;\n\n $this->wxInfo['ITEMS'][$this->tend]['CODE_DATE_RANGE'] = $this->current_group_text;\n\n $found = 1;\n $this->current_ptr++;\n }\n if ($found==1) {\n\n\n// print \"get_start_day: $get_start_day<br>\";\n// print \"get_start_hour: $get_start_hour<br>\";\n// print \"get_end_day: $get_end_day<br>\";\n// print \"get_end_time: $get_end_hour<br>\";\n\n if ($day_timestamp>$get_start_day) {\n $current_start_month++;\n if ($current_start_month>12) {\n $current_start_month=1;\n $current_start_year++;\n }\n }\n\n if ($day_timestamp>$get_end_day) {\n $current_end_month++;\n if ($current_end_month>12) {\n $current_end_month=1;\n $current_end_year++;\n }\n }\n\n if ($get_start_hour==24) {\n $get_start_hour=23;\n $get_start_minute=59;\n }\n\n if ($get_end_hour==24) {\n $get_end_hour=23;\n $get_end_minute=59;\n }\n\n\n $this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_START_TIMESTAMP'] = mktime( $get_start_hour, $get_start_minute, 0, $current_start_month, $get_start_day, $current_start_year);\n $this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_TIMESTAMP'] = mktime( $get_end_hour, $get_end_minute, 0, $current_end_month, $get_end_day, $current_end_year);\n\n\n// Calcule la date\n// $timestamp = strtotime($timestamp);\n// $month = date('m',$timestamp);\n// $startday = date('d',$timestamp);\n// $year = date('Y',$timestamp);\n\n// $startday = abs($this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_STARTDAY']-$startday);\n// $endday = abs($this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_ENDDAY']-$startday);\n\n $this->max_date_end = max($this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_TIMESTAMP'],$this->max_date_end);\n\n// $this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_START_DATETIME'] = date('Y-m-d H:i:s', $time_start);\n// $this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_DATETIME'] = date('Y-m-d H:i:s', $time_end);\n// print \"DATE_RANGE_END_TIMESTAMP: \".$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_TIMESTAMP'].\" DATE_RANGE_END_TEXT: \". date(\"Y-m-d H:i\",$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_TIMESTAMP']).\"\\n\";\n\n//print \"debut: \".$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_START_TIMESTAMP'].\"\\n\";\n//print \"fin: \".$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_TIMESTAMP'].\"\\n\";\n\n /*\n print \"before \".date('Y-m-d H:i:s',$timestamp ).\"\\n\";\n print \"$day\\n\";\n print \"startday \".$startday.\"\\n\";\n print \"endday \".$endday.\"\\n\";\n print \"result start \".$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_START_DATETIME'].\"\\n\";\n print \"result end \".$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_DATETIME'].\"\\n\";\n print \"\\n\\n\";\n exit;\n */\n\n\n// $this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_START_DATETIME'] = '0000-01-'.$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_STARTDAY'].' '.$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_STARTTIME'].':00';\n//$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_END_DATETIME'] = '0000-01-'.$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_ENDDAY'].' '.$this->wxInfo['ITEMS'][$this->tend]['DATE_RANGE_ENDTIME'].':00';\n }\n\n $this->current_group++;\n }",
"function blog_first_and_last_dates() {\n\t$dates = array();\n\n\t$query = \"SELECT `time` FROM `blog` ORDER BY `time` ASC LIMIT 1\";\n\t$result = mysql_query($query);\n\t$row = mysql_fetch_array($result);\n\tarray_push($dates, $row[0]);\n\n\t$query = \"SELECT `time` FROM `blog` ORDER BY `time` DESC LIMIT 1\";\n\t$result = mysql_query($query);\n\t$row = mysql_fetch_array($result);\n\tarray_push($dates, $row[0]);\n\n\treturn $dates;\n}",
"private function GetBetweenArray()\n {\n for(reset($this->dataArray); (list($key,$val)=each($this->dataArray)) !== false;)\n {\n if (($this->Date2MoreDate1($this->startPoint['Arrival']['Date'] . ' ' . $this->startPoint['Arrival']['Time'], $val['Arrival']['Date'] .' '. $val['Arrival']['Time']))\n && ($this->Date2MoreDate1($val['Arrival']['Date'] .' '. $val['Arrival']['Time'], $this->endPoint['Arrival']['Date'] . ' ' . $this->endPoint['Arrival']['Time'])))\n $this->BetweenStartEnd[] = $val;\n }\n }",
"public function sensorReading($sensorId)\n {\n //date_default_timezone_set(\"Europe/London\");\n $date = new DateTime(date(\"Y-m-d\"));\n\n $today = str_replace(\"+\",\".000+\", $date->format(DateTime::ATOM));\n $this_record = MongoSensorData::where('sensor_id', '=', floatval($sensorId))\n ->where('recordDay', '=', new DateTime($today))->first();\n\n $device = Device::where('sensor_id', '=', floatval($sensorId))->first();\n\n $datapoints = $device->data_points;\n $reading = array();\n foreach ($datapoints as $datapoint){\n\n if($this_record){\n if(isset($this_record->dataSamples[$this_record->nSample - 1][$datapoint['point']])){\n $sensor_reading = round($this_record->dataSamples[$this_record->nSample - 1][$datapoint['point']], 2);\n }\n else{\n $sensor_reading = 0;\n }\n\n }\n else{\n $sensor_reading = -1.00;\n }\n $reading[] = ['datapoint' => $datapoint, 'reading' => $sensor_reading];\n }\n return $reading;\n }",
"function getDateFilterSelectedRange() {\n $from = $this->getAdditionalProperty('date_filter_from');\n $to = $this->getAdditionalProperty('date_filter_to');\n \n return $from && $to ? array(new DateValue($from), new DateValue($to)) : array(null, null);\n }",
"function GetDates(DateRange $startingDates);",
"public static function getCommunes($minDate, $maxDate) {\n\t\t$polygons = Polygon::all();\n\t\tforeach ($polygons as $polygon) {\n\t\t\t$polygon->id = (int) $polygon->id;\n\t\t\t$polygon->value = (int) $polygon->summary($minDate, $maxDate);\n\t\t\t$polygon->quantity = $polygon->quantity($minDate, $maxDate);\t\t\t\n\t\t\t$polygon->path = PolygonPath::where('polygon_id', $polygon->id)->get();\n\t\t\tforeach ($polygon->path as $point) {\n\t\t\t\t$point->lat = (float) $point->lat;\n\t\t\t\t$point->lng = (float) $point->lng;\n\t\t\t}\n\t\t}\n\t\treturn array('data' => $polygons);\n\t}",
"function createRangeStat($start, $end, $format = 'Y-m-d') {\n \t\tdate_default_timezone_set(\"Europe/London\");\n\t\t$start = new DateTime($start);\n\t\t$end = new DateTime($end);\n\t\t$invert = $start > $end;\n\n\t\t$dates = array();\n\t\t$dates[] = $start->format($format);\n\t\twhile ($start != $end) {\n\t\t\t$start->modify(($invert ? '-' : '+') . '1 day');\n\t\t\t$dates[] = $start->format($format);\n\t\t}\n\t\treturn $dates;\n\t}",
"function get_all_hazard_fiscal_years($conn) {\n $query_date = \"SELECT MIN(date), MAX(date) FROM hazard\";\n $dates = exec_query($conn, $query_date);\n $min_date = DateTime::createFromFormat('Y-m-d', $dates[0][0]);\n $max_date = DateTime::createFromFormat('Y-m-d', $dates[0][1]);\n $min_fiscal_year = get_corresponding_fiscal_year($min_date);\n $max_fiscal_year = get_corresponding_fiscal_year($max_date);\n return range($min_fiscal_year, $max_fiscal_year);\n}",
"static public function getRange($initialDate, $finalDate){\n\t\tif(!is_object($initialDate)){\n\t\t\t$initialDate = new Date($initialDate);\n\t\t}\n\t\tif(is_object($finalDate)){\n\t\t\t$finalDate = (string) $finalDate;\n\t\t}\n\t\t$initialTime = $initialDate->getTimestamp();\n\t\t$date = (string) $initialDate;\n\t\t$range = array($date);\n\t\twhile($date!=$finalDate){\n\t\t\t$initialTime+=86400;\n\t\t\t$date = date('Y-m-d', $initialTime);\n\t\t\t$range[] = $date;\n\t\t}\n\t\treturn $range;\n\t}",
"public function getMinDateRange()\n {\n $dob = $this->_getAttribute('dob');\n if ($dob !== null) {\n $rules = $this->_getAttribute('dob')->getValidationRules();\n $minDateValue = ArrayObjectSearch::getArrayElementByName(\n $rules,\n self::MIN_DATE_RANGE_KEY\n );\n if ($minDateValue !== null) {\n return date(\"Y/m/d\", $minDateValue);\n }\n }\n\n return null;\n }"
]
| [
"0.6400017",
"0.61367244",
"0.579192",
"0.5558223",
"0.55127424",
"0.5507693",
"0.5507236",
"0.5502386",
"0.54931873",
"0.5492507",
"0.54741657",
"0.54035467",
"0.5369179",
"0.53654575",
"0.53479683",
"0.5329774",
"0.5326367",
"0.52913105",
"0.52178097",
"0.51969314",
"0.5157916",
"0.5151826",
"0.5134133",
"0.5068861",
"0.503303",
"0.50234354",
"0.49996156",
"0.4998261",
"0.49972472",
"0.49963677"
]
| 0.676485 | 0 |
Tells wheter $pathToPage is in the active branch | public function isPagePathActive($pathToPage) {
if ($pathToPage == '') {
return false;
}
$pathToPage = str_replace('//', '/', $pathToPage . '/');
return substr($this->currentPagePath . '/', 0, strlen($pathToPage)) == $pathToPage;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function isCurrentPage($page);",
"function activeLink($page){\n\n\t\t/* Compare $page to $_GET */\n\t\tswitch($page){\n\t\tcase 'home':\n\t\t\tif(empty($_GET) || isset($_GET['home'])){\n\t\t\t\techo ' active';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'about';\n\t\t\tif(isset($_GET['about'])){\n\t\t\t\techo ' active';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'recent';\n\t\t\tif(isset($_GET['recent'])){\n\t\t\t\techo ' active';\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}",
"public function getOnlyActiveBranch(): bool;",
"function activatePage($activePage, $currentPage){\n\techo (strcmp($currentPage, $activePage) === 0)? 'active' : '';\n}",
"function isCurrent($pageName){\n\tglobal $NAV_PAGE;\n\t//If the global matches the argument set as current\n\tif ($NAV_PAGE == $pageName){\n\t\techo \"currentNavItem\";\n\t}\n}",
"protected function isPageActive()\n {\n if($this->url->getTarget()->id == Page::id()) return true;\n return false;\n }",
"function activation($in) {\n $directoryURI = $_SERVER['PHP_SELF'];\n $path = parse_url($directoryURI, PHP_URL_PATH);\n $components = explode('/', $path);\n $first_part = $components[1];\n\n if($first_part == $in) {\n echo 'class=\"active\"';\n }\n}",
"function activeLink($name=null,$tree=false)\n {\n\n\n\n if ( $tree and $name == 'setup' )\n {\n\n $setupArray = ['client-types','resources','teams','costs'];\n\n if ( in_array(request()->segment(1) ,$setupArray) )\n {\n return 'active selected';\n }\n return '';\n\n\n }\n\n if ( $tree and $name == 'reports' )\n {\n $reportArray = ['opportunity-report','activity-report','proposal-report','invoice-report'];\n\n if ( in_array(request()->segment(1) ,$reportArray) )\n {\n return 'active selected';\n }\n return '';\n\n\n }\n\n if ( !is_null($name) and request()->segment(1) == $name )\n {\n if ( $tree )\n {\n return 'current-page';\n }\n\n return 'active selected';\n }\n\n\n }",
"function thisActiveHomepage()\r\n\t{\r\n\t\r\n\t\tglobal $_REQUEST;\r\n\t\t$page = $_REQUEST['page_id'];\r\n\t\t\t\t\r\n\t\tif($page == \"\"){\r\n\t\t\t$page = $this->activeHomepage();\r\n\t\t}\r\n\t\tif($page == $this->activeHomepage())\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}",
"public function activeNavigation($path)\n {\n $uri = $this->request->getMasterRequest()->getPathInfo();\n $reqNav = explode('/', $uri);\n $nav = explode('/', $path);\n\n if (count($reqNav) > 2 && count($nav) > 2 && $reqNav[2] === $nav[2]) {\n if ($reqNav[2] === 'people') {\n if ($this->tokenStorage->getToken()) {\n $token = $this->tokenStorage->getToken();\n if ($token) {\n $user = $token->getUser();\n if ($user instanceOf User) {\n $linkSlug = $reqNav[count($reqNav) - 1];\n $userSlug = $user->getProfile()->getSlug();\n //His profile\n return $userSlug === $linkSlug ? 2 : 1;\n }\n }\n }\n //Profile navigation match\n return 1;\n }\n //Basic navigation match\n return 1;\n }\n\n //Support accountSettings route\n if (count($reqNav) > 3 && $reqNav[2] == 'account' && $reqNav[3] == 'settings') {\n return 2;\n }\n return false;\n }",
"public function setOnlyActiveBranch(bool $flag = true);",
"function currentPageIs($location){\n $current_location = getPage();\n return $current_location === $location;\n}",
"public function isActive() {\n return $this->site->page()->is($this);\n }",
"public function hasBranch(){\n return $this->_has(3);\n }",
"function isActive($path, $active = 'active nav-active nav-expanded'){\n return call_user_func_array('Request::is', (array)$path) ? $active : '';\n}",
"function get_active_menu (string $page, string $page_active, string $class_active = \"active\") {\n return $page == $page_active ? $class_active : \"\";\n }",
"function get_active_menu (string $page, string $page_active, string $class_active = \"active\") {\n return $page == $page_active ? $class_active : \"\";\n }",
"public function treeLevelConditionMatchesCurrentPageIdWhileEditingNewPage() {}",
"function active_for($url)\n{\n $url = ltrim(URL::makeRelative($url), '/');\n\n return app()->request->is($url) ? 'selected' : '';\n}",
"function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath\n\tglobal $post; // load details about this page\n\tif(is_page()&&($post->post_parent==$pid||is_page($pid)))\n return true; // we're at the page or at a sub page\n\telse\n return false; // we're elsewhere\n}",
"public function isCurrent($url){\n return (trim($this->get(), '/') == $url);\n }",
"function on_page($page,$partial_match = false) {\n if(!is_array($page)) {\n $page = array($page);\n }\n $current_page = substr($_SERVER['SCRIPT_FILENAME'],\n strpos($_SERVER['SCRIPT_FILENAME'], PMDROOT) + strlen(PMDROOT)\n );\n foreach($page AS $name) {\n if($partial_match) {\n if(strstr($current_page,$name)) {\n return true;\n }\n } elseif(ltrim($name,'/') == ltrim($current_page,'/')) {\n return true;\n }\n }\n return false;\n}",
"function class_active($url) {\r\n $page = strrchr($_SERVER['PHP_SELF'], '/');\r\n if($page == $url) {\r\n return ' active ';\r\n }\r\n}",
"function check_current_menu($page_name, $current_page) {\n\tif ($page_name === $current_page) return \"current\";\n\telse return \"\";\n}",
"public function isCurrentPage($pageIdentifier);",
"function sc_mailbox_boxlink_active($parm = '')\n {\n if(!$parm) { $parm = 'inbox'; }\n\n // Check if current page is the active page\n if(e107::getParser()->filter($_GET['page']) == $parm)\n {\n return 'class=\"active\"';\n }\n\n return;\n }",
"public function treeLevelConditionMatchesCurrentPageIdWhileSavingNewPage() {}",
"function CheckPageInDB($tocheck)\n{\n $tocheck = str_replace(\".php\", \"\", $tocheck);\n\n // Add a last /\n $tocheckSlash = $tocheck;\n $tocheckSlash .= \"/\";\n\n // Are we checking for a page with a parent? IOW: Is the PageString like \"page/subpage/minipage/tinypage\"?\n // First take the PageString and break it apart\n $tocheckList = explode(\"/\", $tocheckSlash);\n\n // Count how many levels there are\n $tocheckListNodes = count($tocheckList) - 1;\n\n if ($tocheckListNodes > 0)\n {\n // A parent has been detected\n $Parent = \"\";\n\n // Parent is first nodes; Child is last node\n $ChildNode = $tocheckList[$tocheckListNodes-1]; //testpage\n\n // Get the key of the ChildNode\n $ChildNodeKey = array_search($ChildNode, $tocheckList); // 0\n\n // Get the ParentNodes\n for ($i = 0; $i < $tocheckListNodes-1; $i++)\n {\n $Parent .= $tocheckList[$i].\"/\";\n }\n\n if ($Parent != \"\")\n {\n // query_db call\n $Query = query_db(\"SELECT\",DB_PREFIX.\"pages\",\"PageName,parent,\",\" = '{$ChildNode}', = '{$Parent}',\",\"id\",\"id\",NULL,NULL,NULL,NULL);\n }\n else\n {\n // query_db call\n $Query = query_db(\"SELECT\",DB_PREFIX.\"pages\",\"PageName,\",\" = '{$ChildNode}',\",\"id\",\"id\",NULL,NULL,NULL,NULL);\n }\n\n if ($Query != \"\")\n {\n // Explode list\n $List = explode(\",\", $Query);\n\n // Select first one\n $Value = $List[0];\n\n if ($Value != null || $Value != \"\" || $Value != 0)\n {\n // found; now check to see if the page is active\n if ($Parent != \"\")\n {\n $PageStatus = GetPageInfo($ChildNode,\"status\",$Parent);\n }\n else\n {\n $PageStatus = GetPageInfo($ChildNode,\"status\");\n }\n if ($PageStatus == \"active\")\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n else\n {\n // not found\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n else\n {\n // Not a parent page situation; single page\n // query_db call\n $Query = query_db(\"SELECT\",DB_PREFIX.\"pages\",\"PageName,\",\" = '{$tocheck}',\",\"id\",\"id\",NULL,NULL,NULL,NULL);\n\n if ($Query != \"\")\n {\n // Explode list\n $List = explode($Query, \",\");\n\n // Select first one\n $Value = $List[0];\n\n if ($Value != null || $Value != \"\" || $Value != 0)\n {\n // found\n return true;\n }\n else\n {\n // not found\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n}",
"public function isAncestor ($Page)\r\n {\r\n \tif ($this->path == '')\r\n \t\treturn false;\r\n \telse\r\n \t{\r\n \t\t$return = (strpos($Page->path,$this->path)===0);\r\n\r\n \t\treturn $return;\r\n \t}\r\n }",
"function ActiveMenu($requestUri)\n{\n $current_file_name = basename($_SERVER['REQUEST_URI'], \".php\");\n\n if ($current_file_name == $requestUri)\n echo 'class=\"active\"';\n}"
]
| [
"0.6204511",
"0.61539173",
"0.60775155",
"0.5883695",
"0.58183545",
"0.576349",
"0.5690782",
"0.5636337",
"0.56156075",
"0.5611774",
"0.55843455",
"0.5516711",
"0.5470787",
"0.54489887",
"0.544409",
"0.54110146",
"0.54110146",
"0.53569114",
"0.5317659",
"0.5316815",
"0.5308654",
"0.5277856",
"0.5276486",
"0.5273843",
"0.5269065",
"0.52672917",
"0.5251673",
"0.5247342",
"0.52423686",
"0.52394116"
]
| 0.65485346 | 0 |
Set visibility query args. Handpicked products will show hidden products if chosen. | protected function set_visibility_query_args( &$query_args ) {
if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) {
$product_visibility_terms = wc_get_product_visibility_term_ids();
$query_args['tax_query'][] = array(
'taxonomy' => 'product_visibility',
'field' => 'term_taxonomy_id',
'terms' => array( $product_visibility_terms['outofstock'] ),
'operator' => 'NOT IN',
);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function set_restricted_products_visibility( $visibility ) {\n\n\t\tif ( 'hide' === $visibility ) {\n\n\t\t\tupdate_option( $this->hide_restricted_products_option, 'yes' );\n\n\t\t\t$this->hiding_restricted_products = true;\n\n\t\t} else {\n\n\t\t\tupdate_option( $this->hide_restricted_products_option, 'no' );\n\n\t\t\t$this->hiding_restricted_products = false;\n\t\t}\n\t}",
"public function setVisibility() {}",
"function exclude_hidden_products( $ids ) {\n\n\t\t$proceed = apply_filters( 'searchwp_woocommerce_consider_visibility', true );\n\n\t\tif ( empty( $proceed ) ) {\n\t\t\treturn $ids;\n\t\t}\n\n\t\t$args = array(\n\t\t\t'post_type' => 'product',\n\t\t\t'nopaging' => true,\n\t\t\t'fields' => 'ids'\n\t\t);\n\n\t\t// WooCommerce 3.0 switched to powering visibility with ataxonomy\n\t\tif ( function_exists( 'WC' ) && ! empty( WC()->version ) && version_compare( WC()->version, '3.0.0', '>=' ) ) {\n\t\t\t$args['tax_query'] = array(\n\t\t\t\tarray(\n\t\t\t\t\t'taxonomy' => 'product_visibility',\n\t\t\t\t\t'field' => 'slug',\n\t\t\t\t\t'terms' => 'exclude-from-search'\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\t// Before WooCommerce 3.0 metadata was used\n\t\t\t$args['meta_query'] = array(\n\t\t\t\tarray(\n\t\t\t\t\t'key' => '_visibility',\n\t\t\t\t\t'value' => array( 'hidden', 'catalog' ),\n\t\t\t\t\t'compare' => 'IN',\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\t$hidden = get_posts( $args );\n\n\t\tif ( ! empty( $hidden ) ) {\n\t\t\t$ids = array_merge( $ids, $hidden );\n\t\t}\n\n\t\treturn $ids;\n\t}",
"public function setupVisibility();",
"function woocommerce_product_query_meta_query( $meta_query ) {\n\n\t\t$proceed = apply_filters( 'searchwp_woocommerce_consider_visibility', true );\n\n\t\tif ( empty( $proceed ) ) {\n\t\t\treturn $meta_query;\n\t\t}\n\n\t\tif ( isset( $meta_query['visibility'] ) && $this->is_woocommerce_search() ) {\n\t\t\tunset( $meta_query['visibility'] );\n\t\t}\n\n\t\treturn $meta_query;\n\t}",
"public function showing_restricted_products() {\n\t\treturn ! $this->hiding_restricted_products();\n\t}",
"public function filterVisible(): self;",
"public function set_excerpts_visibility( $visibility ) {\n\n\t\tif ( 'hide' === $visibility ) {\n\n\t\t\tupdate_option( $this->show_excerpts_option, 'no' );\n\n\t\t\t$this->showing_excerpts = false;\n\n\t\t} else {\n\n\t\t\tupdate_option( $this->show_excerpts_option, 'yes' );\n\n\t\t\t$this->showing_excerpts = true;\n\t\t}\n\t}",
"function filter_posts_toggle() {\n\n\t\t$is_private_filter_on = isset( $_GET['private_posts'] ) && 'private' == $_GET['private_posts'];\n\n\t\t?>\n\n\t\t<select name=\"private_posts\">\n\t\t\t<option <?php selected( $is_private_filter_on, false ); ?> value=\"public\">Public</option>\n\t\t\t<option <?php selected( $is_private_filter_on, true ); ?> value=\"private\">Private</option>\n\t\t</select>\n\n\t\t<?php\n\n\t}",
"private function updateProductVisibility(ProductInterface $product, Request $request): void\n {\n $visible = $request->request->get('visible') === '1' ? true : false;\n\n if ($visible) {\n $product->enable();\n } else {\n $product->disable();\n }\n }",
"function miracle_add_visibility_fields($widget, $instance = false)\n {\n if ('advanced_text' == get_class($widget))\n return;\n\n $conditions = $this->miracle_widget_visibility_conditions();\n\n if (!$instance)\n {\n $widget_settings = get_option($widget->option_name);\n $instance = $widget_settings[$widget->number];\n }\n\n $allSelected = $homeSelected = $postSelected = $postInCategorySelected = $pageSelected =\n $categorySelected = $blogSelected = $searchSelected = false;\n switch ($instance['action'])\n {\n case \"1\":\n $showSelected = true;\n break;\n case \"0\":\n $dontshowSelected = true;\n break;\n }\n\n?>\t\t\t\n\t<div class=\"atw-conditions\">\n\t<strong><?php _e('Widget Visibility:', $this->textdomain);?></strong>\n <br /><br />\n\t<label for=\"<?php echo $widget->get_field_id('action');?>\" title=\"<?php _e('Show only on specified page(s)/post(s)/category. Default is All', $this->textdomain); ?>\" style=\"line-height:35px;\">\t\t\n\t<select name=\"<?php echo $widget->get_field_name('action');?>\">\n <option value=\"1\" <?php echo ($showSelected)? 'selected=\"selected\"':'';?>><?php _e('Show', $this->textdomain);?></option>\n\t\t\t<option value=\"0\" <?php echo ($dontshowSelected)? 'selected=\"selected\"':'';?>><?php _e('Do NOT show', $this->textdomain);?></option>\n\t\t</select> \n <?php _e('on', $this->textdomain); ?>\n\t\t<select name=\"<?php echo $widget->get_field_name('show');?>\" id=\"<?php echo $widget->get_field_id('show');?>\">\n <?php\n if (is_array($conditions) && !empty($conditions))\n {\n foreach ($conditions as $k => $item)\n {\n $output .= '<option label=\"' . $item['name'] . '\" value=\"' . $k . '\"' . selected($instance['show'],\n $k) . '>' . $item['name'] . '</option>';\n }\n }\n echo $output;\n ?>\n\t\t</select>\n\t</label>\n\t<br/> \n\t<label for=\"<?php echo $widget->get_field_id('slug'); ?>\" title=\"<?php _e('Optional limitation to specific page, post or category. Use ID, slug or title.',$this->textdomain);?>\"><?php _e('Slug/Title/ID:',$this->textdomain); ?> \n\t\t<input type=\"text\" style=\"width: 99%;\" id=\"<?php echo $widget->get_field_id('slug');?>\" name=\"<?php echo $widget->get_field_name('slug');?>\" value=\"<?php echo htmlspecialchars($instance['slug']); ?>\" />\n\t</label>\n\t<?php\n if ($postInCategorySelected)\n _e(\"<p>In <strong>Post In Category</strong> add one or more cat. IDs (not Slug or Title) comma separated!</p>\",$this->textdomain);\n ?>\n\t<br />\n\t<label for=\"<?php echo $widget->get_field_id('suppress_title'); ?>\" title=\"<?php _e('Do not output widget title in the front-end.', $this->textdomain);?>\">\n\t\t<input id=\"<?php echo $widget->get_field_name('suppress_title'); ?>\" name=\"<?php echo $widget->get_field_name('suppress_title'); ?>\" type=\"checkbox\" value=\"1\" <?php checked($instance['suppress_title'], '1', true);?> />\n <?php _e('Suppress Title Output', $this->textdomain); ?>\n\t</label>\n\t</div>\n<?php\n\n $return = null;\n }",
"public function fixVisibleButWithoutCategoryAndInConfigurable()\n {\n $visibilityAttribute = $this->eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'visibility');\n $select = $this->_getWriteAdapter()->select();\n $select->join(['data_index' => $this->getMainTable()], 'data_index.entity_id = attribute.entity_id', []);\n $select->where('attribute.attribute_id = ?', $visibilityAttribute->getId());\n $select->where('data_index.is_in_configurable = ?', 1);\n $select->where('data_index.is_in_category = ?', 0);\n $select->where('data_index.visibility <> ?', Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);\n $select->columns([\n 'value' => new Zend_Db_Expr(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)\n ]);\n $this->_getWriteAdapter()->query($select->crossUpdateFromSelect(\n ['attribute' => $visibilityAttribute->getBackendTable()]\n ));\n\n Mage::getSingleton('index/indexer')\n ->getProcessByCode('catalog_category_product')\n ->reindexAll();\n \n Mage::getSingleton('index/indexer')\n ->getProcessByCode('catalog_product_flat')\n ->reindexAll();\n }",
"public function setHiddenFlag($hidden = true) {}",
"public function setVisible($value) {\r\n $this->bVisible = $this->setBooleanProperty($this->bVisible, $value);\r\n }",
"function is_visible() {\n\t\tif ($this->visibility=='hidden') return false;\n\t\tif ($this->visibility=='visible') return true;\n\t\tif ($this->visibility=='search' && is_search()) return true;\n\t\tif ($this->visibility=='search' && !is_search()) return false;\n\t\tif ($this->visibility=='catalog' && is_search()) return false;\n\t\tif ($this->visibility=='catalog' && !is_search()) return true;\n\t}",
"public function setHidden(){\n $this->_hidden = true;\n }",
"public function setInvisibleFlag($invisible = true) {}",
"function audioman_section_visibility_options() {\n\t$options = array(\n\t\t'homepage' => esc_html__( 'Homepage / Frontpage', 'audioman' ),\n\t\t'entire-site' => esc_html__( 'Entire Site', 'audioman' ),\n\t\t'disabled' => esc_html__( 'Disabled', 'audioman' ),\n\t);\n\n\treturn apply_filters( 'audioman_section_visibility_options', $options );\n}",
"function agenda_set_item_visibility($event_id, $visibility)\n{\n $tbl = get_conf('mainTblPrefix') . 'rel_event_recipient';\n\n $sql = \"UPDATE `\" . $tbl . \"`\n SET visibility = '\" . ($visibility=='HIDE'?\"HIDE\":\"SHOW\") . \"'\n WHERE `event_id` = \" . (int) $event_id;\n return claro_sql_query($sql);\n}",
"function set_hidden_column( $hidden, $screen, $use_defaults ) {\n\n\t// Check the screen ID before we set.\n\tif ( empty( $screen->id ) || 'edit-post' !== $screen->id ) {\n\t\treturn $hidden;\n\t}\n\n\t// Return our updated array.\n\treturn wp_parse_args( (array) 'enforce-plc', $hidden );\n}",
"public function withHidden($hidden=true);",
"public static function set_product_visibility( \\WC_Product $product, $visibility ) {\n\n\t\tunset( self::$products_visibility[ $product->get_id() ] );\n\n\t\tif ( ! is_bool( $visibility ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$product->update_meta_data( self::VISIBILITY_META_KEY, wc_bool_to_string( $visibility ) );\n\t\t$product->save_meta_data();\n\n\t\tself::$products_visibility[ $product->get_id() ] = $visibility;\n\n\t\treturn true;\n\t}",
"public function hiding_restricted_products() {\n\n\t\tif ( null === $this->hiding_restricted_products ) {\n\n\t\t\t$this->hiding_restricted_products = 'yes' === get_option( $this->hide_restricted_products_option );\n\t\t}\n\n\t\treturn $this->hiding_restricted_products;\n\t}",
"function unhide_kitchensink( $args ) {\n$args['wordpress_adv_hidden'] = false;\nreturn $args;\n}",
"public function SetPanelSettings()\n\t{\n\t\t$GLOBALS['ISC_CLASS_PRODUCT'] = GetClass('ISC_PRODUCT');\n\t\t$id = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId();\n\t\t// How many tags do we have?\n\t\t$query = \"\n\t\t\tSELECT p.* , pi.imagefilethumb\n\t\t\tFROM isc_products p\n\t\t\tINNER JOIN isc_product_associations pa ON ( \n\t\t\t\tpa.assocbaseid = \" . $id . \" AND pa.assocprodid = p.productid\n\t\t\t) \n\t\t\tINNER JOIN isc_product_images pi ON ( \n\t\t\t\tpi.imageprodid = pa.assocprodid AND pi.imageisthumb = 1\n\t\t\t) \n\t\t\";\n\t\t$result = $GLOBALS['ISC_CLASS_DB']->Query($query);\n\t\t\n\t\t$GLOBALS['SNIPPETS']['ProductMadeByList'] = '';\n\t\twhile($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {\n\t\t\t$GLOBALS['ComponentImg'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $row['imagefilethumb'];\n\t\t\t$GLOBALS['ComponentName'] = $row['prodname'];\n\t\t\t$GLOBALS['ComponentLink'] = ProdLink($row['prodname']);\n\t\t\t$GLOBALS['SNIPPETS']['ProductMadeByList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductMadeByItem');\n\t\t}\n\t\t\n\t\tif($GLOBALS['SNIPPETS']['ProductMadeByList'] == '') {\n\t\t\t$this->DontDisplay = true;\n\t\t}\n\t}",
"function restrict_listing_by_filter() {\n global $wpdb;\n\t\n\t$screen = get_current_screen();\n\t$hidden_columns = get_hidden_columns($screen);\n\t\n\tif(in_array('featured_listing', $hidden_columns)) {\n\t\t$featured_listing_filter_style = 'style=\"display:none;\"'; \n\t}\n\t?>\n\t\n\t<select name=\"featured_listing_filter\" id=\"featured_listing_filter\" class=\"column-featured_listing\" <?php echo $featured_listing_filter_style;?>>\n\t\t<option value=\"\">Show All Listings</option>\n\t\t<option value=\"yes\">Featured</option>\n\t\t<option value=\"no\">Non-Featured</option>\n\t</select>\n\t\n <?php\n}",
"public function setVisible(array $visible)\n {\n $this->visible = $visible;\n\n return $this;\n }",
"public function setVisible(array $visible)\n {\n $this->visible = $visible;\n\n return $this;\n }",
"function is_filtered() {\n\t\tglobal $_chosen_attributes;\n\n\t\treturn ( sizeof( $_chosen_attributes ) > 0 || ( isset( $_GET['max_price'] ) && isset( $_GET['min_price'] ) ) ) ? true : false;\n\t}",
"public function SetPanelSettings()\r\n\t\t{\r\n\t\t\t$products = $this->getProducts();\r\n\t\t\t$GLOBALS['ProductsOffersList'] = \"\";\r\n\r\n\t\t\t// Should we hide the comparison button?\n\t\t\tif(GetConfig('EnableProductComparisons') == 0 || count($products) < 2) {\n\t\t\t\t$GLOBALS['HideCompareItems'] = \"none\";\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(GetConfig('ShowProductRating') == 0) {\r\n\t\t\t\t$GLOBALS['HideProductRating'] = \"display: none\";\r\n\t\t\t}\r\n\r\n\t\t\t$display_mode = ucfirst(GetConfig(\"CategoryDisplayMode\"));\r\n\t\t\tif ($display_mode == \"Grid\") {\r\n\t\t\t\t$display_mode = \"\";\r\n\t\t\t}\r\n\t\t\t$GLOBALS['DisplayMode'] = $display_mode;\r\n\r\n\t\t\tif ($display_mode == \"List\") {\r\n\t\t\t\tif (GetConfig('ShowAddToCartLink') && count($products) > 0) {\r\n\t\t\t\t\t$GLOBALS['HideAddButton'] = '';\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$GLOBALS['HideAddButton'] = 'none';\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$GLOBALS['ListJS'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"ListCheckForm\");\r\n\t\t\t}\r\n\r\n\t\t\t$GLOBALS['CompareButton'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CompareButton\" . $display_mode);\r\n\r\n\t\t\tif (GetConfig('CategoryProductsPerPage') > 0) {\n\t\t\t\t$this->_numpages = ceil(count($products) / GetConfig('CategoryProductsPerPage'));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$this->_numpages = 0;\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ($display_mode == \"List\" && $this->_numpages > 1) {\r\n\t\t\t\t$GLOBALS['CompareButtonTop'] = $GLOBALS['CompareButton'];\r\n\t\t\t}\r\n\r\n\t\t\t$GLOBALS['AlternateClass'] = '';\r\n\t\t\tforeach($products as $row) {\r\n\t\t\t\t$this->setProductGlobals($row);\r\n\r\n\t\t\t\t// for list style\r\n\t\t\t\tif ($display_mode == \"List\") {\r\n\t\t\t\t\t// get a small chunk of the product description\r\n\t\t\t\t\t$desc = isc_substr(strip_tags($row['proddesc']), 0, 225);\r\n\t\t\t\t\tif (isc_strlen($row['proddesc']) > 225) {\r\n\t\t\t\t\t\t// trim the description back to the last period or space so words aren't cut off\r\n\t\t\t\t\t\t$period_pos = isc_strrpos($desc, \".\");\r\n\t\t\t\t\t\t$space_pos = isc_strrpos($desc, \" \");\r\n\t\t\t\t\t\t// find the character that we should trim back to. -1 on space pos for a space that follows a period, so we dont end up with 4 periods\r\n\t\t\t\t\t\tif ($space_pos - 1 > $period_pos) {\r\n\t\t\t\t\t\t\t$pos = $space_pos;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t$pos = $period_pos;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$desc = isc_substr($desc, 0, $pos);\r\n\t\t\t\t\t\t$desc .= \"...\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$GLOBALS['ProductDescription'] = $desc;\r\n\r\n\t\t\t\t\t$GLOBALS['AddToCartQty'] = \"\";\r\n\r\n\t\t\t\t\tif (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {\r\n\t\t\t\t\t\tif (isId($row['prodvariationid']) || trim($row['prodconfigfields'])!='' || $row['prodeventdaterequired']) {\r\n\t\t\t\t\t\t\t$GLOBALS['AddToCartQty'] = '<a href=\"' . $GLOBALS[\"ProductURL\"] . '\">' . $GLOBALS['ProductAddText'] . \"</a>\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t$GLOBALS['CartItemId'] = $GLOBALS['ProductId'];\r\n\t\t\t\t\t\t\t// If we're using a cart quantity drop down, load that\r\n\t\t\t\t\t\t\tif (GetConfig('TagCartQuantityBoxes') == 'dropdown') {\r\n\t\t\t\t\t\t\t\t$GLOBALS['Quantity0'] = \"selected=\\\"selected\\\"\";\r\n\t\t\t\t\t\t\t\t$GLOBALS['QtyOptionZero'] = '<option %%GLOBAL_Quantity0%% value=\"0\">'.GetLang('Quantity').'</option>';\r\n\t\t\t\t\t\t\t\t$GLOBALS['QtySelectStyle'] = 'width: auto;';\r\n\t\t\t\t\t\t\t\t$GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CartItemQtySelect\");\r\n\t\t\t\t\t\t\t// Otherwise, load the textbox\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$GLOBALS['ProductQuantity'] = 0;\r\n\t\t\t\t\t\t\t\t$GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CartItemQtyText\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} // for grid style\r\n\t\t\t\telse {\r\n\t\t\t\t\t$GLOBALS[\"CompareOnSubmit\"] = \"onsubmit=\\\"return compareProducts(config.CompareLink)\\\"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$GLOBALS['ProductsOffersList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"HomeProductsOfferItem\" . $display_mode);\r\n\t\t\t}\r\n\r\n\t\t\tif(count($products) == 0) {\r\n\t\t\t\t// There are no products in this category\r\n\t\t\t\t$GLOBALS['ProductsOffersList'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CategoryNoProductsMessage\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t// Paging\r\n\t\tif(count($products) <= GetConfig('CategoryProductsPerPage')) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// Workout the paging data\n\t\t$GLOBALS['SNIPPETS']['PagingData'] = \"\";\n\t\t\n\t\t$maxPagingLinks = 5;\n\t\tif($GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {\n\t\t\t$maxPagingLinks = 3;\n\t\t}\n\t\t\n\t\t$start = max($this->_page-$maxPagingLinks,1);\n\t\t$end = min($this->_page+$maxPagingLinks, $this->_numpages);\n\t\t\n\t\t$queryStringAppend = array(\n\t\t\t\t'sort' => $this->_sort,\n\t\t);\n\t\t\n\t\tif(!empty($_GET['price_min'])) {\n\t\t\t$queryStringAppend['price_min'] = (float)$_GET['price_min'];\n\t\t}\n\t\t\n\t\tif(!empty($_GET['price_max'])) {\n\t\t\t$queryStringAppend['price_max'] = (float)$_GET['price_max'];\n\t\t}\n\t\t\n\t\t\n\t\tfor ($page = $start; $page <= $end; $page++) {\n\t\t\tif($page == $this->_page) {\n\t\t\t\t$snippet = \"CategoryPagingItemCurrent\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$snippet = \"CategoryPagingItem\";\n\t\t\t}\n\t\t\n\t\t\t$pageQueryStringAppend = $queryStringAppend;\n\t\t\t$pageQueryStringAppend['page'] = $page;\r\n\t\t\t$GLOBALS['PageLink'] = $this->getPageLink($pageQueryStringAppend);\n\t\t\t$GLOBALS['PageNumber'] = $page;\n\t\t\t$GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);\n\t\t}\n\t\t\n\t\t// Parse the paging snippet\n\t\tif($this->_page > 1) {\n\t\t\t// Do we need to output a \"Previous\" link?\n\t\t\t$pageQueryStringAppend = $queryStringAppend;\n\t\t\t$pageQueryStringAppend['page'] = $this->_page- 1;\n\t\t\t$GLOBALS['PrevLink'] = $this->getPageLink($pageQueryStringAppend);\n\t\t\t$GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CategoryPagingPrevious\");\n\t\t}\n\t\t\n\t\tif($this->_page < $this->_numpages) {\n\t\t\t// Do we need to output a \"Next\" link?\n\t\t\t$pageQueryStringAppend = $queryStringAppend;\n\t\t\t$pageQueryStringAppend['page'] = $this->_page + 1;\r\n\t\t\t$GLOBALS['NextLink'] = $this->getPageLink($pageQueryStringAppend);\n\t\t\t$GLOBALS['SNIPPETS']['CategoryPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CategoryPagingNext\");\n\t\t}\n\t\t\n\t\t$output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet(\"CategoryPaging\");\n\t\t$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);\n\t\t$GLOBALS['SNIPPETS']['CategoryPaging'] = $output;\r\n\t\t}"
]
| [
"0.6626484",
"0.575616",
"0.57323647",
"0.56378496",
"0.5427959",
"0.5421006",
"0.54028404",
"0.5389798",
"0.53730667",
"0.5366859",
"0.5300426",
"0.5279501",
"0.52792424",
"0.52445084",
"0.524432",
"0.5228616",
"0.52202624",
"0.52186155",
"0.5204672",
"0.5176404",
"0.5151016",
"0.5117046",
"0.5112302",
"0.5111506",
"0.5109994",
"0.5094196",
"0.50874496",
"0.50874496",
"0.5086422",
"0.50820094"
]
| 0.6814075 | 0 |
Many to Many relation, one extra has many categories, one category has many extras | public function extras()
{
return $this->belongsToMany('App\Models\Extra', 'extra_category_extras');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function extras()\n {\n return $this->hasMany('App\\DescriptionExtra','category_id');\n }",
"public function items()\n {\n return $this->belongsToMany('App\\Models\\Item', 'item_extra_categories');\n }",
"public function extras()\n {\n return $this->belongsToMany('App\\DescriptionExtra','description_description_category_column','description_id','column_id')\n ->withPivot('value');\n }",
"public function products(): MorphToMany;",
"public function category() {\n\t\treturn $this->belongsToMany('Category');\n\t}",
"public function categories()\n {\n return $this->belongsToMany('App\\Models\\Categories', 'category_article', 'article_id', 'category_id');\n }",
"public function categories()\n {\n return $this->belongsToMany('App\\Category');\n }",
"public function categories()\n {\n return $this->belongsToMany('App\\Category');\n }",
"public function categories()\n {\n return $this->belongsToMany('App\\Category');\n }",
"public function categories()\n {\n \treturn $this->hasMany('App\\Category');\n }",
"public function categories(){\n return $this->belongsToMany(category::class);\n }",
"public function category() {\n \treturn $this->belongsToMany(Category::class, 'product_details', 'category_id');\n }",
"public function categories()\n {\n return $this->belongsToMany(Category::class, 'category_product');\n }",
"public function categoryProductRelations()\n {\n // hasMany(RelatedModel, foreignKeyOnRelatedModel = cate_id, localKey = cate_id)\n return $this->hasMany('App\\CategoryProductRelation','cate_id','cate_id');\n }",
"public function categories()\n\t{\n\t\treturn $this->belongsToMany(Category::class);\n\t}",
"public function categories()\n {\n return $this->belongsToMany(Category::class);\n }",
"public function categories()\n {\n return $this->belongsToMany(Category::class);\n }",
"public function categories()\n {\n return $this->belongsToMany(Category::class);\n }",
"public function cats() {\n return $this->belongsToMany('App\\Models\\Pronunciation\\Cat', 'pronunciation_question_cat','question_id','cat_id');\n }",
"public function categories() {\n return $this->belongsToMany('App\\PodcastMetaData', 'podcast_metas', 'podcast_id', 'meta_id')->where('meta_type', 'podcast_category');\n }",
"public function categoryProduct(){\n return $this->hasMany(CategoryProduct::class);\n }",
"public function tags(): MorphToMany\n {\n return $this->morphToMany(config('rinvex.categories.models.category'), 'taggable', 'taggable', 'taggable_id', 'tag_id')\n ->withTimestamps();\n }",
"public function getCategories()\n {\n return $this->hasMany(Category::class, ['id' => 'category_id'])\n ->viaTable('product_category', ['product_id' => 'id']);\n }",
"public function photo_categories(): BelongsToMany\n {\n return $this->belongsToMany(PhotoCategory::class, 'photo_categories_photos');\n }",
"public function categorias()\n {\n return $this->belongsToMany(Categoria::class, 'medicamentos_categorias', 'medicamentos_id', 'categorias_id');\n }",
"public function categories()\n {\n \treturn $this->belongsToMany('App\\Category', 'category_post', 'post_id', 'category_id');\n }",
"public function categoryAdditionals()\n {\n return $this->where('categories.id', $this->id)\n ->join('categories_additionals', 'categories.id', 'categories_additionals.category_son_id')\n ->join(DB::raw('categories as category_contains'), 'category_contains.id', 'categories_additionals.category_father_id')\n ->select([DB::raw('category_contains.id as id'), DB::raw('category_contains.name as name')])\n ->get();\n }",
"public function categories()\n {\n return $this->morphedByMany(\n Category::class,\n 'metable'\n );\n }",
"public function categories(){\n\t\treturn $this->belongsToMany('ProductCategory', 'product_pivot_categories');\n\t}",
"public function articles() {\n return $this->hasMany('Drstock\\Article','category_id');}"
]
| [
"0.72295916",
"0.6399643",
"0.6204753",
"0.61605823",
"0.60628945",
"0.60575086",
"0.60459214",
"0.60459214",
"0.60459214",
"0.59998286",
"0.5970048",
"0.5917506",
"0.58812535",
"0.5875313",
"0.5865006",
"0.5863388",
"0.5863388",
"0.5863388",
"0.5859131",
"0.58308107",
"0.5813855",
"0.5795089",
"0.57941616",
"0.57772607",
"0.5761722",
"0.5741114",
"0.5731593",
"0.57216966",
"0.5714887",
"0.57034606"
]
| 0.7666871 | 0 |
Show the form for creating a new DataBeritaJur. | public function create()
{
return view('data_berita_jurs.create');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function create()\n {\n // added by dandisy\n \n\n // edited by dandisy\n // return view('surat_keluar_barangs.create');\n return view('surat_keluar_barangs.create');\n }",
"public function create()\n {\n return view ('kodebuku.create');\n }",
"public function create()\n {\n return view('admin.jenisobjekwisata.create');\n }",
"public function create()\n {\n # set all jabatan data\n $jabatan = Jabatan::all();\n\n # return to jabatan with array jabatan data\n return view('pegawai.form_create', compact('jabatan'));\n }",
"public function create()\n {\n return view('jabatan.create');\n }",
"public function create()\n {\n return view('beranda.jawaban.create');\n }",
"public function create()\n {\n // mengambil semua jurusans untuk di jadikan dropdwon list pemilik di form create\n\n $jurusans = \\App\\Jurusan::all();\n\n // melempar ke view di file create.blade.php yang berada di folder crud/mahasiswa, sekaligus mengirim data jurusan yang disimpan di variable $jurusans\n\n return view('crud.mahasiswa.create', compact('jurusans'));\n //\n }",
"public function create()\n {\n return view('detail_penjualan_barangs.create');\n }",
"public function create()\n {\n return view('backend.admin.jurusan.create');\n }",
"public function create()\n {\n // Mengarahkan ke halaman form\n return view('buku.form');\n }",
"public function create()\n {\n $jabatan = Jabatan::all();\n return view('managepengurus.create',compact('jabatan'));\n }",
"public function create()\n {\n return view('distribusi.tambah', [\n 'title' => 'Tambah Distribusi',\n 'modul_link' => route('distribusi.index'),\n 'modul' => 'Distribusi',\n 'action' => route('distribusi.store'),\n 'active' => 'distribusi.create',\n 'listMitraKerja'=>MitraKerja::listMode(),\n 'listJenisBeras'=>JenisBeras::listMode(),\n 'gudang'=>Gudang::all(),\n ]);\n }",
"public function create()\n\t{\n\t\t$jenis_buku = Jenis_buku::orderBy('created_at','asc')->get();\n\t\t$genres = Genre::orderBy('created_at','asc')->get();\n\t\t$covers = Jenis_cover::orderBy('created_at','asc')->get();\n\t\t$bahasa = Text_bahasa::orderBy('created_at','asc')->get();\n\t\t$header = \"Tambah\";\n\t\treturn view('admin.buku.form',compact('header','bahasa','covers','jenis_buku','genres'));\n\t}",
"public function actionCreate()\n {\n $model = new Bilancio();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }",
"public function create()\n {\n $data['universitas'] = Universitas::all();\n $data['clusters'] = Cluster::all();\n $data['program_studis'] = ProgramStudi::all();\n\n return view('jurusan.create',$data);\n }",
"public function create()\n {\n $dataa = new Inputan;\n $kode = $dataa->Kode();\n return view('buku.create')->with('kode', $kode);\n }",
"public function create()\n {\n return view('bajas/bajasCreate');\n }",
"public function create()\n {\n $model = new Bandara;\n return view('bandara.create', compact('model'));\n }",
"public function create()\n {\n $mesinUsers = MesinUsers::dropdown();\n $jabatan = Jabatan::dropdown();\n $jenisKelamin = JenisKelamin::dropdown();\n $pegawaiStatus = PegawaiStatus::dropdown();\n return view('backend.pegawai.create', compact('jabatan', 'jenisKelamin', 'pegawaiStatus', 'mesinUsers'));\n }",
"public function create()\n {\n \n \n return view('jabatan.tambah');\n }",
"public function create()\r\n {\r\n return view('surat_keluar.create');\r\n }",
"public function create()\n {\n $model = new Keranjang;\n //list_barang dipakai untuk menampilkan \n //pilihan semua barang pada form\n $list_barang = Barang::all(); //select & barang\n return view('keranjang.create', compact(\n 'model', 'list_barang'\n ));\n }",
"public function create()\n {\n return view('admin.bloodbank.create');\n }",
"public function create()\n {\n return view('admin.petugas.form_tambah');\n }",
"public function create()\n {\n //\n return view('admin.content.berita.create');\n\n }",
"public function create()\n\t{\n\t\treturn View::make('unitkerjas.create')->withTitle('Tambah Unit Kerja');\n\t}",
"public function create()\n {\n //\n return view('backend.konselor.tambahkonselor');\n }",
"public function create()\n {\n return view('berita.create');\n }",
"public function create()\n {\n $dataBaru = true;\n return view('kategori.form', compact('dataBaru'));\n }",
"public function create()\n {\n //\n $pagename = 'Form Input Akun';\n return view('admin.akun.create', compact('pagename'));\n }"
]
| [
"0.7376853",
"0.7337308",
"0.7329919",
"0.730424",
"0.7285409",
"0.7283738",
"0.72829497",
"0.7282011",
"0.727934",
"0.7275106",
"0.72720456",
"0.7234194",
"0.716618",
"0.71597815",
"0.71524763",
"0.7147039",
"0.714214",
"0.7139253",
"0.71349263",
"0.7124646",
"0.7116811",
"0.7112901",
"0.71111363",
"0.71097225",
"0.7108248",
"0.70964956",
"0.70903623",
"0.70842063",
"0.70828676",
"0.70822674"
]
| 0.77275836 | 0 |
Store a newly created DataBeritaJur in storage. | public function store(CreateDataBeritaJurRequest $request)
{
$input = $request->all();
$dataBeritaJur = $this->dataBeritaJurRepository->create($input);
Flash::success('Data Berita Jur saved successfully.');
return redirect(route('dataBeritaJurs.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\n\t {\n\t //\n\t }",
"public function store()\n\t{\n\t\t\n\t\t//\n\t}",
"public function store() {\n \n }",
"public function store();",
"public function store();",
"public function store();",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}",
"public function store()\n\t{\n\t\t//\n\t}"
]
| [
"0.6141188",
"0.6141188",
"0.6141188",
"0.61400396",
"0.60974294",
"0.60850275",
"0.60715824",
"0.60715824",
"0.60715824",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496",
"0.60390496"
]
| 0.69995743 | 0 |
Update the specified DataBeritaJur in storage. | public function update($id, UpdateDataBeritaJurRequest $request)
{
$dataBeritaJur = $this->dataBeritaJurRepository->findWithoutFail($id);
if (empty($dataBeritaJur)) {
Flash::error('Data Berita Jur not found');
return redirect(route('dataBeritaJurs.index'));
}
$dataBeritaJur = $this->dataBeritaJurRepository->update($request->all(), $id);
Flash::success('Data Berita Jur updated successfully.');
return redirect(route('dataBeritaJurs.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function editData() {\n $this->daftar_barang = array_values($this->daftar_barang);\n $data_barang = json_encode($this->daftar_barang, JSON_PRETTY_PRINT);\n file_put_contents($this->file, $data_barang);\n $this->ambilData();\n }",
"function update_data($perusahaan, $kategori, $nama_file, $masa_berlaku, $id){\r\n\t\t\t$perusahaan \t= escape($perusahaan);\r\n\t\t\t$kategori \t\t= escape($kategori);\r\n\t\t\t$nama_file\t\t= escape($nama_file);\r\n\t\t\t$masa_berlaku\t= escape($masa_berlaku);\r\n\t\t\t$id\t\t\t\t= escape($id);\r\n\t\t\t\r\n\t\t\t$query \t= \"UPDATE data SET pt='$perusahaan', kategori='$kategori', nama_file='$nama_file', masa_berlaku='$masa_berlaku' WHERE id='$id' \";\r\n\t\t\treturn run($query);\r\n\t\t}",
"public function update($data) {}",
"public function update($data) {}",
"public function update($gunBbl);",
"abstract public function updateData();",
"public function update($tarConvenio);",
"public function update($cbtJadwalUjian){\n\t\t$sql = 'UPDATE cbt_jadwal_ujian SET id_tp = ?, id_smt = ?, level = ?, id_jenis = ?, dari = ?, sampai = ?, jam_mulai = ?, jml_mapel = ?, jml_istirahat = ?, durasi_mapel = ?, durasi_istirahat = ? WHERE id_jadwal = ?';\n\t\t$sqlQuery = new SqlQuery($sql);\n\t\t\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->id_tp);\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->id_smt);\n\t\t$sqlQuery->set($cbtJadwalUjian->level);\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->id_jenis);\n\t\t$sqlQuery->set($cbtJadwalUjian->dari);\n\t\t$sqlQuery->set($cbtJadwalUjian->sampai);\n\t\t$sqlQuery->set($cbtJadwalUjian->jam_mulai);\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->jml_mapel);\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->jml_istirahat);\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->durasi_mapel);\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->durasi_istirahat);\n\n\t\t$sqlQuery->setNumber($cbtJadwalUjian->id_jadwal);\n\t\treturn $this->executeUpdate($sqlQuery);\n\t}",
"function update() {\r\n\r\n\t\t$this->connection = new Connection();\r\n\t\t$conn = $this->connection->openConnection();\r\n\r\n\t\t$insert = $conn->prepare(\"UPDATE `panier` SET `quantite`=:quantite WHERE id_internaute=:id_internaute AND id_nourriture=:id_nourriture AND datep=:datep\");\r\n\t\ttry {\r\n\t\t\t$result = $insert->execute(array('quantite' => $this->getQuantite(),'id_internaute' => $this->getId_internaute(),'id_nourriture' => $this->getId_nourriture(),'datep' => $this->getDate()));\r\n\t\t\t\r\n\t\t} catch (PDOExecption $e) {\r\n\t\t\tprint \"Error!: \" . $e->getMessage() . \"</br>\";\r\n\t\t}\r\n\t\t$this->connection->closeConnection();\r\n\t}",
"public function update($data)\n {\n }",
"public function update($data)\n {\n }",
"public function update($data)\n {\n }",
"public function update($data)\n {\n }",
"public function update(Request $request, Berita $berita)\n {\n $berita->update($request->all());\n \n return redirect()->route('beritas.index')\n ->with('success','Berita updated successfully');\n }",
"public function update($param)\n {\n $row = Budget::find($param);\n if (!$row) return abort(404);\n\n # update data \n $row->update([\n // 'kode' => request('kode'),\n // 'uraian' => request('uraian'),\n 'pagu' => request('pagu'),\n // 'realisasi' => request('realisasi'),\n // 'sisa' => request('pagu'),\n 'keterangan' => request('keterangan'),\n ]);\n \n # Tampilin flash message\n flash('Selamat data telah berhasil di update')->success();\n # Kalo udah insert data, redirect ke halaman anggaran\n return redirect()->route('budget.index');\n\n }",
"public function update(Request $request, Jabatan $jabatan)\n {\n //\n }",
"public function update(Request $request, Jurusan $jurusan)\n {\n $lower_nama = strtolower($request['nama']);\n $temp_nama = str_replace(' ','-',$lower_nama);\n $lower_universitas = strtolower($request['universitas']);\n $temp_universitas = str_replace(' ','-',$lower_universitas);\n $kode = $temp_nama.'_'.$temp_universitas;\n\n $validator = Validator::make($request->all(), [\n 'nama' => ['required', 'string', 'max:255'],\n 'nilai' => ['required', 'integer', 'max:1000'],\n 'prioritas' => ['required', 'string', 'max:2'],\n 'kuota' => ['required', 'integer', 'max:1000'],\n 'tahun' => ['required', 'string', 'max:255'],\n 'deskripsi' => ['required', 'string', 'max:255'],\n 'universitas' => ['required', 'string', 'max:255'],\n 'cluster' => ['required', 'string', 'max:255'],\n 'program_studi' => ['required', 'string', 'max:255'],\n ]);\n if ($validator->fails()) {\n return redirect('jurusan/'.$jurusan->id.'/edit')\n ->withErrors($validator)\n ->withInput();\n }\n $jurusan = Jurusan::find($jurusan->id);\n $jurusan->kode = $kode;\n $jurusan->nama = $request['nama'];\n $jurusan->nilai_perhitungan = $request['nilai'];\n $jurusan->prioritas = $request['prioritas'];\n $jurusan->kuota = $request['kuota'];\n $jurusan->tahun = $request['tahun'];\n $jurusan->deskripsi = $request['deskripsi'];\n $jurusan->universitas_kode = $request['universitas'];\n $jurusan->cluster_kode = $request['cluster'];\n $jurusan->program_studi_kode = $request['program_studi'];\n $jurusan->save();\n\n Alert::success('Success', 'Berhasil Mengubah Data');\n return redirect('jurusan/'.$jurusan->id.'/edit');\n }",
"public function upadateUraianById($idUraian, $data)\n {\n return $this->db->update('tb_dist_jwbuo', $data, ['id_uraian' => $idUraian]);\n }",
"public function setData($data){\n\t\t$this->_storage = $data;\n\t\t\n\t\t// set update flag\n\t\t$this->_isModified = true;\n\t\t\n\t\t// new data available\n\t\t$this->_dataAvailable = true;\n\t}",
"function kas_update($kas_id , $kas_tanggal, $kas_jumlah , $kas_keterangan, $kas_tipe ){\r\n\t\t\tif ($kas_tipe==\"Kas Keluar\")\r\n\t\t\t\t$kas_jumlah = $kas_jumlah * -1;\r\n\t\t\t$data = array(\r\n\t\t\t\t\"bs_id\"=>$kas_id,\t\r\n\t\t\t\t\"bs_tanggal\"=>$kas_tanggal,\t\t\t\r\n\t\t\t\t\"bs_jumlah\"=>$kas_jumlah,\t\t\t\r\n\t\t\t\t\"bs_keterangan\"=>$kas_keterangan,\r\n\t\t\t\t\"bs_tipe\"=>$kas_tipe,\t\t\t\t\t\r\n\t\t\t\t\"bs_date_update\"=>date('Y-m-d H:i:s')\t\t\t\r\n\t\t\t);\r\n\t\t\t\r\n\t\t\t$this->db->where('bs_id', $kas_id);\r\n\t\t\t$this->db->update('bs', $data);\r\n\t\t\tif($this->db->affected_rows()){\r\n\r\n\t\t\t\treturn '1';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}",
"public function update($cbtRekapNilai);",
"public function update_with($new_data)\n {\n }",
"public function update($aluno) {\n\t}",
"public function updateBuku($kd_buku, $judul, $kd_jenis, $kd_penerbit, $tahun_terbit, $jumlah_buku){\n if(!$this->isLoggedIn()){\n return false;\n }\n\n try {\n // Ambil data user dari database\n $query = $this->db->prepare(\"\n UPDATE \n `sibukudb`.`buku` \n SET \n `judul` = :judul, \n `kd_jenis` = :kd_jenis,\n `kd_penerbit` = :kd_penerbit, \n `tahun_terbit` = :tahun_terbit,\n `jumlah_buku` = :jumlah_buku \n WHERE \n `kd_buku` = :kd_buku;\n \");\n $query->bindParam(\":kd_buku\", $kd_buku);\n $query->bindParam(\":judul\", $judul);\n $query->bindParam(\":kd_jenis\", $kd_jenis);\n $query->bindParam(\":kd_penerbit\", $kd_penerbit);\n $query->bindParam(\":tahun_terbit\", $tahun_terbit);\n $query->bindParam(\":jumlah_buku\", $jumlah_buku);\n $query->execute();\n $this->message = \"data berhasil di update\";\n } catch (PDOException $e) {\n echo $e->getMessage();\n return false;\n }\n }",
"public function testUpdateSuperfund()\n {\n }",
"public function Update($data) {\n\n }",
"public function update($turmaDisciplina);",
"public function upload_buktibayar($data)\n\t{\n\n\t\t$this->db->where('id_transaksi', $data['id_transaksi']);\n\t\t$this->db->update('tbl_transaksi', $data);\n\t}",
"public function update($cbtSoalSiswa);",
"public function update(BiayaTambahanRequest $request, BiayaTambahan $biayaTambahan)\n {\n $this->authorize('update', $biayaTambahan);\n\n $data = $request->validated();\n\n DB::beginTransaction();\n try { \n $tersedia = $request->user()->bisnis\n ->biayaTambahan()\n ->where(function($q) use ($data, $biayaTambahan) {\n $q->where('outlet_id',$data['outlet_id']);\n $q->where('nama_biaya_tambahan', $data['nama_biaya_tambahan']);\n $q->where('id_biaya_tambahan','!=', $biayaTambahan->id_biaya_tambahan);\n })->count();\n if($tersedia == 0)\n $biayaTambahan->update($data);\n else\n return response([\n 'status' => 'warning',\n 'message' => [\"Biaya Tambahan tidak boleh duplikat\"]\n ], 422);\n\n DB::commit();\n return response([\n 'status' => 'success',\n 'message' => [\"Biaya Tambahan berhasil diperbaharui\"]\n ], 200);\n } catch (\\Exception $e) {\n DB::rollback();\n return response([\n 'status' => 'error',\n 'message' => [\"Terjadi Kesalahan\"]\n ], 500);\n }\n }"
]
| [
"0.6119352",
"0.5968191",
"0.5935796",
"0.5935796",
"0.5816189",
"0.5725181",
"0.5678015",
"0.5642006",
"0.563146",
"0.5626729",
"0.5626729",
"0.5626729",
"0.5626729",
"0.557888",
"0.5547386",
"0.55182993",
"0.5510607",
"0.5510148",
"0.55042756",
"0.5499393",
"0.5485986",
"0.54828924",
"0.5482863",
"0.5479991",
"0.5473305",
"0.54400444",
"0.54089993",
"0.5399446",
"0.5394451",
"0.53896683"
]
| 0.6052861 | 1 |
Returns the parameters needed to build interface according to the classe which makes the call | function returnBuildInterfaceParam() {
$param = array();
$param['name'] = 'msg_docman_access';
$param['func'] = 'docman_access_request';
$param['action'] = '/plugins/docman/sendmessage.php';
$param['index'] = 'docman_no_perm';
return $param;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract public function getParameters();",
"public function build($interface, $_request)\n {\n switch ($interface) {\n case 'fields':\n $this->control = new Fields($_request);\n break;\n\n case 'groups':\n $this->control = new Groups($_request);\n break;\n\n case 'mailings';\n $this->control = new Mailings($_request);\n break;\n\n case 'members':\n $this->control = new Members($_request);\n break;\n\n case 'response';\n $this->control = new Response($_request);\n break;\n\n case 'searches';\n $this->control = new Searches($_request);\n break;\n\n case 'triggers';\n $this->control = new Triggers($_request);\n break;\n\n case 'webhooks';\n $this->control = new Webhooks($_request);\n break;\n }\n }",
"public function getParameters() {}",
"public function getParameters();",
"public function getParameters();",
"public function getParameters();",
"public function getParameters();",
"public function getParameters();",
"public function getParameters();",
"public function getParameters();",
"public function getParameters();",
"function getParameters()\r\n {\r\n }",
"public function getParameters()\n\t{\n\n\t}",
"public function getParameters()\n\t{\n\n\t}",
"public function getParams(){\n\t\tthrow new Exception(\"Method \".__CLASS__.\"::\".__METHOD__.\" not implemented yet!\");\n\t}",
"public function getParams() {}",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"public function getParams();",
"function getParameters();",
"function getParameters();",
"public function get_params()\n {\n }",
"public function get_params()\n {\n }"
]
| [
"0.6576101",
"0.61589384",
"0.6119446",
"0.61111593",
"0.61111593",
"0.61111593",
"0.61111593",
"0.61111593",
"0.61111593",
"0.61111593",
"0.61111593",
"0.6074848",
"0.60673964",
"0.60673964",
"0.6036134",
"0.59383565",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.59253156",
"0.58733624",
"0.58733624",
"0.5813974",
"0.5813974"
]
| 0.6714498 | 0 |
Find an specific city to display in updateprofile | public function find($id_city){
//-- return all query and use the object result in update-profile
return $search = mysql_query("SELECT id_city, states.id_state, states.state, city FROM cities INNER JOIN states ON(cities.id_state = states.id_state ) WHERE id_city='".$id_city."' LIMIT 1");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getCity();",
"public function getCity() {}",
"public function search($city);",
"function lookupRegionByCity($city){\n\t$data = M('georegion');\n\tif(strlen($city)>0){\n\t\t$condition = Array('citylist' => Array('like', '%'.$city.'%'));\n\t\tif($region = $data->where($condition)->find()){\n\t\t\treturn $region['id'];\n\t\t}\n\t\telse\n\t\t\treturn '0';\n\t}\n\treturn false;\n}",
"public function show(city $city)\n {\n //\n }",
"protected function giveCity()\n\t{\n\t\treturn \"Orland\";\n\t}",
"function updateFacebookCurrentCity () {\n }",
"function _param_geowidget_maybeyourcity_form_loadcity_callback() {\n $city = &drupal_static(__FUNCTION__);\n if (!isset($city)) {\n if ($cache = cache_get('geowidget')) {\n $city = $cache->data;\n } else {\n $city = db_select('geowidget_city', 'c')\n ->fields('c', array('id', 'parent_id', 'title', 'geoname_id'))\n ->execute()\n ->fetchAll();\n\n cache_clear_all('geowidget', 'cache', TRUE);\n cache_set('geowidget', $city, 'cache', time() + 360);\n }\n }\n return $city;\n}",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city)\n {\n //\n }",
"public function show(City $city, $id)\n {\n \n }",
"public function getUserCity(){\n return($this->userCity);\n }",
"public function getCityWidgetAction()\n {\n $term = $this->getRequest()->request('city', '', waRequest::TYPE_STRING_TRIM);\n\n try {\n $city = $this->suggestCity($term);\n } catch (waException $e) {\n $this->setError($e->getMessage());\n return;\n }\n\n $this->response = array(\n 'id' => $city['id'],\n 'city' => $city['cityName'],\n 'region' => $city['regionName'],\n 'country' => $city['countryName']\n );\n }",
"public function showCity(){\n\n return $this->getPostData()['novaposhta_city_custom_field'];\n\n }",
"public function getCity(): string\n {\n return $this->result->city_name;\n }",
"function getCity()\n\t\t{\n\t\t\t$cities = $this->manage_content->getValue('city','city_name');\n\t\t\tforeach($cities as $city)\n\t\t\t{\n\t\t\t\techo '<option value=\"'.$city['city_name'].'\">'.$city['city_name'].'</option>';\n\t\t\t}\n\t\t}",
"public function getCity()\n {\n return $this->getParameter('city');\n }",
"public function show(City $city)\n {\n if(LaravelLocalization::getCurrentLocale() == 'ar'){\n $name = 'name_ar';\n }else{\n $name = 'name_en';\n }\n $countries = Country::select('id', \"$name as name\")->get();\n return view('backend.cities.update', compact('countries', 'city'));\n }",
"function particularcity($id)\n\t{\n\t\t$getParcity=\"SELECT * from cities where id = $id\";\n\t\t$getParcitydata = $this->get_results( $getParcity );\n\t\treturn $getParcitydata;\n\t}",
"function getCity(){\r\n\t\t$user_ip = getenv('REMOTE_ADDR');\r\n\t\t$geo = unserialize(file_get_contents(\"http://www.geoplugin.net/php.gp?ip=$user_ip\"));\r\n\t\t$city = $geo[\"geoplugin_city\"];\r\n\t\t\r\n\t\treturn $city;\r\n\t\t/*\r\n\t\t$region = $geo[\"geoplugin_regionName\"];\r\n\t\t$country = $geo[\"geoplugin_countryName\"];\r\n\t\techo \"City: \".$city.\"<br>\";\r\n\t\techo \"Region: \".$region.\"<br>\";\r\n\t\techo \"Country: \".$country.\"<br>\";\r\n\t\tgeoplugin_request\r\n\t\tgeoplugin_status\r\n\t\tgeoplugin_credit\r\n\t\tgeoplugin_city\r\n\t\tgeoplugin_region\r\n\t\tgeoplugin_areaCode\r\n\t\tgeoplugin_dmaCode\r\n\t\tgeoplugin_countryCode\r\n\t\tgeoplugin_countryName\r\n\t\tgeoplugin_continentCode\r\n\t\tgeoplugin_latitude\r\n\t\tgeoplugin_longitude\r\n\t\tgeoplugin_regionCode\r\n\t\tgeoplugin_regionName\r\n\t\tgeoplugin_currencyCode\r\n\t\tgeoplugin_currencySymbol\r\n\t\tgeoplugin_currencySymbol_UTF8\r\n\t\tgeoplugin_currencyConverter\r\n\t\t*/\t\r\n\t}",
"function getCity() {\r\r\n\t\treturn $this->city;\r\r\n\t}",
"function fn_cp_edost_improvement_rus_cities_find_cities($params, $lang_code, $items_per_page, $search, $fields, &$join, $condition)\n{\n}",
"public function getCity()\n {\n return parent::getValue('city');\n }",
"private function findCity($name)\n {\n return City::where(compact('name'))->firstOrFail();\n}",
"function venture_geo_get_location($city, $state, $country) {\n $location = \"$city, \";\n $location .= ($state ? $state : $country);\n return $location;\n}"
]
| [
"0.6632076",
"0.65859216",
"0.65700775",
"0.6545348",
"0.64880407",
"0.63928",
"0.6386226",
"0.6284616",
"0.62798667",
"0.62798667",
"0.62798667",
"0.62798667",
"0.62798667",
"0.62798667",
"0.62798667",
"0.62376994",
"0.6214949",
"0.6187589",
"0.61791545",
"0.6142894",
"0.6114858",
"0.6089971",
"0.60839796",
"0.6067292",
"0.6065191",
"0.6054481",
"0.60320276",
"0.60133654",
"0.6008237",
"0.59890854"
]
| 0.72958505 | 0 |
/ Escapes user input for displaying on page | public static function escapeForDisplay($input) {
if (get_magic_quotes_gpc()) {
$input = stripslashes($input);
}
$result = htmlspecialchars($input, ENT_QUOTES);
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function echoEscaped($input) {\r\n\t\t//htmlentities escapes all characters which have HTML character entity \r\n\t\techo htmlentities($input, ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'ISO-8859-1', false);\r\n\t}",
"function sterilize($input){\r\n return htmlspecialchars($input);\r\n }",
"public function placeholder_escape()\n {\n }",
"function input($data)\r\n {\r\n $data = trim($data);\r\n $data = stripslashes($data);\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n }",
"public function escape($value);",
"public function escape($value);",
"public static function escape($value) {}",
"function input($data) {\r\n $data = trim($data);\r\n $data = stripslashes($data);\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n}",
"function h($value){\n return htmlspecialchars($value, ENT_QUOTES);\n }",
"function safe_slash_html_input($text) {\r\n if (get_magic_quotes_gpc()==0) \r\n {\t\t\r\n $text = addslashes(htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false));\r\n } else \r\n {\t\t\r\n\t $text = htmlentities($text, ENT_QUOTES, 'UTF-8', false);\t\r\n }\r\n return $text;\r\n}",
"function input($data) {\n $data = trim($data);\n $data = stripslashes($data);\n $data = htmlspecialchars($data);\n return $data;\n }",
"function input($data) {\n $data = trim($data);\n $data = stripslashes($data);\n $data = htmlspecialchars($data);\n return $data;\n }",
"function h($text) {\r\n echo(htmlspecialchars($text, ENT_QUOTES));\r\n }",
"function input($data) {\r\n $data = trim($data);\r\n $data = stripslashes($data);\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n }",
"function escape($value){//XSS attacks protection\n return htmlspecialchars($value , ENT_QUOTES,'UTF-8');\n }",
"function format_input($data) { \n $data = trim($data); // Strips unnecessary characters (extra space, tab, newline) from the user input data\n $data = stripslashes($data); // Removes backslashes from the user input data\n $data = htmlspecialchars($data); // When a user tries to submit in a text \n // field. The code is now safe to be displayed on a page or inside an e-mail.\n return $data;\n}",
"public function escape($text);",
"function secure_input($input) {\n\t\t\t$input = trim($input);\n\t\t\t$input = htmlspecialchars($input);\n\t\t\treturn $input;\n\t\t}",
"function clean_output($string) \n{\n if (!($string)) return;\n echo htmlspecialchars($string, ENT_QUOTES);\n}",
"function Chkinput($data) \r\n{\r\n $data = trim($data);\r\n $data = stripslashes($data);\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n}",
"function escape($input)\n{\n\tif(!is_string($input)) {\n\t\treturn false;\n\t}\n\n\treturn htmlspecialchars(strip_tags($input));\n}",
"function e($value)\n {\n return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);\n }",
"function e($str) {\n echo htmlspecialchars($str, ENT_QUOTES);\n}",
"public static function escape($som) {}",
"function esc($value)\n{\n return htmlentities($value);\n}",
"function testinput($data) {\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n }",
"function testinput($data) {\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n }",
"protected function escape( $value )\n\t{\n\t\treturn e( $value );\n\t}",
"function escape($value) {\n return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);\n}",
"function inputRefine($data) {\r\n $data = trim($data);\r\n $data = stripslashes($data);\r\n $data = htmlspecialchars($data);\r\n return $data;\r\n}"
]
| [
"0.68248457",
"0.67773736",
"0.6713038",
"0.66363823",
"0.65998024",
"0.65998024",
"0.6570563",
"0.64748883",
"0.64424306",
"0.64416534",
"0.6437058",
"0.6437058",
"0.6419768",
"0.6416634",
"0.64032143",
"0.6398023",
"0.63528633",
"0.6347332",
"0.63392526",
"0.6291257",
"0.6278081",
"0.6260873",
"0.62506276",
"0.62414086",
"0.6212426",
"0.6209733",
"0.6209733",
"0.6206625",
"0.6181497",
"0.61806494"
]
| 0.73259413 | 0 |
Closing the order Originator can be seller ot buyer | public function close(Request $request, PaymentServiceInterface $psi, StopEarlyBirdOP $stop_early_bird){
$responseData= array();
$user = Auth::user();
$order = Sale::find($request->order_id);
//If job has free place for buyer make it hot
$job = $order->job()->first();
if($job->status == 'working'){
$job->make_hot();
}
$seller = $job->employee()->get()->first();
// Delete Stripe Customer if user signed on
// while an employee was active
//
// (Not completely correct)
// - what about cases where employee leaves?
// - or when there was no employee
//
if ($job->employee_id) {
// get user who is closing order
// and managed account
//$user = DB::table('users')->where('id', $order->buyer_id)->first();
$seller_record = DB::table('stripe_managed_accounts')->where('user_id', $job->employee_id)->first();
// Cancel subscription
// Must be subscribed if sale in progress and job is working
//
if ($order->status == 'in_progress' && $job->status == 'working') {
$plan = $psi->retrievePlan($job, $seller_record->id);
$customer = $psi->retrieveCustomerFromUser($user, $job, $seller_record->id);
$subscription_response = $psi->cancelSubscription($plan, $customer, $seller_record->id);
}
else {
// Check for and delete early bird buyer
//
$early_bird_buyer = $user->early_bird_buyers()->where('sale_id', $order->id)
->where('job_id', $job->id)->where('status', 'working')->first();
if ($early_bird_buyer) {
// stop early bird
$stop_early_bird->go($job, $early_bird_buyer);
}
}
// Delete payment service records
$response = $psi->deleteCustomer($user, $job, $seller_record->id);
//mail to seller
Mail::send('emails.buyer_leaving_job', ['buyer' => $user, 'job' => $job], function($u)
{
$u->from('[email protected]');
$u->to('[email protected]');
$u->subject('Buyer leaving the job.');
});
//mail to admin
Mail::send('emails.buyer_leaving_job', ['buyer' => $user, 'job' => $job], function($u) use ($seller)
{
$u->from('[email protected]');
$u->to($seller->email);
$u->subject('Buyer leaving the job.');
});
}
$order->status = 'closed';
$order->save();
$responseData['error'] = false;
$responseData['status'] = 0;
$responseData['info'] = 'Order successfully closed';
return response($responseData, 200);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function close_orders($quote, $limit_order, $stop_order)\n\t{\n \t// When we opened the order we placed a stop / limit order.\n \t// Here we are checking on the status of that order and seeing\n \t// if we need to update our trade log.\n \t\n // But..... for now we are paper trading.\n \n // Make sure we have an open trade.\n $this->daytrades_model->set_col('DayTradesStatus', 'Open');\n if($t = $this->daytrades_model->get())\n {\n $trade = $t[0];\n } else\n {\n return false;\n } \t\n \n // See if we hit our limit order target - Long\n if(($trade['DayTradesType'] == 'Long Stock') && ($quote['bid'] >= ($trade['DayTradesOpenPrice'] + $limit_order)))\n {\n $profit = (($quote['bid'] - $trade['DayTradesOpenPrice']) * $trade['DayTradesQty']) - $trade['DayTradesOpenCommission'] - 1.00;\n \n $this->daytrades_model->update([\n 'DayTradesStatus' => 'Closed',\n 'DayTradesCloseTime' => date('G:i:s'),\n 'DayTradesClosePrice' => $quote['bid'],\n 'DayTradesCloseCommission' => 1.00,\n 'DayTradesProfit' => $profit\n ], $trade['DayTradesId']);\n \n $this->log(\"Closed long stock position at \\$$quote[bid] for a profit of \\$$profit\");\n \n return true; \n }\n\n // See if we hit our stop order target - Long\n if(($trade['DayTradesType'] == 'Long Stock') && ($quote['bid'] <= ($trade['DayTradesOpenPrice'] - $stop_order)))\n {\n $profit = (($quote['bid'] - $trade['DayTradesOpenPrice']) * $trade['DayTradesQty']) - $trade['DayTradesOpenCommission'] - 1.00; \n \n $this->daytrades_model->update([\n 'DayTradesStatus' => 'Closed',\n 'DayTradesCloseTime' => date('G:i:s'),\n 'DayTradesClosePrice' => $quote['bid'],\n 'DayTradesCloseCommission' => 1.00,\n 'DayTradesProfit' => $profit\n ], $trade['DayTradesId']); \n \n $this->log(\"Closed long stock position at \\$$quote[bid] for a profit of \\$$profit\"); \n \n return true; \n }\n \n // See if we hit our limit order target - Short\n if(($trade['DayTradesType'] == 'Short Stock') && ($quote['ask'] <= ($trade['DayTradesOpenPrice'] - $limit_order)))\n {\n $profit = (($trade['DayTradesOpenPrice'] - $quote['ask']) * $trade['DayTradesQty']) - $trade['DayTradesOpenCommission'] - 1.00;\n \n $this->daytrades_model->update([\n 'DayTradesStatus' => 'Closed',\n 'DayTradesCloseTime' => date('G:i:s'),\n 'DayTradesClosePrice' => $quote['bid'],\n 'DayTradesCloseCommission' => 1.00,\n 'DayTradesProfit' => $profit\n ], $trade['DayTradesId']); \n \n $this->log(\"Closed short stock position at \\$$quote[ask] for a profit of \\$$profit\"); \n \n return true; \n }\n\n // See if we hit our stop order target - Long\n if(($trade['DayTradesType'] == 'Short Stock') && ($quote['ask'] >= ($trade['DayTradesOpenPrice'] + $stop_order)))\n {\n $profit = (($trade['DayTradesOpenPrice'] - $quote['ask']) * $trade['DayTradesQty']) - $trade['DayTradesOpenCommission'] - 1.00;\n \n $this->daytrades_model->update([\n 'DayTradesStatus' => 'Closed',\n 'DayTradesCloseTime' => date('G:i:s'),\n 'DayTradesClosePrice' => $quote['bid'],\n 'DayTradesCloseCommission' => 1.00,\n 'DayTradesProfit' => $profit\n ], $trade['DayTradesId']);\n \n $this->log(\"Closed short stock position at \\$$quote[ask] for a profit of \\$$profit\"); \n \n return true; \n }\n \n // Nothing closed.\n return false;\n\t}",
"public function close(Request $request)\n {\n \n // Validate the inputs\n $validator = \\Validator::make($request->all(), [\n 'order' => 'required|exists:orders,id',\n 'price' => 'required|regex:/^\\d*(\\.\\d{2})?$/',\n 'delivery_price' => 'regex:/^\\d*(\\.\\d{2})?$/'\n ]);\n\n // Check for errors\n if ($validator->fails()) {\n return \\Response::json([\n 'error' => [\n 'message' => 'Validation failed',\n 'code' => 400,\n 'fields' => $validator->errors()\n ]\n ], 400);\n }\n\n $user = \\JWTAuth::parseToken()->toUser();\n\n // Check if the user is shop\n if ($user->type != 2) {\n return \\Response::json([\n 'error' => [\n 'message' => 'You don\\'t have permission to access this resource!',\n 'description' => 'Only shops can perform this action.',\n 'code' => 401\n ]\n ], 401);\n }\n\n $proposal = $user->shop->proposals->where('order_id', (string)$request->order)->first();\n\n // Check if the shop has permission to access this order\n if (!$proposal) {\n return \\Response::json([\n 'error' => [\n 'message' => 'You don\\'t have permission to access this resource!',\n 'description' => 'No proposal was found by the user for this order.',\n 'code' => 401\n ]\n ], 401);\n }\n\n $order = $proposal->order;\n\n // Check if the status of the order allows this change\n if ($order->status != 3) {\n return \\Response::json([\n 'error' => [\n 'message' => 'You don\\'t have permission to perform this action!',\n 'description' => 'The status of the order should be 3. The order status is ' . $order->status . '.',\n 'code' => 401\n ]\n ], 401);\n }\n \n // Check if the shop owns the accepted order\n if ($order->proposal_id != $proposal->id) {\n return \\Response::json([\n 'error' => [\n 'message' => 'You don\\'t have permission to access this resource!',\n 'description' => 'You are not owner of the accepted proposal.',\n 'code' => 401\n ]\n ], 401);\n }\n\n // Save the changes\n $order->status = 5;\n $order->save();\n\n $proposal->status = 5;\n $proposal->price = $request->price ? $request->price : null;\n $proposal->delivery_price = $request->delivery_price ? $request->delivery_price : null;\n $proposal->processed_at = date('Y-m-d H:i:s');\n $proposal->save();\n\n $order->proposal;\n\n // Send notification to the customer\n $data = ['order_id' => $order->id];\n $this->dispatch(new SendPushNotifications($order->customer->user_id, 'הזמנתך מתבצעת, מחיר עודכן', $data));\n // NotificationController::push($order->customer->user_id, 'הזמנתך מתבצעת, מחיר עודכן', $data);\n\n return \\Response::json([\n 'success' => 'The order was updated successfully.',\n 'data' => $order\n ], 200);\n\n }",
"public function set_order_to_closed() {\n $id_order = $this->uri->segment(3);\n $this->create_order_record($id_order);\n $this->m_orders_overview->close_order($id_order);\n $this->show_order();\n }",
"public function cancelBoleto(){\n $cancelamento = Mage::getStoreConfig( 'payment/gwap_boleto/cancelamento' );\n if( is_numeric($cancelamento) && $cancelamento > 0 ){ \n $cancelamento++;\n $due_date = Mage::getModel('core/date')->timestamp( '-'.$cancelamento.' days' );\n }else{\n $due_date = Mage::getModel('core/date')->timestamp( '-2 days' );\n }\n \n $mGwap = Mage::getModel('gwap/order')->getCollection()\n ->addExpireFilter( $due_date )\n ->addTypeFilter('boleto')\n ->addStatusFilter(Indexa_Gwap_Model_Order::STATUS_CAPTUREPAYMENT);\n \n if( $mGwap->count() ){\n foreach ($mGwap as $mGwapitem){\n \n $mGwapitem->setStatus('canceled');\n $mGwapitem->save();\n \n $can_cancel = Mage::getStoreConfig( 'payment/gwap_boleto/cancelar_expirado' );\n \n if( $can_cancel ){\n \n $order = Mage::getModel('sales/order')->load( $mGwapitem->getOrderId() );\n /* var $order Mage_Sales_Model_Order */\n $order->cancel();\n $order->save();\n \n }\n \n }\n }\n return $this;\n }",
"function cancel_distributor_order($distributor_order_id){\r\n $this->db->query(\"UPDATE `distributor_orders` SET status_id = 14 WHERE id = ?\", array($distributor_order_id));\r\n //check if we have multiple distributors on this order.\r\n $query = $this->db->query(\"SELECT order_id FROM `distributor_orders` WHERE id = ?\", array($distributor_order_id));\r\n $result = $query->row_array();\r\n $order_id = $result['order_id']; \r\n\r\n //if there is only one dist_order cancel the main order also.\r\n $query = $this->db->query(\"SELECT order_id FROM `distributor_orders` WHERE id = ?\", array($distributor_order_id));\r\n if($query->num_rows() == 1){\r\n $this->cancel_order($order_id);\r\n }\r\n\r\n return true;\r\n }",
"function order_close()\n{\n global $USER;\n loader_model(\"bank\");\n\n switch ($_SERVER[\"REQUEST_METHOD\"]) {\n case \"GET\" :\n redirect(\"order/list\");\n break;\n case \"POST\":\n if (!empty($_POST)):\n\n $data = $_POST[\"data\"];\n\n if (!$data[\"orderId\"] || !$data[\"seller\"] || !$data[\"buyer\"] || !$data[\"price\"]) {\n render_partial(\"order/successOrder\", array(\"message\" => \"Отсутствуют необходимые параметры\", \"id\" => $data[\"orderId\"]));\n return false;\n }\n\n $token = md5(\"order:{$data[\"orderId\"]}:{$data[\"seller\"]}:{$data[\"buyer\"]}:{$data[\"price\"]}\");\n\n if ($token == $data[\"csrf_token\"]):\n\n if (orders_close($data[\"orderId\"])) {\n if (bank_proceed($data[\"orderId\"], $USER[\"ID\"])) {\n render_partial(\"order/successOrder\", array(\"message\" => \"Госзаказ успешно распилен!<br/>Деньги перечислены в ваш оффшор!\", \"id\" => $data[\"orderId\"]));\n return true;\n }\n }\n render_partial(\"order/successOrder\", array(\"message\" => \"Извините, но заказ уже забрали братья Роттенберги.\", \"id\" => $data[\"orderId\"]));\n else:\n return false;\n endif;\n else:\n redirect(\"order/list\");\n endif;\n break;\n }\n}",
"function closeDoor() {\n return Engine::send('closeDoor');\n}",
"public function chekcingForMarketplaceSellerOrNot() {\n /**\n * Initilize customer and seller group id\n */\n $customerGroupIdVal = $sellerGroupIdVal = $customerStatusValue = '';\n /**\n * Get customer group id\n * @var int\n */\n $customerGroupIdVal = Mage::getSingleton ( 'customer/session' )->getCustomerGroupId ();\n $sellerGroupIdVal = Mage::helper ( 'marketplace' )->getGroupId ();\n /**\n * Get customer status\n * @var int\n */\n $customerStatusValue = Mage::getSingleton ( 'customer/session' )->getCustomer ()->getCustomerstatus ();\n /**\n * Checking for customer group id and seller group id\n */\n if (! Mage::getSingleton ( 'customer/session' )->isLoggedIn () && $customerGroupIdVal != $sellerGroupIdVal) {\n /**\n * add error message\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'You must have a Seller Account to access this page' ) );\n $this->_redirect ( 'marketplace/seller/login' );\n return false;\n }\n /**\n * Checking whether customer approved or not\n */\n if ($customerStatusValue != 1) {\n /**\n * add error message\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'Admin Approval is required. Please wait until admin confirms your Seller Account' ) );\n $this->_redirect ( 'marketplace/seller/login' );\n return false;\n }\n }",
"public function cancel()\n {\n $this->canceled = true;\n\n $this->save();\n\n $this->user->notify(new OrderCanceled($this));\n\n }",
"public function closeDeal(Barter $barter)\n {\n $barter->products()->detach();\n $barter->isClose = true;\n $barter->save();\n\n //step 4 return to the view\n return redirect('/profile');\n }",
"public function closeOrderReference($requestParameters = array());",
"public function cancelAction() {\n $this->chekcingForMarketplaceSellerOrNot ();\n $orderId = $this->getRequest ()->getParam ( 'id' );\n $produtId = $this->getRequest ()->getParam ( 'item' );\n $sellerId = Mage::getSingleton ( 'customer/session' )->getId ();\n /**\n * Prepare product collection for cancel\n */\n $products = Mage::getModel ( 'marketplace/commission' )->getCollection ();\n $products->addFieldToSelect ( '*' );\n $products->addFieldToFilter ( 'seller_id', $sellerId );\n $products->addFieldToFilter ( 'order_id', $orderId );\n $products->addFieldToFilter ( 'product_id', $produtId );\n $collectionId = $products->getFirstItem ()->getId ();\n $orderStatusFlag = Mage::getStoreConfig ( 'marketplace/admin_approval_seller_registration/order_manage' );\n if (! empty ( $collectionId ) && $orderStatusFlag == 1) {\n try {\n $data = array (\n 'order_status' => 'canceled',\n 'customer_id' => 0,\n 'credited' => 1,\n 'item_order_status' => 'canceled'\n );\n $commissionModel = Mage::getModel ( 'marketplace/commission' )->load ( $collectionId )->addData ( $data );\n $commissionModel->setId ( $collectionId )->save ();\n\n /**\n * Load order details based on the order id.\n */\n $_order = Mage::getModel ( 'sales/order' )->load ( $orderId );\n /**\n * Update order items to cancel status\n */\n foreach ( $_order->getAllItems () as $item ) {\n if ($this->getRequest ()->getParam ( 'item' ) == $item->getId ()) {\n $item->cancel ();\n }\n }\n /**\n * Send cancel notification for admin\n */\n Mage::helper('marketplace/general')->sendCancelOrderAdminNotification($orderId,$produtId,$sellerId);\n\n Mage::helper('marketplace/general')->sendCancelOrderBuyerNotification($_order);\n /**\n * Redirect to order view page\n */\n Mage::getSingleton ( 'core/session' )->addSuccess ( $this->__ ( $this->__ ( 'The item has been cancelled.' ) ) );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $orderId );\n } catch ( Exception $e ) {\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( $e->getMessage () ) );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $orderId );\n }\n } else {\n /**\n * Return to order manage page\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'You do not have permission to access this page' ) );\n $this->_redirect ( 'marketplace/order/manage' );\n return false;\n }\n }",
"private function open_orders($quote, $upper, $lower, $comission, $shares_to_trade, $limit_order, $stop_order)\n\t{\n \t$price = 0.00;\n $trade = null;\n \n // Make sure we don't already have an open trade.\n $this->daytrades_model->set_col('DayTradesStatus', 'Open');\n if($this->daytrades_model->get())\n {\n return false;\n }\n \t\n/*\n // Did we cross the upper bound?\n if($quote['bid'] > $upper)\n {\n $price = $quote['bid'];\n $trade = 'Short Stock';\n }\n*/\n \n // Did we cross the lower bound\n if($quote['ask'] < $lower)\n {\n $price = $quote['ask']; \n $trade = 'Long Stock';\n }\n \n // Did we hit a bound\n if(is_null($trade))\n {\n return false;\n }\n \n // Place order.\n $this->daytrades_model->insert([\n 'DayTradesSymbolsId' => 1,\n 'DayTradesStatus' => 'Open',\n 'DayTradesType' => $trade,\n 'DayTradesQty' => $shares_to_trade,\n 'DayTradesDate' => date('Y-m-d'),\n 'DayTradesOpenTime' => date('G:i:s'),\n 'DayTradesOpenPrice' => $price,\n 'DayTradesOpenCommission' => 1.00\n ]); \n \n $this->log(\"Placed a $trade order at $price.\");\n\t}",
"public function closeOrder_get() {\n extract($_GET);\n $result = $this->feeds_model->closeOrder($order_id);\n return $this->response($result);\n }",
"static public function cancelOrderBySeller($iIdOrder, $iIdSeller) {\n\n $sRq = \"UPDATE \" . PREFIX . \"sales.`order` \n SET `is_validated`=0,\n `date_updated`= NOW(), \n `is_cancelled`=1 \n WHERE `id`=\" . (int) $iIdOrder . \" \n AND `id_seller`=\" . (int) $iIdSeller . \" \n LIMIT 1\";\n\n if (Sql::Set($sRq)) {\n $_SESSION['submit'] = 1;\n if (mysql_affected_rows() < 1) {\n return false;\n }\n return true;\n }\n\n return false;\n }",
"public function cancelAction() {\n /**\n * Admin configuration for order cancel request active status.\n */\n $orderCancelStatusFlag = Mage::getStoreConfig ( 'marketplace/admin_approval_seller_registration/order_cancel_request' );\n $data = $this->getRequest ()->getPost ();\n $emailSent = '';\n /**\n * Get order id\n * @var int\n */\n $orderId = $data ['order_id'];\n $loggedInCustomerId = '';\n /**\n * Check that customer login or not.\n */\n if (Mage::getSingleton ( 'customer/session' )->isLoggedIn () && isset ( $orderId )) {\n /**\n * Get customer data\n * @var id\n */\n $customerData = Mage::getSingleton ( 'customer/session' )->getCustomer ();\n $loggedInCustomerId = $customerData->getId ();\n $customerid = Mage::getModel ( 'sales/order' )->load ( $data ['order_id'] )->getCustomerId ();\n } else {\n /**\n * Error message for the when unwanted person access these request.\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( \"You do not have permission to access this page\" ) );\n $this->_redirect ( 'sales/order/history' );\n return;\n }\n if ($orderCancelStatusFlag == 1 && ! empty ( $loggedInCustomerId ) && $customerid == $loggedInCustomerId) {\n $shippingStatus = 0;\n try {\n /**\n * Get templete id for the order cancel request notification.\n */\n $templateId = ( int ) Mage::getStoreConfig ( 'marketplace/admin_approval_seller_registration/order_cancel_request_notification_template_selection' );\n if ($templateId) {\n /**\n * Load email templete.\n */\n $emailTemplate = Mage::helper ( 'marketplace/marketplace' )->loadEmailTemplate ( $templateId );\n } else {\n $emailTemplate = Mage::getModel ( 'core/email_template' )->loadDefault ( 'marketplace_cancel_order_admin_email_template_selection' );\n }\n /**\n * Load order product details based on the orde id.\n */\n $_order = Mage::getModel ( 'sales/order' )->load ( $orderId );\n /**\n * Get increment id\n * @var int\n */\n $incrementId = $_order->getIncrementId ();\n $sellerProductDetails = array ();\n $selectedProducts = $data ['products'];\n $selectedItemproductId = '';\n /**\n * Get the order item from the order.\n */\n foreach ( $_order->getAllItems () as $item ) {\n /**\n * Get Product id\n * @var int\n */\n $itemProductId = $item->getProductId ();\n $orderItem = $item;\n if (in_array ( $itemProductId, $selectedProducts )) {\n $shippingStatus = $this->getShippingStatus ( $orderItem );\n\n $sellerId = Mage::getModel ( 'catalog/product' )->load ( $itemProductId )->getSellerId ();\n $selectedItemproductId = $itemProductId;\n $sellerProductDetails [$sellerId] [] = $item->getName ();\n }\n }\n /**\n * Get seller product details.\n */\n foreach ( $sellerProductDetails as $key => $productDetails ) {\n $productDetailsHtml = \"<ul>\";\n /**\n * Increment foreach loop\n */\n foreach ( $productDetails as $productDetail ) {\n $productDetailsHtml .= \"<li>\";\n $productDetailsHtml .= $productDetail;\n $productDetailsHtml .= \"</li>\";\n }\n $productDetailsHtml .= \"</ul>\";\n $customer = Mage::getModel ( 'customer/customer' )->load ( $loggedInCustomerId );\n $seller = Mage::getModel ( 'customer/customer' )->load ( $key );\n /**\n * Get customer name and customer email id.\n */\n $buyerName = $customer->getName ();\n $buyerEmail = $customer->getEmail ();\n $sellerEmail = $seller->getEmail ();\n $sellerName = $seller->getName ();\n $recipient = $sellerEmail;\n if (empty ( $sellerEmail )) {\n $adminEmailIdVal = Mage::getStoreConfig ( 'marketplace/marketplace/admin_email_id' );\n /**\n * Get the to mail id\n */\n $getToMailId = Mage::getStoreConfig ( \"trans_email/ident_$adminEmailIdVal/email\" );\n $recipient = $getToMailId;\n }\n $emailTemplate->setSenderName ( $buyerName );\n $emailTemplate->setSenderEmail ( $buyerEmail );\n /**\n * To set cancel/refund request sent\n */\n if ($shippingStatus == 1) {\n $requestedType = $this->__ ( 'cancellation' );\n Mage::getModel ( 'marketplace/order' )->updateSellerRequest ( $selectedItemproductId, $orderId, $loggedInCustomerId, $sellerId, 0 );\n } else {\n $requestedType = $this->__ ( 'return' );\n Mage::getModel ( 'marketplace/order' )->updateSellerRequest ( $selectedItemproductId, $orderId, $loggedInCustomerId, $sellerId, 1 );\n }\n $emailTemplateVariables = array (\n 'ownername' => $sellerName,'productdetails' => $productDetailsHtml, 'order_id' => $incrementId,\n 'customer_email' => $buyerEmail,'customer_firstname' => $buyerName,\n 'reason' => $data ['reason'],'requesttype' => $requestedType,\n 'requestperson' => $this->__ ( 'Customer' )\n );\n $emailTemplate->setDesignConfig ( array ('area' => 'frontend') );\n /**\n * Sending email to admin\n */\n $emailTemplate->getProcessedTemplate ( $emailTemplateVariables );\n $emailSent = $emailTemplate->send ( $recipient, $sellerName, $emailTemplateVariables );\n }\n if ($shippingStatus == 1) {\n Mage::getSingleton ( 'core/session' )->addSuccess ( $this->__ ( \"Item cancellation request has been sent successfully.\" ) );\n } else {\n Mage::getSingleton ( 'core/session' )->addSuccess ( $this->__ ( \"Item return request has been sent successfully.\" ) );\n }\n $this->_redirect ( 'sales/order/view/order_id/' . $data ['order_id'] );\n } catch ( Exception $e ) {\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( $e->getMessage () ) );\n $this->_redirect ( 'sales/order/view/order_id/' . $data ['order_id'] );\n }\n } else {\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( \"You do not have permission to access this page\" ) );\n $this->_redirect ( 'sales/order/view/order_id/' . $orderId );\n }\n }",
"public function closeOrders($orders)\n {\n return $this->getEntityManager()->createQuery('UPDATE JCSGYKAdminBundle:ClientOrder o SET o.closed = 1 WHERE o.id IN (:idlist)')\n ->setParameter('idlist', $orders)\n ->execute();\n }",
"public function ship(Order $oOrder, Buyer $oBuyer): string;",
"function wtsProCancelOrder($ar){\n if (!$this->customerIsPro())\n die(json_encode(array('ok'=>0, 'mess'=>'')));\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n $lineoid = $p->get('lineoid');\n\n list($ok, $mess) = $this->modcustomer->cancelProOrder($orderoid, $lineoid);\n\n if ($ok == 1 && $this->modcustomer->proCheckWTPStock()){\n $etatsok = '\"'.implode('\",\"', array(self::$WTSORDER_ETATFABRICATION_CLOSE, self::$WTSORDER_ETATFABRICATION_COMPLETE, self::$WTSORDER_ETATFABRICATION_EDITEE, self::$WTSORDER_ETATFABRICATION_PAIEMENT_ACCEPTE)).'\"';\n if (empty($lineoid)){\n $wtps = selectQuery('select distinct WTPCARD from '.self::$tableORDERLINE.' where LNKORDER=\"'.$orderoid.'\" and LINETYPE=\"forf\"')->fetchAll(PDO::FETCH_COLUMN);\n } else {\n $wtps = selectQuery('select distinct WTPCARD from '.self::$tableORDERLINE.' where LNKORDER=\"'.$orderoid.'\" and KOID=\"'.$lineoid.'\" and LINETYPE=\"forf\"')->fetchAll(PDO::FETCH_COLUMN);\n }\n if (count($wtps)>0){\n foreach($wtps as $wtp){\n $rs = selectQueryGetAll('select l.KOID from WTSORDERLINE l, WTSORDER o where l.LNKORDER=o.KOID and l.WTPCARD =\"'.$wtp.'\" and o.ETATFABRICATION in ('.$etatsok.') and ifnull(l.ETATTA, \"\") !=\"'.self::$WTSORDERLINE_ETATTA_ANNULATION.'\"');\n if (count($rs) == 0){\n $s = 'update '.self::$tableCARDSGROUP.' set OUTOFSTOCK=2 where WTPCARD in(\"'.$wtp.'\")';\n updateQuery($s);\n }\n }\n }\n }\n die(json_encode(array('ok'=>$ok, 'mess'=>$mess)));\n }",
"public function destroy(seller $seller)\n {\n //\n }",
"public function refundAction() {\n $this->chekcingForMarketplaceSellerOrNot ();\n /**\n * Initilize refund variables\n */\n $orderId = $this->getRequest ()->getParam ( 'id' );\n $produtId = $this->getRequest ()->getParam ( 'item' );\n $sellerId = Mage::getSingleton ( 'customer/session' )->getId ();\n /**\n * Collect the produts from the order details.\n */\n $orderPrdouctIds = Mage::helper ( 'marketplace/vieworder' )->getOrderProductIds ( Mage::getSingleton ( 'customer/session' )->getId (), $orderId );\n\n $orderStatusFlag = Mage::getStoreConfig ( 'marketplace/admin_approval_seller_registration/order_manage' );\n /**\n * Check whether product id is in array\n */\n if (in_array ( $produtId, $orderPrdouctIds ) && $orderStatusFlag == 1) {\n\n Mage::getModel ( 'marketplace/order' )->updateSellerRequest ( $produtId, $orderId, Mage::getSingleton ( 'customer/session' )->getId (), '', 2 );\n\n try {\n\n /**\n * Sending order email\n */\n $templateId = ( int ) Mage::getStoreConfig ( 'marketplace/admin_approval_seller_registration/order_cancel_request_notification_template_selection' );\n $adminEmailId = Mage::getStoreConfig ( 'marketplace/marketplace/admin_email_id' );\n $toMailId = Mage::getStoreConfig ( \"trans_email/ident_$adminEmailId/email\" );\n $toName = Mage::getStoreConfig ( \"trans_email/ident_$adminEmailId/name\" );\n /**\n * Select email template\n */\n if ($templateId) {\n $emailTemplate = Mage::helper ( 'marketplace/marketplace' )->loadEmailTemplate ( $templateId );\n } else {\n $emailTemplate = Mage::getModel ( 'core/email_template' )->loadDefault ( 'marketplace_cancel_order_admin_email_template_selection' );\n }\n /**\n * Load product collection for cancel\n */\n $productCollection = Mage::getModel ( 'catalog/product' )->getCollection ()->addAttributeToSelect ( '*' )->addUrlRewrite ()->addAttributeToFilter ( 'entity_id', array (\n 'eq' => $produtId\n ) );\n\n $productDetails = \"<ul>\";\n /**\n * Prepare product details for cancel email\n */\n foreach ( $productCollection as $product ) {\n $productDetails .= \"<li>\";\n $productDetails .= \"<div><a href='{$product->getProductUrl()}'>{$product->getName()}</a><div>\";\n $productDetails .= \"</li>\";\n }\n\n $productDetails .= \"</ul>\";\n /**\n * load order details\n * @var object\n */\n $incrementId = Mage::getModel ( 'sales/order' )->load ( $orderId )->getIncrementId ();\n\n /**\n * Get seller information.\n */\n $customer = Mage::getModel ( 'customer/customer' )->load ( $sellerId );\n /**\n * Initilize variable for send mail to seller\n */\n $sellerEmail = $customer->getEmail ();\n $sellerName = $customer->getName ();\n $recipient = $toMailId;\n $emailTemplate->setSenderName ( $sellerName );\n $emailTemplate->setSenderEmail ( $sellerEmail );\n\n /**\n * Prepare temail templave variables\n */\n $emailTemplateVariables = array (\n 'ownername' => $toName,\n 'productdetails' => $productDetails,\n 'order_id' => $incrementId,\n 'customer_email' => $sellerEmail,\n 'customer_firstname' => $sellerName,\n 'reason' => $this->__ ( 'Buyer wants to refund the item' ),\n 'requesttype' => $this->__ ( 'refund' ),\n 'requestperson' => $this->__ ( 'Seller' )\n );\n $emailTemplate->setDesignConfig ( array (\n 'area' => 'frontend'\n ) );\n /**\n * Sending email to admin\n */\n $emailTemplate->getProcessedTemplate ( $emailTemplateVariables );\n $emailTemplate->send ( $recipient, $toName, $emailTemplateVariables );\n\n /**\n * Redirect to order view page\n */\n Mage::getSingleton ( 'core/session' )->addSuccess ( $this->__ ( \"The item refund request has been sent.\" ) );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $orderId );\n } catch ( Exception $e ) {\n /**\n * when error message occured, redirected to view order page.\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( $e->getMessage () ) );\n $this->_redirect ( 'marketplace/order/vieworder/orderid/' . $orderId );\n }\n } else {\n /**\n * Check the permission.\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'You do not have permission to access this page' ) );\n $this->_redirect ( 'marketplace/order/manage' );\n return false;\n }\n }",
"public function sellerConfirm() {\n\t\tLog::info ( 'Seller has confirmed the payment:' . $this->user_pk, array (\n\t\t\t\t'c' => '1' \n\t\t) );\n\t\tif (isset ( $_POST ['time'] ) && $_POST ['time'] != '') {\n\t\t\t$timePeriod = $_POST ['time'];\n\t\t\t$subscriptionStartsAt = date ( 'Y-m-d H:i:s' );\n\t\t\t$subscriptionEndsAt = '';\n\t\t\t\n\t\t\tif ($timePeriod == 'quarterPeriod') {\n\t\t\t\t$subscriptionEndsAt = date ( 'Y-m-d H:i:s', strtotime ( '+3 months' ) );\n\t\t\t} else if ($timePeriod == 'halfannualPeriod') {\n\t\t\t\t$subscriptionEndsAt = date ( 'Y-m-d H:i:s', strtotime ( '+6 months' ) );\n\t\t\t} else if ($timePeriod == 'annualPeriod') {\n\t\t\t\t$subscriptionEndsAt = date ( 'Y-m-d H:i:s', strtotime ( '+1 years' ) );\n\t\t\t} else if ($timePeriod == 'phantomPeriod') {\n\t\t\t\t$subscriptionEndsAt = date ( 'Y-m-d H:i:s', strtotime ( '+5 years' ) );\n\t\t\t} else if ($timePeriod == 'freeTrail') {\n\t\t\t\t$subscriptionEndsAt = date(\"2016-12-31 00:00:00\");\n\t\t\t}\n\t\t\t\n\t\t\t$userRecord = \\DB::table ( 'users' )->where ( 'id', '=', $this->user_pk )->first ();\n\t\t\t$is_business = $userRecord->is_business;\n\t\t\t\n\t\t\t// add subscription start and end date to seller\n\t\t\t$subscription = ThankyouController::addSubscription ( $subscriptionStartsAt, $subscriptionEndsAt, $is_business );\n\t\tif($subscription==1){\n\t\t\tCommonComponent::activityLog ( \"SELLER_CONFIRM_PAYMENT\", SELLER_CONFIRM_PAYMENT, 0, HTTP_REFERRER, CURRENT_URL );\n\t\t\t$stored_uid = $this->user_pk;\n\t\t\t\t\n\t\t\ttry{\n\t\t\t\tif(isset(Auth::User()->lkp_role_id) && (Auth::User()->lkp_role_id == '1')){\n\t\t\t\t\t\n\t\t\t\t\tDB::table ( 'users' )->where ( 'id', $this->user_pk )->update ( array (\n\t\t\t\t\t'is_active' => 1,\n\t\t\t\t\t'is_confirmed' => 1,\n\t\t\t\t\t'is_approved' => 1,\n\t\t\t\t\t'secondary_role_id'=>'2',\n\t\t\t\t\t'is_buyer_paid'=>1,\n\t\t\t\t\t'mail_sent' => 1\n\t\t\t\t\t) );\n\t\t\t\t\tSession::put('last_login_role_id','2');\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\tDB::table ( 'users' )->where ( 'id', $this->user_pk )->update ( array (\n\t\t\t'lkp_role_id' => 2,\n\t\t\t'is_active' => 1,\n\t\t\t'is_confirmed' => 1,\n\t\t\t'is_approved' => 1,\n\t\t\t'is_buyer_paid'=>1,\n\t\t\t'mail_sent' => 1\n\t\t\t) );\n\t\t\t\t}\n\t\t\t}catch(Exception $ex){\n\t\t\t}\n\t\t\t// Information email to seller after payment\n\t\t\t\t\n\t\t\t$userData = DB::table ( 'users' )->where ( 'id', $this->user_pk )->select ( 'users.*' )->get ();\n\t\t\t\t\n\t\t\tCommonComponent::send_email ( SELLER_PAYMENT_INFO_MAIL, $userData );\n\t\t\t\n\t\t}\n\t\t\t\n\t\t}\n\t}",
"public function vieworderAction() {\n /**\n * Initilize customer and seller group id\n */\n $customerGroupId = $sellerGroupId = $customerStatus = '';\n /**\n * Get customerid,groupid and seller status.\n */\n $customerGroupId = Mage::getSingleton ( 'customer/session' )->getCustomerGroupId ();\n $sellerGroupId = Mage::helper ( 'marketplace' )->getGroupId ();\n $customerStatus = Mage::getSingleton ( 'customer/session' )->getCustomer ()->getCustomerstatus ();\n $returnFlag = 0;\n /**\n * Check the seller login.\n */\n if (! Mage::getSingleton ( 'customer/session' )->isLoggedIn () && $customerGroupId != $sellerGroupId) {\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'You must have a Seller Account to access this page' ) );\n $returnFlag = 1;\n }\n /**\n * Checking whether customer approved or not\n */\n if ($customerStatus != 1) {\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'Admin Approval is required. Please wait until admin confirms your Seller Account' ) );\n $returnFlag = 1;\n }\n if ($returnFlag == 1) {\n $this->_redirect ( 'marketplace/seller/login' );\n return false;\n }\n /**\n * Get the order id from the parms value.\n */\n $orderId = $this->getRequest ()->getParam ( 'orderid' );\n /**\n * Get the product details based on the orderid.\n */\n $orderPrdouctIds = Mage::helper ( 'marketplace/vieworder' )->getOrderProductIds ( Mage::getSingleton ( 'customer/session' )->getId (), $orderId );\n if (count ( $orderPrdouctIds ) <= 0) {\n $this->_redirect ( 'marketplace/order/manage' );\n return false;\n }\n /**\n * Get ordered collection.\n */\n $collection = Mage::getModel ( 'marketplace/commission' )->getCollection ()->addFieldToFilter ( 'seller_id', Mage::getSingleton ( 'customer/session' )->getId () )->addFieldToFilter ( 'order_id', $orderId )->getFirstItem ();\n /**\n * Check orderid from the order collection.\n */\n if (count ( $collection ) >= 1 && $collection->getOrderId () == $orderId) {\n /**\n * load and render layout\n */\n $this->loadLayout ();\n $this->getLayout ()->getBlock ( 'head' )->setTitle ( $this->__ ( 'View Order' ) );\n $this->renderLayout ();\n } else {\n /**\n * Check the errors, when internal error occured in view order.\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'You do not have permission to access this page' ) );\n $this->_redirect ( 'marketplace/order/manage' );\n return false;\n }\n }",
"protected function closed ($user) {\n }",
"function sendwithdrawreqAction() {\n /**\n * check whether customer logged in or not\n */\n if (! $this->_getSession ()->isLoggedIn ()) {\n /**\n * add error message\n */\n Mage::getSingleton ( 'core/session' )->addError ( $this->__ ( 'You must have a Seller Account to access this page' ) );\n $this->_redirect ( 'marketplace/seller/login' );\n return;\n }\n /**\n * Get message\n *\n * @var string\n */\n $message = $this->getRequest ()->getParam ( 'req_message' );\n /**\n * Get Pending Amount\n *\n * @var Apptha_Marketplace_OrderController $pendingAmount\n */\n $pendingAmount = $this->getRequest ()->getParam ( 'pending-amount' );\n /**\n * Get Customer Data\n *\n * @var uobject\n */\n $customerData = Mage::getSingleton ( 'customer/session' )->getCustomer ();\n /**\n * Get customer Id\n *\n * @var unknown\n */\n $customerId = $customerData->getId ();\n /**\n * Sending email to admin to ask for pending amount\n */\n $adminEmailId = Mage::getStoreConfig ( 'marketplace/marketplace/admin_email_id' );\n /**\n * Get to mail id\n *\n * @var string\n */\n $toMailId = Mage::getStoreConfig ( \"trans_email/ident_$adminEmailId/email\" );\n /**\n * Get to name\n *\n * @var name\n */\n $toName = Mage::getStoreConfig ( \"trans_email/ident_$adminEmailId/name\" );\n $emailTemplate = Mage::getModel ( 'core/email_template' )->loadDefault ( 'marketplace_seller_withdraw_request_to_admin' );\n\n /**\n * Load customer details.\n */\n $customer = Mage::getModel ( 'customer/customer' )->load ( $customerId );\n $selleremail = $customer->getEmail ();\n /**\n * Get Recipient details\n *\n * @var unknown\n */\n $recipient = $toMailId;\n $sellername = $customer->getName ();\n $emailTemplate->setSenderName ( $sellername );\n $emailTemplate->setSenderEmail ( $selleremail );\n $emailTemplateVariables = (array (\n 'ownername' => $toName,\n 'sellername' => $sellername,\n 'requestmessage' => $message,\n 'pendingamt' => $pendingAmount\n ));\n $emailTemplate->setDesignConfig ( array (\n 'area' => 'frontend'\n ) );\n $emailTemplate->getProcessedTemplate ( $emailTemplateVariables );\n /**\n * Send email to admin.\n */\n $emailTemplate->send ( $recipient, $sellername, $emailTemplateVariables );\n /**\n * Success message after send email to admin.\n */\n Mage::getSingleton ( 'core/session' )->addSuccess ( $this->__ ( 'Request Sent to Admin Successfully.' ) );\n $this->_redirect ( 'marketplace/order/viewtransaction/' );\n return;\n }",
"function _commerce_oz_eway_3p_close_transaction($transaction, $request_map, $response_map) {\n $transaction->instance_id = 'commerce_commweb|commerce_payment_commerce_commweb';\n \t$transaction->amount = $response_map['ewayResultReturnAmount'];\n $transaction->currency_code = 'AUD';\n $transaction->payload = array('request' => $request_map, 'response' => $response_map);\n \n $transaction->remote_id = $response_map['ewayResultTrxnNumber']; \n $transaction->remote_status = ($response_map['ewayResultTrxnStatus'] == 'True'); \n \n $transaction->status = $transaction->remote_status ? COMMERCE_PAYMENT_STATUS_SUCCESS : COMMERCE_PAYMENT_STATUS_FAILURE;\n \n $transaction->message = t('<strong>Purchase</strong> Code: @code - @message'); \n \n $trans_message = $response_map['ewayResultTrxnError'];\n \n if($transaction->remote_status != 1)\n {\n \t$trans_message .= ' - Failed Card: ' . ': ' ; //. $request_map['vpc_CardNum'];\n } \n \n $transaction->message_variables = array(\n \t'@code' => $response_map['ewayResultTrxnNumber'],\n \t'@message' => $trans_message,\n \t\t);\n \t\t\n // Save the transaction information.\n commerce_payment_transaction_save($transaction);\t\t\n \t\t\n return $response_map;\t\t\t\n}",
"public function orderCancelAfter($observer) {\n if (Mage::registry('INVENTORY_CORE_ORDER_CANCEL'))\n return;\n Mage::register('INVENTORY_CORE_ORDER_CANCEL', true);\n try {\n $order = $observer->getOrder();\n $items = $order->getAllItems();\n\n $parentQtyCanceled = array();\n foreach ($items as $item) {\n \n $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($item->getProductId()); \n \n $manageStock = $stockItem->getManageStock();\n if($stockItem->getUseConfigManageStock()){\n $manageStock = Mage::getStoreConfig('cataloginventory/item_options/manage_stock',Mage::app()->getStore()->getStoreId()); \n }\n if(!$manageStock){\n continue;\n }\n \n $qtyCanceled = 0;\n if (in_array($item->getProductType(), array('configurable', 'bundle', 'grouped'))) {\n $parentQtyCanceled[$item->getId()] = $item->getQtyCanceled();\n continue;\n }\n if ($item->getQtyCanceled() > 0) {\n $qtyCanceled = $item->getQtyCanceled();\n } else {\n if ($item->getParentItemId()) {\n if ($parentQtyCanceled[$item->getParentItemId()])\n $qtyCanceled = $parentQtyCanceled[$item->getParentItemId()];\n }\n }\n if ($qtyCanceled > 0) {\n $warehouseOrder = Mage::getModel('inventoryplus/warehouse_order')\n ->getCollection()\n ->addFieldToFilter('order_id', $order->getId())\n ->addFieldToFilter('item_id', $item->getId())\n ->addFieldToFilter('product_id', $item->getProductId())\n ->getFirstItem();\n if ($warehouseOrder->getId()) {\n $wOQty = $warehouseOrder->getQty();\n $warehouseOrder->setQty($wOQty - $qtyCanceled)\n ->save();\n }\n $warehouseProduct = Mage::getModel('inventoryplus/warehouse_product')\n ->getCollection()\n ->addFieldToFilter('product_id', $item->getProductId())\n ->addFieldToFilter('warehouse_id', $warehouseOrder->getWarehouseId())\n ->getFirstItem();\n if ($warehouseProduct->getId()) {\n $availableQty = $warehouseProduct->getAvailableQty();\n $warehouseProduct->setAvailableQty($availableQty + $qtyCanceled)\n ->save();\n }\n }\n }\n } catch (Exception $e) {\n Mage::log($e->getMessage(), null, 'inventory_management.log');\n }\n }",
"public function cancelOrder($param) { \n if (!$this->aaa->has_right('openruth', 500))\n $res->cancelOrderError->_value = 'authentication_error';\n else {\n $agencyId = self::strip_agency($param->agencyId->_value);\n $targets = $this->config->get_value('ruth', 'ztargets');\n if ($tgt = $targets[$agencyId]) {\n $ord = &$order->ReservationDelete->_value;\n $ord->LibraryNo->_value = $agencyId;\n $ord->DisposalID->_value = $param->orderId->_value;\n $xml = '<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?'.'>' . utf8_decode($this->objconvert->obj2xml($order));\n $z = new z3950();\n $z->set_target($tgt['host']);\n $z->set_database($tgt['database'].'-ophelia');\n $z->set_authentication($tgt['authentication']);\n if ($tgt['proxy']) {\n $z->set_proxy($tgt['proxy']);\n }\n $xml_ret = $z->z3950_xml_update($xml, $tgt['timeout']);\n//echo 'error: ' . $z->get_errno();\n//print_r($xml);\n//print_r($xml_ret);\n if ($z->get_errno() == 0 && $xml_ret['xmlUpdateDoc']) {\n $dom = new DomDocument();\n $dom->preserveWhiteSpace = false;\n if ($dom->loadXML($xml_ret['xmlUpdateDoc'])) {\n if ($err = $dom->getElementsByTagName('ReservationDeleteResponse')->item(0)->nodeValue) {\n verbose::log(ERROR, __FUNCTION__ . ' (' . __LINE__ . ') errno: ' . $err);\n if (!($res->cancelOrderError->_value = $this->errs[$err])) \n $res->cancelOrderError->_value = 'unspecified error (' . $err . '), order not possible';\n } else {\n $res->cancelOrderOk->_value = $param->orderId->_value;\n }\n } else {\n verbose::log(ERROR, __FUNCTION__ . ' (' . __LINE__ . ') loadXML error of: ' . $xml_ret['xmlUpdateDoc']);\n $res->cancelOrderError->_value = 'system error';\n }\n } else {\n self::log_z_error(__FUNCTION__, __LINE__, $agencyId, $z->get_errno(), $z->get_error_string());\n $res->cancelOrderError->_value = 'system error';\n }\n } else\n $res->cancelOrderError->_value = 'unknown agencyId';\n }\n\n $ret->cancelOrderResponse->_value = $res;\n //var_dump($param); print_r($res); die();\n return $ret;\n }",
"public function finish()\n\t{\n\t\t//first we deactivate the quote\n\t\t$this->_getQuote()->setIsActive(false)->save();\n\t\t\n\t\t//now we add the payment information to the order payment\n\t\t$this->_getMethodInstance()->addRequestData($this->getResponse());\n\t\t\n\t\t//now we authorise the payment\n\t\tif(false === $this->_getMethodInstance()->authPayment($this->getResponse())){\n\t\t\tMage::throwException(\"Payment Failure\");\n\t\t}\n\t\t\n\t\t//now we shift the order to either pending state, \n\t\t// or processing state (with invoice) depending on the capture settings.\n\t\t$this->_getMethodInstance()->process($this->getResponse());\n\t\t\n\t\t//send off the new order email\n\t\t$this->_getOrder()->sendNewOrderEmail();\n\t}",
"public function onOrderSave($observer) {\n\t\t\n\t\t$event = $observer->getEvent ();\n\t\t$order = $event->getOrder();\n\t\t\n\t\t$orderHelper = Mage::helper('megaventory/order');\n\t\t\n\t\t//under certain conditions\n\t\t//this code is called twice and therefore we get an 'extra' api call\n\t\t//to cancel an order that is already cancelled in megaventory\n\t\t//the following commented out code remedies this BUT has problems\n\t\t//when order is cancelled programmatically for instance when cancelling\n\t\t//orders via a payment gateway system (i.e Moneybookers) \n\t\tif ($order->getState() == 'canceled')\n\t\t{\n\t\t\t\n\t\t\t/* if(version_compare(Mage::getVersion(), '1.5.0', '>=')) {\n\t\t\t\t$statusHistory = $order->getAllStatusHistory();\n\t\t\t\t$lastItem = count($statusHistory)-2;\n\t\t\t\t\n\t\t\t\t$lastStatus = $statusHistory[$lastItem];\n\t\t\t\t\n\t\t\t\t$statusCollection = Mage::getResourceModel('sales/order_status_collection')\n\t\t\t\t->joinStates();\n\t\t\t\t$state = '';\n\t\t\t\tforeach ($statusCollection as $status){\n\t\t\t\t\tif ($status->getStatus() == $lastStatus->getStatus())\n\t\t\t\t\t{\n\t\t\t\t\t\t$state = $status->getState();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ($state !== Mage_Sales_Model_Order::STATE_CANCELED)\n\t\t\t\t\t$orderHelper->cancelOrder($order);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tMage::log('order canceled',null,'megaventory.log',true);\n\t\t\t\t$statusHistory = $order->getAllStatusHistory();\n\t\t\t\t$lastItem = count($statusHistory)-2;\n\t\t\t\t\n\t\t\t\tMage::log('status history = '.count($statusHistory),null,'megaventory.log');\n\t\t\t\tMage::log('last item index = '.$lastItem,null,'megaventory.log');\n\t\t\t\t$lastStatus = $statusHistory[$lastItem];\n\t\t\t\tMage::log('last status = '.$lastStatus->getStatus(),null,'megaventory.log');\n\t\t\t\t\n\t\t\t\tif ($lastStatus->getStatus() !== Mage_Sales_Model_Order::STATE_CANCELED)\n\t\t\t\t\t$orderHelper->cancelOrder($order);\n\t\t\t} */\n\t\t\t\n\t\t\t\n\t\t\t$orderHelper->cancelOrder($order);\n\t\t}\n\t}"
]
| [
"0.6021025",
"0.5960481",
"0.5856925",
"0.57618695",
"0.57583934",
"0.56298727",
"0.55336726",
"0.55075437",
"0.54803336",
"0.5445651",
"0.5443347",
"0.5395493",
"0.537017",
"0.5363809",
"0.53410316",
"0.5335387",
"0.53073674",
"0.5306891",
"0.5246971",
"0.5239488",
"0.5189564",
"0.5188282",
"0.51838005",
"0.51467264",
"0.5141023",
"0.51339513",
"0.5113146",
"0.5100762",
"0.5099173",
"0.5091803"
]
| 0.5979096 | 1 |
Implemented method to validate profile repository find | public function validateFind(array $input)
{
$this->checkProfileExists($input['id']);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testProfileFindOne()\n {\n\n }",
"public function testProfileFind()\n {\n\n }",
"public function testProfilePrototypeFindByIdQuarantines()\n {\n\n }",
"public function testGetValidProfileByProfileName() {\n\t\t// count the number of rows and save it for later\n\t\t$numRows = $this->getConnection()->getRowCount(\"profile\");\n\n\t\t// create a new Profile and insert into mySQL\n\t\t$profileId = generateUuidV4();\n\n\t\t$profile = new Profile($profileId, $this->VALID_ACTIVATION_TOKEN, $this->VALID_PROFILE_EMAIL, $this->VALID_PROFILE_HASH, $this->VALID_PROFILE_IS_OWNER, $this->VALID_PROFILE_NAME);\n\t\t$profile->insert($this->getPDO());\n\n\t\t// get Profile form database using profile name\n\t\t$results = Profile::getProfileByProfileName($this->getPDO(), $this->VALID_PROFILE_NAME);\n\t\t$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount(\"profile\"));\n\n\t\t// make sure no other objects are contaminating the profile\n\t\t$this->assertContainsOnlyInstancesOf(\"Edu\\\\Cnm\\\\FoodTruckFinder\\\\Profile\", $results);\n\n\t\t// make sure results are same as expected\n\t\t$pdoProfile = $results[0];\n\t\t$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount(\"profile\"));\n\t\t$this->assertEquals($pdoProfile->getProfileId(), $profileId);\n\t\t$this->assertEquals($pdoProfile->getProfileActivationToken(), $this->VALID_ACTIVATION_TOKEN);\n\t\t$this->assertEquals($pdoProfile->getProfileEmail(), $this->VALID_PROFILE_EMAIL);\n\t\t$this->assertEquals($pdoProfile->getProfileHash(), $this->VALID_PROFILE_HASH);\n\t\t$this->assertEquals($pdoProfile->getProfileIsOwner(), $this->VALID_PROFILE_IS_OWNER);\n\t\t$this->assertEquals($pdoProfile->getProfileName(), $this->VALID_PROFILE_NAME);\n\t}",
"private function checkProfile($profile)\n {\n if ($profile === null) {\n $profile = $this->getProfile();\n return $profile;\n } elseif ($this->getProfile()->getUsername() === $profile || $this->getDoorman()->isKitchenStaff() === true) {\n $profileRepository = $this->getDoctrine()->getRepository('MealzUserBundle:Profile');\n $profile = $profileRepository->find($profile);\n return $profile;\n }\n\n return null;\n }",
"public function testGetInvalidProfileByProfileName() : void {\n\t\t// get a profile name that doesn't exist\n\t\t$profile = Profile::getProfileByProfileName($this->getPDO(), \"Invalid Profile Name\");\n\t\t$this->assertCount(0, $profile);\n\t}",
"public function testGetInvalidProfileByProfileId () : void {\n\t\t// grab a profile id that doesn't exist?\n\t\t$invalidProfileId = generateUuidV4();\n\n\t\t$profile = Profile::getProfileByProfileId($this->getPDO() , \"$invalidProfileId\");\n\t\t$this->assertNull($profile);\n\t}",
"public function testGetValidProfileById() {\n\t\t// count the number of rows and save it for later\n\t\t$numRows = $this->getConnection()->getRowCount(\"profile\");\n\n\t\t// create a new Profile and insert into mySQL\n\t\t$profileId = generateUuidV4();\n\n\t\t$profile = new Profile($profileId, $this->VALID_ACTIVATION_TOKEN, $this->VALID_PROFILE_EMAIL, $this->VALID_PROFILE_HASH, $this->VALID_PROFILE_IS_OWNER, $this->VALID_PROFILE_NAME);\n\t\t$profile->insert($this->getPDO());\n\n\t\t// grab the date from mySQL and enforce the fields match out expectations\n\t\t$pdoProfile = Profile::getProfileByProfileId($this->getPDO(), $profile->getProfileId());\n\t\t$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount(\"profile\"));\n\t\t$this->assertEquals($pdoProfile->getProfileId(), $profileId);\n\t\t$this->assertEquals($pdoProfile->getProfileActivationToken(), $this->VALID_ACTIVATION_TOKEN);\n\t\t$this->assertEquals($pdoProfile->getProfileEmail(), $this->VALID_PROFILE_EMAIL);\n\t\t$this->assertEquals($pdoProfile->getProfileHash(), $this->VALID_PROFILE_HASH);\n\t\t$this->assertEquals($pdoProfile->getProfileIsOwner(), $this->VALID_PROFILE_IS_OWNER);\n\t\t$this->assertEquals($pdoProfile->getProfileName(), $this->VALID_PROFILE_NAME);\n\t}",
"public function testProfileExistsGetProfilesidExists()\n {\n\n }",
"public function check_for_profile(){\n\t\t\n\t\t//get username for logged in user\n\t\t$user_name = $_SESSION['username'];\n\t\t// get user id for the logged in user\n\t\t$user_id = Database::user_id_query($user_name);\n\t\t//call static fucntion to check if user profile already exists\n\t\t$result = UserProfileHelper::check_profile($user_id);\n\t\t//var_dump($result);\n\t\treturn $result;\n\t}",
"public function testProfileFindById()\n {\n\n }",
"public function testGetInvalidProfileByProfileEmail() : void {\n\t\t// get an email that doesn't exist\n\t\t$profile = Profile::getProfileByProfileEmail($this->getPDO(), \"[email protected]\");\n\t\t$this->assertNull($profile);\n\t}",
"public function testProfileCheckIfUserExists()\n {\n\n }",
"public function _assertProfileExists($profile_uid)\n {\n }",
"public function testProfilePrototypeFindByIdCommunityRoles()\n {\n\n }",
"public function testProfileExistsHeadProfilesid()\n {\n\n }",
"public function findById($profileId);",
"public function isValid()\n {\n foreach ($this->repo as $repository) {\n /**\n * @var Repository $repository\n */\n $repository->needAuth();\n }\n }",
"private function checkProfileExists($id)\n {\n $profile = Profile::find($id);\n if (!$profile) {\n throw new DomainException(self::MESSAGE_PROFILE_NOT_FOUND);\n }\n }",
"public function validate()\n {\n if (empty($_GET['code'])) {\n throw new \\Exception('Can\\'t found `code` query paramater.');\n }\n\n $token = $this->client->fetchAccessTokenWithAuthCode($_GET['code']);\n\n if (isset($token['error'])) {\n throw new \\Exception($token['error']);\n }\n \n $this->client->setAccessToken($token['access_token']);\n\n // Get profile info\n $googleOAuth = new \\Google\\Service\\Oauth2($this->client);\n $this->user = $googleOAuth->userinfo->get();\n }",
"public function testProfilePrototypeFindByIdLikes()\n {\n\n }",
"public function testProfilePrototypeFindByIdGroups()\n {\n\n }",
"public function testDestiny2GetProfile()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"abstract protected function getUserProfile();",
"public function testProfilePrototypeFindByIdOwnedGroups()\n {\n\n }",
"function validateRemoteProfile()\n {\n if ($this->oprofile->isGroup()) {\n $target = common_local_url('ostatusgroup', array(), array('profile' => $this->profile_uri));\n common_redirect($target, 303);\n } else if ($this->oprofile->isPeopletag()) {\n $target = common_local_url('ostatuspeopletag', array(), array('profile' => $this->profile_uri));\n common_redirect($target, 303);\n }\n }",
"public function perfilValidator($data){\n return NULL;\n }",
"public function testProfileIndexFound()\n {\n $profileService = $this->createProfileServiceMock();\n\n $profileService\n ->method('getProfile')\n ->willReturn(new BlokkrUser());\n\n $client = static::createClient();\n $client->getContainer()->set(\"blokkr.service.profile\", $profileService);\n $client->request(\"GET\", \"/profile/1\");\n\n\n $this->assertEquals(200, $client->getResponse()->getStatusCode());\n }",
"public function testUpdateValidProfile() : void {\n\t\t// count the number of rows and save it for later\n\t\t$numRows = $this->getConnection()->getRowCount(\"profile\");\n\n\t\t// create a new profile and update it in mySQL\n\t\t$profileId = generateUuidV4();\n\n\t\t$profile = new Profile($profileId, $this->VALID_ACTIVATION_TOKEN, $this->VALID_PROFILE_EMAIL, $this->VALID_PROFILE_HASH, $this->VALID_PROFILE_IS_OWNER, $this->VALID_PROFILE_NAME);\n\t\t$profile->insert($this->getPDO());\n\n\t\t// edit the profile and update it in mySQL\n\t\t$profile->setProfileContent($this->VALID_PROFILE_EMAIL, $this->VALID_PROFILE_HASH, $this->VALID_PROFILE_NAME);\n\t\t$profile->update($this->getPDO());\n\n\t\t// grab the date from mySQL and enforce the fields match out expectations\n\t\t$pdoProfile = Profile::getProfileByProfileId($this->getPDO(), $profile->getProfileId());\n\t\t$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount(\"profile\"));\n\t\t$this->assertEquals($pdoProfile->getProfileId(), $profileId);\n\t\t$this->assertEquals($pdoProfile->getProfileActivationToken(), $this->VALID_ACTIVATION_TOKEN);\n\t\t$this->assertEquals($pdoProfile->getProfileEmail(), $this->VALID_PROFILE_EMAIL);\n\t\t$this->assertEquals($pdoProfile->getProfileHash(), $this->VALID_PROFILE_HASH);\n\t\t$this->assertEquals($pdoProfile->getProfileIsOwner(), $this->VALID_PROFILE_IS_OWNER);\n\t\t$this->assertEquals($pdoProfile->getProfileName(), $this->VALID_PROFILE_NAME);\n\t}",
"function pullRemoteProfile()\n {\n $this->profile_uri = $this->trimmed('profile');\n try {\n if (Validate::email($this->profile_uri)) {\n $this->oprofile = Ostatus_profile::ensureWebfinger($this->profile_uri);\n } else if (Validate::uri($this->profile_uri)) {\n $this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);\n } else {\n // TRANS: Error message in OStatus plugin. Do not translate the domain names example.com\n // TRANS: and example.net, as these are official standard domain names for use in examples.\n $this->error = _m(\"Sorry, we could not reach that address. Please make sure that the OStatus address is like [email protected] or http://example.net/nickname.\");\n common_debug('Invalid address format.', __FILE__);\n return false;\n }\n return true;\n } catch (FeedSubBadURLException $e) {\n // TRANS: Error message in OStatus plugin. Do not translate the domain names example.com\n // TRANS: and example.net, as these are official standard domain names for use in examples.\n $this->error = _m('Sorry, we could not reach that address. Please make sure that the OStatus address is like [email protected] or http://example.net/nickname.');\n common_debug('Invalid URL or could not reach server.', __FILE__);\n } catch (FeedSubBadResponseException $e) {\n // TRANS: Error text.\n $this->error = _m('Sorry, we could not reach that feed. Please try that OStatus address again later.');\n common_debug('Cannot read feed; server returned error.', __FILE__);\n } catch (FeedSubEmptyException $e) {\n // TRANS: Error text.\n $this->error = _m('Sorry, we could not reach that feed. Please try that OStatus address again later.');\n common_debug('Cannot read feed; server returned an empty page.', __FILE__);\n } catch (FeedSubBadHTMLException $e) {\n // TRANS: Error text.\n $this->error = _m('Sorry, we could not reach that feed. Please try that OStatus address again later.');\n common_debug('Bad HTML, could not find feed link.', __FILE__);\n } catch (FeedSubNoFeedException $e) {\n // TRANS: Error text.\n $this->error = _m(\"Sorry, we could not reach that feed. Please try that OStatus address again later.\");\n common_debug('Could not find a feed linked from this URL.', __FILE__);\n } catch (FeedSubUnrecognizedTypeException $e) {\n // TRANS: Error text.\n $this->error = _m(\"Sorry, we could not reach that feed. Please try that OStatus address again later.\");\n common_debug('Not a recognized feed type.', __FILE__);\n } catch (Exception $e) {\n // Any new ones we forgot about\n // TRANS: Error message in OStatus plugin. Do not translate the domain names example.com\n // TRANS: and example.net, as these are official standard domain names for use in examples.\n $this->error = _m(\"Sorry, we could not reach that address. Please make sure that the OStatus address is like [email protected] or http://example.net/nickname.\");\n common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__);\n }\n\n return false;\n }"
]
| [
"0.628311",
"0.6247539",
"0.6148062",
"0.60653687",
"0.60117525",
"0.5921143",
"0.5901478",
"0.58845305",
"0.582402",
"0.58215946",
"0.57872206",
"0.5552482",
"0.551144",
"0.54996383",
"0.5486694",
"0.54858917",
"0.5468476",
"0.5460971",
"0.5437119",
"0.5426644",
"0.53629285",
"0.5360466",
"0.53492033",
"0.53446513",
"0.53235644",
"0.5312488",
"0.5285628",
"0.5273285",
"0.526173",
"0.5228056"
]
| 0.6482315 | 0 |
Valid document data provider | public function validDocumentDataProvider()
{
return [
[
'customer_document',
'some/path/to/bucket/document1.pdf',
[
'customerId' => 123,
'documentReference' => 'F 1010101',
'customerDocumentType' => 'customer_invoice',
'originalFilename' => 'F 1010101.pdf',
],
],
[
'supplier_document',
'some/path/to/bucket/document2.pdf',
[
'supplierId' => 234,
'documentReference' => 'G 55555',
'supplierDocumentType' => 'supplier_purchase_order',
'originalFilename' => 'G 55555.pdf',
],
],
];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract public function validateData();",
"function isDataValid() \n {\n return true;\n }",
"private function checkData(){\n $this->datavalidator->addValidation('article_title','req',$this->text('e10'));\n $this->datavalidator->addValidation('article_title','maxlen=250',$this->text('e11'));\n $this->datavalidator->addValidation('article_prologue','req',$this->text('e12'));\n $this->datavalidator->addValidation('article_prologue','maxlen=3000',$this->text('e13'));\n $this->datavalidator->addValidation('keywords','regexp=/^[^,\\s]{3,}(,? ?[^,\\s]{3,})*$/',$this->text('e32'));\n $this->datavalidator->addValidation('keywords','maxlen=500',$this->text('e33'));\n if($this->data['layout'] != 'g' && $this->data['layout'] != 'h'){ //if article is gallery dont need content\n $this->datavalidator->addValidation('article_content','req',$this->text('e14'));\n }\n $this->datavalidator->addValidation('id_menucategory','req',$this->text('e15'));\n $this->datavalidator->addValidation('id_menucategory','numeric',$this->text('e16'));\n $this->datavalidator->addValidation('layout','req',$this->text('e17'));\n $this->datavalidator->addValidation('layout','maxlen=1',$this->text('e18'));\n if($this->languager->getLangsCount() > 1){\n $this->datavalidator->addValidation('lang','req',$this->text('e19'));\n $this->datavalidator->addValidation('lang','numeric',$this->text('e20'));\n }\n //if user cannot publish articles check publish values\n if($_SESSION[PAGE_SESSIONID]['privileges']['articles'][2] == '1') {\n $this->datavalidator->addValidation('published','req',$this->text('e21'));\n $this->datavalidator->addValidation('published','numeric',$this->text('e22'));\n $this->datavalidator->addValidation('publish_date','req',$this->text('e23'));\n }\n $this->datavalidator->addValidation('topped','req',$this->text('e24'));\n $this->datavalidator->addValidation('topped','numeric',$this->text('e25'));\n $this->datavalidator->addValidation('homepage','req',$this->text('e30'));\n $this->datavalidator->addValidation('homepage','numeric',$this->text('e31'));\n $this->datavalidator->addValidation('showsocials','req',$this->text('e26'));\n $this->datavalidator->addValidation('showsocials','numeric',$this->text('e27'));\n \n $result = $this->datavalidator->ValidateData($this->data);\n if(!$result){\n $errors = $this->datavalidator->GetErrors();\n return array('state'=>'error','data'=> reset($errors));\n }else{\n return true;\n }\n }",
"protected function dataProviderDocument() {\n\t\treturn null;\n\t}",
"public function validateData(){\n return true;\n }",
"public function isDataValid(): bool;",
"public function validate()\n {\n $this->validateRequiredParameters();\n\n if (!is_string($this->getType())) {\n throw new InvalidDocumentException(\"The type parameter must be a string\");\n }\n }",
"public function validated();",
"function isValidDocument($docFormat, $document){\n $name = $document['name'];\n $ext = explode('.', $name);\n $ext = '.' . $ext[1];\n\n if($ext == $docFormat){\n if($document['error'] === 0){\n return true;\n }\n else{\n echo \"error uploading document\";\n return false;\n }\n }\n else{\n echo \"doc type does not match documents true extension\";\n }\n }",
"public function valid() {}",
"public function valid() {}",
"public function valid() {}",
"public function valid() {}",
"public function valid() {}",
"public function valid() {}",
"public function valid() {}",
"public function valid() {}",
"public function testValidateDocumentDocValidation()\n {\n }",
"abstract public function valid();",
"abstract public function validateData($data);",
"public function valid();",
"public function valid();",
"public function valid();",
"public function valid();",
"abstract protected function validate($data);",
"public function invalidDocumentDataProvider()\n {\n return [\n [\n 'customer_document',\n 'some/path/to/bucket/document1.pdf',\n [\n 'customerId' => '234324',\n 'documentReference' => 213,\n ],\n [\n 'Object(EavBundle\\Entity\\EavDocument).type',\n 'Object(EavBundle\\Entity\\EavValue).customerId',\n 'Object(EavBundle\\Entity\\EavValue).documentReference',\n ],\n ],\n [\n 'supplier_document',\n 'some/path/to/bucket/document2.pdf',\n [\n 'supplierId' => -1,\n 'documentReference' => '',\n 'supplierDocumentType' => 'supplier_purchase_order',\n ],\n [\n 'Object(EavBundle\\Entity\\EavValue).supplierId',\n 'Object(EavBundle\\Entity\\EavDocument).document',\n ],\n ],\n [\n 'customer_document',\n 'some/path/to/bucket/document1.pdf',\n [],\n [\n 'Object(EavBundle\\Entity\\EavDocument).customerId',\n 'Object(EavBundle\\Entity\\EavDocument).type',\n ],\n ],\n [\n 'customer_document',\n 'some/path/to/bucket/document1.pdf',\n [\n 'customerId' => 123,\n 'documentReference' => 'F 1010101',\n 'customerDocumentType' => 'customer_invoice',\n 'originalFilename' => 'F 1010101.pdf',\n ],\n [\n 'Object(EavBundle\\Entity\\EavDocument).document',\n ],\n ],\n [\n 'customer_document',\n 'some/path/to/bucket/document1.pdf',\n [\n 'customerId' => 5678,\n 'customerDocumentType' => 'customer_invoice',\n 'originalFilename' => 'F 23423423.pdf',\n ],\n [\n 'Object(EavBundle\\Entity\\EavDocument).document',\n ],\n ],\n [\n 'supplier_document',\n 'some/path/to/bucket/document2.pdf',\n [\n 'supplierId' => 234,\n 'documentReference' => 'G 55555',\n 'supplierDocumentType' => 'supplier_purchase_order',\n 'originalFilename' => 'G 55555.pdf',\n ],\n [\n 'Object(EavBundle\\Entity\\EavDocument).document',\n ],\n ],\n [\n 'supplier_document',\n 'some/path/to/bucket/document2.pdf',\n [\n 'supplierId' => 9876,\n 'supplierDocumentType' => 'supplier_invoice',\n 'originalFilename' => 'F 23423423.pdf',\n ],\n [\n 'Object(EavBundle\\Entity\\EavDocument).document',\n ],\n ],\n ];\n }",
"public function is_valid()\n {\n }",
"public function testValidateDocumentPdfValidation()\n {\n }",
"public function is_valid()\n {\n }",
"public function valid(){ }"
]
| [
"0.6715218",
"0.66020477",
"0.63300085",
"0.6260909",
"0.62184507",
"0.62161624",
"0.62118566",
"0.6186857",
"0.61800593",
"0.6154415",
"0.6154415",
"0.6154415",
"0.6154415",
"0.6154415",
"0.6154415",
"0.6154415",
"0.6154415",
"0.61471707",
"0.61259615",
"0.6114034",
"0.607066",
"0.607066",
"0.607066",
"0.607066",
"0.6069312",
"0.60126877",
"0.59992063",
"0.5998309",
"0.5997236",
"0.5980222"
]
| 0.70822054 | 0 |
Invalid document data provider | public function invalidDocumentDataProvider()
{
return [
[
'customer_document',
'some/path/to/bucket/document1.pdf',
[
'customerId' => '234324',
'documentReference' => 213,
],
[
'Object(EavBundle\Entity\EavDocument).type',
'Object(EavBundle\Entity\EavValue).customerId',
'Object(EavBundle\Entity\EavValue).documentReference',
],
],
[
'supplier_document',
'some/path/to/bucket/document2.pdf',
[
'supplierId' => -1,
'documentReference' => '',
'supplierDocumentType' => 'supplier_purchase_order',
],
[
'Object(EavBundle\Entity\EavValue).supplierId',
'Object(EavBundle\Entity\EavDocument).document',
],
],
[
'customer_document',
'some/path/to/bucket/document1.pdf',
[],
[
'Object(EavBundle\Entity\EavDocument).customerId',
'Object(EavBundle\Entity\EavDocument).type',
],
],
[
'customer_document',
'some/path/to/bucket/document1.pdf',
[
'customerId' => 123,
'documentReference' => 'F 1010101',
'customerDocumentType' => 'customer_invoice',
'originalFilename' => 'F 1010101.pdf',
],
[
'Object(EavBundle\Entity\EavDocument).document',
],
],
[
'customer_document',
'some/path/to/bucket/document1.pdf',
[
'customerId' => 5678,
'customerDocumentType' => 'customer_invoice',
'originalFilename' => 'F 23423423.pdf',
],
[
'Object(EavBundle\Entity\EavDocument).document',
],
],
[
'supplier_document',
'some/path/to/bucket/document2.pdf',
[
'supplierId' => 234,
'documentReference' => 'G 55555',
'supplierDocumentType' => 'supplier_purchase_order',
'originalFilename' => 'G 55555.pdf',
],
[
'Object(EavBundle\Entity\EavDocument).document',
],
],
[
'supplier_document',
'some/path/to/bucket/document2.pdf',
[
'supplierId' => 9876,
'supplierDocumentType' => 'supplier_invoice',
'originalFilename' => 'F 23423423.pdf',
],
[
'Object(EavBundle\Entity\EavDocument).document',
],
],
];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function dataProviderDocument() {\n\t\treturn null;\n\t}",
"public function validDocumentDataProvider()\n {\n return [\n [\n 'customer_document',\n 'some/path/to/bucket/document1.pdf',\n [\n 'customerId' => 123,\n 'documentReference' => 'F 1010101',\n 'customerDocumentType' => 'customer_invoice',\n 'originalFilename' => 'F 1010101.pdf',\n ],\n ],\n [\n 'supplier_document',\n 'some/path/to/bucket/document2.pdf',\n [\n 'supplierId' => 234,\n 'documentReference' => 'G 55555',\n 'supplierDocumentType' => 'supplier_purchase_order',\n 'originalFilename' => 'G 55555.pdf',\n ],\n ],\n ];\n }",
"public function testReadDocumentWithIllegalArgumentException() {\n\n $obj = new FileSystemStorageProvider($this->logger, $this->directory);\n\n try {\n\n $obj->readDocument($this->dir1);\n } catch (Exception $ex) {\n\n $this->assertInstanceOf(IllegalArgumentException::class, $ex);\n $this->assertEquals(\"The document must be a document\", $ex->getMessage());\n }\n }",
"public function invalidVersionNumberDataProvider() {}",
"public function passingInvalidMarkersThrowsExceptionDataProvider() {}",
"public function validEmailInvalidDataProvider() {}",
"public function dataProviderInvalid() {\n return [\n [null, 1],\n [2018, false],\n [2018, 'feb'],\n ['year', 12],\n [309696, 2495],\n ];\n }",
"public function testOnUploadedDocumentWithIllegalArgumentException() {\n\n $obj = new FileSystemStorageProvider($this->logger, $this->directory);\n\n try {\n\n $obj->onUploadedDocument($this->dir1);\n } catch (Exception $ex) {\n\n $this->assertInstanceOf(IllegalArgumentException::class, $ex);\n $this->assertEquals(\"The document must be a document\", $ex->getMessage());\n }\n }",
"public function testNoResultingDocument()\n\t {\n\t\t$instance = $this->testForValidity(\"nodocument\");\n\t\t$instance->getExpandedDocument(array(), 0);\n\t }",
"public function validate()\n {\n $this->validateRequiredParameters();\n\n if (!is_string($this->getType())) {\n throw new InvalidDocumentException(\"The type parameter must be a string\");\n }\n }",
"public static function invalidDataProvider() {\n\t\treturn array(\n\t\t\tarray(null),\n\t\t\tarray(false),\n\t\t\tarray(''),\n\t\t\tarray('http://localhost/notthere.xml'),\n\t\t);\n\t}",
"public function callUserFunctionInvalidParameterDataprovider() {}",
"public function testValidationFail() {\n $nbRecords = $this->Links->find('all')->count();\n //Build bad data with an empty token\n $badData = $this->goodData;\n $badData['title'] = '';\n\n $this->Links->save($this->Links->newEntity($badData));\n //Check no data has been inserted\n $this->assertEquals($nbRecords, $this->Links->find('all')->count(),\n 'Bad data has not been inserted');\n }",
"public function testOnDeletedDocumentWithIllegalArgumentException() {\n\n $obj = new FileSystemStorageProvider($this->logger, $this->directory);\n\n try {\n\n $obj->onDeletedDocument($this->dir1);\n } catch (Exception $ex) {\n\n $this->assertInstanceOf(IllegalArgumentException::class, $ex);\n $this->assertEquals(\"The document must be a document\", $ex->getMessage());\n }\n }",
"public static function cmpFqdnInvalidDataProvider() {}",
"protected function _afterPrepareDocumentData()\n {\n }",
"public function isValidUrlInvalidRessourceDataProvider() {}",
"public function testUpdateDocumentValueFailed()\n {\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertInstanceOf(EavDocument::class, $eavDocument);\n $this->assertTrue($eavDocument->hasValue('customerId'));\n\n $eavDocument->setValue('customerId', '6789');\n $this->em->persist($eavDocument);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavDocument->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('customerId', (string) $violations);\n }",
"public function beginsWithReturnsInvalidArgumentDataProvider() {}",
"protected function validateOrThrow() {}",
"function testInvalidFields () {\n \t$field1 = new SolrSimpleField('dummy1', 'foobar');\n \t$field2 = new Dummy();\n \t$doc = new SolrSimpleDocument(array($field1, $field2));\n }",
"public function executeValueModifierInvalidDataProvider() {}",
"public function validateDoc($document)\n\t\t{\n\t\t\tif ($document == 'terms_and_conditions' ||\n\t\t\t\t$document == 'privacy_policy') {\n\t\t\t\t\n\t\t\t\t$render = $document;\n\n\t\t\t}else{\n\n\t\t\t\t$render = \"no_document\";\n\n\t\t\t}\n\n\t\t\treturn $render;\n\t\t}",
"public function testInvalidNamesForResourceAttributesType()\n {\n $this->document->addToData($resource = $this->schemaFactory->createResourceObject($this->getSchema(\n 'people',\n '123',\n ['firstName' => 'John', 'type' => 'whatever'], // <-- 'type' is a reserved word and cannot be used\n new Link('selfUrl'),\n [LinkInterface::SELF => new Link('selfUrl')], // links for resource\n ['some' => 'meta']\n ), new stdClass(), true));\n }",
"function isValidDocument($docFormat, $document){\n $name = $document['name'];\n $ext = explode('.', $name);\n $ext = '.' . $ext[1];\n\n if($ext == $docFormat){\n if($document['error'] === 0){\n return true;\n }\n else{\n echo \"error uploading document\";\n return false;\n }\n }\n else{\n echo \"doc type does not match documents true extension\";\n }\n }",
"abstract public function validateData();",
"function isDataValid() \n {\n return true;\n }",
"public function isExpectingDocument();",
"protected abstract function getErrornousPersistenceAdapter();",
"public function testGetInvalidStrainReviewByStrainReviewTxt() {\n\t\t// grab a strain review by searching for content that does not exist\n\t\t$strainReview = StrainReview::getStrainReviewByStrainReviewTxt($this->getPDO(), \"Dee Dee Dee, No Such Thing\");\n\t\t$this->assertCount(0, $strainReview);\n\t}"
]
| [
"0.642526",
"0.60258466",
"0.60234654",
"0.59504336",
"0.59326977",
"0.5885726",
"0.5807688",
"0.57654196",
"0.5756667",
"0.5729568",
"0.57039654",
"0.5690097",
"0.5667549",
"0.5660351",
"0.5617549",
"0.55418044",
"0.5538024",
"0.5514835",
"0.5487728",
"0.54594976",
"0.5436487",
"0.5400003",
"0.53687435",
"0.5357075",
"0.53227377",
"0.5302268",
"0.53010446",
"0.52865005",
"0.5285609",
"0.52831495"
]
| 0.6477929 | 0 |
Test updating of the document's value | public function testUpdateDocumentValue()
{
$eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);
$this->assertInstanceOf(EavDocument::class, $eavDocument);
$documentId = $eavDocument->getId();
$this->assertTrue($eavDocument->hasValue('documentReference'));
$eavDocument->setValue('documentReference', 'F 2020202');
$this->em->persist($eavDocument);
$this->em->flush();
$eavDocument = $this->getEavDocumentRepo()->find($documentId);
$this->assertInstanceOf(EavDocument::class, $eavDocument);
$eavValue = $eavDocument->getValue('documentReference');
$this->assertSame('F 2020202', $eavValue->getValue());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testUpdateDocument()\n {\n echo \"\\nTesting dcoument update...\";\n\n $id = \"0\";\n //echo \"\\n-----Is string:\".gettype ($id);\n $input = file_get_contents('doc_update.json');\n //echo $input;\n //$url = TestServiceAsReadOnly::$elasticsearchHost . \"/CIL_RS/index.php/rest/documents/\".$id.\"?owner=wawong\";\n $url = TestServiceAsReadOnly::$elasticsearchHost .$this->context.\"/documents/\".$id.\"?owner=wawong\";\n\n //echo \"\\nURL:\".$url;\n $params = json_decode($input);\n $data = json_encode($params); \n $response = $this->curl_put($url,$data);\n \n $json = json_decode($response);\n $this->assertTrue(!$json->success);\n \n }",
"public function testUpdateDocumentValueFailed()\n {\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertInstanceOf(EavDocument::class, $eavDocument);\n $this->assertTrue($eavDocument->hasValue('customerId'));\n\n $eavDocument->setValue('customerId', '6789');\n $this->em->persist($eavDocument);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavDocument->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('customerId', (string) $violations);\n }",
"public function testUpdate()\n {\n // Test with correct field name\n $this->visit('/cube/1')\n ->type('3', 'x')\n ->type('3', 'y')\n ->type('3', 'z')\n ->type('1', 'value')\n ->press('submit-update')\n ->see('updated successfully');\n\n /*\n * Tests with incorrect fields\n */\n // Field required\n $this->visit('/cube/1')\n ->press('submit-update')\n ->see('is required');\n\n // Field must be integer\n $this->visit('/cube/1')\n ->type('1a', 'x')\n ->press('submit-update')\n ->see('integer');\n\n // Field value very great\n $this->visit('/cube/1')\n ->type('1000000000', 'y')\n ->press('submit-update')\n ->see('greater');\n }",
"public function testUpdateValue()\n {\n $response = $this->json('PATCH', '/api/values');\n $response->assertStatus(200);\n }",
"public function testValueValidationForUpdate()\n {\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);\n\n $this->assertNotNull($eavValue);\n\n $eavValue->setValue('not_existing_type');\n\n $this->em->persist($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(1, $violations);\n }",
"public function testPutDocument()\n {\n }",
"public function test_update_item() {}",
"public function test_update_item() {}",
"public function testD_update() {\n\n $fname = self::$generator->firstName();\n $lname = self::$generator->lastName;\n\n $resp = $this->wrapper->update( self::$randomEmail, [\n 'FNAME' => $fname,\n 'LNAME' => $lname\n ]);\n\n $this->assertObjectHasAttribute('id', $resp);\n $this->assertObjectHasAttribute('merge_fields', $resp);\n\n $updated = $resp->merge_fields;\n\n $this->assertEquals($lname, $updated->LNAME);\n\n }",
"public function test_if_failed_update()\n {\n }",
"public function testUpdate()\n {\n $documentHandler = new DocumentHandler($this->connection);\n $result = $documentHandler->save($this->collection1->getName(), [ '_key' => 'test', 'value' => 'test' ]);\n static::assertEquals('test', $result);\n\n $trx = new StreamingTransaction($this->connection, [\n TransactionBase::ENTRY_COLLECTIONS => [\n TransactionBase::ENTRY_WRITE => [ $this->collection1->getName() ]\n ]\n ]);\n\n $trx = $this->transactionHandler->create($trx);\n $this->_shutdown[] = $trx;\n static::assertInstanceOf(StreamingTransaction::class, $trx);\n \n static::assertTrue(is_string($trx->getId()));\n\n $trxCollection = $trx->getCollection($this->collection1->getName());\n static::assertEquals($this->collection1->getName(), $trxCollection->getName());\n\n // document should be present inside transaction\n $doc = $documentHandler->getById($trxCollection, \"test\");\n static::assertEquals('test', $doc->getKey());\n static::assertEquals('test', $doc->value);\n\n // update document inside transaction\n $doc->value = 'foobar';\n $result = $documentHandler->updateById($trxCollection, 'test', $doc);\n static::assertTrue($result);\n\n // transactional lookup should find the modified document\n $doc = $documentHandler->getById($trxCollection, \"test\");\n static::assertEquals('test', $doc->getKey());\n static::assertEquals('foobar', $doc->value);\n \n // non-transactional lookup should still see the old document\n $doc = $documentHandler->getById($this->collection1->getName(), \"test\");\n static::assertEquals('test', $doc->getKey());\n static::assertEquals('test', $doc->value);\n \n // now commit\n static::assertTrue($this->transactionHandler->commit($trx->getId()));\n\n $doc = $documentHandler->getById($this->collection1->getName(), \"test\");\n static::assertEquals('test', $doc->getKey());\n static::assertEquals('foobar', $doc->value);\n }",
"public function testUpdateDocumentMetadata()\n {\n }",
"public function testUpdate(): void { }",
"function updateTest()\n {\n $this->cD->updateElement(new Product(1, \"Trang\"));\n }",
"public function testQuarantineUpdateAll()\n {\n\n }",
"public function testIntegrationUpdate()\n {\n $userFaker = factory(Model::class)->create();\n $this->visit('user/' . $userFaker->slug . '/edit')\n ->type('Foo bar', 'name')\n ->type('Foobar', 'username')\n ->type('[email protected]', 'email')\n ->type('foobar123', 'password')\n ->type('foobar123', 'password_confirmation')\n ->press('Save')\n ->seePageIs('user');\n $this->assertResponseOk();\n $this->seeInDatabase('users', [\n 'username' => 'Foobar',\n 'email' => '[email protected]'\n ]);\n $this->assertViewHas('models');\n }",
"public function testSaveUpdate()\n {\n $city = $this->existing_city;\n\n // set string properties to \"updated <property_name>\"\n // set numeric properties to strlen(<property_name>)\n foreach (get_object_vars($city) as $key => $value) {\n if ($key !== 'id' && $key != 'created') {\n if (is_string($value)) {\n $city->$key = \"updated \".$key;\n } elseif (is_numeric($value)) {\n $city->$key = strlen($key);\n }\n }\n }\n\n // update the city\n $city->save();\n\n // go get the updated record\n $updated_city = new City($city->id);\n // check the properties of the updatedCity\n foreach (get_object_vars($updated_city) as $key => $value) {\n if ($key !== 'id' && $key != 'created') {\n if (is_string($city->$key)) {\n $this->assertEquals(\"updated \".$key, $value);\n } elseif (is_numeric($city->$key)) {\n $this->assertEquals(strlen($key), $value);\n }\n }\n }\n }",
"public function testSaveUpdate()\n {\n $user = User::findOne(1002);\n $version = Version::findOne(1001);\n\n $this->specify('Error update attempt', function () use ($user, $version) {\n $data = [\n 'scenario' => VersionForm::SCENARIO_UPDATE,\n 'title' => 'Some very long title...Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam dignissim, lorem in bibendum.',\n 'type' => Version::TYPE_TABLET,\n 'subtype' => 31,\n 'retinaScale' => false,\n 'autoScale' => 'invalid_value',\n ];\n $model = new VersionForm($user, $data);\n\n $result = $model->save($version);\n $version->refresh();\n\n verify('Model should not succeed', $result)->null();\n verify('Model should have errors', $model->errors)->notEmpty();\n verify('Title error message should be set', $model->errors)->hasKey('title');\n verify('ProjectId error message should not be set', $model->errors)->hasntKey('projectId');\n verify('Type error message should not be set', $model->errors)->hasntKey('type');\n verify('Subtype error message should be set', $model->errors)->hasKey('subtype');\n verify('AutoScale error message should be set', $model->errors)->hasKey('autoScale');\n verify('RetinaScale error message should not be set', $model->errors)->hasntKey('retinaScale');\n verify('Version title should not change', $version->title)->notEquals($data['title']);\n verify('Version type should not be changed', $version->type)->notEquals($data['type']);\n verify('Version subtype should not be changed', $version->subtype)->notEquals($data['subtype']);\n });\n\n $this->specify('Success update attempt', function () use ($user, $version) {\n $data = [\n 'scenario' => VersionForm::SCENARIO_UPDATE,\n 'projectId' => 1003, // should be ignored\n 'title' => 'My new test version title',\n 'type' => Version::TYPE_MOBILE,\n 'subtype' => 31,\n 'retinaScale' => true,\n 'autoScale' => true,\n ];\n $model = new VersionForm($user, $data);\n\n $result = $model->save($version);\n\n verify('Model should succeed and return an instance of Version', $result)->isInstanceOf(Version::className());\n verify('Model should not has any errors', $model->errors)->isEmpty();\n verify('The returned Version should be the same as the updated one', $result->id)->equals($version->id);\n verify('Version projectId should not change', $result->projectId)->notEquals($data['projectId']);\n verify('Version title should match', $result->title)->equals($data['title']);\n verify('Version type should match', $result->type)->equals($data['type']);\n verify('Version subtype should match', $result->subtype)->equals($data['subtype']);\n verify('Version scaleFactor should match', $result->scaleFactor)->equals(Version::AUTO_SCALE_FACTOR);\n });\n }",
"public function testGetChangeField()\n {\n }",
"public function test_it_updates_a_user()\n {\n $user = User::create(['email' => '[email protected]', 'given_name' => 'Andrew', 'family_name' => 'Hook']);\n\n $update = ['email' => '[email protected]', 'given_name' => 'A', 'family_name' => 'H'];\n\n $this->json('PUT', sprintf('/users/%d', $user->id), $update)\n ->seeJson($update);\n }",
"public function testUpdateSingleRecord() {\r\n // Create record\r\n $po = new test_persistence_AbstractPersistenceAdapterTestPersistentObject();\r\n $po->booleanValue = true;\r\n $po->intValue = 2147483647;\r\n $po->stringValue = 'Hallo Welt!';\r\n // Store new record\r\n $this->getPersistenceAdapter()->save($po);\r\n // Remember UUID\r\n $uuid = $po->uuid;\r\n // Update values;\r\n $po->booleanValue = false;\r\n $po->intValue = -2147483646;\r\n $po->stringValue = 'Guten Morgen!';\r\n // Update record\r\n $this->getPersistenceAdapter()->save($po);\r\n // Get record back from database\r\n $result = $this->executeQuery('select * from POTEST where UUID=\\''.$uuid.'\\'');\r\n // Records must be unique\r\n $this->assertEquals($po->booleanValue, (bool)$result[0]['BOOLEAN_VALUE'], 'Boolean value from database differs from the boolean value of the persistent object.');\r\n $this->assertEquals($po->intValue, intval($result[0]['INT_VALUE']), 'Integer value from database differs from the int value of the persistent object.');\r\n $this->assertEquals($po->stringValue, $result[0]['STRING_VALUE'], 'String value from database differs from the string value of the persistent object.');\r\n }",
"public function testExampleUpdateRequestShouldSucceed()\n {\n $example = Example::factory()->create();\n $response = $this->put(route('example.update', $example->id), [\n 'param1' => 100,\n 'param2' => 'Hello World',\n ]);\n $response->assertStatus(200);\n }",
"public function Do_update_Example1(){\n\n\t}",
"public function updated(Document $document)\n {\n //\n }",
"public function testWebinarUpdate()\n {\n }",
"public function testSaveShouldWorkAndBumpTimestampAndTheDirtyFlagShouldWork()\n\t{\n\t\t$result = cms_orm('test_orm_table')->find();\n\t\t$old_timestamp = $result->modified_date->timestamp();\n\t\t$result->save();\n\t\t$result = cms_orm('test_orm_table')->find();\n\t\t$this->assertEqual($old_timestamp, $result->modified_date->timestamp());\n\t\t\n\t\t#Once with\n\t\t$old_timestamp = $result->modified_date->timestamp();\n\t\t$result->test_field = 'test10';\n\t\t$result->save();\n\t\t$result = cms_orm('test_orm_table')->find();\n\t\t$this->assertNotEqual($old_timestamp, $result->modified_date->timestamp());\n\t\t$this->assertEqual('test10', $result->test_field);\n\t}",
"public function testModify()\n {\n $user = User::factory()->create();\n $old_name = $user->name;\n $old_email = $user->email;\n\n $user->name = 'David';\n $user->email = '[email protected]';\n $update = $user->save();\n\n $this->assertTrue($update);\n $this->assertNotEquals($old_name, $user->name);\n $this->assertNotEquals($old_email, $user->email);\n }",
"function test_updateGenre()\n {\n //Arrange\n $title = \"Whimsical Fairytales...and other stories\";\n $genre = \"Fantasy\";\n $test_book = new Book($title, $genre);\n $test_book->save();\n\n $column_to_update = \"genre\";\n $new_info = \"Historical Fiction\";\n\n //Act\n $test_book->update($column_to_update, $new_info);\n\n //Assert\n $result = Book::getAll();\n $this->assertEquals(\"Historical Fiction\", $result[0]->getGenre());\n }",
"public function testUpdateCar()\n {\n $id = 1;\n $car = Cars::find($id);\n $year = $car->year;\n $yearUpdate = 2000;\n //Test for user before update\n $this->assertNotEquals($yearUpdate, $year,\"Before update\");\n $statement = \"The year before updating is \" .$year. \" . \";\n ExampleTest::validate($this,$statement);\n DB::table('cars')\n ->where('id', $id)\n ->update(['year'=>$yearUpdate]);\n $newCar = Cars::find($id);\n $newYear = $newCar->year;\n $this->assertEquals($yearUpdate, $newYear,\"After Update\");\n $statement = \"The car year after updating is \".$newYear.\". \";\n ExampleTest::validate($this,$statement);\n }",
"public function testUpdate()\n {\n $data = array(\n 'foo' => 'baz'\n );\n\n $transaction = $this->client->transaction()->Update(654, $data);\n\n $this->assertEquals($data, get_object_vars($transaction->put), 'Passed variables are not correct');\n $this->assertEquals('PUT', $transaction->request_method, 'The PHP Verb Is Incorrect');\n $this->assertEquals('/transactions/654', $transaction->path, 'The path is incorrect');\n\n }"
]
| [
"0.7118057",
"0.7043425",
"0.7007075",
"0.6997476",
"0.67915326",
"0.66779196",
"0.65438545",
"0.65438545",
"0.64412284",
"0.63555014",
"0.63379925",
"0.6324167",
"0.6301997",
"0.6265667",
"0.6263981",
"0.6262778",
"0.62392974",
"0.619382",
"0.61836636",
"0.61777496",
"0.6161645",
"0.6151882",
"0.61383545",
"0.61279535",
"0.6073264",
"0.6066665",
"0.6062052",
"0.6055255",
"0.60533226",
"0.6046709"
]
| 0.7370754 | 0 |
Tests validation errors in case direct (without EavDocument preloading) EavValue delete operation | public function testDocumentIntegrityAfterManualValueDeletion()
{
$eavValue = $this->getEavValueRepo()->findOneBy(['value' => '123']);
$this->em->remove($eavValue);
$eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);
$this->em->remove($eavValue);
try {
$this->em->flush();
} catch (\Exception $e) {
$this->assertInstanceOf(EavDocumentValidationException::class, $e);
}
$violations = $eavValue->getDocument()->getLastViolations();
$this->assertCount(2, $violations);
$this->assertContains('customerId', (string) $violations);
$this->assertContains('customerDocumentType', (string) $violations);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testValidateAndDelete() {\r\n\t\ttry {\r\n\t\t\t$postData = array();\r\n\t\t\t$this->ShopProductAttribute->validateAndDelete('invalidShopProductAttributeId', $postData);\r\n\t\t} catch (OutOfBoundsException $e) {\r\n\t\t\t$this->assertEqual($e->getMessage(), 'Invalid Shop Product Attribute');\r\n\t\t}\r\n\t\ttry {\r\n\t\t\t$postData = array(\r\n\t\t\t\t'ShopProductAttribute' => array(\r\n\t\t\t\t\t'confirm' => 0));\r\n\t\t\t$result = $this->ShopProductAttribute->validateAndDelete('shopproductattribute-1', $postData);\r\n\t\t} catch (Exception $e) {\r\n\t\t\t$this->assertEqual($e->getMessage(), 'You need to confirm to delete this Shop Product Attribute');\r\n\t\t}\r\n\r\n\t\t$postData = array(\r\n\t\t\t'ShopProductAttribute' => array(\r\n\t\t\t\t'confirm' => 1));\r\n\t\t$result = $this->ShopProductAttribute->validateAndDelete('shopproductattribute-1', $postData);\r\n\t\t$this->assertTrue($result);\r\n\t}",
"public function testDeleteDocumentWithValues()\n {\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertInstanceOf(EavDocument::class, $eavDocument);\n $documentId = $eavDocument->getId();\n\n $values = $eavDocument->getValues();\n\n $this->assertGreaterThan(0, $values->count());\n\n $this->em->remove($eavDocument);\n $this->em->flush();\n\n $eavDocument = $this->getEavDocumentRepo()->find($documentId);\n\n $this->assertNull($eavDocument);\n\n $eavValues = $this->getEavValueRepo()->findBy(['document' => $documentId]);\n\n $this->assertEmpty($eavValues);\n }",
"public function testOnDeletedDocumentWithIllegalArgumentException() {\n\n $obj = new FileSystemStorageProvider($this->logger, $this->directory);\n\n try {\n\n $obj->onDeletedDocument($this->dir1);\n } catch (Exception $ex) {\n\n $this->assertInstanceOf(IllegalArgumentException::class, $ex);\n $this->assertEquals(\"The document must be a document\", $ex->getMessage());\n }\n }",
"public function testUpdateDocumentValueFailed()\n {\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertInstanceOf(EavDocument::class, $eavDocument);\n $this->assertTrue($eavDocument->hasValue('customerId'));\n\n $eavDocument->setValue('customerId', '6789');\n $this->em->persist($eavDocument);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavDocument->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('customerId', (string) $violations);\n }",
"public function testDeleteUnsuccessfulReason()\n {\n }",
"public function testDeleteFail() {\n $this->delete('/api/author/100')\n ->seeJson(['message' => 'invalid request']);\n }",
"public function testValidateAndDelete() {\n\t\ttry {\n\t\t\t$postData = array();\n\t\t\t$this->CreditNote->validateAndDelete('invalidCreditNoteId', $postData);\n\t\t} catch (OutOfBoundsException $e) {\n\t\t\t$this->assertEqual($e->getMessage(), 'Invalid Credit Note');\n\t\t}\n\t\ttry {\n\t\t\t$postData = array(\n\t\t\t\t'CreditNote' => array(\n\t\t\t\t\t'confirm' => 0));\n\t\t\t$result = $this->CreditNote->validateAndDelete('creditnote-1', $postData);\n\t\t} catch (Exception $e) {\n\t\t\t$this->assertEqual($e->getMessage(), 'You need to confirm to delete this Credit Note');\n\t\t}\n\n\t\t$postData = array(\n\t\t\t'CreditNote' => array(\n\t\t\t\t'confirm' => 1));\n\t\t$result = $this->CreditNote->validateAndDelete('creditnote-1', $postData);\n\t\t$this->assertTrue($result);\n\t}",
"public function testDeleteInvalidImage() {\n\t\t//create an Image and try to delete it without actually inserting it\n\t\t$image = new Image(null, $this->VALID_IMAGEPATH, $this->VALID_IMAGETYPE);\n\t\t$image->delete($this->getPDO());\n\t}",
"public function testValidDelete() {\n\n\t\t//create a new organization, and insert into the database\n\t\t$organization = new Organization(null, $this->VALID_ADDRESS1, $this->VALID_ADDRESS2, $this->VALID_CITY, $this->VALID_DESCRIPTION,\n\t\t\t\t$this->VALID_HOURS, $this->VALID_NAME, $this->VALID_PHONE, $this->VALID_STATE, $this->VALID_TYPE, $this->VALID_ZIP);\n\t\t$organization->insert($this->getPDO());\n\n\t\t//perform the actual delete\n\t\t$response = $this->guzzle->delete('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/organization/' . $organization->getOrgId(),\n\t\t\t\t['headers' => ['X-XSRF-TOKEN' => $this->token]\n\t\t]);\n\n\t\t// grab the data from guzzle and enforce that the status codes are correct\n\t\t$this->assertSame($response->getStatusCode(), 200);\n\t\t$body = $response->getBody();\n\t\t$retrievedOrg = json_decode($body);\n\t\t$this->assertSame(200, $retrievedOrg->status);\n\n\t\t//try retrieving entry from database and ensuring it was deleted\n\t\t$deletedOrg = Organization::getOrganizationByOrgId($this->getPDO(), $organization->getOrgId());\n\t\t$this->assertNull($deletedOrg);\n\n\t}",
"private function del_validation(){\n\t\t$ret = true;\n\t\t$this->validation = Validation::factory($this->post)\n\t\t\t->rule('property_id', 'not_empty')\n\t\t\t->rule('property_id', 'digit')\n\t\t\t->rule('property_id', 'property_id', array(':validation', 'property_id'))\n\t\t;\n\t\tif($this->validation->check() === false){\n\t\t\t$this->arr_ret_error = array_merge($this->arr_ret_error, $this->validation->errors());\n\t\t\t$ret = false;\n\t\t}\n\t\treturn $ret;\n\t}",
"public function testDeleteInvalidAccess() {\n\t\t//create access and try to delete without actually inserting it\n\t\t$access = new Access(null, $this->VALID_ACCESSNAME);\n\t\t$access->delete($this->getPDO());\n\t}",
"public function testValidationFail() {\n $nbRecords = $this->Links->find('all')->count();\n //Build bad data with an empty token\n $badData = $this->goodData;\n $badData['title'] = '';\n\n $this->Links->save($this->Links->newEntity($badData));\n //Check no data has been inserted\n $this->assertEquals($nbRecords, $this->Links->find('all')->count(),\n 'Bad data has not been inserted');\n }",
"public function testValueValidationForUpdate()\n {\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);\n\n $this->assertNotNull($eavValue);\n\n $eavValue->setValue('not_existing_type');\n\n $this->em->persist($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(1, $violations);\n }",
"public function testInvalidDelete() {\n\t\t$response = $this->guzzle->delete('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/organization/' . BreadBasketTest::INVALID_KEY,\n\t\t\t\t['headers' => ['X-XSRF-TOKEN' => $this->token]\n\t\t]);\n\n\t\t//make sure the request returns the proper error code for a failed operation\n\t\t$body = $response->getBody();\n\t\t$retrievedOrg = json_decode($body);\n\t\t$this->assertSame(404, $retrievedOrg->status);\n\t}",
"public function testValidateFails()\n\t{\n\t\t$this->assertFalse(ArrayQuery::validate('testInvalid'));\n\t}",
"public function testQuestionDeleteWithValidData() {\n $response = $this->get('question/' . $this->question->id . '/delete');\n $this->assertEquals('200', $response->foundation->getStatusCode());\n $this->assertEquals('general.permission', $response->content->view);\n }",
"public function testDeleteException()\n\t{\n\t\t$name = new My_ShantyMongo_Name();\n\t\t$name->delete();\n\t}",
"public function testDeleteDocument()\n {\n }",
"public function testDelete_Error()\r\n\t{\r\n\t\t$this->http = new Client(['base_uri' => 'http://localhost/casecheckapp/public/index.php/']);\r\n\t\t\r\n\t\t$response = $this->http->delete('/api/v1/hospital/5', [ //Change ID here to a Hospital that isn't in the datastore'\r\n\t\t\t'http_errors' => false\r\n\t\t]);\r\n\t\r\n\t\t//Test invalid requests\r\n\t\t$this->assertEquals(405, $response->getStatusCode());\r\n\r\n\t\t//Stopping the connexion with Guzzle\r\n\t\t$this->http = null;\r\n\t\t\r\n\t}",
"public function testIsValidException()\n {\n $validator = new \\Magento\\Framework\\Validator\\Entity\\Properties();\n $validator->isValid([]);\n }",
"public function testDocumentIntegrityAfterValueInsertion()\n {\n $eavAttribute = $this->getEavAttrRepo()->findOneBy(['name' => 'supplierId']);\n\n $this->assertNotNull($eavAttribute);\n\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertNotNull($eavDocument);\n\n $eavValue = new EavValue();\n $eavValue->setAttribute($eavAttribute);\n $eavValue->setDocument($eavDocument);\n $eavValue->setValue(1234);\n $this->em->persist($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('supplierId', (string) $violations);\n }",
"public function testDeleteInvalidTag() {\n\t\t// create a Tag and try to delete it without actually inserting it\n\t\t$tag = new Tag(null, $this->VALID_TAGCONTENT);\n\t\t$tag->delete($this->getPDO());\n\t}",
"public function testDeleteMetadata1UsingDELETE()\n {\n }",
"public function testDeleteInvalidUser() {\n\t\t// create a Profile and try to delete it without actually inserting it\n\t\t$user = new User(null, $this->VALID_SALT, $this->VALID_HASH, $this->VALID_EMAIL, $this->VALID_NAME);\n\t\t$user->delete($this->getPDO());\n\t}",
"public function testRejectMatchingSuggestionsUsingDELETE()\n {\n }",
"public function testDelete()\n {\n $context = $this->createPageContext();\n $storage = $this->createStorage();\n $tokenStorage = $this->createTokenStorage();\n\n $layout1 = $storage->create();\n $layout2 = $storage->create();\n $layout3 = $storage->create();\n\n $context->addLayoutList([$layout1->getId(), $layout2->getId(), $layout3->getId()]);\n $token = $context->createEditToken([$layout1->getId(), $layout3->getId()], ['user_id' => 17]);\n $tokenString = $token->getToken();\n $tokenStorage->saveToken($token);\n\n // Save our editable instances\n $tokenStorage->update($tokenString, $layout1);\n $tokenStorage->update($tokenString, $layout3);\n\n // Validate that load still work\n $tokenStorage->loadToken($tokenString);\n $tokenStorage->loadMultiple($tokenString, [$layout1->getId(), $layout3->getId()]);\n\n // And now delete\n $tokenStorage->deleteAll($tokenString);\n\n try {\n $tokenStorage->loadToken($tokenString);\n $this->fail();\n } catch (InvalidTokenError $e) {\n $this->assertTrue(true);\n }\n try {\n $tokenStorage->loadMultiple($tokenString, [$layout1->getId()]);\n $this->fail();\n } catch (InvalidTokenError $e) {\n $this->assertTrue(true);\n }\n try {\n $tokenStorage->load($tokenString, $layout3->getId());\n $this->fail();\n } catch (InvalidTokenError $e) {\n $this->assertTrue(true);\n }\n }",
"public function testUserDeleteInvalidId()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/delete_user/1000')\n ->waitForText('Sorry, the page you are looking for could not be found.')\n ->assertSee('Sorry, the page you are looking for could not be found.');\n });\n }",
"public function testDeleteMetadata3UsingDELETE()\n {\n }",
"public function testDeleteMetadata2UsingDELETE()\n {\n }",
"public function testInvalidDelete() {\n\t\t$response =$this->guzzle->delete('http://bootcamp-coders.cnm.edu/~cberaun2/bread-basket/public_html/php/api/message/' . BreadBasketTest::INVALID_KEY, ['headers' => ['XRSF-TOKEN' => $this->token]]);\n\n\t\t//make sure the request returns the proper error code for the failed operation\n\t\t$body =$response->getBody();\n\t\t$retrievedMess = json_encode($body);\n\t\t$this->assertSame(404, $retrievedMess->status);\n\t}"
]
| [
"0.6575598",
"0.6536684",
"0.62905765",
"0.62607133",
"0.6235072",
"0.6176914",
"0.6174171",
"0.6168373",
"0.6158642",
"0.61577034",
"0.6135092",
"0.6107904",
"0.60938704",
"0.6034502",
"0.60340774",
"0.6000965",
"0.59548044",
"0.5922086",
"0.59037936",
"0.59010446",
"0.58868426",
"0.58558905",
"0.58404595",
"0.5831405",
"0.58246195",
"0.581832",
"0.58026737",
"0.57962376",
"0.5788451",
"0.5767124"
]
| 0.735781 | 0 |
Tests validation errors in case direct (without EavDocument preloading) EavValue insert operation | public function testDocumentIntegrityAfterValueInsertion()
{
$eavAttribute = $this->getEavAttrRepo()->findOneBy(['name' => 'supplierId']);
$this->assertNotNull($eavAttribute);
$eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);
$this->assertNotNull($eavDocument);
$eavValue = new EavValue();
$eavValue->setAttribute($eavAttribute);
$eavValue->setDocument($eavDocument);
$eavValue->setValue(1234);
$this->em->persist($eavValue);
try {
$this->em->flush();
} catch (\Exception $e) {
$this->assertInstanceOf(EavDocumentValidationException::class, $e);
}
$violations = $eavValue->getDocument()->getLastViolations();
$this->assertCount(1, $violations);
$this->assertContains('supplierId', (string) $violations);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testValidationFail() {\n $nbRecords = $this->Links->find('all')->count();\n //Build bad data with an empty token\n $badData = $this->goodData;\n $badData['title'] = '';\n\n $this->Links->save($this->Links->newEntity($badData));\n //Check no data has been inserted\n $this->assertEquals($nbRecords, $this->Links->find('all')->count(),\n 'Bad data has not been inserted');\n }",
"public function testValueValidationForUpdate()\n {\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);\n\n $this->assertNotNull($eavValue);\n\n $eavValue->setValue('not_existing_type');\n\n $this->em->persist($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(1, $violations);\n }",
"private function validateInsert() {\n\t\t$this->context->checkPermission(\\Scrivo\\AccessController::WRITE_ACCESS);\n\t\t// application id not 0\n\t}",
"public function testValidation()\n {\n $nbRecords = $this->Links->find('all')->count();\n\n $goodData = $this->goodData;\n //Check good data can be inserted\n $link = $this->Links->newEntity();\n $link = $this->Links->patchEntity($link, $goodData);\n $this->assertNotFalse($this->Links->save($link),\n 'Good data can be inserted');\n $this->assertEquals($nbRecords + 1, $this->Links->find('all')->count(),\n 'A new record is in DB');\n\n //And the data inserted is ok\n $data = $goodData;\n // Tokens are randomly generated, cannot be checked in this way\n unset($data['token']);\n unset($data['private_token']);\n $this->assertArraySubset($data,\n $this->Links->find('all')\n ->where(['Links.title =' => $goodData['title']])\n ->toArray()[0]->toArray(),\n 'The inserted data corresponds to what we expect');\n }",
"public function testUpdateDocumentValueFailed()\n {\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertInstanceOf(EavDocument::class, $eavDocument);\n $this->assertTrue($eavDocument->hasValue('customerId'));\n\n $eavDocument->setValue('customerId', '6789');\n $this->em->persist($eavDocument);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavDocument->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('customerId', (string) $violations);\n }",
"public function testValidation()\n {\n /*\n * setup\n */\n $before = $this->Table->find()->all()->count();\n\n /*\n * combination user_id and entry_id not unique\n */\n $data = ['entry_id' => 1, 'user_id' => 1];\n $bookmark = $this->Table->createBookmark($data);\n $errors = $bookmark->getErrors();\n $this->assertTrue(isset($errors['entry_id']['unique']));\n\n /*\n * entry-ID not set\n */\n $data = ['user_id' => 1];\n $bookmark = $this->Table->createBookmark($data);\n $errors = $bookmark->getErrors();\n $this->assertTrue(isset($errors['entry_id']));\n\n /*\n * user-ID not set\n */\n $data = ['entry_id' => 1];\n $bookmark = $this->Table->createBookmark($data);\n $errors = $bookmark->getErrors();\n $this->assertTrue(isset($errors['user_id']));\n\n /*\n * posting does not exist\n */\n $data = ['entry_id' => 9999, 'user_id' => 1];\n $bookmark = $this->Table->createBookmark($data);\n $errors = $bookmark->getErrors();\n $this->assertTrue(isset($errors['entry_id']['exists']));\n\n /*\n * posting does not exist\n */\n $data = ['entry_id' => 1, 'user_id' => 9999];\n $bookmark = $this->Table->createBookmark($data);\n $errors = $bookmark->getErrors();\n $this->assertTrue(isset($errors['user_id']['exists']));\n\n /*\n * post check\n */\n $after = $this->Table->find()->all()->count();\n $this->assertEquals($before, $after);\n }",
"public function testIsValidException()\n {\n $validator = new \\Magento\\Framework\\Validator\\Entity\\Properties();\n $validator->isValid([]);\n }",
"public function testContentErrors() {\n //Check the content is required\n $badData = $this->goodData;\n $badData['content'] = '';\n $this->assertFalse($this->Links->save($this->Links->newEntity($badData)));\n }",
"public function beforeSave()\n {\n $value = $this->getValue();\n try {\n $this->validate($value);\n } catch (\\Magento\\Framework\\Exception\\LocalizedException $e) {\n $msg = __('%1', $e->getMessage());\n $error = new \\Magento\\Framework\\Exception\\LocalizedException($msg, $e);\n throw $error;\n }\n }",
"public function testInsertInvalidTag() {\n\t\t// create a Tag with a non null tag id and watch it fail\n\t\t$tag = new Tag(DevConnectTest::INVALID_KEY, $this->VALID_TAGCONTENT);\n\t\t$tag->insert($this->getPDO());\n\t}",
"public function testValidateFails()\n\t{\n\t\t$this->assertFalse(ArrayQuery::validate('testInvalid'));\n\t}",
"public function testValidateDocumentAutodetectValidation()\n {\n }",
"public function testTitleErrors() {\n //Check the title is required\n $badData = $this->goodData;\n $badData['title'] = '';\n $this->assertFalse($this->Links->save($this->Links->newEntity($badData)));\n }",
"public function testValidInsertion()\n {\n try {\n $assetid = Asset::create('asset');\n $lastInsertId = DAL::lastInsertId('seq_assetid');\n\n PHPUnit_Framework_Assert::assertEquals($assetid, $lastInsertId);\n\n } catch (Exception $e) {\n PHPUnit_Framework_Assert::fail($e->getMessage().$e->getTraceAsString());\n }\n\n }",
"public function testValidateDocumentEmlValidation()\n {\n }",
"public function testDocumentIntegrityAfterManualValueDeletion()\n {\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => '123']);\n $this->em->remove($eavValue);\n\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);\n $this->em->remove($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(2, $violations);\n $this->assertContains('customerId', (string) $violations);\n $this->assertContains('customerDocumentType', (string) $violations);\n }",
"public function testInsertInvalidTag() {\n\t\t// Create a tag with a non null tag id and watch it fail\n\t\t$tag = new Tag(BrewCrewTest::INVALID_KEY, $this->VALID_TAG_LABEL);\n\t\t$tag->insert($this->getPDO());\n\t}",
"public function testInsertInvalidImage() {\n\t\t//create an Image with a non null ImageId and watch it fail\n\t\t$image = new Image(DevConnectTest::INVALID_KEY, $this->VALID_IMAGEPATH, $this->VALID_IMAGETYPE);\n\t\t$image->insert($this->getPDO());\n\t}",
"public function testInsertInvalidAccess() {\n\t\t//create a User with a non null access id and watch it fail\n\t\t$access = new Access(TimeCrunchersTest::INVALID_KEY, $this->VALID_ACCESSNAME);\n\t\t$access->insert($this->getPDO());\n\t}",
"function testInvalidFields () {\n \t$field1 = new SolrSimpleField('dummy1', 'foobar');\n \t$field2 = new Dummy();\n \t$doc = new SolrSimpleDocument(array($field1, $field2));\n }",
"public function testValidationDefaultCorrect()\r\n {\r\n $data = $this->getCorrectData();\r\n $oddit = $this->Oddits->newEntity($data);\r\n $this->assertEmpty($oddit->errors());\r\n }",
"public function testValidateDocumentDocValidation()\n {\n }",
"protected function preValidate() {}",
"public function testValidateSucceed()\n\t{\n\t\t$this->assertTrue(ArrayQuery::validate('test,valid'));\n\t}",
"protected function validateOrThrow() {}",
"public function testValidateDocumentJsonValidation()\n {\n }",
"public function testInsertInvalidScheduleItem() {\n // create a ScheduleItem with a non null scheduleItem id and watch it fail\n $scheduleItem = new ScheduleItem(5786,$this->VALID_SCHEDULE_ITEM_DESCRIPTION, $this->VALID_SCHEDULE_ITEM_NAME,$this->VALID_SCHEDULE_START_TIME, $this->VALID_SCHEDULE_END_TIME, $this->VALID_USER_ID);\n $scheduleItem->insert($this->getPDO());\n }",
"public function testEInsert()\n {\n $this->db->extendedInsert(\"test\", [\n 'id',\n 'name'\n ], [\n [\n 1,\n 'Ed'\n ],\n [\n 2,\n 'Frank'\n ]\n ]);\n $this->assertEquals(\"INSERT INTO test (`id`,`name`) VALUES ('1','Ed'),('2','Frank')\", (string) $this->db);\n }",
"public function testTokenErrors() {\n //Check the token is required ...\n $badData = $this->goodData;\n unset($badData['token']);\n $this->assertFalse($this->Links->save($this->Links->newEntity($badData)),\n 'Token is required');\n\n //.. and not empty\n $badData['token'] = '';\n $this->assertFalse($this->Links->save($this->Links->newEntity($badData)),\n 'Token is not empty');\n\n $goodData = $this->goodData;\n $goodData['title'] = 'titleTestTokenErrors';\n\n //Check tokens are unique\n $this->Links->save($this->Links->newEntity($goodData));\n $this->Links->save($this->Links->newEntity($goodData));\n $result = $this->Links->find(\"all\")\n ->where(['Links.title =' => $goodData['title']])\n ->toArray();\n $this->assertNotEquals($result[0]->token, $result[1]->token,\n 'Two similar links do not have same tokn');\n }",
"function testRegisterValidationFail() {\r\n $this->User = new User();\r\n \r\n \r\n //existing username\r\n $save = array();\r\n $save['User']['username'] = 'username';\r\n $save['User']['password'] = 'pass';\r\n $save['User']['email'] = '[email protected]';\r\n $save['User']['agb'] = 1;\r\n $result = $this->User->save($save);\r\n $this->assertFalse($result);\r\n \r\n //check if the expected fields are invalidated\r\n\t\t$fields = $this->_getInvalidFields($this->User);\r\n\t\t$this->assertTrue(in_array('username', $fields));\r\n\t\t\r\n\t\t\r\n //existing email\r\n $save = array();\r\n $save['User']['username'] = 'usernamenotexists';\r\n $save['User']['password'] = 'pass';\r\n $save['User']['email'] = '[email protected]';\r\n $save['User']['agb'] = 1;\r\n $result = $this->User->save($save);\r\n $this->assertFalse($result);\r\n \r\n //check if the expected fields are invalidated\r\n\t\t$fields = $this->_getInvalidFields($this->User);\r\n\t\t$this->assertTrue(in_array('username', $fields));\r\n \r\n \r\n //invalid username, invalid email, valid pass\r\n $save = array();\r\n $save['User']['username'] = '&%§\"jljl';\r\n $save['User']['password'] = 'pass';\r\n $save['User']['email'] = 'email';\r\n $save['User']['agb'] = 1;\r\n $result = $this->User->save($save);\r\n $this->assertFalse($result);\r\n \r\n //check if the expected fields are invalidated\r\n\t\t$fields = $this->_getInvalidFields($this->User);\r\n\t\t$this->assertTrue(in_array('username', $fields) && in_array('email', $fields));\r\n\r\n\r\n\t\t//valid username, valid email, invalid pass\r\n $save = array();\r\n $save['User']['username'] = 'valdiusername';\r\n $save['User']['password'] = 't'; //too short\r\n $save['User']['email'] = '[email protected]';\r\n $save['User']['agb'] = 1;\r\n $result = $this->User->save($save);\r\n $this->assertFalse($result);\r\n \r\n\t\t$fields = $this->_getInvalidFields($this->User);\r\n\t\t$this->assertTrue(in_array('password', $fields));\r\n\t\t\r\n\t\t\r\n\t\t//invalid email\r\n\t\t$save = array();\r\n $save['User']['username'] = 'valdiusername';\r\n $save['User']['password'] = 'validpass'; \r\n $save['User']['agb'] = 1;\r\n $save['User']['email'] = 'invalid'; \r\n $result = $this->User->save($save);\r\n $this->assertFalse($result);\r\n \r\n\t\t$fields = $this->_getInvalidFields($this->User);\r\n\t\t$this->assertTrue(in_array('email', $fields));\r\n }"
]
| [
"0.6821526",
"0.6552723",
"0.6447512",
"0.63398415",
"0.63216984",
"0.6243367",
"0.619487",
"0.61903214",
"0.61832076",
"0.6159579",
"0.6154985",
"0.6151074",
"0.61389196",
"0.61324835",
"0.6103811",
"0.60872823",
"0.6048609",
"0.60223943",
"0.5916946",
"0.59168804",
"0.5880291",
"0.5862586",
"0.58506894",
"0.58098656",
"0.57954824",
"0.57661784",
"0.5759136",
"0.5756543",
"0.5753923",
"0.5751068"
]
| 0.69107324 | 0 |
Tests validation errors in case direct (without EavDocument preloading) EavValue update operation | public function testValueValidationForUpdate()
{
$eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);
$this->assertNotNull($eavValue);
$eavValue->setValue('not_existing_type');
$this->em->persist($eavValue);
try {
$this->em->flush();
} catch (\Exception $e) {
$this->assertInstanceOf(EavDocumentValidationException::class, $e);
}
$violations = $eavValue->getDocument()->getLastViolations();
$this->assertCount(1, $violations);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testUpdateDocumentValueFailed()\n {\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertInstanceOf(EavDocument::class, $eavDocument);\n $this->assertTrue($eavDocument->hasValue('customerId'));\n\n $eavDocument->setValue('customerId', '6789');\n $this->em->persist($eavDocument);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavDocument->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('customerId', (string) $violations);\n }",
"public function testDocumentIntegrityAfterValueInsertion()\n {\n $eavAttribute = $this->getEavAttrRepo()->findOneBy(['name' => 'supplierId']);\n\n $this->assertNotNull($eavAttribute);\n\n $eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);\n\n $this->assertNotNull($eavDocument);\n\n $eavValue = new EavValue();\n $eavValue->setAttribute($eavAttribute);\n $eavValue->setDocument($eavDocument);\n $eavValue->setValue(1234);\n $this->em->persist($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(1, $violations);\n $this->assertContains('supplierId', (string) $violations);\n }",
"public function testIsValidException()\n {\n $validator = new \\Magento\\Framework\\Validator\\Entity\\Properties();\n $validator->isValid([]);\n }",
"public function testDocumentIntegrityAfterManualValueDeletion()\n {\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => '123']);\n $this->em->remove($eavValue);\n\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);\n $this->em->remove($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(2, $violations);\n $this->assertContains('customerId', (string) $violations);\n $this->assertContains('customerDocumentType', (string) $violations);\n }",
"public function beforeSave()\n {\n $value = $this->getValue();\n try {\n $this->validate($value);\n } catch (\\Magento\\Framework\\Exception\\LocalizedException $e) {\n $msg = __('%1', $e->getMessage());\n $error = new \\Magento\\Framework\\Exception\\LocalizedException($msg, $e);\n throw $error;\n }\n }",
"public function testValidateDocumentEmlValidation()\n {\n }",
"public function testIsValidFailed()\n {\n $this->_object->expects($this->once())->method('hasDataChanges')->will($this->returnValue(true));\n $this->_object->expects($this->once())->method('getData')->with('attr1')->will($this->returnValue(1));\n $this->_object->expects($this->once())->method('getOrigData')->with('attr1')->will($this->returnValue(2));\n\n $validator = new \\Magento\\Framework\\Validator\\Entity\\Properties();\n $validator->setReadOnlyProperties(['attr1']);\n $this->assertFalse($validator->isValid($this->_object));\n }",
"public function testValidateDocumentAutodetectValidation()\n {\n }",
"public function testValidateFails()\n\t{\n\t\t$this->assertFalse(ArrayQuery::validate('testInvalid'));\n\t}",
"public function test_if_failed_update()\n {\n }",
"public function testHandleUpdateValidationError()\n {\n // Populate data\n $this->_populate();\n \n // Request\n $response = $this->withSession($this->adminSession)\n ->call('POST', '/dealer-account/edit', $this->customDealerAccountData, [], [], ['HTTP_REFERER' => '/dealer-account/edit']);\n \n // Verify\n $this->assertRedirectedTo('/dealer-account/edit');\n $this->assertSessionHasErrors();\n }",
"protected function preValidate() {}",
"public function testEdit() {\r\n\t\t$result = $this->ShopProductAttribute->edit('shopproductattribute-1', null);\r\n\r\n\t\t$expected = $this->ShopProductAttribute->read(null, 'shopproductattribute-1');\r\n\t\t$this->assertEqual($result['ShopProductAttribute'], $expected['ShopProductAttribute']);\r\n\r\n\t\t// put invalidated data here\r\n\t\t$data = $this->record;\r\n\t\t//$data['ShopProductAttribute']['title'] = null;\r\n\r\n\t\t$result = $this->ShopProductAttribute->edit('shopproductattribute-1', $data);\r\n\t\t$this->assertEqual($result, $data);\r\n\r\n\t\t$data = $this->record;\r\n\r\n\t\t$result = $this->ShopProductAttribute->edit('shopproductattribute-1', $data);\r\n\t\t$this->assertTrue($result);\r\n\r\n\t\t$result = $this->ShopProductAttribute->read(null, 'shopproductattribute-1');\r\n\r\n\t\t// put record specific asserts here for example\r\n\t\t// $this->assertEqual($result['ShopProductAttribute']['title'], $data['ShopProductAttribute']['title']);\r\n\r\n\t\ttry {\r\n\t\t\t$this->ShopProductAttribute->edit('wrong_id', $data);\r\n\t\t\t$this->fail('No exception');\r\n\t\t} catch (OutOfBoundsException $e) {\r\n\t\t\t$this->pass('Correct exception thrown');\r\n\t\t}\r\n\t}",
"public function testValidationFail() {\n $nbRecords = $this->Links->find('all')->count();\n //Build bad data with an empty token\n $badData = $this->goodData;\n $badData['title'] = '';\n\n $this->Links->save($this->Links->newEntity($badData));\n //Check no data has been inserted\n $this->assertEquals($nbRecords, $this->Links->find('all')->count(),\n 'Bad data has not been inserted');\n }",
"function validate_on_update() {}",
"public function testValidateFormFailure()\n {\n $formData = 10;\n $validation = GRUB\\Validator\\Validator::validateIngredient($formData);\n $expected = 10;\n $this->assertEquals($validation, $expected);\n }",
"public function testSetRawAttributeFailed()\n {\n $eavDocument = new EavDocument();\n $eavValue = new EavValue();\n\n $eavDocument->setRawEavValue($eavValue);\n }",
"public function testHandleUpdateValidationError()\n {\n // Populate data\n $this->_populate();\n \n // Request\n $response = $this->withSession($this->adminSession)\n ->call('POST', '/branch/edit', $this->customBranchData, [], [], ['HTTP_REFERER' => '/branch/edit']);\n \n // Verify\n $this->assertRedirectedTo('/branch/edit');\n $this->assertSessionHasErrors();\n }",
"protected function _validate() {\n\t}",
"protected function validate()\r\n\t{\r\n\t\tif (!$this->isFetched())\r\n\t\t{\r\n\t\t\treturn;\r\n }\r\n \r\n\t\tif ($this->validationInfo)\r\n\t\t{\r\n\t\t\t$this->validationInfo->validate($this->normalizedValue);\r\n\t\t}\r\n\t\t$this->isValid = true;\r\n\t}",
"public function beforeSave()\n {\n $this->setParams([\n 'url' => $this->getValue(),\n 'apiKey' => $this->getFieldsetDataValue('api_key'),\n 'version' => $this->getFieldsetDataValue('api_version')\n ]);\n\n if (!$this->isUrl($this->getValue())) {\n throw new \\Magento\\Framework\\Exception\\ValidatorException(__('Invalid CRM url'));\n }\n\n if (!$this->isHttps($this->getValue())) {\n $this->schemeEdit($this->getValue());\n }\n\n if ($this->validateApiUrl($this->api)) {\n $this->setValue($this->getValue());\n }\n\n parent::beforeSave();\n }",
"public function testValidateDocumentDocValidation()\n {\n }",
"function testValidationParams() {\n\t\t$TestModel =& new ValidationTest();\n\t\t$TestModel->validate['title'] = array('rule' => 'customValidatorWithParams', 'required' => true);\n\t\t$TestModel->create(array('title' => 'foo'));\n\t\t$TestModel->invalidFields();\n\n\t\t$expected = array(\n\t\t\t'data' => array('title' => 'foo'),\n\t\t\t'validator' => array(\n\t\t\t\t'rule' => 'customValidatorWithParams', 'on' => null,\n\t\t\t\t'last' => false, 'allowEmpty' => false, 'required' => true\n\t\t\t),\n\t\t\t'or' => true,\n\t\t\t'ignore_on_same' => 'id'\n\t\t);\n\t\t$this->assertEqual($TestModel->validatorParams, $expected);\n\n\t\t$TestModel->validate['title'] = array('rule' => 'customValidatorWithMessage', 'required' => true);\n\t\t$expected = array('title' => 'This field will *never* validate! Muhahaha!');\n\t\t$this->assertEqual($TestModel->invalidFields(), $expected);\n\t}",
"protected function validateOrThrow() {}",
"public function testInvalidConfig(): void\n {\n $result = $this->check->run('Books', [ 'icon_bad_values' => ['cube'], 'display_field_bad_values' => [\"title2\"] ]);\n $result = $this->check->getErrors();\n\n $this->assertTrue(is_array($result), \"getErrors() returned a non-array result\");\n $this->assertContains('[Books][config] parse : [/table/icon]: Matched a schema which it should not', $result);\n $this->assertContains('[Books][config] parse : [/table/display_field]: Matched a schema which it should not', $result);\n }",
"public function testValueValid() {\n $config = [\n 'success' => 1,\n 'data' => 'example'\n ];\n $this->assertEmpty($this->getValidator()->validate($config));\n }",
"private function validateUpdate() {\n\t\t$this->context->checkPermission(\\Scrivo\\AccessController::WRITE_ACCESS);\n\t}",
"public function testGetErrorMessagesAfterValidationFailure()\n {\n $this->validator->isValid(-211);\n $this->assertCount(1, $this->validator->errors());\n }",
"public function checkIsValidForUpdate() {\n $errors = array();\n\n if (strlen($this->phone) >0 && !is_numeric($this->phone)){\n $errors[\"phone\"] = i18n(\"You must write a valid phone number\");\n }\n if (strlen($this->phone) < 1) {\n $errors[\"phone\"] = i18n(\"You must write a valid phone number\");\n }\n try{\n $this->checkIsValidForCreate();\n }catch(ValidationException $ex) {\n foreach ($ex->getErrors() as $key=>$error) {\n $errors[$key] = $error;\n }\n }\n if (sizeof($errors) > 0) {\n throw new ValidationException($errors, \"User is not valid\");\n }\n }",
"public function testSaveUpdate()\n {\n $user = User::findOne(1002);\n $version = Version::findOne(1001);\n\n $this->specify('Error update attempt', function () use ($user, $version) {\n $data = [\n 'scenario' => VersionForm::SCENARIO_UPDATE,\n 'title' => 'Some very long title...Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam dignissim, lorem in bibendum.',\n 'type' => Version::TYPE_TABLET,\n 'subtype' => 31,\n 'retinaScale' => false,\n 'autoScale' => 'invalid_value',\n ];\n $model = new VersionForm($user, $data);\n\n $result = $model->save($version);\n $version->refresh();\n\n verify('Model should not succeed', $result)->null();\n verify('Model should have errors', $model->errors)->notEmpty();\n verify('Title error message should be set', $model->errors)->hasKey('title');\n verify('ProjectId error message should not be set', $model->errors)->hasntKey('projectId');\n verify('Type error message should not be set', $model->errors)->hasntKey('type');\n verify('Subtype error message should be set', $model->errors)->hasKey('subtype');\n verify('AutoScale error message should be set', $model->errors)->hasKey('autoScale');\n verify('RetinaScale error message should not be set', $model->errors)->hasntKey('retinaScale');\n verify('Version title should not change', $version->title)->notEquals($data['title']);\n verify('Version type should not be changed', $version->type)->notEquals($data['type']);\n verify('Version subtype should not be changed', $version->subtype)->notEquals($data['subtype']);\n });\n\n $this->specify('Success update attempt', function () use ($user, $version) {\n $data = [\n 'scenario' => VersionForm::SCENARIO_UPDATE,\n 'projectId' => 1003, // should be ignored\n 'title' => 'My new test version title',\n 'type' => Version::TYPE_MOBILE,\n 'subtype' => 31,\n 'retinaScale' => true,\n 'autoScale' => true,\n ];\n $model = new VersionForm($user, $data);\n\n $result = $model->save($version);\n\n verify('Model should succeed and return an instance of Version', $result)->isInstanceOf(Version::className());\n verify('Model should not has any errors', $model->errors)->isEmpty();\n verify('The returned Version should be the same as the updated one', $result->id)->equals($version->id);\n verify('Version projectId should not change', $result->projectId)->notEquals($data['projectId']);\n verify('Version title should match', $result->title)->equals($data['title']);\n verify('Version type should match', $result->type)->equals($data['type']);\n verify('Version subtype should match', $result->subtype)->equals($data['subtype']);\n verify('Version scaleFactor should match', $result->scaleFactor)->equals(Version::AUTO_SCALE_FACTOR);\n });\n }"
]
| [
"0.73958814",
"0.6490489",
"0.6309547",
"0.62958384",
"0.620007",
"0.61726093",
"0.61696255",
"0.61566377",
"0.6146251",
"0.6106605",
"0.60515463",
"0.59927195",
"0.59907347",
"0.59758717",
"0.5971213",
"0.5963221",
"0.59443307",
"0.590058",
"0.58937794",
"0.5877421",
"0.583971",
"0.58323514",
"0.57990277",
"0.57874835",
"0.57643557",
"0.576399",
"0.57593656",
"0.5751757",
"0.5742137",
"0.5740939"
]
| 0.7535972 | 0 |
Test deletion of the document with related values | public function testDeleteDocumentWithValues()
{
$eavDocument = $this->getEavDocumentRepo()->findOneBy(['path' => 'some/path/to/bucket/document1.pdf']);
$this->assertInstanceOf(EavDocument::class, $eavDocument);
$documentId = $eavDocument->getId();
$values = $eavDocument->getValues();
$this->assertGreaterThan(0, $values->count());
$this->em->remove($eavDocument);
$this->em->flush();
$eavDocument = $this->getEavDocumentRepo()->find($documentId);
$this->assertNull($eavDocument);
$eavValues = $this->getEavValueRepo()->findBy(['document' => $documentId]);
$this->assertEmpty($eavValues);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testDocumentIntegrityAfterManualValueDeletion()\n {\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => '123']);\n $this->em->remove($eavValue);\n\n $eavValue = $this->getEavValueRepo()->findOneBy(['value' => 'customer_invoice']);\n $this->em->remove($eavValue);\n\n try {\n $this->em->flush();\n } catch (\\Exception $e) {\n $this->assertInstanceOf(EavDocumentValidationException::class, $e);\n }\n\n $violations = $eavValue->getDocument()->getLastViolations();\n\n $this->assertCount(2, $violations);\n $this->assertContains('customerId', (string) $violations);\n $this->assertContains('customerDocumentType', (string) $violations);\n }",
"public function testDeleteDocument()\n {\n }",
"public function testDelete()\n {\n if (! $this->_url) $this->markTestSkipped(\"Test requires a CouchDb server set up - see TestConfiguration.php\");\n $db = $this->_setupDb();\n \n $db->create(array('a' => 1), 'mydoc');\n \n // Make sure document exists in DB\n $doc = $db->retrieve('mydoc');\n $this->assertType('Sopha_Document', $doc);\n \n // Delete document\n $ret = $db->delete('mydoc', $doc->getRevision());\n \n // Make sure return value is true\n $this->assertTrue($ret);\n \n // Try to fetch doc again \n $this->assertFalse($db->retrieve('mydoc'));\n \n $this->_teardownDb();\n }",
"public function testDeleteDocument()\n {\n echo \"\\nTesting subject deletion...\";\n $id = \"0\";\n \n //$url = TestServiceAsReadOnly::$elasticsearchHost . \"/CIL_RS/index.php/rest/documents/\".$id;\n $url = TestServiceAsReadOnly::$elasticsearchHost .$this->context.\"/documents/\".$id;\n \n $response = $this->curl_delete($url);\n // echo $response;\n $json = json_decode($response);\n $this->assertTrue(!$json->success);\n }",
"public function testDelete()\n {\n // test data\n $this->fixture->query('INSERT INTO <http://example.com/> {\n <http://s> <http://p1> \"baz\" .\n <http://s> <http://xmlns.com/foaf/0.1/name> \"label1\" .\n }');\n\n $res = $this->fixture->query('SELECT * WHERE {?s ?p ?o.}');\n $this->assertEquals(2, \\count($res['result']['rows']));\n\n // remove graph\n $this->fixture->delete(false, 'http://example.com/');\n\n $res = $this->fixture->query('SELECT * WHERE {?s ?p ?o.}');\n $this->assertEquals(0, \\count($res['result']['rows']));\n }",
"public function testDelete()\n {\n $dataLoader = $this->getDataLoader();\n $data = $dataLoader->getOne();\n $this->deleteTest($data['user']);\n }",
"public function testDelete()\n\t{\n\t\t$obj2 = $this->setUpObj();\n\t\t$response = $this->call('DELETE', '/'.self::$endpoint.'/'.$obj2->id);\n\t\t$this->assertEquals(200, $response->getStatusCode());\n\t\t$result = $response->getOriginalContent()->toArray();\n\n\t\t// tes apakah sudah terdelete\n\t\t$response = $this->call('GET', '/'.self::$endpoint.'/'.$obj2->id);\n\t\t$this->assertEquals(500, $response->getStatusCode());\n\n\t\t// tes apakah hasil return adalah yang sesuai\n\t\tforeach ($obj2->attributesToArray() as $key => $val) {\n\t\t\t$this->assertArrayHasKey($key, $result);\n\t\t\tif (isset($result[$key])&&($key!='created_at')&&($key!='updated_at'))\n\t\t\t\t$this->assertEquals($val, $result[$key]);\n\t\t}\n\t}",
"public function testOnDeletedDocument() {\n\n $obj = new FileSystemStorageProvider($this->logger, $this->directory);\n\n $obj->onDeletedDocument($this->doc1);\n $this->assertFileNotExists($this->directory . \"/1/2/4\");\n }",
"public function testDeleteDocument($name, $fields, $expectedValues)\n {\n $crud = new Enumerates();\n $crud->setUrlParameters(array(\n \"familyId\" => $name\n ));\n try {\n $crud->delete(null);\n $this->assertFalse(true, \"An exception must occur\");\n }\n catch(DocumentException $exception) {\n $this->assertEquals(501, $exception->getHttpStatus());\n }\n }",
"public function testDeleteMetadata2UsingDELETE()\n {\n }",
"public function testDeleteMetadata1UsingDELETE()\n {\n }",
"function documents_civicrm_pre( $op, $objectName, $id, &$params ) {\n $repo = CRM_Documents_Entity_DocumentRepository::singleton();\n if ($objectName == 'Individual' || $objectName == 'Household' || $objectName == 'Organization') {\n if ($op == 'delete') {\n try {\n $contact = civicrm_api3('Contact', 'getsingle', array('contact_id' => $id, 'is_deleted' => '1'));\n //contact is in trash so this deletes the contact permanenty\n $docs = $repo->getDocumentsByContactId($id);\n foreach($docs as $doc) {\n $doc->removeContactId($id);\n $repo->persist($doc);\n }\n } catch (Exception $e) {\n //contact not found, or contact is in transh\n }\n }\n }\n \n if ($op == 'delete') {\n $refspec = CRM_Documents_Utils_EntityRef::singleton();\n $ref = $refspec->getRefByObjectName($objectName);\n if ($ref) {\n $documents = $repo->getDocumentsByEntityId($ref->getEntityTableName(), $id);\n foreach($documents as $doc) {\n $entity = new CRM_Documents_Entity_DocumentEntity($doc);\n $entity->setEntityId($id);\n $entity->setEntityTable($ref->getEntityTableName());\n $doc->removeEntity($entity);\n \n $repo->persist($doc);\n }\n }\n }\n}",
"public function testIsRemoveContentRelationed()\n {\n // 1. Create Page 1\n $page1 = $this->createPage();\n\n $pageId = $page1->id;\n\n // 2. Create Page 2 with content relation\n $attributes = $this->attributes['page'];\n $attributes['fields'][] = [\n 'identifier' => 'content',\n 'type' => 'contents',\n 'value' => [\n ['id' => $pageId]\n ]\n ];\n $page2 = $this->createPage($attributes);\n\n // 3. Remove page 1\n (new DeleteContent($page1))->handle();\n\n // 4. Test page 2 fields\n $page2 = Content::find(2);\n\n $contentId = $page2->field('content') ? $page2->field('content')->value : null;\n\n $this->assertNotEquals($pageId, $contentId);\n }",
"public function deleteTest()\n {\n $this->assertEquals(true, $this->object->delete(1));\n }",
"public function delete() {\n // Find document ID.\n if (!$this->find()) {\n debugging('Failed to find ousearch document');\n return false;\n }\n self::wipe_document($this->id);\n }",
"public function testDeleteConditions() {\n $this->loadFixtures('Users', 'Profiles');\n\n $this->assertSame(5, User::total());\n $this->assertSame(3, User::deleteMany(function(Query $query) {\n $query->where('age', '>', 30);\n }));\n $this->assertSame(2, User::total());\n }",
"public function testQuarantineDeleteById()\n {\n\n }",
"public function deleteDocument() {\n\n // should get instance of model and run delete-function\n\n // softdeletes-column is found inside database table\n\n return redirect('/home');\n }",
"public function delete() {\n\t\t$delete_array = array();\n\t\tif ($this->getIdType() === self::ID_TYPE_MONGO) {\n\t\t\t$delete_array['_id'] = new \\MongoId($this->getId());\n\t\t} else {\n\t\t\t$delete_array['_id'] = $this->getId();\n\t\t}\n\t\t$rows_affected = $this->getCollection()->remove($delete_array);\n\t\treturn $rows_affected;\n\t}",
"public function testDeleted()\n {\n // Make a tag, then request it's deletion\n $tag = $this->resources->tag();\n $result = $this->writedown->getService('api')->tag()->delete($tag->id);\n\n // Attempt to grab the tag from the database\n $databaseResult = $this->writedown->getService('entityManager')\n ->getRepository('ByRobots\\WriteDown\\Database\\Entities\\Tag')\n ->findOneBy(['id' => $tag->id]);\n\n $this->assertTrue($result['success']);\n $this->assertNull($databaseResult);\n }",
"protected function _postDelete() {}",
"protected function _postDelete() {}",
"function test_treatments_can_be_deleted_true()\n {\n $this->seed();\n \n $user = User::where('email', '=', '[email protected]')->first();\n\n $treatments = Treatment::factory()\n ->count(3)\n ->for($user)\n ->create();\n $treatment = Treatment::first();\n \n $token = JWTAuth::fromUser($user);\n $response = $this->json('DELETE', '/api/treatments/'.$treatment->id.'?token='.$token);\n $response->assertNoContent();\n }",
"public function testDelete()\n {\n $model = $this->makeFactory();\n $model->save();\n\n $this->json('DELETE', static::ROUTE . '/' . $model->id, [], [\n 'Authorization' => 'Token ' . self::getToken()\n ])\n ->seeStatusCode(JsonResponse::HTTP_NO_CONTENT);\n }",
"public function testDelete() {\n $this->loadFixtures('Users');\n\n $last = User::select()->orderBy('_id', 'asc')->first();\n $user = User::find($last->_id);\n\n $this->assertTrue($user->exists());\n $this->assertSame(1, $user->delete(false));\n $this->assertFalse($user->exists());\n }",
"public function testExample()\n {\n $car = \\App\\Car::find(32);\n $delete= $car->delete();\n $this->assertTrue($delete);\n\n }",
"public function testDelete()\n {\n // save to cache\n $saveSearchCriteria = $this->searchCriteriaBuilder\n ->setContextName('cloud')\n ->setEntityName('customer')\n ->setFieldList(['id', 'name'])\n ->setIdName('id')\n ->build();\n\n $data = [['id' => 60, 'name' => 'Sergii']];\n\n $actualSave = $this->cacheManager->save($saveSearchCriteria, $data);\n $this->assertTrue($actualSave);\n\n // delete\n $searchCriteria = $this->searchCriteriaBuilder\n ->setContextName('cloud')\n ->setEntityName('customer')\n ->setIdList([60])\n ->setIdName('id')\n ->build();\n\n $this->cacheManager->delete($searchCriteria);\n\n // search\n $searchResult = $this->cacheManager->search($searchCriteria);\n $this->assertFalse($searchResult->hasData());\n $this->assertEquals(0, $searchResult->count());\n $this->assertCount(1, $searchResult->getMissedData());\n }",
"public function testDeleteMetadata3UsingDELETE()\n {\n }",
"public function testDelete()\n {\n $this->clientAuthenticated->request('DELETE', '/invoice/delete/' . self::$objectId);\n $response = $this->clientAuthenticated->getResponse();\n $this->assertJsonResponse($response, 200);\n\n //Deletes physically the entity created by test\n $this->deleteEntity('Invoice', 'invoiceId', self::$objectId);\n }",
"public function testDeleteCampaignFromPromotionUsingDELETE()\n {\n }"
]
| [
"0.6988896",
"0.6979224",
"0.6957141",
"0.6836654",
"0.6639289",
"0.6561544",
"0.6442095",
"0.6435984",
"0.6400958",
"0.6383823",
"0.6330451",
"0.63080156",
"0.62951434",
"0.6287781",
"0.6285269",
"0.627901",
"0.6265377",
"0.6254168",
"0.6242549",
"0.6241753",
"0.6215747",
"0.62156796",
"0.6193144",
"0.61910486",
"0.6145067",
"0.6127925",
"0.61244124",
"0.6114694",
"0.61095315",
"0.6101868"
]
| 0.707446 | 0 |
Provides an ArrayCollection of Fixtures that should be loaded for the test | protected static function getFixtures()
{
return new ArrayCollection([
new EavTypeFixture(),
new EavAttributeFixture(),
]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract protected function getFixtures();",
"public function _fixtures()\n {\n return [\n 'user' => [\n 'class' => AdminUserFixture::class,\n 'dataFile' => codecept_data_dir() . 'admin_user.php',\n ],\n 'auth' => [\n 'class' => AuthItemFixture::class,\n 'dataFile' => codecept_data_dir() . 'auth_data.php',\n ],\n 'auth_child' => [\n 'class' => AuthItemChildFixture::class,\n 'dataFile' => codecept_data_dir() . 'auth_child_data.php',\n ],\n 'authAssignment' => [\n 'class' => AuthAssignmentFixture::class,\n 'dataFile' => codecept_data_dir() . 'auth_assigment_data.php',\n ],\n 'category' => [\n 'class' => CategoryFixture::class,\n 'dataFile' => codecept_data_dir() . 'category_data.php',\n ],\n 'category_company_type' => [\n 'class' => CategoryCompanyTypeFixture::class,\n 'dataFile' => codecept_data_dir() . 'category_company_type_data.php',\n ],\n 'company_type' => [\n 'class' => CompanyTypeFixture::class,\n 'dataFile' => codecept_data_dir() . 'company_type_data.php',\n ],\n\n ];\n }",
"protected static function getDataFixtures()\n {\n return array(\n new LoadTestUser(),\n new LoadSuperUser(),\n );\n }",
"public function setupFixtures()\n {\n if ($this->_fixtures === null) {\n $loadedFixtures = [];\n foreach ($this->fixtures() as $fixtureClass) {\n $loadedFixtures[$fixtureClass] = Yii::createObject($fixtureClass);\n }\n\n $this->_fixtures = $loadedFixtures;\n }\n }",
"protected function getFixtures()\n {\n return array(\n __DIR__ . '/card.yml',\n );\n }",
"protected function getFixtures()\n {\n return array(\n // __DIR__ . '/../../Resources/fixtures/majora_entitys.yml',\n );\n }",
"public function fixtures() \n {\n return [\n 'categories' => CategoryFixture::className(),\n ];\n }",
"protected function getFixtures()\n {\n return array(\n __DIR__ . '/../../Resources/fixtures/BlogArticle.yml',\n );\n }",
"public function _fixtures()\n {\n return [\n 'user' => [\n 'class' => BookFixture::class,\n 'dataFile' => codecept_data_dir() . 'book.php'\n ],\n ];\n }",
"public function _fixtures()\n\t{\n\t\treturn [\n\t\t\t'user' => [\n\t\t\t\t'class' => UserFixture::className(),\n\t\t\t\t'dataFile' => codecept_data_dir() . 'login_data.php'\n\t\t\t],\n\t\t\t'models' => [\n\t\t\t\t'class' => ModelsFixture::className(),\n\t\t\t\t'dataFile' => codecept_data_dir() . 'models.php'\n\t\t\t],\n\t\t\t'files' => [\n\t\t\t\t'class' => FilesFixture::className(),\n\t\t\t\t'dataFile' => codecept_data_dir() . 'files.php'\n\t\t\t]\n\n\t\t];\n\t}",
"public function _fixtures()\n {\n return [\n 'user' => [\n 'class' => TicketsFixture::className(),\n 'dataFile' => codecept_data_dir() . 'tickets.php'\n ]\n ];\n }",
"public function testFixtureLoadOnDemand(): void\n {\n $this->loadFixtures('Categories');\n }",
"public function getAllFixtures() { \r\n $uri = $this->payload->_links->fixtures->href;\r\n $response = file_get_contents($uri, false, stream_context_create($this->reqPrefs)); \r\n \r\n return json_decode($response);\r\n }",
"public function _fixtures()\n {\n return [\n\n 'base_date' => [\n 'class' => BaseDataFixture::class,\n 'dataFile' => codecept_data_dir() . 'base_data_data.php',\n ],\n\n ];\n }",
"public function testLoadWithCollection() {\n\t\t$options = $this->_loadOptions;\n\t\t$posts = Fixture::load('models/Posts', $options);\n\t\t$this->_testLoad($posts);\n\t}",
"public function testLoadAllFixtures(): void\n {\n $this->loadFixtures();\n $article = $this->getTableLocator()->get('Articles')->get(1);\n $this->assertSame(1, $article->id);\n $category = $this->getTableLocator()->get('Categories')->get(1);\n $this->assertSame(1, $category->id);\n }",
"private function getFixturesFromRegistry() : array\n {\n $fixtureRegistry = $this->getObjectManager()->create(FixtureRegistry::class);\n $fixtures = [];\n foreach ($fixtureRegistry->getFixtures() as $fixtureClassName) {\n $fixtures[] = $this->getObjectManager()->create(\n $fixtureClassName,\n ['fixtureModel' => $this]\n );\n }\n return $fixtures;\n }",
"protected function createFixtures()\n {\n // Due to a dubious bug(?) in doctrine - product types need to be loaded first.\n $typeFixtures = new LoadProductTypes();\n $typeFixtures->load($this->entityManager);\n $this->productType = $this->getProductTypeRepository()->find(self::PRODUCT_TYPE_ID);\n $this->addonProductType = $this->getProductTypeRepository()->find(self::PRODUCT_TYPE_ADDON_ID);\n\n $countries = new LoadCountries();\n $countries->load($this->entityManager);\n\n $this->contactTestData = new ContactTestData($this->container);\n\n $loadCurrencies = new LoadCurrencies();\n $loadCurrencies->load($this->entityManager);\n\n $this->currency = $this->getCurrencyRepository()->findByCode($this->defaultCurrencyCode);\n\n $unitFixtures = new LoadUnits();\n $unitFixtures->load($this->entityManager);\n $this->orderUnit = $this->getProductUnitRepository()->find(self::ORDER_UNIT_ID);\n\n $this->contentUnit = $this->getProductUnitRepository()->find(self::CONTENT_UNIT_ID);\n\n $taxClasses = new LoadTaxClasses();\n $taxClasses->load($this->entityManager);\n $this->taxClass = $this->getTaxClassRepository()->find(self::TAX_CLASS_ID);\n\n $countryTaxes = new LoadCountryTaxes();\n $countryTaxes->load($this->entityManager);\n\n $collectionTypes = new LoadCollectionTypes();\n $collectionTypes->load($this->entityManager);\n\n $mediaTypes = new LoadMediaTypes();\n $mediaTypes->load($this->entityManager);\n\n $attributeTypes = new LoadAttributeTypes();\n $attributeTypes->load($this->entityManager);\n $this->attributeType = $this->getAttributeTypeRepository()->find(self::ATTRIBUTE_TYPE_ID);\n\n $statusFixtures = new LoadProductStatuses();\n $statusFixtures->load($this->entityManager);\n $this->productStatus = $this->getProductStatusRepository()->find(Status::ACTIVE);\n $this->productStatusChanged = $this->getProductStatusRepository()->find(Status::CHANGED);\n $this->productStatusImported = $this->getProductStatusRepository()->find(Status::IMPORTED);\n $this->productStatusSubmitted = $this->getProductStatusRepository()->find(Status::SUBMITTED);\n\n $deliveryStatusFixtures = new LoadDeliveryStatuses();\n $deliveryStatusFixtures->load($this->entityManager);\n }",
"public function _fixtures()\n {\n return [\n 'user' => [\n 'class' => UserFixture::className(),\n 'dataFile' => codecept_data_dir() . 'login_data.php',\n ],\n ];\n }",
"public function setUp()\n\t{\n\t\tparent::setUp();\n if(is_array($this->fixtures)){\n foreach($this->fixtures as $fixtureName=>$modelClass)\n {\n $tableName=WF_Table::model($modelClass)->tableName();\n $this->resetTable($tableName);\n $rows=$this->loadFixtures($modelClass, $tableName);\n if(is_array($rows) && is_string($fixtureName))\n {\n $this->_rows[$fixtureName]=$rows;\n if(isset($modelClass))\n {\n foreach(array_keys($rows) as $alias)\n $this->_records[$fixtureName][$alias]=$modelClass;\n }\n }\n }\n }\n }",
"private function myLoadFixtures()\n {\n $em = $this->getDatabaseManager();\n\n // load fixtures\n $client = static::createClient();\n $classes = array(\n // classes implementing Doctrine\\Common\\DataFixtures\\FixtureInterface\n 'Demofony2\\AppBundle\\DataFixtures\\ORM\\FixturesLoader',\n );\n\n $this->loadFixtures($classes);\n }",
"function getUserFixtures() {\n\t\t$proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?', true), array('y','n'), 'n');\n\t\t$fixtures = array();\n\t\tif (strtolower($proceed) == 'y') {\n\t\t\t$fixtureList = $this->in(__(\"Please provide a comma separated list of the fixtures names you'd like to use.\\nExample: 'app.comment, app.post, plugin.forums.post'\", true));\n\t\t\t$fixtureListTrimmed = str_replace(' ', '', $fixtureList);\n\t\t\t$fixtures = explode(',', $fixtureListTrimmed);\n\t\t}\n\t\t$this->_fixtures = array_merge($this->_fixtures, $fixtures);\n\t\treturn $fixtures;\n\t}",
"public function getDependencies()\n {\n return [CategoryFixtures::class];\n }",
"public function loadFixtures(array $fixtureNames): array\n {\n static $cachedFixtures = [];\n\n $fixtures = [];\n foreach ($fixtureNames as $fixtureName) {\n if (str_contains($fixtureName, '.')) {\n [$type, $pathName] = explode('.', $fixtureName, 2);\n $path = explode('/', $pathName);\n $name = array_pop($path);\n $additionalPath = implode('\\\\', $path);\n\n if ($type === 'core') {\n $baseNamespace = 'Cake';\n } elseif ($type === 'app') {\n $baseNamespace = Configure::read('App.namespace');\n } elseif ($type === 'plugin') {\n [$plugin, $name] = explode('.', $pathName);\n $baseNamespace = str_replace('/', '\\\\', $plugin);\n $additionalPath = null;\n } else {\n $baseNamespace = '';\n $name = $fixtureName;\n }\n\n if (strpos($name, '/') > 0) {\n $name = str_replace('/', '\\\\', $name);\n }\n\n $nameSegments = [\n $baseNamespace,\n 'Test\\Fixture',\n $additionalPath,\n $name . 'Fixture',\n ];\n /** @var class-string<\\Cake\\Datasource\\FixtureInterface> $className */\n $className = implode('\\\\', array_filter($nameSegments));\n } else {\n /** @var class-string<\\Cake\\Datasource\\FixtureInterface> $className */\n $className = $fixtureName;\n }\n\n if (isset($fixtures[$className])) {\n throw new UnexpectedValueException(sprintf('Found duplicate fixture `%s`.', $fixtureName));\n }\n\n if (!class_exists($className)) {\n throw new UnexpectedValueException(sprintf('Could not find fixture `%s`.', $fixtureName));\n }\n\n if (!isset($cachedFixtures[$className])) {\n $cachedFixtures[$className] = new $className();\n }\n\n $fixtures[$className] = $cachedFixtures[$className];\n }\n\n return $fixtures;\n }",
"public function getLoadedFixtures()\r\n {\r\n $fixtures = [];\r\n\r\n foreach($this->repositories as $fixtureClassName => $fixtureList)\r\n {\r\n foreach($fixtureList as $fixture)\r\n {\r\n /** Merge fixtures from all currently loaded classes. */\r\n $fixtures = array_merge($fixtures, $fixture->getLoadedFixtures());\r\n }\r\n }\r\n\r\n return $fixtures;\r\n }",
"protected function fixtureData() {\n\t\t$rows = array();\n\t\tfor($i = 0; $i < 50; $i++) {\n\t\t\t$rows[] = array(\n\t\t\t\t\"name\" => \"Test Item \".$i,\n\t\t\t\t\"popularity\" => $i,\n\t\t\t\t\"author\" => \"Test Author \".$i,\n\t\t\t\t\"description\" => str_repeat(\"lorem ipsum dolor est \",rand(3,20)),\n\n\t\t\t);\n\t\t}\n\t\treturn $rows;\n\t}",
"function getDependencies()\n {\n return [\n AddressFixtures::class,\n ContactFixtures::class\n ];\n }",
"public function loadAll(): PostCollection\n {\n return new PostCollection(...FakeDataForToy::singleton()->getPostEntities());\n }",
"public function getDependencies()\n {\n return [\n UserFixtures::class,\n EmployeeFixtures::class,\n MaterialFixtures::class\n ];\n }",
"public function haveFixtures($fixtures)\n {\n $this->store = new FixturesStore($fixtures);\n $this->store->loadFixtures();\n $this->loadedFixtures[] = $this->store;\n }"
]
| [
"0.7476397",
"0.74419063",
"0.73265547",
"0.7321824",
"0.72778094",
"0.7208631",
"0.7136346",
"0.71081346",
"0.71011835",
"0.7079089",
"0.69585353",
"0.695261",
"0.6941145",
"0.68353784",
"0.6775201",
"0.6768056",
"0.67570114",
"0.6740962",
"0.6696951",
"0.6581422",
"0.6556871",
"0.649205",
"0.63553613",
"0.63301843",
"0.632277",
"0.6319078",
"0.6286979",
"0.62844765",
"0.6282804",
"0.6260477"
]
| 0.78056586 | 0 |
Add a "Comments" heading above comments except on forum pages. | function maennaco_preprocess_comment_wrapper(&$vars) {
if ($vars['content'] && $vars['node']->type != 'forum') {
$vars['content'] = '<h2 class="comments">' . t('Comments') . '</h2>' . $vars['content'];
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pmi_preprocess_comment_wrapper(&$vars) {\n if ($vars['content'] && $vars['node']->type != 'forum') {\n $vars['content'] = '<h2 class=\"comments\">'. t('Comments') .'</h2>'. $vars['content'];\n }\n}",
"function garland_preprocess_comment_wrapper(&$vars) {\n if ($vars['content'] && $vars['node']->type != 'forum') {\n $vars['content'] = '<h2 class=\"comments\">'. t('Comments') .'</h2>'. $vars['content'];\n }\n}",
"function voyage_mikado_comments_title() {\n ?>\n\n <div class=\"mkdf-comment-number\">\n <div class=\"mkdf-comment-number-inner\">\n <h3><?php comments_number(esc_html__('No Comments', 'voyage'), ''.esc_html__(' Comment ', 'voyage'), ' '.esc_html__(' Comments: ', 'voyage')); ?></h3>\n </div>\n </div>\n\n <?php\n }",
"function register_block_core_comments_title()\n {\n }",
"public function set_comment_before_headers($text)\n {\n }",
"function cosmetics_comment_nav() { if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :\n\n ?>\n <nav class=\"navigation comment-navigation\">\n <h2 class=\"screen-reader-text\">\n <?php _e( 'Comment navigation', 'cosmetics' ); ?>\n </h2>\n <div class=\"nav-links\">\n <?php\n if ( $prev_link = get_previous_comments_link( esc_html__( 'Older Comments', 'cosmetics' ) ) ) :\n printf( '<div class=\"nav-previous\">%s</div>', $prev_link );\n endif;\n\n if ( $next_link = get_next_comments_link( esc_html__( 'Newer Comments', 'cosmetics' ) ) ) :\n printf( '<div class=\"nav-next\">%s</div>', $next_link );\n endif;\n ?>\n </div><!-- .nav-links -->\n </nav><!-- .comment-navigation -->\n\n <?php\n endif;\n }",
"function phptemplate_comment_wrapper($content, $node) {\n if (!$content || $node->type == 'forum') {\n return '<div id=\"comments\">'. $content .'</div><a name=\"comments\"></a>';\n }\n else {\n return '<div id=\"comments\"><h2 class=\"comments\">'. t('Comments') .'</h2>'. $content .'</div><a name=\"comments\"></a>';\n }\n}",
"function lmsim_comment_nav() { if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :\n ?>\n <nav class=\"navigation comment-navigation text-center clearfix\" role=\"navigation\">\n <div class=\"nav-links\">\n <?php\n if ( $prev_link = get_previous_comments_link( '上一页' ) ) :\n printf( '<div class=\"nav-previous alignleft\">%s</div>', $prev_link );\n endif;\n\n if ( $next_link = get_next_comments_link( '下一页' ) ) :\n printf( '<div class=\"nav-next alignright\">%s</div>', $next_link );\n endif;\n ?>\n </div><!-- .nav-links -->\n </nav><!-- .comment-navigation -->\n <?php\n endif;\n}",
"public function admin_header() {\n\t\t\t// print admin notice in case of notice strings given\n\t\t\tif ( !empty( $this->_admin_notices ) ) {\n\t\t\t\t\tadd_action('admin_notices' , array( $this, 'print_admin_notice' ) );\n\t\t\t}\n?>\n<style type=\"text/css\">\n.column-comment_reported {\n\twidth: 8em;\n}\n</style>\n<?php\n\n\t\t}",
"function tempera_number_comments() { ?>\n\t\t\t<h3 id=\"comments-title\"><i class=\"icon-replies\" ></i>\n\t\t\t\t<?php printf( _n( 'One Comment:', '%1$s Comments:', get_comments_number(), 'tempera' ),\n\t\t\t\tnumber_format_i18n( get_comments_number() )); ?>\n\t\t\t</h3>\n<?php }",
"public function comments()\n {\n $task = $this->getTask();\n $commentSortingDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC');\n\n $this->response->html($this->template->render('CommentTooltip:board/tooltip_comments', array(\n 'task' => $task,\n 'comments' => $this->commentModel->getAll($task['id'], $commentSortingDirection)\n )));\n }",
"function tempera_comments_navigation() {\nif ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>\n\t\t\t<div class=\"navigation\">\n\t\t\t\t<div class=\"nav-previous\"><?php previous_comments_link( '<i class=\"icon-reply\"></i>'.__('Older Comments', 'tempera' ) ); ?></div>\n\t\t\t\t<div class=\"nav-next\"><?php next_comments_link( __( 'Newer Comments', 'tempera' ).'<i class=\"icon-forward\"></i>' ); ?></div>\n\t\t\t</div> <!-- .navigation -->\n<?php endif; // check for comment navigation \n}",
"function wap8_trackbacks( $comment ) {\n$GLOBALS['comment'] = $comment; ?>\n<li><?php printf( __( '%s', 'designcrumbs' ), get_comment_author_link() ) ?> <?php edit_comment_link( __( 'Edit', 'designcrumbs' ), '<span>', '</span>' ); ?>\n<?php\n}",
"function wp_dashboard_recent_comments_control()\n {\n }",
"function cosmetics_comment_form() {\n\n if ( comments_open() || get_comments_number() ) :\n?>\n\n <div class=\"site-comments\">\n <?php comments_template( '', true ); ?>\n </div>\n\n<?php\n endif;\n}",
"function tempera_comments_on() {\nglobal $temperas;\nforeach ($temperas as $key => $value) { ${\"$key\"} = $value; }\t\n\tif ( comments_open() && ! post_password_required() && $tempera_blog_show['comments'] && ! is_single()) :\n\t\tprint '<div class=\"comments-link\"><i class=\"icon-comments icon-metas\" title=\"' . __('Comments', 'tempera') . '\"></i>';\n\t\tprintf ( comments_popup_link( __( '<b>0</b>', 'tempera' ), __( '<b>1</b>', 'tempera' ), __( '<b>%</b>', 'tempera' ),(''),__('<b>-</b>','tempera') ));\n\t\tprint '</div>';\n\tendif;\n}",
"public function templateComment()\n {\n // just showing how powerful can commenting be with extension\n }",
"function bones_comments( $comment, $args, $depth ) {\n $GLOBALS['comment'] = $comment; ?>\n <div id=\"comment-<?php comment_ID(); ?>\" <?php comment_class('cf'); ?>>\n <?php echo comment_placeholder($comment, $args, $depth); ?>\n <?php // </li> is added by WordPress automatically ?>\n<?php\n}",
"function cosmetics_comments( $cosmetics_comment, $cosmetics_comment_args, $cosmetics_comment_depth ) {\n\n if ( 'div' === $cosmetics_comment_args['style'] ) :\n\n $cosmetics_comment_tag = 'div';\n $cosmetics_comment_add_below = 'comment';\n\n else :\n\n $cosmetics_comment_tag = 'li';\n $cosmetics_comment_add_below = 'div-comment';\n\n endif;\n\n?>\n <<?php echo $cosmetics_comment_tag ?> <?php comment_class( empty( $cosmetics_comment_args['has_children'] ) ? '' : 'parent' ) ?> id=\"comment-<?php comment_ID() ?>\">\n\n <?php if ( 'div' != $cosmetics_comment_args['style'] ) : ?>\n\n <div id=\"div-comment-<?php comment_ID() ?>\" class=\"comment-body\">\n\n <?php endif; ?>\n\n <div class=\"comment-author vcard\">\n <?php if ( $cosmetics_comment_args['avatar_size'] != 0 ) echo get_avatar( $cosmetics_comment, $cosmetics_comment_args['avatar_size'] ); ?>\n\n </div>\n\n <?php if ( $cosmetics_comment->comment_approved == '0' ) : ?>\n <em class=\"comment-awaiting-moderation\">\n <?php esc_html_e( 'Your comment is awaiting moderation.', 'cosmetics' ); ?>\n </em>\n <?php endif; ?>\n\n <div class=\"comment-meta commentmetadata\">\n <div class=\"comment-meta-box\">\n <span class=\"name\">\n <?php comment_author_link(); ?>\n </span>\n <span class=\"comment-metadata\">\n <?php comment_date(); ?>\n </span>\n\n <?php edit_comment_link( esc_html__( 'Edit ', 'cosmetics' ) ); ?>\n\n <?php comment_reply_link( array_merge( $cosmetics_comment_args, array( 'add_below' => $cosmetics_comment_add_below, 'depth' => $cosmetics_comment_depth, 'max_depth' => $cosmetics_comment_args['max_depth'] ) ) ); ?>\n\n </div>\n <div class=\"comment-text-box\">\n <?php comment_text(); ?>\n </div>\n </div>\n\n <?php if ( 'div' != $cosmetics_comment_args['style'] ) : ?>\n </div>\n <?php endif; ?>\n\n<?php\n}",
"function flatsome_before_blog_comments(){\n if(get_theme_mod('blog_after_post')){\n echo '<div class=\"html-before-comments mb\">'.do_shortcode(get_theme_mod('blog_after_post')).'</div>';\n }\n}",
"function newsdot_comments_link() {\n\t\tif ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {\n\t\t\techo '<span class=\"comments-link\">';\n\t\t\techo '<i class=\"far fa-comments mr-1\"></i>';\n\t\t\tcomments_popup_link(\n\t\t\t\tsprintf(\n\t\t\t\t\twp_kses(\n\t\t\t\t\t\t/* translators: %s: post title */\n\t\t\t\t\t\t__( 'Leave a Comment<span class=\"screen-reader-text\"> on %s</span>', 'newsdot' ),\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'span' => array(\n\t\t\t\t\t\t\t\t'class' => array(),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\twp_kses_post( get_the_title() )\n\t\t\t\t)\n\t\t\t);\n\t\t\techo '</span>';\n\t\t}\n\t}",
"function render_block_core_comments_title($attributes)\n {\n }",
"function buddyblogphotos_enable_bp_comment_filter() {\n\n\tif ( function_exists( 'bp_comments_open' ) ) {\n\t\tadd_filter( 'comments_open', 'bp_comments_open', 10, 2 );\n\t}\n}",
"public function displayComments()\n {\n global $lexicon;\n $lexicon = new Lexicon(COMMENTIA_LEX_LOCALE);\n\n global $roles;\n $roles = new Roles();\n\n /**\n * Iterates through each comment recursively, and appends it to the var holding the HTML markup.\n *\n * @param array $comment An array containing all the comment data\n */\n\n foreach ($this->comments as $comment) {\n if (isset($this->comments['ucid-'.$comment['ucid']])) {\n $this->renderCommentView($comment['ucid']);\n unset($this->comments['ucid-'.$comment['ucid']]);\n }\n }\n\n if ($_SESSION['__COMMENTIA__']['member_is_logged_in']) {\n $this->html_output .= ('<div class=\"commentia-new_comment_area\">'.\"\\n\".'<h4>'.TITLES_NEW_COMMENT.'</h4>'.\"\\n\".'<textarea id=\"comment-box\" oninput=\"autoGrow(this);\"></textarea>'.\"\\n\".'<button id=\"post-comment-button\" onclick=\"postNewComment(this);\">'.COMMENT_CONTROLS_PUBLISH.'</button>'.\"\\n\".'</div>'.\"\\n\");\n }\n\n return $this->html_output;\n }",
"function wputh_disable_comments_css() {\n echo \"<style>#dashboard_right_now .comment-count, #dashboard_right_now .table_discussion, #latest-comments{ display:none; } {display:none !important;}</style>\";\n}",
"function dp_facebook_comment_box() {\n\tglobal $options, $options_visual;\n\t// Facebook comment\n\tif ( get_post_meta(get_the_ID(), 'dp_hide_fb_comment', true) ) return;\n\n\tif ( ($options['facebookcomment'] && get_post_type() === 'post') || ($options['facebookcomment_page'] && is_page()) ) {\n\t\techo '<div class=\"dp_fb_comments_div\"><h3 class=\"inside-title\"><span class=\"title\">'.htmlspecialchars_decode($options['fb_comments_title']).'</span></h3><div class=\"fb-comments\" data-href=\"'.get_permalink ().'\" data-num-posts=\"'.$options['number_fb_comment'].'\" data-width=\"100%\"></div></div>';\n\t}\n}",
"function starter_comment_block() {\n $items = array();\n $number = variable_get('comment_block_count', 10);\n\n foreach (comment_get_recent($number) as $comment) {\n //kpr($comment->changed);\n //print date('Y-m-d H:i', $comment->changed);\n $items[] =\n '<h3>' . l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '</h3>' .\n ' <time datetime=\"'.date('Y-m-d H:i', $comment->changed).'\">' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->changed))) . '</time>';\n }\n\n if ($items) {\n return theme('item_list', array('items' => $items, 'daddy' => 'comments'));\n }\n else {\n return t('No comments available.');\n }\n}",
"function child_theme_comments_title( $comments_title ) {\n\n\t//comments_popup_link( false, false, false, 'comments-link' );\n\n\treturn $comments_title;\n}",
"function displayHeader()\n\t{\n\t\t// output locator\n\t\t$this->displayLocator();\n\n\t\t// output message\n\t\tif($this->message)\n\t\t{\n\t\t\tilUtil::sendInfo($this->message);\n\t\t}\n\t\tilUtil::infoPanel();\n\n//\t\t$this->tpl->setTitleIcon(ilUtil::getImagePath(\"icon_pd_b.gif\"),\n//\t\t\t\"\");\n\t\t$this->tpl->setTitle($this->lng->txt(\"bookmarks\"));\n\t}",
"public function getTabTitle()\n {\n return Mage::helper('blog')->__('Comment Information');\n }"
]
| [
"0.7024877",
"0.7012147",
"0.68652964",
"0.6535666",
"0.6456594",
"0.6193357",
"0.6185523",
"0.6176979",
"0.6143402",
"0.6097398",
"0.60915667",
"0.60855365",
"0.6055256",
"0.6025616",
"0.5995442",
"0.59760547",
"0.59479755",
"0.5937607",
"0.5905697",
"0.5888124",
"0.5864695",
"0.58488286",
"0.5848254",
"0.5830504",
"0.5820892",
"0.57577366",
"0.57484704",
"0.5742641",
"0.57298267",
"0.5729198"
]
| 0.7028442 | 0 |
Generates IE CSS links for LTR and RTL languages. | function phptemplate_get_ie_styles() {
global $language;
$iecss = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . path_to_theme() . '/fix-ie.css" />';
if ($language->direction == LANGUAGE_RTL) {
$iecss .= '<style type="text/css" media="all">@import "' . base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>';
}
return $iecss;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function phptemplate_get_ie_styles() {\n global $language;\n\n $iecss = '<link type=\"text/css\" rel=\"stylesheet\" media=\"all\" href=\"'. base_path() . path_to_theme() .'/fix-ie.css\" />';\n if ($language->direction == LANGUAGE_RTL) {\n $iecss .= '<style type=\"text/css\" media=\"all\">@import \"'. base_path() . path_to_theme() .'/fix-ie-rtl.css\";</style>';\n }\n\n return $iecss;\n}",
"function generateLangLinks() {\n\t\tglobal $_SERVER;\n\t\tforeach( $this->mLanguages as $cur_lang ) {\n\t\t\tif( $cur_lang != $this->mLang ) {\n\t\t\t\n\t\t\t\t$url = \"//tools.wmflabs.org\".$_SERVER['REQUEST_URI'];\n\t\t\t\t\n\t\t\t\tif( in_string( 'uselang', $url ) ) $url = preg_replace( '/uselang=(.*?)&?/', '', $url );\n\t\t\t\tif( in_string( '?', $url ) ) {\n\t\t\t\t\t$url = $url . \"&uselang=\".$cur_lang;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$url = $url . \"?uselang=\".$cur_lang;\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$this->mLanglinks.=\"<a href=\\\"\". $url.\"\\\">\".$cur_lang.\"</a> \";\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $this->mLanglinks;\n\t}",
"function phptemplate_get_ie_styles() {\n global $language;\n\n $iecss = '<link type=\"text/css\" rel=\"stylesheet\" media=\"all\" href=\"'. base_path() . path_to_theme() .'/css/fix-ie.css\" />';\n\n return $iecss;\n}",
"function phptemplate_get_ie_styles() {\n global $language;\n\n $iecss = '<link type=\"text/css\" rel=\"stylesheet\" media=\"all\" href=\"'. base_path() . path_to_theme() .'/fix-ie.css\" />';\n\n return $iecss;\n}",
"private function links()\n {\n foreach ($this->controller->links as $value)\n echo \"\\t<link rel='stylesheet' href='\" . DOMAIN . $value . \"' />\\n\";\n }",
"public function configure_colors_for_rtl_stylesheets() {\n\t\twp_style_add_data( 'colors', 'rtl', $this->is_rtl() );\n\t}",
"function weglotHrefLangRender()\n {\n $url = weglotCurrentUrlInstance();\n return $url->generateHrefLangsTags();\n }",
"function rtl_function($classes) {\n $classes[] = 'rtl';\n // return the $classes array\n return $classes;\n }",
"function GetDirection() : string\n{\n return GetLanguage() == 'ar' ? 'rtl' : 'ltr';\n}",
"function ru_accomodate_markup() {\r\n\tglobal $locale, $wp_styles;\r\n\r\n\twp_enqueue_style($locale, WP_CONTENT_URL . \"/languages/$locale.css\", array(), '20090128', 'all');\r\n\twp_enqueue_style(\"$locale-ie\", WP_CONTENT_URL . \"/languages/$locale-ie.css\", array(), '20090128', 'all');\r\n\t$wp_styles->add_data(\"$locale-ie\", 'conditional', 'IE');\r\n\r\n\twp_print_styles();\r\n}",
"public function rtlSupport()\n {\n return view('pages.example_pages.language');\n }",
"function yourls_is_rtl() {\n\tglobal $yourls_locale_formats;\n\tif( !isset( $yourls_locale_formats ) )\n\t\t$yourls_locale_formats = new YOURLS_Locale_Formats();\n\n\treturn $yourls_locale_formats->is_rtl();\n}",
"function hotel_lux_gutenberg_frontend_styles() {\r\n\twp_enqueue_style('hotel-lux-gutenberg-frontend-style', get_template_directory_uri() . '/gutenberg/cmsmasters-framework/theme-style' . CMSMASTERS_THEME_STYLE . '/css/frontend-style.css', array(), '1.0.0', 'screen');\r\n\t\r\n\t\r\n\tif (is_rtl()) {\r\n\t\twp_enqueue_style('hotel-lux-gutenberg-frontend-rtl', get_template_directory_uri() . '/gutenberg/cmsmasters-framework/theme-style' . CMSMASTERS_THEME_STYLE . '/css/module-rtl.css', array(), '1.0.0', 'screen');\r\n\t}\r\n}",
"function generatepress_child_enqueue_scripts() {\n\tif ( is_rtl() ) {\n\t\twp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );\n\t}\n}",
"public function generate_links($attr)\n\t{\n\t\t$source = \"http://www.marketingvillas.com/links_rev.php\";\n\t\t$source .= '?exc='.str_replace('uat.','www.',$_SERVER['SERVER_NAME']);\n\t\t\n\t\tif($attr['heading'] != '')\n\t\t\t$source .= '&heading='.$attr['heading'];\n\t\t\n\t\tif($attr['uriheading'] != '')\n\t\t\t$source .= '&url_heading='.$attr['uriheading'];\n\t\telse\n\t\t\t$source .= '&url_heading=h2';\n\t\t\n\t\tif($attr['what'] != '')\n\t\t\t$source .= '&what='.urlencode($attr['what']);\n\t\t\n\t\t$meme = $this->ret(ltrim($attr['sublocation']));\n\t\t$source .= '&location='.$meme['location'];\n\t\t$source .= '&area='.$meme['area'];\n\t\t//echo $source;\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, $source);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\t$output = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\t\n\t\treturn $output;\n\t}",
"function wheels_language_attributes() {\n\t$attributes = array();\n\t$output = '';\n\n\tif ( is_rtl() ) {\n\t\t$attributes[] = 'dir=\"rtl\"';\n\t}\n\n\t$lang = get_bloginfo( 'language' );\n\n\tif ( $lang ) {\n\t\t$attributes[] = \"lang=\\\"$lang\\\"\";\n\t}\n\n\t$output = implode( ' ', $attributes );\n\t$output = apply_filters( 'wheels_language_attributes', $output );\n\n\treturn $output;\n}",
"function mumm_v2_preprocess_page_add_hreflang(&$node) {\n global $language;\n\n // Define hreflang replacements for special cases\n $hreflang_overrides = array(\n array('en-uk'),\n array('en-gb'),\n );\n\n /* $element = array(\n '#tag' => 'link',\n '#attributes' => array(\n 'hreflang' => 'x-default',\n 'rel' => 'alternate',\n 'href' => url('<front>', array(\n 'absolute' => true,\n 'language' => language_default(),\n ))\n ),\n ); */\n\n drupal_add_html_head($element, 'hreflang_x_default');\n\n // Add the page and all its translations\n $t_nodes = mumm_helpers_get_node_translations($node);\n if (!$t_nodes) {\n return;\n }\n\n $languages = language_list();\n $languages_code = array();\n\n foreach ($languages as $language_item) {\n $language_code = substr($language_item->prefix, 0, 2);\n if (isset($languages_code[$language_code])) {\n $languages_code[$language_code] ++;\n }\n else {\n $languages_code[$language_code] = 1;\n }\n }\n\n foreach ($t_nodes as $t_node) {\n\n $hreflang = FALSE;\n $language_object = FALSE;\n\n foreach ($languages as $language_item) {\n if ($language_item->language == $t_node->language) {\n $language_code = substr($language->prefix, 0, 2);\n if ($languages_code[$language_code] == 1) {\n $hreflang = $language_item->prefix;\n }\n else {\n $hreflang = $language_item->prefix;\n }\n $language_object = $language_item;\n break;\n }\n }\n\n $url = url(drupal_is_front_page() ? '<front>' : sprintf('node/%s', $t_node->nid), array(\n 'absolute' => TRUE,\n 'alias' => FALSE,\n 'language' => $language_object\n )\n );\n\n\n $element = array(\n '#tag' => 'link',\n '#attributes' => array(\n 'hreflang' => $language_object->prefix,\n 'rel' => 'alternate',\n 'href' => urldecode($url),\n ),\n );\n\n drupal_add_html_head($element, sprintf('hreflang_%s_%s', $t_node->nid, $t_node->language));\n }\n}",
"public function ie8_css() {\n\t\t$ie_8_url = WPEX_CSS_DIR_URI .'ie8.css';\n\t\t$ie_8_url = apply_filters( 'wpex_ie_8_url', $ie_8_url );\n\t\techo '<!--[if IE 8]><link rel=\"stylesheet\" type=\"text/css\" href=\"'. $ie_8_url .'\" media=\"screen\"><![endif]-->';\n\t}",
"function create_links() {\n $total_rows = $this->total_rows;\n if ($total_rows == 0) {\n return '';\n }\n\n // Calculate the total number of pages\n $CI = & get_instance();\n $_quantity = $CI->_quantity;\n $per_page = $this->per_page;\n $num_pages = ceil($total_rows / $per_page);\n\n // Is there only one page? Hm... nothing more to do here then.\n if ($num_pages == 1) {\n return '';\n }\n\n // Determine the current page number.\n $_offset = $CI->_offset;\n $cur_page = $_quantity == -1 ? -1 : floor($CI->_offset / $per_page) + 1;\n\n // And here we go...\n $output = '';\n\n // Render the \"First\" link\n if ($cur_page != 1) {\n $i = 0;\n $output .= $this->first_tag_open . $i . $this->first_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Render the \"previous\" link\n if ($cur_page != 1 && $_quantity != -1) {\n $i = $_offset - $per_page;\n $output .= $this->prev_tag_open . $i . $this->prev_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Write the digit links\n $output .= \"<select tabindex='-1'>\";\n $start = 1;\n $end = $per_page;\n if ($_quantity == -1)\n $output .= '<option selected=\"selected\" > - </option>';\n for ($loop = 1; $loop <= $num_pages; $loop++) {\n if ($end > $total_rows)\n $end = $total_rows;\n $output .= '<option value=\"' . (($loop - 1) * $per_page) . '\" ' . ($loop == $cur_page ? \"selected='selected'\" : \"\") . ' >Trang ' . $loop . '/' . $num_pages . ' ' . $start . \"-\" . $end . '/' . $total_rows . '</option>';\n $start+=$per_page;\n $end+=$per_page;\n }\n $output .= \"</select>\";\n\n // Render the \"next\" link\n if ($cur_page != $num_pages && $_quantity != -1) {\n $i = $_offset + $per_page;\n $output .= $this->next_tag_open . $i . $this->next_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Render the \"Last\" link\n if ($cur_page != $num_pages) {\n $i = ($num_pages - 1) * $per_page;\n $output .= $this->last_tag_open . $i . $this->last_tag_close;\n } else {\n $output .= \"<li class='null'></li>\";\n }\n\n // Add the wrapper HTML if exists\n $output = $this->full_tag_open . $output . str_replace(array(\"{class}\", \"{style}\"), array(($_quantity == -1 ? \"ui-state-hover\" : \"icon\"), ($_quantity == -1 ? \"cursor:default\" : \"\")), $this->full_tag_close);\n\n return $output;\n }",
"protected function generateLinks()\n {\n if ( ! is_null($this->links) ) {\n foreach ( $this->links as $link ) {\n $this->addLine('<url>');\n $this->addLine('<loc>');\n $this->addLine($this->helpers->url(\n $link->link,\n $this->protocol,\n $this->host\n ));\n $this->addLine('</loc>');\n $this->addLine('<lastmod>' . date_format($link->updated_at, 'Y-m-d') . '</lastmod>');\n $this->addLine('</url>');\n }\n }\n }",
"function buildLanguageSwitcher($slugs)\n {\n $html = '';\n foreach ($slugs as $key => $slug) {\n $links = $slug;\n foreach ($links as $lang => $value) {\n if ($lang == config('app.fallback_locale')) {\n $link = $value;\n //echo $link;\n } else {\n $link = $lang.'/'.$value;\n }\n $active = '';\n if ($lang == config('app.locale')) {\n $active = 'class=\"active\"';\n }\n\n $html .= '<li '.$active.'>'.'<a rel=\"alternate\" hreflang=\"'.$lang.'\" href=\"/'.$link.'\">'.$lang.'</a></li>';\n }\n }\n\n return $html;\n }",
"private function getLinks() {\n\t\t// Get new values\n\t$prevMonth = isset($_GET['month']) ? ($_GET['month'] -1) : $this->currentMonth -1;\n\t$nextMonth = isset($_GET['month']) ? ($_GET['month'] +1) : $this->currentMonth +1;\n\n\t\t//Write out links\n\t$this->prevLink = ' <a href=\"?month=' . $prevMonth . '&year=' . $this->newYear . '\"> « </a> ';\n\t$this->nextLink = ' <a href=\"?month=' . $nextMonth . '&year=' . $this->newYear . '\"> » </a> ';\n\n\n\t}",
"public static function enteteCSS() {\r\n foreach (Page::getInstance()->css as $link) {\r\n ?>\r\n <link type=\"text/css\" rel=\"stylesheet\" href=\"<?php echo $link; ?>\" />\r\n <?php\r\n }\r\n }",
"public function create_links()\n {\n \t$txt = '<ul>';\n \t$last = end($this->breadcrumb);\n \tforeach($this->breadcrumb AS $breadcrumb)\n \t{\n \t\t$url = '';\n \t\t$class = FALSE;\n \t\tif($breadcrumb['active'] == '1')\n \t\t{\n \t\t\t$class = 'active';\n \t\t}\n \t\t$txt .= '<li><a href=\"'.$breadcrumb['url'].'\" class=\"'.$class.'\" title=\"'.$breadcrumb['txt'].'\">'.$breadcrumb['txt'].'</a></li>';\n \t\t$class = '';\n \t}\n \t\n \t$txt .= '</ul>';\n \treturn $txt;\n }",
"public function links() {\n\t\t?>\n\t\t<ul>\n\t\t\t<li>\n\t\t\t\t<a href=\"http://bit.ly/15uoww1\" target=\"_blank\"><?php echo __( 'Installation manual', $this->_google_drive_cdn->get_textdomain() ); ?></a>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<a href=\"http://bit.ly/W9GDQT\" target=\"_blank\"><?php echo __( 'Frequently Asked Questions', $this->_google_drive_cdn->get_textdomain() ); ?></a>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<a href=\"http://bit.ly/WW93Sk\" target=\"_blank\"><?php echo __( 'Report a bug', $this->_google_drive_cdn->get_textdomain() ); ?></a>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<a href=\"http://bit.ly/11UE2lF\" target=\"_blank\"><?php echo __( 'Request a function', $this->_google_drive_cdn->get_textdomain() ); ?></a>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<a href=\"http://bit.ly/XkivOW\" target=\"_blank\"><?php echo __( 'Submit a translation', $this->_google_drive_cdn->get_textdomain() ); ?></a>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<a href=\"http://bit.ly/UlDG4t\" target=\"_blank\"><?php echo __( 'More cool stuff by WPBuddy', $this->_google_drive_cdn->get_textdomain() ); ?></a>\n\t\t\t</li>\n\t\t</ul>\n\t<?php\n\t}",
"public function create_links()\n {\n $totalPages = floor($this->total_records / $this->size);\n $totalPages += ($this->total_records % $this->size != 0) ? 1 : 0;\n if($totalPages < 1 || $totalPages == 1)\n return null;\n $output = null;\n $loopStart = 1;\n $loopEnd = $totalPages;\n if($totalPages > 5){\n if($this->page <= 3){\n $loopStart = 1;\n $loopEnd = 5;\n } else if($this->page >= $totalPages - 2){\n $loopStart = $totalPages - 4;\n $loopEnd = $totalPages;\n } else{\n $loopStart = $this->page - 2;\n $loopEnd = $this->page + 2;\n }\n }\n if($loopStart != 1){\n $output .= sprintf('<a id=\"back\" href=\"' . $this->link . '\">«</a>', '1');\n }\n if($this->page > 1){\n $output .= sprintf('<a id=\"prev\" href=\"' . $this->link . '\">' . __('Previous') . '</a>', $this->page - 1);\n }\n for($i = $loopStart; $i <= $loopEnd; $i++){\n if($i == $this->page){\n $output .= '<a class=\"on\">' . $i . '</a>';\n } else{\n $output .= sprintf('<a href=\"' . $this->link . '\">', $i) . $i . '</a>';\n }\n }\n if($this->page < $totalPages){\n $output .= sprintf('<a id=\"next\" href=\"' . $this->link . '\">' . __('Next') . '</a>', $this->page + 1);\n }\n if($loopEnd != $totalPages){\n $output .= sprintf('<a id=\"forward\" href=\"' . $this->link . '\">»</a>', $totalPages);\n }\n return '<div id=\"pagination\"><ul><li>' . $output . '</li></ul></div>';\n }",
"function newenglish_language_attributes() {\n $attributes = [];\n if (is_rtl()) {\n $attributes[] = 'dir=\"rtl\"';\n }\n $lang = get_bloginfo('language');\n if ($lang) {\n $attributes[] = \"lang=\\\"$lang\\\"\";\n }\n $output = implode(' ', $attributes);\n return $output;\n}",
"function create_links()\n\t{\n\t\t$output = '';\n\t\t\n\t\t/*if($this->block > 1){\n\t\t\t$this->prev = $this->first-1; \n\t\t\t$output .= '<a href=\"'.$this->url.'/page/1\" class=\"pBtn prev2\">처음</a>'.chr(10);\n\t\t}else{\n\t\t\t$output .= '<a href=\"javascript:void(0);\"class=\"pBtn prev2\">처음</a>'.chr(10);\n }*/\n\n\t\tif($this->page>1){\n\t\t\t$this->go_page=$this->page-1;\n\t\t\t$output .= '<a href=\"'.$this->url.'/page/'.$this->go_page.$this->querystring.'\"><img src=\"'.$this->theme.'/images/prev1.gif\" alt=\"Prev\" /></a>'.chr(10);\n\t\t}else{\n\t\t\t$output .= '<a href=\"javascript:void(0);\"><img src=\"'.$this->theme.'/images/prev1.gif\" alt=\"Prev\" /></a>'.chr(10);\n\t\t}\n\t\t\n\t\t$pgNum = '';\n\t\tfor($this->pagelnk=$this->first+1; $this->pagelnk <= $this->last; $this->pagelnk++)\n\t\t{\n\t\t\tif($this->first+1 < $this->pagelnk) $pgNum .= \"\t\"; \n\t\t\tif($this->pagelnk==$this->page){\n\t\t\t\t$pgNum .='<strong>'.$this->pagelnk.'</strong>'.chr(10);\n\t\t\t}else{\n\t\t\t\t$pgNum .='<a href=\"'.$this->url.'/page/'.$this->pagelnk.$this->querystring.'\">'.$this->pagelnk.'</a>'.chr(10);\n\t\t\t}\n \n if($this->paglnk!=$this->first+1 && $this->paglnk!=$this->last){\n $pgNum .= '';\n }\n\t\t}\n\t\t\n\t\t//$output .= $pgNum;\n $output .= '<span class=\"num\">'.$pgNum.'</span>';\n\n\t\tif($this->total_page>$this->page){\n\t\t\t$this->go_page=$this->page+1;\n\t\t\t$output .= '<a href=\"'.$this->url.'/page/'.$this->go_page.$this->querystring.'\"><img src=\"'.$this->theme.'/images/next1.gif\" alt=\"Next\" /></a>'.chr(10);\n\t\t}else{\n\t\t\t$output .= '<a href=\"javascript:void(0);\"><img src=\"'.$this->theme.'/images/next1.gif\" alt=\"Next\" /></a>'.chr(10);\n\t\t}\n\n\t\t/*if($this->block < $this->total_block){\n\t\t\t$this->next=$this->last+1;\n\t\t\t$output .= '<a href=\"'.$this->url.'/page/'.$this->total_page.'\" class=\"pBtn next2\">마지막</a>';\n\t\t}else{\n $output .= '<a href=\"javascript:void(0);\" class=\"pBtn next2\">마지막</a>';\n }*/\n\t\t\n\t\tif($this->total_page <= 1) $output =null;\n\n\t\treturn $output;\n\t}",
"function minorite_links__locale_block($variables) {\n $variables['attributes']['class'] = array('nav', 'switch-tongue');\n // Removes class as it is not used.\n $variables['links']['en']['title'] = 'En';\n $variables['links']['en']['attributes']['title'] = t('English site');\n unset($variables['links']['en']['attributes']['class']);\n $variables['links']['fr']['title'] = 'Fr';\n $variables['links']['fr']['attributes']['title'] = t('French site');\n unset($variables['links']['fr']['attributes']['class']);\n\n return theme('links', $variables);\n}",
"function noticias_links(){\n \t\n $html=site('http://www.jornalnoticias.co.mz/');\n\t\n\tforeach($html->find('.items-row')as $elms){\n\t\t\n\t\t\n\t\tforeach($elms->find ('.jn-postheader a') as $elms2){\n\t\t\n\t $j[]=mb_convert_encoding( \"http://www.jornalnoticias.co.mz\".$elms2->href, \"HTML-ENTITIES\", \"UTF-8\");\n\t\n\t\n\t\t\n\t\t}\n\t\t\n\t}\n\t\n\treturn $j;\n }"
]
| [
"0.6340379",
"0.61545074",
"0.58850104",
"0.5834147",
"0.57290316",
"0.5659659",
"0.549198",
"0.54725873",
"0.5295684",
"0.5211203",
"0.5175947",
"0.51363224",
"0.50762165",
"0.50736296",
"0.50533825",
"0.503136",
"0.5020328",
"0.5014057",
"0.50123316",
"0.49793097",
"0.49744025",
"0.49343854",
"0.49339044",
"0.4910361",
"0.4899587",
"0.48796108",
"0.48613408",
"0.4855195",
"0.48416865",
"0.4835913"
]
| 0.6394754 | 0 |
Returns list of content containers | public function getContentContainers($filter = null)
{
return $this->contentManager->listContentContainers($filter);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getContainers()\n {\n }",
"protected function findAll()\n {\n return ContainerPage::find()->contentContainer($this->contentContainer)->all();\n }",
"public function getContentList() {\r\n\t\tif (!$this->read) {\r\n\t\t\t$this->open();\r\n\t\t\t$this->readContent();\r\n\t\t}\r\n\t\treturn $this->contentList;\r\n\t}",
"public function getContainers()\n {\n return $this->containers;\n }",
"public function getContainers()\n {\n return $this->containers;\n }",
"public function getContainers()\n\t\t{\n\t\t\treturn $this->_containers;\n\t\t}",
"public function getContainers()\n\t\t{\n\t\t\treturn $this->getTab( '_options_tab' )->getContainers();\n\t\t}",
"public function getContainer()\n {\n //Return container\n return $this->contentListContainer;\n }",
"public function containers()\n {\n }",
"public function containerNames()\n {\n return $this->contentManager->listContainerNames();\n }",
"public function content(): Collection\n {\n return $this->items->values();\n }",
"public function get (\n\t)\t\t\t\t\t// RETURNS <int:str> a list of widget content stored in the container.\n\t\n\t// $links = $navigation->get();\n\t{\n\t\t$linkContent = array();\n\t\t$contents = $this->slots;\n\t\t\n\t\tksort($contents);\n\t\t\n\t\tforeach($contents as $slotSet)\n\t\t{\n\t\t\tforeach($slotSet as $slotData)\n\t\t\t{\n\t\t\t\t$linkContent[] = $slotData;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $linkContent;\n\t}",
"public function listContent()\n {\n return $this->tarArchive->listContent();\n }",
"public function indexContentCategories()\n {\n return $this->contentCategoryRepo->all();\n }",
"public function containers(): ContainersInterface;",
"public function index()\n {\n $contents = Content::all();\n\n return ContentResource::collection($contents);\n }",
"function jgantt_dashboard_get_contents() {\n $output = array();\n\n // Get all allowed content types and its settings\n $types = jgantt_dashboard_get_content_types();\n\n foreach ($types as $type => $config) {\n $configuration = unserialize($config->configuration);\n $grouping = explode(':', $configuration['grouping']);\n switch ($grouping[0]) {\n case 'n':\n $output[] = jgantt_dashboard_get_content_by_nodequeue($type, $configuration['date'], $grouping[1], $configuration['color'], $grouping[2], $configuration['title']);\n break;\n case 't':\n $output[] = jgantt_dashboard_get_content_by_taxonomy($type, $configuration['date'], $grouping[1], $configuration['color'], $configuration['title']);\n break;\n }\n }\n return $output;\n}",
"public function getAllContent()\n {\n return $this->content;\n }",
"public static function retrieveAll(){\n\n $myDataAccess = aContentAreaDataAccess::getInstance();\n\n $myDataAccess->connectToDB();\n\n $myDataAccess->selectDivs();\n\n $numberOfRecords = 0;\n\n while($row = $myDataAccess->fetchDivs())\n {\n $currentDiv = new self(\n $myDataAccess->fetchAlias($row),\n //$myDataAccess->fetchCreated($row),\n //$myDataAccess->fetchCreatedBy($row),\n $myDataAccess->fetchDescription($row),\n $myDataAccess->fetchDivId($row),\n $myDataAccess->fetchDivOrder($row),\n //$myDataAccess->fetchLastModified($row),\n //$myDataAccess->fetchModifiedBy($row),\n $myDataAccess->fetchName($row)\n );\n\n $arrayOfDivs[] = $currentDiv;\n\n }\n\n $myDataAccess->closeDB();\n\n return $arrayOfDivs;\n }",
"public function getDefinitions()\n {\n return $this->containers;\n }",
"public function contents()\n {\n return $this\n ->morphToMany('App\\Models\\Content', 'owner', 'content_group')\n ->withTimestamps()\n ->withPivot('sequence', 'created_by', 'updated_by')\n ->orderBy('sequence');\n }",
"public function getContainers()\n {\n $cmdResult = explode(\n \" \",\n $this->execute(\"docker ps -aq --filter 'name=cache-'\")\n );\n\n return array_map(\n 'trim',\n $cmdResult\n );\n }",
"public function getListeTypeContent () \n {\n $db = $this->getModel('db');\n $sql = \"SHOW TABLES LIKE '\" . $this->table_cms_contenu . \"_%'\";\n $stmt = $db->query($sql);\n for (true; $res = $db->fetch_assoc($stmt); true) {\n $liste_type_content[] = $res['Tables_in_' . Clementine::$config['clementine_db']['name'] . ' (' . $this->table_cms_contenu . '_%)']; \n }\n return $liste_type_content;\n }",
"public function getContainer();",
"public function getContainer();",
"public function getContainer();",
"public function getContainer();",
"public function getContainer();",
"public function container();",
"protected function getContentCollect()\n {\n return collect($this->getContentObject());\n }"
]
| [
"0.7253063",
"0.71347934",
"0.7110143",
"0.70974594",
"0.70974594",
"0.70158976",
"0.69452536",
"0.69386435",
"0.6728088",
"0.67231",
"0.65609163",
"0.65056217",
"0.6492496",
"0.6490012",
"0.64717144",
"0.6427491",
"0.64017844",
"0.6377951",
"0.6326532",
"0.6309454",
"0.630944",
"0.62980473",
"0.62966216",
"0.6286796",
"0.6286796",
"0.6286796",
"0.6286796",
"0.6286796",
"0.6245449",
"0.62372124"
]
| 0.7478008 | 0 |
Test the service throws an Exception for an invalid geographic location. | public function testItThrowsException()
{
$location = "00000,us";
$response = $this->api->send_request($location);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testGetInvalidLocationByLocationStreetOne() {\n\t\t// grab a location by searching for street one that does not exist\n\t\t$location = Location::getLocationByLocationStreetOne($this->getPDO(), \"That's a ghost street\");\n\t\t$this->assertCount(0, $location);\n\t}",
"public function testInvalidData()\n {\n $startLongitude = '100ab';//'1000'\n $startLatitude = 1000.484;\n $tripDistance = -2000;\n $this->validateCoordinatesServiceMock->shouldReceive('isLatitudeValid')->andReturn(false);\n $this->validateCoordinatesServiceMock->shouldReceive('isLongitudeValid')->andReturn(false);\n try {\n $result = $this->tripMakingService->calculateWholeTrip($startLongitude, $startLatitude, $tripDistance);\n } catch (NoBreweriesFoundException $ex) {\n $this->assertNotNull($ex);\n }\n }",
"public function test_check_on_earth_invalid()\n {\n $coord = new stdClass();\n $coord->x = -133;\n $coord->y = 5543;\n $checked = \\SimpleMappr\\Mappr::checkOnEarth($coord);\n $this->assertFalse($checked);\n }",
"public function testLocalSearchExceptionRadiusInvalid()\n {\n try {\n $this->_yahoo->localSearch('php', ['zip' => '95014', 'radius' => -1]);\n $this->fail('Expected Zend_Service_Exception not thrown');\n } catch (Zend_Service_Exception $e) {\n $this->assertStringContainsString('error occurred sending request', $e->getMessage());\n }\n }",
"public function testThrowingExceptionOnCreateFromJsonCaseIpMissing()\n {\n $this->expectException(Exception::class);\n $this->expectExceptionMessageMatches('/Provided JSON does not contain \\'clientAddress\\' attribute./');\n\n GeoData::createFromJson('{}');\n }",
"public function testExceptions()\n {\n $Location = new Location(self::$databaseName, self::$collection);\n $output = json_decode($Location->getAllCities('_id'));\n $this->assertEquals($output->error, \"true\");\n\n $output = json_decode($Location->getAllCities('india', true));\n $this->assertEquals($output->error, \"true\");\n\n $output = json_decode($Location->getAllCountries(true));\n $this->assertEquals($output->error, \"true\");\n }",
"public function testGetScheduleByInvalidScheduleLocationAddress() {\n\n\t\t$schedule = Schedule::getScheduleByScheduleLocationAddress($this->getPDO(), \"THIS ADDRESS DOES NOT EXIST\");\n\n\t\t$this->assertCOunt(0, $schedule);\n\t}",
"public function testGetLocationNotFound()\n {\n $locationId = 'id-test';\n\n $this->locationRepository\n ->expects($this->once())\n ->method('findOneBy')\n ->with(['id' => $locationId])\n ->will($this->returnValue(null));\n\n $this->setExpectedException(\n 'Doctrine\\ORM\\EntityNotFoundException'\n );\n\n $this\n ->locationServiceProviderAdapter\n ->getLocation($locationId);\n }",
"public function testThrowExceptionOnInvalidDogecoinAddress()\n {\n $this->expectException(Exceptions\\InvalidAddressFormatException::class);\n Wallet::validate(self::INVALID_ADDRESS, Wallet::DOGECOIN);\n }",
"public function test_address_region_validation()\n {\n /*\n * Valid\n */\n $validRegionLocation = Location::factory()->make([\n 'addressRegion' => 'Greater Manchester',\n ]);\n $validRegionData = $validRegionLocation->toArray();\n $this->post($this->route(), $validRegionData)->assertStatus(201);\n\n /**\n * Invalid: not a string\n */\n $nonStringLocation = Location::factory()->make([\n 'addressRegion' => ['invalid'],\n ]);\n $nonStringData = $nonStringLocation->toArray();\n\n $response = $this->post($this->route(), $nonStringData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.addressRegion', 'The address region must be a string.');\n }",
"public function testInsertInvalidLocation() {\n\t\t// create a Location with a non null location id and watch it fail\n\t\t$location = new Location(RootsTableTest::INVALID_KEY, $this->profile->getProfileId(), $this->payAttention, $this->sinCity, $this->granjalada, $this->stateOfMind, $this->warZone, $this->aptTwo, $this->whatHood);\n\t\t$location->insert($this->getPDO());\n\t}",
"public function testThrowExceptionOnInvalidEthereumAddress()\n {\n $this->expectException(Exceptions\\InvalidAddressFormatException::class);\n Wallet::validate(self::INVALID_ADDRESS, Wallet::ETHEREUM);\n }",
"public function testThrowExceptionOnInvalidLitecoinAddress()\n {\n $this->expectException(Exceptions\\InvalidAddressFormatException::class);\n Wallet::validate(self::INVALID_ADDRESS, Wallet::LITECOIN);\n }",
"public function testInvalidRegion()\n {\n $error = '';\n try {\n $this->mockEndpoint('Invalid Region supplied');\n $test = new Product(\n 'ACCESS_KEY',\n 'SECRET_KEY',\n 1\n );\n $test->addData(['SKU' => 'test123']);\n $test->send();\n } catch (Exception $e) {\n $error = $e->getMessage();\n }\n\n $this->assertEquals(\n 'Invalid Region supplied',\n $error\n );\n }",
"public function testGetLocationEmptyParam()\n {\n $this->setExpectedException('\\Exception');\n $instagram = new InstagramSocialMedia(false);\n $location = $instagram->getLocation(false);\n }",
"public function testThrowingExceptionOnCreateFromJsonCaseInvalidJson()\n {\n $this->expectException(Exception::class);\n $this->expectExceptionMessageMatches('/Unable to parse json. Message: .*/');\n\n GeoData::createFromJson('iNv-!aLiD-JSON');\n }",
"public function test_check_on_earth_valid()\n {\n $coord = new stdClass();\n $coord->x = -120;\n $coord->y = 43;\n $checked = \\SimpleMappr\\Mappr::checkOnEarth($coord);\n $this->assertTrue($checked);\n }",
"public function testFindByIpFailed()\n {\n $location = Location::find_by_ip('111.111.111.111');\n\n $this->assertNull($location);\n }",
"public function testSaveIpFailed()\n {\n $this->location->ip = 'This is not valid IP address';\n $this->expectException(DatabaseException::class);\n $this->location->save();\n }",
"public function test_address_locality_validation()\n {\n /*\n * Valid\n */\n $validRegionLocation = Location::factory()->make([\n 'addressLocality' => 'Salford',\n ]);\n $validRegionData = $validRegionLocation->toArray();\n $this->post($this->route(), $validRegionData)->assertStatus(201);\n\n /**\n * Invalid: not a string\n */\n $nonStringLocation = Location::factory()->make([\n 'addressLocality' => ['invalid'],\n ]);\n $nonStringData = $nonStringLocation->toArray();\n\n $response = $this->post($this->route(), $nonStringData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.addressLocality', 'The address locality must be a string.');\n }",
"public function testSaveCountryFailed()\n {\n $this->location->country = 'This is not valid Country name';\n $this->expectException(DatabaseException::class);\n $this->location->save();\n }",
"public function test_lat_lon_validation()\n {\n /*\n * Valid\n */\n $validLatLonLocation = Location::factory()->make([\n 'latitude' => '53.481932',\n 'longitude' => '-2.235981',\n ]);\n $validLatLonData = $validLatLonLocation->toArray();\n $this->post($this->route(), $validLatLonData)->assertStatus(201);\n\n /*\n * Invalid: missing\n */\n $missingLatLonLocation = Location::factory()->make();\n $missingLatLonData = $missingLatLonLocation->toArray();\n unset($missingLatLonData['latitude']);\n unset($missingLatLonData['longitude']);\n\n $response = $this->post($this->route(), $missingLatLonData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.latitude', 'The latitude field is required.');\n $response->assertJsonPath('meta.field_errors.longitude', 'The longitude field is required.');\n\n /*\n * Invalid: Not numerical\n *\n * Setting the values in `->make()` doesn't work as required because\n * the model casts those values to float, meaning our erroneous values\n * get converted to valid ones by the time we run the tests.\n */\n $nonNumericalLocation = Location::factory()->make();\n $nonNumericalData = $nonNumericalLocation->toArray();\n $nonNumericalData['latitude'] = 'invalid';\n $nonNumericalData['longitude'] = 'invalid';\n\n $response = $this->post($this->route(), $nonNumericalData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.latitude', 'The latitude must be a number.');\n $response->assertJsonPath('meta.field_errors.longitude', 'The longitude must be a number.');\n\n /*\n * Invalid: Out of range, min\n */\n $nonNumericalLocation = Location::factory()->make([\n 'latitude' => '-91.234567',\n 'longitude' => '-181.234567',\n ]);\n $nonNumericalData = $nonNumericalLocation->toArray();\n\n $response = $this->post($this->route(), $nonNumericalData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.latitude', 'The latitude must be at least -90.');\n $response->assertJsonPath('meta.field_errors.longitude', 'The longitude must be at least -180.');\n\n /*\n * Invalid: Out of range, max\n */\n $nonNumericalLocation = Location::factory()->make([\n 'latitude' => '91.234567',\n 'longitude' => '181.234567',\n ]);\n $nonNumericalData = $nonNumericalLocation->toArray();\n\n $response = $this->post($this->route(), $nonNumericalData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.latitude', 'The latitude must not be greater than 90.');\n $response->assertJsonPath('meta.field_errors.longitude', 'The longitude must not be greater than 180.');\n }",
"public function testPointStoreRouteInvalidFields()\n {\n $response = $this\n ->actingAs($this->user)\n ->from('/city/' . $this->city->id . '/point/create')\n ->post('/city/' . $this->city->id . '/point/store', [\n 'desc' => null,\n 'latitude' => -1000,\n 'longitude' => 'Laravel is awesome'\n ]);\n\n $response\n ->assertRedirect('/city/' . $this->city->id . '/point/create')\n ->assertStatus(302)\n ->assertSessionHasErrors(['desc', 'latitude', 'longitude']);\n\n $this->assertDatabaseMissing('points', ['lon' => 'Laravel is awesome']);\n }",
"public function testInvalidCountryCode()\n {\n $exception = null;\n $request = ['postal_code' => '75008'];\n $rules = ['postal_code' => 'postal_code:FOO'];\n $validator = $this->factory->make($request, $rules);\n\n $this->assertTrue($validator->fails());\n }",
"public function testSaveCityFailed()\n {\n $this->location->city = 'This is not valid City name - very long';\n $this->expectException(DatabaseException::class);\n $this->location->save();\n }",
"public function testRegisterPlaceException()\n {\n $placeRepositoryMock = \\Mockery::mock(PlaceRepositoryInterface::class)\n ->shouldReceive('update')\n ->andThrow(new \\Exception('error test', 500))\n ->getMock();\n\n $this->app->instance(PlaceRepositoryInterface::class, $placeRepositoryMock);\n\n $response = $this->post(route('place-update'), [\n \"id\" => $this->placeFactory->id,\n \"name\" => \"juan\",\n \"company_id\" => $this->companyFactory->id,\n \"is_active\" => 1\n ], [\n 'Accept' => 'application/json'\n ]);\n\n $response->assertStatus(500);\n }",
"public function testWebSearchRegion()\n {\n $this->_yahoo->webSearch('php', ['region' => 'nl']);\n try {\n $this->_yahoo->webSearch('php', ['region' => 'oops']);\n $this->fail('Expected Zend_Service_Exception not thrown');\n } catch (Zend_Service_Exception $e) {\n $this->assertStringContainsString(\"Invalid value for option 'region': oops\", $e->getMessage());\n }\n }",
"public function testWebSearchExceptionAdultOkInvalid()\n {\n try {\n $this->_yahoo->webSearch('php', ['adult_ok' => 'oops']);\n $this->fail('Expected Zend_Service_Exception not thrown');\n } catch (Zend_Service_Exception $e) {\n $this->assertStringContainsString('error occurred sending request', $e->getMessage());\n }\n }",
"public function test_address_country_validation()\n {\n /*\n * Valid\n */\n $validCountryLocation = Location::factory()->make([\n 'addressCountry' => 'United Kingdom',\n ]);\n $validCountryData = $validCountryLocation->toArray();\n $this->post($this->route(), $validCountryData)->assertStatus(201);\n\n /*\n * Invalid: missing\n */\n $missingCountryLocation = Location::factory()->make();\n $missingCountryData = $missingCountryLocation->toArray();\n unset($missingCountryData['addressCountry']);\n\n $response = $this->post($this->route(), $missingCountryData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.addressCountry', 'The address country field is required.');\n\n /**\n * Invalid: not a string\n */\n $nonStringLocation = Location::factory()->make([\n 'addressCountry' => ['invalid'],\n ]);\n $nonStringData = $nonStringLocation->toArray();\n\n $response = $this->post($this->route(), $nonStringData);\n $response->assertStatus(400);\n $response->assertJsonPath('meta.field_errors.addressCountry', 'The address country must be a string.');\n }",
"public function testGetScheduleByInvalidScheduleLocationName() {\n\n\t\t$schedule = Schedule::getScheduleByScheduleLocationName($this->getPDO(), \"THIS LOCATION NAME DOES NOT EXIST\");\n\n\t\t$this->assertCount(0, $schedule);\n\t}"
]
| [
"0.7338228",
"0.7184018",
"0.71201944",
"0.711983",
"0.6837268",
"0.68037355",
"0.6784723",
"0.66832143",
"0.66812533",
"0.6641753",
"0.6628628",
"0.6590509",
"0.6578969",
"0.64600754",
"0.64552325",
"0.6444178",
"0.6433546",
"0.6409083",
"0.63899344",
"0.6386205",
"0.63772196",
"0.63419557",
"0.6340886",
"0.633348",
"0.6297051",
"0.62815195",
"0.6270864",
"0.626331",
"0.6246852",
"0.62467813"
]
| 0.73615885 | 0 |
Test the service returns a full weather report. | public function testItReturnsFullWeatherReport()
{
$weather = json_decode($this->api->full_weather_report($this->location));
$this->assertObjectHasAttribute('weather', $weather);
$this->assertObjectHasAttribute('main', $weather);
$this->assertObjectHasAttribute('wind', $weather);
$this->assertObjectHasAttribute('clouds', $weather);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getWeatherData() {\n\t\t$this->cleanCache();\n\t\tif (!$this->useCache || !file_exists($this->cache_path) || @filemtime(($this->cache_path) + $this ->cachtime < time()) || file_get_contents($this->cache_path) == \"\") {\n\t\t\t$weather_api_url = \"http://query.yahooapis.com/v1/public/yql?q=select+%2A+from+weather.forecast+where+woeid%3D%22\".$this->location_code.\"%22+and+u%3D%22\".$this->unit.\"%22&format=json\";\n\t\t\t$rss_api_url = \"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20rss%20where%20url%3D%27http%3A%2F%2Fweather.yahooapis.com%2Fforecastrss%3Fw%3d\".$this->location_code.\"%26u%3d\".$this->unit.\"%27&format=json\";\n\n\t\t\t$data = $this->getContentFromUrl($weather_api_url);\n\t\t\t$data_forecast = $this->getContentFromUrl($rss_api_url);\n\t\t\tif ($this->isJson($data) && $this->isJson($data_forecast)) {\n\t\t\t\t$weather_assoc = json_decode($data, true);\n\t\t\t\tif ($weather_assoc[\"query\"][\"results\"][\"channel\"][\"title\"] == \"Yahoo! Weather - Error\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$weather_assoc_forecast = json_decode($data_forecast,true);\n\t\t\t\t$weather_assoc[\"query\"][\"results\"][\"channel\"][\"item\"][\"forecast\"]=$weather_assoc_forecast[\"query\"][\"results\"][\"item\"][\"forecast\"];\n\t\t\t\tif ($this->useCache) {\n\t\t\t\t\tfile_put_contents($this->cache_path.$this->cache_name, json_encode($weather_assoc));\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\t$weather_assoc = json_decode(file_get_contents($this->cache_path.$this->cache_name));\n\t\t}\n\t\t\n\t\treturn $weather_assoc[\"query\"][\"results\"][\"channel\"];\n\t}",
"public function testTemperatureSummary()\n {\n }",
"public function testOpenWeatherMapAPI() {\n $key = $this->api->key;\n if (isset($key) && strlen($key) === 32) {\n $response = $this->api->getWeatherData(37931);\n if ($response['data']) {\n $this->pass(\"We are able to get a response from the OpenWeatherMap API.\");\n }\n else {\n $this->fail(\"We are unable to get a response from the OpenWeatherMap API.\");\n }\n }\n else {\n $this->fail(\"We could not retrieve the API key.\");\n }\n }",
"private function extractOpenWeatherMapResult($json)\n {\n // check response status field\n if (!isset($json->cod)) {\n $this->errorMsg = \"'cod' field not found in the response object!\";\n return false;\n }\n \n // check response status field has success code\n if ($json->cod !== '200') {\n $this->errorMsg = \"API error! status code=\" . $json->cod;\n return false;\n }\n\n // check main data field\n if (!isset($json->list) || count($json->list) === 0) {\n $this->errorMsg = \"Weather forecast data not found in the response object!\";\n return false;\n }\n \n // display units will be different depends on selection\n $degree_simbol = $this->unit === 'FAHRENHEIT' ? \"<span>℉ </span>\" : \"<span>℃ </span>\";\n $wind_unit = $this->unit === 'FAHRENHEIT' ? \" m/h\" : \" m/s\";\n \n // OpenWeatherMap provide forecast data for every 3 hours.\n // calculating daily min, max temperature\n $prev = '';\n $count = 0;\n foreach ($json->list as $hour_data) {\n // convert timestamp in UTC to Japan time and extract day part\n $dt = gmdate(\"Y-m-d\", intval($hour_data->dt)+9*60*60);\n if ($dt === $prev) {\n // find dialy max values\n $weather->wind = max($weather->wind, floatval($hour_data->wind->speed));\n $weather->humidity = max($weather->humidity, floatval($hour_data->main->humidity));\n $weather->temp = max($weather->temp, intval($hour_data->main->temp));\n $weather->temp_min = min($weather->temp_min, intval($hour_data->main->temp_min));\n if ($weather->temp_max < intval($hour_data->main->temp_max)) {\n $weather->temp_max = intval($hour_data->main->temp_max);\n // get icon and description for max temp\n if (count($hour_data->weather) > 0) {\n $weather->description = $hour_data->weather[0]->main;\n $weather->icon = \"https://openweathermap.org/img/wn/\" . $hour_data->weather[0]->icon . \"@2x.png\";\n }\n }\n } else {\n if ($prev !== '') {\n // format and add object to the Area, if there are previos records\n $weather->wind = number_format(floatval($weather->wind), 2) . $wind_unit;\n $weather->humidity = $weather->humidity . \"%\";\n $weather->temp = $weather->temp . $degree_simbol;\n $weather->temp_min = $weather->temp_min . $degree_simbol;\n $weather->temp_max = $weather->temp_max . $degree_simbol;\n array_push($this->forecast, $weather);\n // 3 days forecast required\n if (++$count>2) {\n break;\n }\n }\n \n // next day start\n $weather = (object)[];\n $weather->dt = $dt;\n $prev = $dt;\n $weather->wind = floatval($hour_data->wind->speed);\n $weather->humidity = floatval($hour_data->main->humidity);\n $weather->temp = intval($hour_data->main->temp);\n $weather->temp_min = intval($hour_data->main->temp_min);\n $weather->temp_max = intval($hour_data->main->temp_max);\n if (count($hour_data->weather) > 0) {\n $weather->description = $hour_data->weather[0]->main;\n $weather->icon = \"https://openweathermap.org/img/wn/\" . $hour_data->weather[0]->icon . \"@2x.png\";\n }\n }\n }\n // if days are less than 3, add last object\n if ($count<2) {\n $weather->wind = number_format(floatval($weather->wind), 2) . $wind_unit;\n $weather->humidity = $weather->humidity . \"%\";\n $weather->temp = $weather->temp . $degree_simbol;\n $weather->temp_min = $weather->temp_min . $degree_simbol;\n $weather->temp_max = $weather->temp_max . $degree_simbol;\n array_push($this->forecast, $weather);\n }\n return true;\n }",
"public function shouldGetMonitoringStationInformation(): void\n {\n $expectedValue = [\n 'id' => $this->faker->randomDigitNotNull(),\n 'name' => $this->faker->text(50),\n 'coordinates' => [\n 'latitude' => $this->faker->latitude(),\n 'longitude' => $this->faker->longitude()\n ],\n 'url' => $this->faker->url()\n ];\n\n $this->waqi->shouldReceive('getMonitoringStation')\n ->once()\n ->withNoArgs()\n ->andReturn($expectedValue);\n\n $result = $this->waqi->getMonitoringStation();\n\n // Assertion of overall structure\n $this->assertValue($result, $expectedValue, 'array');\n\n // Assertion of each individual element\n foreach (['id' => 'int', 'name' => 'string', 'url' => 'string', 'coordinates' => 'array'] as $name => $type) {\n $this->assertValue($result[$name], $expectedValue[$name], $type);\n }\n\n // Assertion of the coordinates element\n $this->assertValue($result['coordinates']['longitude'], $expectedValue['coordinates']['longitude'], 'float');\n $this->assertValue($result['coordinates']['latitude'], $expectedValue['coordinates']['latitude'], 'float');\n }",
"public function shouldGetHumidity(): void\n {\n $this->assertPollutantLevel('getHumidity', $this->faker->randomFloat(2, -800, 1100));\n }",
"function pull_weather_for_day( \n $y = 2014,\n $m = 01,\n $d = 01,\n &$error = false )\n {\n // Build the URL to fetch\n //\n $date = date( 'Y', mktime( 0, 0, 0, $m, $d, $y ) )\n .date( 'm', mktime( 0, 0, 0, $m, $d, $y ) )\n .date( 'd', mktime( 0, 0, 0, $m, $d, $y ) );\n $url = sprintf( $this->_api, WU_KEY, $date );\n\n // Get the url and create a json object\n //\n if ( ! $contents = @file_get_contents( $url ) ) {\n $error = \"Error getting the file contents\";\n return false;\n }\n $json = json_decode( $contents );\n\n // Run through the array and build out the hours\n //\n $observations = $json->history->observations;\n $conditions = array();\n if ( is_array( $observations ) && count( $observations ) > 0 ) {\n foreach ( $observations as $key => $data ) {\n $hour = $data->date->hour;\n $conditions[$hour][ 'temp' ] = $data->tempi;\n $conditions[$hour][ 'cond' ] = $data->conds;\n }\n } else {\n $error = \"The observations json object was empty\";\n return false;\n }\n\n // Now get the daily summary and make it key 24\n //\n $summary = $json->history->dailysummary;\n if ( is_array( $summary ) && count( $summary ) > 0 ) {\n foreach ( $summary as $data ) {\n $conditions[ 'day' ][ 'mint' ] = $data->mintempi;\n $conditions[ 'day' ][ 'maxt' ] = $data->maxtempi;\n $conditions[ 'day' ][ 'noon' ] = $conditions[12][ 'cond' ];\n $conditions[ 'day' ][ 'rain' ] = $data->rain;\n $conditions[ 'day' ][ 'fog' ] = $data->fog;\n $conditions[ 'day' ][ 'snow' ] = $data->snow;\n $conditions[ 'day' ][ 'hail' ] = $data->hail;\n $conditions[ 'day' ][ 'thunder' ] = $data->thunder;\n $conditions[ 'day' ][ 'tornado' ] = $data->tornado;\n }\n } else {\n $error = \"The daily summary json object was empty\";\n return false;\n }\n\n return $conditions;\n }",
"private function extractWeatherBitResult($json)\n {\n // check main data field\n if (!isset($json->data)) {\n $this->errorMsg = \"'data' field not found in the response object!\";\n return false;\n }\n // check main data field has records \n if (count($json->data) === 0) {\n $this->errorMsg = \"Weather forecast data not found in the response object!\";\n return false;\n }\n \n // display units will be different depends on selection\n $degree_simbol = $this->unit === 'FAHRENHEIT' ? \"<span>℉ </span>\" : \"<span>℃ </span>\";\n $wind_unit = $this->unit === 'FAHRENHEIT' ? \" m/h\" : \" m/s\";\n\n // weatherBit provide daily forecast data\n foreach ($json->data as $day_data) {\n $weather = (object)[];\n $weather->dt = $day_data->valid_date; // date\n $weather->wind = number_format(floatval($day_data->wind_spd), 2) . $wind_unit;\n $weather->humidity = $day_data->rh . \"%\";\n $weather->temp = $day_data->temp . $degree_simbol;\n $weather->temp_min = round($day_data->min_temp) . $degree_simbol;\n $weather->temp_max = round($day_data->max_temp) . $degree_simbol;\n $weather->description = $day_data->weather->description;\n // make icon image url using icon code\n $weather->icon = \"https://www.weatherbit.io/static/img/icons/\" . $day_data->weather->icon . \".png\";\n array_push($this->forecast, $weather);\n } \n return true;\n }",
"public function shouldGetTemperature(): void\n {\n $this->assertPollutantLevel('getTemperature', $this->faker->randomFloat(2, -100, 100));\n }",
"function getWeather(){\n\t\t$this->racine->asXml();\n\t}",
"public function testReturnsStringIfExistingEndpointRequested()\n {\n $result = $this->apiCaller->retrieve('http://api.openweathermap.org/data/2.5');\n $this->assertTrue(is_string($result));\n }",
"public function fetchWeatherInfo()\n {\n if ($this->latitude && $this->latitude) {\n $cUrl = $this->di->get(\"callurl\");\n $args = $this->buildArgs();\n $apiResult = $cUrl->fetchConcurrently(\n $args[\"urls\"],\n $args[\"params\"],\n $args[\"queries\"]\n );\n\n if (isset($apiResult[0][\"error\"])) {\n $this->setErrorMessage(\"DarkSkyError: \" . $apiResult[0]['error']);\n }\n\n $pastDays = array(\"data\" => []);\n\n $resultCount = count($apiResult);\n\n for ($i=1; $i<$resultCount; $i++) {\n if ($apiResult[$i] && isset($apiResult[$i][\"daily\"][\"data\"][0])) {\n array_push($pastDays[\"data\"], $apiResult[$i][\"daily\"][\"data\"][0]);\n }\n }\n\n // var_dump($apiResult);\n\n if ($apiResult[0]) {\n $this->fillInfo(\n array_merge($apiResult[0], array(\"pastDays\" => $pastDays)),\n [\n \"currently\",\n \"hourly\",\n \"daily\",\n \"pastDays\"\n ]\n );\n } else {\n $this->setErrorMessage(\"DarkSkyError: daily usage limit exceeded\");\n }\n }\n return $this->getWeatherInfo();\n }",
"private function getWeatherBit()\n {\n $url = 'https://api.weatherbit.io/v2.0/forecast/daily';\n $url .= '?lat=' . $this->location->lat;\n $url .= '&lon=' . $this->location->lng;\n $url .= '&units=' . ($this->unit === \"FAHRENHEIT\" ? \"I\" : \"M\");\n $url .= '&days=3'; // default return 16 days forecast. Using forecast of 3 days.\n $url .= '&key=' . $GLOBALS['apikey_weatherbit'];\n $result = $this->callAPI($url);\n return $result ? $this->extractWeatherBitResult(json_decode($result)) : false;\n }",
"function meteoGreg(){\r\n $curl = curl_init();\r\n \r\n curl_setopt_array($curl, array(\r\n CURLOPT_URL => \"api.openweathermap.org/data/2.5/find?q=Prévenchères&units=metric&appid=d196fbd705116ddcd1911b5c8606c6e0&lang=fr\",\r\n CURLOPT_RETURNTRANSFER => true,\r\n CURLOPT_TIMEOUT => 30,\r\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\r\n CURLOPT_CUSTOMREQUEST => \"GET\",\r\n CURLOPT_HTTPHEADER => array(\r\n \"cache-control: no-cache\"\r\n ),\r\n ));\r\n \r\n $response = curl_exec($curl);\r\n \r\n curl_close($curl);\r\n \r\n $response = json_decode($response, true);\r\n echo(\"<p style='text-align:center; color:#373737;'>Le temps à <b>Prévenchères</b> est actuellement <b>\".$response['list'][0]['weather'][0]['description'].\"</b> et la température est de <b>\".intval($response['list'][0]['main']['temp']).\"°C</b></p>\");\r\n}",
"public function test_that_someone_can_get_wind_information_with_zipcode() {\n $zip = substr($this->faker()->postcode(), 0, 5);\n $response = $this->json('GET', \"/api/v1/wind/{$zip}\");\n\n $response->assertStatus(200)\n ->assertJsonStructure([\n 'speed',\n 'direction',\n ]);\n\n }",
"public function testGetData()\n {\n $this->getWeather->setUrl();\n $result = $this->getWeather->getData();\n\n $this->assertIsArray($result);\n }",
"public function getWeather()\n {\n return $this->apiWeather === 'WeatherBit.io' ? $this->getWeatherBit() : $this->getOpenWeatherMap();\n }",
"function get_wheather_data_rounded_off($city)\n {\n $config = \\Drupal::config('weather.settings');\n $appid= $config->get('appid');\n $client = new Client();\n $response = $client->request('GET', 'https://samples.openweathermap.org/data/2.5/weather?q='.$city.'&appid='.$appid);\n $res = Json::decode($response->getBody());\n $temp_min = ceil($res['main']['temp_min']);\n $temp_max = ceil($res['main']['temp_max']);\n $pressure = ceil($res['main']['pressure']);\n $humidity = ceil($res['main']['humidity']);\n $speed = ceil($res['wind']['speed']);\n //this only for debugging purpose if whether it is rounded off or not\n \\Drupal::logger('my_module')->notice(\"temp min:\".$temp_min.\" temp max:\".$temp_max.\" pressure:\".$pressure.\" humidity:\".$humidity.\" speed:\".$speed);\n return array(\n '#temp_min' => $temp_min,\n '#temp_max' => $temp_max,\n '#pressure' => $pressure,\n '#humidity' => $humidity,\n '#wind' => $speed,\n );\n }",
"public function testGetForecast()\n {\n }",
"public function ttsWeather() {\n\t\t// https://www.prevision-meteo.ch/uploads/pdf/recuperation-donnees-meteo.pdf\n\t\t$data = json_decode(file_get_contents(Flight::get(\"ttsWeather\")),true);\n\n\t\t$txt = \"Bonjour, voici la météo pour aujourd'hui: Il fait actuellement \".$data['current_condition']['tmp'].\"°.\";\n\t\t$txt .= \" Les températures sont prévues entre \".$data['fcst_day_0']['tmin'].\" et \".$data['fcst_day_0']['tmax'].\"°.\";\n\t\t$txt .= \" Conditions actuelles: \".$data['current_condition']['condition'].\", Conditions pour la journée: \".$data['fcst_day_0']['condition'];\n\t\tself::playTTS($txt);\n\t}",
"private function initWeather() {\n\t\t$weather = $this->_workflow->read ( $this->_query );\n\t\t$file_time = $this->_workflow->filetime ( $this->_query );\n\t\tif (! empty ( $weather ) && $file_time && time () - $file_time <= self::LIFETIME) {\n\t\t\t$this->_weather = $weather;\n\t\t\treturn;\n\t\t}\n\t\tif ($this->_query == self::QUERY_DEFAULT) {\n\t\t\t$url = sprintf ( self::ENDPOINT, '' );\n\t\t} else {\n\t\t\t$url = sprintf ( self::ENDPOINT, $this->_query );\n\t\t}\n\t\t$response = $this->_get ( $url );\n\t\t$response && $response = json_decode ( $response, true );\n\t\tif (0 == $response ['errNo'] && isset ( $response ['data'] ['weather'] ['content'] )) {\n\t\t\t$this->_weather = $response ['data'] ['weather'] ['content'];\n\t\t\t$this->_workflow->write ( $this->_weather, $this->_query );\n\t\t} elseif (! empty ( $weather ) && $file_time) {\n\t\t\t$this->_weather = $weather;\n\t\t} else {\n\t\t\tthrow new Exception ( 'response_error' );\n\t\t}\n\t}",
"public function fetchWeatherWeekly(){\n\t $url = \"http://opendata.cwb.gov.tw/opendata/MFC/F-C0032-005.xml\"; // 7days\n\t $forecasting = $this->fetchWeather($url);\n\t \n\t return $forecasting;\n\t}",
"private function getOpenWeatherMap()\n {\n $url = 'https://api.openweathermap.org/data/2.5/forecast';\n $url .= '?lat=' . $this->location->lat;\n $url .= '&lon=' . $this->location->lng;\n $url .= '&units=' . ($this->unit === \"FAHRENHEIT\" ? \"imperial\" : \"metric\");\n $url .= '&appid=' . $GLOBALS['apikey_openweathermap'];\n $result = $this->callAPI($url);\n return $result ? $this->extractOpenWeatherMapResult(json_decode($result)) : false;\n }",
"private function _get_windmeters() {\n\t\tif (!$this->_get_data('wilist')) { \n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//Set all the windmeter values\n\t\tunset($this->windmeters);\n\t\tforeach ($this->raw->response as $key=>$value) {\n\t\t\t$this->windmeters->{$key} = $value;\t\t\n\t\t}\n\t\t\n\t\treturn true;\n\t}",
"public function getWeatherData()\n {\n return $this->service->getWeatherData();\n }",
"public function getCurrentWeather() {\n\t\t$weather = $this->APIRequest([\n\t\t\t'lat' => $this->lat,\n\t\t\t'lon' => $this->lng,\n\t\t\t'units' => 'metric'\n\t\t]);\n\t\t\n\t\t$weather = $this->getRelevantData($weather);\n\t\t$this->weatherReportCache = $weather;\n\t\t\n\t\treturn $weather;\n\t}",
"public function getDarkSkyForecastData($args) {\n if (!$this->apiKey) {\n Log::notice($this->apiName . \" API key missing\");\n return false;\n }\n\n // check rate limiting before calling api\n $rateLimit = $this->getRateLimit($this->apiName);\n if ($rateLimit) {\n return false;\n }\n\n // connect to api\n Log::info(\"Calling \" . $this->apiName . \" forecast API for \" . $args['city']->name);\n $url = $this->getUrl($args['city']);\n $data = $this->connect->getData($url, $this->apiName);\n\n if (!$data || empty($data)) {\n Log::info($this->apiName . \" forecast data not found for \" . $args['city']->name);\n return false;\n }\n\n $today = $data->daily->data[0];\n $tomorrow = $data->daily->data[1];\n\n $this->saveDarkSkyData($args['city'], $today);\n $this->saveDarkSkyData($args['city'], $tomorrow);\n\n return true;\n }",
"public function testReportsSummaryGet()\n {\n }",
"public function getToday(){\n\t\ttry{\n\t\t\tif(!empty($this->_city) && !empty($this->_country)){\n\t\t\t\t//get the xml for the weather\n\t\t\t\t$this->url = str_replace(\"city\",$this->_city, $this->url);\n\t\t\t\t$this->url = str_replace(\"country\",$this->_country, $this->url);\n\t\t\t\t$this->url = str_replace(\" \",\"\",$this->url);\n\t\t\t\t$xml = utf8_encode(file_get_contents($this->url));\n\t\t\t\t$xml = simplexml_load_string($xml);\n\n\t\t\t\tif($xml->weather->current_conditions->condition['data']){ \n\t\t\t\t\t$this->today['currentWeather'] = $xml->weather->current_conditions->condition['data'];\n\t\t\t\t\t$this->today['currentTemperature'] = $xml->weather->current_conditions->temp_f['data'];\n\t\t\t\t\t$this->today['picture'] = $this->url_image.$xml->weather->current_conditions->icon['data'];\n\t\t\t\t\treturn $this->today;\n\t\t\t\t} \n\t\t\t}\n\t\t\treturn false;\n\t\t}catch(Exception $e){\n\t\t\t//log error +\n\t\t\tthrow new Exception (\"Error - please try again.\");\n\t\t}\n\t}",
"public static function _ServiceWeather($parm=false)\n\t{\n\t\t$data = $parm == false ? self::$_args : $parm;\n\n\t\tif($data == null)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse\n\t\t{\n\t\t \tif(method_exists('cURLs','access_curl'))\n\t\t \t{\n\t\t\t\t$server = self::BASE_API;\n\t\t\t\t$key = isset($data['key']) ? $data['key'] : self::$_api_key;\n\t\t\t\t$lang = isset($data['lang']) ? $data['lang'] : self::BASE_LANG;\n\t\t\t\t$city = isset($data['city']) ? $data['city'] : self::BASE_CITY;\n\t\t\t\t$city = preg_replace('/ /','',$city);\n\t\t\t\t$forecast = isset($data['forecast']) ? ($data['forecast'] == true ? 'forecast/' : '') : '';\n\t\t\t\t$API_ENDPOINT = $server.'/'.$key.'/conditions/'.$forecast.'lang:'.$lang.'/q/'.$city.'.json';\n\n\t\t\t\t$cURL = new cURLs(array('url'=>$API_ENDPOINT,'type'=>'data'));\n\t\t\t\t$get = $cURL->access_curl();\n\n\t\t\t\t$decode = json_decode($get,true);\n\n\t\t\t\tif(isset($decode['response']['error']) || \n\t\t\t\t\tisset($decode['response']['results']))\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn $get;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}"
]
| [
"0.636361",
"0.626142",
"0.62533706",
"0.6181102",
"0.6147571",
"0.61386526",
"0.6057191",
"0.6029779",
"0.59923106",
"0.59772474",
"0.59524965",
"0.58934015",
"0.5854906",
"0.58404315",
"0.5816359",
"0.57868946",
"0.5771266",
"0.5761259",
"0.57552344",
"0.5724956",
"0.57214546",
"0.56943566",
"0.56756115",
"0.5674251",
"0.56546295",
"0.56335646",
"0.5620646",
"0.5618041",
"0.5611866",
"0.5588008"
]
| 0.82968783 | 0 |
Find the URI exactly matching the supplied GS1 Key and value | public function readURIRecord($gs1Key, $gs1Value)
{
//Set up the correct collection:
$collection = $this->mongoDbClient->gs1resolver->uri;
//Build the "_id" value which will be used to serach MongoDB - format is "/gs1Key/gs1Value"
//Uses $this->formatGS1Value to make sure that the value is consistent with the format of the gs1Key stored
////in the database:
$id = '/' . $gs1Key . '/' . $this->formatGS1Value($gs1Key, $gs1Value);
//Search and retrieve the document
try
{
$result = $collection->findOne(['_id' => $id]);
}
catch (MongoDB\Driver\Exception\ConnectionTimeoutException $cte)
{
file_put_contents('php://stderr', "Error calling MongodDB: " . print_r($cte, true). PHP_EOL);
return json_decode('{"Error", "MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details"}');
}
//Return the complete document as a result
file_put_contents('php://stderr', "JSON version of MongoDB URI record: " . json_encode($result). PHP_EOL);
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_value_uri($uri, $key){\n $find = $key.'=';\n $v_pos = strpos($uri, $find);\n $v_p = $v_pos;\n if($v_pos!==false){\n $v_pos += strlen($find);\n $v_tmp = substr($uri,$v_pos);\n $v_pos = strpos($v_tmp,'&');\n if($v_pos>0){\n return substr($v_tmp,0,$v_pos);\n }else{\n return $v_tmp;\n }\n }else return '';\n}",
"public function uriKey(): string;",
"private function exactMatchUrlValue() {\n if ($this->blExactMatch) {\n return IFinder::REST_QUESTION_MARK;\n } else {\n return IFinder::REST_QUESTION_MARK . PubChemFinder::REST_NAME_SPECIFICATION . PubChemFinder::REST_AMPERSAND;\n }\n }",
"public function findWhereUri($uri);",
"public function match( $pURI );",
"public function readGCPRecord($gs1Key, $gs1Value)\n {\n //Set up the correct collection:\n $collection = $this->mongoDbClient->gs1resolver->gcp;\n\n //Build the \"_id\" value which will be used to serach MongoDB - format is \"/gs1Key/gs1Value\"\n //Uses $this->formatGS1Value to make sure that the value is consistent with the format of the gs1Key stored\n ////in the database:\n $formattedGS1Value = $this->formatGS1Value($gs1Key, $gs1Value);\n\n $result = null;\n $searchCharsLength = strlen($gs1Value) - 1;\n while($result === null)\n {\n $id = '/' . $gs1Key . '/' . $gs1Value;\n file_put_contents('php://stderr', \"Searching MongoDB GCP record: $id\" . PHP_EOL);\n try\n {\n $result = $collection->findOne(['_id' => $id]);\n }\n catch (MongoDB\\Driver\\Exception\\ConnectionTimeoutException $cte)\n {\n file_put_contents('php://stderr', \"Error calling MongodDB: \" . print_r($cte, true). PHP_EOL);\n return json_decode('{\"Error\", \"MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details\"}');\n }\n if($result === null && $searchCharsLength > 3)\n {\n $searchCharsLength--;\n $gs1Value = substr($gs1Value, 0, $searchCharsLength);\n }\n else\n {\n break;\n }\n }\n\n //Return the complete document as a result\n file_put_contents('php://stderr', \"JSON version of MongoDB GCP record: \" . json_encode($result). PHP_EOL);\n return $result;\n }",
"public function &find($key, $val)\n {\n\n $val = trim($val, '/');\n echo \" ($key ::: $val)\";\n if ($val === 'azankaraplop') {\n $val = null;\n return $val;\n }\n\n if ($key === 'path') {\n $res = &$this->paths[$val] ?? null;\n return $res;\n }\n\n if ($key === 'url') {\n $res = &$this->urls[$val] ?? null;\n\n return $res;\n }\n foreach ($this->elts as $id => &$elt) {\n if ($elt && $elt[$key] === $val) {\n return $elt;\n }\n }\n\n $val = null;\n return $val;\n }",
"public function match ($uri);",
"public function match($uri);",
"function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Uri_alias',$k,$v); }",
"public static function lookupMigrateDestinationIdByKeyPath(string $source_key_uri, array $migrations, string $trim_path = '') {\n $found_id = '';\n if (!empty($source_key_uri)) {\n // Go search.\n self::trimPath($source_key_uri, $trim_path);\n foreach ($migrations as $migration) {\n $map_table = \"migrate_map_{$migration}\";\n $database = \\Drupal::database();\n $result = $database->select($map_table, 'm')\n ->condition('m.sourceid1', \"%\" . $database->escapeLike($source_key_uri), 'LIKE')\n ->fields('m', ['destid1'])\n ->execute()\n ->fetchAll();\n\n // Should only have one result.\n if (count($result) === 1) {\n // We got 1, call off the search.\n $mapkey = reset($result);\n $found_id = $mapkey->destid1;\n break;\n }\n }\n }\n\n return $found_id;\n }",
"function KeyUrl($url, $parm = \"\") {\n\t\t$sUrl = $url . \"?\";\n\t\tif ($parm <> \"\") $sUrl .= $parm . \"&\";\n\t\tif (!is_null($this->rid->CurrentValue)) {\n\t\t\t$sUrl .= \"rid=\" . urlencode($this->rid->CurrentValue);\n\t\t} else {\n\t\t\treturn \"javascript:ew_Alert(ewLanguage.Phrase('InvalidRecord'));\";\n\t\t}\n\t\treturn $sUrl;\n\t}",
"protected function findValueToMatch($requestPath)\n\t{\n\t\t// var_dump(\"findValueToMatch($requestPath)\");\n\t\treturn $requestPath;\n\t}",
"public function testGetKeyUriWithOptionHasImage() {\n // accept the image option in freeotp type.\n $this->assertEquals(\n 'otpauth://totp/[email protected]?secret=secret&image=the_image',\n GoogleAuthenticator::getKeyUri('totp', '[email protected]', 'secret', null, ['image' => 'the_image'])\n );\n }",
"function foaf_ssl_match_user($person_uri, $presented_modulus, $presented_exponent) {\n $parser = ARC2::getRDFParser();\n $parser->parse($person_uri);\n\n $rdf_index = $parser->getSimpleIndex();\n\n // Required namespaces.\n $rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns';\n $rsa = 'http://www.w3.org/ns/auth/rsa';\n $cert = 'http://www.w3.org/ns/auth/cert';\n\n // First, get a list of certificates matching the person.\n $matched_certificates = rdf_get_resources($rdf_index, array(\n $rdf . '#type' => $rsa . '#RSAPublicKey',\n $cert . '#identity' => $person_uri,\n ));\n\n // Iterate over the certicates to find a matching modulus, public exponent.\n foreach ($matched_certificates as $certificate_subject) {\n if (!isset($rdf_index[$certificate_subject])) {\n // The certificate is not in the graph.\n continue;\n }\n\n $certificate = $rdf_index[$certificate_subject];\n $modulus = NULL;\n $public_exponent = NULL;\n\n // Iterate over the modules to find a candidate.\n if (isset($certificate[$rsa . '#modulus'])) {\n foreach ($certificate[$rsa . '#modulus'] as $modulus_subject) {\n if ($modulus = _foaf_cert_get_key_value($rdf_index[$modulus_subject])) {\n break;\n }\n }\n }\n\n // Iterate over the public exponents to find a candidate.\n if (isset($certificate[$rsa . '#public_exponent'])) {\n foreach ($certificate[$rsa . '#public_exponent'] as $exponent_subject) {\n if ($public_exponent = _foaf_cert_get_key_value($rdf_index[$exponent_subject])) {\n break;\n }\n }\n }\n\n if (isset($modulus) && isset($public_exponent)) {\n // Try to match that certificate to what was presented by the user.\n if ($modulus == $presented_modulus && $public_exponent == $presented_exponent) {\n // Yay!\n return TRUE;\n }\n }\n }\n return FALSE;\n}",
"public function getUrl(string $sKey = null): string;",
"function KeyUrl($url, $parm = \"\") {\n\t\t$sUrl = $url . \"?\";\n\t\tif ($parm <> \"\") $sUrl .= $parm . \"&\";\n\t\tif (!is_null($this->gjd_id->CurrentValue)) {\n\t\t\t$sUrl .= \"gjd_id=\" . urlencode($this->gjd_id->CurrentValue);\n\t\t} else {\n\t\t\treturn \"javascript:ew_Alert(ewLanguage.Phrase('InvalidRecord'));\";\n\t\t}\n\t\treturn $sUrl;\n\t}",
"public function findFirstByKey($key);",
"public function get($strKey);",
"function maps_actual_url($url, $uriapp = NULL){\n //Elimino el primer caracter si es igual a \"/\"\n if(substr($url, 0, 1) == \"/\"){\n $url= substr($url, 1);\n } \n //Separa la url pasada y la uri en partes para poder analizarlas\n $partes_url= explode(\"/\", $url);\n \n //Saco de la uri actual los parametros\n $uri_explode= explode(\"?\", URIAPP);\n if($uriapp != NULL){\n $uri_explode= explode(\"?\", $uriapp);\n }\n $uri_front= $uri_explode[0];\n //Separo la uri actual\n $partes_uri_actual= explode(\"/\", $uri_front); \n $mapea= TRUE; \n //Analiza que url-uri tiene mas elementos\n if(count($partes_url) >= count($partes_uri_actual)){\n //Si el tamano de la url es igual o mayor que la uri actual uso el for recorriendo las partes de la url\n $count_partes_uri= count($partes_url);\n for($i= 0; $i < $count_partes_uri; $i++) {\n if(count($partes_uri_actual) >= ($i + 1)){\n //Si hay un * no me importa que viene despues, mapea todo, no deberia haber nada despues\n if($partes_url[$i] != \"*\"){\n $pos_ocurrencia= strpos($partes_url[$i], \"*\");\n if($pos_ocurrencia != FALSE){\n $parte_url= explode(\"*\", $partes_url[$i]);\n $parte_url= $parte_url[0];\n if(strlen($partes_uri_actual[$i]) >= strlen($parte_url)){\n $parte_uri_actual= substr($partes_uri_actual[$i], 0, strlen($parte_url));\n if($parte_url == $parte_uri_actual){\n break;\n }\n else{\n $mapea= FALSE;\n break;\n }\n }\n else{\n $mapea= FALSE;\n break;\n }\n }\n //Si alguna esta vacia no compara el mapeo con () y voy directo a la comparacion\n if(empty($partes_url[$i]) || empty($partes_uri_actual[$i])){\n //Si no coinciden las partes no mapean\n if($partes_url[$i] != $partes_uri_actual[$i]){\n $mapea= FALSE;\n break;\n }\n }\n else{\n //Si la parte de la uri empieza con ( y termina con ) puede ir cualquier string ahi por lo que pasa directamente esta parte de la validacion\n if(! ($partes_url[$i]{0} == \"(\" and $partes_url[$i]{strlen($partes_url[$i]) -1} == \")\")){\n //Si no contiene ( y ) debe mapear\n //Si no coinciden las partes no mapean\n if($partes_url[$i] != $partes_uri_actual[$i]){\n $mapea= FALSE;\n break;\n }\n }\n }\n }\n else{\n break;\n }\n }\n else{\n //La uri actual no tiene mas partes y no hay coincidencia completa\n $mapea= FALSE;\n break;\n }\n } \n }\n else{\n //Si el tamano de la url pasada es menor que la uri uso el for recorriendo las partes de la uri\n $count_partes_uri_actual= count($partes_uri_actual);\n for($i= 0; $i < $count_partes_uri_actual; $i++){\n if(count($partes_url) >= ($i + 1)){ \n //Si hay un * no me importa que viene despues, mapea todo, no deberia haber nada despues\n if($partes_url[$i] != \"*\"){\n $pos_ocurrencia= strpos($partes_url[$i], \"*\");\n if($pos_ocurrencia != FALSE){\n $parte_url= explode(\"*\", $partes_url[$i]);\n $parte_url= $parte_url[0];\n if(strlen($partes_uri_actual[$i]) >= strlen($parte_url)){\n $parte_uri_actual= substr($partes_uri_actual[$i], 0, strlen($parte_url));\n if($parte_url == $parte_uri_actual){\n break;\n }\n else{\n $mapea= FALSE;\n break;\n }\n }\n else{\n $mapea= FALSE;\n break;\n }\n }\n //Si alguna esta vacia no compara el mapeo con () y voy directo a la comparacion\n if(empty($partes_url[$i]) || empty($partes_uri_actual[$i])){\n //Si no coinciden las partes no mapean\n if($partes_url[$i] != $partes_uri_actual[$i]){\n $mapea= FALSE;\n break;\n }\n }\n else{\n //Si la parte de la uri empieza con ( y termina con ) puede ir cualquier string ahi por lo que pasa directamente esta parte de la validacion\n if(! ($partes_url[$i]{0} == \"(\" and $partes_url[$i]{strlen($partes_url[$i]) -1} == \")\")){\n //Si no contiene ( y ) debe mapear \n //Si no coinciden las partes no mapean\n if($partes_url[$i] != $partes_uri_actual[$i]){\n $mapea= FALSE;\n break;\n }\n }\n }\n }\n else{\n break;\n }\n }\n else{\n //La url pasada no tiene mas partes y no hay coincidencia completa\n $mapea= FALSE;\n break;\n }\n }\n } \n return $mapea;\n }",
"function get_the_image_by_meta_key( $args = array() ) {\n\n\t/* If $meta_key is not an array. */\n\tif ( !is_array( $args['meta_key'] ) )\n\t\t$args['meta_key'] = array( $args['meta_key'] );\n\n\t/* Loop through each of the given meta keys. */\n\tforeach ( $args['meta_key'] as $meta_key ) {\n\n\t\t/* Get the image URL by the current meta key in the loop. */\n\t\t$image = get_post_meta( $args['post_id'], $meta_key, true );\n\n\t\t/* If an image was found, break out of the loop. */\n\t\tif ( !empty( $image ) )\n\t\t\tbreak;\n\t}\n\n\t/* If a custom key value has been given for one of the keys, return the image URL. */\n\tif ( !empty( $image ) )\n\t\treturn array( 'src' => $image );\n\n\treturn false;\n}",
"public static function _zend_hash_find_known_hash(HashTable $ht, ZendString $key): Zval {\n }",
"function KeyUrl($url, $parm = \"\") {\n\t\t$sUrl = $url . \"?\";\n\t\tif ($parm <> \"\") $sUrl .= $parm . \"&\";\n\t\tif (!is_null($this->IDXDAFTAR->CurrentValue)) {\n\t\t\t$sUrl .= \"IDXDAFTAR=\" . urlencode($this->IDXDAFTAR->CurrentValue);\n\t\t} else {\n\t\t\treturn \"javascript:ew_Alert(ewLanguage.Phrase('InvalidRecord'));\";\n\t\t}\n\t\treturn $sUrl;\n\t}",
"function searchURI()\t{\n return $this->getRandomString(mt_rand(0,100));\n\t}",
"public function testGetKeyUriWithOptionHasOtherAlgorithm() {\n // the options have the algorithm key.\n $this->assertEquals(\n 'otpauth://hotp/[email protected]?secret=secret&counter=123&algorithm=SHA2',\n GoogleAuthenticator::getKeyUri('hotp', '[email protected]', 'secret', 123, ['algorithm' => 'SHA2'])\n );\n }",
"public function getUriParameter($key) {\n $on_console = $this->getRequest() instanceof \\Zend\\Console\\Request;\n\n if( !$on_console and $this->params()->fromQuery($key) != null )\n return $this->params()->fromQuery($key);\n if( $this->getEvent()->getRouteMatch()->getParam($key) != null )\n return $this->getEvent()->getRouteMatch()->getParam($key);\n return false;\n }",
"function findDocumentByKeyValue($dbName, $collectionName, $key, $value) {\n\n Util::throwExceptionIfNullOrBlank($dbName, \"DataBase Name\");\n Util::throwExceptionIfNullOrBlank($collectionName, \"Collection Name\");\n Util::throwExceptionIfNullOrBlank($key, \"KEY\");\n Util::throwExceptionIfNullOrBlank($value, \"Value\");\n $encodedDbName = Util::encodeParams($dbName);\n $encodedCollectionName = Util::encodeParams($collectionName);\n $encodedKey = Util::encodeParams($key);\n $encodedValue = Util::encodeParams($value);\n $objUtil = new Util($this->apiKey, $this->secretKey);\n try {\n\t\t $params = null;\n $headerParams = array();\n $queryParams = array();\n $signParams = $this->populateSignParams();\n $metaHeaders = $this->populateMetaHeaderParams();\n $headerParams = array_merge($signParams, $metaHeaders);\n $signParams['dbName'] = $dbName;\n $signParams['collectionName'] = $collectionName;\n $signParams['key'] = $key;\n $signParams['value'] = $value;\n $signature = urlencode($objUtil->sign($signParams)); //die();\n $headerParams['signature'] = $signature;\n $contentType = $this->content_type;\n $accept = $this->accept;\n $baseURL = $this->url;\n $baseURL = $baseURL . \"/findDocByKV\" . \"/dbName\" . \"/\" . $encodedDbName . \"/collectionName\" . \"/\" . $encodedCollectionName . \"/\" . $encodedKey . \"/\" . $encodedValue;\n $response = RestClient::get($baseURL, $params, null, null, $contentType, $accept, $headerParams);\n //return $response;\n\n $storageResponseObj = new StorageResponseBuilder();\n $storageObj = $storageResponseObj->buildResponse($response->getResponse());\n } catch (App42Exception $e) {\n throw $e;\n } catch (Exception $e) {\n throw new App42Exception($e);\n }\n return $storageObj;\n }",
"public function findMatch(\\string $uri, \\string $method);",
"public function find ($key);",
"abstract public function getUri();"
]
| [
"0.6636099",
"0.5990966",
"0.53561777",
"0.52989954",
"0.52345985",
"0.51744723",
"0.508457",
"0.50814474",
"0.50533617",
"0.4993458",
"0.49618834",
"0.49398518",
"0.48953855",
"0.48890015",
"0.4871537",
"0.4867703",
"0.4830897",
"0.48173887",
"0.48146367",
"0.48107654",
"0.48076",
"0.47961912",
"0.47710595",
"0.4752039",
"0.47387978",
"0.47372246",
"0.47174186",
"0.47145784",
"0.47050285",
"0.4700488"
]
| 0.6420572 | 1 |
Find the WellKnown record for GS1 Resolver | public function readWellKnownRecord()
{
//Set up the correct collection:
$collection = $this->mongoDbClient->gs1resolver->wellknown;
//Search and retrieve the document
try
{
$result = $collection->findOne(['_id' => 'gs1resolver.json']);
}
catch (MongoDB\Driver\Exception\ConnectionTimeoutException $cte)
{
file_put_contents('php://stderr', "Error calling MongodDB: " . print_r($cte, true). PHP_EOL);
return json_decode('{"Error", "MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details"}');
}
//Return the complete document as a result
file_put_contents('php://stderr', "JSON version of Well-Known record: " . json_encode($result). PHP_EOL);
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_source_srid() {\n\t\t# According to Konformitaetsbedingung 2.1.3.1 there needs to be a standard gml:Envelope in each valid xplan-file.\n\t\t# A fallback value will be provided as conformity currently cannot be validated at the moment of loading (schema could be validated with xsd-validator)\n\t\t\n\t\t# NOTE:\n\t\t# Konformitaetsbedingung 2.13.1 currently also still allows a \"kurzbezeichnung\" akin to ALKIS, e.g \"urn:adv:crs:DE_DHDN_3GK3\", where DE_DHDN_3GK3 is Gauss-Krueger Streifen 3\n\t\t# This method of CRS will likely become obsolete in XPlanung 6.0, and is also currently not supported with this parser (default value would be used)\n\t\t$epsg = $this->input_epsg;\n\t\t$lines = file($this->gml_location);\n\t\tforeach ($lines as $lineNumber => $line) {\n\t\t\tif(strpos($line, 'Envelope') === false) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t# needs to check for both single and double quotes as both are permitted by XML spec\n\t\t\tif (preg_match('/srsName=\"([^\"]+)\"/', $line, $matched_epsg_str)) {\n\t\t\t\tbreak; #found it\n\t\t\t}\n\t\t\tif (preg_match('/srsName=\\'([^\"]+)\\'/', $line, $matched_epsg_str)) {\n\t\t\t\tbreak; #found it\n\t\t\t}\n\t\t\tif (preg_match('/srsname=\\'([^\"]+)\\'/', $line, $matched_epsg_str)) {\n\t\t\t\tbreak; #found it\n\t\t\t}\n\t\t\t#echo 'could not find XPlan srsName within double quotes. checking single quotes:<br>';\n\t\t}\n\n\t\t# echo $matched_epsg_str[1] . '<br>';\n\n\t\tif (isset($matched_epsg_str[1])) {\n\t\t\t// e.g. for EPSG:25832\n\t\t\t$epsg_elements_array = explode(':',$matched_epsg_str[1]);\n\t\t\t$matched_epsg = array_values(array_slice($epsg_elements_array, -1))[0];\n\t\t\tif(is_numeric($matched_epsg)) {\n\t\t\t\t# TODO should still be checked if it is a valid EPSG within the konverter or POSTGIS limit, e.g. through a check against the POSTGIS EPSG info\n\t\t\t\t$epsg = $matched_epsg;\n\t\t\t}\n\t\t\treturn array(\n\t\t\t\t'success' => true,\n\t\t\t\t'epsg' => $epsg\n\t\t\t);\n\t\t}\n\t\telse {\n\t\t\t$msg = 'Konnte das SRS des XPlan-Envelope nicht innerhalb von Doppelten oder einfachen Anführungszeichen finden'; \n\t\t\t$msg .= 'Bitte stellen Sie sicher, das ein Envelope-Element nach XPlan-Konformitaetsbedingung 2.1.3.1 vorhanden ist, z.B. wie folgt:<br>';\n\t\t\t$msg .= '<pre>' . htmlentities('<gml:boundedBy><gml:Envelope srsName=\"EPSG:25833\">...</gml:Envelope></gml:boundedBy>') . '</pre>...<br>';\n\t\t\t$msg .= 'Ein Fallback SRS mit EPSG ' . $this->fallback_epsg . ' wird benutzt.<br>';\n\t\t\treturn array(\n\t\t\t\t'success' => false,\n\t\t\t\t'msg' => $msg\n\t\t\t);\n\t\t}\n\t}",
"public function readGCPRecord($gs1Key, $gs1Value)\n {\n //Set up the correct collection:\n $collection = $this->mongoDbClient->gs1resolver->gcp;\n\n //Build the \"_id\" value which will be used to serach MongoDB - format is \"/gs1Key/gs1Value\"\n //Uses $this->formatGS1Value to make sure that the value is consistent with the format of the gs1Key stored\n ////in the database:\n $formattedGS1Value = $this->formatGS1Value($gs1Key, $gs1Value);\n\n $result = null;\n $searchCharsLength = strlen($gs1Value) - 1;\n while($result === null)\n {\n $id = '/' . $gs1Key . '/' . $gs1Value;\n file_put_contents('php://stderr', \"Searching MongoDB GCP record: $id\" . PHP_EOL);\n try\n {\n $result = $collection->findOne(['_id' => $id]);\n }\n catch (MongoDB\\Driver\\Exception\\ConnectionTimeoutException $cte)\n {\n file_put_contents('php://stderr', \"Error calling MongodDB: \" . print_r($cte, true). PHP_EOL);\n return json_decode('{\"Error\", \"MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details\"}');\n }\n if($result === null && $searchCharsLength > 3)\n {\n $searchCharsLength--;\n $gs1Value = substr($gs1Value, 0, $searchCharsLength);\n }\n else\n {\n break;\n }\n }\n\n //Return the complete document as a result\n file_put_contents('php://stderr', \"JSON version of MongoDB GCP record: \" . json_encode($result). PHP_EOL);\n return $result;\n }",
"public function readURIRecord($gs1Key, $gs1Value)\n {\n //Set up the correct collection:\n $collection = $this->mongoDbClient->gs1resolver->uri;\n\n //Build the \"_id\" value which will be used to serach MongoDB - format is \"/gs1Key/gs1Value\"\n //Uses $this->formatGS1Value to make sure that the value is consistent with the format of the gs1Key stored\n ////in the database:\n $id = '/' . $gs1Key . '/' . $this->formatGS1Value($gs1Key, $gs1Value);\n\n //Search and retrieve the document\n try\n {\n $result = $collection->findOne(['_id' => $id]);\n }\n catch (MongoDB\\Driver\\Exception\\ConnectionTimeoutException $cte)\n {\n file_put_contents('php://stderr', \"Error calling MongodDB: \" . print_r($cte, true). PHP_EOL);\n return json_decode('{\"Error\", \"MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details\"}');\n }\n\n //Return the complete document as a result\n file_put_contents('php://stderr', \"JSON version of MongoDB URI record: \" . json_encode($result). PHP_EOL);\n return $result;\n }",
"public function getRecordInformation() {}",
"public function resolvable();",
"public function getLookupField() {}",
"public function getResolver()\n {\n }",
"public function getInfo() : \\GraphQL\\Type\\Definition\\ResolveInfo\n {\n }",
"public function getRecord() {}",
"public function getRecord() {}",
"public function getRecord() {}",
"public function get_lookup(/* ... */)\n {\n throw new \\RuntimeException('Method not implemented');\n }",
"public function resolve()\n {\n if ($key = request('key', null)) {\n return RegistryObjectsRepository::getPublishedByKey($key);\n }\n\n if ($slug = request('slug', null)) {\n return RegistryObject::where('slug', $slug)->where('status', 'PUBLISHED')->get();\n }\n\n if ($title = request('title', null)) {\n return RegistryObject::where('title', $title)->where('status', 'PUBLISHED')->get();\n }\n\n return null;\n }",
"public function testResolveReturnResult()\n {\n $testObject = sourceDataHelper::getDataIndexedL2();\n $g = new Grabbag($testObject);\n $result = $g->resolve('objects');\n\n $this->assertInstanceOf(\n ItemCollection::class, $result\n );\n }",
"public function getRecord();",
"public function getMappedIdFieldExternal()\r\n\t{\r\n\t\t// Query table\r\n\t\t$sql = \"select external_source_field_name from redcap_ddp_mapping \r\n\t\t\t\twhere project_id = \".$this->project_id.\" and is_record_identifier = 1 limit 1\";\r\n\t\t$q = db_query($sql);\t\t\r\n\t\t// Return boolean\r\n\t\treturn (db_num_rows($q) > 0 ? db_result($q, 0) : false);\r\n\t}",
"public function first(): ?\\StructType\\EwsFindMessageTrackingSearchResultType\n {\n return parent::first();\n }",
"private function findRecord()\n {\n /** If the request is a read record request, we need to do this so eager loading occurs. */\n if ($this->jsonApiRequest->isReadResource()) {\n return $this->store->readRecord(\n $this->jsonApiRequest->getResourceType(),\n $this->jsonApiRequest->getResourceId(),\n $this->jsonApiRequest->getParameters()\n );\n }\n\n return $this->store->find($this->jsonApiRequest->getResourceIdentifier());\n }",
"function jget_roshine_record($sid)\n{\n global $DB;\n return $DB->get_record('roshine', array('id' => $sid));\n}",
"private function lookupARecord()\n {\n\n /**\n * Sample output:\n *\n * [\n * {\n * \"Name\": \"domain.com.\",\n * \"Type\": \"A\",\n * \"AliasTarget\": {\n * \"HostedZoneId\": \"HostedZoneId\",\n * \"DNSName\": \"DNSName.cloudfront.net.\",\n * \"EvaluateTargetHealth\": false\n * }\n * }\n * ]\n */\n $response = shell_exec(\n vsprintf(\n '%s %s %s --hosted-zone-id %s --query \"ResourceRecordSets[?Name == \\'%s.\\']\"',\n [\n $this->aws,\n 'route53',\n 'list-resource-record-sets',\n $this->hosted_zone_id,\n $this->real_domain,\n ]\n )\n );\n $response = json_decode($response);\n\n if (count($response) == 0) {\n $this->error('No A records found for \"%s\"', [$this->real_domain]);\n }\n\n $this->alias_target = $response[0]->AliasTarget->DNSName;\n\n $this->message('Looked up the A record for \"%s\":', [$this->real_domain], 1);\n $this->message('Alias Target: %s', [$this->alias_target], 2);\n }",
"public function searchPartyByName($party_name) \n {\n // UTF-8 = greek name\n if (mb_detect_encoding($party_name) == 'ASCII') {\n $party = Party::where('fullname_en', 'like', '%'.$party_name.'%')->first();\n } else if (mb_detect_encoding($party_name) == 'UTF-8') {\n $party = Party::where('fullname_el', 'like', '%'.$party_name.'%')->first();\n }\n \n return $this->apiHelper::returnResource('Party', $party);\n }",
"public function getForRecord($record);",
"public function findFirst();",
"function getSupportType() {\n try {\n $record = $this->db->get_where('tbl_ws_format')->result_array();\n\n $return = array();\n foreach ($record as $key => $val) {\n $return[$key]['formatId'] = (int) $val['iFormatID'];\n $return[$key]['formatName'] = $val['vFormatName'];\n }\n\n if (!empty($return)) {\n return array(\n 'RECORD' => $return,\n 'STATUS' => SUCCESS_STATUS,\n 'MSG' => REC_FOUND\n );\n } return array(\n 'STATUS' => FAIL_STATUS,\n 'MSG' => NO_RECORD\n );\n } catch (Exception $ex) {\n throw new Exception('Error in getSupportType function - ' . $ex);\n }\n }",
"abstract public function getCorrespondingMetaData();",
"public function getLookupMode() {}",
"public function car_lookup($car_name)\n {\n \n }",
"public function getStorageRecord() {}",
"function synonym_lookup($query) {\n\n $apikey = \"GdbOBg1JYIou4guyIKfq\"; // NOTE: replace test_only with your own key \n $word = $query; // any word \n $language = \"en_US\"; // you can use: en_US, es_ES, de_DE, fr_FR, it_IT \n $endpoint = \"http://thesaurus.altervista.org/thesaurus/v1\";\n\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, \"$endpoint?word=\" . urlencode($word) . \"&language=$language&key=$apikey&output=json\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $data = curl_exec($ch);\n $info = curl_getinfo($ch);\n curl_close($ch);\n\n //either return $result populated with the JSON decoded data\n if ($info['http_code'] == 200) {\n $result = json_decode($data, true);\n }\n\n\n //or return result as 0\n else {\n $result = 0;\n }\n\n return $result;\n}",
"function resolve_host($hostname, $family) {\n if ($family == WIN_AF_INET) {\n $dns_family = DNS_A;\n } elseif ($family == WIN_AF_INET6) {\n $dns_family = DNS_AAAA;\n } else {\n my_print('invalid family, must be AF_INET or AF_INET6');\n return NULL;\n }\n\n $dns = dns_get_record($hostname, $dns_family);\n if (empty($dns)) {\n return NULL;\n }\n\n $result = array(\"family\" => $family);\n $record = $dns[0];\n if ($record[\"type\"] == \"A\") {\n $result[\"address\"] = $record[\"ip\"];\n }\n if ($record[\"type\"] == \"AAAA\") {\n $result[\"address\"] = $record[\"ipv6\"];\n }\n $result[\"packed_address\"] = inet_pton($result[\"address\"]);\n return $result;\n}"
]
| [
"0.5496611",
"0.54453313",
"0.54127806",
"0.5111411",
"0.5106458",
"0.50561434",
"0.49476188",
"0.49292335",
"0.49238744",
"0.49231845",
"0.49231845",
"0.49077573",
"0.4892329",
"0.48891354",
"0.48559245",
"0.4781165",
"0.475656",
"0.47383854",
"0.47245014",
"0.46917495",
"0.4672859",
"0.46539518",
"0.46397576",
"0.46077308",
"0.45942846",
"0.45930126",
"0.4591843",
"0.4587382",
"0.45832428",
"0.45806837"
]
| 0.732825 | 0 |
Searches for a GCP record that matches the start of the GS1 Value supplied | public function readGCPRecord($gs1Key, $gs1Value)
{
//Set up the correct collection:
$collection = $this->mongoDbClient->gs1resolver->gcp;
//Build the "_id" value which will be used to serach MongoDB - format is "/gs1Key/gs1Value"
//Uses $this->formatGS1Value to make sure that the value is consistent with the format of the gs1Key stored
////in the database:
$formattedGS1Value = $this->formatGS1Value($gs1Key, $gs1Value);
$result = null;
$searchCharsLength = strlen($gs1Value) - 1;
while($result === null)
{
$id = '/' . $gs1Key . '/' . $gs1Value;
file_put_contents('php://stderr', "Searching MongoDB GCP record: $id" . PHP_EOL);
try
{
$result = $collection->findOne(['_id' => $id]);
}
catch (MongoDB\Driver\Exception\ConnectionTimeoutException $cte)
{
file_put_contents('php://stderr', "Error calling MongodDB: " . print_r($cte, true). PHP_EOL);
return json_decode('{"Error", "MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details"}');
}
if($result === null && $searchCharsLength > 3)
{
$searchCharsLength--;
$gs1Value = substr($gs1Value, 0, $searchCharsLength);
}
else
{
break;
}
}
//Return the complete document as a result
file_put_contents('php://stderr', "JSON version of MongoDB GCP record: " . json_encode($result). PHP_EOL);
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function readURIRecord($gs1Key, $gs1Value)\n {\n //Set up the correct collection:\n $collection = $this->mongoDbClient->gs1resolver->uri;\n\n //Build the \"_id\" value which will be used to serach MongoDB - format is \"/gs1Key/gs1Value\"\n //Uses $this->formatGS1Value to make sure that the value is consistent with the format of the gs1Key stored\n ////in the database:\n $id = '/' . $gs1Key . '/' . $this->formatGS1Value($gs1Key, $gs1Value);\n\n //Search and retrieve the document\n try\n {\n $result = $collection->findOne(['_id' => $id]);\n }\n catch (MongoDB\\Driver\\Exception\\ConnectionTimeoutException $cte)\n {\n file_put_contents('php://stderr', \"Error calling MongodDB: \" . print_r($cte, true). PHP_EOL);\n return json_decode('{\"Error\", \"MongoDB Database Connection Failed. Please contact the Resolver administrator - error log on server for details\"}');\n }\n\n //Return the complete document as a result\n file_put_contents('php://stderr', \"JSON version of MongoDB URI record: \" . json_encode($result). PHP_EOL);\n return $result;\n }",
"private static function getFirst ($val) {\n\t\treturn (substr ($val, 0, strlen (self::$sSearch)) === self::$sSearch);\n\t}",
"function googleSearch($ar){\n $p = new XParam($ar, array('tplentry'=>'br'));\n $fs = $p->get('fs');\n $tpl = $p->get('tplentry');\n $ftable = $p->get('ftable');\n $fname = $p->get('fname');\n $fid = $p->get('fid');\n $flatlng = $p->get('flatlng');\n $flatlng = trim($flatlng);\n $foptions = $p->get('foptions');\n $readonly = $p->get('readonly');\n $oid = $p->get('oid');\n // recherche des infos table/champ dans l'EF\n // $fs = $this->getFieldSetupEdit($ar);\n // position initiale reçue sinon defaut\n if (!empty($flatlng) && $flatlng!=';'){\n list($plat, $plng) = explode(';', $flatlng);\n $mlat = $fs['elat'];\n $mlng = $fs['elng'];\n $newpoint = false;\n } elseif (!empty($oid)) {\n /* to do editer l'occurence ? */\n } else {\n $plat = $mlat = $fs['elat'];\n $plng = $mlng = $fs['elng'];\n $newpoint = true;\n }\n // lire le champ ? ... la cle etc\n $res = array('google'=>array('key'=>$this->key),\n\t\t 'map'=>array('zoom'=>$fs['ezoom'], \n\t\t\t 'readonly'=>$readonly,\n\t\t\t 'lng'=>$mlat, \n\t\t\t 'lat'=>$mlng),\n\t\t 'point'=>array('newpoint'=>$newpoint,\n\t\t\t\t'lat'=>$plat,\n\t\t\t\t'lng'=>$plng,\n\t\t\t\t'ftable'=>$ftable,\n\t\t\t\t'fid'=>$fid,\n\t\t\t\t'fname'=>$fname,\n\t\t\t\t'foptions'=>$foptions\n\t\t\t\t),\n\t\t 'maplabels'=>array('normalview'=>XLabels::getSysLabel('xmodmap','normalview', 'text'),\n\t\t\t\t 'physicalview'=>XLabels::getSysLabel('xmodmap','physicalview', 'text'),\n\t\t\t\t 'satelliteview'=>XLabels::getSysLabel('xmodmap','sattelitview', 'text'),\n\t\t\t\t 'hybridview'=>XLabels::getSysLabel('xmodmap','hybridview', 'text'),\n\t\t\t\t 'search'=>XLabels::getSysLabel('general', 'query', 'text'),\n\t\t\t\t 'validate'=>XLabels::getSysLabel('general', 'save', 'text'),\n\t\t\t\t 'quit'=>XLabels::getSysLabel('general', 'close', 'text'),\n\t\t\t\t 'notfound'=>XLabels::getSysLabel('xmodmap', 'unknownaddress', 'text'),\n\t\t\t\t 'centerview'=>XLabels::getSysLabel('xmodmap', 'centerview', 'text')\n\t\t\t\t )\n\t\t );\n return $res;\n }",
"function search ($specimen, $scientificName = '')\n{\n\tglobal $config;\n\t\n\t$hits = array();\n\t\n\t$hit_keys = array();\n\t\n\tif ($specimen->parsed)\n\t{\n\t\tforeach ($specimen->parameters as $parameters)\n\t\t{\n\t\t\t$url = 'https://api.gbif.org/v1/occurrence/search?';\n\t\t\t\t\t\t\n\t\t\tif ($scientificName != '')\n\t\t\t{\n\t\t\t\t$parameters['scientificName'] = $scientificName;\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tforeach ($parameters as $k => $v)\n\t\t\t{\n\t\t\t\t$url .= $k . '=' . urlencode($v) . '&';\n\t\t\t}\n\t\t\t\n\t\t\t// echo $url . \"\\n\";\t\t\t\n\t\t\t\n\t\t\t$json = get($url);\n\t\t\t\n\t\t\tif ($json != '')\n\t\t\t{\n\t\t\t\t$obj = json_decode($json);\n\t\t\t\tforeach ($obj->results as $occurrence)\n\t\t\t\t{\n\t\t\t\t\t// We may encounter the same record more than once, so ensure uniqueness\n\t\t\t\t\tif (!in_array($occurrence->gbifID, $hit_keys))\n\t\t\t\t\t{\n\t\t\t\t\t\t$hit_keys[] = $occurrence->gbifID;\n\t\t\t\t\t\t$hits[] = $occurrence;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\t//$hits[$occurrence->gbifID] = $occurrence;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\t\n\treturn $hits;\t\n}",
"function find_entries_matching($search){\n $nextcloud_db = new SQLite3(NEXTCLOUD_DB, SQLITE3_OPEN_READONLY);\n\n // CREATE TABLE oc_cards (\n // id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n // carddata BLOB DEFAULT NULL,\n // uri VARCHAR(255) DEFAULT NULL COLLATE BINARY,\n // lastmodified BIGINT UNSIGNED DEFAULT NULL,\n // etag VARCHAR(32) DEFAULT NULL COLLATE BINARY,\n // size BIGINT UNSIGNED NOT NULL,\n // addressbookid BIGINT DEFAULT 0 NOT NULL\n // );\n $result = $nextcloud_db->query(\"SELECT carddata from oc_cards\");\n\n $entries = [];\n while($record = $result->fetchArray(SQLITE3_ASSOC)){\n $entry_lines = explode(\"\\n\", $record[\"carddata\"]);\n $contact_name = \"\";\n $contact_numbers = [];\n // VCard data is in KEY:Value\\n format\n // We're interested in \"FN\" and (\"TEL\" or \"TEL;*\") keys\n // FN -> $contact_name\n // TEL* -> $contact_numbers\n foreach( $entry_lines as $line ){\n $key_value = explode(\":\", $line, 2);\n if( $key_value[0] === \"FN\" ){\n if( strlen($key_value[1]) > 0 )\n $contact_name = trim($key_value[1]);\n }\n else if( $key_value[0] === \"TEL\" || strpos($key_value[0], \"TEL;\") === 0 ){\n if( strlen($key_value[1]) > 0 ){\n $new_number = unify_number(trim($key_value[1]));\n if( !in_array($new_number, $contact_numbers) ){\n $contact_numbers[] = $new_number;\n }\n }\n }\n }\n\n // Fetch all contacts (that match) into an array of [name => \"John\", number => 1234] entries.\n // If a person has multiple phone numbers, they appear multiple times in $entries.\n foreach( $contact_numbers as $number ){\n // If we're searching for something and this entry does *not* match, skip it\n if( strlen($search) > 0 &&\n strpos($contact_name, $search) === FALSE &&\n strpos(name_to_numbers($contact_name), $search) === FALSE &&\n strpos($number, $search) === FALSE &&\n strpos($number, unify_number($search)) === FALSE ){\n continue;\n }\n\n $entries[] = [\n 'name' => $contact_name,\n 'number' => $number\n ];\n }\n }\n uasort($entries, \"cmp_entries\");\n return $entries;\n}",
"function GetStartsWithAFilter($FldExpression, $dbid = 0) {\r\n\treturn $FldExpression . Like(\"'A%'\", $dbid);\r\n}",
"public function find($value);",
"function SearchFirst ( $cFieldExp )\n{\n return $this->Search_Data($this->_SQL_Where_(),$cFieldExp);\n}",
"function zone_letter_start($letter, $userid = true) {\n global $db;\n global $sql_regexp;\n $query = \"SELECT\n\t\t\tdomains.id AS domain_id,\n\t\t\tzones.owner,\n\t\t\tdomains.name AS domainname\n\t\t\tFROM domains\n\t\t\tLEFT JOIN zones ON domains.id=zones.domain_id\n\t\t\tWHERE substring(domains.name,1,1) \" . $sql_regexp . \" \" . $db->quote(\"^\" . $letter, 'text');\n $db->setLimit(1);\n $result = $db->queryOne($query);\n return ($result ? 1 : 0);\n}",
"public function search($value, $strict = false);",
"function find_by_val($field,$value)\n {\n $arr1=[];\n $found=[];\n $seek = scan_students();\n foreach ($seek as $student => $id) {\n $dir = \"students/\".substr($id,0,2);\n $arr1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . $dir .\"/\". $id. \".json\"),true);\n if($arr1[$field] == $value) { $found = $arr1;}\n }\n if(!empty($found))\n echo print_r($found);\n else\n err(\"Student Not Found.\\00[0m This student doesn't exist.\");\n return $found;\n }",
"function binarysearch($array, $start, $end, $value)\n{ \n //Kill if there there isn't anything to search\n if ($end < $start) { return -1; }\n \n //Get the middle of the array\n $middleindex = ceil($start + (($end-$start)/2));\n //The family that is at the middle\n $currentfamily = $array[$middleindex][\"family\"];\n //The difference between the family and the value\n $difference = strcmp($value, $currentfamily);\n \n logadd(\"Searching: i:$middleindex s:$start e:$end c:$currentfamily f:$value d:$difference\");\n \n //If there's no difference then return the index at the middle\n if ($difference == 0) { return $middleindex; }\n //If there is a difference then do a binary search on the left or right half of the array\n else if ($difference < 0) { return binarysearch ($array, $start, $middleindex - 1, $value); }\n else { return binarysearch ($array, $middleindex + 1, $end, $value); }\n}",
"public function beginsWithReturnsTrueForMatchingFirstPartDataProvider() {}",
"function chkFiredata($firedata, $satellite){\n $result = pg_query(\"SELECT * FROM $satellite WHERE '\".$firedata.\"'=concat(latitude,longitude,bright_ti4,acq_date,acq_time)\");\n\n if(pg_fetch_array($result) !== false){\n return 1;\n }else{\n return 0;\n }\n}",
"function search() {}",
"function db_search($value,$column,$column_want,$table) {\n\t\t$query = \"SELECT $column_want FROM $table WHERE `$column` LIKE '$value'\";\n\t\t$result = pg_query($this->db_connection,$query);\n\t\twhile($entry = pg_fetch_assoc($result)) {\n\t\t\t$results[] = $entry;\n\t\t}\n\t\treturn $results;\n\t}",
"static function get_record_byapproximateField($table, $field, $value) {\r\n $rekete = \"SELECT * FROM \" . $table . \" WHERE \" . $field . \" LIKE ? ORDER BY created DESC\";\r\n $param = array(\"%$value%\");\r\n $result = Functions::commit_sql($rekete, $param);\r\n if (Functions::is_void($result))\r\n return false;\r\n else\r\n return $result;\r\n }",
"public function searchByVal( $value, bool $strict = false );",
"public function searchStock($value)\n\t{\n\t\treturn $this->stock->where('name','LIKE','%'.$value.'%')->get();\n\t}",
"public function start($value = '')\n {\n if (!empty($value)) {\n\n return $this->builder->where(\"rc_date\", '>=', date('Y-m-d', strtotime($value)));\n }\n }",
"function checkResult(string $filterName, Client $client, string $comment)\n{\n $query = \"from(bucket: \\\"my-bucket\\\")\n |> range(start: 0)\n |> filter(fn: (r) => r[\\\"location\\\"] == \\\"$filterName\\\")\";\n $queryApi = $client->createQueryApi();\n $result = $queryApi->query($query);\n printf(\"\\n\\n----------------------- $comment -----------------------\\n\\n\");\n foreach ($result as $table) {\n foreach ($table->records as $record) {\n $location = $record[\"location\"];\n $temperature = $record->getValue();\n $measurement = $record->getMeasurement();\n $dateTime = $record->getTime();\n print \"$measurement: Temperature in $location at $dateTime is $temperature °C\\n\";\n }\n }\n}",
"public function search(mixed $value): mixed\n {\n\n return\n ($index = $this->indexOfValue($value)) > -1 ?\n $this->keys[$index] :\n null;\n }",
"protected function _findStartOffset() {}",
"public function find($primaryValue);",
"function exist_Google_FacilPos_title($google, $limit=10000, $offset=0)\n\t{\n\n\t\t$this->db->from('schedule');\t\n\t\t$this->db->where('title',$google);\t\t\n\t\t$query = $this->db->get();\t\t\t\t\n\t\treturn $query->num_rows()==1;\n\t\t\n\t\t\n\t}",
"function str_start($value, $prefix)\n {\n return Str::start($value, $prefix);\n }",
"function clients_select_getSearchQuery($ctlData,$searchRow) {\n\tif($ctlData['SEARCHABLE'] != 'no') {\n\t\t$identifier = strtolower($ctlData['IDENTIFIER']);\n\n\t\t## the A part\t\n\t\t$query_A = '';\n\t\t\n\t\t## the B part\n\t\t$query_B = '';\n\t\t\n\t\t## the C part\n\t\t$search_value = $searchRow['value'];\n\t\t$query_C = ' AND ';\n\t\t$query_C .= DB_PREFIX.$GLOBALS['_MODULE_DATAOBJECTS_DBPREFIX'].'.'.$identifier.' like'.\"'%\".$search_value.\"%'\";\n\t\t\n\t\treturn array('partA'=>$query_A,'partB'=>$query_B,'partC'=>$query_C);\n\t}\n}",
"public function search();",
"public function search();",
"function search_pk($string, $keyserver = '')\n\t{\n\t\t// matches limit\n\t\t$max = 50;\n\n\t\t// defining keyserver\n\t\tif (!$keyserver = $this->prepare_input($keyserver))\n\t\t{\n\t\t\t$keyserver = $this->engine->db->gpg_server;\n\t\t}\n\n\t\t// correcting search string\n\t\tif (str_starts_with($string = trim($string), '0x'))\n\t\t{\n\t\t\t$string = '=' . $string;\n\t\t}\n\n\t\t// requesting key search\n\t\tif ($list = $this->call(\"--keyserver $keyserver --search-key $string\"))\n\t\t{\n\t\t\t$n = 0;\n\t\t\t$results = [];\n\n\t\t\t// filling results array\n\t\t\tif ($rows = explode(\"\\n\", $list)) foreach ($rows as $row)\n\t\t\t{\n\t\t\t\t$cells = explode(':', $row);\n\n\t\t\t\t// new pubkey element\n\t\t\t\tif ($cells[0] == 'pub')\n\t\t\t\t{\n\t\t\t\t\tif (++$n > $max) break;\t\t// break flooding searches\n\n\t\t\t\t\t$type = match ($cells[2])\n\t\t\t\t\t{\n\t\t\t\t\t\t'1'\t\t=> 'RSA',\n\t\t\t\t\t\t'3'\t\t=> 'RSA-S',\n\t\t\t\t\t\t'17'\t\t=> 'DSA',\n\t\t\t\t\t\tdefault\t=> 'Undefined',\n\t\t\t\t\t};\n\n\t\t\t\t\t$results[$key_id = $cells[1]] = [\n\t\t\t\t\t\t0 => $type,\n\t\t\t\t\t\t1 => (int) $cells[3],\n\t\t\t\t\t\t2 => (int) $cells[4],\n\t\t\t\t\t\t3 => trim($cells[6]),\n\t\t\t\t\t\t4 => []\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\t// uid for the current pubkey element\n\t\t\t\telse if ($cells[0] == 'uid')\n\t\t\t\t{\n\t\t\t\t\t$results[$key_id][4][$cells[1]] = (int) $cells[2];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $results;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}"
]
| [
"0.536427",
"0.51116157",
"0.50716347",
"0.5063353",
"0.50408155",
"0.4943508",
"0.4934206",
"0.49325237",
"0.49267402",
"0.4898618",
"0.48966807",
"0.48450035",
"0.48426193",
"0.48382303",
"0.483212",
"0.48149896",
"0.47880626",
"0.47739094",
"0.47536457",
"0.47321394",
"0.47091317",
"0.46937042",
"0.4648017",
"0.46142927",
"0.46085343",
"0.46074873",
"0.46055332",
"0.45924538",
"0.45924538",
"0.4581409"
]
| 0.67930704 | 0 |
TODO: Add formats for other GS1 keys | private function formatGS1Value($gs1Key, $gs1Value)
{
if(strtolower($gs1Key) === 'gtin')
{
while(strlen($gs1Value) < 14)
{
$gs1Value = '0' . $gs1Value;
}
}
return $gs1Value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function format_key($key)\n {\n }",
"public function formatKey(string $key): string;",
"public function testGenerateFormatWithoutReplaceChar()\n {\n $key = Keys::Generate(\"hdjas-skajdkasj-dj938-8848\");\n }",
"public function getExtkey() {}",
"function getPackageKey() ;",
"public function getKVFormat()\n {\n return $this->getMessage(self::FORMAT_KV);\n }",
"protected function _generateKey()\n {\n $key = '';\n ksort($this->_keyData); //so that the order of the array doesn't matter in the key that is generated.\n foreach ($this->_keyData as $i => $val) {\n //\"clean\" the data some\n if (is_numeric($val)) {\n $val = (float)$val;\n //force it to be 4 decimal places every single time, and use thousands\n //seperator, just because we can and we need all numbers to be uniform\n //so they look the same even after getting sent to the database and coming back again.\n $val = number_format($val, 4, '.', ',');\n } else {\n $val = trim($val);\n }\n //NOTE: May need to do further \"cleaning\" to ensure value always stays\n //the same even after getting sent to and from the DB... if so do that\n //cleaning here, NOT outside of this class... we need 1 solution in 1\n //place, not 20 different solutions...\n\n $key = \"$i:_:{$key}:_:$val\";\n }\n //If debug enabled, show what the key is before hash, so we can troubleshoot\n //problems caused by the key changing when trying to decrypt.\n if (self::DEBUG) {\n trigger_error('DEBUG CRYPT: Key used before hash=' . $key);\n }\n $this->_keyString = sha1($key);\n }",
"public function getKey(): string;",
"public function getKey(): string;",
"abstract public function getKey(): string;",
"function keyTypes()\n {\n return array('pattern' => 'K');\n }",
"function sign($date) {\n $key = base64_decode('MIIEowIBAAKCAQEA5NmI8GIsupuvOMXR4yfs8hK2RUmX/CKlHmLEr/b1mPr/gx+fenafOSKoXs7OUvUxF/CR0EW6iUJvJ9lmTACTZFsTfF+mSJZ76dpuh6J8BQj9lpnH+AEp05LqLr2zvlzkksrjYSW4hfaZqfUZDk8YvGsdBqDpWrEykD16R5Jv5Iw/Y13Jd99F5zYU+Z3M+XdBSrFSaDwU5GeiOQVyl8q/Bt9gY7O1HfqYY9udXmAzPfEaZdCqCj7B8V8Sj7Wc92TZ/fHabZFKzfhVwfHCAzK4mQZ1be8snJd1f9R2peqjzBEINGdOnAnm0rGItKZJY91LMYi5H6Wh/Qh21CYY4Ne2wwIDAQABAoIBAEKXQg+goZ9TOfNtLJvKvFncNAmJVp5Zfm6PEuiZFfID52HCS+eYqNA5U4Dy8HqXOkfbCrLt90+Fc07HJcsrx7fGAK+KLZqlnzz3AH6bOzdD3HZ8HQH/ZKpZ76bWMH1ODnzgaLWWAlGI5kHcPgQ549q/2FxbakunkC0ElpZI+CIqWEf0zNfTXOpExMWx+FENntk/qpHijE+zcbh1/cy8Bsmj0WcXZ3aTDElG3XCC21rPd7zgrFeL6Sy26Br0eqxqddatghZHB5PhZYE4BYM3AlZTZVfuDHogXn4BXILTyV+oQHNUzHKjStfVryJnslnWVAF5whaXGm1fyRY3WBAEmuECgYEA+AivBccqnKfgB7BTDTUMCdt7v+vVbR7CEZc5/jCRy+N0R6NN/L/+LdAAjsodjzVmkLOUzPbZhw72hHXA63RijAhSDeg8IdCUY1YVygyr5KZpHRnn96XJOucPCCFWFfiToJ2Qz+JfZMBUt9HhsSWGS2jF2hUGjixhRwFwTd5xtYsCgYEA7DMe0bJeF336UtgrY9MNVC1sc/A8sEeYtlr47rcLlRDboaO9PRsuIMssxiZ/9uRkYP1FDmS3S8pgwg4UuoVUYHg5Tt95iq3aK0BRQnpKuGIerbBCwFUBZMwpP1DW3fMKtOQ5pjoV74tqR+df7gD0hWlfMFV8WUP9vXLa+XBcWqkCgYEA85sbw3IEsQ3UY9jTCSKzqy7NUQcgfGb8NmiwBa7QU08XUpDatMYgsAAdvCBYfeH11WL7X3+G0DZq+lfo3ZhWfbBiXtRb0t5YD2RqTCK75PtoO7PI95r1lAuB4PtU4Ile/R4kL3jnNj4MNupFX0Y6qu/BetqxsIt4E1QfZ+t1BNcCgYBrDiCB2t5at3al5eSEsjvwU0Y8pj5bh5fnzwPU7pIJVkK12IkFETSvGGeKyBhnxszYSPLruyp455lDWy55+8RqlRMkdJWaDYI86EHsZ5FGUPKmtqUKl3yyOvbXA8TfhDDuHCMk/F7E2+OoA26vaS9q6H+EYLqjmvV+0Hf/ZrX1QQKBgGd8r9wi+fPG3IgGXHBQjmnVgaPNsvQzBKFmHrER0/iLZuA9A2R5x7DxZdHUSRWaPADIaHiU1O9jbNJCk7Jtnqn7M85Q0SRsqZhA2+28/1bmqrTkQmT7T9Q4+hUEN+qehZx83BkRYaP1QWuH11UcRxFr+O3HNXlC9mAG/zt6HhuV');\n $sig = hash_hmac('SHA1', $date, $key, true);\n $sig = base64_encode($sig);\n return $sig;\n }",
"function _mn_slingshot_keyauth_key_default() {\n $export = array();\n $keyauth_keys = new stdClass;\n $keyauth_keys->disabled = FALSE; /* Edit this to true to make a default keyauth_keys disabled initially */\n $keyauth_keys->api_version = 1;\n $keyauth_keys->title = 'Slingshot';\n $keyauth_keys->public_key = 'acf8b2bb295ccb58c1ad4e3a376a81cb';\n $keyauth_keys->private_key = 'cdb9381bfde2d9a14acf62c42345da5907b7aa14';\n\n $export['acf8b2bb295ccb58c1ad4e3a376a81cb'] = $keyauth_keys;\n return $export;\n}",
"function sign($param,$key){\n\n $sign = \"\";\n foreach($param as $k => $v){\n $sign .= $k.\"=\".$v.\"&\";\n }\n\n $sign .= \"key=\".$key;\n $sign = strtoupper(md5($sign));\n return $sign;\n\n}",
"public function getShortKey(): string\n {\n return substr($this->key, 0, 4);\n }",
"public function createKeyString()\n\t{\n\t\t$keystring = $this->factory->createKeyString( $this ) ;\n\t\treturn $keystring ;\n\t}",
"public function __construct($data, $format, $password = null, $alg = 'PBES2-HS256+A128KW') {\n switch ($format) {\n case 'php':\n case 'json':\n case 'jwe':\n parent::__construct($data, $format, $password, $alg);\n break;\n case 'pem':\n $offset = 0;\n $jwk = array();\n\n if (preg_match(Key::PEM_PUBLIC, $data, $matches)) {\n $der = base64_decode($matches[1]);\n\n if ($der === FALSE) throw new KeyException('Cannot read PEM key');\n\n $offset += ASN1::readDER($der, $offset, $value); // SEQUENCE\n $offset += ASN1::readDER($der, $offset, $value); // SEQUENCE\n $offset += ASN1::readDER($der, $offset, $algorithm); // OBJECT IDENTIFIER - AlgorithmIdentifier\n\n $algorithm = ASN1::decodeOID($algorithm);\n if ($algorithm != self::OID) throw new KeyException('Not RSA key');\n\n\n $offset += ASN1::readDER($der, $offset, $value); // NULL - parameters\n $offset += ASN1::readDER($der, $offset, $value, true); // BIT STRING\n $offset += ASN1::readDER($der, $offset, $value); // SEQUENCE\n $offset += ASN1::readDER($der, $offset, $n); // INTEGER [n]\n $offset += ASN1::readDER($der, $offset, $e); // INTEGER [e]\n\n $jwk['kty'] = self::KTY;\n $jwk['n'] = Util::base64url_encode($n);\n $jwk['e'] = Util::base64url_encode($e);\n } elseif (preg_match(self::PEM_PRIVATE, $data, $matches)) {\n $der = base64_decode($matches[1]);\n\n if ($der === FALSE) throw new KeyException('Cannot read PEM key');\n\n $offset += ASN1::readDER($der, $offset, $data); // SEQUENCE\n $offset += ASN1::readDER($der, $offset, $version); // INTEGER\n\n if (ord($version) != 0) throw new KeyException('Unsupported RSA private key version');\n\n $offset += ASN1::readDER($der, $offset, $n); // INTEGER [n]\n $offset += ASN1::readDER($der, $offset, $e); // INTEGER [e]\n $offset += ASN1::readDER($der, $offset, $d); // INTEGER [d]\n $offset += ASN1::readDER($der, $offset, $p); // INTEGER [p]\n $offset += ASN1::readDER($der, $offset, $q); // INTEGER [q]\n $offset += ASN1::readDER($der, $offset, $dp); // INTEGER [dp]\n $offset += ASN1::readDER($der, $offset, $dq); // INTEGER [dq]\n $offset += ASN1::readDER($der, $offset, $qi); // INTEGER [qi]\n if (strlen($der) > $offset) ASN1::readDER($der, $offset, $oth); // INTEGER [other]\n\n $jwk['kty'] = self::KTY;\n $jwk['n'] = Util::base64url_encode($n);\n $jwk['e'] = Util::base64url_encode($e);\n $jwk['d'] = Util::base64url_encode($d);\n $jwk['p'] = Util::base64url_encode($p);\n $jwk['q'] = Util::base64url_encode($q);\n $jwk['dp'] = Util::base64url_encode($dp);\n $jwk['dq'] = Util::base64url_encode($dq);\n $jwk['qi'] = Util::base64url_encode($qi);\n }\n\n parent::__construct($jwk);\n break;\n default:\n throw new KeyException('Incorrect format');\n }\n\n if (!isset($this->data['kty'])) $this->data['kty'] = self::KTY;\n }",
"public function buildKey($key): string;",
"protected function parseKey(): string\n {\n foreach ($this->getParams() as $key => $value) {\n $this->key = \\str_replace($key, $value, $this->key);\n }\n\n return $this->key;\n }",
"public function getFormatKeys()\n {\n return $this->formatKeys;\n }",
"function _parseKey($key, $type)\n {\n if ($type != self::PUBLIC_FORMAT_RAW && !is_string($key)) {\n return false;\n }\n\n switch ($type) {\n case self::PUBLIC_FORMAT_RAW:\n if (!is_array($key)) {\n return false;\n }\n $components = array();\n switch (true) {\n case isset($key['e']):\n $components['publicExponent'] = $key['e']->copy();\n break;\n case isset($key['exponent']):\n $components['publicExponent'] = $key['exponent']->copy();\n break;\n case isset($key['publicExponent']):\n $components['publicExponent'] = $key['publicExponent']->copy();\n break;\n case isset($key[0]):\n $components['publicExponent'] = $key[0]->copy();\n }\n switch (true) {\n case isset($key['n']):\n $components['modulus'] = $key['n']->copy();\n break;\n case isset($key['modulo']):\n $components['modulus'] = $key['modulo']->copy();\n break;\n case isset($key['modulus']):\n $components['modulus'] = $key['modulus']->copy();\n break;\n case isset($key[1]):\n $components['modulus'] = $key[1]->copy();\n }\n return isset($components['modulus']) && isset($components['publicExponent']) ? $components : false;\n case self::PRIVATE_FORMAT_PKCS1:\n case self::PRIVATE_FORMAT_PKCS8:\n case self::PUBLIC_FORMAT_PKCS1:\n /* Although PKCS#1 proposes a format that public and private keys can use, encrypting them is\n \"outside the scope\" of PKCS#1. PKCS#1 then refers you to PKCS#12 and PKCS#15 if you're wanting to\n protect private keys, however, that's not what OpenSSL* does. OpenSSL protects private keys by adding\n two new \"fields\" to the key - DEK-Info and Proc-Type. These fields are discussed here:\n\n http://tools.ietf.org/html/rfc1421#section-4.6.1.1\n http://tools.ietf.org/html/rfc1421#section-4.6.1.3\n\n DES-EDE3-CBC as an algorithm, however, is not discussed anywhere, near as I can tell.\n DES-CBC and DES-EDE are discussed in RFC1423, however, DES-EDE3-CBC isn't, nor is its key derivation\n function. As is, the definitive authority on this encoding scheme isn't the IETF but rather OpenSSL's\n own implementation. ie. the implementation *is* the standard and any bugs that may exist in that\n implementation are part of the standard, as well.\n\n * OpenSSL is the de facto standard. It's utilized by OpenSSH and other projects */\n if (preg_match('#DEK-Info: (.+),(.+)#', $key, $matches)) {\n $iv = pack('H*', trim($matches[2]));\n $symkey = pack('H*', md5($this->password . substr($iv, 0, 8))); // symkey is short for symmetric key\n $symkey.= pack('H*', md5($symkey . $this->password . substr($iv, 0, 8)));\n // remove the Proc-Type / DEK-Info sections as they're no longer needed\n $key = preg_replace('#^(?:Proc-Type|DEK-Info): .*#m', '', $key);\n $ciphertext = $this->_extractBER($key);\n if ($ciphertext === false) {\n $ciphertext = $key;\n }\n switch ($matches[1]) {\n case 'AES-256-CBC':\n $crypto = new AES();\n break;\n case 'AES-128-CBC':\n $symkey = substr($symkey, 0, 16);\n $crypto = new AES();\n break;\n case 'DES-EDE3-CFB':\n $crypto = new TripleDES(Base::MODE_CFB);\n break;\n case 'DES-EDE3-CBC':\n $symkey = substr($symkey, 0, 24);\n $crypto = new TripleDES();\n break;\n case 'DES-CBC':\n $crypto = new DES();\n break;\n default:\n return false;\n }\n $crypto->setKey($symkey);\n $crypto->setIV($iv);\n $decoded = $crypto->decrypt($ciphertext);\n } else {\n $decoded = $this->_extractBER($key);\n }\n\n if ($decoded !== false) {\n $key = $decoded;\n }\n\n $components = array();\n\n if (ord($this->_string_shift($key)) != self::ASN1_SEQUENCE) {\n return false;\n }\n if ($this->_decodeLength($key) != strlen($key)) {\n return false;\n }\n\n $tag = ord($this->_string_shift($key));\n /* intended for keys for which OpenSSL's asn1parse returns the following:\n\n 0:d=0 hl=4 l= 631 cons: SEQUENCE\n 4:d=1 hl=2 l= 1 prim: INTEGER :00\n 7:d=1 hl=2 l= 13 cons: SEQUENCE\n 9:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption\n 20:d=2 hl=2 l= 0 prim: NULL\n 22:d=1 hl=4 l= 609 prim: OCTET STRING\n\n ie. PKCS8 keys*/\n\n if ($tag == self::ASN1_INTEGER && substr($key, 0, 3) == \"\\x01\\x00\\x30\") {\n $this->_string_shift($key, 3);\n $tag = self::ASN1_SEQUENCE;\n }\n\n if ($tag == self::ASN1_SEQUENCE) {\n $temp = $this->_string_shift($key, $this->_decodeLength($key));\n if (ord($this->_string_shift($temp)) != self::ASN1_OBJECT) {\n return false;\n }\n $length = $this->_decodeLength($temp);\n switch ($this->_string_shift($temp, $length)) {\n case \"\\x2a\\x86\\x48\\x86\\xf7\\x0d\\x01\\x01\\x01\": // rsaEncryption\n case \"\\x2A\\x86\\x48\\x86\\xF7\\x0D\\x01\\x01\\x0A\": // rsaPSS\n break;\n case \"\\x2a\\x86\\x48\\x86\\xf7\\x0d\\x01\\x05\\x03\": // pbeWithMD5AndDES-CBC\n /*\n PBEParameter ::= SEQUENCE {\n salt OCTET STRING (SIZE(8)),\n iterationCount INTEGER }\n */\n if (ord($this->_string_shift($temp)) != self::ASN1_SEQUENCE) {\n return false;\n }\n if ($this->_decodeLength($temp) != strlen($temp)) {\n return false;\n }\n $this->_string_shift($temp); // assume it's an octet string\n $salt = $this->_string_shift($temp, $this->_decodeLength($temp));\n if (ord($this->_string_shift($temp)) != self::ASN1_INTEGER) {\n return false;\n }\n $this->_decodeLength($temp);\n list(, $iterationCount) = unpack('N', str_pad($temp, 4, chr(0), STR_PAD_LEFT));\n $this->_string_shift($key); // assume it's an octet string\n $length = $this->_decodeLength($key);\n if (strlen($key) != $length) {\n return false;\n }\n\n $crypto = new DES();\n $crypto->setPassword($this->password, 'pbkdf1', 'md5', $salt, $iterationCount);\n $key = $crypto->decrypt($key);\n if ($key === false) {\n return false;\n }\n return $this->_parseKey($key, self::PRIVATE_FORMAT_PKCS1);\n default:\n return false;\n }\n /* intended for keys for which OpenSSL's asn1parse returns the following:\n\n 0:d=0 hl=4 l= 290 cons: SEQUENCE\n 4:d=1 hl=2 l= 13 cons: SEQUENCE\n 6:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption\n 17:d=2 hl=2 l= 0 prim: NULL\n 19:d=1 hl=4 l= 271 prim: BIT STRING */\n $tag = ord($this->_string_shift($key)); // skip over the BIT STRING / OCTET STRING tag\n $this->_decodeLength($key); // skip over the BIT STRING / OCTET STRING length\n // \"The initial octet shall encode, as an unsigned binary integer wtih bit 1 as the least significant bit, the number of\n // unused bits in the final subsequent octet. The number shall be in the range zero to seven.\"\n // -- http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf (section 8.6.2.2)\n if ($tag == self::ASN1_BITSTRING) {\n $this->_string_shift($key);\n }\n if (ord($this->_string_shift($key)) != self::ASN1_SEQUENCE) {\n return false;\n }\n if ($this->_decodeLength($key) != strlen($key)) {\n return false;\n }\n $tag = ord($this->_string_shift($key));\n }\n if ($tag != self::ASN1_INTEGER) {\n return false;\n }\n\n $length = $this->_decodeLength($key);\n $temp = $this->_string_shift($key, $length);\n if (strlen($temp) != 1 || ord($temp) > 2) {\n $components['modulus'] = new BigInteger($temp, 256);\n $this->_string_shift($key); // skip over self::ASN1_INTEGER\n $length = $this->_decodeLength($key);\n $components[$type == self::PUBLIC_FORMAT_PKCS1 ? 'publicExponent' : 'privateExponent'] = new BigInteger($this->_string_shift($key, $length), 256);\n\n return $components;\n }\n if (ord($this->_string_shift($key)) != self::ASN1_INTEGER) {\n return false;\n }\n $length = $this->_decodeLength($key);\n $components['modulus'] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['publicExponent'] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['privateExponent'] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['primes'] = array(1 => new BigInteger($this->_string_shift($key, $length), 256));\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['primes'][] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['exponents'] = array(1 => new BigInteger($this->_string_shift($key, $length), 256));\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['exponents'][] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['coefficients'] = array(2 => new BigInteger($this->_string_shift($key, $length), 256));\n\n if (!empty($key)) {\n if (ord($this->_string_shift($key)) != self::ASN1_SEQUENCE) {\n return false;\n }\n $this->_decodeLength($key);\n while (!empty($key)) {\n if (ord($this->_string_shift($key)) != self::ASN1_SEQUENCE) {\n return false;\n }\n $this->_decodeLength($key);\n $key = substr($key, 1);\n $length = $this->_decodeLength($key);\n $components['primes'][] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['exponents'][] = new BigInteger($this->_string_shift($key, $length), 256);\n $this->_string_shift($key);\n $length = $this->_decodeLength($key);\n $components['coefficients'][] = new BigInteger($this->_string_shift($key, $length), 256);\n }\n }\n\n return $components;\n case self::PUBLIC_FORMAT_OPENSSH:\n $parts = explode(' ', $key, 3);\n\n $key = isset($parts[1]) ? base64_decode($parts[1]) : false;\n if ($key === false) {\n return false;\n }\n\n $comment = isset($parts[2]) ? $parts[2] : false;\n\n $cleanup = substr($key, 0, 11) == \"\\0\\0\\0\\7ssh-rsa\";\n\n if (strlen($key) <= 4) {\n return false;\n }\n extract(unpack('Nlength', $this->_string_shift($key, 4)));\n $publicExponent = new BigInteger($this->_string_shift($key, $length), -256);\n if (strlen($key) <= 4) {\n return false;\n }\n extract(unpack('Nlength', $this->_string_shift($key, 4)));\n $modulus = new BigInteger($this->_string_shift($key, $length), -256);\n\n if ($cleanup && strlen($key)) {\n if (strlen($key) <= 4) {\n return false;\n }\n extract(unpack('Nlength', $this->_string_shift($key, 4)));\n $realModulus = new BigInteger($this->_string_shift($key, $length), -256);\n return strlen($key) ? false : array(\n 'modulus' => $realModulus,\n 'publicExponent' => $modulus,\n 'comment' => $comment\n );\n } else {\n return strlen($key) ? false : array(\n 'modulus' => $modulus,\n 'publicExponent' => $publicExponent,\n 'comment' => $comment\n );\n }\n // http://www.w3.org/TR/xmldsig-core/#sec-RSAKeyValue\n // http://en.wikipedia.org/wiki/XML_Signature\n case self::PRIVATE_FORMAT_XML:\n case self::PUBLIC_FORMAT_XML:\n if (!extension_loaded('xml')) {\n return false;\n }\n\n $this->components = array();\n\n $xml = xml_parser_create('UTF-8');\n xml_set_object($xml, $this);\n xml_set_element_handler($xml, '_start_element_handler', '_stop_element_handler');\n xml_set_character_data_handler($xml, '_data_handler');\n // add <xml></xml> to account for \"dangling\" tags like <BitStrength>...</BitStrength> that are sometimes added\n if (!xml_parse($xml, '<xml>' . $key . '</xml>')) {\n xml_parser_free($xml);\n unset($xml);\n return false;\n }\n\n xml_parser_free($xml);\n unset($xml);\n\n return isset($this->components['modulus']) && isset($this->components['publicExponent']) ? $this->components : false;\n // see PuTTY's SSHPUBK.C and https://tartarus.org/~simon/putty-snapshots/htmldoc/AppendixC.html\n case self::PRIVATE_FORMAT_PUTTY:\n $components = array();\n $key = preg_split('#\\r\\n|\\r|\\n#', $key);\n if ($this->_string_shift($key[0], strlen('PuTTY-User-Key-File-')) != 'PuTTY-User-Key-File-') {\n return false;\n }\n $version = (int) $this->_string_shift($key[0], 3); // should be either \"2: \" or \"3: 0\" prior to int casting\n if ($version != 2 && $version != 3) {\n return false;\n }\n $type = rtrim($key[0]);\n if ($type != 'ssh-rsa') {\n return false;\n }\n $encryption = trim(preg_replace('#Encryption: (.+)#', '$1', $key[1]));\n $comment = trim(preg_replace('#Comment: (.+)#', '$1', $key[2]));\n\n $publicLength = trim(preg_replace('#Public-Lines: (\\d+)#', '$1', $key[3]));\n $public = base64_decode(implode('', array_map('trim', array_slice($key, 4, $publicLength))));\n $public = substr($public, 11);\n extract(unpack('Nlength', $this->_string_shift($public, 4)));\n $components['publicExponent'] = new BigInteger($this->_string_shift($public, $length), -256);\n extract(unpack('Nlength', $this->_string_shift($public, 4)));\n $components['modulus'] = new BigInteger($this->_string_shift($public, $length), -256);\n\n $offset = $publicLength + 4;\n switch ($encryption) {\n case 'aes256-cbc':\n $crypto = new AES();\n switch ($version) {\n case 3:\n if (!function_exists('sodium_crypto_pwhash')) {\n return false;\n }\n $flavour = trim(preg_replace('#Key-Derivation: (.*)#', '$1', $key[$offset++]));\n switch ($flavour) {\n case 'Argon2i':\n $flavour = SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13;\n break;\n case 'Argon2id':\n $flavour = SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13;\n break;\n default:\n return false;\n }\n $memory = trim(preg_replace('#Argon2-Memory: (\\d+)#', '$1', $key[$offset++]));\n $passes = trim(preg_replace('#Argon2-Passes: (\\d+)#', '$1', $key[$offset++]));\n $parallelism = trim(preg_replace('#Argon2-Parallelism: (\\d+)#', '$1', $key[$offset++]));\n $salt = pack('H*', trim(preg_replace('#Argon2-Salt: ([0-9a-f]+)#', '$1', $key[$offset++])));\n\n $length = 80; // keylen + ivlen + mac_keylen\n $temp = sodium_crypto_pwhash($length, $this->password, $salt, $passes, $memory << 10, $flavour);\n\n $symkey = substr($temp, 0, 32);\n $symiv = substr($temp, 32, 16);\n break;\n case 2:\n $symkey = '';\n $sequence = 0;\n while (strlen($symkey) < 32) {\n $temp = pack('Na*', $sequence++, $this->password);\n $symkey.= pack('H*', sha1($temp));\n }\n $symkey = substr($symkey, 0, 32);\n $symiv = str_repeat(\"\\0\", 16);\n }\n }\n\n $privateLength = trim(preg_replace('#Private-Lines: (\\d+)#', '$1', $key[$offset++]));\n $private = base64_decode(implode('', array_map('trim', array_slice($key, $offset, $privateLength))));\n\n if ($encryption != 'none') {\n $crypto->setKey($symkey);\n $crypto->setIV($symiv);\n $crypto->disablePadding();\n $private = $crypto->decrypt($private);\n if ($private === false) {\n return false;\n }\n }\n\n extract(unpack('Nlength', $this->_string_shift($private, 4)));\n if (strlen($private) < $length) {\n return false;\n }\n $components['privateExponent'] = new BigInteger($this->_string_shift($private, $length), -256);\n extract(unpack('Nlength', $this->_string_shift($private, 4)));\n if (strlen($private) < $length) {\n return false;\n }\n $components['primes'] = array(1 => new BigInteger($this->_string_shift($private, $length), -256));\n extract(unpack('Nlength', $this->_string_shift($private, 4)));\n if (strlen($private) < $length) {\n return false;\n }\n $components['primes'][] = new BigInteger($this->_string_shift($private, $length), -256);\n\n $temp = $components['primes'][1]->subtract($this->one);\n $components['exponents'] = array(1 => $components['publicExponent']->modInverse($temp));\n $temp = $components['primes'][2]->subtract($this->one);\n $components['exponents'][] = $components['publicExponent']->modInverse($temp);\n\n extract(unpack('Nlength', $this->_string_shift($private, 4)));\n if (strlen($private) < $length) {\n return false;\n }\n $components['coefficients'] = array(2 => new BigInteger($this->_string_shift($private, $length), -256));\n\n return $components;\n case self::PRIVATE_FORMAT_OPENSSH:\n $components = array();\n $decoded = $this->_extractBER($key);\n $magic = $this->_string_shift($decoded, 15);\n if ($magic !== \"openssh-key-v1\\0\") {\n return false;\n }\n extract(unpack('Nlength', $this->_string_shift($decoded, 4)));\n if (strlen($decoded) < $length) {\n return false;\n }\n $ciphername = $this->_string_shift($decoded, $length);\n extract(unpack('Nlength', $this->_string_shift($decoded, 4)));\n if (strlen($decoded) < $length) {\n return false;\n }\n $kdfname = $this->_string_shift($decoded, $length);\n extract(unpack('Nlength', $this->_string_shift($decoded, 4)));\n if (strlen($decoded) < $length) {\n return false;\n }\n $kdfoptions = $this->_string_shift($decoded, $length);\n extract(unpack('Nnumkeys', $this->_string_shift($decoded, 4)));\n if ($numkeys != 1 || ($ciphername != 'none' && $kdfname != 'bcrypt')) {\n return false;\n }\n switch ($ciphername) {\n case 'none':\n break;\n case 'aes256-ctr':\n extract(unpack('Nlength', $this->_string_shift($kdfoptions, 4)));\n if (strlen($kdfoptions) < $length) {\n return false;\n }\n $salt = $this->_string_shift($kdfoptions, $length);\n extract(unpack('Nrounds', $this->_string_shift($kdfoptions, 4)));\n $crypto = new AES(AES::MODE_CTR);\n $crypto->disablePadding();\n if (!$crypto->setPassword($this->password, 'bcrypt', $salt, $rounds, 32)) {\n return false;\n }\n break;\n default:\n return false;\n }\n extract(unpack('Nlength', $this->_string_shift($decoded, 4)));\n if (strlen($decoded) < $length) {\n return false;\n }\n $publicKey = $this->_string_shift($decoded, $length);\n extract(unpack('Nlength', $this->_string_shift($decoded, 4)));\n if (strlen($decoded) < $length) {\n return false;\n }\n\n if ($this->_string_shift($publicKey, 11) !== \"\\0\\0\\0\\7ssh-rsa\") {\n return false;\n }\n\n $paddedKey = $this->_string_shift($decoded, $length);\n if (isset($crypto)) {\n $paddedKey = $crypto->decrypt($paddedKey);\n }\n\n $checkint1 = $this->_string_shift($paddedKey, 4);\n $checkint2 = $this->_string_shift($paddedKey, 4);\n if (strlen($checkint1) != 4 || $checkint1 !== $checkint2) {\n return false;\n }\n\n if ($this->_string_shift($paddedKey, 11) !== \"\\0\\0\\0\\7ssh-rsa\") {\n return false;\n }\n\n $values = array(\n &$components['modulus'],\n &$components['publicExponent'],\n &$components['privateExponent'],\n &$components['coefficients'][2],\n &$components['primes'][1],\n &$components['primes'][2]\n );\n\n foreach ($values as &$value) {\n extract(unpack('Nlength', $this->_string_shift($paddedKey, 4)));\n if (strlen($paddedKey) < $length) {\n return false;\n }\n $value = new BigInteger($this->_string_shift($paddedKey, $length), -256);\n }\n\n extract(unpack('Nlength', $this->_string_shift($paddedKey, 4)));\n if (strlen($paddedKey) < $length) {\n return false;\n }\n $components['comment'] = $this->_string_shift($decoded, $length);\n\n $temp = $components['primes'][1]->subtract($this->one);\n $components['exponents'] = array(1 => $components['publicExponent']->modInverse($temp));\n $temp = $components['primes'][2]->subtract($this->one);\n $components['exponents'][] = $components['publicExponent']->modInverse($temp);\n\n return $components;\n }\n\n return false;\n }",
"static public function quoteKey($value)\n {\n if (is_int($value)) {\n return $value;\n } elseif (is_float($value)) {\n return sprintf('%F', $value);\n }\n return \"`\" . addcslashes($value, \"\\000\\n\\r\\\\'\\\"\\032\") . \"`\";\n }",
"private function buildSigningKey(): string {\r\n return \"$this->secret&$this->userSecret\";\r\n }",
"#[ArrayShape([\"bits\" => \"int\", \"key\" => \"string\", \"rsa\" => \"array\", \"dsa\" => \"array\", \"dh\" => \"array\", \"type\" => \"int\"])]\nfunction openssl_pkey_get_details(#[LanguageLevelTypeAware([\"8.0\" => \"OpenSSLAsymmetricKey\"], default: \"resource\")] $key): array|false {}",
"public function normaliseKey(string $key): string;",
"public function getExtensionKey() {}",
"public function getExtensionKey() {}",
"abstract protected function generateKey();",
"public function convertStorageToEntityKey($key);",
"function _gensesskey() {\n # with compliments to \"ripat at lumadis dot be\" from php.net online docs\n $acceptedChars = 'azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN0123456789';\n $max = strlen($acceptedChars)-1;\n $key = null;\n for ($i = 0; $i < 64; $i++) {\n $key .= $acceptedChars{mt_rand(0, $max)};\n }\n return $key;\n }"
]
| [
"0.6497994",
"0.638375",
"0.5866821",
"0.5615218",
"0.55490404",
"0.55445176",
"0.5536496",
"0.55313843",
"0.55313843",
"0.5526177",
"0.54993683",
"0.54523146",
"0.5439324",
"0.5422817",
"0.5419559",
"0.5418889",
"0.5418643",
"0.5406233",
"0.5404216",
"0.5380551",
"0.53793776",
"0.5309665",
"0.5306366",
"0.52928805",
"0.5279645",
"0.52726513",
"0.52726513",
"0.527248",
"0.5271957",
"0.52614576"
]
| 0.6588616 | 0 |
Whether to consider the cache item private (for a specific user) or public (so a shared cache can use it). | public function isPrivate(): bool; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function canSeePrivate() {\n \treturn $this->isProjectManager() || (boolean) $this->getSystemPermission('can_see_private_objects');\n }",
"public function isPrivate()\n\t{\n\t\t//return ($this->get('private') == self::PRIVACY_PRIVATE);\n\t\treturn ($this->get('access') == 5);\n\t}",
"public function isUserPrivate()\n\t{\n\t\t$q = new BN_query('rights');\n\t\t$q->addTable('assocs', 'rght_themeid = asso_id');\n\t\t$q->addField('count(*)');\n\t\t$q->addWhere('rght_theme = ' . THEME_ASSOS);\n\t\t$q->addWhere(\"rght_status ='\" . AUTH_MANAGER . \"'\");\n\t\t$q->addWhere('rght_userid =' . Bn::getValue('user_id', -1));\n\t\t$q->addWhere('asso_type =' . OASSO_TYPE_PRIVATE);\n\t\t$nb = $q->getFirst();\n\t\treturn (Bn::getValue('user_type') == AUTH_PRIVATE || $nb);\n\t}",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"protected function is_private()\n {\n }",
"public function has_access($type, $user = false) {\n\t\tstatic $cache = array();\n\n\t\t$user = ORM::factory('user')->find_user($user);\n\t\t$cache_id = sprintf('%d_%s_%d', $this->id, $type, $user ? $user->id : 0);\n\n\t\tif (!isset($cache[$cache_id])) {\n\t\t\t$access = false;\n\t\t\tswitch ($type) {\n\n\t\t\t\t// Access to delete comment\n\t\t\t\tcase self::ACCESS_DELETE:\n\n\t\t\t\t// Access to set comment as private\n\t\t\t\tcase self::ACCESS_PRIVATE:\n\t\t\t\t\t$access = ($user && in_array($user->id, array($this->user_id, $this->author_id)));\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\t\t\t$cache[$cache_id] = $access;\n\t\t}\n\n\t\treturn $cache[$cache_id];\n\t}",
"public function is_private()\n {\n }",
"public function is_private()\n {\n }",
"public function is_private()\n {\n }",
"public function getPrivate() : bool {\n return $this->private;\n }",
"function feed_category_access($allow_public = FALSE, $feed_category) {\r\n global $user;\r\n \r\n if ($allow_public && $feed_category->is_public) {\r\n return TRUE;\r\n }\r\n if (isset($feed_category->uid)) {\r\n return $feed_category->uid == $user->uid;\r\n }\r\n return FALSE;\r\n}",
"function _can_cache() {\n\t\treturn true;\n\t}",
"public function canRead($userId = \"\")\n {\n\n if ($userId == \"\")\n $userId = Yii::$app->user->id;\n\n\n // For guests users\n if (Yii::$app->user->isGuest) {\n if ($this->visibility == 1) {\n if ($this->container instanceof Space) {\n if ($this->container->visibility == Space::VISIBILITY_ALL) {\n return true;\n }\n } elseif ($this->container instanceof User) {\n if ($this->container->visibility == User::VISIBILITY_ALL) {\n return true;\n }\n }\n }\n return false;\n }\n\n if ($this->visibility == 0) {\n // Space/User Content Access Check\n if ($this->space_id != \"\") {\n\n $space = null;\n if (isset(Yii::$app->params['currentSpace']) && Yii::$app->params['currentSpace']->id == $this->space_id) {\n $space = Yii::$app->params['currentSpace'];\n } else {\n $space = Space::findOne(['id' => $this->space_id]);\n }\n\n // Space Found\n if ($space != null) {\n if (!$space->isMember($userId)) {\n return false;\n }\n }\n } else {\n // Check for user content\n if ($userId != $this->user_id) {\n return false;\n }\n }\n }\n\n return true;\n }",
"public function getPrivate() : bool\n {\n return $this->private;\n }",
"function blockAccess($block, $path, $access, $cache=TRUE) {\n // PUBLIC always returns true.\n if ($access=='PUBLIC') return TRUE;\n if (!isset($_SESSION['forena_access'])) $_SESSION['forena_access'] = array();\n if ($cache && isset($_SESSION['forena_access'][$block])) {\n $rights = $_SESSION['forena_access'][$block];\n }\n else {\n $rights = array();\n // Get the block from the repository\n $frxData = Frx::Data();\n $frxData->push(array(), 'frx-block-access');\n $data = Frx::RepoMan()->data($block);\n $frxData->pop();\n if ($data) {\n if (!$path) {\n $path ='*/*';\n }\n $nodes = $data->xpath($path);\n if ($nodes) foreach ($nodes as $node) {\n $rights[] = (string)$node;\n }\n $_SESSION['forena_access'][$block]=$rights;\n }\n }\n foreach ($rights as $right) {\n if ($access == $right) return TRUE;\n }\n return FALSE;\n }",
"public function is_private() {\n\n\t\t/**\n\t\t * If the post is of post_type \"revision\", we need to access the parent of the Post\n\t\t * so that we can check access rights of the parent post. Revision access is inherit\n\t\t * to the Parent it is a revision of.\n\t\t */\n\t\tif ( isset( $this->data->post_type ) && 'revision' === $this->data->post_type ) {\n\n\t\t\t// Get the post\n\t\t\t$parent_post = get_post( $this->data->post_parent );\n\n\t\t\t// If the parent post doesn't exist, the revision should be considered private\n\t\t\tif ( ! $parent_post instanceof WP_Post ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Determine if the revision is private using capabilities relative to the parent\n\t\t\treturn $this->is_post_private( $parent_post );\n\n\t\t}\n\n\t\t/**\n\t\t * Media Items (attachments) are all public. Once uploaded to the media library\n\t\t * they are exposed with a public URL on the site.\n\t\t *\n\t\t * The WP REST API sets media items to private if they don't have a `post_parent` set, but\n\t\t * this has broken production apps, because media items can be uploaded directly to the\n\t\t * media library and published as a featured image, published inline within content, or\n\t\t * within a Gutenberg block, etc, but then a consumer tries to ask for data of a published\n\t\t * image and REST returns nothing because the media item is treated as private.\n\t\t *\n\t\t * Currently, we're treating all media items as public because there's nothing explicit in\n\t\t * how WP Core handles privacy of media library items. By default they're publicly exposed.\n\t\t */\n\t\tif ( 'attachment' === $this->data->post_type ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Published content is public, not private\n\t\t */\n\t\tif ( 'publish' === $this->data->post_status ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $this->is_post_private( $this->data );\n\t}",
"function isItemAuthor($userId, $itemId){\n return getSingleValue(\"SELECT COUNT(`id`) FROM `public_items` WHERE `id` =\" . escape(intval($itemId)) . \" AND `userid` ='\" . escape(intval($userId)) . \"' LIMIT 0, 1\");\n }",
"public function isPublic() {\n return $this->privacyState == 'public';\n }",
"public function isPublic()\n {\n return $this->_public;\n }",
"public function isPrivate() : bool {\n return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);\n }",
"public function is_public_allowed( $entry ) {\n\t\treturn false;\n\t}",
"public function viewableByOwnerOnly();",
"public function is_public(): bool;",
"public function isAccess();"
]
| [
"0.67562926",
"0.64362997",
"0.6394595",
"0.63242257",
"0.63242257",
"0.63242257",
"0.63242257",
"0.63242257",
"0.63242257",
"0.63242257",
"0.63242257",
"0.6254965",
"0.62408495",
"0.62408495",
"0.62408495",
"0.6163403",
"0.6058631",
"0.60055995",
"0.5977228",
"0.5977099",
"0.590704",
"0.5904315",
"0.58807796",
"0.58699894",
"0.58696246",
"0.57956004",
"0.5778439",
"0.57692236",
"0.5741021",
"0.5736396"
]
| 0.6502839 | 1 |
Returns an environment variable as an integer. | function int_val(string $key, int $default = null): ?int
{
$val = env($key, $default);
if (is_numeric($val)) {
return intval($val);
}
return $default;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function GetInt($key)\n {\n return (int)self::Get($key);\n }",
"public function getSystem()\n {\n $value = $this->get(self::system);\n return $value === null ? (integer)$value : $value;\n }",
"private function fetchSeed(): int\n {\n $seed = \\getenv('PHPUNIT_SEED');\n\n if (!$seed) {\n try {\n $seed = \\random_int(1, 9999);\n } catch (\\Exception $e) {\n $seed = 1;\n }\n }\n\n return (int)$seed;\n }",
"public function get(string $key) : int;",
"public static function integer()\n {\n return self::builtinType('int');\n }",
"public function get(): int\n {\n return (int) $this->filesystem->get($this->filename);\n }",
"static public function Integer( $var ) {\r\n\r\n\t\t$cleaned = filter_var( $var, FILTER_SANITIZE_NUMBER_INT);\r\n\t\treturn $cleaned == \"\" ? false : (int)$cleaned;\r\n\r\n\t}",
"public function getInt(string $key): int\n {\n return intval($this->get($key));\n }",
"function env_get( $variable ){\n\t\t// not this function!\n\t\t$data = file_get_contents( 'env/env.json' );\n\t\t$json = json_decode( $data, true );\n\t\treturn $json[ $variable ];\n\t}",
"public function asInt($key)\n {\n\n if (isset($this->data[$key]))\n return (int)$this->data[$key];\n else\n return 0;\n\n }",
"public static function getVersionAsInteger()\n {\n if (self::$_version === null) {\n self::_determineVersion();\n }\n return self::$_version;\n }",
"public static function getEnvVariable($key) \n {\n // TODO - Check for other methods of getting env variables\n return getenv($key);\n }",
"function &int(int $value, string $namespace = 'default'): int\n{\n $var = new Variable\\IntVariable($value);\n Repository::add($var, $namespace);\n return $var->getValue();\n}",
"public function & toInt () {\n return $this->varContainer;\n }",
"protected static function variable($variable)\n {\n $ret = null;\n\n if (defined($variable)) {\n $value = constant($variable);\n } else {\n $value = getenv($variable);\n }\n\n $value = trim($value);\n\n if (strlen($value) > 0) {\n $ret = $value;\n }\n\n return $ret;\n }",
"public function getInt($key)\n {\n return (int) $this->get($key, 0);\n }",
"public static function int($key, $length)\n {\n return static::make($key, $length)->asInt();\n }",
"public function toInt()\n {\n return self::infer((int) $this->value);\n }",
"public static function getInt($name, $default = 0, $hash = 'default')\n {\n return static::getVar($name, $default, $hash, 'int');\n }",
"function getEnvValue($name)\n{\n return $_ENV[$name] ?? getenv($name);\n}",
"public function getInt($key)\n {\n\n if (isset($this->data[$key]))\n return (int)$this->data[$key];\n else\n return 0;\n\n }",
"public function value(): int;",
"public function toInt()\n {\n return $this->cast('int');\n }",
"public function getPort(): int {\n return (integer) $this->port;\n }",
"public static function getInt($param)\n {\n $value = filter_var(self::get($param), FILTER_VALIDATE_INT);\n\n return $value;\n }",
"function envvalue($name, $default)\n{\n $value = getenv($name);\n return $value == false ? $default : $value;\n}",
"public function toNative()\n {\n $value = parent::toNative();\n\n return \\intval($value);\n }",
"public function getInt($name);",
"public function get_userVar(): int\n {\n // $res is a int;\n if ($this->_cacheExpiration <= YAPI::GetTickCount()) {\n if ($this->load(YAPI::$_yapiContext->GetCacheValidity()) != YAPI::SUCCESS) {\n return self::USERVAR_INVALID;\n }\n }\n $res = $this->_userVar;\n return $res;\n }",
"public function getInt() {\n if($this->boolean) {\n return 1;\n } else {\n return 0;\n }\n }"
]
| [
"0.54371",
"0.5410612",
"0.5335025",
"0.53182155",
"0.5305057",
"0.5260806",
"0.5257561",
"0.5243015",
"0.52060014",
"0.5203619",
"0.5184331",
"0.51800865",
"0.5165447",
"0.51006466",
"0.5082181",
"0.5080617",
"0.50407284",
"0.5013334",
"0.50021654",
"0.49792463",
"0.49783546",
"0.4964142",
"0.4948195",
"0.4947624",
"0.49472687",
"0.49406904",
"0.49321637",
"0.4924983",
"0.49172795",
"0.49168104"
]
| 0.6639476 | 0 |
Get the AWS S3 Adapter | public function getAdapter()
{
$client = new S3Client([
'credentials' => [
'key' => $this->accessKey,
'secret' => $this->secret,
],
'region' => $this->region,
'version' => $this->version, // or "latest"
//'profile' => 'default', #if enabled - the library searches for credentials in {webserver_root}/.aws/credentials
]);
$bucket = 'mbt-public-media';
return new AwsS3Adapter($client, $bucket);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getS3Adapter(array $config): AwsS3Adapter\n {\n return app('filesystem')->disk(Arr::get($config, 'disk', 's3'))->getAdapter();\n }",
"public function getS3() {\r\n if (empty($this->s3)) {\r\n try {\r\n $this->s3 = new AmazonS3();\r\n } catch (Exception $e) {\r\n $this->modx->log(modX::LOG_LEVEL_ERROR,'[modAws] Could not load AmazonS3 class: '.$e->getMessage());\r\n }\r\n }\r\n return $this->s3;\r\n }",
"public function getAmazonS3()\n {\n return $this->amazonS3;\n }",
"public function getS3Object(){\t\n\t\ttry {\t\n\t\t\t$this->autoRender = false;\n\t\t\t$s3Credentials = Configure::read('S3_CREDENTIALS');\n\t\n\t\t\t$s3 = S3Client::factory([\n\t\t\t\t\t'credentials' => [\n\t\t\t\t\t\t\t'key' => $s3Credentials['KEY'],\n\t\t\t\t\t\t\t'secret' => $s3Credentials['SECRET']\n\t\t\t\t\t],\n\t\t\t\t\t'region' => $s3Credentials['REGION'],\n\t\t\t\t\t'version' => $s3Credentials['VERSION'],\n\t\t\t\t\t\t\n\t\t\t]);\n\t\t\t\t\n\t\t\treturn $s3;\n\t\n\t\t}catch (S3Exception $e) {\n\t\t\techo $e->getMessage() . \"\\n\";\n\t\t}\n\t\n\t}",
"function getConnection()\n\t{\n\t\treturn S3Client::factory(array(\"key\"=>$this->iamkey, \"secret\"=>$this->iamsecret));\n\t}",
"private function connectServer() : S3Client\n {\n return new S3Client($this->storageConfig['s3']);\n }",
"protected function getS3Client()\n {\n $config = $this->getAwsConfig();\n // Create an instance of the AWS SDK and S3Client.\n $awsSdk = new Sdk($config);\n return $awsSdk->createS3();\n }",
"protected function getS3Client()\n {\n // If we haven't call this function already\n if (!$this->s3) {\n // Generate a brand new instance and keep a reference to it.\n $this->s3 = new Aws\\S3\\S3Client(array(\n 'credentials' => new Aws\\Credentials\\Credentials(\n self::config()->AccessId,\n self::config()->Secret\n ),\n 'region' => $this->Region,\n 'version' => 'latest',\n ));\n }\n return $this->s3;\n }",
"public function getFactory ()\n {\n return S3Client::factory($this->getAwsAuthArray()); // returns the AWS S3 Client Factory, will fail if no key &/or secret\n }",
"public function getS3Bucket();",
"public function getAws(): Sdk\n {\n return $this->aws;\n }",
"public static function getDisk()\n {\n return Storage::disk('s3');\n }",
"public static function getS3Bucket() {\n global $config;\n $aws_connector_config = \\Drupal::config('aws_connector.settings');\n if ($aws_connector_config) {\n if (isset($config['aws_connector.aws_s3_bucket'])) {\n return $config['aws_connector.aws_s3_bucket'];\n }\n else {\n return self::getConfig('aws_s3_bucket', $aws_connector_config);\n }\n }\n return '';\n }",
"public function getS3Client(): S3Client\n {\n return new S3Client([\n 'version' => 'latest',\n 'region' => $this->getAwsRegion(),\n ]);\n }",
"protected function &getS3Client()\n\t{\n\t\t// Retrieve engine configuration data\n\t\t$config = $this->getEngineConfiguration();\n\n\t\t// Get the configuration parameters\n\t\t$accessKey = $config['accessKey'];\n\t\t$secretKey = $config['secretKey'];\n\t\t$useSSL = $config['useSSL'];\n\t\t$customEndpoint = $config['customEndpoint'];\n\t\t$signatureMethod = $config['signatureMethod'];\n\t\t$region = $config['region'];\n\t\t$disableMultipart = $config['disableMultipart'];\n\t\t$bucket = $config['bucket'];\n\n\t\t// Required since we're returning by reference\n\t\t$null = null;\n\n\t\tif ($signatureMethod == 's3')\n\t\t{\n\t\t\t$signatureMethod = 'v2';\n\t\t}\n\n\t\tFactory::getLog()\n\t\t\t->log(LogLevel::DEBUG, \"{$this->engineLogName} -- Using signature method $signatureMethod, \" . ($disableMultipart ? 'single-part' : 'multipart') . ' uploads');\n\n\t\t// Makes sure the custom endpoint has no protocol and no trailing slash\n\t\t$customEndpoint = trim($customEndpoint);\n\n\t\tif ( !empty($customEndpoint))\n\t\t{\n\t\t\t$protoPos = strpos($customEndpoint, ':\\\\');\n\n\t\t\tif ($protoPos !== false)\n\t\t\t{\n\t\t\t\t$customEndpoint = substr($customEndpoint, $protoPos + 3);\n\t\t\t}\n\n\t\t\t$customEndpoint = rtrim($customEndpoint, '/');\n\n\t\t\tFactory::getLog()\n\t\t\t\t->log(LogLevel::DEBUG, \"{$this->engineLogName} -- Using custom endpoint $customEndpoint\");\n\t\t}\n\n\t\t// Remove any slashes from the bucket\n\t\t$bucket = str_replace('/', '', $bucket);\n\n\t\t// Sanity checks\n\t\tif (empty($accessKey))\n\t\t{\n\t\t\t$this->setError('You have not set up your ' . $this->engineLogName . ' Access Key');\n\n\t\t\treturn $null;\n\t\t}\n\n\t\tif (empty($secretKey))\n\t\t{\n\t\t\t$this->setError('You have not set up your ' . $this->engineLogName . ' Secret Key');\n\n\t\t\treturn $null;\n\t\t}\n\n\t\tif ( !function_exists('curl_init'))\n\t\t{\n\t\t\t$this->setWarning('cURL is not enabled, please enable it in order to post-process your archives');\n\n\t\t\treturn null;\n\t\t}\n\n\t\tif (empty($bucket))\n\t\t{\n\t\t\t$this->setError('You have not set up your ' . $this->engineLogName . ' Bucket');\n\n\t\t\treturn $null;\n\t\t}\n\n\n\t\t// Prepare the configuration\n\t\t$configuration = new Configuration($accessKey, $secretKey, $signatureMethod, $region);\n\t\t$configuration->setSSL($useSSL);\n\n\t\tif (!empty($config['token']))\n\t\t{\n\t\t\t$configuration->setToken($config['token']);\n\t\t}\n\n\t\tif ($customEndpoint)\n\t\t{\n\t\t\t$configuration->setEndpoint($customEndpoint);\n\t\t}\n\n\t\t// If we're dealing with China AWS, we have to use the Legacy Paths\n\t\tif ($region == 'cn-north-1')\n\t\t{\n\t\t\t$configuration->setUseLegacyPathStyle(true);\n\t\t}\n\n\t\t// Create the S3 client instance\n\t\t$s3Client = new Connector($configuration);\n\n\t\treturn $s3Client;\n\t}",
"private function createAWSS3Mock()\n {\n /** @var $awsMock S3Client */\n $awsMock = $this->createMock(S3Client::class);\n return $awsMock;\n }",
"function S3Object($name) {\n\t\t\treturn new S3Object($this->__name, $name, $this->GetAWSKeyId(), $this->GetSecretKey());\n\t\t}",
"public function getResponse()\n\t{\n\t\t$query = '';\n\t\tif (sizeof($this->parameters) > 0)\n\t\t{\n\t\t\t$query = substr($this->uri, -1) !== '?' ? '?' : '&';\n\t\t\tforeach ($this->parameters as $var => $value)\n\t\t\t\tif ($value == null || $value == '') $query .= $var.'&';\n\t\t\t\telse $query .= $var.'='.rawurlencode($value).'&';\n\t\t\t$query = substr($query, 0, -1);\n\t\t\t$this->uri .= $query;\n\n\t\t\tif (array_key_exists('acl', $this->parameters) ||\n\t\t\tarray_key_exists('location', $this->parameters) ||\n\t\t\tarray_key_exists('torrent', $this->parameters) ||\n\t\t\tarray_key_exists('website', $this->parameters) ||\n\t\t\tarray_key_exists('logging', $this->parameters))\n\t\t\t\t$this->resource .= $query;\n\t\t}\n\t\t$url = (S3Compatible::$useSSL ? 'https://' : 'http://') . ($this->headers['Host'] !== '' ? $this->headers['Host'] : $this->endpoint) . $this->uri;\n\n\t\t//var_dump('bucket: ' . $this->bucket, 'uri: ' . $this->uri, 'resource: ' . $this->resource, 'url: ' . $url);\n\n\t\t// Basic setup\n\t\t$curl = curl_init();\n\t\tcurl_setopt($curl, CURLOPT_USERAGENT, 'S3/php');\n\n\t\tif (S3Compatible::$useSSL)\n\t\t{\n\t\t\t// Set protocol version\n\t\t\tcurl_setopt($curl, CURLOPT_SSLVERSION, S3Compatible::$useSSLVersion);\n\n\t\t\t// SSL Validation can now be optional for those with broken OpenSSL installations\n\t\t\tcurl_setopt($curl, CURLOPT_SSL_VERIFYHOST, S3Compatible::$useSSLValidation ? 2 : 0);\n\t\t\tcurl_setopt($curl, CURLOPT_SSL_VERIFYPEER, S3Compatible::$useSSLValidation ? 1 : 0);\n\n\t\t\tif (S3Compatible::$sslKey !== null) curl_setopt($curl, CURLOPT_SSLKEY, S3Compatible::$sslKey);\n\t\t\tif (S3Compatible::$sslCert !== null) curl_setopt($curl, CURLOPT_SSLCERT, S3Compatible::$sslCert);\n\t\t\tif (S3Compatible::$sslCACert !== null) curl_setopt($curl, CURLOPT_CAINFO, S3Compatible::$sslCACert);\n\t\t}\n\n\t\tcurl_setopt($curl, CURLOPT_URL, $url);\n\n\t\tif (S3Compatible::$proxy != null && isset(S3Compatible::$proxy['host']))\n\t\t{\n\t\t\tcurl_setopt($curl, CURLOPT_PROXY, S3Compatible::$proxy['host']);\n\t\t\tcurl_setopt($curl, CURLOPT_PROXYTYPE, S3Compatible::$proxy['type']);\n\t\t\tif (isset(S3Compatible::$proxy['user'], S3Compatible::$proxy['pass']) && S3Compatible::$proxy['user'] != null && S3Compatible::$proxy['pass'] != null)\n\t\t\t\tcurl_setopt($curl, CURLOPT_PROXYUSERPWD, sprintf('%s:%s', S3Compatible::$proxy['user'], S3Compatible::$proxy['pass']));\n\t\t}\n\n\t\t// Headers\n\t\t$headers = array(); $amz = array();\n\t\tforeach ($this->amzHeaders as $header => $value)\n\t\t\tif (strlen($value) > 0) $headers[] = $header.': '.$value;\n\t\tforeach ($this->headers as $header => $value)\n\t\t\tif (strlen($value) > 0) $headers[] = $header.': '.$value;\n\n\t\t// Collect AMZ headers for signature\n\t\tforeach ($this->amzHeaders as $header => $value)\n\t\t\tif (strlen($value) > 0) $amz[] = strtolower($header).':'.$value;\n\n\t\t// AMZ headers must be sorted\n\t\tif (sizeof($amz) > 0)\n\t\t{\n\t\t\t//sort($amz);\n\t\t\tusort($amz, array(&$this, 'sortMetaHeadersCmp'));\n\t\t\t$amz = \"\\n\".implode(\"\\n\", $amz);\n\t\t} else $amz = '';\n\n\t\tif (S3Compatible::hasAuth())\n\t\t{\n\t\t\t// Authorization string (CloudFront stringToSign should only contain a date)\n\t\t\tif ($this->headers['Host'] == 'cloudfront.amazonaws.com')\n\t\t\t\t$headers[] = 'Authorization: ' . S3Compatible::getSignature($this->headers['Date']);\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (S3Compatible::$signVer == 'v2')\n\t\t\t\t{\n\t\t\t\t\t$headers[] = 'Authorization: ' . S3Compatible::getSignature(\n\t\t\t\t\t\t$this->verb.\"\\n\".\n\t\t\t\t\t\t$this->headers['Content-MD5'].\"\\n\".\n\t\t\t\t\t\t$this->headers['Content-Type'].\"\\n\".\n\t\t\t\t\t\t$this->headers['Date'].$amz.\"\\n\".\n\t\t\t\t\t\t$this->resource\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t$amzHeaders = S3Compatible::getSignatureV4(\n\t\t\t\t\t\t$this->amzHeaders,\n\t\t\t\t\t\t$this->headers,\n\t\t\t\t\t\t$this->verb,\n\t\t\t\t\t\t$this->uri,\n\t\t\t\t\t\t$this->data,\n\t\t\t\t\t\t$this->parameters\n\t\t\t\t\t);\n\t\t\t\t\tforeach ($amzHeaders as $k => $v) {\n\t\t\t\t\t\t$headers[] = $k .': '. $v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tcurl_setopt($curl, CURLOPT_HTTPHEADER, $headers);\n\t\tcurl_setopt($curl, CURLOPT_HEADER, false);\n\t\tcurl_setopt($curl, CURLOPT_RETURNTRANSFER, false);\n\t\tcurl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, 'responseWriteCallback'));\n\t\tcurl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, 'responseHeaderCallback'));\n\t\tcurl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);\n\n\t\t// Request types\n\t\tswitch ($this->verb)\n\t\t{\n\t\t\tcase 'GET': break;\n\t\t\tcase 'PUT': case 'POST': // POST only used for CloudFront\n\t\t\t\tif ($this->fp !== false)\n\t\t\t\t{\n\t\t\t\t\tcurl_setopt($curl, CURLOPT_PUT, true);\n\t\t\t\t\tcurl_setopt($curl, CURLOPT_INFILE, $this->fp);\n\t\t\t\t\tif ($this->size >= 0)\n\t\t\t\t\t\tcurl_setopt($curl, CURLOPT_INFILESIZE, $this->size);\n\t\t\t\t}\n\t\t\t\telseif ($this->data !== false)\n\t\t\t\t{\n\t\t\t\t\tcurl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->verb);\n\t\t\t\t\tcurl_setopt($curl, CURLOPT_POSTFIELDS, $this->data);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tcurl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->verb);\n\t\t\tbreak;\n\t\t\tcase 'HEAD':\n\t\t\t\tcurl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD');\n\t\t\t\tcurl_setopt($curl, CURLOPT_NOBODY, true);\n\t\t\tbreak;\n\t\t\tcase 'DELETE':\n\t\t\t\tcurl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');\n\t\t\tbreak;\n\t\t\tdefault: break;\n\t\t}\n\n\t\t// Execute, grab errors\n\t\tif (curl_exec($curl))\n\t\t\t$this->response->code = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n\t\telse\n\t\t\t$this->response->error = array(\n\t\t\t\t'code' => curl_errno($curl),\n\t\t\t\t'message' => curl_error($curl),\n\t\t\t\t'resource' => $this->resource\n\t\t\t);\n\n\t\t@curl_close($curl);\n\n\t\t// Parse body into XML\n\t\tif ($this->response->error === false && isset($this->response->headers['type']) &&\n\t\t$this->response->headers['type'] == 'application/xml' && isset($this->response->body))\n\t\t{\n\t\t\t$this->response->body = simplexml_load_string($this->response->body);\n\n\t\t\t// Grab S3 errors\n\t\t\tif (!in_array($this->response->code, array(200, 204, 206)) &&\n\t\t\tisset($this->response->body->Code, $this->response->body->Message))\n\t\t\t{\n\t\t\t\t$this->response->error = array(\n\t\t\t\t\t'code' => (string)$this->response->body->Code,\n\t\t\t\t\t'message' => (string)$this->response->body->Message\n\t\t\t\t);\n\t\t\t\tif (isset($this->response->body->Resource))\n\t\t\t\t\t$this->response->error['resource'] = (string)$this->response->body->Resource;\n\t\t\t\tunset($this->response->body);\n\t\t\t}\n\t\t}\n\n\t\t// Clean up file resources\n\t\tif ($this->fp !== false && is_resource($this->fp)) fclose($this->fp);\n\n\t\treturn $this->response;\n\t}",
"public function connector()\n {\n $aws_config = [\n \"key\" => \"\",\n \"secret\" => \"\",\n \"region\" => \"\",\n \"bucket\" => \"\",\n \"prefix\" => $_GET[\"folder\"],//prefix of listed images, it will be appended to your AWS bucket address. eg. \"images\" or \"some/path/\"\n \"version\" => \"latest\",\n \"acl\" => 'public-read',\n \"private-acl\" => 'private',\n \"StorageClass\" => 'STANDARD',\n ];\n //END AWS CONFIG*******************\n\n $aws_url = \"http://\" . $aws_config[\"bucket\"] . \".s3.\" . $aws_config[\"region\"] . \".amazonaws.com\";\n $client = new S3Client(\n Array ( \"driver\" => \"s3\",\n \"key\" => $aws_config[\"key\"],\n \"secret\" => $aws_config[\"secret\"],\n \"region\" => $aws_config[\"region\"],\n \"bucket\" => $aws_config[\"bucket\"],\n \"url\" => $aws_url,\n \"version\" => $aws_config[\"version\"],\n \"acl\" => $aws_config[\"acl\"],\n \"private-acl\" => $aws_config[\"private-acl\"],\n \"StorageClass\" => $aws_config[\"StorageClass\"],\n \"credentials\" => Array (\n \"key\" => $aws_config[\"key\"],\n \"secret\" => $aws_config[\"secret\"]\n )\n )\n );\n $adapter = new AwsS3Adapter($client, $aws_config[\"bucket\"], $aws_config[\"prefix\"],[\n \"version\" => $aws_config[\"version\"],\n 'ACL' => $aws_config[\"acl\"],\n \"private-acl\" => $aws_config[\"private-acl\"],\n \"StorageClass\" => $aws_config[\"StorageClass\"]\n ]);\n $filesystem = new Filesystem($adapter, Array ( \"url\" => $aws_url ));\n\n $opts = array(\n // 'debug' => true,\n 'roots' => [\n [\n 'driver' => 'Flysystem',\n 'alias' => 'BIQDev.com',//Change to anything you like\n 'filesystem' => $filesystem,\n 'URL' => $aws_url,\n 'tmbURL' => 'self'\n ]\n ],\n 'bind' => array(\n 'upload.pre' => array( $this, 'preCheck' )\n )\n );\n\n $connector = new elFinderConnector(new elFinder($opts));\n $connector->run();\n\n }",
"private function load_s3()\n\t{\n\t\t// S3 credentials\n\t\t$this->client = S3Client::factory(array(\n\t\t\t'key'\t\t=> $this->config['aws_access_key'],\n\t\t\t'secret'\t=> $this->config['aws_secret_key'],\n\t\t));\n\n\t\t// Register Stream Wrapper\n\t\ttry {\n\t\t\t$this->client->registerStreamWrapper();\n\t\t} catch ( Exception $e ) {\n\t\t\t$errors = array(\n\t\t\t\t'error' => $e->getMessage(),\n\t\t\t);\n\n\t\t\t// Set the template here\n\t\t\t$template = File::get( __DIR__ . '/views/error-no-render.html');\n\n\t\t\t// Parse the template\n\t\t\t$html = Parse::template($template, $errors);\n\n\t\t\theader('Content-Type', 'application/json');\n\t\t\techo self::build_response_json(false, true, FILECLERK_S3_ERROR, $e->getMessage(), 'error', $errors, null, $html);\n\t\t\texit;\n\t\t}\n\t}",
"public function createS3Driver(array $config)\n {\n $s3Config = $this->formatS3Config($config);\n\n $root = $s3Config['root'] ?? null;\n\n $options = $config['options'] ?? [];\n\n return new FilesystemS3Adapter(new Flysystem(new S3Adapter(\n new S3Client($s3Config), $s3Config['bucket'], $root, $options), $config\n ));\n }",
"protected function getImageStoreClient()\n {\n try {\n $imageStore = S3Client::factory(\n array(\n 'key' => $this->imageStoreConfig['access_key'],\n 'secret' => $this->imageStoreConfig['secret_key']\n )\n );\n return $imageStore;\n } catch (Exception $e) {\n throw new Exception($e->getMessage());\n }\n }",
"function getImageFromS3($target_id, $type_origin = 0, $ordered = 1) {\n\n $CI = & get_instance();\n $CI->load->library('AppUploader');\n $path = '';\n if ($type_origin == '1') {\n $type = 'nursery';\n $path = 'upload/nursery/default.jpg';\n } elseif ($type_origin == '2') {\n $type = 'job';\n $path = 'upload/job/default.jpg';\n } elseif ($type_origin == '3') {\n $type = 'client';\n $path = 'upload/client/default.jpg';\n } elseif ($type_origin == '4') {\n $type = 'careeradviser';\n $path = 'upload/careeradviser/default.jpg';\n } elseif ($type_origin == '5') {\n $type = 'ads';\n }else {\n $type = 'tmp';\n }\n if ($ordered) {\n $path = 'upload/' . $type . '/' . $target_id . '_' . $ordered . '.jpg';\n }\n\n $ret['path'] = $CI->appuploader->getObjectUrl($path);\n\n // TODO\n // $thumnail = 'upload/' . $type . '/' . $target_id . '_' . $ordered . '_thumbnail.jpg';\n // $ret['thumbnail'] = $CI->appuploader->getObjectUrl($thumnail);\n\n return $ret;\n}",
"public function getS3CompatibleBucket() {\n return @$this->attributes['s3_compatible_bucket'];\n }",
"public function newAWS(): AWS\n {\n return new AWS($this->config);\n }",
"public function getS3Bucket() {\n return @$this->attributes['s3_bucket'];\n }",
"function getAmazonSDB(){\n $config = getConfig();\n \n $adapterClass = 'Zend_Cloud_DocumentService_Adapter_SimpleDb';\n $amazonSDB = Zend_Cloud_DocumentService_Factory::getAdapter(array(\n Zend_Cloud_DocumentService_Factory::DOCUMENT_ADAPTER_KEY => $adapterClass,\n Zend_Cloud_DocumentService_Adapter_SimpleDb::AWS_ACCESS_KEY => $config->amazon->aws_access_key,\n Zend_Cloud_DocumentService_Adapter_SimpleDb::AWS_SECRET_KEY => $config->amazon->aws_private_key\n ));\n \n //Check if we have to create the domain\n $domains = $amazonSDB->listCollections();\n \n foreach($config->analytics as $key => $item){\n if(!in_array($item->domain, $domains)){\n $amazonSDB->createCollection($item->domain);\n }\n }\n \n return $amazonSDB;\n}",
"public function moveToS3()\r\n {\r\n \t$app = \\Base::instance();\r\n \t\r\n \t$options = array(\r\n \t 'clientPrivateKey' => $app->get('aws.clientPrivateKey'),\r\n \t 'serverPublicKey' => $app->get('aws.serverPublicKey'),\r\n \t 'serverPrivateKey' => $app->get('aws.serverPrivateKey'),\r\n \t 'expectedBucketName' => $app->get('aws.bucketname'),\r\n \t 'expectedMaxSize' => $app->get('aws.maxsize'),\r\n \t 'cors_origin' => $app->get('SCHEME') . \"://\" . $app->get('HOST') . $app->get('BASE')\r\n \t);\r\n \t\r\n \tif (!class_exists('\\Aws\\S3\\S3Client')\r\n \t|| empty($options['clientPrivateKey'])\r\n \t|| empty($options['serverPublicKey'])\r\n \t|| empty($options['serverPrivateKey'])\r\n \t|| empty($options['expectedBucketName'])\r\n \t|| empty($options['expectedMaxSize'])\r\n \t)\r\n \t{\r\n \t throw new \\Exception('Invalid configuration settings');\r\n \t}\r\n \t\r\n \t$bucket = $app->get( 'aws.bucketname' );\r\n \t$s3 = \\Aws\\S3\\S3Client::factory(array(\r\n 'key' => $app->get('aws.serverPublicKey'),\r\n 'secret' => $app->get('aws.serverPrivateKey')\r\n ));\r\n\r\n \t$pathinfo = pathinfo($this->{'filename'});\r\n \t$key = (string) $this->id;\r\n \tif (!empty($pathinfo['extension'])) {\r\n \t $key .= '.' . $pathinfo['extension'];\r\n \t}\r\n \t\r\n \t$idx = 1;\r\n \twhile ($s3->doesObjectExist( $bucket, $key ) )\r\n \t{\r\n \t\t$key = (string) $this->id . '-' . $idx;\r\n \t\tif (!empty($pathinfo['extension'])) {\r\n \t\t $key .= '.' . $pathinfo['extension'];\r\n \t\t}\r\n \t\t$idx++;\r\n \t}\r\n \t\r\n \t$chunks = ceil( $this->length / $this->chunkSize );\r\n \t\r\n \t$collChunkName = $this->collectionNameGridFS() . \".chunks\";\r\n \t$collChunks = $this->getDb()->{$collChunkName};\r\n \t$data = '';\r\n \tfor( $i=0; $i<$chunks; $i++ )\r\n \t{\r\n \t\t$chunk = $collChunks->findOne( array( \"files_id\" => $this->id, \"n\" => $i ) );\r\n \t\t$data .= (string) $chunk[\"data\"]->bin;\r\n \t}\r\n \t \r\n \t$res = $s3->putObject(array(\r\n \t\t'Bucket' => $bucket,\r\n \t\t'Key' => $key,\r\n \t\t'Body' => $data,\r\n \t\t\t'ContentType' => $this->contentType,\r\n \t));\r\n \t\r\n \t$s3->waitUntil('ObjectExists', array(\r\n\t\t\t'Bucket' => $bucket,\r\n\t\t\t'Key' => $key\r\n \t));\r\n \t\r\n \tif( !$s3->doesObjectExist( $bucket, $key ) ){\r\n \t\tthrow new \\Exception( \"Upload to Amazon S3 failed! - Asset #\".(string)$this->id );\r\n \t}\r\n \t\r\n \t$objectInfoValues = $s3->headObject(array(\r\n 'Bucket' => $bucket,\r\n 'Key' => $key\r\n \t))->getAll();\r\n \t\r\n \t$this->storage = 's3';\r\n \t$this->url = $s3->getObjectUrl($bucket, $key);\r\n \t\r\n \t$this->s3 = array_merge( array(), (array) $this->s3, array(\r\n \t\t'bucket' => $bucket,\r\n \t\t'key' => $key,\r\n \t\t'filename' => $pathinfo['basename'],\r\n \t\t'uuid' => (string)$this->id\r\n \t) ) + $objectInfoValues;\r\n \t\r\n \t$this->clear( 'chunkSize' );\r\n \t$this->save();\r\n \t\r\n \t// delete all chunks\r\n \t$collChunks->remove( array( \"files_id\" => $this->id ) );\r\n \t \t\r\n \treturn $this;\r\n }",
"public function provides()\n {\n return ['aws', 'Aws\\Sdk'];\n }",
"public function provides()\n {\n return ['aws', Sdk::class];\n }"
]
| [
"0.7414219",
"0.72534543",
"0.7060382",
"0.6906351",
"0.68873507",
"0.68562055",
"0.68512285",
"0.6689838",
"0.66870874",
"0.6641488",
"0.6277621",
"0.6270663",
"0.6235944",
"0.61862206",
"0.6165559",
"0.6117353",
"0.60716796",
"0.6069459",
"0.6048446",
"0.5984131",
"0.59363675",
"0.5927389",
"0.5887402",
"0.58562833",
"0.58370525",
"0.5788464",
"0.57233906",
"0.5715017",
"0.5714841",
"0.5663266"
]
| 0.859698 | 0 |
Get supported AWS S3 Regions Up to date regions: | public function getRegions()
{
$regions = array(
"" => "Default (empty)",
"us-east-2" => "US East (Ohio)",
"us-east-1" => "US East (N. Virginia)",
"us-west-1" => "US West (N. California)",
"us-west-2" => "US West (Oregon)",
//"ap-east-1" => "Asia Pacific (Hong Kong)***",
"ap-south-1" => "Asia Pacific (Mumbai)",
//"ap-northeast-3" => "Asia Pacific (Osaka-Local)****",
"ap-northeast-2" => "Asia Pacific (Seoul)",
"ap-southeast-1" => "Asia Pacific (Singapore)",
"ap-southeast-2" => "Asia Pacific (Sydney)",
"ap-northeast-1" => "Asia Pacific (Tokyo)",
"ca-central-1" => "Canada (Central)",
"cn-north-1" => "China (Beijing)",
"cn-northwest-1" => "China (Ningxia)",
"eu-central-1" => "EU (Frankfurt)",
"eu-west-1" => "EU (Ireland)",
"eu-west-2" => "EU (London)",
"eu-west-3" => "EU (Paris)",
"eu-north-1" => "EU (Stockholm)",
"sa-east-1" => "South America (São Paulo)",
"me-south-1" => "Middle East (Bahrain)",
);
// ***You must enable this Region before you can use it.
// ****You can use the Asia Pacific (Osaka-Local) Region only in conjunction with the Asia Pacific
// (Tokyo) Region. To request access to the Asia Pacific (Osaka-Local) Region, contact your sales representative.
return $regions;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function test_get_regions() {\n\t\t$s3_helper = new S3_helper();\n\t\t$this->assertEquals( self::ARRAY_REGION, $s3_helper->get_regions() );\n\t}",
"function ams_get_amazon_regions() {\n $regions = array(\n 'com.au' => array( 'RegionName' => 'Australia', 'Host' => 'webservices.amazon.com.au', 'RegionCode' => 'us-west-2' ),\n 'com.br' => array( 'RegionName' => 'Brazil', 'Host' => 'webservices.amazon.com.br', 'RegionCode' => 'us-east-1' ),\n 'ca' => array( 'RegionName' => 'Canada', 'Host' => 'webservices.amazon.ca', 'RegionCode' => 'us-east-1' ),\n 'cn' => array( 'RegionName' => 'China', 'Host' => 'webservices.amazon.cn', 'RegionCode' => 'us-west-2' ),\n 'fr' => array( 'RegionName' => 'France', 'Host' => 'webservices.amazon.fr', 'RegionCode' => 'eu-west-1' ),\n 'de' => array( 'RegionName' => 'Germany', 'Host' => 'webservices.amazon.de', 'RegionCode' => 'eu-west-1' ),\n 'in' => array( 'RegionName' => 'India', 'Host' => 'webservices.amazon.in', 'RegionCode' => 'eu-west-1' ),\n 'it' => array( 'RegionName' => 'Italy', 'Host' => 'webservices.amazon.it', 'RegionCode' => 'eu-west-1' ),\n 'jp' => array( 'RegionName' => 'Japan', 'Host' => 'webservices.amazon.co.jp', 'RegionCode' => 'us-west-2' ),\n 'mx' => array( 'RegionName' => 'Mexico', 'Host' => 'webservices.amazon.com.mx', 'RegionCode' => 'us-east-1' ),\n 'nl' => array( 'RegionName' => 'Netherlands', 'Host' => 'webservices.amazon.nl', 'RegionCode' => 'eu-west-1' ),\n 'sa' => array( 'RegionName' => 'Saudi Arabia', 'Host' => 'webservices.amazon.sa', 'RegionCode' => 'eu-west-1' ),\n 'sg' => array( 'RegionName' => 'Singapore', 'Host' => 'webservices.amazon.sg', 'RegionCode' => 'us-west-2' ),\n 'es' => array( 'RegionName' => 'Spain', 'Host' => 'webservices.amazon.es', 'RegionCode' => 'eu-west-1' ),\n 'com.tr' => array( 'RegionName' => 'Turkey', 'Host' => 'webservices.amazon.com.tr', 'RegionCode' => 'eu-west-1' ),\n 'ae' => array( 'RegionName' => 'United Arab Emirates', 'Host' => 'webservices.amazon.ae', 'RegionCode' => 'eu-west-1' ),\n 'co.uk' => array( 'RegionName' => 'United Kingdom', 'Host' => 'webservices.amazon.co.uk', 'RegionCode' => 'eu-west-1' ),\n 'com' => array( 'RegionName' => 'United States', 'Host' => 'webservices.amazon.com', 'RegionCode' => 'us-east-1' )\n );\n\n return $regions;\n}",
"function w3tc_cdn_s3_bucket_location() {\n\t\t$type = Util_Request::get_string( 'type', 's3' );\n\n\t\t$locations = array(\n\t\t\t'us-east-1' \t=> __( 'US East (N. Virginia)', 'w3-total-cache' ),\n\t\t\t'us-east-2' \t=> __( 'US East (Ohio)', 'w3-total-cache' ),\n\t\t\t'us-west-1' \t=> __( 'US-West (N. California)', 'w3-total-cache' ),\n\t\t\t'us-west-2' \t=> __( 'US-West (Oregon)', 'w3-total-cache' ),\n\t\t\t'ca-central-1'\t=> __( 'Canada (Montreal)', 'w3-total-cache' ),\n\t\t\t'ap-south-1' \t=> __( 'Asia Pacific (Mumbai)', 'w3-total-cache' ),\n\t\t\t'ap-northeast-2'=> __( 'Asia Pacific (Seoul)', 'w3-total-cache' ),\n\t\t\t'ap-southeast-1'=> __( 'Asia Pacific (Singapore)', 'w3-total-cache' ),\n\t\t\t'ap-southeast-2'=> __( 'Asia Pacific (Sydney)', 'w3-total-cache' ),\n\t\t\t'ap-northeast-1'=> __( 'Asia Pacific (Tokyo)', 'w3-total-cache' ),\n\t\t\t'eu-central-1' \t=> __( 'EU (Frankfurt)', 'w3-total-cache' ),\n\t\t\t'eu-west-1' \t=> __( 'EU (Ireland)', 'w3-total-cache' ),\n\t\t\t'eu-west-2' \t=> __( 'EU (London)', 'w3-total-cache' ),\n\t\t\t'sa-east-1' \t=> __( 'South America (São Paulo)', 'w3-total-cache' ),\n\t\t);\n\n\t\tinclude W3TC_INC_DIR . '/lightbox/cdn_s3_bucket_location.php';\n\t}",
"public function getRegions()\n {\n return $this->regions;\n }",
"public function provider_get_region() {\n\t\t$array_provide = array();\n\t\tforeach ( self::ARRAY_REGION as $region ) {\n\t\t\t$expected = str_replace( '_', '-', strtolower( $region ) );\n\t\t\t$array_provide[] = array( $region, $expected );\n\t\t}\n\t\treturn $array_provide;\n\t}",
"public function regions(): EstatesRegions\n {\n if (is_null($this->regionsEndpoint)) {\n $this->regionsEndpoint = new EstatesRegions($this->api);\n }\n return $this->regionsEndpoint;\n }",
"public static function getRegion()\n\t{\n\t\t$region = self::$region;\n\n\t\t// parse region from endpoint if not specific\n\t\tif (empty($region)) {\n\t\t\tif (preg_match(\"/s3[.-](?:website-|dualstack\\.)?(.+)\\.amazonaws\\.com/i\",self::$endpoint,$match) !== 0 && strtolower($match[1]) !== \"external-1\") {\n\t\t\t\t$region = $match[1];\n\t\t\t}\n\t\t}\n\n\t\treturn empty($region) ? 'us-east-1' : $region;\n\t}",
"public function getRegions() {\n $query = <<<SQL\n SELECT\n *\n FROM\n region\nSQL;\n\t\t\n\t\treturn $this->DB->execute($query);\n }",
"public function provider_init_s3() {\n\t\treturn array(\n\t\t\tarray( 'accessKey', 'secretKey', self::REGION_OREGON, self::REGION_OREGON ),\n\t\t\tarray( 'AccessKey', 'SecretKey', '', self::REGION_NORTH_VIRGINIA ),\n\t\t\tarray( 'access_key', 'secret_key', null, self::REGION_TOKYO ),\n\t\t);\n\t}",
"public static function get_regions_names() {\r\n\r\n\t\treturn array(\r\n\t\t\tSimpleEmailService::AWS_US_EAST_1 => esc_html__( 'US East (N. Virginia)', 'wp-mail-smtp-pro' ),\r\n\t\t\tSimpleEmailService::AWS_US_WEST_2 => esc_html__( 'US West (Oregon)', 'wp-mail-smtp-pro' ),\r\n\t\t\tSimpleEmailService::AWS_EU_WEST1 => esc_html__( 'EU (Ireland)', 'wp-mail-smtp-pro' ),\r\n\t\t\t// SimpleEmailService::AWS_EU_CENTRAL_1 => esc_html__( 'EU (Frankfurt)', 'wp-mail-smtp-pro' ),\r\n\t\t\t// SimpleEmailService::AWS_AP_SOUTH_1 => esc_html__( 'Asia Pacific (Mumbai)', 'wp-mail-smtp-pro' ),\r\n\t\t\t// SimpleEmailService::AWS_AP_SOUTHEAST_1 => esc_html__( 'Asia Pacific (Sydney)', 'wp-mail-smtp-pro' ),\r\n\t\t);\r\n\t}",
"public function get_regions()\n\t{\n\t\t$this->load->model('promo_model');\n\t\t$region= $this->promo_model->regions();\n\t\t\n\t\techo json_encode($region);\n\t}",
"function getRegionJson2() {\n\t\t\tif (!$this->_regionJson2) {\n\t\t\t\t$cacheKey = 'CORE_DIRECTORY_REGIONS_JSON2_STORE' . Mage::app( )->getStore( )->getId( );\n\n\t\t\t\tif (Mage::app( )->useCache( 'config' )) {\n\t\t\t\t\t$json = Mage::app( )->loadCache( $cacheKey );\n\t\t\t\t}\n\n\n\t\t\t\tif (empty( $$json )) {\n\t\t\t\t\t$countryIds = array( );\n\t\t\t\t\tforeach ($this->getCountryCollection( ) as $country) {\n\t\t\t\t\t\t$countryIds[] = $country->getCountryId( );\n\t\t\t\t\t}\n\n\t\t\t\t\t$collection = Mage::getModel( 'directory/region' )->getResourceCollection( )->addCountryFilter( $countryIds )->load( );\n\t\t\t\t\t$regions = array( 'config' => array( 'show_all_regions' => true, 'regions_required' => Mage::helper( 'core' )->jsonEncode( array( ) ) ) );\n\t\t\t\t\tforeach ($collection as $region) {\n\n\t\t\t\t\t\tif (!$region->getRegionId( )) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$regions[$region->getCountryId( )][$region->getRegionId( )] = array( 'code' => $region->getCode( ), 'name' => $this->__( $region->getName( ) ) );\n\t\t\t\t\t}\n\n\t\t\t\t\t$json = Mage::helper( 'core' )->jsonEncode( $regions );\n\n\t\t\t\t\tif (Mage::app( )->useCache( 'config' )) {\n\t\t\t\t\t\tMage::app( )->saveCache( $json, $cacheKey, array( 'config' ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this->_regionJson2 = $json;\n\t\t\t}\n\n\t\t\treturn $this->_regionJson2;\n\t\t}",
"public static function get_all_regions() {\r\n $DB = new \\Nefuzz\\Php\\DBC();\r\n $result = ($DB)->query_to_array(\"\r\n SELECT *\r\n FROM regions;\r\n \",'',[]);\r\n $DB->quit();\r\n return $result;\r\n }",
"public function test_init_s3_default_region() {\n\t\t$s3_helper = new S3_helper();\n\t\t$s3_client = $s3_helper->init_s3( '', '' );\n\t\t$this->assertEquals( self::REGION_TOKYO, $s3_client->getRegion() );\n\t}",
"public function awsBuckets(){\n //get AWS credentials under CRM\n $configAuth = ConfigAuth::all();\n $awsNetworkArr = array();\n foreach($configAuth as $key => $configDetails){\n try{\n //create object individually\n $awsObject = new S3Client([\n 'version' => 'latest',\n 'region' => 'eu-central-1',\n 'credentials' => [\n 'key' => $configDetails['key'],\n 'secret' => $configDetails['secret']\n ]\n ]);\n $getContent = $awsObject->listBuckets();\n $totalBuckets = count($getContent['Buckets']);\n //add in array\n $awsNetworkArr[$configDetails['aws_name']]['aws_name'] = $configDetails['aws_name'];\n $awsNetworkArr[$configDetails['aws_name']]['total_buckets'] = $totalBuckets;\n }\n catch(\\Exception $exception){\n //catch exception here...\n }\n }\n return array_values($awsNetworkArr);\n }",
"private function getRegions(): array\n {\n try {\n /** @var Regions[] $regions */\n $regions = $this->getDoctrine()\n ->getRepository(Regions::class)\n ->findAll();\n }\n catch(\\Exception $ex) {\n return [];\n }\n\n return $regions;\n }",
"function getRegionsNew() {\n $query = \" SELECT ID,Name,CityID FROM #__ssregions WHERE ID LIKE 'WebSite%'\";\n $this->_db->setQuery($query);\n return $this->_db->loadAssocList();\n }",
"function regionList($where = '')\n {\n $arrClms = array(\n 'pkRegionID',\n 'RegionName',\n );\n $varOrderBy = 'RegionName ASC ';\n $arrRes = $this->select(TABLE_REGION, $arrClms, $where);\n //pre($arrRes);\n return $arrRes;\n }",
"protected function updateRegions()\n {\n $regions = [\n ['_stateId' => 1, 'name' => 'Almería'],\n ['_stateId' => 1, 'name' => 'Cádiz'],\n ['_stateId' => 1, 'name' => 'Córdoba'],\n ['_stateId' => 1, 'name' => 'Granada'],\n ['_stateId' => 1, 'name' => 'Huelva'],\n ['_stateId' => 1, 'name' => 'Jaén'],\n ['_stateId' => 1, 'name' => 'Málaga'],\n ['_stateId' => 1, 'name' => 'Sevilla'],\n ['_stateId' => 2, 'name' => 'Huesca'],\n ['_stateId' => 2, 'name' => 'Teruel'],\n ['_stateId' => 2, 'name' => 'Zaragoza'],\n ['_stateId' => 3, 'name' => 'Asturias'],\n ['_stateId' => 4, 'name' => 'Islas Baleares'],\n ['_stateId' => 5, 'name' => 'Las Palmas'],\n ['_stateId' => 5, 'name' => 'Santa Cruz de Tenerife'],\n ['_stateId' => 6, 'name' => 'Cantabria'],\n ['_stateId' => 7, 'name' => 'Ávila'],\n ['_stateId' => 7, 'name' => 'Burgos'],\n ['_stateId' => 7, 'name' => 'León'],\n ['_stateId' => 7, 'name' => 'Palencia'],\n ['_stateId' => 7, 'name' => 'Salamanca'],\n ['_stateId' => 7, 'name' => 'Segovia'],\n ['_stateId' => 7, 'name' => 'Soria'],\n ['_stateId' => 7, 'name' => 'Valladolid'],\n ['_stateId' => 7, 'name' => 'Zamora'],\n ['_stateId' => 8, 'name' => 'Albacete'],\n ['_stateId' => 8, 'name' => 'Ciudad Real'],\n ['_stateId' => 8, 'name' => 'Cuenca'],\n ['_stateId' => 8, 'name' => 'Guadalajara'],\n ['_stateId' => 8, 'name' => 'Toledo'],\n ['_stateId' => 9, 'name' => 'Barcelona'],\n ['_stateId' => 9, 'name' => 'Girona'],\n ['_stateId' => 9, 'name' => 'Lleida'],\n ['_stateId' => 9, 'name' => 'Tarragona'],\n ['_stateId' => 10, 'name' => 'Alicante'],\n ['_stateId' => 10, 'name' => 'Castellón'],\n ['_stateId' => 10, 'name' => 'Valencia'],\n ['_stateId' => 11, 'name' => 'Badajoz'],\n ['_stateId' => 11, 'name' => 'Cáceres'],\n ['_stateId' => 12, 'name' => 'A Coruña'],\n ['_stateId' => 12, 'name' => 'Lugo'],\n ['_stateId' => 12, 'name' => 'Ourense'],\n ['_stateId' => 12, 'name' => 'Pontevedra'],\n ['_stateId' => 13, 'name' => 'Madrid'],\n ['_stateId' => 14, 'name' => 'Murcia'],\n ['_stateId' => 15, 'name' => 'Navarra'],\n ['_stateId' => 16, 'name' => 'Álava'],\n ['_stateId' => 16, 'name' => 'Bizkaia'],\n ['_stateId' => 16, 'name' => 'Gipuzkoa'],\n ['_stateId' => 17, 'name' => 'La Rioja'],\n ['_stateId' => 18, 'name' => 'Ceuta'],\n ['_stateId' => 19, 'name' => 'Melilla']\n ];\n\n foreach ($regions as $rData) {\n $region = Region::findOne([\n 'name' => $rData['name'],\n ]);\n $region->state_id = $rData['_stateId'];\n if ($region->save() === false) {\n throw new SaveException($region);\n }\n }\n }",
"public function getRegiones()\n\t{\n\t\t$regiones = $this->Model_Region->getRegiones();\n\t\techo json_encode($regiones);\n\t}",
"static function get_treaties_enabled_regions_in_use() {\n global $wpdb;\n return $wpdb->get_results('SELECT a.* FROM ai_region a INNER JOIN ai_treaty_region b ON a.id = b.id_region GROUP BY a.id ORDER BY a.id');\n }",
"public static function get_regions_coordinates() {\r\n\r\n\t\treturn array(\r\n\t\t\tSimpleEmailService::AWS_US_EAST_1 => array(\r\n\t\t\t\t'lat' => 38.837392,\r\n\t\t\t\t'lon' => - 77.447313,\r\n\t\t\t),\r\n\t\t\tSimpleEmailService::AWS_US_WEST_2 => array(\r\n\t\t\t\t'lat' => 45.3573,\r\n\t\t\t\t'lon' => - 122.6068,\r\n\t\t\t),\r\n\t\t\tSimpleEmailService::AWS_EU_WEST1 => array(\r\n\t\t\t\t'lat' => 53.305494,\r\n\t\t\t\t'lon' => - 7.737649,\r\n\t\t\t),\r\n\t\t\tSimpleEmailService::AWS_EU_CENTRAL_1 => array(\r\n\t\t\t\t'lat' => 50.1109,\r\n\t\t\t\t'lon' => 8.6821,\r\n\t\t\t),\r\n\t\t\tSimpleEmailService::AWS_AP_SOUTH_1 => array(\r\n\t\t\t\t'lat' => 19.0760,\r\n\t\t\t\t'lon' => 72.8777,\r\n\t\t\t),\r\n\t\t\tSimpleEmailService::AWS_AP_SOUTHEAST_1 => array(\r\n\t\t\t\t'lat' => 33.8688,\r\n\t\t\t\t'lon' => 151.2093,\r\n\t\t\t),\r\n\t\t);\r\n\t}",
"function getRegions() {\n $query = \" SELECT ID,Name,CityID FROM #__ssregions \";\n $this->_db->setQuery($query);\n return $this->_db->loadAssocList();\n }",
"public function getRegionJsonList()\n {\n $collectionByCountry = [];\n /** @var \\Magento\\Directory\\Model\\ResourceModel\\Region\\Collection $collection */\n $collection = $this->regionCollectionFactory->create();\n /** @var \\Magento\\Directory\\Model\\Region $item */\n foreach ($collection as $item) {\n $collectionByCountry[$item->getData('country_id')][] = $item->getData();\n }\n\n return $collectionByCountry;\n }",
"public function getSelectedRegions()\n\t{\n\t\tif (!$this->hasSelectedRegions()) {\n\t\t\t$regions = array();\n\t\t\tforeach ($this->getSelectedRegionsCollection() as $region) {\n\t\t\t\t$regions[] = $region;\n\t\t\t}\n\t\t\t$this->setSelectedRegions($regions);\n\t\t}\n\t\treturn $this->getData('selected_regions');\n\t}",
"public function GetRegions($flags=null, $excludeFlags=null, $start=0, $count=10, $sortRegionName=null, $sortLocX=null, $sortLocY=null, $asArray=false){\n\t\t\tif(isset($flags) === false){\n\t\t\t\t$flags = RegionFlags::RegionOnline;\n\t\t\t}\n\t\t\tif(isset($excludeFlags) === false){\n\t\t\t\t$excludeFlags = 0;\n\t\t\t}\n\t\t\tif(is_string($flags) === true && ctype_digit($flags) === true){\n\t\t\t\t$flags = (integer)$flags;\n\t\t\t}\n\t\t\tif(is_string($excludeFlags) === true && ctype_digit($excludeFlags) === true){\n\t\t\t\t$excludeFlags = (integer)$excludeFlags;\n\t\t\t}\n\t\t\tif(is_string($start) === true && ctype_digit($start) === true){\n\t\t\t\t$start = (integer)$start;\n\t\t\t}\n\t\t\tif(is_string($count) === true && ctype_digit($count) === true){\n\t\t\t\t$count = (integer)$count;\n\t\t\t}\n\n\t\t\tif(is_bool($asArray) === false){\n\t\t\t\tthrow new InvalidArgumentException('asArray flag must be a boolean.');\n\t\t\t}else if(is_integer($flags) === false){\n\t\t\t\tthrow new InvalidArgumentException('RegionFlags argument should be supplied as integer.');\n\t\t\t}else if($flags < 0){\n\t\t\t\tthrow new InvalidArgumentException('RegionFlags cannot be less than zero');\n\t\t\t}else if(RegionFlags::isValid($flags) === false){ // Aurora::Framework::RegionFlags::isValid() does do a check for integerness, but we want to throw a different exception message if it is an integer.\n\t\t\t\tthrow new InvalidArgumentException('RegionFlags value is invalid, aborting call to API');\n\t\t\t}else if($excludeFlags < 0){\n\t\t\t\tthrow new InvalidArgumentException('Region ExcludeFlags cannot be less than zero');\n\t\t\t}else if(RegionFlags::isValid($excludeFlags) === false){ // Aurora::Framework::RegionFlags::isValid() does do a check for integerness, but we want to throw a different exception message if it is an integer.\n\t\t\t\tthrow new InvalidArgumentException('Region ExcludeFlags value is invalid, aborting call to API');\n\t\t\t}else if(is_integer($start) === false){\n\t\t\t\tthrow new InvalidArgumentException('Start point must be an integer.');\n\t\t\t}else if(isset($count) === true){\n\t\t\t\tif(is_integer($count) === false){\n\t\t\t\t\tthrow new InvalidArgumentException('Count must be an integer.');\n\t\t\t\t}else if($count < 1){\n\t\t\t\t\tthrow new InvalidArgumentException('Count must be greater than zero.');\n\t\t\t\t}\n\t\t\t}else if(isset($sortRegionName) === true && is_bool($sortRegionName) === false){\n\t\t\t\tthrow new InvalidArgumentException('If set, the sort by region name flag must be a boolean.');\n\t\t\t}else if(isset($sortLocX) === true && is_bool($sortLocX) === false){\n\t\t\t\tthrow new InvalidArgumentException('If set, the sort by x-axis flag must be a boolean.');\n\t\t\t}else if(isset($sortLocY) === true && is_bool($sortLocY) === false){\n\t\t\t\tthrow new InvalidArgumentException('If set, the sort by y-axis flag must be a boolean.');\n\t\t\t}\n\t\t\t$response = array();\n\t\t\t$input = array(\n\t\t\t\t'RegionFlags' => $flags,\n\t\t\t\t'ExcludeRegionFlags' => $excludeFlags,\n\t\t\t\t'Start' => $start,\n\t\t\t\t'Count' => $count\n\t\t\t);\n\t\t\tif(isset($sortRegionName) === true){\n\t\t\t\t$input['SortRegionName'] = $sortRegionName;\n\t\t\t}\n\t\t\tif(isset($sortLocX) === true){\n\t\t\t\t$input['SortLocX'] = $sortLocX;\n\t\t\t}\n\t\t\tif(isset($sortLocY) === true){\n\t\t\t\t$input['SortLocY'] = $sortLocY;\n\t\t\t}\n\t\t\t$has = WebUI\\GetRegions::hasInstance($this, $flags, $excludeFlags, $sortRegionName, $sortLocX, $sortLocY);\n\t\t\tif($asArray === true || $has === false){\n\t\t\t\t$result = $this->makeCallToAPI('GetRegions', true, $input, array(\n\t\t\t\t\t'Regions' => array('array'=>array(static::GridRegionValidator())),\n\t\t\t\t\t'Total' => array('integer'=>array())\n\t\t\t\t));\n\t\t\t\tforeach($result->Regions as $val){\n\t\t\t\t\t$response[] = WebUI\\GridRegion::fromEndPointResult($val);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $asArray ? $response : WebUI\\GetRegions::r($this, $flags, $excludeFlags, $start, $has ? null : $result->Total, $sortRegionName, $sortLocX, $sortLocY, $response);\n\t\t}",
"public function testReturnsRegionsFromCollection()\n {\n $data = [\n ['region_name' => 'test1'],\n ['region_name' => 'test2']\n ];\n $regions = ['test1', 'test2'];\n\n $collectionLocationsMock = $this->getResourceModelMock('oggetto_geodetection/location_collection', [\n 'selectRegions', 'filterByCountryCode', 'getData'\n ]);\n\n $collectionLocationsMock->expects($this->once())\n ->method('selectRegions')\n ->willReturnSelf();\n\n $collectionLocationsMock->expects($this->never())\n ->method('filterByCountryCode');\n\n $collectionLocationsMock->expects($this->once())\n ->method('getData')\n ->willReturn($data);\n\n $this->replaceByMock('resource_model', 'oggetto_geodetection/location_collection', $collectionLocationsMock);\n\n $this->assertEquals($regions, $this->_model->getRegions());\n }",
"public function getRegion(): RegionInterface;",
"public static function getRegionOptions() {\n $file = fopen(drupal_get_path('module', 'smart_content_smart_ip') . '/data/region_codes.csv', \"r\");\n $region_codes = [];\n while (!feof($file)) {\n $regions = fgetcsv($file);\n if (!empty($regions[2])) {\n $country_name = self::getCountryNameFromCode($regions[0]);\n $region_codes[$country_name][$regions[2]] = $regions[2];\n }\n }\n ksort($region_codes);\n foreach ($region_codes as $key => $value) {\n ksort($value);\n $region_codes[$key] = $value;\n }\n return $region_codes;\n }",
"function _get_regions_subregions(){\n $this->gen_contents['regions'] = $this->admin_career_event_model->dbSelectAllRegions();\n $arr_data = $this->admin_career_event_model->dbSelectAllSubRegions();\n $this->gen_contents['raw_subregion']= $arr_data;\n $id \t\t\t\t\t= 0;\n $arr_subregion\t\t\t\t= array();\n\n foreach ($arr_data as $value){\n if($id != $value->regionid){\n $id = $value->regionid;\n $arr_subregion['R'][$id] = array();\n }\n $arr_subregion['R'][$id][] = array('id' =>$value->id,'name'=>$value->sub_name);\n }\n //gets all the region and subregion for the purpose of displaying filter\n //used to diaply subregion using jason array \t\t\t\t\n $this->gen_contents['json_array'] \t= json_encode($arr_subregion);\n\t\t\t\n\t\t}"
]
| [
"0.73008746",
"0.67297006",
"0.6269904",
"0.6115389",
"0.608698",
"0.60518426",
"0.60356283",
"0.597247",
"0.59687334",
"0.5944173",
"0.5898634",
"0.57473946",
"0.566314",
"0.5628188",
"0.55408907",
"0.54927284",
"0.5430186",
"0.54289854",
"0.5427597",
"0.5424287",
"0.54232204",
"0.5408599",
"0.53997964",
"0.5385695",
"0.5349327",
"0.5349058",
"0.5336507",
"0.53222686",
"0.52641493",
"0.5230863"
]
| 0.69731826 | 1 |
Build the bucket URL | protected function getBucketUrl()
{
return 'https://'.$this->bucketName.'.s3.'.($this->region ? $this->region : '').'.amazonaws.com';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getS3BaseUri() {\n $aws_base_path = $this->container->getParameter('aws_base_path');\n $aws_bucket = $this->container->getParameter('aws_bucket');\n $full_path = $aws_base_path . '/' . $aws_bucket;\n return $full_path;\n }",
"public function getS3BaseUri() {\n $aws_base_path = $this->container->getParameter('aws_base_path');\n $aws_bucket = $this->container->getParameter('aws_bucket');\n $full_path = $aws_base_path . '/' . $aws_bucket;\n return $full_path;\n }",
"public function getS3BaseUri() {\n //finding the base path of aws and bucket name\n $aws_base_path = $this->container->getParameter('aws_base_path');\n $aws_bucket = $this->container->getParameter('aws_bucket');\n $full_path = $aws_base_path.'/'.$aws_bucket;\n return $full_path;\n }",
"private function buildBaseUrl()\n {\n return $this->scheme() . $this->host;\n }",
"function getSourceBucketFromUrl($url)\n{\n try {\n global $appConfig;\n\n //replace site protocol and s3.amazonaws.com/ from Url\n $sourceBucket = str_replace($appConfig[\"common\"][\"siteProtocol\"] . 's3.amazonaws.com/', '', $url);\n\n //Remove file name from Url to get complete bucket name\n $path = parse_url($url, PHP_URL_PATH);\n $fileName = basename($path);\n $sourceBucket = str_replace('/' . $fileName, '', $sourceBucket);\n\n //return bucket\n return $sourceBucket;\n } catch (\\Exception $e) {\n die(exception($e));\n }\n}",
"private function generateUrl() : string\n {\n return $this->apiUrl.$this->ownerRepo.$this->branchPath.$this->branch;\n }",
"public static function getS3Bucket() {\n global $config;\n $aws_connector_config = \\Drupal::config('aws_connector.settings');\n if ($aws_connector_config) {\n if (isset($config['aws_connector.aws_s3_bucket'])) {\n return $config['aws_connector.aws_s3_bucket'];\n }\n else {\n return self::getConfig('aws_s3_bucket', $aws_connector_config);\n }\n }\n return '';\n }",
"public function buildBackendUri() {}",
"public function getBucket(): string\n {\n return $this->config['bucket'];\n }",
"public function getS3Bucket();",
"protected function generateCloudLink()\n\t{\n\t\t$this->instanceBucket();\n\n\t\tif ($this->checkCloudErrors())\n\t\t{\n\t\t\treturn $this->bucket->GetFileSRC($this->uploadPath);\n\t\t}\n\n\t\treturn '';\n\t}",
"public function get_cdn_url() {\n if ( defined( 'S3_UPLOADS_BUCKET_URL' ) && ! empty( S3_UPLOADS_BUCKET_URL ) ) {\n return S3_UPLOADS_BUCKET_URL;\n }\n return false;\n }",
"function w3tc_cdn_s3_bucket_location() {\n\t\t$type = Util_Request::get_string( 'type', 's3' );\n\n\t\t$locations = array(\n\t\t\t'us-east-1' \t=> __( 'US East (N. Virginia)', 'w3-total-cache' ),\n\t\t\t'us-east-2' \t=> __( 'US East (Ohio)', 'w3-total-cache' ),\n\t\t\t'us-west-1' \t=> __( 'US-West (N. California)', 'w3-total-cache' ),\n\t\t\t'us-west-2' \t=> __( 'US-West (Oregon)', 'w3-total-cache' ),\n\t\t\t'ca-central-1'\t=> __( 'Canada (Montreal)', 'w3-total-cache' ),\n\t\t\t'ap-south-1' \t=> __( 'Asia Pacific (Mumbai)', 'w3-total-cache' ),\n\t\t\t'ap-northeast-2'=> __( 'Asia Pacific (Seoul)', 'w3-total-cache' ),\n\t\t\t'ap-southeast-1'=> __( 'Asia Pacific (Singapore)', 'w3-total-cache' ),\n\t\t\t'ap-southeast-2'=> __( 'Asia Pacific (Sydney)', 'w3-total-cache' ),\n\t\t\t'ap-northeast-1'=> __( 'Asia Pacific (Tokyo)', 'w3-total-cache' ),\n\t\t\t'eu-central-1' \t=> __( 'EU (Frankfurt)', 'w3-total-cache' ),\n\t\t\t'eu-west-1' \t=> __( 'EU (Ireland)', 'w3-total-cache' ),\n\t\t\t'eu-west-2' \t=> __( 'EU (London)', 'w3-total-cache' ),\n\t\t\t'sa-east-1' \t=> __( 'South America (São Paulo)', 'w3-total-cache' ),\n\t\t);\n\n\t\tinclude W3TC_INC_DIR . '/lightbox/cdn_s3_bucket_location.php';\n\t}",
"static function s3_url($disk_driver, $final_path)\n {\n $disk = config('filesystems.disks.' . $disk_driver);\n // bucket.s3.region.backblazeb2.com\n // s3.us-west-000.backblazeb2.com\n // bucket.s3.region.wasabisys.com\n // muzzie.s3.region.amazonaws.com\n // muzzie.s3.region.provider.com\n if ($disk['driver'] === 's3') {\n $url = self::withoutHttp(self::pushBucketAndRegionInEndpoint($disk['endpoint'], $disk['bucket'], $disk['region']));\n return 'https://' . $url . $final_path;\n } else if ($disk['driver'] === 'b2') {\n return 'https://' . self::withoutHttp($disk['bucketName']) . '.' . self::withoutHttp($disk['endpoint']) . $final_path;\n }\n }",
"function _build_url() {\n\t\t// Add transaction ID for better detecting double requests in AUTH server\n\t\tif($GLOBALS['config']['application']['tid'] == '') $GLOBALS['config']['application']['tid'] = rand(0, 10000);\n\n\t\t$url = $this->url.'&action='.$this->action.'&tid='.$GLOBALS['config']['application']['tid'];\n\t\t\n\t\treturn $url;\n\t}",
"private function _buildUrl() {\n $url = OPENDIGI_API_ENDPOINT;\n $url .= '?Vcollection=' . implode('+', $this->_collections);\n if ($this->_languages)\n $url .= '&Vlanguages=' . implode('+', $this->_languages);\n if ($this->_subjectIds)\n $url .= '&Vsubjectids=' . implode('+', $this->_subjectIds);\n\n return $url;\n }",
"public function get_bitbucket_auth_url(){\n\t\tif( empty($this->unauth_token) ){\n\t\t\t$this->request_unauth_token();\n\t\t}\n\t\t\n\t\t$auth_req = OAuthRequest::from_consumer_and_token($this->consumer, $this->unauth_token, \"GET\", $this->oauth_urls['login']);\n\t\t$auth_req->sign_request($this->signature_method, $this->consumer, $this->unauth_token);\n\t\treturn $auth_req->to_url();\n\t}",
"protected function _build_url() {\n\n $params = array_filter([\n 'name' => $this->_names,\n 'country_id' => $this->_country_id,\n 'language_id' => $this->_language_id,\n ], function($v) {\n if (!is_array($v)) {\n return strlen(trim($v)) > 0;\n } else {\n return $v;\n }\n });\n //Only pass apikey if there is one set\n if ($api_key = $this->get_api_key()) {\n $params['apikey'] = trim($api_key);\n }\n\n return self::BASE . '?' . http_build_query($params);\n }",
"public function getURL() {\n return $this->apiURL . $this->endPoint . $this->storeID . $this->jsonFile;\n }",
"public function url()\n\t{\n\t\t$this->buildImage();\n\t\treturn $this->buildCachedFileNameUrl;\n\t}",
"private function getUploadUrl() {\n // Before anything else, we need the ID.\n $bucket_id = $this->getBucketId();\n\n // Grab the needed token, URLs etc\n list($api_url, $token, $download_url) = $this->authorizeAccount();\n $full_url = $api_url.'/b2api/v1/b2_get_upload_url';\n\n // Execute\n $response = self::execCurl(\n $full_url, 'POST', array(\n 'Authorization: '.$token,\n ),\n json_encode(array(\n 'bucketId' => $bucket_id,\n )));\n\n // Parse and get back a sane JSON value.\n $json = self::isValidJson($response);\n\n // Now, check the JSON map has every key-value pair we expect.\n self::jsonHasKeys(\n $json, array(\n 'bucketId',\n 'authorizationToken',\n 'uploadUrl',\n ));\n\n // And, just to be sure: make sure we get the right bucket ID back.\n self::jsonKeyIs($json, 'bucketId', $bucket_id);\n\n // Done: return the needed values\n return array(\n $json['uploadUrl'],\n $json['authorizationToken'],\n );\n }",
"private static function assemble_url() {\n\t\t$nerdpress_options = get_option( 'blog_tutor_support_settings' );\n\t\t$cloudflare_zone = $nerdpress_options['cloudflare_zone'];\n\t\tif ( $cloudflare_zone === 'dns1' ) {\n\t\t\tself::$cloudflare_zone = 'cc0e675a7bd4f65889c85ec3134dd6f3';\n\t\t} elseif ( $cloudflare_zone === 'dns2' ) {\n\t\t\tself::$cloudflare_zone = 'c14d1ac2b0e38a6d49d466ae32b1a6d7';\n\t\t} elseif ( $cloudflare_zone === 'dns3' ) {\n\t\t\tself::$cloudflare_zone = '2f9485f19471fe4fa78fb51590513297';\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t\treturn self::$cloudflare_api_url . self::$cloudflare_api_version . self::$cloudflare_zones_directory . self::$cloudflare_zone . '/';\n\t}",
"public function getUrl($key, $bucket_name = null)\n {\n if ($bucket_name === null) {\n $bucket = $this->s3Params['bucket'];\n if (!$bucket) {\n throw new Exception('Bucket name is required');\n }\n } else {\n $bucket = $bucket_name;\n }\n\n try {\n return $this->client->getObjectUrl($bucket, $key);\n } catch (AwsException $ex) {\n throw new Exception($ex->getMessage());\n }\n\n }",
"public function getBucket()\n {\n return $this->params['Bucket'];\n }",
"protected function getS3Url($key, $expiry = NULL, array $args = array()) {\n $url = Url::factory(\n static::$client->getObjectUrl(\n $this->uri->getBucket(),\n $key,\n $expiry,\n $args\n )\n );\n $this->injectCname($url);\n return $url;\n }",
"public function getBucketName()\n {\n return $this->data['bucket'];\n }",
"protected static function bucket_name() {\n\t\tif(isset(static::$_bucket_name)) {\n\t\t\treturn static::$_bucket_name;\n\t\t} else {\n\t\t\t$class_parts = explode('\\\\', strtolower(get_class(new static())));\n\t\t\tstatic::$_bucket_name = array_pop($class_parts);\n\t\t}\n\t\treturn static::$_bucket_name;\n\t}",
"public function get_uploaded_url(){\n\t\t$api_url \t= \"https://api002.backblazeb2.com\"; // From b2_authorize_account call\n\t\t$auth_token = \"4_002147cd01b5a680000000000_018d4c36_d47af5_acct_8SQ4r2LRCypwp1wl0rPo1ySwDm4=\"; // From b2_authorize_account call\n\t\t$bucket_id \t= \"d184771c8d50b17b65ba0618\"; // The ID of the bucket you want to upload to\n\n\t\t$session = curl_init($api_url . \"/b2api/v2/b2_get_upload_url\");\n\n\t\t// Add post fields\n\t\t$data = array(\"bucketId\" => $bucket_id);\n\t\t$post_fields = json_encode($data);\n\t\tcurl_setopt($session, CURLOPT_POSTFIELDS, $post_fields); \n\n\t\t// Add headers\n\t\t$headers = array();\n\t\t$headers[] = \"Authorization: \" . $auth_token;\n\t\tcurl_setopt($session, CURLOPT_HTTPHEADER, $headers); \n\n\t\tcurl_setopt($session, CURLOPT_POST, true); // HTTP POST\n\t\tcurl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Receive server response\n\t\t$server_output = curl_exec($session); // Let's do this!\n\t\tcurl_close ($session); // Clean up\n\t\techo ($server_output); // Tell me about the rabbits, George!\n\n\t\t/*\n\t\t{ \t\n\t\t\t\"authorizationToken\": \"4_002147cd01b5a680000000000_018d4c4a_2690fb_upld_YoK-yBz17Mj5QQS60UQ1bVwRtXw=\", \n\t\t\t\"bucketId\": \"d184771c8d50b17b65ba0618\", \n\t\t\t\"uploadUrl\": \"https://pod-000-1126-02.backblaze.com/b2api/v2/b2_upload_file/d184771c8d50b17b65ba0618/c002_v0001126_t0048\" \n\t\t} \n\t\t*/\n\t}",
"protected function get_url()\n {\n return $this->base_url + $this->api_version; \n }",
"protected function _getUrl() {\n\t\t\t$this->_url =\timplode('/', array(\n\t\t\t\t$this->_baseUrlSegment,\n\t\t\t\t$this->_apiSegment,\n\t\t\t\timplode('_', array(\n\t\t\t\t\t$this->_type,\n\t\t\t\t\t$this->_language,\n\t\t\t\t\t$this->_locale,\n\t\t\t\t)),\n\t\t\t\t$this->_apiVersionSegment,\n\t\t\t\t$this->controller,\n\t\t\t\t$this->function\t\n\t\t\t));\n\n\t\t\tempty($this->_getFields) ?: $this->_url .= '?' . http_build_query($this->_getFields);\n\t\t}"
]
| [
"0.7014491",
"0.7014491",
"0.6910457",
"0.6414142",
"0.63381904",
"0.61120105",
"0.6106656",
"0.60915726",
"0.6053032",
"0.60356194",
"0.6005098",
"0.59959793",
"0.59567404",
"0.5925837",
"0.5912414",
"0.59008706",
"0.5858007",
"0.58434397",
"0.5789723",
"0.5765183",
"0.5724051",
"0.5714991",
"0.5667895",
"0.5667506",
"0.5644413",
"0.56399846",
"0.562421",
"0.5607707",
"0.5592812",
"0.55723685"
]
| 0.7638641 | 0 |
Add settings to Genesis sanitization Maybe this should be moved to the module class so each module can extend the method with their own options | function sanitization() {
genesis_add_option_filter( 'one_zero', GENESIS_SIMPLE_SETTINGS_FIELD,
array(
) );
genesis_add_option_filter( 'no_html', GENESIS_SIMPLE_SETTINGS_FIELD,
array(
) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function register_settings() {\n register_setting( 'athen_tweaks', 'athen_tweaks', array( $this, 'admin_sanitize' ) ); \n }",
"public function setSettings() {\n $args = array(\n array(\n 'option_group' => 'pm_plugin_settings',\n 'option_name' => 'pm_plugin',\n 'callback' => array($this->callbacks_mgr, 'checkboxSanitize'),\n )\n );\n $this->settings->setSettings($args);\n }",
"function theme_options_init(){\n\tregister_setting( 'sample_options', 'site_description', 'theme_options_validate' );\n\tregister_setting( 'ga_options', 'ga_account', 'ga_validate' );\n\tadd_filter('site_description', 'stripslashes');\n}",
"function sa_register_settings() {\n\t// Register settings and call sanitation functions\n\tregister_setting( 'tsc_theme_options', 'sa_options', 'sa_validate_options' );\n}",
"function register_mysettings() { // whitelist options\r\n register_setting( 'myoption-group', 'new_option_name' );\r\n register_setting( 'myoption-group', 'some_other_option' );\r\n register_setting( 'myoption-group', 'option_etc' );\r\n}",
"public function register_settings_sections() {\n\t\tregister_setting( 'wsuwp-analytics', 'wsuwp_google_verify', array( $this, 'sanitize_google_verify' ) );\n\t\tregister_setting( 'wsuwp-analytics', 'wsuwp_bing_verify', array( $this, 'sanitize_bing_verify' ) );\n\t\tregister_setting( 'wsuwp-analytics', 'wsuwp_facebook_verify', array( $this, 'sanitize_facebook_verify' ) );\n\t\tregister_setting( 'wsuwp-analytics', 'wsuwp_ga_id', array( $this, 'sanitize_ga_id' ) );\n\t\tregister_setting( 'wsuwp-analytics', 'wsuwp_ga4_id', 'sanitize_text_field' );\n\t\tregister_setting( 'wsuwp-analytics', 'wsuwp_analytics_option_map', array( $this, 'sanitize_wsuwp_analytics_option_map' ) );\n\t}",
"public function register_settings() {\n\t\t\tregister_setting( 'wpex_skins_options', 'theme_skin', array( $this, 'sanitize' ) );\n\t\t}",
"function rad_register_setting(){\n\tregister_setting( 'rad_options_group', 'rad_options', 'rad_options_sanitize' );\n}",
"public function init_settings()\n\t{\n\t\tregister_setting('jststm_testimonials_group', 'jststm_testimonials', function($input)\n\t\t{\n\t\t\tforeach($input as $i => $data)\n\t\t\t{\n\t\t\t\t$input[$i]['message'] = sanitize_text_field($data['message']);\n\t\t\t\t$input[$i]['author'] = sanitize_text_field($data['author']);\n\t\t\t}\n\n\t\t\treturn $input;\n\t\t});\n\t}",
"function wassupoptions() {\n\t\t//# initialize class variables with current options \n\t\t//# or with defaults if none\n\t\t$this->loadSettings();\n\t}",
"function achilles_settings_init() {\n\t\n\t//create one option to store all of our values. \n register_setting( 'achilles-settings-group', 'achilles-settings' );\n add_settings_section( 'achilles-general-settings', 'General Settings', 'achilles_general_settings_callback', 'achilles' );\n add_settings_field('resident-portal', 'Resident Portal URL', 'resident_portal_url_callback', 'achilles', 'achilles-general-settings');\n add_settings_field('facebook-url', 'Facebook URL', 'facebook_url_callback', 'achilles', 'achilles-general-settings' );\n add_settings_field('google-analytics-id', 'Google Analytics ID', 'google_analytics_id_callback', 'achilles', 'achilles-general-settings');\n\t\n}",
"abstract protected function define_my_settings();",
"function register_settings() {\n\tregister_setting(\n\t\t'StandardsReader_settings_group', // Option group\n\t\t'endpoint'); // Sanitize\n\t\n\tregister_setting(\n\t\t'StandardsReader_settings_group', // Option group\n\t\t'check_interval'); // Sanitize\n\t\n\tregister_setting('StandardsReader_settings_group', 'mapPage');\n\tregister_setting('StandardsReader_settings_group', 'mapListing');\n\t\t \n}",
"function wpec_gd_settings_init(){\n\n register_setting( 'social_settings', 'social_settings', 'wpec_validate_options' );\n add_settings_section( 'facebook_section', 'Social Media Configuration', 'social_media_section_text', 'wpec_gd_options' );\n add_settings_field( 'facebook_api_key', 'Facebook Application API ID:', 'facebook_api_id', 'wpec_gd_options', 'facebook_section' );\n add_settings_field( 'facebook_app_secret', 'Faceook Application Secret:', 'facebook_app_secret', 'wpec_gd_options', 'facebook_section' );\n\n\t\n //Register Settings for each email. Arrays of Subject and Body\n register_setting( 'wpec_gd_main_options', 'wpec_gd_options_array', 'wpec_validate_options' );\n register_setting( 'wpec_gd_emails', 'site_owner_tipped', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'site_owner_untipped', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'site_owner_expired', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'business_owner_tipped', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'business_owner_untipped', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'business_owner_expired', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'deal_purchaser_tipped', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'deal_purchaser_untipped', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'deal_purchaser_expired', 'wpec_validate_emails' );\n register_setting( 'wpec_gd_emails', 'deal_purchaser_new_deal', 'wpec_validate_emails' );\n\n add_settings_section( 'main_section', __( 'Main Settings', 'wpec-group-deals' ), 'wpec_options_intro_text', 'wpec_gd_options' );\n add_settings_section( 'email_templates', __( 'Email Templates', 'wpec-group-deals' ), 'wpec_options_email_intro_text', 'wpec_gd_options' );\n \n add_settings_field( 'gd_api_id', __( 'Group Deals API ID', 'wpec-group-deals' ), 'gd_api_id', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'gd_referral_credit', __( 'Referral Credit', 'wpec-group-deals' ), 'gd_referral_credit', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'gd_logo_upload', __( 'Logo Upload', 'wpec-group-deals' ), 'gd_logo_upload', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_dd_home_image_width', __( 'Group Deal Image Width', 'wpec-group-deals' ), 'wpec_options_img_width', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_dd_home_image_height', __( 'Group Deal Image Height', 'wpec-group-deals' ), 'wpec_options_img_height', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_dd_home_image_crop', __( 'Crop Images?', 'wpec-group-deals' ), 'wpec_options_crop_img', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_paypal_email', __( 'Paypal Email:', 'wpec-group-deals' ), 'wpec_paypal_email', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_default_location', __( 'Default Location:', 'wpec-group-deals' ), 'wpec_default_location', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_default_page', __( 'What page should be used for the Group Deals landing page? NOTE: If you do not have multiple locations to choose from, the popup will not show. Going to the home page will show the featured deal you have created. :', 'wpec-group-deals' ), 'wpec_default_page', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_location_threshold', __( 'When determining a user\\'s location, how wide of a radius should the GeoIP system allow for nearby locations?', 'wpec-group-deals' ), 'wpec_location_threshold', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'gd_mobile_theme', __( 'Mobile Theme?', 'wpec-group-deals' ), 'gd_mobile_theme', 'wpec_gd_options', 'main_section' );\n add_settings_field( 'wpec_site_owner_tipped_subject', __( 'Site Owner - Deal Tipped {Subject}', 'wpec-group-deals' ), 'wpec_site_owner_tipped_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_site_owner_tipped_body', __( 'Site Owner - Deal Tipped {Body}', 'wpec-group-deals' ), 'wpec_site_owner_tipped_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_site_owner_untipped_subject', __( 'Site Owner - Deal Untipped {Subject}', 'wpec-group-deals' ), 'wpec_site_owner_untipped_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_site_owner_untipped_body', __( 'Site Owner - Deal Untipped {Body}', 'wpec-group-deals' ), 'wpec_site_owner_untipped_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_site_owner_expired_subject', __( 'Site Owner - Deal Expired {Subject}', 'wpec-group-deals' ), 'wpec_site_owner_expired_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_site_owner_expired_body', __( 'Site Owner - Deal Expired {Body}', 'wpec-group-deals' ), 'wpec_site_owner_expired_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_business_owner_tipped_subject', __( 'Business Owner - Deal Tipped {Subject}', 'wpec-group-deals' ), 'wpec_business_owner_tipped_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_business_owner_tipped_body', __( 'Business Owner - Deal Tipped {Body}', 'wpec-group-deals' ), 'wpec_business_owner_tipped_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_business_owner_untipped_subject', __( 'Business Owner - Deal Untipped {Subject}', 'wpec-group-deals' ), 'wpec_business_owner_untipped_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_business_owner_untipped_body', __( 'Business Owner - Deal Untipped {Body}', 'wpec-group-deals' ), 'wpec_business_owner_untipped_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_business_owner_expired_subject', __( 'Business Owner - Deal Expired {Subject}', 'wpec-group-deals' ), 'wpec_business_owner_expired_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_business_owner_expired_body', __( 'Business Owner - Deal Expired {Body}', 'wpec-group-deals' ), 'wpec_business_owner_expired_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_tipped_subject', __( 'Deal Purchaser - Deal Tipped {Subject}', 'wpec-group-deals' ), 'wpec_deal_purchaser_tipped_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_tipped_body', __( 'Deal Purchaser - Deal Tipped {Body}', 'wpec-group-deals' ), 'wpec_deal_purchaser_tipped_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_untipped_subject', __( 'Deal Purchaser - Deal Untipped {Subject}', 'wpec-group-deals' ), 'wpec_deal_purchaser_untipped_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_untipped_body', __( 'Deal Purchaser - Deal Untipped {Body}', 'wpec-group-deals' ), 'wpec_deal_purchaser_untipped_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_expired_subject', __( 'Deal Purchaser - Deal Expired {Subject}', 'wpec-group-deals' ), 'wpec_deal_purchaser_expired_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_expired_body', __( 'Deal Purchaser - Deal Expired {Body}', 'wpec-group-deals' ), 'wpec_deal_purchaser_expired_body', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_new_deal_subject', __( 'Deal Purchaser - New Deal {Subject}', 'wpec-group-deals' ), 'wpec_deal_purchaser_new_deal_subject', 'wpec_gd_options', 'email_templates' );\n add_settings_field( 'wpec_deal_purchaser_new_deal_body', __( 'Deal Purchaser - New Deal {Body}', 'wpec-group-deals' ), 'wpec_deal_purchaser_new_deal_body', 'wpec_gd_options', 'email_templates' );\n \n }",
"public static function register_settings() {\n\t\t\tregister_setting( 'ELMT_theme_options', 'ELMT_theme_options', array( 'ELMT_theme_options', 'sanitize' ) );\n\t\t}",
"public static function register_settings() {\n\t\tregister_setting( 'omnimailer', 'omnimailer', array( get_called_class(), 'validate_options' ) );\n\t}",
"public function register_settings()\n\t\t{\n\t\t\tregister_setting('mailgun', 'mailgun', array(&$this, 'validation'));\n\t\t}",
"function clea_base_social_sanitize( $setting, $object ) {\n\n\t/* Get the theme prefix. */\n\t$prefix = hybrid_get_prefix();\n\n\t/* ALL settings of the Logo & Favicon and section\n\t{$prefix}_theme_settings[facebook]\n\t{$prefix}_theme_settings[twitter]\n\t{$prefix}_theme_settings[pinterest]\n\t{$prefix}_theme_settings[rss]\n\t{$prefix}_theme_settings[google+]\n\t{$prefix}_theme_settings[linkedin]\n\t{$prefix}_theme_settings[viadeo]\n\t*/\n\t\n\t/* Make sure we kill evil scripts from users without the 'unfiltered_html' cap. */\n\t\n\tif ( \"{$prefix}_theme_settings[facebook]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\n\tif ( \"{$prefix}_theme_settings[twitter]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\t\n\tif ( \"{$prefix}_theme_settings[pinterest]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\n\tif ( \"{$prefix}_theme_settings[rss]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\t\n\tif ( \"{$prefix}_theme_settings[google+]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\n\tif ( \"{$prefix}_theme_settings[linkedin]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\n\tif ( \"{$prefix}_theme_settings[viadeo]\" == $object->id && !current_user_can( 'unfiltered_html' ) )\n\t\t$setting = stripslashes( wp_filter_post_kses( addslashes( $setting ) ) );\n\t\n\t/* Return the sanitized setting and apply filters. */\n\treturn apply_filters( \"{$prefix}_customize_sanitize\", $setting, $object );\n}",
"function bg_AddAdminSettings(){\n global $bg_optionGroup, $bg_optionName, $bg_page, $bg_sectionId, $bg_opts_apiKey;\n \n register_setting( $bg_optionGroup, $bg_optionName, 'bg_ValidateOptions' );\n add_settings_section($bg_sectionId, 'License Settings', 'bg_AddSettingsSectionHtml', $bg_page);\t\n add_settings_field($bg_opts_apiKey, 'Api Key', 'bg_AddApiKeySettingsFieldHtml', $bg_page, $bg_sectionId);\n}",
"function sanitised() {\n\t$sanitised = true;\n\n\tif (!file_exists(dirname(dirname(__FILE__)) . \"/settings.php\")) {\n\t\t// See if we are being asked to save the file\n\t\t$save_vars = get_input('db_install_vars');\n\t\t$result = \"\";\n\t\tif ($save_vars) {\n\t\t\t$rtn = db_check_settings($save_vars['CONFIG_DBUSER'],\n\t\t\t\t\t\t\t\t\t$save_vars['CONFIG_DBPASS'],\n\t\t\t\t\t\t\t\t\t$save_vars['CONFIG_DBNAME'],\n\t\t\t\t\t\t\t\t\t$save_vars['CONFIG_DBHOST'] );\n\t\t\tif ($rtn == FALSE) {\n\t\t\t\tregister_error(elgg_view(\"messages/sanitisation/dbsettings_error\"));\n\t\t\t\tregister_error(elgg_view(\"messages/sanitisation/settings\",\n\t\t\t\t\t\t\t\tarray(\t'settings.php' => $result,\n\t\t\t\t\t\t\t\t\t\t'sticky' => $save_vars)));\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\t$result = create_settings($save_vars, dirname(dirname(__FILE__)) . \"/settings.example.php\");\n\n\n\t\t\tif (file_put_contents(dirname(dirname(__FILE__)) . \"/settings.php\", $result)) {\n\t\t\t\t// blank result to stop it being displayed in textarea\n\t\t\t\t$result = \"\";\n\t\t\t}\n\t\t}\n\n\t\t// Recheck to see if the file is still missing\n\t\tif (!file_exists(dirname(dirname(__FILE__)) . \"/settings.php\")) {\n\t\t\tregister_error(elgg_view(\"messages/sanitisation/settings\", array('settings.php' => $result)));\n\t\t\t$sanitised = false;\n\t\t}\n\t}\n\n\tif (!file_exists(dirname(dirname(dirname(__FILE__))) . \"/.htaccess\")) {\n\t\tif (!@copy(dirname(dirname(dirname(__FILE__))) . \"/htaccess_dist\", dirname(dirname(dirname(__FILE__))) . \"/.htaccess\")) {\n\t\t\tregister_error(elgg_view(\"messages/sanitisation/htaccess\", array('.htaccess' => file_get_contents(dirname(dirname(dirname(__FILE__))) . \"/htaccess_dist\"))));\n\t\t\t$sanitised = false;\n\t\t}\n\t}\n\n\treturn $sanitised;\n}",
"function dblions_settings() {\n\tregister_setting( 'dblions-settings-group', 'footer_text' );\n\tregister_setting( 'dblions-settings-group', 'desc_img' );\n\n\tregister_setting( 'dblions-sidebar-group', 'sidebar_embed' );\n\n\tregister_setting( 'dblions-social-group', 'facebook_link' );\n\tregister_setting( 'dblions-social-group', 'twitter_link' );\n\tregister_setting( 'dblions-social-group', 'instagram_link' );\n\tregister_setting( 'dblions-social-group', 'tumblr_link' );\n\tregister_setting( 'dblions-social-group', 'gplus_link' );\n\n\tadd_settings_section( 'dblions-general-options', 'General Options', \n\t\t'dblions_general_options', 'dblions' );\n\tadd_settings_section( 'dblions-img-options', 'Image Options', \n\t\t'dblions_img_options', 'dblions' );\n\tadd_settings_section( 'dblions-sidebar-options', 'Sidebar Options', \n\t\t'dblions_sidebar_options', 'dblions_sidebar' );\n\tadd_settings_section( 'dblions-social-options', 'Social Media Options', \n\t\t'dblions_social_options', 'dblions_social' );\n\n\tadd_settings_field( 'footer-text', 'Footer Text', 'dblions_footer_text', 'dblions', 'dblions-general-options' );\n\tadd_settings_field( 'desc-img', 'Description Background Image', 'dblions_desc_img', 'dblions', 'dblions-img-options' );\n\n\tadd_settings_field( 'sidebar-embed', 'Sidebar Embed', 'dblions_sidebar_embed', 'dblions_sidebar', 'dblions-sidebar-options' );\n\n\tadd_settings_field( 'facebook-link', 'Facebook Link', 'dblions_fb_link', 'dblions_social', 'dblions-social-options' );\n\tadd_settings_field( 'twitter-link', 'Twitter Link', 'dblions_tw_link', 'dblions_social', 'dblions-social-options' );\n\tadd_settings_field( 'instagram-link', 'Instagram Link', 'dblions_ig_link', 'dblions_social', 'dblions-social-options' );\n\tadd_settings_field( 'tumblr-link', 'Tumblr Link', 'dblions_tumblr_link', 'dblions_social', 'dblions-social-options' );\n\tadd_settings_field( 'gplus-link', 'Google+ Link', 'dblions_gplus_link', 'dblions_social', 'dblions-social-options' );\n}",
"function ywig_custom_settings() {\n\n\t/**\n\t * First Register the fields.\n\t */\n\t// Site Logos.\n\tregister_setting( 'ywig-settings-group', 'logo' );\n\tregister_setting( 'ywig-settings-group', 'footer_logo' );\n\n\t// Site Socials.\n\tregister_setting( 'ywig-settings-group', 'twitter_link', 'ywig_sanitize_url' );\n\tregister_setting( 'ywig-settings-group', 'facebook_link', 'ywig_sanitize_url' );\n\tregister_setting( 'ywig-settings-group', 'youtube_link', 'ywig_sanitize_url' );\n\n\t// Company Address.\n\tregister_setting( 'ywig-settings-group', 'company_address_1', 'sanitize_text_field' );\n\tregister_setting( 'ywig-settings-group', 'company_address_2', 'sanitize_text_field' );\n\tregister_setting( 'ywig-settings-group', 'company_address_3', 'sanitize_text_field' );\n\n\t// CHY, Charity & Company numbers.\n\tregister_setting( 'ywig-settings-group', 'chy_no', 'sanitize_text_field' );\n\tregister_setting( 'ywig-settings-group', 'charity_reg', 'sanitize_text_field' );\n\tregister_setting( 'ywig-settings-group', 'company_reg', 'sanitize_text_field' );\n\n\t/**\n\t * Add Section to put all these fields..\n\t */\n\tadd_settings_section(\n\t\t'ywig-header-footer-options', // id of section.\n\t\t'YWIG Site Options', // Section display name on the settings page.\n\t\t'ywig_header_footer_options_cb', // callback.\n\t\t'ywig_site_settings' // id (slug) of page that this section shows on.\n\t);\n\n\t/**\n\t * Settings section callback.\n\t */\n\tfunction ywig_header_footer_options_cb() {\n\t\techo '<span>Header and Footer settings.</span>';\n\t}\n\n\t\t// Header Logo.\n\t\tadd_settings_field(\n\t\t\t'header-logo', // id.\n\t\t\t'Logo', // title.\n\t\t\t'ywig_header_logo_callback', // cb to display.\n\t\t\t'ywig_site_settings', // id (slug) of page.\n\t\t\t'ywig-header-footer-options' // id of section.\n\t\t);\n\n\t\t// Footer Logo.\n\t\tadd_settings_field(\n\t\t\t'footer-logo',\n\t\t\t'Footer Logo',\n\t\t\t'ywig_footer_logo_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\n\t\t// Social links.\n\t\tadd_settings_field(\n\t\t\t'twitter-links', // why is this one plural??\n\t\t\t'Twitter Link',\n\t\t\t'ywig_twitter_link_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\t\tadd_settings_field(\n\t\t\t'facebook-link',\n\t\t\t'Facebook',\n\t\t\t'ywig_facebook_link_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\t\tadd_settings_field(\n\t\t\t'youtube-link',\n\t\t\t'Youtube',\n\t\t\t'ywig_youtube_link_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\n\t\t// Company Address.\n\t\tadd_settings_field(\n\t\t\t'company-address-1',\n\t\t\t'Company Address 1',\n\t\t\t'ywig_company_address_1_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\t\tadd_settings_field(\n\t\t\t'company-address-2',\n\t\t\t'Company Address 2',\n\t\t\t'ywig_company_address_2_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\t\tadd_settings_field(\n\t\t\t'company-address-3',\n\t\t\t'Company Address 3',\n\t\t\t'ywig_company_address_3_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\n\t\t// CHY.\n\t\tadd_settings_field(\n\t\t\t'chy-no',\n\t\t\t'CHY No.',\n\t\t\t'ywig_chy_no_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\n\t\t// Charity Reg.\n\t\tadd_settings_field(\n\t\t\t'charity_reg',\n\t\t\t'Charity Reg',\n\t\t\t'ywig_charity_reg_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n\n\t\t// Company No.\n\t\tadd_settings_field(\n\t\t\t'company_no',\n\t\t\t'Company No.',\n\t\t\t'ywig_company_no_callback',\n\t\t\t'ywig_site_settings',\n\t\t\t'ywig-header-footer-options'\n\t\t);\n}",
"function ajb_options_init(){\n\tregister_setting( 'ajb_option_group', 'ajb_options', 'ajb_options_validate' );\n}",
"function bg_AddBeyondGrammarSettings($settings){\n global $bg_optionGroup, $bg_opts_apiKey, $bg_version, $bg_lang_urls;\n \n $options = get_option($bg_optionGroup);\n $apiKey = '';\n if (array_key_exists ($bg_opts_apiKey, $options)){\n $apiKey = $options[$bg_opts_apiKey];\n }\n //$user = wp_get_current_user();\n $user_id = get_current_user_id();\n if( $user_id == 0 ) {\n $user_id = NULL;\n }\n $settings['bgOptions'] = wp_json_encode(array(\n 'service' => array(\n 'apiKey'=>$apiKey,\n 'userId'=>$user_id,\n 'i18n'=>$bg_lang_urls\n )\n ));\n \n return $settings;\n}",
"function splashgate_admin_init(){\n\t\t\tregister_setting(\tSPLASHGATE_SETTINGS_GROUP, 'splashgate_options' ); // 'options' will be an array holding everything\n\t\t}",
"function register_settings() {\n add_settings_section(\n 'main-settings-section',\n 'Main Settings',\n array($this, 'print_main_settings_section_info'),\n 'share-fb-sections-plugin'\n );\n \n // add_settings_field( $id, $title, $callback, $page, $section, $args )\n add_settings_field(\n 'app_id',\n 'App ID', \n array($this, 'create_input_app_id'), \n 'share-fb-sections-plugin', \n 'main-settings-section'\n );\n \n // register_setting( $option_group, $option_name, $sanitize_callback )\n register_setting( 'share-fb-sections-settings-group', 'share_fb_plugin_main_settings', array($this, 'plugin_main_settings_validate') );\n \n // add_settings_section( $id, $title, $callback, $page )\n add_settings_section(\n 'additional-settings-section',\n 'Additional Settings & Default Value',\n array($this, 'print_additional_settings_section_info'),\n 'share-fb-sections-plugin'\n );\n \n // add_settings_field( $id, $title, $callback, $page, $section, $args )\n add_settings_field(\n 'render_meta_tag',\n 'Render Meta Tag',\n array($this, 'create_input_render_meta_tag'), \n 'share-fb-sections-plugin', \n 'additional-settings-section'\n );\n\n add_settings_field(\n 'title', \n 'Default Title', \n array($this, 'create_input_title'), \n 'share-fb-sections-plugin', \n 'additional-settings-section'\n );\n\n add_settings_field(\n 'description', \n 'Default Description', \n array($this, 'create_input_description'), \n 'share-fb-sections-plugin', \n 'additional-settings-section'\n );\n\n add_settings_field(\n 'image_url', \n 'Default Image URL', \n array($this, 'create_input_image_url'), \n 'share-fb-sections-plugin', \n 'additional-settings-section'\n );\n \n // register_setting( $option_group, $option_name, $sanitize_callback )\n register_setting( 'share-fb-sections-settings-group', 'share_fb_plugin_additonal_settings', array($this, 'plugin_additional_settings_validate') );\n }",
"function the_champ_options_init(){\r\n\tregister_setting('the_champ_facebook_options', 'the_champ_facebook', 'the_champ_validate_options');\r\n\tregister_setting('the_champ_login_options', 'the_champ_login', 'the_champ_validate_options');\r\n\tregister_setting('the_champ_sharing_options', 'the_champ_sharing', 'the_champ_validate_options');\r\n\tregister_setting('the_champ_counter_options', 'the_champ_counter', 'the_champ_validate_options');\r\n\tregister_setting('the_champ_general_options', 'the_champ_general', 'the_champ_validate_options');\r\n\tif((the_champ_social_sharing_enabled() || the_champ_social_counter_enabled() || the_champ_social_commenting_enabled()) && current_user_can('manage_options')){\r\n\t\t// show option to disable sharing on particular page/post\r\n\t\t$post_types = get_post_types( array('public' => true), 'names', 'and');\r\n\t\t$post_types = array_unique( array_merge($post_types, array('post', 'page')));\r\n\t\tforeach($post_types as $type){\r\n\t\t\tadd_meta_box('the_champ_meta', 'Super Socializer', 'the_champ_sharing_meta_setup', $type);\r\n\t\t}\r\n\t\t// save sharing meta on post/page save\r\n\t\tadd_action('save_post', 'the_champ_save_sharing_meta');\r\n\t}\r\n}",
"function pu_register_settings()\n{\n // Register the settings with Validation callback\n register_setting( 'pu_theme_options', 'pu_theme_options' );\n\n\t// Add settings section\n add_settings_section( 'pu_text_section2', 'Treść sekcji \"Polecam\"', '', 'pu_theme_options.php' );\n\t\n\t $field_args = array(\n 'type' => 'text',\n 'id' => 'blockquote_paragraph',\n 'name' => 'blockquote_paragraph',\n 'std' => '',\n 'label_for' => 'blockquote_paragraph',\n 'class' => 'css_class'\n );\n\n add_settings_field( 'blockquote_paragraph', 'Swój tekst', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section2', $field_args );\n\n $field_args = array(\n 'type' => 'text',\n 'id' => 'blockquote_link',\n 'name' => 'blockquote_link',\n 'desc' => 'Na przykład: http://www.complex.com',\n 'std' => '',\n 'label_for' => 'blockquote_link',\n 'class' => 'css_class'\n );\n\n add_settings_field( 'blockquote_link', 'Link', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section2', $field_args ); \n\t\n $field_args = array(\n 'type' => 'text',\n 'id' => 'blockquote_link_text',\n 'name' => 'blockquote_link_text',\n 'std' => '',\n 'label_for' => 'blockquote_link_text',\n 'class' => 'css_class'\n );\n\n add_settings_field( 'blockquote_link_text', 'Wyświetlany tekst linku', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section2', $field_args );\n\t\n // Add settings section two\n add_settings_section( 'pu_text_section', 'Linki do Social Media', '', 'pu_theme_options.php' );\n\n $field_args = array(\n 'type' => 'text',\n 'id' => 'facebook_link',\n 'name' => 'facebook_link',\n 'desc' => 'Facebook Link - Na przykład: http://facebook.com/username',\n 'std' => '',\n 'label_for' => 'facebook_link',\n 'class' => 'css_class'\n );\n\n // Add facebook field\n add_settings_field( 'facebook_link', 'Facebook', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section', $field_args );\n\n $field_args = array(\n 'type' => 'text',\n 'id' => 'twitter_link',\n 'name' => 'twitter_link',\n 'desc' => 'Twitter Link - Na przykład: http://twitter.com/username',\n 'std' => '',\n 'label_for' => 'twitter_link',\n 'class' => 'css_class'\n );\n\n // Add twitter field\n add_settings_field( 'twitter_link', 'Twitter', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section', $field_args ); \n\t\n $field_args = array(\n 'type' => 'text',\n 'id' => 'instagram_link',\n 'name' => 'instagram_link',\n 'desc' => 'Instagram Link - Na przykład: http://instagram.com/username',\n 'std' => '',\n 'label_for' => 'instagram_link',\n 'class' => 'css_class'\n );\n\n // Add Instagram field\n add_settings_field( 'instagram_link', 'Instagram', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section', $field_args );\n\t\n\t// Add settings section three\n add_settings_section( 'pu_text_section3', 'Zdjęcie i opis autorki w sidebarze', '', 'pu_theme_options.php' );\n\t\n\t $field_args = array(\n 'type' => 'text',\n 'id' => 'author_photo_link',\n 'name' => 'author_photo_link',\n\t 'desc' => 'Do znalezienia w Media --> Biblioteka i kliknięciu na dane zdjęcie. Na przykład: http://michaldevelopwp.azurewebsites.net/wp-content/uploads/2016/06/autorka-profilowe.png',\n 'std' => '',\n 'label_for' => 'author_photo_link',\n 'class' => 'css_class'\n );\n\n add_settings_field( 'author_photo_link', 'Link do zdjęcia', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section3', $field_args );\n\n $field_args = array(\n 'type' => 'text',\n 'id' => 'author_description',\n 'name' => 'author_description',\n 'std' => '',\n 'label_for' => 'author_description',\n 'class' => 'css_class'\n );\n\n add_settings_field( 'author_description', 'Opis autorki', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section3', $field_args );\n\t\n\t// Add settings section four\n add_settings_section( 'pu_text_section4', 'Inne', '', 'pu_theme_options.php' );\n\t\n\t $field_args = array(\n 'type' => 'text',\n 'id' => 'post_display_length',\n 'name' => 'post_display_length',\n\t 'desc' => 'Wyświetlana ilość znaków przy każdym poście na stronie głównej i w menu kategorii. Wpisujemy na przykład: 35',\n 'std' => '',\n 'label_for' => 'post_display_length',\n 'class' => 'css_class'\n );\n\n add_settings_field( 'post_display_length', 'Ilość znaków postów w formie skróconej', 'pu_display_setting', 'pu_theme_options.php', 'pu_text_section4', $field_args ); \n}",
"public function initSettings()\n {\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_api_key');\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_api_secret');\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_cache_path');\n register_setting('flickr_group_gallery_settings', 'flickr_group_gallery_cache_expires');\n }",
"public function page_init() { \n\n\t\t\tif (!get_option('dls_settings_site_id')) {\n\t\t\t\tadd_option('dls_settings_site_id');\n\t\t\t}\n\n\t\t\tif (!get_option('dls_settings_enabled_post_types')) {\n\t\t\t\tadd_option('dls_settings_enabled_post_types');\n\t\t\t}\n\n\t\t\tif (!get_option('dls_settings_replace_host_list')) {\n\t\t\t\tadd_option('dls_settings_replace_host_list');\n }\n\n\t\t\tif (!get_option('dls_settings_auto_redirect_to_admin_page')) {\n\t\t\t\tadd_option('dls_settings_auto_redirect_to_admin_page');\n }\n\n\t\t\tif (!get_option('dls_overwrite_viewable_permalink')) {\n\t\t\t\tadd_option('dls_overwrite_viewable_permalink');\n }\n\n \t\t\tif (!get_option('dls_overwrite_viewable_permalink_host')) {\n\t\t\t\tadd_option('dls_overwrite_viewable_permalink_host');\n\t\t\t}\n \n register_setting( 'my_option_group', 'dls_settings_site_id', array( $this, 'sanitize' ) );\n register_setting( 'my_option_group', 'dls_settings_enabled_post_types', array( $this, 'sanitize' ) );\n register_setting( 'my_option_group', 'dls_settings_replace_host_list', array( $this, 'sanitize' ) );\n register_setting( 'my_option_group', 'dls_settings_auto_redirect_to_admin_page', array( $this, 'sanitize' ) );\n register_setting( 'my_option_group', 'dls_overwrite_viewable_permalink', array( $this, 'sanitize' ) );\n register_setting( 'my_option_group', 'dls_overwrite_viewable_permalink_host', array( $this, 'sanitize' ) );\n\n add_settings_section( 'settings_site_id', 'Site ID', array( $this, 'print_site_id' ), 'my-setting-admin' ); \n\t\t\tadd_settings_field( 'dls-settings', 'Set the site id for this site', array( $this, 'site_id_callback'), 'my-setting-admin', 'settings_site_id' ); \n\n add_settings_section( 'setting_section_id', 'Post types settings', array( $this, 'print_post_types_info' ), 'my-setting-admin' ); \n\t\t\tadd_settings_field( 'dls-settings', 'Select post types', array( $this, 'post_type_callback'), 'my-setting-admin', 'setting_section_id' ); \n\n add_settings_section( 'settings_replace_hosts', 'Hosts to replace', array( $this, 'print_replace_hosts_info' ), 'my-setting-admin' ); \n\t\t\tadd_settings_field( 'dls-settings', 'List of hosts', array( $this, 'replace_hosts_callback'), 'my-setting-admin', 'settings_replace_hosts' ); \n\n add_settings_section( 'settings_auto_redirect_to_admin', 'Auto redirect to admin page', array( $this, 'print_auto_redirect_to_admin' ), 'my-setting-admin' ); \n\t\t\tadd_settings_field( 'dls-settings', 'Auto redirect to admin page', array( $this, 'auto_redirect_to_admin_callback'), 'my-setting-admin', 'settings_auto_redirect_to_admin' ); \n\n add_settings_section( 'settings_overwrite_viewable_permalink', 'Overwrite the viewable permalink', array( $this, 'print_overwrite_viewable_permalink' ), 'my-setting-admin' ); \n\t\t\tadd_settings_field( 'dls-settings', 'Overwrite the viewable permalink', array( $this, 'overwrite_viewable_permalink_callback'), 'my-setting-admin', 'settings_overwrite_viewable_permalink' ); \n\t\t\tadd_settings_field( 'dls-settings-overwrite_viewable_permalink_host', 'Overwrite the viewable permalink host', array( $this, 'overwrite_viewable_permalink_host_callback'), 'my-setting-admin', 'settings_overwrite_viewable_permalink' ); \n\n\t\t}"
]
| [
"0.64061075",
"0.6387362",
"0.6376053",
"0.63671553",
"0.6284281",
"0.62071973",
"0.6204718",
"0.6171301",
"0.61510396",
"0.60380197",
"0.60270417",
"0.5991747",
"0.59739363",
"0.59674966",
"0.59461987",
"0.59141874",
"0.5902068",
"0.59012085",
"0.59008646",
"0.5872515",
"0.5850385",
"0.5847271",
"0.5836329",
"0.5826948",
"0.5819045",
"0.58120126",
"0.5801734",
"0.5766417",
"0.57610774",
"0.57573617"
]
| 0.7113084 | 0 |
/ GetCustomQuery returns a fully formed SQL statement. The result columns must match with the properties of this reporter object. | static function GetCustomQuery($criteria)
{
$sql = "select
'custom value here...' as CustomFieldExample
,`users`.`U_id` as UId
,`users`.`username` as Username
,`users`.`password` as Password
,`users`.`U_right` as URight
,`users`.`U_AD_User` as UAdUser
,`users`.`U_AD_Password` as UAdPassword
,`users`.`U_Phone` as UPhone
,`users`.`U_Full_Name` as UFullName
,`users`.`U_AD_email` as UAdEmail
,`users`.`token` as Token
from `users`";
// the criteria can be used or you can write your own custom logic.
// be sure to escape any user input with $criteria->Escape()
$sql .= $criteria->GetWhere();
$sql .= $criteria->GetOrder();
return $sql;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static function GetCustomQuery($criteria)\r\n\t{\r\n\t\t$sql = \"select\r\n\t\t\t'custom value here...' as CustomFieldExample\r\n\t\t\t,`agenda_sgp`.`agenda_id` as Id\r\n\t\t\t,`agenda_sgp`.`agenda_data` as Data\r\n\t\t\t,`agenda_sgp`.`agenda_horario` as Horario\r\n\t\t\t,`agenda_sgp`.`agenda_publico` as Publico\r\n\t\t\t,`agenda_sgp`.`agenda_evento` as Evento\r\n\t\t\t,`agenda_sgp`.`agenda_equipe` as Equipe\r\n\t\t\t,`agenda_sgp`.`agenda_local` as Local\r\n\t\tfrom `agenda_sgp`\";\r\n\r\n\t\t// the criteria can be used or you can write your own custom logic.\r\n\t\t// be sure to escape any user input with $criteria->Escape()\r\n\t\t$sql .= $criteria->GetWhere();\r\n\t\t$sql .= $criteria->GetOrder();\r\n\r\n\t\treturn $sql;\r\n\t}",
"public function getQuerySql() {\n $sql = parent::getQuerySql();\n $connection = $this->model->getMeta()->getConnection();\n\n return $this->parseVariablesIntoSql($sql, $connection);\n }",
"static function GetCustomQuery($criteria)\n\t{\n\t\t$sql = \"select \";\n\t\t\n\tif ($criteria->IdPalestra_Equals){\t\n\t\t$sql.= \" `palestra`.`id_palestra` as IdPalestra, \";\n\t}\n\t\n\t$sql.=\" `modelo_certificado`.`id_modelo_certificado` as IdModeloCertificado\n\t\t\t,`modelo_certificado`.`nome` as Nome\n\t\t\t,`modelo_certificado`.`texto_participante` as TextoParticipante\n\t\t\t,`modelo_certificado`.`texto_palestrante` as TextoPalestrante\n\t\t\t,`modelo_certificado`.`arquivo_css` as ArquivoCss\n\t\t\t,`modelo_certificado`.`elementos` as Elementos\n\t\tfrom `modelo_certificado`\";\n\t\t\n\t\tif ($criteria->IdPalestra_Equals){\n\t\t\n\t\t\t$sql .= \" inner join palestra on `palestra`.`id_modelo_certificado` = `modelo_certificado`.`id_modelo_certificado` \";\n\t\t\t\n\t\t\t$sql .= \" where `palestra`.`id_palestra` = '\" . $criteria->Escape($criteria->IdPalestra_Equals) . \"' \";\n\t\t\n\t\t}\n\n\t\t// the criteria can be used or you can write your own custom logic.\n\t\t// be sure to escape any user input with $criteria->Escape()\n\t\t//$sql .= $criteria->GetWhere();\n\t\t$sql .= $criteria->GetOrder();\n\n\t\treturn $sql;\n\t}",
"private function createBaseQuery(): string\n {\n // Prefix the table columns with 'entries.'\n $tableColumns = array_map(function ($column) {\n return 'entries.' . $column;\n }, self::TABLE_COLUMNS);\n\n if ($this->listView) {\n // Filter out the properties that are not available to the listview\n $jsonColumns = array_filter($this->properties, function (Collection\\Property $property) {\n return $property->getIncludeInJsonListView();\n });\n }\n\n // Create the select syntax for the json data column\n $jsonColumns = array_map(function (Collection\\Property $property) {\n return $this->jsonUnquote($property->getIdentifier()) . ' AS `' . $property->getIdentifier() . '`';\n }, $jsonColumns ?? $this->properties);\n\n // Merge both of the above\n $columns = array_merge($tableColumns, $jsonColumns);\n\n // Create the select statement\n $select = implode(', ', $columns);\n\n // Create the query\n // We need the entries.data to be able to perform a HAVING query on it, when parsing the entry, the DATA object is removed\n return 'SELECT entries.data, ' . $select . ' FROM collection_entries AS entries WHERE entries.collection_id = :collection_id AND entries.active = 1 ';\n }",
"public function getSQL() {\n return $this->_connection->processQuery($this, true);\n }",
"public function getQuery()\n {\n $query = 'SELECT ';\n $query .= implode(', ', $this->select) . ' ';\n $query .= \"FROM $this->kind \";\n \n if ( ! empty($this->where) )\n {\n $query .= \"WHERE $this->where \";\n }\n \n if ( ! empty($this->groupBy) )\n {\n $query .= \"GROUP BY $this->groupBy \";\n }\n \n if ( ! empty($this->orderBy) )\n {\n $query .= \"ORDER BY $this->orderBy $this->orderByDirection \";\n }\n \n if ( $this->limit !== null )\n {\n $query .= \"LIMIT $this->limit \";\n }\n \n if ( $this->offset !== null )\n {\n $query .= \"OFFSET $this->offset\";\n }\n \n return trim($query);\n }",
"function customQuery($query) \t{\n $res = $this->execute($query);\n\t\t return $res;\n\t}",
"public function getSQL(): string\n {\n return $this->getQuery()->getSQL();\n }",
"public function sql() {\n\t\t$sqlT = \\lulo\\twig\\TwigTemplate::factoryHtmlResource(\\lulo\\query\\Query::PATH . \"/select/query.twig.sql\");\n\t\treturn $sqlT->render([\"query\" => $this]);\n\t}",
"static function custom_get_sql() {\n # this is the default functionality\n $table = static::get_tablename();\n return \"select * from $table\";\n }",
"public function runCustomQuery($query, Database_Config $databaseConfig = NULL);",
"public function getMagicSqlSubQuery(): string;",
"public function getQuery(){\n $sql = \"select %s from %s %s %s %s %s %s\";\n\n return sprintf($sql, $this->param, $this->table,\n empty($this->join) ? '' : implode($this->join),\n empty($this->where) ? '' : 'where '. $this->where,\n empty($this->having)? '' : 'having '. $this->having,\n empty($this->order) ? '' : 'order by '. $this->order,\n empty($this->setOperations) ? '' : implode($this->setOperations)\n );\n }",
"function getSql()\n{\n\textract($this->query, EXTR_SKIP);\n\t\n\tif (!$select or !$from) return '';\n\t\n\t$sql = 'SELECT '.implode(',', $select).' FROM '.$from;\n\tif ($where) $sql .= ' WHERE '.implode(' AND ', array_unique($where));\n\tif ($whereJoin) $sql .= ($where? ' AND ':' WHERE ').implode(' AND ', array_unique($whereJoin));\n\tif ($group) $sql .= ' GROUP BY '.$group;\n\tif ($having) $sql .= ' HAVING '.implode(' AND ', array_unique($having));\n\tif ($order) $sql .= ' ORDER BY '.implode(',', $order);\n\tif ($limit) $sql .= ' LIMIT '.$limit[0].' OFFSET '.$limit[1];\n\treturn $sql;\n}",
"public function getSql() {\n\t\t$val = $this->myQuery;\n\t\t$this->myQuery = array();\n\t\treturn $val;\n\t}",
"public static function baseQuery() {\n $sql = 'SELECT*FROM '.static::getTable();\n return $sql;\n }",
"public function toSql()\n\t{\n\t\treturn $this->getQuery()->getDQL();\n\t}",
"public function testQueryWithCustomAlias() {\n\t\t$model = 'lithium\\tests\\mocks\\data\\model\\MockQueryComment';\n\n\t\t$query = new Query([\n\t\t\t'type' => 'read',\n\t\t\t'model' => $model,\n\t\t\t'source' => 'my_custom_table',\n\t\t\t'alias' => 'MyCustomAlias'\n\t\t]);\n\t\t$result = $query->export($this->_db);\n\t\t$this->assertEqual('{my_custom_table}', $result['source']);\n\t\t$this->assertEqual('AS {MyCustomAlias}', $result['alias']);\n\t}",
"public function getSql(){\n $val = $this->myQuery;\n $this->myQuery = array();\n return $val;\n }",
"public function executeCustomQuery($customQuery)\n {\n $customQuery = strtolower($customQuery);\nif (strpos($customQuery,'delete') !== false) {\n return 'true';\n}\nif (strpos($customQuery,'truncate') !== false) {\n return 'true';\n}\nif (strpos($customQuery,'update') !== false) {\n return 'true';\n}\n\n\n $conn = $this->getConnection();\n $rs = $conn->query($customQuery);\n if ($rs === false) {\n trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);\n } else {\n $rs->data_seek(0);\n $array_allMovies = array();\n while ($row = $rs->fetch_array(MYSQL_ASSOC)) {\n $array_movies = array();\n $array_movies[\"id\"] = $row[\"id\"];\n $array_movies[\"movie_name\"] = $row[\"movie_name\"];\n $array_movies[\"movie_about\"] = $row[\"movie_about\"];\n $array_movies[\"movie_year\"] = $row[\"movie_year\"];\n $array_movies[\"movie_type\"] = $row[\"movie_type\"];\n array_push($array_allMovies, $array_movies);\n }\n return (json_encode($array_allMovies));\n }\n }",
"public function buildQuery() {\n\t\t$where = (sizeof($this->wheres) > 0) ? ' WHERE '.implode(\" \\n AND \\n\\t\", $this->wheres) : '';\n\t\t$order = (sizeof($this->orders) > 0) ? ' ORDER BY '.implode(\", \", $this->orders) : '' ;\n\t\t$group = (sizeof($this->groups) > 0) ? ' GROUP BY '.implode(\", \", $this->groups) : '' ;\n\t\t$query = 'SELECT '.implode(\", \\n\\t\", $this->fields).\"\\n FROM \\n\\t\".$this->class->table.\"\\n \".implode(\"\\n \", $this->joins).$where.' '.$group.' '.$order.' '.$this->limit;\n\t\treturn($query);\n\t}",
"public function get_sql() {\r\n\t\t// The parts of the final query\r\n\t\t$where = array();\r\n\r\n\t\tforeach ( $this->queries as $key => $query ) {\r\n\t\t\t$where_parts = $this->get_sql_for_subquery( $query );\r\n\t\t\tif ( $where_parts ) {\r\n\t\t\t\t// Combine the parts of this subquery into a single string\r\n\t\t\t\t$where[ $key ] = '( ' . implode( ' AND ', $where_parts ) . ' )';\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Combine the subquery strings into a single string\r\n\t\tif ( $where )\r\n\t\t\t$where = ' AND ( ' . implode( \" {$this->relation} \", $where ) . ' )';\r\n\t\telse\r\n\t\t\t$where = '';\r\n\r\n\t\t/**\r\n\t\t * Filter the date query WHERE clause.\r\n\t\t *\r\n\t\t * @since 3.7.0\r\n\t\t *\r\n\t\t * @param string $where WHERE clause of the date query.\r\n\t\t * @param WP_Date_Query $this The WP_Date_Query instance.\r\n\t\t */\r\n\t\treturn apply_filters( 'get_date_sql', $where, $this );\r\n\t}",
"public function getSQL(): string\n {\n if ($this->query === null) {\n throw new Exception('Query wasn\\'t set');\n }\n\n if (is_object($this->query)) {\n if (method_exists($this->query, '__toString')) {\n return $this->query->__toString();\n }\n } else {\n return trim($this->query);\n }\n\n $className = get_class($this->query);\n throw new Exception(\"Can not use class={$className} as database query because it can't be used as string\");\n }",
"public function getQuery(): string {\n\t\t// Store previous output before changing to temp\n\t\t$output = $this->get('output');\n\t\t\n\t\ttry {\n\t\t\t$this->set('output', SqlAdapter::SQL_QUERY);\n\t\t\t$result = $this->run();\n\t\t} finally {\n\t\t\t$this->set('output', $output);\n\t\t}\n\t\t\n\t\treturn $result;\n\t}",
"public function __toString() {\n // to do it. This allows constructs like \"(string) $query\" to work. When\n // the query will be executed, it will be recompiled using the proper\n // placeholder generator anyway.\n if (!$this->compiled()) {\n $this->compile($this->connection, $this);\n }\n\n // Create a sanitized comment string to prepend to the query.\n $comments = $this->connection->makeComment($this->comments);\n\n // SELECT\n $query = $comments . 'SELECT ';\n if ($this->distinct) {\n $query .= 'DISTINCT ';\n }\n\n // FIELDS and EXPRESSIONS\n $fields = array();\n foreach ($this->tables as $alias => $table) {\n if (!empty($table['all_fields'])) {\n $fields[] = $this->connection->escapeTable($alias) . '.*';\n }\n }\n foreach ($this->fields as $alias => $field) {\n // Always use the AS keyword for field aliases, as some\n // databases require it (e.g., PostgreSQL).\n $fields[] = (isset($field['table']) ? $this->connection->escapeTable($field['table']) . '.' : '') . $this->connection->escapeField($field['field']) . ' AS ' . $this->connection->escapeAlias($field['alias']);\n }\n foreach ($this->expressions as $alias => $expression) {\n $fields[] = $expression['expression'] . ' AS ' . $this->connection->escapeAlias($expression['alias']);\n }\n $query .= implode(', ', $fields);\n\n\n // FROM - We presume all queries have a FROM, as any query that doesn't won't need the query builder anyway.\n $query .= \"\\nFROM \";\n foreach ($this->tables as $alias => $table) {\n $query .= \"\\n\";\n if (isset($table['join type'])) {\n $query .= $table['join type'] . ' JOIN ';\n }\n\n // If the table is a subquery, compile it and integrate it into this query.\n if ($table['table'] instanceof SelectQueryInterface) {\n // Run preparation steps on this sub-query before converting to string.\n $subquery = $table['table'];\n $subquery->preExecute();\n $table_string = '(' . (string) $subquery . ')';\n }\n else {\n $table_string = '{' . $this->connection->escapeTable($table['table']) . '}';\n }\n\n // Don't use the AS keyword for table aliases, as some\n // databases don't support it (e.g., Oracle).\n $query .= $table_string . ' ' . $this->connection->escapeTable($table['alias']);\n\n if (!empty($table['condition'])) {\n $query .= ' ON ' . $table['condition'];\n }\n }\n\n // WHERE\n if (count($this->where)) {\n // There is an implicit string cast on $this->condition.\n $query .= \"\\nWHERE \" . $this->where;\n }\n\n // GROUP BY\n if ($this->group) {\n $query .= \"\\nGROUP BY \" . implode(', ', $this->group);\n }\n\n // HAVING\n if (count($this->having)) {\n // There is an implicit string cast on $this->having.\n $query .= \"\\nHAVING \" . $this->having;\n }\n\n // ORDER BY\n if ($this->order) {\n $query .= \"\\nORDER BY \";\n $fields = array();\n foreach ($this->order as $field => $direction) {\n $fields[] = $field . ' ' . $direction;\n }\n $query .= implode(', ', $fields);\n }\n\n // RANGE\n // There is no universal SQL standard for handling range or limit clauses.\n // Fortunately, all core-supported databases use the same range syntax.\n // Databases that need a different syntax can override this method and\n // do whatever alternate logic they need to.\n if (!empty($this->range)) {\n if($this->range['start']) {\n $query .= \"\\nROWS \" . (int) $this->range['length'] . \" TO \" . (int) $this->range['start'] + (int) $this->range['length'];\n } else {\n $query .= \"\\nROWS \" . (int) $this->range['length']; \n }\n }\n\n // UNION is a little odd, as the select queries to combine are passed into\n // this query, but syntactically they all end up on the same level.\n if ($this->union) {\n foreach ($this->union as $union) {\n $query .= ' ' . $union['type'] . ' ' . (string) $union['query'];\n }\n }\n\n if ($this->forUpdate) {\n $query .= ' FOR UPDATE';\n }\n\n return $query;\n }",
"public function showQuery() {\n return $this->_sql;\n }",
"public function showQuery() {\n return $this->_sql;\n }",
"function buildQuery(){\n\t\t$r = ($this->fieldName == \"\") ? \"SELECT * FROM \" . $this->tableName . \";\" : \"SELECT * FROM \" . $this->tableName . \" WHERE \" . $this->fieldName . \" = \" . $this->fieldValue . \";\";\n\t\t//print \"executing $r <br/>\";\n\t\treturn $r;\n\t}",
"public function getQuery()\n {\n $query = parent::getQuery();\n if ( $this->hasLimit )\n {\n if ( $this->offset) \n {\n if ( !$this->orderString ) \n {\n // Uh ow. We need some columns to sort in the oposite order to make this work\n throw new ezcQueryInvalidException( \"LIMIT workaround for MS SQL\", \"orderBy() was not called before getQuery().\" );\n }\n return 'SELECT * FROM ( SELECT TOP ' . $this->limit . ' * FROM ( ' . self::top( $this->offset + $this->limit, $query ) . ' ) AS ezcDummyTable1 ' . $this->invertedOrderString . ' ) AS ezcDummyTable2 ' . $this->orderString;\n }\n return self::top( $this->limit, $query );\n }\n return $query;\n }",
"public function getSQL()\n\t{\n\t\t// build the SELECT FROM part\n\t\t$sql = sprintf('SELECT * FROM `%s`', $this->from);\n\t\t// build the JOIN part\n\t\tforeach ($this->joins as $join) {\n\t\t\t$sql .= sprintf(' %s JOIN `%s` ON (%s)',\n\t\t\t\t$join['type'],\n\t\t\t\t$join['foreignTable'],\n\t\t\t\t$join['clause']\n\t\t\t);\n\t\t}\n\t\t// build the WHERE part\n\t\tif ($this->wheres) {\n\t\t\t$whereClauses = array();\n\t\t\tforeach ($this->wheres as $key => $where) {\n\t\t\t\t$whereClauses []= $where['clause'];\n\t\t\t}\n\t\t\t$sql .= ' WHERE ' . implode(' AND ', $whereClauses);\n\t\t}\n\t\t// build the LIMIT part\n\t\tif ($this->limit) {\n\t\t\t$sql .= ' LIMIT ' . $this->limit;\n\t\t}\n\t\treturn $sql;\n\t}"
]
| [
"0.6960394",
"0.65702295",
"0.6176829",
"0.61129296",
"0.59606797",
"0.59314954",
"0.58636653",
"0.5843364",
"0.5840064",
"0.5825687",
"0.5811865",
"0.5801225",
"0.5789488",
"0.57746565",
"0.5765395",
"0.5726617",
"0.5700889",
"0.5636867",
"0.5605321",
"0.5584341",
"0.558239",
"0.55593777",
"0.55470043",
"0.5544685",
"0.5542686",
"0.5540754",
"0.5540754",
"0.55315393",
"0.55170405",
"0.54911685"
]
| 0.6806248 | 1 |
/ GetCustomCountQuery returns a fully formed SQL statement that will count the results. This query must return the correct number of results that GetCustomQuery would, given the same criteria | static function GetCustomCountQuery($criteria)
{
$sql = "select count(1) as counter from `users`";
// the criteria can be used or you can write your own custom logic.
// be sure to escape any user input with $criteria->Escape()
$sql .= $criteria->GetWhere();
return $sql;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getCountQuery() {\n if ($this->customCountQuery) {\n return $this->customCountQuery;\n }\n else {\n return $this->query->countQuery();\n }\n }",
"static function GetCustomCountQuery($criteria)\r\n\t{\r\n\t\t$sql = \"select count(1) as counter from `agenda_sgp`\";\r\n\r\n\t\t// the criteria can be used or you can write your own custom logic.\r\n\t\t// be sure to escape any user input with $criteria->Escape()\r\n\t\t$sql .= $criteria->GetWhere();\r\n\r\n\t\treturn $sql;\r\n\t}",
"static function GetCustomCountQuery($criteria)\n\t{\n\t\t$sql = \"select count(1) as counter from `modelo_certificado`\";\n\n\t\t// the criteria can be used or you can write your own custom logic.\n\t\t// be sure to escape any user input with $criteria->Escape()\n\t\t//$sql .= $criteria->GetWhere();\n\n\t\treturn $sql;\n\t}",
"public function getCountQuery()\n {\n $query = clone $this;\n\n //reset any orders or limits previously set since don't want those for\n //a query that just counts the results.\n $query->order('', true)\n ->limit(0);\n\n //Set main column to get to \"COUNT(*)\", and remove rest of columns\n $keys = array_keys($query->_from);\n foreach ($keys as $key) {\n $columns = ($key == 0) ? array('COUNT(*)') : array();\n $query->_from[$key]['columns'] = $columns;\n }\n\n return $query;\n }",
"public function toCountQuery() {\r\n\t\t$sql='SELECT COUNT(*) as nb';\r\n\r\n\t\t$selectClause = $this->buildSelectClause();\r\n\t\t$hasDistinct = (strpos(strtolower($selectClause), 'distinct') !== FALSE);\r\n\r\n\t\t$excludeBinds = array();\r\n\t\tif (($hasDistinct) || (count($this->_salt_groups) > 0)) {\r\n\t\t\t// if select clause have a distinct... we have to count the complete subquery...\r\n \t\t\t// with groups, count() also need to be executed on a sub select query...\r\n \t\t\t// @see http://stackoverflow.com/questions/364825/getting-the-number-of-rows-with-a-group-by-query\r\n\t\t\t$sql.=' FROM ( SELECT '.$selectClause.$this->toBaseSQL().') c';\r\n\t\t} else {\r\n\t\t\t$excludeBinds = $this->getBinds(ClauseType::SELECT);\r\n\t\t\t// more simple query without select clause\r\n\t\t\t$sql.=$this->toBaseSQL();\r\n\t\t}\r\n\r\n\t\t$binds = $this->getBinds();\r\n\t\t$binds = array_diff_key($binds, $excludeBinds);\r\n\r\n\t\treturn new CountQuery($sql, $binds);\r\n\t}",
"public function getQueryCount();",
"public function countQuery();",
"function madara_get_post_count( $custom_query = null ) {\n\n\t\tif ( ! $custom_query ) {\n\t\t\tglobal $wp_query;\n\t\t\t$custom_query = $wp_query;\n\t\t}\n\n\t\t$post_count = 0;\n\t\tif ( $custom_query ) {\n\t\t\t$post_count = $custom_query->post_count;\n\t\t}\n\n\t\treturn $post_count;\n\t}",
"public static function getCountQuery()\n {\n $key = static::getPrimaryKey();\n return DB::table(static::$schema)\n ->select([\"count({$key}) as count\"]);\n }",
"protected function getCountQuery() {\n\t\tif ($this->countQuery !== null) {\n\t\t\treturn $this->countQuery;\n\t\t}\n\n\t\tif ($this->searchTerm !== null && $this->searchFields === null) {\n\t\t\t$fields = $this->getFields();\n\t\t\t$searchFields = array();\n\t\t\tforeach ($fields as $field) {\n\t\t\t\t$searchFields[] = $field['name'];\n\t\t\t}\n\t\t} else {\n\t\t\t$searchFields = null;\n\t\t}\n\n\t\t$query = clone $this;\n\t\t$query->resetFields();\n\t\t$query->resetLimit();\n\t\t$query->resetOrderBy();\n\t\t$query->field('COUNT(*)', 'total');\n\n\t\tif ($searchFields !== null) {\n\t\t\t$query->setSearchFields($searchFields);\n\t\t}\n\n\t\treturn $query;\n\t}",
"public function composeCountQuery()\n\t{\n\t\t$query = '';\n\n\t\tif (!empty($this->group)) {\n\t\t\t// if the query uses GROUP BY we have to call COUNT on sub-query\n\t\t\t$query .= 'SELECT COUNT( sub.' . $this->orm->getConfigDbPrimaryKey() . ') AS count\n\t\t\tFROM (SELECT ' . $this->orm->getConfigDbTable() . '.' . $this->orm->getConfigDbPrimaryKey() . '';\n\t\t} else {\n\t\t\t$query .= 'SELECT count(' . $this->orm->getConfigDbTable() . '.' . $this->orm->getConfigDbPrimaryKey() . ') AS count';\n\t\t}\n\n\t\t$query .= ' FROM ' . $this->orm->getConfigDbTable() . ' ';\n\n\t\tif (!empty($this->joinTables)) {\n\t\t\t$query .= ' ' . implode(' ', $this->joinTables);\n\t\t}\n\n\t\tif (!empty($this->search)) {\n\t\t\t$query .= ' WHERE ' . implode($this->imploder, $this->search);\n\t\t}\n\n\t\tif (!empty($this->group)) {\n\t\t\t$query .= ' GROUP BY ' . implode(', ', $this->group) . ') AS sub';\n\t\t}\n\n\t\treturn $query;\n\t}",
"public function count(Query $query): int;",
"protected function _performCount()\n {\n $query = $this->cleanCopy();\n $counter = $this->_counter;\n if ($counter) {\n $query->counter(null);\n\n return (int)$counter($query);\n }\n\n $complex = (\n $query->clause('distinct') ||\n count($query->clause('group')) ||\n count($query->clause('union')) ||\n $query->clause('having')\n );\n\n if (!$complex) {\n // Expression fields could have bound parameters.\n foreach ($query->clause('select') as $field) {\n if ($field instanceof ExpressionInterface) {\n $complex = true;\n break;\n }\n }\n }\n\n if (!$complex && $this->_valueBinder !== null) {\n $order = $this->clause('order');\n $complex = $order === null ? false : $order->hasNestedExpression();\n }\n\n $count = ['count' => $query->func()->count('*')];\n\n if (!$complex) {\n $query->getEagerLoader()->enableAutoFields(false);\n $statement = $query\n ->select($count, true)\n ->enableAutoFields(false)\n ->execute();\n } else {\n $statement = $this->getConnection()->newQuery()\n ->select($count)\n ->from(['count_source' => $query])\n ->execute();\n }\n\n $result = $statement->fetch('assoc')['count'];\n $statement->closeCursor();\n\n return (int)$result;\n }",
"function getCountSQL()\n{\n global $User;\n $listFilterSQL = $User->getListFilterSQL($this->moduleID);\n if(empty($this->countSQL)){\n if(empty($this->fromSQL)){\n $SQL = 'SELECT COUNT(*) FROM ('. $this->listSQL . $listFilterSQL . ') as row_count';\n } else {\n $SQL = 'SELECT Count(*) ' . $this->fromSQL . $listFilterSQL;\n }\n } else {\n $SQL = $this->countSQL . $listFilterSQL;\n }\n return $SQL;\n}",
"public function getCountQuery()\n {\n return $this->countQuery;\n }",
"public function getCountQuery()\n {\n return $this->countQuery;\n }",
"function getCount() {\n\t\t$where = (sizeof($this->wheres) > 0) ? ' WHERE '.implode(\" \\n AND \\n\\t\", $this->wheres) : '';\n\t\t$group = (sizeof($this->groups) > 0) ? ' GROUP BY '.implode(\", \", $this->groups) : '' ;\n\t\t$query = \"SELECT count(*) FROM \\n\\t\".$this->class->table.\"\\n \".implode(\"\\n \", $this->joins).$where.' '.$group.' ';\n\n\t\t$count =self::$global['dbCon']->fetchRow($query,MYSQLI_NUM);\n\t\treturn $count[0];\n\n\t}",
"public function getCount()\n {\n $dqlStr = $this->getQuery()->getDQL();\n $stmt = Connection::conn()->prepare(\"SELECT count(*) AS total FROM ({$this->getQuery()->getSQL()}) data\");\n $params = $this->getQuery()->getParameters();\n\n $orderParam = array();\n foreach ($params as $param) {\n /* @var $param \\Doctrine\\ORM\\Query\\Parameter */\n $orderParam[ strpos($dqlStr, \":{$param->getName()}\") ] = $param;\n }\n ksort($orderParam);\n\n $orderParamSorted = array_values($orderParam);\n foreach ($orderParamSorted as $index => $param) {\n $stmt->bindValue(1 + $index, $param->getValue(), $param->getType());\n }\n $stmt->execute();\n\n $row = $stmt->fetch();\n return (int) $row['total'];\n }",
"public function count($query = null)\n {\n return $this->_database->count($query->from($this->_name));\n }",
"protected function getCountQuery()\n {\n return $this->countQuery;\n }",
"public function toCount()\n {\n return $this->buildCountQuery($this->toQuery())->count();\n }",
"public function setCountQuery(SelectQueryInterface $query) {\n $this->customCountQuery = $query;\n }",
"public function count() {\n $queryId = $this->getQueryId('##count##');\n\n if ($this->willCacheResult) {\n $resultId = $this->getResultId($queryId);\n\n $cachedResult = $this->cache->getResult($resultId);\n if ($cachedResult) {\n return $cachedResult->getResult();\n }\n }\n\n $connection = $this->model->getMeta()->getConnection();\n\n $cachedQuery = $this->cache->getQuery($queryId);\n if (!$cachedQuery) {\n $statement = self::$queryParser->parseQueryForCount($this);\n\n $statementParser = $connection->getStatementParser();\n\n $sql = $statementParser->parseStatement($statement);\n $usedModels = $this->getUsedModels($statement);\n\n $cachedQuery = new QueryCacheObject($sql, $usedModels);\n\n $this->cache->setQuery($queryId, $cachedQuery);\n } else {\n $sql = $cachedQuery->getSql();\n $usedModels = $cachedQuery->getUsedModels();\n }\n\n $sql = $this->parseVariablesIntoSql($sql, $connection);\n\n $result = $connection->execute($sql);\n\n if ($result->getRowCount()) {\n $row = $result->getFirst();\n $result = $row[QueryParser::ALIAS_COUNT];\n } else {\n $result = 0;\n }\n\n if ($this->willCacheResult) {\n $cachedResult = new ResultCacheObject($result);\n\n $this->cache->setResult($resultId, $cachedResult, $usedModels);\n }\n\n return $result;\n }",
"public function count($query)\n {\n return $this->newQuery($query)->count();\n }",
"public function count()\n\t{\n\t\t// Get a \"count all\" query\n $db = $this->getDbo();\n\n $query = $this->buildQuery(true);\n\n $query->clear('select')->clear('order')->select('COUNT(*)');\n\n\t\t// Run the \"before build query\" hook and behaviours\n $this->triggerEvent('onBuildCountQuery', array(&$query));\n\n $total = $db->setQuery($query)->loadResult();\n\n\t\treturn $this->count = $total;\n\t}",
"public function getSelectCountSql()\n {\n $this->_renderFilters();\n\n $countSelect = $this->_getClearSelect()\n ->columns('COUNT(DISTINCT cpf'.$this->_storeId.'.entity_id)')\n ->resetJoinLeft();\n return $countSelect;\n }",
"public function build_count() {\n\t\t$this->validate_input();\n\n\t\t$tree = $this->sql_tree;\n\n\t\t$pagination_info = $this->make_pagination_info();\n\t\t// order is important here. The count transform puts everything within a subquery so it must go last\n\t\tif (!$this->ignore_filtering) {\n\t\t\t$tree = $this->filter_transform->alter($tree, $pagination_info);\n\t\t}\n\t\t$tree = $this->count_transform->alter($tree, $pagination_info);\n\n\t\t$creator = new PHPSQLCreator();\n\t\treturn $creator->create($tree);\n\t}",
"private function getCountFilteredResults()\n {\n $qb = $this->em->createQueryBuilder();\n $qb->select('count(distinct ' . $this->tableName . '.' . $this->rootEntityIdentifier . ')');\n $qb->from($this->metadata->getName(), $this->tableName);\n\n $this->setLeftJoin($qb);\n $this->setWhere($qb);\n $this->setWhereCallbacks($qb);\n\n return (int) $qb->getQuery()->getSingleScalarResult();\n }",
"public function count() {\n $this->_active_query->fields($this->func()->count());\n $query = $this->query( $this->_active_query->getQuery(), $this->_active_query->getParams() );\n return (int)$query->rowCount();\n }",
"public function getSelectCountSql()\n {\n $countSelect = clone $this->getSelect();\n $countSelect->reset(\\Magento\\Framework\\DB\\Select::ORDER);\n $countSelect->reset(\\Magento\\Framework\\DB\\Select::LIMIT_COUNT);\n $countSelect->reset(\\Magento\\Framework\\DB\\Select::LIMIT_OFFSET);\n $countSelect->reset(\\Magento\\Framework\\DB\\Select::GROUP);\n $countSelect->reset(\\Magento\\Framework\\DB\\Select::COLUMNS);\n $countSelect->columns(\"COUNT(*)\");\n\n return $countSelect;\n }"
]
| [
"0.8236581",
"0.75073904",
"0.74491024",
"0.6974801",
"0.6960284",
"0.6953397",
"0.6841704",
"0.68253005",
"0.6774736",
"0.67391455",
"0.671871",
"0.66467863",
"0.66311604",
"0.6607868",
"0.6573275",
"0.6573275",
"0.65619874",
"0.6540272",
"0.65218014",
"0.6519896",
"0.64956844",
"0.6477929",
"0.6464293",
"0.64636725",
"0.64378697",
"0.63901204",
"0.63817",
"0.637545",
"0.63279754",
"0.63067716"
]
| 0.7570678 | 1 |
Create a new suspension instance. | public static function create($siteXml) {
return new Chainr_Suspension($siteXml);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function &create($isNew = true)\t{\r\n\t\t$yogurt_suspensions = new yogurt_suspensions();\r\n\t\tif ($isNew) {\r\n\t\t\t$yogurt_suspensions->setNew();\r\n\t\t}\r\n\t\telse{\r\n\t\t$yogurt_suspensions->unsetNew();\r\n\t\t}\r\n\r\n\t\t\r\n\t\treturn $yogurt_suspensions;\r\n\t}",
"public function setSuspended($suspended)\n {\n $this->suspended = $suspended;\n\n return $this;\n }",
"public static function entering()\n {\n return new static(true, 'Entering sleep mode');\n }",
"public function run()\n {\n prodecyt::factory(50)->create();\n }",
"public static function create() {}",
"public static function create() {}",
"public static function create() {}",
"public function setSuspensionDate(DateTime $suspensionDate = null) {\n $this->suspensionDate = $suspensionDate;\n return $this;\n }",
"public function __construct($className = '') {\n\t\tif (self::$popServerInstance) {\n\t\t\tthrow new \\RuntimeException('An instance of PopServer already exists.', 1344504743);\n\t\t}\n\t\t$this->_className = 'PopServer';\n\t\t$this->_uuid = 'self';\n\t\treturn $this;\n\t}",
"public function run()\n {\n factory(Sponser::class, 5)->create();\n }",
"public static function create(): self\n {\n return new self();\n }",
"public static function create(): self\n {\n return new self();\n }",
"public function setSuspendPeriodUntil(?DateTime $suspendPeriodUntil): Card {\n $this->suspendPeriodUntil = $suspendPeriodUntil;\n return $this;\n }",
"public static function factory($id = null)\n {\n $profiler = new Profiler();\n if (true === $id) {\n $profiler->start(); \n } else if ($id) {\n $profiler->start($id);\n }\n \n return $profiler;\n }",
"public function load($suspend = false)\n {\n $tasks = $this->storage->get();\n\n $this->tasks = new SplPriorityQueue(); // clear queue\n\n foreach ($tasks as $task) {\n if ($suspend) {\n if (!$this->storage->suspend($task)) {\n throw new Exception('Can not suspend task in storage!');\n }\n }\n\n $this->tasks->insert($task, $task->getPriority());\n }\n\n return $this;\n }",
"public function create() {}",
"public function run()\n {\n ProfilSekolah::factory(1)->create();\n }",
"static function create(): self;",
"public function suspended()\n\t{\n\t\t$this->load->model('Common/Data_seed_m');\n\t\t$data = $this->Data_seed_m->suspended();\n\t\treturn $data;\n\t}",
"public static function create() {\n\t\treturn new self();\n\t}",
"public function createSlicer()\r\n {\r\n $config = Factory::createConfig();\r\n\r\n $slicer = new Slicer();\r\n $slicer->setConfig( $config );\r\n $slicer->setEventDispatcher( new EventDispatcher() );\r\n\r\n $slicer->setEventDispatcher( $slicer->getEventDispatcher() );\r\n\r\n $slicer->setUpdateManager( new UpdateManager( $config ) );\r\n $slicer->setDownloadManager( new DownloadManager( $config ) );\r\n $slicer->setBackupManager( new BackupManager( $config ) );\r\n $slicer->setInstallationManager( new InstallationManager( $config ) );\r\n\r\n $slicer->getUpdateManager()\r\n ->setDownloadManager( $slicer->getDownloadManager() )\r\n ->setEventDispatcher( $slicer->getEventDispatcher() );\r\n $slicer->getDownloadManager()\r\n ->setEventDispatcher( $slicer->getEventDispatcher() );\r\n $slicer->getBackupManager()\r\n ->setEventDispatcher( $slicer->getEventDispatcher() );\r\n $slicer->getInstallationManager()\r\n ->setEventDispatcher( $slicer->getEventDispatcher() );\r\n\r\n return $slicer;\r\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }",
"public static function create()\n {\n return new self();\n }"
]
| [
"0.5636146",
"0.53896976",
"0.5061295",
"0.50434285",
"0.50180405",
"0.50180405",
"0.50180405",
"0.47785947",
"0.47765917",
"0.47757822",
"0.4764693",
"0.4764693",
"0.47577292",
"0.47371763",
"0.47321606",
"0.47248885",
"0.47024676",
"0.47000733",
"0.46923143",
"0.4692069",
"0.4684187",
"0.46811962",
"0.46811962",
"0.46811962",
"0.46811962",
"0.46811962",
"0.46811962",
"0.46811962",
"0.46811962",
"0.46811962"
]
| 0.6807009 | 0 |
Register a new filter at the filterchain | public function registerFilter(Chainr_Filter $filter) {
$this->filterChain->register($filter);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function registerFilterChain()\n\t{\n\t\t//filters\n\t\t$this->filters['deserial'] = 'deserializationFilter';\n\t\t$this->filters['batch'] = 'batchProcessFilter';\n\t\t$this->filters['serialize'] = 'serializationFilter';\n\t}",
"public function addFilter(callable $filter);",
"public function register_filters() {\n\n\t\t}",
"public function register()\n {\n Filter::register();\n }",
"public function attachFilter($name = '', $filter) {\n $this->filters[$name] = new $filter;\n }",
"public function addFilter($filter) {\n $this->filters[] = $filter;\n $this->rewind();\n }",
"public static function register(): void\n {\n if (!in_array(self::FILTERNAME, stream_get_filters(), true)) {\n stream_filter_register(self::FILTERNAME, self::class);\n }\n }",
"public function addFilters()\n {\n }",
"public function addFilter(DFilter $filter) {\n\t\t$this->filters[] = $filter;\n\t}",
"function add_filters()\n {\n }",
"public function createFilter();",
"public function add()\n {\n foreach ($this->filters as $filter) {\n call_user_func_array($this->addCallback, $filter);\n }\n }",
"public function registerFilters()\n {\n foreach ($this->getFilters() as $filter) {\n try {\n $this->smarty->registerFilter($filter->getType(), $filter->getCallback());\n } catch (SmartyException $e) {\n if (null !== $this->logger) {\n $this->logger->warn(sprintf(\"SmartyException caught: %s.\", $e->getMessage()));\n }\n }\n }\n }",
"public function setFilter($filter){ }",
"public function addFilter(FilterInterface $filter) : void\n {\n $this->getLoader()->addFilter($filter);\n }",
"public function register()\n {\n $this->makeFilters();\n }",
"function mgd_register_filter($name, $function)\n{\n $GLOBALS['midgard_filters'][\"x{$name}\"] = $function;\n}",
"public function registerFilters() {\n//\t $this->addFilter('get_avatar', ['Chayka\\\\LinkedIn\\\\LinkedInHelper', 'filterGetLinkedInAvatar'], 10, 3);\n\t $this->addFilter('CommentModel.created', ['Chayka\\\\LinkedIn\\\\LinkedInHelper', 'filterMarkCommentWithLinkedInUserId']);\n\t $this->addFilter('pre_comment_approved', ['Chayka\\\\LinkedIn\\\\LinkedInHelper', 'filterApproveLinkedInUserComment'], 10, 2);\n\t\t/* chayka: registerFilters */\n }",
"public function addFilter(Swift_StreamFilter $filter, $key);",
"function register($metatype, callable $filefilter) {\n\t\tstatic::$filefilters[$metatype] = $filefilter;\n\t}",
"public function setFilter(string $filter);",
"private function addInputFilter()\n {\n $inputFilter = new InputFilter();\n $this->setInputFilter($inputFilter);\n\n }",
"public function addTestCaseFilter(TestCaseFilter $filter): void\n {\n $this->testCaseFilters[] = $filter;\n }",
"public function addFilter(\\NMC\\Migration\\FilterInterface $filter)\n {\n $this->filters[] = $filter;\n }",
"function add_filter($name, $callback, $priority = 10)\n{\n if ($pluginBroker = get_plugin_broker()) {\n $pluginBroker->addFilter($name, $callback, $priority);\n }\n}",
"public function add($name, $filter, array $options = []);",
"public function addFilter($type, $value);",
"protected function addFilter ()\n {\n global $database;\n\n if (defined('LEPTON_VERSION')) {\n // register the filter at LEPTON outputInterface\n if (! file_exists(WB_PATH . '/modules/output_interface/output_interface.php')) {\n throw new \\Exception('Missing LEPTON outputInterface, can\\'t register the kitFramework filter - installation is not complete!');\n } else {\n if (! function_exists('register_output_filter'))\n include_once (WB_PATH . '/modules/output_interface/output_interface.php');\n register_output_filter('kit_framework', 'kitFramework');\n }\n }\n elseif (defined('CAT_VERSION')) {\n // register the filter at the blackcatFilter\n require_once CAT_PATH.'/modules/blackcatFilter/filter.php';\n // first unregister to prevent trouble at re-install\n unregister_filter('kitCommands', 'kit_framework');\n // register the filter\n register_filter('kitCommands', 'kit_framework', 'Enable the usage of kitCommands within BlackCat');\n }\n else {\n if (version_compare(WB_VERSION, '2.8.3', '>=')) {\n // WebsiteBaker 2.8.3\n $filter_path = WB_PATH . '/modules/output_filter/index.php';\n } else {\n // all other WebsiteBaker versions\n $filter_path = WB_PATH . '/modules/output_filter/filter-routines.php';\n }\n if (file_exists($filter_path)) {\n if (! $this->websiteBakerIsPatched($filter_path)) {\n if (! $this->websiteBakerDoPatch($filter_path)) {\n throw new \\Exception('Failed to patch the WebsiteBaker output filter, please contact the support!');\n }\n }\n } else {\n throw new \\Exception('Can\\'t detect the correct method to patch the output filter, please contact the support!');\n }\n }\n return true;\n }",
"public function addFilter(Filter $filter, int $priority = 0): HttpHandler;",
"public function filter($filterChain);"
]
| [
"0.81039613",
"0.7609429",
"0.7591744",
"0.7407812",
"0.73641235",
"0.71312636",
"0.71222615",
"0.70693445",
"0.70623314",
"0.7014586",
"0.6945525",
"0.6840712",
"0.6708937",
"0.665934",
"0.66282296",
"0.6624293",
"0.6606865",
"0.65636563",
"0.65282106",
"0.65198267",
"0.64971596",
"0.6493364",
"0.6438827",
"0.64339983",
"0.6420757",
"0.641551",
"0.63999856",
"0.63468677",
"0.63352245",
"0.6332134"
]
| 0.80372554 | 1 |
List all table fields | public function list_fields() {
return $this->db->list_fields($this->_table());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getAllFields();",
"function getTableFields($table) {\n return $this->select(\"show fields from $table\");\n }",
"public function getListFields();",
"public function listFields($table)\r\n {\r\n return $this->fetchItems($this->query(\"SHOW FIELDS FROM $table\"), 0, 'row');\r\n }",
"public function getFields($table);",
"public function getFieldsList()\n {\n return $this->table_fields_names;\n }",
"public function fields();",
"public function fields();",
"public function fields();",
"public function fields();",
"public function fields();",
"private function _fields() {\n if ($this->_table() && empty($this->fields)) {\n $this->fields = $this->db->list_fields($this->_table());\n }\n return $this->fields;\n }",
"private function getAllTableFields()\n {\n $connection = $this->node->getConnection();\n $mainTable = $this->node->getMainTable();\n $fields = $connection->describeTable($mainTable);\n $metadataTable = $this->node->getTable('magento_versionscms_hierarchy_metadata');\n $fields += $connection->describeTable($metadataTable);\n\n return $fields;\n }",
"public static function getAllFields(): array\n {\n $className = get_called_class();\n $table = with(new $className)->getTable();\n $cache_key = self::$cache_prefix.'.ALLFIELDS.' . strtoupper($table);\n\n return self::$use_cache ? Cache::remember($cache_key, 5 * 60, function () use ($table) {\n return \\Schema::getColumnListing($table);\n }) : \\Schema::getColumnListing($table);\n }",
"public function getTableFields(){\n if(empty($this->tableFields)){\n $this->getTableInfo();\n }\n return $this->tableFields;\n }",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields();",
"public function getFields($table) {\n\t\treturn $this->_list_fields($table);\n\t}",
"function GetFieldsList($table)\n\t{\n\t\t$tbl = $this->Table($table);\n\t\treturn $tbl->GetFieldsList();\n\t}",
"function get_fields_in_table( ){\n\t\t\t\t $result = mysql_query(\"SHOW COLUMNS FROM \".$this->db.\".\".$this->table.\"\");\n\t\t\t\tif (!$result) {\n\t\t\t\t echo 'Could not run query: ' . mysql_error();\n\t\t\t\t exit;\n\t\t\t\t}\n\t\t\t\tif (mysql_num_rows($result) > 0) {\n\t\t\t\t while ($row = mysql_fetch_assoc($result)) {\n\t\t\t\t \n\t\t\t\t //$a_fields[]=$row;\n\t\t\t\t $a_fields[]=$row['Field'].\" | \".$row['Type'];\n\t\t\t\t \n\t\t\t\t }\n\t\t\t\t}\n\t\t\t\treturn $a_fields;\n\t\t\t }",
"protected function fetch_fields()\n {\n if(empty($this->table_fields))\n {\n $fields = $this->_database->list_fields($this->table);\n foreach ($fields as $field) {\n $this->table_fields[] = $field;\n }\n }\n }",
"static function custom_get_creatable_fields() {\n # use this functionality to get a list of all field in the table\n return self::default_get_updatable_fields();\n }",
"public function getAllFields()\n {\n return $this->fields;\n }",
"public function listFields()\n\t{\n\t\treturn array('id' => 'ID', 'title' => 'Title', 'estimated' => 'Estimated', 'status' => 'Status', 'getPercentageComplete' => 'Percentage Complete');\n\t}",
"public function getAllFields() {\n\t\t\t// Database Connection\n\t\t\t$db\t\t\t\t= $GLOBALS['db_q'];\n\t\t\t// Initialize variables\n\t\t\t$return\t\t\t= false;\n\t\t\t// Query set up\t\n\t\t\t$table\t\t\t= 'tb_field';\n\t\t\t$select_what\t= 'id, vc_field AS vc_name';\n\t\t\t$conditions\t\t= \"1 ORDER BY vc_field ASC\";\n\t\t\t$return\t\t\t= $db->getAllRows_Arr($table, $select_what, $conditions);\n\t\t\t// Return\n\t\t\treturn $return;\n\t\t}",
"public function fetchFields();"
]
| [
"0.82170165",
"0.79293627",
"0.78464794",
"0.7735504",
"0.76905555",
"0.7637615",
"0.7621922",
"0.7621922",
"0.7621922",
"0.7621922",
"0.7621922",
"0.7597616",
"0.7456968",
"0.74427027",
"0.73818773",
"0.7363267",
"0.7363267",
"0.7363267",
"0.7363267",
"0.7363267",
"0.7363267",
"0.7326283",
"0.73084915",
"0.72210896",
"0.7218584",
"0.7201088",
"0.7182192",
"0.71338254",
"0.7130305",
"0.71041703"
]
| 0.81246734 | 1 |
Retrieve and generate a dropdownfriendly array of the data in the table based on a key and a value. | public function dropdown() {
$args = func_get_args();
if (count($args) == 2) {
list($key, $value) = $args;
} else {
$key = $this->primary_key;
$value = $args[0];
}
$this->_callbacks('before_get', array($key, $value));
if ($this->result_mode == 'object') {
$result = $this->db->select(array($key, $value))->get($this->_table())->result();
$options = array();
foreach ($result as $row) {
$row = $this->_callbacks('after_get', array($row));
$options[$row->{$key}] = $row->{$value};
}
} else {
$result = $this->db->select(array($key, $value))->get($this->_table())->result_array();
$options = array();
foreach ($result as $row) {
$row = $this->_callbacks('after_get', array($row));
$options[$row[$key]] = $row[$value];
}
}
return $options;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function drop_down()\n\t{\n\t\t$args = func_get_args();\n\n\t\tif(count($args) == 2)\n\t\t{\n\t\t\tlist($key, $value) = $args;\n\t\t}\n\t\telse {\n\t\t\t$key = $this->primary_key;\n\t\t\t$value = $args[0];\n\t\t}\n\n\t\t$this->trigger('before_dropdown', array($key, $value));\n\n\t\t$result = $this->db->select(array($key, $value))\n\t\t\t\t\t\t ->get($this->_table)\n\t\t\t\t\t\t ->result();\n\n\t\t$options = array();\n\n\t\tforeach($result as $row) \n\t\t{\n\t\t\t$options[$row->{$key}] = $row->{$value};\n\t\t}\n\n\n\t\t$options = $this->trigger('after_dropdown', $options);\n\n\t\treturn $options;\n\t}",
"function get_dropdown_array($value){\n $result = array();\n $array_keys_values = $this->db->query('select Kode, '.$value.' from karyawan order by Kode asc');\n $result[0]=\"-- Pilih Urutan Kode --\";\n foreach ($array_keys_values->result() as $row)\n {\n $result[$row->Kode]= $row->$value;\n }\n return $result;\n }",
"function get_dropdown_array($value){\n $result = array();\n $array_keys_values = $this->db->query('select id, '.$value.' from purchase_transaction order by id asc');\n $result[0]=\"-- Pilih Urutan id --\";\n foreach ($array_keys_values->result() as $row)\n {\n $result[$row->id]= $row->$value;\n }\n return $result;\n }",
"function classic_dropdown($table, $option, $key, $value, $where){\n //Lets Put Little Checks On Required Parameters\n if(!isset($table) || empty($table)){\n return false;\n }\n if(!isset($option) || empty($option)){\n return false;\n }\n if(!isset($key) || empty($key)){\n return false;\n }\n if(!isset($value) || empty($value)){\n return false;\n }\n\n $this->db->select('*');\n $this->db->from($table);\n if($where !== ''){\n $this->db->where($where);\n }\n $query = $this->db->get();\n if($query->num_rows() > 0)\n {\n $data[''] = $option;\n foreach($query->result() as $row)\n {\n $data[$row->$key] = $row->$value;\n }\n return $data;\n }\n }",
"public function dropdown_wd_option($table, $option, $key, $value, $where)\n {\n $this->db->select('*');\n $this->db->where($where);\n $query = $this->db->get($table);\n\n if($query->num_rows() > 0)\n {\n $data[''] = $option;\n foreach($query->result() as $row)\n {\n $data[$row->$key] = $row->$value;\n }\n return $data;\n }\n }",
"public function get_drop_down( $query, $key, $value, $name,$defaultname='' )\n\t{\n //echo $defaultname;\n\t\t$query \t\t= $this->db->query($query);\n\t\t$records = $query->result_array(); //array of arrays\n\t\t\n\t\tif($defaultname=='')\n $data=array(\"\"=>\"SELECT \".$name.\" \");\n else\n $data=array(\"\"=>$defaultname);\n\t\t\n\t\t\n\t\tforeach ($records as $row)\n \t{\n \t$data[ $row[$key] ] = $row[ $value ];\n \t}\n \t\n\t\treturn $data;\n\t}",
"function build_table_drop_down() {\n\t$output = array();\n\t$output[] = array('id' => '', 'text' => TEXT_SELECT);\n\t$output[] = array('id' => 'step', 'text' => 'Step');\n\t$output[] = array('id' => 'task_name', 'text' => 'Task Name');\n\t$output[] = array('id' => 'description', 'text' => 'Task Description');\n\t$output[] = array('id' => 'mfg', 'text' => 'Mfg');\n\t$output[] = array('id' => 'qa', 'text' => 'QA');\n\t$output[] = array('id' => 'complete', 'text' => 'Complete');\n\t$output[] = array('id' => 'data_entry', 'text' => 'Data Entry Req');\n\treturn $output;\n }",
"public function dropdown_tree() {\n $args = func_get_args();\n list($key, $value, $parent) = $args;\n\n $result = $this->db->select(array($key, $value, $parent))->get($this->_table())->result();\n\n $options = array();\n foreach ($result as $row) {\n $options[] = array(\n 'id'=>$row->{$key},\n 'name'=>$row->{$value},\n 'parent'=>$row->{$parent},\n );\n }\n return $options;\n }",
"function get_option_list($table,$col_id,$col_value,$sel=0)\n{\n\t$db = mysqli_connect(\"localhost\",\"root\",\"\",\"cinema\") or die(mysql_error());\n\t$sql=\"SELECT * FROM $table order by $col_id\";\n\t$rs=mysqli_query($db,$sql) or die(mysql_error());\n\t$option_list=\"<option></option>\";\n\twhile($data=mysqli_fetch_assoc($rs))\n\t{\n\t\t$option_list.=\"<option value='$data[$col_value]'>$data[$col_value]</option>\";\n\t}\n\treturn $option_list;\n\n}",
"function getCombo( $table, $values, $titles, $where='' ) {\r\n\t\r\n\tglobal $site, $db;\r\n\t\r\n\tif ( $where == '' )\r\n\t\t$where = \"site_key='$site'\";\r\n\t\t\r\n\t$items = $db->getAll( \"select $values, $titles from $table where $where\" );\r\n\t\r\n\t$aValues = array();\r\n\t$aTitles = array();\r\n\t\r\n\tif ( is_array( $items ) && count( $items ) ) {\r\n\t\tforeach ( $items as $idx=>$item ) {\r\n\t\t\t$aValues[] = $item[$values];\r\n\t\t\t$aTitles[] = $item[$titles];\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn array( $aValues, $aTitles );\r\n}",
"function get_drop_array($db,$key,$value){\n $result = array();\n $array_keys_values = $this->db->query('select '.$key.','.$value.' from '.$db.' order by '.$key.' asc');\n $result[0]=\"-- Pilih \".$value.\" --\";\n foreach ($array_keys_values->result() as $row)\n {\n $result[$row->$key]= $row->$value;\n }\n return $result;\n }",
"function get_drop_array($db,$key,$value){\n $result = array();\n $array_keys_values = $this->db->query('select '.$key.','.$value.' from '.$db.' order by '.$key.' asc');\n $result[0]=\"-- Pilih \".$value.\" --\";\n foreach ($array_keys_values->result() as $row)\n {\n $result[$row->$key]= $row->$value;\n }\n return $result;\n }",
"function getFieldOptions($table, $keyField, $labelField) {\n $query = db_select($table, 'tbl');\n $query->addField('tbl', $keyField, 'key_field');\n $query->addField('tbl', $labelField, 'label');\n return $query->execute()->fetchAllKeyed();\n }",
"public function _get_picker_dropdown_choices() {\n\t\t$this->load_data();\n\t\t$result = array();\n\t\tforeach ( $this->data as $unique_key => $item ) {\n\t\t\t$result[ $unique_key ] = $item['label'];\n\t\t}\n\n\t\treturn $result;\n\t}",
"public function getSelectDataFields();",
"public function select_list($key = '_id',$val = NULL)\n {\n if($val === NULL)\n {\n $val = $key;\n $key = NULL;\n }\n\n $list = array();\n\n foreach($this->cursor() as $data)\n {\n if($key !== NULL)\n {\n $list[(string) $data[$key]] = (isset($data[$val]) ? $data[$val] : NULL);\n }\n else if(isset($data[$val]))\n {\n $list[] = $data[$val];\n }\n }\n\n return $list;\n }",
"function dropdown_teknisi()\n { \n //Query untuk mengambil data user yang memiliki level 'Technician'\n $query = $this->db->query(\"SELECT A.username, B.nama FROM user A LEFT JOIN karyawan B ON B.nik = A.username WHERE A.level = 'Technician'\");\n\n //Value default pada dropdown\n $value[''] = '-- CHOOSE --';\n //Menaruh data user teknisi ke dalam dropdown, value yang akan diambil adalah value id_user yang memiliki level 'Technician'\n foreach ($query->result() as $row) {\n $value[$row->username] = $row->nama;\n }\n return $value;\n }",
"function arr2arr($arr, $keyfield = 'id', $valuefield = 'name', $select = '') {\n $output = array();\n foreach ($arr as $row) {\n $key = lavnn($keyfield, $row, '');\n $value = lavnn($valuefield, $row, '');\n if ($key != '' && $value != '') {\n $output[$key] = array(\"key\" => $key, \"value\" => $value);\n if ($select != '' && $key == $select) {\n $output[$key][\"selected\"] = 'selected';\n }\n }\n }\n return $output;\n}",
"public static function vueDropdown($array, $key, $value)\n {\n $response_array = [];\n if ($array) {\n foreach ($array as $array_key => $array_value) {\n $response_array[] = [\n 'id' => $array_value[$key],\n 'name' => $array_value[$value],\n ];\n }\n }\n\n return $response_array;\n }",
"function get_dropdown_list() {\n\t\t$this->db->from('tag');\n\t\t$this->db->order_by('tag_id');\n\t\t$result = $this->db->get();\n\t\t$return = array();\n\t\tif($result->num_rows() > 0) {\n\t\t\tforeach($result->result_array() as $row) {\n\t\t\t\t$return[$row['tag_id']] = $row['tag_title'];\n\t\t\t}\n\t\t}\n\t\treturn $return;\n\t}",
"function createSelect($name, $keys, $values, $keyIndex)\n {\n echo \"<select name=\\\"\",$name,\"\\\">\\n\";\n \n $nbValues=count($values);\n for ($i=0;$i<$keyIndex;$i++) {\n echo \"<option value=\\\"\",$keys[$i],\"\\\">\",$values[$i],\"</option>\\n\";\n }\n if ($keyIndex>-1)\n echo \"<option value=\\\"\",$keys[$i],\"\\\" selected='true'>\",$values[$i],\"</option>\\n\";\n else\n $i==-1;\n for ($i++;$i<$nbValues;$i++) {\n echo \"<option value=\\\"\",$keys[$i],\"\\\">\",$values[$i],\"</option>\\n\";\n }\n echo \"</select>\\n\";\n }",
"function to_name_array($value_field = null, $key_field = null) {\n\t\t$result = array();\n\n\t\t$this->reset();\n\n\t\twhile($option = $this->next()) {\n\t\t\tif (is_null($value_field)) {\n\t\t\t\t$value_field = $option->name_field;\n\t\t\t}\n\n\t\t\tif (is_null($key_field)) {\n\t\t\t\t$key_field = 'id';\n\t\t\t}\n\n\t\t\t$result[$option->get($key_field)] = $option->get($value_field);\n\t\t}\n\n\t\t$this->reset();\n\n\t\treturn $result;\n\n\t}",
"function get_data($value) {\n $select = array(\n 'employe_table_id',\n 'employe_table_employe_id',\n 'employe_table_employe_name'\n );\n $this->db->select($select);\n $this->db->order_by('employe_table_employe_name', 'ASC');\n $this->db->where('employe_table_employe_status',1);\n $data['tl'] = $this->db->get_where('employe_table', array('employe_table_employe_hierarchy' => 6))->result_array();\n $data['dse'] = $this->db->get_where('employe_table', array('employe_table_employe_hierarchy' => 7))->result_array();\n $data['asm'] = $this->db->get_where('employe_table', array('employe_table_employe_hierarchy' => 5))->result_array();\n return $data;\n }",
"public function gen_dd_array()\n {\n $vec = array();\n if($result = $this->get($this->_table) )\n {\n foreach($result as $reg)\n { \n $vec[$reg->id] = $reg->name;\n }\n }\n return $vec;\n }",
"function get_select($parent = NULL, $nothing_value = NULL)\n\t{\n \t\t$data = array();\n\t\t\n\t\tif ( ! is_null($nothing_value))\n\t\t\t$data = array('' => $nothing_value);\n\n\t\tif ( ! is_null($parent))\n\t\t\t$this->{$this->db_group}->where('parent', $parent);\n\n \t\t$this->{$this->db_group}->order_by('ordering', 'ASC');\n\t\t\t\n\t\t$query = $this->{$this->db_group}->get($this->table);\n\n\t\tif($query->num_rows() > 0)\n\t\t{\n\t\t\t$result = $query->result_array();\n\t\t\t\n\t\t\tforeach($result as $item)\n\t\t\t{\n\t\t\t\t$data[$item['id_type']] = $item['title'];\n\t\t\t}\n\t\t}\t\t\t\n\n\t\treturn $data;\n\t}",
"function create_db_combo($tblname, $key_field, $value_field, $order_field, $additional_value='-Plese Select-', $param=''){\n $ci =& get_instance();\n //load databse library\n $ci->load->database();\n\n $ci->db->from($tblname);\n if($param!=''){\n $ci->db->where($param);\n }\n $ci->db->order_by($order_field);\n $result = $ci->db->get();\n\n $dd[''] = $additional_value ;\n if ($result->num_rows() > 0){\n foreach ($result->result() as $row) {\n $dd[$row->$key_field] = $row->$value_field;\n }\n }\n return $dd;\n }",
"function getOptionValues() {\t\t\n\t\t$optionvaluesquery = \"SELECT lv.lookuptypevalue as optiontext, lv.lookuptypevalue as optionvalue FROM lookuptype AS l , \n\t\tlookuptypevalue AS lv WHERE l.id = lv.lookuptypeid AND l.name ='\".$this->getName().\"' ORDER BY optiontext \";\n\t\treturn getOptionValuesFromDatabaseQuery($optionvaluesquery);\n\t}",
"public function get_table_field_selector()\n {\n $input = JFactory::getApplication()->input;\n\n $response = array();\n $table = $input->get('table');\n $fieldName = $input->get('field_name');\n\n if( ! $table)\n {\n $response['text'] = '';\n }\n else\n {\n $db = JFactory::getDBO();\n $dbTables = $db->getTableList();\n $dbPrefix = $db->getPrefix();\n\n if( ! in_array($dbPrefix.$table, $dbTables))\n {\n $response['text'] = 'Invalid table';\n }\n else\n {\n $fields = $db->getTableFields($dbPrefix.$table);\n\n $fields = $fields[$dbPrefix.$table];\n\n $out = '';\n $out .= '<select name=\"'.$fieldName.'\">';\n $out .= '<option value=\"\">'.jgettext('Select...').'</option>';\n\n foreach(array_keys($fields) as $fieldName)\n {\n $out .= '<option>'.$fieldName.'</option>';\n }\n\n $out .= '</select>';\n $response['text'] = $out;\n $response['status'] = 1;\n }\n }\n\n echo json_encode($response);\n\n jexit();\n }",
"static function get_dropdown_options()\n {\n $rows = ORM::factory('actor')->where('parent_id=0')->orderby('actor')->find_all();\n \n foreach ($rows as $row){\n $hijos = array();\n $_t = ORM::factory('actor')->where('parent_id',$row->id)->orderby('actor')->select_list('id','actor');\n\n foreach($_t as $_id => $_n) {\n\n $_hijos = ORM::factory('actor')->where('parent_id',$_id)->orderby('actor')->select_list('id','actor');\n $hijos[] = array('id' => $_id, 'n' => $_n, 'h' => $_hijos);\n \n /* \n foreach($_hijos as $_idn => $_nn) {\n $_h[] = array('id' => $_idn, 'n' => $_nn, 'h' => ORM::factory('actor')->where('parent_id',$_idn)->select_list('id','actor'));\n }\n \n $hijos[] = array('id' => $_id, 'n' => $_n, 'h' => $_h);\n */\n }\n \n $opts[] = array('id' => $row->id, 'n' => $row->actor, 'h' => $hijos);\n }\n return $opts;\n }",
"function SelectValuesSeguros_Empresas($db_conx, $table) {\r\n $sql = \"\";\r\n if ($table == \"seguros\") {\r\n $sql = \"SELECT * FROM tseguros ORDER BY seg_descrip ASC\";\r\n } else {\r\n $sql = \"SELECT * FROM tempresas ORDER BY emp_descrip ASC\";\r\n }\r\n $query = mysqli_query($db_conx, $sql);\r\n\r\n $n_filas = $query->num_rows;\r\n $data = '<select size=\"12\" class=\"cmb' . $table . '\" id=\"cmb' . $table . '\">\r\n <option value=\"\">Ninguno</option>';\r\n $c = 0;\r\n while ($c < $n_filas) {\r\n $row = mysqli_fetch_array($query);\r\n $data .= '<option value=\"' . $row[0] . '\">' . $row[1] . \"_\" . $row[2] . '</option>';\r\n $c++;\r\n }\r\n $data .= '</select>';\r\n echo $data;\r\n}"
]
| [
"0.7465868",
"0.7340904",
"0.7305427",
"0.70666003",
"0.69728434",
"0.65550053",
"0.6554254",
"0.6271945",
"0.6227102",
"0.61971086",
"0.616585",
"0.616585",
"0.6155632",
"0.61116415",
"0.6094811",
"0.6063492",
"0.6043429",
"0.6014441",
"0.5925427",
"0.59198546",
"0.5912233",
"0.5911812",
"0.5911371",
"0.59100217",
"0.5894611",
"0.5880661",
"0.58699757",
"0.58596945",
"0.5851123",
"0.58127314"
]
| 0.77348036 | 0 |
Sets WHERE depending on the number of parameters, has 4 modes: 1. ($id) primary key value mode 2. (array("name"=>$name)) associative array mode 3. ("name", $name) custom key/value mode 4. ("id", array(1, 2, 3)) where in mode | private function _set_where($params) {
if (count($params) == 1) {
if (!is_array($params[0]) && !strstr($params[0], "'")) {
$this->db->where($this->primary_key, $params[0]); // 1.
} else {
$this->db->where($params[0]); // 2.
}
} elseif (count($params) == 2) {
if (is_array($params[1])) {
$this->db->where_in($params[0], $params[1]); // 4.
} else {
$this->db->where($params[0], $params[1]); // 3.
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function where()\n {\n $args = func_get_args();\n $count = count($args);\n \n if ($count == 1) {\n if (is_array($args[0])) {\n # This is expected to be a column => value associated array.\n # In this case, the array is stored as is.\n $this->where[] = $args[0];\n } else {\n # This is expected to be a string.\n $this->where[] = $args[0];\n }\n } elseif ($count) {\n # Case: $query->where(\"foo\", true, \"bar_baz\", $bar);\n if ($count >= 2 && is_int($count / 2) && (!is_array($args[1]) || Toolbox\\ArrayTools::isIndexed($args[1])) && is_bool(strpos($args[0], ' '))) {\n $where = [];\n foreach ($args as $key => $value) {\n $key++;\n if ($key && !($key % 2)) {\n $where[$next_key] = $value;\n } else {\n $next_key = $value;\n }\n }\n $this->where[] = $where;\n } else {\n $this->where[] = array_shift($args);\n \n # Case: $query->where('foo => :foo', ['foo' => $foo]);\n if ($count == 2 && is_array($args[0]) && !Toolbox\\ArrayTools::isIndexed($args[0]))\n $args = $args[0];\n \n if ($args)\n $this->where_params = array_merge($this->where_params, $args);\n }\n }\n return $this;\n }",
"public function where() {\r\n\t\t$args = func_get_args();\r\n\t\t$expr = array_shift($args);\r\n\t\tarray_push($this->_wheres, '(' . $this->_parameterize($expr, $args) . ')');\r\n\t\t$this->_dirty = true;\r\n\t}",
"public function where($arr){//ex of $arr : ['name' => 'LIKE A%','email' => '= [email protected]']\n $c = \"\";\n $x = 0;\n foreach($arr as $key => $v){//for each param, translate to SQL language\n if($x != 0){\n $c .= \" AND\";\n }\n $x++;\n $c .= \" $key $v\";\n }\n $this->params[\"WHERE\"] = $c;//adding the conditions to the query\n return $this;\n }",
"Private function where($tableName,array $conditions,array $options = array()){\n\t\tif(empty ($options))$options = array('prepend' => true ,'join' => ' AND ');\n\t\tif(!isset($options['join'])) $options['join'] = ' AND ';\n\t\t$ops = $this->_operators;\n\t\t$schema = $this->schema[$tableName];\n\t\t$conditions = $this->addSlashesDeep($conditions);\n\t\tswitch (true) {\n\t\t\tcase empty($conditions):\n\t\t\t\treturn '';\n\t\t\tcase is_string($conditions):\n\t\t\t\treturn ($options['prepend']) ? \" WHERE {$conditions}\" : $conditions;\n\t\t\tcase !is_array($conditions):\n\t\t\t\treturn '';\n\t\t}\n\t\t$result = array();\n\n if(count($conditions) > 0 && count($schema) > 0){\n foreach ($conditions as $key => $value) {\n $schema[$key] = isset($schema[$key]) ? $schema[$key] : array();\n switch (true) {\n case strtolower($key) == 'or':\n case strtolower($key) == 'and':\n $result[] = $this->where($tableName,$value,array('prepend' => FALSE,'join' => \" {$key} \"));\n break;\n case (is_numeric($key) && is_array($value)):\n $result[] = $this->where($tableName,$value,array('prepend' => FALSE));\n break;\n case (is_numeric($key) && is_string($value)):\n $result[] = $value;\n break;\n case (is_string($key) && is_array($value) && isset($ops[key($value)])):\n foreach ($value as $op => $val) {\n $result[] = $this->_operator($tableName,$key, array($op => $val), $schema[$key]);\n }\n break;\n case (is_string($key) && is_array($value)):\n $value = join(', ', $this->value($value, $schema[$key]));\n $result[] = \"{$tableName}.{$key} IN ({$value})\";\n break;\n case (is_string($key) && is_string($value) && strpos($value,'%') !== FALSE):\n if(array_key_exists ($key,$this->schema[$tableName])){\n $result[] = \"{$tableName}.{$key} LIKE '{$value}'\";\n }\n else{\n $result[] = \"{$key} LIKE '{$value}'\";\n }\n //$result[] = \"{$tableName}.{$key} LIKE '{$value}'\";\n break;\n default:\n $value = $this->value($value, $schema[$key]);\n $result[] = $tableName.\".\".$key.\" = \".$value;\n break;\n }\n }\n }\n\n\t\tif(count($result)>1){\n\t\t\t$result = \"(\".join($options['join'], $result).\")\";\n\t\t}else{\n\t\t\t$result = join($options['join'], $result);\n\t\t}\n\t\treturn ($options['prepend'] && !empty($result)) ? \"WHERE {$result}\" : $result;\n\t}",
"abstract public function where(array $where);",
"public function condition()\n {\n $op = $this->getDefaultOperator();\n $params = func_get_args();\n \n switch (count($params)) {\n case 1:\n if (is_string($params[0])) {\n $this->addCondition('literal', [$params[0]]);\n } elseif (is_array($params[0])) {\n $combination = $this->getDefaultOperator();\n \n /**\n * The code within the foreach is an extraction of Zend\\Db\\Sql\\Select::where()\n */\n foreach ($params[0] as $pkey => $pvalue) {\n if (is_string($pkey) && strpos($pkey, '?') !== false) {\n # ['id = ?' => 1]\n # ['id IN (?, ?, ?)' => [1, 3, 4]]\n $predicate = new ZfPredicate\\Expression($pkey, $pvalue);\n } elseif (is_string($pkey)) {\n if ($pvalue === null) {\n # ['name' => null] -> \"ISNULL(name)\"\n $predicate = new ZfPredicate\\IsNull($pkey, $pvalue);\n } elseif (is_array($pvalue)) {\n # ['id' => [1, 2, 3]] -> \"id IN (1, 2, 3)\"\n $predicate = new ZfPredicate\\In($pkey, $pvalue);\n } else {\n # ['id' => $id] -> \"id = 15\"\n $predicate = new ZfPredicate\\Operator($pkey, ZfPredicate\\Operator::OP_EQ, $pvalue);\n }\n } elseif ($pvalue instanceof ZfPredicate\\PredicateInterface) {\n $predicate = $pvalue;\n } else {\n # ['id = ?'] -> \"id = ''\"\n # ['id = 1'] -> literal.\n $predicate = (strpos($pvalue, Expression::PLACEHOLDER) !== false)\n ? new ZfPredicate\\Expression($pvalue) : new ZfPredicate\\Literal($pvalue);\n }\n $this->getCurrentPredicate()->addPredicate($predicate, $combination);\n }\n }\n break;\n \n case 2:\n # $rel->where('foo = ? AND id IN (?) AND bar = ?', [true, [1, 2, 3], false]);\n # If passing a non-array value:\n # $rel->where('foo = ?', 1);\n # But if an array is to be passed, must be inside another array\n # $rel->where('id IN (?)', [[1, 2, 3]]);\n if (!is_array($params[1])) {\n $params[1] = [$params[1]];\n }\n $this->expandPlaceholders($params[0], $params[1]);\n $this->addCondition('expression', [$params[0], $params[1]]);\n break;\n \n case 3:\n # $rel->where('id', '>', 2);\n $this->getCurrentPredicate()->addPredicate(\n new ZfPredicate\\Operator($params[0], $params[1], $params[2])\n );\n break;\n \n default:\n throw new Exception\\BadMethodCallException(\n sprintf(\n \"One to three arguments are expected, %s passed\",\n count($params)\n )\n );\n }\n \n return $this;\n }",
"public function whereArray($wheres){\r\n\t\tforeach($wheres as $k => $v){\r\n\t\t\t$this->where(\"`$k`=?\", $v);\r\n\t\t}\r\n\t}",
"public function set_where(array $params) {\n $where = '';\n foreach ($params as $field_name => $field_value) {\n $where .= '`' . $field_name . '` = \\'' . $field_value . '\\' AND ';\n }\n\n $where = rtrim($where, ' AND ');\n $this->where = ' WHERE ' . $where;\n }",
"public function andWhere() {\r\n\t\t$args = func_get_args();\r\n\t\t$statement = array_shift($args);\r\n\t\t//if ( (count($args) == 1) && (is_null($args[0])) ) {\r\n\t\t//\t$this->_wheres = array();\r\n\t\t//\treturn null;\r\n\t\t//}\r\n\t\t$criteria = new Dbi_Sql_Criteria($this, new Dbi_Sql_Expression($statement, $args));\r\n\t\t$this->_wheres[] = $criteria;\r\n\t\treturn $criteria;\r\n\t}",
"function dbWhereVars() {\n\n foreach ($this->fields() as $f) {\n if ($this->$f === false) continue;\n $this->db->where($this->model.'.'.$f,$this->$f);\n }\n\n }",
"public function where()\n {\n $args = func_get_args();\n $num_args = count($args);\n \n // Custom queries\n if ( $num_args == 2 && is_array($args[1]) )\n {\n $this->where = $args[0];\n $this->params = $args[1];\n }\n else\n {\n // AND equality condition\n if ( $num_args == 2 )\n {\n list($field, $value) = $args;\n $op = '=';\n }\n // AND with custom operation condition\n else\n {\n list($field, $op, $value) = $args;\n }\n $this->appendWhere('AND', $field, $op, $value); \n }\n return $this;\n }",
"public static function where(array $where);",
"function where( ...$getwherekeys) { \n $whereorhaving = ($this->iswhere) ? 'WHERE' : 'HAVING';\n $this->iswhere = true;\n \n\t\tif (!empty($getwherekeys)){\n\t\t\tif (is_string($getwherekeys[0])) {\n\t\t\t\tforeach ($getwherekeys as $makearray) \n\t\t\t\t\t$wherekeys[] = explode(' ',$makearray);\t\n\t\t\t} else \n\t\t\t\t$wherekeys = $getwherekeys;\t\t\t\n\t\t} else \n\t\t\treturn '';\n\t\t\n\t\tforeach ($wherekeys as $values) {\n\t\t\t$operator[] = (isset($values[1])) ? $values[1]: '';\n\t\t\tif (!empty($values[1])){\n\t\t\t\tif (strtoupper($values[1]) == 'IN') {\n\t\t\t\t\t$wherekey[ $values[0] ] = array_slice($values,2);\n\t\t\t\t\t$combiner[] = (isset($values[3])) ? $values[3]: _AND;\n\t\t\t\t\t$extra[] = (isset($values[4])) ? $values[4]: null;\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t$wherekey[ (isset($values[0])) ? $values[0] : '1' ] = (isset($values[2])) ? $values[2] : '' ;\n\t\t\t\t\t$combiner[] = (isset($values[3])) ? $values[3]: _AND;\n\t\t\t\t\t$extra[] = (isset($values[4])) ? $values[4]: null;\n\t\t\t\t}\t\t\t\t\n\t\t\t} else {\n $this->setParamaters();\n\t\t\t\treturn false;\n } \n\t\t}\n \n $where='1'; \n if (! isset($wherekey['1'])) {\n $where='';\n $i=0;\n $needtoskip=false;\n foreach($wherekey as $key=>$val) {\n $iscondition = strtoupper($operator[$i]);\n\t\t\t\t$combine = $combiner[$i];\n\t\t\t\tif ( in_array(strtoupper($combine), array( 'AND', 'OR', 'NOT', 'AND NOT' )) || isset($extra[$i])) \n\t\t\t\t\t$combinewith = (isset($extra[$i])) ? $combine : strtoupper($combine);\n\t\t\t\telse \n\t\t\t\t\t$combinewith = _AND;\n if (! in_array( $iscondition, array( '<', '>', '=', '!=', '>=', '<=', '<>', 'IN', 'LIKE', 'NOT LIKE', 'BETWEEN', 'NOT BETWEEN', 'IS', 'IS NOT' ) )) {\n $this->setParamaters();\n return false;\n } else {\n if (($iscondition=='BETWEEN') || ($iscondition=='NOT BETWEEN')) {\n\t\t\t\t\t\t$value = $this->escape($combinewith);\n\t\t\t\t\t\tif (in_array(strtoupper($extra[$i]), array( 'AND', 'OR', 'NOT', 'AND NOT' ))) \n\t\t\t\t\t\t\t$mycombinewith = strtoupper($extra[$i]);\n\t\t\t\t\t\telse \n $mycombinewith = _AND;\n\t\t\t\t\t\tif ($this->getPrepare()) {\n\t\t\t\t\t\t\t$where.= \"$key \".$iscondition.' '._TAG.\" AND \"._TAG.\" $mycombinewith \";\n\t\t\t\t\t\t\t$this->setParamaters($val);\n\t\t\t\t\t\t\t$this->setParamaters($combinewith);\n\t\t\t\t\t\t} else \n\t\t\t\t\t\t\t$where.= \"$key \".$iscondition.\" '\".$this->escape($val).\"' AND '\".$value.\"' $mycombinewith \";\n\t\t\t\t\t\t$combinewith = $mycombinewith;\n\t\t\t\t\t} elseif ($iscondition=='IN') {\n\t\t\t\t\t\t$value = '';\n\t\t\t\t\t\tforeach ($val as $invalues) {\n\t\t\t\t\t\t\tif ($this->getPrepare()) {\n\t\t\t\t\t\t\t\t$value .= _TAG.', ';\n\t\t\t\t\t\t\t\t$this->setParamaters($invalues);\n\t\t\t\t\t\t\t} else \n\t\t\t\t\t\t\t\t$value .= \"'\".$this->escape($invalues).\"', \";\n\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t$where.= \"$key \".$iscondition.\" ( \".rtrim($value, ', ').\" ) $combinewith \";\n\t\t\t\t\t} elseif(((strtolower($val)=='null') || ($iscondition=='IS') || ($iscondition=='IS NOT'))) {\n $iscondition = (($iscondition=='IS') || ($iscondition=='IS NOT')) ? $iscondition : 'IS';\n $where.= \"$key \".$iscondition.\" NULL $combinewith \";\n } elseif((($iscondition=='LIKE') || ($iscondition=='NOT LIKE')) && ! preg_match('/[_%?]/',$val)) return false;\n else {\n\t\t\t\t\t\tif ($this->getPrepare()) {\n\t\t\t\t\t\t\t$where.= \"$key \".$iscondition.' '._TAG.\" $combinewith \";\n\t\t\t\t\t\t\t$this->setParamaters($val);\n\t\t\t\t\t\t} else \n\t\t\t\t\t\t\t$where.= \"$key \".$iscondition.\" '\".$this->escape($val).\"' $combinewith \";\n\t\t\t\t\t}\n $i++;\n }\n }\n $where = rtrim($where, \" $combinewith \");\n }\n\t\t\n if (($this->getPrepare()) && !empty($this->getParamaters()) && ($where!='1'))\n\t\t\treturn \" $whereorhaving \".$where.' ';\n\t\telse\n\t\t\treturn ($where!='1') ? \" $whereorhaving \".$where.' ' : ' ' ;\n }",
"public function whereall() {\n\t\t\treturn 'id=id';\n\t\t}",
"public function getWhereClause() {\n\n\tif (isset($this->filters) && !empty($this->filters)) {\n\t\t// $aClause = array();\n\t\t// $aOperators = array();\n\t\t$sClause = '';\n\t switch ($this->type) {\n\t\tcase 0:\n\t\tcase 4:\n\t\tdefault:\n\t\t \n\t\t $aWhere = $this->getFilter($this->filters);\n\t\t if ($aWhere) {\n\t\t \t$i = 1;\n\t\t\t\tforeach ($aWhere as $key => $value) {\n\t\t\t\t // $this->model->where($key, $value);\n\t\t\t\t $sClause .= $key . ' = ' . $value . (count($aWhere) == $i++ ? '' : ' OR ');\n\t\t\t\t}\n\t\t }\n\t\t break;\n\t\tcase 1:\n\t\t $aWhere = $this->getLikeFilter($this->filters);\n\t\t if ($aWhere) {\n\t\t \t$i = 1;\n\t\t\t\tforeach ($aWhere as $key => $value) {\n\t\t\t\t // $this->model->where_like($key, $value);\n\t\t\t\t $sClause .= $key . ' LIKE ' . $value . (count($aWhere) == $i++ ? '' : ' OR ');\n\t\t\t\t}\n\t\t }\n\t\t break;\n\t\tcase 2:\n\t\t $aWhere = $this->getRangeFilter($this->filters);\n\t\t if ($aWhere) {\n\t\t \t$i = 1;\n\t\t\t\tforeach ($aWhere as $key => $value) {\n\t\t\t\t // $this->model->where_raw($key, $value);\n\t\t\t\t\t$sClause .= vsprintf(str_replace('?','%s',$key),$value) . (count($aWhere) == $i++ ? '' : ' OR ');\n\t\t\t\t}\n\t\t }\n\t\t break;\n\t\tcase 3:\n\t\t $aWhere = $this->getInFilter($this->filters);\n\t\t if ($aWhere) {\n\t\t \t$i = 1;\n\t\t\t\tforeach ($aWhere as $key => $value) {\n\t\t\t\t\t$sClause .= $key . ' IN (' . implode(',',$value) . ')' . (count($aWhere) == $i++ ? '' : ' OR ');\n\t\t\t\t // $this->model->where_in($key, $value);\n\t\t\t\t}\n\t\t }\n\t\t break;\n\t\tcase 5:\n\t\t $aWhere = $this->getInRawFilter($this->filters);\n\t\t if ($aWhere) {\n\t\t \t$i = 1;\n\t\t\t\tforeach ($aWhere as $key => $value) {\n\t\t\t\t // $this->model->where_raw($key, $value);\n\t\t\t\t\t$sClause .= vsprintf(str_replace('?','%s',$key),$value) . (count($aWhere) == $i++ ? '' : ' OR ');\n\t\t\t\t}\n\t\t }\n\t\t break;\n\t\tcase 6:\n\t\t $aWhere = $this->getDependendFilter($this->filters);\n\t\t if ($aWhere) {\n\t\t \t$i = 1;\n\t\t\t\tforeach ($aWhere as $key => $value) {\n\t\t\t\t // $this->model->where_raw($value, array());\n\t\t\t\t $sClause .= $value . (count($aWhere) == $i++ ? '' : ' OR ');\n\t\t\t\t}\n\t\t }\n\t\t break;\n\t }\n\t}\n\treturn $sClause;\n\t// return $this->model;\n }",
"public function whereIn()\n {\n list($field, $value) = $this->extractQueryToFieldAndValue(func_get_args());\n $this->_conditions[self::WHEREIN][$field] = [self::OPERATORS['in'] => $value];\n return $this;\n }",
"protected function setWhereFilters() : ApiGetService\n {\n if(count($this->where_filters) === 0){\n return $this;\n }\n\n // Traverse prepared filters\n foreach($this->where_filters as $column => $value){\n // {column}:{operator} = {value}\n $column_operator = preg_split('/[:\\s]+/', $column);\n\n // Split value by \" , \"\n $splited_value = preg_split('/[,]+/', $value);\n\n //... and if {value} is not scalar\n if(count($splited_value) > 1){\n // ... we know that we will have SQL IN operator in WHERE\n $in_operator = true;\n }\n // ... else we are good with simple \" = \"\n else{\n $in_operator = false;\n }\n\n // Depending on $in_operator, we know if we are using IN or =\n $this->builder\n ->when($in_operator ,\n // If it is true, we are using IN\n function ($query) use($column_operator, $splited_value){\n if(isset($column_operator[1]) && $column_operator[1] == \"eq\"){\n\n return $query->whereIn($column_operator[0], $splited_value);\n\n }elseif(isset($column_operator[1]) && $column_operator[1] == \"ne\"){\n\n return $query->whereNotIn($column_operator[0], $splited_value);\n\n }else{\n\n return $query->whereIn($column_operator[0], $splited_value);\n }\n },\n // Else, we are using scalar operators...\n function ($query) use($column_operator, $splited_value) {\n\n return $query->where($column_operator[0],\n ((isset($column_operator[1]) && $column_operator[1] != \"\") ? $this->api_operators[$column_operator[1]] : \"=\"),\n $splited_value[0]);\n });\n }\n\n return $this;\n }",
"public function where($clause, array $params);",
"protected function where($data, $conditional = false) {\n\n\t \t$fields = count($data);\n\t\t\t$i = 0;\n\n\t\t\t$this->_where = ' WHERE ';\n\n\t\t\tforeach ($data as $key => $value) {\n\t\t\t\t$newKey = ':'.$key;\n\t\t\t\tif ( $fields == 1) {\n\t\t\t\t\t$this->_where .= $key . ' = ' . $newKey;\n\t\t\t\t\t$this->_params[$newKey] = $value;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t$this->_params[$newKey] = $value;\n\t\t\t\t\tif ( $i+1 == $fields) {\n\t\t\t\t\t\t$this->_where .= $key . ' = ' . $newKey;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$cond = ($conditional) ? $conditional[$i] : 'AND';\n\t\t\t\t\t\t$this->_where .= $key . ' = ' . $newKey . ' ' . $cond . ' ';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$i++;\n\t\t\t}\n\t }",
"public function where($where=array())\n\t\t{\n\t\t\tif( is_array($where) && !empty($where)){\n\n\t\t\t\tforeach( $where as $k => $val ){\n\n\t\t\t\t\t// name = 'jack'\n\t\t\t\t\t// id > 1\n\t\t\t\t\t if( is_array($val) ){\n\n\t\t\t\t\t \t$type = $val[0];\n\n\t\t\t\t\t \tswitch($type){\n\t\t\t\t\t \t\tcase 'lt':\n\t\t\t\t\t \t\t\t$result[] = \"{$k} < {$val[1]} \";\n\t\t\t\t\t \t\t\tbreak;\n\t\t\t\t\t \t\tcase 'gt':\n\t\t\t\t\t \t\t\t$result[] = \"{$k} > {$val[1]} \";\n\t\t\t\t\t \t\t\tbreak;\n\t\t\t\t\t \t}\n\t\t\t\t\t \t\n\t\t\t\t\t }else{\n\n\t\t\t\t\t \t$result[] = \"{$k} = '{$val}'\";\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\t$this->where = 'where '.implode(' and ', $result);\n\t\t\t}\n\t\t\t\n\t\t\treturn $this;\n\t\t}",
"protected function where(array $filter){\n if (array_key_exists(\"order\", $filter)){\n $order = $filter[\"order\"];\n unset($filter[\"order\"]);\n if (gettype($order) != \"array\")\n $order = [$order];\n }\n\n if (array_key_exists(\"limit\", $filter)){\n $limit = $filter[\"limit\"];\n unset($filter[\"limit\"]);\n if (gettype($limit) != \"integer\")\n throw new appException(\"This is off-limits, literally\");\n }\n\n if (!empty($filter)){\n $query = \" WHERE \";\n\n foreach ($filter as $k => $v){\n if (gettype($v) == \"array\"){\n $query .= $this->genTableVar($k) . \" IN ( \";\n $query .= join(\", \", array_fill(0, count($v), \"?\"));\n $query .= \") AND \";\n }\n else if (gettype($v) == \"object\" && get_class($v) == \"dbContains\"){\n $query .= $v->genSql($this->genTableVar($k)) . \" AND \";\n }\n else {\n $query .= $this->genTableVar($k) . \" = ? AND \";\n }\n $this->args[] = $v;\n }\n\n $query = substr($query, 0, -4);\n\n $this->query .= $query;\n }\n\n if (isset($order))\n $this->orderBy($order);\n\n if (isset($limit))\n $this->limit($limit);\n }",
"protected function user_where_clause() {}",
"public function whereIn($values);",
"function query() {\n \n $this->ensure_my_table();\n \n if ($this->options['operator'] == 'in') {\n $keys = array_keys($this->value);\n\n $this->query->add_where(0, $this->table_alias.'.id IN ('. implode(',', $keys).')' );\n }\n\n }",
"public function findAll($condition = [], $params = [], $mode = PDO::FETCH_ASSOC){\n\t\t$this->beforeFind();\n\t\t$tableName = $this->tableName();\n\t\t$tables = $tableName;\n\t\t$sql = '';\n\t\t$bindValues = [];\n\n\t\tif(!empty($condition)){\n\t\t\t$sql .= ' WHERE ';\n\t\t\tforeach($condition as $key => $value){\n\t\t\t\tif(is_array($value)){\n\t\t\t\t\t$sql .= $tableName . '.' . $key . ' IN (';\n\t\t\t\t\tforeach($value as $inKey => $inValue){\n\t\t\t\t\t\t$sql .= ':' . $key . $inKey;\n\t\t\t\t\t\tif($inKey !== array_key_last($value)) $sql .= ', ';\n\t\t\t\t\t\t$bindValues[':' . $key . $inKey] = $inValue;\n\t\t\t\t\t}\n\t\t\t\t\t$sql .= ') ';\n\t\t\t\t} else {\n\t\t\t\t\t$sql .= $tableName . '.' . $key . ' = :' . $key . ' ';\n\t\t\t\t\t$bindValues[':' . $key] = $value;\n\t\t\t\t}\n\t\t\t\tif($key !== array_key_last($condition)) $sql .= 'AND ';\n\t\t\t}\n\t\t}\n\n\t\t// If there is orderBy param. Note: column name strings cannot be set as placeholders (column order numbers could though)\n\t\t// so model column names are used as a filter check to permit the passing of a string value to the statement.\n\t\tif(array_key_exists('orderBy', $params)){\n\t\t\t// Make sure the column name exists in model and direction is ASC or DESC\n\t\t\tif(property_exists($this, $params['orderBy'][0]) ){\n\t\t\t\t$sql .= ' ORDER BY ' . $params['orderBy'][0];\n\t\t\t\tif(strtolower($params['orderBy'][1]) === 'asc') $sql .= ' ASC';\n\t\t\t\telse if(strtolower($params['orderBy'][1]) === 'desc') $sql .= ' DESC';\n\t\t\t}\n\t\t}\n\t\t// If there is limit param.\n\t\tif(array_key_exists('limit', $params) && $params['limit'] > 0){\n\t\t\t$sql .= ' LIMIT :limit';\n\t\t\t$bindValues[':limit'] = $params['limit'];\n\t\t\t// If there is offset param.\n\t\t\tif(array_key_exists('offset', $params)){\n\t\t\t\t$sql .= ' OFFSET :offset';\n\t\t\t\t$bindValues[':offset'] = $params['offset'];\n\t\t\t}\n\t\t}\n\n\t\t// Join related table.\n\t\tif(array_key_exists('join', $params)){\n\t\t\t$relation = $this->relations()[$params['join']];\n\t\t\t// Many-to-many relation between tables.\n\t\t\tif($relation[0] == 'manyToMany'){\n\t\t\t\t// Get relation table models and instantiate.\n\t\t\t\trequire_once(APPROOT . 'models/' . $relation[1] . '.php');\n\t\t\t\t$relatedTable = new $relation[1];\n\t\t\t\trequire_once(APPROOT . 'models/' . $relation[2] . '.php');\n\t\t\t\t// Get tale names and build inner joins.\n\t\t\t\t$joinTable = new $relation[2];\n\t\t\t\t$joinTableName = $joinTable->tableName();\n\t\t\t\t$relatedTableName = $relatedTable->tableName();\n\t\t\t\t$tables .= ' INNER JOIN ' . $joinTableName . ' ON ' . $tableName . '.' . $relation[3] . ' = ' . $joinTableName . '.' . $relation[3];\n\t\t\t\t$tables .= ' INNER JOIN ' . $relatedTableName . ' ON ' . $joinTableName . '.' . $relation[4] . ' = ' . $relatedTableName . '.' . $relation[4];\n\t\t\t}\n\t\t}\n\n\t\t$statement = $this->db->prepare('SELECT * FROM ' . $tables . $sql);\n\t\tforeach($bindValues as $key => $value){\n\t\t\t$this->binder($statement, $key, $value);\n\t\t}\n\n\t\t$statement->execute();\n\t\t$result = $statement->fetchAll($mode);\n\t\tforeach($result as &$item){\n\t\t\t$this->afterFind($item);\n\t\t}\n\t\treturn $result;\n\t}",
"public function where() {\r\n\t\t$args = func_get_args();\r\n\t\treturn call_user_func_array(array($this, 'andWhere'), $args);\r\n\t}",
"function _where ($identifier_array, $o = TRUE) {\n\t\t$statement = '';\n\t\tif ( !isset($identifier_array) || !$identifier_array ) {\n\t\t\treturn $statement;\n\t\t}\n\t\t$statement .= $o ? ' WHERE ' : ' ';\n\t\tforeach ($identifier_array as $query_array) {\n\t\t\t$sub_stmt = '(';\n\t\t\tif ( isset($query_array['name']) && ! is_array($query_array['value']) ) {\n\t\t\t\t$regex = isset($query_array['regex']) ? $query_array['regex'] : '@';\n\t\t\t\t$sub_stmt .= '`' . $query_array['name'] . '` ';\n\t\t\t\t$sub_stmt .= (isset($query_array['ctype']) ? $query_array['ctype'] : '=') . ' ';\n\t\t\t\t$sub_stmt .= $this->escape($query_array['value'], $regex, FALSE);\n\t\t\t} else {\n\t\t\t\t// Incoming value is an array.\n\t\t\t\t$sub_stmt .= $this->_where($query_array['value'], FALSE);\n\t\t\t}\n\t\t\t$sub_stmt .= ')';\n\t\t\t$sub_stmt .= (isset($query_array['atype']) ? (' ' . $query_array['atype']).' ' : '');\n\t\t\t$statement .= $sub_stmt;\n\t\t}\n\t\treturn $statement; \n\t}",
"function where($keys, $data) {\n\n $WHERE = array();\n\n foreach ($keys as $key) {\n $index = $key;\n $value = $data[$key];\n $WHERE[] = \"`$index` = '\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n }\n\n return implode(' AND ', $WHERE);\n}",
"public function resolveConditionData($params)\n {\n $dataWhere = \"\";\n\n $lowerKeyd = array_change_key_case($params, CASE_LOWER);\n $glue = strtoupper(isset($lowerKeyd[self::OPERATOR_PREFIX . 'operator']) && strtolower($lowerKeyd[self::OPERATOR_PREFIX . 'operator']) == \"or\" ? \"OR\" : \"AND\");\n unset($lowerKeyd);\n\n foreach ($params as $k => $v) {\n if (strpos($k, self::OPERATOR_PREFIX) === 0) {\n continue;\n }\n if (is_numeric($k)) {\n if (is_array($v)) {\n $dataWhere .= ($dataWhere ? \" {$glue} (\" : \"(\") . $this->resolveConditionData($v) . \")\";\n }\n else { // raw\n $dataWhere .= ($dataWhere ? \" {$glue} \" : \"\") . $v;\n }\n }\n else {\n $expl = explode(\" \", $k, 2);\n $operator = count($expl) > 1 ? $expl[1] : \"=\";\n if ($operator == \"=\" && (is_array($v))) {\n $operator = \"IN\";\n }\n if ($operator == \"!=\" && (is_array($v))) {\n $operator = \"NOT IN\";\n }\n if ($operator == \"=\" && ($v === NULL)) {\n $operator = \"IS\";\n }\n if ($operator == \"!=\" && ($v === NULL)) {\n $operator = \"IS NOT\";\n }\n $dontQuote = false;\n if ($v === NULL) {\n $v = \"NULL\";\n $dontQuote = true;\n }\n if ($v === TRUE) {\n $v = 1;\n }\n if ($v === FALSE) {\n $v = 0;\n }\n $column = $expl[0];\n if (strpos($column, self::DONT_QUOTE_VALUE_PREFIX) === 0) {\n $column = substr($column, 1);\n $dontQuote = true;\n }\n $dataWhere .= ($dataWhere ? \" {$glue} \" : \"\") . $this->quoteColumn($column) . \" {$operator} \" . $this->_quoteVal($v, $dontQuote);\n }\n }\n\n return $dataWhere;\n }",
"public function orWhereIn()\n {\n list($field, $value) = $this->extractQueryToFieldAndValue(func_get_args());\n if (!is_array($value)) {\n $value = [$value];\n }\n return $this->addOrWhereStack([$field => [self::OPERATORS['in'] => $value]]); \n }"
]
| [
"0.69818056",
"0.6781005",
"0.67592454",
"0.6590336",
"0.6474417",
"0.63325703",
"0.6263484",
"0.6235511",
"0.6220795",
"0.6202309",
"0.6201893",
"0.619922",
"0.6173831",
"0.6173228",
"0.6173058",
"0.6166605",
"0.61619955",
"0.61513615",
"0.61460054",
"0.613577",
"0.61254406",
"0.61195356",
"0.60805124",
"0.60800725",
"0.60695934",
"0.6064875",
"0.6045867",
"0.60304123",
"0.5977672",
"0.5976532"
]
| 0.73595166 | 0 |
Function to calculate the number of seconds between two times Parameters: datetime string $start_timeA human readable string of the date. The following is allowed: dd/mm/yyyy hh:mm:ss mm/dd/yyyy hh:mm:ss | function elapsed_time($start_time, $finish_time){
return sc_strtotime($finish_time) - sc_strtotime($start_time);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function countTimediff($beginTime,$endTime)\n\t{\n\t\t$begins=explode( \":\",$beginTime);\n\t\t$beginseconds=(int)($begins[0])*3600 + (int)($begins[1])*60 + (int)($begins[2]);\n\t\n\t\t$ends=explode(\":\",$endTime);\n\t\t$endseconds=(int)($ends[0])*3600 + (int)($ends[1])*60 + (int)($ends[2]);\n\t\n\t\treturn ($endseconds-$beginseconds);\n\t}",
"function getduration_cmn($EndTime, $StartTime) {\n $diff = strtotime($EndTime) - strtotime($StartTime);\n return $diff;\n}",
"function time_diff($start) {\n return formatDateTimeDiff($start);\n}",
"function time_diff($start_time,$end_time) {\n\n\t//subtract our times to get the difference\n\t$calcStArray = explode(\":\",$start_time);\n\t$calcEtArray = explode(\":\",$end_time);\n\n\t$start_hour = $calcStArray[0];\n\t$start_min = $calcStArray[1];\n\n\t$end_hour = $calcEtArray[0];\n\t$end_min = $calcEtArray[1];\n\n\t//reduce our dates to timestamps. We use a random date here, since it does not matter\n\t$ts1 = mktime($start_hour,$start_min,\"0\",1,1,2000);\n\t$ts2 = mktime($end_hour,$end_min,\"0\",1,1,2000);\n\n\t//get the number of seconds\n\t$diff = $ts2 - $ts1;\n\n\t$temp = $diff/3600;\n\n\t//get the place of the decimal point\n\t$pos = strpos($temp,\".\");\n\n\t//if we have pos, there is a decimal point\n\tif ($pos) {\n\n\t\t$dur_hour = intval($temp);\n\t\t$min = substr($temp,$pos);\n\n\t\t//convert to clock nums\n\t\tif ($min==\".5\") $dur_min = \"30\";\n\t\telseif ($min==\".25\") $dur_min = \"15\";\n\t\telseif ($min==\".75\") $dur_min = \"45\";\n\n\t}\n\telse {\n\t\t$dur_hour = $temp;\n\t\t$dur_min = \"00\";\n\t}\n\n\treturn array($dur_hour,$dur_min);\n\n}",
"function getQueryTime($time_start,$time_end) {\n\t\treturn round($time_end - $time_start,4).'sec';\n\t}",
"function get_time_difference( $time1, $time2 ) {\n\t$time1 = (int)$time1;\n\t$time2 = (int)$time2;\n\t$result = array(\n\t\t'days' => 0,\n\t\t'hours' => 0,\n\t\t'minutes' => 0,\n\t\t'seconds' => 0\n\t);\n\tif( $time1 == 0 || $time2 == 0) return $result;\n\t\n\tif($time2 > $time1) {\n\t\t$start = date(\"H:i\",$time1);\n\t\t$end = date(\"H:i\",$time2);\n\t} else {\n\t\t$start = date(\"H:i\",$time2);\n\t\t$end = date(\"H:i\",$time1);\t\n\t}\t\n\t\n\t$uts['start'] = $time2;\n\t$uts['end'] = $time1;\n\tif( $uts['start']!==-1 && $uts['end']!==-1 ) {\n\t\tif( $uts['end'] >= $uts['start'] ) {\n\t\t\n\t\t\t$diff = $uts['end'] - $uts['start'];\n\t\t\tif( $days=intval((floor($diff/86400))) ) $diff = $diff % 86400;\n\t\t\tif( $hours=intval((floor($diff/3600))) ) $diff = $diff % 3600;\n\t\t\tif( $minutes=intval((floor($diff/60))) ) $diff = $diff % 60;\n\t\t\t$diff = intval( $diff ); \n\t\t\tif($days > 0) $hours += $days*24;\n\t\t\treturn( array('days'=>str_pad($days,2,0, STR_PAD_LEFT), 'hours'=>str_pad($hours,2,0, STR_PAD_LEFT), 'minutes'=>str_pad($minutes,2,0, STR_PAD_LEFT), 'seconds'=>str_pad($diff,2,0, STR_PAD_LEFT)) );\n\t\t}\t\n\t}\t\n\treturn $result;\n}",
"function get_time_difference($start, $end) {\r\n\t\r\n $uts['start'] = strtotime($start);\r\n $uts['end'] = strtotime($end);\r\n if ($uts['start']!=false && $uts['end']!=false) {\r\n if ($uts['end'] >= $uts['start']) {\r\n $diff = $uts['end'] - $uts['start'];\r\n\t\t\t$days = intval((floor($diff/60/60/24)));\r\n\t\t\t$hours = intval((floor($diff/60/60)));\r\n\t\t\t$minutes = intval((floor($diff/60)));\r\n $seconds = intval($diff); \r\n return(array('days'=>$days, 'hours'=>$hours, 'minutes'=>$minutes, 'seconds'=>$seconds));\r\n } else {\r\n return(false);\r\n }\r\n } else {\r\n return(false);\r\n }\r\n return(false);\r\n}",
"function get_time_difference( $start, $end )\n{\n //$uts['end'] = strtotime( $end );\n $uts['start'] = $start;\n $uts['end'] = $end;\n if( $uts['start']!==-1 && $uts['end']!==-1 )\n {\n if( $uts['end'] >= $uts['start'] )\n {\n $diff = $uts['end'] - $uts['start'];\n if( $days=intval((floor($diff/86400))) )\n $diff = $diff % 86400;\n if( $hours=intval((floor($diff/3600))) )\n $diff = $diff % 3600;\n if( $minutes=intval((floor($diff/60))) )\n $diff = $diff % 60;\n $diff = intval( $diff );\n return( array('days'=>$days, 'hours'=>$hours, 'minutes'=>$minutes, 'seconds'=>$diff) );\n }\n else\n {\n trigger_error( \"Ending date/time is earlier than the start date/time\", E_USER_WARNING );\n }\n }\n else\n {\n trigger_error( \"Invalid date/time data detected\", E_USER_WARNING );\n }\n return( false );\n}",
"function timeDiff($firstTime,$lastTime)\n {\n $firstTime=strtotime($firstTime);\n $lastTime=strtotime($lastTime);\n\n// perform subtraction to get the difference (in seconds) between times\n $timeDiff=$lastTime-$firstTime;\n\n return ($timeDiff);\n }",
"public static function calculateRemainTime($start,$end)\n {\n $date1 = strtotime($start); \n $date2 = strtotime($end); \n \n // Formulate the Difference between two dates \n $diff = abs($date2 - $date1); \n \n \n // To get the year divide the resultant date into \n // total seconds in a year (365*60*60*24) \n $years = floor($diff / (365*60*60*24)); \n \n \n // To get the month, subtract it with years and \n // divide the resultant date into \n // total seconds in a month (30*60*60*24) \n $months = floor(($diff - $years * 365*60*60*24) \n / (30*60*60*24)); \n \n \n // To get the day, subtract it with years and \n // months and divide the resultant date into \n // total seconds in a days (60*60*24) \n $days = floor(($diff - $years * 365*60*60*24 - \n $months*30*60*60*24)/ (60*60*24)); \n \n \n // To get the hour, subtract it with years, \n // months & seconds and divide the resultant \n // date into total seconds in a hours (60*60) \n $hours = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24) \n / (60*60)); \n \n \n // To get the minutes, subtract it with years, \n // months, seconds and hours and divide the \n // resultant date into total seconds i.e. 60 \n $minutes = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24 \n - $hours*60*60)/ 60); \n \n \n // To get the minutes, subtract it with years, \n // months, seconds, hours and minutes \n $seconds = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24 \n - $hours*60*60 - $minutes*60)); \n \n // Print the result\n return [\n 0=>$days,\n 1=>$hours,\n 2=>$minutes,\n 3=>$seconds\n ];\n }",
"function timedifference_in_minutes($start_time, $end_time,$para=\"\") {\n /*$first_date = new DateTime(\"2012-11-30 \" . $start_time);\n $second_date = new DateTime(\"2012-12-21 \" . $end_time);\n $difference = $first_date->diff($second_date);\n //pr($difference);\n return $total_minutes = $difference->h * 60 + $difference->$i;*/\n $start_time = date(\"G:i\", strtotime($start_time));\n $end_time = date(\"G:i\", strtotime($end_time));\n $s_spit = explode(\":\",$start_time);\n $e_spit = explode(\":\",$end_time);\n\n $h1 = (int)($s_spit[0]);\n $m1 = (int)($s_spit[1]);\n\n $h2 = (int)($e_spit[0]);\n $m2 = (int)($e_spit[1]);\n\n //console.log($h1+' '+$m1+' '+$h2+' ' +$m2);\n $counter = 0;\n if(($h2-$h1)<0){\n for($i=$h1;$i<24;$i++) $counter++;\n for($i=1;$i<=$h2;$i++) $counter++;\n } else if(($h2-$h1)>0){\n $counter = $h2-$h1;\n } else {\n $counter = 24;\n }\n $minutes = 0;\n if(($m2-$m1)<0) {\n $minutes = 0-($m2-$m1);\n $counter--;\n } else {\n $minutes = $m2-$m1;\n }\n if ($para =='hours') {\n return ($counter . \" hrs : \" . $minutes . \" mins\");\n }\n return ($counter*60 + $minutes);\n \n}",
"function elapsedSeconds() {\n if (null === $this->startMicrotime) {\n throw new InvalidArgumentException(\"Start time was not marked\");\n }\n if (null === $this->endMicrotime) {\n // Not stopped so return time from start to now\n return microtime(true) - $this->startMicrotime;\n }\n // Stopped so show total elapsed time between start and stop\n return $this->endMicrotime - $this->startMicrotime;\n }",
"function calculateTimeDiff($time1, $time2) {\n\t\t$time1 = new DateTime($time1);\n\t\t$time2 = new DateTime($time2);\n\t\t$interval = $time1->diff($time2);\n\t\t$h = intval($interval->format('%h')*60);\n\t\t$m = intval($interval->format('%i'));\n\t\treturn $h + $m;\n\t}",
"function timeDiff($firstTime, $lastTime) {\n $firstTime = strtotime($firstTime);\n $lastTime = strtotime($lastTime);\n $timeDiff = ($lastTime - $firstTime) / 86400;\n return $timeDiff;\n}",
"function diffInSeconds ($firstDate, $secondDate)\n\t{\n\t\t$diff = $firstDate - $secondDate;\n\t\treturn $diff;\n\t}",
"function dateDiff($start, $end) {\n\t\n $start_ts = strtotime($start);\n $end_ts = strtotime($end);\n $diff = $end_ts - $start_ts;\n return round($diff / 86400);\n}",
"public static function getDurationInSeconds($dateTime1, $dateTime2) {\n\t\t$ri = 0;\n\t\t$dateTime1Seconds = qdat::getAbsoluteSeconds($dateTime1);\n\t\t$dateTime2Seconds = qdat::getAbsoluteSeconds($dateTime2);\n\t\t$ri = $dateTime1Seconds - $dateTime2Seconds;\n\t\t$ri = abs($ri);\n\t\treturn $ri;\n\t}",
"function simpleDiff($start, $end = 'NOW') { \n $start_time = strtotime($start);\n $stop_time = strtotime($end);\n\n $diff_time = $start_time - $stop_time;\n\n if (abs($diff_time) < 3600) {\n return ceil($diff_time / 60) . 'm';\n }\n\n return ceil($diff_time / 3600) . 'h';\n }",
"function timeDiff($firstTime,$lastTime) {\n\t\t$firstTime = strtotime($firstTime);\n\t\t$lastTime = strtotime($lastTime);\n\n\t\t// perform subtraction to get the difference (in seconds) between times\n\t\t$timeDiff = $lastTime-$firstTime;\n\n\t\t// return the difference\n\t\treturn $timeDiff;\n\t}",
"function diff_two_dates2($startdate,$enddate){\n $date1 = strtotime($startdate); \n $date2 = strtotime($enddate); \n \n // Formulate the Difference between two dates \n $diff = abs($date2 - $date1); \n \n \n // To get the year divide the resultant date into \n // total seconds in a year (365*60*60*24) \n $years = floor($diff / (365*60*60*24)); \n \n \n // To get the month, subtract it with years and \n // divide the resultant date into \n // total seconds in a month (30*60*60*24) \n $months = floor(($diff - $years * 365*60*60*24) \n / (30*60*60*24)); \n \n \n // To get the day, subtract it with years and \n // months and divide the resultant date into \n // total seconds in a days (60*60*24) \n $days = floor(($diff - $years * 365*60*60*24 - \n $months*30*60*60*24)/ (60*60*24)); \n \n \n // To get the hour, subtract it with years, \n // months & seconds and divide the resultant \n // date into total seconds in a hours (60*60) \n $hours = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24) \n / (60*60)); \n \n \n // To get the minutes, subtract it with years, \n // months, seconds and hours and divide the \n // resultant date into total seconds i.e. 60 \n $minutes = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24 \n - $hours*60*60)/ 60); \n \n \n // To get the minutes, subtract it with years, \n // months, seconds, hours and minutes \n $seconds = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24 \n - $hours*60*60 - $minutes*60)); \n \n // Print the result \n return array(\n 'seconds'=>$seconds,\n 'minutes'=>$minutes,\n 'hours'=>$hours,\n 'days'=>$days,\n 'months'=>$months,\n 'years'=>$years\n );\n}",
"protected function calculateTime()\n {\n return $this->start->diffInHours($this->end) +\n round(\n ($this->start->diffInMinutes($this->end) - ($this->start->diffInHours($this->end) * 60)) / 60,\n 1\n );\n }",
"public function getdifftime($date1,$date2)\n {\n\n\n\n \n\n// Declare and define two dates \n$diff = abs($date1->getTimestamp()-$date2->getTimestamp());\n\n \n \n// To get the year divide the resultant date into \n// total seconds in a year (365*60*60*24) \n$years = floor($diff / (365*60*60*24)); \n \n \n// To get the month, subtract it with years and \n// divide the resultant date into \n// total seconds in a month (30*60*60*24) \n$months = floor(($diff - $years * 365*60*60*24) \n / (30*60*60*24)); \n \n \n// To get the day, subtract it with years and \n// months and divide the resultant date into \n// total seconds in a days (60*60*24) \n$days = floor(($diff - $years * 365*60*60*24 - \n $months*30*60*60*24)/ (60*60*24)); \n \n \n// To get the hour, subtract it with years, \n// months & seconds and divide the resultant \n// date into total seconds in a hours (60*60) \n$hours = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24) \n / (60*60)); \n \n \n// To get the minutes, subtract it with years, \n// months, seconds and hours and divide the \n// resultant date into total seconds i.e. 60 \n$minutes = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24 \n - $hours*60*60)/ 60); \n \n \n// To get the minutes, subtract it with years, \n// months, seconds, hours and minutes \n$seconds = floor(($diff - $years * 365*60*60*24 \n - $months*30*60*60*24 - $days*60*60*24 \n - $hours*60*60 - $minutes*60)); \n \nreturn $hours;\n }",
"function printtimediff($start, $end = null) {\n\n\tif( ! $end )\t$end = time();\n\t$ret = '';\n\t$diff = $end - $start;\n\n\t$h = floor($diff/3600);\n\t$diff %= 3600;\n\tif($h > 0) {\n\t\t$ret .= $h.' h ';\n\t}\n\n\t$m = floor($diff/60);\n\t$diff %= 60;\n\tif ( $m > 0 ) {\n\t\t$ret .= $m.' m ';\n\t}\n\n\treturn $ret . $diff .' s';\n}",
"public function countDates($start, $end)\n {\n // make timestamps from the MySQL formatted time\n $startTimestamp = strtotime($start);\n $endTimestamp = strtotime($end);\n\n // First we need to break these dates into their constituent parts:\n $gd_a = getdate($startTimestamp);\n $gd_b = getdate($endTimestamp);\n\n // Now recreate these timestamps, based upon noon on each day\n // The specific time doesn't matter but it must be the same each day\n $a_new = mktime(12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year']);\n $b_new = mktime(12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year']);\n\n // Subtract these two numbers and divide by the number of seconds in a\n // day. Round the result since crossing over a daylight savings time\n // barrier will cause this time to be off by an hour or two.\n return round(abs($a_new - $b_new) / 86400);\n }",
"protected function diffTimeInNanoseconds($start, $end): int\n {\n if ($this->platformSupportsNanoseconds()) {\n return (int) ($end - $start);\n }\n\n // Difference is in seconds (with microsecond precision)\n // * 1000 to get to milliseconds\n // * 1000 to get to microseconds\n // * 1000 to get to nanoseconds\n return (int) (($end - $start) * 1000 * 1000 * 1000);\n }",
"function timeDiff($firstTime,$lastTime)\n{\n$firstTime=strtotime($firstTime);\n$lastTime=strtotime($lastTime);\n$timeDiff = ($lastTime-$firstTime)/86400;\nreturn $timeDiff;\n}",
"protected function getElapsedTime($start)\n {\n return round((microtime(true) - $start) * 1000, 2);\n }",
"public function calculateTimePerDay($startTime, $endTime){\n\n $start_time = strtotime(Config::get('mycnf.start_time'));//8:30\n $end_time = strtotime(Config::get('mycnf.end_time')); //18\n $sleep_AM = strtotime(Config::get('mycnf.sleep_AM')); //11:30\n $start_PM = strtotime(Config::get('mycnf.start_PM')); //13\n\n if ($startTime < $sleep_AM) {\n\n if ($endTime < $sleep_AM) {\n $timePerDay = $endTime - $startTime;\n\n }elseif ($endTime > $sleep_AM && $endTime < $start_PM) {\n $timePerDay = $sleep_AM - $startTime;\n\n }elseif ($endTime > $start_PM) {\n $timePerDay = ($sleep_AM - $startTime) + ($endTime - $start_PM);\n }\n\n }elseif ($startTime >= $sleep_AM && $startTime <= $start_PM) {\n\n if ($endTime > $sleep_AM && $endTime < $start_PM ) {\n $timePerDay = 0;\n\n }elseif ($endTime > $start_PM) {\n $timePerDay = $endTime - $start_PM;\n\n }\n\n }elseif ($startTime > $start_PM){\n $timePerDay = $endTime - $startTime;\n\n }\n\n return $timePerDay;\n }",
"function date_diff_between_ts($time1, $time2, $what='d') {\n\t$result = 0;\n\n\tif($time2 > $time1) {\n\t\t$nseconds = $time2 - $time1;\n\t} else {\n\t\t$nseconds = $time1 - $time2;\n\t}\n\n\tif($what == 'd') {\t\t// Days\n\t\t$result = (float)($nseconds / 86400);\n\t} elseif($what == 'w') {\t// Weeks\n\t\t$result = (float)($nseconds / 604800);\n\t} elseif($what == 'm') {\t// Months\n\t\tif($time1 > $time2) {\n\t\t\t$temp = $time1;\n\t\t\t$time1 = $time2;\n\t\t\t$time2 = $temp;\n\t\t}\n\n\t\t$day1 = uwa_date('j', $time1);\n\t\t$mon1 = uwa_date('n', $time1);\n\t\t$year1 = uwa_date('Y', $time1);\n\t\t$day2 = uwa_date('j', $time2);\n\t\t$mon2 = uwa_date('n', $time2);\n\t\t$year2 = uwa_date('Y', $time2);\n\n\t\tif($day1 > $day2) {\n\t\t\t$result = (($year2 - $year1) * 12) + ($mon2 - $mon1 - 1);\n\t\t} else {\n\t\t\t$result = (($year2 - $year1) * 12) + ($mon2 - $mon1);\n\t\t}\n\t} elseif($what == 'y') {\t// Years\n\t\t$weeks = (float)($nseconds / 604800);\n\t\t$result = $weeks / 52;\n\t} elseif($what == 'h') {\t// Hours\n\t\t$result = (float)($nseconds / 3600);\n\t} elseif($what == 'i') {\t// Minutes\n\t\t$result = (int)($nseconds / 60);\n\t}\n\n\treturn $result;\n}",
"protected function getElapsedTime($start)\n {\n return round ( (microtime ( true ) - $start) * 1000, 2 );\n }"
]
| [
"0.6572806",
"0.65647995",
"0.65368915",
"0.651515",
"0.6476805",
"0.6363731",
"0.63462937",
"0.62755364",
"0.62310797",
"0.6188671",
"0.61377937",
"0.6136454",
"0.6135945",
"0.6125896",
"0.6101747",
"0.6064273",
"0.6012661",
"0.600008",
"0.5985235",
"0.59847766",
"0.592983",
"0.5913594",
"0.5908961",
"0.59023476",
"0.58869046",
"0.5884702",
"0.58780503",
"0.5873107",
"0.5869435",
"0.58681166"
]
| 0.6919769 | 0 |
Return a US style date format | function sc_us_date_format($date){
return date('m/d/Y', $date);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sc_date_format($date){\n\t$CI =& get_instance();\n\tif($CI->session->userdata('locale') =='uk'){\n\t\treturn date('d/m/Y', $date);\n\t}else{\n\t\treturn date('m/d/Y', $date);\n\t}\n}",
"private function format()\n {\n return config('app.locale') != 'en' ? 'd/m/Y' : 'm/d/Y';\n }",
"public static function checkfront_date_format() {\n return (string)static::config()->get('checkfront_date_format');\n }",
"function carton_date_format() {\n\treturn apply_filters( 'carton_date_format', get_option( 'date_format' ) );\n}",
"public function getDateFormat()\n {\n return Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);\n }",
"public function getDateFormat()\n {\n return $this->_localeDate->getDateFormat(\\IntlDateFormatter::SHORT);\n }",
"public function getDateFormat()\n {\n return $this->_localeDate->getDateFormat(\\IntlDateFormatter::SHORT);\n }",
"function get_short_date_format() {\n\t\tstatic $site_short_date_format = FALSE;\n\n\t\tif( !$site_short_date_format ) {\n\t\t\t$site_short_date_format = $this->getConfig( 'site_short_date_format', '%d %b %Y' );\n\t\t}\n\n\t\treturn $site_short_date_format;\n\t}",
"function dateFormat($date, $format=\"m/d/Y h:i:s A\") {\n if (empty($date)) {\n return \"\";\n }\n Zend_Date::setOptions(array('format_type' => 'php'));\n $zdate = new Zend_Date(strtotime($date));\n $str_date = $zdate->toString($format);\n Zend_Date::setOptions(array('format_type' => 'iso'));\n return $str_date;\n }",
"function erp_format_date( $date, $format = false ) {\n if ( ! $format ) {\n $format = erp_get_option( 'date_format', 'erp_settings_general', 'd-m-Y' );\n }\n\n if ( ! is_numeric( $date ) ) {\n $date = strtotime( $date );\n }\n\n if ( function_exists('wp_date') ) {\n return wp_date( $format, $date );\n }\n\n return date_i18n( $format, $date );\n}",
"function get_date_textual($format = 'Y-m-d') {\n\t$format = ($format == '') ? 'Y-m-d' : $format;\n\t$format = str_replace('Y', 'yyyy', $format);\n\t$format = str_replace('m', 'mm', $format);\n\t$format = str_replace('d', 'dd', $format);\n\treturn $format;\n}",
"function format_date($date, $format = 'd', $culture = null, $charset = null)\n{\n return formatDate($date, null, 'd', $format);\n}",
"function formatDate($date){\r\n\t\t\t\t$dateObject = date_create($date);\r\n\t\t\t\treturn date_format($dateObject, \"j F Y\");\r\n\t\t\t}",
"public function formatDate($date = null);",
"public function dateTimeFormat();",
"public function toFormattedDateString()\n {\n return $this->toLocalizedString('MMM d, yyyy');\n }",
"function googleDateFormat($strDate)\n {\n $date = new DateTime($strDate);\n return $date->format('Y-m-d\\TH:i:sP');\n //return $stDate;\n }",
"function formatDate($date){\n\tif(validateDate($date)){\n\t\t$year = substr($date,0,4);\n\t\t$month = substr($date,4,2);\n\t\t$day = substr($date,6,2);\n\t\treturn $year.C('STR_YEAR').$month.C('STR_MONTH').$day.C('STR_DAY');\n\t}\n\telse\n\t\treturn C('STR_FORMAT_DATE_FAIL');\n}",
"function outputDateFormat($date, $format = null) {\n if(empty($date)){\n return '';\n }\n if(!$format){\n $format = 'm/d/Y';\n }\n if ($date == config('custom.null_date') || $date == '0000-00-00') {\n return '';\n }\n if(!($date instanceof Carbon)) {\n if(is_numeric($date)) {\n // Assume Timestamp\n $date = Carbon::createFromTimestamp($date);\n } else {\n $date = Carbon::parse($date);\n }\n return Carbon::parse($date)->format($format);\n }\n return $date->setTimezone('US/Eastern')->format($format);\n }",
"function format_date($date) {\n return substr($date, 8, 2) . '/' . substr($date, 5, 2) . '/' . substr($date, 0, 4);\n }",
"function helper_format_date($date, $format = APP_DATE_TIME_FORMAT){\n return date( $format, strtotime($date) );\n }",
"public function format($format)\n {\n if (preg_match(\"/^.*[f]+.*$/\", $format)) {\n $format = str_replace('f', 'F', $format);\n \n $date = parent::format($format);\n \n $english = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); \n \n return str_replace($english, self::$polish_months, $date);\n }\n \n return parent::format($format);\n }",
"function formatDate($date, $format = '%d %B %Y') {\n setlocale(LC_ALL, 'fr.utf-8');\n\n return strftime($format, strtotime($date));\n}",
"function local_to_iso($date,$date_format)\n{\n $list_date=explode (\"-\",$date);\n if ($date_format=='fr')\n {\n $date=$list_date[2].'-'.$list_date[1].'-'.$list_date[0];\n }\n elseif ($date_format=='en')\n $date=$list_date[2].'-'.$list_date[0].'-'.$list_date[1];\n return $date;\n}",
"function local_to_iso($date,$date_format)\n{\n $list_date=explode (\"-\",$date);\n if ($date_format=='fr')\n {\n $date=$list_date[2].'-'.$list_date[1].'-'.$list_date[0];\n }\n elseif ($date_format=='en')\n $date=$list_date[2].'-'.$list_date[0].'-'.$list_date[1];\n return $date;\n}",
"public function dateFormat($date)\n {\n return $this->formatDate($date, \\IntlDateFormatter::SHORT);\n }",
"public function dateFormat($date)\n {\n return $this->formatDate($date, \\IntlDateFormatter::SHORT);\n }",
"public function dateFormat($date)\n {\n return $this->formatDate($date, \\IntlDateFormatter::SHORT);\n }",
"public function format($format) {\n \t$spf = str_replace(array(\"d\",\"m\",\"Y\"),array(\"%3$02d\",\"%2$02d\",\"%1$04d\"),$format);\n \t\treturn sprintf($spf, $this->dt[0], $this->dt[1], $this->dt[2]);\n\t}",
"public function formatDate() {\n\t\t\tif(!empty($this->review_date)) {\n\t\t\t\t$date = new dateTime($this->review_date);\n\t\t\t\treturn $date->format('M jS, Y - H:i');\n\t\t\t}\n\t\t}"
]
| [
"0.7224971",
"0.7192705",
"0.7110512",
"0.7093999",
"0.7078693",
"0.70440274",
"0.70440274",
"0.7036326",
"0.7001148",
"0.6993213",
"0.6960304",
"0.6934747",
"0.69202304",
"0.6912458",
"0.6906909",
"0.69035256",
"0.68759483",
"0.68486285",
"0.6845312",
"0.6824403",
"0.68119127",
"0.6781511",
"0.6743846",
"0.6734482",
"0.6734482",
"0.67172205",
"0.67172205",
"0.67172205",
"0.6710792",
"0.6664221"
]
| 0.77569133 | 0 |
Function to _calculate the corrected time based on RYA PY handicap | function PY_calc($elapsed, $handicap){
// Parameters: $elapsed
// Type: integer, number of seconds of elapsed time
// $handicap
// Type: float, the RYA PY handicap value
// Returns: integer, number of seconds of corrected time
// Different countries use different PY bases
$ci =& get_instance();
if($ci->userdata->session('locale') == 'uk'){
$base = 1000;
}else{
$base = 100;
}
if($reverse){
return round(intval($elapsed) * intval($handicap) / $base, 0);
}else{
$tcc = round(intval($elapsed) * $base / intval($handicap), 0);
return $tcc;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function IRC_calc($elapsed, $handicap, $reverse = false){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the IRC handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\t\tif($reverse){\n\t\t\treturn intval(round(intval($elapsed) / floatval($handicap), 0));\n\t\t}else{\n\t\t\treturn intval(round(intval($elapsed) * floatval($handicap), 0));\n\t\t}\n\t}",
"function ECHO_calc($elapsed, $handicap, $reverse = false){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the ECHO handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\n\t\tif($reverse){\n\t\t\treturn intval(round(intval($elapsed) / floatval($handicap), 0));\n\t\t}else{\n\t\t\treturn intval(round(intval($elapsed) * floatval($handicap), 0));\n\t\t} \n\t}",
"private function calculateTime()\n {\n $slowest = 1000000;\n for($i=1; $i<=12; $i++){\n if($_GET['Tr'.$i] > 0 && $slowest > $this->troopCostsProperties['Tr'.$i][5] ){\n $slowest = $this->troopCostsProperties['Tr'.$i][5];\n }\n }\n $time = $this->distance/($slowest*SERVER_SPEED_RATE);\n return $time;\n }",
"public function getAnswerTime();",
"public function getTurnaroundTime()\n\t{\n\t\t$startTime = new DateTime($this->specimen->time_accepted);\n\t\t$endTime = new DateTime($this->time_verified);\n\t\t$interval = $startTime->diff($endTime);\n\n\t\t$turnaroundTime = ($interval->days * 24 * 3600) + ($interval->h * 3600) + ($interval->i * 60) + ($interval->s);\n\n\t\t\n\t\treturn $turnaroundTime;\n\t}",
"public function getLapTime()\n {\n \n }",
"function calculateTime($trueIndex, $dataIndex) {\n\t\t$dataTime = self::$data[$dataIndex]['Time'];\n\t\t$trueTime = $this -> timeToSeconds(self::$groundTruth[$trueIndex]['min'], self::$groundTruth[$trueIndex]['sec'], self::$groundTruth[$trueIndex]['msec']);\n\n\t\t//+-1 sec is accepted (=-1)\n\t\treturn 1 - 2 * abs($dataTime - $trueTime);\n\t}",
"public function getFormattedTurnaroundTime()\n\t{\n\t\t\n\t\t$tat = $this->getTurnaroundTime();\n\t\t\n\t\t$ftat = \"\";\n\t\t$tat_y = intval($tat/(365*24*60*60));\n\t\t$tat_w = intval(($tat-($tat_y*(365*24*60*60)))/(7*24*60*60));\n\t\t$tat_d = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60)))/(24*60*60));\n\t\t$tat_h = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60)))/(60*60));\n\t\t$tat_m = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60))-($tat_h*(60*60)))/(60));\n\t\t$tat_s = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60))-($tat_h*(60*60))-($tat_m*(60))));\n\t\tif($tat_y > 0) $ftat = $tat_y.\" \".Lang::choice('messages.year',$tat_y).\" \";\n\t\tif($tat_w > 0) $ftat .= $tat_w.\" \".Lang::choice('messages.week',$tat_w).\" \";\n\t\tif($tat_d > 0) $ftat .= $tat_d.\" \".Lang::choice('messages.day',$tat_d).\" \";\n\t\tif($tat_h > 0) $ftat .= $tat_h.\" \".Lang::choice('messages.hour',$tat_h).\" \";\n\t\tif($tat_m > 0) $ftat .= $tat_m.\" \".Lang::choice('messages.minute',$tat_m).\" \";\n\t\tif($tat_s > 0) $ftat .= $tat_s.\" \".Lang::choice('messages.second',$tat_s);\n\n\t\treturn $ftat;\n\t}",
"function get_time_offset()\n {\n \t$r = 0;\n \t\n \t$r = ( (isset($this->member['time_offset']) AND $this->member['time_offset'] != \"\") ? $this->member['time_offset'] : $this->vars['time_offset'] ) * 3600;\n\t\t\t\n\t\tif ( $this->vars['time_adjust'] )\n\t\t{\n\t\t\t$r += ($this->vars['time_adjust'] * 60);\n\t\t}\n\t\t\n\t\tif ( isset($this->member['dst_in_use']) AND $this->member['dst_in_use'] )\n\t\t{\n\t\t\t$r += 3600;\n\t\t}\n \t\n \treturn $r;\n }",
"private function getTimeCorrection(): int\n\t{\n\t\treturn config('curl-connection.' . $this->service . '.time_correction');\n\t}",
"abstract public function getForecastTime();",
"public static function normalizedTime() {\n\t\t$offset = 0;\n\t\ttry {\n\t\t\t$offset = wfWAF::getInstance()->getStorageEngine()->getConfig('timeoffset_ntp', false);\n\t\t\tif ($offset === false) {\n\t\t\t\t$offset = wfWAF::getInstance()->getStorageEngine()->getConfig('timeoffset_wf', false);\n\t\t\t\tif ($offset === false) { $offset = 0; }\n\t\t\t}\n\t\t}\n\t\tcatch (Exception $e) {\n\t\t\t//Ignore\n\t\t}\n\t\treturn time() + $offset;\n\t}",
"public function timeMid();",
"function hitung_hari($awal,$akhir){\n\t\t$tglAwal = strtotime($awal);\n\t\t$tglAkhir = strtotime($akhir);\n\t\t$jeda = abs($tglAkhir - $tglAwal);\n\t\treturn floor($jeda/(60*60*24));\n\t}",
"function correctTime($Hours,$Minutes,$Seconds, &$printArray)\n{\n\tarray_push($printArray,\"CorrectTime (before loops): H:$Hours M:$Minutes S:$Seconds <br>\");\n\t//echo nl2br(\"Seconds are now: $Seconds \\n\");\n\tif($Seconds>=60)\n\t{\n\t\t$CaryOver=$Seconds%60;\n\t\t$Minutes+=floor($Seconds/60);\n\t\t$Seconds=$CaryOver;\n\t\t//echo nl2br(\"Seconds are now: $CarryOver \\n\");\n\t\t\n\t}\n\n\tif($Minutes>=60)\n\t{\n\t\t$CaryOver=$Minutes%60; //Remainder\n\t\t$Hours+=floor($Minutes/60);\n\t\t$Minutes=$CaryOver;\n\t\t//echo nl2br(\"Minutes are now: $CarryOver \\n\");\n\t\t\n\t}\n\t\n\t//NOW Correct the FORMAT\n\tif($Hours<10)\n\t{$Hours=\"0\".$Hours;}\t\n\tif($Minutes<10)\n\t{$Minutes=\"0\".$Minutes;}\n\tif($Seconds<10)\n\t{$Seconds=\"0\".$Seconds;}\n\t\n\n array_push($printArray,\"CorrectTime (after): H:$Hours M:$Minutes S:$Seconds <br><br>\");\n\t\n\treturn array($Hours,$Minutes,$Seconds);\n}",
"protected function calculateTime()\n {\n return $this->start->diffInHours($this->end) +\n round(\n ($this->start->diffInMinutes($this->end) - ($this->start->diffInHours($this->end) * 60)) / 60,\n 1\n );\n }",
"function translate_time($t) {\n /* US only :)\n $a_times = array(\n '9:00' => '9am' , '9:45' => '9:45'\n , '10:00' => '10am', '10:15' =>'10:15', '10:30' =>'10:30', '10:45' => '10:45'\n , '11:00' => '11am', '11:15' =>'11:15', '11:30' =>'11:30', '11:45' => '11:45'\n , '12:00' => '12pm', '12:15' =>'12:15', '12:30' =>'12:30', '12:45' => '12:45'\n , '13:00' => '1pm', '13:15' => '1:15', '13:30' => '1:30', '13:45' => '1:45'\n , '14:00' => '2pm', '14:15' => '2:15', '14:30' => '2:30', '14:45' => '2:45'\n , '15:00' => '3pm', '15:15' => '3:15', '15:30' => '3:30', '15:45' => '3:45'\n , '16:00' => '4pm', '16:15' => '4:15', '16:30' => '4:30', '16:45' => '4:45'\n , '17:00' => '5pm', '17:15' => '5:15', '17:30' => '5:30', '17:45' => '5:45'\n , '18:00' => '6pm', '18:15' => '6:15'\n , '20:00' => '8pm', '22:00' => '10pm'\n );\n if (isset($a_times[$t])) return $a_times[$t];\n */\n return $t;\n }",
"protected static function TimeDifference()\n\t{\n\t\t$ts=0;\n\t\t$ts -= date ( \"Z\" ) * 1;\n\t\t$daylight = date ( \"I\" );\n\t\t$daylight *= 1;\n\t\t$daylight *= 3600;\n\t\t$ts += $daylight; //12600 seconds 3:30+ GMT Tehran\n\t\t$ts += self::$GMTdelta;\n\t\treturn $ts;\n\t\t\n\t}",
"public function getRawTime(): float\n {\n return $this->endTime - $this->startTime;\n }",
"function time_calc($up_time)\n {\n // time is of the form YYYY-MM-DD HH:MM:SS.MILISEC\n $x = explode(' ', $up_time);\n $y = explode('-', $x[0]);\n $z = explode(':', $x[1]);\n\n // condition for year\n if(((int)date('Y') - (int)$y[0]) > 0)\n {\n $temp = ((int)date('Y') - (int)$y[0]);\n $temp = $temp.\" years ago\";\n return($temp);\n }\n else if(((int)date('m') - (int)$y[1]) > 0)\n {\n $temp = ((int)date('m') - (int)$y[1]);\n $temp = $temp.\" months ago\";\n return($temp);\n }\n else if(((int)date('d') - (int)$y[2]) > 0)\n {\n $temp = ((int)date('d') - (int)$y[2]);\n $temp = $temp.\" days ago\";\n return($temp);\n }\n else if(((int)date('H') - (int)$z[0]) > 0)\n {\n $temp = ((int)date('H') - (int)$z[0]);\n $temp = $temp.\" hrs ago\";\n return($temp);\n }\n else if(((int)date('i') - (int)$z[1]) > 0)\n {\n $temp = ((int)date('i') - (int)$z[1]);\n $temp = $temp.\" mins ago\";\n return($temp);\n }\n }",
"function rtime ()\n{\n $time = explode (\" \", microtime ());\n return (double) ((double) $time[0] + (double) $time[1]);\n}",
"function _get_time()\n{\n $_mtime = microtime();\n $_mtime = explode(\" \", $_mtime);\n\n return (double) ($_mtime[1]) + (double) ($_mtime[0]);\n}",
"function when($parameters) { // $parameters = ['timestamp'], ['numberOfUnits']\n\t$currentTime = time();\n\t\n\tif (preg_match ( '/\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{1,2}:\\d{1,2}:\\d{1,2}/u', $parameters['timestamp'] )) // /d -> 0-9, nt 1978-2-3 5:8:9, u on seotud UTF-8 ga\n\t{\n\t\t$time = strtotime( $parameters['timestamp'] ); //konventeerib sekunditeks\n\t}\n\telse {\n\t\t$time = $parameters['timestamp'];\n\t}\n\n\tif($currentTime > $time){\n\t\t$difference = $currentTime - $time;\n\t} else {\n\t\t$difference = $time - $currentTime;\n\t}\n\n\t$units = array (\n\t\t\t'second',\n\t\t\t'minute',\n\t\t\t'hour',\n\t\t\t'day',\n\t\t\t'week',\n\t\t\t'month',\n\t\t\t'year',\n\t\t\t'decade'\n\t);\n\t\n\t$secondsInSecond = 1;\n\t$secondsInMinute = 60;\n\t$secondsInHour = $secondsInMinute*60;\n\t$secondsInDay = $secondsInHour*24;\n\t$secondsInWeek = $secondsInDay*7;\n\t$secondsInMonth = $secondsInWeek*(4+1/3);\n\t$secondsInYear = $secondsInMonth*12;\n\t$secondsInDecade = $secondsInYear*10;\n\t\n\t$sizes = array (\t\t\t\t//$sizes = array (\n\t\t\t$secondsInSecond, \t\t//1, //sekund\n\t\t\t$secondsInMinute, \t\t//60, //minut\n\t\t\t$secondsInHour, \t\t// 60*60, //tund\n\t\t\t$secondsInDay,\t\t\t//60*60*24, //päev\n\t\t\t$secondsInWeek, \t\t//60*60*24*7, //nädal\n\t\t\t$secondsInMonth,\t\t//60*60*24*7*(4+1/3), //kuu\n\t\t\t$secondsInYear, \t\t//60*60*24*7*(4+1/3)*12, //aasta\n\t\t\t$secondsInDecade \t\t//60*60*24*7*(4+1/3)*12*10 //kümmend\n\t);\n\n\tfor($positionInUnits = sizeof ( $sizes ) - 1; ($positionInUnits >= 0) && \n\t\t(($amountOfTime = $difference / $sizes [$positionInUnits]) <= 1); $positionInUnits --); \n\t\tif ($positionInUnits < 0)\n\t\t\t$positionInUnits = 0;\n\t\t$remainedTime = $currentTime - ($difference % $sizes [$positionInUnits]);\n\t\t$amountOfTime = floor ( $amountOfTime );\n\t\tif ($amountOfTime != 1) \n\t\t\t$units [$positionInUnits] .= 's';\n\t\t$when = sprintf ( \"%d %s \", $amountOfTime, $units [$positionInUnits] );\n\t\tif (($parameters['numberOfUnits'] == 0) && ($positionInUnits >= 1) && (($currentTime - $remainedTime) > 0))\n\t\t$when .= when ( $remainedTime);\n\t\treturn $when;\n}",
"static public function get_time() {\n // By Zach Buller ([email protected])\n $time1 = \\microtime();\n \\settype($time1, 'string'); //convert to string to keep trailing zeroes\n $time2 = explode(\" \", $time1);\n $sub_secs = \\preg_replace('/0./', '', $time2[0], 1);\n $time3 = ($time2[1].$sub_secs)/100;\n return $time3;\n }",
"protected static function _timeToCake()\n {\n return TIME_START - $_SERVER['REQUEST_TIME_FLOAT'];\n }",
"function hebrew_delay_2($yr) {\n\n\t\t$last = hebrew_delay_1($yr - 1);\n\t\t$present = hebrew_delay_1($yr);\n\t\t$next = hebrew_delay_1($yr + 1);\n\n\t\treturn ( (($next - $present) == 356) ? 2 :\n\t\t\t\t\t((($present - $last) == 382) ? 1 : 0) );\n\t}",
"private function time_rule($time){\n $hour = floor($time/3600);//divisão retornando parte inteira.\n $hour_rest = fmod($time, 3600);//divisão retornando restante\n $min = floor($hour_rest/60); // calculo de minutos apartir do restante de horas\n $sec = fmod($hour_rest, 60); // calculos dos segundos\n return $this->number_format($sec,$min,$hour);\n }",
"function timeConversion($originalTime) {\n\t$newTime;\n\n $hours = substr($originalTime, 0, 2);\n $minutes = substr($originalTime, 3, 2);\n\n if ($hours > 12) $newTime = ($hours - 12) . \":\" . $minutes . \" PM\";\n else if ($hours == 12) $newTime = $hours . \":\" . $minutes . \" PM\";\n else if ($hours == 0) $newTime = 12 . \":\" . $minutes . \" AM\";\n else $newTime = substr($hours, 1) . \":\" . $minutes . \" AM\";\n\n \treturn $newTime;\n}",
"protected static function _timeToStopwatch()\n {\n return self::$_startupTime - $_SERVER['REQUEST_TIME_FLOAT'];\n }",
"function getTime(){\n\t\t$mtime = microtime();//print(\"\\n time : \" . $mtime);\n\t\t$mtime = explode(' ', $mtime);\n\t\t$mtime = $mtime[1] + $mtime[0];\n\t\treturn $mtime;\n\t}"
]
| [
"0.6263883",
"0.58469164",
"0.58258885",
"0.5802",
"0.5769836",
"0.57294226",
"0.5692107",
"0.5669839",
"0.5660477",
"0.56457746",
"0.55581665",
"0.5536663",
"0.55051166",
"0.5496144",
"0.5493948",
"0.5483826",
"0.5466968",
"0.5451982",
"0.54461086",
"0.54424757",
"0.53583544",
"0.5348313",
"0.5346776",
"0.53353876",
"0.5288345",
"0.5249255",
"0.52375084",
"0.5227138",
"0.5226258",
"0.52005845"
]
| 0.6945714 | 0 |
Function to calculate the corrected time based on ECHO handicap | function ECHO_calc($elapsed, $handicap, $reverse = false){
// Parameters: $elapsed
// Type: integer, number of seconds of elapsed time
// $handicap
// Type: float, the ECHO handicap value
// Returns: integer, number of seconds of corrected time
if($reverse){
return intval(round(intval($elapsed) / floatval($handicap), 0));
}else{
return intval(round(intval($elapsed) * floatval($handicap), 0));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function PY_calc($elapsed, $handicap){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the RYA PY handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\n\t\t// Different countries use different PY bases\n\t\t$ci =& get_instance();\n\t\tif($ci->userdata->session('locale') == 'uk'){\n\t\t\t$base = 1000;\n\t\t}else{\n\t\t\t$base = 100;\n\t\t}\n\t\t\n\t\tif($reverse){\n\t\t\treturn round(intval($elapsed) * intval($handicap) / $base, 0);\n\t\t}else{\n\t\t\t$tcc = round(intval($elapsed) * $base / intval($handicap), 0);\n\t\t\treturn $tcc;\n\t\t}\n\t}",
"public function getAnswerTime();",
"public function getFormattedTurnaroundTime()\n\t{\n\t\t\n\t\t$tat = $this->getTurnaroundTime();\n\t\t\n\t\t$ftat = \"\";\n\t\t$tat_y = intval($tat/(365*24*60*60));\n\t\t$tat_w = intval(($tat-($tat_y*(365*24*60*60)))/(7*24*60*60));\n\t\t$tat_d = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60)))/(24*60*60));\n\t\t$tat_h = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60)))/(60*60));\n\t\t$tat_m = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60))-($tat_h*(60*60)))/(60));\n\t\t$tat_s = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60))-($tat_h*(60*60))-($tat_m*(60))));\n\t\tif($tat_y > 0) $ftat = $tat_y.\" \".Lang::choice('messages.year',$tat_y).\" \";\n\t\tif($tat_w > 0) $ftat .= $tat_w.\" \".Lang::choice('messages.week',$tat_w).\" \";\n\t\tif($tat_d > 0) $ftat .= $tat_d.\" \".Lang::choice('messages.day',$tat_d).\" \";\n\t\tif($tat_h > 0) $ftat .= $tat_h.\" \".Lang::choice('messages.hour',$tat_h).\" \";\n\t\tif($tat_m > 0) $ftat .= $tat_m.\" \".Lang::choice('messages.minute',$tat_m).\" \";\n\t\tif($tat_s > 0) $ftat .= $tat_s.\" \".Lang::choice('messages.second',$tat_s);\n\n\t\treturn $ftat;\n\t}",
"function IRC_calc($elapsed, $handicap, $reverse = false){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the IRC handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\t\tif($reverse){\n\t\t\treturn intval(round(intval($elapsed) / floatval($handicap), 0));\n\t\t}else{\n\t\t\treturn intval(round(intval($elapsed) * floatval($handicap), 0));\n\t\t}\n\t}",
"function correctTime($Hours,$Minutes,$Seconds, &$printArray)\n{\n\tarray_push($printArray,\"CorrectTime (before loops): H:$Hours M:$Minutes S:$Seconds <br>\");\n\t//echo nl2br(\"Seconds are now: $Seconds \\n\");\n\tif($Seconds>=60)\n\t{\n\t\t$CaryOver=$Seconds%60;\n\t\t$Minutes+=floor($Seconds/60);\n\t\t$Seconds=$CaryOver;\n\t\t//echo nl2br(\"Seconds are now: $CarryOver \\n\");\n\t\t\n\t}\n\n\tif($Minutes>=60)\n\t{\n\t\t$CaryOver=$Minutes%60; //Remainder\n\t\t$Hours+=floor($Minutes/60);\n\t\t$Minutes=$CaryOver;\n\t\t//echo nl2br(\"Minutes are now: $CarryOver \\n\");\n\t\t\n\t}\n\t\n\t//NOW Correct the FORMAT\n\tif($Hours<10)\n\t{$Hours=\"0\".$Hours;}\t\n\tif($Minutes<10)\n\t{$Minutes=\"0\".$Minutes;}\n\tif($Seconds<10)\n\t{$Seconds=\"0\".$Seconds;}\n\t\n\n array_push($printArray,\"CorrectTime (after): H:$Hours M:$Minutes S:$Seconds <br><br>\");\n\t\n\treturn array($Hours,$Minutes,$Seconds);\n}",
"private function calculateTime()\n {\n $slowest = 1000000;\n for($i=1; $i<=12; $i++){\n if($_GET['Tr'.$i] > 0 && $slowest > $this->troopCostsProperties['Tr'.$i][5] ){\n $slowest = $this->troopCostsProperties['Tr'.$i][5];\n }\n }\n $time = $this->distance/($slowest*SERVER_SPEED_RATE);\n return $time;\n }",
"function TimeToSecondsNEW($inputTime) \n{\t\n\t//now i need to strip h m s from this \n\t$s= substr($inputTime, (strlen($inputTime)-2)); // makes seconds the last 2 chars\n $inputTime=substr($inputTime,0,-3);//$inputTime=str_replace((\":\" . $s), \"\", $inputTime);\t//gets rid of seconds and :\n\t$m= substr($inputTime, (strlen($inputTime)-2)); \n\t$inputTime=substr($inputTime,0,-3);//$inputTime=str_replace((\":\" . $m), \"\", $inputTime);\t//gets rid of minutes and :\n\t$h= $inputTime; \n\t\n\t//USE THIS FOR TOTALS? add each individual piece\n\t$totalH=($h*60*60);\n\t$totalM=($m*60);\n\t$totalS=($s);\n\t\n\t//Then send updated totals back to user\t\t\n\treturn ($totalH+$totalM+$totalS);\n}",
"function timeConversion($originalTime) {\n\t$newTime;\n\n $hours = substr($originalTime, 0, 2);\n $minutes = substr($originalTime, 3, 2);\n\n if ($hours > 12) $newTime = ($hours - 12) . \":\" . $minutes . \" PM\";\n else if ($hours == 12) $newTime = $hours . \":\" . $minutes . \" PM\";\n else if ($hours == 0) $newTime = 12 . \":\" . $minutes . \" AM\";\n else $newTime = substr($hours, 1) . \":\" . $minutes . \" AM\";\n\n \treturn $newTime;\n}",
"function calc_chegada($partida,$tempo){\n \n \n $aux=split(\":\",$partida);\n\t\t$p=mktime($aux[0],$aux[1],$aux[2]);\n\n\t\t$aux=split(\":\",$tempo);\n\t\t$t=$aux[0]*3600+$aux[1]*60+$aux[2];\n\t\t\n\t\t$c=strftime(\"%H:%M:%S\",$p+$t);\n\t\t//echo \"$p<br>\";\n\t\t//echo \"$t<br>\";\n // echo $t+$p . \"<br>\";\n //echo \"$c<br>\";\n\t\t\n\t\treturn $c;\n }",
"protected static function _timeToCake()\n {\n return TIME_START - $_SERVER['REQUEST_TIME_FLOAT'];\n }",
"function win_time($timestr) {\r\n return substr($timestr, 4, 2) . \"/\" . substr($timestr, 6, 2) . \"/\" .\r\n substr($timestr, 0, 4) . \" \" . substr($timestr, 8, 2) . \":\" .\r\n substr($timestr, 10, 2) . \":\" . substr($timestr, 12, 2) . \" \" .\r\n substr($timestr, -4);\r\n}",
"private function time_rule($time){\n $hour = floor($time/3600);//divisão retornando parte inteira.\n $hour_rest = fmod($time, 3600);//divisão retornando restante\n $min = floor($hour_rest/60); // calculo de minutos apartir do restante de horas\n $sec = fmod($hour_rest, 60); // calculos dos segundos\n return $this->number_format($sec,$min,$hour);\n }",
"function tambahWaktu2($jam_mulai,$jam_selesai){\n//echo \"<br>\";\n//echo \"Jam Selesai : \".$jam_selesai='09:45:01';\n//echo \"<br>\";\n $times = array($jam_mulai,$jam_selesai);\n//$times = array('08:30:22','09:45:53');\n $seconds = 0;\n foreach ( $times as $time )\n {\n \tlist( $g, $i, $s ) = explode( ':', $time );\n \t$seconds += $g * 3600;\n \t$seconds += $i * 60;\n \t$seconds += $s;\n \n \n }\n $hours = floor( $seconds / 3600);\n if($hours<10){\n $hours='0'.$hours;\n }\n \n $seconds -= $hours * 3600;\n $minutes = floor( $seconds / 60);\n if($minutes<10){\n $minutes='0'.$minutes;\n }\n \n $seconds -= $minutes * 60; \n if($seconds<10){\n $seconds='0'.$seconds;\n } \n \n $waktu2=\"{$hours}:{$minutes}:{$seconds}\";\n return $waktu2;\n \n}",
"function time_calc($up_time)\n {\n // time is of the form YYYY-MM-DD HH:MM:SS.MILISEC\n $x = explode(' ', $up_time);\n $y = explode('-', $x[0]);\n $z = explode(':', $x[1]);\n\n // condition for year\n if(((int)date('Y') - (int)$y[0]) > 0)\n {\n $temp = ((int)date('Y') - (int)$y[0]);\n $temp = $temp.\" years ago\";\n return($temp);\n }\n else if(((int)date('m') - (int)$y[1]) > 0)\n {\n $temp = ((int)date('m') - (int)$y[1]);\n $temp = $temp.\" months ago\";\n return($temp);\n }\n else if(((int)date('d') - (int)$y[2]) > 0)\n {\n $temp = ((int)date('d') - (int)$y[2]);\n $temp = $temp.\" days ago\";\n return($temp);\n }\n else if(((int)date('H') - (int)$z[0]) > 0)\n {\n $temp = ((int)date('H') - (int)$z[0]);\n $temp = $temp.\" hrs ago\";\n return($temp);\n }\n else if(((int)date('i') - (int)$z[1]) > 0)\n {\n $temp = ((int)date('i') - (int)$z[1]);\n $temp = $temp.\" mins ago\";\n return($temp);\n }\n }",
"function humanTiming ($time)\n {\n\n $time = time() - $time; // to get the time since that moment\n $time = ($time<1)? 1 : $time;\n $tokens = array (\n 31536000 => 'tahun',\n 2592000 => 'bulan',\n 604800 => 'minggu',\n 86400 => 'hari',\n 3600 => 'jam',\n 60 => 'menit',\n 1 => 'detik'\n );\n\n foreach ($tokens as $unit => $text) {\n if ($time < $unit) continue;\n $numberOfUnits = floor($time / $unit);\n return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');\n }\n\n }",
"function SecondsToTimeNEW($inputTime) \n{\t\n\t//echo nl2br(\"Seconds are now: $Seconds \\n\");\n\t//HOUR\n\tif($inputTime>=(60*60))\n\t{\n\t\t$CaryOver=$inputTime%(60*60);\n\t\t$Hours=floor($inputTime/(60*60));\n\t\t$inputTime=$CaryOver;\n\t\t\n\t}\n //MIN\n\tif($inputTime>=60)\n\t{\n\t\t$CaryOver=$inputTime%60; //Remainder\n\t\t$Minutes=floor($inputTime/60);\n\t\t$inputTime=$CaryOver;\n\t\t//echo nl2br(\"Minutes are now: $CarryOver \\n\");\n\t\t\n\t}\n\t//SEC\n\t$Seconds=$inputTime;\n\t\t\n\t//NOW Correct the FORMAT\n\tif($Hours<10)\n\t{$Hours=\"0\".$Hours;}\t\n\tif($Minutes<10)\n\t{$Minutes=\"0\".$Minutes;}\n\tif($Seconds<10)\n\t{$Seconds=\"0\".$Seconds;}\n\t\n\t\n\treturn (\"$Hours:$Minutes:$Seconds\");\n}",
"public function getTurnaroundTime()\n\t{\n\t\t$startTime = new DateTime($this->specimen->time_accepted);\n\t\t$endTime = new DateTime($this->time_verified);\n\t\t$interval = $startTime->diff($endTime);\n\n\t\t$turnaroundTime = ($interval->days * 24 * 3600) + ($interval->h * 3600) + ($interval->i * 60) + ($interval->s);\n\n\t\t\n\t\treturn $turnaroundTime;\n\t}",
"private function getTimeCorrection(): int\n\t{\n\t\treturn config('curl-connection.' . $this->service . '.time_correction');\n\t}",
"function translate_time($t) {\n /* US only :)\n $a_times = array(\n '9:00' => '9am' , '9:45' => '9:45'\n , '10:00' => '10am', '10:15' =>'10:15', '10:30' =>'10:30', '10:45' => '10:45'\n , '11:00' => '11am', '11:15' =>'11:15', '11:30' =>'11:30', '11:45' => '11:45'\n , '12:00' => '12pm', '12:15' =>'12:15', '12:30' =>'12:30', '12:45' => '12:45'\n , '13:00' => '1pm', '13:15' => '1:15', '13:30' => '1:30', '13:45' => '1:45'\n , '14:00' => '2pm', '14:15' => '2:15', '14:30' => '2:30', '14:45' => '2:45'\n , '15:00' => '3pm', '15:15' => '3:15', '15:30' => '3:30', '15:45' => '3:45'\n , '16:00' => '4pm', '16:15' => '4:15', '16:30' => '4:30', '16:45' => '4:45'\n , '17:00' => '5pm', '17:15' => '5:15', '17:30' => '5:30', '17:45' => '5:45'\n , '18:00' => '6pm', '18:15' => '6:15'\n , '20:00' => '8pm', '22:00' => '10pm'\n );\n if (isset($a_times[$t])) return $a_times[$t];\n */\n return $t;\n }",
"function timecheck ($time) {\n $min = 0;\n if($time->h >= 1) {\n $min += 60*$time->h;\n }\n $min += $time->i;\n if($min == 0) {\n return \"Passage en cours...\";\n } else {\n return $min.\" min\";\n }\n \n\n}",
"function counttime()\n{\n global $time;\n\n $arrHour = explode(\":\", $time);\n $arrTime2 = array(8, 10, 12, 14, 16, 18, 20, 22, 24);\n foreach ($arrTime2 as $intTime)\n {\n if ($arrHour[0] < $intTime)\n {\n $intWait = (($intTime - $arrHour[0]) * 60) - $arrHour[1];\n $intHours = floor($intWait / 60);\n $intMinutes = $intWait % 60;\n break;\n }\n }\n $arrTime = array('', '');\n if ($intHours < 1)\n {\n $arrTime[0] = '';\n }\n if ($intHours == 1)\n {\n $arrTime[0] = $intHours.T_HOUR;\n }\n if ($intHours > 1 && $intHours < 5)\n {\n $arrTime[0] = $intHours.T_HOURS2;\n }\n if ($intHours > 4)\n {\n $arrTime[0] = $intHours.T_HOURS;\n }\n if ($intMinutes < 1)\n {\n $arrTime[1] = '';\n }\n if ($intMinutes == 1)\n {\n $arrTime[1] = $intMinutes.T_MINUTE;\n }\n if (($intMinutes > 1 && $intMinutes < 5) || @ereg(\"^[2-5][2-4]*$\", $intMinutes))\n {\n $arrTime[1] = $intMinutes.T_MINUTES2;\n }\n if (($intMinutes > 4 && $intMinutes < 20) || @ereg(\"^[2-5][5-9]*$\", $intMinutes) || @ereg(\"^[2-5][0-1]*$\", $intMinutes))\n {\n $arrTime[1] = $intMinutes.T_MINUTES;\n }\n\n return $arrTime;\n}",
"function timeConversion($s) {\n /*\n * Write your code here.\n */\n $timeArray = explode(':', $s);\n $hour = $timeArray[0];\n $minute = $timeArray[1];\n $sec = $timeArray[2];\n $period = substr($sec, 2);\n $originalSec = rtrim($sec, $period);\n $newTime;\n if((0 <= $hour && $hour < 12) && ($period == 'AM')) {\n $newTime = $hour.\":\".$minute.\":\".$originalSec;\n }elseif ((0 <= $hour && $hour < 12) && ($period == 'PM')) {\n $newTime = 12+$hour.\":\".$minute.\":\".$originalSec;\n }elseif (($hour == 12) && ($period == 'AM')) {\n $newTime = \"00\".\":\".$minute.\":\".$originalSec;\n }elseif (($hour == 12) && ($period == 'PM')) {\n $newTime = $hour.\":\".$minute.\":\".$originalSec;\n }\n\n return $newTime; \n\n\n\n}",
"function humanTiming ($time){\n $time = (time()- 2*60*60)- $time; // to get the time since that moment\n $time = ($time<1)? 1 : $time;\n $tokens = array (\n 31536000 => 'year',\n 2592000 => 'month',\n 604800 => 'week',\n 86400 => 'day',\n 3600 => 'hour',\n 60 => 'minute',\n 1 => 'second'\n );\n\n foreach ($tokens as $unit => $text) {\n if ($time < $unit) continue;\n $numberOfUnits = floor($time / $unit);\n return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');\n }\n }",
"function TimeToSeconds($inputTime, &$printArray) \n{\t\n\t//now i need to strip h m s from this \n\t$s= substr($inputTime, (strlen($inputTime)-2)); // makes seconds the last 2 chars\n $inputTime=substr($inputTime,0,-3);//$inputTime=str_replace((\":\" . $s), \"\", $inputTime);\t//gets rid of seconds and :\n\t$m= substr($inputTime, (strlen($inputTime)-2)); \n\t$inputTime=substr($inputTime,0,-3);//$inputTime=str_replace((\":\" . $m), \"\", $inputTime);\t//gets rid of minutes and :\n\t$h= $inputTime; \n\t\n\t//PRINT\n\tarray_push($printArray,\"TimeToSeconds(adding/before): $h:$m:$s <br>\");\n\t\n\t//USE THIS FOR TOTALS? add each individual piece\n\t$totalH=($h*60*60);\n\t$totalM=($m*60);\n\t$totalS=($s);\n\t\n\t//Then send updated totals back to user\t\n\t\n\t//PRINT\n\tarray_push($printArray,\"TimeToSeconds: TotalTime- $totalH:$totalM:$totalS, Total: (\". ($totalH+$totalM+$totalS) .\") <br>\");\n\t\n\treturn ($totalH+$totalM+$totalS);\n}",
"public function timeMid();",
"function humanTiming($time) {\n\tif(time() - $time >= 345600) {\n return date(\"m/d/Y g:i A\", $time);\n }\n $time = time() - $time;\n if (strval($time) < 1) {\n $time = 1;\n }\n $tokens = array(86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second');\n foreach ($tokens as $unit => $text){\n if($time < $unit) continue;\n $numberOfUnits = floor($time / $unit);\n return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':''). ' ago';\n }\n}",
"public function calculate_time(){\n\t\t\n\t\t$time_zone = new DateTimeZone('Asia/Colombo');\n\t\t\n\t\t$current_time = new DateTime(\"now\",$time_zone);\n\t\t$temp = $current_time->format(\"Y/m/28 06:00:00\");\n\n\t\t$end_time = new DateTime($temp,$time_zone);\n\t\n//\t\techo date_format($current_time,\"Y/m/d H:i:s\").\"<br>\";\n//\t\techo date_format($end_time,\"Y/m/d H:i:s\").\"<br>\";\n\n\t\t$file = 'timer.txt';\n\t\t\n\t\tif($end_time<$current_time){\n\n\t\t\tif($this->run_once_check($file)){\n\t\t\t\t//run the program\n\t\t\t}\n\t\t}\n\t\telseif(file_exists($file)){\n\t\t\t$this->delete_file($file);\n\t\t}\n\n\t}",
"function time_to_secs($time)\n{\n$timeArr = array_reverse(split(\":\", $time));\n$seconds = 0;\n$vals = Array(1, 60, 3600, 86400);\nforeach($timeArr as $key => $value)\n{\nif(!isset($vals[$key]))\nbreak;\n$seconds += $value * $vals[$key];\n}\nreturn $seconds;\n}",
"function timeConversion($s) {\n /*\n * Write your code here.\n */\n $tim = \"\";\n $arr = preg_split(\"/[:]/\",$s);\n\n if( preg_match( '/AM$/', $arr[2]) ) {\n $replace = str_replace('AM', '', $arr[2]);\n if($arr[0] === \"12\"){\n $arr[0] = \"00\";\n }\n }else{ // PM\n $replace = str_replace('PM', '', $arr[2]);\n\n if($arr[0] !== \"12\"){\n $arr[0] = strval(intval($arr[0]) + 12);\n }\n }\n $arr[2] = $replace;\n return $arr[0] .\":\". $arr[1] .\":\". $arr[2];\n}",
"function times2str ($t1,$t2) {\n\tif ($t1 == '00:00:00' OR $t1 == '')\n\t\treturn '';\n\t// no end time\n\tif ($t2 == '00:00:00' OR $t2 == '')\n\t\treturn time2str($t1);\n\tlist($h1,$m1,$s1) = explode(\":\",$t1);\n\tlist($h2,$m2,$s2) = explode(\":\",$t2);\n\t$ampm1 = ($h1 >= 12) ? \" p.m.\" : \" a.m.\";\n\t$ampm2 = ($h2 >= 12) ? \" p.m.\" : \" a.m.\";\n\t$ampm1 = ($ampm1 != $ampm2) ? $ampm1 : \"\";\n\t// if time1 is 12:xx p.m.\n\tif ($h1 == \"12\") {\n\t\t$time_str = ($m1 > 0) ? \"12:\" . $m1 . $ampm1 : \"Noon\";\n\t} else {\n\t\t$time_str = ($m1 > 0) ? $h1 % 12 . \":\" . $m1 . $ampm1 : $h1 % 12 . $ampm1;\n\t}\n\t$time_str .= \"-\";\n\tif ($h2 == \"12\") {\n\t\t$time_str .= ($m2 > 0) ? \"12:\" . $m2 . $ampm2 : \"Noon\";\n\t} else {\n\t\t$time_str .= ($m2 > 0) ? $h2 % 12 . \":\" . $m2 . $ampm2 : $h2 % 12 . $ampm2;\n\t}\n\treturn ($time_str);\n}"
]
| [
"0.6641398",
"0.6500605",
"0.63889897",
"0.6357268",
"0.61501324",
"0.61136264",
"0.60694534",
"0.60689706",
"0.60263145",
"0.60058665",
"0.6000712",
"0.599514",
"0.5970636",
"0.5970206",
"0.5932257",
"0.5899362",
"0.5852879",
"0.58127165",
"0.58127046",
"0.5764609",
"0.5750376",
"0.5730568",
"0.57159185",
"0.56659186",
"0.56589335",
"0.5642828",
"0.5637221",
"0.56303835",
"0.5610933",
"0.56028533"
]
| 0.6707137 | 0 |
Function to calculate the corrected time based on IRC handicap | function IRC_calc($elapsed, $handicap, $reverse = false){
// Parameters: $elapsed
// Type: integer, number of seconds of elapsed time
// $handicap
// Type: float, the IRC handicap value
// Returns: integer, number of seconds of corrected time
if($reverse){
return intval(round(intval($elapsed) / floatval($handicap), 0));
}else{
return intval(round(intval($elapsed) * floatval($handicap), 0));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function getTimeCorrection(): int\n\t{\n\t\treturn config('curl-connection.' . $this->service . '.time_correction');\n\t}",
"function PY_calc($elapsed, $handicap){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the RYA PY handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\n\t\t// Different countries use different PY bases\n\t\t$ci =& get_instance();\n\t\tif($ci->userdata->session('locale') == 'uk'){\n\t\t\t$base = 1000;\n\t\t}else{\n\t\t\t$base = 100;\n\t\t}\n\t\t\n\t\tif($reverse){\n\t\t\treturn round(intval($elapsed) * intval($handicap) / $base, 0);\n\t\t}else{\n\t\t\t$tcc = round(intval($elapsed) * $base / intval($handicap), 0);\n\t\t\treturn $tcc;\n\t\t}\n\t}",
"function time_calc($up_time)\n {\n // time is of the form YYYY-MM-DD HH:MM:SS.MILISEC\n $x = explode(' ', $up_time);\n $y = explode('-', $x[0]);\n $z = explode(':', $x[1]);\n\n // condition for year\n if(((int)date('Y') - (int)$y[0]) > 0)\n {\n $temp = ((int)date('Y') - (int)$y[0]);\n $temp = $temp.\" years ago\";\n return($temp);\n }\n else if(((int)date('m') - (int)$y[1]) > 0)\n {\n $temp = ((int)date('m') - (int)$y[1]);\n $temp = $temp.\" months ago\";\n return($temp);\n }\n else if(((int)date('d') - (int)$y[2]) > 0)\n {\n $temp = ((int)date('d') - (int)$y[2]);\n $temp = $temp.\" days ago\";\n return($temp);\n }\n else if(((int)date('H') - (int)$z[0]) > 0)\n {\n $temp = ((int)date('H') - (int)$z[0]);\n $temp = $temp.\" hrs ago\";\n return($temp);\n }\n else if(((int)date('i') - (int)$z[1]) > 0)\n {\n $temp = ((int)date('i') - (int)$z[1]);\n $temp = $temp.\" mins ago\";\n return($temp);\n }\n }",
"function reply_time() {\n\tglobal $reply;\n\treturn $reply['time'];\n}",
"public function getAnswerTime();",
"public static function normalizedTime() {\n\t\t$offset = 0;\n\t\ttry {\n\t\t\t$offset = wfWAF::getInstance()->getStorageEngine()->getConfig('timeoffset_ntp', false);\n\t\t\tif ($offset === false) {\n\t\t\t\t$offset = wfWAF::getInstance()->getStorageEngine()->getConfig('timeoffset_wf', false);\n\t\t\t\tif ($offset === false) { $offset = 0; }\n\t\t\t}\n\t\t}\n\t\tcatch (Exception $e) {\n\t\t\t//Ignore\n\t\t}\n\t\treturn time() + $offset;\n\t}",
"function TimeToSecondsNEW($inputTime) \n{\t\n\t//now i need to strip h m s from this \n\t$s= substr($inputTime, (strlen($inputTime)-2)); // makes seconds the last 2 chars\n $inputTime=substr($inputTime,0,-3);//$inputTime=str_replace((\":\" . $s), \"\", $inputTime);\t//gets rid of seconds and :\n\t$m= substr($inputTime, (strlen($inputTime)-2)); \n\t$inputTime=substr($inputTime,0,-3);//$inputTime=str_replace((\":\" . $m), \"\", $inputTime);\t//gets rid of minutes and :\n\t$h= $inputTime; \n\t\n\t//USE THIS FOR TOTALS? add each individual piece\n\t$totalH=($h*60*60);\n\t$totalM=($m*60);\n\t$totalS=($s);\n\t\n\t//Then send updated totals back to user\t\t\n\treturn ($totalH+$totalM+$totalS);\n}",
"function ECHO_calc($elapsed, $handicap, $reverse = false){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the ECHO handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\n\t\tif($reverse){\n\t\t\treturn intval(round(intval($elapsed) / floatval($handicap), 0));\n\t\t}else{\n\t\t\treturn intval(round(intval($elapsed) * floatval($handicap), 0));\n\t\t} \n\t}",
"function win_time($timestr) {\r\n return substr($timestr, 4, 2) . \"/\" . substr($timestr, 6, 2) . \"/\" .\r\n substr($timestr, 0, 4) . \" \" . substr($timestr, 8, 2) . \":\" .\r\n substr($timestr, 10, 2) . \":\" . substr($timestr, 12, 2) . \" \" .\r\n substr($timestr, -4);\r\n}",
"public function getTurnaroundTime()\n\t{\n\t\t$startTime = new DateTime($this->specimen->time_accepted);\n\t\t$endTime = new DateTime($this->time_verified);\n\t\t$interval = $startTime->diff($endTime);\n\n\t\t$turnaroundTime = ($interval->days * 24 * 3600) + ($interval->h * 3600) + ($interval->i * 60) + ($interval->s);\n\n\t\t\n\t\treturn $turnaroundTime;\n\t}",
"function xtorrent_GetDownloadTime($size = 0, $gmodem = 1, $gisdn = 1, $gdsl = 1, $gslan = 0, $gflan = 0)\r\n{\r\n $aflag = [];\r\n $amtime = [];\r\n $artime = [];\r\n $ahtime = [];\r\n $asout = [];\r\n $aflag = [\r\n $gmodem,\r\n $gisdn,\r\n $gdsl,\r\n $gslan,\r\n $gflan\r\n ];\r\n $amtime = [\r\n $size / 6300 / 60,\r\n $size / 7200 / 60,\r\n $size / 86400 / 60,\r\n $size / 1125000 / 60,\r\n $size / 11250000 / 60\r\n ];\r\n $amname = [\r\n 'Modem(56k)',\r\n 'ISDN(64k)',\r\n 'DSL(768k)',\r\n 'LAN(10M)',\r\n 'LAN(100M)'\r\n ];\r\n for($i = 0;$i < 5;$i++)\r\n { \r\n $artime[$i] = ($amtime[$i] % 60);\r\n } \r\n for($i = 0;$i < 5;$i++)\r\n {\r\n $ahtime[$i] = sprintf(' %2.0f', $amtime[$i] / 60);\r\n } \r\n if ($size <= 0)\r\n {\r\n $dltime = 'N/A';\r\n }\r\n else\r\n {\r\n for($i = 0; $i < 5; $i++)\r\n {\r\n if (!$aflag[$i]) $asout[$i] = '';\r\n else\r\n {\r\n if (($amtime[$i] * 60) < 1)\r\n {\r\n $asout[$i] = sprintf(' : %4.2fs', $amtime[$i] * 60);\r\n }\r\n else\r\n {\r\n if ($amtime[$i] < 1)\r\n {\r\n $asout[$i] = sprintf(' : %2.0fs', round($amtime[$i] * 60));\r\n }\r\n else\r\n {\r\n if (0 == $ahtime[$i])\r\n {\r\n $asout[$i] = sprintf(' : %5.1fmin', $amtime[$i]);\r\n }\r\n else\r\n {\r\n $asout[$i] = sprintf(' : %2.0fh%2.0fmin', $ahtime[$i], $artime[$i]);\r\n }\r\n } \r\n } \r\n $asout[$i] = '<b>' . $amname[$i] . '</b>' . $asout[$i];\r\n if ($i < 4)\r\n {\r\n $asout[$i] = $asout[$i] . ' | ';\r\n }\r\n } \r\n } \r\n $dltime = '';\r\n for($i = 0; $i < 5; $i++)\r\n {\r\n $dltime = $dltime . $asout[$i];\r\n } \r\n } \r\n return $dltime;\r\n}",
"private function calculateTime()\n {\n $slowest = 1000000;\n for($i=1; $i<=12; $i++){\n if($_GET['Tr'.$i] > 0 && $slowest > $this->troopCostsProperties['Tr'.$i][5] ){\n $slowest = $this->troopCostsProperties['Tr'.$i][5];\n }\n }\n $time = $this->distance/($slowest*SERVER_SPEED_RATE);\n return $time;\n }",
"function counttime()\n{\n global $time;\n\n $arrHour = explode(\":\", $time);\n $arrTime2 = array(8, 10, 12, 14, 16, 18, 20, 22, 24);\n foreach ($arrTime2 as $intTime)\n {\n if ($arrHour[0] < $intTime)\n {\n $intWait = (($intTime - $arrHour[0]) * 60) - $arrHour[1];\n $intHours = floor($intWait / 60);\n $intMinutes = $intWait % 60;\n break;\n }\n }\n $arrTime = array('', '');\n if ($intHours < 1)\n {\n $arrTime[0] = '';\n }\n if ($intHours == 1)\n {\n $arrTime[0] = $intHours.T_HOUR;\n }\n if ($intHours > 1 && $intHours < 5)\n {\n $arrTime[0] = $intHours.T_HOURS2;\n }\n if ($intHours > 4)\n {\n $arrTime[0] = $intHours.T_HOURS;\n }\n if ($intMinutes < 1)\n {\n $arrTime[1] = '';\n }\n if ($intMinutes == 1)\n {\n $arrTime[1] = $intMinutes.T_MINUTE;\n }\n if (($intMinutes > 1 && $intMinutes < 5) || @ereg(\"^[2-5][2-4]*$\", $intMinutes))\n {\n $arrTime[1] = $intMinutes.T_MINUTES2;\n }\n if (($intMinutes > 4 && $intMinutes < 20) || @ereg(\"^[2-5][5-9]*$\", $intMinutes) || @ereg(\"^[2-5][0-1]*$\", $intMinutes))\n {\n $arrTime[1] = $intMinutes.T_MINUTES;\n }\n\n return $arrTime;\n}",
"function time_to_secs($time)\n{\n$timeArr = array_reverse(split(\":\", $time));\n$seconds = 0;\n$vals = Array(1, 60, 3600, 86400);\nforeach($timeArr as $key => $value)\n{\nif(!isset($vals[$key]))\nbreak;\n$seconds += $value * $vals[$key];\n}\nreturn $seconds;\n}",
"function timeConversion($originalTime) {\n\t$newTime;\n\n $hours = substr($originalTime, 0, 2);\n $minutes = substr($originalTime, 3, 2);\n\n if ($hours > 12) $newTime = ($hours - 12) . \":\" . $minutes . \" PM\";\n else if ($hours == 12) $newTime = $hours . \":\" . $minutes . \" PM\";\n else if ($hours == 0) $newTime = 12 . \":\" . $minutes . \" AM\";\n else $newTime = substr($hours, 1) . \":\" . $minutes . \" AM\";\n\n \treturn $newTime;\n}",
"function get_time_offset()\n {\n \t$r = 0;\n \t\n \t$r = ( (isset($this->member['time_offset']) AND $this->member['time_offset'] != \"\") ? $this->member['time_offset'] : $this->vars['time_offset'] ) * 3600;\n\t\t\t\n\t\tif ( $this->vars['time_adjust'] )\n\t\t{\n\t\t\t$r += ($this->vars['time_adjust'] * 60);\n\t\t}\n\t\t\n\t\tif ( isset($this->member['dst_in_use']) AND $this->member['dst_in_use'] )\n\t\t{\n\t\t\t$r += 3600;\n\t\t}\n \t\n \treturn $r;\n }",
"protected static function _timeToCake()\n {\n return TIME_START - $_SERVER['REQUEST_TIME_FLOAT'];\n }",
"function SecondsToTimeNEW($inputTime) \n{\t\n\t//echo nl2br(\"Seconds are now: $Seconds \\n\");\n\t//HOUR\n\tif($inputTime>=(60*60))\n\t{\n\t\t$CaryOver=$inputTime%(60*60);\n\t\t$Hours=floor($inputTime/(60*60));\n\t\t$inputTime=$CaryOver;\n\t\t\n\t}\n //MIN\n\tif($inputTime>=60)\n\t{\n\t\t$CaryOver=$inputTime%60; //Remainder\n\t\t$Minutes=floor($inputTime/60);\n\t\t$inputTime=$CaryOver;\n\t\t//echo nl2br(\"Minutes are now: $CarryOver \\n\");\n\t\t\n\t}\n\t//SEC\n\t$Seconds=$inputTime;\n\t\t\n\t//NOW Correct the FORMAT\n\tif($Hours<10)\n\t{$Hours=\"0\".$Hours;}\t\n\tif($Minutes<10)\n\t{$Minutes=\"0\".$Minutes;}\n\tif($Seconds<10)\n\t{$Seconds=\"0\".$Seconds;}\n\t\n\t\n\treturn (\"$Hours:$Minutes:$Seconds\");\n}",
"public function getFormattedTurnaroundTime()\n\t{\n\t\t\n\t\t$tat = $this->getTurnaroundTime();\n\t\t\n\t\t$ftat = \"\";\n\t\t$tat_y = intval($tat/(365*24*60*60));\n\t\t$tat_w = intval(($tat-($tat_y*(365*24*60*60)))/(7*24*60*60));\n\t\t$tat_d = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60)))/(24*60*60));\n\t\t$tat_h = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60)))/(60*60));\n\t\t$tat_m = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60))-($tat_h*(60*60)))/(60));\n\t\t$tat_s = intval(($tat-($tat_y*(365*24*60*60))-($tat_w*(7*24*60*60))-($tat_d*(24*60*60))-($tat_h*(60*60))-($tat_m*(60))));\n\t\tif($tat_y > 0) $ftat = $tat_y.\" \".Lang::choice('messages.year',$tat_y).\" \";\n\t\tif($tat_w > 0) $ftat .= $tat_w.\" \".Lang::choice('messages.week',$tat_w).\" \";\n\t\tif($tat_d > 0) $ftat .= $tat_d.\" \".Lang::choice('messages.day',$tat_d).\" \";\n\t\tif($tat_h > 0) $ftat .= $tat_h.\" \".Lang::choice('messages.hour',$tat_h).\" \";\n\t\tif($tat_m > 0) $ftat .= $tat_m.\" \".Lang::choice('messages.minute',$tat_m).\" \";\n\t\tif($tat_s > 0) $ftat .= $tat_s.\" \".Lang::choice('messages.second',$tat_s);\n\n\t\treturn $ftat;\n\t}",
"function correctTime($Hours,$Minutes,$Seconds, &$printArray)\n{\n\tarray_push($printArray,\"CorrectTime (before loops): H:$Hours M:$Minutes S:$Seconds <br>\");\n\t//echo nl2br(\"Seconds are now: $Seconds \\n\");\n\tif($Seconds>=60)\n\t{\n\t\t$CaryOver=$Seconds%60;\n\t\t$Minutes+=floor($Seconds/60);\n\t\t$Seconds=$CaryOver;\n\t\t//echo nl2br(\"Seconds are now: $CarryOver \\n\");\n\t\t\n\t}\n\n\tif($Minutes>=60)\n\t{\n\t\t$CaryOver=$Minutes%60; //Remainder\n\t\t$Hours+=floor($Minutes/60);\n\t\t$Minutes=$CaryOver;\n\t\t//echo nl2br(\"Minutes are now: $CarryOver \\n\");\n\t\t\n\t}\n\t\n\t//NOW Correct the FORMAT\n\tif($Hours<10)\n\t{$Hours=\"0\".$Hours;}\t\n\tif($Minutes<10)\n\t{$Minutes=\"0\".$Minutes;}\n\tif($Seconds<10)\n\t{$Seconds=\"0\".$Seconds;}\n\t\n\n array_push($printArray,\"CorrectTime (after): H:$Hours M:$Minutes S:$Seconds <br><br>\");\n\t\n\treturn array($Hours,$Minutes,$Seconds);\n}",
"function getTime10sec(){\n /** Setting the variable to override the Warning **/\n $modifiedLast2=0;\n\n /** Getting the epoch seconds **/\n $time = microtime(false);\n $time = explode(\" \", $time); \n $time = $time[1];\n \n\n /** Splitting the epoch removing the last 2 digits **/\n $epochLength = strlen($time);\n $last2=$epochLength-2;\n $allTime=substr($time,0,$last2);\n $last2 = substr($time,$last2);\n\n /** Checking the seconds to modify the last 2 digits **/\n if($last2>=0&&$last2<=10){\n $modifiedLast2=01;\n }elseif($last2>=11&&$last2<=20){\n $modifiedLast2=11;\n }elseif($last2>=21&&$last2<=30){\n $modifiedLast2=21;\n }elseif($last2>=31&&$last2<=40){\n $modifiedLast2=31;\n }elseif($last2>=41&&$last2<=50){\n $modifiedLast2=41;\n }elseif($last2>=51&&$last2<=60){\n $modifiedLast2=51;\n }elseif($last2>=61&&$last2<=70){\n $modifiedLast2=61;\n }elseif($last2>=71&&$last2<=80){\n $modifiedLast2=71;\n }elseif($last2>=81&&$last2<=90){\n $modifiedLast2=81;\n }elseif($last2>=91&&$last2<=100){\n $modifiedLast2=91;\n }\n\n /** Merging the original first part with the modified last 2 digits **/\n $modifiedTime=$allTime.$modifiedLast2;\n\n /** Returning the modified epoch **/\n return $modifiedTime;\n }",
"function net_time($timestamp=NULL)\n{\n $ts = ($timestamp == NULL) ? time() : intval($timestamp);\n\n list($h,$m,$s) = split(':',gmdate('H:i:s',$ts));\n list($u,$ts) = ($timestamp == NULL) ? split(' ',microtime()) : array(0,0);\n\n $deg = $h * 15; // 0-345 (increments of 15)\n $deg = $deg + floor($m / 4); // 0-14\n\n $min = ($m % 4) * 15; // 0,15,30,45\n $min = $min + floor($s / 4); // 0-14\n\n $sec = ($s % 4) * 15; // 0,15,30,45\n $sec = $sec + ((60 * $u) / 4); // 0-14\n\n return sprintf('%d%s %02d\\' %02d\" NET',$deg,unichr(176),$min,$sec);\n}",
"function process_time(){\n $time = number_format( microtime(true) - LIM_START_MICROTIME, 6);\n return($time);\n}",
"function nicetime($sdate, $edate)\n{\n if(empty($sdate)) {\n return \"No date provided\";\n }\n \n $periods = array(\"second\", \"minute\", \"hour\", \"day\", \"week\", \"month\", \"year\", \"decade\");\n $lengths = array(\"60\",\"60\",\"24\",\"7\",\"4.35\",\"12\",\"10\");\n \n $now = strtotime($sdate);\n $unix_date = strtotime($edate);\n \n // check validity of date\n if(empty($unix_date)) { \n return \"Bad date\";\n }\n\n // is it future date or past date\n if($now > $unix_date) { \n $difference = $now - $unix_date;\n $tense = \"ago\";\n \n } else {\n $difference = $unix_date - $now;\n $tense = \"from now\";\n }\n \n/* for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {\n $difference /= $lengths[$j];\n }\n \n $difference = round($difference);\n \n if($difference != 1) {\n $periods[$j].= \"s\";\n }\n*/ \n return $difference/(60);// $periods[$j] {$tense}\";\n}",
"function calculateTime($trueIndex, $dataIndex) {\n\t\t$dataTime = self::$data[$dataIndex]['Time'];\n\t\t$trueTime = $this -> timeToSeconds(self::$groundTruth[$trueIndex]['min'], self::$groundTruth[$trueIndex]['sec'], self::$groundTruth[$trueIndex]['msec']);\n\n\t\t//+-1 sec is accepted (=-1)\n\t\treturn 1 - 2 * abs($dataTime - $trueTime);\n\t}",
"function getTime(){\n\t\t$mtime = microtime();//print(\"\\n time : \" . $mtime);\n\t\t$mtime = explode(' ', $mtime);\n\t\t$mtime = $mtime[1] + $mtime[0];\n\t\treturn $mtime;\n\t}",
"function refreshTime(){\n\n global $refreshTime;\n getChannel();\n if ((getChannel()[Name] == 'SmartPolitech') || (getChannel()[Name] == 'NoticiasEpcc')){\n $refreshTime = 960;\n }\n return $refreshTime;\n}",
"public function aim_onlinetime()\r\n\t{\r\n\t\t$s = time() - $this->core->user['timer'];\r\n\t\t$d = intval($s / 86400);\r\n\t\t$s -= $d * 86400;\r\n\t\t$h = intval($s / 3600);\r\n\t\t$s -= $h * 3600;\r\n\t\t$m = intval($s / 60);\r\n\t\t$s -= $m * 60;\r\n\t\treturn array('days' => $d, 'hours' => $h, 'mins' => $m, 'secs' => $s);\r\n\t}",
"public function timeMid();",
"function translate_time($t) {\n /* US only :)\n $a_times = array(\n '9:00' => '9am' , '9:45' => '9:45'\n , '10:00' => '10am', '10:15' =>'10:15', '10:30' =>'10:30', '10:45' => '10:45'\n , '11:00' => '11am', '11:15' =>'11:15', '11:30' =>'11:30', '11:45' => '11:45'\n , '12:00' => '12pm', '12:15' =>'12:15', '12:30' =>'12:30', '12:45' => '12:45'\n , '13:00' => '1pm', '13:15' => '1:15', '13:30' => '1:30', '13:45' => '1:45'\n , '14:00' => '2pm', '14:15' => '2:15', '14:30' => '2:30', '14:45' => '2:45'\n , '15:00' => '3pm', '15:15' => '3:15', '15:30' => '3:30', '15:45' => '3:45'\n , '16:00' => '4pm', '16:15' => '4:15', '16:30' => '4:30', '16:45' => '4:45'\n , '17:00' => '5pm', '17:15' => '5:15', '17:30' => '5:30', '17:45' => '5:45'\n , '18:00' => '6pm', '18:15' => '6:15'\n , '20:00' => '8pm', '22:00' => '10pm'\n );\n if (isset($a_times[$t])) return $a_times[$t];\n */\n return $t;\n }"
]
| [
"0.6204446",
"0.5965706",
"0.59091085",
"0.58926576",
"0.5881106",
"0.5855123",
"0.5733794",
"0.57331777",
"0.56858426",
"0.5665234",
"0.5636825",
"0.56048024",
"0.5556603",
"0.5513868",
"0.55113554",
"0.55059445",
"0.54818124",
"0.54575944",
"0.5443916",
"0.53823984",
"0.53685695",
"0.5349899",
"0.53474265",
"0.5310473",
"0.5291328",
"0.52889293",
"0.5288484",
"0.5283145",
"0.52760714",
"0.52492636"
]
| 0.6815405 | 0 |
Function to calculate for level timed races Parameters: $elapsed Type: integer, number of seconds of elapsed time $handicap Type: This is ignored anyway. Returns:integer, number of seconds of corrected time | function Level_calc($elapsed, $handicap = null, $reverse = null){
return $elapsed;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function PY_calc($elapsed, $handicap){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the RYA PY handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\n\t\t// Different countries use different PY bases\n\t\t$ci =& get_instance();\n\t\tif($ci->userdata->session('locale') == 'uk'){\n\t\t\t$base = 1000;\n\t\t}else{\n\t\t\t$base = 100;\n\t\t}\n\t\t\n\t\tif($reverse){\n\t\t\treturn round(intval($elapsed) * intval($handicap) / $base, 0);\n\t\t}else{\n\t\t\t$tcc = round(intval($elapsed) * $base / intval($handicap), 0);\n\t\t\treturn $tcc;\n\t\t}\n\t}",
"function IRC_calc($elapsed, $handicap, $reverse = false){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the IRC handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\t\tif($reverse){\n\t\t\treturn intval(round(intval($elapsed) / floatval($handicap), 0));\n\t\t}else{\n\t\t\treturn intval(round(intval($elapsed) * floatval($handicap), 0));\n\t\t}\n\t}",
"function ECHO_calc($elapsed, $handicap, $reverse = false){\n\t// Parameters: \t$elapsed\n\t//\t\t\t\tType: integer, number of seconds of elapsed time\n\t// \t\t\t\t$handicap\n\t//\t\t\t\tType: float, the ECHO handicap value\n\t// Returns:\t\tinteger, number of seconds of corrected time\n\n\t\tif($reverse){\n\t\t\treturn intval(round(intval($elapsed) / floatval($handicap), 0));\n\t\t}else{\n\t\t\treturn intval(round(intval($elapsed) * floatval($handicap), 0));\n\t\t} \n\t}",
"private function passTime()\n {\n // guys in bathroom lose pee equal to peeSpeed\n // guys at bar gain pee equal to drinkSpeed\n // guys in bathroom with pee == 0 return to bar\n }",
"public function getElapsedTime();",
"public function getLapTime()\n {\n \n }",
"private function calculateTime()\n {\n $slowest = 1000000;\n for($i=1; $i<=12; $i++){\n if($_GET['Tr'.$i] > 0 && $slowest > $this->troopCostsProperties['Tr'.$i][5] ){\n $slowest = $this->troopCostsProperties['Tr'.$i][5];\n }\n }\n $time = $this->distance/($slowest*SERVER_SPEED_RATE);\n return $time;\n }",
"function timeElapsed($sec){\n\n if( $sec <= 1 ) 'Agora mesmo';\n\n $date = [ 'ano' => 31536000,\n 'mes' => 2592000,\n 'dia' => 86400,\n 'hora' => 3600,\n 'minuto' => 60,\n 'segundo' => 1];\n \n foreach( $date as $name => $time ){\n $qtde = $sec / $time;\n if( $qtde >= 1 ) return 'há ' . floor( $qtde ) . ' ' . $name . ($qtde > 2 ? 's' : '');\n }\n\n }",
"function elapsed_time($start_time, $finish_time){\n\treturn sc_strtotime($finish_time) - sc_strtotime($start_time);\n}",
"public function getTurnaroundTime()\n\t{\n\t\t$startTime = new DateTime($this->specimen->time_accepted);\n\t\t$endTime = new DateTime($this->time_verified);\n\t\t$interval = $startTime->diff($endTime);\n\n\t\t$turnaroundTime = ($interval->days * 24 * 3600) + ($interval->h * 3600) + ($interval->i * 60) + ($interval->s);\n\n\t\t\n\t\treturn $turnaroundTime;\n\t}",
"function hackerHot($baseScore,$date_time,$gravity = 1.8){\n \n $upload_time=strtotime($date_time);\n $time_diff=(strtotime('now')-$upload_time);\n $hourPassed=round(($time_diff/(60 * 60)));\n if($hourPassed<0){\n $hourPassed=0;\n }\n \n return round((($baseScore-1)/pow($hourPassed+2,$gravity))*1000);\n }",
"public function updateTimeAlgo($time, $subjectTag, $difficulty, $typeTag)\n\t{\n\t\t$results = $this->_dbConnection->selectFromTable($this->_tableName, \"username\", $this->_username);\n\t//\treturn $results;\n\t\t$results_formatted = $this->_dbConnection->formatQueryResults($results, \"tags\");\n\t//\treturn $results_formatted;\n\t\t$result = $results_formatted[0];\n\t//\treturn $result;\n\t\t$json = json_decode($result, true);\n\t//\treturn $json;\n\t\n\t// $timeAvg --> the average time for homework in a certain subject;\n\t\t$timeAvg = $this->findSubjectInArray($subjectTag, $json, 1);\n\t// $timeAvg1 --> the average time for essays/projects in a subject\n\t\t$timeAvg1 = $this->findSubjectInArray($subjectTag, $json, 2);\n\t//\t$timeAvg2 --> the average time for presentations in a given subject;\n\t\t$timeAvg2 = $this->findSubjectInArray($subjectTag, $json, 3);\t\n\t//\treturn $timeAvg;\n\t\t$newTime = 0;\n\t\t$json_encodedList;\n\t\tif($typeTag == \"homework\")\n\t\t{\n\t\t\t$newTime = ($timeAvg + $time) / 2;\n\t\t\t$json_encodedList = json_encode(array(\"English\" => array($difficulty, $newTime, $timeAvg1, $timeAvg2)));\t\t\t\n\t\t}\n\t\telse if($typeTag == \"essay\")\n\t\t{\n\t\t\t$newTime = ($timeAvg1 + $time) / 2;\n\t\t\t$json_encodedList = json_encode(array(\"English\" => array($difficulty, $timeAvg, $newTime, $timeAvg2)));\t\t\t\n\t\t}\n\t\telse if($typeTag == \"presentation\")\n\t\t{\n\t\t\t$newTime = ($timeAvg2 + $time) / 2;\n\t\t\t$json_encodedList = json_encode(array(\"English\" => array($difficulty, $timeAvg, $timeAvg1, $newTime)));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthrow new Exception(\"typeTag does not match any in database;\");\n\t\t}\n\t\t\n\t//\treturn $newTime;\n\t/**\n\t * Order for the JsonArray --> 1) Difficulty of subject; 2) the TimeAVg for Homework in that subject;\n\t * 3) The TimeAvg for essays/projects in that subject;\n\t * 4) the TimeAvg for the presentations in that subject;\n\t */\n\t\t$jsonArray = array(\"tags\" => $json_encodedList);\n\t//\treturn $jsonArray;\n\t\t$condition = \"username = '$this->_username'\";\n\t//\treturn $condition;\n\t\t$update = $this->_dbConnection->updateTable($this->_tableName, $jsonArray, $condition);\n\t\treturn $update;\n\t}",
"public function setLapTime($time)\n {\n\n }",
"function correctTime($Hours,$Minutes,$Seconds, &$printArray)\n{\n\tarray_push($printArray,\"CorrectTime (before loops): H:$Hours M:$Minutes S:$Seconds <br>\");\n\t//echo nl2br(\"Seconds are now: $Seconds \\n\");\n\tif($Seconds>=60)\n\t{\n\t\t$CaryOver=$Seconds%60;\n\t\t$Minutes+=floor($Seconds/60);\n\t\t$Seconds=$CaryOver;\n\t\t//echo nl2br(\"Seconds are now: $CarryOver \\n\");\n\t\t\n\t}\n\n\tif($Minutes>=60)\n\t{\n\t\t$CaryOver=$Minutes%60; //Remainder\n\t\t$Hours+=floor($Minutes/60);\n\t\t$Minutes=$CaryOver;\n\t\t//echo nl2br(\"Minutes are now: $CarryOver \\n\");\n\t\t\n\t}\n\t\n\t//NOW Correct the FORMAT\n\tif($Hours<10)\n\t{$Hours=\"0\".$Hours;}\t\n\tif($Minutes<10)\n\t{$Minutes=\"0\".$Minutes;}\n\tif($Seconds<10)\n\t{$Seconds=\"0\".$Seconds;}\n\t\n\n array_push($printArray,\"CorrectTime (after): H:$Hours M:$Minutes S:$Seconds <br><br>\");\n\t\n\treturn array($Hours,$Minutes,$Seconds);\n}",
"function rtime ()\n{\n $time = explode (\" \", microtime ());\n return (double) ((double) $time[0] + (double) $time[1]);\n}",
"function calcRunTime($totalSheets, $color, $class) {\n\tif ($class == 1) {\n\t\tswitch ($color){\n\t\t\tcase \"4/4\":\n\t\t\t\t$runTime = ($totalSheets / 1000);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\tcase \"4/1\":\n\t\t\t\t$runTime = ($totalSheets / 1600);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\tcase \"4/0\":\n\t\t\t\t$runTime = ($totalSheets / 2000);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"1/1\":\n\t\t\t\t$runTime = ($totalSheets / 4000);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"1/0\":\n\t\t\t\t$runTime = ($totalSheets / 8000);\t\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tif ($class == 2) {\n\t\tswitch ($color){\n\t\t\tcase \"4/4\":\n\t\t\t\t$runTime = ($totalSheets / 666);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\tcase \"4/1\":\n\t\t\t\t$runTime = ($totalSheets / 888);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\tcase \"4/0\":\n\t\t\t\t$runTime = ($totalSheets / 1333);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"1/1\":\n\t\t\t\t$runTime = ($totalSheets / 1333);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"1/0\":\n\t\t\t\t$runTime = ($totalSheets / 2666);\t\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tif ($class == 3) {\n\t\tswitch ($color){\n\t\t\tcase \"4/4\":\n\t\t\t\t$runTime = ($totalSheets / 666);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\tcase \"4/1\":\n\t\t\t\t$runTime = ($totalSheets / 888);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\tcase \"4/0\":\n\t\t\t\t$runTime = ($totalSheets / 1333);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"1/1\":\n\t\t\t\t$runTime = ($totalSheets / 1333);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase \"1/0\":\n\t\t\t\t$runTime = ($totalSheets / 2666);\t\n\t\t\t\tbreak;\n\t\t}\t\t\n\n}\nreturn $runTime;\n\n}",
"public function calculateTime()\n {\n echo 'it takes 1h to get there.',\"\\n\";\n\n self::$traitStaticMember = 'changes conflict member\\'s initial value';\n }",
"private function calculateRashiKutaScore()\n\t{\n\t\t\t\t\t$house_check = $this->inHouseRelativeTo( $this->_female_planets['Moon']['fulldegree'], $this->_male_planets['Moon']['fulldegree'] );\n\n\t\tif ($this->male_moon_sign_lord == $this->female_moon_sign_lord ||\n\t\t $this->planetaryFriends($this->male_moon_sign_lord, $this->female_moon_sign_lord))\n\t\t{\n\t\t\t$this->rashiKutaScore = 7;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$diff = $this->deltaDegrees( $this->_female_planets['Moon']['fulldegree'], $this->_male_planets['Moon']['fulldegree'] );\n\t\t/*\t$diff = abs( $this->_male_planets['Moon']['fulldegree'] -\n\t\t\t \t $this->_female_planets['Moon']['fulldegree'] );\n\t\t\tif ( $diff > 180 )\n\t\t\t{\n\t\t\t\t$diff = 360 - $diff;\n\t\t\t}*/\n\t\t\tif ( $diff > 165 && !in_array( $house_check, array( 6, 8, 12 ) ) )\n\t\t \t{\n\t\t\t\t$this->rashiKutaScore = 7;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->rashiKutaScore = 0;\n\t\t\t}\n\t\t}\n\t}",
"static public function get_time() {\n // By Zach Buller ([email protected])\n $time1 = \\microtime();\n \\settype($time1, 'string'); //convert to string to keep trailing zeroes\n $time2 = explode(\" \", $time1);\n $sub_secs = \\preg_replace('/0./', '', $time2[0], 1);\n $time3 = ($time2[1].$sub_secs)/100;\n return $time3;\n }",
"public function getTimePassed(): float\n {\n if ($this->started) {\n return microtime(true) - $this->start_time;\n } else {\n return $this->stop_time - $this->start_time;\n }\n }",
"public function humidityScore();",
"public function tempHumScore();",
"function race(int $v1, int $v2, int $g): array\n{\n if ($v1 >= $v2) {\n return null;\n }\n\n $hours = $g / ($v2 - $v1);\n return [floor($hours), (floor($hours * 60) % 60), floor($hours * 3600) % 60];\n}",
"function humanTiming ($time)\n {\n\n $time = time() - $time; // to get the time since that moment\n $time = ($time<1)? 1 : $time;\n $tokens = array (\n 31536000 => 'tahun',\n 2592000 => 'bulan',\n 604800 => 'minggu',\n 86400 => 'hari',\n 3600 => 'jam',\n 60 => 'menit',\n 1 => 'detik'\n );\n\n foreach ($tokens as $unit => $text) {\n if ($time < $unit) continue;\n $numberOfUnits = floor($time / $unit);\n return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');\n }\n\n }",
"function getTime($distance,$speed) {\r\n\tif (gettype($speed)==\"array\") {\r\n\t\t$min=0;\r\n\t\tforeach ($speed as $value) {\r\n\t\t\tif (($min==0)||($min>$value)) {\r\n\t\t\t\t$min=$value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ($min==0) {\r\n\t\t\t\t\r\n\t\t\t$log=Zend_Registry::get(\"log\");\r\n\t\t\t$log->log(\"velocità 0!!!!\",Zend_Log::CRIT);\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\telse $speed=$min;\r\n\t}\r\n\treturn intval(($distance/$speed)*3600);\r\n}",
"function chanceToWin($lastWin)\n{\n $rough = (int) ((time() - $lastWin) / 60);\n $chance = 0;\n if ($rough > 120) {\n if ($rough > 180) {\n $rough = rand(120, 180);\n }\n $rough = $rough - 120;\n $chance = (int) ($rough * 100) / 60;\n }\n return $chance;\n}",
"function time_calc($up_time)\n {\n // time is of the form YYYY-MM-DD HH:MM:SS.MILISEC\n $x = explode(' ', $up_time);\n $y = explode('-', $x[0]);\n $z = explode(':', $x[1]);\n\n // condition for year\n if(((int)date('Y') - (int)$y[0]) > 0)\n {\n $temp = ((int)date('Y') - (int)$y[0]);\n $temp = $temp.\" years ago\";\n return($temp);\n }\n else if(((int)date('m') - (int)$y[1]) > 0)\n {\n $temp = ((int)date('m') - (int)$y[1]);\n $temp = $temp.\" months ago\";\n return($temp);\n }\n else if(((int)date('d') - (int)$y[2]) > 0)\n {\n $temp = ((int)date('d') - (int)$y[2]);\n $temp = $temp.\" days ago\";\n return($temp);\n }\n else if(((int)date('H') - (int)$z[0]) > 0)\n {\n $temp = ((int)date('H') - (int)$z[0]);\n $temp = $temp.\" hrs ago\";\n return($temp);\n }\n else if(((int)date('i') - (int)$z[1]) > 0)\n {\n $temp = ((int)date('i') - (int)$z[1]);\n $temp = $temp.\" mins ago\";\n return($temp);\n }\n }",
"function hrChance($hr, $ab){\n //protects from divided-by 0\n if($ab > 0)\n $ave = $hr/$ab;\n else\n $ave = 0.0;\n //returns the average \n return \"<span>$ave</span\";\n }",
"public function elapsedtime() {\n return fmod(floatval($this->servertime()),$this->waitingtime());\n\t}",
"public function TravelTime($options = array()) {\n if (!is_array($options)) {\n throw new Exception(\"Input parameter must be an array.\");\n }\n $modes = array('walk', 'bike', 'drive', 'transit');\n if (!in_array($options['mode'], $modes)) {\n throw new Exception(\"Mode parameter must be one of 'walk', 'bike', 'drive', or 'transit'.\");\n }\n $response = $this->make_api_call('http://www.walkscore.com/api/v1/traveltime/json', $options);\n return $response->response;\n }"
]
| [
"0.6801696",
"0.6601908",
"0.62738234",
"0.5625131",
"0.5615995",
"0.5331435",
"0.51755434",
"0.5056403",
"0.5001489",
"0.4967659",
"0.496021",
"0.4958862",
"0.4942641",
"0.49293235",
"0.49268526",
"0.49163473",
"0.49162495",
"0.4907132",
"0.4892565",
"0.48409867",
"0.48134866",
"0.479243",
"0.47716627",
"0.47694895",
"0.47622058",
"0.47570223",
"0.47475293",
"0.47363448",
"0.47362497",
"0.4734324"
]
| 0.7367898 | 0 |
Load City List for address field | function loadCityAddress($id=null, $id2=null, $id3=null) {
$this->layout = false;
$this->City->recursive = -1;
$cities = $this->City->find('list', array('conditions' => array("City.state_id" => $id), 'fields' => array('City.name'), 'order' => array('City.name ASC')));
if (empty($id3))
$this->set(compact('cities', 'id2'));
else
$this->set(compact('cities', 'id2', 'id3'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getCityList() {\n\t\treturn $this->getByKey(Config::get('constants.KEY_CITY'));\n\t}",
"function CityList()\n\t{\t$cities = array();\n\t\t$adminuser = new AdminUser((int)$_SESSION[SITE_NAME][\"auserid\"]);\n\t\t$sql = \"SELECT cities.*,countries.shortname FROM cities, countries WHERE cities.country=countries.ccode ORDER BY countries.shortname\";\n\t\tif ($result = $this->db->Query($sql))\n\t\t{\twhile ($row = $this->db->FetchArray($result))\n\t\t\t{\tif ($adminuser->CanAccessCity($row[\"cityid\"]))\n\t\t\t\t{\t$cities[$row[\"cityid\"]] = $row[\"cityname\"] . \" - \" . $row[\"shortname\"];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $cities;\n\t}",
"function _param_geowidget_maybeyourcity_form_loadcity_callback() {\n $city = &drupal_static(__FUNCTION__);\n if (!isset($city)) {\n if ($cache = cache_get('geowidget')) {\n $city = $cache->data;\n } else {\n $city = db_select('geowidget_city', 'c')\n ->fields('c', array('id', 'parent_id', 'title', 'geoname_id'))\n ->execute()\n ->fetchAll();\n\n cache_clear_all('geowidget', 'cache', TRUE);\n cache_set('geowidget', $city, 'cache', time() + 360);\n }\n }\n return $city;\n}",
"function geowidget_maybeyourcity_form_loadcity_callback($form, &$form_state) {\n return array(\n '#type' => 'ajax',\n '#commands' => array(\n array(\n 'command' => 'selectCity',\n 'arrParam' => _param_geowidget_maybeyourcity_form_loadcity_callback(),\n ),\n ),\n );\n}",
"function getCity()\n\t\t{\n\t\t\t$cities = $this->manage_content->getValue('city','city_name');\n\t\t\tforeach($cities as $city)\n\t\t\t{\n\t\t\t\techo '<option value=\"'.$city['city_name'].'\">'.$city['city_name'].'</option>';\n\t\t\t}\n\t\t}",
"public function collectAddressData()\n {\n try {\n $components = collect($this->response->address_components);\n\n $this->address_data = $components->filter(function ($element) {\n $types = collect($element->types);\n\n return $types->search('street_number') !== false ||\n $types->search('route') !== false ||\n $types->search('locality') !== false ||\n $types->search('administrative_area_level_1') !== false || // province, normalement, short et long form\n $types->search('country') !== false ||\n $types->search('postal_code') !== false;\n })->mapWithKeys(function ($item) {\n return [$item->types[0] => $item->long_name];\n });\n } catch (\\Exception $e) {\n $this->address_data = null;\n }\n\n return $this;\n }",
"public function getCityList() {\n return $this->_get(2);\n }",
"public function getAddresses() {\n $table = new Yourdelivery_Model_DbTable_Locations();\n return $table->fetchAll('companyId = ' . $this->getId());\n }",
"public function listCities() {\n $result = array();\n $query = 'SELECT `id`,`zipCode`,`city`,`id_ppro_departments` FROM `ppro_cities` ORDER BY `id` ASC';\n $queryResult = $this->db->query($query);\n if (is_object($queryResult)) {\n $result = $queryResult->fetchAll(PDO::FETCH_OBJ);\n }\n return $result;\n }",
"public function __construct(TDProject_ERP_Model_Entities_Address $address = null)\n {\n // call the parents constructor\n parent::__construct($address);\n // initialize the ValueObject with the passed data\n $this->_countries = new TechDivision_Collections_ArrayList();\n }",
"function load_field($field) {\n if (($countries = get_transient('acf_cities_countries')) === false) {\n $url = 'http://api.londrinaweb.com.br/PUC/Paisesv2/0/1000';\n\n $response = wp_remote_get($url);\n\n // Return nothing if the request returns an error\n if (!is_wp_error($response)) {\n $body = wp_remote_retrieve_body($response);\n $data = json_decode($body);\n $countries = $data;\n\n set_transient('acf_cities_countries', $countries, 10 * MINUTE_IN_SECONDS);\n }\n }\n\n $field['countries'] = $countries;\n return $field;\n }",
"public function getCityList()\n {\n return $this -> generate_city_list();\n }",
"public function getCity();",
"protected function generate_city_list()\n {\n $sql = \"SELECT city_name, city_value FROM city_list\";\n $conn = $this -> connect();\n $stmt = $this -> query($conn, $sql);\n $this -> disconnect($conn);\n \n $list = [];\n while ($row = $stmt -> fetch()): \n $list[] = array(\n 'name' => $row['city_name'], \n 'value' => $row['city_value']\n ); \n endwhile;\n return $list;\n }",
"function cities($state_id)\n\t{\n //echo json_encode(array('' => 'Ciudad') + ORM::factory('city')->where('state_id', $state_id)->orderby('city')->select_list('CONCAT(city_lon,\",\",city_lat)','city'));\n $cities = array();\n $_rs = ORM::factory('city')->select('city_lon AS lon, city_lat AS lat, city AS n, id')->where('state_id', $state_id)->orderby('city')->find_all();\n foreach($_rs as $_r) {\n $c['n'] = $_r->n;\n $c['id'] = $_r->id;\n $c['lonlat'] = $_r->lon.','.$_r->lat;\n\n $cities[] = $c;\n }\n header('Content-type: application/json; charset=utf-8');\n echo json_encode($cities);\n }",
"function getAddressCoordinates($address, City $city=null);",
"function City_list(){\n\t\t\n\t\t//fetch all cities from table\n\t\t$data = $this->View('*','city','','ORDER BY id DESC');\n\t\t\n\t\t//if city \n\t\tif($data){\n\t\t\t\n\t\t// for serial number\t\n\t\t$sno=1;\n\t\t\t\n\t\t//view all cities from table\n\t\tforeach($data as $value){\n\t\t\t\n\t\t\techo \" <tr>\n <td>\".$sno++.\"</td>\n <td>\".$value['city'].\"</td>\n <td><a href='Add-City?Edit=\".$value['id'].\"' class='btn btn-custon-two btn-primary btn-sm' >Edit</a></td>\n <td><a href='Add-City?Delete=\".$value['id'].\"' class='btn btn-custon-two btn-danger btn-sm' >Delete</a></td>\n </tr>\";\n\t\t} // foreach close\n\t\t} // if close\n\t}",
"public function actionGetLoadingAddressList()\n {\n if (Yii::app()->request->isPostRequest) {\n $order = new Order();\n $order->setAttributes($_POST['Order']);\n $supplierAddressesList = SupplierAddresses::getListBySupplierId($order->supplier_id);\n foreach ($supplierAddressesList as $value => $name) {\n echo CHtml::tag('option', ['value' => $value], CHtml::encode($name));\n }\n } else {\n throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');\n }\n Yii::app()->end();\n }",
"public function actionAddressListAll() \r\n {\r\n return $this->listing(0, true, Yii::$app->request->get('area_id'));\r\n }",
"public function getCity() {}",
"private function loadAllDistricts(){\n \n\n }",
"function listCities()\r\n {\r\n try\r\n {\r\n $sql=\"SELECT city_id,city_name\r\n\t\t FROM edms_city ORDER BY city_name\";\r\n $result=dbQuery($sql);\r\n $resultArray=dbResultToArray($result);\r\n return $resultArray;\r\n }\r\n\r\n catch(Exception $e)\r\n {\r\n }\r\n\r\n }",
"private function resolveAddressData()\n {\n /** @var \\Magento\\Quote\\Model\\Quote $quote */\n $quote = $this->checkoutSession->getQuote();\n /** @var \\Magento\\Quote\\Model\\Quote\\Address $shippingAddress */\n $shippingAddress = $quote->getShippingAddress();\n\n $customerData = $this->geoIp->getCurrentLocation();\n if ($customerData->getCode() && $this->helper->isCountryAllowed($customerData->getCode())) {\n /** @var \\Magento\\Directory\\Model\\Country $currentCountry */\n $currentCountry = $shippingAddress\n ->getCountryModel()\n ->loadByCode($customerData->getCode());\n\n if (!$currentCountry) {\n return;\n }\n\n $shippingAddress->setCountryId($currentCountry->getId());\n $shippingAddress->setRegion($customerData->getRegion());\n $shippingAddress->setRegionCode($customerData->getRegionCode());\n $shippingAddress->setCity($customerData->getCity());\n $shippingAddress->setPostcode($customerData->getPosttalCode());\n\n $regionModel = $this->regionFactory->create();\n if ($customerData->getRegionCode() && $currentCountry->getId()) {\n $regionModel->loadByCode($customerData->getRegionCode(), $currentCountry->getId());\n $regionId = $regionModel->getRegionId();\n $shippingAddress->setRegionId($regionId);\n }\n }\n }",
"public function ShipmentFrom_AddressList() {\n\t\treturn $this->db->get_results(\n\t\t\t\"SELECT * FROM wp_azlabs_address\", \n\t\t\tARRAY_A\n\t\t);\n\t}",
"public function get_city_name_list()\n {\n return $this -> generate_city_name_list_by_type('name');\n }",
"protected function generate_city_value_list()\n {\n $sql = \"SELECT city_name FROM city_list\";\n $conn = $this -> connect();\n $stmt = $this -> query($conn, $sql);\n $this -> disconnect($conn);\n \n $list = [];\n while ($row = $stmt -> fetch()): $list[] = $row['city_name']; endwhile;\n return $list;\n }",
"private function citiesList(): array {\n\t\t\t\n\t\t\t$rawData = Config::get('cities');\n\t\t\t$cities = [];\n\t\t\tforeach ($rawData as $index => $data) {\n\t\t\t\t$cities[] = [\n\t\t\t\t 'name' => $data['provincia'],\n\t\t\t\t 'code' => $index\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn $cities;\n\t\t}",
"public static function getOriginCities($stateURL) {\n\t\tglobal $wpdb;\n\n\t\treturn $wpdb->get_results($wpdb->prepare(\"SELECT `City`, `StateName`, `Code`, REPLACE(LOWER(`StateName`), ' ', '-') AS `URL`, `Image`, `District`, `Latitude`, `Longitude`, `Needs`, `Shares` FROM (SELECT ffi_ta_cities.*, ffi_ta_states.Name AS `StateName`, ffi_ta_states.Code, ffi_ta_states.Image, ffi_ta_states.District, COALESCE(q1.Needs, 0) AS `Needs`, COALESCE(q2.Shares, 0) AS `Shares` FROM `ffi_ta_cities` LEFT JOIN `ffi_ta_states` ON ffi_ta_cities.State = ffi_ta_states.Code LEFT JOIN (SELECT `FromCity`, COUNT(`FromCity`) AS `Needs` FROM `ffi_ta_need` WHERE (ffi_ta_need.Leaving > NOW() AND ffi_ta_need.Fulfilled = 0) OR (ffi_ta_need.Leaving <= NOW() AND ffi_ta_need.EndDate > NOW() AND ffi_ta_need.Fulfilled = 0) GROUP BY `FromCity`) `q1` ON ffi_ta_cities.ID = q1.FromCity LEFT JOIN (SELECT `FromCity`, COUNT(`FromCity`) AS `Shares` FROM `ffi_ta_share` WHERE (ffi_ta_share.Leaving > NOW() AND ffi_ta_share.Seats > ffi_ta_share.Fulfilled) OR (ffi_ta_share.Leaving <= NOW() AND ffi_ta_share.EndDate > NOW() AND ffi_ta_share.Seats > ffi_ta_share.Fulfilled) GROUP BY `FromCity`) `q2` ON ffi_ta_cities.ID = q2.FromCity) `query` WHERE `Needs` > 0 OR `Shares` > 0 HAVING `URL` = %s ORDER BY `City` ASC\", $stateURL));\n\t}",
"function get_cities()\n\t{\n\t\t$stateID = $this->uri->segment(3);\n\t\t\n\t\t$this->db->select(\"*\")\n\t\t\t\t ->from('city')\n\t\t\t\t ->where('stateID', $stateID);\n\t\t$db = $this->db->get();\n\t\t\n\t\t$array = array();\n\t\tforeach($db->result() as $row):\n\t\t\t$array[] = array(\"value\" => $row->city_id, \"property\" => $row->city_title);\n\t\tendforeach;\n\t\t\n\t\techo json_encode($array);\n\t\texit;\n\t}",
"function fetchMultipleAddress()\n{\n\t$cf = new addressData();\n\t\n\t$data = array();\n\t$data['app_id'] = isset($_POST['app_id']) ? $_POST['app_id'] : '';\n\t$data['auth_token'] = isset($_POST['auth_token']) ? $_POST['auth_token'] : '';\n\t$data['domain_id'] = isset($_POST['domain_id']) ? $_POST['domain_id'] : '';\n \n\t$cf->fetchMultipleAddress($data);\n}"
]
| [
"0.6175489",
"0.60364044",
"0.59740704",
"0.58903253",
"0.5885694",
"0.58581144",
"0.58512115",
"0.5714346",
"0.569122",
"0.5664876",
"0.5658593",
"0.56367207",
"0.56330687",
"0.5594548",
"0.55897367",
"0.5571951",
"0.5566974",
"0.5561447",
"0.5548762",
"0.55359185",
"0.55357474",
"0.55312616",
"0.5523733",
"0.55134267",
"0.5509095",
"0.55068654",
"0.54925036",
"0.5479938",
"0.54675144",
"0.5438694"
]
| 0.67712986 | 0 |
/ Set up some standards to save CPU later / Initial ipsclass, set up some variables for later Populates: $this>time_options, $this>num_format, $this>get_magic_quotes, $this>ip_address $this>user_agent, $this>browser, $this>operating_system | function initiate_ipsclass()
{
//-----------------------------------------
// Version numbers
//-----------------------------------------
//$this->acpversion = '210015.060501.u';
if ( strstr( $this->acpversion , '.' ) )
{
list( $n, $b, $r ) = explode( ".", $this->acpversion );
}
else
{
$n = $b = $r = '';
}
$this->vn_full = $this->acpversion;
$this->acpversion = $n;
$this->vn_build_date = $b;
$this->vn_build_reason = $r;
//-----------------------------------------
// Time options
//-----------------------------------------
$this->time_options = array( 'JOINED' => $this->vars['clock_joined'],
'SHORT' => $this->vars['clock_short'],
'LONG' => $this->vars['clock_long'],
'TINY' => isset($this->vars['clock_tiny']) ? $this->vars['clock_tiny'] : 'j M Y - G:i',
'DATE' => isset($this->vars['clock_date']) ? $this->vars['clock_date'] : 'j M Y',
);
$this->num_format = ( $this->vars['number_format'] == 'space' ) ? ' ' : $this->vars['number_format'];
//-----------------------------------------
// Sort out the accessing IP
// (Thanks to Cosmos and schickb)
//-----------------------------------------
$addrs = array();
if ( $this->vars['xforward_matching'] )
{
foreach( array_reverse( explode( ',', $this->my_getenv('HTTP_X_FORWARDED_FOR') ) ) as $x_f )
{
$x_f = trim($x_f);
if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $x_f ) )
{
$addrs[] = $x_f;
}
}
$addrs[] = $this->my_getenv('HTTP_CLIENT_IP');
$addrs[] = $this->my_getenv('HTTP_X_CLUSTER_CLIENT_IP');
$addrs[] = $this->my_getenv('HTTP_PROXY_USER');
}
$addrs[] = $this->my_getenv('REMOTE_ADDR');
//-----------------------------------------
// Do we have one yet?
//-----------------------------------------
foreach ( $addrs as $ip )
{
if ( $ip )
{
preg_match( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip, $match );
$this->ip_address = $match[1].'.'.$match[2].'.'.$match[3].'.'.$match[4];
if ( $this->ip_address AND $this->ip_address != '...' )
{
break;
}
}
}
//-----------------------------------------
// Make sure we take a valid IP address
//-----------------------------------------
if ( ( ! $this->ip_address OR $this->ip_address == '...' ) AND !$this->my_getenv('SHELL') )
{
print "Could not determine your IP address";
exit();
}
#Backwards compat:
$this->input["IP_ADDRESS"] = $this->ip_address;
//-----------------------------------------
// Make a safe query string
//-----------------------------------------
$this->query_string_safe = str_replace( '&amp;', '&', $this->parse_clean_value( urldecode($this->my_getenv('QUERY_STRING')) ) );
$this->query_string_real = str_replace( '&' , '&' , $this->query_string_safe );
//-----------------------------------------
// Format it..
//-----------------------------------------
$this->query_string_formatted = str_replace( $this->vars['board_url'] . '/index.'.$this->vars['php_ext'].'?', '', $this->query_string_safe );
$this->query_string_formatted = preg_replace( "#s=([a-z0-9]){32}#", '', $this->query_string_formatted );
//-----------------------------------------
// Admin dir
//-----------------------------------------
$this->vars['_admin_link'] = $this->vars['board_url'] . '/' . IPB_ACP_DIRECTORY . '/index.php';
//-----------------------------------------
// Upload dir?
//-----------------------------------------
$this->vars['upload_dir'] = $this->vars['upload_dir'] ? $this->vars['upload_dir'] : ROOT_PATH.'uploads';
//-----------------------------------------
// Char set
//-----------------------------------------
$this->vars['gb_char_set'] = $this->vars['gb_char_set'] ? $this->vars['gb_char_set'] : 'iso-8859-1';
//-----------------------------------------
// Max display name length
//-----------------------------------------
$this->vars['max_user_name_length'] = $this->vars['max_user_name_length'] ? $this->vars['max_user_name_length'] : 26;
//-----------------------------------------
// PHP API
//-----------------------------------------
define('IPB_PHP_SAPI', php_sapi_name() );
//-----------------------------------------
// IPS CLASS INITIATED
//-----------------------------------------
if ( ! defined( 'IPSCLASS_INITIATED' ) )
{
define( 'IPSCLASS_INITIATED', 1 );
}
//-----------------------------------------
// Get user-agent, browser and OS
//-----------------------------------------
$this->user_agent = $this->parse_clean_value($this->my_getenv('HTTP_USER_AGENT'));
$this->browser = $this->fetch_browser();
$this->operating_system = $this->fetch_os();
//-----------------------------------------
// Can we use fancy JS? IE6, Safari, Moz
// and opera 7.6
//-----------------------------------------
if ( $this->browser['browser'] == 'ie' AND $this->browser['version'] >= 6.0 )
{
$this->can_use_fancy_js = 1;
}
else if ( $this->browser['browser'] == 'gecko' AND $this->browser['version'] >= 20030312 )
{
$this->can_use_fancy_js = 1;
}
else if ( $this->browser['browser'] == 'mozilla' AND $this->browser['version'] >= 1.3 )
{
$this->can_use_fancy_js = 1;
}
else if ( $this->browser['browser'] == 'opera' AND $this->browser['version'] >= 7.6 )
{
$this->can_use_fancy_js = 1;
}
else if ( $this->browser['browser'] == 'safari' AND $this->browser['version'] >= 120)
{
$this->can_use_fancy_js = 1;
}
//$this->can_use_fancy_js = 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function init()\n {\n global $g_comp_database;\n\n // We need the catg_ip DAO for a few awesome IPv6 methods.\n $this->m_ip_dao = new isys_cmdb_dao_category_g_ip($g_comp_database);\n\n // We set the header information because we don't accept anything than JSON.\n header('Content-Type: application/json');\n\n if (!empty($_POST['method']))\n {\n switch ($_POST['method'])\n {\n case 'calculate_ipv6_range':\n echo isys_format_json::encode($this->calculate_ipv6_range());\n break;\n\n case 'find_free_v6':\n echo isys_format_json::encode($this->find_free_v6());\n break;\n\n case 'is_ipv6_inside_range':\n echo isys_format_json::encode($this->is_ipv6_inside_range());\n break;\n\n default:\n echo isys_format_json::encode([]);\n } // switch\n } // if\n\n $this->_die();\n }",
"public function __construct() {\n\t\n parent::__construct();\n\t\t\n self::_initTags(); //extend ipp server tags\t\t\t\n\t\t\n\t\t$this->server_version = '1.0'; //IPP server version\n\t\t$this->ipp_version = '1.0'; //1.1 or 1.0\n\t\t$this->ipp_version_auto = true; //auto change ipp version depending on ipp client\n\t\t\n\t\tswitch ($this->ipp_version) {\n\t\t case '1.1' : $this->ipp_version_x8 = chr(0x01) . chr(0x01); \n\t\t break;\n\t\t case '1.0' :\n\t\t default :\n\t\t $this->ipp_version_x8 = chr(0x01) . chr(0x00);//'1.0';//NOT 1.1 ..WILL NOT WORK IN WINDOWS\n\t\t}\n\t\t\n\t\t$this->clientoutput = new stdClass();\t\t\n }",
"public function __construct()\n\t\t{\n\t\t\t$this->setUrl();\t\t\t\n\t\t\t$this->setSeparator();\n\t\t\t$this->setController();\n\t\t\t$this->setAction();\t\t\t\n\t\t\t$this->setParams();\t\n\n\t\t\t$this->server_info = array('PHP_SELF', \n\t\t\t\t'argv', \n\t\t\t\t'argc', \n\t\t\t\t'GATEWAY_INTERFACE', \n\t\t\t\t'SERVER_ADDR', \n\t\t\t\t'SERVER_NAME', \n\t\t\t\t'SERVER_SOFTWARE', \n\t\t\t\t'SERVER_PROTOCOL', \n\t\t\t\t'REQUEST_METHOD', \n\t\t\t\t'REQUEST_TIME', \n\t\t\t\t'REQUEST_TIME_FLOAT', \n\t\t\t\t'QUERY_STRING', \n\t\t\t\t'DOCUMENT_ROOT', \n\t\t\t\t'HTTP_ACCEPT', \n\t\t\t\t'HTTP_ACCEPT_CHARSET', \n\t\t\t\t'HTTP_ACCEPT_ENCODING', \n\t\t\t\t'HTTP_ACCEPT_LANGUAGE', \n\t\t\t\t'HTTP_CONNECTION', \n\t\t\t\t'HTTP_HOST', \n\t\t\t\t'HTTP_REFERER', \n\t\t\t\t'HTTP_USER_AGENT', \n\t\t\t\t'HTTPS', \n\t\t\t\t'REMOTE_ADDR', \n\t\t\t\t'REMOTE_HOST', \n\t\t\t\t'REMOTE_PORT', \n\t\t\t\t'REMOTE_USER', \n\t\t\t\t'REDIRECT_REMOTE_USER', \n\t\t\t\t'SCRIPT_FILENAME', \n\t\t\t\t'SERVER_ADMIN', \n\t\t\t\t'SERVER_PORT', \n\t\t\t\t'SERVER_SIGNATURE', \n\t\t\t\t'PATH_TRANSLATED', \n\t\t\t\t'SCRIPT_NAME', \n\t\t\t\t'REQUEST_URI', \n\t\t\t\t'PHP_AUTH_DIGEST', \n\t\t\t\t'PHP_AUTH_USER', \n\t\t\t\t'PHP_AUTH_PW', \n\t\t\t\t'AUTH_TYPE', \n\t\t\t\t'PATH_INFO', \n\t\t\t\t'ORIG_PATH_INFO');\n\t\t}",
"public function __construct() {\n\t\tself::$IP = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : \"127.0.0.1\"; \t\t\n\t\tself::$SETTINGS = array(\n\t\t\tnew SecuritySetting(1, \"SITE_LOAD\", 20, \"1 MINUTE\"),\n\t\t\tnew SecuritySetting(2, \"ACTION_HANDLER\", 15, \"1 MINUTE\"),\n\t\t\tnew SecuritySetting(3, \"LOGIN_ATTEMPT\", 7, \"10 MINUTE\"),\n\t\t\tnew SecuritySetting(4, \"EMAIL\", 5, \"1 MINUTE\"),\n\t\t\tnew SecuritySetting(5, \"CHANGE_PASSWORD\", 5, \"20 MINUTE\"),\n\t\t\tnew SecuritySetting(6, \"REGISTRATIONS\", 15, \"30 MINUTE\"),\n\t\t\tnew SecuritySetting(7, \"FORUM_POST\", 5, \"30 SECOND\"),\n\t\t\tnew SecuritySetting(8, \"MESSAGE_CENTRE\", 10, \"1 MINUTE\")\n\t\t);\n\t}",
"function __construct(){\r\n\r\n\t\t\t$this->setHttpHeaders();\r\n\t\t\t$this->setUserIp();\r\n\t\t\t$this->setUserAgent();\r\n\r\n\t\t}",
"public function __construct() {\n $this->_configPassword = $this->parseConfig(2);\n $this->_configClass = $this->parseConfig(5);\n $this->_time = time();\n\t}",
"public function init()\r\r\n\t{\r\r\n\t\t$this->ip=$_SERVER[\"REMOTE_ADDR\"];\r\r\n\t\tparent::init();\r\r\n\t}",
"public function prepare():void\n {\n\n // Get IP address\n if ($this->reg_ip == '') { \n $this->reg_ip = IpAddress::get();\n }\n\n // Get user-agent\n if ($this->reg_user_agent == '') { \n $this->reg_user_agent = UserAgent::get();\n }\n\n // Lookup ip address\n if ($this->reg_country == '' && $this->reg_ip != '') { \n $res = LookupIP::query($this->reg_ip);\n foreach ($res as $key => $value) {\n $key = 'reg_' . $key; \n $this->$key = $value;\n }\n }\n\n }",
"function __construct(){\n $s= gethostbyaddr ( $_SERVER['REMOTE_ADDR']);\n if ($s == 'apch-PC'){$this->server='local';}\n else {$this->server='gamisio';}\n }",
"public function __construct()\n\t{\n\t\t$this->registry\t\t= ipsRegistry::instance();\n\t\t$this->DB\t\t\t= $this->registry->DB();\n\t\t$this->settings\t\t=& $this->registry->fetchSettings();\n\t\t$this->lang\t\t\t= $this->registry->getClass('class_localization');\n\t}",
"private function __construct() {\n\t\trequire_once WPUL_PATH . 'includes/wpul-ip.php';\n\n\n\t\t// Include Geo IP functions\n\t\trequire_once WPUL_PATH . 'includes/wpul-geo-ip-functions.php';\n\n\t\t// Enqueue scripts/styles\n\t\tadd_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ), 5 );\n\t}",
"public function __construct()\n\t{\n\t\t$this->request = ($_SERVER['REQUEST_METHOD'] == 'POST')\n\t\t\t? $_POST\n\t\t\t: $_GET;\n\n\t\t// Check if the IP is from a shared internet connection\n\t\tif ( ! empty($_SERVER['HTTP_CLIENT_IP']))\n\t\t{\n\t\t\t$this->request_ip_address = $_SERVER['HTTP_CLIENT_IP'];\n\t\t}\n\t\t// Check if the IP address is passed from a proxy server such as Nginx\n\t\telseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR']))\n\t\t{\n\t\t\t$this->request_ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->request_ip_address = $_SERVER['REMOTE_ADDR'];\n\t\t}\n\t}",
"function __construct()\n {\n // Some default values of the class\n $this->gatewayUrl = 'https://test.ipgonline.com/connect/gateway/processing';\n $this->ipnLogFile = PAID_SUBS_DIR.'/ipn/logs/firstdata.ipn_results.log';\n \n global $paidSub;\n \n if($paidSub->configs['test_mode']=='enabled')\n $this->enableTestMode();\n }",
"public function __construct()\n {\n if (16 == func_num_args()) {\n $this->country = func_get_arg(0);\n $this->ipCity = func_get_arg(1);\n $this->ipMatchesBin = func_get_arg(2);\n $this->cardType = func_get_arg(3);\n $this->cardCategory = func_get_arg(4);\n $this->ipCountryCode = func_get_arg(5);\n $this->ipCountry = func_get_arg(6);\n $this->issuer = func_get_arg(7);\n $this->ipBlocklisted = func_get_arg(8);\n $this->valid = func_get_arg(9);\n $this->ipBlocklists = func_get_arg(10);\n $this->issuerWebsite = func_get_arg(11);\n $this->countryCode = func_get_arg(12);\n $this->ipRegion = func_get_arg(13);\n $this->cardBrand = func_get_arg(14);\n $this->issuerPhone = func_get_arg(15);\n }\n }",
"function __construct ( $in_http_vars\t///< The HTTP parameters we'd like to send to the server.\n\t\t\t\t\t ) {\n\t\t$this->helpline_string = _NSLI_LIST_HELPLINE; ///< This is the default string we use for the Helpline.\n\t\t$this->credits_string = _NSLI_LIST_CREDITS; ///< The credits for creation of the list.\n\t\t$this->web_uri_string = _NSLI_LIST_URL; ///< The Web site URI.\n\t\t$this->banner_1_string = _NSLI_LIST_BANNER_1; ///< The First Banner String.\n\t\t$this->banner_2_string = _NSLI_LIST_BANNER_2; ///< The Second Banner String.\n\t\t$this->banner_3_string = _NSLI_LIST_BANNER_3; ///< The Third Banner String.\n\t\t$this->week_starts_1_based_int = _NSLI_WEEK_STARTS; ///< The Day of the week (1-based integer, with 1 as Sunday) that our week starts.\n\t\t\n\t\t$this->image_path_string = _NSLI_IMAGE_POSIX_PATH; ///< The POSIX path to the image, relative to this file.\n\t\t$this->filename = sprintf(_NSLI_FILENAME_FORMAT, date (\"Y_m_d\")); ///< The output name for the file.\n\t\t$this->root_uri = _NSLI_LIST_ROOT_URI; ///< This is the default Root Server URL.\n\t\t$this->date_header_format_string = _NSLI_DATE_FORMAT; ///< This is the default string we use for the date attribution line at the top.\n\n\t\t$this->font = 'Helvetica';\t ///< The font we'll use.\n \n\t\t$this->sort_keys = array (\t'weekday_tinyint' => true,\t\t\t///< First, sort by weekday\n\t\t 'start_time' => true, ///< Next, the meeting start time\n\t\t\t\t\t\t\t\t\t'location_municipality' => true,\t///< Next, the town.\n\t\t\t\t\t\t\t\t\t'week_starts' => $this->week_starts_1_based_int ///< Our week starts on this day\n\t\t\t\t\t\t\t\t\t);\n\t\t\n\t\t/// These are the parameters that we send over to the root server, in order to get our meetings.\n\t\t$this->out_http_vars = array ( 'services' => array ( ///< We will be asking for meetings in specific Service Bodies.\n 1001,\t///< SSAASC\n 1002,\t///< NASC\n 1003,\t///< ELIASC\n 1004,\t///< SSSAC\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 1067 ///< NSLI\n\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t\t'sort_key' => 'time' \n\t\t\t\t\t\t\t\t\t);\n\n\t\tparent::__construct ($in_http_vars);\n\t}",
"function __construct()\n {\n $this->url = 'http://sqlvalidator.mimer.com/v1/services';\n $this->service_name = 'SQL99Validator';\n $this->wsdl = '?wsdl';\n\n $this->output_type = 'html';\n\n $this->username = 'anonymous';\n $this->password = '';\n $this->calling_program = 'PHP_SQLValidator';\n $this->calling_program_version = '$Revision$';\n $this->target_dbms = 'N/A';\n $this->target_dbms_version = 'N/A';\n $this->connection_technology = 'PHP';\n $this->connection_technology_version = phpversion();\n $this->interactive = 1;\n\n $this->service_link = null;\n $this->session_data = null;\n }",
"public function __construct() {\n \t// $this->host = $host;\n \t// $this->port = $port;\n \t// $this->timeout = $timeout;\n parent::__construct(\"192.168.163.30\", \"22\", \"1\");\n }",
"function pre_system ( $data ) \n\t{\n\n\t\t// Is the HTTP_CF_CONNECTING_IP header set? If not, then this isn't CloudFlare\n\t\t$this->is_cf = ( ! empty( $_SERVER[\"HTTP_CF_CONNECTING_IP\"] )) ? TRUE : FALSE;\n\n\t\t// Set Origin IP\n\t\t$this->origin_ip = ( ! empty( $_SERVER[\"HTTP_CF_CONNECTING_IP\"] ))\n\t\t\t\t? $_SERVER[\"HTTP_CF_CONNECTING_IP\"]\n\t\t\t\t: UNKNOWN_COUNTRY;\n\n\t\t// Set country code\n\t\t$this->ip_country = ( ! empty( $_SERVER[\"HTTP_CF_IPCOUNTRY\"] ))\n\t\t\t\t? $_SERVER[\"HTTP_CF_IPCOUNTRY\"]\n\t\t\t\t: UNKNOWN_COUNTRY;\n\t\t\n\t\t// Set the CloudFlare service IP\n\t\t$this->cloudflare_ip = $_SERVER['REMOTE_ADDR'];\n\t\t\n\t\t// Overwrite the REMOTE_ADDR data if enabled\n\t\tif ( $this->settings['overwrite_addr'] == 'y' )\n\t\t{\n\t\t\t$this->_overwrite_remoteaddr();\n\t\t}\n\t\t\n\t}",
"public function __construct()\n\t{\n\t $this->CI = &get_instance();\n\t $this->idclass = 1;\n\t\t //mt_srand((double)microtime()*1000000);\n\t\t $APPID = 'QievnEMnPVePl5IuiEkbK47iUNHaORE98a2tlgcx';\n $RESTKEY = '5nhxBdaWoobBSJETssRZkybUO0nMW3dcO47VsAgI';\n $MASTERKEY = '75zTvvoVsxwWHebxWavyX7xX2uHJ92tuR5BHBE6D';\n ParseClient::initialize( $APPID, $RESTKEY, $MASTERKEY );\n\t}",
"public function __construct() {\n // be shure, classes are loaded before copie\n MLSession::gi();\n MLSetting::gi();\n MLMessage::gi();\n MLController::gi('widget_message');\n MLController::gi('widget_progressbar');\n MLHelper::gi('remote');\n MLCache::gi();\n MLShop::gi();\n MLHttp::gi();\n MLLog::gi();\n MLException::factory('update');\n try {\n MLDatabase::factory('config');\n } catch (Exception $oEx) {\n // database is not part of installer\n }\n $this->sCacheName = __CLASS__.'__updateinfo.json';\n parent::__construct();\n }",
"public function __construct(){\n $this->c_path = $_SERVER[\"SCRIPT_NAME\"];\n $this->c_header = null;\n $this->c_authentication_page_form = null;\n $this->c_arr_login_form = null;\n $this->c_arr_register_form = null;\n $this->c_arr_homepage_page_form = null;\n $this->c_arr_homepage_page_error_form = null;\n $this->c_download_page = null;\n $this->c_review_page = null;\n $this->c_download_error_page = null;\n $this->c_review_error_page = null;\n $this->c_review_logs = null;\n $this->c_arr_login_field_empty_form = null;\n $this->c_arr_login_wrong_input_form = null;\n $this->c_arr_register_field_empty_form = null;\n $this->c_arr_register_user_exists_form = null;\n $this->c_display_page_processed = null;\n }",
"public function __construct() {\n trace('[METHOD] '.__METHOD__);\n $this->classConfigArr = $GLOBALS['TSFE']->tmpl->setup['config.']['tx_ptgsaaccounting.'];\n $this->shopConfigArr = $GLOBALS['TSFE']->tmpl->setup['config.']['tx_ptgsashop.']; \n \n if($this->shopConfigArr['usePricesWithMoreThanTwoDecimals'] == 1) {\n $this->precision = 4;\n } else {\n $this->precision = 2;\n } \n trace($this->classConfigArr,0,'classConfigArr');\n trace($this->shopConfigArr,0,'shopConfigArr');\n }",
"private function __construct($ip)\n {\n $this->ip = $ip;\n }",
"protected function systemInfo()\n {\n $this->osname = php_uname('s');\n $this->hostname = php_uname('n');\n $this->osrelease = php_uname('r');\n $this->osversion = php_uname('v');\n $this->ostype = php_uname('m');\n }",
"public function __construct()\n {\n if (11 == func_num_args()) {\n $this->valid = func_get_arg(0);\n $this->country = func_get_arg(1);\n $this->providerType = func_get_arg(2);\n $this->countryCode = func_get_arg(3);\n $this->hostname = func_get_arg(4);\n $this->providerDomain = func_get_arg(5);\n $this->city = func_get_arg(6);\n $this->providerWebsite = func_get_arg(7);\n $this->ip = func_get_arg(8);\n $this->region = func_get_arg(9);\n $this->providerDescription = func_get_arg(10);\n }\n }",
"function __construct()\n {\n // $this->_ci =& get_instance();\n //load config \n // $this->load->library('user_agent'); \n }",
"public function __construct()\n {\n $this->protocolList = array(\n 'imap' => __NAMESPACE__ . '\\IMAP',\n 'pop3' => __NAMESPACE__ . '\\POP',\n 'nntp' => __NAMESPACE__ . '\\NNTP',\n );\n }",
"protected function _construct()\n\t{\n\t\t$this->_init('cecropia_advancedoc/blockedip');\n\t}",
"function __construct() {\n $this->name=\"AliIPRelays\";\n $this->title=\"Ali IP Реле\";\n $this->lastsate=array();\n $this->module_category=\"<#LANG_SECTION_DEVICES#>\";\n $this->checkInstalled();\n}",
"function my_deconstructor()\n\t{\n\t\t//-----------------------------------------\n\t\t// Update Server Load\n\t\t//-----------------------------------------\n\t\t\t\t\n if ($this->vars['load_limit'] > 0)\n {\n\t $server_load_found = 0;\n\t \n\t //-----------------------------------------\n\t // Check cache first...\n\t //-----------------------------------------\n\t \n\t if ( $this->cache['systemvars']['loadlimit'] )\n\t {\n\t\t $loadinfo = explode( \"-\", $this->cache['systemvars']['loadlimit'] );\n\t\t \n\t\t if ( intval($loadinfo[1]) > (time() - 10) )\n\t\t {\n\t\t\t //-----------------------------------------\n\t\t\t // Cache is less than 1 minute old\n\t\t\t //-----------------------------------------\n\t\t\t \n\t\t\t $server_load_found = 1;\n \t\t\t}\n\t\t\t}\n\t\t\t\n\t //-----------------------------------------\n\t // No cache or it's old, check real time\n\t //-----------------------------------------\n\t\t\t\n\t\t\tif ( ! $server_load_found )\n\t\t\t{\n\t\t # @ supressor fixes warning in >4.3.2 with open_basedir restrictions\n\t\t \n\t \tif ( @file_exists('/proc/loadavg') )\n\t \t{\n\t \t\tif ( $fh = @fopen( '/proc/loadavg', 'r' ) )\n\t \t\t{\n\t \t\t\t$data = @fread( $fh, 6 );\n\t \t\t\t@fclose( $fh );\n\t \t\t\t\n\t \t\t\t$load_avg = explode( \" \", $data );\n\t \t\t\t\n\t \t\t\t$this->server_load = trim($load_avg[0]);\n\t \t\t}\n\t \t}\n\t \telse if( strstr( strtolower(PHP_OS), 'win' ) )\n\t \t{\n\t\t\t /*---------------------------------------------------------------\n\t\t\t | typeperf is an exe program that is included with Win NT,\n\t\t\t |\tXP Pro, and 2K3 Server. It can be installed on 2K from the\n\t\t\t |\t2K Resource kit. It will return the real time processor\n\t\t\t |\tPercentage, but will take 1 second processing time to do so.\n\t\t\t |\tThis is why we shall cache it, and check every 10 secs.\n\t\t\t |\n\t\t\t |\tCan also be obtained from COM, but it's extremely slow...\n\t\t\t ---------------------------------------------------------------*/\n\t\t \t\n\t\t \t$serverstats = @shell_exec(\"typeperf \\\"Processor(_Total)\\% Processor Time\\\" -sc 1\");\n\t\t \t\n\t\t \tif( $serverstats )\n\t\t \t{\n\t\t\t\t\t\t$server_reply = explode( \"\\n\", str_replace( \"\\r\", \"\", $serverstats ) );\n\t\t\t\t\t\t$serverstats = array_slice( $server_reply, 2, 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\t$statline = explode( \",\", str_replace( '\"', '', $serverstats[0] ) );\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->server_load = round( $statline[1], 2 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t \telse\n\t \t{\n\t\t\t\t\tif ( $serverstats = @exec(\"uptime\") )\n\t\t\t\t\t{\n\t\t\t\t\t\tpreg_match( \"/(?:averages)?\\: ([0-9\\.]+)[^0-9\\.]+([0-9\\.]+)[^0-9\\.]+([0-9\\.]+)\\s*/\", $serverstats, $load );\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->server_load = $load[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( $this->server_load )\n\t\t\t\t{\n\t\t\t\t\t$this->cache['systemvars']['loadlimit'] = $this->server_load.\"-\".time();\n\t\t\t\t\t\n\t\t\t\t\t$this->update_cache( array( 'array' => 1, 'name' => 'systemvars', 'donow' => 1, 'deletefirst' => 0 ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Process mail queue\n\t\t//-----------------------------------------\n\t\t\t\n\t\t$this->process_mail_queue();\t\t\n\t\t\n\t\t//-----------------------------------------\n\t\t// Any shutdown queries\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->DB->return_die = 0;\n\t\t\n\t\tif ( count( $this->DB->obj['shutdown_queries'] ) )\n\t\t{\n\t\t\tforeach( $this->DB->obj['shutdown_queries'] as $q )\n\t\t\t{\n\t\t\t\t$this->DB->query( $q );\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->DB->return_die = 1;\n\t\t\n\t\t$this->DB->obj['shutdown_queries'] = array();\n\t\t\n\t\t$this->DB->close_db();\n\t\t\n\t\tif( is_object($this->cachelib) )\n\t\t{\n\t\t\t// memcache, primarily, though disconnect will\n\t\t\t// happen automatically just like DB anyways\n\t\t\t\n\t\t\t$this->cachelib->disconnect();\n\t\t}\t\t\n\t}"
]
| [
"0.6663937",
"0.6489266",
"0.6335373",
"0.6227281",
"0.6211156",
"0.60748255",
"0.60321283",
"0.6029289",
"0.59888315",
"0.5954565",
"0.5902744",
"0.58918655",
"0.5868165",
"0.5846813",
"0.5781906",
"0.576869",
"0.5759446",
"0.5755019",
"0.57388586",
"0.5702686",
"0.5692096",
"0.56913364",
"0.5690685",
"0.5668043",
"0.5654919",
"0.5643166",
"0.5641346",
"0.56397855",
"0.56323457",
"0.56310964"
]
| 0.80831605 | 0 |
/ Get browser Return: unknown, windows, mac / Fetches the user's operating system | function fetch_os()
{
$useragent = strtolower($this->my_getenv('HTTP_USER_AGENT'));
if ( strstr( $useragent, 'mac' ) )
{
return 'mac';
}
if ( preg_match( '#wi(n|n32|ndows)#', $useragent ) )
{
return 'windows';
}
return 'unknown';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getBrowser() \n { \n $u_agent = $_SERVER['HTTP_USER_AGENT']; \n $bname = 'Unknown';\n $platform = 'Unknown';\n $version= \"\";\n $ub=\"\";\n //print($u_agent);\n //First get the platform?\n if (preg_match('/Android/i', $u_agent)) {\n $platform = 'Android';\n }\n elseif (preg_match('/iPhone/i', $u_agent)) {\n $platform = 'iOS';\n }\n elseif (preg_match('/windows|win32/i', $u_agent)) {\n $platform = 'Windows';\n }\n elseif (preg_match('/linux/i', $u_agent)) {\n $platform = 'Linux';\n }\n elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {\n $platform = 'OSX';\n }\n return $platform;\n }",
"public function getClientOs()\n\t{\n\t\t$userAgent = $this->getUserAgent();\n\n\t\tif (preg_match('/Linux/', $userAgent))\n\t\t{\n\t\t\treturn 'Linux';\n\t\t}\n\t\telseif (preg_match('/Win/', $userAgent))\n\t\t{\n\t\t\treturn 'Windows';\n\t\t}\n\t\telseif (preg_match('/Mac/', $userAgent))\n\t\t{\n\t\t\treturn 'Mac';\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 'Other';\n\t\t}\n\t}",
"function getUserBrowser()\r\n{\r\n global $HTTP_USER_AGENT, $_SERVER;\r\n if (!empty($_SERVER['HTTP_USER_AGENT'])) {\r\n $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];\r\n }\r\n elseif (getenv(\"HTTP_USER_AGENT\")) {\r\n $HTTP_USER_AGENT = getenv(\"HTTP_USER_AGENT\");\r\n }\r\n elseif (empty($HTTP_USER_AGENT)) {\r\n $HTTP_USER_AGENT = \"\";\r\n }\r\n\r\n if (eregi(\"MSIE ([0-9].[0-9]{1,2})\", $HTTP_USER_AGENT, $regs)) {\r\n $browser['agent'] = 'MSIE';\r\n $browser['version'] = $regs[1];\r\n }\r\n elseif (eregi(\"Mozilla/([0-9].[0-9]{1,2})\", $HTTP_USER_AGENT, $regs)) {\r\n $browser['agent'] = 'MOZILLA';\r\n $browser['version'] = $regs[1];\r\n }\r\n elseif (eregi(\"Opera(/| )([0-9].[0-9]{1,2})\", $HTTP_USER_AGENT, $regs)) {\r\n $browser['agent'] = 'OPERA';\r\n $browser['version'] = $regs[2];\r\n }\r\n else {\r\n $browser['agent'] = 'OTHER';\r\n $browser['version'] = 0;\r\n }\r\n\r\n return $browser['agent'];\r\n}",
"function getUserBrowser()\n {\n $arr_browsers = [\"Firefox\", \"Opera\", \"Edge\", \"OPR\", \"Chrome\", \"Safari\", \"MSIE\", \"Trident\"];\n $agent = $_SERVER['HTTP_USER_AGENT'];\n $user_browser = 'Unknown';\n foreach ($arr_browsers as $browser) {\n if (strpos($agent, $browser) !== false) {\n $user_browser = $browser;\n break;\n }\n }\n\n switch ($user_browser) {\n case 'MSIE':\n case 'Trident':\n $user_browser = 'Internet Explorer';\n break;\n\n case 'OPR':\n $user_browser = 'Opera';\n break;\n }\n return $user_browser;\n }",
"function getBrowser(){ \n\t\t$u_agent\t=\t$_SERVER['HTTP_USER_AGENT']; \n\t\t$bname\t\t=\t'Unknown';\n\t\t$platform\t=\t'Unknown';\n\t\t$version\t=\t\"\";\n\n\t\tif (preg_match('/linux/i', $u_agent)) {\n\t\t\t$platform = 'Linux';\n\t\t}\n\t\telse if(preg_match('/macintosh|mac os x/i', $u_agent))\n\t\t{\n\t\t\t$platform = 'Mac';\n\t\t}\n\t\telse if(preg_match('/windows|win32/i', $u_agent))\n\t\t{\n\t\t\t$platform = 'Windows';\n\t\t}\n\n\t\tif(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent)) \n\t\t{ \n\t\t\t$bname\t=\t'Internet Explorer'; \n\t\t\t$ub\t\t=\t\"MSIE\"; \n\t\t} \n\t\telseif(preg_match('/Firefox/i',$u_agent)) \n\t\t{ \n\t\t\t$bname\t=\t'Mozilla Firefox'; \n\t\t\t$ub\t\t=\t\"Firefox\"; \n\t\t} \n\t\telseif(preg_match('/Chrome/i',$u_agent)) \n\t\t{ \n\t\t\t$bname\t=\t'Google Chrome'; \n\t\t\t$ub\t\t=\t\"Chrome\"; \n\t\t} \n\t\telseif(preg_match('/Safari/i',$u_agent)) \n\t\t{ \n\t\t\t$bname\t=\t'Apple Safari'; \n\t\t\t$ub\t\t=\t\"Safari\"; \n\t\t} \n\t\telseif(preg_match('/Opera/i',$u_agent)) \n\t\t{ \n\t\t\t$bname\t=\t'Opera'; \n\t\t\t$ub\t\t=\t\"Opera\"; \n\t\t} \n\t\telseif(preg_match('/Netscape/i',$u_agent)) \n\t\t{ \n\t\t\t$bname\t=\t'Netscape'; \n\t\t\t$ub\t\t=\t\"Netscape\"; \n\t\t} \n\n\t\t$known = array('Version', $ub, 'other');\n\t\t$pattern = '#(?<browser>' . join('|', $known) .')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';\n\t\tif (!preg_match_all($pattern, $u_agent, $matches))\n\t\t{\n\t\t}\n\n\t\t$i\t=\tcount($matches['browser']);\n\t\tif ($i != 1) {\n\t\t\tif (strripos($u_agent,\"Version\") < strripos($u_agent,$ub))\n\t\t\t{\n\t\t\t\t$version= $matches['version'][0];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$version= $matches['version'][1];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$version= $matches['version'][0];\n\t\t}\n\n\t\tif ($version==null || $version==\"\") {$version=\"?\";}\n\t\treturn array(\n\t\t\t'userAgent'\t=>\t$u_agent,\n\t\t\t'name'\t\t=>\t$bname,\n\t\t\t'version'\t=>\t$version,\n\t\t\t'platform'\t=>\t$platform,\n\t\t\t'pattern'\t=>\t$pattern\n\t\t);\n\t}",
"public function getOS() { \n \n $server_data = $_SERVER['HTTP_USER_AGENT'];\n\n $os_platform = \"Unknown OS Platform\";\n\n $os_array = array(\n '/windows nt 10/i' => 'Windows',\n '/windows nt 6.3/i' => 'Windows',\n '/windows nt 6.2/i' => 'Windows',\n '/windows nt 6.1/i' => 'Windows',\n '/windows nt 6.0/i' => 'Windows',\n '/windows nt 5.2/i' => 'Windows',\n '/windows nt 5.1/i' => 'Windows',\n '/windows xp/i' => 'Windows',\n '/windows nt 5.0/i' => 'Windows 2000',\n '/windows me/i' => 'Windows ME',\n '/win98/i' => 'Windows 98',\n '/win95/i' => 'Windows 95',\n '/win16/i' => 'Windows 3.11',\n '/macintosh|mac os x/i' => 'Mac OS X',\n '/mac_powerpc/i' => 'Mac OS 9',\n '/linux/i' => 'Linux',\n '/ubuntu/i' => 'Ubuntu',\n '/iphone/i' => 'iPhone',\n '/ipod/i' => 'iPod',\n '/ipad/i' => 'iPad',\n '/android/i' => 'Android',\n '/blackberry/i' => 'BlackBerry',\n '/webos/i' => 'Mobile'\n );\n\n foreach ($os_array as $regex => $value) { \n\n if (preg_match($regex, $server_data)) {\n $os_platform = $value;\n }\n } \n\n return $os_platform;\n }",
"public static function setOS(){\n\t\tif (preg_match(\"#Linux#\", $_SERVER['HTTP_USER_AGENT'])) {\n self::$os_system = \"unix\";\n\t\t}\n\t\telse if (preg_match(\"#Macintosh#\", $_SERVER['HTTP_USER_AGENT'])) {\n self::$os_system = \"mac\";\n\t\t}\n\t\telse if (preg_match(\"#iPhone#\", $_SERVER['HTTP_USER_AGENT'])) {\n self::$os_system = \"iphone\";\n\t\t}\n\t\telse {\n\t\t self::$os_system = \"windows\";\n\t\t}\n\t\treturn($_SERVER['HTTP_USER_AGENT']);\n\t}",
"function getBrowser()\r\n\t\t{\r\n\t\t\t\t$u_agent = $_SERVER['HTTP_USER_AGENT'];\r\n\t\t\t\t$bname = 'unbekannt';\r\n\t\t\t\t$platform = 'unbekannt';\r\n\t\t\t\t$version= \"\";\r\n\r\n\t\t\t\t//First get the platform?\r\n\t\t\t\tif (preg_match('/linux/i', $u_agent)) {\r\n\t\t\t\t\t\t$platform = 'linux';\r\n\t\t\t\t}\r\n\t\t\t\telseif (preg_match('/macintosh|mac os x/i', $u_agent)) {\r\n\t\t\t\t\t\t$platform = 'mac';\r\n\t\t\t\t}\r\n\t\t\t\telseif (preg_match('/windows|win32/i', $u_agent)) {\r\n\t\t\t\t\t\t$platform = 'windows';\r\n\t\t\t\t}\r\n\t\t\t \r\n\t\t\t\t// Next get the name of the useragent yes seperately and for good reason\r\n\t\t\t\tif(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))\r\n\t\t\t\t{\r\n\t\t\t\t\t\t$bname = 'Internet Explorer';\r\n\t\t\t\t\t\t$ub = \"MSIE\";\r\n\t\t\t\t}\r\n\t\t\t\telseif(preg_match('/Firefox/i',$u_agent))\r\n\t\t\t\t{\r\n\t\t\t\t\t\t$bname = 'Mozilla Firefox';\r\n\t\t\t\t\t\t$ub = \"Firefox\";\r\n\t\t\t\t}\r\n\t\t\t\telseif(preg_match('/Chrome/i',$u_agent))\r\n\t\t\t\t{\r\n\t\t\t\t\t\t$bname = 'Google Chrome';\r\n\t\t\t\t\t\t$ub = \"Chrome\";\r\n\t\t\t\t}\r\n\t\t\t\telseif(preg_match('/Safari/i',$u_agent))\r\n\t\t\t\t{\r\n\t\t\t\t\t\t$bname = 'Apple Safari';\r\n\t\t\t\t\t\t$ub = \"Safari\";\r\n\t\t\t\t}\r\n\t\t\t\telseif(preg_match('/Opera/i',$u_agent))\r\n\t\t\t\t{\r\n\t\t\t\t\t\t$bname = 'Opera';\r\n\t\t\t\t\t\t$ub = \"Opera\";\r\n\t\t\t\t}\r\n\t\t\t\telseif(preg_match('/Netscape/i',$u_agent))\r\n\t\t\t\t{\r\n\t\t\t\t\t\t$bname = 'Netscape';\r\n\t\t\t\t\t\t$ub = \"Netscape\";\r\n\t\t\t\t}\r\n\t\t\t \r\n\t\t\t\t// finally get the correct version number\r\n\t\t\t\t$known = array('Version', $ub, 'other');\r\n\t\t\t\t$pattern = '#(?<browser>' . join('|', $known) .\r\n\t\t\t\t')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';\r\n\t\t\t\tif (!preg_match_all($pattern, $u_agent, $matches)) {\r\n\t\t\t\t\t\t// we have no matching number just continue\r\n\t\t\t\t}\r\n\t\t\t \r\n\t\t\t\t// see how many we have\r\n\t\t\t\t$i = count($matches['browser']);\r\n\t\t\t\tif ($i != 1) {\r\n\t\t\t\t\t\t//we will have two since we are not using 'other' argument yet\r\n\t\t\t\t\t\t//see if version is before or after the name\r\n\t\t\t\t\t\tif (strripos($u_agent,\"Version\") < strripos($u_agent,$ub)){\r\n\t\t\t\t\t\t\t\t$version= $matches['version'][0];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t$version= $matches['version'][1];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t\t$version= $matches['version'][0];\r\n\t\t\t\t}\r\n\t\t\t \r\n\t\t\t\t// check if we have a number\r\n\t\t\t\tif ($version==null || $version==\"\") {$version=\"?\";}\r\n\t\t\t \r\n\t\t\t\treturn array(\r\n\t\t\t\t\t\t'userAgent' => $u_agent,\r\n\t\t\t\t\t\t'name' => $bname,\r\n\t\t\t\t\t\t'version' => $version,\r\n\t\t\t\t\t\t'platform' => $platform,\r\n\t\t\t\t\t\t'pattern' => $pattern,\r\n\t\t\t\t\t\t'shortname' => $ub\r\n\t\t\t\t);\r\n\t\t}",
"public static function get_browser() {\n $user_agent = $_SERVER['HTTP_USER_AGENT'];\n\n if (strpos($user_agent, 'Opera') || strpos($user_agent, 'OPR/')) {\n return 'Opera';\n } else if (strpos($user_agent, 'Edge')) {\n return 'Edge';\n } elseif (strpos($user_agent, 'Chrome')) {\n return 'Chrome';\n } elseif (strpos($user_agent, 'Safari')) {\n return 'Safari';\n } elseif (strpos($user_agent, 'Firefox')) {\n return 'Firefox';\n } elseif (strpos($user_agent, 'MSIE') || strpos($user_agent, 'Trident/7')) {\n return 'Internet Explorer';\n }\n\n return 'Other';\n }",
"public function getUserAgentPlatform()\n {\n return UTIL_Browser::getPlatform($_SERVER['HTTP_USER_AGENT']);\n }",
"function get_client_browser() {\r\n $browser = '';\r\n if(strpos($_SERVER['HTTP_USER_AGENT'], 'Netscape'))\r\n $browser = 'Netscape';\r\n else if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox'))\r\n $browser = 'Firefox';\r\n else if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome'))\r\n $browser = 'Chrome';\r\n else if (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera'))\r\n $browser = 'Opera';\r\n else if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'))\r\n $browser = 'Internet Explorer';\r\n else\r\n $browser = 'Other';\r\n return $browser;\r\n}",
"static function getOS(){\n\t\trequire_once(\"knj/functions_array.php\");\n\t\t$bots = array(\n\t\t\t\"yahoo! slurp\",\n\t\t\t\"msnbot\",\n\t\t\t\"googlebot\",\n\t\t\t\"adsbot\",\n\t\t\t\"ask jeeves\",\n\t\t\t\"conpilot crawler\",\n\t\t\t\"yandex\",\n\t\t\t\"exabot\",\n\t\t\t\"hostharvest\",\n\t\t\t\"dotbot\",\n\t\t\t\"ia_archiver\",\n\t\t\t\"httpclient\",\n\t\t\t\"spider.html\",\n\t\t\t\"comodo-certificates-spider\",\n\t\t\t\"sbider\",\n\t\t\t\"speedy spider\",\n\t\t\t\"spbot\",\n\t\t\t\"aihitbot\",\n\t\t\t\"scoutjet\",\n\t\t\t\"com_bot\",\n\t\t\t\"aihitbot\",\n\t\t\t\"robot.html\",\n\t\t\t\"robot.htm\",\n\t\t\t\"catchbot\",\n\t\t\t\"baiduspider\",\n\t\t\t\"setoozbot\",\n\t\t\t\"sslbot\",\n\t\t\t\"browsershots\",\n\t\t\t\"perl\",\n\t\t\t\"wget\",\n\t\t\t\"w3c_validator\"\n\t\t);\n\t\t\n\t\tif (array_key_exists(\"HTTP_USER_AGENT\", $_SERVER)){\n\t\t\t$ua = strtolower($_SERVER[\"HTTP_USER_AGENT\"]);\n\t\t}else{\n\t\t\treturn \"unknown\";\n\t\t}\n\t\t\n\t\tif (strpos($ua, \"windows\") !== false){\n\t\t\treturn \"windows\";\n\t\t}elseif(strpos($ua, \"linux\") !== false){\n\t\t\treturn \"linux\";\n\t\t}elseif(strpos($ua, \"mac\") !== false){\n\t\t\treturn \"mac\";\n\t\t}elseif(strpos($ua, \"playstation\") !== false){\n\t\t\treturn \"playstation\";\n\t\t}elseif(strpos($ua, \"nintendo wii\") !== false){\n\t\t\treturn \"wii\";\n\t\t}elseif(knjarray::stringsearch($ua, $bots)){\n\t\t\treturn \"bot\";\n\t\t}elseif(strpos($ua, \"sunos\") !== false){\n\t\t\treturn \"sun\";\n\t\t}elseif(trim($ua) == \"\"){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn \"unknown\";\n\t\t}\n\t}",
"function get_the_browser()\n{\n if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)\n return 'Internet explorer';\n elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false)\n return 'Internet explorer';\n elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false)\n return 'Mozilla Firefox';\n elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false)\n return 'Google Chrome';\n elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false)\n return \"Opera Mini\";\n elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false)\n return \"Opera\";\n elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false)\n return \"Safari\";\n else\n return 'Other';\n }",
"function getBrowser() \n{ \n $u_agent = $_SERVER['HTTP_USER_AGENT']; \n $bname = 'Unknown';\n $platform = 'Unknown';\n $version= \"\";\n\n //First get the platform?\n if (preg_match('/linux/i', $u_agent)) {\n $platform = 'linux';\n }\n elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {\n $platform = 'mac';\n }\n elseif (preg_match('/windows|win32/i', $u_agent)) {\n $platform = 'windows';\n }\n \n // Next get the name of the useragent yes seperately and for good reason\n if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent)) \n { \n $bname = 'Internet Explorer'; \n $ub = \"MSIE\"; \n } \n elseif(preg_match('/Firefox/i',$u_agent)) \n { \n $bname = 'Mozilla Firefox'; \n $ub = \"Firefox\"; \n } \n elseif(preg_match('/Chrome/i',$u_agent)) \n { \n $bname = 'Google Chrome'; \n $ub = \"Chrome\"; \n } \n elseif(preg_match('/Safari/i',$u_agent)) \n { \n $bname = 'Apple Safari'; \n $ub = \"Safari\"; \n } \n elseif(preg_match('/Opera/i',$u_agent)) \n { \n $bname = 'Opera'; \n $ub = \"Opera\"; \n } \n elseif(preg_match('/Netscape/i',$u_agent)) \n { \n $bname = 'Netscape'; \n $ub = \"Netscape\"; \n } \n \n // finally get the correct version number\n $known = array('Version', $ub, 'other');\n $pattern = '#(?<browser>' . join('|', $known) .\n ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';\n if (!preg_match_all($pattern, $u_agent, $matches)) {\n // we have no matching number just continue\n }\n \n // see how many we have\n $i = count($matches['browser']);\n if ($i != 1) {\n //we will have two since we are not using 'other' argument yet\n //see if version is before or after the name\n if (strripos($u_agent,\"Version\") < strripos($u_agent,$ub)){\n $version= $matches['version'][0];\n }\n else {\n $version= $matches['version'][1];\n }\n }\n else {\n $version= $matches['version'][0];\n }\n \n // check if we have a number\n if ($version==null || $version==\"\") {$version=\"?\";}\n \n return array(\n 'userAgent' => $u_agent,\n 'name' => $bname,\n 'version' => $version,\n 'platform' => $platform,\n 'pattern' => $pattern\n );\n}",
"function getUserBrowser()\n{\n $useragent = $_SERVER ['HTTP_USER_AGENT']; \n return $useragent;\n}",
"function getBrowser() {\n $u_agent = $_SERVER['HTTP_USER_AGENT'];\n $bname = 'Unknown';\n $platform = 'Unknown';\n $version = \"\";\n\n //First get the platform?\n if (preg_match('/linux/i', $u_agent)) {\n $platform = 'linux';\n } elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {\n $platform = 'mac';\n } elseif (preg_match('/windows|win32/i', $u_agent)) {\n $platform = 'windows';\n }\n\n // Next get the name of the useragent yes seperately and for good reason\n if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) {\n $bname = 'Internet Explorer';\n $ub = \"MSIE\";\n } elseif (preg_match('/Firefox/i', $u_agent)) {\n $bname = 'Mozilla Firefox';\n $ub = \"Firefox\";\n } elseif (preg_match('/Chrome/i', $u_agent)) {\n $bname = 'Google Chrome';\n $ub = \"Chrome\";\n } elseif (preg_match('/Safari/i', $u_agent)) {\n $bname = 'Apple Safari';\n $ub = \"Safari\";\n } elseif (preg_match('/Opera/i', $u_agent)) {\n $bname = 'Opera';\n $ub = \"Opera\";\n } elseif (preg_match('/Netscape/i', $u_agent)) {\n $bname = 'Netscape';\n $ub = \"Netscape\";\n }\n\n // finally get the correct version $number\n $known = array('Version', $ub, 'other');\n $pattern = '#(?<browser>' . join('|', $known) .\n ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';\n if (!preg_match_all($pattern, $u_agent, $matches)) {\n // we have no matching $number just continue\n }\n\n // see how many we have\n $i = count($matches['browser']);\n if ($i != 1) {\n //we will have two since we are not using 'other' argument yet\n //see if version is before or after the name\n if (strripos($u_agent, \"Version\") < strripos($u_agent, $ub)) {\n $version = $matches['version'][0];\n } else {\n $version = $matches['version'][1];\n }\n } else {\n $version = $matches['version'][0];\n }\n\n // check if we have a $number\n if ($version == null || $version == \"\") {\n $version = \"?\";\n }\n\n return array(\n 'userAgent' => $u_agent,\n 'name' => $bname,\n 'version' => $version,\n 'platform' => $platform,\n 'pattern' => $pattern\n );\n}",
"function determineOs() {\n\t\n\t$ret\t\t\t= \"undef\";\n\t\n\tob_start();\n\teval(\"phpinfo();\");\n\t$info \t\t\t= ob_get_contents();\n\tob_end_clean();\n\t\n\tforeach(explode(\"\\n\", $info) as $line) \t{\n\t \n\t if(strpos($line, \"System\")!== false) {\n\t \n\t $show \t= trim(str_replace(\"System\",\"\", strip_tags($line)));\n\t \n\t }\n\t}\n\t\n\tif( preg_match('/WIN/i', $show) ) {\n\t \n\t $ret\t= \"windows\";\n\t} else {\n\t $ret\t= \"unix\";\n\t}\n\n\treturn( $ret );\n}",
"function _userAgent()\n{\n $u_agent = $_SERVER['HTTP_USER_AGENT'];\n $bname = 'Unknown';\n $platform = 'Unknown';\n $version = \"\";\n\n $os_array = array(\n '/windows nt 10.0/i' => 'Windows 10',\n '/windows nt 6.3/i' => 'Windows 8.1',\n '/windows nt 6.2/i' => 'Windows 8',\n '/windows nt 6.1/i' => 'Windows 7',\n '/windows nt 6.0/i' => 'Windows Vista',\n '/windows nt 5.2/i' => 'Windows Server 2003/XP x64',\n '/windows nt 5.1/i' => 'Windows XP',\n '/windows xp/i' => 'Windows XP',\n '/windows nt 5.0/i' => 'Windows 2000',\n '/windows me/i' => 'Windows ME',\n '/win98/i' => 'Windows 98',\n '/win95/i' => 'Windows 95',\n '/win16/i' => 'Windows 3.11',\n '/macintosh|mac os x/i' => 'Mac OS X',\n '/mac_powerpc/i' => 'Mac OS 9',\n '/linux/i' => 'Linux',\n '/ubuntu/i' => 'Ubuntu',\n '/iphone/i' => 'iPhone',\n '/ipod/i' => 'iPod',\n '/ipad/i' => 'iPad',\n '/android/i' => 'Android',\n '/blackberry/i' => 'BlackBerry',\n '/webos/i' => 'Mobile'\n );\n\n foreach ($os_array as $regex => $value) {\n\n if (preg_match($regex, $u_agent)) {\n $platform = $value;\n break;\n }\n }\n\n // Next get the name of the useragent yes seperately and for good reason\n if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) {\n $bname = 'Internet Explorer';\n $ub = \"MSIE\";\n } elseif (preg_match('/Firefox/i', $u_agent)) {\n $bname = 'Mozilla Firefox';\n $ub = \"Firefox\";\n } elseif (preg_match('/Chrome/i', $u_agent)) {\n $bname = 'Google Chrome';\n $ub = \"Chrome\";\n } elseif (preg_match('/Safari/i', $u_agent)) {\n $bname = 'Apple Safari';\n $ub = \"Safari\";\n } elseif (preg_match('/Opera/i', $u_agent)) {\n $bname = 'Opera';\n $ub = \"Opera\";\n } elseif (preg_match('/Netscape/i', $u_agent)) {\n $bname = 'Netscape';\n $ub = \"Netscape\";\n }\n\n // finally get the correct version number\n $known = array('Version', $ub, 'other');\n $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';\n\n if (!preg_match_all($pattern, $u_agent, $matches)) {\n // we have no matching number just continue\n }\n\n // see how many we have\n $i = count($matches['browser']);\n if ($i != 1) {\n //we will have two since we are not using 'other' argument yet\n //see if version is before or after the name\n if (strripos($u_agent, \"Version\") < strripos($u_agent, $ub)) {\n $version = $matches['version'][0];\n } else {\n $version = $matches['version'][1];\n }\n } else {\n $version = $matches['version'][0];\n }\n\n // check if we have a number\n $version = ($version == null || $version == \"\") ? \"?\" : $version;\n\n return array(\n 'userAgent' => $u_agent,\n 'name' => $bname,\n 'version' => $version,\n 'platform' => $platform,\n 'pattern' => $pattern\n );\n}",
"function getBrowser()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$u_agent = $_SERVER[\"HTTP_USER_AGENT\"];\n\t\t\t\t\t\t\t$ub = \"\";\n\t\t\t\t\t\t\t/*preg_match() is a php function that will look for a match within a string. It will only match once even if it finds multiple matchs in a string.*/\n\t\t\t\t\t\t\tif (preg_match(\"/Opera/i\",$u_agent))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$ub = \"Your browser is Opera\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telseif (preg_match(\"/Firefox/i\",$u_agent))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$ub = \"Your browser is Firefox\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telseif (preg_match(\"/MSIE/i\",$u_agent))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$ub = \"Your browser is Internet Explorer\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telseif (preg_match(\"/Chrome/i\",$u_agent))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$ub = \"Your browser is Chrome\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tEcho \"Go download a decent browser you fool\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn $ub;\n\t\t\t\t\t\t}",
"function get_user_agent()\n{\n $ret = array();\n $ret['browser'] = 'Unknown';\n $ret['version'] = 'Unknown';\n $ret['user_os'] = 'Unknown';\n\n // get browser\n preg_match('/(MSIE|Safari|Firefox|Opera)/i', $_SERVER['HTTP_USER_AGENT'], $browser_matches);\n\n if (count($browser_matches) > 0)\n {\n $ret['browser'] = $browser_matches[0];\n }\n\n switch($ret['browser'])\n {\n case 'MSIE':\n preg_match('/MSIE ([0-9.]*)/i', $_SERVER['HTTP_USER_AGENT'], $version_matches);\n $ret['version'] = $version_matches[1];\n break;\n case 'Firefox':\n preg_match('/Firefox[ \\/]([0-9.]*)/i', $_SERVER['HTTP_USER_AGENT'], $version_matches);\n $ret['version'] = $version_matches[1];\n break;\n case 'Opera':\n preg_match('/Opera[ \\/]([0-9.]*)/i', $_SERVER['HTTP_USER_AGENT'], $version_matches);\n $ret['version'] = $version_matches[1];\n break;\n case 'Safari':\n // Safari's versioning is more like build numbers, actual version seems to be added to 3 and higher\n // while it may be Safari 3.0.1 the return string will be 522.12.2\n preg_match('/Safari\\/([0-9.]*)/i', $_SERVER['HTTP_USER_AGENT'], $version_matches);\n $ret['version'] = $version_matches[1];\n break;\n ## chrome can be mis-read as safari\n }\n\n // get OS\n preg_match('/(Windows|Mac)/i', $_SERVER['HTTP_USER_AGENT'], $os_matches);\n\n if (count($os_matches) > 0)\n {\n $ret['user_os'] = $os_matches[0];\n }\n\n // return array\n return $ret;\n}",
"function getOS($userAgent) {\n // Create list of operating systems with operating system name as array key \n\t$oses = array (\n\t\t'iPhone' => '(iPhone)',\n\t\t'Windows 3.11' => 'Win16',\n\t\t'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)', // Use regular expressions as value to identify operating system\n\t\t'Windows 98' => '(Windows 98)|(Win98)',\n\t\t'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',\n\t\t'Windows XP' => '(Windows NT 5.1)|(Windows XP)',\n\t\t'Windows 2003' => '(Windows NT 5.2)',\n\t\t'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',\n\t\t'Windows 7' => '(Windows NT 6.1)|(Windows 7)',\n\t\t'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',\n\t\t'Windows ME' => 'Windows ME',\n\t\t'Open BSD'=>'OpenBSD',\n\t\t'Sun OS'=>'SunOS',\n\t\t'Linux'=>'(Linux)|(X11)',\n\t\t'Safari' => '(Safari)',\n\t\t'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',\n\t\t'QNX'=>'QNX',\n\t\t'BeOS'=>'BeOS',\n\t\t'OS/2'=>'OS/2',\n\t\t'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)'\n\t);\n\n\tforeach($oses as $os=>$pattern){ // Loop through $oses array\n // Use regular expressions to check operating system type\n\t\tif(eregi($pattern, $userAgent)) { // Check if a value in $oses array matches current user agent.\n\t\t\treturn $os; // Operating system was matched so return $oses key\n\t\t}\n\t}\n\treturn 'Unknown'; // Cannot find operating system so return Unknown\n}",
"function platform(){\n\n\t\treturn (new user_agent)->platform();\n\n\t}",
"public function getUserOS()\n {\n return $this->userOS ?: $this->userOS = @$this->os[mb_strtolower(PHP_OS)];\n }",
"public function sistema_operativo(){\n\t\t$useragent = $_SERVER['HTTP_USER_AGENT'];\n\t\tif (strstr($useragent,'Win')) {\n\t\t\t$os='Windows';\n\t\t} else if (strstr($useragent,'Mac')) {\n\t\t\t$os='Mac';\n\t\t} else if (strstr($useragent,'Linux')) {\n\t\t\t$os='Linux';\n\t\t} else if (strstr($useragent,'Unix')) {\n\t\t\t$os='Unix';\n\t\t} else {\n\t\t\t$os='Altro';\n\t\t}\n\t\t\n\t\treturn $os;\n\t}",
"function getOS($request) {\n $user_agent = $request->server('HTTP_USER_AGENT');\n $os_platform = $user_agent . \" - Unknown OS Platform\";\n $os_array = array(\n '/windows nt 10/i' => 'Windows 10',\n '/windows nt 6.3/i' => 'Windows 8.1',\n '/windows nt 6.2/i' => 'Windows 8',\n '/windows nt 6.1/i' => 'Windows 7',\n '/windows nt 6.0/i' => 'Windows Vista',\n '/windows nt 5.2/i' => 'Windows Server 2003/XP x64',\n '/windows nt 5.1/i' => 'Windows XP',\n '/windows xp/i' => 'Windows XP',\n '/windows nt 5.0/i' => 'Windows 2000',\n '/windows me/i' => 'Windows ME',\n '/win98/i' => 'Windows 98',\n '/win95/i' => 'Windows 95',\n '/win16/i' => 'Windows 3.11',\n '/macintosh|mac os x/i' => 'Mac OS X',\n '/mac_powerpc/i' => 'Mac OS 9',\n '/linux/i' => 'Linux',\n '/ubuntu/i' => 'Ubuntu',\n '/iphone/i' => 'iPhone',\n '/ipod/i' => 'iPod',\n '/ipad/i' => 'iPad',\n '/android/i' => 'Android',\n '/blackberry/i' => 'BlackBerry',\n '/webos/i' => 'Mobile'\n );\n foreach ($os_array as $regex => $value)\n if (preg_match($regex, $user_agent))\n $os_platform = $value;\n return $os_platform;\n }",
"function browser(){\n\n\t\treturn (new user_agent)->browser();\n\n\t}",
"function getOS() { \n\n $user_agent = $_SERVER['HTTP_USER_AGENT'];\n\n $os_platform = \"UnknownOS\";\n\n $os_array = array(\n '/Windows Phone/i' => 'Windows Phone',\n '/iphone/i' => 'iPhone',\n '/ipod/i' => 'iPod',\n '/ipad/i' => 'iPad',\n '/android/i' => 'Android',\n '/blackberry/i' => 'BlackBerry',\n '/webos/i' => 'Mobile'\n );\n\n foreach ($os_array as $regex => $value) { \n\n if (preg_match($regex, $user_agent)) {\n $os_platform = $value;\n }\n\n } \n\n return $os_platform;\n\n}",
"function fetch_browser()\n\t{\n\t\t$version = 0;\n\t\t$browser = \"unknown\";\n\t\t$useragent = strtolower($this->my_getenv('HTTP_USER_AGENT'));\n\t\t\n\t\t//-----------------------------------------\n\t\t// Opera...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( strstr( $useragent, 'opera' ) )\n\t\t{\n\t\t\tpreg_match( \"#opera[ /]([0-9\\.]{1,10})#\", $useragent, $ver );\n\t\t\t\n\t\t\treturn array( 'browser' => 'opera', 'version' => $ver[1] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// IE...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( strstr( $useragent, 'msie' ) )\n\t\t{\n\t\t\tpreg_match( \"#msie[ /]([0-9\\.]{1,10})#\", $useragent, $ver );\n\t\t\t\n\t\t\treturn array( 'browser' => 'ie', 'version' => $ver[1] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Safari...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( strstr( $useragent, 'safari' ) )\n\t\t{\n\t\t\tpreg_match( \"#safari/([0-9.]{1,10})#\", $useragent, $ver );\n\t\t\t\n\t\t\treturn array( 'browser' => 'safari', 'version' => $ver[1] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Mozilla browsers...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( strstr( $useragent, 'gecko' ) )\n\t\t{ \n\t\t\tpreg_match( \"#gecko/(\\d+)#\", $useragent, $ver );\n\t\t\t\n\t\t\treturn array( 'browser' => 'gecko', 'version' => $ver[1] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Older Mozilla browsers...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( strstr( $useragent, 'mozilla' ) )\n\t\t{\n\t\t\tpreg_match( \"#^mozilla/[5-9]\\.[0-9.]{1,10}.+rv:([0-9a-z.+]{1,10})#\", $useragent, $ver );\n\t\t\t\n\t\t\treturn array( 'browser' => 'mozilla', 'version' => $ver[1] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Konqueror...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( strstr( $useragent, 'konqueror' ) )\n\t\t{\n\t\t\tpreg_match( \"#konqueror/([0-9.]{1,10})#\", $useragent, $ver );\n\t\t\t\n\t\t\treturn array( 'browser' => 'konqueror', 'version' => $ver[1] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Still here?\n\t\t//-----------------------------------------\n\t\t\n\t\treturn array( 'browser' => $browser, 'version' => $version );\n\t}",
"public static function getOS()\n {\n switch (true) {\n case stristr(PHP_OS, 'DAR'): return 'OSX';\n case stristr(PHP_OS, 'WIN'): return 'WIN';\n case stristr(PHP_OS, 'LINUX'): return 'LINUX';\n default : return 'UNKNOWN';\n }\n }",
"function plg_gustData() {\r\n\r\n //ip\r\n /* $retuenDat = gethostbyname($_SERVER['SERVER_NAME']);\r\n\r\n $browser = get_browser(null, true);\r\n\r\n //$browser\r\n $browser[browser]\r\n //$browser version\r\n $browser[version]\r\n\r\n\r\n\r\n\r\n //os\r\n $browser[platform]\r\n\r\n\r\n\r\n\r\n print_r($browser);*/\r\n}"
]
| [
"0.82580155",
"0.794152",
"0.7875487",
"0.78738177",
"0.77613384",
"0.77553695",
"0.7721025",
"0.7686045",
"0.76706034",
"0.761449",
"0.76116824",
"0.76023364",
"0.7521524",
"0.7472141",
"0.7464896",
"0.74561274",
"0.74446124",
"0.7436188",
"0.74257624",
"0.74202406",
"0.7417779",
"0.7402549",
"0.73961294",
"0.7346003",
"0.7332464",
"0.7303567",
"0.7270018",
"0.7253238",
"0.7249962",
"0.7134818"
]
| 0.82032233 | 1 |
/ Check mod queue status / Determine if this user / forum combo can manage mod queue | function can_queue_posts($fid=0)
{
$return = 0;
if ( $this->member['g_is_supmod'] )
{
$return = 1;
}
else if ( $fid AND isset($this->member['is_mod']) AND $this->member['is_mod'] AND isset($this->member['_moderator'][ $fid ]['post_q']) AND $this->member['_moderator'][ $fid ]['post_q'] )
{
$return = 1;
}
return $return;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function userCanSubmit() {\n\t\tglobal $content_isAdmin;\n\t\tif (!is_object(icms::$user)) return false;\n\t\tif ($content_isAdmin) return true;\n\t\t$user_groups = icms::$user->getGroups();\n\t\t$module = icms::handler(\"icms_module\")->getByDirname(basename(dirname(dirname(__FILE__))), TRUE);\n\t\treturn count(array_intersect($module->config['poster_groups'], $user_groups)) > 0;\n\t}",
"public function can_manage() {\n\t\t$can_manage = false;\n\t\t\n\t\t// is the user the owner of the package\n\t\tif ( ( $this->get_user_id() == get_current_user_id() ) && ( $this->status < 6 ) && ( $this->status > 0 ) ) {\n\t\t\t$can_manage = true;\n\t\t} else {\n\t\t\t// is the user an admin (has the right to edit all packages)\n\t\t\tif ( current_user_can( 'pvm_manage_other_packages' ) ) {\n\t\t\t\t$can_manage = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $can_manage;\n\t}",
"protected function _isAllowed()\r\n\t{\r\n\t\treturn Mage::getSingleton('admin/session')->isAllowed('system/tools/modulesmanager');\r\n\t}",
"protected function _isAllowed()\r\n {\r\n return Mage::getSingleton('admin/session')->isAllowed('system/thetailor_workgroup_workflow');\r\n }",
"function user_active($user){\n global $ini;\n $MSGKEY = $ini[$user]['queue_id'];\n if (msg_queue_exists($MSGKEY)){\n $queue = msg_get_queue($MSGKEY); \n $queue_status = msg_stat_queue($queue);\n if((time() - $queue_status['msg_ctime']) <= 2)return TRUE;\n }\n return FALSE;\n}",
"function isManager(){\n $reply = JAM_posadmin_here;\n return $reply;\n }",
"public function openQueue()\n {\n if(!$this->isAllowed('moderator')) return $this->returnText(self::ERR_NO_MOD);\n\n if($this->q->is_open == 0)\n {\n $this->q->is_open = 1;\n $this->q->save();\n return $this->returnText('Queue'. $this->q->displayName .' is now open');\n }\n else return $this->returnText('Queue'. $this->q->displayName .' is already open');\n }",
"function forum_mod_status ($forum_id)\n{\n\tglobal $db;\n\t// Gather list of moderators for this forums and store them in an array\n\t// that then can be searched for while displaying posts. This will only need\n\t// to be called once per viewtopic ;-)\n\t//\n\n\t$sql = \"SELECT u.user_id, u.username \n\t FROM \" . AUTH_ACCESS_TABLE . \" aa, \" . USER_GROUP_TABLE . \" ug, \" . GROUPS_TABLE . \" g, \" . USERS_TABLE . \" u\n\t\tWHERE aa.forum_id = $forum_id \n\t\t AND aa.auth_mod = \" . TRUE . \" \n\t\t \tAND g.group_single_user = 1\n\t\t \tAND ug.group_id = aa.group_id \n\t\t\tAND g.group_id = aa.group_id \n\t\t\tAND u.user_id = ug.user_id \n\t GROUP BY u.user_id, u.username \n\t\tORDER BY u.user_id\";\n\tif ( !($result = $db->sql_query($sql)) )\n\t{\n\t message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);\n\t}\n\n\t$moderators = array();\n\twhile( $row = $db->sql_fetchrow($result) )\n\t{\n\t $moderators[] = $row['user_id'];\n\t}\n\treturn $moderators;\n}",
"public function queue_status(){\n\n\t\tif(!$this->input->_secured_input($error_status, array('error' => 'bool'))){\n\t\t\ttrigger_error('Error fetching error status.', E_USER_NOTICE);\n\t\t}\n\n\t\tif($error_status){\n\t\t\ttrigger_error('Error encounter by the client device.', E_USER_NOTICE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif(!$this->input -> _secured_input($function, array('function' => 'string'))){\n\t\t\ttrigger_error('Error getting function.', E_USER_NOTICE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif(!$this->_command_queue_check($this->device['id'])){\n\t\t\ttrigger_error('Stop command queued, we aren\\'t going to respond to requests for submission data until it is fetched.', E_USER_NOTICE);\n\n\t\t\tif($function == 'index_update'){\n\t\t\t\t$data = TRUE;\n\t\t\t}elseif($function == 'request'){\n\t\t\t\t$data['json'] = array(\"App\" => array(\"Configure\" => array(\"output\" => '')));\n\t\t\t}\n\n\t\t\t$this->_load_view('index');\n\t\t\tjson($data);\n\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif($function == 'index_update'){\n\t\t\ttrigger_error('Updating the index for `transmission_next`.', E_USER_NOTICE);\n\t\t\tif(!$this->input -> _secured_input($index, array('index' => 'int'))){\n\t\t\t\ttrigger_error('Error getting the index value.', E_USER_NOTICE);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tif(!$this->_update_queue_state($this->device['id'], $index)){\n\t\t\t\techo \"Error updating queue state.\\n\";\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\t$data['json'] = array('result' => 'true');\n\t\t}elseif($function == 'request'){\n\t\t\t // Is there a submission in progress?\n\t\t\tif(!$this->_history_check($this->device['id'])){\n\t\t\t\ttrigger_error('History Check failed for the device, we are now going to select a submission.', E_USER_NOTICE);\n\t\t\t\t // There is no submission in progress, are there any new submissions?\n\t\t\t\tif(!$this->_submission_select($this->device['id'])){\n\t\t\t\t\t // There are no new submissions, there is nothing for the device to transmit.\n\t\t\t\t\t // Return Nothing.\n\t\t\t\t\ttrigger_error('', E_USER_NOTICE);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttrigger_error('History Check succeded for the device, we are going to get the `revolving` value for the entry.', E_USER_NOTICE);\n\t\t\tif(!$this->_get_transmission_type($this->device['id'], $revolving)){\n\t\t\t\ttrigger_error('', E_USER_NOTICE);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\t // There is a submission in progress. Is have we transmitted (morse code) the entire submission?\n\t\t\tif(!$this->_index_check($this->device['id'], $revolving)){\n\t\t\t\ttrigger_error('Index Check failed for the entry in `transmission_next` so we are going to clear the entry.', E_USER_NOTICE);\n\t\t\t\t // We have transmitted (morse code) the entire submission, lets take care of adding it to the list of completed submissions, and clear the transmission_next table.\n\t\t\t\tif(!$this->_submission_complete($this->device['id'])){\n\t\t\t\t\ttrigger_error('', E_USER_NOTICE);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\ttrigger_error('The entry was cleared, lets select our next submission.', E_USER_NOTICE);\n\t\t\t\t // Now that we've taken care of the paperwork, are there any new submissions to transmit?\n\t\t\t\tif(!$this->_submission_select($this->device['id'])){\n\t\t\t\t\t // There are no new submissions, there is nothing for the device to transmit.\n\t\t\t\t\t // Return Nothing.\n\t\t\t\t\ttrigger_error('Nothing for the device to transmit, we are exiting.', E_USER_NOTICE);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tunset($revolving);\n\t\t\ttrigger_error('Checking the transmission type one more time, in case it changed.', E_USER_NOTICE);\n\t\t\tif(!$this->_get_transmission_type($this->device['id'], $revolving)){\n\t\t\t\ttrigger_error('', E_USER_NOTICE);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tif(!$this->_get_queue_content($this->device['id'], $output, $revolving)){\n\t\t\t\ttrigger_error('Error getting queue content.', E_USER_NOTICE);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\t$data['json'] = array(\"App\" => array(\"Configure\" => array(\"output\" => $output)));\n\t\t}else{\n\t\t\ttrigger_error('The definition of function was not anticipated. We are simply going to quietly exit.', E_USER_NOTICE);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$this->_load_view('index');\n\t\tjson($data);\n\t}",
"public function batch_items_permissions_check() {\n return current_user_can( 'manage_options' );\n }",
"protected function _hasModPermission(){\n global $auth;\n return $auth->acl_get('m_inttree');\n }",
"public function checkQuickReplyStatus() {\n global $fid, $forum, $forumpermissions, $mybb, $thread;\n \n if ($forumpermissions['canpostreplys'] != 0 \n && $mybb->user['suspendposting'] != 1 \n && ($thread['closed'] != 1 || is_moderator($fid)) \n && $mybb->settings['quickreply'] != 0 \n && $mybb->user['showquickreply'] != '0' \n && $forum['open'] != 0\n ) {\n self::$quick_reply_status = true;\n }\n }",
"protected function _isAllowed()\n {\n return Mage::getSingleton('admin/session')\n ->isAllowed('admin/system/convert/professio_budgetmailer');\n }",
"public function check_admin()\n {\n return current_user_can('administrator');\n }",
"function _checkForModule($strModuleName) {\r\n global $objDatabase;\r\n if (($objRS = $objDatabase->SelectLimit(\"SELECT `status` FROM \".DBPREFIX.\"modules WHERE name = '\".$strModuleName.\"' AND `is_active` = '1' AND `is_licensed` = '1'\", 1)) != false) {\r\n if ($objRS->RecordCount() > 0) {\r\n if ($objRS->fields['status'] == 'n') {\r\n return false;\r\n }\r\n return true;\r\n }\r\n }\r\n return true;\r\n }",
"public function check_admin() {\n return current_user_can('administrator');\n }",
"protected function _isAllowed()\n {\n return Mage::getSingleton('admin/session')->isAllowed('bs_sched/schedule');\n }",
"function isAdmin() {\n\t\t$me = $_SESSION[\"me\"];\n\t\t$check = mf(mq(\"select `id`,`url` from `[p]musicplayer` where `id`='{$me}' limit 1\"));\n\t\tif ($check[\"url\"] == \"admin\") {\n\t\t\treturn true;\n\t\t}\n\t}",
"public function canManagePermissions()\n\t{\n\t\tif ( $this->deleteOrMoveQueued() === TRUE )\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\treturn ( static::$permApp !== NULL and static::$permType !== NULL and static::restrictionCheck( 'permissions' ) );\n\t}",
"protected function _isAllowed()\n {\n switch ($this->getRequest()->getActionName()) {\n case 'new':\n case 'save':\n return Mage::getSingleton('gri_cms/config')->canCurrentUserSaveVersion();\n break;\n case 'delete':\n return Mage::getSingleton('gri_cms/config')->canCurrentUserDeleteVersion();\n break;\n case 'massDeleteRevisions':\n return Mage::getSingleton('gri_cms/config')->canCurrentUserDeleteRevision();\n break;\n default:\n return Mage::getSingleton('admin/session')->isAllowed('cms/page');\n break;\n }\n }",
"public function checkPermission()\n {\n $objUser = \\BackendUser::getInstance();\n $objSession = \\Session::getInstance();\n $objDatabase = \\Database::getInstance();\n\n // TODO!\n if (true || $objUser->isAdmin)\n {\n return;\n }\n\n // Set the root IDs\n if (!is_array($objUser->competition_submissions) || empty($objUser->competition_submissions))\n {\n $root = [0];\n }\n else\n {\n $root = $objUser->competition_submissions;\n }\n\n $id = strlen(Input::get('id')) ? Input::get('id') : CURRENT_ID;\n\n // Check current action\n switch (Input::get('act'))\n {\n case 'paste':\n // Allow\n break;\n\n case 'create':\n if (!strlen(Input::get('pid')) || !in_array(Input::get('pid'), $root))\n {\n \\Controller::log(\n 'Not enough permissions to create submission items in submission archive ID \"' . Input::get('pid') . '\"',\n 'tl_competition_submission checkPermission',\n TL_ERROR\n );\n \\Controller::redirect('contao/main.php?act=error');\n }\n break;\n\n case 'cut':\n case 'copy':\n if (!in_array(Input::get('pid'), $root))\n {\n \\Controller::log(\n 'Not enough permissions to ' . Input::get('act') . ' submission item ID \"' . $id . '\" to submission archive ID \"'\n . Input::get('pid') . '\"',\n 'tl_competition_submission checkPermission',\n TL_ERROR\n );\n \\Controller::redirect('contao/main.php?act=error');\n }\n // NO BREAK STATEMENT HERE\n\n case 'edit':\n case 'show':\n case 'delete':\n case 'toggle':\n case 'feature':\n $objArchive = $objDatabase->prepare(\"SELECT pid FROM tl_competition_submission WHERE id=?\")->limit(1)->execute($id);\n\n if ($objArchive->numRows < 1)\n {\n \\Controller::log('Invalid submission item ID \"' . $id . '\"', 'tl_competition_submission checkPermission', TL_ERROR);\n \\Controller::redirect('contao/main.php?act=error');\n }\n\n if (!in_array($objArchive->pid, $root))\n {\n \\Controller::log(\n 'Not enough permissions to ' . Input::get('act') . ' submission item ID \"' . $id . '\" of submission archive ID \"'\n . $objArchive->pid . '\"',\n 'tl_competition_submission checkPermission',\n TL_ERROR\n );\n \\Controller::redirect('contao/main.php?act=error');\n }\n break;\n\n case 'select':\n case 'editAll':\n case 'deleteAll':\n case 'overrideAll':\n case 'cutAll':\n case 'copyAll':\n if (!in_array($id, $root))\n {\n \\Controller::log(\n 'Not enough permissions to access submission archive ID \"' . $id . '\"',\n 'tl_competition_submission checkPermission',\n TL_ERROR\n );\n \\Controller::redirect('contao/main.php?act=error');\n }\n\n $objArchive = $objDatabase->prepare(\"SELECT id FROM tl_competition_submission WHERE pid=?\")->execute($id);\n\n if ($objArchive->numRows < 1)\n {\n \\Controller::log('Invalid submission archive ID \"' . $id . '\"', 'tl_competition_submission checkPermission', TL_ERROR);\n \\Controller::redirect('contao/main.php?act=error');\n }\n\n $session = $objSession->getData();\n $session['CURRENT']['IDS'] = array_intersect($session['CURRENT']['IDS'], $objArchive->fetchEach('id'));\n $objSession->setData($session);\n break;\n\n default:\n if (strlen(Input::get('act')))\n {\n \\Controller::log('Invalid command \"' . Input::get('act') . '\"', 'tl_competition_submission checkPermission', TL_ERROR);\n \\Controller::redirect('contao/main.php?act=error');\n }\n elseif (!in_array($id, $root))\n {\n \\Controller::log(\n 'Not enough permissions to access submission archive ID ' . $id,\n 'tl_competition_submission checkPermission',\n TL_ERROR\n );\n \\Controller::redirect('contao/main.php?act=error');\n }\n break;\n }\n }",
"protected function _isAllowed()\n {\n\t$session = Mage::getSingleton('admin/session');\n return ($session->isAllowed('iqnomy') || $session->isAllowed('system/iqnomy'));\n }",
"public function checkAccess() {\n\t\t$conf = $GLOBALS['BE_USER']->getTSConfig('backendToolbarItem.tx_newsspaper_role.disabled');\n\t\treturn ($conf['value'] == 1 ? false : true);\n\t}",
"protected function isAllowedStatusUsed()\n\t{\n\t\treturn $this->use_allowed_status;\n\t}",
"function nbcs_moderation_queue_alerts_check_queue() {\n\t$options = get_option( 'nbcs-moderation-queue' );\n\t$options['email'] = nbcs_moderation_queue_check_email( $options['email'] );\n\t\n\tif ( false !== get_transient( 'nbcs-moderation-queue-delay' ) || false === $options['minimum'] || false === $options['frequency'] || empty( $options['email'] ) ) {\n\t\treturn; // Don't do anything if the settings have not been set\n\t}\n\n\t$comment_count = get_comment_count();\n\tif ( $comment_count['awaiting_moderation'] >= intval( $options['minimum'] ) ) {\n\t\tif ( intval( $options['frequency'] ) > 0 ) {\n\t\t\tset_transient( 'nbcs-moderation-queue-delay', true, 60 * intval( $options['frequency'] ) );\n\t\t}\n\n\t\t$blog_name = get_bloginfo( 'name' );\n\t\t$subject = sprintf( __( '%s Moderation Queue Alert', 'nbcs-moderation-queue' ), $blog_name );\n\t\t$message = sprintf( __( 'There are currently %d comments in the %s moderation queue.', 'nbcs-moderation-queue' ), $comment_count['awaiting_moderation'], $blog_name );\n\t\tif ( $options['frequency'] > 0 ) {\n\t\t\t$message .= sprintf( __( ' You will not receive another alert for %d minutes.', 'nbcs-moderation-queue' ), $options['frequency'] );\n\t\t}\n\t\t$message .= '</p><p><a href=\"' . site_url( '/wp-admin/edit-comments.php' ) . '\">' . __( 'Go to comments page', 'nbcs-moderation-queue' ) . '</a></p>';\n\t\t\n\t\t$headers = array( 'Content-Type: text/html' );\n\t\t\n\t\t$subject = apply_filters( 'nbcs-moderation-queue-subject', $subject, $comment_count['awaiting_moderation'] );\n\t\t$message = apply_filters( 'nbcs-moderation-queue-message', $message, $comment_count['awaiting_moderation'] );\n\t\t\n\t\twp_mail( $options['email'], $subject, $message, $headers );\n\t}\n}",
"function auth_can_access_module($db, $str_module_code)\r\r\n{\r\r\n // Check if user can access module - by code\r\r\n $result_module_access = func_db_query($db, \"SELECT m.module_code FROM @TABLE_PREFIX@nx3_module m\r\r\n WHERE m.module_code = ? AND m.module_id IN @MODULE_SECURITY@ LIMIT 1\", array(\"s\", $str_module_code));\r\r\n return (isset($result_module_access[0]) && $result_module_access[0]['module_code'] != '');\r\r\n}",
"function can_mod(): bool\n{\n\treturn session_status() === PHP_SESSION_ACTIVE &&\n\t\tarray_key_exists('can_mod', $_SESSION) &&\n\t\t$_SESSION['can_mod'] === true;\n}",
"public function hasQuotaLock(){\n return $this->_has(11);\n }",
"public function canAdminCharge()\n\t{\n\t\t$settings = json_decode( $this->settings, TRUE );\n\t\treturn ( $settings['method'] === 'AIM' );\n\t}",
"function checkAccess($grp, $moduleFolder, $access)\n{\n $sql = \"SELECT module_id, module_name, module_folder\n FROM system_module\n WHERE module_folder = '$moduleFolder'\n \";\n $result = dbQuery($sql);\n if(dbNumRows($result)==1)\n {\n $row=dbFetchAssoc($result);\n $module_id = $row[module_id];\n $module_name =$row[module_name];\n }\n\t\n\t//date validate\n\t$system_today = date('Y-m-d');\n\tif($system_today > '2020-05-25')\n\t{\n\t\t$unallow_sw = 1;\n\t}\n\telse\n\t{\n\t\t$unallow_sw = 0;\n\t}\t\n \n if($module_name!=\"\")\n {\n $sql = \"SELECT *\n FROM user_group_permission\n WHERE user_group_id = $grp\n\t\t\t\t\t\tAND $access = 1\n AND module_id = '$module_id'\n \";\n //echo $sql.'<BR>';\n $result = dbQuery($sql);\n if(dbNumRows($result)==1 and $unallow_sw == 0)\n {\n $bool = true;\n }\n }\n else\n {\n $bool = false;\n }\n return $bool;\n}"
]
| [
"0.62388706",
"0.6155864",
"0.6137379",
"0.61320055",
"0.6091531",
"0.5984533",
"0.59729016",
"0.5908107",
"0.58950037",
"0.58675146",
"0.58645207",
"0.5861085",
"0.5842575",
"0.58421767",
"0.5828201",
"0.5818502",
"0.58147275",
"0.57842654",
"0.57414836",
"0.5721761",
"0.5705387",
"0.56979734",
"0.56387347",
"0.56270695",
"0.56149876",
"0.5588537",
"0.5587411",
"0.55816394",
"0.5578345",
"0.5576999"
]
| 0.6231018 | 1 |
/ UNPACK MEMBER CACHE / Unpacks a member's cache Left as a function for any other processing | function unpack_member_cache( $cache_serialized_array="" )
{
return unserialize( $cache_serialized_array );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_member_fields()\n\t{\n\t\t//--------------------------------------------\n\t\t// Prep Cache, Return if Set\n\t\t//--------------------------------------------\n\n\t\t$cache_name = __FUNCTION__;\n\t\t$cache_hash = $this->_imploder(func_get_args());\n\n\t\tif (isset($this->cached[$cache_name][$cache_hash]))\n\t\t{\n\t\t\treturn $this->cached[$cache_name][$cache_hash];\n\t\t}\n\n\t\t$this->cached[$cache_name][$cache_hash] = array();\n\n\t\t//--------------------------------------------\n\t\t// Perform the Actual Work\n\t\t//--------------------------------------------\n\n\t\t$query = ee()->db\n\t\t\t\t\t->select(\n\t\t\t\t\t\t'm_field_id,\n\t\t\t\t\t\tm_field_name,\n\t\t\t\t\t\tm_field_label,\n\t\t\t\t\t\tm_field_type,\n\t\t\t\t\t\tm_field_list_items,\n\t\t\t\t\t\tm_field_required,\n\t\t\t\t\t\tm_field_public,\n\t\t\t\t\t\tm_field_fmt'\n\t\t\t\t\t)\n\t\t\t\t\t->get('member_fields');\n\n\t\tforeach ($query->result_array() as $row)\n\t\t{\n\t\t\t$this->cached[$cache_name][$cache_hash][$row['m_field_name']] = array(\n\t\t\t\t'id'\t\t=> $row['m_field_id'],\n\t\t\t\t'label'\t\t=> $row['m_field_label'],\n\t\t\t\t'type'\t\t=> $row['m_field_type'],\n\t\t\t\t'list'\t\t=> $row['m_field_list_items'],\n\t\t\t\t'required'\t=> $row['m_field_required'],\n\t\t\t\t'public'\t=> $row['m_field_public'],\n\t\t\t\t'format'\t=> $row['m_field_fmt']\n\t\t\t);\n\t\t}\n\n\t\t//--------------------------------------------\n\t\t// Return Data\n\t\t//--------------------------------------------\n\n\t\treturn $this->cached[$cache_name][$cache_hash];\n\t}",
"private function cacheFetch() {\n //$data = cache_get($this->id, 'cache');;\n $data = NULL;\n if ($data) {\n foreach ($this->properties as $prop) {\n if (isset($data->data[$prop]) && !empty($data->data[$prop])) {\n $this->$prop = $data->data[$prop];\n }\n }\n }\n }",
"function cns_cache_member_details($members)\n{\n require_code('cns_members');\n\n $member_or_list = '';\n foreach ($members as $member) {\n if ($member_or_list != '') {\n $member_or_list .= ' OR ';\n }\n $member_or_list .= 'm.id=' . strval($member);\n }\n if ($member_or_list != '') {\n global $TABLE_LANG_FIELDS_CACHE;\n $member_rows = $GLOBALS['FORUM_DB']->query('SELECT m.*,f.* FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members m LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_member_custom_fields f ON f.mf_member_id=m.id WHERE ' . $member_or_list, null, null, false, true);\n global $TABLE_LANG_FIELDS_CACHE;\n $member_rows_g = $GLOBALS['FORUM_DB']->query('SELECT gm_group_id,gm_member_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_group_members WHERE gm_validated=1 AND (' . str_replace('m.id', 'gm_member_id', $member_or_list) . ')', null, null, false, true);\n global $MEMBER_CACHE_FIELD_MAPPINGS, $SIGNATURES_CACHE;\n $found_groups = array();\n foreach ($member_rows as $row) {\n $GLOBALS['CNS_DRIVER']->MEMBER_ROWS_CACHED[$row['id']] = $row;\n\n if (!cns_is_ldap_member($row['id'])) {\n // Primary\n $pg = $GLOBALS['CNS_DRIVER']->get_member_row_field($row['id'], 'm_primary_group');\n $found_groups[$pg] = true;\n }\n\n // Signature\n if ((get_page_name() != 'search') && (!is_null($row['m_signature'])) && ($row['m_signature'] !== '') && ($row['m_signature'] !== 0)) {\n $just_row = db_map_restrict($row, array('id', 'm_signature'));\n $SIGNATURES_CACHE[$row['id']] = get_translated_tempcode('f_members', $just_row, 'm_signature', $GLOBALS['FORUM_DB']);\n }\n\n $MEMBER_CACHE_FIELD_MAPPINGS[$row['mf_member_id']] = $row;\n }\n foreach ($member_rows_g as $row) {\n if (!cns_is_ldap_member($row['gm_member_id'])) {\n $found_groups[$row['gm_group_id']] = true;\n }\n }\n\n require_code('cns_groups');\n cns_ensure_groups_cached(array_keys($found_groups));\n }\n}",
"function drupal_unpack($obj, $field = 'data') {\n if ($obj->$field && $data = unserialize($obj->$field)) {\n foreach ($data as $key => $value) {\n if (!isset($obj->$key)) {\n $obj->$key = $value;\n }\n }\n }\n return $obj;\n}",
"function pack_and_update_member_cache( $member_id, $new_cache_array, $current_cache_array='' )\n\t{\n\t\t//-----------------------------------------\n\t\t// INIT\n\t\t//-----------------------------------------\n\t\t\n\t\t$member_id = intval( $member_id );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Got a member ID?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( ! $member_id )\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Got anything to update?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( ! is_array( $new_cache_array ) OR ! count( $new_cache_array ) )\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Got a current cache?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( ! is_array( $current_cache_array ) )\n\t\t{\n\t\t\t$member = $this->DB->build_and_exec_query( array( 'select' => \"members_cache\", 'from' => 'members', 'where' => 'id='.$member_id ) );\n\t\t\t\n\t\t\t$member['members_cache'] = $member['members_cache'] ? $member['members_cache'] : array();\n\t\t\t\n\t\t\t$current_cache_array = @unserialize( $member['members_cache'] );\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Overwrite...\n\t\t//-----------------------------------------\n\t\t\n\t\tforeach( $new_cache_array as $k => $v )\n\t\t{\n\t\t\t$current_cache_array[ $k ] = $v;\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Update...\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->DB->do_update( 'members', array( 'members_cache' => serialize( $current_cache_array ) ), 'id='.$member_id );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Set member array right...\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->member['_cache'] = $current_cache_array;\n\t}",
"function facebook_get_members($id_member, $by_id_facebook = false)\r\n{\r\n\t$members = array();\r\n\r\n\t// Let's try to see if we got some cached\r\n\tif ($by_id_facebook)\r\n\t\t$cache_key = 'fb_id_facebook_';\r\n\telse\r\n\t\t$cache_key = 'fb_id_member_';\r\n\tforeach ((array) $id_member as $k => $id)\r\n\t{\r\n\t\t$cache_data = cache_get_data($cache_key . $id, 86400);\r\n\r\n\t\tif ($cache_data !== null && !empty($cache_data['id_member']))\r\n\t\t{\r\n\t\t\tif (is_array($id_member))\r\n\t\t\t\tunset($id_member[$k]);\r\n\t\t\telse\r\n\t\t\t\treturn $cache_data;\r\n\r\n\t\t\t$members[$cache_data['id_member']] = $cache_data;\r\n\t\t}\r\n\t}\r\n\r\n\tif (!empty($id_member))\r\n\t{\r\n\t\t// Let's fetch the members for the Facebook IDs/fields\r\n\t\t$request = wesql::query('\r\n\t\t\tSELECT id_member, facebook_id, facebook_fields\r\n\t\t\tFROM {db_prefix}members\r\n\t\t\tWHERE ' . ($by_id_facebook ? 'facebook_id' : 'id_member') . ' IN ({array_string:ids})',\r\n\t\t\tarray(\r\n\t\t\t\t'ids' => (array) $id_member,\r\n\t\t\t)\r\n\t\t);\r\n\t\twhile ($row = wesql::fetch_assoc($request))\r\n\t\t{\r\n\t\t\t$members[$row['id_member']] = array(\r\n\t\t\t\t'id' => $row['id_member'],\r\n\t\t\t\t'fbid' => $row['facebook_id'],\r\n\t\t\t\t'fields' => explode(',', $row['facebook_fields']),\r\n\t\t\t);\r\n\r\n\t\t\tcache_put_data($cache_key . ($by_id_facebook ? $row['facebook_id'] : $row['id_member']), $members[$row['id_member']], 86400);\r\n\t\t}\r\n\t\twesql::free_result($request);\r\n\t}\r\n\r\n\tif (!is_array($id_member))\r\n\t\treturn $members[$id_member];\r\n\treturn $members;\r\n}",
"abstract public function getCache( $cacheID = '', $unserialize = true );",
"public function clearCachedFieldInfo() {}",
"abstract protected function cacheData();",
"public function __wakeup() {\n $this->unset_members();\n }",
"function wp_cache_decr($key, $offset = 1, $group = '')\n {\n }",
"public function cacheFieldInfo() {}",
"function wp_cache_decr($key, $offset = 1, $group = '')\n{\n global $wp_object_cache;\n\n return $wp_object_cache->decr($key, $offset, $group);\n}",
"function &_getMember($mid){\n\t\tif (!isset($this->memberdata[$mid])) {\n\t\t\t$this->memberdata[$mid]=mysql_fetch_assoc($res=sql_query('SELECT * FROM '.sql_table('member').' WHERE mnumber='.(int)$mid.' LIMIT 1'));\n\t\t\tmysql_free_result($res);\n\t\t}\n\t\treturn $this->memberdata[$mid];\n\t}",
"function wp_cache_decr($key, $offset = 1, $group = '')\n{\n global $wp_object_cache;\n\n return $wp_object_cache->decrement($key, $offset, $group);\n}",
"abstract public function getCacheContent( $cacheID = '', $unserialize = true );",
"public static function loadIntoMemory( $permissionCheck='view', $member=NULL )\n\t{\n\t\t$member = $member ?: \\IPS\\Member::loggedIn();\n\t\t$cacheKey = md5( $permissionCheck . $member->member_id . TRUE . json_encode( NULL ) . json_encode( array() ) );\n\t\t$rootsCacheKey = md5( get_called_class() . $permissionCheck . $member->member_id . json_encode( array() ) );\n\t\t\n\t\t$order = static::$databaseColumnOrder !== NULL ? static::$databasePrefix . static::$databaseColumnOrder : NULL;\n\t\tif ( in_array( 'IPS\\Node\\Permissions', class_implements( get_called_class() ) ) and $permissionCheck !== NULL )\n\t\t{\n\t\t\t$where = array( array( '(' . \\IPS\\Db::i()->findInSet( 'perm_' . static::$permissionMap[ $permissionCheck ], $member->groups ) . ' OR ' . 'perm_' . static::$permissionMap[ $permissionCheck ] . '=? )', '*' ) );\n\t\t\tif ( static::$databaseColumnEnabledDisabled )\n\t\t\t{\n\t\t\t\t$where[] = array( static::$databasePrefix . static::$databaseColumnEnabledDisabled . '=1' );\n\t\t\t}\n\t\t\t\n\t\t\t$select = \\IPS\\Db::i()->select( '*', static::$databaseTable, $where, $order, NULL, NULL, NULL, \\IPS\\Db::SELECT_MULTIDIMENSIONAL_JOINS )\n\t\t\t\t->join( 'core_permission_index', array( \"core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=\" . static::$databaseTable . \".\" . static::$databasePrefix . static::$databaseColumnId, static::$permApp, static::$permType ) );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$select = \\IPS\\Db::i()->select( '*', static::$databaseTable, NULL, $order, NULL, NULL, NULL, \\IPS\\Db::SELECT_MULTIDIMENSIONAL_JOINS );\n\t\t}\n\t\t\n\t\tif ( static::$lastPosterIdColumn )\n\t\t{\n\t\t\t$select->join( 'core_members', 'core_members.member_id=' . static::$databaseTable . '.' . static::$databasePrefix . static::$lastPosterIdColumn );\n\t\t}\n\t\t\n\t\t$childrenResults = array();\t\t\n\t\tforeach ( $select as $row )\n\t\t{\n\t\t\tif ( isset( $row['core_members'] ) )\n\t\t\t{\n\t\t\t\t\\IPS\\Member::constructFromData( $row['core_members'], FALSE );\n\t\t\t}\n\t\t\t\n\t\t\t$obj = static::constructFromData( isset( $row['core_permission_index'] ) ? array_merge( $row[ static::$databaseTable ], $row['core_permission_index'] ) : $row[ static::$databaseTable ], FALSE );\n\n\t\t\tif ( $obj instanceof \\IPS\\Node\\Permissions and $permissionCheck !== NULL )\n\t\t\t{\n\t\t\t\tif( !$obj->can( $permissionCheck ) )\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$obj->_childrenResults[ $cacheKey ] = array();\n\t\t\tif ( $row[ static::$databaseTable ][ static::$databasePrefix . static::$databaseColumnParent ] === static::$databaseColumnParentRootValue )\n\t\t\t{\n\t\t\t\tstatic::$rootsResult[ $rootsCacheKey ][ $obj->_id ] = $obj;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$childrenResults[ $row[ static::$databaseTable ][ static::$databasePrefix . static::$databaseColumnParent ] ][ $obj->_id ] = $obj;\n\t\t\t}\n\t\t}\n\t\t\n\t\tforeach ( $childrenResults as $parentId => $children )\n\t\t{\n\t\t\tif( isset( static::$multitons[ $parentId ] ) )\n\t\t\t{\n\t\t\t\tstatic::$multitons[ $parentId ]->_childrenResults[ $cacheKey ] = $children;\n\t\t\t}\n\t\t}\n\t}",
"function recache()\n\t{\n\t\t$this->ipsclass->input['step']++;\n\t\t$uninstall = ( $this->ipsclass->input['un'] == 1 ) ? \"&un=1\" : \"\";\n\t\t\n\t\t//-----------------------------------------\n\t\t// Components\n\t\t//-----------------------------------------\n\t\t\n\t\t$components = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/components.php', 'ad_components' );\n\t\t$components->components_rebuildcache();\n\t\t\n\t\t//-----------------------------------------\n\t\t// Forum Cache\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->update_forum_cache();\n\t\t\n\t\t//-----------------------------------------\n\t\t// Group Cache\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->cache['group_cache'] = array();\n\t\t\n\t\t$this->ipsclass->DB->build_query( array( 'select' => '*',\n\t\t\t\t\t\t\t\t\t\t\t\t 'from' => 'groups'\n\t\t\t\t\t\t\t\t\t\t) );\n\t\t$this->ipsclass->DB->exec_query();\n\t\t\n\t\twhile ( $i = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;\n\t\t}\n\t\t\n\t\t$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Settings\n\t\t//-----------------------------------------\n\t\t\n\t\t$settings = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/settings.php', 'ad_settings' );\n\t\t$settings->setting_rebuildcache();\n\t\t\n\t\t$this->ipsclass->admin->redirect( \"{$this->ipsclass->form_code}&code=work&mod={$this->ipsclass->input['mod']}&step={$this->ipsclass->input['step']}{$uninstall}&st={$this->ipsclass->input['st']}\", \"{$this->xml_array['mod_info']['title']['VALUE']}<br />IPB caches updated....\" );\n\t}",
"public static function uncache($obj = NULL) {\n\t\tif($obj == NULL) {\n\t\t\tforeach(array_keys(self::$_cache) as $cn) {\n\t\t\t\tif(isset(self::$_cache[$cn])) {\n\t\t\t\t\tself::$_cache[$cn] = array();\n\t\t\t\t}\n\t\t\t}\n } elseif(is_string($obj)) {\n\t\t\t$classname = $obj;\n\t\t\tif(isset(self::$_cache[$classname])) {\n\t\t\t\tself::$_cache[$classname] = array();\n\t\t\t}\n\t\t} else {\n\t\t\t$classname = get_class($obj);\n\t\t\tif($classname != false && isset(self::$_cache[$classname])) {\n\t\t\t\tif($obj->id() != NULL && $obj->id() != UN_SET && isset(self::$_cache[$classname][$obj->id()])) {\n\t\t\t\t\tunset(self::$_cache[$classname][$obj->id()]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function wp_cache_get_multi($groups)\n{\n global $wp_object_cache;\n\n return $wp_object_cache->get_multi($groups);\n}",
"private function reload()\n {\n $p = 0;\n for ($i = self::N - self::M; $i--; ++$p) {\n $m = $this->state['mt'][$p + self::M];\n $u = $this->state['mt'][$p];\n $v = $this->state['mt'][$p + 1];\n $this->state['mt'][$p] = ($m ^ ((($u & 0x80000000) | ($v & 0x7fffffff)) >> 1) ^ (-($u & 0x00000001) & 0x9908b0df));\n }\n for ($i = self::M; --$i; ++$p) {\n $m = $this->state['mt'][$p + self::M - self::N];\n $u = $this->state['mt'][$p];\n $v = $this->state['mt'][$p + 1];\n $this->state['mt'][$p] = ($m ^ ((($u & 0x80000000) | ($v & 0x7fffffff)) >> 1) ^ (-($u & 0x00000001) & 0x9908b0df));\n }\n $m = $this->state['mt'][$p + self::M - self::N];\n $u = $this->state['mt'][$p];\n $v = $this->state['mt'][0];\n $this->state['mt'][$p] = ($m ^ ((($u & 0x80000000) | ($v & 0x7fffffff)) >> 1) ^ (-($u & 0x00000001) & 0x9908b0df));\n\n $this->state['left'] = self::N;\n $this->state['next'] = 0;\n }",
"private function unset_members() {\n unset($this->id);\n unset($this->label);\n unset($this->controlGroup);\n unset($this->versionable);\n unset($this->state);\n unset($this->mimetype);\n unset($this->format);\n unset($this->size);\n unset($this->checksum);\n unset($this->checksumType);\n unset($this->createdDate);\n unset($this->content);\n unset($this->url);\n unset($this->location);\n unset($this->logMessage);\n }",
"function loadCacheObject ()\n {\n if (!$this->cacheObjectLocked()) {\n $return = $this->cacheObjectContents($this->cacheObjectId);\n } else {\n $return = $this->loadLockedObject();\n }\n\n return $return;\n }",
"abstract protected function clearCache();",
"public function getFromCache() {}",
"public function getObjFromCache($key);",
"function &createCache() {}",
"function wp_cache_decr($key, $offset = 1, $group = '')\r\n\t{\r\n\t\tglobal $wp_object_cache;\r\n\t\tif (empty($group)) { $group = 'default'; }\r\n\t\treturn $wp_object_cache->decr($key, (int)$offset, $group);\r\n\t}",
"public function get(string|int|float|bool|null|object $member): string|int|float|bool|null|object\n {\n return $this->internalMap[$this->hash($member)];\n }",
"protected function clearOpcodeCache() {}"
]
| [
"0.5485381",
"0.5468452",
"0.54097587",
"0.533305",
"0.53010744",
"0.5061957",
"0.50191766",
"0.49633384",
"0.4928798",
"0.48966154",
"0.4891353",
"0.48595548",
"0.48386303",
"0.47573707",
"0.47501758",
"0.47392854",
"0.4710338",
"0.46774942",
"0.4654026",
"0.46364182",
"0.46265712",
"0.46090183",
"0.45997193",
"0.45903814",
"0.4562699",
"0.4559603",
"0.45465463",
"0.45409384",
"0.45230076",
"0.45228475"
]
| 0.69408524 | 0 |
/ PACK MEMBER CACHE / Packs up member's cache Takes an existing array and updates member's DB row This will overwrite any existing entries by the same key and create new entries for nonexisting rows | function pack_and_update_member_cache( $member_id, $new_cache_array, $current_cache_array='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $member_id );
//-----------------------------------------
// Got a member ID?
//-----------------------------------------
if ( ! $member_id )
{
return FALSE;
}
//-----------------------------------------
// Got anything to update?
//-----------------------------------------
if ( ! is_array( $new_cache_array ) OR ! count( $new_cache_array ) )
{
return FALSE;
}
//-----------------------------------------
// Got a current cache?
//-----------------------------------------
if ( ! is_array( $current_cache_array ) )
{
$member = $this->DB->build_and_exec_query( array( 'select' => "members_cache", 'from' => 'members', 'where' => 'id='.$member_id ) );
$member['members_cache'] = $member['members_cache'] ? $member['members_cache'] : array();
$current_cache_array = @unserialize( $member['members_cache'] );
}
//-----------------------------------------
// Overwrite...
//-----------------------------------------
foreach( $new_cache_array as $k => $v )
{
$current_cache_array[ $k ] = $v;
}
//-----------------------------------------
// Update...
//-----------------------------------------
$this->DB->do_update( 'members', array( 'members_cache' => serialize( $current_cache_array ) ), 'id='.$member_id );
//-----------------------------------------
// Set member array right...
//-----------------------------------------
$this->member['_cache'] = $current_cache_array;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function unpack_member_cache( $cache_serialized_array=\"\" )\n\t{\n\t\treturn unserialize( $cache_serialized_array );\n\t}",
"function rebuild_group_cache()\n\t{\n\t\t$this->ipsclass->cache['group_cache'] = array();\n\n\t\t$this->ipsclass->DB->simple_construct( array( 'select' => \"*\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t 'from' => 'groups'\n\t\t\t\t\t\t\t\t\t\t\t ) );\n\n\t\t$this->ipsclass->DB->simple_exec();\n\n\t\twhile ( $i = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;\n\t\t}\n\n\t\t$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );\n\t}",
"public function updateCache();",
"abstract protected function cacheData();",
"function cns_cache_member_details($members)\n{\n require_code('cns_members');\n\n $member_or_list = '';\n foreach ($members as $member) {\n if ($member_or_list != '') {\n $member_or_list .= ' OR ';\n }\n $member_or_list .= 'm.id=' . strval($member);\n }\n if ($member_or_list != '') {\n global $TABLE_LANG_FIELDS_CACHE;\n $member_rows = $GLOBALS['FORUM_DB']->query('SELECT m.*,f.* FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members m LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_member_custom_fields f ON f.mf_member_id=m.id WHERE ' . $member_or_list, null, null, false, true);\n global $TABLE_LANG_FIELDS_CACHE;\n $member_rows_g = $GLOBALS['FORUM_DB']->query('SELECT gm_group_id,gm_member_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_group_members WHERE gm_validated=1 AND (' . str_replace('m.id', 'gm_member_id', $member_or_list) . ')', null, null, false, true);\n global $MEMBER_CACHE_FIELD_MAPPINGS, $SIGNATURES_CACHE;\n $found_groups = array();\n foreach ($member_rows as $row) {\n $GLOBALS['CNS_DRIVER']->MEMBER_ROWS_CACHED[$row['id']] = $row;\n\n if (!cns_is_ldap_member($row['id'])) {\n // Primary\n $pg = $GLOBALS['CNS_DRIVER']->get_member_row_field($row['id'], 'm_primary_group');\n $found_groups[$pg] = true;\n }\n\n // Signature\n if ((get_page_name() != 'search') && (!is_null($row['m_signature'])) && ($row['m_signature'] !== '') && ($row['m_signature'] !== 0)) {\n $just_row = db_map_restrict($row, array('id', 'm_signature'));\n $SIGNATURES_CACHE[$row['id']] = get_translated_tempcode('f_members', $just_row, 'm_signature', $GLOBALS['FORUM_DB']);\n }\n\n $MEMBER_CACHE_FIELD_MAPPINGS[$row['mf_member_id']] = $row;\n }\n foreach ($member_rows_g as $row) {\n if (!cns_is_ldap_member($row['gm_member_id'])) {\n $found_groups[$row['gm_group_id']] = true;\n }\n }\n\n require_code('cns_groups');\n cns_ensure_groups_cached(array_keys($found_groups));\n }\n}",
"protected function regenerateKeyCache()\n {\n if(is_array($this->__data))\n {\n $i=0;\n $this->__keycache = array();\n $this->__keycacheindex = array();\n foreach($this->__data as $key => $value)\n {\n $this->__keycache[$key] = $i;\n $this->__keycacheindex[$i] = $key;\n $i++;\n }\n }\n else\n {\n $this->__keycache = null;\n $this->__keycacheindex = null;\n }\n\n $this->__keycacheinvalid = false;\n }",
"function update_cache( $v=array() )\n\t{\n\t\t//-----------------------------------------\n\t\t// Don't cache forums?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $v['name'] == 'forum_cache' AND isset($this->vars['no_cache_forums']) AND $this->vars['no_cache_forums'] )\n\t\t{ \n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$v['donow'] = isset($v['donow']) ? $v['donow'] : 0;\n\t\t\n\t\t//-----------------------------------------\n\t\t// Next...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $v['name'] )\n\t\t{\n\t\t\tif ( ! isset($v['value']) OR !$v['value'] )\n\t\t\t{\n\t\t\t\tif ( isset($v['array']) AND $v['array'] )\n\t\t\t\t{\n\t\t\t\t\t$value = serialize($this->cache[ $v['name'] ]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$value = $this->cache[ $v['name'] ];\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( isset($v['array']) AND $v['array'] )\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\t$value = serialize($v['value']);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$value = $v['value'];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$this->DB->no_escape_fields['cs_key'] = 1;\n\t\t\t\n\t\t\tif ( $v['deletefirst'] == 1 )\n\t\t\t{\n\t\t\t\tif ( $v['donow'] )\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_replace_into( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_key' => $v['name'], 'cs_value' => $value ), array( 'cs_key' ) );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_shutdown_replace_into( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_key' => $v['name'], 'cs_value' => $value ), array( 'cs_key' ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( $v['donow'] )\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_update( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_value' => $value ), \"cs_key='{$v['name']}'\" );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_shutdown_update( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_value' => $value ), \"cs_key='{$v['name']}'\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif( is_object($this->cachelib) )\n\t\t\t{\n\t\t\t\tif( !$value )\n\t\t\t\t{\n\t\t\t\t\t$value = \"EMPTY\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$this->cachelib->do_remove( $v['name'] );\n\t\t\t\t$this->cachelib->do_put( $v['name'], $value );\n\t\t\t}\n\t\t}\n\t}",
"function wp_cache_add_multiple(array $data, $group = '', $expire = 0)\n {\n }",
"function update_columns_cache()\n {\n $key = C_Photocrati_Transient_Manager::create_key('col_in_' . $this->get_table_name(), 'columns');\n global $wpdb;\n $this->_table_columns = array();\n $sql = \"SHOW COLUMNS FROM `{$this->get_table_name()}`\";\n foreach ($wpdb->get_results($sql) as $row) {\n $this->_table_columns[] = $row->Field;\n }\n C_Photocrati_Transient_Manager::update($key, $this->_table_columns);\n }",
"function wp_cache_set_multiple(array $data, $group = '', $expire = 0)\n {\n }",
"final public function rebuild_cache($cache_name = null) {\n\n\t\t\t// if we want to rebuild specific kind of cache or all of it\n\t\t\t$rebild_cache = (!is_null($cache_name) && array_key_exists($cache_name, $this->cache)) ? array($cache_name => $this->cache[$cache_name]) : $this->cache;\n\n\t\t\tforeach ($rebild_cache as $name => $options) {\n\t\t\t\tif (!array_key_exists('fields', $options)) continue;\n\n\t\t\t\t$options = array_merge(array('conditions' => null, 'order' => null, 'limit' => null), $options);\n\n\t\t\t\t// find if the array of fields is multidimensional array - so we got to consider the the associations\n\t\t\t\tif (count($options['fields']) == count($options['fields'], 1)) {\n\t\t\t\t\t// no multidimensional array so no associations\n\t\t\t\t\t$associations = array();\n\t\t\t\t\t// keys to fetch are all 'fields' elements\n\t\t\t\t\t$keys = array_combine($options['fields'], $options['fields']);\n\t\t\t\t} else {\n\t\t\t\t\t// filter the associations out\n\t\t\t\t\t$associations = array_filter($options['fields'], 'is_array');\n\t\t\t\t\t// get only the fields which are no associations\n\t\t\t\t\t$keys = array_diff_key($options['fields'], $associations);\n\t\t\t\t\t// keys to fetch from main object\n\t\t\t\t\t$keys = array_combine($keys, $keys);\n\t\t\t\t}\n\n\t\t\t\t$store = array();\n\t\t\t\t// we loop through all locales\n\t\t\t\tforeach (Config()->LOCALE_SHORTCUTS as $lang) {\n\t\t\t\t\t$this->set_locale($lang);\n\t\t\t\t\t// preserve index for better cache structure\n\t\t\t\t\t$preserve_index = $this->preserve_index;\n\t\t\t\t\t$this->preserve_index = true;\n\t\t\t\t\t// find all elements according to conditions, order and limit\n\t\t\t\t\t$items = $this->find_all($options['conditions'], $options['order'], $options['limit']);\n\t\t\t\t\t// return preserve index to its original state\n\t\t\t\t\t$this->preserve_index = $preserve_index;\n\n\t\t\t\t\tforeach ($items as $id => $item) {\n\t\t\t\t\t\t// fetch the coresponding fields from each item\n\t\t\t\t\t\t$values = array();\n\t\t\t\t\t\tforeach($keys as $k) {\n\t\t\t\t\t\t $values[$k] = $item->$k;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// store them according to i18n settings\n\t\t\t\t\t\tif ($this->is_i18n == true) {\n\t\t\t\t\t\t\t$store[$lang][$id] = $values;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$store[$id] = $values;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// loop through associations and fetch their data\n\t\t\t\t\t\tforeach ($associations as $association => $fields) {\n\t\t\t\t\t\t\t// fetch the coresponding fields from each association\n\t\t\t\t\t\t\t$values = array_intersect_key((array)($item->$association()), array_combine($fields, $fields));\n\t\t\t\t\t\t\tif (empty($values)) continue;\n\t\t\t\t\t\t\t// store them according to i18n settings\n\t\t\t\t\t\t\tif ($this->is_i18n == true) {\n\t\t\t\t\t\t\t\t$store[$lang][$id][$association] = $values;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$store[$id][$association] = $values;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// write cache\n\t\t\t\t$cache_with_model = Inflector::tableize($this->get_class_name()) . '_' . $name;\n\t\t\t\t$cache_file = Config()->ROOT_PATH . 'cache/site/' . $cache_with_model . '.cache';\n\t\t\t\t$file = fopen($cache_file, \"w\");\n\t\t\t\t@flock($file, LOCK_EX);\n\t\t\t\tfwrite($file, \"<?php\\n\\$this->cached_results['\" . $cache_with_model . \"'] = \" . var_export($store, true) . \";\\n?>\");\n\t\t\t\t@flock($file, LOCK_UN);\n\t\t\t\tfclose($file);\n\t\t\t\t@chmod($cache_file, 0666);\n\t\t\t}\n\n\t\t\t// return back to original locale\n\t\t\t$this->set_locale(Registry()->locale);\n\t\t}",
"abstract public function installMemcached();",
"function update_postmeta_cache($post_ids)\n {\n }",
"public function actionRebuildCache()\n {\n foreach (Yii::app()->Modules as $id => $params)\n $this->actionDb2php(array('module' => $id));\n\n }",
"function components_rebuildcache()\n\t{\n\t\t$this->ipsclass->cache['components'] = array();\n\n\t\t$this->ipsclass->DB->simple_construct( array( 'select' => 'com_id,com_enabled,com_section,com_filename,com_url_uri,com_url_title,com_position',\n\t\t\t\t\t\t\t\t\t\t\t\t\t 'from' => 'components',\n\t\t\t\t\t\t\t\t\t\t\t\t\t 'where' => 'com_enabled=1',\n\t\t\t\t\t\t\t\t\t\t\t\t\t 'order' => 'com_position ASC' ) );\n\t\t$this->ipsclass->DB->simple_exec();\n\n\t\twhile ( $r = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->ipsclass->cache['components'][] = $r;\n\t\t}\n\n\t\t$this->ipsclass->update_cache( array( 'name' => 'components', 'array' => 1, 'deletefirst' => 1 ) );\n\t}",
"function recache()\n\t{\n\t\t$this->ipsclass->input['step']++;\n\t\t$uninstall = ( $this->ipsclass->input['un'] == 1 ) ? \"&un=1\" : \"\";\n\t\t\n\t\t//-----------------------------------------\n\t\t// Components\n\t\t//-----------------------------------------\n\t\t\n\t\t$components = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/components.php', 'ad_components' );\n\t\t$components->components_rebuildcache();\n\t\t\n\t\t//-----------------------------------------\n\t\t// Forum Cache\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->update_forum_cache();\n\t\t\n\t\t//-----------------------------------------\n\t\t// Group Cache\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->cache['group_cache'] = array();\n\t\t\n\t\t$this->ipsclass->DB->build_query( array( 'select' => '*',\n\t\t\t\t\t\t\t\t\t\t\t\t 'from' => 'groups'\n\t\t\t\t\t\t\t\t\t\t) );\n\t\t$this->ipsclass->DB->exec_query();\n\t\t\n\t\twhile ( $i = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;\n\t\t}\n\t\t\n\t\t$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Settings\n\t\t//-----------------------------------------\n\t\t\n\t\t$settings = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/settings.php', 'ad_settings' );\n\t\t$settings->setting_rebuildcache();\n\t\t\n\t\t$this->ipsclass->admin->redirect( \"{$this->ipsclass->form_code}&code=work&mod={$this->ipsclass->input['mod']}&step={$this->ipsclass->input['step']}{$uninstall}&st={$this->ipsclass->input['st']}\", \"{$this->xml_array['mod_info']['title']['VALUE']}<br />IPB caches updated....\" );\n\t}",
"function myPear_update27(){\n foreach(array('zzz_unit_members','zzz_list_members') as $table){\n foreach(array('lm_option'=>'lm_id',\n\t\t 'um_option'=>'um_id',\n\t\t ) as $column=>$lm_id){\n if (myPear_db()->columnExists($column,$table)){\n\t$q=myPear_db()->qquery(\"SELECT $lm_id,$column FROM $table\",1);\n\twhile($r=myPear_db()->next_record($q)){\n\t if (empty($r[$column])){\n\t $f = array();\n\t }else{\n\t $e = error_reporting(0); $f = unserialize($r[$column]); error_reporting($e);\n\t if (!is_array($f)){\n\t if (cnf_dev) b_debug::var_dump($r[$column],\"- $table.$column not serialized, leave it as it is\");\n\t $f = array();\n\t }\n\t }\n\t $OK = True;\n\t foreach(array_keys($f) as $k){\n\t $v = $f[$k];\n\t if(is_array($v)){\n\t // b_debug::xxx(\"array $column($k=\".join(',',$v).')');\n\t $f[$k] = join(',',$v);\n\t $OK = False;\n\t }\n\t }\n\t if (!$OK) myPear_db()->query(\"UPDATE $table SET $column='\".serialize($f).\"' WHERE $lm_id = \".$r[$lm_id]);\n\t}\n }\n }\n }\n}",
"protected static function buildSpriteDataAndCreateCacheEntry() {}",
"private function generateCache()\n {\n $schmaTabls = [];\n foreach (self::$allSchema as $Schema) {\n $schmaTabls[] = Tools::parse_object_TO_array($Schema);\n }\n self::setgenerateCACHE_SELECT($schmaTabls);\n }",
"private function _putBans()\r\n\t{\r\n\t\t$ban_file_name = md5($this->CI->config->config['encryption_key'].$this->ban_file);\r\n\t\t\r\n\t\t// Get group object from DB\r\n\t\t$bans = $this->db->get_where('bans', array('type' => 'user'));\r\n\t\tforeach($bans->result() as $ban)\r\n\t\t{\r\n\t\t\t$this->ban_list[$ban->ip] = array('ip' => $ban->ip, 'time' => $ban->time, 'type' => 'user');\r\n\t\t}\r\n\t\t\r\n\t\t// Save the group object to cache for increased performance\r\n\t\tfile_put_contents(CACHEPATH . $ban_file_name, base64_encode(serialize($this->ban_list)));\r\n\t}",
"function update_meta_cache($meta_type, $object_ids)\n {\n }",
"protected function saveToPackageCache() {}",
"function wp_cache_add_non_persistent_groups($groups)\n{\n global $wp_object_cache;\n\n $wp_object_cache->add_non_persistent_groups($groups);\n}",
"function wp_cache_add_non_persistent_groups($groups)\n {\n }",
"public function expand()\n {\n $oldTable = clone $this;\n\n if ($this->cap < 1024) $this->cap *= 2;\n else $this->cap += ($this->cap >> 2);\n\n $this->reset();\n\n foreach ($oldTable as $key => $value) {\n $this->set($key, $value);\n }\n }",
"function wp_cache_add_non_persistent_groups($groups)\n{\n global $wp_object_cache;\n\n return $wp_object_cache->add_non_persistent_groups($groups);\n}",
"function _prime_site_caches($ids, $update_meta_cache = \\true)\n {\n }",
"function InPlaceCache_mergeTo(&$arrayDest, &$arraySrc)\r\n{\r\n\tif(is_array($arraySrc))\r\n\t\tforeach($arraySrc as $k => $v)\r\n\t\t{\r\n\t\t\tif(is_array($v))\r\n\t\t\t\tInPlaceCache_mergeTo($arrayDest[$k],$v);\r\n\t\t\telse $arrayDest[$k] = $v;\r\n\t\t}\r\n}",
"function _prime_post_caches($ids, $update_term_cache = \\true, $update_meta_cache = \\true)\n {\n }",
"function wp_cache_replace($key, $data, $group = '', $expire = 0)\n {\n }"
]
| [
"0.55490345",
"0.5508078",
"0.545307",
"0.5377138",
"0.5254207",
"0.5221819",
"0.51995",
"0.51809514",
"0.51670134",
"0.5132876",
"0.5090857",
"0.5029304",
"0.50283056",
"0.50101894",
"0.49998397",
"0.4986995",
"0.49546766",
"0.4942958",
"0.49335015",
"0.49329308",
"0.49063578",
"0.4898524",
"0.48895866",
"0.4868101",
"0.48664415",
"0.48477998",
"0.48320124",
"0.48196536",
"0.48024124",
"0.47986132"
]
| 0.6532736 | 0 |
/ UPDATE FORUM CACHE / Updates forum cache (loads all, recaches all) | function update_forum_cache()
{
$ignore_me = array( 'redirect_url', 'redirect_loc', 'rules_text', 'permission_custom_error', 'notify_modq_emails' );
if ( isset($this->vars['forum_cache_minimum']) AND $this->vars['forum_cache_minimum'] )
{
$ignore_me[] = 'description';
$ignore_me[] = 'rules_title';
}
$this->cache['forum_cache'] = array();
$this->DB->simple_construct( array( 'select' => '*',
'from' => 'forums',
'order' => 'parent_id, position'
) );
$this->DB->simple_exec();
while( $f = $this->DB->fetch_row() )
{
$fr = array();
$perms = unserialize(stripslashes($f['permission_array']));
//-----------------------------------------
// Stuff we don't need...
//-----------------------------------------
if ( $f['parent_id'] == -1 )
{
$fr['id'] = $f['id'];
$fr['sub_can_post'] = $f['sub_can_post'];
$fr['name'] = $f['name'];
$fr['parent_id'] = $f['parent_id'];
$fr['show_perms'] = $perms['show_perms'];
$fr['skin_id'] = $f['skin_id'];
$fr['permission_showtopic'] = $f['permission_showtopic'];
}
else
{
foreach( $f as $k => $v )
{
if ( in_array( $k, $ignore_me ) )
{
continue;
}
else
{
if ( $v != "" )
{
$fr[ $k ] = $v;
}
}
}
$fr['read_perms'] = isset($perms['read_perms']) ? $perms['read_perms'] : '';
$fr['reply_perms'] = isset($perms['reply_perms']) ? $perms['reply_perms'] : '';
$fr['start_perms'] = isset($perms['start_perms']) ? $perms['start_perms'] : '';
$fr['upload_perms'] = isset($perms['upload_perms']) ? $perms['upload_perms'] : '';
$fr['download_perms'] = isset($perms['download_perms']) ? $perms['download_perms'] : '';
$fr['show_perms'] = isset($perms['show_perms']) ? $perms['show_perms'] : '';
unset($fr['permission_array']);
}
$this->cache['forum_cache'][ $fr['id'] ] = $fr;
}
$this->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 0, 'donow' => 0 ) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function updateCache();",
"function update_cache( $v=array() )\n\t{\n\t\t//-----------------------------------------\n\t\t// Don't cache forums?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $v['name'] == 'forum_cache' AND isset($this->vars['no_cache_forums']) AND $this->vars['no_cache_forums'] )\n\t\t{ \n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$v['donow'] = isset($v['donow']) ? $v['donow'] : 0;\n\t\t\n\t\t//-----------------------------------------\n\t\t// Next...\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $v['name'] )\n\t\t{\n\t\t\tif ( ! isset($v['value']) OR !$v['value'] )\n\t\t\t{\n\t\t\t\tif ( isset($v['array']) AND $v['array'] )\n\t\t\t\t{\n\t\t\t\t\t$value = serialize($this->cache[ $v['name'] ]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$value = $this->cache[ $v['name'] ];\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( isset($v['array']) AND $v['array'] )\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\t$value = serialize($v['value']);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$value = $v['value'];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$this->DB->no_escape_fields['cs_key'] = 1;\n\t\t\t\n\t\t\tif ( $v['deletefirst'] == 1 )\n\t\t\t{\n\t\t\t\tif ( $v['donow'] )\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_replace_into( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_key' => $v['name'], 'cs_value' => $value ), array( 'cs_key' ) );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_shutdown_replace_into( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_key' => $v['name'], 'cs_value' => $value ), array( 'cs_key' ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( $v['donow'] )\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_update( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_value' => $value ), \"cs_key='{$v['name']}'\" );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->DB->do_shutdown_update( 'cache_store', array( 'cs_array' => intval($v['array']), 'cs_value' => $value ), \"cs_key='{$v['name']}'\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif( is_object($this->cachelib) )\n\t\t\t{\n\t\t\t\tif( !$value )\n\t\t\t\t{\n\t\t\t\t\t$value = \"EMPTY\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$this->cachelib->do_remove( $v['name'] );\n\t\t\t\t$this->cachelib->do_put( $v['name'], $value );\n\t\t\t}\n\t\t}\n\t}",
"function recache()\n\t{\n\t\t$this->ipsclass->input['step']++;\n\t\t$uninstall = ( $this->ipsclass->input['un'] == 1 ) ? \"&un=1\" : \"\";\n\t\t\n\t\t//-----------------------------------------\n\t\t// Components\n\t\t//-----------------------------------------\n\t\t\n\t\t$components = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/components.php', 'ad_components' );\n\t\t$components->components_rebuildcache();\n\t\t\n\t\t//-----------------------------------------\n\t\t// Forum Cache\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->update_forum_cache();\n\t\t\n\t\t//-----------------------------------------\n\t\t// Group Cache\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->ipsclass->cache['group_cache'] = array();\n\t\t\n\t\t$this->ipsclass->DB->build_query( array( 'select' => '*',\n\t\t\t\t\t\t\t\t\t\t\t\t 'from' => 'groups'\n\t\t\t\t\t\t\t\t\t\t) );\n\t\t$this->ipsclass->DB->exec_query();\n\t\t\n\t\twhile ( $i = $this->ipsclass->DB->fetch_row() )\n\t\t{\n\t\t\t$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;\n\t\t}\n\t\t\n\t\t$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Settings\n\t\t//-----------------------------------------\n\t\t\n\t\t$settings = $this->ipsclass->load_class( ROOT_PATH.'sources/action_admin/settings.php', 'ad_settings' );\n\t\t$settings->setting_rebuildcache();\n\t\t\n\t\t$this->ipsclass->admin->redirect( \"{$this->ipsclass->form_code}&code=work&mod={$this->ipsclass->input['mod']}&step={$this->ipsclass->input['step']}{$uninstall}&st={$this->ipsclass->input['st']}\", \"{$this->xml_array['mod_info']['title']['VALUE']}<br />IPB caches updated....\" );\n\t}",
"function updateCache() {\r\n return $this->_fHandler->updateCache();\r\n }",
"protected function update_cache(){\r\n\t\t$html = file_get_contents($this->_cfg->get('sfbaseurl'));\r\n\t\tif($html === false || !trim($html))\r\n\t\t\tthrow new Exception('Could not read SourceForge website');\r\n\t\t$mtch = null;\r\n\t\tif(!preg_match('/lazarus-(\\\\d+.\\\\d+.\\\\d+)-fpc-(\\\\d+.\\\\d+.\\\\d+)-/', $html, $mtch))\r\n\t\t\tthrow new Exception('Could not parse version from SourceForge');\r\n\t\t$data = array(\r\n\t\t\t'laz' => $mtch[1],\r\n\t\t\t'fpc' => $mtch[2],\r\n\t\t);\r\n\t\t$data = '<'.'?php return '.var_export($data, true).'; ?>';\r\n\t\tfile_put_contents($this->get_cache(), $data);\r\n\t}",
"function update_site_cache($sites, $update_meta_cache = \\true)\n {\n }",
"function update_user_caches($user)\n {\n }",
"function update_category_cache()\n {\n }",
"function wp_clean_update_cache()\n {\n }",
"function wp_cache_flush()\n {\n }",
"public function flushCache();",
"public function _cache_refresh_all()\n {\n }",
"function _cache_refresh ($name = \"\") {\n\t\t$this->_cache_put($name);\n\t}",
"public static function reset_reactforum_cache() {\n self::$reactforumcache = array();\n self::$fetchedreactforums = array();\n }",
"public function updateCache (\n\t)\t\t\t\t\t\t// RETURNS <bool> TRUE on success, FALSE on failure.\n\t\n\t// $contentForm->updateCache();\n\t{\n\t\t// Prepare the text for being cached\n\t\t$body = \"\";\n\t\t\n\t\t// Get the list of content segments\n\t\t$results = Database::selectMultiple(\"SELECT block_id, type FROM content_block_segment WHERE content_id=? ORDER BY sort_order ASC\", array($this->contentID));\n\t\t\n\t\t// Pull the text from the appropriate block type\n\t\tforeach($results as $result)\n\t\t{\n\t\t\tif(method_exists(\"Module\" . $result['type'], \"get\"))\n\t\t\t{\n\t\t\t\t$body .= call_user_func(array(\"Module\" . $result['type'], \"get\"), (int) $result['block_id']);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Cache the text\n\t\treturn Database::query(\"REPLACE INTO content_cache (content_id, body) VALUES (?, ?)\", array($this->contentID, $body));\n\t}",
"function update_post_cache(&$posts)\n {\n }",
"function mgd_cache_invalidate()\n{\n}",
"function xthreads_admin_forumcommit() {\r\n\tglobal $fid, $db, $cache, $mybb;\r\n\tif(!$fid) {\r\n\t\t// bad MyPlaza Turbo! (or any other plugin which does the same thing)\r\n\t\t$fid = (int)$mybb->input['fid'];\r\n\t}\r\n\t\r\n\t/*\r\n\t// handle additional filters\r\n\t$afefields = array(\r\n\t\t'uid',\r\n\t\t'lastposteruid',\r\n\t\t'prefix',\r\n\t\t'icon',\r\n\t);\r\n\t$addfiltenable = '';\r\n\tforeach($afefields as &$afe)\r\n\t\tif($db->field_exists($afe, 'threads') && isset($mybb->input['xthreads_afe_'.$afe])) {\r\n\t\t\t$addfiltenable .= ($addfiltenable?',':'').$afe;\r\n\t\t\tif($afe != 'uid') {\r\n\t\t\t\t// try to add key - if it already exists, MySQL will fail for us :P\r\n\t\t\t\t$db->write_query('ALTER TABLE `'.$db->table_prefix.'threads` ADD KEY `xthreads_'.$afe.'` (`'.$afe.'`)', true);\r\n\t\t\t}\r\n\t\t} elseif($afe != 'uid') {\r\n\t\t\t// check if any other forum is using this field\r\n\t\t\tif(!isset($afe_usage_cache)) {\r\n\t\t\t\t$afe_usage_cache = array();\r\n\t\t\t\t$query = $db->simple_select('forums', 'DISTINCT xthreads_addfiltenable', 'xthreads_addfiltenable != \"\" AND fid != '.$fid);\r\n\t\t\t\twhile($fafelist = $db->fetch_field($query, 'xthreads_addfiltenable')) {\r\n\t\t\t\t\tforeach(explode(',', $fafelist) as $fafe)\r\n\t\t\t\t\t\t$afe_usage_cache[$fafe] = 1;\r\n\t\t\t\t}\r\n\t\t\t\t$db->free_result($query);\r\n\t\t\t\tunset($fafelist, $fafe);\r\n\t\t\t}\r\n\t\t\tif(!$afe_usage_cache[$afe]) {\r\n\t\t\t\t// this filter isn't being used anywhere - try to drop the key\r\n\t\t\t\t$db->write_query('ALTER TABLE `'.$db->table_prefix.'threads` DROP KEY `xthreads_'.$afe.'`', true);\r\n\t\t\t}\r\n\t\t}\r\n\t*/\r\n\t\r\n\t$update_array = array();\r\n\tforeach(array(\r\n\t\t'xthreads_tplprefix' => 1,\r\n\t\t'xthreads_langprefix' => 1,\r\n\t\t'xthreads_grouping' => 0,\r\n\t\t'xthreads_firstpostattop' => 0,\r\n\t\t'xthreads_allow_blankmsg' => 0,\r\n\t\t'xthreads_nostatcount' => 0,\r\n\t\t'xthreads_inlinesearch' => 0,\r\n\t\t'xthreads_fdcolspan_offset' => 0,\r\n\t\t'xthreads_settingoverrides' => 1,\r\n\t\t'xthreads_postsperpage' => 0,\r\n\t\t'xthreads_hideforum' => 0,\r\n\t\t'xthreads_hidebreadcrumb' => 0,\r\n\t\t'xthreads_defaultfilter' => 1,\r\n\t\t//'xthreads_addfiltenable' => $db->escape_string($addfiltenable),\r\n//\t\t'xthreads_deffilter' => $db->escape_string($deffilter),\r\n\t\t'xthreads_wol_announcements' => 2,\r\n\t\t'xthreads_wol_forumdisplay' => 2,\r\n\t\t'xthreads_wol_newthread' => 2,\r\n\t\t'xthreads_wol_attachment' => 2,\r\n\t\t'xthreads_wol_newreply' => 2,\r\n\t\t'xthreads_wol_showthread' => 2,\r\n\t) as $k => $is_str) {\r\n\t\tif(isset($mybb->input[$k])) {\r\n\t\t\tif($is_str) {\r\n\t\t\t\t$update_array[$k] = $db->escape_string($is_str == 2 ? trim($mybb->input[$k]) : $mybb->input[$k]);\r\n\t\t\t} else\r\n\t\t\t\t$update_array[$k] = (int)trim($mybb->input[$k]);\r\n\t\t} else {\r\n\t\t\t$update_array[$k] = $is_str ? '' : 0;\r\n\t\t}\r\n\t}\r\n\t$db->update_query('forums', $update_array, 'fid='.$fid);\r\n\t\r\n\t$cache->update_forums();\r\n\txthreads_buildtfcache();\r\n}",
"function wp_cache_flush_runtime()\n {\n }",
"function update_comment_cache($comments, $update_meta_cache = \\true)\n {\n }",
"public function preCacheUpdate()\n\t{\n\t\t$this->template->assign('updateCache', true);\n\t}",
"function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = \\true, $update_meta_cache = \\true)\n {\n }",
"function update_sitemeta_cache($site_ids)\n {\n }",
"public function updateCache() {\n\t\tif ($this->hasLocalMessages()) {\n\t\t\t$this->postCache();\n\t\t}\n\n\t\t$this->uplink->open($this->auth);\n\t\t// Gruppenhashes vergleichen (Schnellste Moeglichkeit)\n\t\tif ($this->uplink->getGroupHash() != $this->getGroupHash()) {\n\t\t\t/* Wenn unser Uplink uns die Nachrichten auch direkt geben kann,\n\t\t\t * muessen wir nicht erst die komplette Gruppe laden */\n\t\t\tif ($this->uplink instanceof MessageStream) {\n\t\t\t\t$this->updateGroup();\n\t\t\t} else {\n\t\t\t\t$this->setGroup($this->uplink->getGroup());\n\t\t\t}\n\t\t}\n\t\t$this->uplink->close();\n\t}",
"function xthreads_admin_forumcommit() {\r\n\tglobal $fid, $db, $cache, $mybb;\r\n\tif(!$fid) {\r\n\t\t// bad MyPlaza Turbo! (or any other plugin which does the same thing)\r\n\t\t$fid = intval($mybb->input['fid']);\r\n\t}\r\n\t\r\n\t// handle additional filters\r\n\t$afefields = array(\r\n\t\t'uid',\r\n\t\t'lastposteruid',\r\n\t\t'prefix',\r\n\t\t'icon',\r\n\t);\r\n\t$addfiltenable = '';\r\n\tforeach($afefields as &$afe)\r\n\t\tif($db->field_exists($afe, 'threads') && $mybb->input['xthreads_afe_'.$afe]) {\r\n\t\t\t$addfiltenable .= ($addfiltenable?',':'').$afe;\r\n\t\t\tif($afe != 'uid') {\r\n\t\t\t\t// try to add key - if it already exists, MySQL will fail for us :P\r\n\t\t\t\t$db->write_query('ALTER TABLE `'.$db->table_prefix.'threads` ADD KEY `xthreads_'.$afe.'` (`'.$afe.'`)', true);\r\n\t\t\t}\r\n\t\t} elseif($afe != 'uid') {\r\n\t\t\t// check if any other forum is using this field\r\n\t\t\tif(!isset($afe_usage_cache)) {\r\n\t\t\t\t$afe_usage_cache = array();\r\n\t\t\t\t$query = $db->simple_select('forums', 'DISTINCT xthreads_addfiltenable', 'xthreads_addfiltenable != \"\" AND fid != '.$fid);\r\n\t\t\t\twhile($fafelist = $db->fetch_field($query, 'xthreads_addfiltenable')) {\r\n\t\t\t\t\tforeach(explode(',', $fafelist) as $fafe)\r\n\t\t\t\t\t\t$afe_usage_cache[$fafe] = 1;\r\n\t\t\t\t}\r\n\t\t\t\t$db->free_result($query);\r\n\t\t\t\tunset($fafelist, $fafe);\r\n\t\t\t}\r\n\t\t\tif(!$afe_usage_cache[$afe]) {\r\n\t\t\t\t// this filter isn't being used anywhere - try to drop the key\r\n\t\t\t\t$db->write_query('ALTER TABLE `'.$db->table_prefix.'threads` DROP KEY `xthreads_'.$afe.'`', true);\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t\r\n\t$db->update_query('forums', array(\r\n\t\t'xthreads_tplprefix' => $db->escape_string(implode(',', array_map('trim', explode(',', $mybb->input['xthreads_tplprefix'])))),\r\n\t\t'xthreads_grouping' => intval(trim($mybb->input['xthreads_grouping'])),\r\n\t\t'xthreads_firstpostattop' => intval(trim($mybb->input['xthreads_firstpostattop'])),\r\n\t\t'xthreads_allow_blankmsg' => intval(trim($mybb->input['xthreads_allow_blankmsg'])),\r\n\t\t'xthreads_nostatcount' => intval(trim($mybb->input['xthreads_nostatcount'])),\r\n\t\t'xthreads_inlinesearch' => intval(trim($mybb->input['xthreads_inlinesearch'])),\r\n\t\t'xthreads_threadsperpage' => intval(trim($mybb->input['xthreads_threadsperpage'])),\r\n\t\t'xthreads_postsperpage' => intval(trim($mybb->input['xthreads_postsperpage'])),\r\n\t\t'xthreads_force_postlayout' => trim($mybb->input['xthreads_force_postlayout']),\r\n\t\t'xthreads_hideforum' => intval($mybb->input['xthreads_hideforum']),\r\n\t\t'xthreads_hidebreadcrumb' => intval($mybb->input['xthreads_hidebreadcrumb']),\r\n\t\t'xthreads_addfiltenable' => $db->escape_string($addfiltenable),\r\n//\t\t'xthreads_deffilter' => $db->escape_string($deffilter),\r\n\t\t'xthreads_wol_announcements' => $db->escape_string(trim($mybb->input['xthreads_wol_announcements'])),\r\n\t\t'xthreads_wol_forumdisplay' => $db->escape_string(trim($mybb->input['xthreads_wol_forumdisplay'])),\r\n\t\t'xthreads_wol_newthread' => $db->escape_string(trim($mybb->input['xthreads_wol_newthread'])),\r\n\t\t'xthreads_wol_attachment' => $db->escape_string(trim($mybb->input['xthreads_wol_attachment'])),\r\n\t\t'xthreads_wol_newreply' => $db->escape_string(trim($mybb->input['xthreads_wol_newreply'])),\r\n\t\t'xthreads_wol_showthread' => $db->escape_string(trim($mybb->input['xthreads_wol_showthread'])),\r\n\t\t'xthreads_wol_xtattachment' => $db->escape_string(trim($mybb->input['xthreads_wol_xtattachment'])),\r\n\t), 'fid='.$fid);\r\n\t\r\n\t$cache->update_forums();\r\n}",
"function _prime_site_caches($ids, $update_meta_cache = \\true)\n {\n }",
"public function refreshAPCCache()\n {\n $configModel = new Default_Model_Configuration();\n $server = $configModel->getKey('api_url');\n $hash = isset($server) ? hash('sha1', $server) : '';\n \n $cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);\n\n $cache->delete($hash . '-Partners.emails-keys');\n $cache->delete($hash . '-configFile-partners');\n }",
"public function saveToCacheForever();",
"function update_site_cache( $sites ) {\n\tif ( ! $sites ) {\n\t\treturn;\n\t}\n\n\tforeach ( $sites as $site ) {\n\t\twp_cache_add( $site->blog_id, $site, 'sites' );\n\t\twp_cache_add( $site->blog_id . 'short', $site, 'blog-details' );\n\t}\n}",
"public function reloadCaches() {}"
]
| [
"0.7577632",
"0.70351887",
"0.685945",
"0.6851236",
"0.6640841",
"0.64499795",
"0.6273942",
"0.62531495",
"0.6175319",
"0.61461526",
"0.61046493",
"0.60698485",
"0.60532033",
"0.6043134",
"0.6030009",
"0.60277957",
"0.6022973",
"0.60223186",
"0.6004978",
"0.5998739",
"0.5980057",
"0.5960276",
"0.595676",
"0.59375817",
"0.5905852",
"0.5875714",
"0.58574045",
"0.5843304",
"0.5842373",
"0.5837872"
]
| 0.7846294 | 0 |
/ Process Mail Queue / Process mail queue | function process_mail_queue()
{
//-----------------------------------------
// SET UP
//-----------------------------------------
$this->vars['mail_queue_per_blob'] = isset($this->vars['mail_queue_per_blob']) ? $this->vars['mail_queue_per_blob'] : 5;
$this->cache['systemvars']['mail_queue'] = isset( $this->cache['systemvars']['mail_queue'] ) ? intval( $this->cache['systemvars']['mail_queue'] ) : 0;
$sent_ids = array();
if ( $this->cache['systemvars']['mail_queue'] > 0 )
{
//-----------------------------------------
// Require the emailer...
//-----------------------------------------
require_once( ROOT_PATH . 'sources/classes/class_email.php' );
$emailer = new emailer(ROOT_PATH);
$emailer->ipsclass =& $this;
$emailer->email_init();
//-----------------------------------------
// Get the mail stuck in the queue
//-----------------------------------------
$this->DB->simple_construct( array( 'select' => '*', 'from' => 'mail_queue', 'order' => 'mail_id', 'limit' => array( 0, $this->vars['mail_queue_per_blob'] ) ) );
$this->DB->simple_exec();
while ( $r = $this->DB->fetch_row() )
{
$data[] = $r;
$sent_ids[] = $r['mail_id'];
}
if ( count($sent_ids) )
{
//-----------------------------------------
// Delete sent mails and update count
//-----------------------------------------
$this->cache['systemvars']['mail_queue'] = $this->cache['systemvars']['mail_queue'] - count($sent_ids);
$this->DB->simple_exec_query( array( 'delete' => 'mail_queue', 'where' => 'mail_id IN ('.implode(",", $sent_ids).')' ) );
foreach( $data as $mail )
{
if ( $mail['mail_to'] and $mail['mail_subject'] and $mail['mail_content'] )
{
$emailer->to = $mail['mail_to'];
$emailer->from = $mail['mail_from'] ? $mail['mail_from'] : $this->vars['email_out'];
$emailer->subject = $mail['mail_subject'];
$emailer->message = $mail['mail_content'];
if ( $mail['mail_html_on'] )
{
$emailer->html_email = 1;
}
else
{
$emailer->html_email = 0;
}
$emailer->send_mail();
}
}
}
else
{
//-----------------------------------------
// No mail after all?
//-----------------------------------------
$this->cache['systemvars']['mail_queue'] = 0;
}
//-----------------------------------------
// Update cache with remaning email count
//-----------------------------------------
$this->update_cache( array( 'array' => 1, 'name' => 'systemvars', 'donow' => 1, 'deletefirst' => 0 ) );
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function exec_queue()\n\t{\n\t\t$vbulletin =& $this->registry;\n\n\t\tif ($vbulletin->options['usemailqueue'] == 2)\n\t\t{\n\t\t\t// Lock mailqueue table so that only one process can\n\t\t\t// send a batch of emails and then delete them\n\t\t\t$vbulletin->db->lock_tables(array('mailqueue' => 'WRITE'));\n\t\t}\n\n\t\t$emails = $vbulletin->db->query_read(\"\n\t\t\tSELECT *\n\t\t\tFROM \" . TABLE_PREFIX . \"mailqueue\n\t\t\tORDER BY mailqueueid\n\t\t\tLIMIT \" . intval($vbulletin->options['emailsendnum'])\n\t\t);\n\n\t\t$mailqueueids = '';\n\t\t$newmail = 0;\n\t\t$emailarray = array();\n\t\twhile ($email = $vbulletin->db->fetch_array($emails))\n\t\t{\n\t\t\t// count up number of mails about to send\n\t\t\t$mailqueueids .= ',' . $email['mailqueueid'];\n\t\t\t$newmail++;\n\t\t\t$emailarray[] = $email;\n\t\t}\n\t\tif (!empty($mailqueueids))\n\t\t{\n\t\t\t// remove mails from queue - to stop duplicates being sent\n\t\t\t$vbulletin->db->query_write(\"\n\t\t\t\tDELETE FROM \" . TABLE_PREFIX . \"mailqueue\n\t\t\t\tWHERE mailqueueid IN (0 $mailqueueids)\n\t\t\t\");\n\n\t\t\tif ($vbulletin->options['usemailqueue'] == 2)\n\t\t\t{\n\t\t\t\t$vbulletin->db->unlock_tables();\n\t\t\t}\n\n\t\t\tif ($vbulletin->options['use_smtp'])\n\t\t\t{\n\t\t\t\t$prototype =& new vB_SmtpMail($vbulletin);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$prototype =& new vB_Mail($vbulletin);\n\t\t\t}\n\n\t\t\tforeach ($emailarray AS $index => $email)\n\t\t\t{\n\t\t\t\t// send those mails\n\t\t\t\t$mail = (phpversion() < '5' ? $prototype : clone($prototype)); // avoid ctor overhead\n\t\t\t\t$mail->quick_set($email['toemail'], $email['subject'], $email['message'], $email['header'], $email['fromemail']);\n\t\t\t\t$mail->send();\n\t\t\t}\n\n\t\t\t$newmail = 'data - ' . intval($newmail);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($vbulletin->options['usemailqueue'] == 2)\n\t\t\t{\n\t\t\t\t$vbulletin->db->unlock_tables();\n\t\t\t}\n\n\t\t\t$newmail = 0;\n\t\t}\n\n\t\t// update number of mails remaining\n\t\t$vbulletin->db->query_write(\"\n\t\t\tUPDATE \" . TABLE_PREFIX . \"datastore SET\n\t\t\t\tdata = \" . $newmail . \",\n\t\t\t\tdata = IF(data < 0, 0, data)\n\t\t\tWHERE title = 'mailqueue'\n\t\t\");\n\n\t\t// if we're using a alternate datastore, we need to give it an integer value\n\t\t// this may not be atomic\n\t\tif (method_exists($vbulletin->datastore, 'build'))\n\t\t{\n\t\t\t$mailqueue_db = $vbulletin->db->query_first(\"\n\t\t\t\tSELECT data\n\t\t\t\tFROM \" . TABLE_PREFIX . \"datastore\n\t\t\t\tWHERE title = 'mailqueue'\n\t\t\t\");\n\t\t\t$vbulletin->datastore->build('mailqueue', intval($mailqueue_db['data']));\n\t\t}\n\t}",
"public function emailQueue() {\n\t\t$this->EmailQueue->processQueue(); exit;\n\t}",
"public function process()\n\t{\n\n\t\tif(is_null($this->mailqueue_model)) {\n\t\t\tLog::info($this->header_vars . ' did not find mailqueue model');\n\t\t\treturn 'Mailqueue Model not found in Database';\n\t\t}\n\n\t\ttry {\n\t\tswitch ($this->action) {\n\t\t\tcase 'delivered':\n\t\t\t\t$this->mailqueue_model->hasBeenDelivered();\n\n\t\t\t\tbreak;\n\t\t\tcase 'opened':\n\n\t\t\t\t$this->mailqueue_model->hasBeenOpened();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'complained':\n\t\t\t\t$this->mailqueue_model->complained();\n\t\t\t\tbreak;\n\n\t\t\tcase 'clicked':\n\t\t\t\t$this->mailqueue_model->clickedLink();\n\t\t\t\tbreak;\n\t\t\tcase 'bounced';\n\t\t\t\t$this->mailqueue_model->hardBounce();\n\n\t\t\tcase 'dropped';\n\t\t\t\tLog::info('dropped event');\n\t\t\t\t$this->mailqueue_model->dropped();\n\t\t\tdefault:\n\t\t\t\t# code...\n\t\t\t\tbreak;\n\t\t}\n\n\t\t\treturn true;\n\t\t} catch (\\Exception $e) {\n\t\t\tLog::error($e->getMessage() . ' ' . $e->getLine() . ' ' . $e->getFile());\n\t\t\treturn false;\n \t}\n\t}",
"function Main()\n{\n\tglobal $server;\n\t$company = ECash::getFactory()->getModel('Company');\n\t$company->loadBy(array('name_short' => strtolower(ECash::getConfig()->COMPANY_NAME_SHORT))); \n\n\t$server->company_id = $company->company_id;\n\t$company_id = $company->company_id;\n\t$db = ECash::getMasterDb();\n\t$start_date = getLastProcessTime($db, 'populate_email_queue', 'completed');\n\n\t// If this is null, the process has never run so we'll need to make up a \n\t// new start date.\n\tif (NULL === $start_date)\n\t{\n\t\t// We're going to subtract 6 hours below, so by setting this to 18 hours ago,\n\t\t// we'll ultimately start at 24 hours ago.\n\t\t$start_date = date('YmdHis', strtotime('-18 hourss', time()));\n\t}\n\telse if (EXECUTION_MODE !== 'LIVE') // local and rc time will be off, so...\n\t{\n\t\t$start_date = substr($start_date, 0, 8) . '000000';\n\t}\n\n\t$start_date = date('YmdHis', strtotime('-6 hours', strtotime($start_date)));\n\n\t$pid = Set_Process_Status($db, $company_id, 'populate_email_queue', 'started');\n\tECash::getLog()->Write(\"populate email queue [start:{$start_date}]\");\n\t$email_documents = eCash_Document_DeliveryAPI_Condor::Prpc()->Get_Incoming_Documents($start_date, NULL, NULL, TRUE, 'EMAIL');\n\n\tif(! is_array($email_documents))\n\t{\n\t\tSet_Process_Status($db, $company_id, 'populate_email_queue', 'failed', NULL, $pid);\n\t\treturn;\n\t}\t\t\n\n\tif(! empty($email_documents))\n\t{\n\t\tECash::getLog()->Write(\"Importing New Email Documents:\");\n\t\tECash::getLog()->Write(print_r($email_documents, true));\n\n\t\t$request = new stdClass();\n\t \t$eq = new Incoming_Email_Queue($server, $request);\n\n\t\tforeach ($email_documents as $email)\n\t\t{\n\t\t\t$eq->Add_To_Email_Queue($company_id, $email->archive_id, FALSE, $email->recipient, $email->sender);\n\t\t}\n\t}\n\n\tSet_Process_Status($db, $company_id, 'populate_email_queue', 'completed', NULL, $pid);\n\n}",
"public function processQueue()\n {\n $gate_arr = config('gates');\n foreach ($gate_arr as $gate_item) {\n $this->sendSmsOne($gate_item['name']);\n }\n }",
"public function queueManagement(int $mid){\n\t\t// \n\t\t// A queue number is added in mailbox table for getting the last queue number of the user, the queue number should not be used for sent folder because they are the emails which are send by us not came from them.\n\t\t// \n\t\t// Initially the folder should take the emails in send but when the project starts the send emails are not necessarily be taken from the email box of gmail etc or it can be taken into consideration but they will create a confustion as, to whom the reply will be associated.\n\t}",
"public function process()\n\t{\n\t\tPhpfox::isUser(true);\t\t\n\t\t\n\t\t$bIsInLegacyView = false;\n\t\tif (Phpfox::getParam('mail.threaded_mail_conversation') && $this->request()->get('legacy'))\n\t\t{\t\t\t\t\n\t\t\tPhpfox::getLib('setting')->setParam('mail.threaded_mail_conversation', false);\n\t\t\t$bIsInLegacyView = true;\t\t\t\n\t\t}\n\t\t\n\t\t$this->setParam('bIsInLegacyView', $bIsInLegacyView);\n\t\t\n\t\tif (($aItemModerate = $this->request()->get('item_moderate')))\n\t\t{\n\t\t\t$sFile = Phpfox::getService('mail')->getThreadsForExport($aItemModerate);\n\t\t\t\n\t\t\tPhpfox::getLib('file')->forceDownload($sFile, 'mail.xml');\n\t\t}\n\t\t\n\t\t$iPage = $this->request()->getInt('page');\n\t\t$iPageSize = 10;\n\t\t$bIsSentbox = ($this->request()->get('view') == 'sent' ? true : false);\n\t\t$bIsTrash = ($this->request()->get('view') == 'trash' ? true : false);\n\t\t$iPrivateBox = ($this->request()->get('view') == 'box' ? $this->request()->getInt('id') : false);\n\n\t\t$bIs = $this->getParam('bIsSentbox');\n\t\t\n\t\tif ($this->request()->get('action') == 'archive')\n\t\t{\n\t\t\tPhpfox::getService('mail.process')->archiveThread($this->request()->getInt('id'), 1);\n\t\t\t\n\t\t\t$this->url()->send('mail.trash', null, Phpfox::getPhrase('mail.message_successfully_archived'));\n\t\t}\n\t\t\n\t\tif ($this->request()->get('action') == 'unarchive')\n\t\t{\n\t\t\tPhpfox::getService('mail.process')->archiveThread($this->request()->getInt('id'), 0);\n\t\t\t\n\t\t\t$this->url()->send('mail', null, Phpfox::getPhrase('mail.message_successfully_unarchived'));\n\t\t}\t\t\t\t\n\t\t\n\t\tif ($this->request()->get('action') == 'delete')\n\t\t{\n\t\t\t$iMailId = $this->request()->getInt('id');\n\t\t\tif (!is_int($iMailId) || empty($iMailId))\n\t\t\t{\n\t\t\t\tPhpfox_Error::set(Phpfox::getPhrase('mail.no_mail_specified'));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$bTrash = $this->getParam('bIsTrash');\n\t\t\t\tif (!isset($bTrash) || !is_bool($bTrash))\n\t\t\t\t{\n\t\t\t\t\t$bIsTrash = Phpfox::getService('mail')->isDeleted($iMailId);\n\t\t\t\t}\n\t\t\t\tif ($bIsTrash)\n\t\t\t\t{\n\t\t\t\t\tif (Phpfox::getService('mail.process')->deleteTrash($iMailId))\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->url()->send('mail.trash', null, Phpfox::getPhrase('mail.mail_deleted_successfully'));\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tPhpfox_Error::set(Phpfox::getPhrase('mail.mail_could_not_be_deleted'));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\t$bIsSent = $this->getParam('bIsSentbox');\n\t\t\t\t\tif (!isset($bIsSent) || !is_bool($bIsSent))\n\t\t\t\t\t{\n\t\t\t\t\t\t$bIsSentbox = Phpfox::getService('mail')->isSent($iMailId);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (Phpfox::getService('mail.process')->delete($iMailId, $bIsSentbox))\n\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t$this->url()->send($bIsSentbox == true ? 'mail.sentbox' : 'mail', null, Phpfox::getPhrase('mail.mail_deleted_successfully'));\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tPhpfox_Error::set(Phpfox::getPhrase('mail.mail_could_not_be_deleted'));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tif (($aVals = $this->request()->getArray('val')) && isset($aVals['action']))\n\t\t{\n\t\t\tif (isset($aVals['id']))\n\t\t\t{ //make sure there is at least one selected\n\t\t\t\t$oMailProcess = Phpfox::getService('mail.process');\n\t\t\t\tswitch ($aVals['action'])\n\t\t\t\t{\n\t\t\t\t\tcase 'unread':\n\t\t\t\t\t\tcase 'read':\n\t\t\t\t\t\t\tforeach ($aVals['id'] as $iId)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$oMailProcess->toggleView($iId, ($aVals['action'] == 'unread' ? true : false));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$sMessage = Phpfox::getPhrase('mail.messages_updated');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'delete':\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (isset($aVals['select']) && $aVals['select'] == 'every')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aMail = Phpfox::getService('mail')->getAllMailFromFolder(Phpfox::getUserId(),(int)$aVals['folder'], $bIsSentbox, $bIsTrash);\n\t\t\t\t\t\t\t\t$aVals['id'] = $aMail;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tforeach ($aVals['id'] as $iId)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t($bIsTrash ? $oMailProcess->deleteTrash($iId) : $oMailProcess->delete($iId, $bIsSentbox));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$sMessage = Phpfox::getPhrase('mail.messages_deleted');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'undelete':\n\t\t\t\t\t\t\tforeach ($aVals['id'] as $iId)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$oMailProcess->undelete($iId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$sMessage = Phpfox::getPhrase('mail.messages_updated');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{ // didnt select any message\n\t\t\t\t\t$sMessage = Phpfox::getPhrase('mail.error_you_did_not_select_any_message');\n\n\t\t\t\t}\n\t\t\t\t// define the mail box that the user was looking at\n\t\t\t\t$mSend = null;\n\t\t\t\tif ($bIsSentbox)\n\t\t\t\t{\n\t\t\t\t\t$mSend = array('sentbox');\n\t\t\t\t}\n\t\t\t\telseif ($bIsTrash)\n\t\t\t\t{\n\t\t\t\t\t$mSend = array('trash');\n\t\t\t\t}\n\t\t\t\telseif ($iPrivateBox)\n\t\t\t\t{\n\t\t\t\t\t$mSend = array('box', 'id' => $iPrivateBox);\n\t\t\t\t}\n\n\t\t\t\t// send the user to that folder with the message\n\t\t\t\t$this->url()->send('mail', $mSend, $sMessage);\n\t\t\t}\n\t\t\t\n\t\t\t$this->search()->set(array(\n\t\t\t\t\t'type' => 'mail',\n\t\t\t\t\t'field' => 'mail.mail_id',\t\t\t\t\n\t\t\t\t\t'search_tool' => array(\n\t\t\t\t\t\t'table_alias' => 'm',\n\t\t\t\t\t\t'search' => array(\n\t\t\t\t\t\t\t'action' => $this->url()->makeUrl('mail', array('view' => $this->request()->get('view'), 'id' => $this->request()->get('id'))),\n\t\t\t\t\t\t\t'default_value' => Phpfox::getPhrase('mail.search_messages'),\n\t\t\t\t\t\t\t'name' => 'search',\n\t\t\t\t\t\t\t'field' => array('m.subject', 'm.preview')\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'sort' => array(\n\t\t\t\t\t\t\t'latest' => array('m.time_stamp', Phpfox::getPhrase('mail.latest')),\n\t\t\t\t\t\t\t'most-viewed' => array('m.viewer_is_new', Phpfox::getPhrase('mail.unread_first'))\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'show' => array(10, 15, 20)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\t\t\n\t\t\t\n\t\t\t$iPageSize = $this->search()->getDisplay();\n\n\t\t\t$aFolders = Phpfox::getService('mail.folder')->get();\n\n\t\t\t$sUrl = '';\n\t\t\t$sFolder = '';\n\t\t\tif (Phpfox::getParam('mail.threaded_mail_conversation'))\n\t\t\t{\t\t\t\t\n\t\t\t\tif ($bIsTrash)\n\t\t\t\t{\n\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail.trash');\t\t\t\t\t\n\t\t\t\t\t$this->search()->setCondition('AND m.owner_user_id = ' . Phpfox::getUserId() . ' AND m.is_archive = 1');\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif ($bIsSentbox)\n\t\t\t\t\t{\n\t\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail.sentbox');\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\t\t\t\t\t\n\t\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail');\t\t\t\t\t\t\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t$this->search()->setCondition('AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.is_archive = 0');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ($bIsTrash)\n\t\t\t\t{\n\t\t\t\t\t$sFolder = Phpfox::getPhrase('mail.trash');\n\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail.trash');\n\t\t\t\t\t$this->search()->setCondition('AND (m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 1) OR (m.owner_user_id = ' . Phpfox::getUserId() . ' AND m.owner_type_id = 1)');\t\t\t\t\t\n\t\t\t\t\t// $this->search()->setCondition('AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 1');\n\t\t\t\t}\n\t\t\t\telseif ($iPrivateBox)\n\t\t\t\t{\n\t\t\t\t\tif (isset($aFolders[$iPrivateBox]))\n\t\t\t\t\t{\n\t\t\t\t\t\t$sFolder = $aFolders[$iPrivateBox]['name'];\n\t\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail.box', array('id' => (int) $iPrivateBox));\n\t\t\t\t\t\t$this->search()->setCondition('AND m.viewer_folder_id = ' . (int) $iPrivateBox . ' AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 0');\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->url()->send('mail', null, Phpfox::getPhrase('mail.mail_folder_does_not_exist'));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif ($bIsSentbox)\n\t\t\t\t\t{\n\t\t\t\t\t\t$sFolder = Phpfox::getPhrase('mail.sent_messages');\n\t\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail.sentbox');\n\t\t\t\t\t\t$this->search()->setCondition('AND m.owner_user_id = ' . Phpfox::getUserId() . ' AND m.owner_type_id = 0');\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$sFolder = Phpfox::getPhrase('mail.inbox');\n\t\t\t\t\t\t$sUrl = $this->url()->makeUrl('mail');\n\t\t\t\t\t\t$this->search()->setCondition('AND m.viewer_folder_id = 0 AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 0');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tlist($iCnt, $aRows, $aInputs) = Phpfox::getService('mail')->get($this->search()->getConditions(), $this->search()->getSort(), $this->search()->getPage(), $iPageSize, $bIsSentbox, $bIsTrash);\n\n\t\t\tPhpfox::getLib('pager')->set(array(\n\t\t\t\t\t'page' => $iPage,\n\t\t\t\t\t'size' => $iPageSize,\n\t\t\t\t\t'count' => $iCnt\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\tPhpfox::getService('mail')->buildMenu();\n\t\t\t\n\t\t$aActions = array();\n\t\t$aActions[] = array(\n\t\t\t'phrase' => Phpfox::getPhrase('mail.delete'),\n\t\t\t'action' => 'delete'\n\t\t);\n\t\tif (!$bIsSentbox)\n\t\t{\n\t\t\t$aActions[] = array(\n\t\t\t\t'phrase' => Phpfox::getPhrase('mail.move'),\n\t\t\t\t'action' => 'move'\n\t\t\t);\n\t\t}\n\t\t\n\t\t$aModeration = array(\n\t\t\t\t'name' => 'mail',\n\t\t\t\t'ajax' => 'mail.moderation',\n\t\t\t\t'menu' => $aActions\n\t\t\t);\n\t\t\t\n\t\tif ($bIsSentbox)\n\t\t{\n\t\t\t$aModeration['custom_fields'] = '<div><input type=\"hidden\" name=\"sent\" value=\"1\" /></div>';\n\t\t}\n\t\telseif ($bIsTrash)\n\t\t{\n\t\t\t$aModeration['custom_fields'] = '<div><input type=\"hidden\" name=\"trash\" value=\"1\" /></div>';\n\t\t}\n\t\t\n\t\tif (Phpfox::getParam('mail.threaded_mail_conversation'))\n\t\t{\n\t\t\t$aModeration['ajax'] = 'mail.archive';\n\t\t\t\n\t\t\t$aMenuOptions = array();\n\t\t\tif ($bIsTrash)\n\t\t\t{\n\t\t\t\t$aMenuOptions = array(\n\t\t\t\t\t'phrase' => Phpfox::getPhrase('mail.un_archive'),\n\t\t\t\t\t'action' => 'un-archive'\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$aMenuOptions = array(\n\t\t\t\t\t'phrase' => Phpfox::getPhrase('mail.archive'),\n\t\t\t\t\t'action' => 'archive'\n\t\t\t\t);\n\t\t\t}\n\t\t\t\n\t\t\t$aModeration['menu'] = array($aMenuOptions,\n\t\t\t\tarray(\n\t\t\t\t\t'phrase' => Phpfox::getPhrase('mail.export'),\n\t\t\t\t\t'action' => 'export'\n\t\t\t\t)\t\t\t\t\t\n\t\t\t);\n\t\t}\n\t\t\t\n\t\t$this->setParam('global_moderation', $aModeration);\t\t\t\n\n\t\tif (empty($sFolder))\n\t\t{\n\t\t\t$sFolder = Phpfox::getPhrase('mail.mail');\n\t\t}\n\t\t$iMailSpaceUsed = 0;\n\t\tif ((!Phpfox::getUserParam('mail.override_mail_box_limit') && Phpfox::getParam('mail.enable_mail_box_warning')))\n\t\t{\n\t\t\t$iMailSpaceUsed = Phpfox::getService('mail')->getSpaceUsed(Phpfox::getUserId());\n\t\t}\t\t\n\t\t\n\t\t\t$this->template()->setTitle($sFolder)\n\t\t\t\t->setBreadcrumb(Phpfox::getPhrase('mail.mail'), $this->url()->makeUrl('mail'))\n\t\t\t\t->setPhrase(array(\n\t\t\t\t\t\t'mail.add_new_folder',\n\t\t\t\t\t\t'mail.adding_new_folder',\n\t\t\t\t\t\t'mail.view_folders',\n\t\t\t\t\t\t'mail.edit_folders',\n\t\t\t\t\t\t'mail.you_will_delete_every_message_in_this_folder',\n\t\t\t\t\t\t'mail.updating'\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t->setHeader('cache', array(\n\t\t\t\t\t\t'jquery/plugin/jquery.highlightFade.js' => 'static_script',\n\t\t\t\t\t\t'quick_edit.js' => 'static_script',\t\n\t\t\t\t\t\t'selector.js' => 'static_script',\n\t\t\t\t\t\t'mail.js' => 'module_mail',\n\t\t\t\t\t\t'pager.css' => 'style_css',\n\t\t\t\t\t\t'mail.css' => 'style_css'\n\t\t\t\t\t)\n\t\t\t\t)\t\t\t\n\t\t\t\t->assign(array(\n\t\t\t\t\t'aMails' => $aRows,\n\t\t\t\t\t'bIsSentbox' => $bIsSentbox,\n\t\t\t\t\t'bIsTrash' => $bIsTrash,\n\t\t\t\t\t'aInputs' => $aInputs,\n\t\t\t\t\t'aFolders' => $aFolders,\n\t\t\t\t\t'iMailSpaceUsed' => $iMailSpaceUsed,\n\t\t\t\t\t'iMessageAge' => Phpfox::getParam('mail.message_age_to_delete'),\n\t\t\t\t\t'sUrl' => $sUrl,\n\t\t\t\t\t'iFolder' => (isset($aFolders[$iPrivateBox]['folder_id']) ? $aFolders[$iPrivateBox]['folder_id'] : 0),\n\t\t\t\t\t'iTotalMessages' => $iCnt,\n\t\t\t\t\t'sSiteName' => Phpfox::getParam('core.site_title'),\n\t\t\t\t\t'bIsInLegacyView' => $bIsInLegacyView\n\t\t\t\t)\n\t\t\t);\n\t}",
"public function process_queue()\r\n {\r\n error_reporting(0);\r\n\r\n // TODO: Prefill information is stored in this array. It's nasty, but it works for now.\r\n // This will need to be cleaned up somehow, later.\r\n $this->prefillRequests = array();\r\n\r\n $this->parseResponses();\r\n\r\n // Array of keys that need to be included in the response.\r\n $include = array('request', 'class', 'hit');\r\n $responseQuery = [];\r\n foreach($this->messageQuery as $response) {\r\n // Switch all keys to lower case to prevent possible case errors.\r\n $responseArr = array_change_key_case($response, CASE_LOWER);\r\n // returns an array that intersects with the keys from the $include array\r\n $responseQuery[] = array_intersect_key($responseArr, array_flip($include));\r\n }\r\n\r\n $requestSummary = $this->ArchiveResponse->ArchiveRequest->Request->getSummary(\r\n $this->CurrentAgency->agencyId,\r\n $this->CurrentDevice->agencyDeviceId);\r\n\r\n $summary = array(\r\n 'requests' => $requestSummary,\r\n 'response' => $responseQuery,\r\n 'prefill' => $this->prefillRequests\r\n );\r\n $this->set('summary', $summary);\r\n }",
"public function process()\n\t{\n\t\t$aValidation = array(\n\t\t\t'message' => Phpfox::getPhrase('mail.add_reply')\n\t\t);\t\t\t\t\n\n\t\t$oValid = Phpfox::getLib('validator')->set(array(\n\t\t\t\t'sFormName' => 'js_form', \n\t\t\t\t'aParams' => $aValidation\n\t\t\t)\n\t\t);\t\t\t\t\n\t\n\t\t$aMail = Phpfox::getService('mail')->getMail($this->request()->getInt('id'));\t\n\t\t\n\t\tif (!isset($aMail['mail_id']))\n\t\t{\n\t\t\treturn Phpfox_Error::display(Phpfox::getPhrase('mail.invalid_message'));\n\t\t}\n\t\t\n\t\t$bCanView = false;\n\t\tif (($aMail['viewer_user_id'] == Phpfox::getUserId()) || ($aMail['owner_user_id'] == Phpfox::getUserId()))\n\t\t{\n\t\t\t$bCanView = true;\t\t\t\n\t\t}\n\t\t\n\t\tif ($bCanView === false)\n\t\t{\n\t\t\treturn Phpfox_Error::display(Phpfox::getPhrase('mail.invalid_message'));\n\t\t}\n\t\t\n\t\tif ($aVals = $this->request()->getArray('val'))\n\t\t{\t\t\t\n\t\t\tif ($oValid->isValid($aVals))\n\t\t\t{\n\t\t\t\t$aVals['to'] = $aMail['owner_user_id'];\n\t\t\t\t\n\t\t\t\tif (($iNewId = Phpfox::getService('mail.process')->add($aVals)))\n\t\t\t\t{\n\t\t\t\t\t$this->url()->send('mail.view', array('id' => $iNewId));\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t\t\n\t\tif ($aMail['viewer_user_id'] == Phpfox::getUserId())\n\t\t{\n\t\t\tPhpfox::getService('mail.process')->toggleView($aMail['mail_id'], false);\n\t\t}\n\t\t\n\t\t$this->template()->assign(array(\n\t\t\t\t'bMobileInboxIsActive' => true,\n\t\t\t\t'aMail' => $aMail\n\t\t\t)\n\t\t);\n\t}",
"public function runQueue();",
"public function processQueue ()\n {\n $lastRestartTime = $this->getLastRestartTime();\n $app = Application::getInstance();\n\n while ( true ) {\n //check if the code is updated in between the run time\n $this->needsRestart($lastRestartTime);\n\n //check if the system is down for maintenance\n if ( $app->isDownForMaintenance() ) continue;\n\n //get all pending events for the period\n $events = $this->getPendingEvents();\n\n foreach ( $events as $event ) {\n $event->start_time = DateUtil::getDateTime();\n\n //no event is registered for the given record\n $handler = $event->event_detail;\n if ( !$handler ) {\n $this->saveEvent($event);\n continue;\n }\n\n //set event to broadcast of its event\n event(new EventQueueRaised($event));\n\n //process the job mentioned with the event\n $this->dispatchEventJob($event);\n\n //dispatch notification if any attached to the event\n $this->dispatchNotificationJob($event);\n\n //save the given event with necessary datetime params\n $this->saveEvent($event);\n }\n\n //check if the program has to sleep or not\n if ( !sizeof($events) ) $this->rest();\n\n Cache::forever($this->identifier, false);\n }\n }",
"public function send_queue()\n\t{\n\t\t$sql = 'SELECT *\n\t\t\t\tFROM ' . SQL_PREFIX . 'notify\n\t\t\t\tORDER BY notify_time';\n\t\t$result = Fsb::$db->query($sql, 'notify_');\n\t\tif ($row = Fsb::$db->row($result))\n\t\t{\n\t\t\t// Suppression des elements directement, afin d'eviter un double envoie\n\t\t\t$sql = 'DELETE FROM ' . SQL_PREFIX . 'notify';\n\t\t\tFsb::$db->query($sql);\n\t\t\tFsb::$db->destroy_cache('notify_');\n\n\t\t\t// Envoie du message\n\t\t\tdo\n\t\t\t{\n\t\t\t\t$this->method = (isset($this->ext[$row['notify_method']])) ? $row['notify_method'] : NOTIFY_MAIL;\n\t\t\t\t$this->subject = $row['notify_subject'];\n\t\t\t\t$this->body = $row['notify_body'];\n\t\t\t\t$this->bcc = explode(\"\\n\", $row['notify_bcc']);\n\t\t\t\t$return = $this->send(false);\n\t\t\t\t$this->reset();\n\n\t\t\t\t// En cas d'echec du message on le reinsere dans la base de donnee\n\t\t\t\tif (!$return && $row['notify_try'] < Notify::MAX_TRY)\n\t\t\t\t{\n\t\t\t\t\t$row['notify_try']++;\n\t\t\t\t\tunset($row['notify_id']);\n\t\t\t\t\tforeach ($row AS $k => $v)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (is_numeric($k))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tunset($row[$k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tFsb::$db->insert('notify', $row, 'INSERT', true);\n\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile ($row = Fsb::$db->row($result));\n\t\t\tFsb::$db->query_multi_insert();\n\t\t}\n\t\tFsb::$db->free($result);\n\t}",
"public function processQueue()\r\n {\r\n //Set items to 0\r\n $this->totalItems = 0;\r\n\r\n //Set priority\r\n $this->_setPriority();\r\n\r\n //Check previous import status\r\n $this->_checkImportStatus();\r\n\r\n $enabledWebsiteIds = $this->getEnabledWebsiteIds();\r\n\r\n //Bulk priority. Process Contact Bulk first\r\n foreach ($this->bulkPriority as $bulk) {\r\n if ($this->totalItems < self::TOTAL_IMPORT_SYNC_LIMIT) {\r\n // only Contact imports have a bulk limit\r\n $bulkLimit = isset($bulk['limit']) ? $bulk['limit'] - $this->totalItems : self::TOTAL_IMPORT_SYNC_LIMIT - $this->totalItems;\r\n $collection = $this->_getQueue(\r\n $bulk['type'],\r\n $bulk['mode'],\r\n $bulkLimit,\r\n $enabledWebsiteIds\r\n );\r\n if ($collection->getSize()) {\r\n $this->totalItems += count($collection);\r\n $bulkModel = Mage::getModel($bulk['model']);\r\n $bulkModel->processCollection($collection);\r\n }\r\n }\r\n }\r\n\r\n //reset total items\r\n $this->totalItems = 0;\r\n\r\n //Single/Update priority\r\n foreach ($this->singlePriority as $single) {\r\n if ($this->totalItems < self::TOTAL_IMPORT_SYNC_LIMIT) {\r\n $collection = $this->_getQueue(\r\n $single['type'],\r\n $single['mode'],\r\n self::TOTAL_IMPORT_SYNC_LIMIT - $this->totalItems,\r\n $enabledWebsiteIds\r\n );\r\n if ($collection->getSize()) {\r\n $this->totalItems += count($collection);\r\n $singleModel = Mage::getModel($single['model']);\r\n $singleModel->processCollection($collection);\r\n }\r\n }\r\n }\r\n\r\n return array('message' => 'Done.');\r\n }",
"public function execute()\n {\n\n $undeliveredRecipients = array();\n $recipientsCount = 0;\n\n while (count($this->recipients) >= 1) {\n\n //send the command and read the response\n parent::execute();\n\n $recipient = array_pop($this->recipients);\n\n switch ($this->response->getCode()) {\n\n case '250':\n case '251':\n if (isset($recipient['original_email'])) {\n //we finally delivered mail to a user that provided a \n //forward-address\n $key = array_search($recipient['original_email'],\n $undeliveredRecipients);\n\n if ($key !== FALSE)\n unset($undeliveredRecipients[$key]);\n }\n\n $recipientsCount++;\n break;\n\n case '450':\n case '451':\n //add the recipient to the begginning of the queue to try again\n //later\n if ($recipient['retries'] > 0) {\n $recipient['retries']--;\n array_unshift($this->recipients, $recipient);\n }\n break;\n\n /* Handle too much recipients by splitting the message to chunks\n *\n * RFC 821 [30] incorrectly listed the error where an SMTP server\n * exhausts its implementation limit on the number of RCPT commands\n * (\"too many recipients\") as having reply code 552. The correct \n * reply code for this condition is 452. Clients SHOULD treat a \n * 552 code in this case as a temporary, rather than permanent, \n * failure so the logic below works. \n */\n case '452':\n case '552':\n array_push($this->recipients, $recipient);\n\n $result['undelivered'] = $undeliveredRecipients;\n //this causes the client to append a new mail sending sequence \n //for the rest of recipients\n $result['toDeliver'] = $this->recipients;\n $result['recipientsCount'] = $recipientsCount;\n\n return $result;\n break; //unreachable\n\n case '550':\n case '553':\n $undeliveredRecipients[] = $recipient['email'];\n break;\n\n case '551':\n if (preg_match('/<\\([^>]*\\)>/', $this->response, $matches)) {\n\n $forward = array();\n $forward['email'] = $matches[1];\n $forward['retries'] = 2;\n if (isset($recipient['original_email'])) {\n $forward['original_email'] = \n $recipient['original_email'];\n } else {\n $forward['original_email'] = $recipient['email'];\n $undeliveredRecipients[] = $recipient['email'];\n }\n\n $this->recipients[] = $forward;\n }\n break;\n }\n\n }\n\n return array(\n 'undelivered' => $undeliveredRecipients, \n 'recipientsCount' => $recipientsCount,\n );\n }",
"public function processMessages() {\n while ( ( $execution = array_shift($this->queue) ) ) { \n $execution->event('continue');\n $this->messagesDelivered++;\n }\n }",
"function mail_queue($email = [])\n\t{\n\t\t$ci = &get_instance();\n\t\t$email = is_array($email) ? (object)$email : $email; \n\n\t\t$email->is_test = IS_LOCAL ? '1' : '0';\n\t\t$email->created_at = date('Y-m-d H:i:s');\n\t\tif (isset($email->_attachment)) {\n\t\t\tif (is_array($email->_attachment))\n\t\t\t\t$email->_attachment = json_encode($email->_attachment);\n\t\t\telseif (is_object($email->_attachment))\n\t\t\t\t$email->_attachment = json_encode((array)$email->_attachment);\n\t\t\telse \n\t\t\t\t$email->_attachment = json_encode([$email->_attachment]);\n\t\t}\n\n\t\tif (!$result = $ci->db->insert('mail_queue', $email))\n\t\t\treturn [FALSE, ['message' => 'Database Error: '.$ci->db->error()['message']]];\n\t\t\n\t\treturn [TRUE, NULL];\n\t}",
"public function Queues();",
"public function main()\n {\n try {\n $lock = new FileLock('fetchmail_' . md5(__FILE__) . '.lock');\n } catch (MutexException $e) {\n $this->warn($e->getMessage());\n\n return null;\n }\n\n if (!$lock->lock()) {\n $this->warn('Fetching mail is already in progress');\n\n return null;\n }\n\n /** @var MailboxesTable $table */\n $table = TableRegistry::getTableLocator()->get('MessagingCenter.Mailboxes');\n Assert::isInstanceOf($table, MailboxesTable::class);\n\n $limit = empty($this->params['limit']) ? null : (int)$this->params['limit'];\n $since = null;\n\n if (!empty($this->params['since'])) {\n $time = strtotime($this->params['since']);\n if ($time !== false) {\n $since = (int)$time;\n }\n }\n\n $activeMailboxes = $table->getActiveMailboxes((string)MailboxType::EMAIL());\n foreach ($activeMailboxes as $mailbox) {\n $this->processMailbox($mailbox, $since, $limit);\n }\n }",
"public function queue() {\n\t\t$this->prepareMessage();\n\t\t$this->queueRepository->add($this->toArray());\n\t}",
"public function action_sendmails(){\r\n\t\techo 'Send mails from queue'.\"\\n\";\n\t\t$mails = Model_Mail::getQueuedToSend();\n\t\t$swiftMail = email::connect();\r\n\t\t\t\t\n\t\tforeach ($mails as $mail)\n\t\t{\n\t\t\t$message = new Swift_Message();\n\t\t\t$message->setFrom(array($mail->from));\n\t\t\t$message->setBody($mail->content,'text/html');\n\t\t\t$message->setTo(array($mail->to));\n\t\t\t$message->setSubject($mail->title);\n\t\t\t\n\t\t\t$result = $swiftMail->send($message);\n\t\t\tif ($result)\n\t\t\t{\n\t\t\t\tModel_Mail::setSent($mail->id);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\techo 'Sended '.count($mails).' e-mail'.\"\\n\";\r\n\t}",
"function send()\n\t{\n\t\tif (!$this->toemail)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$vbulletin =& $this->registry;\n\n\t\t$data = \"\n\t\t\t(\" . TIMENOW . \",\n\t\t\t'\" . $vbulletin->db->escape_string($this->toemail) . \"',\n\t\t\t'\" . $vbulletin->db->escape_string($this->fromemail) . \"',\n\t\t\t'\" . $vbulletin->db->escape_string($this->subject) . \"',\n\t\t\t'\" . $vbulletin->db->escape_string($this->message) . \"',\n\t\t\t'\" . $vbulletin->db->escape_string($this->headers) . \"')\n\t\t\";\n\n\t\tif ($this->bulk)\n\t\t{\n\t\t\tif (!empty($this->mailsql))\n\t\t\t{\n\t\t\t\t$this->mailsql .= ',';\n\t\t\t}\n\n\t\t\t$this->mailsql .= $data;\n\t\t\t$this->mailcounter++;\n\n\t\t\t// current insert exceeds half megabyte, insert it and start over\n\t\t\tif (strlen($this->mailsql) > 524288)\n\t\t\t{\n\t\t\t\t$this->set_bulk(false);\n\t\t\t\t$this->set_bulk(true);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t/*insert query*/\n\t\t\t$vbulletin->db->query_write(\"\n\t\t\t\tINSERT INTO \" . TABLE_PREFIX . \"mailqueue\n\t\t\t\t\t(dateline, toemail, fromemail, subject, message, header)\n\t\t\t\tVALUES\n\t\t\t\t\" . $data\n\t\t\t);\n\n\t\t\t$vbulletin->db->query_write(\"\n\t\t\t\tUPDATE \" . TABLE_PREFIX . \"datastore SET\n\t\t\t\t\tdata = data + 1\n\t\t\t\tWHERE title = 'mailqueue'\n\t\t\t\");\n\n\t\t\t// if we're using a alternate datastore, we need to give it an integer value\n\t\t\t// this may not be atomic\n\t\t\tif (method_exists($vbulletin->datastore, 'build'))\n\t\t\t{\n\t\t\t\t$mailqueue_db = $vbulletin->db->query_first(\"\n\t\t\t\t\tSELECT data\n\t\t\t\t\tFROM \" . TABLE_PREFIX . \"datastore\n\t\t\t\t\tWHERE title = 'mailqueue'\n\t\t\t\t\");\n\t\t\t\t$vbulletin->datastore->build('mailqueue', intval($mailqueue_db['data']));\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}",
"protected function processClearCacheQueue() {}",
"public function processQueue($schedule) {\n \tMage::getModel('avatax_records/queue_process')->run();\n }",
"function process_mail(){\n\t\t$result = true;\n\t\t\n\t\tif(count($this->to) < 1){\n\t\t\treturn 'No email address.';\n\t\t}\n\t\t$this->set_eol();\n\t\t$this->get_message_type();\n\t\t$this->set_boundary();\n\t\t$headers = $this->set_headers();\n\t\t$body = $this->set_body();\n\t\t\n\t\tif($body == ''){\n\t\t\treturn 'Empty email body.';\n\t\t}\n\t\t$result = $this->send_mail($headers, $body);\n\t\treturn $result;\n\t}",
"protected function queueEmailMsg($playbook) {\r\n // $currentTime = time();\r\n $subEmailPlaybook = SubEmailPlaybook::where([\r\n 'playbook_email_id' => $playbook->id,\r\n 'message_level' => $playbook->message_sent_level\r\n ])\r\n // ->where('message_sent_at', '<=', $currentTime)\r\n ->first();\r\n \r\n $messageController = new MessageController();\r\n\r\n if ($subEmailPlaybook && isset($playbook->last_message_sent_at)) {\r\n $smsContact = SmsContact::where(['playbook_id'=> $playbook->id, 'playbook_type' => 'EMAIL'])->first();\r\n \r\n $last_message_sent_at = $playbook->last_message_sent_at;\r\n $format = 'Y-m-d H:i';\r\n // send next message on next schedule days\r\n if ($subEmailPlaybook->sendemailafter) {\r\n $date = date($format, $last_message_sent_at);\r\n $last_message_sent_at = strtotime($date.\"+ $subEmailPlaybook->sendemailafter days\");\r\n }\r\n\r\n // skip message on weekend\r\n if($playbook->sendingon_weekdays_only > 0)\r\n {\r\n $addDays = $messageController->isWeekend($last_message_sent_at);\r\n if($addDays > 0){\r\n $date = date($format, $last_message_sent_at);\r\n $last_message_sent_at = strtotime($date.\"+ $addDays days\");\r\n }\r\n }\r\n\r\n // set message time \r\n if($playbook->adTime)\r\n { \r\n $date = date('Y-m-d', $last_message_sent_at);\r\n $last_message_sent_at = strtotime($date.' '.$playbook->adTime);\r\n }\r\n\r\n // get all contact ids whose created date is less than playbook activated date\r\n // remove these ids from actual contacts ids\r\n // $contact_ids = json_decode($smsContact->contact_ids, true);\r\n // $playbook_activated_at = $playbook->playbook_activated_at;\r\n // $playbook_activated_at = date('Y-m-d H:i:s', $playbook_activated_at);\r\n // $playbookContactDetails = SegmentContactsModel::select('subscriber_invitee_id')\r\n // ->whereIn('subscriber_invitee_id', $contact_ids)\r\n // ->where('created_at', '>=', $playbook_activated_at)\r\n // ->get();\r\n // $new_contact_ids = []; \r\n \r\n // if (count($playbookContactDetails) > 0) {\r\n // // Log::info('segment new contact added '.print_r($playbookContactDetails, true));\r\n // foreach ($playbookContactDetails as $value) {\r\n // // Log::info('value in loop '.$value);\r\n // $new_contact_ids[] = $value->subscriber_invitee_id;\r\n // if (in_array($value->subscriber_invitee_id, $contact_ids)) {\r\n // if (($key = array_search($value->subscriber_invitee_id, $contact_ids)) !== false) {\r\n // unset($contact_ids[$key]);\r\n // }\r\n // $contact_ids = array_values($contact_ids);\r\n // }\r\n // }\r\n // }\r\n\r\n // get all contact details\r\n $contactDetails = $messageController->getContact($contact_ids);\r\n // add message on queue\r\n if ($contactDetails) {\r\n $messageController->addMessageOnQueue($playbook->user_id, $contactDetails, $subEmailPlaybook, $last_message_sent_at);\r\n }\r\n }\r\n \r\n }",
"public function handleQueuedMailerSender($job, $data)\n {\n\n // по умолчанию не пропускаем задачу\n $skipJob = false;\n\n $isSend = false;\n\n // Получаем id задачи в очереди\n $jobId = $job->getId();\n\n // Если задача и не занята воркером и не блокирована и не выполнена\n /** @var QueueList $queue */\n $queue = QueueList::findFirst(\"jobId = '{$jobId}' AND workerPid = 0 AND status = 0 AND lock = 0\");\n\n // Если нашли строчку в БД\n if($queue){\n\n echo \"Catch jobId: {$jobId}\".PHP_EOL;\n\n // Лочим задачу\n if($queue->setWorkerPid(posix_getpid())->setLock(1)->save() == false){\n\n $skipJob = true;\n\n } else {\n /** @var EmailList $email */\n $email = EmailList::findFirstById($queue->getEmailId());\n\n /** @var MessagesTemplates $message */\n $message = MessagesTemplates::findFirstById($queue->getMessageId());\n\n // Формируем кому отправлять\n $from = [\n 'address' => $email->getName() !== \"N/A\" ? [ $email->getAddress() => $email->getName() ] : $email->getAddress(),\n 'subject' => $message->getSubject()\n ];\n\n echo \"Sending at: \". $email->getAddress().\" the userId \".$email->getUserId().PHP_EOL;\n\n // Формируем путь к шаблону\n $messageTemplate = $this->getPath($queue->getUserId()) .\n $this->getFilename([\n 'userId' => $queue->getUserId(),\n 'messageId' => $queue->getMessageId(),\n 'categoryId' => $queue->getCategoryId()\n ], \"\");\n\n // Данные для volt шаблонизатора {{ username }}\n $dataVolt = [\n 'username' => $email->getName()\n ];\n\n// try{\n//\n// // Отправляем письмо\n// $isSend = $this->send($messageTemplate, $dataVolt, function($message) use($from) {\n// $message->to($from['address']);\n// $message->subject($from['subject']);\n// });\n//\n// // Получаем транспорт\n// $transport = $this->getSwiftMailer()->getTransport();\n//\n// // Если запущен, то останавливаем\n// if($transport->isStarted()){\n// $transport->stop();\n// }\n//\n// } catch(\\Exception $e){\n// $queue->setErrors($e->getMessage());\n// }\n\n $isSend = true;\n }\n }\n\n // Если отправили то сообщаем об отправке\n if($isSend){\n\n // Удаляем с очереди\n $job->delete();\n\n // Помечаем здание как выполненное\n $queue->setStatus('sends')->setLock(0);\n\n if($queue->update() == false){\n echo \"Error: \".$queue->getMessages().PHP_EOL;\n }\n\n /** @var Queuing $Queuing */\n $Queuing = Queuing::findFirstById($queue->getQueueId());\n\n // Сохраняем данные очереди\n $Queuing->setCurrent($Queuing->getCurrent()+1)->setStatus(1);\n\n if($Queuing->update() == false){\n echo \"Error: \".$queue->getMessages().PHP_EOL;\n }\n\n echo \"Done jobId: {$jobId}\".PHP_EOL;\n\n } elseif($isSend == false) { // Иначе сообщаем о пропуске\n\n $job->delete();\n\n // Помечаем задучу как снятую с очереди и снимаем блокировку\n $queue->setStatus('cancel')->setLock(0);\n\n if($queue->update() == false){\n echo \"Error: \".$queue->getMessages().PHP_EOL;\n }\n\n echo \"Error sending jobId: {$jobId}\".PHP_EOL;\n\n } elseif($skipJob) {\n\n $job->delete();\n\n echo \"Skipping job Id: {$jobId}\".PHP_EOL;\n }\n\n }",
"public function execute()\n {\n foreach ($this->queue->pull(1000) as $message) {\n $this->process($message)->delete();\n }\n }",
"public function scheduledemails(){\n foreach ($this->framework->getProjectsWithModuleEnabled() as $projectId){\n $_GET['pid'] = $projectId; // might change in future to $this->setProjectId($projectId);\n if($projectId != \"\") {\n $this->deleteOldLogs($projectId);\n if(!$this->isProjectStatusCompleted($projectId)) {\n $this->log(\"scheduledemails PID: \" . $projectId . \" - start\", ['scheduledemails' => 1]);\n $email_queue = $this->getProjectSetting('email-queue', $projectId);\n if ($email_queue != '') {\n $email_sent_total = 0;\n foreach ($email_queue as $index => $queue) {\n if (\n $queue['record'] != '' &&\n $email_sent_total < 100 &&\n !$this->hasQueueExpired($queue, $index, $projectId) &&\n $queue['deactivated'] != 1\n ) {\n if ($this->getProjectSetting(\n 'email-deactivate',\n $projectId\n )[$queue['alert']] != \"1\" &&\n $this->sendToday($queue, $projectId)\n ) {\n $this->log(\n \"scheduledemails PID: \" .\n $projectId .\n \" - Has queued emails to send today \" .\n date(\"Y-m-d H:i:s\"),\n ['scheduledemails' => 1]\n );\n #SEND EMAIL\n $email_sent = $this->sendQueuedEmail(\n $index,\n $projectId,\n $queue['record'],\n $queue['alert'],\n $queue['instrument'],\n $queue['instance'],\n $queue['isRepeatInstrument'],\n $queue['event_id']\n );\n #If email sent save date and number of times sent and delete queue if needed\n if ($email_sent || $email_sent == \"1\") {\n $email_sent_total++;\n }\n #Check if we need to delete the queue\n $this->stopRepeat($queue, $index, $projectId);\n }\n } else if ($email_sent_total >= 100) {\n $this->log(\n \"scheduledemails PID: \" .\n $projectId .\n \" - Batch ended at \" .\n date(\"Y-m-d H:i:s\"),\n ['scheduledemails' => 1]\n );\n break;\n }\n }\n }\n }\n }\n }\n }",
"protected function processQueues() {\n $original_session_saving = drupal_save_session();\n drupal_save_session(FALSE);\n\n // Force the current user to anonymous to ensure consistent permissions on\n $original_user = $GLOBALS['user'];\n $GLOBALS['user'] = drupal_anonymous_user();\n\n $return = FALSE;\n\n // Try to acquire cron lock.\n if (!lock_acquire('cron', 240.0)) {\n // Cron is still running normally.\n return watchdog('cron', 'Attempting to re-run cron while it is already running.', array(), WATCHDOG_WARNING);\n }\n\n //Grab the defined cron queues.\n $queues = $this->infoQueues;\n //$queues = module_invoke_all('cron_queue_info');\n drupal_alter('cron_queue_info', $queues);\n\n // Make sure every queue exists. There is no harm in trying to recreate an existing queue.\n foreach ($queues as $queue_name => $info) {\n DrupalQueue::get($queue_name)->createQueue();\n }\n // Iterate through the modules calling their cron handlers (if any):\n foreach (module_implements('cron') as $module) {\n // Do not let an exception thrown by one module disturb another.\n try {\n module_invoke($module, 'cron');\n }\n catch (Exception $e) {\n watchdog_exception('cron', $e);\n }\n }\n\n // Record cron time.\n variable_set('cron_last', REQUEST_TIME);\n watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE);\n // Release cron lock.\n lock_release('cron');\n // Return TRUE so other functions can check if it did run successfully\n $return = TRUE;\n\n foreach ($queues as $queue_name => $info) {\n if (!empty($info['skip on cron'])) {\n // Do not run if queue wants to skip.\n continue;\n }\n\n $callback = $info['worker callback'];\n $end = time() + (isset($info['time']) ? $info['time'] : 15);\n $queue = DrupalQueue::get($queue_name);\n\n while (time() < $end && ($item = $queue->claimItem())) {\n try {\n call_user_func($callback, $item->data);\n $queue->deleteItem($item);\n }\n catch (Exception $e) {\n // In case of exception log it and leave the item in the queue to be processed again later.\n watchdog_exception('cron', $e);\n }\n }\n }\n\n // Restore the user.\n $GLOBALS['user'] = $original_user;\n drupal_save_session($original_session_saving);\n\n return $return;\n }",
"abstract protected function _sendMail ( );"
]
| [
"0.7930832",
"0.76679206",
"0.6639054",
"0.65608805",
"0.6526934",
"0.6508077",
"0.650692",
"0.649666",
"0.6442103",
"0.6407312",
"0.6387903",
"0.6366192",
"0.63124305",
"0.62754923",
"0.62521124",
"0.6211839",
"0.6200173",
"0.6181114",
"0.6107626",
"0.6097427",
"0.60280704",
"0.6025271",
"0.60227203",
"0.6004416",
"0.6001026",
"0.5982289",
"0.59817517",
"0.5963594",
"0.5959195",
"0.594721"
]
| 0.8435674 | 0 |
/ Load a ACP template file / Load an ACP skin template file for use | function acp_load_template( $template )
{
if ( ! $this->skin_acp )
{
$this->skin_acp = 'IPB2_Standard';
}
require_once( ROOT_PATH."skin_acp/".$this->skin_acp."/acp_skin_html/".$template.".php" );
$tmp = new $template();
$tmp->ipsclass =& $this;
return $tmp;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function loadTemplate() {\n\t\t\tinclude('template.inc.php');\n\t\t\t$this->mainTemplate = new Template();\n\t\t\t$this->mainTemplate->readTpl('main');\n\t\t}",
"public function loadTemplate()\n\t\t{\n\t\t}",
"public function LoadTemplate($sFilename) {\t\t\n\t}",
"function load_template($_template_file, $load_once = \\true, $args = array())\n {\n }",
"private function load_template()\r\n\t{\r\n\t\tif(! $this -> loaded)\r\n\t\t{\r\n\t\t\t$controller = $this -> sp -> targetdir().\"/\".sp_StaticProjector::templates_dir.\"/\".$this->name.\"_controller.php\";\r\n\t\t\tsp_StaticRegister::push_object(\"sp\", $this -> sp);\r\n\t\t\t\r\n\t\t\tif(!file_exists($controller))\r\n\t\t\t{\r\n $controller = $this -> sp -> coretemplatesdir().\"/\".$this->name.\"_controller.php\";\r\n if(! file_exists($controller)) {\r\n $controller = $this -> sp -> coretemplatesdir().\"/default_controller.php\";\r\n }\r\n\t\t\t\t/*if($this -> name == \"default\")\r\n\t\t\t\t{\r\n\t\t\t\t\t$default_controller = $this -> sp -> defaultsdir().\"/default_controller.php\";\r\n\t\t\t\t\t@copy($default_controller, $controller);\r\n\t\t\t\t\tchmod($controller,sp_StaticProjector::file_create_rights);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t$base_code = file_get_contents($this -> sp -> defaultsdir().\"/new_controller.txt\");\r\n\t\t\t\t\t$controller_code = str_replace(\"%controller_name%\", $this->name.\"_controller\", $base_code);\r\n\t\t\t\t\tfile_put_contents($controller, $controller_code);\r\n\t\t\t\t}*/\r\n\t\t\t}\r\n\t\t\trequire_once($controller);\r\n\r\n\t\t\t$template = $this -> sp -> targetdir().\"/\".sp_StaticProjector::templates_dir.\"/\".$this->name.\"_template.php\";\r\n\t\t\tif(!file_exists($template))\r\n\t\t\t{\r\n $template = $this -> sp -> coretemplatesdir().\"/\".$this->name.\"_template.php\";\r\n if(! file_exists($template)) {\r\n $template = $this -> sp -> coretemplatesdir().\"/default_template.php\";\r\n }\r\n\t\t\t\t/*if($this -> name == \"default\")\r\n\t\t\t\t{\r\n\t\t\t\t\t$default_template = $this -> sp -> defaultsdir().\"/default_template.php\";\r\n\t\t\t\t\t@copy($default_template, $template);\r\n\t\t\t\t\tchmod($template,sp_StaticProjector::file_create_rights);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t$chunks_code = \"\";\r\n\t\t\t\t\t$chunk_base = file_get_contents($this -> sp -> defaultsdir().\"/new_template_chunk.txt\");\r\n\t\t\t\t\tforeach($this -> sp -> get_config() -> default_templates_chunks() as $chunk)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$chunks_code .= str_replace(\"%chunk_name%\",$chunk,$chunk_base);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t$template_base = file_get_contents($this -> sp -> defaultsdir().\"/new_template.txt\");\r\n\t\t\t\t\t$template_code = str_replace(\"%template_name%\", $this -> name.\"_template\", $template_base);\r\n\t\t\t\t\t$template_code = str_replace(\"%template_chunks%\", $chunks_code, $template_code);\r\n\t\t\t\t\tfile_put_contents($template, $template_code);\r\n\t\t\t\t}*/\r\n\t\t\t}\r\n\t\t\trequire_once($template);\r\n\t\t\tsp_StaticRegister::pop_object(\"sp\");\r\n\t\t\t\r\n\t\t\t$this -> loaded = true;\r\n\t\t}\r\n\t}",
"public function setTemplate($file);",
"public function loadTemplate($path);",
"function zr_template_load( $template ){ \n\tif( !is_user_logged_in() && zr_options('maintaince_enable') ){\n\t\t$template = ZRPATH . 'includes/maintaince/maintaince.php';\n\t}\n\treturn $template;\n}",
"function Template()\r\n\t{\t\t\r\n\t\tglobal $_REQUEST;\t\t\r\n\t\t$theme = $this->theme;\r\n\t\t/*** Get Template By Page Id ***/\r\n\t\t$file = $this->get_template();\r\n\t\t\r\n\t\tif($_SETTINGS['debug'] == 1){\r\n\t\t\techo \"TEMPLATE: \".$file.\" <Br>\";\r\n\t\t}\r\n\t\t\r\n\t\t$websitepath = $this->website_path;\r\n\t\t//die(\"FILE: $file\");\r\n\t\t//exit();\r\n\t\tinclude''.$_SERVER['DOCUMENT_ROOT'].$websitepath.'themes/'.$theme.''.$file.'';\r\n\t}",
"function loadTemplate( $title ) {\n global $wgUser, $wgParser, $wgTitle;\n \n # Load the template article for this skin\n $article = new Article( Title::newFromText( $title ) );\n if ( $article ) {\n $template = $article->fetchContent(0,false,false);\n if ( $template ) {\n # Drop leading and trailing blanks and escape delimiter before parsing\n # Substitute a few skin-related variables before parsing\n $template = preg_replace('/(^\\s+|\\s+$)/m', '', $template );\n $template = str_replace( DELIM.DELIM.DELIM, \"\\x07\", $template);\n $template = preg_replace('/'.DELIM.DELIM.'(.*?)'.DELIM.DELIM.'/e',\n 'translate_variable( $1 )', $template );\n \n # Use the parser preprocessor to evaluate conditionals in the template\n # Copy the parser to make sure we don't trash the parser state too much\n $lparse = clone $wgParser;\n $template = $lparse->parse( $template, $wgTitle, ParserOptions::newFromUser($wgUser) );\n $template = str_replace( ' ', ' ', $template->getText() );\n return $template ;\n }\n }\n return '';\n}",
"function testLoadTemplatefile()\n {\n $result = $this->tpl->loadTemplatefile('loadtemplatefile.html', false, false);\n if (PEAR::isError($result)) {\n $this->assertTrue(false, 'Error loading template file: '. $result->getMessage());\n }\n $this->assertEquals('A template', trim($this->tpl->get()));\n }",
"function load_templates( $template ) {\n\n if ( is_singular( 'units' ) ) {\n \tif ( $overridden_template = locate_template( 'single-units.php' ) ) {\n\t\t\t $template = $overridden_template;\n\t\t\t } else {\n\t\t\t $template = plugin_dir_path( __file__ ) . 'templates/single-units.php';\n\t\t\t }\n } elseif ( is_archive( 'units' ) ) {\n \tif ( $overridden_template = locate_template( 'archive-units.php' ) ) {\n\t\t\t $template = $overridden_template;\n\t\t\t } else {\n\t\t\t $template = plugin_dir_path( __file__ ) . 'templates/archive-units.php';\n\t\t\t }\n }\n load_template( $template );\n\t}",
"private function _load_template()\n\t\t{\n\t\t\t//check for a custom template\n\t\t\t$template_file = 'views/'.$this->template_file.'.tpl';\n\n\n\t\t\tif(file_exists($template_file) && is_readable($template_file))\n\t\t\t{\n\t\t\t\t$path = $template_file;\n\t\t\t}\n\t\t\telse if(file_exists($default_file = 'views/error/index.php') && is_readable($default_file))\n\t\t\t{\n\t\t\t\t$path = $default_file;\n\t\t\t}\n\n\t\t\t//If the default template is missing, throw an error\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new Exception(\"No default template found\");\n\t\t\t}\n\n\n\t\t\t//Load the contents of the file and return them\n\t\t\t$this->_template = file_get_contents($path);\n\n\t\t}",
"function s3_storage_load_template($name, array $_vars)\n{\n $template = locate_template($name, false, false);\n\n // Use the default template if the theme doesn't have it\n if (!$template) {\n $template = dirname(__FILE__) . '/../templates/' . $name . '.php';\n }\n\n // Load the template\n extract($_vars);\n require $template;\n}",
"public function loadTemplate()\n\t{\n\t\t$t_location = \\IPS\\Request::i()->t_location;\n\t\t$t_key = \\IPS\\Request::i()->t_key;\n\t\t\n\t\tif ( $t_location === 'block' and $t_key === '_default_' and isset( \\IPS\\Request::i()->block_key ) )\n\t\t{\n\t\t\t/* Find it from the normal template system */\n\t\t\tif ( isset( \\IPS\\Request::i()->block_app ) )\n\t\t\t{\n\t\t\t\t$plugin = \\IPS\\Widget::load( \\IPS\\Application::load( \\IPS\\Request::i()->block_app ), \\IPS\\Request::i()->block_key, mt_rand() );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$plugin = \\IPS\\Widget::load( \\IPS\\Plugin::load( \\IPS\\Request::i()->block_plugin ), \\IPS\\Request::i()->block_key, mt_rand() );\n\t\t\t}\n\t\t\t\n\t\t\t$location = $plugin->getTemplateLocation();\n\t\t\t\n\t\t\t$templateBits = \\IPS\\Theme::master()->getRawTemplates( $location['app'], $location['location'], $location['group'], \\IPS\\Theme::RETURN_ALL );\n\t\t\t$templateBit = $templateBits[ $location['app'] ][ $location['location'] ][ $location['group'] ][ $location['name'] ];\n\t\t\t\n\t\t\tif ( ! isset( \\IPS\\Request::i()->noencode ) OR ! \\IPS\\Request::i()->noencode )\n\t\t\t{\n\t\t\t\t$templateBit['template_content'] = htmlentities( $templateBit['template_content'], ENT_DISALLOWED, 'UTF-8', TRUE );\n\t\t\t}\n\t\t\t\n\t\t\t$templateArray = array(\n\t\t\t\t'template_id' \t\t\t=> $templateBit['template_id'],\n\t\t\t\t'template_key' \t\t\t=> 'template_' . $templateBit['template_name'] . '.' . $templateBit['template_id'],\n\t\t\t\t'template_title'\t\t=> $templateBit['template_name'],\n\t\t\t\t'template_desc' \t\t=> null,\n\t\t\t\t'template_content' \t\t=> $templateBit['template_content'],\n\t\t\t\t'template_location' \t=> null,\n\t\t\t\t'template_group' \t\t=> null,\n\t\t\t\t'template_container' \t=> null,\n\t\t\t\t'template_rel_id' \t\t=> null,\n\t\t\t\t'template_user_created' => null,\n\t\t\t\t'template_user_edited' => null,\n\t\t\t\t'template_params' \t => $templateBit['template_data']\n\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif ( \\is_numeric( $t_key ) )\n\t\t\t\t{\n\t\t\t\t\t$template = \\IPS\\cms\\Templates::load( $t_key, 'template_id' );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$template = \\IPS\\cms\\Templates::load( $t_key );\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch( \\OutOfRangeException $ex )\n\t\t\t{\n\t\t\t\t\\IPS\\Output::i()->json( array( 'error' => true ) );\n\t\t\t}\n\n\t\t\tif ( $template !== null )\n\t\t\t{\n\t\t\t\t$templateArray = array(\n\t 'template_id' \t\t\t=> $template->id,\n\t 'template_key' \t\t\t=> $template->key,\n\t 'template_title'\t\t=> $template->title,\n\t 'template_desc' \t\t=> $template->desc,\n\t 'template_content' \t\t=> ( isset( \\IPS\\Request::i()->noencode ) AND \\IPS\\Request::i()->noencode ) ? $template->content : htmlentities( $template->content, ENT_DISALLOWED, 'UTF-8', TRUE ),\n\t 'template_location' \t=> $template->location,\n\t 'template_group' \t\t=> $template->group,\n\t 'template_container' \t=> $template->container,\n\t 'template_rel_id' \t\t=> $template->rel_id,\n\t 'template_user_created' => $template->user_created,\n\t 'template_user_edited' => $template->user_edited,\n\t 'template_params' \t => $template->params\n\t );\n\t\t\t}\n\t\t}\n\n\t\tif ( \\IPS\\Request::i()->show == 'json' )\n\t\t{\n\t\t\t\\IPS\\Output::i()->json( $templateArray );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\\IPS\\Output::i()->sendOutput( \\IPS\\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( \\IPS\\Theme::i()->getTemplate( 'templates', 'cms', 'admin' )->viewTemplate( $templateArray ) ), 200, 'text/html', \\IPS\\Output::i()->httpHeaders );\n\t\t}\n\t}",
"function bok_load_template( $_template_file, $require_once = true, $template_vars = array() ) {\n\t\n\tapply_filters( 'bok_load_template_params', $template_vars ); // in case you want to add your own global variables or common data\n\t\t\n\tif ( $template_vars ) {\n\t\textract( $template_vars );\n\t}\n\t\t\n\tif ( $require_once )\n\t\trequire_once( $_template_file );\n\telse\n\t\trequire( $_template_file );\n}",
"function load_template($template_name='default', Page $p)\n{\n\t$template_path = TEMPLATES_DIR . \"/\" . $template_name . \"/template.php\";\n\n\tif(!file_exists($template_path)) throw new FrameworkException(\"$template_path: template doesn't exist\");\n\n\t$p->setTemplate($template_path);\n\t$p->display();\n}",
"function load_plugin_templates() : void {\n\trequire_once plugin_dir_path( __FILE__ ) . '../templates/messages/subscriber-only-message.php';\n\trequire_once plugin_dir_path( __FILE__ ) . '../templates/messages/split-content-message.php';\n\trequire_once plugin_dir_path( __FILE__ ) . '../templates/messages/banner-message.php';\n}",
"public function loadTemplate(){\n\t\t$tpl = $this->template;\n\t\t$file = $this->path . DIRECTORY_SEPARATOR . $tpl . '.tmpl.php';\n\t\t$exists = file_exists($file);\n\t\t// Wenn Template vorhanden\n\t\tif( $exists ){\n\n\t\t\tob_start();\n\t\t\tinclude $file;\n\t\t\t$output = ob_get_contents();\n\t\t\tob_end_clean();\n\n\t\t\treturn $output;\n\t\t}else{\n\t\t\treturn 'Datei nicht gefunden!';\n\t\t}\n\t}",
"function load_file($path){\n\tif (!file_exists($path)) system_die('File reading error - \"' . $path . '\"', 'Template->load_file');\n\t$this->template = @file($path);\n\tunset($this->result);\n\t$this->filename = $path;\n}",
"public function Load() : void\n {\n do_action('template_redirect');\n\n $this->Template === self::VIRTUAL_PAGE_TEMPLATE ? $Template = self::VIRTUAL_PAGE_TEMPLATE : $Template = locate_template(array_filter($this->Templates));\n $filtered = apply_filters('template_include', apply_filters('WP_Plugin_virtual_page_template', $Template));\n if(empty($filtered) || file_exists($filtered))\n {\n $Template = $filtered;\n }\n if(!empty($Template) && file_exists($Template)) \n {\n add_action('wp_enqueue_scripts',function (){$this->Define_Resources();});\n require_once $Template;\n }\n }",
"function load_template_from_php( $name='skin_global', $full_name='skin_global_1', $id='1' )\n\t{\n\t\t$_NOW = $this->memory_debug_make_flag();\n\t\t\n\t\t//-----------------------------------------\n\t\t// File exist?\n\t\t//-----------------------------------------\n\t\t\n\t\tif( !file_exists( CACHE_PATH.\"cache/skin_cache/cacheid_\".$id.\"/\".$name.\".php\" ) )\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// IN_DEV?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( IN_DEV AND $id == 1 )\n\t\t{\n\t\t\t//-----------------------------------------\n\t\t\t// Get data...\n\t\t\t//-----------------------------------------\n\t\t\n\t\t\t$data = implode( '', file( CACHE_PATH.\"cache/skin_cache/cacheid_\".$id.\"/\".$name.\".php\" ) );\n\t\t\n\t\t\t//-----------------------------------------\n\t\t\t// Get template class\n\t\t\t//-----------------------------------------\n\t\t\n\t\t\tif ( ! is_object( $this->work_classes['class_template_engine'] ) )\n\t\t\t{\n\t\t\t\trequire_once( KERNEL_PATH . 'class_template_engine.php' );\n\n\t\t\t\t$this->work_classes['class_template_engine'] = new class_template();\n\t\t\t}\n\t\t\t\n\t\t\t$toeval = $this->work_classes['class_template_engine']->convert_cache_to_eval( $data, $full_name );\n\t\t\t\n\t\t\t#if ( $name == 'skin_topic' ) { print $toeval; exit(); }\n\t\t\t\n\t\t\teval( $toeval );\n\t\t}\n\t\telse\n\t\t{\n\t\t\trequire_once( CACHE_PATH.\"cache/skin_cache/cacheid_\".$id.\"/\".$name.\".php\" );\n\t\t}\n\t\t\n\t\t$this->compiled_templates[ $name ] = new $full_name();\n\t\t$this->compiled_templates[ $name ]->ipsclass =& $this;\n\t\n\t\t# Add to loaded templates\n\t\t$this->loaded_templates[ $full_name ] = $full_name;\n\t\n\t\t$this->memory_debug_add( \"IPSCLASS: Loaded skin file - $name\", $_NOW );\n\t\t\n\t\treturn TRUE;\n\t}",
"private function setTemplate(){\n if (isset($this->data['template']) && !empty($this->data['template'])){\n $template = APP_ROOT.'/app/templates/'.trim($this->data['template']).'.tpl';\n if (file_exists($template)){\n $this->template = $template;\n return;\n }\n }\n //default\n $this->template = APP_ROOT.'/app/templates/default.tpl';\n }",
"function deals_get_template($template_name, $require_once = true) {\n\tif (file_exists( STYLESHEETPATH . '/' . DEALS_TEMPLATE . $template_name )) load_template( STYLESHEETPATH . '/' . DEALS_TEMPLATE . $template_name, $require_once ); \n\telseif (file_exists( STYLESHEETPATH . '/' . $template_name )) load_template( STYLESHEETPATH . '/' . $template_name , $require_once); \n\telse load_template( DEALS_TEMPLATE_DIR . $template_name , $require_once);\n}",
"public function loadTemplate($template='')\n\t{\n\t\tif($template!='')\n\t\t\t$this->_template=$template;\n\n if(!is_file($this->_templateDir.$this->_template))\n throw new Exception('Unable to load template file: '.$this->_templateDir.$this->_template);\n\n\t\t//identify type of template file\n\t\t$inputFileType = PHPExcel_IOFactory::identify($this->_templateDir.$this->_template);\n\t\t//TODO: better control of allowed input types\n\t\t//load template file into PHPExcel objects\n\t\t$this->objReader = PHPExcel_IOFactory::createReader($inputFileType);\n\t\t$this->objPHPExcel = $this->objReader->load($this->_templateDir.$this->_template);\n\t\t$this->objWorksheet = $this->objPHPExcel->getActiveSheet();\n\n $this->_usingTemplate=true;\n\t}",
"function useTemplate($path_to_root_dir)\n{\n global $area, $path_to_root_dir, $error_msg_text, $sys_msg_text;\n $sys_info = getSysInfo();\n \n //this is the first place where we see that sys-tables don't exist!!\n if ($sys_info['no_tables']) {\n $link_text = __('PolyPager found the database. Very good. <br/>But: it seems that it does not yet have its database configured. By clicking on the following link you can assure that all the tables that PolyPager needs to operate are being created (if they have not been already).<br/>');\n $link_href = \"admin/?&cmd=create\";\n global $area;\n if ($area == '_admin') {\n $link_href = './?&cmd=create';\n }\n if ($area == '_gallery') {\n $link_href = '../../admin/?&cmd=create';\n }\n $error_msg_text[] = '<span id=\"no_tables_warning\">'.$link_text.'<a href=\"'.$link_href.'\">click here to create the tables.</a></span>';\n }\n if (utf8_strpos($sys_info['skin'], 'picswap')>-1) {\n $skin = 'picswap';\n } else {\n $skin = $sys_info['skin'];\n }\n $template_dirpath = $path_to_root_dir.\"/style/skins/\".$skin;\n $template_filepath = $template_dirpath.\"/template.php\";\n if (file_exists($template_filepath)) {\n @include($template_filepath);\n } else if (file_exists($template_dirpath)) {\n if ($area == '_admin') {\n $sys_msg_text[] = 'The template.php file in the '.$skin.'-directory couldn\\'t be found';\n }\n // we fall silently back to the template file\n @include($template_dirpath.\"/template.php.template\");\n } else {\n $sys_msg_text[] = __('Warning: No template could be found for the selected skin.');\n @include($path_to_root_dir.\"/style/skins/polly/template.php.template\");\n }\n}",
"function st_get_template($file,$data = array()){\r $file = ST_DIR.'/templates/'.$file;\r if(file_exists($file)){\r include($file); return true;\r }\r return false;\r}",
"public static function Load($Template) {\n self::$Template = (String) $Template;\n self::$Template = file_get_contents(self::$Template . '.tpl.html');\n var_dump(self::$Template);\n }",
"public static function afficher() {\r\n $filevue = \"application/templates/\" . Page::getInstance()->template . \".template.php\";\r\n\r\n if (file_exists($filevue)) {\r\n require_once $filevue;\r\n } else {\r\n die(\"template non renseigne\");\r\n }\r\n }",
"function load_template($_template, $_data = NULL, $_echo = true)\n\t{\n\t\t//append the file extension if not supplied\n\t\tif (strpos( $_template, $this->template_ext ) === FALSE)\n\t\t\t$_template .= $this->template_ext;\n\t\t\t\n\t\t//set the working dir to the templates folder\n\t\t//(save current working dir to revert to when we're done)\n\t\t$_cwd = getcwd();\n\t\tchdir($this->route);\n\t\t\n\t\t//load the file into the class. Throw an exception if it fails for some reason\n\t\tif (($_template_data = file_get_contents( $_template ) ) === FALSE) \n\t\t{\n\t\t\tchdir( $_cwd );\n\t\t\tthrow new Exception( 'TemplateController: Was unable to open template file: '.$this->route.$_template );\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//if data is an array, break out all of its keys into variables\n\t\tif (isset( $_data) && is_array( $_data ))\n\t\t\textract( $_data, EXTR_OVERWRITE );\n\n\t\t//start a new output buffering session to collect all of the printed data\n\t\tob_start();\n\n\t\t//evalutate the code\n\t\t//(IMPORTANT: PHP documentation states that a trailing space is needed\n\t\t// for the <?php brace to be picked up.)\n\t\teval('?> '.$_template_data.' <?php ');\n\n\t\t//retrieve the output from the eval\n\t\t$_output = ob_get_contents();\n\n\t\t//close the buffering session\n\t\tob_end_clean();\n\n\t\t//revert the working dir to default\n\t\tchdir($_cwd);\n\t\t\n\t\t//output the resulting text based on parameters\n\t\tif ($_echo)\n\t\t\techo $_output;\n\t\telse\n\t\t\treturn $_output;\n\t\t\t\n\t\treturn TRUE;\n\t}"
]
| [
"0.6931667",
"0.6611182",
"0.63770056",
"0.63752",
"0.62889695",
"0.6271695",
"0.6263604",
"0.6198815",
"0.6166395",
"0.61058134",
"0.6065634",
"0.6040346",
"0.6006256",
"0.5993739",
"0.59384865",
"0.59332705",
"0.59026015",
"0.58658713",
"0.5850083",
"0.5843157",
"0.58322644",
"0.57906723",
"0.57783747",
"0.5772825",
"0.5768889",
"0.57601815",
"0.5717604",
"0.57123893",
"0.57082444",
"0.5700912"
]
| 0.74750453 | 0 |
/ Require, parse and return an array containing the language stuff / Load an ACP language file. Populates $this>lang | function acp_load_language( $file="" )
{
if ( ! $this->lang_id )
{
$this->lang_id = $this->member['language'] ? $this->member['language'] : $this->vars['default_language'];
if ( ($this->lang_id != $this->vars['default_language']) and ( ! is_dir( ROOT_PATH."cache/lang_cache/".$this->lang_id ) ) )
{
$this->lang_id = $this->vars['default_language'];
}
//-----------------------------------------
// Still nothing?
//-----------------------------------------
if ( ! $this->lang_id )
{
$this->lang_id = 'en';
}
}
//-----------------------------------------
// Load it
//-----------------------------------------
if( file_exists( ROOT_PATH."cache/lang_cache/".$this->lang_id."/".$file.".php" ) )
{
require_once( ROOT_PATH."cache/lang_cache/".$this->lang_id."/".$file.".php" );
if ( is_array( $lang ) )
{
foreach ($lang as $k => $v)
{
$this->acp_lang[ $k ] = $v;
}
}
}
unset($lang);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function read() \n {\n if ($this->lang == '') $this->lang = App::getLocale();\n $this->path = base_path().'/resources/lang/'.$this->lang.'/'.$this->file.'.php';\n $this->arrayLang = Lang::get($this->file);\n if (gettype($this->arrayLang) == 'string') $this->arrayLang = array();\n }",
"public function getLang()\n {\n \t$lang_path = 'lang/';\n if(isset($_GET['lang']))\n {\n Yii::app()->session[\"lang\"] = $_GET['lang']; \n }\n \n if(!file_exists($lang_path.Yii::app()->session[\"lang\"].'.ini'))\n {\n\t\t\tYii::app()->session[\"lang\"] = 'sr';\n }\n\t\t\n\t\t$this->langArray= parse_ini_file($lang_path.Yii::app()->session[\"lang\"].'.ini'); \n }",
"function pnLangLoad()\n{\n\t// See if a language update is required\n $newlang = pnVarCleanFromInput('newlang');\n if (!empty($newlang)) {\n $lang = $newlang;\n pnSessionSetVar('lang', $newlang);\n } else {\n $detectlang = pnConfigGetVar('language_detect');\n $defaultlang = pnConfigGetVar('language');\n\n switch ($detectlang) { \n case 1: // Detect Browser Language\n\t\t $cnvlanguage=cnvlanguagelist();\n $currentlang='';\n \t $langs = preg_split ('/[,;]/',$_SERVER['HTTP_ACCEPT_LANGUAGE']);\n \t foreach ($langs as $lang) {\n \t \t if (isset($cnvlanguage[$lang]) && file_exists('language/' . pnVarPrepForOS($cnvlanguage[$lang]) . '/global.php')) {\n \t \t $currentlang=$cnvlanguage[$lang];\n \t \t break;\n \t \t }\n \t }\n if ($currentlang=='')\n \t $currentlang=$defaultlang;\n \t \t break;\n default:\n $currentlang=$defaultlang; \n }\n $lang = pnSessionGetVar('lang');\n }\n \n // Load global language defines\n\t// these are deprecated and will be moved to the relevant modules\n\t// with .8x\n if (isset ($lang) && file_exists('language/' . pnVarPrepForOS($lang) . '/global.php')) {\n $currentlang = $lang;\n } else {\n $currentlang = pnConfigGetVar('language');\n pnSessionSetVar('lang', $currentlang);\n }\n\t$oscurrentlang = pnVarPrepForOS($currentlang);\n\tif (file_exists('language/' . $oscurrentlang . '/global.php')) {\n\t include 'language/' . $oscurrentlang . '/global.php';\n\t}\n\n\t// load the languge language file\n\tif (file_exists('language/languages.php')) {\n\t\tinclude 'language/languages.php';\n\t}\n\n\t// load the core language file\n\tif (file_exists('language/' . $oscurrentlang . '/core.php')) {\n\t\tinclude 'language/' . $oscurrentlang . '/core.php';\n\t}\n\n\t// V4B RNG\n\tif (file_exists('language/' . $oscurrentlang . '/v4blib.php')) {\n\t\tinclude 'language/' . $oscurrentlang . '/v4blib.php';\n\t}\n\t// V4B RNG\n\n\t// set the correct locale\n\t// note: windows has different requires for the setlocale funciton to other OS's\n\t// See: http://uk.php.net/setlocale\n\tif (stristr(getenv('OS'), 'windows')) {\n\t\t// for windows we either use the _LOCALEWIN define or the existing language code\n\t\tif (defined('_LOCALEWIN')) {\n\t\t\tsetlocale(LC_ALL, _LOCALEWIN);\n\t\t} else {\n\t\t\tsetlocale(LC_ALL, $currentlang);\n\t\t}\n\t} else {\n\t\t// for other OS's we use the _LOCALE define\n\t\tsetlocale(LC_ALL, _LOCALE);\n\t}\n}",
"public static function loadLang() {\n\t\tif (!is_object($GLOBALS['LANG'])) {\n\n\t\t\trequire_once t3lib_extMgm::extPath('lang') . 'lang.php';\n\t\t\t//TODO see pt_tool smarty!\n\t\t\t$GLOBALS['LANG'] = t3lib_div::makeInstance('language');\n\t\t\t$GLOBALS['LANG']->csConvObj = t3lib_div::makeInstance('t3lib_cs');\n\t\t}\n\t\tif (is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->config['config']['language']) {\n\t\t\t$LLkey = $GLOBALS['TSFE']->config['config']['language'];\n\t\t\t$GLOBALS['LANG']->init($LLkey);\n\t\t}\n\n\t}",
"public function initializeLanguages() {}",
"public function lang() {\n\t\t\tload_plugin_textdomain( 'cherry-site-shortcodes', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );\n\t\t}",
"function languages()\n\t{\n\t\t$this->ipsclass->input['step']++;\n\t\t$uninstall = ( $this->ipsclass->input['un'] == 1 ) ? \"&un=1\" : \"\";\n\t\t\n\t\t$object = ( $this->tasks['languages'] == 1 ) ? 'Language String' : 'Language Strings';\n\t\t$operation = ( $this->ipsclass->input['un'] ) ? 'removed' : 'created';\n\t\t\n\t\t$api = $this->ipsclass->load_class( IPS_API_PATH.'/api_language.php', 'api_language' );\n\t\t$api->path_to_ipb = ROOT_PATH;\n\t\t$api->api_init();\n\t\t\n\t\tforeach ( $this->xml_array['languages_group']['language'] as $k => $v )\n\t\t{\n\t\t\tif ( !$this->ipsclass->input['un'] )\n\t\t\t{\n\t\t\t\t$api->lang_add_strings( array( $v['key']['VALUE'] => $v['text']['VALUE'] ), $v['file']['VALUE'] );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach ( $this->ipsclass->cache['languages'] as $kk => $vv )\n\t\t\t\t{\n\t\t\t\t\t$lang = array();\n\t\t\t\t\trequire( CACHE_PATH.'cache/lang_cache/'.$vv['ldir'].'/'.$v['file']['VALUE'].'.php' );\n\t\t\t\t\t\n\t\t\t\t\tunset( $lang[ $v['key']['VALUE'] ] );\n\t\t\t\t\t\n\t\t\t\t\t$start = \"<?php\\n\\n\".'$lang = array('.\"\\n\";\n\t\t\t\t\t\n\t\t\t\t\tforeach ( $lang as $kkk => $vvv )\n\t\t\t\t\t{\n\t\t\t\t\t\t$vvv = preg_replace( \"/\\n{1,}$/\", \"\", $vvv );\n\t\t\t\t\t\t$vvv \t= stripslashes( $vvv );\n\t\t\t\t\t\t$vvv\t= preg_replace( '/\"/', '\\\\\"', $vvv );\n\t\t\t\t\t\t$start .= \"\\n'\".$kkk.\"' => \\\"\".$vvv.\"\\\",\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$start .= \"\\n\\n);\\n\\n?\".\">\";\n\t\t\t\t\t\n\t\t\t\t\tif ( $fh = @fopen( CACHE_PATH.'cache/lang_cache/'.$vv['ldir'].'/'.$v['file']['VALUE'].'.php', 'w' ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t@fwrite( $fh, $start );\n\t\t\t\t\t\t@fclose( $fh );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tunset( $lang, $start, $fh );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->ipsclass->admin->redirect( \"{$this->ipsclass->form_code}&code=work&mod={$this->ipsclass->input['mod']}&step={$this->ipsclass->input['step']}{$uninstall}&st={$this->ipsclass->input['st']}\", \"{$this->xml_array['mod_info']['title']['VALUE']}<br />{$this->tasks['languages']} {$object} {$operation}....\" );\n\t}",
"private static function loadLanguage($lang){\n\t\t$descriptions = array();\n\n\t\t$locale = 'locale/'.$lang.'.php';\n\t\trequire($locale);\n\n\t\treturn (object)$descriptions;\n\t}",
"public function language(){\n\t\tdefined('MGK_LANGUAGE')\n\t\t || define('MGK_LANGUAGE', $this->lang );\n\n\t\t$language = MGK_LANGUAGE;\t\n\t\t$file_lang = MGK_APPLICATION_DIRECTORY.'/_language/'.$language.'.json';\n\t\t$this->mgkLang = new Amaguk_lang( $language );\t\t\t\n\t\t$this->mgkLang->read_lang($file_lang);\t\t\t\n\t}",
"function _load_languages()\r\n\t{\r\n\t\t// Load the form validation language file\r\n\t\t$this->lang->load('form_validation');\r\n\r\n\t\t// Load the DataMapper language file\r\n\t\t$this->lang->load('datamapper');\r\n\t}",
"protected function getLanguages() {}",
"function initLanguage() {\n global $_ARRLANG, $basePath, $language;\n\n $language = $this->_getLanguage();\n\n require_once($basePath.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$language.'.lang.php');\n }",
"public function loadLanguage() {\n\t\t$this->languageLoaded = true;\n\t\t$filename = TMP_DIR.TMP_FILE_PREFIX.$this->data['languageCode'].'_'.$this->data['languageEncoding'].'_wcf.setup.php';\n\t\t\n\t\tif (!file_exists($filename)) {\n\t\t\t$xml = new XML(TMP_DIR.TMP_FILE_PREFIX.'setup_'.$this->data['languageCode'].'.xml');\n\t\t\t\n\t\t\t// compile an array with XML::getElementTree\n\t\t\t$languageXML = $xml->getElementTree('language');\n\n\t\t\t// extract attributes (language code, language name)\n\t\t\t//$languageXML = array_merge($languageXML, $languageXML['attrs']);\n\n\t\t\t// get language items\n\t\t\t$categoriesToCache = array();\n\t\t\tforeach ($languageXML['children'] as $key => $languageCategory) {\n\t\t\t\t// language category does not exist yet, create it\n\t\t\t\tif (isset($languageCategory['children'])) {\n\t\t\t\t\tforeach ($languageCategory['children'] as $key2 => $languageitem) {\n\t\t\t\t\t\t$categoriesToCache[] = array( 'name' => $languageitem['attrs']['name'], 'cdata' => $languageitem['cdata']);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// update language files here\n\t\t\tif (count($categoriesToCache) > 0) {\n\t\t\t\t$file = new File($filename);\n\t\t\t\t$file->write(\"<?php\\n/**\\n* WoltLab Community Framework\\n* language: \".$this->data['languageCode'].\"\\n* encoding: \".$this->data['languageEncoding'].\"\\n* category: WCF Setup\\n* generated at \".gmdate(\"r\").\"\\n* \\n* DO NOT EDIT THIS FILE\\n*/\\n\");\n\t\t\t\tforeach ($categoriesToCache as $value => $name) {\n\t\t\t\t\t// simple_xml returns values always UTF-8 encoded\n\t\t\t\t\t// manual decoding to charset necessary\n\t\t\t\t\tif ($this->data['languageEncoding'] != 'UTF-8') {\n\t\t\t\t\t\t$name['cdata'] = StringUtil::convertEncoding('UTF-8', $this->data['languageEncoding'], $name['cdata']);\n\t\t\t\t\t}\n\t\t\t\t\t$file->write(\"\\$this->items[\\$this->languageID]['\".$name['name'].\"'] = '\".str_replace(\"'\", \"\\'\", $name['cdata']).\"';\\n\");\n\t\t\t\t\t\n\t\t\t\t\t// compile dynamic language variables\n\t\t\t\t\tif (strpos($name['cdata'], '{') !== false) {\n\t\t\t\t\t\t$file->write(\"\\$this->dynamicItems[\\$this->languageID]['\".$name['name'].\"'] = '\".str_replace(\"'\", \"\\'\", self::getScriptingCompiler()->compileString($name['name'], $name['cdata'])).\"';\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\n\t\t\t\t$file->write(\"?>\");\n\t\t\t\t$file->close();\n\t\t\t}\n\t\t}\n\n\t\tinclude_once($filename);\n\t\t$this->setLocale();\n\t}",
"private function _get_translations_from_file () {\n\n\t\t$lang = file_exists(self::DIR_LANGS . $this->lang . '.php')\n\t\t\t\t\t? $this->lang : $this->_default_lang;\n\n\t\trequire self::DIR_LANGS . $lang . '.php';\n\n\t\treturn $t;\n\n\t}",
"function load_language( $file=\"\" )\n {\n\t\t//-----------------------------------------\n\t\t// Memory\n\t\t//-----------------------------------------\n\t\t\n\t\t$_NOW = $this->memory_debug_make_flag();\n\t\t\n\t $this->vars['default_language'] = isset($this->vars['default_language']) ? $this->vars['default_language'] : 'en';\n\t \n \tif ( ! $this->lang_id )\n \t{\n \t\t$this->lang_id = isset($this->member['language']) ? $this->member['language'] : $this->vars['default_language'];\n\n\t\t\tif ( ($this->lang_id != $this->vars['default_language']) and ( ! is_dir( ROOT_PATH.\"cache/lang_cache/\".$this->lang_id ) ) )\n\t\t\t{\n\t\t\t\t$this->lang_id = $this->vars['default_language'];\n\t\t\t}\n\t\t\t\n\t\t\t//-----------------------------------------\n\t\t\t// Still nothing?\n\t\t\t//-----------------------------------------\n\t\t\t\n\t\t\tif ( ! $this->lang_id )\n\t\t\t{\n\t\t\t\t$this->lang_id = 'en';\n\t\t\t}\n\t\t}\n \t\n \t//-----------------------------------------\n \t// Load it\n \t//-----------------------------------------\n\t\t\n\t\tif ( file_exists( ROOT_PATH.\"cache/lang_cache/\".$this->lang_id.\"/\".$file.\".php\" ) )\n\t\t{\n \trequire ( ROOT_PATH.\"cache/lang_cache/\".$this->lang_id.\"/\".$file.\".php\" );\n \n\t if ( isset($lang) AND is_array( $lang ) )\n\t {\n\t\t\t\tforeach ($lang as $k => $v)\n\t\t\t\t{\n\t\t\t\t\t$this->lang[ $k ] = $v;\n\t\t\t\t}\n\t }\n\t }\n\t\t\n\t\t//-----------------------------------------\n\t\t// Memory\n\t\t//-----------------------------------------\n\t\t\n\t\t$this->memory_debug_add( \"IPSCLASS: Loaded language file - $file\", $_NOW );\n\t\t\n\t\t//-----------------------------------------\n\t\t// Clean up\n\t\t//-----------------------------------------\n\t\t\n\t\tunset( $lang, $file );\n }",
"function codepress_get_lang($filename)\n {\n }",
"public function languages();",
"protected function load()\n {\n $this->translations = array();\n \n if ($this->language) {\n if ($this->cachepath) {\n if (file_exists($cache = $this->cachepath.'/'.$this->language.'.php')) {\n $this->translations = include($cache);\n }\n } else {\n if (!empty($this->filepaths)) {\n foreach ($this->filepaths as $filepath) {\n $this->loadFilePath($filepath);\n }\n }\n }\n }\n }",
"function load($langfile = '', $idiom = '')\n\t{\n\t\tif (is_array($langfile))\n\t\t{\n\t\t\t$temp = $langfile;\n\t\t\t$langfile = $temp['0'];\n\t\t\t$idiom = $temp['1'];\n\t\t}\n\t\n\t\t$langfile = str_replace(EXT, '', str_replace('_lang.', '', $langfile)).'_lang'.EXT;\n\t\t\n\t\tif (call('CI', 'is_loaded', $langfile) == TRUE)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif ($idiom == '')\n\t\t{\n\t\t\t$deft_lang = call('config', 'item', 'language');\n\t\t\t$idiom = ($deft_lang == '') ? 'english' : $deft_lang;\n\t\t}\n\t\n\t\tif ( ! file_exists(BASEPATH.'language/'.$idiom.'/'.$langfile))\n\t\t{\n\t\t\tshow_error('Unable to load the requested language file: language/'.$langfile.EXT);\n\t\t}\n\n\t\tinclude_once(BASEPATH.'language/'.$idiom.'/'.$langfile);\n\t\t \n\t\tif ( ! isset($lang))\n\t\t{\n\t\t\tlog_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$this->ci_is_loaded[] = $langfile;\n\t\t$this->language = array_merge($this->language, $lang);\n\t\tunset($lang);\n\t\t\n\t\tlog_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile);\n\t}",
"public function load_lang() {\n /** Set our unique textdomain string */\n $textdomain = 'ninja-forms';\n\n /** The 'plugin_locale' filter is also used by default in load_plugin_textdomain() */\n $locale = apply_filters( 'plugin_locale', get_locale(), $textdomain );\n\n /** Set filter for WordPress languages directory */\n $wp_lang_dir = apply_filters(\n 'ninja_forms_wp_lang_dir',\n WP_LANG_DIR . '/ninja-forms/' . $textdomain . '-' . $locale . '.mo'\n );\n\n /** Translations: First, look in WordPress' \"languages\" folder = custom & update-secure! */\n load_textdomain( $textdomain, $wp_lang_dir );\n\n /** Translations: Secondly, look in plugin's \"lang\" folder = default */\n $plugin_dir = trailingslashit( basename( dirname( dirname( __FILE__ ) ) ) ) . basename( dirname( __FILE__ ) );\n $lang_dir = apply_filters( 'ninja_forms_lang_dir', $plugin_dir . '/lang/' );\n load_plugin_textdomain( $textdomain, FALSE, $lang_dir );\n }",
"function pi_loadLL($file=null)\t{\n\t\tif (!$this->LOCAL_LANG_loaded && $this->scriptRelPath &&!$file)\t{\n\t\t\t$basePath = PATH_site . t3lib_extMgm::siteRelPath($this->extKey).dirname($this->scriptRelPath).'/locallang.php';\n\t\t\tif (@is_file($basePath))\t{\n\t\t\t\tinclude('./'.$basePath);\n\t\t\t\t$this->LOCAL_LANG = $LOCAL_LANG;\n\t\t\t\tif (is_array($this->conf['_LOCAL_LANG.']))\t{\n\t\t\t\t\treset($this->conf['_LOCAL_LANG.']);\n\t\t\t\t\twhile(list($k,$lA)=each($this->conf['_LOCAL_LANG.']))\t{\n\t\t\t\t\t\tif (is_array($lA))\t{\n\t\t\t\t\t\t\t$k = substr($k,0,-1);\n\t\t\t\t\t\t\t$this->LOCAL_LANG[$k] = t3lib_div::array_merge_recursive_overrule(is_array($this->LOCAL_LANG[$k])?$this->LOCAL_LANG[$k]:array(), $lA);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else if(!$this->LOCAL_LANG_loaded && $file){\n\t\t\tif (@is_file($file))\t{\n\t\t\t\tinclude($file);\n\t\t\t\t$this->LOCAL_LANG = $LOCAL_LANG;\n\t\t\t\tif (is_array($this->conf['_LOCAL_LANG.']))\t{\n\t\t\t\t\treset($this->conf['_LOCAL_LANG.']);\n\t\t\t\t\twhile(list($k,$lA)=each($this->conf['_LOCAL_LANG.']))\t{\n\t\t\t\t\t\tif (is_array($lA))\t{\n\t\t\t\t\t\t\t$k = substr($k,0,-1);\n\t\t\t\t\t\t\t$this->LOCAL_LANG[$k] = t3lib_div::array_merge_recursive_overrule(is_array($this->LOCAL_LANG[$k])?$this->LOCAL_LANG[$k]:array(), $lA);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t}\n\t\t$this->LOCAL_LANG_loaded = 1;\n\t}",
"public function getSystemLanguages() {}",
"public function getSystemLanguages() {}",
"function forum_lang( $old_lang ){\n\n\t$loc = HOME . '_plugins/Forum/lang/';\n\tif( file_exists( $loc . LANG . '.php' ) )\n\t\trequire $loc . LANG . '.php';\n\telse\n\t\trequire $loc . 'English.php';\n\n\treturn array_merge( $old_lang, $lang );\n}",
"public function system_language_file_variables(){\n\t // Verify app level lang\n $my_files = $this->zajlib->file->get_files('app/lang/', true);\n foreach($my_files as $f){\n $file = str_ireplace('app/lang/', '', $this->zajlib->file->get_relative_path($f));\n $fdata = explode('.', $file);\n // Check for old data\n if(strlen($fdata[1]) < 5) $this->zajlib->test->notice(\"Found old language file format: \".$file);\n else{\n $file = trim($fdata[0], '/');\n $this->verify_single_language_file($file);\n }\n }\n\n\t\t// Get all of the plugins (local lang files are in _project plugin)\n\t\tforeach($this->zajlib->plugin->get_plugins('app') as $plugin){\n\t\t\t$my_files = $this->zajlib->file->get_files('plugins/'.$plugin.'/lang/', true);\n\t\t\tforeach($my_files as $f){\n\t\t\t\t$file = str_ireplace('plugins/'.$plugin.'/lang/', '', $this->zajlib->file->get_relative_path($f));\n\t\t\t\t$fdata = explode('.', $file);\n\t\t\t\t// Check for old data\n\t\t\t\tif(strlen($fdata[1]) < 5) $this->zajlib->test->notice(\"Found old language file format: \".$file);\n\t\t\t\telse{\n\t\t\t\t\t$file = trim($fdata[0], '/');\n\t\t\t\t\t$this->verify_single_language_file($file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Get all of the plugins (local lang files are in _project plugin)\n\t\tforeach($this->zajlib->plugin->get_plugins('system') as $plugin){\n\t\t\t$my_files = $this->zajlib->file->get_files('system/plugins/'.$plugin.'/lang/', true);\n\t\t\tforeach($my_files as $f){\n\t\t\t\t$file = str_ireplace('system/plugins/'.$plugin.'/lang/', '', $this->zajlib->file->get_relative_path($f));\n\t\t\t\t$fdata = explode('.', $file);\n\t\t\t\t// Check for old data\n\t\t\t\tif(strlen($fdata[1]) < 5) $this->zajlib->test->notice(\"Found old language file format: \".$file);\n\t\t\t\telse{\n\t\t\t\t\t$file = trim($fdata[0], '/');\n\t\t\t\t\t$this->verify_single_language_file($file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"public static function init(){\n self::$language = config::getMainIni('language');\n\n $system_lang = array();\n $db = new db();\n $system_language = $db->select(\n 'language',\n 'language',\n config::$vars['coscms_main']['language']\n );\n\n // create system lanugage for all modules\n if (!empty($system_language)){\n foreach($system_language as $key => $val){\n $module_lang = unserialize($val['translation']);\n $system_lang+= $module_lang;\n }\n } \n self::$dict = $system_lang;\n }",
"public function create_new_lang()\n {\n $root_directory = FCPATH.\"application/language/\";\n $scan_root_directory = array_diff(scandir($root_directory),array('.','..'));\n $data['root_dir'] = $scan_root_directory;\n\n // Application Languages\n $directory = FCPATH.\"application/language/english\";\n $file_lists = scandir($directory,0);\n $total_file = count($file_lists);\n $language_Files = array();\n\n for($i = 2; $i< $total_file; $i++) \n {\n array_push($language_Files, $file_lists[$i]);\n }\n\n for ($i = 0; $i < count($language_Files); $i++) \n {\n $file_name = $language_Files[$i];\n include FCPATH.\"application/language/english/\".$file_name;\n $data['file_name'][$i] = $file_name;\n }\n\n // datatables plugins language\n $directory2 = FCPATH.\"assets/modules/datatables/language/english.json\";\n $plugin_file = file_get_contents($directory2);\n $plugin_file_contents = json_decode($plugin_file,TRUE);\n\n $lang = array();\n\n foreach ($plugin_file_contents as $key => $value) \n {\n if($key == \"oPaginate\")\n {\n foreach ($value as $key1 => $value1) \n {\n $lang[$key1] = $value1;\n }\n\n } else if ($key =='oAria') {\n\n foreach ($value as $key1 => $value1) \n {\n $lang[$key1] = $value1;\n }\n } else {\n $lang[$key] = $value;\n\n } \n }\n\n\n // Addon Language\n $addon_directory = FCPATH.\"application/modules/\";\n $scan_directory = scandir($addon_directory,0);\n $addon_files = array();\n\n for ($i = 2; $i < count($scan_directory) ; $i++) \n {\n array_push($addon_files, $scan_directory[$i]);\n }\n\n $addon_lang_folder = array();\n for ($i = 0; $i < count($addon_files); $i++) \n {\n $module_directory = FCPATH.\"application/modules/\".$addon_files[$i].\"/language\";\n if(file_exists($module_directory))\n {\n $scan_module_directories = array_diff(scandir($module_directory),array('.','..'));\n if(!empty($scan_module_directories))\n {\n $addon_name = $addon_directory.$addon_files[$i];\n array_push($addon_lang_folder,$addon_name);\n }\n }\n }\n\n\n $addon_dir_arr = array();\n for ($i = 0; $i < count($addon_lang_folder); $i++) \n {\n $addon_lang_file = $addon_lang_folder[$i];\n $addon_lang_file_dir = $addon_lang_file.\"/language/english/\";\n $addon_lang_file_dir_scan[] = scandir($addon_lang_file_dir,1);\n array_push($addon_dir_arr,$addon_lang_file_dir_scan[$i][0]);\n }\n $data['addons'] = $addon_dir_arr;\n\n $data['body'] = 'admin/multi_language/add_language';\n $data['page_title'] = $this->lang->line(\"New Language\");\n $this->_viewcontroller($data);\n }",
"static function getList_languages(){\n \t$configFile = dirname ( __FILE__ ).'/../config/'.DIRECTORY_SEPARATOR.'config_languages.php';\n \t$tmp=require($configFile);\n \t foreach ($tmp as $code=>$item){\n \t$tmp[$code]=Language::t(Yii::app()->language,'Backend.Language.List',$item);\n }\n return $tmp;\n }",
"public function Lang() {\n $this->langFolder = FILES['LOCALE'].(file_exists(FILES['LOCALE'].((locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']) !== null) ? \n locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']) : \"en_US\").\"/global.lang\") ? locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']) : \"en_US\").\"/\";\n return $this;\n }",
"private static function loadLanguage()\n\t{\n\t\t// Load translations\n\t\t$basePath = dirname(__FILE__);\n\t\t$jlang = JFactory::getLanguage();\n\t\t$jlang->load('liveupdate', $basePath, 'en-GB', true); // Load English (British)\n\t\t$jlang->load('liveupdate', $basePath, $jlang->getDefault(), true); // Load the site's default language\n\t\t$jlang->load('liveupdate', $basePath, null, true); // Load the currently selected language\n\t}"
]
| [
"0.73287755",
"0.7170706",
"0.70908755",
"0.7008337",
"0.6873602",
"0.68580997",
"0.685445",
"0.6806519",
"0.6797466",
"0.6792506",
"0.6765948",
"0.6724352",
"0.67217886",
"0.6671896",
"0.6666042",
"0.66603005",
"0.66513383",
"0.66487026",
"0.66208386",
"0.6618741",
"0.66020894",
"0.65849006",
"0.6582609",
"0.6547508",
"0.65472865",
"0.65257746",
"0.65203285",
"0.6509828",
"0.6499182",
"0.64990366"
]
| 0.719925 | 1 |
/ Get new PM notification window / Get a new PM notification message | function get_new_pm_notification( $limit=0, $xmlout = 0 )
{
//-----------------------------------------
// Make sure we have a skin...
//-----------------------------------------
if ( ! $this->compiled_templates['skin_global'] )
{
$this->load_template( 'skin_global' );
}
//-----------------------------------------
// posty parsery
//-----------------------------------------
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
$parser = new parse_bbcode();
$parser->ipsclass =& $this;
$parser->allow_update_caches = 0;
$parser->parse_bbcode = 1;
$parser->parse_smilies = 1;
$parser->parse_html = 0;
//-----------------------------------------
// Get last PM details
//-----------------------------------------
$this->DB->cache_add_query( 'msg_get_new_pm_notification', array( 'mid' => $this->member['id'], 'limit_a' => intval($limit) ) );
$this->DB->simple_exec();
$msg = $this->DB->fetch_row();
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! $msg['msg_id'] and ! $msg['mt_id'] and ! $msg['id'] )
{
return '<!-- CANT FIND MESSAGE -->';
}
//-----------------------------------------
// Strip and wrap
//-----------------------------------------
$msg['msg_post'] = $parser->strip_all_tags( $msg['msg_post'] );
$msg['msg_post'] = preg_replace("#([^\s<>'\"/\.\\-\?&\n\r\%]{80})#i", " \\1"."<br />", $msg['msg_post']);
$msg['msg_post'] = str_replace( "\n", "<br />", trim($msg['msg_post']) );
if ( strlen( $msg['msg_post'] ) > 300 )
{
$msg['msg_post'] = substr( $msg['msg_post'], 0, 350 ) . '...';
$msg['msg_post'] = preg_replace( "/&(#(\d+;?)?)?\.\.\.$/", '...', $msg['msg_post'] );
}
//-----------------------------------------
// Add attach icon
//-----------------------------------------
if ( $msg['mt_hasattach'] )
{
$msg['attach_img'] = '<{ATTACH_ICON}> ';
}
//-----------------------------------------
// Date
//-----------------------------------------
$msg['msg_date'] = $this->get_date( $msg['msg_date'], 'TINY' );
//-----------------------------------------
// Next / Total links
//-----------------------------------------
$msg['_cur_num'] = intval($limit) + 1;
$msg['_msg_total'] = intval($this->member['new_msg']) ? intval($this->member['new_msg']) : 1;
//-----------------------------------------
// Return loverly HTML
//-----------------------------------------
$return = $this->compiled_templates['skin_global']->msg_get_new_pm_notification( $msg, $xmlout );
//-----------------------------------------
// XML request?
//-----------------------------------------
return $return;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNotification(){\n\n\n}",
"public function getNewWindow() {}",
"public function getNewWindow() {}",
"function wd_notification() {\n return WeDevs_Notification::init();\n}",
"function messages_notifier() {\n\tif (elgg_is_logged_in()) {\n\t\t$class = \"elgg-icon elgg-icon-mail\";\n\t\t$text = \"<span class='$class'></span>\";\n\t\t$tooltip = elgg_echo(\"messages\");\n\t\t\n\t\t// get unread messages\n\t\t$num_messages = (int)messages_count_unread();\n\t\tif ($num_messages != 0) {\n\t\t\t$text .= \"<span class=\\\"messages-new\\\">$num_messages</span>\";\n\t\t\t$tooltip .= \" (\" . elgg_echo(\"messages:unreadcount\", array($num_messages)) . \")\";\n\t\t}\n\n\t\telgg_register_menu_item('topbar', array(\n\t\t\t'name' => 'messages',\n\t\t\t'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,\n\t\t\t'text' => $text,\n\t\t\t'priority' => 600,\n\t\t\t'title' => $tooltip,\n\t\t));\n\t}\n}",
"public function maybe_create_notification() {\n\t\tif ( ! $this->should_show_notification() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! $this->notification_center->get_notification_by_id( self::NOTIFICATION_ID ) ) {\n\t\t\t$notification = $this->notification();\n\t\t\t$this->notification_helper->restore_notification( $notification );\n\t\t\t$this->notification_center->add_notification( $notification );\n\t\t}\n\t}",
"public function notification();",
"public function notification();",
"public function getMessenger();",
"public function getPopup() {}",
"protected function getNotification_Type_PmService()\n {\n $instance = new \\phpbb\\notification\\type\\pm(${($_ = isset($this->services['dbal.conn']) ? $this->services['dbal.conn'] : ($this->services['dbal.conn'] = new \\phpbb\\db\\driver\\factory($this))) && false ?: '_'}, ${($_ = isset($this->services['language']) ? $this->services['language'] : $this->getLanguageService()) && false ?: '_'}, ${($_ = isset($this->services['user']) ? $this->services['user'] : $this->getUserService()) && false ?: '_'}, ${($_ = isset($this->services['auth']) ? $this->services['auth'] : ($this->services['auth'] = new \\phpbb\\auth\\auth())) && false ?: '_'}, './../', 'php', 'phpbb_user_notifications');\n\n $instance->set_user_loader(${($_ = isset($this->services['user_loader']) ? $this->services['user_loader'] : $this->getUserLoaderService()) && false ?: '_'});\n $instance->set_config(${($_ = isset($this->services['config']) ? $this->services['config'] : $this->getConfigService()) && false ?: '_'});\n\n return $instance;\n }",
"public function view_notification()\n\t{\n\t\t$this->admin_header();\n\t\t\n\t\t//check and confirm if the total url segment is 3\n\t\t$url_segments = $this->uri->total_segments();\n\t\t\n\t\tif ($url_segments == 3) {\n\t\t\t//retrieved the unreviewed property id\n\t\t\t$notification_id = $this->uri->segment(3);\n\t\t\t\n\t\t\t//retrieve from the database all the details of this property\n\t\t\t$result = $this->Admin_model->fetch_notification_message($notification_id);\n\t\t\t\n\t\t\tif ($result === FALSE) {\n\t\t\t\tredirect('Admin/notification_list');\n\t\t\t}\n\t\t\t\n\t\t\t$data['notification_details'] = $result;\n\t\t\t\n\t\t\t$this->add_category_template('notification_message', $data);\n\t\t\t\n\t\t}else {\n\t\t\tredirect('Admin/notification_list');\n\t\t}\n\t}",
"function notify_new_income() {\n $message = new Message;\n $message\n ->setTitle('新的存款通知')\n ->setMessage('您有一笔新的收入,请查照')\n ->setUrl('/depositing_siteapi_audit.php')\n ->setDelay(5000); //顯示1sec後dismiss 不設則不會消失\n\n // get channel\n $channel = get_message_channel(\n 'backstage', // platform = [front|backstage]\n 'test' // channel\n );\n\n// send message\n mqtt_send(\n $channel,\n $message\n );\n}",
"public function getNotification($id)\n\t{\n\t\t\n\t\treturn View::make('pages.notification');\n\t}",
"public function get_portfolio_notification();",
"public function getNotifyMsg()\n {\n return $this->get(self::_NOTIFY_MSG);\n }",
"function Admin_Messages_admin_new()\n{\n // Security check - important to do this as early as possible to avoid\n // potential security holes or just too much wasted processing\n if (!pnSecAuthAction(0, 'Admin_Messages::', '::', ACCESS_ADD)) {\n return pnVarPrepHTMLDisplay(_MODULENOAUTH);\n }\n\n // Create output object - this object will store all of our output so that\n // we can return it easily when required\n\t$pnRender =& new pnRender('Admin_Messages');\n\n\t// As Admin output changes often, we do not want caching.\n\t$pnRender->caching = false;\n\n // Return the output that has been generated by this function\n return $pnRender->fetch('admin_messages_admin_new.htm');\n}",
"function pmpro_notifications()\n{\n\tif(current_user_can(\"manage_options\"))\n\t{\n\t\t$pmpro_notification = get_transient(\"pmpro_notification_\" . PMPRO_VERSION);\n\t\tif(empty($pmpro_notification))\n\t\t{\n\t\t\t//set to NULL in case the below times out or fails, this way we only check once a day\n\t\t\tset_transient(\"pmpro_notification_\" . PMPRO_VERSION, 'NULL', 86400);\n\n\t\t\t//figure out which server to get from\n\t\t\tif(is_ssl())\n\t\t\t{\n\t\t\t\t$remote_notification = wp_remote_get(\"https://notifications.paidmembershipspro.com/?v=\" . PMPRO_VERSION);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$remote_notification = wp_remote_get(\"http://notifications.paidmembershipspro.com/?v=\" . PMPRO_VERSION);\n\t\t\t}\n\n\t\t\t//get notification\n\t\t\t$pmpro_notification = wp_remote_retrieve_body($remote_notification);\n\n\t\t\t//update transient if we got something\n\t\t\tif(!empty($pmpro_notification))\n\t\t\t\tset_transient(\"pmpro_notification_\" . PMPRO_VERSION, $pmpro_notification, 86400);\n\t\t}\n\n\t\tif($pmpro_notification && $pmpro_notification != \"NULL\")\n\t\t{\n\t\t?>\n\t\t<div id=\"pmpro_notifications\">\n\t\t\t<?php echo $pmpro_notification; ?>\n\t\t</div>\n\t\t<?php\n\t\t}\n\t}\n\n\t//exit so we just show this content\n\texit;\n}",
"function createMessage($object) {\n\tglobal $USER;\n\t\n\t$message = new \\core\\message\\message();\n\t$message->component = 'local_littlehelpers';\n\t$message->name = 'paragraph52notification';\n\t$message->userfrom = $USER;\n\t\n\t// Get user\n\t$message->userto = core_user::get_user($object->useridto);\n\t\n\t// force email sending\n\t$message->userto->emailstop = 0;\n\t\n\t$message->subject = $object->subject;\n\t$message->fullmessage = $object->fullmessage;\n\t$message->fullmessageformat = FORMAT_MARKDOWN;\n\t$message->fullmessagehtml = $object->fullmessagehtml;\n\t$message->smallmessage = $object->smallmessage;\n\t$message->notification = '0';\n\t\n\t$message->contexturl = 'https://moodle.tu-darmstadt.de/local/littlehelpers/paragraph52';\n\t$message->contexturlname = 'Paragraph52';\n\t$message->replyto = \"[email protected]\";\n\n\treturn $message;\n}",
"public function trigger_notification()\n\t{\n \t\t\n\t\t $result=$this->Fb_common_func->send_notification($this->facebook,'Skywards meet me here!',array('100001187318347','1220631499','1268065008','1347427052','566769531'),'467450859982651|cf5YXgYRZZDJuvBF1_ZOyDyRJHM','100001187318347');\n\n\t echo $result;\n\t}",
"public function getNotification()\n\t{\n\t\treturn $this->notification;\n\t}",
"public function broadcastOn()\n {\n return ['new-message'.$this->for_user_id];\n }",
"public static function getNewNotificationURL() {\n return admin_url().'admin.php?page=set-notification';\n }",
"function um_messaging_open_modal() {\n\n\t\tif ( ! is_user_logged_in() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isset( $_SESSION['um_messaging_message_to'] ) ) {\n\t\t\treturn;\n\t\t} ?>\n\n\t\t<script type=\"text/javascript\">\n\t\t\tjQuery('document').ready( function(){\n\t\t\t\t<?php $message_to = $_SESSION['um_messaging_message_to']; ?>\n\t\t\t\tsetTimeout( function(){\n\t\t\t\t\tif ( jQuery('.um-message-btn[data-message_to=\"<?php echo esc_js( $message_to ); ?>\"]').length ) {\n\t\t\t\t\t\tjQuery('.um-message-btn[data-message_to=\"<?php echo esc_js( $message_to ); ?>\"]')[0].click();\n\t\t\t\t\t}\n\t\t\t\t},1000) ;\n\n\t\t\t});\n\t\t</script>\n\n\t\t<?php unset( $_SESSION['um_messaging_message_to'] );\n\t}",
"public function getNotification()\n {\n return $this->notification;\n }",
"function load_notification( ) {\n\t\tif ( check_ajax_referer( 'ht-dms', 'nonce' ) ) {\n\t\t\t$nID = pods_v_sanitized( 'nID', $_REQUEST );\n\t\t\tif ( $nID ) {\n\n\t\t\t\twp_die( ht_dms_ui()->views()->notification( null, $nID ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}",
"function popup($sid)\n{\n $uid = getuid_sid($sid);\n $unreadpopup=mysql_fetch_array(mysql_query(\"SELECT COUNT(*) FROM ibwf_popups WHERE unread='1' AND touid='\".$uid.\"'\"));\n \n \n if ($unreadpopup[0]>0)\n {\n\t $popsenabled=mysql_fetch_array(mysql_query(\"SELECT popmsg FROM ibwf_users WHERE id='\".$uid.\"'\"));\n\t if($popsenabled[0]==1) \n\t {\n\t $pminfo = mysql_fetch_array(mysql_query(\"SELECT id, text, byuid, timesent, touid, reported FROM ibwf_popups WHERE unread='1' AND touid='\".$uid.\"'\"));\n\t $pmfrm = getnick_uid($pminfo[2]);\n\t $ncl = mysql_query(\"UPDATE ibwf_popups SET unread='0' WHERE id='\".$pminfo[0].\"'\");\n\t $popmsgbox .= \"<center><strong>POP-UP Message From $pmfrm</strong>\";\n\t $popmsgbox .= \"<br/>\";\n\t $tmstamp = $pminfo[3];\n\t\t $tmdt = date(\"d m Y - H:i:s\", $tmstamp);\n\t $popmsgbox .= \"Sent At: $tmdt<br/>\";\n\t $pmtext = parsepm($pminfo[1], $sid);\n \t $pmtext = str_replace(\"/llfaqs\",\"<a href=\\\"lists.php?action=faqs&sid=$sid\\\">$sitename F.A.Qs</a>\", $pmtext);\n \t $pmtext = str_replace(\"/reader\",getnick_uid($pminfo[4]), $pmtext);\n \t $pmid=$pminfo[0];\n\t $popmsgbox .= \"Message: $pmtext\";\n\t $popmsgbox .= \"<br/>Send Reply to $pmfrm<br/></center>\";\n\t \t $popmsgbox .= \"<form action=\\\"inbxproc.php?action=sendpopup&who=$pminfo[2]&sid=$sid&pmid=$pminfo[0]\\\" method=\\\"post\\\">\";\n \t\t $popmsgbox .= \"<center><input name=\\\"pmtext\\\" maxlength=\\\"500\\\"/><br/>\";\n \t\t $popmsgbox .= \"<input type=\\\"Submit\\\" name=\\\"submit\\\" Value=\\\"Send\\\"></center></form>\";\n \t\t // $res = mysql_query(\"INSERT INTO ibwf_online SET userid='\".$uid.\"', actvtime='\".$tm.\"', place='\".$place.\"', placedet='\".$plclink.\"'\");\n \t\t $location = mysql_fetch_array(mysql_query(\"SELECT placedet FROM ibwf_online WHERE userid='\".$uid.\"'\"));\n \t\t $popmsgbox .= \"<center><a href=\\\"$location[0]&sid=$sid\\\">Skip Msg</a><br/>\";\n \t\t $popmsgbox .= \"<a href=\\\"inbxproc.php?action=rptpop&sid=$sid&pmid=$pminfo[0]\\\">Report</a></center>\";\n }\n }\n \t\t return $popmsgbox;\n}",
"public function notificationAction(){\n\t\t$this->loadLayout(); \n\t\t$this->renderLayout();\n\t}",
"public function newMsgs()\n {\n $uid = Auth::user()->id;\n $messages = Msgs::where(['to'=> $uid, 'new'=> 1]);\n return $messages;\n }",
"public function get_count_new_pm($uid = null)\n {\n\t\t$this->counter = false;\n\t\t$this->cached = false;\n\t\t$uid = intval($uid);\n\t\tif ($uid < 1) die();\n\t\t\n\t\t$res = $this->Model->getNewPmMessages($uid);\n\t\tif ($res) {\n\t\t\tdie($res);\n\t\t}\n\t\t\t\n\t\tdie();\n\t}"
]
| [
"0.6400951",
"0.60667384",
"0.60667384",
"0.60213995",
"0.5867708",
"0.58240825",
"0.58233374",
"0.58233374",
"0.5812384",
"0.5795543",
"0.5725171",
"0.56793684",
"0.5660705",
"0.5640962",
"0.56266475",
"0.5549823",
"0.55397093",
"0.5535925",
"0.55079544",
"0.5468648",
"0.546391",
"0.54392445",
"0.54115075",
"0.54000294",
"0.53929114",
"0.5390513",
"0.53865063",
"0.5360465",
"0.5349279",
"0.5346192"
]
| 0.63365966 | 1 |
/ Content search hightlight / Replaces text with highlighted blocks | function content_search_highlight( $text, $highlight )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$highlight = $this->parse_clean_value( urldecode( $highlight ) );
$loosematch = strstr( $highlight, '*' ) ? 1 : 0;
$keywords = str_replace( '*', '', str_replace( "+", " ", str_replace( "++", "+", str_replace( '-', '', trim($highlight) ) ) ) );
$keywords = str_replace( '\\', '\', $keywords );
$word_array = array();
$endmatch = "(.)?";
$beginmatch = "(.)?";
//-----------------------------------------
// Go!
//-----------------------------------------
if ( $keywords )
{
if ( preg_match("/,(and|or),/i", $keywords) )
{
while ( preg_match("/,(and|or),/i", $keywords, $match) )
{
$word_array = explode( ",".$match[1].",", $keywords );
$keywords = str_replace( $match[0], '' ,$keywords );
}
}
else if ( strstr( $keywords, ' ' ) )
{
$word_array = explode( ' ', str_replace( ' ', ' ', $keywords ) );
}
else
{
$word_array[] = $keywords;
}
if ( ! $loosematch )
{
$beginmatch = "(^|\s|\>|;)";
$endmatch = "(\s|,|\.|!|<br|&|$)";
}
if ( is_array($word_array) )
{
foreach ( $word_array as $keywords )
{
preg_match_all( "/{$beginmatch}(".preg_quote($keywords, '/')."){$endmatch}/is", $text, $matches );
for ( $i = 0; $i < count($matches[0]); $i++ )
{
$text = str_replace( $matches[0][$i], $matches[1][$i]."<span class='searchlite'>".$matches[2][$i]."</span>".$matches[3][$i], $text );
}
}
}
}
return $text;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function decode_highlight_search_results( $text ) {\n if ( is_search() ) {\n \t$sr = get_search_query();\n\t\t$keys = implode( '|', explode( ' ', get_search_query() ) );\n\t\tif ($keys != '') { // Check for empty search, and don't modify text if empty\n\t\t\t$text = preg_replace( '/(' . $keys .')/iu', '<mark class=\"search-highlight\">\\0</mark>', $text );\n\t\t}\n }\n return $text;\n}",
"public function silo_highlights()\r\n\t{\r\n\t}",
"public function silo_highlights()\n\t{\n\t}",
"function search_excerpt_highlight() {\n $excerpt = get_the_excerpt();\n $keys = implode('|', explode(' ', get_search_query()));\n $excerpt = preg_replace('/(' . $keys . ')/iu', '<strong class=\"search-highlight\">\\0</strong>', $excerpt);\n\n echo '<p>' . $excerpt . '</p>';\n}",
"function smarty_outputfilter_highlight($source, &$smarty) {\n\n $highlight = $_REQUEST['highlight'];\n\n if (isset($_GET['keywords'])) {\n $highlight .= oos_var_prep_for_os($_GET['keywords']);\n }\n\n $highlight = strip_tags($highlight);\n $sStrSize = strlen($highlight);\n\n if ($sStrSize <= 5) {\n return $source;\n }\n\n if (preg_match(oos_server_get_var('HTTP_HOST'), oos_server_get_var('HTTP_REFERER'))) {\n if (!isset($highlight) || empty($highlight)) {\n return $source;\n }\n } else {\n MyOOS_CoreApi::requireOnce('classes/class_referrer.php');\n $referrer = new referrer();\n $highlight .= $referrer->getKeywords();\n }\n\n $words = $highlight;\n if (!isset($highlight) || empty($highlight)) {\n return $source;\n }\n\n // Pull out the script blocks\n preg_match_all(\"!<script[^>]+>.*?</script>!is\", $source, $match);\n $_script_blocks = $match[0];\n $source = preg_replace(\"!<script[^>]+>.*?</script>!is\", '@@@=====@@@', $source);\n\n preg_match_all(\"!<a onmouseo[^>]+>.*!is\", $source, $match);\n $_onmouse_block = $match[0];\n $source = preg_replace(\"!<a onmouseo[^>]+>.*!is\", '@@@#=====#@@@', $source);\n\n // pull out all html tags\n preg_match_all(\"'<[\\/\\!]*?[^<>]*'si\", $source, $match);\n $_tag_blocks = $match[0];\n $source = preg_replace(\"'<[\\/\\!]*?[^<>]*'si\", '@@@:=====:@@@', $source);\n\n\n // This array is used to choose colors for supplied highlight terms\n $colorArr = array('#ffff66','#ff9999','#A0FFFF','#ff66ff','#99ff99');\n\n // Wrap all the highlight words with tags bolding them and changing\n // their background colors\n $wordArr = explode(\" \",addslashes($words));\n $i = 0;\n foreach($wordArr as $word) {\n $word = preg_quote($word);\n $source = preg_replace('~('.$word.')~si', '<span style=\"color:black;background-color:'.$colorArr[$i].';\">$1</span>', $source);\n $i++;\n }\n\n // replace script blocks\n foreach($_script_blocks as $curr_block) {\n $source = preg_replace(\"!@@@=====@@@!\",$curr_block,$source,1);\n }\n\n foreach($_onmouse_block as $curr_block) {\n $source = preg_replace(\"!@@@#=====#@@@!\",$curr_block,$source,1);\n }\n\n foreach($_tag_blocks as $curr_block) {\n $source = preg_replace(\"!@@@:=====:@@@!\",$curr_block,$source,1);\n }\n\n return $source;\n }",
"function _highlightText($text = '') \n {\n if ($text == '')\n return '';\n $str = $text;\n\n $str = str_replace(\"\\2\", $this->hlbeg, $str);\n $str = str_replace(\"\\3\", $this->hlend, $str);\n return $str;\n }",
"function highlight_this($text, $words)\n\t{\n\t\t$words = trim($words);\n\t\t$the_count = 0;\n\t\t$wordsArray = explode(' ', $words);\n\t\t\tforeach($wordsArray as $word) {\n\t\t\t if(strlen(trim($word)) != 0)\n\t\t\t\n\t\t\t //exclude these words from being replaced\n\t\t\t $exclude_list = array(\"word1\", \"word2\", \"word3\");\n\t\t\t// Check if it's excluded\n\t\t\tif($word!=\"\")\n\t\t\t{\n\t\t\tif ( in_array( strtolower($word), $exclude_list ) ) {\n\t \n\t\t\t} else {\n\t\t\t\t//$text = str_replace($word, \"<span class=\\\"highlight\\\">\".$word.\"</span>\", $text, $count);\n\t\t//\t\t$text = str_replace($word, \"<span class=\\\"highlight\\\">\".$word.\"</span>\", $text);\n\t\t\t\t$text = preg_replace ( \"/\".$word.\"/i\", \"<span class=\\\"highlight\\\">\".$word.\"</span>\", $text );\n\t\t\t\t//$the_count = $count + $the_count;\n\t\t\t\t}\n\t\t\t}\n\t\t\t \n\t\t}\n\t\t//added to show how many keywords were found\n\t\t//echo \"<br><div class=\\\"emphasis\\\">A search for <strong>\" . $words. \"</strong> found <strong>\" . $the_count . \"</strong> matches within the \" . $the_place. \".</div><br>\";\n\t \n\t\treturn $text;\n\t}",
"function highlight()\n{\n // echo \"data coming from hooks\";\n // intercept output\n $CI =& get_instance();\n $data = $CI->output->get_output();\n // find the quote and make it an array of words!\n // substr(string,start,length) method // 16 is for p tag stuff\n $quote = substr($data, strpos($data, '<p class=\"lead\">') + 16,\n strpos($data, '</p>') - (strpos($data, '<p class=\"lead\">') + 16));\n // get all the required data into aaray form \n $newdata = explode(\" \", $quote);\n // create new array for updated quote\n $requiredoutput = array();\n // iterate all the words and add strong tag to them, if there is any capital word \n foreach($newdata as $word)\n {\n if( preg_match(\"/[A-Z]+/\", $word) )\n {\n $word = \"<strong>\" . $word . \"</strong>\";\n }\n $requiredoutput[] = $word;\n }\n // put everything together\n $newquote = implode(\" \", $requiredoutput);\n $newquote = '<p class=\"lead\">' . $newquote . '</p>';\n $data = preg_replace('#<p class=\"lead\">.+</p>#', $newquote, $data);\n // output the page!\n $CI->output->set_output($data);\n $CI->output->_display();\n}",
"function tep_find_and_highlight($source_string, $search_keywords){\n\t$changed = false;\n\t$lower_string = strtolower($source_string);\n\t$position_array = array();\n\tfor ($i = 0, $n = strlen($lower_string); $i < $n; $i++) {\n\t\t$position_array[$i] = 0;\n\t}\n\tfor ($i = 0, $n = sizeof($search_keywords); $i < $n; $i++) {\n\t\t$length_keywords = strlen($search_keywords[$i]);\n\t\tif ($length_keywords > 0) {\n\t\t\t$keyword = strtolower($search_keywords[$i]);\n\t\t\t$curr_position = 0;\n\t\t\tdo {\n\t\t\t\t$str_pos = strpos ($lower_string, $keyword, $curr_position);\n\t\t\t\tif ($str_pos !== false){\n\t\t\t\t\tfor ($j = $str_pos, $m = $str_pos + $length_keywords; $j < $m; $j++) {\n\t\t\t\t\t\t$position_array[$j] = 1;\n\t\t\t\t\t}\n\t\t\t\t\t$curr_position = $str_pos + $length_keywords;\n\t\t\t\t\t$changed = true;\n\t\t\t\t}\n\t\t\t} while ($str_pos !== false);\n\t\t}\n\t}\n\tif ($changed == true) {\n\t\t$open_tag = false;\n\t\t$result_string = '';\n\t\tfor ($i = 0, $n = sizeof($position_array); $i < $n; $i++) {\n\t\t\tif ($position_array[$i] == 1) {\n\t\t\t\tif ($open_tag == false) {\n\t\t\t\t\t$result_string .= '<span style=\"color:red;font-weight:bold;\">';\n\t\t\t\t\t$open_tag = true;\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\tif ($open_tag == true) {\n\t\t\t\t\t$result_string .= '</span>';\n\t\t\t\t\t$open_tag = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$result_string .= $source_string{$i};\n\t\t}\n\t\tif ($open_tag == true) { $result_string .= '</span>'; }\n\t\treturn $result_string;\n\t}else {\n\t\treturn $source_string;\n\t}\n}",
"function sql_highlight(&$code)\n\n{\n\n $code = strtr($code, array('\"\"' => get_placeholder(9), \"''\" => get_placeholder(10)));\n\n $blocks = array(\n\n array(\n\n 'pattern' => \"#(['\\\"`])(\\\\\\\\\\\\\\\\|.*?([^\\\\\\\\]|[^\\\\\\\\](\\\\\\\\\\\\\\\\)+)|)\\\\1#se\",\n\n //'replacement' => 'parse_c_string(\\'$0\\', \\'sql\\', \\'|""|\\\\\\'\\\\\\'\\')'\n\n //'pattern' => \"#(['\\\"])(.*?([^\\\\\\\\]|(\\\\\\\\\\\\\\\\)+)|)\\\\1#s\",\n\n 'prefix' => '<span class=\"sql_string\">', \n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => \"#/\\\\*(.*?)\\\\*/#s\",\n\n 'prefix' => '<span class=\"sql_blockcomment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => \"#--(.*?)[\\n\\r]#\",\n\n 'prefix' => '<span class=\"sql_linecomment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n );\n\n $secondaries = array(\n\n array(\n\n 'pattern' => '#(\\W|^)(\\.?[0-9][0-9a-zA-Z.]*)#i',\n\n 'replacement' => '<span class=\"sql_number\">$2</span>',\n\n 'keepprefix' => 1\n\n ),\n\n array(\n\n 'pattern' => '#([,\\[\\]\\{\\};=\\+\\-!%\\^&*\\(\\)<>|])#',\n\n 'prefix' => '<span class=\"sql_symbol\">',\n\n 'suffix' => '</span>'\n\n ),\n\n );\n\n \n\n $kw = array(\n\n array(\n\n 'prefix' => '<span '.get_placeholder(8).'=\"sql_keyword\">',\n\n 'suffix' => '</span>',\n\n 'keywords' => array('abs','absolute','access','acos','add','add_months','adddate','admin','after','aggregate','all','allocate','alter','and','any','app_name','are','array','as','asc','ascii','asin','assertion','at','atan','atn2','audit','authid','authorization','autonomous_transaction','avg','before','begin','benchmark','between','bfilename','bin','binary','binary_checksum','binary_integer','bit','bit_count','bit_and','bit_or','blob','body','boolean','both','breadth','bulk','by','call','cascade','cascaded','case','cast','catalog','ceil','ceiling','char','char_base','character','charindex','chartorowid','check','checksum','checksum_agg','chr','class','clob','close','cluster','coalesce','col_length','col_name','collate','collation','collect','column','comment','commit','completion','compress','concat','concat_ws','connect','connection','constant','constraint','constraints','constructorcreate','contains','containsable','continue','conv','convert','corr','corresponding','cos','cot','count','count_big','covar_pop','covar_samp','create','cross','cube','cume_dist','current','current_date','current_path','current_role','current_time','current_timestamp','current_user','currval','cursor','cycle','data','datalength','databasepropertyex','date','date_add','date_format','date_sub','dateadd','datediff','datename','datepart','day','db_id','db_name','deallocate','dec','declare','decimal','decode','default','deferrable','deferred','degrees','delete','dense_rank','depth','deref','desc','describe','descriptor','destroy','destructor','deterministic','diagnostics','dictionary','disconnect','difference','distinct','do','domain','double','drop','dump','dynamic','each','else','elsif','empth','encode','encrypt','end','end-exec','equals','escape','every','except','exception','exclusive','exec','execute','exists','exit','exp','export_set','extends','external','extract','false','fetch','first','first_value','file','float','floor','file_id','file_name','filegroup_id','filegroup_name','filegroupproperty','fileproperty','for','forall','foreign','format','formatmessage','found','freetexttable','from','from_days','fulltextcatalog','fulltextservice','function','general','get','get_lock','getdate','getansinull','getutcdate','global','go','goto','grant','greatest','group','grouping','having','heap','hex','hextoraw','host','host_id','host_name','hour','ident_incr','ident_seed','ident_current','identified','identity','if','ifnull','ignore','immediate','in','increment','index','index_col','indexproperty','indicator','initcap','initial','initialize','initially','inner','inout','input','insert','instr','instrb','int','integer','interface','intersect','interval','into','is','is_member','is_srvrolemember','is_null','is_numeric','isdate','isnull','isolation','iterate','java','join','key','lag','language','large','last','last_day','last_value','lateral','lcase','lead','leading','least','left','len','length','lengthb','less','level','like','limit','limited','ln','lpad','local','localtime','localtimestamp','locator','lock','log','log10','long','loop','lower','ltrim','make_ref','map','match','max','maxextents','mid','min','minus','minute','mlslabel','mod','mode','modifies','modify','module','month','months_between','names','national','natural','naturaln','nchar','nclob','new','new_time','newid','next','next_day','nextval','no','noaudit','nocompress','nocopy','none','not','nowait','null','nullif','number','number_base','numeric','nvl','nvl2','object','object_id','object_name','object_property','ocirowid','oct','of','off','offline','old','on','online','only','opaque','open','operator','operation','option','or','ord','order','ordinalityorganization','others','out','outer','output','package','pad','parameter','parameters','partial','partition','path','pctfree','percent_rank','pi','pls_integer','positive','positiven','postfix','pow','power','pragma','precision','prefix','preorder','prepare','preserve','primary','prior','private','privileges','procedure','public','radians','raise','rand','range','rank','ratio_to_export','raw','rawtohex','read','reads','real','record','recursive','ref','references','referencing','reftohex','relative','release','release_lock','rename','repeat','replace','resource','restrict','result','return','returns','reverse','revoke','right','rollback','rollup','round','routine','row','row_number','rowid','rowidtochar','rowlabel','rownum','rows','rowtype','rpad','rtrim','savepoint','schema','scroll','scope','search','second','section','seddev_samp','select','separate','sequence','session','session_user','set','sets','share','sign','sin','sinh','size','smallint','some','soundex','space','specific','specifictype','sql','sqlcode','sqlerrm','sqlexception','sqlstate','sqlwarning','sqrt','start','state','statement','static','std','stddev','stdev_pop','strcmp','structure','subdate','substr','substrb','substring','substring_index','subtype','successful','sum','synonym','sys_context','sys_guid','sysdate','system_user','table','tan','tanh','temporary','terminate','than','then','time','timestamp','timezone_abbr','timezone_minute','timezone_hour','timezone_region','to','to_char','to_date','to_days','to_number','to_single_byte','trailing','transaction','translate','translation','treat','trigger','trim','true','trunc','truncate','type','ucase','uid','under','union','unique','unknown','unnest','update','upper','usage','use','user','userenv','using','validate','value','values','var_pop','var_samp','varchar','varchar2','variable','variance','varying','view','vsize','when','whenever','where','with','without','while','with','work','write','year','zone')\n\n )\n\n );\n\n $code = generic_highlight($code, $blocks, $secondaries, array(), $kw);\n\n // put escapes back in\n\n return strtr($code, array(get_placeholder(9) => '<span class=\"sql_string\">""</span>', get_placeholder(10) => '<span class=\"sql_string\">\\'\\'</span>'));\n\n}",
"function smarty_outputfilter_highlight($source, &$smarty) {\n global $feature_referer_highlight;\n\n $highlight = $_REQUEST['highlight'];\n if(isset($feature_referer_highlight) && $feature_referer_highlight == 'y') {\n $refererhi = _refererhi();\n if(isset($refererhi) && !empty($refererhi)) {\n if(isset($highlight) && !empty($highlight)) {\n $highlight = $highlight.\" \".$refererhi;\n } else {\n $highlight = $refererhi;\n }\n }\n }\n if (!isset($highlight) || empty($highlight)) {\n return $source;\n }\n\n\t$beginTag = '<!--HIGHLIGHT BEGIN-->';\n\t$endTag = '<!--HIGHLIGHT END-->';\n\t\n\t$beginPosition = strpos($source, $beginTag);\n\t$endPosition = strpos($source, $endTag);\n\t//return \"beginPosition: $beginPosition<br/>endPosition: $endPosition<br/>\" . ((!empty($beginPosition) && !empty($endPosition)) ? \"ok\" : \"nao\");\n\t\n\tif (!empty($beginPosition) && !empty($endPosition)) {\n\t\t$begin = substr($source, 0, $beginPosition);\n\t\t$mid = substr($source, $beginPosition + strlen($beginTag), $endPosition - $beginPosition - strlen($beginTag));\n\t\t$end = substr($source, $endPosition + strlen($endTag));\n\t} else {\n\t // highlight não funciona mais sem as tags $beginTag e $endTag, pra evitar q ele seja chamado em vários níveis.\n\t return $source;\n\t}\n\t\n\t$source = ''; // save memory\n\t\n\tglobal $enlightPattern;\n\t$enlightPattern = _enlightColor($highlight); // set colors\n\t\n\t$mid = preg_replace_callback('/>([^<>]+)</', '_findMatch', $mid);\n\t\n\t$mid = preg_replace_callback(\"/tooltip\\('[^']+?'\\)/\",'_fixTooltip', $mid);\n\treturn $begin . $mid . $end;\n\n }",
"function vb_highlight(&$code)\n\n{\n\n $code = str_replace('\"\"', get_placeholder(10), $code);\n\n $blocks = array(\n\n array(\n\n 'pattern' => '#\".+?\"#',\n\n 'prefix' => '<span class=\"vb_string\">', \n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => \"#'.*#\",\n\n 'prefix' => '<span class=\"vb_comment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n );\n\n \n\n $secondaries = array(\n\n array(\n\n 'pattern' => '!([\\n\\r]|^)\\s*?#.*!',\n\n 'prefix' => '<span class=\"vb_preprocessor\">',\n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => '!(\\W|^)(\\.?[0-9][0-9.]*|&[hH][0-9a-fA-F]*)!',\n\n 'replacement' => '<span class=\"vb_number\">$2</span>',\n\n 'keepprefix' => 1\n\n ),\n\n array(\n\n 'pattern' => '~[,=\\+\\-!%\\^&\\*\\(\\)\\<\\>#$|]~',\n\n 'prefix' => '<span class=\"vb_symbol\">',\n\n 'suffix' => '</span>'\n\n )\n\n );\n\n \n\n $kw = array(\n\n array(\n\n 'prefix' => '<span '.get_placeholder(8).'=\"vb_keyword\">',\n\n 'suffix' => '</span>',\n\n 'keywords' => array('addhandler','addressof','andalso','alias','and','ansi','as','assembly','attribute','auto','begin','call','case','catch','cbool','cbyte','cchar','cdate','cdec','cdbl','char','cint','class','clng','cobj','compare','const','continue','cshort','csng','cstr','ctype','declare','default','delegate','dim','do','each','else','elseif','end','erase','error','event','exit','explicit','finally','for','friend','function','get','gettype','global','gosub','goto','handles','if','implement','implements','imports','in','inherits','interface','is','let','lib','like','load','loop','lset','me','mid','mod','module','mustinherit','mustoverride','mybase','myclass','namespace','new','next','not','nothing','notinheritable','notoverridable','on','open','option','or','orelse','overloads','overridable','overrides','paramarray','preserve','property','raiseevent','readonly','redim','rem','removehandler','rset','resume','return','select','set','shadows','shared','step','stop','structure','sub','synclock','then','throw','to','try','typeof','unload','unicode','until','wend','when','while','with','withevents','writeonly','xor')\n\n ),\n\n array(\n\n 'prefix' => '<span '.get_placeholder(8).'=\"vb_type\">',\n\n 'suffix' => '</span>',\n\n 'keywords' => array('boolean','byref','byte','byval','currency','date','decimal','double','enum','false','integer','long','object','optional','private','protected','public','short','single','static','string','true','type','variant')\n\n ),\n\n );\n\n $code = generic_highlight($code, $blocks, $secondaries, array(), $kw);\n\n // put escapes back in\n\n return str_replace(get_placeholder(10), '<span class=\"vb_string\">""</span>', $code);\n\n}",
"function getHighlightedContent($results, $id) {\n foreach($results as $result) {\n if( $result->id == $id ) {\n $str = strip_tags($result->content);\n //echo $str . \"<br /><br />\";\n $str = '...' . str_replace(\"#TERM#\", \"<strong>\", $str);\n $str = str_replace(\"#/TERM#\", \"</strong>\", $str);\n $str = str_replace(\"#BREAK#\", \"<br />...\", $str);\n return $str;\n }\n }\n }",
"public function highlightMatches(string $query, string $text): string\n\t{\n\t\t$queryWords = str_word_count($query, 1, implode('', $this->specialChars));\n\t\t$snippetWords = str_word_count(str_replace('-', ' ', $text), 1, implode('', $this->specialChars));\n\t\t$replaces = [];\n\t\tforeach ($queryWords as $word) {\n\t\t\tforeach ($snippetWords as $snippetWord) {\n\t\t\t\t// case-insensitive matching. accent-insensitive matching\n\t\t\t\tif (strtolower(str_replace($this->specialChars, $this->specialReplaces, $word)) ===\n\t\t\t\t\tstrtolower(str_replace($this->specialChars, $this->specialReplaces, $snippetWord))) {\n\t\t\t\t\t$replaces['/\\b' . preg_quote($snippetWord, '/') . '\\b/'] = str_replace('%word%', $snippetWord, $this->highlightTemplate);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn preg_replace(array_keys($replaces), array_values($replaces), $text);\n\t}",
"function wrapHTMLHighlight($text, $additionalClasses = \"\") {\n\t\treturn wrapHTMLSpan($text, \"dgNPCHighlight \".$additionalClasses);\t\n}",
"function highlight($text, $expression, $highlight) {\n if (!$highlight || !$expression)\n {\n return $text;\n }\n \n if (is_array($expression) && (count($expression) == 0) )\n {\n return $text;\n }\n \n // add a tag in front (is needed for preg_match_all to work correct)\n $text = '<!--h-->' . $text;\n \n // split the HTML up so we have HTML tags\n // $matches[0][i] = HTML + text\n // $matches[1][i] = HTML\n // $matches[2][i] = text\n\t$matches = array();\n preg_match_all('/(<[^>]+>)([^<>]*)/', $text, $matches);\n \n // throw it all together again while applying the highlight to the text pieces\n $result = '';\n $count_matches = count($matches[2]);\n for ($i = 0; $i < $count_matches; $i++) {\n if ($i != 0)\n {\n $result .= $matches[1][$i];\n }\n \n if (is_array($expression) )\n {\n foreach ($expression as $regex)\n {\n if ($regex)\n {\n $matches[2][$i] = @preg_replace(\"#\".$regex.\"#i\", $highlight, $matches[2][$i]);\n }\n }\n \n $result .= $matches[2][$i];\n }\n else\n {\n $result .= @preg_replace(\"#\".$expression.\"#i\", $highlight, $matches[2][$i]);\n }\n }\n \n return $result;\n}",
"public function highlight($text, array $options = []);",
"function highlight_paragraph($string, $keyword) {\n\t//$string = '<p>foo<b>bar</b></p>';\n\t//$keyword = 'foo';\n\t\n\t\n\t$dom = new DomDocument();\n\t$dom->loadHtml($string);\n\t$xpath = new DomXpath($dom);\n\t$elements = $xpath->query('//*[contains(.,\"'.$keyword.'\")]');\n\tforeach ($elements as $element) {\n \t foreach ($element->childNodes as $child) {\n \t if (!$child instanceof DomText) continue;\n \t $fragment = $dom->createDocumentFragment();\n \t $text = $child->textContent;\n\t\t\t\t\techo 'text content: ' . $text . '<br/>';\n \t while (($pos = stripos($text, $keyword)) !== false) {\n \t \t\techo 'TEXT: ' . $text . '<br/>';\n \t \t\techo 'keyword found in: ' . $pos . '<br/>';\n \t $fragment->appendChild(new DomText(substr($text, 0, $pos)));\n \t echo 'Making a child from 0 to ' . $pos . '<br/>'; \n \t $word = substr($text, $pos, strlen($keyword));\n \t echo 'Highlighting word: ' . $word . ' <br/>';\n \t $highlight = $dom->createElement('span');\n \t $highlight->appendChild(new DomText($word));\n \t //$highlight->setAttribute('class', 'highlight');\n \t $highlight->setAttribute('class', 'ht');\n \t $fragment->appendChild($highlight);\n \t $text = substr($text, $pos + strlen($keyword));\n \t echo 'TEXT IS NOT JUST: ' . $text . '<br/>'; \n \t }\n \t if (!empty($text)) $fragment->appendChild(new DomText($text));\n \t echo 'replacing child with fragment...<br/>';\n \t $element->replaceChild($fragment, $child);\n \t}\n\t}\n\t//$string = $dom->saveXml($dom->getElementsByTagName('body')->item(0)->firstChild);\n\t$string = $dom->saveHTML();\n\treturn $string;\n}",
"static function highlight( $text, $words ) {\n\t\t$highlighted = preg_filter( '/' . preg_quote( $words ) . '/i', '<strong class=\"highlight\">$0</strong>', $text );\n\n\t\tif ( ! empty( $highlighted ) ) {\n\t\t\t$text = $highlighted;\n\t\t}\n\n\t\treturn $text;\n\t}",
"function crumble_stdHLight($atts, $content = null) {\r\n\treturn '<span class=\"highlight\">' . do_shortcode ( $content ) . '</span>';\r\n}",
"function php_highlight(&$code)\n\n{\n\n if(preg_match('#^(\\s*)(\\<\\?(php|))#i', $code, $open_tag, PREG_OFFSET_CAPTURE))\n\n {\n\n $code = substr($code, strlen($open_tag[0][0]));\n\n $open_tag = $open_tag[1][0].'<span class=\"php_tag\">'.htmlspecialchars($open_tag[2][0]).'</span>';\n\n }\n\n if(preg_match('#(\\?\\>)(\\s*)$#', $code, $end_tag, PREG_OFFSET_CAPTURE))\n\n {\n\n $code = substr($code, 0, -strlen($end_tag[0][0]));\n\n $end_tag = '<span class=\"php_tag\">'.htmlspecialchars($end_tag[1][0]).'</span>'.$end_tag[2][0];\n\n }\n\n \n\n $blocks = array(\n\n array(\n\n 'pattern' => '#\\?\\>(.*?)(\\<\\?(php()|(\\s))|($()))#ise',\n\n 'replacement' => '\\'<span class=\"php_tag\">?></span>\\'.block_background(html_highlight(str_replace(\\'\\\\\\\\\\\\\\\\\"\\', \\'\"\\',\\'$1\\')), \\'php_html\\').\\'<span class=\"php_tag\">\\'.htmlspecialchars(\\'$2\\').\\'</span>\\'',\n\n 'keepsuffix' => 4\n\n ),\n\n array(\n\n 'pattern' => \"#'\".GENERAL_BACKSLASH_ESC_PREG.\"'#se\",\n\n 'replacement' => 'parse_php_string_simple(\\'$0\\')',\n\n //'prefix' => '<span class=\"php_string\">', \n\n //'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => '#\"'.GENERAL_BACKSLASH_ESC_PREG.'\"#se',\n\n 'replacement' => '\\'<span class=\"php_string_d\">"\\'.parse_php_string(\\'$1\\').\\'"</span>\\''\n\n ),\n\n array(\n\n 'pattern' => \"#\\<\\<\\<(.+?)([\\n\\r])(.*?)([\\n\\r]\\\\1)#se\",\n\n 'replacement' => '\\'<span class=\"php_string_h\"><<<$1$2\\'.parse_php_string(\\'$3\\').\\'$4</span>\\''\n\n ),\n\n array(\n\n 'pattern' => \"#/\\\\*(.*?)\\\\*/#s\",\n\n 'prefix' => '<span class=\"php_blockcomment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => \"#//(.*?)[\\n\\r]#\",\n\n 'prefix' => '<span class=\"php_linecomment\">', \n\n 'suffix' => '</span>'\n\n ),\n\n );\n\n \n\n $secondaries = array(\n\n array(\n\n 'pattern' => '#(\\W|^)(\\.?[0-9][0-9a-zA-Z.]*)#',\n\n 'replacement' => '<span class=\"php_number\">$2</span>',\n\n 'keepprefix' => 1\n\n ),\n\n array(\n\n 'pattern' => '#([,\\[\\]\\{\\};=\\+\\-!%\\^&\\*\\(\\)<>|@.~])#',\n\n 'prefix' => '<span class=\"php_symbol\">',\n\n 'suffix' => '</span>'\n\n ),\n\n array(\n\n 'pattern' => '#\\$[a-zA-Z_][a-zA-Z0-9_]*#',\n\n 'prefix' => '<span class=\"php_var\">',\n\n 'suffix' => '</span>'\n\n )\n\n );\n\n \n\n $kw = array(\n\n array(\n\n 'prefix' => '<span '.get_placeholder(8).'=\"php_keyword\">',\n\n 'suffix' => '</span>',\n\n 'keywords' => array('and','or','xor','__file__','__line__','array','as','break','case','cfunction','class','const','continue','declare','default','die','do','echo','else','elseif','empty','enddeclare','endfor','endforeach','endif','endswitch','endwhile','eval','exit','extends','for','foreach','function','global','if','include','include_once','isset','list','new','old_function','print','require','require_once','return','static','switch','unset','use','var','while','__function__','__class__','php_version','php_os','default_include_path','pear_install_dir','pear_extension_dir','php_extension_dir','php_bindir','php_libdir','php_datadir','php_sysconfdir','php_localstatedir','php_config_file_path','php_output_handler_start','php_output_handler_cont','php_output_handler_end','e_error','e_warning','e_parse','e_notice','e_core_error','e_core_warning','e_compile_error','e_compile_warning','e_user_error','e_user_warning','e_user_notice','e_all','true','false','bool','boolean','int','integer','float','double','real','string','array','object','resource','null','class','extends','parent','stdclass','directory','__sleep','__wakeup','interface','implements','abstract','public','protected','private')\n\n )\n\n );\n\n $code = generic_highlight($code, $blocks, $secondaries, array(), $kw);\n\n // put back end/start tags if necessary\n\n if(isset($open_tag) && is_string($open_tag))\n\n $code = $open_tag.$code;\n\n if(isset($end_tag) && is_string($end_tag))\n\n $code .= $end_tag;\n\n \n\n return $code;\n\n}",
"public function highlight($content, $conf) {\n\n\t\t$renderer = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance(\\TYPO3\\CMS\\Core\\Page\\PageRenderer::class);\n\t\t$highlightjs = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::getFileAbsFileName($conf['library']);\n\n\t\t// Case 1: server-side syntax highlighting\n \tif (isset($conf['enablev8js']) && ($conf['enablev8js'] == 1 || $conf['enablev8js'] == \"true\") && extension_loaded('v8js')) {\n\n\t\t\t$v8 = new \\V8Js();\n\t\t\t// Remove the surrounding <pre></pre> Tag, and extract the language from its class attribute\n\t\t\tpreg_match(\"/^<pre class=\\\"(.*)\\\">(.*)<\\/pre>$/im\", $content, $out);\n\t\t\t// Escape all double quote characters and all line breaks\n\t\t\t$language = $out[1];\n\t\t\t$source = html_entity_decode($out[2], ENT_HTML5);\n\t\t\t$source = str_replace(\"<br />\", \"\\\\n\", $source);\n\t\t\t$source = str_replace(\"\\\"\", \"\\\\\\\"\", $source);\n\t\t\t$jscode = array();\n\t\t\t$jscode[] = 'var global = global || this, self = self || this, window = window || this;';\n\t\t\t$jscode[] = file_get_contents($highlightjs);\n\t\t\t$jscode[] = 'var hljs = global.hljs;';\n\t\t\t$jscode[] = 'var sourceCode = \"' . $source . '\";';\n\t\t\t$jscode[] = \"var result = hljs.highlight('\" . $language . \"', sourceCode, true).value;\";\n\t\t\t$jscode[] = 'result;';\n\t\t\t// This is a dirty fix as RteHtmlArea escapes the & and I haven't found a way to avoid this\n\t\t\t$content = str_replace(\"&\", \"&\", $v8->executeString(implode(\"\\n\", $jscode)));\n\t\t\t$content = '<pre class=\"hljs ' . $language . '\">' . $content . '</pre>';\n\n \t} else { // Case 2: client-side syntax highlighting\n\t\t\t$renderer->loadJquery();\n\t\t\t$renderer->addJsFooterFile(\\TYPO3\\CMS\\Core\\Utility\\PathUtility::getAbsoluteWebPath($highlightjs),\n\t\t \t\t'text/javascript', /* compress? */ false, false, '',\n\t\t\t\t/* excludeFromConcatenation? */ true, '|', /* async? */ false);//, /* integrity? */ 'sha256-b07457d8f5ce2d11be2d0b53a6f44416c5a1315bb60099e6cf1a66a2099d76d3');\n\t\t\t$renderer->addJsFooterInlineCode('jm_highlightjs',\n\t\t \t\t\"jQuery(document).ready(function() {\n \t\t\t\t\tjQuery('pre').each(function(i, block) {\n \t\t\t\t\thljs.highlightBlock(block);\n \t\t\t\t\t});\n\t\t\t\t});\");\n\t\t\t// Fix markup that comes from RteHtmlArea\n\t\t\t$content = str_replace(\"&\", \"&\", $content);\n\t\t\t$content = str_replace(\"<br />\", \"\\n\", $content);\n \t}\n\n\t\t// Finally add CSS stylesheet as configured\n\t\t$url = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::getFileAbsFileName('EXT:jm_highlightjs/Resources/Public/CSS/default.css');\n\t\tif (isset($conf['stylesheet'])) {\n\t\t\t$url = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::getFileAbsFileName($conf['stylesheet']);\n\t\t}\n\t\t$renderer->addCssFile(\\TYPO3\\CMS\\Core\\Utility\\PathUtility::getAbsoluteWebPath($url),\n\t\t\t'stylesheet', 'all', '', false, false, '', true);\n\t\t// And configure tab-width to 4 characters\n\t\t$renderer->addCssInlineBlock('JensMittag\\JmHighlightjs\\Hooks\\HighlightingUserFunc', '.hljs { tab-size: 4; -moz-tab-size: 4; }', true);\n\n \treturn $content;\n \t}",
"public function colorize()\n\t {\n\t\t $div = array();\n\t\t if($this->_divSurround !== null)\n\t\t {\n\t\t\t $div = $this->makeDivSurround();\n\t\t } \n\t\t \n\t\t for($i=0;$i<count($this->_aCodeFragments);$i++)\n\t\t {\n\t\t\t $this->_aCodeColorizedFragments[$i] = \"<h2>\".$this->_aCodeTitles[$i].\"</h2>\";\n\t\t\t if($this->_divSurround[\"EVERY\"] === true)\n\t\t\t {\t\t\t\t\n\t\t\t\t$this->_aCodeColorizedFragments[$i] .= $div[\"OPENTAG\"].highlight_string($this->_aCodeFragments[$i], true).$div[\"CLOSETAG\"];\n\t\t\t }\n\t\t\t else\n\t\t\t {\n\t\t\t\t $this->_aCodeColorizedFragments[$i] .= highlight_string($this->_aCodeFragments[$i], true);\n\t\t\t }\t\t\t \n\t\t }\t\t \t\t\n\t }",
"private function defineHighlight ($num) {\n $this->begin_hi = array();\n // strings for highlighting search terms \n for ($i = 0; $i < $num; $i++) {\n $this->begin_hi[$i] = \"<span class='term\" . ($i + 1) . \"'>\";\n }\n }",
"private function _highlightMatchingWord($datas)\n {\n $numResult = count($datas);\n for ($i = 0; $i < $numResult; $i++) {\n //store how much word matching\n $match = 0;\n //searching each word in title\n foreach ($this->sSearch as $word) {\n $pos = mb_stripos($datas[$i]->title, $word);\n if (is_numeric($pos) && (strlen($word) > 1)) {\n $word = mb_strtolower($word);\n $datas[$i]->title = mb_strtolower($datas[$i]->title);\n $datas[$i]->title = str_ireplace(\n $word,\n \"<b style='background-color:#ffc107;'>$word</b>\",\n $datas[$i]->title\n );\n $match++;\n }\n }\n //push to each array depend on how much word matching\n if ($match) {\n $part[$match][] = $datas[$i];\n }\n }\n //merge all document ordered by matching number form hight to low\n $wordNumb = count($this->sSearch);\n $partTmp = [];\n for ($j = $wordNumb; $j > 0; $j--) {\n if (isset($part[$j])) {\n foreach ($part[$j] as $value) {\n $partTmp[] = $value;\n }\n }\n }\n // store total of matching title\n $this->count_filtered = count($partTmp);\n // paging by cutting array\n $end = Input::get('start') + Input::get('length');\n $tmp = [];\n for ($i = Input::get('start'); $i < $end; $i++) {\n if (isset($partTmp[$i])) {\n $tmp[] = $partTmp[$i];\n }\n }\n return $tmp;\n }",
"function AbbcSyntaxHighlight($text, $incode = false)\r\n{\r\n\tglobal $ABBC;\r\n\r\n\t// Syntax Highlighting using the GeSHi class\r\n\t$lang = '';\r\n\tif ($incode) $lang = $incode;\r\n\tif ($lang == 'html') $lang = 'html4strict';\r\n\tif ($lang == 'js') $lang = 'javascript';\r\n\r\n#\tif ($lang == 'html4strict') $lang = ''; // Doesn't work right now\r\n#\tif ($lang == 'xml') $lang = ''; // Doesn't work right now\r\n\r\n\tif ($lang != '')\r\n\t{\r\n\t\t$text = str_replace('$', '$', $text);\r\n\r\n\t\t$geshi = new GeSHi(AbbcH2T($text), $lang);\r\n\t\t$geshi->set_header_type(GESHI_HEADER_DIV);\r\n\t\t$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);\r\n\t\t$geshi->set_line_style('', '');\r\n\t\t$geshi->set_line_class('cont even', 'cont odd');\r\n\t\t#$geshi->start_line_numbers_at(1);\r\n\t\t#$geshi->enable_classes();\r\n\t\t#$geshi->get_stylesheet(false);\r\n\t\t$geshi->set_tab_width(4);\r\n\t\t$geshi->set_link_styles(GESHI_LINK, 'border-bottom: dotted 1px blue;');\r\n\t\t$geshi->set_link_styles(GESHI_HOVER, '');\r\n\t\t$geshi->set_link_styles(GESHI_ACTIVE, '');\r\n\t\t$geshi->set_link_styles(GESHI_VISITED, 'border-bottom: dotted 1px blue;');\r\n\r\n\t\t$geshi->set_overall_class('');\r\n\t\t$geshi->set_overall_style('');\r\n\t\t$geshi->set_code_style('');\r\n\t\t$geshi->set_keyword_group_style(1, 'color: blue;');\r\n\t\t$geshi->set_keyword_group_style(2, 'color: blue;');\r\n\t\t$geshi->set_keyword_group_style(3, 'color: darkblue;');\r\n\t\t$geshi->set_keyword_group_style(4, 'color: blue;');\r\n\t\t$geshi->set_comments_style(1, 'color: gray;');\r\n\t\t$geshi->set_comments_style(2, 'color: gray;');\r\n\t\t$geshi->set_comments_style('MULTI', 'color: gray;');\r\n\t\t$geshi->set_escape_characters_style('color: #800080;');\r\n\t\t$geshi->set_symbols_style('color: red;');\r\n\t\t$geshi->set_strings_style('color: darkcyan;');\r\n\t\t$geshi->set_numbers_style('color: darkcyan;');\r\n\t\t$geshi->set_methods_style(1, 'color: black;');\r\n\t\t$geshi->set_methods_style(2, 'color: black;');\r\n\t\tif (in_array($lang, array('perl', 'php')))\r\n\t\t\t$geshi->set_regexps_style(0, 'color: black;'); // make $-variables black\r\n\r\n\t\t// TODO: this should really be handled by the GeSHi library\r\n\t\tif ($geshi->error != GESHI_ERROR_NO_SUCH_LANG)\r\n\t\t{\r\n\t\t\t$text = $geshi->parse_code();\r\n\t\t\t$text = str_replace(\"\\n\", \"\\r\", $text);\r\n\t\t\t$text = str_replace('<br />', '', $text);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// For unrecognised languages, use default processing for now\r\n\t\t\t$lines = explode(endl, $text);\r\n\t\t\tforeach ($lines as $no => $line)\r\n\t\t\t{\r\n\t\t\t\t$cls = $no % 2 == 0 ? 'cont even' : 'cont odd';\r\n\t\t\t\t$lines[$no] = '<div class=\"' . $cls . '\">' . rtrim($line) . '</div>';\r\n\t\t\t}\r\n\t\t\t$text = join(\"\\r\", $lines);\r\n\t\t}\r\n\t}\r\n\telseif ($ABBC['Config']['subsets'] & ABBC_PARAGRAPH)\r\n\t{\r\n\t\t$text = str_replace(\"\\n\", '
', $text);\r\n\t}\r\n\treturn $text;\r\n}",
"public function highlight($haystack) {\n $lwHaystack = self::normalize(mb_strtolower($haystack));\n $positions = array();\n\n // Look up all the needle positions\n foreach ($this->needles as $needle) {\n $offset = 0;\n while (($position = mb_strpos($lwHaystack, $needle, $offset)) !== FALSE) {\n $end = $position + mb_strlen($needle);\n $positions[] = array('start' => $position, 'end' => $end);\n $offset = $position + 1;\n }\n }\n\n // Now start highlighting areas\n $start = NULL;\n $end = NULL;\n $extraLength = 0;\n sort($positions);\n foreach ($positions as $position) {\n if ($start === NULL) {\n $start = $position['start'];\n $end = $position['end'];\n }\n else {\n if (($position['start'] <= $end) && ($position['end'] >= $end)) {\n // Overlapping areas, combine them\n $end = $position['end'];\n }\n else {\n if ($position['start'] > $end) {\n // New area found, highlight the previous area and continue with new one\n $haystack = mb_substr($haystack, 0, $start + $extraLength) . $this->openingTag . mb_substr($haystack, $start + $extraLength);\n $extraLength += mb_strlen($this->openingTag);\n\n $haystack = mb_substr($haystack, 0, $end + $extraLength) . $this->closingTag . mb_substr($haystack, $end + $extraLength);\n $extraLength += mb_strlen($this->closingTag);\n\n $start = $position['start'];\n $end = $position['end'];\n }\n }\n }\n }\n\n // Highlight the latest found area\n if (($start !== NULL) && ($end !== NULL)) {\n $haystack = mb_substr($haystack, 0, $start + $extraLength) . $this->openingTag . mb_substr($haystack, $start + $extraLength);\n $extraLength += mb_strlen($this->openingTag);\n $haystack = mb_substr($haystack, 0, $end + $extraLength) . $this->closingTag . mb_substr($haystack, $end + $extraLength);\n }\n\n return $haystack;\n }",
"public function searchHighlight($content, $keyword) {\n $text = $this->plain($content);\n $i = stripos($text, $keyword);\n $regex = preg_quote($keyword);\n $results = array();\n while($i !== false) {\n $s = substr($text, max([0, $i - 60]), 120);\n $results[] = preg_replace(\"/($regex)/i\", '<mark>$1</mark>', $s);\n $i = stripos($text, $keyword, $i+1);\n }\n return array_unique($results);\n }",
"public function testHighlightCustom()\n {\n $str = 'The quick brown fox jumps over the dog.';\n $expected = 'The quick <em>brown</em> fox jumps over the dog.';\n $this->assertEquals($expected, $this->helper->highlight($str, 'brown', '<em>$1</em>'));\n }",
"function verifyTextSearchReplaceAll(){\n parent::doExpandAdvanceSection();\n $this->type(TEXT_EDITOR, \"\");\n $this->click(LINK_SEARCH);\n $this->type(TEXT_EDITOR, (TEXT_SAMPLE));\n $this->type(INPUT_SEARCH, (TEXT_SEARCH));\n $this->type(INPUT_REPLACE, (TEXT_REPLACE));\n $this->click(BUTTON_REPLACEALL);\n $this->click(BUTTON_CANCEL);\n $this->click(BUTTON_PREVIEW);\n $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME));\n try {\n $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT1));\n } catch (PHPUnit_Framework_AssertionFailedError $e) {\n parent::doCreateScreenShot(__FUNCTION__);\n array_push($this->verificationErrors, $e->toString());\n }\n try {\n $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT2));\n } catch (PHPUnit_Framework_AssertionFailedError $e) {\n parent::doCreateScreenShot(__FUNCTION__);\n array_push($this->verificationErrors, $e->toString());\n }\n try {\n $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT3));\n } catch (PHPUnit_Framework_AssertionFailedError $e) {\n parent::doCreateScreenShot(__FUNCTION__);\n array_push($this->verificationErrors, $e->toString());\n }\n }"
]
| [
"0.7288386",
"0.71174186",
"0.7074223",
"0.70068306",
"0.67620116",
"0.6710118",
"0.67015654",
"0.6671012",
"0.6658104",
"0.65977186",
"0.6562116",
"0.63687605",
"0.6361518",
"0.634943",
"0.6315007",
"0.62904185",
"0.6215897",
"0.6215399",
"0.6213451",
"0.6178886",
"0.6067447",
"0.6065807",
"0.6054885",
"0.60480046",
"0.59955615",
"0.59516996",
"0.593034",
"0.5898705",
"0.5838828",
"0.5834477"
]
| 0.7621918 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.