Posted by on the 17th of January, 2013 at 10:57 pm under 컴퓨터.  Post is not tagged.  This post has no comments.

모바일 테마를 테마를 추가하면서 브라우저에 맞게 자동으로 테마를 바꿀 수 있도록 Any mobile theme switcher를 썼다. 그런데 이 플러그인이 다른건 다 좋은데 안드로이드 폰과 태블릿을 구분하지 않는다. 안드로이드면 무조건 설정한 테마를 보여준다.

안드로이드 폰과 태블릿을 구분할 수 있는지 찾아봤다. stackoverflow에서 원하는 결과를 찾았다. (link) 폰에는 태블릿과 달리 Mobile이라는 문자열이 들어간다. 단, 허니컴 이전 태블릿은 똑같이 Mobile이 들어간다. 그런데 뭐 허니컴 이전 태블릿은 태블릿이라 하기 뭐하니까 상관 없다.

Any mobile theme switcher에 android 문자열을 찾아서 tablet 관련 코드를 추가했다. 일단은 잘 동작한다. 수정사항을 제작자 게시판에 올맀는데 봤을려나? …


diff --git a/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php b/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php
index 5cde7ca..dd22df7 100644
--- a/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php
+++ b/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php
@@ -33,8 +33,16 @@ $accept           = $_SERVER['HTTP_ACCEPT']; // get the content accept value - t
break; // break out and skip the rest if we've had a match on the iphone or ipod

case (preg_match('/android/i',$user_agent));  // we find android in the user agent
-      $mobile_browser = get_option('android_theme'); // mobile browser is either true or false depending on the setting of android when calling the function
-      $status = 'Android';
+      if (preg_match('/mobile/i',$user_agent))
+      {
+        $mobile_browser = get_option('android_theme'); // mobile browser is either true or false depending on the setting of android when calling the function
+        $status = 'Android';
+      }
+      else
+      {
+        $mobile_browser = get_option('android_tablet_theme'); // mobile browser is either true or false depending on the setting of android when calling the function
+        $status = 'AndroidTablet';
+      }
break; // break out and skip the rest if we've had a match on android

