PluginProbe
Solid Post Likes / trunk
Solid Post Likes vtrunk
trunk 1.0.8 1.1.0 1.2.0
solid-post-likes / controllers / SolidPostLikesSetter.php

SolidPostLikesSetter.php in Solid Post Likes trunk, at controllers/SolidPostLikesSetter.php

30 lines 965 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace OACS\SolidPostLikes\Controllers;
3
4 use OACS\SolidPostLikes\Controllers\SolidPostLikesStore as Store;
5
6 if ( ! defined( 'WPINC' ) ) {die;}
7
8 //** This sets the manual post like count via admin settings "Set Likes" */
9
10 class SolidPostLikesSetter
11 {
12 public function oacs_spl_set_like_count()
13 {
14 $post_id = intval(carbon_get_theme_option( 'oacs_spl_set_like_count_post' ));
15 $oacs_spl_set_like_count_setting = intval(carbon_get_theme_option( 'oacs_spl_set_like_count' ));
16
17 if (!empty($post_id) && isset($oacs_spl_set_like_count_setting)) {
18 // Stored as an offset over the per-like rows so future likes/unlikes
19 // keep counting from the admin's number.
20 $store = new Store;
21 $store->set_manual_count($post_id, $oacs_spl_set_like_count_setting);
22 carbon_set_theme_option('oacs_spl_set_like_count_post', '');
23 carbon_set_theme_option('oacs_spl_set_like_count', '');
24 return;
25 }
26 return ;
27 }
28
29 }
30