Plugin Directory

Changeset 2528049


Ignore:
Timestamp:
05/07/2021 05:34:01 PM (4 years ago)
Author:
lukasznowicki
Message:

Fixed birthday banner

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  
    44 * Plugin URI: https://wordpress.org/plugins/postpage-specific-custom-css/
    55 * 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.1
     6 * Version: 0.3.0
    77 * Author: Łukasz Nowicki
    88 * Author URI: https://lukasznowicki.info/
    99 * Requires at least: 5.0
    1010 * Requires PHP: 7.0
    11  * Tested up to: 5.6
    12  * Text Domain: phylaxppsccss
     11 * Tested up to: 5.7
     12 * Text Domain: postpage-specific-custom-css
    1313 * Domain Path: /languages
    1414 */
     
    1616namespace Phylax\WPPlugin\PPCustomCSS;
    1717
    18 if ( ! defined( 'ABSPATH' ) ) {
    19     die;
    20 } # famous cheatin', huh?
    21 
    22 const TEXT_DOMAIN = 'phylaxppsccss';
    23 
     18use Phylax\Autoloader;
     19
     20defined( 'ABSPATH' ) or exit;
     21
     22const TEXT_DOMAIN = 'postpage-specific-custom-css';
     23const PLUGIN_FILE = __FILE__;
     24const PLUGIN_DIR  = __DIR__;
     25
     26const MENU_SLUG              = 'post-page-custom-css';
     27const PARENT_MENU_SLUG       = 'options-general.php';
     28const OPTION_GROUP           = 'ppcs_settings_group';
     29const OPTION_NAME            = 'ppcs_settings_name';
     30const SECTION_BEHAVIOR_ID    = 'plugin-behavior';
     31const SECTION_DEFAULT_VALUES = 'default-values';
     32
     33if ( ! 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
     42new Plugin();
     43
     44/*
    2445class 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;
    3446
    3547    private $newPlugin = true;
     
    3749    private $myTransient;
    3850
     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
    3975    public function __construct() {
    4076        add_action( 'init', [
     
    4783        ] );
    4884        if ( is_admin() ) {
    49             add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [
    50                 $this,
    51                 'page_settings_link_filter',
    52             ] );
    5385            add_action( 'add_meta_boxes', [
    5486                $this,
     
    6597            add_action( 'admin_init', [
    6698                $this,
    67                 'register_settings',
    68             ] );
    69             add_action( 'admin_init', [
    70                 $this,
    7199                'pluginInfo'
    72100            ] );
     
    139167            ] );
    140168        }
    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' );
    169169    }
    170170
     
    264264    }
    265265
    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         <?php
    272     }
    273 
    274266    public function section_plugin_behavior() {
    275267        if ( $this->isBirthday || $this->isDayBefore || $this->isWeekAfter ) {
     
    517509
    518510    public function pluginInfo() {
    519         /** TODO: see if there is a new plugin, now there is not. */
    520511    }
    521512
     
    684675
    685676new Plugin();
     677*/
  • postpage-specific-custom-css/trunk/readme.txt

    r2485141 r2528049  
    66Contributors: lukasznowicki
    77Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LEXEGNRGEF7H4
    8 Stable tag: trunk
     8Stable tag: 0.2.2
    99
    1010Post/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.