case (preg_match('/opera mini/i',$user_agent)); // we find opera mini in the user agent
diff --git a/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php b/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php
index 1dbdd80..2a336fd 100644
--- a/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php
+++ b/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php
@@ -11,6 +11,7 @@ function register_mysettings_theme() {
register_setting('am-settings-group', 'iphone_theme');
register_setting('am-settings-group', 'ipad_theme');
register_setting('am-settings-group', 'android_theme');
+    register_setting('am-settings-group', 'android_tablet_theme');
register_setting('am-settings-group', 'blackberry_theme');
register_setting('am-settings-group', 'windows_theme');
register_setting('am-settings-group', 'opera_theme');
@@ -26,6 +27,7 @@ function am_settings_page() {
$iphoneTheme         = get_option('iphone_theme');
$ipadTheme            = get_option('ipad_theme');
$androidTheme        = get_option('android_theme');
+    $androidTabletTheme        = get_option('android_tablet_theme');
$blackberryTheme    = get_option('blackberry_theme');
$windowsTheme        = get_option('windows_theme');
$operaTheme            = get_option('opera_theme');
@@ -132,6 +134,24 @@ function am_settings_page() {
</tr>


+        <tr valign="top">
+        <th scope="row">Android Tablet Theme</th>
+        <td>
+            <select name="android_tablet_theme">
+     <?php
+      foreach ($themeNames as $themeName) {
+          if (($androidTabletTheme == $themeName) || (($androidTabletTheme == '') && ($themeName == $defaultTheme))) {
+              echo '<option value="' . $themeName . '" selected="selected">' . htmlspecialchars($themeName) . '</option>';
+          } else {
+              echo'<option value="' . $themeName . '">' . htmlspecialchars($themeName) . '</option>';
+          }
+      }
+     ?>
+            </select>
+        </td>
+        </tr>
+
+
<tr valign="top">
<th scope="row">Blackberry Theme</th>
<td>

Posted by on the 13th of January, 2013 at 8:12 pm under 보고읽고듣고.  Post is not tagged.  This post has 2 comments.

언제 읽었는지 기억도 안나는 ‘파이 이야기’. 내가 이런 책을 일부러 찾아서 볼 일이 없을테니 아마 군대에 있을 때 읽은거 같다. 그 이야기가 영화로 나왔다.

Life of Pi poster

읽은지 오래라 배가 난파돼서 호랑이랑 단 둘이 남아 살아남는다는 이야기만 기억에 남았는데 많은 이야기가 있었다. 그리고 글로 읽으면서 상상했던 많은 장면들이 정말 아름다웠다.

자세한 내용은 잘라야지. (read more)

Posted by on the 12th of January, 2013 at 8:05 pm under 컴퓨터.  Post is not tagged.  This post has no comments.

모바일 테마를 어떻게 할까 고민하다가 지금 쓰는 테마를 고쳤다. 원래 쓰던 테마가 1 column짜리라 모바일 테마로 만드는 것은 생각보다 쉬웠다. 모바일 브라우저에 따라 테마를 바꿔주는 건 Any Mobile Theme Switcher를 썼다.

아직은 블로그만 바꿨는데 위키랑 게시판까지 모바일 페이지로 천천히 바꿔야겠다.

Posted by on the 10th of January, 2013 at 10:50 pm under 컴퓨터.  Post is not tagged.  This post has one comment.

예전에 고민하고 6년만에 다시 고민중. 집에서 그다지 개발을 하지는 않지만 회사에서 모니터를 여러개 쓰다 보니 집에서 하나만 쓸 때 답답했다. 회사 일이 좀 조정되면서 개발을 예전처럼 많이 할 것 같지 않아 집에서 틈틈히 안드로이드 앱이나 만들까 하는데, 이 기회에 모니터 하나 들일까 고민 중.

지금 쓰고 있는 모니터는 BTC에서 나온 20.1인치. 만으로 6년째 쓰고 있는데 아직도 문제없이 잘 나오고 있다. 4:3 20.1 인치 모니터라 새로 사는 모니터는 16:10 24인치로 결정. 해상도가  1600×1200, 1920×1200으로 세로가 1200으로 같고 실제 화면 높이도 거의 비슷하다. (20.1인치: 40.8cm x 30.6cm, 24인치: 51.7cm x 32.3cm)

그런데 정작 제품을 못고르겠다. 회사에서 TN패널 24인치 모니터를 쓰면서 생각보다는 괜찮다고 느꼈다. 그렇지만 막상 사려니 IPS패널을 보고 있는데 요즘 나오는 주요 패널이 H-IPS 계열로 6bit+afr 기술을 이용해서 16만7천 색상을 표시하고 있다. 6년전에 샀던 모니터도 8bit 쓰는데 세월이 지날수록 뭔가 질은 떨어지는 느낌.

아무튼 후보를 정했다.

  • DELL UltraSharp U2412M
    가격은 저렴한데 H-IPS라 6bit+afr. 실제로 구분하기 어렵다 함.
  • HP ZR24w
    가격은 위에거 두배. 8bit. CCFL 백라이트라 발열도 있다 함.

합리적으로 보면 U2412M을 선택하면 되는데 이왕이면 때문에 HP ZR24w도 고민하고 있다. 실리냐 만족이냐로 고민 중.

Posted by on the 2nd of January, 2013 at 4:21 pm under 컴퓨터.  Post is not tagged.  This post has one comment.

글 링크가 영어가 아닐 때 읽을 수 없는 문제가 있었는데(link) 해결했다. 옮긴 서버 문제인지 뭔지 잘 모르겠지만, 워드프레스가 주소를 가지고 작업하는 도중에 문자열이 달라서 생긴 문제였다.

워드프레스 동작이 어떻게 되는지 잘 몰라서 헤맸는데, 어쨌든 REQUEST_URI를 쓸거라는 생각에 여기저기 뒤져보다가 원인을 찾았다. $_SERVER[‘PATH_INFO’]는 주소를 그대로 전달 해 주는데 $_SERVER[‘REQUEST_URI’]는 urlencode 한 값이 와서 그랬다. 그래서 urldecode 하도록 수정.

--- wp-includes/class-wp.php.orig       2013-01-02 16:09:46.000000000 +0900
+++ wp-includes/class-wp.php    2013-01-02 16:09:49.000000000 +0900
@@ -149,7 +149,7 @@
			$pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
			$req_uri = $_SERVER['REQUEST_URI'];
			$req_uri_array = explode('?', $req_uri);
-			$req_uri = $req_uri_array[0];
+			$req_uri = urldecode($req_uri_array[0]);
			$self = $_SERVER['PHP_SELF'];
			$home_path = parse_url(home_url());
			if ( isset($home_path['path']) )

2015년 2월 4일 추가. WordPress 4.1에서는 이렇게 고쳤다.

--- class-wp.php.orig   2015-02-03 23:44:44.000000000 +0900
+++ class-wp.php        2015-02-04 00:04:33.000000000 +0900
@@ -155,6 +155,7 @@
			$pathinfo = str_replace( "%", "%25", $pathinfo );

			list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
+			$req_uri = urldecode($req_uri);
			$self = $_SERVER['PHP_SELF'];
			$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );