当前位置: 首页>>代码示例>>PHP>>正文


PHP debug::log方法代码示例

本文整理汇总了PHP中debug::log方法的典型用法代码示例。如果您正苦于以下问题:PHP debug::log方法的具体用法?PHP debug::log怎么用?PHP debug::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在debug的用法示例。


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

示例1: post

 /**
  * Nutzer einloggen und Session erzeugen
  *
  * @return Array Nutzer oder Fehler
  */
 public function post()
 {
     $data = $this->getData();
     if (!is_array($data)) {
         return $this->error(500);
     }
     $loginData = array('username' => $data['username'], 'uident_text' => $data['password'], 'status' => 'login');
     // PID-Check (bbt-user sollen getrennt sein)
     $GLOBALS['user']->checkPid = true;
     $GLOBALS['user']->checkPid_value = $this->getConfigOption('userPID');
     debug::log('user checkpid: ' . $GLOBALS['user']->checkPid);
     $info = $GLOBALS['user']->getAuthInfoArray();
     debug::log($info);
     $user = $GLOBALS['user']->fetchUserRecord($info['db_user'], $loginData['username']);
     if (isset($user) && $user != '') {
         // User gefunden, jetzt noch Zugangspasswort prüfen
         $authBase = new tx_saltedpasswords_sv1();
         $ok = $authBase->compareUident($user, $loginData);
         if ($ok) {
             $GLOBALS['user']->createUserSession($user);
             $data = array('Name' => $user['name'], 'Logo' => $user['tx_webetatext_logo'], 'Verified' => $user['tx_webetatext_verified']);
             $this->userLogo($data['Logo']);
             return $this->success($data);
         }
         return $this->error(401, 'Authentication failed');
     }
     return $this->error(401, 'User not found');
 }
开发者ID:sjakk,项目名称:betatext,代码行数:33,代码来源:webetatext_login.php

