• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Core类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Core的典型用法代码示例。如果您正苦于以下问题:PHP Core类的具体用法?PHP Core怎么用?PHP Core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Core类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     $this->__core = Core::getInstance();
     $this->__lib = $this->__core->getLib();
     $this->__uri = $this->__core->getUri();
     $this->__req = $this->__core->getRequest();
 }
开发者ID:dalinhuang,项目名称:StudentManage,代码行数:7,代码来源:page.php


示例2: getGoodsinfo

 public function getGoodsinfo()
 {
     $goodsinfos = array();
     $db = new Core();
     $query = "SELECT g.*,\n                  gv.field as gvkey,\n                  gv.value as gvvalue,\n                  o.telphone as mobile,\n                  o.order_quantity as goods_number,\n                  o.goods_value as goods_value\n                  FROM " . DB_PREFIX . "goodslist g\n                  LEFT JOIN  " . DB_PREFIX . "order o \n                  ON g.order_id=o.id\n                  LEFT JOIN  " . DB_PREFIX . "goodsextensionvalue gv \n                  ON g.order_id=gv.id\n                  WHERE \n                  1\n                  and o.order_id='" . $this->order_id . "'";
     $mresult = $db->query($query);
     if (!$mresult) {
         $this->BundleGoods = $goodsinfos;
         return;
     }
     foreach ($mresult as $result) {
         $goods = json_decode(urldecode($result['extensions']), 1);
         $goods['goods_number'] = $result['goods_number'];
         $goods['goods_value'] = $result['goods_value'];
         //$goods['mobile'] = $result['mobile'];
         if ($result['gvkey'] == 'session') {
             $goods['session'] = $result['gvvalue'];
         }
         $goodsinfos[$result['bundle_id']]['goods'][] = $goods;
     }
     //file_put_contents('./cache/mobile.txt',var_export($result,1));
     $query = "SELECT *\n                  FROM " . DB_PREFIX . "order \n                  \n                  WHERE \n                  1\n                  and order_id='" . $this->order_id . "'";
     $re = $db->query($query, '');
     $this->mobile = $re[0]['telphone'];
     // = '18021806556';
     $this->BundleGoods = $goodsinfos;
 }
开发者ID:h3len,项目名称:Project,代码行数:27,代码来源:sms.class.php


示例3: checkNeededDataGoogleSearchAnalytics

 /**
  *  Query database.  Retrun all values from a table
  *
  *  @param $table     String   Table name
  *
  *  @returns   Object   Database records.  MySQL object
  */
 public function checkNeededDataGoogleSearchAnalytics($website)
 {
     $core = new Core();
     //Load core
     $mysql = new MySQL();
     //Load MySQL
     $now = $core->now();
     /* Identify date range */
     $dateStartOffset = self::GOOGLE_SEARCH_ANALYTICS_MAX_DATE_OFFSET + self::GOOGLE_SEARCH_ANALYTICS_MAX_DAYS;
     $dateStart = date('Y-m-d', strtotime('-' . $dateStartOffset . ' days', $now));
     $dateEnd = date('Y-m-d', strtotime('-' . self::GOOGLE_SEARCH_ANALYTICS_MAX_DATE_OFFSET . ' days', $now));
     /* Query database for dates with data */
     $query = "SELECT COUNT( DISTINCT date ) AS record, date FROM " . MySQL::DB_TABLE_SEARCH_ANALYTICS . " WHERE domain LIKE '" . $website . "' AND date >= '" . $dateStart . "' AND date <= '" . $dateEnd . "' GROUP BY date";
     $result = $mysql->query($query);
     /* Create array from database response */
     $datesWithData = array();
     foreach ($result as $row) {
         array_push($datesWithData, $row['date']);
     }
     /* Get date rante */
     $dates = $core->getDateRangeArray($dateStart, $dateEnd);
     /* Loop through dates, removing those with data */
     foreach ($dates as $index => $date) {
         if (in_array($date, $datesWithData)) {
             unset($dates[$index]);
         }
     }
     /* Reindex dates array */
     $dates = array_values($dates);
     $returnArray = array('dateStart' => $dateStart, 'dateEnd' => $dateEnd, 'datesWithNoData' => $dates);
     return $returnArray;
 }
