diff --git a/apis/charts_graphs_amcharts/charts_graphs_amcharts.class.inc b/apis/charts_graphs_amcharts/charts_graphs_amcharts.class.inc index 692e41a..2f0997e 100644 --- a/apis/charts_graphs_amcharts/charts_graphs_amcharts.class.inc +++ b/apis/charts_graphs_amcharts/charts_graphs_amcharts.class.inc @@ -6,7 +6,7 @@ * */ -require_once dirname(__FILE__) . '/../../charts_graphs_flash_canvas.class.inc'; +require_once '/' . drupal_dirname(__FILE__) . '/../../charts_graphs_flash_canvas.class.inc'; /** * Implementation of abstract class ChartsGraphsFlashCanvas for amCharts library. diff --git a/apis/charts_graphs_amcharts/charts_graphs_amcharts.info b/apis/charts_graphs_amcharts/charts_graphs_amcharts.info index c0038f4..21eeb7d 100644 --- a/apis/charts_graphs_amcharts/charts_graphs_amcharts.info +++ b/apis/charts_graphs_amcharts/charts_graphs_amcharts.info @@ -4,5 +4,9 @@ description = "amCharts implementation for Charts and Graphs." dependencies[] = charts_graphs dependencies[] = swftools package = "Charts" -core = 6.x +core = 7.x php = 5.1 + +files[] = charts_graphs_amcharts.class.inc +files[] = charts_graphs_amcharts.install +files[] = charts_graphs_amcharts.module diff --git a/apis/charts_graphs_amcharts/charts_graphs_amcharts.install b/apis/charts_graphs_amcharts/charts_graphs_amcharts.install index 77c6591..d361f0a 100644 --- a/apis/charts_graphs_amcharts/charts_graphs_amcharts.install +++ b/apis/charts_graphs_amcharts/charts_graphs_amcharts.install @@ -7,7 +7,7 @@ */ /** - * Implementation of hook_requirements(). + * Implements of hook_requirements(). */ function charts_graphs_amcharts_requirements($phase) { $requirements = array(); @@ -16,7 +16,7 @@ function charts_graphs_amcharts_requirements($phase) { $t = get_t(); if ($phase == 'runtime') { - $path = dirname(realpath((__FILE__))) . '/downloaded/'; + $path = drupal_dirname(realpath((__FILE__))) . '/downloaded/'; $installation_instructions_path = module_exists('advanced_help') ? 'help/charts_graphs/amcharts' : 'http://drupal.org/node/681928'; diff --git a/apis/charts_graphs_amcharts/charts_graphs_amcharts.module b/apis/charts_graphs_amcharts/charts_graphs_amcharts.module index 30c845a..bdeb011 100644 --- a/apis/charts_graphs_amcharts/charts_graphs_amcharts.module +++ b/apis/charts_graphs_amcharts/charts_graphs_amcharts.module @@ -5,11 +5,11 @@ */ /** - * Implementation of hook_chartgraph_provider(). + * Implements of hook_chartgraph_provider(). **/ function charts_graphs_amcharts_chartgraph_provider() { $provider = array( - 'path' => dirname(__FILE__) . '/charts_graphs_amcharts.class.inc', // must be full path + 'path' => drupal_dirname(__FILE__) . '/charts_graphs_amcharts.class.inc', // must be full path 'clazz' => 'ChartsGraphsAmcharts', // implementation class' name 'name' => 'amcharts', // name used when invoking through a factory method 'nice_name' => 'amCharts', @@ -66,7 +66,7 @@ function charts_graphs_amcharts_get_data() { $obj = $cache->data; $ret = $obj->$op; - drupal_set_header('Content-Type: text/xml; charset=utf-8'); + drupal_add_http_header('Content-Type: text/xml; charset=utf-8'); print $ret; exit(); } diff --git a/apis/charts_graphs_bluff/charts_graphs_bluff.info b/apis/charts_graphs_bluff/charts_graphs_bluff.info index 979cfb9..ef5b7d2 100644 --- a/apis/charts_graphs_bluff/charts_graphs_bluff.info +++ b/apis/charts_graphs_bluff/charts_graphs_bluff.info @@ -3,5 +3,9 @@ name = "Charts and Graphs: Bluff" description = "Bluff (Beautiful Graphs in JavaScript) implementation for Charts and Graphs." dependencies[] = charts_graphs package = "Charts" -core = 6.x +core = 7.x php = 5.1 + +files[] = charts_graphs_bluff.class.inc +files[] = charts_graphs_bluff.install +files[] = charts_graphs_bluff.module diff --git a/apis/charts_graphs_bluff/charts_graphs_bluff.install b/apis/charts_graphs_bluff/charts_graphs_bluff.install index 53aa4fc..d26a49c 100644 --- a/apis/charts_graphs_bluff/charts_graphs_bluff.install +++ b/apis/charts_graphs_bluff/charts_graphs_bluff.install @@ -7,7 +7,7 @@ */ /** - * Implementation of hook_requirements(). + * Implements hook_requirements(). */ function charts_graphs_bluff_requirements($phase) { $requirements = array(); @@ -16,7 +16,7 @@ function charts_graphs_bluff_requirements($phase) { $t = get_t(); if ($phase == 'runtime') { - $path = dirname(realpath((__FILE__))) . '/bluff/'; + $path = drupal_dirname(realpath((__FILE__))) . '/bluff/'; $installation_instructions_path = module_exists('advanced_help') ? 'help/charts_graphs/bluff' : 'http://drupal.org/node/681668'; diff --git a/apis/charts_graphs_bluff/charts_graphs_bluff.module b/apis/charts_graphs_bluff/charts_graphs_bluff.module index b96c9c1..a775b12 100644 --- a/apis/charts_graphs_bluff/charts_graphs_bluff.module +++ b/apis/charts_graphs_bluff/charts_graphs_bluff.module @@ -5,11 +5,11 @@ */ /** - * Implementation of hook_chartgraph_provider(). + * Implements hook_chartgraph_provider(). **/ function charts_graphs_bluff_chartgraph_provider() { $provider = array( - 'path' => dirname(__FILE__) . '/charts_graphs_bluff.class.inc', // must be full path + 'path' => drupal_dirname(__FILE__) . '/charts_graphs_bluff.class.inc', // must be full path 'clazz' => 'ChartsGraphsBluff', // implementation class' name 'name' => 'bluff', // name used when invoking through a factory method 'nice_name' => 'Bluff', diff --git a/apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc b/apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc index 4d0d74a..abf0396 100644 --- a/apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc +++ b/apis/charts_graphs_google_charts/charts_graphs_google_charts.class.inc @@ -119,7 +119,7 @@ class ChartsGraphsGoogleCharts extends ChartsGraphsCanvas { $max_serie = reset($serie); $serie_as_string = ''; foreach ($serie as $val) { - $serie_as_string .= ',' . drupal_urlencode($val); + $serie_as_string .= ',' . drupal_encode_path($val); if ($val < $min_serie) { $min_serie = $val; } @@ -155,7 +155,7 @@ class ChartsGraphsGoogleCharts extends ChartsGraphsCanvas { $max_y = $this->y_max; } - $chds = drupal_urlencode($min_y) . ',' . drupal_urlencode($max_y); + $chds = drupal_encode_path($min_y) . ',' . drupal_encode_path($max_y); if ($is_pie) { $chdl = $this->x_labels; $chl = reset($this->series); @@ -180,7 +180,7 @@ class ChartsGraphsGoogleCharts extends ChartsGraphsCanvas { } if ($this->y_legend) { $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_VISIBLE_AXIS_PARAMETER] .= $y_legend_axis; - $y_legend = '2:|' . drupal_urlencode($this->y_legend) . '|'; + $y_legend = '2:|' . drupal_encode_path($this->y_legend) . '|'; $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_LABEL_POSITION] = '2,50'; } else { @@ -201,8 +201,8 @@ class ChartsGraphsGoogleCharts extends ChartsGraphsCanvas { $max_y = $this->y_max; } $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_AXIS_RANGE_PARAMETER] = - $scale_axis_identifier . ',' . drupal_urlencode($min_y) . ',' . - drupal_urlencode($max_y); + $scale_axis_identifier . ',' . drupal_encode_path($min_y) . ',' . + drupal_encode_path($max_y); /** * Applying user defined step for y axis values. */ @@ -271,15 +271,15 @@ class ChartsGraphsGoogleCharts extends ChartsGraphsCanvas { array_reverse($this->x_labels) : $this->x_labels; foreach ($x_labels as $label) { - $chxl .= '|' . drupal_urlencode($label); + $chxl .= '|' . drupal_encode_path($label); } } return $chxl; } protected function _encode_other_parameters() { - $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_CHART_TITLE] = drupal_urlencode($this->title); - $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_CHART_SIZE] = drupal_urlencode(sprintf( + $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_CHART_TITLE] = drupal_encode_path($this->title); + $this->parameters_to_send[CHARTS_GRAPHS_GOOGLE_CHARTS_CHART_SIZE] = drupal_encode_path(sprintf( '%ux%u', $this->width, $this->height @@ -334,7 +334,7 @@ class ChartsGraphsGoogleCharts extends ChartsGraphsCanvas { } } else { - $encoded_value = drupal_urlencode($value); + $encoded_value = drupal_encode_path($value); } return $encoded_value; } diff --git a/apis/charts_graphs_google_charts/charts_graphs_google_charts.info b/apis/charts_graphs_google_charts/charts_graphs_google_charts.info index 7a799b2..0a665ee 100644 --- a/apis/charts_graphs_google_charts/charts_graphs_google_charts.info +++ b/apis/charts_graphs_google_charts/charts_graphs_google_charts.info @@ -3,5 +3,8 @@ name = "Charts and Graphs: Google Charts" description = "Google Charts implementation for Charts and Graphs." dependencies[] = charts_graphs package = "Charts" -core = 6.x +core = 7.x php = 5.1 + +files[] = charts_graphs_google_charts.class.inc +files[] = charts_graphs_google_charts.module diff --git a/apis/charts_graphs_google_charts/charts_graphs_google_charts.module b/apis/charts_graphs_google_charts/charts_graphs_google_charts.module index 9070b1e..1f5c007 100644 --- a/apis/charts_graphs_google_charts/charts_graphs_google_charts.module +++ b/apis/charts_graphs_google_charts/charts_graphs_google_charts.module @@ -9,7 +9,7 @@ **/ function charts_graphs_google_charts_chartgraph_provider() { $provider = array( - 'path' => dirname(__FILE__) . '/charts_graphs_google_charts.class.inc', // must be full path + 'path' => drupal_dirname(__FILE__) . '/charts_graphs_google_charts.class.inc', // must be full path 'clazz' => 'ChartsGraphsGoogleCharts', // implementation class' name 'name' => 'google-charts', // name used when invoking through a factory method 'nice_name' => 'Google Charts', diff --git a/apis/charts_graphs_open_flash/charts_graphs_open_flash.class.inc b/apis/charts_graphs_open_flash/charts_graphs_open_flash.class.inc index 6e331bb..9841bcd 100644 --- a/apis/charts_graphs_open_flash/charts_graphs_open_flash.class.inc +++ b/apis/charts_graphs_open_flash/charts_graphs_open_flash.class.inc @@ -7,7 +7,7 @@ * */ -require_once dirname(__FILE__) . '/../../charts_graphs_flash_canvas.class.inc'; +require_once '/' . drupal_dirname(__FILE__) . '/../../charts_graphs_flash_canvas.class.inc'; /** * Implementation of abstract class ChartsGraphsFlashCanvas for Open Charts @@ -231,7 +231,7 @@ class ChartsGraphsOpenFlash extends ChartsGraphsFlashCanvas { $generic = (object) $arr; //Keep for at least 30 seconds; - cache_set($unique, $generic, 'cache', time() + 30); + cache_set($unique, $generic, 'cache', REQUEST_TIME + 30); $mod_path = drupal_get_path('module', $this->getModuleName()); $openflash_swf_uri = $base_url . '/' . $mod_path . '/open-flash-chart.swf'; diff --git a/apis/charts_graphs_open_flash/charts_graphs_open_flash.info b/apis/charts_graphs_open_flash/charts_graphs_open_flash.info index 1316596..bd24ce3 100644 --- a/apis/charts_graphs_open_flash/charts_graphs_open_flash.info +++ b/apis/charts_graphs_open_flash/charts_graphs_open_flash.info @@ -3,5 +3,8 @@ description = "Open Flash Charts 2 implementation for Charts and Graphs." dependencies[] = charts_graphs dependencies[] = swftools package = "Charts" -core = 6.x +core = 7.x php = 5.1 + +files[] = charts_graphs_open_flash.class.inc +files[] = charts_graphs_open_flash.module diff --git a/apis/charts_graphs_open_flash/charts_graphs_open_flash.module b/apis/charts_graphs_open_flash/charts_graphs_open_flash.module index fa3545f..d7bac56 100644 --- a/apis/charts_graphs_open_flash/charts_graphs_open_flash.module +++ b/apis/charts_graphs_open_flash/charts_graphs_open_flash.module @@ -9,7 +9,7 @@ **/ function charts_graphs_open_flash_chartgraph_provider() { $provider = array( - 'path' => dirname(__FILE__) . '/charts_graphs_open_flash.class.inc', //must be full path + 'path' => drupal_dirname(__FILE__) . '/charts_graphs_open_flash.class.inc', //must be full path 'clazz' => 'ChartsGraphsOpenFlash', //implementation class' name 'name' => 'open-flash', //name used when invoking through a factroy method 'nice_name' => 'Open Flash Chart 2', @@ -66,6 +66,6 @@ function charts_graphs_open_flash_data($cid = NULL) { $chart->get_data_from_cache($cid); - drupal_json($chart); + drupal_json_output($chart); exit(); } diff --git a/charts_graphs.info b/charts_graphs.info old mode 100755 new mode 100644 index 214f79c..3a415d4 --- a/charts_graphs.info +++ b/charts_graphs.info @@ -2,5 +2,10 @@ name = "Charts and Graphs" description = "Charts and Graphs Core API." package = "Charts" -core = 6.x +core = 7.x php = 5.1 + +files[] = charts_graphs.install +files[] = charts_graphs.module +files[] = charts_graphs_canvas.class.inc +files[] = charts_graphs_flash_canvas.class.inc diff --git a/charts_graphs.install b/charts_graphs.install index 636ff19..c8f70c8 100644 --- a/charts_graphs.install +++ b/charts_graphs.install @@ -7,15 +7,20 @@ */ /** - * Implementation of hook_uninstall(). + * Implements hook_uninstall(). */ function charts_graphs_uninstall() { - db_query("DELETE FROM {variable} WHERE name LIKE 'charts_graphs_%%'"); + // TODO Please review the conversion of this statement to the D7 database API syntax. + /* db_query("DELETE FROM {variable} WHERE name LIKE 'charts_graphs_%%'") */ + db_delete('variable') + ->condition('name', 'charts_graphs_%%', 'LIKE') + ->execute(); + cache_clear_all('variables', 'cache'); } /** - * Implementation of hook_requirements(). + * Implements hook_requirements(). */ function charts_graphs_requirements($phase) { $requirements = array(); @@ -31,14 +36,14 @@ function charts_graphs_requirements($phase) { 'description' => $t('Charts and Graphs requires at least one charting library enabled. Please go to !modules_page and enable at least one charting library.', - array('!modules_page' => l(t('modules list page'), 'admin/build/modules/list')) + array('!modules_page' => l(t('modules list page'), 'admin/modules/list')) ), 'severity' => REQUIREMENT_ERROR, 'value' => $t('None enabled'), ); } - $path = dirname(realpath(__FILE__)) . '/'; + $path = drupal_dirname(realpath(__FILE__)) . '/'; $file = $path . 'apis/charts_google_charts'; if (file_exists($file)) { $requirements['charts_graphs_old_path_google_charts'] = array( @@ -122,7 +127,7 @@ function charts_graphs_requirements($phase) { ), '!charts_graphs_settings_page' => l( t('Charts and Graphs settings page'), - 'admin/settings/charts_graphs' + 'admin/config/charts_graphs' ), ) ), @@ -152,7 +157,7 @@ function charts_graphs_requirements($phase) { ), '!charts_graphs_settings_page' => l( t('Charts and Graphs settings page'), - 'admin/settings/charts_graphs' + 'admin/config/charts_graphs' ), ) ), diff --git a/charts_graphs.module b/charts_graphs.module old mode 100755 new mode 100644 index 475abfe..a4a2f5e --- a/charts_graphs.module +++ b/charts_graphs.module @@ -6,10 +6,10 @@ */ /** - * Implementation of hook_init(). + * Implements hook_init(). */ function charts_graphs_init() { - require_once(dirname(__FILE__) . '/charts_graphs_canvas.class.inc'); + require_once('/' . drupal_dirname(__FILE__) . '/charts_graphs_canvas.class.inc'); $api_providers = array(); $hook = 'chartgraph_provider'; @@ -38,7 +38,7 @@ function charts_graphs_menu() { 'type' => MENU_CALLBACK, ); - $items['admin/settings/charts_graphs'] = array( + $items['admin/config/charts_graphs'] = array( 'title' => 'Charts and Graphs', 'description' => 'Main configurations for Charts and Graphs', 'page callback' => 'drupal_get_form', @@ -53,7 +53,7 @@ function charts_graphs_menu() { /** * Main Charts and Graphs settings form. */ -function charts_graphs_main_settings_form() { +function charts_graphs_main_settings_form($form, &$form_state) { $form = array(); $form['charts_graphs_check_chart_api'] = array( @@ -197,7 +197,7 @@ function charts_graphs_get_graph($name) { $api = $apis[$name]; if (!empty($api) && is_object($api)) { - require_once($api->path); + require_once('/' . $api->path); $canvas = new $api->clazz($api->modulename); return $canvas; }