开发者

How to use a code igniter class in Wordpress?

开发者 https://www.devze.com 2023-01-23 03:13 出处:网络
The class I wish to use is: https://github.com/philsturgeon/codeigniter-curl/blob/master/libraries/Curl.开发者_StackOverflowphp

The class I wish to use is: https://github.com/philsturgeon/codeigniter-curl/blob/master/libraries/Curl.开发者_StackOverflowphp

How can I use this in a Wordpress project? Do I just take out the code igniter specific snippets out?


Also you need remove log_message() function calls and codeIgniter get_instance() call

Summary.. remove lines 233-238

    // If no a protocol in URL, assume its a CI link
    if ( ! preg_match('!^\w+://! i', $url))
    {
        $this->_ci->load->helper('url');
        $url = site_url($url);
    }

line 31-32

$this->_ci =& get_instance();
log_message('debug', 'cURL Class Initialized');

and line 36

log_message('error', 'cURL Class - PHP was not built with cURL enabled. Rebuild PHP with --with-curl to use cURL.') ;


It looks like the class uses codeigniter's url helper. So, you would have to take a look at this:

http://codeigniter.com/user_guide/helpers/url_helper.html

And re-factor the class in the places where those functions are used. For instance, line 237 of your class uses the codeigniter site_url function.

0

精彩评论

暂无评论...
验证码 换一张
取 消