开发者ID:ctseo,项目名称:organic-search-analytics,代码行数:39,代码来源:dataCapture.php


示例4: getAppRoute

 public function getAppRoute($route_name, $app_id = null)
 {
     if (!$this->mappingRepository) {
         $this->mappingRepository = $this->doctrine->getManager()->getRepository('UnifikSystemBundle:Mapping');
     }
     $mapping = $this->mappingRepository->findOneBy(array('app' => $app_id ? $app_id : $this->systemCore->getApplicationCore()->getApp()->getId(), 'type' => 'route', 'target' => $route_name), array('section' => 'ASC'));
     if ($mapping) {
         // Faut checker toutes les routes, à cause du mapping alias
         $routes = $this->router->getRouteCollection()->all();
         foreach ($routes as $name => $route) {
             if ($defaults = $route->getDefaults()) {
                 if (array_key_exists('_unifikRequest', $defaults) && array_key_exists('mappedRouteName', $defaults['_unifikRequest'])) {
                     $real_name = preg_replace('/^[aA-zZ]{2}__[A-Z]{2}__/', '', $defaults['_unifikRequest']['mappedRouteName']);
                     // On a trouvé la bonne route
                     if ($real_name == $route_name) {
                         return preg_replace('/^[aA-zZ]{2}__[A-Z]{2}__/', '', $name);
                     }
                 }
             }
         }
         // On a rien trouvé... on retourne la route "par défaut" de la section
         return 'section_id_' . $mapping->getSection()->getId();
     }
     // Aucun mapping... on fallback sur la premiere route disponible (?)
     $mapping = $this->mappingRepository->findOneBy(array('type' => 'route', 'target' => $route_name), array('section' => 'ASC'));
     if ($mapping) {
         return 'section_id_' . $mapping->getSection()->getId();
     }
     // Rien de concluant
     return null;
 }
开发者ID:pmdc,项目名称:UnifikSystemBundle,代码行数:31,代码来源:ApplicationPathExtension.php


示例5: populatePPMTable

 private function populatePPMTable($counter, $result_row)
 {
     $core = new Core();
     $number_Of_houses = $core->getNumberofHouses($this->loc_table, $result_row['location']);
     $this->total_num_of_houses += $number_Of_houses;
     $per_street_year = $number_Of_houses * 12;
     $this->total_expected += $per_street_year;
     $date_done = $result_row['date_done'];
     $done_till_date = $core->getTillDate($number_Of_houses, $date_done);
     $this->expected_rate += $done_till_date;
     $houses_serviced = $result_row['houses_serviced'];
     $this->total_num_of_houses_serviced += $houses_serviced;
     $status_tiil_date = $core->getStatusTillDate($number_Of_houses, $houses_serviced);
     $current_satus = $core->getcurrentStatus($houses_serviced, $number_Of_houses, $status_tiil_date);
     $calls_generated = $result_row['calls_gen'];
     $this->total_calls_gen += $calls_generated;
     $calls_completed = $result_row['calls_comp'];
     $this->total_calls_gen += $calls_completed;
     $no_access = $number_Of_houses - $houses_serviced;
     $this->no_access_loc += $no_access;
     $out = "";
     $id = $result_row['S/N'];
     $out .= " <tr>";
     $out .= "<td >{$counter}</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='job_id'>" . $result_row['job_id'] . "</td>\n\t<td>" . $result_row['location'] . "</td><td>" . $number_Of_houses . "</td><td>Monthly</td>";
     $out .= "<td>" . $per_street_year . "</td><td>" . $done_till_date . "</td>";
     $out .= "<td ondblclick='myFunction(this," . $id . ")' id='houses_serviced'>" . $houses_serviced . "</td>";
     $out .= "<td >" . $status_tiil_date . " % </td><td>" . $current_satus . " % </td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='date_done'>" . $result_row['date_done'] . "</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='date_nect'>" . $result_row['date_next'] . "</td>";
     $out .= "<td ondblclick='myFunction(this," . $id . ")' id='calls_gen'>{$calls_generated}</td>";
     $out .= "<td ondblclick='myFunction(this," . $id . ")' id='calls_comp'>{$calls_completed}</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='inspection'>" . $result_row['inspection'] . "</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='noaccesslocresolved'>" . $result_row['noaccesslocresolved'] . "</td>";
     $out .= "<td>" . $no_access . "</td><td ondblclick='myFunction(this," . $id . ")' id='engineers_remark'>" . $result_row['engineers_remark'] . "</td></tr>";
     return $out;
 }
