Skip to content
This repository was archived by the owner on Jan 2, 2020. It is now read-only.

Improvements based on "Plugin Include Component Plugin" #1

Closed
wants to merge 1 commit into from
Closed

Improvements based on "Plugin Include Component Plugin" #1

wants to merge 1 commit into from

Conversation

anibalsanchez
Copy link

Hi Mike,

I've just added features from Mike Reumer "Plugin Include Component Plugin".

// Enable Post
curl_setopt($ch, CURLOPT_POST, true);

...

    $cookie = '';
    $reg = '/^[a-f0-9]+$/si';
    //get all session parameters
    foreach ($_COOKIE as $key => $value)
                if (preg_match($reg, $key)>0) $cookie.="$key=$value; "; // separation in cookies is ; with space!

            // Include all cookies
            if ( strlen($cookie)>0 ){
                // False to keep all cookies of previous session
                curl_setopt($ch, CURLOPT_COOKIESESSION, false); 
                curl_setopt($ch, CURLOPT_COOKIE, $cookie);
            }

....

            // stop after 10 redirects
            curl_setopt ($ch, CURLOPT_MAXREDIRS, 10);

Thanks,
Anibal

@@ -73,6 +73,9 @@ public function request($method, JUri $uri, $data = null, array $headers = null,
// If data exists let's encode it and make sure our Content-type header is set.
if (isset($data))
{
// Enable Post
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need to set the CURLOPT_POST constant. The method is being set a few lines above with the CURLOPT_CUSTOMREQUEST constant.

@BabDev
Copy link
Collaborator

BabDev commented May 5, 2012

Unit testing complete. There were 0 failures and 0 errors from 31 tests and 52 assertions.
Checkstyle analysis reported 2 warnings and 30 errors.
There are 0 warnings and 1 errors expected. If your results have more than the number of expected errors and warnings, please correct your code style.

@mbabker
Copy link
Member

mbabker commented May 5, 2012

I'm running my own unit test suite and following the Joomla Platform code style standards (makes it easier to merge changes from the Platform in this case and submit the changes once I've made all the changes I need to and test them). Would you mind fixing up the code style as well?

FILE: libraries/babdev/http/transport/curl.php

FOUND 29 ERROR(S) AND 2 WARNING(S) AFFECTING 15 LINE(S)

76 | ERROR | Tabs must be used to indent lines; spaces are not allowed
77 | ERROR | Tabs must be used to indent lines; spaces are not allowed
77 | ERROR | Whitespace found at end of line
78 | ERROR | Tabs must be used to indent lines; spaces are not allowed
78 | ERROR | Whitespace found at end of line
100 | ERROR | Please put a space between the // and the start of comment text; found "//get all session parameters"
101 | WARNING | Inline control structures are discouraged
102 | ERROR | Tabs must be used to indent lines; spaces are not allowed
102 | WARNING | Inline control structures are discouraged
102 | ERROR | Expected "if (...)\n"; found "if (...) "
102 | ERROR | Expected 1 space before ">"; 0 found
102 | ERROR | Expected 1 space after ">"; 0 found
102 | ERROR | Expected 1 space before ".="; 0 found
102 | ERROR | Expected 1 space after ".="; 0 found
102 | ERROR | Please start your comment with a capital letter; found "// separation in cookies is ; with space!"
104 | ERROR | Tabs must be used to indent lines; spaces are not allowed
105 | ERROR | Tabs must be used to indent lines; spaces are not allowed
105 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if (...)...{...}\n...else\n"
105 | ERROR | Expected 1 space before ">"; 0 found
105 | ERROR | Expected 1 space after ">"; 0 found
106 | ERROR | Tabs must be used to indent lines; spaces are not allowed
107 | ERROR | Tabs must be used to indent lines; spaces are not allowed
107 | ERROR | Whitespace found at end of line
108 | ERROR | Tabs must be used to indent lines; spaces are not allowed
109 | ERROR | Tabs must be used to indent lines; spaces are not allowed
130 | ERROR | Tabs must be used to indent lines; spaces are not allowed
130 | ERROR | Whitespace found at end of line
131 | ERROR | Tabs must be used to indent lines; spaces are not allowed
131 | ERROR | Please start your comment with a capital letter; found "// stop after 10 redirects"
132 | ERROR | Tabs must be used to indent lines; spaces are not allowed
132 | ERROR | Space before opening parenthesis of function call prohibited

@anibalsanchez
Copy link
Author

Hi, Sure,

This is my first time pushing a change following this guidelines. How do
you execute this tests? How do you apply this style? Eclipse?

Thanks,
Anibal

@mbabker
Copy link
Member

mbabker commented May 5, 2012

You just push a new commit to the branch and GitHub automatically adds it to the open pull request.

As far as running the tools, this link from the Platform's Manual should help you get everything installed: http://developer.joomla.org/manual/appe-Joomla_Platform_Manual-Analysis.html

One other suggestion also would be to go into Eclipse and set the code style settings there to follow the Platform's style as close as possible. For example, using a tab character instead of spaces is the common one that gets people. Once you have Eclipse (or whatever IDE you use) set up with that, you'll notice it's a lot easier to follow the code style rules. A lot of the error messages are useful as well and tell you what exactly the error is and on what line it occurred.

@mbabker mbabker closed this Mar 28, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants