9:38 UTC">5 年 前 2608 f022c07ac9 goto server 5 年 前 2608_fsm ad01fc0d19 find places 5 年 前 2608_vm a4345e5759 first commit 5 年 前 2609 a4345e5759 first commit 5 年 前 2609_fsm a4345e5759 first commit 5 年 前 2609_vm a4345e5759 first commit 5 年 前 2610 f022c07ac9 goto server 5 年 前 2610_fsm a4345e5759 first commit 5 年 前 2610_vm a4345e5759 first commit 5 年 前 2611 a4345e5759 first commit 5 年 前 2612 a4345e5759 first commit 5 年 前 2612_fsm a4345e5759 first commit 5 年 前 2612_vm a4345e5759 first commit 5 年 前 2613 a4345e5759 first commit 5 年 前 2615 a4345e5759 first commit 5 年 前 2615_fsm a4345e5759 first commit 5 年 前 2615_vm a4345e5759 first commit 5 年 前 2616 a4345e5759 first commit 5 年 前 2616_fsm a4345e5759 first commit 5 年 前 2616_vm a4345e5759 first commit 5 年 前 2617 a4345e5759 first commit 5 年 前 2617_fsm a4345e5759 first commit 5 年 前 2617_vm a4345e5759 first commit 5 年 前 2618 a4345e5759 first commit 5 年 前 2618_fsm a4345e5759 first commit 5 年 前 2618_vm a4345e5759 first commit 5 年 前 2619 ad01fc0d19 find places 5 年 前 2619_fsm a4345e5759 first commit 5 年 前 2619_vm ad01fc0d19 find places 5 年 前 2620 f022c07ac9 goto server 5 年 前 2620_fsm a4345e5759 first commit 5 年 前 2650 a4345e5759 first commit 5 年 前 2651 a4345e5759 first commit 5 年 前 2652 a4345e5759 first commit 5 年 前 2653 a4345e5759 first commit 5 年 前 2654 a4345e5759 first commit 5 年 前 2655 a4345e5759 first commit 5 年 前 2656 f022c07ac9 goto server 5 年 前 2657 f022c07ac9 goto server 5 年 前 2658 f022c07ac9 goto server 5 年 前 2659 f022c07ac9 goto server 5 年 前 2660 a4345e5759 first commit 5 年 前 2661 a4345e5759 first commit 5 年 前 2662 f022c07ac9 goto server 5 年 前 2663 f022c07ac9 goto server 5 年 前 2664 f022c07ac9 goto server 5 年 前 2665 f022c07ac9 goto server 5 年 前 2666 f022c07ac9 goto server 5 年 前 2667 f022c07ac9 goto server 5 年 前 2668 a4345e5759 first commit 5 年 前 2669 a4345e5759 first commit 5 年 前 2670 a4345e5759 first commit 5 年 前 2673 f022c07ac9 goto server 5 年 前 2674 f022c07ac9 goto server 5 年 前 2675 a4345e5759 first commit 5 年 前 2678 f022c07ac9 goto server 5 年 前 2679 f022c07ac9 goto server 5 年 前 2680 a4345e5759 first commit 5 年 前 2681 a4345e5759 first commit 5 年 前 2682 a4345e5759 first commit 5 年 前 2683 a4345e5759 first commit 5 年 前 2684 a4345e5759 first commit 5 年 前 2685 a4345e5759 first commit 5 年 前 2686 a4345e5759 first commit 5 年 前 2687 a4345e5759 first commit 5 年 前 2688 a4345e5759 first commit 5 年 前 2689 a4345e5759 first commit 5 年 前 2690 a4345e5759 first commit 5 年 前 2691 a4345e5759 first commit 5 年 前 2692 a4345e5759 first commit 5 年 前 2693 a4345e5759 first commit 5 年 前 2696 ad01fc0d19 find places 5 年 前 2699 f022c07ac9 goto server 5 年 前 2701 f022c07ac9 goto server 5 年 前 2702 f022c07ac9 goto server 5 年 前 2703 ad01fc0d19 find places 5 年 前 2704 ad01fc0d19 find places 5 年 前 2753 a4345e5759 first commit 5 年 前 2753_fsm a4345e5759 first commit 5 年 前 2753_vm a4345e5759 first commit 5 年 前 2754 a4345e5759 first commit 5 年 前 2755 a4345e5759 first commit 5 年 前 2756 a4345e5759 first commit 5 年 前 2757 a4345e5759 first commit 5 年 前 2830 a4345e5759 first commit 5 年 前 2831 a4345e5759 first commit 5 年 前 2832 a4345e5759 first commit 5 年 前 2833 a4345e5759 first commit 5 年 前 2834 a4345e5759 first commit 5 年 前 2835 a4345e5759 first commit 5 年 前 2836 a4345e5759 first commit 5 年 前 2837 a4345e5759 first commit 5 年 前 2838 a4345e5759 first commit 5 年 前 2838_fsm a4345e5759 first commit 5 年 前 2838_vm a4345e5759 first commit 5 年 前 2839 a4345e5759 first commit 5 年 前 2840 ad01fc0d19 find places 5 年 前 2840_fsm ad01fc0d19 find places 5 年 前 2840_vm a4345e5759 first commit 5 年 前 2841 ad01fc0d19 find places 5 年 前 2995 a4345e5759 first commit 5 年 前 2996 a4345e5759 first commit 5 年 前 3079 a4345e5759 first commit 5 年 前 3079_fsm a4345e5759 first commit 5 年 前 3079_vm a4345e5759 first commit 5 年 前 3080 a4345e5759 first commit 5 年 前 3081 a4345e5759 first commit 5 年 前 3085 a4345e5759 first commit 5 年 前 3118 a4345e5759 first commit 5 年 前 3119 a4345e5759 first commit 5 年 前 3164 a4345e5759 first commit 5 年 前 3256 a4345e5759 first commit 5 年 前 3257 a4345e5759 first commit 5 年 前 3258 a4345e5759 first commit 5 年 前 3350 a4345e5759 first commit 5 年 前 3351 a4345e5759 first commit 5 年 前 3379 a4345e5759 first commit 5 年 前 3380 a4345e5759 first commit 5 年 前 3381 a4345e5759 first commit 5 年 前 3394 a4345e5759 first commit 5 年 前 3394_fsm a4345e5759 first commit 5 年 前 3394_vm a4345e5759 first commit 5 年 前 3395 a4345e5759 first commit 5 年 前 3429 a4345e5759 first commit 5 年 前 3430 a4345e5759 first commit 5 年 前 3431 a4345e5759 first commit 5 年 前 3433 a4345e5759 first commit 5 年 前 3439 a4345e5759 first commit 5 年 前 3440 a4345e5759 first commit 5 年 前 3455 f022c07ac9 goto server 5 年 前 3456 a4345e5759 first commit 5 年 前 3456_fsm a4345e5759 first commit 5 年 前 3456_vm a4345e5759 first commit 5 年 前 3466 a4345e5759 first commit 5 年 前 3467 a4345e5759 first commit 5 年 前 3468 a4345e5759 first commit 5 年 前 3501 a4345e5759 first commit 5 年 前 3502 a4345e5759 first commit 5 年 前 3503 a4345e5759 first commit 5 年 前 3534 a4345e5759 first commit 5 年 前 3541 a4345e5759 first commit 5 年 前 3541_fsm a4345e5759 first commit 5 年 前 3541_vm a4345e5759 first commit 5 年 前 3542 a4345e5759 first commit 5 年 前 3574 a4345e5759 first commit 5 年 前 3575 a4345e5759 first commit 5 年 前 3576 a4345e5759 first commit 5 年 前 3596 a4345e5759 first commit 5 年 前 3597 a4345e5759 first commit 5 年 前 3598 a4345e5759 first commit 5 年 前 3599 a4345e5759 first commit 5 年 前 3600 a4345e5759 first commit 5 年 前 3600_fsm a4345e5759 first commit 5 年 前 3600_vm a4345e5759 first commit 5 年 前 3601 a4345e5759 first commit 5 年 前 3601_fsm a4345e5759 first commit 5 年 前 3601_vm a4345e5759 first commit 5 年 前 3602 a4345e5759 first commit 5 年 前 3602_fsm a4345e5759 first commit 5 年 前 3602_vm a4345e5759 first commit 5 年 前 3603 a4345e5759 first commit 5 年 前 3603_fsm a4345e5759 first commit 5 年 前 3603_vm a4345e5759 first commit 5 年 前 3604 a4345e5759 first commit 5 年 前 3605 a4345e5759 first commit 5 年 前 3606 a4345e5759 first commit 5 年 前 3607 a4345e5759 first commit 5 年 前 3608 a4345e5759 first commit 5 年 前 3609 a4345e5759 first commit 5 年 前 3712 a4345e5759 first commit 5 年 前 3764 a4345e5759 first commit 5 年 前 3764_fsm a4345e5759 first commit 5 年 前 3764_vm a4345e5759 first commit 5 年 前 3766 a4345e5759 first commit 5 年 前 3767 a4345e5759 first commit 5 年 前 3997 a4345e5759 first commit 5 年 前 4143 a4345e5759 first commit 5 年 前 4144 a4345e5759 first commit 5 年 前 4145 a4345e5759 first commit 5 年 前 4146 a4345e5759 first commit 5 年 前 4147 a4345e5759 first commit 5 年 前 4148 a4345e5759 first commit 5 年 前 4149 a4345e5759 first commit 5 年 前 4150 a4345e5759 first commit 5 年 前 4151 a4345e5759 first commit 5 年 前 4152 a4345e5759 first commit 5 年 前 4153 a4345e5759 first commit 5 年 前 4154 a4345e5759 first commit 5 年 前 4155 a4345e5759 first commit 5 年 前 4156 a4345e5759 first commit 5 年 前 4157 a4345e5759 first commit 5 年 前 4158 a4345e5759 first commit 5 年 前 4159 a4345e5759 first commit 5 年 前 4160 a4345e5759 first commit 5 年 前 4161 a4345e5759 first commit 5 年 前 4162 a4345e5759 first commit 5 年 前 4163 a4345e5759 first commit 5 年 前 4164 a4345e5759 first commit 5 年 前 4165 a4345e5759 first commit 5 年 前 4166 a4345e5759 first commit 5 年 前 4167 a4345e5759 first commit 5 年 前 4168 a4345e5759 first commit 5 年 前 4169 a4345e5759 first commit 5 年 前 4170 a4345e5759 first commit 5 年 前 4171 a4345e5759 first commit 5 年 前 4172 a4345e5759 first commit 5 年 前 4173 a4345e5759 first commit 5 年 前 4174 a4345e5759 first commit 5 年 前 5002 ad01fc0d19 find places 5 年 前 548 a4345e5759 first commit 5 年 前 549 a4345e5759 first commit 5 年 前 6102 a4345e5759 first commit 5 年 前 6104 a4345e5759 first commit 5 年 前 6106 a4345e5759 first commit 5 年 前 6110 a4345e5759 first commit 5 年 前 6111 a4345e5759 first commit 5 年 前 6112 a4345e5759 first commit 5 年 前 6113 a4345e5759 first commit 5 年 前 6117 a4345e5759 first commit 5 年 前 826 a4345e5759 first commit 5 年 前 827 a4345e5759 first commit 5 年 前 828 a4345e5759 first commit 5 年 前 PG_VERSION a4345e5759 first commit 5 年 前 pg_filenode.map a4345e5759 first commit 5 年 前 pg_internal.init a4345e5759 first commit 5 年 前 tum/whitesports - Gogs: Simplico Git Service

