SHOW:
|
|
- or go back to the newest paste.
1 | - | [code language="text"] |
1 | + | #include<stdio.h> |
2 | - | === DeMomentSomTres Prestashop Integration === |
2 | + | #include<string.h> |
3 | - | Contributors: marcqueralt |
3 | + | #define max 205 |
4 | - | Donate link: http://demomentsomtres.com/ |
4 | + | int main() |
5 | - | Tags: prestashop, eCommerce, shortcode, prestashop integration |
5 | + | { |
6 | - | Requires at least: 3.4 |
6 | + | char str2[max],str1[max],str3[max]; |
7 | - | Tested up to: 3.9.1 |
7 | + | int i,n,a,N,sum,k,ln1,ln2,large,small,b,teamp,w; |
8 | - | Stable tag: trunk |
8 | + | scanf("%d",&N); |
9 | - | License: GPLv2 or later |
9 | + | while(N--) |
10 | - | License URI: http://www.gnu.org/licenses/gpl-2.0.html |
10 | + | { |
11 | w=b=k=0; | |
12 | - | This plugin aims to help integrate contents from Prestashop into WordPress. It uses webservices and shortcodes. |
12 | + | scanf("%s%s",str1,str2); |
13 | ln1=strlen(str1); | |
14 | - | == Description == |
14 | + | ln2=strlen(str2); |
15 | for(i=ln1-1;i>=0;i--) | |
16 | - | This plugin aims to help integrate contents from Prestashop into WordPress. It uses webservices and shortcodes. |
16 | + | { |
17 | if(str1[i]=='0') | |
18 | - | = Shortcodes = |
18 | + | { |
19 | teamp=i; | |
20 | - | * demomentsomtres-prestashop-category: shows all subcategories within the one selected. Syntax`[demomentsomtres-prestashop-category id="99" url="xxxxxxxx" key="yyyyy" lang="9"]`. Named parameters: |
20 | + | w=1; |
21 | - | ** id: category id whose sons should be showed. |
21 | + | } |
22 | - | ** url: prestashop shop address |
22 | + | else |
23 | - | ** key: prestashop key (security key provided by prestashop administrator) |
23 | + | break; |
24 | - | ** lang: language id to choose text naming |
24 | + | } |
25 | if(w==1) str1[teamp]='\0'; w=0; | |
26 | - | * demomentsomtres-prestashop-category-desc: shows the category description. Syntax`[demomentsomtres-prestashop-category-desc id="99" url="xxxxxxxx" key="yyyyy" lang="9"]`. Named parameters: |
26 | + | for(i=ln2-1;i>=0;i--) |
27 | - | ** id: category id whose sons should be showed. |
27 | + | { |
28 | - | ** url: prestashop shop address |
28 | + | if(str2[i]=='0') |
29 | - | ** key: prestashop key (security key provided by prestashop administrator) |
29 | + | { |
30 | - | ** lang: language id to choose text naming |
30 | + | teamp=i; |
31 | w=1; | |
32 | - | * demomentsomtres-prestashop-manufacturers: shoes the list of manufactures. Syntax`[demomentsomtres-prestashop-manufacturers id="99" url="xxxxxxxx" key="yyyyy" lang="9"]`. Named parameters: |
32 | + | } |
33 | - | ** id: category id whose sons should be showed. |
33 | + | else |
34 | - | ** url: prestashop shop address |
34 | + | break; |
35 | - | ** key: prestashop key (security key provided by prestashop administrator) |
35 | + | } |
36 | - | ** lang: language id to choose text naming |
36 | + | if(w==1) str2[teamp]='\0'; |
37 | - | == Installation == |
37 | + | ln1=strlen(str1); |
38 | ln2=strlen(str2); | |
39 | - | 1. The plugin is installed as any other plugin. |
39 | + | if(ln1>ln2) |
40 | - | 1. You should configure PrestaShop web services in order to allow required accesses. |
40 | + | a=1; |
41 | else if(ln2>ln1) | |
42 | - | == Frequently Asked Questions == |
42 | + | a=2; |
43 | else a=0; | |
44 | - | == Screenshots == |
44 | + | if(a==1) |
45 | { | |
46 | - | == Changelog == |
46 | + | for(i=0;i<ln1;i++) |
47 | - | = 1.3 = |
47 | + | { |
48 | - | * multilanguage prestashop supported on links |
48 | + | if(i<ln2) |
49 | { | |
50 | - | = 1.0 = |
50 | + | n=(str1[i]-'0')+(str2[i]-'0')+b; |
51 | - | * initial version: demomentsomtres-prestashop-category shortcode. |
51 | + | if(n>9) |
52 | { | |
53 | - | == Upgrade Notice == |
53 | + | str3[i]=(n%10)+'0'; b=1; |
54 | - | [/code] |
54 | + | } |
55 | else | |
56 | { | |
57 | str3[i]=n+'0'; b=0; | |
58 | } | |
59 | } | |
60 | else | |
61 | { | |
62 | if(b==1) | |
63 | { | |
64 | n=(str1[i]-'0')+b; | |
65 | if(n>9) | |
66 | { | |
67 | str3[i]=(n%10)+'0'; b=1; | |
68 | } | |
69 | else | |
70 | { | |
71 | str3[i]=n+'0'; b=0; | |
72 | } | |
73 | } | |
74 | else str3[i]=str1[i]; | |
75 | } | |
76 | } | |
77 | } | |
78 | else if(a==2) | |
79 | { | |
80 | for(i=0;i<ln2;i++) | |
81 | { | |
82 | if(i<ln1) | |
83 | { | |
84 | n=(str2[i]-'0')+(str1[i]-'0')+b; | |
85 | if(n>9) | |
86 | { | |
87 | str3[i]=(n%10)+'0'; b=1; | |
88 | } | |
89 | else | |
90 | { | |
91 | str3[i]=n+'0'; b=0; | |
92 | } | |
93 | } | |
94 | else | |
95 | { | |
96 | if(b==1) | |
97 | { | |
98 | n=(str2[i]-'0')+b; | |
99 | if(n>9) | |
100 | { | |
101 | str3[i]=(n%10)+'0'; b=1; | |
102 | } | |
103 | else | |
104 | { | |
105 | str3[i]=n+'0'; b=0; | |
106 | } | |
107 | } | |
108 | else str3[i]=str2[i]; | |
109 | } | |
110 | } | |
111 | } | |
112 | else | |
113 | { | |
114 | for(i=0;i<ln1;i++) | |
115 | { | |
116 | n=(str2[i]-'0')+(str1[i]-'0')+b; | |
117 | if(n>9) | |
118 | { | |
119 | str3[i]=(n%10)+'0'; b=1; | |
120 | } | |
121 | else | |
122 | { | |
123 | str3[i]=n+'0'; b=0; | |
124 | } | |
125 | } | |
126 | } | |
127 | if(b==1) str3[i++]='1'; | |
128 | str3[i]='\0'; | |
129 | for(i=0;str3[i]!='\0';i++) | |
130 | { | |
131 | if(str3[i]=='0' && b==1) continue; | |
132 | printf("%c",str3[i]); | |
133 | b=0; | |
134 | } | |
135 | printf("\n"); | |
136 | ||
137 | } | |
138 | return 0; | |
139 | } |