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


PHP debug函数代码示例

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


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

示例1: createEmailFromTemplate

function createEmailFromTemplate($templateName, $user, $data = null)
{
    global $APP_DIR;
    $email_config = getConfig("_email");
    if (!$email_config || !$templateName || !$user) {
        return null;
    }
    $templateDir = $email_config["templates"];
    $template = readTextFile("{$APP_DIR}/{$templateDir}/{$templateName}.html");
    if (!$template) {
        return null;
    }
    $name = is_string($user) ? substringBefore($user, "@") : $user["first_name"] . " " . $user["last_name"];
    $to_email = is_string($user) ? $user : $user["email"];
    if (isset($email_config["to"])) {
        $to_email = $email_config["to"];
    }
    $logo = combine($email_config["baseUrl"], getConfig("app.logo"));
    $cfg = array("site" => getConfig("defaultTitle"), "baseUrl" => $email_config["baseUrl"], "logo" => $logo, "name" => $name, "to" => $to_email);
    $template = replaceVariables($template, $cfg);
    $template = replaceVariables($template, $user);
    $template = replaceVariables($template, $data);
    $subject = substringBefore($template, "\n");
    $body = substringAfter($template, "\n");
    //replace classes with inlineStyles
    $styles = readConfigFile("{$APP_DIR}/{$templateDir}/inline.css");
    if ($styles) {
        $body = "<div class=\"fp-email\">{$body}</div>";
        $body = inlineStyles($body, $styles);
    }
    debug("createEmail subject", $subject);
    debug("createEmail body", $body);
    return createEmail($to_email, $subject, $body, true);
}
开发者ID:araynaud,项目名称:FoodPortrait,代码行数:34,代码来源:email_functions.php

