diff --git a/common/lang/en.php b/common/lang/en.php index bff963a1c..5ec21ffc4 100644 --- a/common/lang/en.php +++ b/common/lang/en.php @@ -267,6 +267,7 @@ $lang->success_sended = 'Sent successfully.'; $lang->success_reset = 'Reset successfully.'; $lang->success_leaved = 'Your account has been closed successfully.'; $lang->success_saved = 'Saved successfully.'; +$lang->success_added = 'Added successfully.'; $lang->fail_to_registed = 'Failed to register.'; $lang->fail_to_update = 'Fail to update.'; $lang->fail_to_delete = 'Failed to delete.'; diff --git a/common/lang/ko.php b/common/lang/ko.php index 51462454c..f6ba251ec 100644 --- a/common/lang/ko.php +++ b/common/lang/ko.php @@ -269,6 +269,7 @@ $lang->success_sended = '발송했습니다.'; $lang->success_reset = '초기화했습니다.'; $lang->success_leaved = '탈퇴했습니다.'; $lang->success_saved = '저장했습니다.'; +$lang->success_added = '추가했습니다.'; $lang->fail_to_registed = '등록하지 못했습니다.'; $lang->fail_to_update = '수정하지 못했습니다.'; $lang->fail_to_delete = '삭제 실패했습니다.'; diff --git a/modules/editor/components/emoticon/emoticon.class.php b/modules/editor/components/emoticon/emoticon.class.php index f94d06049..14a7793e6 100644 --- a/modules/editor/components/emoticon/emoticon.class.php +++ b/modules/editor/components/emoticon/emoticon.class.php @@ -19,7 +19,7 @@ class emoticon extends EditorHandler { $this->editor_sequence = $editor_sequence; $this->component_path = $component_path; - $this->emoticon_path = sprintf('%s%s/images',preg_replace('/^\.\//i','',$this->component_path),'tpl','images'); + $this->emoticon_path = $this->component_path . 'tpl/images'; } /** @@ -28,39 +28,47 @@ class emoticon extends EditorHandler function getEmoticonList() { $emoticon = Context::get('emoticon'); - if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new BaseObject(-1,'msg_invalid_request'); - - $list = $this->getEmoticons($emoticon); - - $this->add('emoticons', $list); + if(!$emoticon || !preg_match('/^[a-z0-9\_]+$/i', $emoticon)) + { + return new BaseObject(-1, 'msg_invalid_request'); + } + + $this->add('emoticons', $this->getEmoticons($emoticon)); } /** * @brief Likely to be recursively emoticons will search all the files to a subdirectory. 8000 gaekkajineun ran tests whether the stack and raise beef pro-overs and Unsure. (06/09/2007, Benny) */ - function getEmoticons($path) + function getEmoticons($emoticon) { - $emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path); - $output = array(); - - $oDir = dir($emoticon_path); - while($file = $oDir->read()) + $emoticon_path = sprintf('%s/%s', $this->emoticon_path, $emoticon); + $emoticon_url = RX_BASEURL . preg_replace('@^\./@', '', $emoticon_path) . '/'; + if(!$emoticon_files = Rhymix\Framework\Storage::readDirectory($emoticon_path)) { - if(substr($file,0,1)=='.') continue; - if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) { - $svg = null; - $filename = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file)); - list($width, $height, $type, $attr) = getimagesize($emoticon_path . '/'. $file); - - if(file_exists (($emoticon_path . '/svg/'. substr($file, 0, -4) . '.svg'))) { - $svg = sprintf("%s/svg/%s", $path, str_replace($this->emoticon_path,'',substr($file, 0, -4) . '.svg')); - } - - $output[] = array('filename' => $filename, 'width' => $width, 'height' => $height, 'svg' => $svg, 'alt' => substr($file, 0, -4)); - } + return array(); } - $oDir->close(); - if(count($output)) asort($output); + + $output = array(); + foreach($emoticon_files as $file) + { + if(!preg_match('/\.(jpg|jpeg|gif|png)$/i', $file)) + { + continue; + } + + $file_name = basename($file); + list($file_width, $file_height) = getimagesize($file); + $svg_name = preg_replace('@\.[^.]+$@', '', $file_name) . '.svg'; + + $output[] = array( + 'url' => $emoticon_url . $file_name, + 'width' => $file_width, + 'height' => file_height, + 'svg' => file_exists(sprintf('%s/svg/%s', $emoticon_path, $svg_name)) ? ($emoticon_url . 'svg/' . $svg_name) : '', + 'alt' => $file_name, + ); + } + asort($output); return $output; } diff --git a/modules/editor/components/emoticon/tpl/popup.html b/modules/editor/components/emoticon/tpl/popup.html index 6a6926f7d..fc18e58e4 100644 --- a/modules/editor/components/emoticon/tpl/popup.html +++ b/modules/editor/components/emoticon/tpl/popup.html @@ -1,6 +1,9 @@ {@Context::addMetaTag('viewport', 'width=device-width', FALSE);} +

{$component_info->title}

diff --git a/modules/editor/components/emoticon/tpl/popup.js b/modules/editor/components/emoticon/tpl/popup.js index 1acbb35bc..3aadcdfb7 100644 --- a/modules/editor/components/emoticon/tpl/popup.js +++ b/modules/editor/components/emoticon/tpl/popup.js @@ -23,17 +23,17 @@ function completeGetEmoticons(ret_obj) { .width( parseInt(emoticons[i].width, 10)) .height(parseInt(emoticons[i].height, 10)) .attr({ - 'src': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].filename, - 'data-src': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].filename, + 'src': emoticons[i].url, + 'data-src': emoticons[i].url, 'alt': emoticons[i].alt }); if( emoticons[i].svg ) { $img.attr({ - 'data-svg': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].svg + 'data-svg': emoticons[i].svg }); if( typeof SVGRect !== "undefined" ) { $img.attr({ - 'src': './modules/editor/components/emoticon/tpl/images/'+emoticons[i].svg + 'src': emoticons[i].svg }); } } @@ -67,7 +67,8 @@ function insertEmoticon(obj) { win.editorRelKeys[win.editorPrevSrl].pasteHTML(html); if (is_popup) window.focus(); - + + rhymix_alert(lang_success_added); return false; }