A_Custom_Lightbox_Form

Class A_Custom_Lightbox_Form.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php  
  1. class A_Custom_Lightbox_Form extends Mixin 
  2. function get_model() 
  3. return C_Lightbox_Library_Manager::get_instance()->get('custom_lightbox'); 
  4. /** 
  5. * Returns a list of fields to render on the settings page 
  6. */ 
  7. function _get_field_names() 
  8. return array('lightbox_library_code', 'lightbox_library_styles', 'lightbox_library_scripts'); 
  9. /** 
  10. * @param $lightbox 
  11. * @return mixed 
  12. */ 
  13. function _render_lightbox_library_code_field($lightbox) 
  14. return $this->_render_text_field($lightbox, 'code', __('Code', 'nggallery'), $lightbox->code); 
  15. /** 
  16. * @param $lightbox 
  17. * @return mixed 
  18. */ 
  19. function _render_lightbox_library_styles_field($lightbox) 
  20. return $this->_render_textarea_field($lightbox, 'styles', __('Stylesheet URL', 'nggallery'), implode("\n", $lightbox->styles)); 
  21. /** 
  22. * @param $lightbox 
  23. * @return mixed 
  24. */ 
  25. function _render_lightbox_library_scripts_field($lightbox) 
  26. return $this->_render_textarea_field($lightbox, 'scripts', __('Javascript URL', 'nggallery'), implode("\n", $lightbox->scripts)); 
  27. function _convert_to_urls($input) 
  28. $retval = array(); 
  29. $urls = explode("\n", $input); 
  30. foreach ($urls as $url) { 
  31. if (strpos($url, home_url()) === 0) { 
  32. $url = str_replace(home_url(), '', $url); 
  33. } elseif (strpos($url, 'http') === 0) { 
  34. $url = str_replace('https://', '//', $url); 
  35. $url = str_replace('http://', '//', $url); 
  36. $retval[] = $url; 
  37. return $retval; 
  38. function save_action() 
  39. $settings = C_NextGen_Settings::get_instance(); 
  40. $modified = FALSE; 
  41. if ($params = $this->param('custom_lightbox')) { 
  42. if (array_key_exists('scripts', $params)) { 
  43. $settings->thumbEffectScripts = $this->_convert_to_urls($params['scripts']); 
  44. $modified = TRUE; 
  45. if (array_key_exists('styles', $params)) { 
  46. $settings->thumbEffectStyles = $this->_convert_to_urls($params['styles']); 
  47. $modified = TRUE; 
  48. if (array_key_exists('code', $params)) { 
  49. $settings->thumbEffectCode = $params['code']; 
  50. $modified = TRUE; 
  51. if ($modified) { 
  52. $settings->save();