开发者ID:jerryhanks,项目名称:Melnet,代码行数:32,代码来源:PreventiveMaintenance.php


示例6: initInvoice

 private function initInvoice()
 {
     $core = new Core();
     $this->invoiceNumber = $core->generatePreformerInvoiceNumber();
     $this->jobNumber = $core->generateCmJobId();
     $details = $core->getAllStockDetails($this->materials);
     $this->stockRows .= '<tr class="item-row" id="item0">' . '<td>1</td>' . '<td class="item-name"><textarea data-role="none" class="item_name" >' . $details['part_number'] . '</textarea></td>' . '<td class="description"><textarea disabled data-role="none" class="item_description">' . $details['description'] . '</textarea></td>' . '<td><span disabled  class="cost" data-role="none" id="unitCost1"><del>N</del>' . $details['price'] . '</span></td>' . '<td><textarea  disabled  class="qty" data-role="none" id="quantity1">1</textarea></td>' . '<td><span class="price" >0.00</span></td></tr>';
 }
开发者ID:jerryhanks,项目名称:Melnet,代码行数:8,代码来源:PreformerInvoice.php


示例7: testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent

 public function testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent()
 {
     $core = new Core();
     $core->exchangeArray(array('name' => 'some name', 'id' => 123));
     $core->exchangeArray(array());
     $this->assertNull($core->name, '"name" should have defaulted to null');
     $this->assertNull($core->id, '"id" should have defaulted to null');
 }
开发者ID:elmosgot,项目名称:cool-builder,代码行数:8,代码来源:CoreTest.php


示例8: updateSubscriberList

 function updateSubscriberList($argArrPost)
 {
     $objCore = new Core();
     $varID = implode('\',\'', $argArrPost['frmSubscriberID']);
     $varWhere = "pkSubscriberID IN('" . $varID . "')";
     $this->delete(TABLE_SUBSCRIBERS, $varWhere);
     //***end here
     $objCore->setSuccessMsg(ADMIN_SUBSCRIBER_DELETE);
     return true;
 }
开发者ID:saurabhs4,项目名称:demoshop,代码行数:10,代码来源:class.subscriber.php


示例9: printBeautifulPHPCode

 function printBeautifulPHPCode($sourceCode)
 {
     require_once CODE_BEAUTIFIER_REQ;
     require_once BEAUTIFIER_PATH . FILE_SEPARATOR . "HFile" . FILE_SEPARATOR . "HFile_php3.php";
     require_once BEAUTIFIER_PATH . FILE_SEPARATOR . "Output" . FILE_SEPARATOR . "Output_HTML.php";
     $highlighter = new Core(new HFile_php3(), new Output_HTML());
     echo "<pre>";
     echo $highlighter->highlight_text($sourceCode);
     echo "</pre>";
 }
开发者ID:juddy,项目名称:GIP,代码行数:10,代码来源:phpCodeBeautifier.class.php


