| @@ 247-313 (lines=67) @@ | ||
| 244 | return $result; |
|
| 245 | } |
|
| 246 | ||
| 247 | function getInputParameters($module) { |
|
| 248 | $result = array(); |
|
| 249 | ||
| 250 | if ( $module == 'G' ) { |
|
| 251 | $cut = 'OSCOM_APP_PAYPAL_BRAINTREE_'; |
|
| 252 | } else { |
|
| 253 | $cut = 'OSCOM_APP_PAYPAL_BRAINTREE_' . $module . '_'; |
|
| 254 | } |
|
| 255 | ||
| 256 | $cut_length = strlen($cut); |
|
| 257 | ||
| 258 | foreach ( $this->getParameters($module) as $key ) { |
|
| 259 | $p = strtolower(substr($key, $cut_length)); |
|
| 260 | ||
| 261 | if ( $module == 'G' ) { |
|
| 262 | $cfg_class = 'OSCOM_Braintree_Cfg_' . $p; |
|
| 263 | ||
| 264 | if ( !class_exists($cfg_class) ) { |
|
| 265 | $this->loadLanguageFile('cfg_params/' . $p . '.php'); |
|
| 266 | ||
| 267 | include(DIR_FS_CATALOG . 'includes/apps/braintree/cfg_params/' . $p . '.php'); |
|
| 268 | } |
|
| 269 | } else { |
|
| 270 | $cfg_class = 'OSCOM_Braintree_' . $module . '_Cfg_' . $p; |
|
| 271 | ||
| 272 | if ( !class_exists($cfg_class) ) { |
|
| 273 | $this->loadLanguageFile('modules/' . $module . '/cfg_params/' . $p . '.php'); |
|
| 274 | ||
| 275 | include(DIR_FS_CATALOG . 'includes/apps/braintree/modules/' . $module . '/cfg_params/' . $p . '.php'); |
|
| 276 | } |
|
| 277 | } |
|
| 278 | ||
| 279 | $cfg = new $cfg_class(); |
|
| 280 | ||
| 281 | if ( !defined($key) ) { |
|
| 282 | $this->saveParameter($key, $cfg->default, isset($cfg->title) ? $cfg->title : null, isset($cfg->description) ? $cfg->description : null, isset($cfg->set_func) ? $cfg->set_func : null); |
|
| 283 | } |
|
| 284 | ||
| 285 | if ( !isset($cfg->app_configured) || ($cfg->app_configured !== false) ) { |
|
| 286 | if ( isset($cfg->sort_order) && is_numeric($cfg->sort_order) ) { |
|
| 287 | $counter = (int)$cfg->sort_order; |
|
| 288 | } else { |
|
| 289 | $counter = count($result); |
|
| 290 | } |
|
| 291 | ||
| 292 | while ( true ) { |
|
| 293 | if ( isset($result[$counter]) ) { |
|
| 294 | $counter++; |
|
| 295 | ||
| 296 | continue; |
|
| 297 | } |
|
| 298 | ||
| 299 | $set_field = $cfg->getSetField(); |
|
| 300 | ||
| 301 | if ( !empty($set_field) ) { |
|
| 302 | $result[$counter] = $set_field; |
|
| 303 | } |
|
| 304 | ||
| 305 | break; |
|
| 306 | } |
|
| 307 | } |
|
| 308 | } |
|
| 309 | ||
| 310 | ksort($result, SORT_NUMERIC); |
|
| 311 | ||
| 312 | return $result; |
|
| 313 | } |
|
| 314 | ||
| 315 | function makeApiCall($url, $parameters = null, $headers = null) { |
|
| 316 | $server = parse_url($url); |
|
| @@ 291-357 (lines=67) @@ | ||
| 288 | return $result; |
|
| 289 | } |
|
| 290 | ||
| 291 | function getInputParameters($module) { |
|
| 292 | $result = array(); |
|
| 293 | ||
| 294 | if ( $module == 'G' ) { |
|
| 295 | $cut = 'OSCOM_APP_PAYPAL_'; |
|
| 296 | } else { |
|
| 297 | $cut = 'OSCOM_APP_PAYPAL_' . $module . '_'; |
|
| 298 | } |
|
| 299 | ||
| 300 | $cut_length = strlen($cut); |
|
| 301 | ||
| 302 | foreach ( $this->getParameters($module) as $key ) { |
|
| 303 | $p = strtolower(substr($key, $cut_length)); |
|
| 304 | ||
| 305 | if ( $module == 'G' ) { |
|
| 306 | $cfg_class = 'OSCOM_PayPal_Cfg_' . $p; |
|
| 307 | ||
| 308 | if ( !class_exists($cfg_class) ) { |
|
| 309 | $this->loadLanguageFile('cfg_params/' . $p . '.php'); |
|
| 310 | ||
| 311 | include(DIR_FS_CATALOG . 'includes/apps/paypal/cfg_params/' . $p . '.php'); |
|
| 312 | } |
|
| 313 | } else { |
|
| 314 | $cfg_class = 'OSCOM_PayPal_' . $module . '_Cfg_' . $p; |
|
| 315 | ||
| 316 | if ( !class_exists($cfg_class) ) { |
|
| 317 | $this->loadLanguageFile('modules/' . $module . '/cfg_params/' . $p . '.php'); |
|
| 318 | ||
| 319 | include(DIR_FS_CATALOG . 'includes/apps/paypal/modules/' . $module . '/cfg_params/' . $p . '.php'); |
|
| 320 | } |
|
| 321 | } |
|
| 322 | ||
| 323 | $cfg = new $cfg_class(); |
|
| 324 | ||
| 325 | if ( !defined($key) ) { |
|
| 326 | $this->saveParameter($key, $cfg->default, isset($cfg->title) ? $cfg->title : null, isset($cfg->description) ? $cfg->description : null, isset($cfg->set_func) ? $cfg->set_func : null); |
|
| 327 | } |
|
| 328 | ||
| 329 | if ( !isset($cfg->app_configured) || ($cfg->app_configured !== false) ) { |
|
| 330 | if ( isset($cfg->sort_order) && is_numeric($cfg->sort_order) ) { |
|
| 331 | $counter = (int)$cfg->sort_order; |
|
| 332 | } else { |
|
| 333 | $counter = count($result); |
|
| 334 | } |
|
| 335 | ||
| 336 | while ( true ) { |
|
| 337 | if ( isset($result[$counter]) ) { |
|
| 338 | $counter++; |
|
| 339 | ||
| 340 | continue; |
|
| 341 | } |
|
| 342 | ||
| 343 | $set_field = $cfg->getSetField(); |
|
| 344 | ||
| 345 | if ( !empty($set_field) ) { |
|
| 346 | $result[$counter] = $set_field; |
|
| 347 | } |
|
| 348 | ||
| 349 | break; |
|
| 350 | } |
|
| 351 | } |
|
| 352 | } |
|
| 353 | ||
| 354 | ksort($result, SORT_NUMERIC); |
|
| 355 | ||
| 356 | return $result; |
|
| 357 | } |
|
| 358 | ||
| 359 | // APP calls require $server to be "live" or "sandbox" |
|
| 360 | function getApiResult($module, $call, $extra_params = null, $server = null, $is_ipn = false) { |
|