如何修复wordpress主题中的“非法字符串偏移”

时间:2016-02-18 12:54:34

标签: php string wordpress offset woothemes

我有一些主题来自我一年前买的WooThemes,现在我开始使用它们了。我一直收到“非法字符串偏移”错误。代码发布。请指教。感谢。

错误讯息:

Warning: Illegal string offset 'version' in C:\xampp\apps\wordpress\htdocs\wp-content\themes\flashnews\functions\admin-interface.php on line 1613

Warning: Illegal string offset 'version' in C:\xampp\apps\wordpress\htdocs\wp-content\themes\flashnews\functions\admin-interface.php on line 1659

第1612至1659行:

//Check if version is the latest - assume standard structure x.x.x
    $pieces_rss = explode( '.', $latest_version_via_rss['version'] );
    $pieces_local = explode( '.', $local_version );

    //account for null values in second position x.2.x

    if( isset( $pieces_rss[0] ) && $pieces_rss[0] != 0 ) {
        if ( ! isset( $pieces_rss[1] ) )
            $pieces_rss[1] = '0';

        if ( ! isset( $pieces_local[1] ) )
            $pieces_local[1] = '0';

        //account for null values in third position x.x.3
        if ( ! isset( $pieces_rss[2] ) )
            $pieces_rss[2] = '0';

        if ( ! isset( $pieces_local[2] ) )
            $pieces_local[2] = '0';

        //do the comparisons
        $version_sentinel = false;
        $status = 'bugfix';

        // Setup update statuses
        $statuses = array(
            'new_version' => __( 'New Version', 'woothemes' ),
            'new_feature' => __( 'New Feature', 'woothemes' ),
            'bugfix' => __( 'Bugfix', 'woothemes' )
        );

        // New version
        if ( $pieces_rss[0] > $pieces_local[0] ) {
            $version_sentinel = true;
            $status = 'new_version';
        }
        // New feature
        if ( ( $pieces_rss[1] > $pieces_local[1] ) && ( $version_sentinel == false ) && ( $pieces_rss[0] == $pieces_local[0] ) ) {
            $version_sentinel = true;
            $status = 'new_feature';
        }
        // Bugfix
        if ( ( $pieces_rss[2] > $pieces_local[2] ) && ( $version_sentinel == false ) && ( $pieces_rss[0] == $pieces_local[0] ) && ( $pieces_rss[1] == $pieces_local[1] ) ) {
            $version_sentinel = true;
            $status = 'bugfix';
        }

        return array( 'is_update' => $version_sentinel, 'version' => $latest_version_via_rss['version'], 'status' => $statuses[$status], 'theme_name' => $theme_name );

0 个答案:

没有答案
相关问题