本文整理汇总了PHP中w3_activate_error函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_activate_error函数的具体用法?PHP w3_activate_error怎么用?PHP w3_activate_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_activate_error函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate
/**
* Activate plugin action
*/
function activate()
{
if (!$this->update_wp_config()) {
$error = sprintf('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'WP_CACHE\', true);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong><br />then re-activate plugin.', ABSPATH);
w3_activate_error($error);
}
if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_string('pgcache.engine') == 'file_pgcache') {
/**
* Disable enchanged mode if permalink structure is disabled
*/
$permalink_structure = get_option('permalink_structure');
if ($permalink_structure == '') {
$this->_config->set('pgcache.engine', 'file');
$this->_config->save();
} else {
if (!w3_is_wpmu() && !$this->write_rules_core()) {
w3_writable_error(ABSPATH . '.htaccess');
}
if (!$this->write_rules_cache()) {
w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR . '/.htaccess');
}
}
}
if (!$this->locked()) {
if (@copy(W3TC_INSTALL_DIR . '/advanced-cache.php', WP_CONTENT_DIR . '/advanced-cache.php')) {
@chmod(WP_CONTENT_DIR . '/advanced-cache.php', 0644);
} else {
w3_writable_error(WP_CONTENT_DIR . '/advanced-cache.php');
}
}
$this->schedule();
}
示例2: activate
/**
* Activate plugin action
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_string('pgcache.engine') == 'file_generic') {
/**
* Disable enhanced mode if permalink structure is disabled
*/
$permalink_structure = get_option('permalink_structure');
if ($permalink_structure == '') {
$this->_config->set('pgcache.engine', 'file');
$this->_config->save();
} else {
if (w3_can_modify_rules(w3_get_pgcache_rules_core_path())) {
$this->write_rules_core();
}
if (w3_can_modify_rules(w3_get_pgcache_rules_cache_path())) {
$this->write_rules_cache();
}
}
}
if (!$this->locked()) {
if (!@copy(W3TC_INSTALL_FILE_ADVANCED_CACHE, W3TC_ADDIN_FILE_ADVANCED_CACHE)) {
w3_writable_error(W3TC_ADDIN_FILE_ADVANCED_CACHE);
}
if ((!defined('WP_CACHE') || !WP_CACHE) && !$this->enable_wp_cache()) {
$reactivate_url = wp_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
$reactivate_button = sprintf('<input type="button" value="re-activate plugin" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
$error = sprintf('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'WP_CACHE\', true);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong><br />then %s.', ABSPATH, $reactivate_button);
w3_activate_error($error);
}
}
$this->schedule();
$this->schedule_prime();
}
示例3: activate
/**
* Activation action
*/
function activate()
{
global $wpdb;
$this->schedule();
$this->schedule_upload();
if ($this->_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($this->_config->get_string('cdn.engine')) && !$this->table_create(true)) {
$error = sprintf('Unable to create table <strong>%s%s</strong>: %s', $wpdb->prefix, W3TC_CDN_TABLE_QUEUE, $wpdb->last_error);
w3_activate_error($error);
}
}
示例4: w3_writable_error
/**
* W3 writable error
*
* @param string $path
* @return string
*/
function w3_writable_error($path)
{
$reactivate_url = nxt_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
$reactivate_button = sprintf('<input type="button" value="re-activate plugin" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
require_once W3TC_INC_DIR . '/functions/file.php';
if (w3_check_open_basedir($path)) {
$error = sprintf('<strong>%s</strong> could not be created, please run following command:<br /><strong style="color: #f00;">chmod 777 %s</strong><br />then %s.', $path, file_exists($path) ? $path : dirname($path), $reactivate_button);
} else {
$error = sprintf('<strong>%s</strong> could not be created, <strong>open_basedir</strong> restriction in effect, please check your php.ini settings:<br /><strong style="color: #f00;">open_basedir = "%s"</strong><br />then %s.', $path, ini_get('open_basedir'), $reactivate_button);
}
w3_activate_error($error);
}
示例5: activate
/**
* Activation action
*/
function activate()
{
w3_require_once(W3TC_INC_DIR . '/functions/activation.php');
global $wpdb;
$this->schedule();
$this->schedule_upload();
if ($this->_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($this->_config->get_string('cdn.engine')) && !$this->table_create(true)) {
$error = sprintf('Unable to create table <strong>%s%s</strong>: %s', $wpdb->prefix, W3TC_CDN_TABLE_QUEUE, $wpdb->last_error);
w3_activate_error($error);
}
if ($this->_config->get_boolean('cdn.enabled')) {
if (w3_can_modify_rules(w3_get_browsercache_rules_cache_path())) {
try {
$this->write_rules();
} catch (Exception $e) {
}
}
}
}
示例6: activate
/**
* Activation action
*/
function activate()
{
global $wpdb;
$upload_info = w3_upload_info();
if (!$upload_info) {
$upload_path = get_option('upload_path');
$upload_path = trim($upload_path);
if (empty($upload_path)) {
echo 'Your store uploads folder is not available. Default WordPress directories will be created: <strong>wp-content/uploads/</strong>.<br />';
$upload_path = WP_CONTENT_DIR . '/uploads';
}
w3_writable_error($upload_path);
}
$sql = sprintf('DROP TABLE IF EXISTS `%s%s`', $wpdb->prefix, W3TC_CDN_TABLE_QUEUE);
$wpdb->query($sql);
$sql = sprintf("CREATE TABLE IF NOT EXISTS `%s%s` (\r\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n `local_path` varchar(150) NOT NULL DEFAULT '',\r\n `remote_path` varchar(150) NOT NULL DEFAULT '',\r\n `command` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 - Upload, 2 - Delete',\r\n `last_error` varchar(150) NOT NULL DEFAULT '',\r\n `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\r\n PRIMARY KEY (`id`),\r\n UNIQUE KEY `path` (`local_path`, `remote_path`),\r\n KEY `date` (`date`)\r\n ) /*!40100 CHARACTER SET latin1 */", $wpdb->prefix, W3TC_CDN_TABLE_QUEUE);
$wpdb->query($sql);
if (!$wpdb->result) {
$error = sprintf('Unable to create table <strong>%s%s</strong>: %s', $wpdb->prefix, W3TC_CDN_TABLE_QUEUE, $wpdb->last_error);
w3_activate_error($error);
}
$this->schedule();
}
示例7: activate
/**
* Activate plugin action
*
* @return void
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
/**
* Disable buggy sitewide activation in WPMU and WP 3.0
*/
if (w3_is_wpmu() && isset($_GET['sitewide']) || w3_is_multisite() && isset($_GET['networkwide'])) {
w3_network_activate_error();
}
/**
* Check installation files
*/
$files = array(W3TC_INSTALL_FILE_ADVANCED_CACHE, W3TC_INSTALL_FILE_DB, W3TC_INSTALL_FILE_OBJECT_CACHE);
$nonexistent_files = array();
foreach ($files as $file) {
if (!file_exists($file)) {
$nonexistent_files[] = $file;
}
}
if (count($nonexistent_files)) {
$error = sprintf('Unfortunately core file(s): (<strong>%s</strong>) are missing, so activation will fail. Please re-start the installation process from the beginning.', implode(', ', $nonexistent_files));
w3_activate_error($error);
}
if (!@is_dir(W3TC_CONTENT_DIR) && !@mkdir(W3TC_CONTENT_DIR)) {
w3_writable_error(W3TC_CONTENT_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_DBCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_DBCACHE_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_DBCACHE_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_OBJECTCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_OBJECTCACHE_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_OBJECTCACHE_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_PGCACHE_DIR) && !@mkdir(W3TC_CACHE_FILE_PGCACHE_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_PGCACHE_DIR);
}
if (!@is_dir(W3TC_CACHE_FILE_MINIFY_DIR) && !@mkdir(W3TC_CACHE_FILE_MINIFY_DIR)) {
w3_writable_error(W3TC_CACHE_FILE_MINIFY_DIR);
}
if (!@is_dir(W3TC_LOG_DIR) && !@mkdir(W3TC_LOG_DIR)) {
w3_writable_error(W3TC_LOG_DIR);
}
if (!@is_dir(W3TC_TMP_DIR) && !@mkdir(W3TC_TMP_DIR)) {
w3_writable_error(W3TC_TMP_DIR);
}
if (w3_is_network() && file_exists(W3TC_CONFIG_MASTER_PATH)) {
/**
* For multisite load master config
*/
$this->_config->load_master();
if (!$this->_config->save(false)) {
w3_writable_error(W3TC_CONFIG_PATH);
}
} elseif (!file_exists(W3TC_CONFIG_PATH)) {
/**
* Set default settings
*/
$this->_config->set_defaults();
/**
* If config doesn't exist enable preview mode
*/
if (!$this->_config->save(true)) {
w3_writable_error(W3TC_CONFIG_PREVIEW_PATH);
}
}
/**
* Save blognames into file
*/
if (w3_is_network() && !w3_is_subdomain_install()) {
if (!w3_save_blognames()) {
w3_writable_error(W3TC_BLOGNAMES_PATH);
}
}
delete_option('w3tc_request_data');
add_option('w3tc_request_data', '', null, 'no');
}
示例8: w3_activation_error_on_exception
/**
* Print activation error with repeat button based on exception
*
* @param $e
*/
function w3_activation_error_on_exception($e)
{
$reactivate_url = wp_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
$reactivate_button = sprintf('<input type="button" value="re-activate plugin" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
w3_activate_error(sprintf('%s<br />then %s.', $e->getMessage(), $reactivate_button));
}