$v) { echo "{$v} "; } } // smilies options page function clcs_options_admin_page() { global $wpsmiliestrans, $clcs_options; if ($_POST['update-options']) { $updated = false; $is_illegal_dir = false; if (get_option('cs_list') != $_POST['list']) { update_option('cs_list', $_POST['list']); $updated = true; } if (array_key_exists('use-action-comment-form', $_POST)) { $clcs_options = get_option('clcs_options'); if ($clcs_options['use_action_comment_form'] == 0) { $updated = true; } $clcs_options['use_action_comment_form'] = 1; update_option('clcs_options', $clcs_options); } else { $clcs_options = get_option('clcs_options'); if ($clcs_options['use_action_comment_form'] == 1) { $updated = true; } $clcs_options['use_action_comment_form'] = 0; update_option('clcs_options', $clcs_options); } if (array_key_exists('comment_textarea', $_POST)) { $clcs_options = get_option('clcs_options'); if ($_POST['comment_textarea'] != $clcs_options['comment_textarea']) { $clcs_options['comment_textarea'] = $_POST['comment_textarea']; update_option('clcs_options', $clcs_options); $updated = true; } } if (array_key_exists('popup_win_width', $_POST)) { $clcs_options = get_option('clcs_options'); if (!array_key_exists('popup_win_width', $clcs_options)) { $clcs_options['popup_win_width'] = 0; } if ($_POST['popup_win_width'] != $clcs_options['popup_win_width']) { $clcs_options['popup_win_width'] = $_POST['popup_win_width']; update_option('clcs_options', $clcs_options); $updated = true; } } if (array_key_exists('popup_win_height', $_POST)) { $clcs_options = get_option('clcs_options'); if (!array_key_exists('popup_win_height', $clcs_options)) { $clcs_options['popup_win_height'] = 0; } if ($_POST['popup_win_height'] != $clcs_options['popup_win_height']) { $clcs_options['popup_win_height'] = $_POST['popup_win_height']; update_option('clcs_options', $clcs_options); $updated = true; } } if (array_key_exists('smilies_path', $_POST)) { $clcs_options = get_option('clcs_options'); if (is_dir(ABSPATH . $_POST['smilies_path'])) { if (($_POST['smilies_path'] != $clcs_options['smilies_path'])) { $clcs_options['smilies_path'] = $_POST['smilies_path']; update_option('clcs_options', $clcs_options); $updated = true; } } else { $is_illegal_dir = true; } } if ($updated) { $clcs_message = __('Preferences updated.', 'custom_smilies'); } else { $clcs_message = __('No changes made.', 'custom_smilies'); } if ($is_illegal_dir) { $clcs_message .= __(' The path of smilies that you want to set is illegal.', 'custom_smilies'); } echo '

' . $clcs_message . '

'; } $clcs_options = get_option('clcs_options'); if (!is_array($clcs_options)) { $clcs_options = array(); } // show all or show undefined? $su = ($_GET['su'] === '1'); if ($_POST['update-smilies']) { // save smilies to file and refresh $wpsmiliestrans $wpsmiliestrans = cs_save_smilies($_POST); echo '

' . __('Your smilies have been updated.', 'custom_smilies') . '

'; } // $smilies: 1|gif, 2|gif, etc // $old_smilies: :D, :(, etc $smilies = cs_get_all_smilies(); $old_smilies = cs_load_existing_smilies(); ?>

' . __('Display all smilies', 'custom_smilies') . '' : '' . __('Display undefined smilies only', 'custom_smilies') . ''; ?>

1.gif $smilie_name = str_replace('.', '|', $smilie); if ($su && $old_smilies[$smilie] != '') { // show undefined only ?>


:D, :), :wink:, :(', 'custom_smilies'); ?>


get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { return; } // get existing smilies from database $result = $wpdb->get_results("SELECT * FROM `$table_name` ORDER BY `File`"); $ext = get_option('csm_ext'); foreach ($result as $object) { $tmp[$object->File.'.'.$ext] = $object->Emot; } // write to file cs_save_smilies($tmp); // uninstall $wpdb->query("DROP TABLE `{$table_prefix}smileys`"); delete_option('csm_path'); delete_option('csm_dbx'); delete_option('csm_ext'); delete_option('csm_spl'); } // save smilies to file function cs_save_smilies($array) { if (!is_array($array)) { return; } foreach ($array as $k => $v) { // sanitize smilies: remove \ ' " and trim whitespaces $array[$k] = trim(str_replace(array('\'','\\', '"'), '', $v)); } $array = array_flip($array); $array4db = array(); foreach ($array as $k => $v) { // sanitize smilies file name $array[$k] = $v = str_replace('|', '.', $v); if (!in_array($v, array('update-smilies', 'page')) && !in_array($k, array('', 'QAD'))) { $array4db[$k] = $v; } } update_option('clcs_smilies', $array4db); return $array; } // ensure compatibility with older version function csm_comment_form() { cs_print_smilies(); } // return all smilies function cs_all_smilies() { global $wpsmiliestrans; $url = clcs_get_smilies_path(); foreach ($wpsmiliestrans as $k => $v) { $smilies[$k] = "$url/$v"; } return $smilies; } // print smilies list @ comment form function clcs_print_smilies($comment_textarea = 'comment') { ?> $v) { echo "{$v} "; } } else { $display = explode(',', $list); $smilies = array_flip($smilies); foreach ($display as $v) { $v = trim($v); echo "{$v} "; unset($smilies[$v]); } echo ' more »'; } } function cs_print_smilies() { global $clcs_options; clcs_print_smilies($clcs_options['comment_textarea']); } if (array_key_exists('use_action_comment_form', $clcs_options) && $clcs_options['use_action_comment_form'] == 1) { add_action('comment_form', 'cs_print_smilies'); } ?>