示例10: imageUpload

 function imageUpload($argFILES, $argVarDirLocation, $varThumbnailWidth = '', $varThumbnailHeight = '', $varMediumWidth = '', $varMediumHeight = '')
 {
     $objUpload = new upload();
     $objCore = new Core();
     $objUpload->setMaxSize();
     $objUpload->setDirectory($argVarDirLocation);
     $varIsImage = $objUpload->IsImageValid($argFILES['type']);
     if ($varIsImage) {
         $varImageExists = 'yes';
     } else {
         $varImageExists = 'no';
     }
     if ($varImageExists == 'no') {
         $objCore->setErrorMsg(IMAGE_TYPE_ERROR);
         return false;
     }
     if ($varImageExists == 'yes') {
         $objUpload->setTmpName($argFILES['tmp_name']);
         if ($objUpload->userTmpName) {
             $objUpload->setFileSize($argFILES['size']);
             $objUpload->setFileType($argFILES['type']);
             $varRandomNumber = $this->generateRandomKey();
             $fileName = $varRandomNumber . '_' . strtolower($argFILES['name']);
             $fileName = str_replace(' ', '_', $fileName);
             $objUpload->setFileName($fileName);
             $objUpload->startCopy();
             if ($objUpload->isError()) {
                 $thumbnailName1 = '_thumb';
                 $objUpload->setThumbnailName($thumbnailName1);
                 $objUpload->createThumbnail();
                 if ($varThumbnailWidth == '' && $varThumbnailHeight == '') {
                     $objUpload->setThumbnailSize();
                 } else {
                     $objUpload->setThumbnailSize($varThumbnailWidth, $varThumbnailHeight);
                 }
                 $varFileName = $objUpload->userFileName;
                 $varExt = substr(strrchr($varFileName, "."), 1);
                 $varThumbFileNameNoExt = substr($varFileName, 0, -(strlen($varExt) + 1));
                 $varThumbFileName = $varThumbFileNameNoExt . 'thumb.' . $varExt;
                 $thumbnailName1 = '';
                 $objUpload->setThumbnailName($thumbnailName1);
                 $objUpload->createThumbnail();
                 if ($varMediumWidth == '' && $varMediumHeight == '') {
                     $objUpload->setThumbnailSize();
                 } else {
                     $objUpload->setThumbnailSize($varMediumWidth, $varMediumHeight);
                 }
                 return $varFileName;
             } else {
                 $objCore->setErrorMsg(ERROR_ON_UPLOAD);
                 return false;
             }
         }
     }
 }
开发者ID:saurabhs4,项目名称:niches,代码行数:55,代码来源:class.general.php


示例11: overdueproceess

 public function overdueproceess()
 {
     $time = 2100;
     //过期时间
     $db = new Core();
     /**
      * 查询与订单号相关的商品,订单中相关信息如积分等
      */
     $query = "SELECT \n    \t          g.*,\n    \t          o.order_id as new_order_id,\n    \t          o.pay_credits as pay_credits,\n    \t          o.user_id as user_id,\n    \t\t      o.integral_status as integral_status\n    \t          FROM " . DB_PREFIX . "goodslist g\n                  LEFT JOIN " . DB_PREFIX . "order o\n                  ON g.order_id=o.id\n                  WHERE o.pay_status = 1 \n                  and o.create_time<" . (time() - $time) . " limit 0,100";
     $goodses = $db->query($query);
     if (!$goodses) {
         return;
     }
     $ids = array();
     $newgoodses = array();
     foreach ($goodses as $goods) {
         $newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['id'] = $goods['goods_id'];
         $newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['goods_number'] += $goods['goods_number'];
         $newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['bundle_id'] = $goods['bundle_id'];
         $ids[] = $goods['order_id'];
         $credits[$goods['user_id']]['id'] = $goods['order_id'];
         $credits[$goods['user_id']]['order_id'] = $goods['new_order_id'];
         $credits[$goods['user_id']]['credit'] = $goods['pay_credits'];
         $credits[$goods['user_id']]['integral_status'] = $goods['integral_status'];
         //积分的状态
     }
     $this->BundleGoods = $newgoodses;
     foreach ($newgoodses as $bundle_id => $bundlegoodses) {
         $curl = $bundle_id . "curl";
         $this->{$curl} = $this->create_curl_obj($bundle_id);
         $this->init_curl($bundle_id);
         //$Re_Minus_updateStores = $this -> opBundle('updateStore', array('operation' => 'plus'));
     }
     $Re_Minus_updateStores = $this->opBundle('updateStore', array('operation' => 'plus'));
     $orderids = implode(",", $ids);
     if (!$orderids) {
         return false;
     }
     require_once CUR_CONF_PATH . 'lib/sms.class.php';
     require_once ROOT_PATH . 'lib/class/members.class.php';
     $members = new members();
     foreach ($credits as $user => $v) {
         if (!$v['credit']) {
             continue;
         }
         $re = $members->return_credit($user, $v['credit'], $v['order_id'], 'payments', 'OrderUpdate', 'cancle', '订单:' . $v['order_id'] . '被系统取消:' . $v['title'], $v['integral_status'], '取消订单');
         if (!$re['logid']) {
             return false;
         }
     }
     $query = "UPDATE " . DB_PREFIX . "order \n                  SET order_status=24,pay_status=3,is_completed=23\n                  WHERE pay_status=1 and id in(" . $orderids . ")";
     $result = $db->query_update($query);
 }