Нет описания

class-featured-image-admin-thumb.php 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <?php
  2. /**
  3. * Featured Image Admin Thumb.
  4. *
  5. * @package Featured_Image_Admin_Thumb
  6. * @author Sean Hayes <sean@seanhayes.biz>
  7. * @license GPL-2.0+
  8. * @link http://www.seanhayes.biz
  9. * @copyright 2014 Sean Hayes
  10. */
  11. /**
  12. * Plugin class. This class should ideally be used to work with the
  13. * public-facing side of the WordPress site.
  14. *
  15. * If you're interested in introducing administrative or dashboard
  16. * functionality, then refer to `class-featured-image-admin-thumb-admin.php`
  17. *
  18. *
  19. * @package Featured_Image_Admin_Thumb
  20. * Sean Hayes <sean@seanhayes.biz>
  21. */
  22. class Featured_Image_Admin_Thumb {
  23. /**
  24. * Plugin version, used for cache-busting of style and script file references.
  25. *
  26. * @since 1.0.0
  27. *
  28. * @var string
  29. */
  30. const VERSION = '1.6';
  31. /**
  32. *
  33. * Unique identifier for your plugin.
  34. *
  35. *
  36. * The variable name is used as the text domain when internationalizing strings
  37. * of text. Its value should match the Text Domain file header in the main
  38. * plugin file.
  39. *
  40. * @since 1.0.0
  41. *
  42. * @var string
  43. */
  44. protected $plugin_slug = 'featured-image-admin-thumb-fiat';
  45. /**
  46. * Instance of this class.
  47. *
  48. * @since 1.0.0
  49. *
  50. * @var object
  51. */
  52. protected static $instance = null;
  53. /**
  54. * Initialize the plugin by setting localization and loading public scripts
  55. * and styles.
  56. *
  57. * @since 1.0.0
  58. */
  59. private function __construct() {
  60. // Load plugin text domain
  61. add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
  62. // Activate plugin when new blog is added
  63. add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
  64. }
  65. /**
  66. * Return the plugin slug.
  67. *
  68. * @since 1.0.0
  69. *
  70. * @return string Plugin slug variable.
  71. */
  72. public function get_plugin_slug() {
  73. return $this->plugin_slug;
  74. }
  75. /**
  76. * Return an instance of this class.
  77. *
  78. * @since 1.0.0
  79. *
  80. * @return object A single instance of this class.
  81. */
  82. public static function get_instance() {
  83. // If the single instance hasn't been set, set it now.
  84. if ( null == self::$instance ) {
  85. self::$instance = new self;
  86. }
  87. return self::$instance;
  88. }
  89. /**
  90. * Fired when the plugin is activated.
  91. *
  92. * @since 1.0.0
  93. *
  94. * @param boolean $network_wide True if WPMU superadmin uses
  95. * "Network Activate" action, false if
  96. * WPMU is disabled or plugin is
  97. * activated on an individual blog.
  98. */
  99. public static function activate( $network_wide ) {
  100. if ( function_exists( 'is_multisite' ) && is_multisite() ) {
  101. if ( $network_wide ) {
  102. // Get all blog ids.
  103. $blog_ids = self::get_blog_ids();
  104. foreach ( $blog_ids as $blog_id ) {
  105. switch_to_blog( $blog_id );
  106. self::single_activate();
  107. }
  108. restore_current_blog();
  109. } else {
  110. self::single_activate();
  111. }
  112. } else {
  113. self::single_activate();
  114. }
  115. }
  116. /**
  117. * Fired when the plugin is deactivated.
  118. *
  119. * @since 1.0.0
  120. *
  121. * @param boolean $network_wide True if WPMU superadmin uses
  122. * "Network Deactivate" action, false if
  123. * WPMU is disabled or plugin is
  124. * deactivated on an individual blog.
  125. */
  126. public static function deactivate( $network_wide ) {
  127. if ( function_exists( 'is_multisite' ) && is_multisite() ) {
  128. if ( $network_wide ) {
  129. // Get all blog ids.
  130. $blog_ids = self::get_blog_ids();
  131. foreach ( $blog_ids as $blog_id ) {
  132. switch_to_blog( $blog_id );
  133. self::single_deactivate();
  134. }
  135. restore_current_blog();
  136. } else {
  137. self::single_deactivate();
  138. }
  139. } else {
  140. self::single_deactivate();
  141. }
  142. }
  143. /**
  144. * Fired when a new site is activated with a WPMU environment.
  145. *
  146. * @since 1.0.0
  147. *
  148. * @param int $blog_id ID of the new blog.
  149. */
  150. public function activate_new_site( $blog_id ) {
  151. if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
  152. return;
  153. }
  154. switch_to_blog( $blog_id );
  155. self::single_activate();
  156. restore_current_blog();
  157. }
  158. /**
  159. * Get all blog ids of blogs in the current network that are:
  160. * - not archived
  161. * - not spam
  162. * - not deleted
  163. *
  164. * @since 1.0.0
  165. *
  166. * @return array|false The blog ids, false if no matches.
  167. */
  168. private static function get_blog_ids() {
  169. global $wpdb;
  170. // get an array of blog ids
  171. $sql = "SELECT blog_id FROM $wpdb->blogs
  172. WHERE archived = '0' AND spam = '0'
  173. AND deleted = '0'";
  174. return $wpdb->get_col( $sql );
  175. }
  176. /**
  177. * Fired for each blog when the plugin is activated.
  178. *
  179. * @since 1.0.0
  180. */
  181. private static function single_activate() {
  182. // @TODO: Define activation functionality here
  183. }
  184. /**
  185. * Fired for each blog when the plugin is deactivated.
  186. *
  187. * @since 1.0.0
  188. */
  189. private static function single_deactivate() {
  190. // @TODO: Define deactivation functionality here
  191. }
  192. /**
  193. * Load the plugin text domain for translation.
  194. *
  195. * @since 1.0.0
  196. */
  197. public function load_plugin_textdomain() {
  198. load_plugin_textdomain(
  199. $this->plugin_slug,
  200. false,
  201. dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
  202. );
  203. }
  204. /**
  205. * Register and enqueue public-facing style sheet.
  206. *
  207. * @since 1.0.0
  208. */
  209. public function enqueue_styles() {
  210. wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
  211. }
  212. /**
  213. * Register and enqueues public-facing JavaScript files.
  214. *
  215. * @since 1.0.0
  216. */
  217. public function enqueue_scripts() {
  218. wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'assets/js/public.js', __FILE__ ), array( 'jquery' ), self::VERSION );
  219. }
  220. }