diff --git a/dart.info b/dart.info index 906ea97..e85ab68 100644 --- a/dart.info +++ b/dart.info @@ -16,11 +16,3 @@ files[] = export_ui/dart_ctools_export_ui.inc files[] = export_ui/dart_tag_ui.class.php files[] = tests/dart.test files[] = views/views_plugin_row_dart_node_view.inc - - -; Information added by drupal.org packaging script on 2012-11-07 -version = "7.x-2.9+2-dev" -core = "7.x" -project = "dart" -datestamp = "1352249305" - diff --git a/dart.module b/dart.module index 75b1395..9280b6e 100644 --- a/dart.module +++ b/dart.module @@ -120,7 +120,7 @@ function dart_libraries_info() { } /** - * Implements of hook_token_info(). + * Implements hook_token_info(). */ function dart_token_info() { $type = array( @@ -141,7 +141,7 @@ function dart_token_info() { } /** - * Implements of hook_token(). + * Implements hook_token(). */ function dart_tokens($type, $tokens, array $data = array(), array $options = array()) { $replacements = array(); @@ -297,6 +297,15 @@ function dart_dart_tag_alter(&$tag) { } /** + * Implements hook_views_api(). + */ +function dart_views_api() { + return array( + 'api' => '2', + ); +} + +/** * Wrapper function for outputting a themed dart tag. */ function dart_tag($machinename) { @@ -773,10 +782,29 @@ function _dart_term_formatter_full($term) { } /** + * Return the themed output for displaying an ad. + */ +function _dart_ads_tag($delta) { + $current_path = trim(request_uri(), '/'); + + // Ads within ajax. + if ($current_path == 'views/ajax' || preg_match('|admin/structure/views/.*/preview|', $current_path)) { + $machinename = str_replace('dart-tag-', '', $delta); + $tags = dart_tag_load($machinename); + return ''; + return theme('dart_tag_ajax', array('tag' => $tags, 'name' => $delta)); + } + // Normal dart ad. + else { + $dart_tag_block = module_invoke('dart', 'block_view', $delta); + return $dart_tag_block['content']; + } +} + +/** * Template preprocess function for dart tags. */ function template_preprocess_dart_tag(&$variables) { - $tag = $variables['tag']; $variables['attr']['class'] = 'dart-tag dart-name-' . $tag->machinename; @@ -798,47 +826,14 @@ function template_preprocess_dart_tag(&$variables) { } /** - * Implements hook_views_api(). - */ -function dart_views_api() { - - return array( - 'api' => '2', - ); -} - -/** - * Return the themed output for displaying an ad. - */ -function _dart_ads_tag($delta) { - - $current_path = trim(request_uri(), '/'); - - // Ads within ajax. - if ($current_path == 'views/ajax' || preg_match('|admin/structure/views/.*/preview|', $current_path)) { - $machinename = str_replace('dart-tag-', '', $delta); - $tags = dart_tag_load($machinename); - return ''; - return theme('dart_tag_ajax', array('tag' => $tags, 'name' => $delta)); - } - // Normal dart ad. - else { - $dart_tag_block = module_invoke('dart', 'block_view', $delta); - return $dart_tag_block['content']; - } -} - -/** * Template preprocess function for ads. */ function template_process_dart_tag_ajax(&$variables) { - $tag = $variables['tag']; $variables['attributes'] = array('class' => 'dart-tag'); $variables['json_tag'] = drupal_json_encode($tag); $variables['show_script_tag'] = !$tag->settings['options']['scriptless']; - $noscript_tag_image = l(theme('image', array('path' => $tag->noscript['src'])), - $tag->noscript['href'], array('html' => TRUE)); + $noscript_tag_image = l(theme('image', array('path' => $tag->noscript['src'])), $tag->noscript['href'], array('html' => TRUE)); $variables['noscript_tag'] = variable_get('dart_noscript', 1) ? '' : ''; } diff --git a/modules/dart_scheduler/dart_scheduler.info b/modules/dart_scheduler/dart_scheduler.info index 10f8ad3..95692e9 100644 --- a/modules/dart_scheduler/dart_scheduler.info +++ b/modules/dart_scheduler/dart_scheduler.info @@ -6,9 +6,3 @@ package = Advertising files[] = dart_scheduler.install files[] = dart_scheduler.module - -; Information added by drupal.org packaging script on 2012-11-07 -version = "7.x-2.9+2-dev" -core = "7.x" -project = "dart" -datestamp = "1352249305" diff --git a/modules/dart_search/dart_search.info b/modules/dart_search/dart_search.info index 1fd33a2..a32b6ca 100644 --- a/modules/dart_search/dart_search.info +++ b/modules/dart_search/dart_search.info @@ -6,9 +6,3 @@ dependencies[] = search dependencies[] = ctools package = Advertising - -; Information added by drupal.org packaging script on 2012-11-07 -version = "7.x-2.9+2-dev" -core = "7.x" -project = "dart" -datestamp = "1352249305" diff --git a/modules/dart_taxonomy/dart_taxonomy.info b/modules/dart_taxonomy/dart_taxonomy.info index b8a746d..7312501 100644 --- a/modules/dart_taxonomy/dart_taxonomy.info +++ b/modules/dart_taxonomy/dart_taxonomy.info @@ -6,9 +6,3 @@ package = Advertising files[] = dart_taxonomy.install files[] = dart_taxonomy.module - -; Information added by drupal.org packaging script on 2012-11-07 -version = "7.x-2.9+2-dev" -core = "7.x" -project = "dart" -datestamp = "1352249305" diff --git a/theme/dart_tag_ajax.tpl.php b/theme/dart_tag_ajax.tpl.php index 082f294..242a637 100644 --- a/theme/dart_tag_ajax.tpl.php +++ b/theme/dart_tag_ajax.tpl.php @@ -2,11 +2,11 @@ /** * @file - * Display the js call to display a Petside-AJAX DART ad tag. + * Display the js call to display a AJAX DART ad tag. * * Variables available: - * - $tag: The full tag object or NULL. If it's NULL, all other - * vars listed below will be NULL as well + * - $tag: The full tag object or NULL. If it's NULL, all other vars listed + * below will be NULL as well * - $json_tag: a js version of $tag. * - $attributes: any attributes that should be displayed on teh outer-most div. * - $show_script_tag: boolean. @@ -24,7 +24,7 @@ diff --git a/views/dart-views-view-row-node.tpl.php b/views/dart-views-view-row-node.tpl.php index e8295a6..7b3798f 100644 --- a/views/dart-views-view-row-node.tpl.php +++ b/views/dart-views-view-row-node.tpl.php @@ -1,5 +1,4 @@ array()); return $options; @@ -29,7 +26,6 @@ class views_plugin_row_dart_node_view extends views_plugin_row_node_view { * Construct the options form. */ function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); $default_values = $this->options['ad_position']; @@ -104,43 +100,25 @@ class views_plugin_row_dart_node_view extends views_plugin_row_node_view { } /** - * Validate the options form. + * Called before the view row is rendered. */ - function options_validate(&$form, &$form_state) { - - parent::options_validate($form, $form_state); - } - - /** - * Return the main options, which are shown in the summary title. - */ - function options_form_summary_options() { - - return parent::options_form_summary_options(); - } - - function summary_title() { - - return parent::summary_title(); - } - function pre_render($values) { - parent::pre_render($values); static $position_offset = 1; - foreach ($this->options['ad_position'] as $key => $ad_setting) { if ($ad_setting['position'] && $ad_setting['source']) { - $this->ad_positions[ $ad_setting['position'] ] = $ad_setting['source']; + $this->ad_positions[ $ad_setting['position'] ] = $ad_setting['source']; } } ksort($this->ad_positions); } + /** + * Render the view row and return the HTML output. + */ function render($row) { - static $current_row_position = 0, $position_offset = 1; $output = ''; @@ -149,7 +127,6 @@ class views_plugin_row_dart_node_view extends views_plugin_row_node_view { // This will add DART ads even if they are to be displayed right next to // one another. while (isset($this->ad_positions[ ($current_row_position + $position_offset) ])) { - $ad_source = $this->ad_positions[ ($current_row_position + $position_offset) ]; // Insert dart ad. @@ -160,7 +137,6 @@ class views_plugin_row_dart_node_view extends views_plugin_row_node_view { } $output .= $rendered_node; - $current_row_position++; return $output;