PluginProbe
Flex Posts – Responsive Posts Block / 1.12.0
Flex Posts – Responsive Posts Block v1.12.0
2.1.0 trunk 1.12.0 2.0.0
flex-posts / flex-posts.php

flex-posts.php in Flex Posts – Responsive Posts Block 1.12.0, at flex-posts.php

116 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Flex Posts - Widget and Gutenberg Block
4 * Plugin URI: https://tajam.id/flex-posts/
5 * Description: A widget to display posts with thumbnails in various layouts for any widget area.
6 * Version: 1.12.0
7 * Author: Tajam
8 * Author URI: https://tajam.id/
9 * License: GPL-2.0+
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 * Text Domain: flex-posts
12 * Domain Path: /languages
13 *
14 * Flex Posts is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 2 of the License, or
17 * any later version.
18 *
19 * Flex Posts is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Flex Posts. If not, see http://www.gnu.org/licenses/gpl-2.0.txt
26 *
27 * @package Flex Posts
28 */
29
30 if ( ! defined( 'ABSPATH' ) ) {
31 exit;
32 }
33
34 /**
35 * Current plugin version.
36 */
37 define( 'FLEX_POSTS_VERSION', '1.12.0' );
38
39 /**
40 * Plugin directory and url
41 */
42 define( 'FLEX_POSTS_DIR', plugin_dir_path( __FILE__ ) );
43 define( 'FLEX_POSTS_URL', plugin_dir_url( __FILE__ ) );
44
45 /**
46 * Include functions & widget classes
47 */
48 require FLEX_POSTS_DIR . 'includes/functions.php';
49 require FLEX_POSTS_DIR . 'includes/form-helpers.php';
50 require FLEX_POSTS_DIR . 'includes/class-flex-posts-widget.php';
51 require FLEX_POSTS_DIR . 'includes/class-flex-posts-list.php';
52 if ( is_admin() ) {
53 require FLEX_POSTS_DIR . 'includes/class-options.php';
54 }
55
56 /**
57 * Include template functions in `after_setup_theme` hook
58 * to make the functions pluggable
59 * (can be overridden from theme or other plugin)
60 */
61 function flex_posts_after_setup_theme() {
62 require FLEX_POSTS_DIR . 'includes/template-tags.php';
63 }
64 add_action( 'after_setup_theme', 'flex_posts_after_setup_theme' );
65
66 /**
67 * Include block
68 */
69 if ( function_exists( 'register_block_type' ) ) {
70 require FLEX_POSTS_DIR . 'blocks/list/block.php';
71 }
72
73 /**
74 * Register custom widget
75 */
76 function flex_posts_register_widgets() {
77 register_widget( 'Flex_Posts_List' );
78 }
79 add_action( 'widgets_init', 'flex_posts_register_widgets' );
80
81 /**
82 * Load the text domain for translation.
83 */
84 function flex_posts_load_textdomain() {
85 load_plugin_textdomain(
86 'flex-posts',
87 false,
88 dirname( plugin_basename( __FILE__ ) ) . '/languages'
89 );
90 }
91 add_action( 'plugins_loaded', 'flex_posts_load_textdomain' );
92
93 /**
94 * Register a new image size
95 */
96 function flex_posts_init() {
97 $option = get_option( 'flex_posts' );
98 if ( empty( $option['disable_image_size'] ) ) {
99 add_image_size( '400x250-crop', 400, 250, true );
100 }
101 }
102 add_action( 'init', 'flex_posts_init' );
103
104 /**
105 * Add settings link
106 *
107 * @param array $actions Actions.
108 * @return array
109 */
110 function flex_posts_action_links( $actions ) {
111 $links[] = '<a href="' . esc_url( admin_url( 'options-general.php?page=flex-posts' ) ) . '">' . esc_html__( 'Settings', 'flex-posts' ) . '</a>';
112 $actions = array_merge( $links, $actions );
113 return $actions;
114 }
115 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'flex_posts_action_links' );
116