| 1 |
<?php |
| 2 |
/** |
| 3 |
* (C) Copyright 2011-2025 by Kolja Nolte |
| 4 |
* kolja.nolte@gmail.com |
| 5 |
* https://www.kolja-nolte.com |
| 6 |
* |
| 7 |
* Secondary Title is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation, either version 2 of the License, or |
| 10 |
* any later version. |
| 11 |
* |
| 12 |
* Secondary Title is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* @package secondary-title |
| 18 |
* @see https://wordpress.org/plugins/secondary-title |
| 19 |
*/ |
| 20 |
|
| 21 |
/** |
| 22 |
* Plugin Name: Secondary Title |
| 23 |
* Plugin URI: https://docs.kolja-nolte.com/secondary-title |
| 24 |
* Description: Add a secondary title to posts, pages and custom post types. |
| 25 |
* Version: 2.2.1 |
| 26 |
* Author: Kolja Nolte |
| 27 |
* Author URI: https://www.kolja-nolte.com |
| 28 |
* License: GPLv2 or later |
| 29 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 30 |
* Text Domain: secondary-title |
| 31 |
*/ |
| 32 |
|
| 33 |
/** |
| 34 |
* Stop script when the file is called directly. |
| 35 |
*/ |
| 36 |
if ( ! function_exists( 'add_action' ) ) { |
| 37 |
die( '403 - You are not authorized to view this page.' ); |
| 38 |
} |
| 39 |
|
| 40 |
define( 'SECONDARY_TITLE_PATH', plugin_dir_path( __FILE__ ) ); |
| 41 |
define( 'SECONDARY_TITLE_URL', plugin_dir_url( __FILE__ ) ); |
| 42 |
|
| 43 |
const SECONDARY_TITLE_DOCS_URL = 'https://docs.kolja-nolte.com/secondary-title'; |
| 44 |
const SECONDARY_TITLE_VERSION = '2.2.0'; |
| 45 |
|
| 46 |
/** Autoload dependencies */ |
| 47 |
require_once __DIR__ . '/vendor/autoload.php'; |
| 48 |
|
| 49 |
/** |
| 50 |
* Install default settings (if not set yet) |
| 51 |
*/ |
| 52 |
register_activation_hook( __FILE__, 'secondary_title_install' ); |
| 53 |
|
| 54 |
/** |
| 55 |
* Handles the donation notification display settings |
| 56 |
*/ |
| 57 |
register_deactivation_hook( __FILE__, 'secondary_title_reset_donation_notice' ); |
| 58 |
|
| 59 |
/** |
| 60 |
* Adds a link to the settings page on 'Plugins' section in the admin area |
| 61 |
*/ |
| 62 |
add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'secondary_title_add_settings_link' ); |
| 63 |
|
| 64 |
/** Find all .php files in the 'includes' directory */ |
| 65 |
$include_files = glob( plugin_dir_path( __FILE__ ) . '/includes/*.php' ); |
| 66 |
|
| 67 |
/** Loop through all .php files in the 'includes' directory */ |
| 68 |
foreach ( $include_files as $include_file ) { |
| 69 |
/** Skip file if file is not valid */ |
| 70 |
if ( ! is_file( $include_file ) || is_dir( $include_file ) ) { |
| 71 |
continue; |
| 72 |
} |
| 73 |
|
| 74 |
/** Include current file */ |
| 75 |
require_once $include_file; |
| 76 |
} |