April, 2012
What is a WordPress Shortcode?
Open a pair of PHP tags and write code to output the results of the “do_shortcode()” function. Pass the shortcode into “do_shortcode()” as a parameter, typing it out as a string. This is how it should look: <?php echo do_shortcode(‘[shortcode]’); ?> Use single quotes around the shortcode so you can type out a shortcode with an attribute containing double quotes, like this: <?php echo do_shortcode(‘[shortcode attribute=”setting”]’); ?>
Posted in Wordpress | Comments Off on What is a WordPress Shortcode?
Joomla makesafe
$regex = array(‘#(\.){2,}#’, ‘#\[^ぁ-んァ-ンァ-ン゙゚A-Za-z0-9\.\_\- ]#’, ‘#^\.#’); // Japanese $regex = array(‘#(\.){2,}#’, ‘#[^A-Za-z0-9\.\_\- ]#’, ‘#^\.#’); // Korean
Posted in PHP | Comments Off on Joomla makesafe
preg_match for Korean, Japanese, Chinese
한글, 한자, 일어를 검색하는 정규식은 아래와 같습니다. 예전에 블로그에 포스팅했던 내용이었습니다만… 여기에서 영문이나 특수문자를 허용하려면 [ ] 안에 더 적어주면 되겠죠. 주의할점 1. PCRE 정규식 사용시 식의 맨 처음과 끝부분은 구분자를 넣어줘야 합니다. 예를들어 영문 A~Z 를 대소문자 구별없이 찾고자 할때 @[a-z]@i 2. 정규식 내에 [ ] 안에 마이너스(-) 를 검색하고자 할때는 Escape 시켜줘야 합니다. 안그러면 범위 지정이 되어서 엉뚱한 결과가 나올 수 있습니다. @[a-z,.\-~]@i 위의 정규식과 아래 정규식은 결과가 조금 다릅니다. @[a-z,.-~]@i . 문자 부터 ~ 문자 사이를 지정하게 되는 식이 되버리니까요. // 예제 문자열 $content = “test content☆漢字〓韓國外交部對外稱, 應美方要求,韓國貿易部長金宗塤和美國貿易代表施瓦布本週一下午還舉行了一個「非正式磋商」。end◆ 日語〓慰謝料としてフルハウス(Full House)をあげるというィヨンジェの言葉に,ジウンは寝ても寝る事ができないで悩む。end◆ 한글〓해쉬(Hash)값 필터링 시스템(Filtering system)은 디지털 파일에 고유의 키 값을 매겨서 등록, 관리하는 것으로 저작권 침해 신고가 접수됐을 […]
Posted in PHP | Comments Off on preg_match for Korean, Japanese, Chinese
Services Single Sign-On Drupal
A.Setting up the SSO Server site. 1.Install Services 3.x and enable the main Services module plus the REST server. 2.Install Services single sign-on server helper 3.Set up an endpoint in Structure > Services with the following settings: Server: REST, Authentication: Session authentication 4.Under the “server” tab of the endpoint, make sure response formatters: json and request parsing: application/json application/x-www-form-urlencoded are checked. 5.Under the “resources” tab of the endpoint, enable user.retrieve, user.index, user.login and user.logout B.Setting up your SSO Client site. 1.SSO Client site. 2.Install the Services single sign-on client module 3.Under Configuration > Web services > Services single sign-on client settings, fill in the server address of the SSO […]
Posted in Drupal | Comments Off on Services Single Sign-On Drupal
The clean URL test failed.
-Check mod_rewrite in httpd.conf -In .htaccess-Check mod_rewrite in httpd.conf -In .htaccess <Directory /var/www/drupal> AllowOverride All </Directory> AccessFileName .htaccess restart
Posted in Drupal | Comments Off on The clean URL test failed.
How to use SortTable Post
SortTable Post [ sorttablepost ] HIDE STANDARD COLUMNS [ sorttablepost nothumb=”true” nodate=”true” nocats=”true” notags=”true” ] You can omit any undesired columns by using one or more of these shortcode options. SHOW CUSTOM POST TYPE [ sorttablepost type=”my-custom-post-type” ] You can specify the name of a custom post type (or `page`), instead of showing posts. USE CUSTOM TAXONOMIES [ sorttablepost cat=”my-custom-taxonomy” tag=”another-custom-taxonomy” ] You can replace the standard `Categories` or `Tags` columns (or both) with custom taxonomies. USE CUSTOM FIELDS [ sorttablepost meta=”Custom Field Key,Another Custom Field Key,Yet Another” ] As of version 4.0, you can add as many custom field columns as you like. Use a comma-seperated list of field […]
Posted in Wordpress | Comments Off on How to use SortTable Post
Limit word in the front widget
Front <?php echo limit_words(get_the_excerpt(), ‘5’); ?> function limit_words($string, $word_limit) { $words = explode(‘ ‘, $string); // this next bit chops the $words array and sticks it back together // starting at the first word ‘0’ and ending at the $word_limit // the $word_limit which is passed in the function will be the number // of words we want to use // implode glues the chopped up array back together using a space character return implode(‘ ‘, array_slice($words, 0, $word_limit)); }
Posted in Wordpress | Comments Off on Limit word in the front widget