質問編集履歴
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -559,3 +559,23 @@
|
|
559
559
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
560
560
|
|
561
561
|
Wordpress 4.7.2
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
###追記
|
568
|
+
|
569
|
+
single.phpにwp_head();を入れることで、cssは反映されるようになりました。
|
570
|
+
|
571
|
+
しかし、カウントはされないままです。
|
572
|
+
|
573
|
+
ただ、いいねボタンを押すと、下記のエラーが出ます。
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
```
|
578
|
+
|
579
|
+
Uncaught ReferenceError: toastr is not defined
|
580
|
+
|
581
|
+
```
|
1
ソース追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -180,6 +180,368 @@
|
|
180
180
|
|
181
181
|
|
182
182
|
|
183
|
+
```PHP
|
184
|
+
|
185
|
+
<?php
|
186
|
+
|
187
|
+
/*
|
188
|
+
|
189
|
+
Plugin Name:WP ULike
|
190
|
+
|
191
|
+
Plugin URI: http://preview.alimir.ir/developer/wp-ulike/
|
192
|
+
|
193
|
+
Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
|
194
|
+
|
195
|
+
Version: 2.4.2
|
196
|
+
|
197
|
+
Author: Ali Mirzaei
|
198
|
+
|
199
|
+
Author URI: http://about.alimir.ir
|
200
|
+
|
201
|
+
Text Domain: wp-ulike
|
202
|
+
|
203
|
+
Domain Path: /lang/
|
204
|
+
|
205
|
+
License: GPL2
|
206
|
+
|
207
|
+
*/
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
//Do not change this value
|
212
|
+
|
213
|
+
define( 'WP_ULIKE_VERSION' , '2.4.2' );
|
214
|
+
|
215
|
+
define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
|
216
|
+
|
217
|
+
define( 'WP_ULIKE_DB_VERSION' , '1.3' );
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
//Load Translations
|
222
|
+
|
223
|
+
load_plugin_textdomain( WP_ULIKE_SLUG, false, dirname( plugin_basename( __FILE__ ) ) .'/lang/' );
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
/**
|
228
|
+
|
229
|
+
* When the plugin is activated, This function will install wp_ulike tables in database (If not exist table)
|
230
|
+
|
231
|
+
*
|
232
|
+
|
233
|
+
* @author Alimir
|
234
|
+
|
235
|
+
* @since 1.1
|
236
|
+
|
237
|
+
* @updated 1.7
|
238
|
+
|
239
|
+
* @return Void
|
240
|
+
|
241
|
+
*/
|
242
|
+
|
243
|
+
register_activation_hook( __FILE__, 'wp_ulike_install' );
|
244
|
+
|
245
|
+
function wp_ulike_install() {
|
246
|
+
|
247
|
+
global $wpdb;
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
$table_name = $wpdb->prefix . "ulike";
|
252
|
+
|
253
|
+
if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
|
254
|
+
|
255
|
+
$sql = "CREATE TABLE " . $table_name . " (
|
256
|
+
|
257
|
+
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
258
|
+
|
259
|
+
`post_id` int(11) NOT NULL,
|
260
|
+
|
261
|
+
`date_time` datetime NOT NULL,
|
262
|
+
|
263
|
+
`ip` varchar(30) NOT NULL,
|
264
|
+
|
265
|
+
`user_id` int(11) NOT NULL,
|
266
|
+
|
267
|
+
`status` varchar(15) NOT NULL,
|
268
|
+
|
269
|
+
PRIMARY KEY (`id`)
|
270
|
+
|
271
|
+
);";
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
276
|
+
|
277
|
+
dbDelta( $sql );
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
add_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
$table_name_2 = $wpdb->prefix . "ulike_comments";
|
288
|
+
|
289
|
+
if ( $wpdb->get_var( "show tables like '$table_name_2'" ) != $table_name_2 ) {
|
290
|
+
|
291
|
+
$sql = "CREATE TABLE " . $table_name_2 . " (
|
292
|
+
|
293
|
+
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
294
|
+
|
295
|
+
`comment_id` int(11) NOT NULL,
|
296
|
+
|
297
|
+
`date_time` datetime NOT NULL,
|
298
|
+
|
299
|
+
`ip` varchar(30) NOT NULL,
|
300
|
+
|
301
|
+
`user_id` int(11) NOT NULL,
|
302
|
+
|
303
|
+
`status` varchar(15) NOT NULL,
|
304
|
+
|
305
|
+
PRIMARY KEY (`id`)
|
306
|
+
|
307
|
+
);";
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
312
|
+
|
313
|
+
dbDelta( $sql );
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
|
318
|
+
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
$table_name_3 = $wpdb->prefix . "ulike_activities";
|
324
|
+
|
325
|
+
if ( $wpdb->get_var( "show tables like '$table_name_3'" ) != $table_name_3 ) {
|
326
|
+
|
327
|
+
$sql = "CREATE TABLE " . $table_name_3 . " (
|
328
|
+
|
329
|
+
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
330
|
+
|
331
|
+
`activity_id` int(11) NOT NULL,
|
332
|
+
|
333
|
+
`date_time` datetime NOT NULL,
|
334
|
+
|
335
|
+
`ip` varchar(30) NOT NULL,
|
336
|
+
|
337
|
+
`user_id` int(11) NOT NULL,
|
338
|
+
|
339
|
+
`status` varchar(15) NOT NULL,
|
340
|
+
|
341
|
+
PRIMARY KEY (`id`)
|
342
|
+
|
343
|
+
);";
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
348
|
+
|
349
|
+
dbDelta( $sql );
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
|
354
|
+
|
355
|
+
}
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
$table_name_4 = $wpdb->prefix . "ulike_forums";
|
360
|
+
|
361
|
+
if ( $wpdb->get_var( "show tables like '$table_name_4'" ) != $table_name_4 ) {
|
362
|
+
|
363
|
+
$sql = "CREATE TABLE " . $table_name_4 . " (
|
364
|
+
|
365
|
+
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
366
|
+
|
367
|
+
`topic_id` int(11) NOT NULL,
|
368
|
+
|
369
|
+
`date_time` datetime NOT NULL,
|
370
|
+
|
371
|
+
`ip` varchar(30) NOT NULL,
|
372
|
+
|
373
|
+
`user_id` int(11) NOT NULL,
|
374
|
+
|
375
|
+
`status` varchar(15) NOT NULL,
|
376
|
+
|
377
|
+
PRIMARY KEY (`id`)
|
378
|
+
|
379
|
+
);";
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
384
|
+
|
385
|
+
dbDelta( $sql );
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
|
390
|
+
|
391
|
+
}
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
}
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
/**
|
402
|
+
|
403
|
+
* Applied to the list of links to display on the plugins page
|
404
|
+
|
405
|
+
*
|
406
|
+
|
407
|
+
* @author Alimir
|
408
|
+
|
409
|
+
* @since 2.3
|
410
|
+
|
411
|
+
* @return String
|
412
|
+
|
413
|
+
*/
|
414
|
+
|
415
|
+
$prefix = is_network_admin() ? 'network_admin_' : '';
|
416
|
+
|
417
|
+
add_filter( "{$prefix}plugin_action_links", 'wp_ulike_add_plugin_links', 10, 5 );
|
418
|
+
|
419
|
+
function wp_ulike_add_plugin_links( $actions, $plugin_file )
|
420
|
+
|
421
|
+
{
|
422
|
+
|
423
|
+
static $plugin;
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
if (!isset($plugin))
|
428
|
+
|
429
|
+
$plugin = plugin_basename(__FILE__);
|
430
|
+
|
431
|
+
if ($plugin == $plugin_file) {
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
$settings = array('settings' => '<a href="admin.php?page=wp-ulike-settings">' . __('Settings', WP_ULIKE_SLUG) . '</a>');
|
436
|
+
|
437
|
+
$stats = array('stats' => '<a href="admin.php?page=wp-ulike-statistics">' . __('Statistics', WP_ULIKE_SLUG) . '</a>');
|
438
|
+
|
439
|
+
$about = array('about' => '<a href="admin.php?page=wp-ulike-about">' . __('About', WP_ULIKE_SLUG) . '</a>');
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
$actions = array_merge($about, $actions);
|
444
|
+
|
445
|
+
$actions = array_merge($stats, $actions);
|
446
|
+
|
447
|
+
$actions = array_merge($settings, $actions);
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
}
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
return $actions;
|
456
|
+
|
457
|
+
}
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
/**
|
462
|
+
|
463
|
+
* Redirect to the "About WP ULike" page after plugin activation.
|
464
|
+
|
465
|
+
*
|
466
|
+
|
467
|
+
* @author Alimir
|
468
|
+
|
469
|
+
* @since 2.3
|
470
|
+
|
471
|
+
* @return Void
|
472
|
+
|
473
|
+
*/
|
474
|
+
|
475
|
+
add_action( 'activated_plugin', 'wp_ulike_activation_redirect' );
|
476
|
+
|
477
|
+
function wp_ulike_activation_redirect( $plugin ) {
|
478
|
+
|
479
|
+
if( $plugin == plugin_basename( __FILE__ ) ) {
|
480
|
+
|
481
|
+
exit( wp_redirect( admin_url( 'admin.php?page=wp-ulike-about' ) ) );
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
/**
|
490
|
+
|
491
|
+
* This hook is called once any activated plugins have been loaded.
|
492
|
+
|
493
|
+
*
|
494
|
+
|
495
|
+
* @author Alimir
|
496
|
+
|
497
|
+
* @since 1.7
|
498
|
+
|
499
|
+
* @return Void
|
500
|
+
|
501
|
+
*/
|
502
|
+
|
503
|
+
add_action( 'plugins_loaded', 'wp_ulike_update_db_check' );
|
504
|
+
|
505
|
+
function wp_ulike_update_db_check() {
|
506
|
+
|
507
|
+
if ( get_site_option( 'wp_ulike_dbVersion' ) != WP_ULIKE_DB_VERSION ) {
|
508
|
+
|
509
|
+
wp_ulike_install();
|
510
|
+
|
511
|
+
}
|
512
|
+
|
513
|
+
}
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
//Include plugin setting file
|
518
|
+
|
519
|
+
include plugin_dir_path( __FILE__ ) . 'admin/admin.php';
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
//Include general functions
|
524
|
+
|
525
|
+
include plugin_dir_path( __FILE__ ) . 'inc/wp-functions.php';
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
//Include plugin scripts
|
530
|
+
|
531
|
+
include plugin_dir_path( __FILE__ ) . 'inc/wp-script.php';
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
//Load WP ULike functions
|
536
|
+
|
537
|
+
include plugin_dir_path( __FILE__ ) . 'inc/wp-ulike.php';
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
```
|
542
|
+
|
543
|
+
|
544
|
+
|
183
545
|
・[Reaction Buttons](https://ja.wordpress.org/plugins/reaction-buttons/)
|
184
546
|
|
185
547
|
参考:[https://liginc.co.jp/programmer/archives/3497](https://liginc.co.jp/programmer/archives/3497)
|
@@ -192,6 +554,8 @@
|
|
192
554
|
|
193
555
|
|
194
556
|
|
557
|
+
|
558
|
+
|
195
559
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
196
560
|
|
197
561
|
Wordpress 4.7.2
|