示例2: get_all_taxa

 function get_all_taxa()
 {
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     $paths = $func->extract_archive_file($this->dwca_file, "meta.xml");
     $archive_path = $paths['archive_path'];
     $temp_dir = $paths['temp_dir'];
     $harvester = new ContentArchiveReader(NULL, $archive_path);
     $tables = $harvester->tables;
     if (!($this->fields["taxa"] = $tables["http://rs.tdwg.org/dwc/terms/taxon"][0]->fields)) {
         debug("Invalid archive file. Program will terminate.");
         return false;
     }
     self::build_taxa_rank_array($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
     self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
     self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
     self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     recursive_rmdir($temp_dir);
     echo "\n temporary directory removed: " . $temp_dir;
     print_r($this->debug);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:25,代码来源:WormsArchiveAPI.php

示例3: parse

 function parse()
 {
     setlocale(LC_TIME, $this->locale);
     if ($this->day && $this->month && $this->year) {
         $this->timestamp = mktime($this->hour, $this->minutes, $this->seconds, $this->month, $this->day, $this->year);
     }
     for ($i = 0; $i < 7; $i++) {
         $this->__weekdays[$i] = ucfirst(strftime("%a", $i * 86400 + 3 * 86400));
     }
     for ($i = 1; $i < 13; $i++) {
         $this->__months[$i] = ucfirst(strftime("%B", mktime(0, 0, 0, $i, 1, $this->year)));
     }
     list($this->weekday, $this->day, $this->month, $this->year, $this->hour, $this->minutes, $this->seconds) = explode(" ", date("w j n Y G i s", $this->timestamp));
     $this->strmonth = $this->__months[$this->month];
     $this->strweekday = $this->__weekdays[$this->weekday];
     //$this->string = $this->__weekdays[$this->weekday]." ".$this->day." ".$this->__months[$this->month]." ".$this->year." ".$this->hour.":".$this->minutes;
     $this->string = $this->day . "/" . $this->month . "/" . $this->year . " " . $this->hour . ":" . $this->minutes;
     $this->short_string = substr($this->__weekdays[$this->weekday], 0, 4) . " " . $this->day . " " . substr($this->__months[$this->month], 0, 3) . " " . $this->year;
     debug($this, "<font color=\"magenta\"> Parsed Date, timestamp = " . $this->timestamp . " , string = " . $this->string);
     if ($this->timestamp == 0 || $this->timestamp == -1) {
         $this->timestamp = 0;
         $this->day = 0;
         $this->month = 0;
         $this->year = 0;
         $this->hour = 0;
         $this->minutes = 0;
         $this->seconds = 0;
         $this->string = " N/A ";
         $this->short_string = " N/A ";
     }
 }
开发者ID:Esleelkartea,项目名称:arotz,代码行数:31,代码来源:date.class.php

示例4: get_all_taxa

 function get_all_taxa($resource_id)
 {
     self::get_associations();
     if ($this->debug_info) {
         echo "\n\n total: " . count($GLOBALS['taxon']) . "\n";
     }
     $all_taxa = array();
     $i = 0;
     $total = count(array_keys($GLOBALS['taxon']));
     foreach ($GLOBALS['taxon'] as $taxon_name => $record) {
         $i++;
         if ($this->debug_info) {
             echo "\n{$i} of {$total} " . $taxon_name;
         }
         $record["taxon_name"] = $taxon_name;
         $arr = self::get_plant_feeding_taxa($record);
         $page_taxa = $arr[0];
         if ($page_taxa) {
             $all_taxa = array_merge($all_taxa, $page_taxa);
         }
         unset($page_taxa);
     }
     $xml = \SchemaDocument::get_taxon_xml($all_taxa);
     $resource_path = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml";
     if (!($OUT = fopen($resource_path, "w"))) {
         debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $resource_path);
         return;
     }
     fwrite($OUT, $xml);
     fclose($OUT);
     return $all_taxa;
     //used for testing
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:33,代码来源:PlantFeedingInsectsAPI.php

示例5: calculateOld

 /**
  * Calculate check digit according to Luhn's algorithm
  * This is an old method, tests show that this is little bit slower than new one
  * 
  * @param string $number
  * @return integer
  */
 public function calculateOld($number)
 {
     $length = strlen($number);
     $sum = 0;
     $p = $length % 2;
     // Sum digits, where every second digit from right is doubled (last one is check digit, which is not in parameter)
     for ($i = $length - 1; $i >= 0; --$i) {
         $digit = $number[$i];
         // Every second digit is doubled
         if ($i % 2 != $p) {
             $digit *= 2;
             // If doubled value is 10 or more (for example 13), then add to sum each digit (i.e. 1 and 3)
             if ($digit > 9) {
                 $sum += $digit[0];
                 $sum += $digit[1];
             } else {
                 $sum += $digit;
             }
         } else {
             $sum += $digit;
         }
     }
     // Multiply by 9
     $sum *= 9;
     // Last one is check digit
     $ret = (double) substr($sum, -1, 1);
     debug($ret);
     return $ret;
 }
开发者ID:ristorantino,项目名称:barcodes,代码行数:36,代码来源:Luhn.php

示例6: index

 /**
  * index method
  *
  * @return void
  */
 public function index()
 {
     $this->Measurement->recursive = -0;
     $measurements = $this->Paginator->paginate();
     $this->set('measurements', $measurements);
     debug($measurements);
 }
开发者ID:rodrigodeflopes,项目名称:portalqualidade,代码行数:12,代码来源:MeasurementsController.php

示例7: generate

 /**
  * Calls procesItemStates() so that the common configuration for the menu items are resolved into individual configuration per item.
  * Calls makeGifs() for all "normal" items and if configured for, also the "rollover" items.
  *
  * @return void
  * @see AbstractMenuContentObject::procesItemStates(), makeGifs()
  * @todo Define visibility
  */
 public function generate()
 {
     $splitCount = count($this->menuArr);
     if ($splitCount) {
         list($NOconf, $ROconf) = $this->procesItemStates($splitCount);
         //store initial count value
         $temp_HMENU_MENUOBJ = $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'];
         $temp_MENUOBJ = $GLOBALS['TSFE']->register['count_MENUOBJ'];
         // Now we generate the giffiles:
         $this->makeGifs($NOconf, 'NO');
         // store count from NO obj
         $tempcnt_HMENU_MENUOBJ = $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'];
         $tempcnt_MENUOBJ = $GLOBALS['TSFE']->register['count_MENUOBJ'];
         if ($this->mconf['debugItemConf']) {
             echo '<h3>$NOconf:</h3>';
             debug($NOconf);
         }
         // RollOver
         if ($ROconf) {
             // Start recount for rollover with initial values
             $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = $temp_HMENU_MENUOBJ;
             $GLOBALS['TSFE']->register['count_MENUOBJ'] = $temp_MENUOBJ;
             $this->makeGifs($ROconf, 'RO');
             if ($this->mconf['debugItemConf']) {
                 echo '<h3>$ROconf:</h3>';
                 debug($ROconf);
             }
         }
         // Use count from NO obj
         $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = $tempcnt_HMENU_MENUOBJ;
         $GLOBALS['TSFE']->register['count_MENUOBJ'] = $tempcnt_MENUOBJ;
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:41,代码来源:GraphicalMenuContentObject.php

示例8: testAsText

 public function testAsText()
 {
     echo "<h2>Display as text</h2>";
     $result = $this->display->asText(array('test' => 'data', 'test two' => 'data2'));
     debug($result);
     //$this->assertEquals(true,$result);
 }
开发者ID:evelynmitchell,项目名称:conference-list,代码行数:7,代码来源:DisplayHelperTest.php

示例9: import

 /**
  * Import a set of valid URLS from a sitemap
  *
  * @param string path to sitemap we want to parse
  * @param boolean clear the set first, then import.
  * @param boolean verbose
  * @param int count of imported urls
  */
 function import($sitemap = null, $clear_all = true, $verbose = false)
 {
     $count = 0;
     if ($this->settings['active']) {
         if ($sitemap) {
             $this->settings['source'] = $sitemap;
         }
         if ($clear_all) {
             $this->deleteAll(1);
         }
         $xml = simplexml_load_file($this->getPathToSiteMap());
         foreach ($xml->url as $url) {
             $this->clear();
             $save_data = array('url' => parse_url((string) $url->loc, PHP_URL_PATH), 'priority' => (string) $url->priority);
             if ($this->save($save_data)) {
                 if ($verbose) {
                     echo ".";
                 }
                 $count++;
             } elseif ($verbose) {
                 echo "f";
                 debug($this->validationErrors);
             }
         }
     }
     return $count;
 }
开发者ID:webtechnick,项目名称:cakephp-seo-plugin,代码行数:35,代码来源:SeoUrl.php

示例10: oauth2callback

 /**
  * Internal callback, after Outlook Connect's request
  */
 public function oauth2callback()
 {
     $callbackTime = time();
     if (array_key_exists('code', $_GET) && !empty($_GET['code'])) {
         $url = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
         $params = array('client_id' => $this->strategy['client_id'], 'client_secret' => $this->strategy['client_secret'], 'redirect_uri' => $this->strategy['redirect_uri'], 'grant_type' => 'authorization_code', 'code' => trim($_GET['code']));
         if (!empty($this->strategy['state'])) {
             $params['state'] = $this->strategy['state'];
         }
         $response = $this->serverPost($url, $params, null, $headers);
         $results = json_decode($response);
         debug($results);
         if (!empty($results) && !empty($results->access_token)) {
             $me = $this->me($results->access_token);
             $this->auth = array('uid' => $me['Id'], 'info' => array('email' => $me['EmailAddress'], 'name' => $me['DisplayName'], 'nickname' => $me['Alias']), 'credentials' => array('token' => $results->access_token), 'raw' => $me);
             $this->callback();
         } else {
             $error = array('code' => 'access_token_error', 'message' => 'Failed when attempting to obtain access token', 'raw' => array('response' => $response, 'headers' => $headers));
             $this->errorCallback($error);
         }
     } else {
         $error = array('code' => 'oauth2callback_error', 'raw' => $_GET);
         $this->errorCallback($error);
     }
 }
开发者ID:t1mmen,项目名称:opauth-outlook,代码行数:28,代码来源:OutlookStrategy.php

示例11: delete

function delete()
{
    debug("Info: Calling Extended delete");
    if ($this->type == "archive") {
        $par = new Ente($this->name);
        $fi = newObject("fileh", $this->fileh);
        if (!$fi->delete()) {
            $this->WARNING = $fi->ERROR;
        }
        $par = typecast($this, "Ente");
        return $par->delete();
    } else {
        /* Ohohohoho we've a dir here */
        $confirmation = newObject("data_object");
        $n = $confirmation->select("inode=" . $this->ID);
        if ($confirmation->nRes < 1) {
            /* Lets detelete */
            $par = new Ente($this->name);
            $par = typecast($this, "Ente");
            return $par->delete();
        } else {
            $this->ERROR = _("Folder not empty");
            return False;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:26,代码来源:data_object.php

示例12: annotate

 function annotate($text, $ontologies = array(), $params = array())
 {
     $this->annotations = array();
     if (!$text) {
         return false;
     }
     $default = array('format' => 'xml', 'filterNumber' => 'true', 'isVirtualOntologyId' => 'false', 'levelMax' => '0', 'longestOnly' => 'true', 'wholeWordOnly' => 'true', 'minTermSize' => 3, 'scored' => 'true', 'withDefaultStopWords' => 'true', 'isStopWordsCaseSensitive' => 'false', 'withSynonyms' => 'true', 'ontologiesToExpand' => implode(',', $ontologies), 'ontologiesToKeepInResult' => implode(',', $ontologies), 'textToAnnotate' => $text);
     $params = array_merge($default, $params);
     $http = array('method' => 'POST', 'ignore_errors' => false, 'header' => 'Accept: */*;q=0.2', 'timeout' => 300);
     // 5 minute timeout
     $this->get_data('http://rest.bioontology.org/obs/annotator', $params, 'dom', $http);
     debug('response');
     debug($this->data);
     if (!is_object($this->data)) {
         return FALSE;
     }
     file_put_contents(sys_get_temp_dir() . '/bioportal.xml', $this->data->saveXML());
     $nodes = $this->xpath->query('data/annotatorResultBean/annotations/annotationBean');
     if (!$nodes->length) {
         return FALSE;
     }
     foreach ($nodes as $node) {
         $context = $this->xpath->query('context', $node)->item(0);
         $concept = $this->xpath->query('concept', $node)->item(0);
         $synonyms = array();
         foreach ($this->xpath->query('synonyms/string', $concept) as $synonym) {
             $synonyms = $synonym->textContent;
         }
         $conceptId = $this->xpath->query('localConceptId', $concept)->item(0)->nodeValue;
         list($ontology, $id) = explode('/', $conceptId);
         $this->annotations[] = array('score' => $this->xpath->query('score', $node)->item(0)->nodeValue, 'start' => $this->xpath->query('from', $context)->item(0)->nodeValue - 1, 'end' => $this->xpath->query('to', $context)->item(0)->nodeValue, 'text' => $this->xpath->query('term/name', $context)->item(0)->nodeValue, 'title' => $this->xpath->query('preferredName', $concept)->item(0)->nodeValue, 'uri' => $this->xpath->query('fullId', $concept)->item(0)->nodeValue, 'ontology' => $ontology, 'id' => $id, 'type' => $this->xpath->query('semanticTypes[1]/semanticTypeBean/semanticType', $concept)->item(0)->nodeValue);
     }
 }
开发者ID:hubgit,项目名称:libapi,代码行数:33,代码来源:BioPortal.php

示例13: toConstraintChain

 public function toConstraintChain()
 {
     $cc = new ConstraintChain();
     if ($this->cleared) {
         return $cc;
     }
     debug('BaseSearch::toConstraintChain Fields: ' . print_r($this->fields, true));
     foreach ($this->fields as $group) {
         foreach ($group as $field => $searchField) {
             if ($field == 'balance') {
                 $cc1 = new ConstraintChain();
                 if ($searchField->getValue() == '') {
                     $cc1->add(new Constraint('balance', '>', '0'));
                 }
                 $cc->add($cc1);
             } elseif ($field != 'parent_id' && $field != 'search_id') {
                 $c = $searchField->toConstraint();
                 if ($c !== false) {
                     $cc->add($c);
                 }
             }
         }
     }
     debug('BaseSearch::toConstraintChain Constraints: ' . print_r($cc, true));
     return $cc;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:whlocationsSearch.php

示例14: render

 /**
  * Renders the current node
  *
  * @param LiquidContext $context
  * @return string
  */
 public function render(&$context)
 {
     $collection = $context->get($this->collection_name);
     if (!is_array($collection)) {
         die(debug('not array', $collection));
     }
     // discard keys
     $collection = array_values($collection);
     if (isset($this->attributes['limit']) || isset($this->attributes['offset'])) {
         $limit = $context->get($this->attributes['limit']);
         $offset = $context->get($this->attributes['offset']);
         $collection = array_slice($collection, $offset, $limit);
     }
     $length = count($collection);
     $cols = $context->get($this->attributes['cols']);
     $row = 1;
     $col = 0;
     $result = "<tr class=\"row1\">\n";
     $context->push();
     foreach ($collection as $index => $item) {
         $context->set($this->variable_name, $item);
         $context->set('tablerowloop', array('length' => $length, 'index' => $index + 1, 'index0' => $index, 'rindex' => $length - $index, 'rindex0' => $length - $index - 1, 'first' => (int) ($index == 0), 'last' => (int) ($index == $length - 1)));
         $result .= "<td class=\"col" . ++$col . "\">" . $this->render_all($this->_nodelist, $context) . "</td>";
         if ($col == $cols && !($index == $length - 1)) {
             $col = 0;
             $result .= "</tr>\n<tr class=\"row" . ++$row . "\">";
         }
     }
     $context->pop();
     $result .= "</tr>\n";
     return $result;
 }
开发者ID:realestateconz,项目名称:php-liquid,代码行数:38,代码来源:LiquidTagTablerow.class.php

示例15: import

 /**
  * Import a set of valid URLS from a sitemap
  *
  * @param string $sitemapPath path to sitemap we want to parse defaults to webroot/site-map.xml
  * @param bool $clearAll
  * @param bool $verbose
  * @throws NotFoundException
  * @internal param \clear $boolean the set first, then import.
  * @internal param \verbose $boolean
  * @internal param \count $int of imported urls
  * @return int
  */
 public function import($sitemapPath = null, $clearAll = true, $verbose = false)
 {
     $count = 0;
     if ($this->settings['active']) {
         if (!file_exists($this->__getPathToSiteMap($sitemapPath))) {
             throw new NotFoundException("File not found.");
         }
         if ($clearAll) {
             $this->deleteAll(1);
         }
         $xml = simplexml_load_file($this->__getPathToSiteMap($sitemapPath));
         foreach ($xml->url as $url) {
             $this->create();
             $saveData = array('url' => parse_url((string) $url->loc, PHP_URL_PATH), 'priority' => (string) $url->priority);
             if ($this->save($saveData)) {
                 if ($verbose) {
                     echo ".";
                 }
                 $count++;
             } elseif ($verbose) {
                 echo "f";
                 debug($this->validationErrors);
             }
         }
     }
     return $count;
 }
开发者ID:stonelasley,项目名称:seo,代码行数:39,代码来源:SeoUrl.php


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