Changeset 1519046
- Timestamp:
- 10/21/2016 07:38:06 AM (9 years ago)
- Location:
- wp-platform/trunk
- Files:
-
- 4 edited
-
classes/Form.php (modified) (2 diffs)
-
classes/Request.php (modified) (1 diff)
-
classes/Setup.php (modified) (3 diffs)
-
plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-platform/trunk/classes/Form.php
r1513511 r1519046 315 315 316 316 if (!isset($attrs['first_option'])) { 317 $input .= '<option value=" 0">[please select]</option>';317 $input .= '<option value="">[please select]</option>'; 318 318 $input .= "\n"; 319 319 } elseif ($attrs['first_option']) { 320 $input .= '<option value=" 0">'.$attrs['first_option'].'</option>';320 $input .= '<option value="">'.$attrs['first_option'].'</option>'; 321 321 $input .= "\n"; 322 322 } … … 1634 1634 1635 1635 //required html 1636 if (empty($this->fields[$name]['required'])) { 1636 if ($this->isRequired($name)) { 1637 $required_html = ' <span class="'.$this->required_wrap.'">*</span>'; 1638 } else { 1637 1639 $required_html = ''; 1638 } else {1639 $required_html = ' <span class="'.$this->required_wrap.'">*</span>';1640 1640 } 1641 1641 -
wp-platform/trunk/classes/Request.php
r1513511 r1519046 127 127 } 128 128 129 /** 130 * @return string 131 */ 132 public static function getUrl() 133 { 134 return self::getScheme().self::getHost().self::getPath().self::getQuery(); 135 } 136 129 137 } -
wp-platform/trunk/classes/Setup.php
r1513511 r1519046 3 3 4 4 class Setup { 5 6 protected static $caught_errors = false; 5 7 6 8 /** … … 39 41 //activation 40 42 register_activation_hook(WP_PLATFORM, array(__CLASS__, 'activate')); 43 44 //error handler 45 error_reporting(E_ALL | E_STRICT); 46 set_error_handler([__CLASS__, 'errorHandler']); 47 set_exception_handler([__CLASS__, 'exceptionHandler']); 41 48 42 49 } … … 119 126 } 120 127 128 /** 129 * @param string $errno 130 * @param string $errmsg 131 * @param string $filename 132 * @param string $linenum 133 * @return bool 134 */ 135 public static function errorHandler($errno, $errmsg, $filename, $linenum) 136 { 137 if (intval(ini_get('error_reporting')) < 1) { //this error has been @ suppressed 138 return true; 139 } 140 141 if (!(error_reporting() & $errno)) { 142 return true; //this error code is not included in error_reporting 143 } 144 145 if (strpos($filename, 'wp-content/themes') !== false) { 146 //report bug notices from theme files 147 } elseif (strpos($filename, 'wp-content/plugins/wp-platform') !== false) { 148 //report bug notices from sd-platform 149 } else { 150 //we're not interested in any other bug notices 151 return false; 152 } 153 154 if (!self::$caught_errors) { 155 self::emailError($errno, $errmsg, $filename, $linenum); 156 self::$caught_errors = true; 157 } 158 159 return false; //let the defaults kick in 160 } 161 162 /** 163 * @param Exception $exception 164 * @return void 165 */ 166 public static function exceptionHandler($exception) 167 { 168 if (!self::$caught_errors) { 169 170 $type = get_class($exception); 171 $message = $exception->getMessage(); 172 $filename = $exception->getFile(); 173 $line = $exception->getLine(); 174 $trace = $exception->getTraceAsString(); 175 176 if ($type == 'ErrorException') { 177 $code = $exception->getSeverity(); 178 } else { 179 $code = $exception->getCode(); 180 } 181 182 self::emailError($code, $message, $filename, $line, $trace); 183 self::$caught_errors = true; 184 185 } 186 187 } 188 189 /** 190 * @param string $code 191 * @param string $message 192 * @param string $filename 193 * @param string $line 194 * @param string $trace 195 * @return void 196 */ 197 public static function emailError($code, $message, $filename, $line, $trace='') 198 { 199 if (!defined('DEBUG_EMAIL')) { 200 return; 201 } 202 203 $msg = ''; 204 $msg .= '-- IP: '.(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '')."\n"; 205 $msg .= '-- UA: '.(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')."\n"; 206 $msg .= '-- Code: '.$code."\n"; 207 $msg .= '-- File: '.$filename."\n"; 208 $msg .= '-- Line: '.$line."\n"; 209 $msg .= '-- Message: '.$message."\n"; 210 $msg .= "\n"; 211 $msg .= $trace."\n"; 212 213 $sitename = get_bloginfo('name'); 214 $subject = '['.$sitename.' Bug] '.Request::getUrl(); 215 $emails = explode(',', DEBUG_EMAIL); 216 $emails = (array)$emails; 217 218 foreach ($emails as $to) { 219 mail($to, $subject, $msg, 'From: bugs@spindogs.com'); 220 } 221 222 } 223 121 224 122 225 } -
wp-platform/trunk/plugin.php
r1514036 r1519046 2 2 /** 3 3 * Plugin Name: WP-Platform 4 * Version: 1.4. 24 * Version: 1.4.4 5 5 * Description: Provides platform to allow developers to build bespoke functionality in an MVC and OOP fashion 6 6 */
Note: See TracChangeset
for help on using the changeset viewer.