-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/dev-teplo'
- Loading branch information
Showing
14 changed files
with
805 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
node_modules | ||
/.buildpath | ||
/.project | ||
/.settings/org.eclipse.php.core.prefs | ||
/.settings/org.eclipse.wst.common.project.facet.core.xml | ||
/TeploBot | ||
/.settings/org.eclipse.core.resources.prefs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ | |
/* | ||
Plugin Name: TeploBot - Telegram Bot for WP | ||
Description: Simple Telegram Bot for your site with green effect | ||
Version: 1.1 | ||
Version: 1.2 | ||
Author: Teplitsa | ||
Author URI: https://te-st.ru/ | ||
Text Domain: gwptb | ||
Domain Path: /lang | ||
Contributors: | ||
Gleb Suvorov aka gsuvorov ([email protected]) - Idea, UX | ||
Anna Ladoshkina aka foralien ([email protected]) - Development | ||
Denis Cherniatev aka denischerniatev ([email protected]) - Development | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.txt | ||
|
@@ -37,7 +38,7 @@ | |
|
||
// Plugin version: | ||
if( !defined('GWPTB_VERSION') ) | ||
define('GWPTB_VERSION', '1.1'); | ||
define('GWPTB_VERSION', '1.2'); | ||
|
||
// Plugin DIR, with trailing slash: | ||
if( !defined('GWPTB_PLUGIN_DIR') ) | ||
|
@@ -70,6 +71,9 @@ | |
require_once(plugin_dir_path(__FILE__).'inc/class-cssjs.php'); | ||
require_once(plugin_dir_path(__FILE__).'inc/class-stat.php'); | ||
require_once(plugin_dir_path(__FILE__).'inc/class-filters.php'); | ||
require_once(plugin_dir_path(__FILE__).'inc/api.php'); | ||
require_once(plugin_dir_path(__FILE__).'inc/subscription.php'); | ||
require_once(plugin_dir_path(__FILE__).'inc/posting.php'); | ||
$tplb = Gwptb_Core::get_instance(); | ||
|
||
if(is_admin()){ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
# subscription | ||
function gwptb_get_post_teaser($post) { | ||
# get teaser from post content and excerpt | ||
$short = $post->post_excerpt; | ||
if(!$short) { | ||
if( preg_match( '/<!--more(.*?)?-->/', $post->post_content, $matches ) ) { | ||
$parts = explode( $matches[0], $post->post_content, 2 ); | ||
$short = $parts[0]; | ||
} | ||
else { | ||
$short = wp_trim_words($post->post_content); | ||
} | ||
} | ||
$short = apply_filters( 'get_the_excerpt', $short ); | ||
$short = preg_replace("/&#?[a-z0-9]+;/i", "", $short); | ||
|
||
return $short; | ||
} | ||
|
||
function gwptb_notify_subscribers($subscription_name, $message) { | ||
global $wpdb; | ||
|
||
$table_name = Gwptb_Core::get_chat_subscriptions_tablename(); | ||
$subscribed_chat_list = $wpdb->get_results($wpdb->prepare( "SELECT * FROM {$table_name} WHERE name = %s ", $subscription_name)); | ||
|
||
$telebot = Gwptb_Self::get_instance(); | ||
foreach($subscribed_chat_list as $chat) { | ||
$telebot->send_notification(array('chat_id' => $chat->chat_id, 'text' => $message, 'parse_mode' => 'HTML')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.