Example #1
0
 function get($args = false)
 {
     $this->setup_request();
     $this->resp = parent::get($this->request_uri, $args);
     return $this;
 }
Example #2
0
 function compatibility_check()
 {
     global $wpdb;
     global $wp_version;
     $data = array();
     // PHP
     if (version_compare(PHP_VERSION, '5.3', '<')) {
         $data['php'] = array('status' => 'warning', 'message' => sprintf(__('Your PHP version (%s) is lower than recommended (%s).', OP_SN), PHP_VERSION, '5.3'));
     } else {
         $data['php'] = array('status' => 'ok', 'message' => sprintf(__('Your PHP version (%s) meets requirements (%s).', OP_SN), PHP_VERSION, '5.3'));
     }
     // MySQL
     if (version_compare($wpdb->db_version(), '5.0', '<')) {
         $data['mysql'] = array('status' => 'error', 'message' => sprintf(__('Your MySQL version (%s) is lower than required (%s).', OP_SN), $wpdb->db_version(), '5.0'));
     } else {
         $data['mysql'] = array('status' => 'ok', 'message' => sprintf(__('Your MySQL version (%s) meets requirements (%s).', OP_SN), $wpdb->db_version(), '5.0'));
     }
     // WP
     if (version_compare($wp_version, '3.5', '<')) {
         $data['wordpress'] = array('status' => 'warning', 'message' => sprintf(__('Your WordPress version (%s) is lower than recommended (%s).', OP_SN), $wp_version, '3.5'));
     } else {
         $data['wordpress'] = array('status' => 'ok', 'message' => sprintf(__('Your WordPress version (%s) meets requirements (%s).', OP_SN), $wp_version, '3.5'));
     }
     // Transfer protocols (curl, streams)
     $http = new Wp_Http();
     if (false === $http->_get_first_available_transport(array())) {
         $data['transfer'] = array('status' => 'error', 'message' => __('There are no transport protocols (curl, streams) that are capable of handling the requests.', OP_SN));
     } else {
         $data['transfer'] = array('status' => 'ok', 'message' => __('Transfer protocols (curl, streams) are in order.', OP_SN));
     }
     // OP SL
     if (true !== op_sl_ping()) {
         $data['op_sl'] = array('status' => 'error', 'message' => __('Unable to connect to OptimizePress Security & Licensing service.', OP_SN));
     } else {
         $data['op_sl'] = array('status' => 'ok', 'message' => __('Connection with OptimizePress Security & Licensing service is in order.', OP_SN));
     }
     // OP Eligibility
     if (true !== op_sl_eligible()) {
         $data['op_sl'] = array('status' => 'warning', 'message' => sprintf(__('You are not eligible for new updates. You can prolong your subscription <a href="%s" target="_blank">here</a>.', OP_SN), 'http://optimizepress.com'));
     }
     // Permalink structure
     if ('' === ($permalink_structure = get_option('permalink_structure', ''))) {
         $data['permalink'] = array('status' => 'error', 'message' => sprintf(__('Permalink structure must not be set to "default" for OptimizePress to work correctly. Please change the <a href="%s">setting</a>.', OP_SN), admin_url('options-permalink.php')));
     } else {
         $data['permalink'] = array('status' => 'ok', 'message' => sprintf(__('Permalink structure is in order (%s).', OP_SN), trim($permalink_structure, '/')));
     }
     // Memory limit
     $memory_limit = wp_convert_hr_to_bytes(ini_get('memory_limit')) / 1024 / 1024;
     if ($memory_limit < 64) {
         $data['memory'] = array('status' => 'warning', 'message' => sprintf(__('Your memory limit (%sMB) is lower than recommended (%sMB)', OP_SN), $memory_limit, 64));
     } else {
         $data['memory'] = array('status' => 'ok', 'message' => sprintf(__('Your memory limit (%sMB) meets recommendation (%sMB)', OP_SN), $memory_limit, 64));
     }
     // Upload limit
     $upload_limit = wp_max_upload_size() / 1024 / 1024;
     if ($upload_limit < 32) {
         $data['upload'] = array('status' => 'warning', 'message' => sprintf(__('Your upload limit (%sMB) is lower than recommended (%sMB).', OP_SN), $upload_limit, 32));
     } else {
         $data['upload'] = array('status' => 'ok', 'message' => sprintf(__('Your upload limit (%sMB) meets recommendation (%sMB).', OP_SN), $upload_limit, 32));
     }
     // Max input vars
     $input_vars_limit = ini_get('max_input_vars');
     if ($input_vars_limit < 3000) {
         $data['input_vars'] = array('status' => 'info', 'message' => sprintf(__('Your "max_input_vars" setting is set to %s. If you plan to have pages with a large number of elements on it, you should raise this setting to at least %s.', OP_SN), $input_vars_limit ? $input_vars_limit : 1000, 3000));
     } else {
         $data['input_vars'] = array('status' => 'ok', 'message' => sprintf(__('Your "max_input_vars" (%s) meets recommendation (%s).', OP_SN), $input_vars_limit, 3000));
     }
     // Max execution time
     $execution_time = ini_get('max_execution_time');
     if ($execution_time < 60) {
         $data['execution_time'] = array('status' => 'info', 'message' => sprintf(__('Your "max_execution_time" setting (%s) is lower than recommended (%s).', OP_SN), $execution_time ? $execution_time : 30, 60));
     } else {
         $data['execution_time'] = array('status' => 'ok', 'message' => sprintf(__('Your "max_execution_time" (%s) meets recommendation (%s).', OP_SN), $execution_time, 60));
     }
     echo op_load_section('compatibility_check', array('compat' => $data), 'global_settings');
 }