<?php /* * Uninstall plugin completely with all data */ include_once pathinfo(__FILE__, PATHINFO_DIRNAME) . '/library/Plugin.php'; $pluginClass = new Xpandbuddy(); $pluginClass->del(__FILE__);
<?php /* Plugin Name: Xpand Buddy Plugin URI: http://themexpand.com/product/xpand-buddy Description: Backup and clone your WordPress site securely and easily using Xpand Buddy. Version: 1.0.0 Author: ThemeXpand Author URI: http://themexpand.com */ $_tmpDir = getcwd(); chdir(ABSPATH); if (!is_dir('wp-backups') && mkdir('wp-backups', 0755) === false) { $arrError = error_get_last(); echo 'The plugin could not be activated because of your host server settings. ' . @$arrError['message'] . '. Please contact your host to get the issue resolved.'; die; } if (!is_file('wp-backups' . DIRECTORY_SEPARATOR . ".htaccess") && @file_put_contents('wp-backups' . DIRECTORY_SEPARATOR . ".htaccess", "Options -Indexes") === false) { $arrError = error_get_last(); echo 'The plugin could not be activated because of your host server settings. ' . @$arrError['message'] . '. Please contact your host to get the issue resolved.'; die; } chdir($_tmpDir); ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); include_once pathinfo(__FILE__, PATHINFO_DIRNAME) . '/library/Plugin.php'; $pluginClass = new Xpandbuddy(); Xpandbuddy::$pathName = pathinfo(__FILE__, PATHINFO_DIRNAME); Xpandbuddy::$baseName = trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))); $pluginClass->pluginRun();
private static function get() { global $wpdb; self::$_options = json_decode(get_option(self::$_optionName, '{}'), true); if (empty(self::$_options)) { self::$_options = array(); } }
private function getResponce(&$strRes) { $_userTempDir = Xpandbuddy::$pathName . DIRECTORY_SEPARATOR . 'temp'; if (!Xpandbuddy::prepareTmpDir($_userTempDir)) { return false; } $file = '<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "' . $this->getUri() . '" ); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" ); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Cache-Control: max-age=0", "Connection: keep-alive", "Keep-Alive: 300", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Accept-Language: en-us,en;q=0.5", )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $responce = curl_exec($ch); // if( stripos($responce,"https://")&&stripos($responce,"refresh") ){ // curl_setopt($ch, CURLOPT_URL, "' . $this->getUri(true) . '" ); // $responce = curl_exec($ch); // } curl_close ($ch);'; if ($this->_skin == 'x3') { $file .= 'if( stripos( $responce , \'class="errors"\') ) { preg_match(\'/id="details">[\\n ]+([a-zA-Z .!]+)\\n/\', $responce, $match ); if( isset( $match[1] ) ){ echo $match[1]; }else{ echo "error"; } } else { echo "added"; }?>'; } else { $file .= 'if( stripos( $responce , "error") ) { echo "error"; } else { echo "added"; }?>'; } $_fileName = $_userTempDir . 'cpanel_creat.php'; if (!is_file($_fileName)) { $handle = fopen($_fileName, 'w'); fwrite($handle, $file); fclose($handle); } $_ftp = new Xpandbuddy_Ftp(); if (!$_ftp->setChmod('0644')->setHost(urldecode($this->_uri['host']))->setUser(urldecode($this->_uri['username']))->setPassw(urldecode($this->_uri['password']))->setRoot('public_html')->makeConnectToRootDir()) { return false; } if ($_ftp->fileUpload('cpanel_creat.php', $_fileName) !== true) { return false; } @unlink($_fileName); $strRes = $this->getUrl('http://' . $this->_uri['host'] . '/cpanel_creat.php'); if ($strRes === false) { return false; } if ($strRes === "added") { return true; } if (!empty($strRes) && $strRes != "error") { $this->error = $strRes; } return false; }