├── Notifcaster.class.php ├── README.md ├── admin └── settings-page.php ├── functions.php ├── icon.png ├── inc ├── Notifcaster.class.php ├── composer.php ├── css │ ├── spectre.min.css │ └── twp-admin.css └── js │ ├── emojione.js │ ├── fn.js │ └── textrange.js ├── lang ├── twp-plugin-fa_IR.mo ├── twp-plugin-fa_IR.po └── twp-plugin.pot ├── readme.txt ├── twp.php └── uninstall.php /Notifcaster.class.php: -------------------------------------------------------------------------------- 1 | 5 | * forked from Notifygram by Anton Ilzheev 6 | * Attention! $method always must be started with slash " / " 7 | */ 8 | if (!defined('PHP_VERSION_ID')) { 9 | $version = explode('.', PHP_VERSION); 10 | 11 | define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); 12 | } 13 | if (PHP_VERSION_ID < 50207) { 14 | define('PHP_MAJOR_VERSION', $version[0]); 15 | define('PHP_MINOR_VERSION', $version[1]); 16 | define('PHP_RELEASE_VERSION', $version[2]); 17 | } 18 | class Notifcaster_Class 19 | { 20 | protected 21 | $api_token = null, 22 | $url = 'https://tg-notifcaster.rhcloud.com/api/v1', 23 | $api_method = null; 24 | /** 25 | * Notifcaster API constructor 26 | * @param string $api_token 27 | * @param string $url 28 | */ 29 | public function Notifcaster($api_token, $url = 'https://tg-notifcaster.rhcloud.com/api/v1') 30 | { 31 | $this->api_token = $api_token; 32 | $this->url = $url; 33 | } 34 | /** 35 | * Telegram API constructor 36 | * 37 | * @param string $bot_token 38 | * 39 | */ 40 | public function _telegram($bot_token) 41 | { 42 | $this->url = 'https://api.telegram.org/bot'.$bot_token; 43 | } 44 | /** 45 | * Send Notification to user 46 | * 47 | * @param string $msg 48 | * 49 | * @return string 50 | */ 51 | public function notify($msg = 'NULL') 52 | { 53 | $params = array( 54 | 'api_token' => $this->api_token, 55 | 'msg' => $msg 56 | ); 57 | $this->api_method = "/selfMessage"; 58 | $response = $this->make_request($params); 59 | return $response; 60 | } 61 | /** 62 | * Get bot info from Telegram 63 | * 64 | * @return JSON 65 | */ 66 | public function get_bot() 67 | { 68 | $params = array(); 69 | $this->api_method = "/getMe"; 70 | $response = $this->make_request($params); 71 | return $response; 72 | } 73 | /** 74 | * Send text message to channel 75 | * 76 | * @param string $chat_id 77 | * @param string $msg 78 | * 79 | * @return string 80 | */ 81 | public function channel_text($chat_id , $msg) 82 | { 83 | $params = array( 84 | 'chat_id' => $chat_id, 85 | 'text' => strip_tags($msg) 86 | ); 87 | $this->api_method = "/sendMessage"; 88 | $response = $this->make_request($params); 89 | return $response; 90 | } 91 | /** 92 | * Send text message to channel 93 | * 94 | * @param string $chat_id 95 | * @param string $msg 96 | * 97 | * @return string 98 | */ 99 | public function channel_photo($chat_id , $caption , $photo) 100 | { 101 | $params = array( 102 | 'chat_id' => $chat_id, 103 | 'caption' => $caption, 104 | 'photo' => $photo 105 | ); 106 | $this->api_method = "/sendPhoto"; 107 | $file_upload = true; 108 | $response = $this->make_request($params, $file_upload); 109 | return $response; 110 | } 111 | 112 | /** 113 | * Request Function 114 | * 115 | * @param array $params 116 | * @param string $file_upload 117 | * 118 | * @return string "success" || error message 119 | */ 120 | protected function make_request(array $params = array(), $file_upload = false) 121 | { 122 | if (function_exists('curl_init')) { 123 | $curl = curl_init($this->url.$this->api_method); 124 | if (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 5){ 125 | curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true); 126 | } 127 | if ($file_upload) { 128 | if (class_exists('CURLFile')) { 129 | $params['photo'] = new CURLFile($params['photo']); 130 | } else { 131 | $params = $this->curl_custom_postfields($curl, array('chat_id' => $params['chat_id'], 'caption' => $params['caption']), array('photo' => $params['photo'])); 132 | } 133 | } else { 134 | $params = http_build_query($params); 135 | } 136 | curl_setopt_array($curl, array( 137 | CURLOPT_SSL_VERIFYPEER => 0, 138 | CURLOPT_SSL_VERIFYHOST => 0, 139 | CURLOPT_RETURNTRANSFER => 1, 140 | CURLOPT_POST => 1, 141 | CURLOPT_POSTFIELDS => $params 142 | )); 143 | $response = curl_exec($curl); 144 | curl_close($curl); 145 | } else { 146 | $context = stream_context_create(array( 147 | 'http' => array( 148 | 'method' => 'POST', 149 | 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 150 | 'content' => $post, 151 | 'timeout' => 10, 152 | ), 153 | )); 154 | $response = file_get_contents($this->url.$this->api_method, false, $context); 155 | } 156 | return $this->response = json_decode($response, true); 157 | } 158 | 159 | /** 160 | * Helpers 161 | */ 162 | 163 | /** 164 | * For safe multipart POST request for PHP5.3 ~ PHP 5.4. 165 | * @author https://twitter.com/mpyw 166 | * @param resource $ch cURL resource 167 | * @param array $assoc "name => value" 168 | * @param array $files "name => path" 169 | * @return string 170 | */ 171 | protected function curl_custom_postfields($ch, array $assoc = array(), array $files = array()) { 172 | 173 | // invalid characters for "name" and "filename" 174 | static $disallow = array("\0", "\"", "\r", "\n"); 175 | 176 | // initialize body 177 | $body = array(); 178 | 179 | // build normal parameters 180 | foreach ($assoc as $k => $v) { 181 | $k = str_replace($disallow, "_", $k); 182 | $body[] = implode("\r\n", array( 183 | "Content-Disposition: form-data; name=\"{$k}\"", 184 | "", 185 | filter_var($v), 186 | )); 187 | } 188 | 189 | // build file parameters 190 | foreach ($files as $k => $v) { 191 | switch (true) { 192 | case false === $v = realpath(filter_var($v)): 193 | case !is_file($v): 194 | case !is_readable($v): 195 | continue; // or return false, throw new InvalidArgumentException 196 | } 197 | $data = file_get_contents($v); 198 | $v = call_user_func("end", explode(DIRECTORY_SEPARATOR, $v)); 199 | list($k, $v) = str_replace($disallow, "_", array($k, $v)); 200 | $body[] = implode("\r\n", array( 201 | "Content-Disposition: form-data; name=\"{$k}\"; filename=\"{$v}\"", 202 | "Content-Type: application/octet-stream", 203 | "", 204 | $data, 205 | )); 206 | } 207 | 208 | // generate safe boundary 209 | do { 210 | $boundary = "---------------------" . md5(mt_rand() . microtime()); 211 | } while (preg_grep("/{$boundary}/", $body)); 212 | 213 | // add boundary for each parameters 214 | array_walk($body, function (&$part) use ($boundary) { 215 | $part = "--{$boundary}\r\n{$part}"; 216 | }); 217 | 218 | // add final boundary 219 | $body[] = "--{$boundary}--"; 220 | $body[] = ""; 221 | 222 | // set options 223 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( 224 | "Expect: 100-continue", 225 | "Content-Type: multipart/form-data; boundary={$boundary}", // change Content-Type 226 | ) 227 | ); 228 | return implode("\r\n", $body); 229 | } 230 | } 231 | ?> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Telegram for WordPress 2 | Also known as TWP, is a plugin that allows user to receive WordPress notifications in their Telegram account and publish their files/posts/products to Telegram channel. 3 | 4 | # Notifcaster 5 | Notifcaster is a free service for sending notifications directly to Telegram. 6 | 7 | 8 | ###Installing Plugin 9 | 1. Download Telegram for WordPress plugin from Wordpress Plugin directory. 10 | 2. Upload zip file to your WordPress Plugins directory. /wp-content/plugins. 11 | 3. Activate the plugin through the \'Plugins\' menu in WordPress. You can also find and install the plugin from WordPress plugin repository through this menu. 12 | 4. Go to TWP Settings Page in WordPress dashboard. 13 | 5. Follow the guides in the TWP Settings page. 14 | 15 | There is also an online document in Notifcaster 16 | 17 | ###Feedback 18 | Call me on Telegram: @ameer_mousavi 19 | -------------------------------------------------------------------------------- /admin/settings-page.php: -------------------------------------------------------------------------------- 1 | 6 | 8 | #floating_save_button{left: 25px !important; right: auto !important;} 9 | .tab-links li {float:right !important;} 10 | 11 | '; 12 | } 13 | 14 | ?> 15 |
16 |

17 |

@notifcaster"); ?>

18 | 19 |
20 |

21 |
22 | 23 |
24 |
💾
25 | 26 | 27 |
28 | 33 |
34 |
35 |
36 |
37 |
38 |
39 |
Bot Info
40 |
This bot will be used for all actions.
41 |
42 |
43 |
    44 |
  1. /newbot", "@Botfather") ?> 45 |
  2. 46 |
  3. 47 |
  4. 48 |
  5. /start") ?>
  6. 49 |
50 |
51 |
52 |
53 | option_value."(".$tdata['twp_bot_username']->option_value.")"?> 54 |
55 | 56 | 57 |
58 | 65 |
66 |
67 |
68 |
69 |
70 |
71 | 72 |
73 | 87 |
88 |
89 | 90 |
    91 |
  1. /start","@UserInfoBot") ?> 92 |
  2. 93 |
  3. chat_id", "chat_id") ?>
  4. 94 |
  5. 95 |
96 |
97 |
98 | 99 |
    100 |
  1. 101 |
  2. 102 |
  3. @GroupInfoBot") ?> 103 |
  4. 104 |
  5. chat_id", "chat_id") ?>
  6. 105 |
    106 | 107 |
    108 |
  7. 109 |
110 |
111 | 112 |
113 | 124 |
125 |
126 |
127 |
128 |
129 | 130 | 131 | 132 | 151 | 152 | 153 | 154 | 162 | 163 | 164 | 165 | 171 | 172 | 173 | option_value; 175 | $excerpt_length = $tdata['twp_excerpt_length']->option_value; 176 | $tstc = $tdata['twp_send_to_channel']->option_value; 177 | $tstc = $tstc != "" ? $tstc : 0 ; 178 | $cp = $tdata['twp_channel_pattern']->option_value; 179 | $s = $tdata['twp_send_thumb']->option_value; 180 | $m = $tdata['twp_markdown']->option_value; 181 | $ipos = $tdata['twp_img_position']->option_value; 182 | ?> 183 | 184 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 215 | 216 | 217 | 218 | 223 | 224 | 225 | 226 | 231 | 232 | 233 | 234 | 250 | 251 |

133 |

134 | 135 |
136 | 137 |
138 | 139 |

140 |
    141 |
  1. 142 |
  2. 143 |
  3. 144 |
  4. 145 |
  5. 146 |
  6. 147 |
  7. 148 |
  8. 149 |
150 |

Bot Token

155 | 156 | 157 |

158 | 159 | 160 |

161 |

166 | 167 | 168 |

🔄

169 |

@ at the beginning", "twp-plugin") ?>

170 |

185 |


186 |
187 | />
188 | /> 189 |
190 |

191 |
192 |

200 |


201 |
202 | value="0"> 203 | 204 |
205 | value="1"> 206 | 207 |
208 | value="2"> 209 | 210 |
211 | 212 |
213 |
214 |

219 |


220 | 221 | 222 |

227 |


228 | /> 229 | 230 |

235 |


236 |
237 | value="0"> 238 | 239 |
240 |

You can set a caption for the photo in the media library.", "twp-plugin") ?>

241 |
242 | value="1"> 243 | 244 |
245 | 246 |

247 |
248 |
249 |
252 |
253 |
254 |

255 |

256 | Hi my friends!☺️
257 | I'm Ameer Mousavi (plugin author) from Iran, a country in the Middle East. I'm a Zoology junior student and part-time computer assistant at my former high school.
258 | I put lots of energy and time (and also money) on the development of this plugin. If you enjoy this plugin and want to make this plugin better, please consider making a small donation using one of the below options: 259 |

260 | 261 | 262 | 272 | 280 | 281 |
263 |

🌎

264 |

265 | Just click on the below button:", "twp-plugin") ?>
266 |

267 |

268 | Flattr this 269 | 270 |

271 |
273 |

🇮🇷

274 |

275 | اکر شما در ایران هستید، لطفا کمکهای نقدی خودتان را به شماره ملی کارت زیر واریز نمایید:
276 |

277 |

6037-9971-9935-3583

278 |

به نام سید امیر محمد موسوی پور

279 |
282 |
283 |
284 |
285 |

286 | 287 |

288 |
289 |
290 | '.__('Telegram for Wordpress page in wordpress.org', "twp-plugin").'', ''.__("donating", "twp-plugin").'' ); 292 | echo $message; ?> 293 |
294 |
295 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | prefix . "twp_logs"; 4 | /** 5 | * Add table to db for logs 6 | */ 7 | function twp_install() { 8 | if (!get_option('twp_db_version')) add_option('twp_db_version', TWP_DB_VERSION); 9 | if ( twp_db_need_update() ) twp_install_db_tables(); 10 | } 11 | register_activation_hook( TWP_PLUGIN_DIR.'/twp.php', 'twp_install' ); 12 | 13 | /** 14 | * Install twp table 15 | */ 16 | function twp_install_db_tables() { 17 | global $wpdb; 18 | $table_name = $wpdb->prefix . "twp_logs"; 19 | $charset_collate = $wpdb->get_charset_collate(); 20 | $sql = "CREATE TABLE $table_name ( 21 | id bigint(20) NOT NULL AUTO_INCREMENT, 22 | time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 23 | post_id bigint(20) NOT NULL, 24 | sending_result text NOT NULL, 25 | UNIQUE KEY id (id) 26 | ) $charset_collate;"; 27 | require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 28 | dbDelta( $sql ); 29 | } 30 | 31 | //forked from alo-easymail plugin. Thanks! 32 | /** 33 | * Check if plugin tables are already properly installed 34 | */ 35 | function twp_db_need_update() { 36 | global $wpdb; 37 | global $table_name; 38 | $installed_db = get_option('twp_db_version'); 39 | $missing_table = false; // Check if tables not yet installed 40 | if ( $wpdb->get_var("show tables like '$table_name'") != $table_name ) $missing_table = true; 41 | return ( $missing_table || TWP_DB_VERSION != $installed_db ) ? true : false; 42 | } 43 | /** 44 | * Since 3.1 the register_activation_hook is not called when a plugin 45 | * is updated, so to run the above code on automatic upgrade you need 46 | * to check the plugin db version on another hook. 47 | */ 48 | function twp_check_db_when_loaded() { 49 | if ( twp_db_need_update() ) twp_install_db_tables(); 50 | } 51 | add_action('plugins_loaded', 'twp_check_db_when_loaded'); 52 | //End forked functions 53 | 54 | /** 55 | * An optimized function for getting our options from db 56 | * 57 | * @since 1.5 58 | */ 59 | function twp_get_option() { 60 | global $wpdb; 61 | $query = "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE 'twp_%%'"; 62 | $twp_data = $wpdb->get_results($query, OBJECT_K); 63 | return $twp_data; 64 | } 65 | 66 | /** 67 | * Print admin settings page 68 | */ 69 | function twp_settings_page() { 70 | require_once('admin/settings-page.php'); 71 | } 72 | 73 | /** 74 | * Enqueue styles in the WordPress admin. 75 | * 76 | * @param int $hook Hook suffix for the current admin page. 77 | */ 78 | 79 | function twp_enqueue_style($hook) { 80 | $pages_array = array('toplevel_page_telegram-for-wp'); 81 | if (!in_array($hook, $pages_array)){ 82 | return; 83 | } 84 | wp_register_style( 'twp_spectre_css', TWP_PLUGIN_URL. '/inc/css/spectre.min.css', false, '1.0.0' ); 85 | wp_register_style( 'twp_admin_css', TWP_PLUGIN_URL. '/inc/css/twp-admin.css', false, '1.0.0' ); 86 | 87 | wp_enqueue_style( 'twp_spectre_css' ); 88 | wp_enqueue_style( 'twp_admin_css' ); 89 | } 90 | add_action( 'admin_enqueue_scripts', 'twp_enqueue_style' ); 91 | /** 92 | * Enqueue scripts in the WordPress admin, excluding edit.php. 93 | * 94 | * @param int $hook Hook suffix for the current admin page. 95 | */ 96 | function twp_enqueue_script( $hook ) { 97 | $pages_array = array('toplevel_page_telegram-for-wp', 'post-new.php', 'post.php'); 98 | if (!in_array($hook, $pages_array)){ 99 | return; 100 | } 101 | wp_enqueue_script( 'textrange', TWP_PLUGIN_URL. '/inc/js/textrange.js', array(), '', true ); 102 | wp_enqueue_script( 'emojione', TWP_PLUGIN_URL. '/inc/js/emojione.js', array(), '', true ); 103 | wp_enqueue_script( 'twp-functions', TWP_PLUGIN_URL. '/inc/js/fn.js', array(), '', true ); 104 | $translation_array = array( 105 | 'frame_title' => __("Select or Upload the custom photo", "twp-plugin"), 106 | 'button_text' => __("Use this image", "twp-plugin"), 107 | 'file_frame_title' => __("Select or Upload the files", "twp-plugin"), 108 | 'file_button_text' => __("Use this file(s)", "twp-plugin"), 109 | 'edit_file' => __("Edit file", "twp-plugin"), 110 | 'bot_token_empty' => __("bot token field is empty", "twp-plugin"), 111 | 'test_message' => __("This is a test message", "twp-plugin"), 112 | 'token_chat_id_empty' => __("bot_token/chat_id field is empty", "twp-plugin"), 113 | 'channel_test' => __("This will send a test message to your channel. Do you want to continue?", "twp-plugin") 114 | 115 | ); 116 | wp_localize_script( 'twp-functions', 'twp_js_obj', $translation_array ); 117 | } 118 | add_action( 'admin_enqueue_scripts', 'twp_enqueue_script' ); 119 | 120 | /** 121 | * Sanitize a string from user input or from the db 122 | * 123 | * check for invalid UTF-8, 124 | * Convert single < characters to entity, 125 | * strip all tags, 126 | * strip octets. 127 | * 128 | * @since 2.9.0 129 | * 130 | * @param string $str 131 | * @return string 132 | */ 133 | function twp_sanitize_text_field($str) { 134 | $filtered = wp_check_invalid_utf8( $str ); 135 | 136 | if ( strpos($filtered, '<') !== false ) { 137 | $filtered = wp_pre_kses_less_than( $filtered ); 138 | // This will strip extra whitespace for us. 139 | $filtered = strip_tags( $filtered, "
");
140 | 	}
141 | 	$found = false;
142 | 	while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
143 | 		$filtered = str_replace($match[0], '', $filtered);
144 | 		$found = true;
145 | 	}
146 | 	if ( $found ) {
147 | 		// Strip out the whitespace that may now exist after removing the octets.
148 | 		$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
149 | 	}
150 | 
151 | 	/**
152 | 	 * Filter a sanitized text field string.
153 | 	 *
154 | 	 * @since 2.9.0
155 | 	 *
156 | 	 * @param string $filtered The sanitized string.
157 | 	 * @param string $str      The string prior to being sanitized.
158 | 	 */
159 | 	return apply_filters( 'twp_sanitize_text_field', $filtered, $str );
160 | }
161 | 
162 | /**
163 |  * Load plugin textdomain.
164 |  *
165 |  * @since 1.0.0
166 |  */
167 | function twp_load_textdomain() {
168 | 	load_plugin_textdomain( 'twp-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); 
169 | }
170 | add_action( 'plugins_loaded', 'twp_load_textdomain' );
171 | 
172 | /**
173 | * Add action links to the plugin list for TWP.
174 | *
175 | * @param $links
176 | * @return array
177 | */
178 | function twp_plugin_action_links($links) {
179 | 	$links[] = '' . __('Persian Tutorial in My website', 'twp-plugin') . '';
180 | 	return $links;
181 | }
182 | add_action('plugin_action_links_' . plugin_basename(__FILE__), 'twp_plugin_action_links');
183 | 
184 | /**
185 | * This will get information about sent mail from PHPMailer and send it to user
186 | */
187 | function twp_mail_action($result, $to, $cc, $bcc, $subject, $body){
188 | 	global $tdata;
189 | 	$nt = new Notifcaster_Class();
190 | 	$_apitoken = $tdata['twp_bot_token']->option_value;
191 | 	$_msg = $body;
192 | 	if($tdata['twp_hashtag']->option_value != '') {
193 | 		$_msg = $tdata['twp_hashtag']->option_value."\n".$_msg;
194 | 	}
195 | 	$nt->Notifcaster($_apitoken);
196 | 	if(mb_strlen($_msg) > 4096){
197 | 		$splitted_text = $nt->str_split_unicode($_msg, 4096);
198 | 		foreach ($splitted_text as $text_part) {
199 | 			$nt->notify($text_part);
200 | 		}
201 | 	} else {
202 | 		$nt->notify($_msg);
203 | 	}
204 | }
205 | /**
206 |  * Setup a custom PHPMailer action callback. This will let us to fire our action every time a mail sent
207 |  * Thanks to Birgire (http://xlino.com/) for creating this code snippet.
208 |  */
209 | function twp_phpmailer_hook ( $phpmailer ){
210 | 	$phpmailer->action_function = 'twp_mail_action';
211 | 	
212 | }
213 | /**
214 | * Show a warning message for admins.
215 | */
216 | function twp_api_admin_notice($message) {
217 | 	$class = "updated notice is-dismissible";
218 | 	$message = sprintf(__('Your API token isn\'t set. Please go to %s and set it.','twp-plugin'), "".__("TWP Settings", "twp-plugin")."");
219 | 	echo"

$message

"; 220 | } 221 | 222 | 223 | /** 224 | * Adds a box to the main column on the Post and Page edit screens. 225 | */ 226 | function twp_add_meta_box() { 227 | $screens = get_post_types( '', 'names' ); 228 | foreach ( $screens as $screen ) { 229 | add_meta_box( 230 | 'twp_meta_box', 231 | __( 'Telegram Channel Options', 'twp-plugin' ), 232 | 'twp_meta_box_callback', 233 | $screen, 234 | "normal", 235 | "high" 236 | ); 237 | } 238 | } 239 | add_action( 'add_meta_boxes', 'twp_add_meta_box' ); 240 | 241 | /** 242 | * Prints the box content. 243 | * 244 | * @param WP_Post $post The object for the current post/page. 245 | */ 246 | function twp_meta_box_callback( $post ) { 247 | global $wpdb; 248 | global $table_name; 249 | global $tdata; 250 | // Add a nonce field so we can check for it later. 251 | $ID = $post->ID; 252 | wp_nonce_field( 'twp_save_meta_box_data', 'twp_meta_box_nonce' ); 253 | $error = ""; 254 | $dis = ""; 255 | $check_state = ""; 256 | $is_product = false; 257 | $twp_log = $wpdb->get_row( "SELECT * FROM $table_name WHERE post_id = $ID", ARRAY_A ); 258 | if ($tdata['twp_channel_username']->option_value == "" || $tdata['twp_bot_token']->option_value == "") 259 | { 260 | $dis = "disabled=disabled"; 261 | $error = "".__("Bot token or Channel username aren't set!", "twp-plugin")."
"; 262 | } 263 | $tstc = get_post_meta($ID, '_twp_send_to_channel', true); 264 | $tstc = $tstc != "" ? $tstc : $tdata['twp_send_to_channel']->option_value; 265 | $cp = get_post_meta($ID, '_twp_meta_pattern', true); 266 | $cp = $cp != "" ? $cp : $tdata['twp_channel_pattern']->option_value; 267 | $s = get_post_meta($ID, '_twp_send_thumb', true); 268 | $s = $s != "" ? $s : $tdata[ 'twp_send_thumb']->option_value; 269 | if ($post->post_type == 'product'){ 270 | $is_product = true; 271 | } 272 | // Custom image upload-link 273 | $twp_img_upload_link = esc_url( get_upload_iframe_src( 'image', $ID )); 274 | // See if there's a media id already saved as post meta 275 | $twp_img_id = get_post_meta( $ID, '_twp_img_id', true ); 276 | // Get the image src 277 | $twp_img_src = wp_get_attachment_image_src( $twp_img_id); 278 | // For convenience, see if the array is valid 279 | $twp_have_img = is_array( $twp_img_src ); 280 | 281 | // File upload-link 282 | $twp_file_upload_link = esc_url( get_upload_iframe_src()); 283 | // See if there's a media id already saved as post meta 284 | $twp_file_id = get_post_meta( $ID, '_twp_file_id', true); 285 | if(!empty($twp_file_id)){ 286 | $attachment = wp_prepare_attachment_for_js($twp_file_id); 287 | $parsed = $attachment->url; 288 | $twp_file_src = dirname( $parsed [ 'path' ] ) . '/' . rawurlencode( basename( $parsed[ 'path' ] ) ); 289 | $twp_have_file = 1; 290 | } 291 | 292 | ?> 293 |
294 | 300 | 301 | 302 | 303 | 304 | 310 | 311 | 312 | 313 |

305 |
306 | value="1" />
307 | value="0" /> 308 |
309 |
314 |
315 |

316 | 317 | 326 | 327 |
328 | 329 | option_value; 375 | if ( $tstc != $_POST['twp_send_to_channel']) { 376 | $tstc = $_POST['twp_send_to_channel']; 377 | update_post_meta( $ID, '_twp_send_to_channel', $tstc); 378 | } else { 379 | delete_post_meta( $ID, '_twp_send_to_channel'); 380 | } 381 | # Load global options 382 | $pattern = $tdata['twp_channel_pattern']->option_value; 383 | $thumb_method = $tdata['twp_send_thumb']->option_value; 384 | if ( $pattern != $_POST['twp_channel_pattern']) { 385 | $pattern = $_POST['twp_channel_pattern']; 386 | update_post_meta( $ID, '_twp_meta_pattern', $pattern); 387 | } else { 388 | delete_post_meta( $ID, '_twp_meta_pattern'); 389 | } 390 | if ( $thumb_method != $_POST['twp_send_thumb']){ 391 | $thumb_method = $_POST['twp_send_thumb']; 392 | update_post_meta( $ID, '_twp_send_thumb', $thumb_method); 393 | } else { 394 | delete_post_meta( $ID, '_twp_send_thumb'); 395 | } 396 | if (isset($_POST['twp_img_id'])){ 397 | $twp_img_id = $_POST['twp_img_id']; 398 | update_post_meta( $ID, '_twp_img_id', $twp_img_id); 399 | } else { 400 | $twp_img_id = 0; 401 | delete_post_meta( $ID, '_twp_img_id'); 402 | } 403 | if (isset($_POST['twp_file_id'])){ 404 | $twp_file_id = $_POST['twp_file_id']; 405 | update_post_meta( $ID, '_twp_file_id', $twp_file_id); 406 | } else { 407 | $twp_file_id = 0; 408 | delete_post_meta( $ID, '_twp_file_id'); 409 | } 410 | if($tstc == 1){ 411 | if ($post->post_status == "publish" && $post->post_password == ""){ 412 | twp_post_published ( $ID, $post, $pattern, $thumb_method, $twp_img_id, $twp_file_id ); 413 | } 414 | } 415 | } 416 | add_action( 'save_post', 'twp_save_meta_box_data', 10, 3 ); 417 | 418 | function twp_on_publish_future_post( $post ) { 419 | global $tdata; 420 | $ID = $post->ID; 421 | $tstc = get_post_meta($ID, '_twp_send_to_channel', true); 422 | $tstc = $tstc != "" ? $tstc : $tdata['twp_send_to_channel']->option_value; 423 | $pattern = get_post_meta($ID, '_twp_meta_pattern', true); 424 | $pattern = $pattern != "" ? $pattern : $tdata['twp_channel_pattern']->option_value; 425 | $thumb_method = get_post_meta($ID, '_twp_send_thumb', true); 426 | $thumb_method = $thumb_method != "" ? $thumb_method : $tdata[ 'twp_send_thumb']->option_value; 427 | $twp_img_id = get_post_meta( $ID, '_twp_img_id', true ); 428 | $twp_file_id = get_post_meta( $ID, '_twp_file_id', true ); 429 | if($tstc == 1){ 430 | twp_post_published ( $ID, $post, $pattern, $thumb_method, $twp_img_id, $twp_file_id ); 431 | } 432 | } 433 | add_action( 'future_to_publish', 'twp_on_publish_future_post', 10, 1 ); 434 | 435 | /** 436 | * When the post is published, send the messages. 437 | * @param int $ID 438 | * @param obj $post 439 | */ 440 | function twp_post_published ( $ID, $post, $pattern, $thumb_method, $twp_img_id, $twp_file_id ) { 441 | global $wpdb; 442 | global $table_name; 443 | global $tdata; 444 | if ($pattern == "" || $pattern == false){ 445 | $pattern = $tdata['twp_channel_pattern']->option_value; 446 | } 447 | if( $thumb_method != $tdata['twp_send_thumb']->option_value ) { 448 | $thumb_method = get_post_meta($ID, '_twp_send_thumb', true); 449 | } 450 | // If there is no pattern then return! 451 | if ($pattern == ""){ 452 | return; 453 | } 454 | switch ($thumb_method) { 455 | case 1: 456 | $method = 'photo'; 457 | $img_id = get_post_thumbnail_id($ID); 458 | $photo = get_attached_file($img_id); 459 | break; 460 | case 2: 461 | $method = 'photo'; 462 | $img_id = $twp_img_id; 463 | $photo = get_attached_file($img_id); 464 | break; 465 | default: 466 | $method = false; 467 | break; 468 | } 469 | // Initialize Telegram information 470 | switch ($tdata['twp_markdown']->option_value) { 471 | case 0: 472 | $parse_mode = null; 473 | break; 474 | case 1: 475 | $parse_mode = "Markdown"; 476 | break; 477 | case 2: 478 | $parse_mode = "HTML"; 479 | break; 480 | default: 481 | $parse_mode = null; 482 | break; 483 | } 484 | $ch_name = $tdata['twp_channel_username']->option_value; 485 | $token = $tdata['twp_bot_token']->option_value; 486 | $web_preview = $tdata['twp_web_preview']->option_value; 487 | $excerpt_length = intval($tdata['twp_excerpt_length']->option_value); 488 | if ($token == "" || $ch_name == ""){ 489 | update_post_meta( $ID, '_twp_meta_data', __('Bot token or Channel username aren\'t set!', 'twp-plugin') ); 490 | return; 491 | } 492 | if($post->post_type == 'product'){ 493 | $_pf = new WC_Product_Factory(); 494 | $product = $_pf->get_product($ID); 495 | $tags_array = explode(', ' , $product->get_tags()); 496 | $categories_array = explode(', ' ,$product->get_categories()); 497 | } else { 498 | $tags_array = wp_get_post_tags( $ID, array( 'fields' => 'names' ) ); 499 | $categories_array = wp_get_post_categories($ID, array( 'fields' => 'names' )); 500 | } 501 | foreach ($tags_array as $tag) { 502 | $tags .= " #".$tag; 503 | } 504 | foreach ($categories_array as $cat) { 505 | $categories .= "|".$cat; 506 | } 507 | // Preparing message for sending 508 | // Wordpress default tags and substitutes array 509 | $wp_tags = array("{ID}","{title}","{excerpt}","{content}","{author}","{short_url}","{full_url}","{tags}","{categories}"); 510 | $wp_subs = array( 511 | $post->ID, 512 | $post->post_title, 513 | wp_trim_words($post->post_content, $excerpt_length, "..."), 514 | $post->post_content, 515 | get_the_author_meta("display_name",$post->post_author), 516 | wp_get_shortlink($ID), 517 | get_permalink($ID), 518 | $tags, 519 | $categories 520 | ); 521 | // WooCommerce tags and substitutes array 522 | $wc_tags = array("{width}", "{length}", "{height}", "{weight}", "{price}", "{regular_price}", "{sale_price}", "{sku}", "{stock}", "{downloadable}", "{virtual}", "{sold_indiidually}", "{tax_status}", "{tax_class}", "{stock_status}", "{backorders}", "{featured}", "{visibility}"); 523 | if ($post->post_type == 'product'){ 524 | $p = $product; 525 | $wc_subs = array ($p->width, $p->length, $p->height, $p->weight, $p->price, $p->regular_price, $p->sale_price, $p->sku, $p->stock, $p->downloadable, $p->virtual, $p->sold_individually, $p->tax_status, $p->tax_class, $p->stock_status, $p->backorders, $p->featured, $p->visibility); 526 | } 527 | // The variables are case-sensitive. 528 | $re = $wp_tags; 529 | $subst = $wp_subs; 530 | if ($post->post_type == 'product'){ 531 | $p = $product; 532 | $re = array_merge($re, $wc_tags); 533 | $subst = array_merge($subst, $wc_subs); 534 | } else { 535 | // If it's not a product post then strip out all of the WooCommerce tags 536 | $strip_wc = 1; 537 | } 538 | 539 | if($parse_mode == "Markdown"){ 540 | $subst = str_replace(array("_", "*"), array("\_", "\*"), $subst); 541 | } 542 | 543 | $msg = str_replace($re, $subst, $pattern); 544 | 545 | if ($strip_wc == 1){ 546 | $msg = str_replace($wc_tags, '', $msg); 547 | } 548 | 549 | // Search for custom field pattern 550 | $re = "/%(#)?([\w\s]+)%/iu"; 551 | $number_of_cf = preg_match_all($re, $msg, $matches); 552 | if ($number_of_cf != 0){ 553 | $cf_tags_array = array(); 554 | $cf_value_array = array(); 555 | for ($i=0; $i < $number_of_cf; $i++) { 556 | $cf_value = get_post_meta($ID, $matches[2][$i], true); 557 | if ($matches[1][0] != ""){ 558 | if ($parse_mode == "Markdown") { 559 | $cf_value = str_replace(" ", "\_", $cf_value); 560 | } else { 561 | $cf_value = str_replace(" ", "_", $cf_value); 562 | } 563 | array_push($cf_value_array, "#".$cf_value); 564 | } 565 | array_push($cf_tags_array, $matches[0][$i]); 566 | } 567 | $msg = str_replace($cf_tags_array, $cf_value_array, $msg); 568 | } 569 | 570 | $msg = str_replace(' ','', $msg); 571 | 572 | $nt = new Notifcaster_Class(); 573 | $nt->_telegram($token, $parse_mode, $web_preview); 574 | if ($method == 'photo' && $photo != false ) { 575 | if($tdata['twp_img_position']->option_value == 1){ 576 | $msg = ''.$msg; 577 | $nt->web_preview = 0; 578 | $r = $nt->channel_text($ch_name, $msg); 579 | } else { 580 | $attachment = wp_prepare_attachment_for_js($img_id); 581 | if (mb_strlen($msg) < 200){ 582 | $file_caption = $msg; 583 | $file_format = 'image'; 584 | $file = $photo; 585 | $r1 = $nt->channel_file($ch_name, $file_caption, $file, $file_format ); 586 | } else { 587 | $file_caption = $attachment['caption']; 588 | $file_format = 'image'; 589 | $file = $photo; 590 | $r1 = $nt->channel_file($ch_name, $file_caption, $file, $file_format ); 591 | $r = $nt->channel_text($ch_name, $msg); 592 | } 593 | } 594 | } else { 595 | $r = $nt->channel_text($ch_name, $msg); 596 | } 597 | if($twp_file_id != 0){ 598 | $file = get_attached_file($twp_file_id); 599 | $attachment = wp_get_attachment($twp_file_id); 600 | $file_caption = $attachment['caption']; 601 | $file_format = $attachment['fileformat']; 602 | $nt->channel_file($ch_name, $file_caption, $file, $file_format); 603 | } 604 | $publish_date = current_time( "mysql", $gmt = 0 ); 605 | if ($r["ok"] == true){ 606 | $sending_result = 1; 607 | } else { 608 | $sending_result = $r["description"]."|| ".$msg; 609 | } 610 | $twp_log = $wpdb->get_row( "SELECT * FROM $table_name WHERE post_id = $ID"); 611 | if($twp_log == null){ 612 | $wpdb->replace( 613 | $table_name, 614 | array( 615 | 'time' => $publish_date, 616 | 'post_id' => $ID, 617 | 'sending_result' => $sending_result 618 | ) 619 | ); 620 | } else { 621 | $wpdb->update( 622 | $table_name, 623 | array( 624 | 'time' => $publish_date, 625 | 'post_id' => $ID, 626 | 'sending_result' => $sending_result 627 | ), 628 | array ('post_id' => $ID) 629 | ); 630 | } 631 | //update_post_meta( $ID, '_twp_send_to_channel', 0); 632 | //unset($_POST['twp_send_to_channel']); 633 | } 634 | // add_action( 'publish_post', 'twp_post_published', 10, 2 ); 635 | // add_action( 'publish_page', 'twp_post_published', 10, 2 ); 636 | 637 | function get_icon_for_attachment($attachment_id) { 638 | $base = includes_url() . "images/media/"; 639 | $type = get_post_mime_type($attachment_id); 640 | switch ($type) { 641 | case 'audio/mpeg': 642 | case 'audio/vorbis': 643 | case 'application/ogg': 644 | return $base . "image.png"; break; 645 | case 'video/mpeg': 646 | case 'video/mp4': 647 | case 'video/quicktime': 648 | return $base . "video.png"; break; 649 | default: 650 | return $base . "default.png"; 651 | } 652 | } 653 | function wp_get_attachment( $attachment_id ) { 654 | 655 | $attachment = get_post( $attachment_id ); 656 | $attachment_path = basename(get_attached_file($attachment_id)); 657 | error_log(print_r(wp_prepare_attachment_for_js($attachment_id),1)); 658 | return true; 659 | } 660 | 661 | function twp_ajax_test_callback() { 662 | $nt = new Notifcaster_Class(); 663 | switch ($_POST['subject']) { 664 | case 'm': 665 | //Send a test message using Notifcaster. 666 | $nt->_telegram($_POST['bot_token']); 667 | $result = $nt->sendmessage($_POST['chat_id'], $_POST['text']); 668 | echo json_encode($result); 669 | wp_die(); 670 | break; 671 | case 'c': 672 | //Send a test message to channel 673 | $nt->_telegram($_POST['bot_token'], $_POST['markdown'], $_POST['web_preview']); 674 | $msg = str_replace("\\", "", $_POST['msg']); 675 | $result = $nt->channel_text($_POST['channel_username'], $msg ); 676 | echo json_encode($result); 677 | wp_die(); 678 | break; 679 | case 'b': 680 | //Get bot info 681 | $nt->_telegram($_POST['bot_token']); 682 | $result = $nt->get_bot(); 683 | echo json_encode($result); 684 | wp_die(); 685 | break; 686 | case 'gm': 687 | //Get the number of members in a chat. 688 | $nt->_telegram($_POST['bot_token']); 689 | $result = $nt->get_members_count($_POST['channel_username']); 690 | echo json_encode($result); 691 | wp_die(); 692 | break; 693 | default: 694 | return "Invalid POST request"; 695 | break; 696 | } 697 | } 698 | add_action( 'wp_ajax_twp_ajax_test', 'twp_ajax_test_callback' ); 699 | 700 | ?> -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ameer/telegram-for-wordpress/69f79b026784e360e7d1515f31211e77df6223d5/icon.png -------------------------------------------------------------------------------- /inc/Notifcaster.class.php: -------------------------------------------------------------------------------- 1 | 6 | * Attention! $method always must be started with slash " / " 7 | * @category Telegram Bot API 8 | * @package Telegram for WordPress 9 | * @author Ameer Mousavi 10 | * @copyright 2015-2018 Ameer Mousavi 11 | * @license GPLv3 or later. 12 | * @version 1.6 13 | * @link http://notifcaster.com 14 | */ 15 | 16 | // Remove below line if you want using this file outside of WordPress 17 | if ( ! defined( 'ABSPATH' ) ) exit; 18 | 19 | if (!defined('PHP_VERSION_ID')) { 20 | $version = explode('.', PHP_VERSION); 21 | 22 | define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); 23 | } 24 | if (PHP_VERSION_ID < 50207) { 25 | define('PHP_MAJOR_VERSION', $version[0]); 26 | define('PHP_MINOR_VERSION', $version[1]); 27 | define('PHP_RELEASE_VERSION', $version[2]); 28 | } 29 | class Notifcaster_Class 30 | { 31 | protected 32 | $api_token = null, 33 | $url = 'https://api.telegram.org/bot', 34 | $api_method = null, 35 | $parse_mode = null; 36 | public 37 | $web_preview = 0; 38 | /** 39 | * Notifcaster API constructor 40 | * @param string $api_token 41 | * @param string $url 42 | */ 43 | public function Notifcaster($api_token, $url = 'https://tg-notifcaster.rhcloud.com/api/v1') 44 | { 45 | $this->api_token = $api_token; 46 | $this->url = $url; 47 | } 48 | /** 49 | * Telegram API constructor 50 | * 51 | * @param string $bot_token 52 | * @param string $parse_mode - default 53 | * 54 | */ 55 | public function _telegram($bot_token, $parse_mode = null, $web_preview = 0) 56 | { 57 | $this->url = 'https://api.telegram.org/bot'.$bot_token; 58 | $this->parse_mode = $parse_mode; 59 | $this->web_preview = $web_preview; 60 | } 61 | /** 62 | * Send Notification to user 63 | * 64 | * @param string $msg 65 | * 66 | * @return string 67 | */ 68 | public function notify($msg = 'NULL') 69 | { 70 | $msg = strip_tags($msg); 71 | //The below condition should be go inside make_request 72 | if (isset($msg)) { 73 | if(mb_strlen($msg) > 4096){ 74 | $splitted_text = $this->str_split_unicode($msg, 4096); 75 | } 76 | } 77 | $this->api_method = "/selfMessage"; 78 | if (isset($splitted_text)) { 79 | foreach ($splitted_text as $text_part) { 80 | $params = array( 81 | 'api_token' => $this->api_token, 82 | 'msg' => $text_part 83 | ); 84 | $response = $this->make_request($params); 85 | } 86 | } else { 87 | $params = array( 88 | 'api_token' => $this->api_token, 89 | 'msg' => $msg 90 | ); 91 | $response = $this->make_request($params); 92 | } 93 | return $response; 94 | } 95 | /** 96 | * Get bot info from Telegram 97 | * 98 | * @return JSON 99 | */ 100 | public function get_bot() 101 | { 102 | $params = array(); 103 | $this->api_method = "/getMe"; 104 | $response = $this->make_request($params); 105 | return $response; 106 | } 107 | /** 108 | * Get the number of members in a chat. 109 | * @param string $chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) 110 | * 111 | * @return JSON 112 | */ 113 | public function get_members_count($chat_id) 114 | { 115 | if($chat_id == null || $chat_id == ''){ 116 | return; 117 | } 118 | $params = array( 119 | 'chat_id' => $chat_id 120 | ); 121 | $this->api_method = "/getChatMembersCount"; 122 | $response = $this->make_request($params); 123 | return $response; 124 | } 125 | /** 126 | * Send text message to channel 127 | * 128 | * @param string $chat_id 129 | * @param string $msg 130 | * 131 | * @return string 132 | */ 133 | public function sendmessage($chat_id , $msg) 134 | { 135 | $params = array( 136 | 'chat_id' => $chat_id, 137 | 'text' => $this->prepare_text($msg), 138 | 'parse_mode' => $this->parse_mode, 139 | 'disable_web_page_preview' => $this->web_preview 140 | ); 141 | $this->api_method = "/sendMessage"; 142 | $response = $this->make_request($params); 143 | return $response; 144 | } 145 | /** 146 | * Send photo message to channel 147 | * @deprecated deprecated since version 1.6 148 | */ 149 | public function channel_photo($chat_id , $caption , $photo) 150 | { 151 | $params = array( 152 | 'chat_id' => $chat_id, 153 | 'caption' => $caption, 154 | 'photo' => $photo 155 | ); 156 | $this->api_method = "/sendPhoto"; 157 | $file_upload = true; 158 | $response = $this->make_request($params, $file_upload); 159 | return $response; 160 | } 161 | /** 162 | * Send file to channel based on its format 163 | * 164 | * @param string $chat_id 165 | * @param string $caption 166 | * @param string $file relative path to file 167 | * 168 | * @return string 169 | */ 170 | public function channel_file($chat_id , $caption , $file, $file_format) 171 | { 172 | switch ($file_format) { 173 | case 'image': 174 | $method = 'photo'; 175 | break; 176 | case 'mp3': 177 | $method = 'audio'; 178 | break; 179 | case 'mp4': 180 | $method = 'video'; 181 | break; 182 | default: 183 | $method = 'document'; 184 | break; 185 | } 186 | $params = array( 187 | 'chat_id' => $chat_id, 188 | 'caption' => $caption, 189 | $method => $file 190 | ); 191 | $this->api_method = "/send".$method; 192 | $file_upload = true; 193 | $file_param = $method; 194 | $response = $this->make_request($params, $file_upload, $file_param); 195 | return $response; 196 | } 197 | 198 | /** 199 | * Request Function 200 | * 201 | * @param array $params 202 | * @param string $file_upload 203 | * 204 | * @return string "success" || error message 205 | */ 206 | protected function make_request(array $params = array(), $file_upload = false, $file_param = '') 207 | { 208 | $default_params = $params; 209 | if (!empty($params)) { 210 | if (isset($params['caption'])) { 211 | if (mb_strlen($params['caption']) > 200){ 212 | $params['caption'] = $this->str_split_unicode($params['caption'], 200); 213 | $params['caption'] = $params['caption'][0]; 214 | } 215 | } 216 | if (isset($params['text'])) { 217 | if(mb_strlen($params['text']) > 4096){ 218 | $splitted_text = $this->str_split_unicode($params['text'], 4096); 219 | } 220 | } 221 | } 222 | if (function_exists('curl_init')) { 223 | $curl = curl_init($this->url.$this->api_method); 224 | if (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 5){ 225 | curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true); 226 | } 227 | if ($file_upload) { 228 | if (class_exists('CURLFile')) { 229 | $params[$file_param] = new CURLFile($params[$file_param]); 230 | } else { 231 | $params = $this->curl_custom_postfields($curl, array('chat_id' => $params['chat_id'], 'caption' => $params['caption']), array($file_param => $params[$file_param])); 232 | } 233 | } else { 234 | $params = http_build_query($params); 235 | } 236 | curl_setopt_array($curl, array( 237 | CURLOPT_SSL_VERIFYPEER => 0, 238 | CURLOPT_SSL_VERIFYHOST => 0, 239 | CURLOPT_RETURNTRANSFER => 1, 240 | CURLOPT_POST => 1, 241 | CURLOPT_POSTFIELDS => $params 242 | )); 243 | $response = curl_exec($curl); 244 | curl_close($curl); 245 | // if text 246 | if (isset($splitted_text)) { 247 | $curl = curl_init($this->url."/sendMessage"); 248 | curl_setopt_array($curl, array( 249 | CURLOPT_SSL_VERIFYPEER => 0, 250 | CURLOPT_SSL_VERIFYHOST => 0, 251 | CURLOPT_RETURNTRANSFER => 1, 252 | CURLOPT_POST => 1 253 | )); 254 | foreach ($splitted_text as $text_part) { 255 | $params = array( 256 | 'chat_id' => $default_params['chat_id'], 257 | 'text' => $this->prepare_text($text_part), 258 | 'parse_mode' => $this->parse_mode, 259 | 'disable_web_page_preview' => $this->web_preview 260 | ); 261 | $params = http_build_query($params); 262 | curl_setopt($curl, CURLOPT_POSTFIELDS, $params); 263 | $response = curl_exec($curl); 264 | } 265 | curl_close($curl); 266 | } 267 | 268 | } else { 269 | $context = stream_context_create(array( 270 | 'http' => array( 271 | 'method' => 'POST', 272 | 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 273 | 'content' => $params, 274 | 'timeout' => 10, 275 | ), 276 | )); 277 | $response = file_get_contents($this->url.$this->api_method, false, $context); 278 | } 279 | return $this->response = json_decode($response, true); 280 | } 281 | 282 | /** 283 | * Helpers 284 | */ 285 | 286 | /** 287 | * For safe multipart POST request for PHP5.3 ~ PHP 5.4. 288 | * @author https://twitter.com/mpyw 289 | * @param resource $ch cURL resource 290 | * @param array $assoc "name => value" 291 | * @param array $files "name => path" 292 | * @return string 293 | */ 294 | protected function curl_custom_postfields($ch, array $assoc = array(), array $files = array()) { 295 | 296 | // invalid characters for "name" and "filename" 297 | static $disallow = array("\0", "\"", "\r", "\n"); 298 | 299 | // initialize body 300 | $body = array(); 301 | 302 | // build normal parameters 303 | foreach ($assoc as $k => $v) { 304 | $k = str_replace($disallow, "_", $k); 305 | $body[] = implode("\r\n", array( 306 | "Content-Disposition: form-data; name=\"{$k}\"", 307 | "", 308 | filter_var($v), 309 | )); 310 | } 311 | 312 | // build file parameters 313 | foreach ($files as $k => $v) { 314 | switch (true) { 315 | case false === $v = realpath(filter_var($v)): 316 | case !is_file($v): 317 | case !is_readable($v): 318 | continue; // or return false, throw new InvalidArgumentException 319 | } 320 | $data = file_get_contents($v); 321 | $v = call_user_func("end", explode(DIRECTORY_SEPARATOR, $v)); 322 | list($k, $v) = str_replace($disallow, "_", array($k, $v)); 323 | $body[] = implode("\r\n", array( 324 | "Content-Disposition: form-data; name=\"{$k}\"; filename=\"{$v}\"", 325 | "Content-Type: application/octet-stream", 326 | "", 327 | $data, 328 | )); 329 | } 330 | 331 | // generate safe boundary 332 | do { 333 | $boundary = "---------------------" . md5(mt_rand() . microtime()); 334 | } while (preg_grep("/{$boundary}/", $body)); 335 | 336 | // add boundary for each parameters 337 | foreach ($body as &$part) { 338 | $part = "--{$boundary}\r\n{$part}"; unset($part); 339 | } 340 | 341 | // add final boundary 342 | $body[] = "--{$boundary}--"; 343 | $body[] = ""; 344 | 345 | // set options 346 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( 347 | "Expect: 100-continue", 348 | "Content-Type: multipart/form-data; boundary={$boundary}", // change Content-Type 349 | ) 350 | ); 351 | return implode("\r\n", $body); 352 | } 353 | 354 | /** 355 | * Convert HTML tags to Telegram markdown format 356 | * @param string $html content with HTML tags 357 | * @param boolean $b to *bold text* 358 | * @param boolean $i to _italic text_ 359 | * @param boolean $u to [text](url) 360 | * @return string 361 | */ 362 | public function markdown ($html, $b = 0, $i = 0, $u = 0) { 363 | $allowed_tags = ""; 364 | $re = array(); 365 | $subst = array(); 366 | if ($b){ 367 | $allowed_tags .= ""; 368 | array_push($re, "/(.+?)<\\/strong>/uis"); 369 | array_push($subst, "*$1*"); 370 | } 371 | if ($i){ 372 | $allowed_tags .= ""; 373 | array_push($re, "/(.+?)<\\/em>/uis"); 374 | array_push($subst, "_$1_"); 375 | } 376 | if ($u){ 377 | $allowed_tags .= ""; 378 | array_push($re, "/]*?\\s+)?href=[\"']?([^'\"]*)[\"']?.*?>(.*?)<\\/a>/uis"); 379 | array_push($subst, "[$2]($1)"); 380 | } 381 | array_push($re, "/[\*](.+)?(\[.+\]\(.+\))(.+)?[\*]/ui", "/[_](.+)?(\[.+\]\(.+\))(.+)?[_]/ui"); 382 | array_push($subst, "$2", "$2"); 383 | $html = strip_tags($html, $allowed_tags); 384 | $result = preg_replace($re, $subst, $html); 385 | return $result; 386 | } 387 | /** 388 | * Split the Unicode string into characters 389 | * @param string $str The input string 390 | * @param integer $l Maximum length of the chunk 391 | * @author http://nl1.php.net/manual/en/function.str-split.php#107658 392 | */ 393 | public function str_split_unicode($str, $l = 0) { 394 | if ($l > 0) { 395 | $ret = array(); 396 | $len = mb_strlen($str, "UTF-8"); 397 | for ($i = 0; $i < $len; $i += $l) { 398 | $ret[] = mb_substr($str, $i, $l, "UTF-8"); 399 | } 400 | return $ret; 401 | } 402 | return preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY); 403 | } 404 | /** 405 | * Prepare text to compatible with Telegram format. 406 | * @param string $str 407 | * @return string 408 | */ 409 | public function prepare_text($str){ 410 | $str = stripslashes($str); 411 | if (strtolower($this->parse_mode) == "markdown") { 412 | $str = $this->markdown($str, 1, 1, 1); 413 | } elseif (strtolower($this->parse_mode) == "html") { 414 | $excluded_tags = "
";
415 |             // Remove nested tags. The priority is  tags. For example if a link nested is between  or  tags, then these tags will removed.
416 |             $re = array();
417 |             $subst = array();
418 |             array_push($re, "/()(.+)?(]*?\s+)?href=[\"']?([^'\"]*)[\"']?.*?>(.*?)<\/a>)(.+)?(<\/em>)/ui", "/()(.+)?(]*?\s+)?href=[\"']?([^'\"]*)[\"']?.*?>(.*?)<\/a>)(.+)?(<\/strong>)/ui");
419 |             array_push($subst, "$3", "$3");
420 |             $str = preg_replace($re, $subst, $str);
421 |             $str = strip_tags($str, $excluded_tags);
422 |         }
423 |         return $str;
424 |     }
425 | 
426 |     /**
427 |      * Get file info and send it to Telegram using the correct method
428 |      */
429 | }
430 | ?>


