Geen omschrijving

duplicate-post.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * Plugin Name: Yoast Duplicate Post
  4. * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
  5. * Description: The go-to tool for cloning posts and pages, including the powerful Rewrite & Republish feature.
  6. * Version: 4.1.2
  7. * Author: Enrico Battocchi & Team Yoast
  8. * Author URI: https://yoast.com
  9. * Text Domain: duplicate-post
  10. *
  11. * @package Duplicate Post
  12. * @since 0.1
  13. *
  14. * Copyright 2020 Yoast BV (email : info@yoast.com)
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. use Yoast\WP\Duplicate_Post\Duplicate_Post;
  31. if ( ! defined( 'ABSPATH' ) ) {
  32. exit();
  33. }
  34. if ( ! defined( 'DUPLICATE_POST_FILE' ) ) {
  35. define( 'DUPLICATE_POST_FILE', __FILE__ );
  36. }
  37. if ( ! defined( 'DUPLICATE_POST_PATH' ) ) {
  38. define( 'DUPLICATE_POST_PATH', plugin_dir_path( __FILE__ ) );
  39. }
  40. define( 'DUPLICATE_POST_CURRENT_VERSION', '4.1.2' );
  41. $duplicate_post_autoload_file = __DIR__ . '/vendor/autoload.php';
  42. if ( is_readable( $duplicate_post_autoload_file ) ) {
  43. require $duplicate_post_autoload_file;
  44. // Initialize the main autoloaded class.
  45. add_action( 'plugins_loaded', '__duplicate_post_main' );
  46. }
  47. /**
  48. * Loads the Duplicate Post main class.
  49. *
  50. * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore,WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Function name change would be BC-break.
  51. */
  52. function __duplicate_post_main() {
  53. new Duplicate_Post();
  54. }
  55. // phpcs:enable
  56. /**
  57. * Initialises the internationalisation domain.
  58. */
  59. function duplicate_post_load_plugin_textdomain() {
  60. load_plugin_textdomain( 'duplicate-post', false, basename( dirname( __FILE__ ) ) . '/languages/' );
  61. }
  62. add_action( 'plugins_loaded', 'duplicate_post_load_plugin_textdomain' );
  63. add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'duplicate_post_plugin_actions', 10 );
  64. /**
  65. * Adds 'Settings' link to plugin entry in the Plugins list.
  66. *
  67. * @ignore
  68. * @see 'plugin_action_links_$plugin_file'
  69. *
  70. * @param array $actions An array of plugin action links.
  71. * @return array
  72. */
  73. function duplicate_post_plugin_actions( $actions ) {
  74. $settings_action = array(
  75. 'settings' => sprintf(
  76. '<a href="%1$s" %2$s>%3$s</a>',
  77. menu_page_url( 'duplicatepost', false ),
  78. 'aria-label="' . __( 'Settings for Duplicate Post', 'duplicate-post' ) . '"',
  79. esc_html__( 'Settings', 'default' )
  80. ),
  81. );
  82. $actions = $settings_action + $actions;
  83. return $actions;
  84. }
  85. require_once dirname( __FILE__ ) . '/duplicate-post-common.php';
  86. if ( is_admin() ) {
  87. include_once dirname( __FILE__ ) . '/duplicate-post-admin.php';
  88. }