Exemple #1
0
 public function render()
 {
     $script = "<script type='text/javascript'>\n";
     $script .= "var lburl = '" . RMCURL . "/plugins/lightbox';\n";
     $config = RMSettings::plugin_settings('lightbox', true);
     $params = '';
     foreach ($this->options as $name => $value) {
         if ($value == 'true' || $value == 'false') {
             $value = $value;
         } elseif (is_string($value)) {
             $value = "'" . $value . "'";
         }
         $params .= $params == '' ? "{$name}: {$value}" : ", {$name}: {$value}";
     }
     if ($config->configs != '') {
         $params .= ", {$config->configs}";
     }
     $script .= "var lb_params = {" . $params . "};\n";
     if (!defined('RM_LB_PARAMS')) {
         define('RM_LB_PARAMS', 1);
     }
     $script .= "\$(function(){\n";
     if (is_array($this->elements)) {
         foreach ($this->elements as $element) {
             $script .= "\$(\"{$element}\").colorbox(lb_params);\n";
         }
     } else {
         $script .= "\$(\"{$this->elements}\").colorbox(lb_params);\n";
     }
     $script .= "});\n</script>\n";
     RMTemplate::get()->add_script('jquery.colorbox-min.js', 'rmcommon', array('directory' => 'plugins/lightbox'));
     RMTemplate::get()->add_head($script);
     return $script;
 }
Exemple #2
0
 /**
  * @deprecated
  * Retrieves the settings for a given plugin.
  * This function is deprecated, use RMSettings::plugins_settings() instead;
  * @param string $dir Directory name for plugin
  * @param bool $values Retrieves only key => value (true) or the full array (false)
  * @return array
  */
 public static function plugin_settings($dir, $values = false)
 {
     $settings = RMSettings::plugin_settings($dir, $values);
     if (is_object($settings)) {
         return (array) $settings;
     } else {
         return $settings;
     }
 }