开发者ID:h3len,项目名称:Project,代码行数:53,代码来源:Overdueorder.php


示例12: saveClientExtras

 function saveClientExtras($argArrPost)
 {
     $objCore = new Core();
     $clientExtra1 = $argArrPost['ClientExtra1'];
     $clientExtra2 = $argArrPost['ClientExtra2'];
     if ($argArrPost['client_id'] != '') {
         $varWhere = 'pkClientID = ' . $argArrPost['client_id'];
         $arrclm = array('ClientExtra1' => $clientExtra1, 'ClientExtra2' => $clientExtra2);
         $varExtraID = $this->update(TABLE_CLIENTS, $arrclm, $varWhere);
         $objCore->setSuccessMsg("Extra settings updated successfully");
         return 2;
     }
 }
开发者ID:saurabhs4,项目名称:niches,代码行数:13,代码来源:class.extra.php


示例13: render

 public function render($output)
 {
     $Core = new Core();
     $this->dir = $_SERVER['DOCUMENT_ROOT'] . DS . $Core->path;
     //print_r($this->values);
     if (isset($this->values['layout'])) {
         $this->layout = $this->values['layout'];
     }
     $base_url = $Core->site($this->layout);
     $site_url = $Core->site_url();
     $title = isset($this->values['title']) ? $this->values['title'] : $this->title;
     $header = isset($this->values['header']) ? $this->values['header'] : $this->header;
     $content = $output;
     include $this->dir . DS . 'Layout' . DS . $this->layout . DS . 'default.phtml';
 }
开发者ID:novayadi85,项目名称:CBR,代码行数:15,代码来源:Template.class.php


示例14: execute

 /**
  * Add the comment.
  */
 function execute()
 {
     // Personalized execute() method since now there are possibly two comments contained within each form submission.
     $commentDao = DAORegistry::getDAO('PaperCommentDAO');
     $this->insertedComments = array();
     // Assign all common information
     $comment = new PaperComment();
     $comment->setCommentType($this->commentType);
     $comment->setRoleId($this->roleId);
     $comment->setPaperId($this->paper->getPaperId());
     $comment->setAssocId($this->assocId);
     $comment->setAuthorId($this->user->getId());
     $comment->setCommentTitle($this->getData('commentTitle'));
     $comment->setDatePosted(Core::getCurrentDate());
     // If comments "For authors and director" submitted
     if ($this->getData('authorComments') != null) {
         $comment->setComments($this->getData('authorComments'));
         $comment->setViewable(1);
         array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
     }
     // If comments "For director" submitted
     if ($this->getData('comments') != null) {
         $comment->setComments($this->getData('comments'));
         $comment->setViewable(null);
         array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
     }
 }
开发者ID:artkuo,项目名称:ocs,代码行数:30,代码来源:PeerReviewCommentForm.inc.php


示例15: submission

 /**
  * View an assigned submission's layout editing page.
  * @param $args array ($articleId)
  */
 function submission($args)
 {
     $articleId = isset($args[0]) ? $args[0] : 0;
     list($journal, $submission) = SubmissionLayoutHandler::validate($articleId);
     parent::setupTemplate(true, $articleId);
     import('submission.proofreader.ProofreaderAction');
     ProofreaderAction::layoutEditorProofreadingUnderway($submission);
     $layoutAssignment =& $submission->getLayoutAssignment();
     if ($layoutAssignment->getDateNotified() != null && $layoutAssignment->getDateUnderway() == null) {
         // Set underway date
         $layoutAssignment->setDateUnderway(Core::getCurrentDate());
         $layoutDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
         $layoutDao->updateSubmission($submission);
     }
     $disableEdit = !SubmissionLayoutHandler::layoutEditingEnabled($submission);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign('disableEdit', $disableEdit);
     $templateMgr->assign('useProofreaders', $journal->getSetting('useProofreaders'));
     $templateMgr->assign('templates', $journal->getSetting('templates'));
     $templateMgr->assign('helpTopicId', 'editorial.layoutEditorsRole.layout');
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
     if ($publishedArticle) {
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
         $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
         $templateMgr->assign_by_ref('issue', $issue);
     }
     $templateMgr->display('layoutEditor/submission.tpl');
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:35,代码来源:SubmissionLayoutHandler.inc.php


示例16: onLoad

 /**
  * (non-PHPdoc)
  * @see BPCPageAbstract::onLoad()
  */
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!AccessControl::canAccessPriceMatchPage(Core::getRole())) {
         die(BPCPageAbstract::show404Page('Access Denied', 'You do NOT have the access to this page!'));
     }
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:11,代码来源:SkuMatchController.php


