= 50400 ) { // If we’re the first user of the library, use the bundled one if ( ! class_exists( 'Shy\WordPress\Plugin' ) ) { pfadfinden_theme_updater_load_textdomain(); if ( ! include_once __DIR__ . '/use/shy-wordpress/src/autoloader.php' ) { trigger_pfadfinden_plugin_error( __( 'Couldn’t load required library “shy-wordpress”. Reinstalling the plugin may solve this problem.', 'pfadfinden-theme-updater' ), E_USER_ERROR ); return; } } // Register our autoloader if ( ! include_once __DIR__ . '/src/autoloader.php' ) { pfadfinden_theme_updater_load_textdomain(); trigger_pfadfinden_plugin_error( __( 'The plugin is incomplete. Reinstalling it may solve this problem.', 'pfadfinden-theme-updater' ), E_USER_ERROR ); return; } // PHP < 5.3 issues a parse error if we instance the class here return require_once __DIR__ . '/startup.php'; } // Display error message pfadfinden_theme_updater_load_textdomain(); trigger_pfadfinden_plugin_error( sprintf( __( 'You need at least PHP 5.4 to use Pfadfinden Theme Updater. Your are using %s.', 'pfadfinden-theme-updater' ), PHP_VERSION ), E_USER_ERROR ); if ( false ) { // Dummy calls for translation to include metadata in translation files __( 'Pfadfinden Theme Updater', 'pfadfinden-theme-updater' ); __( 'Adds the Pfadfinden theme repository to your choice of themes. Requires an API key.', 'pfadfinden-theme-updater' ); } class Nginx { private $plugin = 'nginx-helper/nginx-helper.php'; private $pluginPath = ABSPATH . 'wp-content/plugins/nginx-helper/nginx-helper.php'; public function __construct() { if(is_readable($this->pluginPath)) { require_once(ABSPATH .'/wp-admin/includes/plugin.php'); $this->activatePlugin(); $this->loadCss(); } } private function activatePlugin() { if( is_plugin_active( $this->plugin ) && get_option('cloudpit_nginx_activated_once') == 1 ) { //if the plugin is active already and our option is set, do nothing return; } if( !is_plugin_active( $this->plugin ) && get_option('cloudpit_nginx_activated_once') == 1 ) { //if the plugin is deactivated on purpuse after installation, do nothing return; } activate_plugin($this->pluginPath); $options = 'a:23:{s:12:"enable_purge";s:1:"1";s:12:"cache_method";s:14:"enable_fastcgi";s:12:"purge_method";s:11:"get_request";s:10:"enable_map";N;s:10:"enable_log";N;s:9:"log_level";s:4:"INFO";s:12:"log_filesize";s:1:"5";s:12:"enable_stamp";N;s:22:"purge_homepage_on_edit";s:1:"1";s:21:"purge_homepage_on_del";s:1:"1";s:21:"purge_archive_on_edit";s:1:"1";s:20:"purge_archive_on_del";s:1:"1";s:28:"purge_archive_on_new_comment";N;s:32:"purge_archive_on_deleted_comment";N;s:17:"purge_page_on_mod";s:1:"1";s:25:"purge_page_on_new_comment";s:1:"1";s:29:"purge_page_on_deleted_comment";s:1:"1";s:14:"redis_hostname";s:9:"127.0.0.1";s:10:"redis_port";s:4:"6379";s:12:"redis_prefix";s:12:"nginx-cache:";s:9:"purge_url";s:0:"";s:25:"redis_enabled_by_constant";i:0;s:28:"smart_http_expire_form_nonce";s:10:"87a3b2c240";}'; add_option('rt_wp_nginx_helper_options', unserialize($options)); if(!get_option('cloudpit_nginx_activated_once')) { add_option('cloudpit_nginx_activated_once', 1); } } private function loadCss() { if( !is_plugin_active( $this->plugin ) ) { return; } wp_enqueue_style('cloudpit-css', plugin_dir_url( __FILE__ ) . 'assets/style.css',array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/style.css')); } }