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


PHP _debug函数代码示例

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


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

示例1: hook_article_filter

 function hook_article_filter($article)
 {
     if (strpos($article["link"], "volksstimme.de") !== FALSE) {
         $doc = new DOMDocument();
         @$doc->loadHTML(mb_convert_encoding(fetch_file_contents($article["link"]), 'HTML-ENTITIES', "auto"));
         $basenode = "";
         if ($doc) {
             $xpath = new DOMXPath($doc);
             // first remove advertisement stuff
             /* $stuff = $xpath->query('(//div[contains(@class, "em_left")])|(//div[contains(@class, "em_artikelansicht_tags")])|(//div[contains(@class, "em_ads_")])'); */
             /* foreach ($stuff as $removethis) { */
             /*     $removethis->parentNode->removeChild($removethis); */
             /* } */
             $entries = $xpath->query('(//div[@itemprop="image"]|//div[@itemprop="articleBody"])');
             foreach ($entries as $entry) {
                 _debug("Muh, found stuff...");
                 $basenode = $basenode . $doc->saveXML($entry);
                 _debug("Length of basenode: " . strlen($basenode));
             }
             if (!empty($basenode)) {
                 $article["content"] = $basenode;
             }
         }
     }
     return $article;
 }
开发者ID:Verisor,项目名称:Tiny-Tiny-RSS-Plugins,代码行数:26,代码来源:init.php

示例2: __call

 public function __call($event, $args)
 {
     if ($this->state) {
         _debug("calling state handler '" . $this->state . "' for incoming event '" . $event . "'");
         $call = method_exists($this, $this->state) ? array(&$this, $this->state) : $this->state;
         $r = call_user_func($call, $event, $args);
         if (is_array($r) && sizeof($r) == 2) {
             list($this->state, $ret) = $r;
         } else {
             if (is_array($r) && sizeof($r) == 1) {
                 $this->state = $r[0];
             } else {
                 if (is_string($r)) {
                     $this->state = $r;
                 } else {
                     $this->handle_invalid_state($r);
                 }
             }
         }
         _debug("current state '" . $this->state . "'");
         if (is_array($r) && sizeof($r) == 2) {
             return $ret;
         }
     } else {
         _debug("invalid state found, nothing called for event " . $event . "");
     }
 }
开发者ID:nimdraugsael,项目名称:furiko-server,代码行数:27,代码来源:jaxl_fsm.php

示例3: hook_article_filter

 function hook_article_filter($article)
 {
     if (strpos($article["link"], "taz.de") !== FALSE) {
         $doc = new DOMDocument();
         @$doc->loadHTML(mb_convert_encoding(fetch_file_contents($article["link"]), 'HTML-ENTITIES', "UTF-8"));
         $basenode = false;
         if ($doc) {
             $xpath = new DOMXPath($doc);
             // first remove advertisement stuff
             $stuff = $xpath->query('(//script)|(//noscript)|(//iframe)|(//style)|(//div[@class="sectfoot"])|(//div[@id="tzi_paywall"])|(//div[contains(@class, "rack")])');
             foreach ($stuff as $removethis) {
                 _debug("Remove1: " . $doc->saveXML($removethis));
                 $removethis->parentNode->removeChild($removethis);
             }
             $entries = $xpath->query('(//div[@class="sectbody"])');
             foreach ($entries as $entry) {
                 $basenode = $entry;
                 break;
             }
             if ($basenode) {
                 _debug("Result: " . $doc->saveXML($basenode));
                 $article["content"] = $doc->saveXML($basenode);
             }
         }
     }
     return $article;
 }
开发者ID:EduardBaer,项目名称:Tiny-Tiny-RSS-Plugins,代码行数:27,代码来源:init.php

