Version Description
Download this release
Release Info
Developer | hchouhan |
Plugin | I Recommend This |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.5 to 2.0
- css/dot-irecommendthis-heart.css +17 -0
- css/dot-irecommendthis.css +10 -0
- css/heart.png +0 -0
- css/i-recommend-this.css +0 -3
- dot-irecommendthis.php +602 -0
- i-recommend-this.php +0 -418
- images/default.png +0 -0
- images/heart.png +0 -0
- index.php +4 -0
- js/dot_irecommendthis.js +19 -0
- js/i-recommend-this.js +0 -13
- languages/dot-irecommendthis-en.mo +0 -0
- languages/dot-irecommendthis-en.po +158 -0
- readme.txt +12 -5
- recommend.php +0 -28
css/dot-irecommendthis-heart.css
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.dot-irecommendthis {
|
3 |
+
background:url(../images/heart.png) 0 3px no-repeat;
|
4 |
+
padding-left: 18px;
|
5 |
+
border: 0 !important;
|
6 |
+
margin-bottom: 10px;
|
7 |
+
display: inline-block;
|
8 |
+
text-decoration: none;
|
9 |
+
min-height: 14px;
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
.dot-irecommendthis:hover, .dot-irecommendthis.active { background-position:0 -23px; color: #F56559 !important; border: 0 !important;
|
15 |
+
margin: 0 0 10px 0 !important;
|
16 |
+
padding-left: 18px !important;
|
17 |
+
text-decoration: none;}
|
css/dot-irecommendthis.css
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.dot-irecommendthis {
|
3 |
+
background:url(../images/default.png) 0 0px no-repeat;
|
4 |
+
padding:0 0 0 20px;
|
5 |
+
border: 0 !important;
|
6 |
+
margin-bottom: 10px;
|
7 |
+
display: inline-block;
|
8 |
+
text-decoration: none;
|
9 |
+
}
|
10 |
+
.dot-irecommendthis:hover, .dot-irecommendthis.active { background-position:0 -24px; color: #F56559 !important; }
|
css/heart.png
DELETED
Binary file
|
css/i-recommend-this.css
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
.iRecommendThis { display:inline; }
|
2 |
-
.iRecommendThis .recommendThis { background:url(heart.png) top left no-repeat; padding:0 0 0 20px; font-weight:bold; cursor:pointer;}
|
3 |
-
.iRecommendThis .recommendThis.active { background-position:0 -24px; color: #F56559 !important; }
|
|
|
|
|
|
dot-irecommendthis.php
ADDED
@@ -0,0 +1,602 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: I Recommend This
|
4 |
+
* Plugin URI: http://www.harishchouhan.com/personal-projects/i-recommend-this/
|
5 |
+
* Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
|
6 |
+
* Version: 2.0
|
7 |
+
* Author: Harish Chouhan
|
8 |
+
* Author URI: http://www.harishchouhan.com
|
9 |
+
* Author Email: me@harishchouhan.com
|
10 |
+
*
|
11 |
+
* @package WordPress
|
12 |
+
* @subpackage DOT_IRecommendThis
|
13 |
+
* @author Harish
|
14 |
+
* @since 2.0
|
15 |
+
*
|
16 |
+
* License:
|
17 |
+
|
18 |
+
Copyright 2012 "I Recommend This WordPress Plugin" (me@harishchouhan.coms)
|
19 |
+
|
20 |
+
This program is free software; you can redistribute it and/or modify
|
21 |
+
it under the terms of the GNU General Public License, version 2, as
|
22 |
+
published by the Free Software Foundation.
|
23 |
+
|
24 |
+
This program is distributed in the hope that it will be useful,
|
25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
+
GNU General Public License for more details.
|
28 |
+
|
29 |
+
You should have received a copy of the GNU General Public License
|
30 |
+
along with this program; if not, write to the Free Software
|
31 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
32 |
+
|
33 |
+
*/
|
34 |
+
|
35 |
+
//if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
36 |
+
|
37 |
+
|
38 |
+
if ( ! class_exists( 'DOT_IRecommendThis' ) )
|
39 |
+
{
|
40 |
+
|
41 |
+
|
42 |
+
class DOT_IRecommendThis {
|
43 |
+
|
44 |
+
public $version = '2.0';
|
45 |
+
|
46 |
+
/*--------------------------------------------*
|
47 |
+
* Constructor
|
48 |
+
*--------------------------------------------*/
|
49 |
+
|
50 |
+
function __construct( $file )
|
51 |
+
{
|
52 |
+
$this->file = $file;
|
53 |
+
|
54 |
+
// Load text domain
|
55 |
+
add_action( 'init', array( &$this, 'load_localisation' ), 0 );
|
56 |
+
|
57 |
+
// Run this on activation / deactivation
|
58 |
+
register_activation_hook( __FILE__, array( &$this, 'activate' ) );
|
59 |
+
|
60 |
+
add_action( 'admin_menu', array( &$this, 'dot_irecommendthis_menu' ) );
|
61 |
+
add_action( 'admin_init', array( &$this, 'dot_irecommendthis_settings' ) );
|
62 |
+
add_action( 'init', array( &$this, 'add_widget_most_recommended_posts' ) );
|
63 |
+
add_action( 'wp_enqueue_scripts', array( &$this, 'dot_enqueue_scripts' ) );
|
64 |
+
add_filter( 'the_content', array( &$this, 'dot_content' ) );
|
65 |
+
add_action( 'publish_post', array( &$this, 'dot_setup_recommends' ) );
|
66 |
+
add_action( 'wp_ajax_dot-irecommendthis', array( &$this, 'ajax_callback' ) );
|
67 |
+
add_action( 'wp_ajax_nopriv_dot-irecommendthis', array( &$this, 'ajax_callback' ) );
|
68 |
+
add_shortcode( 'dot_recommends', array( &$this, 'shortcode' ) );
|
69 |
+
|
70 |
+
} // end constructor
|
71 |
+
|
72 |
+
|
73 |
+
/*--------------------------------------------*
|
74 |
+
* Localisation | Public | 1.4.6 | Return : void
|
75 |
+
*--------------------------------------------*/
|
76 |
+
|
77 |
+
public function load_localisation ()
|
78 |
+
{
|
79 |
+
load_plugin_textdomain( 'dot', false, dirname( plugin_basename( $this->file ) ) . '/languages/' );
|
80 |
+
|
81 |
+
} // End load_localisation()
|
82 |
+
|
83 |
+
|
84 |
+
/*--------------------------------------------*
|
85 |
+
* Activate
|
86 |
+
*--------------------------------------------*/
|
87 |
+
|
88 |
+
public function activate( $network_wide ) {
|
89 |
+
|
90 |
+
global $wpdb;
|
91 |
+
|
92 |
+
$table_name = $wpdb->prefix . "irecommendthis_votes";
|
93 |
+
if($wpdb->get_var("show tables recommend '$table_name'") != $table_name) {
|
94 |
+
$sql = "CREATE TABLE " . $table_name . " (
|
95 |
+
id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
|
96 |
+
time TIMESTAMP NOT NULL,
|
97 |
+
post_id BIGINT(20) NOT NULL,
|
98 |
+
ip VARCHAR(15) NOT NULL,
|
99 |
+
UNIQUE KEY id (id)
|
100 |
+
);";
|
101 |
+
|
102 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
103 |
+
dbDelta($sql);
|
104 |
+
|
105 |
+
$this->register_plugin_version();
|
106 |
+
|
107 |
+
//add_option("dot_irecommendthis_db_version", $dot_irecommendthis_db_version);
|
108 |
+
}
|
109 |
+
|
110 |
+
} // end activate
|
111 |
+
|
112 |
+
private function register_plugin_version () {
|
113 |
+
if ( $this->version != '' ) {
|
114 |
+
update_option( 'dot-irecommendthis' . '-version', $this->version );
|
115 |
+
}
|
116 |
+
} // End register_plugin_version()
|
117 |
+
|
118 |
+
|
119 |
+
/*--------------------------------------------*
|
120 |
+
* Admin Menu
|
121 |
+
*--------------------------------------------*/
|
122 |
+
|
123 |
+
function dot_irecommendthis_menu()
|
124 |
+
{
|
125 |
+
$page_title = __('I Recommend This', 'dot');
|
126 |
+
$menu_title = __('I Recommend This', 'dot');
|
127 |
+
$capability = 'manage_options';
|
128 |
+
$menu_slug = 'dot-irecommendthis';
|
129 |
+
$function = array( &$this, 'dot_settings_page');
|
130 |
+
add_options_page($page_title, $menu_title, $capability, $menu_slug, $function);
|
131 |
+
|
132 |
+
} //dot_irecommendthis_menu
|
133 |
+
|
134 |
+
|
135 |
+
/*--------------------------------------------*
|
136 |
+
* Settings & Settings Page
|
137 |
+
*--------------------------------------------*/
|
138 |
+
|
139 |
+
public function dot_irecommendthis_settings() // whitelist options
|
140 |
+
{
|
141 |
+
register_setting( 'dot-irecommendthis', 'dot_irecommendthis_settings', array(&$this, 'settings_validate') );
|
142 |
+
add_settings_section( 'dot-irecommendthis', '', array(&$this, 'section_intro'), 'dot-irecommendthis' );
|
143 |
+
add_settings_field( 'show_on', __( 'Automatically display on', 'dot' ), array(&$this, 'setting_show_on'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
144 |
+
add_settings_field( 'text_zero_suffix', __( 'Text after 0 Count', 'dot' ), array(&$this, 'setting_text_zero_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
145 |
+
add_settings_field( 'text_one_suffix', __( 'Text after 1 Count', 'dot' ), array(&$this, 'setting_text_one_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
146 |
+
add_settings_field( 'text_more_suffix', __( 'Text after more than 1 Count', 'dot' ), array(&$this, 'setting_text_more_suffix'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
147 |
+
add_settings_field( 'disable_css', __( 'Disable CSS', 'dot' ), array(&$this, 'setting_disable_css'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
148 |
+
add_settings_field( 'recommend_style', __( 'Choose a style', 'dot' ), array(&$this, 'setting_recommend_style'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
149 |
+
add_settings_field( 'instructions', __( 'Shortcode and Template Tag', 'dot' ), array(&$this, 'setting_instructions'), 'dot-irecommendthis', 'dot-irecommendthis' );
|
150 |
+
|
151 |
+
} //dot_irecommendthis_settings
|
152 |
+
|
153 |
+
|
154 |
+
public function dot_settings_page()
|
155 |
+
{
|
156 |
+
?>
|
157 |
+
<div class="wrap">
|
158 |
+
<?php screen_icon(); ?>
|
159 |
+
<h2>"I Recommend This" Options</h2>
|
160 |
+
<div class="metabox-holder has-right-sidebar">
|
161 |
+
<!-- SIDEBAR -->
|
162 |
+
<div class="inner-sidebar">
|
163 |
+
<!--<div class="postbox">
|
164 |
+
<h3><span>Metabox 1</span></h3>
|
165 |
+
<div class="inside">
|
166 |
+
<p>Hi, I'm metabox 1!</p>
|
167 |
+
</div>
|
168 |
+
</div>-->
|
169 |
+
</div> <!-- //inner-sidebar -->
|
170 |
+
|
171 |
+
<!-- MAIN CONTENT -->
|
172 |
+
<div id="post-body">
|
173 |
+
<div id="post-body-content">
|
174 |
+
<form action="options.php" method="post">
|
175 |
+
<?php settings_fields( 'dot-irecommendthis' ); ?>
|
176 |
+
<?php do_settings_sections( 'dot-irecommendthis' ); ?>
|
177 |
+
<p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'dot' ); ?>" /></p>
|
178 |
+
</form>
|
179 |
+
</div>
|
180 |
+
</div> <!-- //main content -->
|
181 |
+
</div> <!-- //metabox-holder -->
|
182 |
+
</div>
|
183 |
+
<?php
|
184 |
+
|
185 |
+
} //dot_settings_page
|
186 |
+
|
187 |
+
function section_intro()
|
188 |
+
{
|
189 |
+
?>
|
190 |
+
|
191 |
+
<p><?php _e('<a href="https://twitter.com/harishchouhan" class="twitter-follow-button" data-show-count="false">Follow @harishchouhan</a>
|
192 |
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> or Check out our other themes & plugins at <a href="http://www.dreamsonline.net">Dreams Online Themes</a>.', 'dot'); ?></p>
|
193 |
+
<p><?php _e('This plugin allows your visitors to simply recommend or like your posts instead of commment it.', 'dot'); ?></p>
|
194 |
+
<?php
|
195 |
+
}
|
196 |
+
|
197 |
+
function setting_show_on()
|
198 |
+
{
|
199 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
200 |
+
if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
|
201 |
+
if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
|
202 |
+
|
203 |
+
echo '<input type="hidden" name="dot_irecommendthis_settings[add_to_posts]" value="0" />
|
204 |
+
<label><input type="checkbox" name="dot_irecommendthis_settings[add_to_posts]" value="1"'. (($options['add_to_posts']) ? ' checked="checked"' : '') .' />
|
205 |
+
'. __('Posts', 'dot') .'</label><br />
|
206 |
+
<input type="hidden" name="dot_irecommendthis_settings[add_to_other]" value="0" />
|
207 |
+
<label><input type="checkbox" name="dot_irecommendthis_settings[add_to_other]" value="1"'. (($options['add_to_other']) ? ' checked="checked"' : '') .' />
|
208 |
+
'. __('All other pages like Index, Archive, etc.', 'dot') .'</label><br />';
|
209 |
+
}
|
210 |
+
|
211 |
+
function setting_disable_css()
|
212 |
+
{
|
213 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
214 |
+
if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
|
215 |
+
|
216 |
+
echo '<input type="hidden" name="dot_irecommendthis_settings[disable_css]" value="0" />
|
217 |
+
<label><input type="checkbox" name="dot_irecommendthis_settings[disable_css]" value="1"'. (($options['disable_css']) ? ' checked="checked"' : '') .' />
|
218 |
+
I want to use my own CSS styles</label>';
|
219 |
+
}
|
220 |
+
|
221 |
+
function setting_text_zero_suffix()
|
222 |
+
{
|
223 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
224 |
+
if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
|
225 |
+
|
226 |
+
echo '<input type="text" name="dot_irecommendthis_settings[text_zero_suffix]" class="regular-text" value="'. $options['text_zero_suffix'] .'" /><br />
|
227 |
+
<span class="description">'. __('Text to display after zero count. Leave blank for no text after the count.', 'dot') .'</span>';
|
228 |
+
}
|
229 |
+
|
230 |
+
function setting_text_one_suffix() {
|
231 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
232 |
+
if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
|
233 |
+
|
234 |
+
echo '<input type="text" name="dot_irecommendthis_settings[text_one_suffix]" class="regular-text" value="'. $options['text_one_suffix'] .'" /><br />
|
235 |
+
<span class="description">'. __('Text to display after 1 person has recommended. Leave blank for no text after the count.', 'dot') .'</span>';
|
236 |
+
}
|
237 |
+
|
238 |
+
function setting_text_more_suffix()
|
239 |
+
{
|
240 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
241 |
+
if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
|
242 |
+
|
243 |
+
echo '<input type="text" name="dot_irecommendthis_settings[text_more_suffix]" class="regular-text" value="'. $options['text_more_suffix'] .'" /><br />
|
244 |
+
<span class="description">'. __('Text to display after more than 1 person have recommended. Leave blank for no text after the count.', 'dot') .'</span>';
|
245 |
+
}
|
246 |
+
|
247 |
+
function setting_recommend_style()
|
248 |
+
{
|
249 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
250 |
+
if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
|
251 |
+
|
252 |
+
echo '<label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="0"'. (($options['recommend_style']) == "0" ? checked : '') .' />
|
253 |
+
'. __('Default style - Thumb', 'dot') .'</label><br />
|
254 |
+
|
255 |
+
<label><input type="radio" name="dot_irecommendthis_settings[recommend_style]" value="1"'. (($options['recommend_style']) == "1" ? checked : '') .' />
|
256 |
+
'. __('Heart', 'dot') .'</label><br />';
|
257 |
+
}
|
258 |
+
|
259 |
+
function setting_instructions()
|
260 |
+
{
|
261 |
+
echo '<p>'. __('To use I Recomment This in your posts and pages you can use the shortcode:', 'dot') .'</p>
|
262 |
+
<p><code>[dot_irecommendthis]</code></p>
|
263 |
+
<p>'. __('To use I Recomment This manually in your theme template use the following PHP code:', 'dot') .'</p>
|
264 |
+
<p><code><?php if( function_exists(\'dot_irecommendthis\') ) dot_irecommendthis(); ?></code></p>';
|
265 |
+
}
|
266 |
+
|
267 |
+
function settings_validate($input)
|
268 |
+
{
|
269 |
+
return $input;
|
270 |
+
}
|
271 |
+
|
272 |
+
|
273 |
+
/*--------------------------------------------*
|
274 |
+
* Enqueue Scripts
|
275 |
+
*--------------------------------------------*/
|
276 |
+
|
277 |
+
function dot_enqueue_scripts()
|
278 |
+
{
|
279 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
280 |
+
if( !isset($options['disable_css']) ) $options['disable_css'] = '0';
|
281 |
+
if( !isset($options['recommend_style']) ) $options['recommend_style'] = '0';
|
282 |
+
|
283 |
+
|
284 |
+
if ($options['recommend_style'] == '0') {
|
285 |
+
wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis.css', __FILE__ ) );
|
286 |
+
}
|
287 |
+
else {
|
288 |
+
wp_enqueue_style( 'dot-irecommendthis', plugins_url( '/css/dot-irecommendthis-heart.css', __FILE__ ) );
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
wp_enqueue_script( 'dot-irecommendthis', plugins_url( '/js/dot_irecommendthis.js', __FILE__ ), array('jquery') );
|
293 |
+
wp_enqueue_script( 'jquery' );
|
294 |
+
|
295 |
+
wp_localize_script('dot-irecommendthis', 'dot', array(
|
296 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
297 |
+
));
|
298 |
+
|
299 |
+
wp_localize_script( 'dot-irecommendthis', 'dot_irecommendthis', array('ajaxurl' => admin_url('admin-ajax.php')) );
|
300 |
+
|
301 |
+
} //dot_enqueue_scripts
|
302 |
+
|
303 |
+
|
304 |
+
/*--------------------------------------------*
|
305 |
+
* Content / Front-end view
|
306 |
+
*--------------------------------------------*/
|
307 |
+
|
308 |
+
function dot_content( $content )
|
309 |
+
{
|
310 |
+
// Don't show on custom page templates or pages
|
311 |
+
if(is_page_template() || is_page() || is_front_page()) return $content;
|
312 |
+
|
313 |
+
// Don't show after excerpts
|
314 |
+
global $wp_current_filter;
|
315 |
+
if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
|
316 |
+
return $content;
|
317 |
+
}
|
318 |
+
|
319 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
320 |
+
if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '0';
|
321 |
+
if( !isset($options['add_to_other']) ) $options['add_to_other'] = '0';
|
322 |
+
|
323 |
+
if(is_singular('post') && $options['add_to_posts']) $content .= $this->dot_recommend();
|
324 |
+
if((is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->dot_recommend();
|
325 |
+
|
326 |
+
return $content;
|
327 |
+
|
328 |
+
} //dot_content
|
329 |
+
|
330 |
+
|
331 |
+
/*--------------------------------------------*
|
332 |
+
* Setup recommends
|
333 |
+
*--------------------------------------------*/
|
334 |
+
|
335 |
+
function setup_recommends( $post_id )
|
336 |
+
{
|
337 |
+
if(!is_numeric($post_id)) return;
|
338 |
+
|
339 |
+
add_post_meta($post_id, '_recommended', '0', true);
|
340 |
+
|
341 |
+
} //setup_recommends
|
342 |
+
|
343 |
+
|
344 |
+
/*--------------------------------------------*
|
345 |
+
* AJAX Callback
|
346 |
+
*--------------------------------------------*/
|
347 |
+
|
348 |
+
function ajax_callback($post_id)
|
349 |
+
{
|
350 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
351 |
+
if( !isset($options['add_to_posts']) ) $options['add_to_posts'] = '1';
|
352 |
+
if( !isset($options['add_to_other']) ) $options['add_to_other'] = '1';
|
353 |
+
if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
|
354 |
+
if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
|
355 |
+
if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
|
356 |
+
|
357 |
+
if( isset($_POST['recommend_id']) ) {
|
358 |
+
// Click event. Get and Update Count
|
359 |
+
$post_id = str_replace('dot-irecommendthis-', '', $_POST['recommend_id']);
|
360 |
+
echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'update');
|
361 |
+
} else {
|
362 |
+
// AJAXing data in. Get Count
|
363 |
+
$post_id = str_replace('dot-irecommendthis-', '', $_POST['post_id']);
|
364 |
+
echo $this->dot_recommend_this($post_id, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix'], 'get');
|
365 |
+
}
|
366 |
+
|
367 |
+
exit;
|
368 |
+
|
369 |
+
} //ajax_callback
|
370 |
+
|
371 |
+
|
372 |
+
/*--------------------------------------------*
|
373 |
+
* Main Process
|
374 |
+
*--------------------------------------------*/
|
375 |
+
|
376 |
+
|
377 |
+
function dot_recommend_this($post_id, $text_zero_suffix = false, $text_one_suffix = false, $text_more_suffix = false, $action = 'get')
|
378 |
+
{
|
379 |
+
if(!is_numeric($post_id)) return;
|
380 |
+
$text_zero_suffix = strip_tags($text_zero_suffix);
|
381 |
+
$text_one_suffix = strip_tags($text_one_suffix);
|
382 |
+
$text_more_suffix = strip_tags($text_more_suffix);
|
383 |
+
|
384 |
+
switch($action) {
|
385 |
+
|
386 |
+
case 'get':
|
387 |
+
$recommended = get_post_meta($post_id, '_recommended', true);
|
388 |
+
if( !$recommended ){
|
389 |
+
$recommended = 0;
|
390 |
+
add_post_meta($post_id, '_recommended', $recommended, true);
|
391 |
+
}
|
392 |
+
|
393 |
+
if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
|
394 |
+
elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
|
395 |
+
else { $suffix = $text_more_suffix; }
|
396 |
+
|
397 |
+
return '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class=""dot-irecommendthis-suffix">'. $suffix .'</span>';
|
398 |
+
break;
|
399 |
+
|
400 |
+
case 'update':
|
401 |
+
|
402 |
+
$recommended = get_post_meta($post_id, '_recommended', true);
|
403 |
+
|
404 |
+
global $wpdb;
|
405 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
406 |
+
$voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_id' AND ip = '$ip'");
|
407 |
+
|
408 |
+
if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
|
409 |
+
return $recommended;
|
410 |
+
}
|
411 |
+
|
412 |
+
$recommended++;
|
413 |
+
update_post_meta($post_id, '_recommended', $recommended);
|
414 |
+
setcookie('dot_irecommendthis_'. $post_id, time(), time()+3600*24*365, '/');
|
415 |
+
$wpdb->query("INSERT INTO ".$wpdb->prefix."irecommendthis_votes VALUES ('', NOW(), '$post_id', '$ip')");
|
416 |
+
|
417 |
+
if( $recommended == 0 ) { $suffix = $text_zero_suffix; }
|
418 |
+
elseif( $recommended == 1 ) { $suffix = $text_one_suffix; }
|
419 |
+
else { $suffix = $text_more_suffix; }
|
420 |
+
|
421 |
+
return '<span class="dot-irecommendthis-count">'. $recommended .'</span> <span class=""dot-irecommendthis-suffix">'. $suffix .'</span>';
|
422 |
+
break;
|
423 |
+
|
424 |
+
}
|
425 |
+
} //dot_recommend_this
|
426 |
+
|
427 |
+
|
428 |
+
/*--------------------------------------------*
|
429 |
+
* Shortcode
|
430 |
+
*--------------------------------------------*/
|
431 |
+
|
432 |
+
function shortcode( $atts )
|
433 |
+
{
|
434 |
+
extract( shortcode_atts( array(), $atts ) );
|
435 |
+
return $this->dot_recommend();
|
436 |
+
|
437 |
+
} //shortcode
|
438 |
+
|
439 |
+
|
440 |
+
function dot_recommend()
|
441 |
+
{
|
442 |
+
global $wpdb;
|
443 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
444 |
+
$post_ID = get_the_ID();
|
445 |
+
$voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post->ID' AND ip = '$ip'");
|
446 |
+
global $post;
|
447 |
+
|
448 |
+
|
449 |
+
|
450 |
+
$options = get_option( 'dot_irecommendthis_settings' );
|
451 |
+
if( !isset($options['text_zero_suffix']) ) $options['text_zero_suffix'] = '';
|
452 |
+
if( !isset($options['text_one_suffix']) ) $options['text_one_suffix'] = '';
|
453 |
+
if( !isset($options['text_more_suffix']) ) $options['text_more_suffix'] = '';
|
454 |
+
|
455 |
+
$output = $this->dot_recommend_this($post->ID, $options['text_zero_suffix'], $options['text_one_suffix'], $options['text_more_suffix']);
|
456 |
+
|
457 |
+
|
458 |
+
|
459 |
+
//if ( isset($_COOKIE['dot_irecommendthis_'. $post_id]) && $voteStatusByIp != 0 ) {
|
460 |
+
|
461 |
+
if (!isset($_COOKIE['dot_irecommendthis_'.$post_ID]) && $voteStatusByIp == 0) {
|
462 |
+
$class = 'dot-irecommendthis';
|
463 |
+
$title = __('Recommend this', 'dot');
|
464 |
+
}
|
465 |
+
else {
|
466 |
+
|
467 |
+
$class = 'dot-irecommendthis active';
|
468 |
+
$title = __('You already recommended this', 'dot');
|
469 |
+
}
|
470 |
+
|
471 |
+
return '<a href="#" class="'. $class .'" id="dot-irecommendthis-'. $post->ID .'" title="'. $title .'">'. $output .'</a>';
|
472 |
+
}
|
473 |
+
|
474 |
+
|
475 |
+
/*--------------------------------------------*
|
476 |
+
* Widget
|
477 |
+
*--------------------------------------------*/
|
478 |
+
|
479 |
+
function add_widget_most_recommended_posts()
|
480 |
+
{
|
481 |
+
|
482 |
+
function most_recommended_posts($numberOf, $before, $after, $show_count, $post_type="post", $raw=false) {
|
483 |
+
global $wpdb;
|
484 |
+
|
485 |
+
$request = "SELECT * FROM $wpdb->posts, $wpdb->postmeta";
|
486 |
+
$request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
|
487 |
+
$request .= " AND post_status='publish' AND post_type='$post_type' AND meta_key='_recommended'";
|
488 |
+
$request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
|
489 |
+
$posts = $wpdb->get_results($request);
|
490 |
+
|
491 |
+
if ($raw):
|
492 |
+
return $posts;
|
493 |
+
else:
|
494 |
+
foreach ($posts as $item) {
|
495 |
+
$post_title = stripslashes($item->post_title);
|
496 |
+
$permalink = get_permalink($item->ID);
|
497 |
+
$post_count = $item->meta_value;
|
498 |
+
echo $before.'<a href="' . $permalink . '" title="' . $post_title.'" rel="nofollow">' . $post_title . '</a>';
|
499 |
+
echo $show_count == '1' ? ' ('.$post_count.')' : '';
|
500 |
+
echo $after;
|
501 |
+
}
|
502 |
+
endif;
|
503 |
+
}
|
504 |
+
|
505 |
+
function widget_most_recommended_posts($args)
|
506 |
+
{
|
507 |
+
extract($args);
|
508 |
+
$options = get_option("most_recommended_posts");
|
509 |
+
if (!is_array( $options ))
|
510 |
+
{
|
511 |
+
$options = array(
|
512 |
+
'title' => 'Most recommended posts',
|
513 |
+
'number' => '5',
|
514 |
+
'show_count' => '0'
|
515 |
+
);
|
516 |
+
}
|
517 |
+
$title = $options['title'];
|
518 |
+
$numberOf = $options['number'];
|
519 |
+
$show_count = $options['show_count'];
|
520 |
+
|
521 |
+
echo $before_widget;
|
522 |
+
echo $before_title . $title . $after_title;
|
523 |
+
echo '<ul class="mostrecommendedposts">';
|
524 |
+
|
525 |
+
most_recommended_posts($numberOf, '<li>', '</li>', $show_count);
|
526 |
+
|
527 |
+
echo '</ul>';
|
528 |
+
echo $after_widget;
|
529 |
+
}
|
530 |
+
wp_register_sidebar_widget('most_recommended_posts', 'Most recommended posts', 'widget_most_recommended_posts');
|
531 |
+
|
532 |
+
function options_widget_most_recommended_posts() {
|
533 |
+
$options = get_option("most_recommended_posts");
|
534 |
+
|
535 |
+
if (!is_array( $options )) {
|
536 |
+
$options = array(
|
537 |
+
'title' => 'Most recommended posts',
|
538 |
+
'number' => '5',
|
539 |
+
'show_count' => '0'
|
540 |
+
);
|
541 |
+
}
|
542 |
+
|
543 |
+
if ($_POST['mrp-submit']) {
|
544 |
+
$options['title'] = htmlspecialchars($_POST['mrp-title']);
|
545 |
+
$options['number'] = htmlspecialchars($_POST['mrp-number']);
|
546 |
+
$options['show_count'] = $_POST['mrp-show-count'];
|
547 |
+
if ( $options['number'] > 15) { $options['number'] = 15; }
|
548 |
+
|
549 |
+
update_option("most_recommended_posts", $options);
|
550 |
+
}
|
551 |
+
?>
|
552 |
+
<p><label for="mrp-title"><?php _e('Title:', 'i-recommend-this'); ?><br />
|
553 |
+
<input class="widefat" type="text" id="mrp-title" name="mrp-title" value="<?php echo $options['title'];?>" /></label></p>
|
554 |
+
|
555 |
+
<p><label for="mrp-number"><?php _e('Number of posts to show:', 'i-recommend-this'); ?><br />
|
556 |
+
<input type="text" id="mrp-number" name="mrp-number" style="width: 25px;" value="<?php echo $options['number'];?>" /> <small>(max. 15)</small></label></p>
|
557 |
+
|
558 |
+
<p><label for="mrp-show-count"><input type="checkbox" id="mrp-show-count" name="mrp-show-count" value="1"<?php if($options['show_count'] == '1') echo 'checked="checked"'; ?> /> <?php _e('Show post count', 'i-recommend-this'); ?></label></p>
|
559 |
+
|
560 |
+
<input type="hidden" id="mrp-submit" name="mrp-submit" value="1" />
|
561 |
+
<?php
|
562 |
+
}
|
563 |
+
wp_register_widget_control('most_recommended_posts', 'Most recommended posts', 'options_widget_most_recommended_posts');
|
564 |
+
}
|
565 |
+
|
566 |
+
|
567 |
+
} // End Class
|
568 |
+
|
569 |
+
global $dot_irecommendthis;
|
570 |
+
|
571 |
+
// Initiation call of plugin
|
572 |
+
$dot_irecommendthis = new DOT_IRecommendThis( $file );
|
573 |
+
|
574 |
+
}
|
575 |
+
|
576 |
+
/*--------------------------------------------*
|
577 |
+
* Template Tag
|
578 |
+
*--------------------------------------------*/
|
579 |
+
|
580 |
+
function dot_irecommendthis()
|
581 |
+
{
|
582 |
+
global $dot_irecommendthis;
|
583 |
+
echo $dot_irecommendthis->dot_recommend();
|
584 |
+
|
585 |
+
}
|
586 |
+
|
587 |
+
/*--------------------------------------------*
|
588 |
+
* Settings Menu
|
589 |
+
*--------------------------------------------*/
|
590 |
+
|
591 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'dot_irecommendthis_plugin_links' );
|
592 |
+
|
593 |
+
function dot_irecommendthis_plugin_links($links) {
|
594 |
+
return array_merge(
|
595 |
+
array(
|
596 |
+
'settings' => '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=dot-irecommendthis">' . __('Settings', 'dot-irecommendthis') . '</a>'
|
597 |
+
),
|
598 |
+
$links
|
599 |
+
);
|
600 |
+
}
|
601 |
+
|
602 |
+
?>
|
i-recommend-this.php
DELETED
@@ -1,418 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: I Recommend This
|
4 |
-
Plugin URI: http://www.harishchouhan.com/personal-projects/i-recommend-this/
|
5 |
-
Description: This plugin allows your visitors to simply recommend or like your posts instead of commment it.
|
6 |
-
Version: 1.4.5
|
7 |
-
Author: Harish Chouhan
|
8 |
-
Author URI: http://www.harishchouhan.com
|
9 |
-
|
10 |
-
Copyright 2012 Harish Chouhan (email : me@harishchouhan.com)
|
11 |
-
|
12 |
-
This program is free software; you can redistribute it and/or modify
|
13 |
-
it under the terms of the GNU General Public License as published by
|
14 |
-
the Free Software Foundation; either version 2 of the License, or
|
15 |
-
(at your option) any later version.
|
16 |
-
|
17 |
-
This program is distributed in the hope that it will be useful,
|
18 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
-
GNU General Public License for more details.
|
21 |
-
*/
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
#### INSTALL PROCESS ####
|
26 |
-
$irt_dbVersion = "1.0";
|
27 |
-
|
28 |
-
function setOptionsIRT() {
|
29 |
-
global $wpdb;
|
30 |
-
global $irt_dbVersion;
|
31 |
-
|
32 |
-
$table_name = $wpdb->prefix . "irecommendthis_votes";
|
33 |
-
if($wpdb->get_var("show tables recommend '$table_name'") != $table_name) {
|
34 |
-
$sql = "CREATE TABLE " . $table_name . " (
|
35 |
-
id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
|
36 |
-
time TIMESTAMP NOT NULL,
|
37 |
-
post_id BIGINT(20) NOT NULL,
|
38 |
-
ip VARCHAR(15) NOT NULL,
|
39 |
-
UNIQUE KEY id (id)
|
40 |
-
);";
|
41 |
-
|
42 |
-
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
43 |
-
dbDelta($sql);
|
44 |
-
|
45 |
-
add_option("irt_dbVersion", $irt_dbVersion);
|
46 |
-
}
|
47 |
-
|
48 |
-
add_option('irt_jquery', '1', '', 'yes');
|
49 |
-
add_option('irt_onPage', '1', '', 'yes');
|
50 |
-
add_option('irt_textOrNotext', 'notext', '', 'yes');
|
51 |
-
add_option('irt_text', 'I recommend This', '', 'yes');
|
52 |
-
add_option('irt_textOnclick', 'recommends', '', 'yes');
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
register_activation_hook(__FILE__, 'setOptionsIRT');
|
57 |
-
|
58 |
-
function unsetOptionsIRT() {
|
59 |
-
global $wpdb;
|
60 |
-
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."irecommendthis_votes");
|
61 |
-
|
62 |
-
delete_option('irt_jquery');
|
63 |
-
delete_option('irt_onPage');
|
64 |
-
delete_option('irt_textOrNotext');
|
65 |
-
delete_option('irt_text');
|
66 |
-
delete_option('irt_textOnclick');
|
67 |
-
delete_option('most_recommended_posts');
|
68 |
-
delete_option('irt_dbVersion');
|
69 |
-
}
|
70 |
-
|
71 |
-
register_uninstall_hook(__FILE__, 'unsetOptionsIRT');
|
72 |
-
####
|
73 |
-
|
74 |
-
|
75 |
-
#### ADMIN OPTIONS ####
|
76 |
-
function IRecommendThisAdminMenu() {
|
77 |
-
add_options_page('I Recommend This', 'I Recommend This', 'administrator', 'IRecommendThisAdminMenu', 'IRecommendThisAdminContent');
|
78 |
-
}
|
79 |
-
add_action('admin_menu', 'IRecommendThisAdminMenu');
|
80 |
-
|
81 |
-
function IRecommendThisAdminRegisterSettings() { // whitelist options
|
82 |
-
register_setting( 'irt_options', 'irt_jquery' );
|
83 |
-
register_setting( 'irt_options', 'irt_onPage' );
|
84 |
-
register_setting( 'irt_options', 'irt_textOrNotext' );
|
85 |
-
register_setting( 'irt_options', 'irt_text' );
|
86 |
-
register_setting( 'irt_options', 'irt_textOnclick' );
|
87 |
-
}
|
88 |
-
add_action('admin_init', 'IRecommendThisAdminRegisterSettings');
|
89 |
-
|
90 |
-
function IRecommendThisAdminContent() {
|
91 |
-
?>
|
92 |
-
<div class="wrap">
|
93 |
-
<h2>"I Recommend This" Options</h2>
|
94 |
-
<br class="clear" />
|
95 |
-
|
96 |
-
<div id="poststuff" class="ui-sortable meta-box-sortables">
|
97 |
-
<div id="irecommendthisoptions" class="postbox">
|
98 |
-
<h3><?php _e('Configuration'); ?></h3>
|
99 |
-
<div class="inside">
|
100 |
-
<form method="post" action="options.php">
|
101 |
-
<?php settings_fields('irt_options'); ?>
|
102 |
-
<table class="form-table">
|
103 |
-
<tr valign="top">
|
104 |
-
<th scope="row"><label for="irt_jquery"><?php _e('jQuery framework', 'i-recommend-this'); ?></label></th>
|
105 |
-
<td>
|
106 |
-
<select name="irt_jquery" id="irt_jquery">
|
107 |
-
<?php echo get_option('irt_jquery') == '1' ? '<option value="1" selected="selected">'.__('Enabled', 'i-recommend-this').'</option><option value="0">'.__('Disabled', 'i-recommend-this').'</option>' : '<option value="1">'.__('Enabled', 'i-recommend-this').'</option><option value="0" selected="selected">'.__('Disabled', 'i-recommend-this').'</option>'; ?>
|
108 |
-
</select>
|
109 |
-
<span class="description"><?php _e('Disable it if you already have the jQuery framework enabled in your theme.', 'i-recommend-this'); ?></span>
|
110 |
-
</td>
|
111 |
-
</tr>
|
112 |
-
<tr valign="top">
|
113 |
-
<th scope="row"><legend><?php _e('No Text or Text?', 'i-recommend-this'); ?></legend></th>
|
114 |
-
<td>
|
115 |
-
<label for="irt_textOrNotext" style="padding:3px 20px 0 0; margin-right:20px;">
|
116 |
-
<?php echo get_option('irt_textOrNotext') == 'notext' ? '<input type="radio" name="irt_textOrNotext" id="irt_textOrNotext" value="image" checked="checked">' : '<input type="radio" name="irt_textOrNotext" id="irt_textOrNotext" value="notext">'; ?> No Text
|
117 |
-
</label>
|
118 |
-
<label for="irt_text">
|
119 |
-
<?php echo get_option('irt_textOrNotext') == 'text' ? '<input type="radio" name="irt_textOrNotext" id="irt_textOrNotext" value="text" checked="checked">' : '<input type="radio" name="irt_textOrNotext" id="irt_textOrNotext" value="text">'; ?>
|
120 |
-
<input type="text" name="irt_text" id="irt_text" value="<?php echo get_option('irt_text'); ?>" />
|
121 |
-
</label>
|
122 |
-
</td>
|
123 |
-
</tr>
|
124 |
-
<tr valign="top">
|
125 |
-
<th scope="row"><legend><?php _e('Text displayed on click', 'i-recommend-this'); ?></legend></th>
|
126 |
-
<td>
|
127 |
-
<label for="irt_textOnclick">
|
128 |
-
<input type="text" name="irt_textOnclick" id="irt_textOnclick" value="<?php echo get_option('irt_textOnclick'); ?>" />
|
129 |
-
</label>
|
130 |
-
</td>
|
131 |
-
</tr>
|
132 |
-
<tr valign="top">
|
133 |
-
<th scope="row"><legend><?php _e('Automatic display', 'i-recommend-this'); ?></legend></th>
|
134 |
-
<td>
|
135 |
-
<label for="irt_onPage">
|
136 |
-
<?php echo get_option('irt_onPage') == '1' ? '<input type="checkbox" name="irt_onPage" id="ilt_onPage" value="1" checked="checked">' : '<input type="checkbox" name="irt_onPage" id="irt_onPage" value="1">'; ?>
|
137 |
-
<?php _e('<strong>On all posts</strong> (home, archives, search) at the bottom of the post', 'i-recommend-this'); ?>
|
138 |
-
</label>
|
139 |
-
<p class="description"><?php _e('If you disable this option, you have to put manually the code', 'i-recommend-this'); ?><code><?php if(function_exists(getIRecommendThis)) getIRecommendThis('get'); ?></code> <?php _e('wherever you want in your template.', 'i-recommend-this'); ?></p>
|
140 |
-
</td>
|
141 |
-
</tr>
|
142 |
-
<tr valign="top">
|
143 |
-
<th scope="row"><input class="button-primary" type="submit" name="Save" value="<?php _e('Save Options', 'i-recommend-this'); ?>" /></th>
|
144 |
-
<td></td>
|
145 |
-
</tr>
|
146 |
-
</table>
|
147 |
-
</form>
|
148 |
-
</div>
|
149 |
-
</div>
|
150 |
-
</div>
|
151 |
-
</div>
|
152 |
-
<?php
|
153 |
-
}
|
154 |
-
####
|
155 |
-
|
156 |
-
|
157 |
-
#### WIDGET ####
|
158 |
-
function most_recommended_posts($numberOf, $before, $after, $show_count, $post_type="post", $raw=false) {
|
159 |
-
global $wpdb;
|
160 |
-
|
161 |
-
$request = "SELECT * FROM $wpdb->posts, $wpdb->postmeta";
|
162 |
-
$request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
|
163 |
-
$request .= " AND post_status='publish' AND post_type='$post_type' AND meta_key='_recommended'";
|
164 |
-
$request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
|
165 |
-
$posts = $wpdb->get_results($request);
|
166 |
-
|
167 |
-
if ($raw):
|
168 |
-
return $posts;
|
169 |
-
else:
|
170 |
-
foreach ($posts as $item) {
|
171 |
-
$post_title = stripslashes($item->post_title);
|
172 |
-
$permalink = get_permalink($item->ID);
|
173 |
-
$post_count = $item->meta_value;
|
174 |
-
echo $before.'<a href="' . $permalink . '" title="' . $post_title.'" rel="nofollow">' . $post_title . '</a>';
|
175 |
-
echo $show_count == '1' ? ' ('.$post_count.')' : '';
|
176 |
-
echo $after;
|
177 |
-
}
|
178 |
-
endif;
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Mini counter widget
|
183 |
-
*/
|
184 |
-
function most_recommended_recommend_widget(){
|
185 |
-
global $wpdb;
|
186 |
-
$post_ID = get_the_ID();
|
187 |
-
$ip = $_SERVER['REMOTE_ADDR'];
|
188 |
-
|
189 |
-
$liked = get_post_meta($post_ID, '_recommended', true) != '' ? get_post_meta($post_ID, '_recommended', true) : '0';
|
190 |
-
$voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
|
191 |
-
|
192 |
-
|
193 |
-
$return='<div class="irt_counter_widget">';
|
194 |
-
if (!isset($_COOKIE['recommended-'.$post_ID]) && $voteStatusByIp == 0) {
|
195 |
-
$return.='<p class="irt_counter_widget_btn"><a onclick="recommendThis('.$post_ID.');">Vote!</a></p>';
|
196 |
-
}
|
197 |
-
else {
|
198 |
-
$return.='<p class="irt_counter_widget_btn recommended">Voted</p>';
|
199 |
-
}
|
200 |
-
$return.= '<p class="irt_counter_widget_counter" id="'.$post_ID.'">'.$recommended.' lights</p>';
|
201 |
-
$return.= '</div>';
|
202 |
-
echo $return;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* SIDEBAR WIDGET
|
207 |
-
*/
|
208 |
-
function add_widget_most_recommended_posts() {
|
209 |
-
function widget_most_recommended_posts($args) {
|
210 |
-
extract($args);
|
211 |
-
$options = get_option("most_recommended_posts");
|
212 |
-
if (!is_array( $options )) {
|
213 |
-
$options = array(
|
214 |
-
'title' => 'Most recommended posts',
|
215 |
-
'number' => '5',
|
216 |
-
'show_count' => '0'
|
217 |
-
);
|
218 |
-
}
|
219 |
-
$title = $options['title'];
|
220 |
-
$numberOf = $options['number'];
|
221 |
-
$show_count = $options['show_count'];
|
222 |
-
|
223 |
-
echo $before_widget;
|
224 |
-
echo $before_title . $title . $after_title;
|
225 |
-
echo '<ul class="mostrecommendedposts">';
|
226 |
-
|
227 |
-
most_recommended_posts($numberOf, '<li>', '</li>', $show_count);
|
228 |
-
|
229 |
-
echo '</ul>';
|
230 |
-
echo $after_widget;
|
231 |
-
}
|
232 |
-
wp_register_sidebar_widget('most_recommended_posts', 'Most recommended posts', 'widget_most_recommended_posts');
|
233 |
-
|
234 |
-
function options_widget_most_recommended_posts() {
|
235 |
-
$options = get_option("most_recommended_posts");
|
236 |
-
|
237 |
-
if (!is_array( $options )) {
|
238 |
-
$options = array(
|
239 |
-
'title' => 'Most recommended posts',
|
240 |
-
'number' => '5',
|
241 |
-
'show_count' => '0'
|
242 |
-
);
|
243 |
-
}
|
244 |
-
|
245 |
-
if ($_POST['mrp-submit']) {
|
246 |
-
$options['title'] = htmlspecialchars($_POST['mrp-title']);
|
247 |
-
$options['number'] = htmlspecialchars($_POST['mrp-number']);
|
248 |
-
$options['show_count'] = $_POST['mrp-show-count'];
|
249 |
-
if ( $options['number'] > 15) { $options['number'] = 15; }
|
250 |
-
|
251 |
-
update_option("most_recommended_posts", $options);
|
252 |
-
}
|
253 |
-
?>
|
254 |
-
<p><label for="mrp-title"><?php _e('Title:', 'i-recommend-this'); ?><br />
|
255 |
-
<input class="widefat" type="text" id="mrp-title" name="mrp-title" value="<?php echo $options['title'];?>" /></label></p>
|
256 |
-
|
257 |
-
<p><label for="mrp-number"><?php _e('Number of posts to show:', 'i-recommend-this'); ?><br />
|
258 |
-
<input type="text" id="mrp-number" name="mrp-number" style="width: 25px;" value="<?php echo $options['number'];?>" /> <small>(max. 15)</small></label></p>
|
259 |
-
|
260 |
-
<p><label for="mrp-show-count"><input type="checkbox" id="mrp-show-count" name="mrp-show-count" value="1"<?php if($options['show_count'] == '1') echo 'checked="checked"'; ?> /> <?php _e('Show post count', 'i-recommend-this'); ?></label></p>
|
261 |
-
|
262 |
-
<input type="hidden" id="mrp-submit" name="mrp-submit" value="1" />
|
263 |
-
<?php
|
264 |
-
}
|
265 |
-
wp_register_widget_control('most_recommended_posts', 'Most recommended posts', 'options_widget_most_recommended_posts');
|
266 |
-
}
|
267 |
-
|
268 |
-
add_action('init', 'add_widget_most_recommended_posts');
|
269 |
-
####
|
270 |
-
|
271 |
-
|
272 |
-
#### FRONT-END VIEW ####
|
273 |
-
function getIRecommendThis($arg) {
|
274 |
-
global $wpdb;
|
275 |
-
$post_ID = get_the_ID();
|
276 |
-
$ip = $_SERVER['REMOTE_ADDR'];
|
277 |
-
|
278 |
-
$recommended = get_post_meta($post_ID, '_recommended', true) != '' ? get_post_meta($post_ID, '_recommended', true) : '0';
|
279 |
-
$voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
|
280 |
-
|
281 |
-
/*
|
282 |
-
if (!isset($_COOKIE['recommended-'.$post_ID]) && $voteStatusByIp == 0) {
|
283 |
-
//$counter = '<a onclick="likeThis('.$post_ID.');">'.$liked.'';
|
284 |
-
//$counter = '<a onclick="likeThis('.$post_ID.');" class"image">'.$liked.'</a>';
|
285 |
-
$counter = $recommended;
|
286 |
-
$recommend_status = "";
|
287 |
-
}
|
288 |
-
else {
|
289 |
-
$counter = $recommended;
|
290 |
-
$recommend_status = "active";
|
291 |
-
}
|
292 |
-
*/
|
293 |
-
if (!isset($_COOKIE['recommended-'.$post_ID]) && $voteStatusByIp == 0) {
|
294 |
-
if (get_option('irt_textOrNotext') == 'notext') {
|
295 |
-
$counter = '<a onclick="recommendThis('.$post_ID.');" class="recommendThis">'.$recommended.'</a>';
|
296 |
-
}
|
297 |
-
else {
|
298 |
-
$counter = '<a onclick="recommendThis('.$post_ID.');" class="recommendThis">'.$recommended.' - '.get_option('irt_text').'</a>';
|
299 |
-
}
|
300 |
-
}
|
301 |
-
else {
|
302 |
-
$counter = '<a onclick="return(false);" class="recommendThis active">'.$recommended.'</a>';
|
303 |
-
}
|
304 |
-
//END of modifed part
|
305 |
-
|
306 |
-
|
307 |
-
/*
|
308 |
-
$iRecommendThis = '<div id="iRecommendThis-'.$post_ID.'" class="iRecommendThis"><a onclick="recommendThis('.$post_ID.');" class="'.$recommend_status.'">';
|
309 |
-
$iRecommendThis .= '<span class="counter">'.$counter.'</span>';
|
310 |
-
$iRecommendThis .= '</a></div>';
|
311 |
-
*/
|
312 |
-
$iRecommendThis = '<div id="iRecommendThis-'.$post_ID.'" class="iRecommendThis">';
|
313 |
-
$iRecommendThis .= $counter;
|
314 |
-
$iRecommendThis .= '</div>';
|
315 |
-
|
316 |
-
//END of modifed part
|
317 |
-
/*
|
318 |
-
if ($arg == 'put') {
|
319 |
-
return $iRecommendThis;
|
320 |
-
}
|
321 |
-
else {
|
322 |
-
echo $iRecommendThis;
|
323 |
-
}
|
324 |
-
}
|
325 |
-
*/
|
326 |
-
|
327 |
-
if ($arg == 'put') {
|
328 |
-
return $iRecommendThis;
|
329 |
-
}
|
330 |
-
else if ($arg == 'count'){
|
331 |
-
echo $recommended;
|
332 |
-
}
|
333 |
-
else {
|
334 |
-
echo $iRecommendThis;
|
335 |
-
}
|
336 |
-
}
|
337 |
-
//END of modifed part
|
338 |
-
|
339 |
-
if (get_option('irt_onPage') == '1') {
|
340 |
-
function putIRecommendThis($content) {
|
341 |
-
if(!is_feed() && !is_page()) {
|
342 |
-
$content.= getIRecommendThis('put');
|
343 |
-
}
|
344 |
-
return $content;
|
345 |
-
}
|
346 |
-
|
347 |
-
add_filter('the_content', putIRecommendThis);
|
348 |
-
}
|
349 |
-
|
350 |
-
function enqueueScripts() {
|
351 |
-
if (get_option('irt_jquery') == '1') {
|
352 |
-
wp_enqueue_script('iRecommendThis', WP_PLUGIN_URL.'/i-recommend-this/js/i-recommend-this.js', array('jquery'));
|
353 |
-
}
|
354 |
-
else {
|
355 |
-
wp_enqueue_script('iRecommendThis', WP_PLUGIN_URL.'/i-recommend-this/js/i-recommend-this.js');
|
356 |
-
}
|
357 |
-
}
|
358 |
-
|
359 |
-
function addHeaderLinks() {
|
360 |
-
echo '<link rel="stylesheet" type="text/css" href="'.WP_PLUGIN_URL.'/i-recommend-this/css/i-recommend-this.css" media="screen" />'."\n";
|
361 |
-
echo '<script type="text/javascript">var blogUrl = \''.get_bloginfo('wpurl').'\'</script>'."\n";
|
362 |
-
}
|
363 |
-
|
364 |
-
add_action('init', enqueueScripts);
|
365 |
-
add_action('wp_head', addHeaderLinks);
|
366 |
-
|
367 |
-
// Start of Presstrends Magic
|
368 |
-
function presstrends_plugin() {
|
369 |
-
|
370 |
-
// PressTrends Account API Key
|
371 |
-
$api_key = '0o9bxvlwkq4x71se6ey7ggnrjckfsmzs89k8';
|
372 |
-
$auth = 'wu9y7j98r8vkpgl7e3dsw0hzbhbpibdg3';
|
373 |
-
|
374 |
-
// Start of Metrics
|
375 |
-
global $wpdb;
|
376 |
-
$data = get_transient( 'presstrends_data' );
|
377 |
-
if (!$data || $data == ''){
|
378 |
-
$api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update/auth/';
|
379 |
-
$url = $api_base . $auth . '/api/' . $api_key . '/';
|
380 |
-
$data = array();
|
381 |
-
$count_posts = wp_count_posts();
|
382 |
-
$count_pages = wp_count_posts('page');
|
383 |
-
$comments_count = wp_count_comments();
|
384 |
-
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
|
385 |
-
$plugin_count = count(get_option('active_plugins'));
|
386 |
-
$all_plugins = get_plugins();
|
387 |
-
foreach($all_plugins as $plugin_file => $plugin_data) {
|
388 |
-
$plugin_name .= $plugin_data['Name'];
|
389 |
-
$plugin_name .= '&';}
|
390 |
-
$plugin_data = get_plugin_data( __FILE__ );
|
391 |
-
$plugin_version = $plugin_data['Version'];
|
392 |
-
$posts_with_comments = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}posts WHERE post_type='post' AND comment_count > 0");
|
393 |
-
$comments_to_posts = number_format(($posts_with_comments / $count_posts->publish) * 100, 0, '.', '');
|
394 |
-
$pingback_result = $wpdb->get_var('SELECT COUNT(comment_ID) FROM '.$wpdb->comments.' WHERE comment_type = "pingback"');
|
395 |
-
$data['url'] = stripslashes(str_replace(array('http://', '/', ':' ), '', site_url()));
|
396 |
-
$data['posts'] = $count_posts->publish;
|
397 |
-
$data['pages'] = $count_pages->publish;
|
398 |
-
$data['comments'] = $comments_count->total_comments;
|
399 |
-
$data['approved'] = $comments_count->approved;
|
400 |
-
$data['spam'] = $comments_count->spam;
|
401 |
-
$data['pingbacks'] = $pingback_result;
|
402 |
-
$data['post_conversion'] = $comments_to_posts;
|
403 |
-
$data['theme_version'] = $plugin_version;
|
404 |
-
$data['theme_name'] = urlencode($theme_data['Name']);
|
405 |
-
$data['site_name'] = str_replace( ' ', '', get_bloginfo( 'name' ));
|
406 |
-
$data['plugins'] = $plugin_count;
|
407 |
-
$data['plugin'] = urlencode($plugin_name);
|
408 |
-
$data['wpversion'] = get_bloginfo('version');
|
409 |
-
foreach ( $data as $k => $v ) {
|
410 |
-
$url .= $k . '/' . $v . '/';}
|
411 |
-
$response = wp_remote_get( $url );
|
412 |
-
set_transient('presstrends_data', $data, 60*60*24);}
|
413 |
-
}
|
414 |
-
|
415 |
-
// PressTrends WordPress Action
|
416 |
-
add_action('admin_init', 'presstrends_plugin');
|
417 |
-
|
418 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
images/default.png
ADDED
Binary file
|
images/heart.png
ADDED
Binary file
|
index.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
+
|
4 |
+
?>
|
js/dot_irecommendthis.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
|
3 |
+
$('.dot-irecommendthis').live('click',
|
4 |
+
function() {
|
5 |
+
var link = $(this);
|
6 |
+
if(link.hasClass('active')) return false;
|
7 |
+
|
8 |
+
var id = $(this).attr('id'),
|
9 |
+
suffix = link.find('.dot-irecommendthis-suffix').text();
|
10 |
+
|
11 |
+
$.post(dot_irecommendthis.ajaxurl, { action:'dot-irecommendthis', recommend_id:id, suffix:suffix }, function(data){
|
12 |
+
link.html(data).addClass('active').attr('title','You already recommended this');
|
13 |
+
});
|
14 |
+
|
15 |
+
return false;
|
16 |
+
});
|
17 |
+
|
18 |
+
|
19 |
+
});
|
js/i-recommend-this.js
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
function recommendThis(postId) {
|
2 |
-
if (postId != '') {
|
3 |
-
jQuery('#iRecommendThis-'+postId+' .recommendThis').text('...');
|
4 |
-
|
5 |
-
jQuery.post(blogUrl + "/wp-content/plugins/i-recommend-this/recommend.php",{ id: postId },
|
6 |
-
function(data){
|
7 |
-
jQuery('#iRecommendThis-'+postId+' .recommendThis').text(data);
|
8 |
-
jQuery('#iRecommendThis-'+postId+' .recommendThis').addClass('active');
|
9 |
-
|
10 |
-
});
|
11 |
-
}
|
12 |
-
}
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/dot-irecommendthis-en.mo
ADDED
Binary file
|
languages/dot-irecommendthis-en.po
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: I Recommend This 2.0\n"
|
4 |
+
"POT-Creation-Date: 2012-11-15 22:57+0530\n"
|
5 |
+
"PO-Revision-Date: 2012-11-15 22:58+0530\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.4\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SearchPath-0: D:\\Work\\My Projects\\Plugin Development\\i-"
|
15 |
+
"recommend-this\\trunk\n"
|
16 |
+
|
17 |
+
#: D:\Work\My Projects\Plugin
|
18 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:125
|
19 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:126
|
20 |
+
msgid "I Recommend This"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: D:\Work\My Projects\Plugin
|
24 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:143
|
25 |
+
msgid "Automatically display on"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: D:\Work\My Projects\Plugin
|
29 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:144
|
30 |
+
msgid "Text after 0 Count"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: D:\Work\My Projects\Plugin
|
34 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:145
|
35 |
+
msgid "Text after 1 Count"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: D:\Work\My Projects\Plugin
|
39 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:146
|
40 |
+
msgid "Text after more than 1 Count"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: D:\Work\My Projects\Plugin
|
44 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:147
|
45 |
+
msgid "Disable CSS"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: D:\Work\My Projects\Plugin
|
49 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:148
|
50 |
+
msgid "Choose a style"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: D:\Work\My Projects\Plugin
|
54 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:149
|
55 |
+
msgid "Shortcode and Template Tag"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: D:\Work\My Projects\Plugin
|
59 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:177
|
60 |
+
msgid "Save Changes"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: D:\Work\My Projects\Plugin
|
64 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:190
|
65 |
+
msgid ""
|
66 |
+
"This plugin allows your visitors to simply recommend or like your posts "
|
67 |
+
"instead of commment it."
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: D:\Work\My Projects\Plugin
|
71 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:191
|
72 |
+
msgid ""
|
73 |
+
"Check out our other themes & plugins at <a href=\"http://www.dreamsonline.net"
|
74 |
+
"\">Dreams Online Themes</a>."
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: D:\Work\My Projects\Plugin
|
78 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:203
|
79 |
+
msgid "Posts"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: D:\Work\My Projects\Plugin
|
83 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:206
|
84 |
+
msgid "All other pages like Index, Archive, etc."
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: D:\Work\My Projects\Plugin
|
88 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:225
|
89 |
+
msgid ""
|
90 |
+
"Text to display after zero count. Leave blank for no text after the count."
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: D:\Work\My Projects\Plugin
|
94 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:233
|
95 |
+
msgid ""
|
96 |
+
"Text to display after 1 person has recommended. Leave blank for no text "
|
97 |
+
"after the count."
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: D:\Work\My Projects\Plugin
|
101 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:242
|
102 |
+
msgid ""
|
103 |
+
"Text to display after more than 1 person have recommended. Leave blank for "
|
104 |
+
"no text after the count."
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: D:\Work\My Projects\Plugin
|
108 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:251
|
109 |
+
msgid "Default style - Thumb"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: D:\Work\My Projects\Plugin
|
113 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:254
|
114 |
+
msgid "Heart"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: D:\Work\My Projects\Plugin
|
118 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:259
|
119 |
+
msgid ""
|
120 |
+
"To use I Recomment This in your posts and pages you can use the shortcode:"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: D:\Work\My Projects\Plugin
|
124 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:261
|
125 |
+
msgid ""
|
126 |
+
"To use I Recomment This manually in your theme template use the following "
|
127 |
+
"PHP code:"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: D:\Work\My Projects\Plugin
|
131 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:456
|
132 |
+
msgid "You already recommended this"
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: D:\Work\My Projects\Plugin
|
136 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:461
|
137 |
+
msgid "Recommend this"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: D:\Work\My Projects\Plugin
|
141 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:545
|
142 |
+
msgid "Title:"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: D:\Work\My Projects\Plugin
|
146 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:548
|
147 |
+
msgid "Number of posts to show:"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: D:\Work\My Projects\Plugin
|
151 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:551
|
152 |
+
msgid "Show post count"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: D:\Work\My Projects\Plugin
|
156 |
+
#: Development\i-recommend-this\trunk/dot-irecommendthis.php:589
|
157 |
+
msgid "Settings"
|
158 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: hchouhan, dreamsonline, dreamsmedia, Benoit "LeBen" Burgener
|
3 |
Donate link: http://www.designerskiosk.com
|
4 |
Tags: recommend, like, love, post, rate, rating, heart, dribbble like, tumblr like
|
5 |
-
Requires at least: 3.
|
6 |
Tested up to: 3.2.2
|
7 |
-
Stable tag:
|
8 |
-
Last Updated: 2012-
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -18,7 +18,7 @@ This plugin allows your visitors to simply like/recommend your posts instead of
|
|
18 |
|
19 |
|
20 |
= This plugin includes =
|
21 |
-
* A counter
|
22 |
* A widget and a function to display the X most liked posts.
|
23 |
* A preference pane with some options.
|
24 |
|
@@ -48,7 +48,7 @@ If you love the plugin, please consider rating it and clicking on "it works" but
|
|
48 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
49 |
|
50 |
To display the recomment/like link other than at the bottom of individual post, you would have to add below code in your template
|
51 |
-
<?php if(function_exists(
|
52 |
|
53 |
== Frequently Asked Questions ==
|
54 |
|
@@ -60,6 +60,13 @@ You can also visit the [support center](http://www.harishchouhan.com/personal-pr
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
= 1.4.3
|
64 |
* All deprecated functions removed. Plugin might not work on WordPress versions older than 3.
|
65 |
|
2 |
Contributors: hchouhan, dreamsonline, dreamsmedia, Benoit "LeBen" Burgener
|
3 |
Donate link: http://www.designerskiosk.com
|
4 |
Tags: recommend, like, love, post, rate, rating, heart, dribbble like, tumblr like
|
5 |
+
Requires at least: 3.4
|
6 |
Tested up to: 3.2.2
|
7 |
+
Stable tag: 2.0
|
8 |
+
Last Updated: 2012-November-15
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
18 |
|
19 |
|
20 |
= This plugin includes =
|
21 |
+
* A counter to display the number of "like" and to vote.
|
22 |
* A widget and a function to display the X most liked posts.
|
23 |
* A preference pane with some options.
|
24 |
|
48 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
49 |
|
50 |
To display the recomment/like link other than at the bottom of individual post, you would have to add below code in your template
|
51 |
+
'<?php if( function_exists('dot_irecommendthis') ) dot_irecommendthis(); ?>'
|
52 |
|
53 |
== Frequently Asked Questions ==
|
54 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 2.0
|
64 |
+
* This is a major revamp. The entire plugin structure is now based on OOP
|
65 |
+
* Settings are now stored using Settings API and Settings page is created based on WordPress standards.
|
66 |
+
* This plugin contains code from "Zilla Like" plugin developed by Orman Clark of www.themezilla.com.
|
67 |
+
* Translation files are finally added.
|
68 |
+
|
69 |
+
|
70 |
= 1.4.3
|
71 |
* All deprecated functions removed. Plugin might not work on WordPress versions older than 3.
|
72 |
|
recommend.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once '../../../wp-config.php';
|
3 |
-
|
4 |
-
global $wpdb;
|
5 |
-
$post_ID = $_POST['id'];
|
6 |
-
$ip = $_SERVER['REMOTE_ADDR'];
|
7 |
-
$irt_textOnclick = get_option('irt_textOnclick');
|
8 |
-
$recommend = get_post_meta($post_ID, '_recommended', true);
|
9 |
-
|
10 |
-
if($post_ID != '') {
|
11 |
-
$voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."irecommendthis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
|
12 |
-
|
13 |
-
if (!isset($_COOKIE['recommended-'.$post_ID]) && $voteStatusByIp == 0) {
|
14 |
-
$recommendNew = $recommend + 1;
|
15 |
-
update_post_meta($post_ID, '_recommended', $recommendNew);
|
16 |
-
|
17 |
-
setcookie('recommended-'.$post_ID, time(), time()+3600*24*365, '/');
|
18 |
-
$wpdb->query("INSERT INTO ".$wpdb->prefix."irecommendthis_votes VALUES ('', NOW(), '$post_ID', '$ip')");
|
19 |
-
|
20 |
-
$return_text = $recommendNew . ' ' . $irt_textOnclick;
|
21 |
-
echo $return_text; //$recommendNew; //
|
22 |
-
}
|
23 |
-
else {
|
24 |
-
$return_text = $recommend . ' ' . $irt_textOnclick;
|
25 |
-
echo $return_text; //$recommendNew; //
|
26 |
-
}
|
27 |
-
}
|
28 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|