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


PHP Debug::silent_mode方法代码示例

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


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

示例1: send

 public function send($supress = true)
 {
     // Build the email header
     $this->build_header();
     // Disable error reporting
     if ($supress = true) {
         \Debug::silent_mode(true);
     }
     // Send the email
     $sent = mail($this->to, $this->subject, $this->message, $this->header);
     // Re-enable errors and return
     if ($supress = true) {
         \Debug::silent_mode(false);
     }
     return $sent;
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:16,代码来源:Email.php

示例2: connect

 public function connect($server, $port, $user, $pass, $urn = NULL)
 {
     // Determine our URI based on our core if one isnt provided
     if ($urn == NULL) {
         $e = config('emulator');
         switch ($e) {
             case "mangos":
                 $uri = "urn:MaNGOS";
                 break;
             case "trinity":
                 $uri = "urn:TC";
                 break;
             default:
                 $uri = "";
                 break;
         }
     } else {
         $uri = "urn:" . $urn;
     }
     // Disable error reporting
     \Debug::silent_mode(true);
     // Open the handle
     $test = fsockopen($server, $port, $errno, $errstr, 3);
     // Re-enable error reporting
     \Debug::silent_mode(false);
     // Check if we connected successfully
     if ($test) {
         // Build our connection params
         $params = array("location" => "http://" . $server . ":" . $port . "/", "uri" => $uri, "style" => SOAP_RPC, "login" => $user, "password" => $pass);
         // Open the handle
         try {
             $this->handle = new \SoapClient(NULL, $params);
             $return = TRUE;
         } catch (\Exception $e) {
             $this->console_return = $this->debug[] = 'Failed to initiate SOAP Connection: ' . $e->getMessage();
             $this->write_log();
             $return = FALSE;
         }
     } else {
         $this->console_return = $this->debug[] = 'Connection to ' . $server . ':' . $port . ' Failed!';
         $this->write_log();
         $return = FALSE;
     }
     // Return our success or failure
     return $return;
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:46,代码来源:Soap.php

示例3: connect

 public function connect($host, $port, $user, $pass)
 {
     // Disable error reporting
     \Debug::silent_mode(true);
     // Open the handle
     $this->handle = fsockopen($host, $port, $errno, $errstr, 3);
     // Re-enable error reporting
     \Debug::silent_mode(false);
     // Check if we connected successfully
     if ($this->handle) {
         // get the Login prompt
         $auth_prompt = $this->get_response();
         // Uppercase Username
         $user = strtoupper($user);
         // Write username and password to command window
         $send1 = $this->send($user);
         $send2 = $this->send($pass);
         // If our writing is successful
         if ($send1 == TRUE && $send2 == TRUE) {
             // Get the motd OR auth error, 1 of the 2
             $response = $this->get_response();
             if (strpos($response, "failed") !== FALSE) {
                 $this->console_return = $this->debug[] = 'Authorization Failed.';
                 $this->write_log();
                 $this->disconnect();
                 return FALSE;
             }
             return TRUE;
         } else {
             $this->debug[] = 'Writing to console failed!';
         }
     } else {
         $this->console_return = $this->debug[] = 'Connection to ' . $host . ':' . $port . ' Failed!';
     }
     // If we are here, we had errors :(
     $this->write_log();
     return FALSE;
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:38,代码来源:Telnet.php

示例4: realm_status

 public function realm_status()
 {
     // Load our config class
     $Config = load_class('Config');
     $Cache = $this->load->library('Cache');
     $Ajax = get_instance();
     // See if we have cached results
     $result = $Cache->get('ajax_realm_status');
     if ($result == FALSE) {
         // Set the result to array, and load time helper
         $result = array();
         $this->load->helper('Time');
         // Fetch the array of realms
         $query = "SELECT `id`, `name`, `type`, `address`, `port`, `max_players` FROM `pcms_realms`";
         $realms = $this->DB->query($query)->fetchAll();
         if ($realms == FALSE) {
             $realms = array();
         }
         // Loop through each realm, and get its status
         foreach ($realms as $key => $realm) {
             // Dont show warning produced by fsockopen
             \Debug::silent_mode(true);
             $handle = fsockopen($realm['address'], $realm['port'], $errno, $errstr, 2);
             \Debug::silent_mode(false);
             // Set our status var
             $handle == FALSE ? $status = 0 : ($status = 1);
             // Load the wowlib for this realm
             $wowlib = $this->load->wowlib($realm['id']);
             // Build our realms return
             if ($status == 1 && is_object($wowlib) && is_object($wowlib->characters)) {
                 // Get our realm uptime
                 $uptime = $this->realm->uptime($realm['id']);
                 $uptime == FALSE ? $uptime = 'Unavailable' : ($uptime = format_time($uptime));
                 // Determine population
                 $ally = $wowlib->characters->getOnlineCount(1);
                 $horde = $wowlib->characters->getOnlineCount(2);
                 $online = $ally + $horde;
                 $space = $realm['max_players'] - $online;
                 $percent = $space < 0 ? 100 : $space / $realm['max_players'];
                 // Get our population text
                 if ($percent < 40) {
                     $pop = '<span id="realm_population_low">Low</span>';
                 } elseif ($percent < 75) {
                     $pop = '<span id="realm_population_medium">Medium</span>';
                 } else {
                     $pop = $percent > 98 ? '<span id="realm_population_full">Full</span>' : '<span id="realm_population_high">High</span>';
                 }
                 // Build our realm info array
                 $result[] = array('success' => true, 'id' => $realm['id'], 'name' => $realm['name'], 'type' => $realm['type'], 'status' => $status, 'population' => $pop, 'online' => $online, 'alliance' => $ally, 'horde' => $horde, 'uptime' => $uptime);
             } else {
                 $result[] = array('success' => true, 'id' => $realm['id'], 'name' => $realm['name'], 'type' => $realm['type'], 'status' => $status, 'population' => '<span id="realm_population_low">Low</span>', 'online' => 0, 'alliance' => 0, 'horde' => 0, 'uptime' => 'Offline');
             }
         }
         // Cache the results for 2 minutes
         $Cache->save('ajax_realm_status', $result, 120);
     }
     // Push the output in json format
     echo json_encode($result);
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:59,代码来源:ajax_model.php

示例5: update

 public function update()
 {
     // Make sure user is super admin for ajax
     if ($this->user['is_super_admin'] != 1) {
         $this->show_403();
         return;
     }
     // Build our page title / desc, then load the view
     $data = array('page_title' => "Remote Updater", 'page_desc' => "This script allows you to update your CMS with just a click of a button.");
     //Try cURL first.
     if (!extension_loaded("curl")) {
         $ssl = true;
         $fopen = true;
         //Fall back on OpenSSL and allow_url_fopen before failing.
         if (!extension_loaded("openssl") || !in_array("https", stream_get_wrappers())) {
             $ssl = false;
         }
         if (ini_get("allow_url_fopen") != 1) {
             $fopen = false;
         }
         if (!$ssl || !$fopen) {
             $Message = "The Plexis remote updater requires either cURL or OpenSSL and allow_url_fopen, please enable cURL or OpenSSL and allow_url_fopen.<br /><br />cURL: Disabled";
             $Message .= "<br />OpenSSL: " . $ssl ? "Enabled" : "Disabled";
             $Message .= "<br />allow_url_fopen" . $fopen ? "Enabled" : "Disabled";
             output_message("warning", $Message);
             $this->load->view("blank", $data);
             return;
         }
     }
     // Include the URL helper
     $this->load->helper('Url');
     // Get the file changes from github
     $start = microtime(1);
     \Debug::silent_mode(true);
     $page = getPageContents('https://api.github.com/repos/Plexis/Plexis/commits?per_page=30');
     \Debug::silent_mode(false);
     $stop = microtime(1);
     // Granted we have page contents
     if ($page) {
         // Decode the results
         $commits = json_decode($page, TRUE);
         // Defaults
         $count = 0;
         $latest = 0;
         // Get the latest build
         $message = $commits[0]['commit']['message'];
         if (preg_match('/([0-9]+)/', $message, $latest)) {
             $latest = $latest[0];
             if (CMS_BUILD < $latest) {
                 $count = $latest - CMS_BUILD;
                 if ($count > 29) {
                     output_message('warning', 'Your cms is out of date by more than 30 updates. You will need to manually update.');
                     $this->load->view('blank', $data);
                     return;
                 }
             }
         } else {
             output_message('warning', 'Unable to determine latest build');
             $this->load->view('blank', $data);
             return;
         }
         // Simple
         $count == 0 ? $next = $commits[0] : ($next = $commits[$count - 1]);
         $d = new DateTime($next['commit']['author']['date']);
         $date = $d->format("M j, Y - g:i a");
         // Set JS vars
         $this->Template->setjs('update_sha', $next['sha']);
         $this->Template->setjs('update_url', $next['url']);
         // Build our page data
         $data['time'] = round($stop - $start, 5);
         $data['count'] = $count;
         $data['latest'] = $latest;
         $data['message'] = preg_replace('/([\\[0-9\\]]+)/', '', htmlspecialchars($next['commit']['message']), 1);
         $data['date'] = $date;
         $data['author'] = '<a href="https://github.com/' . $next['author']['login'] . '" target="_blank">' . ucfirst($next['author']['login']) . '</a>';
         $data['more_info'] = "https://github.com/Plexis/Plexis/commit/" . $next['sha'];
         $data['CMS_BUILD'] = CMS_BUILD;
         unset($commits);
         // No updates has a different view
         if ($count == 0) {
             $this->load->view('no_updates', $data);
         } else {
             // Add the progress bar
             $this->Template->add_script('progressbar_mini.js');
             $this->Template->add_css('progressbar.css');
             $this->load->view('updates', $data);
         }
     } else {
         output_message('warning', 'Unable to fetch updates from Github.');
         $this->load->view('blank', $data);
         return;
     }
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:93,代码来源:admin.php

示例6: show_error

function show_error($err_message = 'none', $args = null, $lvl = E_ERROR, $fatal = false)
{
    // Let get a backtrace for deep debugging
    $backtrace = debug_backtrace();
    $calling = $backtrace[0];
    // Load language
    $lang = load_class('Language');
    $lang->load('core_errors');
    $message = $lang->get($err_message);
    // Allow custom messages
    if ($message === FALSE) {
        $message = $err_message;
    }
    // Do replacing
    if (is_array($args)) {
        $message = vsprintf($message, $args);
    }
    // Let the debugger take over from here
    if ($fatal) {
        \Debug::silent_mode(false);
    }
    \Debug::trigger_error($lvl, $message, $calling['file'], $calling['line']);
}
开发者ID:Kheros,项目名称:Plexis,代码行数:23,代码来源:Common.php

示例7: _initWowlib

 protected function _initWowlib()
 {
     // Include the wowlib file
     require path(ROOT, 'third_party', 'wowlib', 'Wowlib.php');
     // Add Trace
     \Debug::trace('Initializing Wowlib...', __FILE__, __LINE__);
     // Try to init the wowlib
     try {
         \Wowlib::Init(config('emulator'));
         \Debug::trace('Wowlib Initialized successfully', __FILE__, __LINE__);
     } catch (Exception $e) {
         \Debug::silent_mode(false);
         \Debug::trace('Wowlib failed to initialize. Message thrown was: ' . $e->getMessage(), __FILE__, __LINE__);
         show_error('Wowlib Error: ' . $e->getMessage(), false, E_ERROR);
     }
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:16,代码来源:Loader.php

示例8: update

 public function update()
 {
     // Make sure we arent directly accessed and the user has perms
     $this->check_access('sa');
     // Process action
     if (isset($_POST['action'])) {
         $action = trim($this->Input->post('action'));
         switch ($action) {
             case "get_latest":
                 // cURL exist? If not we need to verify the user has openssl installed and https support
                 $curl = function_exists('curl_exec');
                 if (!$curl) {
                     // Make sure the Openssl extension is loaded
                     if (!extension_loaded('openssl')) {
                         echo json_encode(array('success' => false, 'message' => 'Openssl extension not found. Please enable the openssl extension in your php.ini file'));
                         return;
                     }
                     // Check for https support
                     if (!in_array('https', stream_get_wrappers())) {
                         echo json_encode(array('success' => false, 'message' => 'Unable to find the stream wrapper "https" - did you forget to enable it when you configured PHP?'));
                         return;
                     }
                 }
                 // Make sure the client server allows fopen of urls
                 if (ini_get('allow_url_fopen') == 1 || $curl == true) {
                     // Get the file changes from github
                     $start = microtime(1);
                     \Debug::silent_mode(true);
                     $page = getPageContents('https://api.github.com/repos/Plexis/Plexis/commits?per_page=1', false);
                     \Debug::silent_mode(false);
                     $stop = microtime(1);
                     if ($page == FALSE || empty($page)) {
                         echo json_encode(array('success' => false, 'message' => 'Unable to connect to the update server'));
                         return;
                     }
                     // Decode the results
                     $commits = json_decode($page, TRUE);
                     // Defaults
                     $count = 0;
                     $latest = 0;
                     echo json_encode(array('success' => true, 'message' => $commits));
                     return;
                 } else {
                     echo json_encode(array('success' => false, 'message' => 'allow_url_fopen not enabled in php.ini'));
                     return;
                 }
                 break;
             case "init":
                 config_set('site_updating', 1);
                 config_save('app');
                 break;
             case "finish":
                 // Enable the site again
                 config_set('site_updating', 0);
                 config_save('app');
                 break;
             case "next":
                 // Load the commit.info file
                 $sha = $type = trim($this->Input->post('sha'));
                 $url = 'https://raw.github.com/Plexis/Plexis/' . $sha . '/commit.info';
                 // Get the file changes from github
                 $start = microtime(1);
                 \Debug::silent_mode(true);
                 $page = trim(getPageContents($url, false));
                 \Debug::silent_mode(false);
                 $stop = microtime(1);
                 if ($page == FALSE || empty($page)) {
                     echo json_encode(array('success' => false, 'data' => 'Error fetching updates'));
                     return;
                 }
                 echo json_encode(array('success' => true, 'data' => json_decode($page)));
                 break;
             case "update":
                 // Grab POSTS
                 $type = trim($this->Input->post('status'));
                 $sha = trim($this->Input->post('sha'));
                 $file = trim(str_replace(array('/', '\\'), '/', $this->Input->post('filename')));
                 $url = 'https://raw.github.com/Plexis/Plexis/' . $sha . '/' . $file;
                 $filename = ROOT . DS . str_replace('/', DS, $file);
                 $dirname = dirname($filename);
                 // Load our Filesystem Class
                 $Fs = $this->load->library('Filesystem');
                 // Build our default Json return
                 $return = array();
                 $success = TRUE;
                 $removed = FALSE;
                 // Hush errors
                 \Debug::silent_mode(true);
                 // Get file contents
                 $contents = trim(getPageContents($url, false));
                 $mod = substr($type, 0, 1);
                 switch ($mod) {
                     case "A":
                     case "M":
                         // Make sure the Directory exists!
                         if (!is_dir($dirname)) {
                             // Ignore install files if the install directory doesnt exist
                             if (strpos($dirname, ROOT . DS . 'install') !== false) {
                                 $this->output(true, '');
                                 return;
//.........这里部分代码省略.........
开发者ID:Kheros,项目名称:Plexis,代码行数:101,代码来源:admin_ajax.php


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