Changeset 2528049
- Timestamp:
- 05/07/2021 05:34:01 PM (4 years ago)
- Location:
- postpage-specific-custom-css
- Files:
-
- 23 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
postpage-specific-custom-css/trunk/post-page-specific-custom-css.php
r2442595 r2528049 4 4 * Plugin URI: https://wordpress.org/plugins/postpage-specific-custom-css/ 5 5 * Description: Post/Page specific custom CSS will allow you to add cascade stylesheet to specific posts/pages. It will give you special area in the post/page edit field to attach your CSS. It will also let you decide if this CSS has to be added in multi-page/post view (like archive posts) or only in a single view. 6 * Version: 0. 2.16 * Version: 0.3.0 7 7 * Author: Łukasz Nowicki 8 8 * Author URI: https://lukasznowicki.info/ 9 9 * Requires at least: 5.0 10 10 * Requires PHP: 7.0 11 * Tested up to: 5. 612 * Text Domain: p hylaxppsccss11 * Tested up to: 5.7 12 * Text Domain: postpage-specific-custom-css 13 13 * Domain Path: /languages 14 14 */ … … 16 16 namespace Phylax\WPPlugin\PPCustomCSS; 17 17 18 if ( ! defined( 'ABSPATH' ) ) { 19 die; 20 } # famous cheatin', huh? 21 22 const TEXT_DOMAIN = 'phylaxppsccss'; 23 18 use Phylax\Autoloader; 19 20 defined( 'ABSPATH' ) or exit; 21 22 const TEXT_DOMAIN = 'postpage-specific-custom-css'; 23 const PLUGIN_FILE = __FILE__; 24 const PLUGIN_DIR = __DIR__; 25 26 const MENU_SLUG = 'post-page-custom-css'; 27 const PARENT_MENU_SLUG = 'options-general.php'; 28 const OPTION_GROUP = 'ppcs_settings_group'; 29 const OPTION_NAME = 'ppcs_settings_name'; 30 const SECTION_BEHAVIOR_ID = 'plugin-behavior'; 31 const SECTION_DEFAULT_VALUES = 'default-values'; 32 33 if ( ! class_exists( 'Phylax\Autoloader' ) ) { 34 require_once __DIR__ . '/Phylax/Autoloader.php'; 35 } 36 37 $autoloader = new Autoloader(); 38 $autoloader->registerHandler(); 39 $autoloader->addNamespace( 'Phylax\WPPlugin\PPCustomCSS', __DIR__ . '/Phylax/WPPlugin/PPCustomCSS' ); 40 $autoloader->addNamespace( 'Phylax\WordPress', __DIR__ . '/Phylax/WordPress' ); 41 42 new Plugin(); 43 44 /* 24 45 class Plugin { 25 26 public $menu_slug = 'post-page-custom-css';27 public $menu_parent_slug = 'options-general.php';28 public $option_group = 'ppcs_settings_group';29 public $option_name = 'ppcs_settings_name';30 31 private $isBirthday = false;32 private $isDayBefore = false;33 private $isWeekAfter = false;34 46 35 47 private $newPlugin = true; … … 37 49 private $myTransient; 38 50 51 public function register_settings() { 52 register_setting( $this->option_group, $this->option_name ); 53 add_settings_section( 'plugin-behavior', __( 'Options', TEXT_DOMAIN ), [ 54 $this, 55 'section_plugin_behavior', 56 ], $this->menu_slug ); 57 add_settings_field( 'default_post_css', __( 'Default stylesheet for new posts', TEXT_DOMAIN ), [ 58 $this, 59 'default_post_css', 60 ], $this->menu_slug, 'default-values' ); 61 add_settings_field( 'default_page_css', __( 'Default stylesheet for new pages', TEXT_DOMAIN ), [ 62 $this, 63 'default_page_css', 64 ], $this->menu_slug, 'default-values' ); 65 add_settings_field( 'enable_highlighting_in', __( 'Code highlight', TEXT_DOMAIN ), [ 66 $this, 67 'enable_highlighting_in', 68 ], $this->menu_slug, 'plugin-behavior' ); 69 add_settings_field( 'bigger_textarea', __( 'Bigger input field', TEXT_DOMAIN ), [ 70 $this, 71 'bigger_textarea', 72 ], $this->menu_slug, 'plugin-behavior' ); 73 } 74 39 75 public function __construct() { 40 76 add_action( 'init', [ … … 47 83 ] ); 48 84 if ( is_admin() ) { 49 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [50 $this,51 'page_settings_link_filter',52 ] );53 85 add_action( 'add_meta_boxes', [ 54 86 $this, … … 65 97 add_action( 'admin_init', [ 66 98 $this, 67 'register_settings',68 ] );69 add_action( 'admin_init', [70 $this,71 99 'pluginInfo' 72 100 ] ); … … 139 167 ] ); 140 168 } 141 }142 143 public function register_settings() {144 register_setting( $this->option_group, $this->option_name );145 add_settings_section( 'plugin-behavior', __( 'Options', TEXT_DOMAIN ), [146 $this,147 'section_plugin_behavior',148 ], $this->menu_slug );149 add_settings_section( 'default-values', __( 'Default values', TEXT_DOMAIN ), [150 $this,151 'section_default_values',152 ], $this->menu_slug );153 add_settings_field( 'default_post_css', __( 'Default stylesheet for new posts', TEXT_DOMAIN ), [154 $this,155 'default_post_css',156 ], $this->menu_slug, 'default-values' );157 add_settings_field( 'default_page_css', __( 'Default stylesheet for new pages', TEXT_DOMAIN ), [158 $this,159 'default_page_css',160 ], $this->menu_slug, 'default-values' );161 add_settings_field( 'enable_highlighting_in', __( 'Code highlight', TEXT_DOMAIN ), [162 $this,163 'enable_highlighting_in',164 ], $this->menu_slug, 'plugin-behavior' );165 add_settings_field( 'bigger_textarea', __( 'Bigger input field', TEXT_DOMAIN ), [166 $this,167 'bigger_textarea',168 ], $this->menu_slug, 'plugin-behavior' );169 169 } 170 170 … … 264 264 } 265 265 266 public function section_default_values() {267 ?>268 <p>269 <?php echo __( 'You can set the pre-filled content for your newly created posts or pages.', TEXT_DOMAIN ); ?>270 </p>271 <?php272 }273 274 266 public function section_plugin_behavior() { 275 267 if ( $this->isBirthday || $this->isDayBefore || $this->isWeekAfter ) { … … 517 509 518 510 public function pluginInfo() { 519 /** TODO: see if there is a new plugin, now there is not. */520 511 } 521 512 … … 684 675 685 676 new Plugin(); 677 */ -
postpage-specific-custom-css/trunk/readme.txt
r2485141 r2528049 6 6 Contributors: lukasznowicki 7 7 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LEXEGNRGEF7H4 8 Stable tag: trunk8 Stable tag: 0.2.2 9 9 10 10 Post/Page specific custom CSS will allow you to add cascade stylesheet to specific posts/pages. It will give you special area in the post/page edit field to attach your CSS. It will also let you decide if this CSS has to be added in multi-page/post view (like archive posts) or only in a single view.
Note: See TracChangeset
for help on using the changeset viewer.