I updated trustlink code. Please review my patch.

Comments

andypost’s picture

Status: Active » Needs work
+++ b/seonet.admin.inc
@@ -294,10 +293,25 @@ function seonet_admin_trustlink() {
+  ¶

много пустых строк и делаьше

+++ b/seonet.module
@@ -12,8 +12,6 @@
-      return t('Link exchange - Sape, TrustLink, LinkFeed (support: <a href="@url" target="_blank">www.seonet.by</a>)', array('@url' => 'http://www.seonet.by/'));
-    break;

??

+++ b/seonet.module
@@ -126,13 +124,16 @@ function seonet_block($op = 'list', $delta = 0, $edit = array()) {
-          // Use different templates for selected orientation.
-          if (variable_get('seonet_trustlink_orientation', 'vertical') == 'vertical') {
-            $obj->tl_template = drupal_get_path('module', 'seonet') . '/engines/template-v.tpl.html';
-          }
-          else {
-            $obj->tl_template = drupal_get_path('module', 'seonet') . '/engines/template-h.tpl.html';
+          $host = variable_get('seonet_trustlink_host', $_SERVER['HTTP_HOST']);
+          $curr_host = $host ? $host : $_SERVER['HTTP_HOST'];
+          $curr_host = preg_replace('{^https?://}i', '', $curr_host);
+          $curr_host = preg_replace('{^www\.}i', '', $curr_host);
+          $curr_host = strtolower($curr_host);
+          $template =  file_directory_path().'/trustlink/template.'. $curr_host .'.tpl.html';

разве не удобнее использвоать шаблоны, которые стоит вообще сделать темизируемыми, обнволять шаблон проще чем код модуля

+++ b/seonet.module
@@ -159,6 +160,86 @@ function seonet_block($op = 'list', $delta = 0, $edit = array()) {
+      <table class="'. $user_id .'">
+        <tbody>
+        <{block}>
+          <tr>
+            <td>
+              <table>
+                <{head_block}><tr><td><{link}></td></tr><{/head_block}>
+                <tr><td class="text"><{text}></td></tr>
+                <tr><td class="host"><{host}></td></tr>
+                </table>
+            </td>
+          </tr>
+        <{/block}>
+        </tbody>
+      </table>';

Этот маркап от случая к случаю меняется, попробуй слить несокльо вариантов трастлинка и сравнить внутренности

+++ b/seonet.module
@@ -159,6 +160,86 @@ function seonet_block($op = 'list', $delta = 0, $edit = array()) {
+      </ul>';      ¶

когда ты уже настроишь тектсовый редактор....

+++ b/seonet.module
@@ -380,36 +461,29 @@ function _seonet_trustlink() {
-      // An array with trustlink settings.
-      $settings = array();
-      // UTF-8 is a Default for both trustlink and Drupal.
-      // But links are passed as WIN-1251.
-      $settings['charset'] = 'UTF-8';
-      if (variable_get('seonet_trustlink_multi', 1)) {
-        $settings['multi_site'] = TRUE;
-      }
-      if ($fetch_type = variable_get('seonet_trustlink_fetch', '')) {
-        $settings['fetch_remote_type'] = $fetch_type;
-      }
-      // Enables debug output.
-      $settings['verbose'] = variable_get('seonet_trustlink_verbose', 0);
-      // Always show code.
-      $settings['force_show_code'] = TRUE;
+      // Creating an array with trustlink settings
+      $settings                      = array();
+      $settings['charset']           = 'UTF-8'; //Default charset
+      $settings['multi_site']        = variable_get('seonet_trustlink_multi', TRUE); // Enalbes multi site option
+      $settings['fetch_remote_type'] = variable_get('seonet_trustlink_fetch', '');
+      $settings['verbose']           = variable_get('seonet_trustlink_verbose', 0); // Enables debug output
+      $settings['host']              = variable_get('seonet_trustlink_host', $_SERVER['HTTP_HOST']); // Host name
+      $settings['force_show_code']   = TRUE; // Always show code

зачем убрал коменты?

+++ b/seonet.module
@@ -380,36 +461,29 @@ function _seonet_trustlink() {
+      $settings['host']              = variable_get('seonet_trustlink_host', $_SERVER['HTTP_HOST']); // Host name
+      $settings['force_show_code']   = TRUE; // Always show code
 
-      if ($host = variable_get('seonet_trustlink_host', '')) {
-        $settings['host'] = $host;
-      }

опять меняешь значения по умолчанию на мусор?

spleshka’s picture

StatusFileSize
new13.39 KB

Попробуй этот патч

spleshka’s picture

StatusFileSize
new9.41 KB

Новый патч

spleshka’s picture

StatusFileSize
new9.41 KB

Новый патч 2

spleshka’s picture

StatusFileSize
new9.27 KB

Поправлены окончания строк в шаблонах

andypost’s picture

Status: Needs work » Reviewed & tested by the community

+1 now it's ready

spleshka’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Patch was applies. I close this issue.

andypost’s picture

Status: Closed (fixed) » Fixed

use Fixed

andypost’s picture

Use @Fixed@ Status

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.