Admin Tweak has Strict php static errors. Fix patch included.
-
I was getting “non-static function _____ should not be called statically”. I just made the functions static and the errors are gone.
Note you will not see these errors unless you ask php to show strict errors.
Patch that fixes them:
diff -u a/many-tips-together/inc/class-admin-validate.php b/many-tips-together/inc/class-admin-validate.php --- a/many-tips-together/inc/class-admin-validate.php +++ b/many-tips-together/inc/class-admin-validate.php @@ -12,7 +12,7 @@ class B5F_MTT_Validate * @param object $value * @return object */ - public function validate_adminbar( $value ) + public static function validate_adminbar( $value ) { if( isset( $value['url'] ) ) $value['url'] = self::validate_url( $value['url'] ); @@ -46,7 +46,7 @@ class B5F_MTT_Validate * @param object $value * @return object */ - public function validate_post_renaming( $value ) + public static function validate_post_renaming( $value ) { foreach( $value as $key => $val ) { @@ -65,7 +65,7 @@ class B5F_MTT_Validate * @param object $value * @return object */ - public function validate_postlisting( $value ) + public static function validate_postlisting( $value ) { if( isset( $value['width'] ) ) { @@ -89,7 +89,7 @@ class B5F_MTT_Validate * @param number $value * @return number */ - public function validate_postediting( $value ) + public static function validate_postediting( $value ) { $val = B5F_MTT_Utils::validate_pos_neg_number( $value ); $value = ( false !== $val ) ? $val : ''; @@ -103,7 +103,7 @@ class B5F_MTT_Validate * @param number $value * @return number */ - public function validate_jpg_quality( $value ) + public static function validate_jpg_quality( $value ) { $return = B5F_MTT_Utils::validate_pos_neg_number( $value ); @@ -127,7 +127,7 @@ class B5F_MTT_Validate * @param number $value * @return number */ - public function validate_rss_time( $value ) + public static function validate_rss_time( $value ) { $return = B5F_MTT_Utils::validate_pos_neg_number( $value ); @@ -147,7 +147,7 @@ class B5F_MTT_Validate * @param object $value * @return object */ - public function validate_colorize_plugins( $value ) + public static function validate_colorize_plugins( $value ) { if( isset( $value['names'] ) ) $value['names'] = @@ -162,7 +162,7 @@ class B5F_MTT_Validate * @param type $value * @return type */ - public function validate_general_tab( $value ) + public static function validate_general_tab( $value ) { if( isset( $value['time'] ) ) $value['time'] = @@ -211,7 +211,7 @@ class B5F_MTT_Validate * @param type $numb Allows # or not * @return string */ - public function validate_url( $uri, $numb = true ) + public static function validate_url( $uri, $numb = true ) { $url = B5F_MTT_Utils::check_url( $uri, $numb ); if( !$url ) @@ -230,7 +230,7 @@ class B5F_MTT_Validate * @param string $val * @return boolean */ - public function is_alphanumeric( $val, $simple = false ) + public static function is_alphanumeric( $val, $simple = false ) { $preg = $simple @@ -245,7 +245,7 @@ class B5F_MTT_Validate * @param string $value * @return string */ - public function validate_loginout_url( $value ) + public static function validate_loginout_url( $value ) { // false doesn't allow # $url = B5F_MTT_Utils::check_url( $value['url'], false ); @@ -277,7 +277,7 @@ class B5F_MTT_Validate * @param string $value * @return string */ - public function validate_simple_full_url( $value ) + public static function validate_simple_full_url( $value ) { $url = B5F_MTT_Utils::check_url( $value, false ); if( !$url ) @@ -292,7 +292,7 @@ class B5F_MTT_Validate * @param type $value * @return type */ - public function validate_number( $value ) + public static function validate_number( $value ) { $num = B5F_MTT_Utils::validate_css_number( $value ); $value = ( false === $num ) ? '' : $num; @@ -306,7 +306,7 @@ class B5F_MTT_Validate * @param type $value * @return type */ - public function validate_css_num_value( $value ) + public static function validate_css_num_value( $value ) { $num = B5F_MTT_Utils::validate_css_px_percent( $value ); if( !$num ) @@ -346,7 +346,7 @@ class B5F_MTT_Validate * * @param type $value */ - public function strip_html( $value ) + public static function strip_html( $value ) { return strip_tags( $value ); } @@ -359,7 +359,7 @@ class B5F_MTT_Validate * @param type $value * @return type */ - public function validate_html_text( $value ) + public static function validate_html_text( $value ) { if( is_array( $value ) ) { diff -u a/many-tips-together/inc/class-plugin-metabox.php b/many-tips-together/inc/class-plugin-metabox.php --- a/many-tips-together/inc/class-plugin-metabox.php +++ b/many-tips-together/inc/class-plugin-metabox.php @@ -7,7 +7,7 @@ class B5F_MTT_MetaBox { - public function mtt_meta_box() + public static function mtt_meta_box() { $logo = B5F_MTT_Init::get_instance()->plugin_url . 'images/mtt-logo.png'; $mtt_tb_title = B5F_MTT_Init::$version . ' ' . B5F_MTT_Admin::$mtt_tb_title; @@ -117,4 +117,4 @@ class B5F_MTT_MetaBox } - \ No newline at end of file + diff -u a/many-tips-together/inc/hooks/class-category-check-list-tree.php b/many-tips-together/inc/hooks/class-category-check-list-tree.php --- a/many-tips-together/inc/hooks/class-category-check-list-tree.php +++ b/many-tips-together/inc/hooks/class-category-check-list-tree.php @@ -10,11 +10,11 @@ Plugin URI: https://scribu.net/wordpress/category-checklist-tree class MTT_Category_Checklist { - function init() { + public static function init() { add_filter( 'wp_terms_checklist_args', array( __CLASS__, 'checklist_args' ) ); } - function checklist_args( $args ) { + static function checklist_args( $args ) { add_action( 'admin_footer', array( __CLASS__, 'script' ) ); $args['checked_ontop'] = false; @@ -23,7 +23,7 @@ class MTT_Category_Checklist { } // Scrolls to first checked category - function script() { + static function script() { ?> <script type="text/javascript"> jQuery(function(){ @@ -45,4 +45,4 @@ class MTT_Category_Checklist { } } -MTT_Category_Checklist::init(); \ No newline at end of file +MTT_Category_Checklist::init();
- The topic ‘Admin Tweak has Strict php static errors. Fix patch included.’ is closed to new replies.