public function __construct() { $this->_table = '@__options_categories'; $this->_id = 'id'; $this->_alias = 'toe_opt_cats'; $this->_addField('id', 'hidden', 'int', 0, langBup::_('ID'))->_addField('label', 'text', 'varchar', 0, langBup::_('Method'), 128); }
public function __construct() { $this->_table = '@__files'; $this->_id = 'id'; $this->_alias = 'toe_f'; $this->_addField('pid', 'hidden', 'int', '', langBup::_('Product ID'))->_addField('name', 'text', 'varchar', '255', langBup::_('File name'))->_addField('path', 'hidden', 'text', '', langBup::_('Real Path To File'))->_addField('mime_type', 'text', 'varchar', '32', langBup::_('Mime Type'))->_addField('size', 'text', 'int', 0, langBup::_('File Size'))->_addField('active', 'checkbox', 'tinyint', 0, langBup::_('Active Download'))->_addField('date', 'text', 'datetime', '', langBup::_('Upload Date'))->_addField('download_limit', 'text', 'int', '', langBup::_('Download Limit'))->_addField('period_limit', 'text', 'int', '', langBup::_('Period Limit'))->_addField('description', 'textarea', 'text', 0, langBup::_('Descritpion'))->_addField('type_id', 'text', 'int', '', langBup::_('Type ID')); }
public function __construct() { $this->_table = '@__htmltype'; $this->_id = 'id'; $this->_alias = 'toe_htmlt'; $this->_addField('id', 'hidden', 'int', 0, langBup::_('ID'))->_addField('label', 'text', 'varchar', 0, langBup::_('Method'), 32)->_addField('description', 'text', 'varchar', 0, langBup::_('Description'), 255); }
public function restore($filename) { if (!file_exists($filename)) { $this->pushError(sprintf(langBup::_('Filesystem backup %s does not exists'), basename($filename))); return false; } if (!class_exists('PclZip', false)) { /** @var backupBup $backup */ $backup = $this->getModule(); $backup->loadLibrary('pcl'); } $pcl = new PclZip($filename); if ($files = $pcl->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER) === 0) { $this->pushError(langBup::_('An error has occurred while unpacking the archive')); return false; } unset($pcl); // Unpack stacks $stacks = glob(realpath(ABSPATH) . '/BUP*'); if (empty($stacks)) { return true; } foreach ($stacks as $stack) { if (file_exists($stack)) { $pcl = new PclZip($stack); $pcl->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER); unlink($stack); unset($pcl); } } return true; }
public function __construct() { $this->_table = '@__log'; $this->_id = 'id'; /*Let's associate it with posts*/ $this->_alias = 'toe_log'; $this->_addField('id', 'text', 'int', 0, langBup::_('ID'), 11)->_addField('type', 'text', 'varchar', '', langBup::_('Type'), 64)->_addField('data', 'text', 'text', '', langBup::_('Data'))->_addField('date_created', 'text', 'int', '', langBup::_('Date created'))->_addField('uid', 'text', 'int', 0, langBup::_('User ID'))->_addField('oid', 'text', 'int', 0, langBup::_('Order ID')); }
public function __construct() { $this->_table = '@__modules'; $this->_id = 'id'; /*Let's associate it with posts*/ $this->_alias = 'toe_m'; $this->_addField('label', 'text', 'varchar', 0, langBup::_('Label'), 128)->_addField('type_id', 'selectbox', 'smallint', 0, langBup::_('Type'))->_addField('active', 'checkbox', 'tinyint', 0, langBup::_('Active'))->_addField('params', 'textarea', 'text', 0, langBup::_('Params'))->_addField('has_tab', 'checkbox', 'tinyint', 0, langBup::_('Has Tab'))->_addField('description', 'textarea', 'text', 0, langBup::_('Description'), 128)->_addField('code', 'hidden', 'varchar', '', langBup::_('Code'), 64)->_addField('ex_plug_dir', 'hidden', 'varchar', '', langBup::_('External plugin directory'), 255); }
public function __construct() { $this->_table = '@__modules_type'; $this->_id = 'id'; /*Let's associate it with posts*/ $this->_alias = 'toe_m_t'; $this->_addField($this->_id, 'text', 'int', '', langBup::_('ID'))->_addField('label', 'text', 'varchar', '', langBup::_('Label'), 128); }
public function __construct() { $this->_table = '@__options'; $this->_id = 'id'; /*Let's associate it with posts*/ $this->_alias = 'toe_opt'; $this->_addField('id', 'text', 'int', 0, langBup::_('ID'))->_addField('code', 'text', 'varchar', '', langBup::_('Code'), 64)->_addField('value', 'text', 'varchar', '', langBup::_('Value'), 134217728)->_addField('label', 'text', 'varchar', '', langBup::_('Label'), 255)->_addField('description', 'text', 'text', '', langBup::_('Description'))->_addField('htmltype_id', 'selectbox', 'text', '', langBup::_('Type'))->_addField('cat_id', 'hidden', 'int', '', langBup::_('Category ID'))->_addField('sort_order', 'hidden', 'int', '', langBup::_('Sort Order'))->_addField('value_type', 'hidden', 'varchar', '', langBup::_('Value Type')); }
/** * Returns the available tabs * * @return array of tab */ public function getTabs() { $tabs = array(); $tab = new tabBup(langBup::_('General'), $this->getCode()); $tab->setView('optionTab'); $tab->setSortOrder(-99); $tabs[] = $tab; return $tabs; }
public function saveGroupEvery() { $res = new responseBup(); if ($data = $this->getModel()->saveGroupEvery(reqBup::get('post'))) { $res->addMessage(langBup::_('Save complete')); //$res->addData($data); } else { $res->pushError($this->getModel()->getErrors()); } return $res->ajaxExec(); }
public function saveMainFromDestGroup() { $res = new responseBup(); $post = reqBup::get('post'); if ($result = $this->getModel()->saveMainFromDestGroup($post)) { $res->addMessage(langBup::_('Save Complete')); $res->addData($result); } else { $res->pushError($this->getModel('options')->getErrors()); } return $res->ajaxExec(); }
public function bupSendInfo() { $res = new responseBup(); if ($this->getModel()->welcomePageSaveInfo(reqBup::get('post'))) { $res->addMessage(langBup::_('Information was saved. Thank you!')); $originalPage = reqBup::getVar('original_page'); $return = $this->getModule()->decodeSlug(str_replace('return=', '', $originalPage)); $return = admin_url(strpos($return, '?') ? $return : 'admin.php?page=' . $return); $res->addData('redirect', $return); installerBup::setUsed(); } else { $res->pushError($this->getModel()->getErrors()); } return $res->ajaxExec(); }
public function initMenu() { $firstTimeLookedToPlugin = installerBup::isUsed(); //$firstTimeLookedToPlugin = false; if ($firstTimeLookedToPlugin) { add_menu_page(langBup::_('Ready! Backup'), langBup::_('Ready! Backup'), 10, $this->_file, array(frameBup::_()->getModule('options')->getView(), 'getAdminPage')); } else { if (frameBup::_()->getModule('promo_ready')) { add_menu_page(langBup::_('Ready! Backup'), langBup::_('Ready! Backup'), 10, $this->_file, array(frameBup::_()->getModule('promo_ready')->getView(), 'showWelcomePage')); } else { // if not install module "promo_ready" installerBup::setUsed(); add_menu_page(langBup::_('Ready! Backup'), langBup::_('Ready! Backup'), 10, $this->_file, array(frameBup::_()->getModule('options')->getView(), 'getAdminPage')); } } /*if(!empty($this->_options)) { foreach($this->_options as $opt) { add_submenu_page($this->_file, langBup::_($opt['title']), langBup::_($opt['title']), $opt['capability'], $opt['menu_slug'], $opt['function']); } }*/ }
public function sendMailToDevelopers() { $res = new responseBup(); $data = reqBup::get('post'); $fields = array('name' => new fieldBupBup('name', langBup::_('Your name field is required.'), '', '', 'Your name', 0, array(), 'notEmpty'), 'website' => new fieldBupBup('website', langBup::_('Your website field is required.'), '', '', 'Your website', 0, array(), 'notEmpty'), 'email' => new fieldBupBup('email', langBup::_('Your e-mail field is required.'), '', '', 'Your e-mail', 0, array(), 'notEmpty, email'), 'subject' => new fieldBupBup('subject', langBup::_('Subject field is required.'), '', '', 'Subject', 0, array(), 'notEmpty'), 'category' => new fieldBupBup('category', langBup::_('You must select a valid category.'), '', '', 'Category', 0, array(), 'notEmpty'), 'message' => new fieldBupBup('message', langBup::_('Message field is required.'), '', '', 'Message', 0, array(), 'notEmpty')); foreach ($fields as $f) { $f->setValue($data[$f->name]); $errors = validatorBup::validate($f); if (!empty($errors)) { $res->addError($errors); } } if (!$res->error) { $msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />'; foreach ($fields as $f) { $msg .= '<b>' . $f->label . '</b>: ' . nl2br($f->value) . '<br />'; } $headers[] = 'From: ' . $fields['name']->value . ' <' . $fields['email']->value . '>'; wp_mail('ukrainecmk@ukr.net, simon@readyshoppingcart.com, support@readyecommerce.zendesk.com', 'Ready Ecommerce Contact Dev', $msg, $headers); $res->addMessage(langBup::_('Done')); } $res->ajaxExec(); }
</td> </tr> </table> <div class="excludeOpt"> <?php echo langBup::_('Exclude:'); echo htmlBup::text('opt_values[exclude]', array('attrs' => 'class="excludeInput" title="If entering multiple files/directories, then separate them with commas."', 'value' => frameBup::_()->getModule('options')->get('exclude'))); ?> </div> <div class="emailOpt"> <table> <tr> <td width="120"><?php echo langBup::_('Email notification:'); ?> </td> <td><?php echo htmlBup::checkbox('opt_values[email_ch]', array('attrs' => 'class="bupCheckboxNotUnCheck"', 'value' => 1, 'checked' => frameBup::_()->getModule('options')->getValueType('email') ? 'checked' : '')); ?> </td> </tr> </table> <div class="emailAddress" <?php echo frameBup::_()->getModule('options')->getValueType('email') ? '' : 'style="display:none"'; ?> > <?php echo htmlBup::text('opt_values[email]', array('attrs' => 'class="excludeInput" placeholder="*****@*****.**" title=""', 'value' => frameBup::_()->getModule('options')->get('email'))); ?>
/** * Function to get field params * * @param object $params */ public static function getFieldAttributes($params) { $output = ''; if (!empty($params->attr)) { foreach ($params->attr as $key => $value) { $output .= langBup::_($key) . ':<br />'; $output .= htmlBup::text('params[attr][' . $key . ']', array('value' => $value)) . '<br />'; } } else { $output .= langBup::_('class') . ':<br />'; $output .= htmlBup::text('params[attr][class]', array('value' => '')) . '<br />'; $output .= langBup::_('id') . ':<br />'; $output .= htmlBup::text('params[attr][id]', array('value' => '')) . '<br />'; } return $output; }
?> "><?php echo BUP_S_VERSION; ?> </a> </div> <div class="bupAdminFooterCell">|</div> <div class="bupAdminFooterCell"> <?php langBup::_e('Get'); ?> <a target="_blank" href="<?php echo $this->getModule()->preparePromoLink('https://readyshoppingcart.com/product/wordpress-backup-and-restoration-plugin/'); ?> "><?php langBup::_e('License'); ?> </a> </div> <div class="bupAdminFooterCell">|</div> <div class="bupAdminFooterCell"> <a target="_blank" href="http://wordpress.org/support/plugin/ready-backup"><?php langBup::_e('Support'); ?> </a> </div> <div class="bupAdminFooterCell">|</div> <div class="bupAdminFooterCell"> Add your <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/ready-backup?filter=5#postform">★★★★★</a> on wordpress.org. </div> </div>
public static function attach($d) { self::$_data = array_merge(self::$_data, self::extract($d)); }
public function activateUpdate($d = array()) { $plugName = isset($d['plugName']) ? $d['plugName'] : ''; if (!empty($plugName)) { $activationKey = isset($d['activation_key']) ? $d['activation_key'] : ''; if (!empty($activationKey)) { $result = modInstallerBup::activateUpdate($plugName, $activationKey); if ($result === true) { return true; } elseif (is_array($result)) { // Array with errors $this->pushError($result); } else { $this->pushError(langBup::_('Can not contact authorization server for now.')); $this->pushError(langBup::_('Please try again latter.')); $this->pushError(langBup::_('If problem will not stop - please contact us using this form <a href="http://readyshoppingcart.com/contacts/" target="_blank">http://readyshoppingcart.com/contacts/</a>.')); } } else { $this->pushError(langBup::_('Please enter activation key')); } } else { $this->pushError(langBup::_('Empty plugin name')); } }
/** * Return last error * @return string error message */ public function getError() { return langBup::_($this->_error); }
<div class="bupMargDest"> <?php echo htmlBup::radiobutton('dest_opt', array('attrs' => 'class="' . $not_piad . '"', 'value' => 'amazon', 'checked' => frameBup::_()->getModule('options')->get('glb_dest') == 'amazon' ? 'checked' : '')); ?> Amazon S3 </div> <div class="bupMargDest"> <?php echo htmlBup::radiobutton('dest_opt', array('attrs' => 'class="' . $not_piad . '"', 'value' => 'onedrive', 'checked' => frameBup::_()->getModule('options')->get('glb_dest') == 'onedrive' ? 'checked' : '')); ?> Microsoft OneDrive </div> <div> <?php echo htmlBup::hidden('reqType', array('value' => 'ajax')); ?> <?php echo htmlBup::hidden('page', array('value' => 'options')); ?> <?php echo htmlBup::hidden('action', array('value' => 'saveMainFromDestGroup')); ?> <?php echo htmlBup::submit('saveAll', array('value' => langBup::_('Save'), 'attrs' => 'class="button button-primary button-large"')); ?> </div> <div id="bupMainFormOptionsMsg"></div> </form> </div>
public function init() { //$startTime = microtime(true); langBup::init(); reqBup::init(); $this->_extractTables(); $this->_extractModules(); $this->_initModules(); $this->_execModules(); add_action('init', array($this, 'addScripts')); add_action('init', array($this, 'addStyles')); register_uninstall_hook(BUP_DIR . DS . BUP_MAIN_FILE, array('utilsBup', 'deletePlugin')); register_activation_hook(BUP_DIR . DS . BUP_MAIN_FILE, array('utilsBup', 'activatePlugin')); //See classes/install.php file add_action('admin_notices', array('errorsBup', 'displayOnAdmin')); add_action('init', array($this, 'connectLang')); //var_dump($this->getActivationErrors()); //$operationTime = microtime(true) - $startTime; }
<button class="button button-primary button-small bupDownload" data-filename="<?php echo $backup['name']; ?> " > <?php langBup::_e('Download'); ?> </button> <!-- /downloadButton --> <!-- deleteButton --> <a href="#" class="delBackup bupDelete" title="<?php langBup::_e('Delete'); ?> " data-id="<?php echo $uniqid; ?> " data-filename="<?php echo $data['name']; ?> "></a> <!-- /deleteButton --> </td> </tr> </tbody> </table> </fieldset> </div>
<?php foreach ($this->storageData[2] as $el) { ?> <?php $name = frameBup::_()->getModule('backup')->getModel()->fileNameFormat($el, 'prefix'); $name = $name == 'full' && preg_match('~\\.sql~', $el) ? 'database' : $name; //if ($name == 'full' && preg_match('~\.sql~', $el)) continue; ?> <tr class="tabStr"> <td align="right" style="height:20px !important; margin:0px !important; padding:0px !important; " ><?php echo ucfirst($name); ?> </td> <td width="162"> <?php echo htmlBup::submit($el, array('value' => langBup::_('Restore'), 'attrs' => 'class="button button-primary button-small restoreBup" id="' . $this->storageData[0] . '"')); ?> <a class="button button-primary button-small bupButDownload" href="<?php echo substr(BUP_URL, 0, strlen(BUP_URL) - 1) . frameBup::_()->getModule('options')->get('warehouse') . $el; ?> " title="download">Download</a> <a class="delBackup" id="del|<?php echo $this->storageData[0] . '|' . $el, '|' . $name; ?> " href="javascript:void (0)" title="delete"></a> </td> </tr> <?php } ?> </table> </fieldset>
public static function activate($modDataArr) { $locations = self::_getPluginLocations(); if ($modules = self::_getModulesFromXml($locations['xmlPath'])) { foreach ($modules as $m) { $modDataArr = utilsBup::xmlNodeAttrsToArr($m); if (!frameBup::_()->moduleActive($modDataArr['code'])) { //If module is not active - then acivate it if (frameBup::_()->getModule('options')->getModel('modules')->put(array('code' => $modDataArr['code'], 'active' => 1))->error) { errorsBup::push(langBup::_('Error Activating module'), errorsBup::MOD_INSTALL); } } } } }
/** * Show messages at the top of the page. This is kinda weird way to do this, * but WP gives me no other way to do this - no action or hook right after body tag opening or somwere around this place */ public function checkSysMessages() { $messages = array(); if (is_404() && frameBup::_()->getModule('user')->isAdmin()) { $messages['adminAlerts'][] = langBup::_(array('If you are trying to view your product and see this message - maybe you have some troubles with permalinks settings.', 'Try to go to <a href="' . get_admin_url() . 'options-permalink.php' . '">Admin panel -> Settings -> Permalinks</a> and re-saive this settings (just click on "Save Changes").<br />', '<a href="http://readyshoppingcart.com/faq/ecommerce-plugin-alerts">', 'Please check FAQ.', '</a>')); } if (!empty($messages)) { $this->getView()->assign('forAdminOnly', langBup::_('This message will be visible for admin only.')); $this->getView()->assign('messages', $messages); $this->getView()->display('pagesSystemMessages'); } }
}); // --> </script> <div id="bup-first-start"> <div class="container"> <form id="bupWelcomePageFindUsForm"> <h1> <?php langBup::_e('Welcome to'); ?> <?php echo BUP_S_WP_PLUGIN_NAME; ?> <?php langBup::_e('Version'); ?> <?php echo BUP_S_VERSION; ?> ! </h1> <div class="clear"></div> <div class="about-message"> This is first start up of the <?php echo BUP_S_WP_PLUGIN_NAME; ?> plugin.<br /> If you are newbie - check all features on that page, if you are guru - please correct us. </div> <div class="plug-icon-shell">
/** * Remove Action */ public function removeAction() { $request = reqBup::get('post'); $response = new responseBup(); $model = $this->getModel(); if ($model->remove($request['filename']) === true) { $response->addMessage(langBup::_('Backup successfully removed')); } else { $response->addError(langBup::_('Unable to delete backup')); } $response->ajaxExec(); }
foreach ($formData as $key => $val) { if (is_array($val)) { foreach ($val as $subKey => $subVal) { echo htmlBup::hidden($key . '[' . $subKey . ']', array('value' => $subVal)); } } else { echo htmlBup::hidden($key, array('value' => $val)); } } ?> <table width="100%"> <tr> <td><?php langBup::_e('Delete Plugin Data (options, setup data, database tables, etc.)'); ?> :</td> <td><?php echo htmlBup::radiobuttons('deleteOptions', array('options' => array('No', 'Yes'))); ?> </td> </tr> </table> <?php echo htmlBup::submit('toeGo', array('value' => langBup::_('Done'))); ?> <?php echo htmlBup::formEnd(); ?> </div> </body> </html>
/** * Run parsed queries from SQL file * @global \wpdb $wpdb * @param array $queries * @return boolean */ protected function runQueries($queries = array()) { /** @var wpdb $wpdb */ global $wpdb; $config = $this->getConfig(); $transaction = $this->getTransactionSupport(); if (empty($queries) or $queries === null) { return false; } // Start transaction if safe update enabled or set error if transaction is unsupported if ($config['safe_update'] === true) { if ($transaction === true) { $this->query('SET AUTOCOMMIT=0'); $this->query('START TRANSACTION'); } else { $this->pushError(langBup::_('Your MySQL server does not support transactions, "safe update" unavailable')); return false; } } $this->query('SET FOREIGN_KEY_CHECKS=0'); foreach ($queries as $query) { if ($wpdb->query($query) === false) { // Rollback transaction if safe update enabled if ($config['safe_update'] === true && $transaction === true) { $this->query('ROLLBACK'); } $this->query('SET FOREIGN_KEY_CHECKS=1'); return false; } } // Commit transaction if safe update enabled if ($config['safe_update'] === true && $transaction === true) { $this->query('COMMIT'); } $this->query('SET FOREIGN_KEY_CHECKS=1', $wpdb->dbh); return true; }