示例17: rescan_locale

 public function rescan_locale()
 {
     if ($this->token->validate('rescan_locale')) {
         $u = new \User();
         if ($u->isSuperUser()) {
             \Core::make('cache/request')->disable();
             $section = Section::getByID($_REQUEST['locale']);
             $target = new MultilingualProcessorTarget($section);
             $processor = new Processor($target);
             if ($_POST['process']) {
                 foreach ($processor->receive() as $task) {
                     $processor->execute($task);
                 }
                 $obj = new \stdClass();
                 $obj->totalItems = $processor->getTotalTasks();
                 echo json_encode($obj);
                 exit;
             } else {
                 $processor->process();
             }
             $totalItems = $processor->getTotalTasks();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d task", "%d tasks", $totalItems)));
             exit;
         }
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:26,代码来源:copy.php


示例18: getService

 /**
  * @return Community
  */
 public function getService()
 {
     if (!$this->service) {
         $this->service = \Core::make('authentication/community');
     }
     return $this->service;
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:10,代码来源:controller.php


示例19: testWrite

	/**
	 * Test that a message can be written to a log file.
	 *
	 * @return \Core\Utilities\Logger\LogFile The log file created.
	 */
	public function testWrite(){
		$type = 'testphpunit';
		$msg  = \BaconIpsumGenerator::Make_a_Sentence();
		$code = '/test/' . Core::RandomHex(6);

		// First, I'll test the functional method.
		\Core\Utilities\Logger\append_to($type, $msg, $code);

		// Now a file should exist called testphpunit.log that contains the line above.
		$this->assertTrue(file_exists(ROOT_PDIR . 'logs/' . $type . '.log'));
		$contents = file_get_contents(ROOT_PDIR . 'logs/' . $type . '.log');
		$this->assertContains($msg, $contents);
		$this->assertContains($code, $contents);

		// And now the class method, (should be identical).
		$type = 'testphpunit';
		$msg  = \BaconIpsumGenerator::Make_a_Sentence();
		$code = '/test/' . Core::RandomHex(6);

		// First, I'll test the functional method.
		$log = new \Core\Utilities\Logger\LogFile($type);
		$log->write($msg, $code);

		// Now a file should exist called testphpunit.log that contains the line above.
		$this->assertTrue($log->exists());
		$contents = $log->getContents();
		$this->assertContains($msg, $contents);
		$this->assertContains($code, $contents);

		return $log;
	}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:36,代码来源:LogFileTest.php


示例20: autoload

 /**
  * autoload
  *
  * This function automatically loads any missing classes as they are
  * needed so that we don't use a million include statements which load
  * more than we need.
  */
 public static function autoload($class)
 {
     if (strpos($class, '\\') === false) {
         $file = AmpConfig::get('prefix') . '/lib/class/' . strtolower($class) . '.class.php';
         if (Core::is_readable($file)) {
             require_once $file;
             // Call _auto_init if it exists
             $autocall = array($class, '_auto_init');
             if (is_callable($autocall)) {
                 call_user_func($autocall);
             }
         } else {
             debug_event('autoload', "'{$class}' not found!", 1);
         }
     } else {
         // Class with namespace are not used by Ampache but probably by modules
         $split = explode('\\', $class);
         $path = AmpConfig::get('prefix') . '/modules';
         for ($i = 0; $i < count($split); ++$i) {
             $path .= '/' . $split[$i];
             if ($i != count($split) - 1) {
                 if (!is_dir($path)) {
                     break;
                 }
             } else {
                 $path .= '.php';
                 if (Core::is_readable($path)) {
                     require_once $path;
                 }
             }
         }
     }
 }
开发者ID:nioc,项目名称:ampache,代码行数:40,代码来源:core.class.php



注:本文中的Core类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CoreLocal类代码示例发布时间:2022-05-23
下一篇:
PHP CopixUrl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap