• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónd4fab39a0c628be31df506a699c57d6ea88870fc (tree)
Tiempo2011-02-04 00:01:25
Autorhenoheno <henoheno>
Commiterhenoheno

Log Message

BugTrack2/343 BugTrack/779: Cleanup:
* "Double $quotes"; => 'Single ' . $quotes;
* if (foo) bar; => if (foo) { bar; }
* Adding spaces

Cambiar Resumen

Diferencia incremental

--- a/plugin/ref.inc.php
+++ b/plugin/ref.inc.php
@@ -1,6 +1,6 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
3-// $Id: ref.inc.php,v 1.51 2011/01/25 15:01:01 henoheno Exp $
3+// $Id: ref.inc.php,v 1.52 2011/02/03 15:01:25 henoheno Exp $
44 // Copyright (C)
55 // 2002-2006 PukiWiki Developers Team
66 // 2001-2002 Originally written by yu-ji
@@ -10,10 +10,11 @@
1010 // Include an attached image-file as an inline-image
1111
1212 // File icon image
13-if (! defined('FILE_ICON'))
13+if (! defined('FILE_ICON')) {
1414 define('FILE_ICON',
1515 '<img src="' . IMAGE_DIR . 'file.png" width="20" height="20"' .
1616 ' alt="file" style="border-width:0px" />');
17+}
1718
1819 /////////////////////////////////////////////////
1920 // Default settings
@@ -43,7 +44,7 @@ define('PLUGIN_REF_DIRECT_ACCESS', FALSE); // FALSE or TRUE
4344 define('PLUGIN_REF_IMAGE', '/\.(gif|png|jpe?g)$/i');
4445
4546 // Usage (a part of)
46-define('PLUGIN_REF_USAGE', "([pagename/]attached-file-name[,parameters, ... ][,title])");
47+define('PLUGIN_REF_USAGE', '([pagename/]attached-file-name[,parameters, ... ][,title])');
4748
4849 function plugin_ref_inline()
4950 {
@@ -64,12 +65,12 @@ function plugin_ref_inline()
6465 function plugin_ref_convert()
6566 {
6667 if (! func_num_args())
67- return '<p>#ref(): Usage:' . PLUGIN_REF_USAGE . "</p>\n";
68+ return '<p>#ref(): Usage:' . PLUGIN_REF_USAGE . '</p>' . "\n";
6869
6970 $params = plugin_ref_body(func_get_args());
7071
7172 if (isset($params['_error']) && $params['_error'] != '') {
72- return "<p>#ref(): {$params['_error']}</p>\n";
73+ return '<p>#ref(): ' . $params['_error'] . '</p>' . "\n";
7374 }
7475
7576 if ((PLUGIN_REF_WRAP_TABLE && ! $params['nowrap']) || $params['wrap']) {
@@ -85,7 +86,8 @@ function plugin_ref_convert()
8586 // Netscape 6 = x (wrapで寄せが効かない)
8687 // IE6 = o
8788 $margin = ($params['around'] ? '0px' : 'auto');
88- $margin_align = ($params['_align'] == 'center') ? '' : ";margin-{$params['_align']}:0px";
89+ $margin_align = ($params['_align'] == 'center') ? '' :
90+ ';margin-' . $params['_align'] . ':0px';
8991 $params['_body'] = <<<EOD
9092 <table class="style_table" style="margin:$margin$margin_align">
9193 <tr>
@@ -98,11 +100,11 @@ EOD;
98100 if ($params['around']) {
99101 $style = ($params['_align'] == 'right') ? 'float:right' : 'float:left';
100102 } else {
101- $style = "text-align:{$params['_align']}";
103+ $style = 'text-align:' . $params['_align'];
102104 }
103105
104106 // divで包む
105- return "<div class=\"img_margin\" style=\"$style\">{$params['_body']}</div>\n";
107+ return '<div class="img_margin" style="' . $style . '">' . $params['_body'] . '</div>' . "\n";
106108 }
107109
108110 function plugin_ref_body($args)
@@ -123,8 +125,8 @@ function plugin_ref_body($args)
123125 'noimg' => FALSE, // 画像を展開しない
124126 'zoom' => FALSE, // 縦横比を保持する
125127 '_size' => FALSE, // サイズ指定あり
126- '_w' => 0, // 幅
127- '_h' => 0, // 高さ
128+ '_w' => 0, // 幅
129+ '_h' => 0, // 高さ
128130 '_%' => 0, // 拡大率
129131 '_args' => array(),
130132 '_done' => FALSE,
@@ -173,7 +175,7 @@ function plugin_ref_body($args)
173175 $is_file_second = is_file($file);
174176
175177 // If the second argument is WikiName, or double-bracket-inserted pagename (compat)
176- $is_bracket_bracket = preg_match("/^($WikiName|\[\[$BracketName\]\])$/", $args[0]);
178+ $is_bracket_bracket = preg_match('/^(' . $WikiName . '|\[\[' . $BracketName . '\]\])$/', $args[0]);
177179
178180 if ($is_file_second && $is_bracket_bracket) {
179181 // Believe the second argument (compat)
@@ -307,7 +309,9 @@ function plugin_ref_body($args)
307309
308310 if (! empty($_title)) {
309311 $title = htmlsc(join(',', $_title));
310- if ($is_image) $title = make_line_rules($title);
312+ if ($is_image) {
313+ $title = make_line_rules($title);
314+ }
311315 }
312316 }
313317
@@ -335,7 +339,9 @@ function plugin_ref_body($args)
335339 $width = (int)($width * $params['_%'] / 100);
336340 $height = (int)($height * $params['_%'] / 100);
337341 }
338- if ($width && $height) $info = "width=\"$width\" height=\"$height\" ";
342+ if ($width && $height) {
343+ $info = 'width="' . $width . '" height="' . $height . '" ';
344+ }
339345 }
340346
341347 // アラインメント判定
@@ -348,12 +354,19 @@ function plugin_ref_body($args)
348354 }
349355
350356 if ($is_image) { // 画像
351- $params['_body'] = "<img src=\"$url\" alt=\"$title\" title=\"$title\" $info/>";
352- if (! $params['nolink'] && $url2)
353- $params['_body'] = "<a href=\"$url2\" title=\"$title\">{$params['_body']}</a>";
357+ $params['_body'] = '<img src="' . $url . '" ' .
358+ 'alt="' . $title . '" ' .
359+ 'title="' . $title . '" ' .
360+ $info . '/>';
361+ if (! $params['nolink'] && $url2) {
362+ $params['_body'] =
363+ '<a href="' . $url2 . '" title="' . $title . '">' .
364+ $params['_body'] . '</a>';
365+ }
354366 } else {
355367 $icon = $params['noicon'] ? '' : FILE_ICON;
356- $params['_body'] = "<a href=\"$url\" title=\"$info\">$icon$title</a>";
368+ $params['_body'] = '<a href="' . $url . '" title="' . $info . '">' .
369+ $icon . $title . '</a>';
357370 }
358371
359372 return $params;