示例4: performUpdateTo

 function performUpdateTo($version, $html_output = true)
 {
     if ($this->getSchemaVersion() == $version - 1) {
         $lines = $this->getSchemaLines($version);
         if (is_array($lines)) {
             db_query("BEGIN");
             foreach ($lines as $line) {
                 if (strpos($line, "--") !== 0 && $line) {
                     if (!db_query($line, false)) {
                         if ($html_output) {
                             print_notice("Query: {$line}");
                             print_error("Error: " . db_last_query_error());
                         } else {
                             _debug("Query: {$line}");
                             _debug("Error: " . db_last_query_error());
                         }
                         return false;
                     }
                 }
             }
             $db_version = $this->getSchemaVersion();
             if ($db_version == $version) {
                 db_query("COMMIT");
                 return true;
             } else {
                 db_query("ROLLBACK");
                 return false;
             }
         } else {
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:kucrut,项目名称:tt-rss,代码行数:35,代码来源:dbupdater.php

示例5: create_new_template

/**
 * 
 * Function sort out paramaters
 * This function creates folders needed when duplicating a template
 * @param number $folder_name_id - the id of this template
 * @param number $tutorial_id_from_post - the parent template name for the new tutorial
 * @version 1.0
 * @author Patrick Lockley
 */
function create_new_template($folder_name_id, $parent_template_name)
{
    global $dir_path, $new_path, $temp_dir_path, $temp_new_path, $xerte_toolkits_site;
    $row_framework = db_query_one("SELECT template_framework from {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails WHERE template_name = ?", array($parent_template_name));
    // I think this is wrong, currently looking like : /home/david/src/xerteonlinetoolkits/modules//templates/0 should presumably be home/david/src/xerteonlinetoolkits/modules/xerte/templates/Nottingham
    $dir_path = $xerte_toolkits_site->basic_template_path . $row_framework['template_framework'] . "/templates/" . $parent_template_name;
    /**
     * Get the id of the folder we are looking to copy into
     */
    _debug("Creating new template : {$folder_name_id}, {$parent_template_name}");
    $new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $parent_template_name;
    $path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $parent_template_name;
    if (is_dir($path)) {
        _debug("Trying to create new template at location - {$path} - it's already in use. Aborting");
        die("Template directory already exists; will not overwrite/re-create.");
    }
    if (mkdir($path)) {
        _debug("Created {$path} ok");
        if (@chmod($path, 0777)) {
            $ok = copy_r($dir_path, $path);
            _debug("Copy_r returned " . print_r($ok, true));
            return $ok;
        } else {
            _debug("Failed to set rights ");
            receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "MAJOR", "Failed to set rights on parent folder for template", "Failed to set rights on parent folder " . $path);
            return false;
        }
    } else {
        receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "CRITICAL", "Failed to create parent folder for template", "Failed to create parent folder " . $path);
        return false;
    }
}
开发者ID:jak786,项目名称:xerteonlinetoolkits,代码行数:41,代码来源:new_template.php

示例6: process

 function process(&$article)
 {
     if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) {
         if ($debug_enabled) {
             _debug("af_pennyarcade: Processing comic");
         }
         $doc = new DOMDocument();
         $doc->loadHTML(fetch_file_contents($article["link"]));
         $basenode = false;
         if ($doc) {
             $xpath = new DOMXPath($doc);
             $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
             if ($basenode) {
                 $article["content"] = $doc->saveXML($basenode);
             }
         }
         return true;
     }
     if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) {
         if ($debug_enabled) {
             _debug("af_pennyarcade: Processing news post");
         }
         $doc = new DOMDocument();
         $doc->loadHTML(fetch_file_contents($article["link"]));
         if ($doc) {
             $xpath = new DOMXPath($doc);
             $entries = $xpath->query('(//div[@class="post"])');
             $basenode = false;
             foreach ($entries as $entry) {
                 $basenode = $entry;
             }
             $meta = $xpath->query('(//div[@class="meta"])')->item(0);
             if ($meta->parentNode) {
                 $meta->parentNode->removeChild($meta);
             }
             $header = $xpath->query('(//div[@class="postBody"]/h2)')->item(0);
             if ($header->parentNode) {
                 $header->parentNode->removeChild($header);
             }
             $header = $xpath->query('(//div[@class="postBody"]/div[@class="comicPost"])')->item(0);
             if ($header->parentNode) {
                 $header->parentNode->removeChild($header);
             }
             $avatar = $xpath->query('(//div[@class="avatar"]//img)')->item(0);
             if ($basenode) {
                 $basenode->insertBefore($avatar, $basenode->firstChild);
             }
             $uninteresting = $xpath->query('(//div[@class="avatar"])');
             foreach ($uninteresting as $i) {
                 $i->parentNode->removeChild($i);
             }
             if ($basenode) {
                 $article["content"] = $doc->saveXML($basenode);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:XelaRellum,项目名称:tt-rss,代码行数:59,代码来源:af_comics_pa.php

示例7: hook_article_filter

 function hook_article_filter($article)
 {
     $owner_uid = $article["owner_uid"];
     if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) {
         if (strpos($article["plugin_data"], "pennyarcade,{$owner_uid}:") === FALSE) {
             if ($debug_enabled) {
                 _debug("af_pennyarcade: Processing comic");
             }
             $doc = new DOMDocument();
             $doc->loadHTML(fetch_file_contents($article["link"]));
             $basenode = false;
             if ($doc) {
                 $xpath = new DOMXPath($doc);
                 $entries = $xpath->query('(//div[@class="post comic"])');
                 foreach ($entries as $entry) {
                     $basenode = $entry;
                 }
                 if ($basenode) {
                     $article["content"] = $doc->saveXML($basenode);
                     $article["plugin_data"] = "pennyarcade,{$owner_uid}:" . $article["plugin_data"];
                 }
             }
         } else {
             if (isset($article["stored"]["content"])) {
                 $article["content"] = $article["stored"]["content"];
             }
         }
     }
     if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) {
         if (strpos($article["plugin_data"], "pennyarcade,{$owner_uid}:") === FALSE) {
             if ($debug_enabled) {
                 _debug("af_pennyarcade: Processing news post");
             }
             $doc = new DOMDocument();
             $doc->loadHTML(fetch_file_contents($article["link"]));
             if ($doc) {
                 $xpath = new DOMXPath($doc);
                 $entries = $xpath->query('(//div[@class="post"])');
                 $basenode = false;
                 foreach ($entries as $entry) {
                     $basenode = $entry;
                 }
                 $uninteresting = $xpath->query('(//div[@class="heading"])');
                 foreach ($uninteresting as $i) {
                     $i->parentNode->removeChild($i);
                 }
                 if ($basenode) {
                     $article["content"] = $doc->saveXML($basenode);
                     $article["plugin_data"] = "pennyarcade,{$owner_uid}:" . $article["plugin_data"];
                 }
             }
         } else {
             if (isset($article["stored"]["content"])) {
                 $article["content"] = $article["stored"]["content"];
             }
         }
     }
     return $article;
 }
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:59,代码来源:init.php

示例8: send_headlines_digests

/**
 * Send by mail a digest of last articles.
 *
 * @param mixed $link The database connection.
 * @param integer $limit The maximum number of articles by digest.
 * @return boolean Return false if digests are not enabled.
 */
function send_headlines_digests($debug = false)
{
    require_once 'classes/ttrssmailer.php';
    $user_limit = 15;
    // amount of users to process (e.g. emails to send out)
    $limit = 1000;
    // maximum amount of headlines to include
    if ($debug) {
        _debug("Sending digests, batch of max {$user_limit} users, headline limit = {$limit}");
    }
    if (DB_TYPE == "pgsql") {
        $interval_query = "last_digest_sent < NOW() - INTERVAL '1 days'";
    } elseif (DB_TYPE == "mysql") {
        $interval_query = "last_digest_sent < DATE_SUB(NOW(), INTERVAL 1 DAY)";
    }
    $result = db_query("SELECT id,email FROM ttrss_users\n        WHERE email != '' AND (last_digest_sent IS NULL OR {$interval_query})");
    while ($line = db_fetch_assoc($result)) {
        if (@get_pref('DIGEST_ENABLE', $line['id'], false)) {
            $preferred_ts = strtotime(get_pref('DIGEST_PREFERRED_TIME', $line['id'], '00:00'));
            // try to send digests within 2 hours of preferred time
            if ($preferred_ts && time() >= $preferred_ts && time() - $preferred_ts <= 7200) {
                if ($debug) {
                    _debug("Sending digest for UID:" . $line['id'] . " - " . $line["email"]);
                }
                $do_catchup = get_pref('DIGEST_CATCHUP', $line['id'], false);
                global $tz_offset;
                // reset tz_offset global to prevent tz cache clash between users
                $tz_offset = -1;
                $tuple = prepare_headlines_digest($line["id"], 1, $limit);
                $digest = $tuple[0];
                $headlines_count = $tuple[1];
                $affected_ids = $tuple[2];
                $digest_text = $tuple[3];
                if ($headlines_count > 0) {
                    $mail = new ttrssMailer();
                    $rc = $mail->quickMail($line["email"], $line["login"], DIGEST_SUBJECT, $digest, $digest_text);
                    if (!$rc && $debug) {
                        _debug("ERROR: " . $mail->ErrorInfo);
                    }
                    if ($debug) {
                        _debug("RC={$rc}");
                    }
                    if ($rc && $do_catchup) {
                        if ($debug) {
                            _debug("Marking affected articles as read...");
                        }
                        catchupArticlesById($affected_ids, 0, $line["id"]);
                    }
                } elseif ($debug) {
                    _debug("No headlines");
                }
                db_query("UPDATE ttrss_users SET last_digest_sent = NOW()\n                    WHERE id = " . $line["id"]);
            }
        }
    }
    if ($debug) {
        _debug("All done.");
    }
}
开发者ID:adrianpietka,项目名称:bfrss,代码行数:66,代码来源:digest.php

示例9: logout

function logout()
{
    global $_SESSION;
    _debug("logging out user " . $_SESSION["s_user"]);
    $_SESSION = array();
    session_destroy();
    header("location: " . $GLOBALS["script_name"]);
}
开发者ID:realtimeprojects,项目名称:quixplorer,代码行数:8,代码来源:login.php

示例10: shutdown_handler

 public static function shutdown_handler()
 {
     try {
         if (null !== ($error = error_get_last())) {
             throw new JAXLException($error['message'], $error['type'], $error['file'], $error['line']);
         }
     } catch (Exception $e) {
         _debug("shutdown handler catched with exception " . json_encode($e));
     }
 }
开发者ID:nimdraugsael,项目名称:furiko-server,代码行数:10,代码来源:jaxl_exception.php

示例11: logged_out

 public function logged_out($stanza)
 {
     if ($stanza->name == "error" && $stanza->ns == NS_XMPP) {
         $reason = $stanza->childrens[0]->name;
         $this->jaxl->handle_auth_failure($reason);
         $this->jaxl->send_end_stream();
         return array("logged_out", 0);
     } else {
         _debug("uncatched stanza received in logged_out");
     }
 }
开发者ID:lcandida,项目名称:push-message-serie-web,代码行数:11,代码来源:xep_0114.php

示例12: actionShow

 public function actionShow()
 {
     $url = end(App::parseRoute($_SERVER['REQUEST_URI'])['routes']);
     $article = Article::findOne(['url_crc' => crc32($url)]);
     _debug('Url: ' . $url . ' (crc: ' . crc32($url) . ')');
     if (empty($article)) {
         return Controller::redirectTo404($_SERVER['REQUEST_URI']);
     }
     $comments = $article->getComments();
     return $this->view->render('showArticle', ['article' => $article, 'commentsCount' => count($comments), 'comments' => $comments]);
 }
开发者ID:ArtemRochev,项目名称:MVC-Framework,代码行数:11,代码来源:ControllerArticle.php

示例13: hook_article_filter

 function hook_article_filter($article)
 {
     if ($this->lang) {
         $entry_language = $this->lang->detect($article['title'] . " " . $article['content'], 1);
         if (count($entry_language) > 0) {
             $possible = array_keys($entry_language);
             $entry_language = $possible[0];
             _debug("detected language: {$entry_language}");
             $article["language"] = $entry_language;
         }
     }
     return $article;
 }
开发者ID:XelaRellum,项目名称:tt-rss,代码行数:13,代码来源:init.php

示例14: add_transcode_job

function add_transcode_job($inputFilename, $outputFilename)
{
    // Ubuntu 14.04 - libav-tools, libavcodec-extra-54
    if (is_file('/usr/bin/ffmpeg')) {
        $cmd = 'ffmpeg -i ' . escapeshellarg($inputFilename) . ' -sameq -ar 22050 -vcodec libx264  ' . escapeshellarg($outputFilename) . ' 2>&1';
    } else {
        $cmd = 'avconv ' . '-i ' . escapeshellarg($inputFilename) . ' -c:v h264 ' . '-b:v 2000k ' . '-c:a aac ' . '-b:a 196k ' . '-f mp4 ' . '-strict experimental ' . escapeshellarg($outputFilename) . ' 2>&1';
    }
    _debug("Running: {$cmd}");
    $output = array();
    $return = null;
    exec($cmd, $output, $return);
    _debug("Returned: {$return}, Output: " . print_r($output, true));
}
开发者ID:virginiarcruz,项目名称:xerteonlinetoolkits,代码行数:14,代码来源:transcoder.php

示例15: xml_check_parseability

/**
 * Wordpress filter (see add_filter), designed to hook in on the action/event 'editor_save_data'.
 *
 * Check the validity of the XML passed in when saving a template via use of simplexml_load_string.
 * If there are errors, we _debug() them and return boolean false.
 * If there aren't any errors, we return the pretty printed variant of the string.
 *
 * @return string (xml) or boolean false on failure
 */
function xml_check_parseability()
{
    $args = func_get_args();
    $xml_string = $args[0];
    $validator = new Xerte_Validate_Xml();
    if ($validator->isValid($xml_string)) {
        _debug("XML parsing passed");
        return $xml_string;
    } else {
        _debug("Invalid XML passed in : '{$xml_string}'");
        error_log("Invalid XML passed in : '{$xml_string}'");
        return false;
    }
}
开发者ID:virginiarcruz,项目名称:xerteonlinetoolkits,代码行数:23,代码来源:xml_parsing_check.php


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