--------------------------------------------------------------------------------
/inc/composer.php:
--------------------------------------------------------------------------------
  1 | 
 11 | 
 47 | 
 48 | 	
 49 | 		

50 | 51 | 52 |

53 | 56 |

57 |
58 | 95 | 289 | 🔗".__("Emoji full list", "twp-plugin").""; 291 | echo "🔗".__("Patterns Template", "twp-plugin").""; 292 | ?> 293 |
294 |
295 | 296 |
297 |
298 |
299 | value="0"> 300 | 301 |
302 | value="1"> 303 | 304 |
305 | base == 'post'){ 309 | ?> 310 | value="2"> 311 | 312 |
313 | 314 | 315 | 316 |
317 | 318 | 328 | 329 | 330 | 331 |
332 | 333 | 334 | base == 'post'){ 337 | ?> 338 | 339 | 340 |

341 | 342 | 343 |

344 | 347 |

348 |
349 |
350 | 351 | "> 352 | 353 |
354 |
355 | 356 |

Title:

357 |

Caption:

358 |

Size:

359 | 360 |
361 |
362 | 363 | 373 | 374 | 375 | 376 | 377 | -------------------------------------------------------------------------------- /inc/css/spectre.min.css: -------------------------------------------------------------------------------- 1 | /*! Spectre.css v0.5.0 | MIT License | github.com/picturepan2/spectre */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}address{font-style:normal}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:"SF Mono","Segoe UI Mono","Roboto Mono",Menlo,Courier,monospace;font-size:1em}dfn{font-style:italic}small{font-size:80%;font-weight:400}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}fieldset{border:0;margin:0;padding:0}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item;outline:0}canvas{display:inline-block}template{display:none}[hidden]{display:none}*,::after,::before{box-sizing:inherit}html{box-sizing:border-box;font-size:20px;line-height:1.5;-webkit-tap-highlight-color:transparent}body{background:#fff;color:#50596c;font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif;font-size:.8rem;overflow-x:hidden;text-rendering:optimizeLegibility}a{color:#5755d9;outline:0;text-decoration:none}a:focus{box-shadow:0 0 0 .1rem rgba(87,85,217,.2)}a.active,a:active,a:focus,a:hover{color:#4240d4;text-decoration:underline}h1,h2,h3,h4,h5,h6{color:inherit;font-weight:500;line-height:1.2;margin-bottom:.5em;margin-top:0}.h1,.h2,.h3,.h4,.h5,.h6{font-weight:500}.h1,h1{font-size:2rem}.h2,h2{font-size:1.6rem}.h3,h3{font-size:1.4rem}.h4,h4{font-size:1.2rem}.h5,h5{font-size:1rem}.h6,h6{font-size:.8rem}p{margin:0 0 1rem}a,ins,u{-webkit-text-decoration-skip:ink edges;text-decoration-skip:ink edges}abbr[title]{border-bottom:.05rem dotted;cursor:help;text-decoration:none}kbd{background:#454d5d;border-radius:.1rem;color:#fff;font-size:.7rem;line-height:1.2;padding:.1rem .15rem}mark{background:#ffe9b3;border-radius:.1rem;color:#50596c;padding:.05rem}blockquote{border-left:.1rem solid #e7e9ed;margin-left:0;padding:.4rem .8rem}blockquote p:last-child{margin-bottom:0}ol,ul{/* margin:.8rem 0 .8rem .8rem; */padding:0;}ol ol, ol ul, ul ol, ul ul{/* margin:.8rem 0 .8rem .8rem */}ol li,ul li{margin-top:.4rem}ul{list-style:disc inside}ul ul{list-style-type:circle}ol{list-style:decimal inside}ol ol{list-style-type:lower-alpha}dl dt{font-weight:700}dl dd{margin:.4rem 0 .8rem 0}:lang(zh){font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Helvetica Neue",sans-serif}:lang(ja){font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Hiragino Sans","Hiragino Kaku Gothic Pro","Yu Gothic",YuGothic,Meiryo,"Helvetica Neue",sans-serif}:lang(ko){font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Malgun Gothic","Helvetica Neue",sans-serif}.cjk ins,.cjk u,:lang(ja) ins,:lang(ja) u,:lang(zh) ins,:lang(zh) u{border-bottom:.05rem solid;text-decoration:none}.cjk del+del,.cjk del+s,.cjk ins+ins,.cjk ins+u,.cjk s+del,.cjk s+s,.cjk u+ins,.cjk u+u,:lang(ja) del+del,:lang(ja) del+s,:lang(ja) ins+ins,:lang(ja) ins+u,:lang(ja) s+del,:lang(ja) s+s,:lang(ja) u+ins,:lang(ja) u+u,:lang(zh) del+del,:lang(zh) del+s,:lang(zh) ins+ins,:lang(zh) ins+u,:lang(zh) s+del,:lang(zh) s+s,:lang(zh) u+ins,:lang(zh) u+u{margin-left:.125em}.table{border-collapse:collapse;border-spacing:0;text-align:left;width:100%}.table.table-striped tbody tr:nth-of-type(odd){background:#f8f9fa}.table tbody tr.active,.table.table-striped tbody tr.active{background:#f0f1f4}.table.table-hover tbody tr:hover{background:#f0f1f4}.table.table-scroll{display:block;overflow-x:auto;padding-bottom:.75rem;white-space:nowrap}.table td,.table th{border-bottom:.05rem solid #e7e9ed;padding:.6rem .4rem}.table th{border-bottom-width:.1rem}.btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:.05rem solid #5755d9;border-radius:.1rem;color:#5755d9;cursor:pointer;display:inline-block;font-size:.8rem;height:1.8rem;line-height:1rem;outline:0;padding:.35rem .4rem;text-align:center;text-decoration:none;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;white-space:nowrap}.btn:focus{box-shadow:0 0 0 .1rem rgba(87,85,217,.2)}.btn:focus,.btn:hover{background:#f1f1fc;border-color:#4b48d6;text-decoration:none}.btn.active,.btn:active{background:#4b48d6;border-color:#3634d2;color:#fff;text-decoration:none}.btn.active.loading::after,.btn:active.loading::after{border-bottom-color:#fff;border-left-color:#fff}.btn.disabled,.btn:disabled,.btn[disabled]{cursor:default;opacity:.5;pointer-events:none}.btn.btn-primary{background:#5755d9;border-color:#4b48d6;color:#fff}.btn.btn-primary:focus,.btn.btn-primary:hover{background:#4240d4;border-color:#3634d2;color:#fff}.btn.btn-primary.active,.btn.btn-primary:active{background:#3a38d2;border-color:#302ecd;color:#fff}.btn.btn-error.loading::after,.btn.btn-primary.loading::after,.btn.btn-success.loading::after{border-bottom-color:#fff;border-left-color:#fff}.btn.btn-success{background:#32b643;border-color:#2faa3f;color:#fff}.btn.btn-success:focus{box-shadow:0 0 0 .1rem rgba(50,182,67,.2)}.btn.btn-success:focus,.btn.btn-success:hover{background:#30ae40;border-color:#2da23c;color:#fff}.btn.btn-success.active,.btn.btn-success:active{background:#2a9a39;border-color:#278e34;color:#fff}.btn.btn-error{background:#e85600;border-color:#d95000;color:#fff}.btn.btn-error:focus{box-shadow:0 0 0 .1rem rgba(232,86,0,.2)}.btn.btn-error:focus,.btn.btn-error:hover{background:#de5200;border-color:#cf4d00;color:#fff}.btn.btn-error.active,.btn.btn-error:active{background:#c44900;border-color:#b54300;color:#fff}.btn.btn-link{background:0 0;border-color:transparent;color:#5755d9}.btn.btn-link.active,.btn.btn-link:active,.btn.btn-link:focus,.btn.btn-link:hover{color:#4240d4}.btn.btn-sm{font-size:.7rem;height:1.4rem;padding:.15rem .3rem}.btn.btn-lg{font-size:.9rem;height:2rem;padding:.45rem .6rem}.btn.btn-block{display:block;width:100%}.btn.btn-action{padding-left:0;padding-right:0;width:1.8rem}.btn.btn-action.btn-sm{width:1.4rem}.btn.btn-action.btn-lg{width:2rem}.btn.btn-clear{background:0 0;border:0;color:currentColor;height:.8rem;line-height:.8rem;margin-left:.2rem;margin-right:-2px;opacity:1;padding:0;text-decoration:none;width:.8rem}.btn.btn-clear:hover{opacity:.95}.btn.btn-clear::before{content:"\2715"}.btn-group{display:inline-flex;display:-ms-inline-flexbox;-ms-flex-wrap:wrap;flex-wrap:wrap}.btn-group .btn{-ms-flex:1 0 auto;flex:1 0 auto}.btn-group .btn:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group .btn:not(:first-child):not(:last-child){border-radius:0;margin-left:-.05rem}.btn-group .btn:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-.05rem}.btn-group .btn.active,.btn-group .btn:active,.btn-group .btn:focus,.btn-group .btn:hover{z-index:1}.btn-group.btn-group-block{display:flex;display:-ms-flexbox}.btn-group.btn-group-block .btn{-ms-flex:1 0 0;flex:1 0 0}.form-group:not(:last-child){margin-bottom:.4rem}fieldset{margin-bottom:.8rem}legend{font-size:.9rem;font-weight:500;margin-bottom:.8rem}.form-label{display:block;line-height:1rem;padding:.4rem 0}.form-label.label-sm{font-size:.7rem;padding:.2rem 0}.form-label.label-lg{font-size:.9rem;padding:.5rem 0}.form-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;background-image:none;border:.05rem solid #caced7;border-radius:.1rem;color:#50596c;display:block;font-size:.8rem;height:1.8rem;line-height:1rem;max-width:100%;outline:0;padding:.35rem .4rem;position:relative;transition:all .2s ease;width:100%}.form-input:focus{border-color:#5755d9;box-shadow:0 0 0 .1rem rgba(87,85,217,.2)}.form-input::-webkit-input-placeholder{color:#acb3c2}.form-input:-ms-input-placeholder{color:#acb3c2}.form-input::placeholder{color:#acb3c2}.form-input.input-sm{font-size:.7rem;height:1.4rem;padding:.15rem .3rem}.form-input.input-lg{font-size:.9rem;height:2rem;padding:.45rem .6rem}.form-input.input-inline{display:inline-block;vertical-align:middle;width:auto}.form-input[type=file]{height:auto}textarea.form-input{height:auto}.form-input-hint{color:#acb3c2;font-size:.7rem;margin-top:.2rem}.has-success .form-input-hint,.is-success+.form-input-hint{color:#32b643}.has-error .form-input-hint,.is-error+.form-input-hint{color:#e85600}.form-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:.05rem solid #caced7;border-radius:.1rem;color:inherit;font-size:.8rem;height:1.8rem;line-height:1rem;outline:0;padding:.35rem .4rem;vertical-align:middle;width:100%}.form-select[multiple],.form-select[size]{height:auto}.form-select[multiple] option,.form-select[size] option{padding:.1rem .2rem}.form-select:not([multiple]):not([size]){background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%204%205'%3E%3Cpath%20fill='%23667189'%20d='M2%200L0%202h4zm0%205L0%203h4z'/%3E%3C/svg%3E") no-repeat right .35rem center/.4rem .5rem;padding-right:1.2rem}.form-select:focus{border-color:#5755d9;box-shadow:0 0 0 .1rem rgba(87,85,217,.2)}.form-select::-ms-expand{display:none}.form-select.select-sm{font-size:.7rem;height:1.4rem;padding:.15rem 1.1rem .15rem .3rem}.form-select.select-lg{font-size:.9rem;height:2rem;padding:.45rem 1.4rem .45rem .6rem}.has-icon-left,.has-icon-right{position:relative}.has-icon-left .form-icon,.has-icon-right .form-icon{height:.8rem;margin:0 .35rem;position:absolute;top:50%;transform:translateY(-50%);width:.8rem}.has-icon-left .form-icon{left:.05rem}.has-icon-left .form-input{padding-left:1.5rem}.has-icon-right .form-icon{right:.05rem}.has-icon-right .form-input{padding-right:1.5rem}.form-checkbox,.form-radio,.form-switch{display:inline-block;line-height:1rem;margin:.2rem 0;min-height:1.2rem;padding:.2rem .4rem .2rem 1.2rem;position:relative}.form-checkbox input,.form-radio input,.form-switch input{clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;position:absolute;width:1px}.form-checkbox input:focus+.form-icon,.form-radio input:focus+.form-icon,.form-switch input:focus+.form-icon{border-color:#5755d9;box-shadow:0 0 0 .1rem rgba(87,85,217,.2)}.form-checkbox input:checked+.form-icon,.form-radio input:checked+.form-icon,.form-switch input:checked+.form-icon{background:#5755d9;border-color:#5755d9}.form-checkbox .form-icon,.form-radio .form-icon,.form-switch .form-icon{border:.05rem solid #caced7;cursor:pointer;display:inline-block;position:absolute;transition:all .2s ease}.form-checkbox.input-sm,.form-radio.input-sm,.form-switch.input-sm{font-size:.7rem;margin:0}.form-checkbox.input-lg,.form-radio.input-lg,.form-switch.input-lg{font-size:.9rem;margin:.3rem 0}.form-checkbox .form-icon,.form-radio .form-icon{background:#fff;height:.8rem;left:0;top:.3rem;width:.8rem}.form-checkbox input:active+.form-icon,.form-radio input:active+.form-icon{background:#f0f1f4}.form-checkbox .form-icon{border-radius:.1rem}.form-checkbox input:checked+.form-icon::before{background-clip:padding-box;border:.1rem solid #fff;border-left-width:0;border-top-width:0;content:"";height:12px;left:50%;margin-left:-4px;margin-top:-8px;position:absolute;top:50%;transform:rotate(45deg);width:8px}.form-checkbox input:indeterminate+.form-icon{background:#5755d9;border-color:#5755d9}.form-checkbox input:indeterminate+.form-icon::before{background:#fff;content:"";height:2px;left:50%;margin-left:-5px;margin-top:-1px;position:absolute;top:50%;width:10px}.form-radio .form-icon{border-radius:50%}.form-radio input:checked+.form-icon::before{background:#fff;border-radius:50%;content:"";height:4px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:4px}.form-switch{padding-left:2rem}.form-switch .form-icon{background:#e7e9ed;background-clip:padding-box;border-radius:.45rem;height:.9rem;left:0;top:.25rem;width:1.6rem}.form-switch .form-icon::before{background:#fff;border-radius:50%;content:"";display:block;height:.8rem;left:0;position:absolute;top:0;transition:all .2s ease;width:.8rem}.form-switch input:checked+.form-icon::before{left:14px}.form-switch input:active+.form-icon::before{background:#f8f9fa}.input-group{display:flex;display:-ms-flexbox}.input-group .input-group-addon{background:#f8f9fa;border:.05rem solid #caced7;border-radius:.1rem;line-height:1rem;padding:.35rem .4rem;white-space:nowrap}.input-group .input-group-addon.addon-sm{font-size:.7rem;padding:.15rem .3rem}.input-group .input-group-addon.addon-lg{font-size:.9rem;padding:.45rem .6rem}.input-group .form-input,.input-group .form-select{-ms-flex:1 1 auto;flex:1 1 auto}.input-group .input-group-btn{z-index:1}.input-group .form-input:first-child:not(:last-child),.input-group .form-select:first-child:not(:last-child),.input-group .input-group-addon:first-child:not(:last-child),.input-group .input-group-btn:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.input-group .form-input:not(:first-child):not(:last-child),.input-group .form-select:not(:first-child):not(:last-child),.input-group .input-group-addon:not(:first-child):not(:last-child),.input-group .input-group-btn:not(:first-child):not(:last-child){border-radius:0;margin-left:-.05rem}.input-group .form-input:last-child:not(:first-child),.input-group .form-select:last-child:not(:first-child),.input-group .input-group-addon:last-child:not(:first-child),.input-group .input-group-btn:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-.05rem}.input-group .form-input:focus,.input-group .form-select:focus,.input-group .input-group-addon:focus,.input-group .input-group-btn:focus{z-index:2}.input-group .form-select{width:auto}.input-group.input-inline{display:inline-flex;display:-ms-inline-flexbox}.form-input.is-success,.form-select.is-success,.has-success .form-input,.has-success .form-select{border-color:#32b643}.form-input.is-success:focus,.form-select.is-success:focus,.has-success .form-input:focus,.has-success .form-select:focus{box-shadow:0 0 0 .1rem rgba(50,182,67,.2)}.form-input.is-error,.form-select.is-error,.has-error .form-input,.has-error .form-select{border-color:#e85600}.form-input.is-error:focus,.form-select.is-error:focus,.has-error .form-input:focus,.has-error .form-select:focus{box-shadow:0 0 0 .1rem rgba(232,86,0,.2)}.form-checkbox.is-error .form-icon,.form-radio.is-error .form-icon,.form-switch.is-error .form-icon,.has-error .form-checkbox .form-icon,.has-error .form-radio .form-icon,.has-error .form-switch .form-icon{border-color:#e85600}.form-checkbox.is-error input:checked+.form-icon,.form-radio.is-error input:checked+.form-icon,.form-switch.is-error input:checked+.form-icon,.has-error .form-checkbox input:checked+.form-icon,.has-error .form-radio input:checked+.form-icon,.has-error .form-switch input:checked+.form-icon{background:#e85600;border-color:#e85600}.form-checkbox.is-error input:focus+.form-icon,.form-radio.is-error input:focus+.form-icon,.form-switch.is-error input:focus+.form-icon,.has-error .form-checkbox input:focus+.form-icon,.has-error .form-radio input:focus+.form-icon,.has-error .form-switch input:focus+.form-icon{border-color:#e85600;box-shadow:0 0 0 .1rem rgba(232,86,0,.2)}.form-input:not(:placeholder-shown):invalid{border-color:#e85600}.form-input:not(:placeholder-shown):invalid:focus{box-shadow:0 0 0 .1rem rgba(232,86,0,.2)}.form-input:not(:placeholder-shown):invalid+.form-input-hint{color:#e85600}.form-input.disabled,.form-input:disabled,.form-select.disabled,.form-select:disabled{background-color:#f0f1f4;cursor:not-allowed;opacity:.5}.form-input[readonly]{background-color:#f8f9fa}input.disabled+.form-icon,input:disabled+.form-icon{background:#f0f1f4;cursor:not-allowed;opacity:.5}.form-switch input.disabled+.form-icon::before,.form-switch input:disabled+.form-icon::before{background:#fff}.form-horizontal{padding:.4rem 0}.form-horizontal .form-group{display:flex;display:-ms-flexbox}.label{background:#f0f1f4;border-radius:.1rem;color:#5b657a;display:inline-block;line-height:1.2;padding:.1rem .15rem}.label.label-rounded{border-radius:5rem;padding-left:.4rem;padding-right:.4rem}.label.label-primary{background:#5755d9;color:#fff}.label.label-secondary{background:#f1f1fc;color:#5755d9}.label.label-success{background:#32b643;color:#fff}.label.label-warning{background:#ffb700;color:#fff}.label.label-error{background:#e85600;color:#fff}code{background:#fdf4f4;border-radius:.1rem;color:#e06870;font-size:85%;line-height:1.2;padding:.1rem .15rem}.code{border-radius:.1rem;color:#50596c;position:relative}.code::before{color:#acb3c2;content:attr(data-lang);font-size:.7rem;position:absolute;right:.4rem;top:.1rem}.code code{background:#f8f9fa;color:inherit;display:block;line-height:1.5;overflow-x:auto;padding:1rem;width:100%}.img-responsive{display:block;height:auto;max-width:100%}.img-fit-cover{object-fit:cover}.img-fit-contain{object-fit:contain}.video-responsive{display:block;overflow:hidden;padding:0;position:relative;width:100%}.video-responsive::before{content:"";display:block;padding-bottom:56.25%}.video-responsive embed,.video-responsive iframe,.video-responsive object{border:0;bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}video.video-responsive{height:auto;max-width:100%}video.video-responsive::before{content:none}.video-responsive-4-3::before{padding-bottom:75%}.video-responsive-1-1::before{padding-bottom:100%}.figure{margin:0 0 .4rem 0}.figure .figure-caption{color:#667189;margin-top:.4rem}.container{margin-left:auto;margin-right:auto;padding-left:.4rem;padding-right:.4rem;width:100%}.container.grid-xl{max-width:1296px}.container.grid-lg{max-width:976px}.container.grid-md{max-width:856px}.container.grid-sm{max-width:616px}.container.grid-xs{max-width:496px}.show-lg,.show-md,.show-sm,.show-xl,.show-xs{display:none!important}.columns{display:flex;display:-ms-flexbox;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-left:-.4rem;margin-right:-.4rem}.columns.col-gapless{margin-left:0;margin-right:0}.columns.col-gapless>.column{padding-left:0;padding-right:0}.columns.col-oneline{-ms-flex-wrap:nowrap;flex-wrap:nowrap;overflow-x:auto}.column{-ms-flex:1;flex:1;max-width:100%;padding-left:.4rem;padding-right:.4rem}.column.col-1,.column.col-10,.column.col-11,.column.col-12,.column.col-2,.column.col-3,.column.col-4,.column.col-5,.column.col-6,.column.col-7,.column.col-8,.column.col-9{-ms-flex:none;flex:none}.col-12{width:100%}.col-11{width:91.66666667%}.col-10{width:83.33333333%}.col-9{width:75%}.col-8{width:66.66666667%}.col-7{width:58.33333333%}.col-6{width:50%}.col-5{width:41.66666667%}.col-4{width:33.33333333%}.col-3{width:25%}.col-2{width:16.66666667%}.col-1{width:8.33333333%}.col-auto{-ms-flex:0 0 auto;flex:0 0 auto;max-width:none;width:auto}.col-mx-auto{margin-left:auto;margin-right:auto}.col-ml-auto{margin-left:auto}.col-mr-auto{margin-right:auto}@media (max-width:1280px){.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9{-ms-flex:none;flex:none}.col-xl-12{width:100%}.col-xl-11{width:91.66666667%}.col-xl-10{width:83.33333333%}.col-xl-9{width:75%}.col-xl-8{width:66.66666667%}.col-xl-7{width:58.33333333%}.col-xl-6{width:50%}.col-xl-5{width:41.66666667%}.col-xl-4{width:33.33333333%}.col-xl-3{width:25%}.col-xl-2{width:16.66666667%}.col-xl-1{width:8.33333333%}.hide-xl{display:none!important}.show-xl{display:block!important}}@media (max-width:960px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{-ms-flex:none;flex:none}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.hide-lg{display:none!important}.show-lg{display:block!important}}@media (max-width:840px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{-ms-flex:none;flex:none}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.hide-md{display:none!important}.show-md{display:block!important}}@media (max-width:600px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{-ms-flex:none;flex:none}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.hide-sm{display:none!important}.show-sm{display:block!important}}@media (max-width:480px){.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{-ms-flex:none;flex:none}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.hide-xs{display:none!important}.show-xs{display:block!important}}.navbar{align-items:stretch;display:flex;display:-ms-flexbox;-ms-flex-align:stretch;-ms-flex-pack:justify;-ms-flex-wrap:wrap;flex-wrap:wrap;justify-content:space-between}.navbar .navbar-section{align-items:center;display:flex;display:-ms-flexbox;-ms-flex:1 0 0;flex:1 0 0;-ms-flex-align:center}.navbar .navbar-section:not(:first-child):last-child{-ms-flex-pack:end;justify-content:flex-end}.navbar .navbar-center{align-items:center;display:flex;display:-ms-flexbox;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-align:center}.navbar .navbar-brand{font-size:.9rem;font-weight:500;text-decoration:none}.accordion input:checked~.accordion-header .icon,.accordion[open] .accordion-header .icon{transform:rotate(90deg)}.accordion input:checked~.accordion-body,.accordion[open] .accordion-body{max-height:50rem}.accordion .accordion-header{display:block;padding:.2rem .4rem}.accordion .accordion-header .icon{transition:all .2s ease}.accordion .accordion-body{margin-bottom:.4rem;max-height:0;overflow:hidden;transition:max-height .2s ease}summary.accordion-header::-webkit-details-marker{display:none}.form-autocomplete{position:relative}.form-autocomplete .form-autocomplete-input{align-content:flex-start;display:flex;display:-ms-flexbox;-ms-flex-line-pack:start;-ms-flex-wrap:wrap;flex-wrap:wrap;height:auto;min-height:1.6rem;padding:.1rem}.form-autocomplete .form-autocomplete-input.is-focused{border-color:#5755d9;box-shadow:0 0 0 .1rem rgba(87,85,217,.2)}.form-autocomplete .form-autocomplete-input .form-input{border-color:transparent;box-shadow:none;display:inline-block;-ms-flex:1 0 auto;flex:1 0 auto;height:1.2rem;line-height:.8rem;margin:.1rem;width:auto}.form-autocomplete .menu{left:0;position:absolute;top:100%;width:100%}.avatar{background:#5755d9;border-radius:50%;color:rgba(255,255,255,.85);display:inline-block;font-size:.8rem;font-weight:300;height:1.6rem;line-height:1.25;margin:0;position:relative;vertical-align:middle;width:1.6rem}.avatar.avatar-xs{font-size:.4rem;height:.8rem;width:.8rem}.avatar.avatar-sm{font-size:.6rem;height:1.2rem;width:1.2rem}.avatar.avatar-lg{font-size:1.2rem;height:2.4rem;width:2.4rem}.avatar.avatar-xl{font-size:1.6rem;height:3.2rem;width:3.2rem}.avatar img{border-radius:50%;height:100%;position:relative;width:100%;z-index:1}.avatar .avatar-icon,.avatar .avatar-presence{background:#fff;bottom:14.64%;height:50%;padding:.1rem;position:absolute;right:14.64%;transform:translate(50%,50%);width:50%;z-index:2}.avatar .avatar-presence{background:#acb3c2;border-radius:50%;box-shadow:0 0 0 .1rem #fff;height:.5em;width:.5em}.avatar .avatar-presence.online{background:#32b643}.avatar .avatar-presence.busy{background:#e85600}.avatar .avatar-presence.away{background:#ffb700}.avatar[data-initial]::before{color:currentColor;content:attr(data-initial);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:1;text-transform: uppercase;}.badge{position:relative;white-space:nowrap}.badge:not([data-badge])::after,.badge[data-badge]::after{background:#5755d9;background-clip:padding-box;border-radius:.5rem;box-shadow:0 0 0 .1rem #fff;color:#fff;content:attr(data-badge);display:inline-block;transform:translate(-.1rem,-.5rem)}.badge[data-badge]::after{font-size:.7rem;height:.9rem;line-height:1;min-width:.9rem;padding:.1rem .2rem;text-align:center;white-space:nowrap}.badge:not([data-badge])::after,.badge[data-badge=""]::after{height:6px;min-width:6px;padding:0;width:6px}.badge.btn::after{position:absolute;right:0;top:0;transform:translate(50%,-50%)}.badge.avatar::after{position:absolute;right:14.64%;top:14.64%;transform:translate(50%,-50%);z-index:100}.badge.avatar-xs::after{content:"";height:.4rem;min-width:.4rem;padding:0;width:.4rem}.breadcrumb{list-style:none;margin:.2rem 0;padding:.2rem 0}.breadcrumb .breadcrumb-item{color:#667189;display:inline-block;margin:0;padding:.2rem 0}.breadcrumb .breadcrumb-item:not(:last-child){margin-right:.2rem}.breadcrumb .breadcrumb-item:not(:last-child) a{color:#667189}.breadcrumb .breadcrumb-item:not(:first-child)::before{color:#e7e9ed;content:"/";padding-right:.4rem}.bar{background:#f0f1f4;border-radius:.1rem;display:flex;display:-ms-flexbox;-ms-flex-wrap:nowrap;flex-wrap:nowrap;height:.8rem;width:100%}.bar.bar-sm{height:.2rem}.bar .bar-item{background:#5755d9;color:#fff;display:block;-ms-flex-negative:0;flex-shrink:0;font-size:.7rem;height:100%;line-height:.8rem;position:relative;text-align:center;width:0}.bar .bar-item:first-child{border-bottom-left-radius:.1rem;border-top-left-radius:.1rem}.bar .bar-item:last-child{border-bottom-right-radius:.1rem;border-top-right-radius:.1rem;-ms-flex-negative:1;flex-shrink:1}.bar-slider{height:.1rem;margin:.4rem 0;position:relative}.bar-slider .bar-item{left:0;padding:0;position:absolute}.bar-slider .bar-item:not(:last-child):first-child{background:#f0f1f4;z-index:1}.bar-slider .bar-slider-btn{background:#5755d9;border:0;border-radius:50%;height:.6rem;padding:0;position:absolute;right:0;top:50%;transform:translate(50%,-50%);width:.6rem}.bar-slider .bar-slider-btn:active{box-shadow:0 0 0 .1rem #5755d9}.card{background:#fff;border:.05rem solid #e7e9ed;border-radius:.1rem;display:flex;display:-ms-flexbox;-ms-flex-direction:column;flex-direction:column}.card .card-body,.card .card-footer,.card .card-header{padding:.8rem;padding-bottom:0}.card .card-body:last-child,.card .card-footer:last-child,.card .card-header:last-child{padding-bottom:.8rem}.card .card-image{padding-top:.8rem}.card .card-image:first-child{padding-top:0}.card .card-image:first-child img{border-top-left-radius:.1rem;border-top-right-radius:.1rem}.card .card-image:last-child img{border-bottom-left-radius:.1rem;border-bottom-right-radius:.1rem}.chip{align-items:center;background:#f0f1f4;border-radius:5rem;color:#667189;display:inline-flex;display:-ms-inline-flexbox;-ms-flex-align:center;font-size:90%;height:1.2rem;line-height:.8rem;margin:.1rem;max-width:100%;padding:.2rem .4rem;text-decoration:none;vertical-align:middle}.chip.active{background:#5755d9;color:#fff}.chip .avatar{margin-left:-.4rem;margin-right:.2rem}.dropdown{display:inline-block;position:relative}.dropdown .menu{animation:slide-down .15s ease 1;display:none;left:0;max-height:50vh;overflow-y:auto;position:absolute;top:100%}.dropdown.dropdown-right .menu{left:auto;right:0}.dropdown .dropdown-toggle:focus+.menu,.dropdown .menu:hover,.dropdown.active .menu{display:block}.dropdown .btn-group .dropdown-toggle:nth-last-child(2){border-bottom-right-radius:.1rem;border-top-right-radius:.1rem}.empty{background:#f8f9fa;border-radius:.1rem;color:#667189;padding:3.2rem 1.6rem;text-align:center}.empty .empty-icon{margin-bottom:.8rem}.empty .empty-subtitle,.empty .empty-title{margin:.4rem auto}.empty .empty-action{margin-top:.8rem}.menu{background:#fff;border-radius:.1rem;box-shadow:0 .05rem .2rem rgba(69,77,93,.3);list-style:none;margin:0;min-width:180px;padding:.4rem;transform:translateY(.2rem);z-index:100}.menu.menu-nav{background:0 0;box-shadow:none}.menu .menu-item{margin-top:0;padding:0 .4rem;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.menu .menu-item>a{border-radius:.1rem;color:inherit;display:block;margin:0 -.4rem;padding:.2rem .4rem;text-decoration:none}.menu .menu-item>a:focus,.menu .menu-item>a:hover{background:#f1f1fc;color:#5755d9}.menu .menu-item>a.active,.menu .menu-item>a:active{background:#f1f1fc;color:#5755d9}.menu .menu-item+.menu-item{margin-top:.2rem}.menu .menu-badge{float:right;padding:.2rem 0}.menu .menu-badge .btn{margin-top:-.1rem}.modal{align-items:center;bottom:0;display:none;-ms-flex-align:center;-ms-flex-pack:center;justify-content:center;left:0;opacity:0;overflow:hidden;padding:.4rem;position:fixed;right:0;top:0}.modal.active,.modal:target{display:flex;display:-ms-flexbox;opacity:1;z-index:400}.modal.active .modal-overlay,.modal:target .modal-overlay{background:rgba(248,249,250,.75);bottom:0;cursor:default;display:block;left:0;position:absolute;right:0;top:0}.modal.active .modal-container,.modal:target .modal-container{animation:slide-down .2s ease 1;max-width:640px;width:100%;z-index:1}.modal.modal-sm .modal-container{max-width:320px;padding:0 .4rem}.modal.modal-lg .modal-overlay{background:#fff}.modal.modal-lg .modal-container{box-shadow:none;max-width:960px}.modal-container{background:#fff;border-radius:.1rem;box-shadow:0 .2rem .5rem rgba(69,77,93,.3);display:block;padding:0 .8rem;text-align:left}.modal-container .modal-header{padding:.8rem}.modal-container .modal-body{max-height:50vh;overflow-y:auto;padding:.8rem;position:relative}.modal-container .modal-footer{padding:.8rem;text-align:right}.nav{display:flex;display:-ms-flexbox;-ms-flex-direction:column;flex-direction:column;list-style:none;margin:.2rem 0}.nav .nav-item a{color:#667189;padding:.2rem .4rem;text-decoration:none}.nav .nav-item a:focus,.nav .nav-item a:hover{color:#5755d9}.nav .nav-item.active>a{color:#50596c;font-weight:700}.nav .nav-item.active>a:focus,.nav .nav-item.active>a:hover{color:#5755d9}.nav .nav{margin-bottom:.4rem;margin-left:.8rem}.pagination{display:flex;display:-ms-flexbox;list-style:none;margin:.2rem 0;padding:.2rem 0}.pagination .page-item{margin:.2rem .05rem}.pagination .page-item span{display:inline-block;padding:.2rem .2rem}.pagination .page-item a{border-radius:.1rem;color:#667189;display:inline-block;padding:.2rem .4rem;text-decoration:none}.pagination .page-item a:focus,.pagination .page-item a:hover{color:#5755d9}.pagination .page-item.disabled a{cursor:default;opacity:.5;pointer-events:none}.pagination .page-item.active a{background:#5755d9;color:#fff}.pagination .page-item.page-next,.pagination .page-item.page-prev{-ms-flex:1 0 50%;flex:1 0 50%}.pagination .page-item.page-next{text-align:right}.pagination .page-item .page-item-title{margin:0}.pagination .page-item .page-item-subtitle{margin:0;opacity:.5}.panel{border:.05rem solid #e7e9ed;border-radius:.1rem;display:flex;display:-ms-flexbox;-ms-flex-direction:column;flex-direction: column;}.panel .panel-footer,.panel .panel-header{-ms-flex:0 0 auto;flex:0 0 auto;padding:.8rem}.panel .panel-nav{-ms-flex:0 0 auto;flex:0 0 auto}.panel .panel-body{-ms-flex:1 1 auto;flex:1 1 auto;overflow-y:auto;padding:0 .8rem;}.popover{display:inline-block;position:relative}.popover .popover-container{left:50%;opacity:0;padding:.4rem;position:absolute;top:0;transform:translate(-50%,-50%) scale(0);transition:transform .2s ease;width:320px;z-index:400}.popover .popover-container:hover,.popover :focus+.popover-container,.popover:hover .popover-container{display:block;opacity:1;transform:translate(-50%,-100%) scale(1)}.popover.popover-right .popover-container{left:100%;top:50%}.popover.popover-right .popover-container:hover,.popover.popover-right :focus+.popover-container,.popover.popover-right:hover .popover-container{transform:translate(0,-50%) scale(1)}.popover.popover-bottom .popover-container{left:50%;top:100%}.popover.popover-bottom .popover-container:hover,.popover.popover-bottom :focus+.popover-container,.popover.popover-bottom:hover .popover-container{transform:translate(-50%,0) scale(1)}.popover.popover-left .popover-container{left:0;top:50%}.popover.popover-left .popover-container:hover,.popover.popover-left :focus+.popover-container,.popover.popover-left:hover .popover-container{transform:translate(-100%,-50%) scale(1)}.popover .card{border:0;box-shadow:0 .2rem .5rem rgba(69,77,93,.3)}.step{display:flex;display:-ms-flexbox;-ms-flex-wrap:nowrap;flex-wrap:nowrap;list-style:none;margin:.2rem 0;width:100%}.step .step-item{-ms-flex:1 1 0;flex:1 1 0;margin-top:0;min-height:1rem;position:relative;text-align:center}.step .step-item:not(:first-child)::before{background:#5755d9;content:"";height:2px;left:-50%;position:absolute;top:9px;width:100%}.step .step-item a{color:#acb3c2;display:inline-block;padding:20px 10px 0;text-decoration:none}.step .step-item a::before{background:#5755d9;border:.1rem solid #fff;border-radius:50%;content:"";display:block;height:.6rem;left:50%;position:absolute;top:.2rem;transform:translateX(-50%);width:.6rem;z-index:1}.step .step-item.active a::before{background:#fff;border:.1rem solid #5755d9}.step .step-item.active~.step-item::before{background:#e7e9ed}.step .step-item.active~.step-item a::before{background:#e7e9ed}.tab{align-items:center;border-bottom:.05rem solid #e7e9ed;display:flex;display:-ms-flexbox;-ms-flex-align:center;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;margin:.2rem 0 .15rem 0}.tab .tab-item{margin-top:0}.tab .tab-item a{border-bottom:.1rem solid transparent;color:inherit;display:block;margin:0 .4rem 0 0;padding:.4rem .2rem .3rem .2rem;text-decoration:none}.tab .tab-item a:focus,.tab .tab-item a:hover{color:#5755d9}.tab .tab-item a.active,.tab .tab-item.active a{border-bottom-color:#5755d9;color:#5755d9}.tab .tab-item.tab-action{-ms-flex:1 0 auto;flex:1 0 auto;text-align:right}.tab .tab-item .btn-clear{margin-top:-.2rem}.tab.tab-block .tab-item{-ms-flex:1 0 0;flex:1 0 0;text-align:center}.tab.tab-block .tab-item a{margin:0}.tab.tab-block .tab-item .badge[data-badge]::after{position:absolute;right:.1rem;top:.1rem;transform:translate(0,0)}.tab:not(.tab-block) .badge{padding-right:0}.tile{align-content:space-between;align-items:flex-start;display:flex;display:-ms-flexbox;-ms-flex-align:start;-ms-flex-line-pack:justify}.tile .tile-action,.tile .tile-icon{-ms-flex:0 0 auto;flex:0 0 auto}.tile .tile-content{-ms-flex:1 1 auto;flex:1 1 auto}.tile .tile-content:not(:first-child){padding-left:.4rem}.tile .tile-content:not(:last-child){padding-right:.4rem}.tile .tile-subtitle,.tile .tile-title{line-height:1rem}.tile.tile-centered{align-items:center;-ms-flex-align:center}.tile.tile-centered .tile-content{overflow:hidden}.tile.tile-centered .tile-subtitle,.tile.tile-centered .tile-title{margin-bottom:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toast{background:rgba(69,77,93,.9);border:.05rem solid #454d5d;border-color:#454d5d;border-radius:.1rem;color:#fff;display:block;padding:.4rem;width:100%}.toast.toast-primary{background:rgba(87,85,217,.9);border-color:#5755d9}.toast.toast-success{background:rgba(50,182,67,.9);border-color:#32b643}.toast.toast-warning{background:rgba(255,183,0,.9);border-color:#ffb700}.toast.toast-error{background:rgba(232,86,0,.9);border-color:#e85600}.toast a{color:#fff;text-decoration:underline}.toast a.active,.toast a:active,.toast a:focus,.toast a:hover{opacity:.75}.toast .btn-clear{margin:4px -2px 4px 4px}.tooltip{position:relative}.tooltip::after{background:rgba(69,77,93,.9);border-radius:.1rem;bottom:100%;color:#fff;content:attr(data-tooltip);display:block;font-size:.7rem;left:50%;max-width:320px;opacity:0;overflow:hidden;padding:.2rem .4rem;pointer-events:none;position:absolute;text-overflow:ellipsis;transform:translate(-50%,.4rem);transition:all .2s ease;white-space:pre;z-index:300}.tooltip:focus::after,.tooltip:hover::after{opacity:1;transform:translate(-50%,-.2rem)}.tooltip.disabled,.tooltip[disabled]{pointer-events:auto}.tooltip.tooltip-right::after{bottom:50%;left:100%;transform:translate(-.2rem,50%)}.tooltip.tooltip-right:focus::after,.tooltip.tooltip-right:hover::after{transform:translate(.2rem,50%)}.tooltip.tooltip-bottom::after{bottom:auto;top:100%;transform:translate(-50%,-.4rem)}.tooltip.tooltip-bottom:focus::after,.tooltip.tooltip-bottom:hover::after{transform:translate(-50%,.2rem)}.tooltip.tooltip-left::after{bottom:50%;left:auto;right:100%;transform:translate(.4rem,50%)}.tooltip.tooltip-left:focus::after,.tooltip.tooltip-left:hover::after{transform:translate(-.2rem,50%)}@keyframes loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes slide-down{0%{opacity:0;transform:translateY(-1.6rem)}100%{opacity:1;transform:translateY(0)}}.text-primary{color:#5755d9}a.text-primary:focus,a.text-primary:hover{color:#4240d4}.text-secondary{color:#e5e5f9}a.text-secondary:focus,a.text-secondary:hover{color:#d1d0f4}.text-gray{color:#acb3c2}a.text-gray:focus,a.text-gray:hover{color:#9ea6b7}.text-light{color:#fff}a.text-light:focus,a.text-light:hover{color:#f2f2f2}.text-success{color:#32b643}a.text-success:focus,a.text-success:hover{color:#2da23c}.text-warning{color:#ffb700}a.text-warning:focus,a.text-warning:hover{color:#e6a500}.text-error{color:#e85600}a.text-error:focus,a.text-error:hover{color:#cf4d00}.bg-primary{background:#5755d9;color:#fff}.bg-secondary{background:#f1f1fc}.bg-dark{background:#454d5d;color:#fff}.bg-gray{background:#f8f9fa}.bg-success{background:#32b643;color:#fff}.bg-warning{background:#ffb700;color:#fff}.bg-error{background:#e85600;color:#fff}.c-hand{cursor:pointer}.c-move{cursor:move}.c-zoom-in{cursor:zoom-in}.c-zoom-out{cursor:zoom-out}.c-not-allowed{cursor:not-allowed}.c-auto{cursor:auto}.d-block{display:block}.d-inline{display:inline}.d-inline-block{display:inline-block}.d-flex{display:flex;display:-ms-flexbox}.d-inline-flex{display:inline-flex;display:-ms-inline-flexbox}.d-hide,.d-none{display:none!important}.d-visible{visibility:visible}.d-invisible{visibility:hidden}.text-hide{background:0 0;border:0;color:transparent;font-size:0;line-height:0;text-shadow:none}.text-assistive{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.divider,.divider-vert{display:block;position:relative}.divider-vert[data-content]::after,.divider[data-content]::after{background:#fff;color:#acb3c2;content:attr(data-content);display:inline-block;font-size:.7rem;padding:0 .4rem;transform:translateY(-.65rem)}.divider{border-top:.05rem solid #e7e9ed;height:.05rem;margin:.4rem 0}.divider[data-content]{margin:.8rem 0}.divider-vert{display:block;padding:.8rem}.divider-vert::before{border-left:.05rem solid #e7e9ed;bottom:.4rem;content:"";display:block;left:50%;position:absolute;top:.4rem;transform:translateX(-50%)}.divider-vert[data-content]::after{left:50%;padding:.2rem 0;position:absolute;top:50%;transform:translate(-50%,-50%)}.loading{color:transparent!important;min-height:.8rem;pointer-events:none;position:relative}.loading::after{animation:loading .5s infinite linear;border:.1rem solid #5755d9;border-radius:50%;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:.8rem;left:50%;margin-left:-.4rem;margin-top:-.4rem;position:absolute;top:50%;width:.8rem;z-index:1}.loading.loading-lg{min-height:2rem}.loading.loading-lg::after{height:1.6rem;margin-left:-.8rem;margin-top:-.8rem;width:1.6rem}.clearfix::after,.container::after{clear:both;content:"";display:table}.float-left{float:left!important}.float-right{float:right!important}.relative{position:relative}.absolute{position:absolute}.fixed{position:fixed}.centered{display:block;float:none;margin-left:auto;margin-right:auto}.flex-centered{align-items:center;display:flex;display:-ms-flexbox;-ms-flex-align:center;-ms-flex-pack:center;justify-content:center}.m-0{margin:0}.mb-0{margin-bottom:0}.ml-0{margin-left:0}.mr-0{margin-right:0}.mt-0{margin-top:0}.mx-0{margin-left:0;margin-right:0}.my-0{margin-bottom:0;margin-top:0}.m-1{margin:.2rem}.mb-1{margin-bottom:.2rem}.ml-1{margin-left:.2rem}.mr-1{margin-right:.2rem}.mt-1{margin-top:.2rem}.mx-1{margin-left:.2rem;margin-right:.2rem}.my-1{margin-bottom:.2rem;margin-top:.2rem}.m-2{margin:.4rem}.mb-2{margin-bottom:.4rem}.ml-2{margin-left:.4rem}.mr-2{margin-right:.4rem}.mt-2{margin-top:.4rem}.mx-2{margin-left:.4rem;margin-right:.4rem}.my-2{margin-bottom:.4rem;margin-top:.4rem}.p-0{padding:0}.pb-0{padding-bottom:0}.pl-0{padding-left:0}.pr-0{padding-right:0}.pt-0{padding-top:0}.px-0{padding-left:0;padding-right:0}.py-0{padding-bottom:0;padding-top:0}.p-1{padding:.2rem}.pb-1{padding-bottom:.2rem}.pl-1{padding-left:.2rem}.pr-1{padding-right:.2rem}.pt-1{padding-top:.2rem}.px-1{padding-left:.2rem;padding-right:.2rem}.py-1{padding-bottom:.2rem;padding-top:.2rem}.p-2{padding:.4rem}.pb-2{padding-bottom:.4rem}.pl-2{padding-left:.4rem}.pr-2{padding-right:.4rem}.pt-2{padding-top:.4rem}.px-2{padding-left:.4rem;padding-right:.4rem}.py-2{padding-bottom:.4rem;padding-top:.4rem}.rounded{border-radius:.1rem}.circle{border-radius:50%}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-normal{font-weight:400}.text-bold{font-weight:700}.text-italic{font-style:italic}.text-large{font-size:1.2em}.text-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-clip{overflow:hidden;text-overflow:clip;white-space:nowrap}.text-break{-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-break:break-word;word-wrap:break-word} -------------------------------------------------------------------------------- /inc/css/twp-admin.css: -------------------------------------------------------------------------------- 1 | .s-title, .s-subtitle { 2 | color: #414857; 3 | line-height: 1.8rem; 4 | margin-bottom: 0; 5 | padding-top: 1rem; 6 | padding-bottom: 1rem; 7 | } 8 | a:focus { 9 | box-shadow: 0 0 0 0 rgba(87,85,217,.2); 10 | } 11 | .twp-tab-content { 12 | padding: 15px; 13 | border-radius: 0 3px; 14 | box-shadow: 0px 2px 5px rgba(0,0,0,0.25); 15 | background: #fff; 16 | } 17 | .tab, li.tab-item { 18 | margin-bottom: 0 !important; 19 | } 20 | .panel { 21 | height: 100%; 22 | } 23 | .panel-body{ 24 | padding-top: .8rem !important; 25 | } 26 | .toast-title{font-weight:700}.toast-message{-ms-word-wrap:break-word;word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-close-button{position:relative;right:-.3em;top:-.3em;float:right;font-size:20px;font-weight:700;color:#fff;-webkit-text-shadow:0 1px 0 #fff;text-shadow:0 1px 0 #fff;opacity:.8;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);filter:alpha(opacity=80)}.toast-close-button:focus,.toast-close-button:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=40);filter:alpha(opacity=40)}button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.toast-top-center{top:0;right:0;width:100%}.toast-bottom-center{bottom:0;right:0;width:100%}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}#toast-container{position:fixed;z-index:999999;pointer-events:none}#toast-container *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#toast-container>div{position:relative;pointer-events:auto;overflow:hidden;margin:0 0 6px;padding:15px 15px 15px 50px;width:100vh;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;color:#fff;opacity:.8;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);filter:alpha(opacity=80)}#toast-container>:hover{-moz-box-shadow:0 0 12px #000;-webkit-box-shadow:0 0 12px #000;box-shadow:0 0 12px #000;opacity:1;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);filter:alpha(opacity=100);cursor:pointer}#toast-container.toast-bottom-center>div,#toast-container.toast-top-center>div{width: 100vh;margin-left:auto;margin-right:auto;}#toast-container.toast-bottom-full-width>div,#toast-container.toast-top-full-width>div{width:96%;margin-left:auto;margin-right:auto}.toast{background-color:#030303}.toast-success{background-color:#51a351}.toast-error{background-color:#bd362f}.toast-info{background-color:#2f96b4}.toast-warning{background-color:#f89406}.toast-progress{position:absolute;left:0;bottom:0;height:4px;background-color:#000;opacity:.4;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=40);filter:alpha(opacity=40)}@media all and (max-width:240px){#toast-container>div{padding:8px 8px 8px 50px;width:11em}#toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width:241px) and (max-width:480px){#toast-container>div{padding:8px 8px 8px 50px;width:18em}#toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width:481px) and (max-width:768px){#toast-container>div{padding:15px 15px 15px 50px;width:25em}} -------------------------------------------------------------------------------- /inc/js/emojione.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ameer/telegram-for-wordpress/69f79b026784e360e7d1515f31211e77df6223d5/inc/js/emojione.js -------------------------------------------------------------------------------- /inc/js/fn.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function ($) { 2 | 3 | /* 4 | * Select and upload custom image using WordPress Media dialog 5 | * from https://codex.wordpress.org/Javascript_Reference/wp.media 6 | */ 7 | // Set all variables to be used in scope 8 | var frame, 9 | metaBox = $('#twp_meta_box.postbox'), // Your meta box id here 10 | addImgLink = metaBox.find('.upload-custom-img'), 11 | delImgLink = metaBox.find('.delete-custom-img'), 12 | imgContainer = metaBox.find('.twp-img-container'), 13 | imgIdInput = metaBox.find('.twp-img-id'); 14 | // ADD IMAGE LINK 15 | addImgLink.on('click', function (event) { 16 | event.preventDefault(); 17 | // If the media frame already exists, reopen it. 18 | if (frame) { 19 | frame.open(); 20 | return; 21 | } 22 | // Create a new media frame 23 | frame = wp.media({ 24 | title: twp_js_obj.frame_title, 25 | button: { 26 | text: twp_js_obj.button_text 27 | }, 28 | library: { 29 | type: 'image' 30 | }, 31 | multiple: false // Set to true to allow multiple files to be selected 32 | }); 33 | // When an image is selected in the media frame... 34 | frame.on('select', function () { 35 | 36 | // Get media attachment details from the frame state 37 | var attachment = frame.state().get('selection').first().toJSON(); 38 | 39 | // Send the attachment URL to our custom image input field. 40 | imgContainer.append(''); 41 | 42 | // Send the attachment id to our hidden input 43 | imgIdInput.val(attachment.id); 44 | 45 | // Hide the add image link 46 | addImgLink.addClass('hidden'); 47 | 48 | // Unhide the remove image link 49 | delImgLink.removeClass('hidden'); 50 | }); 51 | 52 | // Finally, open the modal on click 53 | frame.open(); 54 | }); 55 | // DELETE IMAGE LINK 56 | delImgLink.on('click', function (event) { 57 | 58 | event.preventDefault(); 59 | 60 | // Clear out the preview image 61 | imgContainer.html(''); 62 | 63 | // Un-hide the add image link 64 | addImgLink.removeClass('hidden'); 65 | 66 | // Hide the delete image link 67 | delImgLink.addClass('hidden'); 68 | 69 | // Delete the image id from the hidden input 70 | imgIdInput.val(''); 71 | 72 | }); 73 | // File variables 74 | var file_frame, 75 | addFileLink = metaBox.find('.upload-custom-file'), 76 | delFileLink = metaBox.find('.delete-custom-file'), 77 | fileContainer = metaBox.find('.twp-file-container'), 78 | fileIcon = metaBox.find('#twp-file-icon'), 79 | fileDetails = metaBox.find('#twp-file-details'), 80 | fileIdInput = metaBox.find('.twp-file-id'); 81 | if (wp.media != undefined) { 82 | file_frame = wp.media({ 83 | title: twp_js_obj.file_frame_title, 84 | button: { 85 | text: twp_js_obj.file_button_text 86 | }, 87 | library: {}, 88 | multiple: false 89 | }); 90 | file_frame.on("select", function() { 91 | var a = file_frame.state().get("selection").first().toJSON(); 92 | console.log(a) 93 | var b = a; 94 | console.log(b); 95 | if (b.filesizeInBytes > 25e6) var c = '

Warning! The file size is larger than 25 MB . It may cause unexpected errors.

'; else if (b.filesizeInBytes > 5e7) var c = '

Error! The file size is larger than 50 MB . Telegram Bots can currently send files of up to 50 MB. Please select a smaller file.

'; else var c = ""; 96 | fileIcon.html(""); 97 | fileDetails.html(""); 98 | fileIcon.append('' + b.filename + ''); 99 | fileDetails.append("

Title: " + b.filename + "

Caption: " + b.caption + "

Size: " + b.filesizeHumanReadable + "

" + c); 100 | fileIdInput.val(a.id); 101 | addFileLink.addClass("hidden"); 102 | delFileLink.removeClass("hidden"); 103 | }); 104 | file_frame.on("open", function() { 105 | var a = file_frame.state().get("selection"); 106 | id = jQuery("input[name=twp_file_id]").val(); 107 | if (id) { 108 | attachment = wp.media.attachment(id); 109 | attachment.fetch(); 110 | a.add(attachment ? [ attachment ] : []); 111 | } 112 | }); 113 | fileIcon.on("click", function(a) { 114 | a.preventDefault(); 115 | file_frame.open(); 116 | }); 117 | addFileLink.on("click", function(a) { 118 | a.preventDefault(); 119 | file_frame.open(); 120 | }); 121 | delFileLink.on("click", function(a) { 122 | a.preventDefault(); 123 | fileIcon.html(""); 124 | fileDetails.html(""); 125 | addFileLink.removeClass("hidden"); 126 | delFileLink.addClass("hidden"); 127 | fileIdInput.val(""); 128 | }); 129 | } 130 | $("input[name=twp_send_thumb]").change(function () { 131 | if ($(this).val() == 2) { 132 | $("#twp-upload-link").removeClass("hidden"); 133 | } else { 134 | $("#twp-upload-link").addClass("hidden"); 135 | // Clear out the preview image 136 | imgContainer.html(''); 137 | 138 | // Un-hide the add image link 139 | addImgLink.removeClass('hidden'); 140 | 141 | // Hide the delete image link 142 | delImgLink.addClass('hidden'); 143 | 144 | // Delete the image id from the hidden input 145 | imgIdInput.val(''); 146 | } 147 | }) 148 | 149 | $("input[name=twp_markdown]").change(function () { 150 | if ($(this).val() == 0) { 151 | $("input:radio[name=twp_img_position][id=twp-img-0]").prop('checked', true); 152 | $("input:radio[name=twp_img_position][id=twp-img-1]").prop('disabled', true); 153 | $("#twp-img-1-error").removeClass('hidden'); 154 | } else { 155 | $("input:radio[name=twp_img_position][id=twp-img-1]").prop('disabled', false); 156 | $("#twp-img-1-error").addClass('hidden'); 157 | } 158 | }) 159 | 160 | $("#twp_send_to_channel").click(function () { 161 | if ($(this).prop("checked") == false) { 162 | $("#twp_fieldset").prop("disabled", true); 163 | $("#twp_fieldset label").css("color", "grey") 164 | } else { 165 | $("#twp_fieldset").prop("disabled", false); 166 | $("#twp_fieldset label").css("color", "black") 167 | } 168 | }); 169 | 170 | if ($('#twp_send_to_channel').prop("checked") == false) { 171 | $("#twp_fieldset").prop("disabled", true); 172 | $("#twp_fieldset label").css("color", "grey") 173 | } else { 174 | $("#twp_fieldset").prop("disabled", false); 175 | $("#twp_fieldset label").css("color", "black") 176 | } 177 | $('#patterns-select').change(function () { 178 | var tcp = '#twp_channel_pattern'; 179 | $(tcp).textrange('insert', $(this).val()) 180 | $(tcp).textrange('setcursor', $(tcp).textrange('get', 'end')); 181 | var str = $(tcp).val(); 182 | var preview = emojione.toImage(str); 183 | $('#output').html(preview); 184 | }) 185 | $('#emoji-select').change(function () { 186 | var tcp = '#twp_channel_pattern'; 187 | $(tcp).textrange('insert', $(this).val()) 188 | $(tcp).textrange('setcursor', $(tcp).textrange('get', 'end')); 189 | var str = $(tcp).val(); 190 | var preview = emojione.toImage(str); 191 | $('#output').html(preview); 192 | }) 193 | $("#twp_channel_pattern").keyup(function () { 194 | var str = $(this).val(); 195 | var preview = emojione.toImage(str); 196 | $('#output').html(preview); 197 | $(this).val(emojione.shortnameToUnicode(str)); 198 | var objDiv = document.getElementById("output"); 199 | objDiv.scrollTop = objDiv.scrollHeight; 200 | }) 201 | $('ul.tab').each(function(){ 202 | // For each set of tabs, we want to keep track of 203 | // which tab is active and it's associated content 204 | var $active, $content, $links = $(this).find('a'); 205 | 206 | // If the location.hash matches one of the links, use that as the active tab. 207 | // If no match is found, use the first link as the initial active tab. 208 | $active = $($links.filter('[href="'+sessionStorage.currentTab+'"]')[0] || $links[0]); 209 | $active.addClass('active'); 210 | 211 | $content = $($active[0].hash); 212 | 213 | // Hide the remaining content 214 | $links.not($active).each(function () { 215 | $(this.hash).hide(); 216 | }); 217 | 218 | // Bind the click event handler 219 | $(this).on('click', 'a', function(e){ 220 | if (typeof (Storage) !== 'undefined' && this.hash.startsWith("#twp")) { 221 | sessionStorage.currentTab = this.hash; 222 | } 223 | // Make the old tab inactive. 224 | $active.removeClass('active'); 225 | $content.hide(); 226 | 227 | // Update the variables with the new link and content 228 | $active = $(this); 229 | $content = $(this.hash); 230 | 231 | // Make the tab active. 232 | $active.addClass('active'); 233 | $content.fadeIn(400); 234 | 235 | //Prevent the anchor's default click action 236 | e.preventDefault(); 237 | }); 238 | }); 239 | $('#bot_info_chip').siblings('figure').attr('data-initial', $('#bot_info_chip').text().substr(0,2)) 240 | $("#checkbot").click(function() { 241 | if($('input[name=twp_bot_token]').val() != '' ) { 242 | var bot_token = $('input[name=twp_bot_token]').val(); 243 | $('#checkbot').toggleClass('loading'); 244 | $.post(ajaxurl, 245 | { 246 | bot_token: bot_token, subject: 'b', action:'twp_ajax_test' 247 | }, function( data ) { 248 | if (data != undefined && data.ok != false){ 249 | $('#bot_info_chip').text(data.result.first_name + " (@"+data.result.username+")").siblings('figure').attr('data-initial', data.result.first_name.substr(0,2)) 250 | $('input[name=twp_bot_name]').val(data.result.first_name); 251 | $('input[name=twp_bot_username]').val("@"+data.result.username); 252 | toastr["success"]("Token was successfully authorized.", "Success!") 253 | }else { 254 | $('#bot_info_chip').text("Bot Name").siblings('figure').attr('data-initial', "N/A") 255 | $('input[name=twp_bot_name]').val(""); 256 | $('input[name=twp_bot_username]').val(""); 257 | toastr["error"](data.description, "Oops! Error") 258 | } 259 | $('#checkbot').toggleClass('loading'); 260 | }, 'json'); 261 | } else { 262 | alert(twp_js_obj.bot_token_empty) 263 | } 264 | }); 265 | $('#send_test_msg').click(function () { 266 | var bot_token = $('input[name=twp_bot_token]').val(), chat_id = $('input[name=twp_chat_id]').val() , h = ''; 267 | if(bot_token != '' && chat_id != '') { 268 | $('#send_test_msg').toggleClass('loading'); 269 | if($("#twp_hashtag").val() != ''){ 270 | var h = $('#twp_hashtag').val(); 271 | } 272 | var text = h +'\n'+twp_js_obj.test_message+ '\n' + document.URL; 273 | $.post(ajaxurl, 274 | { 275 | chat_id: chat_id, text: text , bot_token: bot_token, subject: 'm', action:'twp_ajax_test' 276 | }, function( data ) { 277 | 278 | if (data != undefined && data.ok != false){ 279 | var res = data.result; 280 | if(res.chat.type == "private"){ 281 | $('#user_info').text(res.chat.first_name + " " + res.chat.last_name); 282 | } else { 283 | $('#user_info').text(res.chat.title + " " + res.chat.last_name); 284 | } 285 | 286 | }else { 287 | alert(data.ok); 288 | $('#bot_name').text(data.description) 289 | } 290 | 291 | 292 | $('#send_test_msg').toggleClass('loading'); 293 | }, 294 | 'json'); 295 | } else { 296 | alert(twp_js_obj.token_chat_id_empty) 297 | } 298 | }); 299 | $('#channelbtn').click(function() { 300 | var bot_token = $('input[name=twp_bot_token]').val(), channel_username = $('input[name=twp_channel_username]').val(), pattern = $("#twp_channel_pattern").val(); 301 | if(bot_token != '' && channel_username != '' ) { 302 | var c = confirm(twp_js_obj.channel_test); 303 | if( c == true ){ 304 | $('#channelbtn').prop('disabled', true); 305 | $('#channelbtn').toggleClass('loading'); 306 | var msg = ''+'\n'; 307 | if (pattern != null || pattern != ''){ 308 | msg += pattern; 309 | } 310 | $.post(ajaxurl, 311 | { 312 | channel_username: channel_username, msg: msg , bot_token: bot_token, markdown: $('input[name=twp_markdown]:checked').attr("data-markdown"), web_preview: $('#twp_web_preview').prop('checked'), subject: 'c', action:'twp_ajax_test' 313 | }, function( data ) { 314 | $('#channelbtn').prop('disabled', false); 315 | $('#channelbtn').text(''); 316 | alert((data.ok == true ? 'The message sent succesfully.' : data.description))}, 'json'); 317 | } 318 | } else { 319 | alert(' ') 320 | } 321 | }); 322 | $('#get_members_count').click(function() { 323 | var channel_username = $('input[name=twp_channel_username]').val(); 324 | var bot_token = $('input[name=twp_bot_token]').val(); 325 | if(channel_username !== '' && bot_token !== '') { 326 | $.post(ajaxurl, 327 | { 328 | bot_token: bot_token, channel_username: channel_username, subject: 'gm', action:'twp_ajax_test' 329 | }, function( data ) { 330 | if (data != undefined && data.ok != false){ 331 | $('#members_count').text(data.result+ " " +""); 332 | }else { 333 | $('#members_count').text(data.description); 334 | } 335 | }, 'json'); 336 | } else { 337 | return; 338 | } 339 | }) 340 | $("#floating_save_button").click(function () { 341 | $("#twp_form").submit(); 342 | }); 343 | }); 344 | /* Toaster */ 345 | !function(e){e(["jquery"],function(e){return function(){function t(e,t,n){return g({type:O.error,iconClass:m().iconClasses.error,message:e,optionsOverride:n,title:t})}function n(t,n){return t||(t=m()),v=e("#"+t.containerId),v.length?v:(n&&(v=d(t)),v)}function o(e,t,n){return g({type:O.info,iconClass:m().iconClasses.info,message:e,optionsOverride:n,title:t})}function s(e){C=e}function i(e,t,n){return g({type:O.success,iconClass:m().iconClasses.success,message:e,optionsOverride:n,title:t})}function a(e,t,n){return g({type:O.warning,iconClass:m().iconClasses.warning,message:e,optionsOverride:n,title:t})}function r(e,t){var o=m();v||n(o),u(e,o,t)||l(o)}function c(t){var o=m();return v||n(o),t&&0===e(":focus",t).length?void h(t):void(v.children().length&&v.remove())}function l(t){for(var n=v.children(),o=n.length-1;o>=0;o--)u(e(n[o]),t)}function u(t,n,o){var s=!(!o||!o.force)&&o.force;return!(!t||!s&&0!==e(":focus",t).length)&&(t[n.hideMethod]({duration:n.hideDuration,easing:n.hideEasing,complete:function(){h(t)}}),!0)}function d(t){return v=e("
").attr("id",t.containerId).addClass(t.positionClass),v.appendTo(e(t.target)),v}function p(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function f(e){C&&C(e)}function g(t){function o(e){return null==e&&(e=""),e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function s(){c(),u(),d(),p(),g(),C(),l(),i()}function i(){var e="";switch(t.iconClass){case"toast-success":case"toast-info":e="polite";break;default:e="assertive"}I.attr("aria-live",e)}function a(){E.closeOnHover&&I.hover(H,D),!E.onclick&&E.tapToDismiss&&I.click(b),E.closeButton&&j&&j.click(function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&e.cancelBubble!==!0&&(e.cancelBubble=!0),E.onCloseClick&&E.onCloseClick(e),b(!0)}),E.onclick&&I.click(function(e){E.onclick(e),b()})}function r(){I.hide(),I[E.showMethod]({duration:E.showDuration,easing:E.showEasing,complete:E.onShown}),E.timeOut>0&&(k=setTimeout(b,E.timeOut),F.maxHideTime=parseFloat(E.timeOut),F.hideEta=(new Date).getTime()+F.maxHideTime,E.progressBar&&(F.intervalId=setInterval(x,10)))}function c(){t.iconClass&&I.addClass(E.toastClass).addClass(y)}function l(){E.newestOnTop?v.prepend(I):v.append(I)}function u(){if(t.title){var e=t.title;E.escapeHtml&&(e=o(t.title)),M.append(e).addClass(E.titleClass),I.append(M)}}function d(){if(t.message){var e=t.message;E.escapeHtml&&(e=o(t.message)),B.append(e).addClass(E.messageClass),I.append(B)}}function p(){E.closeButton&&(j.addClass(E.closeClass).attr("role","button"),I.prepend(j))}function g(){E.progressBar&&(q.addClass(E.progressClass),I.prepend(q))}function C(){E.rtl&&I.addClass("rtl")}function O(e,t){if(e.preventDuplicates){if(t.message===w)return!0;w=t.message}return!1}function b(t){var n=t&&E.closeMethod!==!1?E.closeMethod:E.hideMethod,o=t&&E.closeDuration!==!1?E.closeDuration:E.hideDuration,s=t&&E.closeEasing!==!1?E.closeEasing:E.hideEasing;if(!e(":focus",I).length||t)return clearTimeout(F.intervalId),I[n]({duration:o,easing:s,complete:function(){h(I),clearTimeout(k),E.onHidden&&"hidden"!==P.state&&E.onHidden(),P.state="hidden",P.endTime=new Date,f(P)}})}function D(){(E.timeOut>0||E.extendedTimeOut>0)&&(k=setTimeout(b,E.extendedTimeOut),F.maxHideTime=parseFloat(E.extendedTimeOut),F.hideEta=(new Date).getTime()+F.maxHideTime)}function H(){clearTimeout(k),F.hideEta=0,I.stop(!0,!0)[E.showMethod]({duration:E.showDuration,easing:E.showEasing})}function x(){var e=(F.hideEta-(new Date).getTime())/F.maxHideTime*100;q.width(e+"%")}var E=m(),y=t.iconClass||E.iconClass;if("undefined"!=typeof t.optionsOverride&&(E=e.extend(E,t.optionsOverride),y=t.optionsOverride.iconClass||y),!O(E,t)){T++,v=n(E,!0);var k=null,I=e("
"),M=e("
"),B=e("
"),q=e("
"),j=e(E.closeHtml),F={intervalId:null,hideEta:null,maxHideTime:null},P={toastId:T,state:"visible",startTime:new Date,options:E,map:t};return s(),r(),a(),f(P),E.debug&&console&&console.log(P),I}}function m(){return e.extend({},p(),b.options)}function h(e){v||(v=n()),e.is(":visible")||(e.remove(),e=null,0===v.children().length&&(v.remove(),w=void 0))}var v,C,w,T=0,O={error:"error",info:"info",success:"success",warning:"warning"},b={clear:r,remove:c,error:t,getContainer:n,info:o,options:{},subscribe:s,success:i,version:"2.1.4",warning:a};return b}()})}("function"==typeof define&&define.amd?define:function(e,t){"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)}); 346 | //# sourceMappingURL=toastr.js.map 347 | toastr.options = { 348 | "closeButton": true, 349 | "debug": false, 350 | "newestOnTop": false, 351 | "progressBar": false, 352 | "positionClass": "toast-bottom-center", 353 | "preventDuplicates": false, 354 | "onclick": null, 355 | "showDuration": "1000", 356 | "hideDuration": "1000", 357 | "timeOut": "5000", 358 | "extendedTimeOut": "5000", 359 | "showEasing": "swing", 360 | "hideEasing": "linear", 361 | "showMethod": "slideDown", 362 | "hideMethod": "fadeOut" 363 | } -------------------------------------------------------------------------------- /inc/js/textrange.js: -------------------------------------------------------------------------------- 1 | !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){var e,n={get:function(t){return i[e].get.apply(this,[t])},set:function(t,n){var s,r=parseInt(t),o=parseInt(n);return"undefined"==typeof t?r=0:0>t&&(r=this[0].value.length+r),"undefined"!=typeof n&&(s=n>=0?r+o:this[0].value.length+o),i[e].set.apply(this,[r,s]),this},setcursor:function(t){return this.textrange("set",t,0)},replace:function(t){return i[e].replace.apply(this,[String(t)]),this},insert:function(t){return this.textrange("replace",t)}},i={xul:{get:function(t){var e={position:this[0].selectionStart,start:this[0].selectionStart,end:this[0].selectionEnd,length:this[0].selectionEnd-this[0].selectionStart,text:this.val().substring(this[0].selectionStart,this[0].selectionEnd)};return"undefined"==typeof t?e:e[t]},set:function(t,e){"undefined"==typeof e&&(e=this[0].value.length),this[0].selectionStart=t,this[0].selectionEnd=e},replace:function(t){var e=this[0].selectionStart,n=this[0].selectionEnd,i=this.val();this.val(i.substring(0,e)+t+i.substring(n,i.length)),this[0].selectionStart=e,this[0].selectionEnd=e+t.length}},msie:{get:function(t){var e=document.selection.createRange();if("undefined"==typeof e){var n={position:0,start:0,end:this.val().length,length:this.val().length,text:this.val()};return"undefined"==typeof t?n:n[t]}var i=0,s=0,r=this[0].value.length,o=this[0].value.replace(/\r\n/g,"\n"),a=this[0].createTextRange(),l=this[0].createTextRange();a.moveToBookmark(e.getBookmark()),l.collapse(!1),-1===a.compareEndPoints("StartToEnd",l)?(i=-a.moveStart("character",-r),i+=o.slice(0,i).split("\n").length-1,-1===a.compareEndPoints("EndToEnd",l)?(s=-a.moveEnd("character",-r),s+=o.slice(0,s).split("\n").length-1):s=r):(i=r,s=r);var n={position:i,start:i,end:s,length:r,text:e.text};return"undefined"==typeof t?n:n[t]},set:function(t,e){var n=this[0].createTextRange();if("undefined"!=typeof n){"undefined"==typeof e&&(e=this[0].value.length);var i=t-(this[0].value.slice(0,t).split("\r\n").length-1),s=e-(this[0].value.slice(0,e).split("\r\n").length-1);n.collapse(!0),n.moveEnd("character",s),n.moveStart("character",i),n.select()}},replace:function(t){document.selection.createRange().text=t}}};t.fn.textrange=function(i){return"undefined"==typeof this[0]?this:("undefined"==typeof e&&(e="selectionStart"in this[0]?"xul":document.selection?"msie":"unknown"),"unknown"===e?this:(document.activeElement!==this[0]&&this[0].focus(),"undefined"==typeof i||"string"!=typeof i?n.get.apply(this):"function"==typeof n[i]?n[i].apply(this,Array.prototype.slice.call(arguments,1)):void t.error("Method "+i+" does not exist in jQuery.textrange")))}}); -------------------------------------------------------------------------------- /lang/twp-plugin-fa_IR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ameer/telegram-for-wordpress/69f79b026784e360e7d1515f31211e77df6223d5/lang/twp-plugin-fa_IR.mo -------------------------------------------------------------------------------- /lang/twp-plugin-fa_IR.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015 Telegram for WordPress 2 | # This file is distributed under the same license as the Telegram for WordPress package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: Telegram for WordPress 1.6\n" 6 | "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/telegram-for-wp\n" 7 | "POT-Creation-Date: 2016-06-18 03:22+0330\n" 8 | "PO-Revision-Date: 2016-06-18 03:43+0330\n" 9 | "Last-Translator: Ameer Mousavi \n" 10 | "Language-Team: Ameer \n" 11 | "Language: fa_IR\n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 16 | "X-Generator: Poedit 1.6.5\n" 17 | "X-Poedit-KeywordsList: __\n" 18 | "X-Poedit-Basepath: e:/wamp/www/ameer/wp-content/plugins/telegram-for-wp\n" 19 | "X-Poedit-SearchPath-0: .\n" 20 | 21 | #: admin/settings-page.php:58 22 | msgid "Telegram for WordPress" 23 | msgstr "تلگرام برای وردپرس" 24 | 25 | #: admin/settings-page.php:59 26 | #, php-format 27 | msgid "Join our channel in Telegram: %s" 28 | msgstr "به کانال ما در تلگرام بپیوندید: %s" 29 | 30 | #: admin/settings-page.php:71 31 | msgid "Notifications" 32 | msgstr "اطلاع‌رسانی‌ها" 33 | 34 | #: admin/settings-page.php:72 35 | msgid "Post to Channel" 36 | msgstr "ارسال به کانال" 37 | 38 | #: admin/settings-page.php:73 39 | msgid "Donate" 40 | msgstr "حمایت مالی" 41 | 42 | #: admin/settings-page.php:78 43 | msgid "" 44 | "You will receive messages in Telegram with the contents of every emails that " 45 | "sent from your WordPress site." 46 | msgstr "" 47 | " یک کپی از ایمیل‌های ارسالی توسط این سایت، به اکانت تلگرام شما ارسال می شود." 48 | 49 | #: admin/settings-page.php:80 50 | msgid "" 51 | "For example, once a new comment has been submitted, you will receive the " 52 | "comment in your Telegram account." 53 | msgstr "" 54 | "برای مثال وقتی یک دیدگاه در سایت شما ثبت شود، محتویات آن دیدگاه به اکانت " 55 | "تلگرام شما ارسال می‌شود." 56 | 57 | #: admin/settings-page.php:85 58 | msgid "Instructions" 59 | msgstr "دستور کار" 60 | 61 | #: admin/settings-page.php:88 62 | msgid "If you want to send notifications to single user:" 63 | msgstr "اگر می‌خواهید اطلاع‌رسانی‌ها فقط به یک کاربر ارسال شود:" 64 | 65 | #: admin/settings-page.php:90 66 | #, php-format 67 | msgid "In Telegram app start a new chat with %s ." 68 | msgstr "در برنامه تلگرام، به %s پیام بدهید." 69 | 70 | #: admin/settings-page.php:90 71 | msgid "Pay attention to underline!" 72 | msgstr "به علامت آندِرلاین توجه کنید!" 73 | 74 | #: admin/settings-page.php:91 75 | msgid "" 76 | "Send /token command and the bot will give you an API token for " 77 | "the user." 78 | msgstr "" 79 | "دستور /token را بفرستید؛ ربات به شما یک توکن برای ارتباط با API " 80 | "می‌دهد." 81 | 82 | #: admin/settings-page.php:92 admin/settings-page.php:99 83 | msgid "Copy and paste it in the below field and hit the save button!" 84 | msgstr "" 85 | "آن توکن را کپی کرده و در فیلد زیر paste کنید و دکمه ذخیره تنظیمات را بزنید." 86 | 87 | #: admin/settings-page.php:93 88 | msgid "Kaboom! You are ready to go." 89 | msgstr "تمام شد! همه چیز آماده است." 90 | 91 | #: admin/settings-page.php:96 92 | msgid "If you want to send notifications to group:" 93 | msgstr "اگر می‌خواهید اطلاع‌رسانی‌ها به یک گروه ارسال شود:" 94 | 95 | #: admin/settings-page.php:98 96 | msgid "" 97 | "Add the bot to your group and bot will give you an API token for the " 98 | "group( token must be started with g: ) " 99 | msgstr "" 100 | "ربات را به گروه موردنظر اضافه کنید و ربات یک توکن مخصوص گروه به شما می‌دهد. " 101 | "(توکن باید با g: شروع شود)" 102 | 103 | #: admin/settings-page.php:111 104 | msgid "Send a test Message" 105 | msgstr "فرستادن یک پیام آزمایشی" 106 | 107 | #: admin/settings-page.php:112 admin/settings-page.php:164 108 | #: admin/settings-page.php:309 admin/settings-page.php:332 109 | msgid "Send now!" 110 | msgstr "بفرست!" 111 | 112 | #: admin/settings-page.php:115 113 | msgid "Hashtag (optional)" 114 | msgstr "هشتگ (اختیاری)" 115 | 116 | #: admin/settings-page.php:118 117 | msgid "Insert a custom hashtag at the beginning of the messages." 118 | msgstr "یک هشتگ دلخواه را در ابتدای پیام‌های اطلاع‌رسانی اضافه می‌کند." 119 | 120 | #: admin/settings-page.php:119 121 | msgid "Don't forget # at the beginning" 122 | msgstr "حتما علامت # را در ابتدای هشتگ وارد کنید." 123 | 124 | #: admin/settings-page.php:128 125 | msgid "Introduction" 126 | msgstr "معرفی" 127 | 128 | #: admin/settings-page.php:131 129 | msgid "Telegram channel is a great way for attracting people to your site." 130 | msgstr "کانال تلگرام راه بسیار مناسبی برای جذب مردم به سایت شماست." 131 | 132 | #: admin/settings-page.php:133 133 | msgid "" 134 | "This option allows you to send posts to your Telegram channel. Intresting, " 135 | "no?" 136 | msgstr "" 137 | "این گزینه به شما امکان این را می‌دهد که نوشته‌های سایتتان را به کانال تلگرام " 138 | "بفرستید. جالب است، نه؟" 139 | 140 | #: admin/settings-page.php:135 141 | msgid "So let's start!" 142 | msgstr "پس بیایید شروع کنیم!" 143 | 144 | #: admin/settings-page.php:138 145 | msgid "Create a channel (if you don't already have one)." 146 | msgstr "در تلگرام یک کانال بسازید. (اگر در حال حاضر کانال ندارید)" 147 | 148 | #: admin/settings-page.php:139 149 | msgid "Create a bot (if you don't already have one)." 150 | msgstr "در تلگرام یک ربات بسازید. (اگر در حال حاضر ربات ندارید)" 151 | 152 | #: admin/settings-page.php:140 153 | msgid "Go to channel options and select 'Administrator' option." 154 | msgstr "" 155 | "در برنامه تلگرام به تنظیمات کانال بروید و گزینه Administrator را انتخاب کنید." 156 | 157 | #: admin/settings-page.php:141 158 | msgid "Select 'Add Administrator' option." 159 | msgstr "گزینه Add Administrator را بزنید." 160 | 161 | #: admin/settings-page.php:142 162 | msgid "Search the username of your bot and add it as administrator." 163 | msgstr "نام کاربری ربات‌تان را جستجو کنید و آن را به عنوان مدیر اضافه کنید." 164 | 165 | #: admin/settings-page.php:143 166 | msgid "" 167 | "Copy the bot token (you got it in step two) and paste it in the below field." 168 | msgstr "" 169 | "توکن ربات را که از botfather گرفته‌اید کپی کنید و در فیلد زیر paste کنید." 170 | 171 | #: admin/settings-page.php:144 172 | msgid "Enter the username of the channel and hit SAVE button!!!" 173 | msgstr "نام کاربری کانال را وارد کنید و دکمه ذخیره را بزنید!" 174 | 175 | #: admin/settings-page.php:145 176 | msgid "" 177 | "Yes! Now, whenever you publish or update a post you can choose whether send " 178 | "it to Telegram (from post editor page)" 179 | msgstr "" 180 | "بله! از این پس هر نوشته‌ای که منتشر یا بروزرسانی کنید، می‌توانید تعیین کنید که " 181 | "به تلگرام ارسال شود یا نه.(از طریق صفحه ویرایش نوشته)" 182 | 183 | #: admin/settings-page.php:153 admin/settings-page.php:354 184 | msgid "Check bot token" 185 | msgstr "بررسی توکن ربات" 186 | 187 | #: admin/settings-page.php:155 188 | msgid "Bot Info: " 189 | msgstr "اطلاعات ربات:" 190 | 191 | #: admin/settings-page.php:161 192 | msgid "Channel Username" 193 | msgstr "نام کاربری کانال" 194 | 195 | #: admin/settings-page.php:165 196 | msgid "Click here to refresh members count" 197 | msgstr "برای بروزرسانی تعداد اعضا اینجا کلیک کنید" 198 | 199 | #: admin/settings-page.php:165 200 | msgid "Members Count:" 201 | msgstr "تعداد اعضا:" 202 | 203 | #: admin/settings-page.php:166 204 | msgid "Don't forget @ at the beginning" 205 | msgstr "علامت @ را حتما در ابتدای نام کاربری وارد کنید." 206 | 207 | #: admin/settings-page.php:180 208 | msgid "Send to Telegram Status (Global)" 209 | msgstr "ارسال به کانال تلگرام (تنظیم کلی)" 210 | 211 | #: admin/settings-page.php:182 212 | msgid "" 213 | "By checking one of the below options, you don't need to set \"Send to " 214 | "Telegram Status\" every time you create a new post." 215 | msgstr "" 216 | "با فعال کردن گزینه زیر، دیگر نیاز نیست که هر بار نوشته تازه‌ای منتشر می‌کنید " 217 | "روی گزینه \"ارسال به کانال تلگرام\" کلیک کنید." 218 | 219 | #: admin/settings-page.php:184 220 | msgid "Always send" 221 | msgstr "همیشه به تلگرام بفرست." 222 | 223 | #: admin/settings-page.php:185 224 | msgid "Never Send" 225 | msgstr "هرگز نفرست" 226 | 227 | #: admin/settings-page.php:187 228 | msgid "You can override the above settings in post-edit screen" 229 | msgstr "شما میتوانید تنظیمات بالا را در برگه‌ی ویرایش نوشته، تغییر دهید." 230 | 231 | #: admin/settings-page.php:195 232 | msgid "Formatting messages" 233 | msgstr "قالب‌بندی پیام‌ها" 234 | 235 | #: admin/settings-page.php:197 236 | msgid "" 237 | "Telegram supports basic markdown and some HTML tags (bold, italic, inline " 238 | "links). By checking one of the following options, your messages will be " 239 | "compatible with Telegram format." 240 | msgstr "" 241 | "تلگرام به صورت محدود از markdown و بعضی از تگ‌های HTML پشتیبانی می‌کند ( bold، " 242 | "italic و لینک‌های درون خطی). با کلیک بر روی هر یک از گزینه‌های زیر پیامهای شما " 243 | "به قالب متناسب با تلگرام تبدیل می‌شوند." 244 | 245 | #: admin/settings-page.php:200 246 | msgid "Disable Markdown and remove HTML tags" 247 | msgstr "عدم استفاده از markdown و حذف تگ‌های HTML" 248 | 249 | #: admin/settings-page.php:203 250 | msgid "Use basic Markdown (less characters)" 251 | msgstr "استفاده از Basic Markdown (کارکتر کمتر)" 252 | 253 | #: admin/settings-page.php:206 254 | msgid "Use HTML tags (more speed)" 255 | msgstr "استفاده از تگ‌های HTML (سرعت بیشتر)" 256 | 257 | #: admin/settings-page.php:208 258 | msgid "Learn more" 259 | msgstr "بیشتر بدانید..." 260 | 261 | #: admin/settings-page.php:214 262 | msgid "Excerpt length" 263 | msgstr "طول چکیده" 264 | 265 | #: admin/settings-page.php:216 266 | msgid "" 267 | "By default, the plugin replaces {excerpt} tag with 55 first words of your " 268 | "post content. You can change the number of words here:" 269 | msgstr "" 270 | "به صورت پیش‌فرض افزونه تگ {excerpt} را با 55 کلمه‌ی نخست محتوای نوشته عوض " 271 | "می‌کند. شما می‌توانید تعداد کلمات را اینجا تغییر دهید:" 272 | 273 | #: admin/settings-page.php:218 274 | msgid "words in excerpt" 275 | msgstr "کلمه در چکیده" 276 | 277 | #: admin/settings-page.php:222 278 | msgid "Web page preview in messages" 279 | msgstr "پیش‌نمایش لینک‌ها در پیام‌ها" 280 | 281 | #: admin/settings-page.php:224 282 | msgid "Disables link previews for links in the sent message." 283 | msgstr "قابلیت پیش‌نمایش لینک‌های موجود در متن را غیرفعال می‌کند." 284 | 285 | #: admin/settings-page.php:226 286 | msgid "Disable Web page preview" 287 | msgstr "غیرفعال کردن پیش‌نمایش لینک‌ها" 288 | 289 | #: admin/settings-page.php:230 290 | msgid "Photo position" 291 | msgstr "محل قرارگیری تصویر" 292 | 293 | #: admin/settings-page.php:232 294 | msgid "" 295 | "Telegram limits the photo caption to 200 characters. Here are two options if " 296 | "your message text exceeds this limit:" 297 | msgstr "" 298 | "تلگرام عنوان (caption) زیر عکس‌ها را به 200 کاراکتر محدود کرده است. دو گزینه " 299 | "وجود دارد اگر محتوای پیام شما از 200 کاراکتر بیشتر شد:" 300 | 301 | #: admin/settings-page.php:235 302 | msgid "Send photo before text" 303 | msgstr "تصویر را قبل از متن بفرست" 304 | 305 | #: admin/settings-page.php:237 306 | msgid "" 307 | "This will send the photo with the pattern content as the caption. If pattern " 308 | "content exceeds 200 characters limit, then this will send the photo with the " 309 | "caption specified in WordPress media library and the pattern content " 310 | "afterward (Each one in a separate message).
You can set a caption for " 311 | "the photo in the media library." 312 | msgstr "" 313 | "این گزینه، محتوای پیام را در زیر عکس به عنوان کپشن درج می‌کند. اگر محتوای " 314 | "پیام بیش از 200 کاراکتر شد، آن وقت تصویر را با کپشن تعیین شده در کتابخانه‌ی " 315 | "رسانه وردپرس ارسال می‌کند و محتوای پیام را در پیام متنی به دنبال آن می‌فرستد. " 316 | "(هر کدام در پیامی جداگانه)
شما در مدیریت رسانه وردپرس می‌توانید یک کپشن " 317 | "یا عنوان برای عکس تعیین کنید." 318 | 319 | #: admin/settings-page.php:240 320 | msgid "Send photo after text" 321 | msgstr "تصویر را بعد از متن بفرست" 322 | 323 | #: admin/settings-page.php:242 324 | msgid "Can't use this option while formatting is disabled" 325 | msgstr "وقتی گزینه قالب‌بندی غیرفعال است نمی‌توان از این گزینه استفاده کرد." 326 | 327 | #: admin/settings-page.php:243 328 | msgid "" 329 | "This will attach an invisible link of your photo to the beginning of your " 330 | "message. People wouldn't see the link, but Telegram clients will show the " 331 | "photo at the bottom of the message (All in one message). This will ignore " 332 | "any caption that has been set using media library." 333 | msgstr "" 334 | "این گزینه لینک تصویر مربوطه را به صورت نامرئی به اول پیام اضافه می‌کند. مردم " 335 | "لینک را نمی‌بینند اما تلگرام عکس را از لینک دریافت کرده و در پایین پیام نشان " 336 | "می‌دهد(همه در یک پیام). این گزینه هر کپشنی که در مدیریت رسانه وردپرس تعیین " 337 | "شده باشد نادیده می‌گیرد." 338 | 339 | #: admin/settings-page.php:251 340 | msgid "My story..." 341 | msgstr "داستان من" 342 | 343 | #: admin/settings-page.php:260 344 | msgid "From anywhere" 345 | msgstr "از هر کجا" 346 | 347 | #: admin/settings-page.php:262 348 | msgid "" 349 | "From anywhere on this planet, you can make me happy 😍
Just " 350 | "click on the below button:" 351 | msgstr "" 352 | "از هر کجای زمین که هستید، می توانید من را خوشحال کنید 😍
فقط روی " 353 | "دکمه زیر کلیک کنید:" 354 | 355 | #: admin/settings-page.php:270 356 | msgid "From Iran" 357 | msgstr "از داخل ایران" 358 | 359 | #: admin/settings-page.php:289 360 | #, php-format 361 | msgid "" 362 | "If you like this plugin, please rate it in %1$s. You can also support us by " 363 | "%2$s" 364 | msgstr "" 365 | "اگر از این افزونه خوشتان آمده است می‌توانید در %1$s به آن امتیاز بدهید. شما " 366 | "همچنین می‌توانید از ما %2$s کنید." 367 | 368 | #: admin/settings-page.php:289 369 | msgid "Telegram for Wordpress page in wordpress.org" 370 | msgstr "صفحه افزونه" 371 | 372 | #: admin/settings-page.php:289 373 | msgid "donating" 374 | msgstr "حمایت مالی" 375 | 376 | #: admin/settings-page.php:298 admin/settings-page.php:322 377 | #: admin/settings-page.php:343 378 | msgid "Please wait..." 379 | msgstr "لطفا صبر کنید..." 380 | 381 | #: admin/settings-page.php:302 admin/settings-page.php:323 382 | msgid "This is a test message" 383 | msgstr "این یک پیام آزمایشی است." 384 | 385 | #: admin/settings-page.php:313 386 | msgid "api_token field is empty" 387 | msgstr "فیلد api_token خالی است." 388 | 389 | #: admin/settings-page.php:319 390 | msgid "This will send a test message to your channel. Do you want to continue?" 391 | msgstr "این یک پیام تست را به کانال می‌فرستد. آیا ادامه می‌دهید؟" 392 | 393 | #: admin/settings-page.php:336 394 | msgid "bot token/channel username field is empty" 395 | msgstr "فیلد نام کاربری کانال یا توکن ربات خالی است." 396 | 397 | #: admin/settings-page.php:357 398 | msgid "bot token field is empty" 399 | msgstr "فیلد توکن ربات خالی است." 400 | 401 | #: admin/settings-page.php:369 402 | msgid "members" 403 | msgstr "عضو" 404 | 405 | #: functions.php:93 406 | msgid "Select or Upload the custom photo" 407 | msgstr "تصویر دلخواهتان را انتخاب یا بارگذاری کنید." 408 | 409 | #: functions.php:94 410 | msgid "Use this image" 411 | msgstr "استفاده از این تصویر" 412 | 413 | #: functions.php:95 414 | msgid "Select or Upload the files" 415 | msgstr "فایل دلخواه را انتخاب/بارگذاری کنید" 416 | 417 | #: functions.php:96 418 | msgid "Use this file(s)" 419 | msgstr "استفاده از این فایل" 420 | 421 | #: functions.php:97 inc/composer.php:351 422 | msgid "Edit file" 423 | msgstr "ویرایش فایل" 424 | 425 | #: functions.php:162 426 | msgid "Persian Tutorial in HamyarWP" 427 | msgstr "راهنما و آموزش فارسی در سایت همیار وردپرس" 428 | 429 | #: functions.php:201 430 | #, php-format 431 | msgid "Your API token isn't set. Please go to %s and set it." 432 | msgstr "کد api_token شما تنظیم نشده است. لطفا به %s بروید و آن را تنظیم کنید." 433 | 434 | #: functions.php:201 twp.php:39 435 | msgid "TWP Settings" 436 | msgstr "تنظیمات TWP" 437 | 438 | #: functions.php:214 439 | msgid "Telegram Channel Options" 440 | msgstr "گزینه‌های کانال تلگرام" 441 | 442 | #: functions.php:244 functions.php:472 443 | msgid "Bot token or Channel username aren't set!" 444 | msgstr "توکن ربات یا نام کاربری کانال تنظیم نشده‌اند." 445 | 446 | #: functions.php:286 447 | msgid "Send to Telegram Status" 448 | msgstr "وضعیت ارسال به تلگرام" 449 | 450 | #: functions.php:289 451 | msgid "Send this post to channel" 452 | msgstr "ارسال این نوشته به کانال" 453 | 454 | #: functions.php:290 455 | msgid "Don't send this post to channel" 456 | msgstr "این نوشته را ارسال نکن" 457 | 458 | #: functions.php:298 459 | msgid "Sending result: " 460 | msgstr "نتیجه ارسال: " 461 | 462 | #: functions.php:303 463 | msgid "Published successfully" 464 | msgstr "با موفقیت منتشر شد." 465 | 466 | #: functions.php:307 467 | msgid "Date: " 468 | msgstr "تاریخ:" 469 | 470 | #: inc/composer.php:49 471 | msgid "Message Pattern" 472 | msgstr "الگوی پیام" 473 | 474 | #: inc/composer.php:54 475 | msgid "" 476 | "Define the structure of messages that are sent to the channel. Use tags, " 477 | "emoji shortnames and any other text." 478 | msgstr "" 479 | "ساختار پیام‌هایی را که به کانال فرستاده می‌شوند، در اینجا تعیین کنید. شما " 480 | "می‌توانید از تگ‌های پیش‌فرض، اسم کوتاه خندانک‌ها و هر متن دیگری استفاده کنید." 481 | 482 | #: inc/composer.php:59 483 | msgid "Select a tag..." 484 | msgstr "یک تگ را انتخاب کنید..." 485 | 486 | #: inc/composer.php:61 487 | msgid "The ID of this post" 488 | msgstr "شناسه یکتا (ID) این نوشته" 489 | 490 | #: inc/composer.php:62 491 | msgid "The title of this post" 492 | msgstr "عنوان این نوشته" 493 | 494 | #: inc/composer.php:63 495 | msgid "The first 55 words of this post" 496 | msgstr "۵۵ کلمه‌ی نخست این نوشته" 497 | 498 | #: inc/composer.php:64 499 | msgid "The whole content of this post" 500 | msgstr "همه‌ی محتوای این نوشته" 501 | 502 | #: inc/composer.php:65 503 | msgid "The display name of author of this post" 504 | msgstr "نام نمایشیِ نویسنده" 505 | 506 | #: inc/composer.php:66 507 | msgid "The short url of this post" 508 | msgstr "پیوند کوتاه این نوشته" 509 | 510 | #: inc/composer.php:67 511 | msgid "The permalink of this post" 512 | msgstr "پیوند یکتای این نوشته" 513 | 514 | #: inc/composer.php:68 515 | msgid "" 516 | "The tags of this post. Tags are automatically converted to Telegram hashtags" 517 | msgstr "برچسب‌های این نوشته. برچسب‌ها به صورت خودکار به #هشتگ تبدیل می‌شوند." 518 | 519 | #: inc/composer.php:69 520 | msgid "" 521 | "The categories of this post. Categories are automatically separated by | " 522 | "symbol" 523 | msgstr "" 524 | "دسته‌بندی‌های این نوشته. دسته‌بندی‌ها به صورت خودکار با علامت | از هم جدا می‌شوند." 525 | 526 | #: inc/composer.php:74 527 | msgid "The width of this product" 528 | msgstr "پهنای این محصول" 529 | 530 | #: inc/composer.php:75 531 | msgid "The length of this product" 532 | msgstr "طول این محصول" 533 | 534 | #: inc/composer.php:76 535 | msgid "The height of this product" 536 | msgstr "ارتفاع این محصول" 537 | 538 | #: inc/composer.php:77 539 | msgid "The weight of this product" 540 | msgstr "وزن این محصول" 541 | 542 | #: inc/composer.php:78 543 | msgid "The price of this product" 544 | msgstr "قیمت این محصول" 545 | 546 | #: inc/composer.php:79 547 | msgid "The regular price of this product" 548 | msgstr "قیمت عادی این محصول" 549 | 550 | #: inc/composer.php:80 551 | msgid "The sale price of this product" 552 | msgstr "قیمت فروش این محصول" 553 | 554 | #: inc/composer.php:81 555 | msgid "The SKU (Stock Keeping Unit) of this product" 556 | msgstr "شماره اختصاصی این محصول در انبار (SKU)" 557 | 558 | #: inc/composer.php:82 559 | msgid "The stock amount of this product" 560 | msgstr "میزان این محصول در انبار" 561 | 562 | #: inc/composer.php:83 563 | msgid "Is this product downloadable? (Yes or No)" 564 | msgstr "آیا این محصول قابل دانلود است؟‌(بله یا خیر)" 565 | 566 | #: inc/composer.php:84 567 | msgid "Is this product virtual? (Yes or No)" 568 | msgstr "آیا این محصول مجازی است؟‌(بله یا خیر)" 569 | 570 | #: inc/composer.php:85 571 | msgid "Is this product sold individually? (Yes or No)" 572 | msgstr "آیا این محصول به صورت جداگانه به فروش می‌رسد؟" 573 | 574 | #: inc/composer.php:86 575 | msgid "The tax status of this product" 576 | msgstr "وضعیت مالیات این محصول" 577 | 578 | #: inc/composer.php:87 579 | msgid "The tax class of this product" 580 | msgstr "کلاس مالیاتی این محصول" 581 | 582 | #: inc/composer.php:88 583 | msgid "The stock status of this product" 584 | msgstr "وضعیت انبار این محصول" 585 | 586 | #: inc/composer.php:89 587 | msgid "Whether or not backorders allowed? " 588 | msgstr "آیا در صورت نبود این محصول، امکان سفارش دادن آن هست؟" 589 | 590 | #: inc/composer.php:90 591 | msgid "Is this a featured product? (Yes or No)" 592 | msgstr "آیا این یک محصول شاخص است؟‌ (بله یا خیر)" 593 | 594 | #: inc/composer.php:91 595 | msgid "Is this product visible? (Yes or No)" 596 | msgstr "آیا این محصول قابل مشاهده است؟‌(بله یا خیر)" 597 | 598 | #: inc/composer.php:96 599 | msgid "Emoji..." 600 | msgstr "خندانک..." 601 | 602 | #: inc/composer.php:290 603 | msgid "Click to see a full list of available emojis and their shortnames" 604 | msgstr "برای مشاهده فهرست کامل خندانک‌ها و نام کوتاه آن‌ها کلیک کنید" 605 | 606 | #: inc/composer.php:290 607 | msgid "Emoji full list" 608 | msgstr "فهرست کامل خندانک‌ها" 609 | 610 | #: inc/composer.php:291 611 | msgid "Click to see some patterns template" 612 | msgstr "برای مشاهده چند نمونه‌ی الگو کلیک کنید" 613 | 614 | #: inc/composer.php:291 615 | msgid "Patterns Template" 616 | msgstr "نمونه‌ی الگوها" 617 | 618 | #: inc/composer.php:300 619 | msgid "Don't send featured image" 620 | msgstr "تصویر شاخص را نفرست." 621 | 622 | #: inc/composer.php:303 623 | msgid "Send featured image" 624 | msgstr "ارسال تصویر شاخص" 625 | 626 | #: inc/composer.php:311 627 | msgid "Send custom image" 628 | msgstr "ارسال تصویر دلخواه" 629 | 630 | #: inc/composer.php:340 631 | msgid "Send file" 632 | msgstr "ارسال فایل" 633 | 634 | #: inc/composer.php:345 635 | msgid "Select the file that you want to send with this post." 636 | msgstr "فایلی را که می‌خواهید به همراه این نوشته بفرستید، انتخاب کنید" 637 | 638 | #: inc/composer.php:366 639 | msgid "Set custom file" 640 | msgstr "انتخاب فایل دلخواه" 641 | 642 | #: inc/composer.php:370 643 | msgid "Remove this file" 644 | msgstr "حذف این فایل" 645 | 646 | #~ msgid "" 647 | #~ "Receive your WordPress site notifications in your Telegram account and " 648 | #~ "publish your posts to Telegram channel." 649 | #~ msgstr "" 650 | #~ "اطلاع‌رسانی‌های سایت وردپرس خودتان را در تلگرام دریافت کنید و نوشته‌هایتان " 651 | #~ "را مستقیم به کانال تلگرام بفرستید" 652 | 653 | #~ msgid "Ameer Mousavi" 654 | #~ msgstr "امیر موسوی" 655 | 656 | #~ msgid "Use Markdown in messages" 657 | #~ msgstr "استفاده از قابلیت Markdown در پیام‌ها" 658 | 659 | #~ msgid "Send to Telegram channel" 660 | #~ msgstr "ارسال به کانال تلگرام" 661 | 662 | #~ msgid "Select or Upload Media Of Your Chosen Persuasion" 663 | #~ msgstr "تصویر مورد نظرتان را انتخاب یا آپلود کنید." 664 | 665 | #~ msgid "" 666 | #~ "You will receive messages in Telegram with the contents of every emails " 667 | #~ "that sent from your WordPress site.
\n" 668 | #~ " For example, once a new comment has been " 669 | #~ "submitted, you will receive the comment in your Telegram account.
\n" 670 | #~ " " 671 | #~ msgstr "" 672 | #~ " یک کپی از ایمیل‌های ارسالی توسط این سایت، به اکانت تلگرام شما ارسال می " 673 | #~ "شود.
برای مثال وقتی یک دیدگاه در سایت شما ثبت شود، محتویات آن دیدگاه " 674 | #~ "به اکانت تلگرام شما ارسال می‌شود." 675 | 676 | #~ msgid "" 677 | #~ "Telegram channel is a great way for attracting people to your site.
" 678 | #~ "This option allows you to send posts to your Telegram channel. " 679 | #~ "Intresting, no?
\n" 680 | #~ " So let's start!
" 681 | #~ msgstr "" 682 | #~ "کانال تلگرام یک راه بسیار خوب برای جذب مردم به وب‌سایت شماست.
این " 683 | #~ "گزینه به شما امکان می‌دهد تا نوشته‌های سایت خود را به کانال تلگرام ارسال " 684 | #~ "کنید. جالب است، نه؟!
بیایید شروع کنیم!" 685 | 686 | #~ msgid "Channel Signature" 687 | #~ msgstr "امضای کانال" 688 | 689 | #~ msgid "Add channel username at the end of the messages" 690 | #~ msgstr "اضافه کردن نام کاربری کانال در آخر پیام‌ها" 691 | 692 | #~ msgid "Excerpt + Featured Image" 693 | #~ msgstr "خلاصه نوشته + تصویر شاخص" 694 | 695 | #~ msgid "Text without image(s)" 696 | #~ msgstr "کل نوشته (بدون هیچ عکسی)" 697 | 698 | #~ msgid "Add full url at the end" 699 | #~ msgstr "افزودن پیوند کامل در انتهای پیام" 700 | 701 | #~ msgid "Yes! You did it!" 702 | #~ msgstr "بله! شما انجامش دادید!" 703 | 704 | #~ msgid "" 705 | #~ "

