Changeset 3061759
- Timestamp:
- 03/31/2024 01:39:34 PM (23 months ago)
- Location:
- kama-wp-smile
- Files:
-
- 6 added
- 2 deleted
- 15 edited
- 1 copied
-
assets/banner-772x250.jpg (modified) (1 prop) (previous)
-
assets/icon-128x128.png (modified) (1 prop) (previous)
-
assets/icon-256x256.png (modified) (1 prop) (previous)
-
assets/screenshot-1.png (modified) (1 prop) (previous)
-
assets/screenshot-2.png (modified) (1 prop) (previous)
-
assets/screenshot-3.png (modified) (1 prop) (previous)
-
assets/screenshot-4.png (modified) (1 prop) (previous)
-
tags/1.9.13 (copied) (copied from kama-wp-smile/trunk)
-
tags/1.9.13/Kama_WP_Smiles_Admin.php (added)
-
tags/1.9.13/TODO.md (added)
-
tags/1.9.13/class.Kama_WP_Smiles.php (modified) (7 diffs)
-
tags/1.9.13/class.Kama_WP_Smiles_Admin.php (deleted)
-
tags/1.9.13/functions.php (added)
-
tags/1.9.13/kama_wp_smiles.php (modified) (3 diffs)
-
tags/1.9.13/readme.txt (modified) (3 diffs)
-
tags/1.9.13/uninstall.php (modified) (4 diffs)
-
trunk/Kama_WP_Smiles_Admin.php (added)
-
trunk/TODO.md (added)
-
trunk/class.Kama_WP_Smiles.php (modified) (7 diffs)
-
trunk/class.Kama_WP_Smiles_Admin.php (deleted)
-
trunk/functions.php (added)
-
trunk/kama_wp_smiles.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/uninstall.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kama-wp-smile/assets/banner-772x250.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
kama-wp-smile/assets/icon-128x128.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
kama-wp-smile/assets/icon-256x256.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
kama-wp-smile/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
kama-wp-smile/assets/screenshot-2.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
kama-wp-smile/assets/screenshot-3.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
kama-wp-smile/assets/screenshot-4.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
kama-wp-smile/tags/1.9.13/class.Kama_WP_Smiles.php
r2484455 r3061759 184 184 function _smiles_replace_cb( $match ){ 185 185 186 // сначала заменяем полные патерны с названием файла- (:smile:)186 // first replace the full paternas with the file name - (:smile:) 187 187 $filename = isset( $match[1] ) ? $match[1] : ''; 188 188 if( $filename ){ 189 if( in_array( $filename, $this->get_opt( 'all_sm' ) ) ){189 if( in_array( $filename, $this->get_opt( 'all_sm' ), true ) ){ 190 190 return sprintf( self::$sm_img, $match[1], $match[1] ); 191 191 } 192 else{ 193 return '<span title="' . $filename . '.' . $this->get_opt( 'file_ext' ) . ' - no smiley file...">--</span>'; 194 } 195 } 196 // теперь специальные обозначения 197 else{ 198 $hard_sm = $this->get_opt( 'hard_sm' ); 199 if( $hard_sm && isset( $hard_sm[ $match[0] ] ) ){ 200 return sprintf( self::$sm_img, $hard_sm[ $match[0] ], $hard_sm[ $match[0] ] ); 201 } 192 193 return '<span title="' . $filename . '.' . $this->get_opt( 'file_ext' ) . ' - no smiley file...">--</span>'; 194 } 195 196 // now special signs 197 $hard_sm = $this->get_opt( 'hard_sm' ); 198 if( $hard_sm && isset( $hard_sm[ $match[0] ] ) ){ 199 return sprintf( self::$sm_img, $hard_sm[ $match[0] ], $hard_sm[ $match[0] ] ); 202 200 } 203 201 … … 206 204 207 205 function footer_scripts(){ 208 if( ! is_singular() || ( isset($GLOBALS['post']) && $GLOBALS['post']->comment_status != 'open' ) ) 206 global $post; 207 208 if( ( $post && $post->comment_status !== 'open' ) || ! is_singular() ){ 209 209 return; 210 } 210 211 211 212 $all_smile = addslashes( $this->get_all_smile_html( $this->get_opt('textarea_id') ) ); … … 214 215 <!-- Kama WP Smiles --> 215 216 <?php echo $this->insert_smile_js(); ?> 216 <script type="text/javascript"> 217 <script id="kama_wp_smile"> 218 (function(){ 217 219 var tx = document.getElementById('<?php echo $this->get_opt('textarea_id') ?>'); 218 220 if( tx ){ 219 var 220 txNext = tx.nextSibling, 221 txPar = tx.parentNode, 222 txWrapper = document.createElement('DIV'); 221 var txNext = tx.nextSibling; 222 var txPar = tx.parentNode; 223 var txWrapper = document.createElement( 'DIV' ); 223 224 224 225 txWrapper.innerHTML = '<?php echo $all_smile ?>'; 225 txWrapper.setAttribute( 'class', 'kws-wrapper');226 txWrapper.appendChild( tx);227 tx Wrapper = txPar.insertBefore(txWrapper, txNext);226 txWrapper.setAttribute( 'class', 'kws-wrapper' ); 227 txWrapper.appendChild( tx ); 228 txPar.insertBefore( txWrapper, txNext ); 228 229 } 230 })() 229 231 </script> 230 232 <?php … … 242 244 onmouseover=" 243 245 var el = this.childNodes[0]; 244 if( el.style.display == \'block\' ) return; 246 if( el.style.display === \'block\' ) 247 return; 245 248 246 249 el.style.display=\'block\'; … … 297 300 * Callback for `wp_head` adds styles. 298 301 */ 299 function styles(){302 public function styles(){ 300 303 301 304 if( ! is_singular() || $GLOBALS['post']->comment_status !== 'open' ){ … … 306 309 } 307 310 308 function main_css(){311 public function main_css(){ 309 312 ob_start(); 310 313 ?> … … 389 392 * @return array 390 393 */ 391 function get_dir_smile_names( $dir = '' ){394 public function get_dir_smile_names( $dir = '' ){ 392 395 $out = []; 393 396 394 if( ! $dir ) 397 if( ! $dir ){ 395 398 $dir = $this->pack_path; 399 } 396 400 397 401 foreach( glob( trailingslashit( $dir ) . '*.{gif,png}', GLOB_BRACE ) as $fpath ){ -
kama-wp-smile/tags/1.9.13/kama_wp_smiles.php
r2484186 r3061759 11 11 * Domain Path: /languages 12 12 * 13 * Requires PHP: 5. 413 * Requires PHP: 5.6 14 14 * 15 * Version: 1.9.1 215 * Version: 1.9.13 16 16 */ 17 17 18 $data = get_file_data( __FILE__, [ 'ver' => 'Version', 'lang_dir' =>'Domain Path' ] );18 $data = get_file_data( __FILE__, [ 'ver' => 'Version', 'lang_dir' => 'Domain Path' ] ); 19 19 20 20 define( 'KWS_VER', $data['ver'] ); … … 22 22 define( 'KWS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 23 23 24 require_once KWS_PLUGIN_PATH . 'class.Kama_WP_Smiles.php'; 24 require_once __DIR__ . '/functions.php'; 25 require_once __DIR__ . '/Kama_WP_Smiles.php'; 25 26 26 27 if( is_admin() && ! defined( 'DOING_AJAX' ) ){ 27 require_once KWS_PLUGIN_PATH . 'class.Kama_WP_Smiles_Admin.php';28 require_once __DIR__ . '/Kama_WP_Smiles_Admin.php'; 28 29 } 29 30 … … 41 42 42 43 43 register_activation_hook( __FILE__, function(){44 Kama_WP_Smiles::instance()->activation();44 register_activation_hook( __FILE__, static function(){ 45 kwsmile()->activation(); 45 46 } ); 46 47 47 48 48 /**49 * Gets plugin instance.50 *51 * @return Kama_WP_Smiles|Kama_WP_Smiles_Admin52 */53 function kwsmile(){54 return Kama_WP_Smiles::instance();55 }56 57 /**58 * Gets smiles HTML for specified textarea.59 *60 * @param string $textarea_id textarea ID61 * @return string HTML62 */63 function kws_get_smiles_html( $textarea_id ){64 return kwsmile()->get_all_smile_html( $textarea_id ) . kwsmile()->insert_smile_js();65 }66 67 /**68 * Convert smiles code to HTML IMG in passed content.69 *70 * @param string $content Content where need smiles convert71 * @return string Filtered content72 */73 function kws_convert_smiles( $content ){74 return kwsmile()->convert_smilies( $content );75 }76 49 77 50 78 // DEPRECATED --------------79 80 function kama_sm_get_smiles_code( $textarea_id ){81 _deprecated_function( __FUNCTION__, '1.9.0', 'kws_get_smiles_html()' );82 83 return kws_get_smiles_html( $textarea_id );84 }85 86 -
kama-wp-smile/tags/1.9.13/readme.txt
r2484455 r3061759 1 1 === Kama WP Smiles === 2 Stable tag: trunk3 Tested up to: 5.62 Stable tag: 1.9.13 3 Tested up to: 6.4.3 4 4 Contributors: Tkama 5 Official website: http://wp-kama.ru ?p=1856 Requires at least: 3.0.15 Official website: http://wp-kama.ru/185 6 Requires at least: 4.7.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 Tags: comments, smiles, posts, optimization9 Tags: comments, smiles, stickers 10 10 11 Replace W P smilies (emoticons) to pretty dynamic one. Automaticaly add smiley block to comment form and in visual/HTML editor on admin. You can set your own package of smiles or select preferred from existing list.11 Replace WordPress emoticons with dynamic smileys, adding a smiley block to comment forms and admin editor. Pick from existing or create custom sets. 12 12 13 13 14 14 == Description == 15 15 16 Kama WP Smiles adds block with smiles to comment form in your theme and to HTML/visual editor in admin panel. All that allows you easily add smiles into comment or post content. The plugin replace original WordPress emoticons by new pretty dinamic one (gif).16 Kama WP Smiles enhances your WordPress experience by seamlessly incorporating a smiley block into the comment form of your theme and the HTML/visual editor in the admin panel. This feature simplifies the process of adding smiles to your comments or posts. The plugin replaces the standard WordPress emoticons with lively and animated GIF smileys. 17 17 18 With Kama WP Smiles visitors of you blog will have easy instrument to add smiles in comments and you will have opportunity to add smiles while writing posts or answer comments.18 With Kama WP Smiles, visitors to your blog can effortlessly insert smiles into their comments, while you gain the ability to enhance your posts or respond to comments with smiles of your own. 19 19 20 On plugin settings page, you can choose which of accessible smiles will appear in the smiles block. And you can tune smiles special code like :) which will be replaced on smile image in content. Moreover you can add your own package of any images and use it as smiles.20 In the plugin settings, you have the option to select which smileys appear in the smiley block. Additionally, you can customize the special codes, such as :) , which trigger the replacement with smiley images in your content. Furthermore, you have the freedom to create and utilize your own set of smiley images. 21 21 22 If you don't enjoy the plugin, you can just delete it. On uninstall, plugin will clean up after itself.22 Should you decide the plugin isn't for you, uninstalling it is a breeze. The plugin ensures a clean removal process, leaving no trace behind. 23 23 24 [ Official plugin page](http://wp-kama.ru/?p=185)24 [Plugin page](http://wp-kama.ru/185) 25 25 26 26 … … 29 29 == Frequently Asked Questions == 30 30 31 = Plugin don't add smile block tocomment form =31 = Plugin don't add smile block for the comment form = 32 32 33 May be, you comment form textarea HTML tag have not default ID attribute. Specify comment form ID attribute tag on settings page. Default is `comment`33 Maybe, you comment form textarea HTML tag have not default ID attribute. Specify comment form ID attribute tag on settings page. Default is `comment` 34 34 35 35 … … 60 60 61 61 62 ===== TODO =====63 64 Поддержка Quick Chat и BbPress65 66 На мой взгляд - это:67 68 1. Кнопки (в настройках) > Раскрытие списка смайлов (выпадающий список) > при подведении к значку ИЛИ нажатию на него (или так или так) — (переключатель в настройках!!!)69 70 — Когда нажимаешь на значок смайла > раскрывается меню > !!! НЕ РЕАЛИЗОВАНО !!!!71 (не всегда удобно когда подводишь и раскрывается список, порой даже мешает)72 73 74 2.75 — Выпадающий список > наверное тоже самое что пункт 1. только со значком рядом " стрелочка вниз " - (">" только повёрнутая вниз) —---( справа или слева, лучше справа)76 77 Т.е Отображается смайл и рядом с ним значок (">" только повёрнутая вниз) в виде кнопки (НЕ КРИТИЧНО при полной реализации п.1) - такой переключатель в настройках тоже был бы многим удобен и полезен (или так или так).78 79 80 4.81 — Возможность (в настройках плагина) Расширять и сужать сетку смайлов, при раскрытии меню смайлов = отображать количество колонок и столбцов !!!82 Т.е - (нажимаешь на смайл или подводишь мышь к нему) = > отображение сетки = (8 столбцов + 16 строк) или (16 столбцов + 16 строк) ..... например (1x2-20) (1-20x1) (2x20) (3x4) (4x3) (5x32) (16x20) итд итп! т.е произвольные параметры в настройках плагина (кол-во столбцов = " X " ; кол-во строк = " X ") !!!83 84 85 8.86 - Безопасность:87 88 /wp-content/plugins/kama-wp-smile/smiles/*.gif89 Папки:90 /wp-content - есть возможность скрыть с91 помощью сторонних плагинов92 /plugins/ - есть возможность скрыть с помощью сторонних плагинов93 94 /kama-wp-smile/smiles/*.gif - Название плагина даёт определить по коду страницы или открытию смайла в новом что установлен wordpress.95 96 Рекомендую сменить название (Убрать wp из имени папки, .... не плагина!)97 - Сделать вообще просто папку Smile или (Kama)98 99 Например /wp-content/plugins/smile/smiles/*.gif - так точно сразу не определишь!!!100 Например /wp-content/plugins/kama/smiles/*.gif - так точно сразу не определишь!!!ъ101 т.е будет в коде отображаться /kama/smiles/*.gif102 т.е будет в коде отображаться *****/*****/kama/smiles/*.gif103 104 Спасибо за внимание.105 106 107 108 109 62 == Changelog == 110 63 111 64 = 1.9.13 = 65 * UPD: WP Version up. 112 66 * NEW: filter `kwsmile__insert_smile_space`. 113 67 -
kama-wp-smile/tags/1.9.13/uninstall.php
r2461097 r3061759 1 1 <?php 2 2 3 if( ! defined('WP_UNINSTALL_PLUGIN') )exit;3 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 4 4 5 if( ! defined( 'KWS_PLUGIN_PATH') ){6 define( 'KWS_PLUGIN_PATH', plugin_dir_path(__FILE__) );5 if( ! defined( 'KWS_PLUGIN_PATH' ) ){ 6 define( 'KWS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 7 7 8 require_once plugin_dir_path(__FILE__) .'class.Kama_WP_Smiles.php'; 8 require_once __DIR__ . '/functions.php'; 9 require_once __DIR__ . '/Kama_WP_Smiles.php'; 9 10 } 10 11 … … 12 13 13 14 function kws_unistall_init(){ 14 global $wpdb;15 15 16 16 delete_option( 'kwsmile_version' ); … … 22 22 23 23 // delete smiles in content 24 if(1){ 25 26 // collect all names from all folders 27 $names = array(); 28 foreach( glob(KWS_PLUGIN_PATH .'packs/*') as $dir ){ 29 if( is_dir($dir) ) 30 $names = array_merge( $names, Kama_WP_Smiles::get_dir_smile_names($dir) ); 31 } 32 foreach( glob(untrailingslashit(KWS_PLUGIN_PATH) .'-packs/*') as $dir ){ 33 if( is_dir($dir) ) 34 $names = array_merge( $names, Kama_WP_Smiles::get_dir_smile_names($dir) ); 35 } 36 37 $names = array_unique( $names ); 38 39 // split huge number of names into sets by 100 40 $all_count = count( $names ); 41 $split_names = array(); 42 $start_from = 0; // start 43 while(true){ 44 $split_names[] = array_slice( $names, $start_from, 100 ); 45 46 if( $start_from > $all_count ) 47 break; // stop 48 49 $start_from += 100; 50 } 24 _kws_delete_smiles_in_content(); 51 25 52 26 53 // delete sets54 $affected_rows = 0;55 foreach( $split_names as $names ){ 27 // delete custom created packs - the folder `/wp-content/plugins/kama-wp-smile-packs` 28 _kws_delete_folder( untrailingslashit( KWS_PLUGIN_PATH ) . '-packs' ); 29 } 56 30 57 // multiple replace query - REPLACE( REPLACE( REPLACE( __FIELDNAME__, '(:acute:)', ''), '(:aggressive:)', ''), '(:air_kiss:)', '') 58 $REPLACE_patt = ''; 59 foreach( $names as $val ){ 31 function _kws_delete_smiles_in_content(){ 32 global $wpdb; 60 33 61 if( $val = preg_replace('/[^a-zA-Z0-9_-]/', '', $val ) ){ 62 $smile_code = Kama_WP_Smiles::$sm_start . $val . Kama_WP_Smiles::$sm_end; 63 $REPLACE_patt = str_replace( 64 array( '__FIELDNAME__', '__SMILECODE__' ), 65 array( ($REPLACE_patt ? $REPLACE_patt : '__FIELDNAME__'), $smile_code ), 66 "REPLACE( __FIELDNAME__, '__SMILECODE__', '')" 67 ); 68 } 69 } 70 71 if( $REPLACE_patt ){ 72 $affected_rows += $wpdb->query( 73 "UPDATE $wpdb->posts SET post_content = ". str_replace( '__FIELDNAME__', 'post_content', $REPLACE_patt ) ." WHERE post_type NOT IN ('attachment','revision','nav_meny_item')" 74 ); 75 76 $affected_rows += $wpdb->query( 77 "UPDATE $wpdb->comments SET comment_content = ". str_replace( '__FIELDNAME__', 'comment_content', $REPLACE_patt ) ."" 78 ); 79 } 80 34 // collect all names from all folders 35 $names = []; 36 foreach( glob( KWS_PLUGIN_PATH . 'packs/*' ) as $dir ){ 37 if( is_dir( $dir ) ){ 38 /** @noinspection SlowArrayOperationsInLoopInspection */ 39 $names = array_merge( $names, kwsmile()->get_dir_smile_names( $dir ) ); 40 } 41 } 42 foreach( glob( untrailingslashit( KWS_PLUGIN_PATH ) . '-packs/*' ) as $dir ){ 43 if( is_dir( $dir ) ){ 44 /** @noinspection SlowArrayOperationsInLoopInspection */ 45 $names = array_merge( $names, kwsmile()->get_dir_smile_names( $dir ) ); 81 46 } 82 47 } 83 48 84 // delete custom created packs - the folder `/wp-content/plugins/kama-wp-smile-packs` 85 _kws_delete_folder( untrailingslashit(KWS_PLUGIN_PATH) .'-packs' ); 49 $names = array_unique( $names ); 50 51 // split huge number of names into sets by 100 52 $all_count = count( $names ); 53 $split_names = []; 54 $start_from = 0; // start 55 while( true ){ 56 $split_names[] = array_slice( $names, $start_from, 100 ); 57 58 if( $start_from > $all_count ){ 59 break; 60 } 61 62 $start_from += 100; 63 } 64 65 // delete sets 66 $affected_rows = 0; 67 foreach( $split_names as $names ){ 68 69 // multiple replace query - REPLACE( REPLACE( REPLACE( __FIELDNAME__, '(:acute:)', ''), '(:aggressive:)', ''), '(:air_kiss:)', '') 70 $REPLACE_patt = ''; 71 foreach( $names as $val ){ 72 73 if( $val = preg_replace( '/[^a-zA-Z0-9_-]/', '', $val ) ){ 74 75 $smile_code = Kama_WP_Smiles::$sm_start . $val . Kama_WP_Smiles::$sm_end; 76 77 $REPLACE_patt = str_replace( 78 [ '__FIELDNAME__', '__SMILECODE__' ], 79 [ ( $REPLACE_patt ?: '__FIELDNAME__' ), $smile_code ], 80 "REPLACE( __FIELDNAME__, '__SMILECODE__', '')" 81 ); 82 } 83 } 84 85 if( $REPLACE_patt ){ 86 $affected_rows += $wpdb->query( $wpdb->prepare( 87 "UPDATE $wpdb->posts SET post_content = %s WHERE post_type NOT IN ( 'attachment', 'revision', 'nav_meny_item' )", 88 str_replace( '__FIELDNAME__', 'post_content', $REPLACE_patt ) 89 ) ); 90 91 $affected_rows += $wpdb->query( $wpdb->prepare( 92 "UPDATE $wpdb->comments SET comment_content = %s", 93 str_replace( '__FIELDNAME__', 'comment_content', $REPLACE_patt ) 94 ) ); 95 } 96 } 86 97 } 87 98 … … 95 106 96 107 $glod = glob( "$folder_path/{,.}[!.,!..]*", GLOB_BRACE ); 108 97 109 foreach( $glod as $file ){ 98 if( is_dir( $file) )110 if( is_dir( $file ) ){ 99 111 call_user_func( __FUNCTION__, $file ); 100 else 112 } 113 else{ 101 114 unlink( $file ); 115 } 102 116 } 103 117 104 if( $delete_self ) 118 if( $delete_self ){ 105 119 rmdir( $folder_path ); 120 } 106 121 } -
kama-wp-smile/trunk/class.Kama_WP_Smiles.php
r2484455 r3061759 184 184 function _smiles_replace_cb( $match ){ 185 185 186 // сначала заменяем полные патерны с названием файла- (:smile:)186 // first replace the full paternas with the file name - (:smile:) 187 187 $filename = isset( $match[1] ) ? $match[1] : ''; 188 188 if( $filename ){ 189 if( in_array( $filename, $this->get_opt( 'all_sm' ) ) ){189 if( in_array( $filename, $this->get_opt( 'all_sm' ), true ) ){ 190 190 return sprintf( self::$sm_img, $match[1], $match[1] ); 191 191 } 192 else{ 193 return '<span title="' . $filename . '.' . $this->get_opt( 'file_ext' ) . ' - no smiley file...">--</span>'; 194 } 195 } 196 // теперь специальные обозначения 197 else{ 198 $hard_sm = $this->get_opt( 'hard_sm' ); 199 if( $hard_sm && isset( $hard_sm[ $match[0] ] ) ){ 200 return sprintf( self::$sm_img, $hard_sm[ $match[0] ], $hard_sm[ $match[0] ] ); 201 } 192 193 return '<span title="' . $filename . '.' . $this->get_opt( 'file_ext' ) . ' - no smiley file...">--</span>'; 194 } 195 196 // now special signs 197 $hard_sm = $this->get_opt( 'hard_sm' ); 198 if( $hard_sm && isset( $hard_sm[ $match[0] ] ) ){ 199 return sprintf( self::$sm_img, $hard_sm[ $match[0] ], $hard_sm[ $match[0] ] ); 202 200 } 203 201 … … 206 204 207 205 function footer_scripts(){ 208 if( ! is_singular() || ( isset($GLOBALS['post']) && $GLOBALS['post']->comment_status != 'open' ) ) 206 global $post; 207 208 if( ( $post && $post->comment_status !== 'open' ) || ! is_singular() ){ 209 209 return; 210 } 210 211 211 212 $all_smile = addslashes( $this->get_all_smile_html( $this->get_opt('textarea_id') ) ); … … 214 215 <!-- Kama WP Smiles --> 215 216 <?php echo $this->insert_smile_js(); ?> 216 <script type="text/javascript"> 217 <script id="kama_wp_smile"> 218 (function(){ 217 219 var tx = document.getElementById('<?php echo $this->get_opt('textarea_id') ?>'); 218 220 if( tx ){ 219 var 220 txNext = tx.nextSibling, 221 txPar = tx.parentNode, 222 txWrapper = document.createElement('DIV'); 221 var txNext = tx.nextSibling; 222 var txPar = tx.parentNode; 223 var txWrapper = document.createElement( 'DIV' ); 223 224 224 225 txWrapper.innerHTML = '<?php echo $all_smile ?>'; 225 txWrapper.setAttribute( 'class', 'kws-wrapper');226 txWrapper.appendChild( tx);227 tx Wrapper = txPar.insertBefore(txWrapper, txNext);226 txWrapper.setAttribute( 'class', 'kws-wrapper' ); 227 txWrapper.appendChild( tx ); 228 txPar.insertBefore( txWrapper, txNext ); 228 229 } 230 })() 229 231 </script> 230 232 <?php … … 242 244 onmouseover=" 243 245 var el = this.childNodes[0]; 244 if( el.style.display == \'block\' ) return; 246 if( el.style.display === \'block\' ) 247 return; 245 248 246 249 el.style.display=\'block\'; … … 297 300 * Callback for `wp_head` adds styles. 298 301 */ 299 function styles(){302 public function styles(){ 300 303 301 304 if( ! is_singular() || $GLOBALS['post']->comment_status !== 'open' ){ … … 306 309 } 307 310 308 function main_css(){311 public function main_css(){ 309 312 ob_start(); 310 313 ?> … … 389 392 * @return array 390 393 */ 391 function get_dir_smile_names( $dir = '' ){394 public function get_dir_smile_names( $dir = '' ){ 392 395 $out = []; 393 396 394 if( ! $dir ) 397 if( ! $dir ){ 395 398 $dir = $this->pack_path; 399 } 396 400 397 401 foreach( glob( trailingslashit( $dir ) . '*.{gif,png}', GLOB_BRACE ) as $fpath ){ -
kama-wp-smile/trunk/kama_wp_smiles.php
r2484186 r3061759 11 11 * Domain Path: /languages 12 12 * 13 * Requires PHP: 5. 413 * Requires PHP: 5.6 14 14 * 15 * Version: 1.9.1 215 * Version: 1.9.13 16 16 */ 17 17 18 $data = get_file_data( __FILE__, [ 'ver' => 'Version', 'lang_dir' =>'Domain Path' ] );18 $data = get_file_data( __FILE__, [ 'ver' => 'Version', 'lang_dir' => 'Domain Path' ] ); 19 19 20 20 define( 'KWS_VER', $data['ver'] ); … … 22 22 define( 'KWS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 23 23 24 require_once KWS_PLUGIN_PATH . 'class.Kama_WP_Smiles.php'; 24 require_once __DIR__ . '/functions.php'; 25 require_once __DIR__ . '/Kama_WP_Smiles.php'; 25 26 26 27 if( is_admin() && ! defined( 'DOING_AJAX' ) ){ 27 require_once KWS_PLUGIN_PATH . 'class.Kama_WP_Smiles_Admin.php';28 require_once __DIR__ . '/Kama_WP_Smiles_Admin.php'; 28 29 } 29 30 … … 41 42 42 43 43 register_activation_hook( __FILE__, function(){44 Kama_WP_Smiles::instance()->activation();44 register_activation_hook( __FILE__, static function(){ 45 kwsmile()->activation(); 45 46 } ); 46 47 47 48 48 /**49 * Gets plugin instance.50 *51 * @return Kama_WP_Smiles|Kama_WP_Smiles_Admin52 */53 function kwsmile(){54 return Kama_WP_Smiles::instance();55 }56 57 /**58 * Gets smiles HTML for specified textarea.59 *60 * @param string $textarea_id textarea ID61 * @return string HTML62 */63 function kws_get_smiles_html( $textarea_id ){64 return kwsmile()->get_all_smile_html( $textarea_id ) . kwsmile()->insert_smile_js();65 }66 67 /**68 * Convert smiles code to HTML IMG in passed content.69 *70 * @param string $content Content where need smiles convert71 * @return string Filtered content72 */73 function kws_convert_smiles( $content ){74 return kwsmile()->convert_smilies( $content );75 }76 49 77 50 78 // DEPRECATED --------------79 80 function kama_sm_get_smiles_code( $textarea_id ){81 _deprecated_function( __FUNCTION__, '1.9.0', 'kws_get_smiles_html()' );82 83 return kws_get_smiles_html( $textarea_id );84 }85 86 -
kama-wp-smile/trunk/readme.txt
r2484455 r3061759 1 1 === Kama WP Smiles === 2 Stable tag: trunk3 Tested up to: 5.62 Stable tag: 1.9.13 3 Tested up to: 6.4.3 4 4 Contributors: Tkama 5 Official website: http://wp-kama.ru ?p=1856 Requires at least: 3.0.15 Official website: http://wp-kama.ru/185 6 Requires at least: 4.7.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 Tags: comments, smiles, posts, optimization9 Tags: comments, smiles, stickers 10 10 11 Replace W P smilies (emoticons) to pretty dynamic one. Automaticaly add smiley block to comment form and in visual/HTML editor on admin. You can set your own package of smiles or select preferred from existing list.11 Replace WordPress emoticons with dynamic smileys, adding a smiley block to comment forms and admin editor. Pick from existing or create custom sets. 12 12 13 13 14 14 == Description == 15 15 16 Kama WP Smiles adds block with smiles to comment form in your theme and to HTML/visual editor in admin panel. All that allows you easily add smiles into comment or post content. The plugin replace original WordPress emoticons by new pretty dinamic one (gif).16 Kama WP Smiles enhances your WordPress experience by seamlessly incorporating a smiley block into the comment form of your theme and the HTML/visual editor in the admin panel. This feature simplifies the process of adding smiles to your comments or posts. The plugin replaces the standard WordPress emoticons with lively and animated GIF smileys. 17 17 18 With Kama WP Smiles visitors of you blog will have easy instrument to add smiles in comments and you will have opportunity to add smiles while writing posts or answer comments.18 With Kama WP Smiles, visitors to your blog can effortlessly insert smiles into their comments, while you gain the ability to enhance your posts or respond to comments with smiles of your own. 19 19 20 On plugin settings page, you can choose which of accessible smiles will appear in the smiles block. And you can tune smiles special code like :) which will be replaced on smile image in content. Moreover you can add your own package of any images and use it as smiles.20 In the plugin settings, you have the option to select which smileys appear in the smiley block. Additionally, you can customize the special codes, such as :) , which trigger the replacement with smiley images in your content. Furthermore, you have the freedom to create and utilize your own set of smiley images. 21 21 22 If you don't enjoy the plugin, you can just delete it. On uninstall, plugin will clean up after itself.22 Should you decide the plugin isn't for you, uninstalling it is a breeze. The plugin ensures a clean removal process, leaving no trace behind. 23 23 24 [ Official plugin page](http://wp-kama.ru/?p=185)24 [Plugin page](http://wp-kama.ru/185) 25 25 26 26 … … 29 29 == Frequently Asked Questions == 30 30 31 = Plugin don't add smile block tocomment form =31 = Plugin don't add smile block for the comment form = 32 32 33 May be, you comment form textarea HTML tag have not default ID attribute. Specify comment form ID attribute tag on settings page. Default is `comment`33 Maybe, you comment form textarea HTML tag have not default ID attribute. Specify comment form ID attribute tag on settings page. Default is `comment` 34 34 35 35 … … 60 60 61 61 62 ===== TODO =====63 64 Поддержка Quick Chat и BbPress65 66 На мой взгляд - это:67 68 1. Кнопки (в настройках) > Раскрытие списка смайлов (выпадающий список) > при подведении к значку ИЛИ нажатию на него (или так или так) — (переключатель в настройках!!!)69 70 — Когда нажимаешь на значок смайла > раскрывается меню > !!! НЕ РЕАЛИЗОВАНО !!!!71 (не всегда удобно когда подводишь и раскрывается список, порой даже мешает)72 73 74 2.75 — Выпадающий список > наверное тоже самое что пункт 1. только со значком рядом " стрелочка вниз " - (">" только повёрнутая вниз) —---( справа или слева, лучше справа)76 77 Т.е Отображается смайл и рядом с ним значок (">" только повёрнутая вниз) в виде кнопки (НЕ КРИТИЧНО при полной реализации п.1) - такой переключатель в настройках тоже был бы многим удобен и полезен (или так или так).78 79 80 4.81 — Возможность (в настройках плагина) Расширять и сужать сетку смайлов, при раскрытии меню смайлов = отображать количество колонок и столбцов !!!82 Т.е - (нажимаешь на смайл или подводишь мышь к нему) = > отображение сетки = (8 столбцов + 16 строк) или (16 столбцов + 16 строк) ..... например (1x2-20) (1-20x1) (2x20) (3x4) (4x3) (5x32) (16x20) итд итп! т.е произвольные параметры в настройках плагина (кол-во столбцов = " X " ; кол-во строк = " X ") !!!83 84 85 8.86 - Безопасность:87 88 /wp-content/plugins/kama-wp-smile/smiles/*.gif89 Папки:90 /wp-content - есть возможность скрыть с91 помощью сторонних плагинов92 /plugins/ - есть возможность скрыть с помощью сторонних плагинов93 94 /kama-wp-smile/smiles/*.gif - Название плагина даёт определить по коду страницы или открытию смайла в новом что установлен wordpress.95 96 Рекомендую сменить название (Убрать wp из имени папки, .... не плагина!)97 - Сделать вообще просто папку Smile или (Kama)98 99 Например /wp-content/plugins/smile/smiles/*.gif - так точно сразу не определишь!!!100 Например /wp-content/plugins/kama/smiles/*.gif - так точно сразу не определишь!!!ъ101 т.е будет в коде отображаться /kama/smiles/*.gif102 т.е будет в коде отображаться *****/*****/kama/smiles/*.gif103 104 Спасибо за внимание.105 106 107 108 109 62 == Changelog == 110 63 111 64 = 1.9.13 = 65 * UPD: WP Version up. 112 66 * NEW: filter `kwsmile__insert_smile_space`. 113 67 -
kama-wp-smile/trunk/uninstall.php
r2461097 r3061759 1 1 <?php 2 2 3 if( ! defined('WP_UNINSTALL_PLUGIN') )exit;3 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 4 4 5 if( ! defined( 'KWS_PLUGIN_PATH') ){6 define( 'KWS_PLUGIN_PATH', plugin_dir_path(__FILE__) );5 if( ! defined( 'KWS_PLUGIN_PATH' ) ){ 6 define( 'KWS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 7 7 8 require_once plugin_dir_path(__FILE__) .'class.Kama_WP_Smiles.php'; 8 require_once __DIR__ . '/functions.php'; 9 require_once __DIR__ . '/Kama_WP_Smiles.php'; 9 10 } 10 11 … … 12 13 13 14 function kws_unistall_init(){ 14 global $wpdb;15 15 16 16 delete_option( 'kwsmile_version' ); … … 22 22 23 23 // delete smiles in content 24 if(1){ 25 26 // collect all names from all folders 27 $names = array(); 28 foreach( glob(KWS_PLUGIN_PATH .'packs/*') as $dir ){ 29 if( is_dir($dir) ) 30 $names = array_merge( $names, Kama_WP_Smiles::get_dir_smile_names($dir) ); 31 } 32 foreach( glob(untrailingslashit(KWS_PLUGIN_PATH) .'-packs/*') as $dir ){ 33 if( is_dir($dir) ) 34 $names = array_merge( $names, Kama_WP_Smiles::get_dir_smile_names($dir) ); 35 } 36 37 $names = array_unique( $names ); 38 39 // split huge number of names into sets by 100 40 $all_count = count( $names ); 41 $split_names = array(); 42 $start_from = 0; // start 43 while(true){ 44 $split_names[] = array_slice( $names, $start_from, 100 ); 45 46 if( $start_from > $all_count ) 47 break; // stop 48 49 $start_from += 100; 50 } 24 _kws_delete_smiles_in_content(); 51 25 52 26 53 // delete sets54 $affected_rows = 0;55 foreach( $split_names as $names ){ 27 // delete custom created packs - the folder `/wp-content/plugins/kama-wp-smile-packs` 28 _kws_delete_folder( untrailingslashit( KWS_PLUGIN_PATH ) . '-packs' ); 29 } 56 30 57 // multiple replace query - REPLACE( REPLACE( REPLACE( __FIELDNAME__, '(:acute:)', ''), '(:aggressive:)', ''), '(:air_kiss:)', '') 58 $REPLACE_patt = ''; 59 foreach( $names as $val ){ 31 function _kws_delete_smiles_in_content(){ 32 global $wpdb; 60 33 61 if( $val = preg_replace('/[^a-zA-Z0-9_-]/', '', $val ) ){ 62 $smile_code = Kama_WP_Smiles::$sm_start . $val . Kama_WP_Smiles::$sm_end; 63 $REPLACE_patt = str_replace( 64 array( '__FIELDNAME__', '__SMILECODE__' ), 65 array( ($REPLACE_patt ? $REPLACE_patt : '__FIELDNAME__'), $smile_code ), 66 "REPLACE( __FIELDNAME__, '__SMILECODE__', '')" 67 ); 68 } 69 } 70 71 if( $REPLACE_patt ){ 72 $affected_rows += $wpdb->query( 73 "UPDATE $wpdb->posts SET post_content = ". str_replace( '__FIELDNAME__', 'post_content', $REPLACE_patt ) ." WHERE post_type NOT IN ('attachment','revision','nav_meny_item')" 74 ); 75 76 $affected_rows += $wpdb->query( 77 "UPDATE $wpdb->comments SET comment_content = ". str_replace( '__FIELDNAME__', 'comment_content', $REPLACE_patt ) ."" 78 ); 79 } 80 34 // collect all names from all folders 35 $names = []; 36 foreach( glob( KWS_PLUGIN_PATH . 'packs/*' ) as $dir ){ 37 if( is_dir( $dir ) ){ 38 /** @noinspection SlowArrayOperationsInLoopInspection */ 39 $names = array_merge( $names, kwsmile()->get_dir_smile_names( $dir ) ); 40 } 41 } 42 foreach( glob( untrailingslashit( KWS_PLUGIN_PATH ) . '-packs/*' ) as $dir ){ 43 if( is_dir( $dir ) ){ 44 /** @noinspection SlowArrayOperationsInLoopInspection */ 45 $names = array_merge( $names, kwsmile()->get_dir_smile_names( $dir ) ); 81 46 } 82 47 } 83 48 84 // delete custom created packs - the folder `/wp-content/plugins/kama-wp-smile-packs` 85 _kws_delete_folder( untrailingslashit(KWS_PLUGIN_PATH) .'-packs' ); 49 $names = array_unique( $names ); 50 51 // split huge number of names into sets by 100 52 $all_count = count( $names ); 53 $split_names = []; 54 $start_from = 0; // start 55 while( true ){ 56 $split_names[] = array_slice( $names, $start_from, 100 ); 57 58 if( $start_from > $all_count ){ 59 break; 60 } 61 62 $start_from += 100; 63 } 64 65 // delete sets 66 $affected_rows = 0; 67 foreach( $split_names as $names ){ 68 69 // multiple replace query - REPLACE( REPLACE( REPLACE( __FIELDNAME__, '(:acute:)', ''), '(:aggressive:)', ''), '(:air_kiss:)', '') 70 $REPLACE_patt = ''; 71 foreach( $names as $val ){ 72 73 if( $val = preg_replace( '/[^a-zA-Z0-9_-]/', '', $val ) ){ 74 75 $smile_code = Kama_WP_Smiles::$sm_start . $val . Kama_WP_Smiles::$sm_end; 76 77 $REPLACE_patt = str_replace( 78 [ '__FIELDNAME__', '__SMILECODE__' ], 79 [ ( $REPLACE_patt ?: '__FIELDNAME__' ), $smile_code ], 80 "REPLACE( __FIELDNAME__, '__SMILECODE__', '')" 81 ); 82 } 83 } 84 85 if( $REPLACE_patt ){ 86 $affected_rows += $wpdb->query( $wpdb->prepare( 87 "UPDATE $wpdb->posts SET post_content = %s WHERE post_type NOT IN ( 'attachment', 'revision', 'nav_meny_item' )", 88 str_replace( '__FIELDNAME__', 'post_content', $REPLACE_patt ) 89 ) ); 90 91 $affected_rows += $wpdb->query( $wpdb->prepare( 92 "UPDATE $wpdb->comments SET comment_content = %s", 93 str_replace( '__FIELDNAME__', 'comment_content', $REPLACE_patt ) 94 ) ); 95 } 96 } 86 97 } 87 98 … … 95 106 96 107 $glod = glob( "$folder_path/{,.}[!.,!..]*", GLOB_BRACE ); 108 97 109 foreach( $glod as $file ){ 98 if( is_dir( $file) )110 if( is_dir( $file ) ){ 99 111 call_user_func( __FUNCTION__, $file ); 100 else 112 } 113 else{ 101 114 unlink( $file ); 115 } 102 116 } 103 117 104 if( $delete_self ) 118 if( $delete_self ){ 105 119 rmdir( $folder_path ); 120 } 106 121 }
Note: See TracChangeset
for help on using the changeset viewer.