示例2: onBeforeWrite

 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     $imageAdded = false;
     if ($this->AutomaticallyIncludedFolderID) {
         debug::log("A");
         if ($folder = Folder::get()->byID($this->AutomaticallyIncludedFolderID)) {
             if ($files = Image::get()->filter("ParentID", $folder->ID)) {
                 foreach ($files as $file) {
                     if (ImageGalleryEntry::get()->filter(array("ImageID" => $file->ID, "ParentID" => $this->ID))->count()) {
                         //do nothing
                         //debug::log("already exists");
                     } else {
                         $ImageGalleryEntry = new ImageGalleryEntry();
                         $ImageGalleryEntry->Title = $file->Title;
                         $ImageGalleryEntry->ImageID = $file->ID;
                         $ImageGalleryEntry->ParentID = $this->ID;
                         $ImageGalleryEntry->write();
                         $imageAdded = true;
                         //debug::log("writing");
                     }
                 }
             } else {
                 //debug::log("D");
             }
         } else {
             //debug::log("C");
         }
     } else {
         //debug::log("B");
     }
     if ($ImageGalleryEntries = ImageGalleryEntry::get()->filter(array("ParentID" => $this->ID))) {
         foreach ($ImageGalleryEntries as $ImageGalleryEntry) {
             $image = Image::get()->filter(array("ID" => $ImageGalleryEntry->ImageID))->exclude(array("Title" => $ImageGalleryEntry->Title))->First();
             if ($image) {
                 $image->Title = $image->Name = $ImageGalleryEntry->Title;
                 $image->write();
             }
         }
     }
     if ($imageAdded) {
         //LeftAndMain::force_reload();
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-imagegallery-basic,代码行数:44,代码来源:ImageGalleryPage.php

示例3: run_command

 /**
  *
  * @param string $openGraphCommand
  *
  * @return FacebookResponse | false
  */
 public static function run_command($openGraphCommand = "")
 {
     $fb = self::get_connection();
     $accessToken = Config::inst()->get("SilverstripeFacebookConnector", "app_id") . "|" . Config::inst()->get("SilverstripeFacebookConnector", "app_secret");
     //$helper = $fb->getPageTabHelper();
     try {
         $response = $fb->get($openGraphCommand, $accessToken);
     } catch (Facebook\Exceptions\FacebookResponseException $e) {
         // When Graph returns an error
         self::$error[] = 'Graph returned an error: ' . $e->getMessage();
         return false;
     } catch (Facebook\Exceptions\FacebookSDKException $e) {
         // When validation fails or other local issues
         self::$error[] = 'Facebook SDK returned an error: ' . $e->getMessage();
         return false;
     }
     if (self::$debug) {
         debug::log(implode(" | ", self::$error));
     }
     return $response;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-sharethis,代码行数:27,代码来源:SilverstripeFacebookConnector.php

示例4: _tagBuilder

 /**
  * Creates simple HTML wrappers, accessed via $this->__call()
  *
  * JS and CSS files are never included more than once even if requested twice. If DEBUG mode is enabled than the
  * second request will be added to the debug log as a duplicate. The jsSingleton and cssSingleton methods operate
  * the same as the js & css methods except that they will silently skip duplicate requests instead of logging them.
  *
  * jsInlineSingleton and cssInlineSingleton makes sure a JavaScript or CSS snippet will only be output once, even
  * if echoed out multiple times and this method will attempt to place the JS code into the head section, if <head>
  * has already been echoed out then it will return the JS code inline the same as jsInline. Eg.:
  * $helloJs = "function helloWorld() {alert('Hello World');}";
  * echo $html->jsInlineSingleton($helloJs);
  *
  * Adding an optional extra argument to jsInlineSingleton/cssInlineSingleton will return the inline code bare (plus
  * a trailing linebreak) if it cannot place it into the head section, this is used for joint JS/CSS statements:
  * echo $html->jsInline($html->jsInlineSingleton($helloJs, true) . 'helloWorld();');
  *
  * @param string $tagType
  * @param array $args
  * @return string
  */
 protected function _tagBuilder($tagType, $args = array())
 {
     $arg = current($args);
     if (empty($arg) || $arg === '') {
         $errorMsg = 'Missing argument for ' . __CLASS__ . '::' . $tagType . '()';
         trigger_error($errorMsg, E_USER_WARNING);
     }
     if (is_array($arg)) {
         foreach ($arg as $thisArg) {
             $return[] = $this->_tagBuilder($tagType, array($thisArg));
         }
         $return = implode(PHP_EOL, $return);
     } else {
         switch ($tagType) {
             case 'js':
             case 'jsSingleton':
             case 'css':
                 //Optional extra argument to define CSS media type
             //Optional extra argument to define CSS media type
             case 'cssSingleton':
             case 'jqueryTheme':
                 if ($tagType == 'jqueryTheme') {
                     $arg = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/' . str_replace(' ', '-', strtolower($arg)) . '/jquery-ui.css';
                     $tagType = 'css';
                 }
                 if (!isset($this->_includedFiles[$tagType][$arg])) {
                     if ($tagType == 'css' || $tagType == 'cssSingleton') {
                         $return = '<link rel="stylesheet" type="text/css" href="' . $arg . '"' . ' media="' . (isset($args[1]) ? $args[1] : 'all') . '" />';
                     } else {
                         $return = '<script type="text/javascript" src="' . $arg . '"></script>';
                     }
                     $this->_includedFiles[$tagType][$arg] = true;
                 } else {
                     $return = null;
                     if (DEBUG_MODE && ($tagType == 'js' || $tagType == 'css')) {
                         debug::log($arg . $tagType . ' file has already been included', 'warn');
                     }
                 }
                 break;
             case 'cssInline':
                 //Optional extra argument to define CSS media type
                 $return = '<style type="text/css" media="' . (isset($args[1]) ? $args[1] : 'all') . '">' . PHP_EOL . '/*<![CDATA[*/' . PHP_EOL . '<!--' . PHP_EOL . $arg . PHP_EOL . '//-->' . PHP_EOL . '/*]]>*/' . PHP_EOL . '</style>';
                 break;
             case 'jsInline':
                 $return = '<script type="text/javascript">' . PHP_EOL . '//<![CDATA[' . PHP_EOL . '<!--' . PHP_EOL . $arg . PHP_EOL . '//-->' . PHP_EOL . '//]]>' . PHP_EOL . '</script>';
                 break;
             case 'jsInlineSingleton':
                 //Optional extra argument to supress adding of inline JS/CSS wrapper
             //Optional extra argument to supress adding of inline JS/CSS wrapper
             case 'cssInlineSingleton':
                 $tagTypeBase = substr($tagType, 0, -15);
                 $return = null;
                 $md5 = md5($arg);
                 if (!isset($this->{'_' . $tagTypeBase . 'Singleton'}[$md5])) {
                     $this->{'_' . $tagTypeBase . 'Singleton'}[$md5] = true;
                     if (!$this->_bodyOpen) {
                         $this->vorkHead[$tagTypeBase . 'Inline'][] = $arg;
                     } else {
                         $return = !isset($args[1]) || !$args[1] ? $this->{$tagTypeBase . 'Inline'}($arg) : $arg . PHP_EOL;
                     }
                 }
                 break;
             case 'div':
             case 'li':
             case 'p':
             case 'h1':
             case 'h2':
             case 'h3':
             case 'h4':
                 $return = '<' . $tagType . '>' . $arg . '</' . $tagType . '>';
                 break;
             default:
                 $errorMsg = 'TagType ' . $tagType . ' not valid in ' . __CLASS__ . '::' . __METHOD__;
                 throw new Exception($errorMsg);
                 break;
         }
     }
     return $return;
 }
开发者ID:Jason3S,项目名称:wikimarkup-wiktionary-original,代码行数:100,代码来源:moadmin.php

示例5: EwayURL

 function EwayURL()
 {
     // 1) Main Informations
     $order = $this->Order();
     //$items = $order->Items();
     $member = $order->Member();
     // 2) Main Settings
     if ($this->config()->get('test_mode') == 'yes') {
         $inputs['CustomerID'] = $this->config()->get('test_customer_id');
         $inputs['UserName'] = $this->config()->get('test_customer_username');
     } else {
         $inputs['CustomerID'] = $this->config()->get('customer_id');
         $inputs['UserName'] = $this->config()->get('customer_username');
     }
     if ($this->config()->get('test_mode') == 'yes' && isset($_REQUEST["PaymentTypeTest"])) {
         $amount = round($this->Amount->getAmount()) + intval($_REQUEST["PaymentTypeTest"]) / 100;
     } else {
         $amount = $this->Amount->getAmount();
     }
     $inputs['Amount'] = number_format($amount, 2, '.', '');
     //$decimals = 2, $decPoint = '.' , $thousands_sep = ''
     $inputs['Currency'] = $this->Amount->getCurrency();
     $inputs['ReturnURL'] = $inputs['CancelURL'] = Director::absoluteBaseURL() . EwayPayment_Handler::complete_link($this);
     $inputs['CompanyName'] = $this->config()->get('company_name');
     $inputs['MerchantReference'] = $inputs['MerchantInvoice'] = $order->ID;
     //$inputs['InvoiceDescription'] =
     $inputs['PageTitle'] = $this->config()->get('page_title');
     $inputs['PageDescription'] = 'Please fill the details below to complete your order.';
     if ($logo = $this->config()->get('company_logo')) {
         $inputs['CompanyLogo'] = Director::absoluteBaseURL() . $logo;
     }
     // 7) Prepopulating Customer Informations
     $address = $this->Order()->BillingAddress();
     $inputs['CustomerFirstName'] = $address->FirstName;
     $inputs['CustomerLastName'] = $address->Surname;
     $inputs['CustomerAddress'] = "{$address->Address} {$address->Address2}";
     $inputs['CustomerPostCode'] = $address->PostalCode;
     $inputs['CustomerCity'] = $address->City;
     $inputs['CustomerCountry'] = class_exists("Geoip") ? Geoip::countryCode2name($address->Country) : $address->Country;
     $inputs['CustomerPhone'] = $address->Phone;
     $inputs['CustomerEmail'] = $address->Email;
     $inputs['CustomerState'] = $address->RegionCode;
     if ($this->config()->get('test_mode') == 'yes') {
         $inputs['CompanyName'] = "TEST FOR " . $inputs['CompanyName'];
         debug::log(print_r($inputs, 1));
         debug::log($this->config()->get('url'));
     }
     return $this->config()->get('url') . '?' . http_build_query($inputs);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-payment-eway,代码行数:49,代码来源:EwayPayment.php

示例6: AddFiles

 /**
  * Adds the download files to the Log and makes them available for download.
  * @param ArrayList | Null $dosWithFiles - Data Object Set with files
  */
 public function AddFiles($listOfFiles)
 {
     //update log fields
     $this->Title = _t("OrderStatusLog.DOWNLOADFILES", "Download Files");
     $this->Note = "<ul>";
     if (!$this->OrderID) {
         user_error("Tried to add files to an ElectronicDelivery_OrderStatus object without an OrderID");
     }
     if ($this->debug) {
         debug::log(print_r($listOfFiles, 1));
         debug::log("COUNT: " . $listOfFiles->count());
     }
     //are there any files?
     if ($listOfFiles && $listOfFiles->count()) {
         if ($this->debug) {
             debug::log("doing it");
         }
         //create folder
         $fullFolderPath = $this->getOrderDownloadFolder(true);
         $folderOnlyPart = $this->getOrderDownloadFolder(false);
         $existingFiles = $this->Files();
         $alreadyCopiedFileNameArray = array();
         //loop through files
         foreach ($listOfFiles as $file) {
             if ($file->exists() && file_exists($file->getFullPath())) {
                 $existingFiles->add($file);
                 $copyFrom = $file->getFullPath();
                 $fileName = $file->Name;
                 $destinationFile = $fullFolderPath . "/" . $file->Name;
                 $destinationURL = Director::absoluteURL("/" . $this->getBaseFolder(false) . "/" . $folderOnlyPart . "/" . $fileName);
                 if (!in_array($copyFrom, $alreadyCopiedFileNameArray)) {
                     $alreadyCopiedFileNameArray[] = $fileName;
                     if (copy($copyFrom, $destinationFile)) {
                         if ($this->debug) {
                             debug::log("\r\n COPYING {$copyFrom} to {$destinationFile} \r\n |||" . serialize($file));
                         }
                         $this->Note .= '<li><a href="' . $destinationURL . '" target="_blank">' . $file->Title . '</a></li>';
                     }
                 } else {
                     $this->Note .= "<li>" . _t("OrderLog.NOTINCLUDEDIS", "no download available: ") . $file->Title . "</li>";
                 }
             }
         }
     } else {
         $this->Completed = true;
         $this->Note .= "<li>" . _t("OrderStatusLog.THEREARENODOWNLOADSWITHTHISORDER", "There are no downloads for this order.") . "</li>";
     }
     $this->Note .= "</ul>";
     $this->write();
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-delivery-electronic,代码行数:54,代码来源:ElectronicDelivery_OrderLog.php

示例7: apiCall

 /**
  * Handles actual communication with API server.
  */
 protected function apiCall($method, $data = array())
 {
     $postfields = array('METHOD' => $method, 'VERSION' => $this->Config()->get("version"), 'USER' => $this->Config()->get("API_UserName"), 'PWD' => $this->Config()->get("API_Password"), 'SIGNATURE' => $this->Config()->get("API_Signature"), 'BUTTONSOURCE' => $this->Config()->get("sBNCode"));
     if (Director::isDev() || self::$debug) {
         debug::log("POST FIELDS: " . print_r($postfields, 1));
     }
     if (Director::isDev() || self::$debug) {
         debug::log("ADD POINT: " . print_r($this->getApiEndpoint(), 1));
     }
     $postfields = array_merge($postfields, $data);
     //Make POST request to Paypal via RESTful service
     $rs = new RestfulService($this->getApiEndpoint(), 0);
     //REST connection that will expire immediately
     $rs->httpHeader('Accept: application/xml');
     $rs->httpHeader('Content-Type: application/x-www-form-urlencoded');
     $response = $rs->request('', 'POST', http_build_query($postfields));
     if (Director::isDev() || self::$debug) {
         debug::log(print_r($response, 1));
     }
     return $this->deformatNVP($response->getBody());
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-payment-paypal,代码行数:24,代码来源:PayPalExpressCheckoutPayment.php

示例8: count

debug::log("Source model: " . $source_model);
debug::log("Source model table: " . $source_model::TABLE);
#debug::var_dump($source_model::db());
if ($project->last_page === null) {
    $project->last_page = 0;
}
$source_data = $source_model::get_where_order_page(null, null, $project->last_page + 1, $project->rows_per_run);
$project->last_page += 1;
$project->update_db_row();
$count = count($source_data);
debug::log("Fetched rows from source - count: " . $count);
if (!$count) {
    $project->status = 'inactive';
    throw new e_system("Warning: no rows fetched from source table");
}
# 3. Connects to the target database
# 4. Inserts the rows to target table
$target_db = new source_target_adodb(ADONewConnection($project->target_db_type));
if (!$target_db->Connect($project->target_host, $project->target_username, $project->target_password)) {
    throw new e_system("Failed to connect to target database");
}
$source_db->debug = project::db()->debug;
$target_model = (string) new fluid_model($project->target_table, $project->target_pk, $target_db);
$inserted_rows = 0;
foreach ($source_data as $source_datum) {
    $inserted_rows += (int) (bool) $target_model::add_new($source_datum->data_array());
    #debug::log("Inserted row to target: " . $source_datum);
}
debug::log("Inserted rows: " . $inserted_rows);
# 5. done and log
run_log::add_new(array('log' => debug::$log, 'insert_time' => time()));
开发者ID:albertdiones,项目名称:locust-mule,代码行数:31,代码来源:run.php

示例9: apply_min_max

 static function apply_min_max()
 {
     if (self::$min_field || self::$max_field || self::$default_min_quantity || self::$default_max_quantity) {
         $msgArray = array();
         $minFieldName = self::$min_field;
         $maxFieldName = self::$max_field;
         $currentOrder = ShoppingCart::current_order();
         if ($currentOrder->IsSubmitted()) {
             //too late!
             return;
         }
         $items = $currentOrder->Items();
         $i = 0;
         if ($items) {
             foreach ($items as $item) {
                 $buyable = $item->Buyable();
                 if ($buyable) {
                     $quantity = $item->Quantity;
                     $absoluteMin = self::$default_min_quantity;
                     $absoluteMax = self::$default_max_quantity;
                     $parent = $buyable->Parent();
                     if ($minFieldName) {
                         if (isset($buyable->{$minFieldName}) && $buyable->{$minFieldName} > 0) {
                             $absoluteMin = $buyable->{$minFieldName};
                         } elseif (!isset($buyable->{$minFieldName})) {
                             if ($parent && isset($parent->{$minFieldName}) && $parent->{$minFieldName} > 0) {
                                 $absoluteMin = $parent->{$minFieldName};
                             }
                         }
                     }
                     if ($maxFieldName) {
                         if (isset($buyable->{$maxFieldName}) && $buyable->{$maxFieldName} > 0) {
                             $absoluteMax = $buyable->{$maxFieldName};
                         } elseif (!isset($buyable->{$maxFieldName})) {
                             if ($parent && isset($parent->{$maxFieldName}) && $parent->{$maxFieldName} > 0) {
                                 $absoluteMax = $parent->{$maxFieldName};
                             }
                         }
                     }
                     if ($buyable->UnlimitedStock) {
                         //nothing more to do
                     } elseif (self::$use_stock_quantities) {
                         $maxStockQuantity = $buyable->getActualQuantity();
                         if ($absoluteMax > $maxStockQuantity) {
                             $absoluteMax = $maxStockQuantity;
                         }
                         if ($absoluteMin > $maxStockQuantity) {
                             $absoluteMax = 0;
                             $maxStockQuantity = 0;
                         }
                     }
                     $absoluteMin = intval($absoluteMin) - 0;
                     $absoluteMax = intval($absoluteMax) - 0;
                     $newValue = $quantity;
                     if ($quantity < $absoluteMin && $absoluteMin > 0) {
                         debug::log("adjusting for MIN: {$quantity} < {$absoluteMin}");
                         $newValue = $absoluteMin;
                     }
                     if ($quantity > $absoluteMax && $absoluteMax > 0) {
                         debug::log("adjusting for MAX: {$quantity} > {$absoluteMax}");
                         $newValue = $absoluteMax;
                     }
                     if ($quantity != $newValue) {
                         $item->Quantity = $newValue;
                         ShoppingCart::singleton()->setQuantity($buyable, $newValue);
                         $msgArray[$i] = $buyable->Title . " changed from " . $quantity . " to " . $newValue;
                         $i++;
                         $quantity = $newValue;
                         self::$ids_of_items_adjusted[$item->ID] = $item->ID;
                     }
                     if (Director::is_ajax()) {
                         //do nothing
                     } else {
                         //IS THIS WORKING?
                         $fieldName = $item->AJAXDefinitions()->QuantityFieldName();
                         $js = 'MinMaxModifier.add_item("input[name=\'' . $fieldName . '\']", ' . intval($absoluteMin) . ', ' . intval($absoluteMax) . ', "' . addslashes(self::$sorry_message) . '");';
                         Requirements::javascript("ecommerce_stockcontrol/javascript/MinMaxModifier.js");
                         Requirements::customScript($js, $fieldName);
                     }
                 }
             }
         }
     }
     if (count($msgArray)) {
         if (self::$adjustment_message) {
             $msg = self::$adjustment_message . "\n" . implode("\n", $msgArray);
             if ($msg && !Director::is_ajax()) {
                 Requirements::customScript('alert("' . Convert::raw2js($msg) . '");', "MinMaxModifierAlert");
             }
             //$this->Adjustments = $msg;
         }
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-stockcontrol,代码行数:93,代码来源:MinMaxModifier.php

示例10: checkCommentedText

 private function checkCommentedText($text, $CommentID)
 {
     $comment = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('CommentedText', 'tx_webetatext_comment', 'uid=' . $CommentID);
     require_once BBT_restpath . '/phpQuery/phpQuery.php';
     phpQuery::newDocument($text, 'text/html');
     foreach (pq('span.comment-' . $CommentID) as $selection) {
         $CommentedText .= pq($selection)->html();
     }
     $SelectedText_norm = $this->normalizeText($CommentedText);
     $CommentedText_norm = $this->normalizeText($comment['CommentedText']);
     if ($SelectedText_norm != $CommentedText_norm) {
         debug::log('fail. Neuer Kommentar ist nicht im geschickten Text enthalten');
         return false;
     }
     return true;
 }
开发者ID:sjakk,项目名称:betatext,代码行数:16,代码来源:webetatext_text.php

示例11: halt

 /**
 * halt
 +-----------------------------------------
 * @access public
 * @param ErrorException $e
 * @return void
 */
 static function halt($e)
 {
     self::append($e);
     if (IS_AJAX) {
         $code = $e->getCode();
         json_return(null, $code ? $code : 9999, $e->getMessage());
     }
     if (DEBUG) {
         $traceInfo = '';
         $trace = $e->getTrace();
         foreach ($trace as $t) {
             $traceInfo .= $t['file'] . ' (' . $t['line'] . ') ';
             $traceInfo .= $t['class'] . $t['type'] . $t['function'] . '(';
             foreach ($t['args'] as $k => $arg) {
                 if ($k != 0) {
                     $traceInfo .= ',';
                 }
                 switch (gettype($arg)) {
                     case 'object':
                     case 'array':
                         $traceInfo .= '<b title="' . addslashes(var_export($arg)) . '">' . ucfirst(gettype($arg)) . '</b>';
                         break;
                     default:
                         $traceInfo .= $arg;
                 }
             }
             $traceInfo .= ")\n";
         }
         $message = $e->getMessage() . ' File:' . $e->getFile() . ' Line:' . $e->getLine();
         debug::log($message, 'Error');
         include COMMON_PATH . '500.php';
         exit;
     } else {
         //否则定向到错误页面
         redirect(WEB_PATH . '500.html');
     }
     exit;
 }
开发者ID:page7,项目名称:amazon.jp.price.log,代码行数:45,代码来源:exception.class.php

示例12: add_to_session

 /**
  * adds additional info to current session
  * @param String $action
  * @param DataObject $copyFrom
  * @param DataObject $copyInto
  */
 protected static function add_to_session($action, $copyFrom = null, $copyInto = null)
 {
     $obj = new CopyFactoryLog();
     $obj->Type = Config::inst()->get("CopyFactory", "for_real") ? "Real" : "Fake";
     $obj->StartTime = Config::inst()->get("CopyFactory", "start_time");
     $obj->CopyCausingClassName = Config::inst()->get("CopyFactory", "dry_run_for_class_name");
     $obj->CopyCausingClassNameID = Config::inst()->get("CopyFactory", "dry_run_for_id");
     if ($copyFrom) {
         $obj->CopyFromClassNameID = $copyFrom->ID;
     }
     if ($copyInto) {
         $obj->CopyIntoClassName = $copyInto->ClassName;
         $obj->CopyIntoClassNameID = $copyInto->ID;
     }
     $obj->Action = $action;
     $obj->write();
     if (Config::inst()->get("CopyFactory", "debug")) {
         $copyFromLine = "";
         if ($copyFrom && $copyFrom->exists()) {
             $copyFromLine = "FROM: " . self::title_for_object($copyFrom) . " - " . $copyFrom->ClassName . "." . $copyFrom->ID . "\n";
         }
         $copyIntoLine = "";
         if ($copyInto && $copyInto->exists()) {
             $copyIntoLine = "INTO: " . self::title_for_object($copyInto) . " - " . $copyInto->ClassName . "." . $copyInto->ID . "\n";
         }
         debug::log($copyFromLine . $copyIntoLine . $action);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-copyfactory,代码行数:34,代码来源:CopyFactory.php


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