Mojo WP插件问题-cli-init.php错误

时间:2018-11-11 05:33:05

标签: php wordpress

我创建了一个WP网站,但由于以下错误而被锁定:

解析错误:语法错误,在[我的网站] /wp-content/plugins/mojo-marketplace-wp-plugin/inc/cli-init.php中出现意外的“。”,在第25行。追溯到我的代码。这是第20-35行:

protected $commands = array(
    array(
        'cmd'       => 'branding',
        'class'     => 'EIG_WP_CLI_Branding',
        'shortdesc' => 'Control hosting branding and UX.',
        'longdesc'  => 'Control the admin interface, default modules and UX for an Endurance hosting brand.' .
                       PHP_EOL . 'Subcommands: update, remove',
    ),
    array(
        'cmd'       => 'cache',
        'class'     => 'EIG_WP_CLI_Cache',
        'shortdesc' => 'Control all forms of caching.',
        'longdesc'  => 'Control how browser cache, page cache and browser caching are configured.' .
                       PHP_EOL . 'Cache Types: browser, page, object (not functional yet)' .
                       PHP_EOL . 'Subcommands: add, update, status',
    ),

尽管我对代码不是很熟悉,但是我没有看到任何问题。有什么想法吗?我目前已配置为使用PHP Edge(7.1),谢谢!

4 个答案:

答案 0 :(得分:1)

今天早上发现了我的两个与此问题相同的网站。进入主机的PHP设置,它是用php 5.4解析的。我可以将其设置为7.1,但这已解决。

答案 1 :(得分:0)

由于某些原因,未在系统上定义常量PHP_EOL。

将以下内容添加到wp-config.php文件中:

if(!defined("PHP_EOL")) {
    define("PHP_EOL", strtoupper(substr(PHP_OS, 0, 3) == "WIN") ? "\r\n" : "\n");
 }

答案 2 :(得分:0)

几分钟前删除 / mojo-marketplace-wp-plugin / 目录对我有用

答案 3 :(得分:0)

由于某种原因,它无法解析数组中的字符串。

我更改了语法以删除与PHP_EOL的连接,并且能够在不更改PHP版本或删除插件的情况下对其进行修复:

    /**
     * Main variable containing all WP-CLI commands and callbacks.
     *
     * @var array
     */
    protected $commands = array(
        array(
            'cmd'       => 'branding',
            'class'     => 'EIG_WP_CLI_Branding',
            'shortdesc' => 'Control hosting branding and UX.',
            'longdesc'  => 'Control the admin interface, default modules and UX for an Endurance hosting brand.\n
            Subcommands: update, remove',
        ),
        array(
            'cmd'       => 'cache',
            'class'     => 'EIG_WP_CLI_Cache',
            'shortdesc' => 'Control all forms of caching.',
            'longdesc'  => 'Control how browser cache, page cache and browser caching are configured.\n
            Cache Types: browser, page, object (not functional yet)\n
            Subcommands: add, update, status',
        ),
        array(
            'cmd'       => 'digest',
            'class'     => 'EIG_WP_CLI_Digest',
            'shortdesc' => 'Analyze WordPress for this site.',
            'longdesc'  => 'Analyze WordPress content, configuration and server environment.\n
                           Associative Args: --full --noprompt',
        ),
        array(
            'cmd'       => 'secrets',
            'class'     => 'EIG_WP_CLI_Secrets',
            'shortdesc' => 'Control the WordPress Salts.',
            'longdesc'  => 'Read and update WordPress salts in the wp-config.php file.\n
                           Subcommands: update, age, list',
        ),
        array(
            'cmd'       => 'remove_orphan_post_meta',
            'class'     => 'EIG_WP_CLI_Remove_Orphan_Post_Meta',
            'shortdesc' => 'Legacy cmd for removing orphan meta.',
            'longdesc'  => 'Legacy WP-CLI command used for checking for orphaned postmeta.',
        ),
        array(
            'cmd'       => 'sso',
            'class'     => 'EIG_WP_CLI_SSO',
            'shortdesc' => 'Single sign-on from hosting platform.',
            'longdesc'  => 'Handle single sign-on from Endurance hosting platforms and get magic link.\n
                           Associative Args: --username --role --email --id --min=MINUTES_UNTIL_EXPIRE --url-only',
        ),
        array(
            'cmd'       => 'staging',
            'class'     => 'EIG_WP_CLI_Staging',
            'shortdesc' => 'CRUD operations for EIG staging.',
            'longdesc'  => 'Internal commands to handle staging environment.\n
                                         Subcommands: create, clone, destroy, sso_staging, deploy, deploy_files,
                                         deploy_db, deploy_files_db, save_state, restore_state, sso_production',
        ),
        array(
            'cmd'       => 'module',
            'class'     => 'EIG_WP_CLI_Module',
            'shortdesc' => 'Control hosting plugin modules.',
            'longdesc'  => 'Enable, disable and check status of internal modules in the hosting plugin.\n
                           Subcommands: enable, disable, status, list, reset',
        ),
    );