Plugin Directory

Changeset 1519046


Ignore:
Timestamp:
10/21/2016 07:38:06 AM (9 years ago)
Author:
spindogs
Message:

release v1.4.4

Location:
wp-platform/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-platform/trunk/classes/Form.php

    r1513511 r1519046  
    315315
    316316        if (!isset($attrs['first_option'])) {
    317             $input .= '<option value="0">[please select]</option>';
     317            $input .= '<option value="">[please select]</option>';
    318318            $input .= "\n";
    319319        } elseif ($attrs['first_option']) {
    320             $input .= '<option value="0">'.$attrs['first_option'].'</option>';
     320            $input .= '<option value="">'.$attrs['first_option'].'</option>';
    321321            $input .= "\n";
    322322        }
     
    16341634
    16351635        //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 {
    16371639            $required_html = '';
    1638         } else {
    1639             $required_html = ' <span class="'.$this->required_wrap.'">*</span>';
    16401640        }
    16411641
  • wp-platform/trunk/classes/Request.php

    r1513511 r1519046  
    127127    }
    128128
     129    /**
     130     * @return string
     131     */
     132    public static function getUrl()
     133    {
     134        return self::getScheme().self::getHost().self::getPath().self::getQuery();
     135    }
     136
    129137}
  • wp-platform/trunk/classes/Setup.php

    r1513511 r1519046  
    33
    44class Setup {
     5
     6    protected static $caught_errors = false;
    57
    68    /**
     
    3941        //activation
    4042        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']);
    4148
    4249    }
     
    119126    }
    120127
     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
    121224
    122225}
  • wp-platform/trunk/plugin.php

    r1514036 r1519046  
    22/**
    33 * Plugin Name: WP-Platform
    4  * Version: 1.4.2
     4 * Version: 1.4.4
    55 * Description: Provides platform to allow developers to build bespoke functionality in an MVC and OOP fashion
    66 */
Note: See TracChangeset for help on using the changeset viewer.