Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     $this->settings = new Tiny_Settings();
     if (is_admin()) {
         add_action('admin_menu', $this->get_method('admin_menu'));
     }
 }
 public static function plugin_version()
 {
     if (is_null(self::$plugin_version)) {
         $plugin_data = get_plugin_data(dirname(__FILE__) . '/../tiny-compress-images.php');
         self::$plugin_version = $plugin_data['Version'];
     }
     return self::$plugin_version;
 }
 protected function output_options($resize)
 {
     $options = array('http' => array('method' => 'GET'), 'ssl' => array('cafile' => self::get_ca_file(), 'verify_peer' => true));
     if ($resize) {
         $options['http']['header'] = array('Authorization: Basic ' . base64_encode('api:' . $this->api_key), 'Content-Type: application/json', 'User-Agent: ' . Tiny_WP_Base::plugin_identification() . ' fopen');
         $options['http']['content'] = json_encode(array('resize' => $resize));
     }
     return $options;
 }
 protected function output_options($url, $resize)
 {
     $options = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CAINFO => self::get_ca_file(), CURLOPT_SSL_VERIFYPEER => true, CURLOPT_USERAGENT => Tiny_WP_Base::plugin_identification() . ' cURL');
     if ($resize) {
         $options[CURLOPT_USERPWD] = 'api:' . $this->api_key;
         $options[CURLOPT_HTTPHEADER] = array('Content-Type: application/json');
         $options[CURLOPT_POSTFIELDS] = json_encode(array('resize' => $resize));
     }
     return $options;
 }
Exemplo n.º 5
0
 public function __construct()
 {
     parent::__construct();
     $this->settings = new Tiny_Settings();
     try {
         $this->compressor = Tiny_Compress::get_compressor($this->settings->get_api_key());
     } catch (Tiny_Exception $e) {
         $this->add_admin_notice(self::translate_escape($e->getMessage()));
     }
 }
 protected function shrink_options($input)
 {
     $options = array(CURLOPT_URL => Tiny_Config::URL, CURLOPT_USERPWD => 'api:' . $this->api_key, CURLOPT_POSTFIELDS => $input, CURLOPT_BINARYTRANSFER => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CAINFO => self::get_ca_file(), CURLOPT_SSL_VERIFYPEER => true, CURLOPT_USERAGENT => Tiny_WP_Base::plugin_identification() . ' cURL');
     if (TINY_DEBUG) {
         $f = fopen(dirname(__FILE__) . '/curl.log', 'w');
         if (is_resource($f)) {
             $options[CURLOPT_VERBOSE] = true;
             $options[CURLOPT_STDERR] = $f;
         }
     }
     return $options;
 }
 public static function wp_version()
 {
     if (is_null(self::$wp_version)) {
         // Try to use unmodified version
         include ABSPATH . WPINC . '/version.php';
         if (isset($wp_version)) {
             self::$wp_version = $wp_version;
         } else {
             self::$wp_version = $GLOBALS['wp_version'];
         }
     }
     return self::$wp_version;
 }
 public function __construct()
 {
     parent::__construct();
     $this->settings = new Tiny_Settings();
 }
Exemplo n.º 9
0
 public function __construct()
 {
     parent::__construct();
     $this->notices = new Tiny_Notices();
 }
Exemplo n.º 10
0
 protected function shrink_options($input)
 {
     return array('http' => array('method' => 'POST', 'header' => array('Content-type: image/png', 'Authorization: Basic ' . base64_encode('api:' . $this->api_key), 'User-Agent: ' . Tiny_WP_Base::plugin_identification() . ' fopen'), 'content' => $input), 'ssl' => array('cafile' => self::get_ca_file(), 'verify_peer' => true));
 }
 protected function shrink_options($input)
 {
     return array(CURLOPT_URL => $this->config['api']['url'], CURLOPT_USERPWD => 'api:' . $this->api_key, CURLOPT_POSTFIELDS => $input, CURLOPT_BINARYTRANSFER => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CAINFO => self::get_ca_file(), CURLOPT_SSL_VERIFYPEER => true, CURLOPT_USERAGENT => Tiny_WP_Base::plugin_identification());
 }