If you like this plugin, please rate it in Telegram for " 707 | #~ "Wordpress page in wordpress.org You can also support us by donating

" 710 | #~ msgstr "سلام" 711 | -------------------------------------------------------------------------------- /lang/twp-plugin.pot: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015 Telegram for WordPress 2 | # This file is distributed under the same license as the Telegram for WordPress package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: Telegram for WordPress 1.6\n" 6 | "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/telegram-for-wp\n" 7 | "POT-Creation-Date: 2016-06-18 03:22+0330\n" 8 | "PO-Revision-Date: 2016-06-18 03:22+0330\n" 9 | "Last-Translator: Ameer Mousavi \n" 10 | "Language-Team: Ameer Mousavi \n" 11 | "Language: en_US\n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 16 | "X-Generator: Poedit 1.6.5\n" 17 | "X-Poedit-KeywordsList: __\n" 18 | "X-Poedit-Basepath: e:\\wamp\\www\\ameer\\wp-content\\plugins\\telegram-for-wp" 19 | "\\\n" 20 | "X-Poedit-SearchPath-0: .\n" 21 | 22 | #: admin/settings-page.php:58 23 | msgid "Telegram for WordPress" 24 | msgstr "" 25 | 26 | #: admin/settings-page.php:59 27 | #, php-format 28 | msgid "Join our channel in Telegram: %s" 29 | msgstr "" 30 | 31 | #: admin/settings-page.php:71 32 | msgid "Notifications" 33 | msgstr "" 34 | 35 | #: admin/settings-page.php:72 36 | msgid "Post to Channel" 37 | msgstr "" 38 | 39 | #: admin/settings-page.php:73 40 | msgid "Donate" 41 | msgstr "" 42 | 43 | #: admin/settings-page.php:78 44 | msgid "" 45 | "You will receive messages in Telegram with the contents of every emails that " 46 | "sent from your WordPress site." 47 | msgstr "" 48 | 49 | #: admin/settings-page.php:80 50 | msgid "" 51 | "For example, once a new comment has been submitted, you will receive the " 52 | "comment in your Telegram account." 53 | msgstr "" 54 | 55 | #: admin/settings-page.php:85 56 | msgid "Instructions" 57 | msgstr "" 58 | 59 | #: admin/settings-page.php:88 60 | msgid "If you want to send notifications to single user:" 61 | msgstr "" 62 | 63 | #: admin/settings-page.php:90 64 | #, php-format 65 | msgid "In Telegram app start a new chat with %s ." 66 | msgstr "" 67 | 68 | #: admin/settings-page.php:90 69 | msgid "Pay attention to underline!" 70 | msgstr "" 71 | 72 | #: admin/settings-page.php:91 73 | msgid "" 74 | "Send /token command and the bot will give you an API token for " 75 | "the user." 76 | msgstr "" 77 | 78 | #: admin/settings-page.php:92 admin/settings-page.php:99 79 | msgid "Copy and paste it in the below field and hit the save button!" 80 | msgstr "" 81 | 82 | #: admin/settings-page.php:93 83 | msgid "Kaboom! You are ready to go." 84 | msgstr "" 85 | 86 | #: admin/settings-page.php:96 87 | msgid "If you want to send notifications to group:" 88 | msgstr "" 89 | 90 | #: admin/settings-page.php:98 91 | msgid "" 92 | "Add the bot to your group and bot will give you an API token for the " 93 | "group( token must be started with g: ) " 94 | msgstr "" 95 | 96 | #: admin/settings-page.php:111 97 | msgid "Send a test Message" 98 | msgstr "" 99 | 100 | #: admin/settings-page.php:112 admin/settings-page.php:164 101 | #: admin/settings-page.php:309 admin/settings-page.php:332 102 | msgid "Send now!" 103 | msgstr "" 104 | 105 | #: admin/settings-page.php:115 106 | msgid "Hashtag (optional)" 107 | msgstr "" 108 | 109 | #: admin/settings-page.php:118 110 | msgid "Insert a custom hashtag at the beginning of the messages." 111 | msgstr "" 112 | 113 | #: admin/settings-page.php:119 114 | msgid "Don't forget # at the beginning" 115 | msgstr "" 116 | 117 | #: admin/settings-page.php:128 118 | msgid "Introduction" 119 | msgstr "" 120 | 121 | #: admin/settings-page.php:131 122 | msgid "Telegram channel is a great way for attracting people to your site." 123 | msgstr "" 124 | 125 | #: admin/settings-page.php:133 126 | msgid "" 127 | "This option allows you to send posts to your Telegram channel. Intresting, " 128 | "no?" 129 | msgstr "" 130 | 131 | #: admin/settings-page.php:135 132 | msgid "So let's start!" 133 | msgstr "" 134 | 135 | #: admin/settings-page.php:138 136 | msgid "Create a channel (if you don't already have one)." 137 | msgstr "" 138 | 139 | #: admin/settings-page.php:139 140 | msgid "Create a bot (if you don't already have one)." 141 | msgstr "" 142 | 143 | #: admin/settings-page.php:140 144 | msgid "Go to channel options and select 'Administrator' option." 145 | msgstr "" 146 | 147 | #: admin/settings-page.php:141 148 | msgid "Select 'Add Administrator' option." 149 | msgstr "" 150 | 151 | #: admin/settings-page.php:142 152 | msgid "Search the username of your bot and add it as administrator." 153 | msgstr "" 154 | 155 | #: admin/settings-page.php:143 156 | msgid "" 157 | "Copy the bot token (you got it in step two) and paste it in the below field." 158 | msgstr "" 159 | 160 | #: admin/settings-page.php:144 161 | msgid "Enter the username of the channel and hit SAVE button!!!" 162 | msgstr "" 163 | 164 | #: admin/settings-page.php:145 165 | msgid "" 166 | "Yes! Now, whenever you publish or update a post you can choose whether send " 167 | "it to Telegram (from post editor page)" 168 | msgstr "" 169 | 170 | #: admin/settings-page.php:153 admin/settings-page.php:354 171 | msgid "Check bot token" 172 | msgstr "" 173 | 174 | #: admin/settings-page.php:155 175 | msgid "Bot Info: " 176 | msgstr "" 177 | 178 | #: admin/settings-page.php:161 179 | msgid "Channel Username" 180 | msgstr "" 181 | 182 | #: admin/settings-page.php:165 183 | msgid "Click here to refresh members count" 184 | msgstr "" 185 | 186 | #: admin/settings-page.php:165 187 | msgid "Members Count:" 188 | msgstr "" 189 | 190 | #: admin/settings-page.php:166 191 | msgid "Don't forget @ at the beginning" 192 | msgstr "" 193 | 194 | #: admin/settings-page.php:180 195 | msgid "Send to Telegram Status (Global)" 196 | msgstr "" 197 | 198 | #: admin/settings-page.php:182 199 | msgid "" 200 | "By checking one of the below options, you don't need to set \"Send to " 201 | "Telegram Status\" every time you create a new post." 202 | msgstr "" 203 | 204 | #: admin/settings-page.php:184 205 | msgid "Always send" 206 | msgstr "" 207 | 208 | #: admin/settings-page.php:185 209 | msgid "Never Send" 210 | msgstr "" 211 | 212 | #: admin/settings-page.php:187 213 | msgid "You can override the above settings in post-edit screen" 214 | msgstr "" 215 | 216 | #: admin/settings-page.php:195 217 | msgid "Formatting messages" 218 | msgstr "" 219 | 220 | #: admin/settings-page.php:197 221 | msgid "" 222 | "Telegram supports basic markdown and some HTML tags (bold, italic, inline " 223 | "links). By checking one of the following options, your messages will be " 224 | "compatible with Telegram format." 225 | msgstr "" 226 | 227 | #: admin/settings-page.php:200 228 | msgid "Disable Markdown and remove HTML tags" 229 | msgstr "" 230 | 231 | #: admin/settings-page.php:203 232 | msgid "Use basic Markdown (less characters)" 233 | msgstr "" 234 | 235 | #: admin/settings-page.php:206 236 | msgid "Use HTML tags (more speed)" 237 | msgstr "" 238 | 239 | #: admin/settings-page.php:208 240 | msgid "Learn more" 241 | msgstr "" 242 | 243 | #: admin/settings-page.php:214 244 | msgid "Excerpt length" 245 | msgstr "" 246 | 247 | #: admin/settings-page.php:216 248 | msgid "" 249 | "By default, the plugin replaces {excerpt} tag with 55 first words of your " 250 | "post content. You can change the number of words here:" 251 | msgstr "" 252 | 253 | #: admin/settings-page.php:218 254 | msgid "words in excerpt" 255 | msgstr "" 256 | 257 | #: admin/settings-page.php:222 258 | msgid "Web page preview in messages" 259 | msgstr "" 260 | 261 | #: admin/settings-page.php:224 262 | msgid "Disables link previews for links in the sent message." 263 | msgstr "" 264 | 265 | #: admin/settings-page.php:226 266 | msgid "Disable Web page preview" 267 | msgstr "" 268 | 269 | #: admin/settings-page.php:230 270 | msgid "Photo position" 271 | msgstr "" 272 | 273 | #: admin/settings-page.php:232 274 | msgid "" 275 | "Telegram limits the photo caption to 200 characters. Here are two options if " 276 | "your message text exceeds this limit:" 277 | msgstr "" 278 | 279 | #: admin/settings-page.php:235 280 | msgid "Send photo before text" 281 | msgstr "" 282 | 283 | #: admin/settings-page.php:237 284 | msgid "" 285 | "This will send the photo with the pattern content as the caption. If pattern " 286 | "content exceeds 200 characters limit, then this will send the photo with the " 287 | "caption specified in WordPress media library and the pattern content " 288 | "afterward (Each one in a separate message).
You can set a caption for " 289 | "the photo in the media library." 290 | msgstr "" 291 | 292 | #: admin/settings-page.php:240 293 | msgid "Send photo after text" 294 | msgstr "" 295 | 296 | #: admin/settings-page.php:242 297 | msgid "Can't use this option while formatting is disabled" 298 | msgstr "" 299 | 300 | #: admin/settings-page.php:243 301 | msgid "" 302 | "This will attach an invisible link of your photo to the beginning of your " 303 | "message. People wouldn't see the link, but Telegram clients will show the " 304 | "photo at the bottom of the message (All in one message). This will ignore " 305 | "any caption that has been set using media library." 306 | msgstr "" 307 | 308 | #: admin/settings-page.php:251 309 | msgid "My story..." 310 | msgstr "" 311 | 312 | #: admin/settings-page.php:260 313 | msgid "From anywhere" 314 | msgstr "" 315 | 316 | #: admin/settings-page.php:262 317 | msgid "" 318 | "From anywhere on this planet, you can make me happy 😍
Just " 319 | "click on the below button:" 320 | msgstr "" 321 | 322 | #: admin/settings-page.php:270 323 | msgid "From Iran" 324 | msgstr "" 325 | 326 | #: admin/settings-page.php:289 327 | #, php-format 328 | msgid "" 329 | "If you like this plugin, please rate it in %1$s. You can also support us by " 330 | "%2$s" 331 | msgstr "" 332 | 333 | #: admin/settings-page.php:289 334 | msgid "Telegram for Wordpress page in wordpress.org" 335 | msgstr "" 336 | 337 | #: admin/settings-page.php:289 338 | msgid "donating" 339 | msgstr "" 340 | 341 | #: admin/settings-page.php:298 admin/settings-page.php:322 342 | #: admin/settings-page.php:343 343 | msgid "Please wait..." 344 | msgstr "" 345 | 346 | #: admin/settings-page.php:302 admin/settings-page.php:323 347 | msgid "This is a test message" 348 | msgstr "" 349 | 350 | #: admin/settings-page.php:313 351 | msgid "api_token field is empty" 352 | msgstr "" 353 | 354 | #: admin/settings-page.php:319 355 | msgid "This will send a test message to your channel. Do you want to continue?" 356 | msgstr "" 357 | 358 | #: admin/settings-page.php:336 359 | msgid "bot token/channel username field is empty" 360 | msgstr "" 361 | 362 | #: admin/settings-page.php:357 363 | msgid "bot token field is empty" 364 | msgstr "" 365 | 366 | #: admin/settings-page.php:369 367 | msgid "members" 368 | msgstr "" 369 | 370 | #: functions.php:93 371 | msgid "Select or Upload the custom photo" 372 | msgstr "" 373 | 374 | #: functions.php:94 375 | msgid "Use this image" 376 | msgstr "" 377 | 378 | #: functions.php:95 379 | msgid "Select or Upload the files" 380 | msgstr "" 381 | 382 | #: functions.php:96 383 | msgid "Use this file(s)" 384 | msgstr "" 385 | 386 | #: functions.php:97 inc/composer.php:351 387 | msgid "Edit file" 388 | msgstr "" 389 | 390 | #: functions.php:162 391 | msgid "Persian Tutorial in HamyarWP" 392 | msgstr "" 393 | 394 | #: functions.php:201 395 | #, php-format 396 | msgid "Your API token isn't set. Please go to %s and set it." 397 | msgstr "" 398 | 399 | #: functions.php:201 twp.php:39 400 | msgid "TWP Settings" 401 | msgstr "" 402 | 403 | #: functions.php:214 404 | msgid "Telegram Channel Options" 405 | msgstr "" 406 | 407 | #: functions.php:244 functions.php:472 408 | msgid "Bot token or Channel username aren't set!" 409 | msgstr "" 410 | 411 | #: functions.php:286 412 | msgid "Send to Telegram Status" 413 | msgstr "" 414 | 415 | #: functions.php:289 416 | msgid "Send this post to channel" 417 | msgstr "" 418 | 419 | #: functions.php:290 420 | msgid "Don't send this post to channel" 421 | msgstr "" 422 | 423 | #: functions.php:298 424 | msgid "Sending result: " 425 | msgstr "" 426 | 427 | #: functions.php:303 428 | msgid "Published successfully" 429 | msgstr "" 430 | 431 | #: functions.php:307 432 | msgid "Date: " 433 | msgstr "" 434 | 435 | #: inc/composer.php:49 436 | msgid "Message Pattern" 437 | msgstr "" 438 | 439 | #: inc/composer.php:54 440 | msgid "" 441 | "Define the structure of messages that are sent to the channel. Use tags, " 442 | "emoji shortnames and any other text." 443 | msgstr "" 444 | 445 | #: inc/composer.php:59 446 | msgid "Select a tag..." 447 | msgstr "" 448 | 449 | #: inc/composer.php:61 450 | msgid "The ID of this post" 451 | msgstr "" 452 | 453 | #: inc/composer.php:62 454 | msgid "The title of this post" 455 | msgstr "" 456 | 457 | #: inc/composer.php:63 458 | msgid "The first 55 words of this post" 459 | msgstr "" 460 | 461 | #: inc/composer.php:64 462 | msgid "The whole content of this post" 463 | msgstr "" 464 | 465 | #: inc/composer.php:65 466 | msgid "The display name of author of this post" 467 | msgstr "" 468 | 469 | #: inc/composer.php:66 470 | msgid "The short url of this post" 471 | msgstr "" 472 | 473 | #: inc/composer.php:67 474 | msgid "The permalink of this post" 475 | msgstr "" 476 | 477 | #: inc/composer.php:68 478 | msgid "" 479 | "The tags of this post. Tags are automatically converted to Telegram hashtags" 480 | msgstr "" 481 | 482 | #: inc/composer.php:69 483 | msgid "" 484 | "The categories of this post. Categories are automatically separated by | " 485 | "symbol" 486 | msgstr "" 487 | 488 | #: inc/composer.php:74 489 | msgid "The width of this product" 490 | msgstr "" 491 | 492 | #: inc/composer.php:75 493 | msgid "The length of this product" 494 | msgstr "" 495 | 496 | #: inc/composer.php:76 497 | msgid "The height of this product" 498 | msgstr "" 499 | 500 | #: inc/composer.php:77 501 | msgid "The weight of this product" 502 | msgstr "" 503 | 504 | #: inc/composer.php:78 505 | msgid "The price of this product" 506 | msgstr "" 507 | 508 | #: inc/composer.php:79 509 | msgid "The regular price of this product" 510 | msgstr "" 511 | 512 | #: inc/composer.php:80 513 | msgid "The sale price of this product" 514 | msgstr "" 515 | 516 | #: inc/composer.php:81 517 | msgid "The SKU (Stock Keeping Unit) of this product" 518 | msgstr "" 519 | 520 | #: inc/composer.php:82 521 | msgid "The stock amount of this product" 522 | msgstr "" 523 | 524 | #: inc/composer.php:83 525 | msgid "Is this product downloadable? (Yes or No)" 526 | msgstr "" 527 | 528 | #: inc/composer.php:84 529 | msgid "Is this product virtual? (Yes or No)" 530 | msgstr "" 531 | 532 | #: inc/composer.php:85 533 | msgid "Is this product sold individually? (Yes or No)" 534 | msgstr "" 535 | 536 | #: inc/composer.php:86 537 | msgid "The tax status of this product" 538 | msgstr "" 539 | 540 | #: inc/composer.php:87 541 | msgid "The tax class of this product" 542 | msgstr "" 543 | 544 | #: inc/composer.php:88 545 | msgid "The stock status of this product" 546 | msgstr "" 547 | 548 | #: inc/composer.php:89 549 | msgid "Whether or not backorders allowed? " 550 | msgstr "" 551 | 552 | #: inc/composer.php:90 553 | msgid "Is this a featured product? (Yes or No)" 554 | msgstr "" 555 | 556 | #: inc/composer.php:91 557 | msgid "Is this product visible? (Yes or No)" 558 | msgstr "" 559 | 560 | #: inc/composer.php:96 561 | msgid "Emoji..." 562 | msgstr "" 563 | 564 | #: inc/composer.php:290 565 | msgid "Click to see a full list of available emojis and their shortnames" 566 | msgstr "" 567 | 568 | #: inc/composer.php:290 569 | msgid "Emoji full list" 570 | msgstr "" 571 | 572 | #: inc/composer.php:291 573 | msgid "Click to see some patterns template" 574 | msgstr "" 575 | 576 | #: inc/composer.php:291 577 | msgid "Patterns Template" 578 | msgstr "" 579 | 580 | #: inc/composer.php:300 581 | msgid "Don't send featured image" 582 | msgstr "" 583 | 584 | #: inc/composer.php:303 585 | msgid "Send featured image" 586 | msgstr "" 587 | 588 | #: inc/composer.php:311 589 | msgid "Send custom image" 590 | msgstr "" 591 | 592 | #: inc/composer.php:340 593 | msgid "Send file" 594 | msgstr "" 595 | 596 | #: inc/composer.php:345 597 | msgid "Select the file that you want to send with this post." 598 | msgstr "" 599 | 600 | #: inc/composer.php:366 601 | msgid "Set custom file" 602 | msgstr "" 603 | 604 | #: inc/composer.php:370 605 | msgid "Remove this file" 606 | msgstr "" 607 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Telegram for WP === 2 | Contributors: amir-mousavi 3 | Tags: telegram,notifications,email,admin,plugin,channel 4 | Requires at least: 3.5 5 | Tested up to: 4.5.2 6 | Stable tag: 1.6.1 7 | License: GPLv2 or later 8 | License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html 9 | 10 | Allows WordPress site to send notifications to Telegram. You can also send files/posts/products to Telegram Channel. 11 | 12 | == Description == 13 | Hi, 14 | Whether you want to receive notifications about your website (e.g. comment submit, user register, new core update and etc.) or you just want to share your posts/products in Telegram Channel; you are welcome to use this plugin. This will help you to integrate Telegram with WordPress. 15 | 16 | This plugin based on Notifcaster service by Ameer Mousavi and allows WordPress site to send notifications to telegram. 17 | 18 | Note: You have to turn on WordPress email notifications in order to receive Telegram notifications. Because in this version you will receive the body of any email that WordPrss is sending. 19 | 20 | Please feedback and rate to make this plugin better. 21 | 22 | Here is a Persian Tutorial 23 | 24 | == Installation == 25 | 1. Download Telegram for WordPress plugin from Wordpress Plugin directory. 26 | 27 | 2. Upload zip file to your WordPress Plugins directory. /wp-content/plugins 28 | 29 | 3. Activate the plugin through the \'Plugins\' menu in WordPress 30 | 31 | 4. Go to TWP Settings Page in Wordpress dashboard. 32 | 33 | 5. Follow the guides in the TWP Settings page. 34 | 35 | == Screenshots == 36 | 37 | 1. Notification Settings. 38 | 2. Telegram Channel Settings. 39 | 3. Metabox in post editor allows you to override global settings. 40 | 41 | == Changelog == 42 | 43 | = 1.6 = 44 | * Fixed request timed-out when publishing a new post. 45 | * Added support for pages/products and any other post type. 46 | * Added feature for sending photo and text; all in one message. 47 | * Added feature for sending almost any file (limited to 50MB). 48 | * Fix the Internal Server Error in WooCommerce and Gravity Forms. 49 | * Optimized codes for faster and safer operation. 50 | * Better support for scheduled posts/products. 51 | * Added custom field support. Use following format for any custom field: %custom field name% or %#custom field name% for converting them to hashtags. 52 | * Added feature for controlling excerpt length. 53 | * Support supergroups in notifications. 54 | 55 | = 1.5 = 56 | * Using patterns for sending messages. 57 | * Using markdown and HTML format in messages. 58 | * Added support for sending long messages (Messages will be splitted). 59 | * Added support for emojis. 60 | * Added support for scheduled posts. 61 | *‌ Allow sending custom image. 62 | * Initial Support for WooCommerce. 63 | * Better report for sent messages. 64 | * Allow disabling link previews for links in the sent message. 65 | * Improved UI and UX. 66 | * Optimized codes for faster and safer operation. 67 | 68 | = 1.4 = 69 | * Sending posts to Telegram channel. 70 | * Sending notifications to groups. 71 | * Adding basic hashtag option. 72 | * Adding signature at the end of the channel messages. 73 | * Add backward compatibility for php < 5.5 . 74 | 75 | = 1.3 = 76 | * Introducing Notifcaster, a new service for sending notifications to Telegram using bot api. 77 | 78 | = 1.2 = 79 | * Fixing the conflict with Contact Form 7 80 | * Change "Notifygram" class name to "Notifygram_Class" 81 | 82 | = 1.1 = 83 | * Add Persian Tutorial Link 84 | * Add test button 85 | 86 | = 1.0 = 87 | * Initial Release -------------------------------------------------------------------------------- /twp.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 | query( "DROP TABLE IF EXISTS {$wpdb->prefix}twp_logs" ); 9 | $wpdb->query( "DELETE FROM {$wpdb->prefix}options WHERE option_name = 'twp_%'" ); --------------------------------------------------------------------------------