Member
Member
hucste   04-08-2017, 01:20
#1

Hi, all.

I rewrite my code about zenpaypal plugin, in new version.
I attempt to use the "Paypal REST API PHP SDK".
(http://paypal.github.io/PayPal-PHP-SDK/)

I need to create a checkout php script receiving posted datas from the form html (wrote by function zenpaypal into zenPaypal.php script).

How to do it for running correctly with zenphoto, and my zenpaypal plugin?

Administrator
Administrator
acrylian   04-08-2017, 08:02
#2

Great, third party contributionsl like this are always very welcome.

I don't know the paypal framework and what you specifially need to do with it. But via PHP you can generally check for POST/GET data directy in your main plugin file using

if(isset($_POST['your-paypal-form-stuff']) { //here whatever you need to do with the code - Don't forget to sanitize properly! exitZP(); // to avoid other plugin code being executed afterwards }`

If all can happen on page reload after submitting you can do that within a theme function of the plugin naturally. See for example the printContactForm() function from the contact_form plugin.

Does that help? Or do you mean anything else?

Member
Member
hucste   04-08-2017, 08:21
#3

ok, thank you.
I see that!

Member
Member
hucste   15-08-2017, 18:28
#4

Hi...

I've one problem, with my script.

If i test as:

`

$ php-7.0 -l zenpaypal.php

No syntax errors detected in zenpaypal.php

$ php-7.0 -l zenpaypal/class.ZenPayPal.php

No syntax errors detected in zenpaypal/class.ZenPayPal.php

`

But, when i upload my plugin, the zenphoto website is blank!
When i delete my plugin, the website run correctly.
One idea?

My first lines code into zenpaypal.php:

`

Administrator
Administrator
acrylian   16-08-2017, 09:27
#5

Some observations and recommendations.

[list]
[]Best use lowercase file names to avoid accidental typos regarding the case. Same for variable names. Function and method names where the case doesn't matter use camelCase.
[
]Include classes, functions and filter defines after the $plugin definition.
Instead include(__DIR__ .'/'.ZPP.'/class.ZenPayPal.php'); use
require_once(SERVERPATH . '/' . USER_PLUGIN_FOLDER . '/zenpaypal/class.ZenPayPal.php'); Not sure if the define of the constant ZPP is really necessary.
[]if $zenpaypal = new ZenPayPal(); is meant to be used as a global object variable name it accordingly like $_zenpayapl or even $_zp_zenpaypal (this is how globals should be named internally - sadly ZP does not do this consequently as well in some places ;-))
[
]Additionally you zp_register_filter calls might not be correct. If these are not static functions it will not work. If these are methods of the class you have to use static methods like zp_register_filter('admin_head', 'ZenPayPal::printCSS');
[/list]
The blank page might of course also be caused by the code following that.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.