From 5468323594eee66e1d7d8288c06de3cbc7fd0746 Mon Sep 17 00:00:00 2001 From: Bill Ross Date: Fri, 20 Jun 2025 09:49:03 -0600 Subject: [PATCH] https://wppb.me/ starter --- README.md | 3 - admin/class-jit-tr-admin.php | 103 ++++++++++ admin/css/jit-tr-admin.css | 4 + admin/index.php | 1 + admin/js/jit-tr-admin.js | 32 ++++ admin/partials/jit-tr-admin-display.php | 16 ++ includes/class-jit-tr-activator.php | 36 ++++ includes/class-jit-tr-deactivator.php | 36 ++++ includes/class-jit-tr-i18n.php | 47 +++++ includes/class-jit-tr-loader.php | 129 +++++++++++++ includes/class-jit-tr.php | 218 ++++++++++++++++++++++ includes/index.php | 1 + index.php | 1 + jit-tr.php | 82 ++++++++ languages/jit-tr.pot | 0 public/class-jit-tr-public.php | 103 ++++++++++ public/css/jit-tr-public.css | 4 + public/index.php | 1 + public/js/jit-tr-public.js | 32 ++++ public/partials/jit-tr-public-display.php | 19 ++ readme.txt | 114 +++++++++++ uninstall.php | 31 +++ 22 files changed, 1010 insertions(+), 3 deletions(-) delete mode 100644 README.md create mode 100644 admin/class-jit-tr-admin.php create mode 100644 admin/css/jit-tr-admin.css create mode 100644 admin/index.php create mode 100644 admin/js/jit-tr-admin.js create mode 100644 admin/partials/jit-tr-admin-display.php create mode 100644 includes/class-jit-tr-activator.php create mode 100644 includes/class-jit-tr-deactivator.php create mode 100644 includes/class-jit-tr-i18n.php create mode 100644 includes/class-jit-tr-loader.php create mode 100644 includes/class-jit-tr.php create mode 100644 includes/index.php create mode 100644 index.php create mode 100644 jit-tr.php create mode 100644 languages/jit-tr.pot create mode 100644 public/class-jit-tr-public.php create mode 100644 public/css/jit-tr-public.css create mode 100644 public/index.php create mode 100644 public/js/jit-tr-public.js create mode 100644 public/partials/jit-tr-public-display.php create mode 100644 readme.txt create mode 100644 uninstall.php diff --git a/README.md b/README.md deleted file mode 100644 index c5d1839..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# jit-tr-wp - -Wordpress plugin for Jit-Tr \ No newline at end of file diff --git a/admin/class-jit-tr-admin.php b/admin/class-jit-tr-admin.php new file mode 100644 index 0000000..285e0ec --- /dev/null +++ b/admin/class-jit-tr-admin.php @@ -0,0 +1,103 @@ + + */ +class Jit_Tr_Admin { + + /** + * The ID of this plugin. + * + * @since 1.0.0 + * @access private + * @var string $plugin_name The ID of this plugin. + */ + private $plugin_name; + + /** + * The version of this plugin. + * + * @since 1.0.0 + * @access private + * @var string $version The current version of this plugin. + */ + private $version; + + /** + * Initialize the class and set its properties. + * + * @since 1.0.0 + * @param string $plugin_name The name of this plugin. + * @param string $version The version of this plugin. + */ + public function __construct( $plugin_name, $version ) { + + $this->plugin_name = $plugin_name; + $this->version = $version; + + } + + /** + * Register the stylesheets for the admin area. + * + * @since 1.0.0 + */ + public function enqueue_styles() { + + /** + * This function is provided for demonstration purposes only. + * + * An instance of this class should be passed to the run() function + * defined in Jit_Tr_Loader as all of the hooks are defined + * in that particular class. + * + * The Jit_Tr_Loader will then create the relationship + * between the defined hooks and the functions defined in this + * class. + */ + + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/jit-tr-admin.css', array(), $this->version, 'all' ); + + } + + /** + * Register the JavaScript for the admin area. + * + * @since 1.0.0 + */ + public function enqueue_scripts() { + + /** + * This function is provided for demonstration purposes only. + * + * An instance of this class should be passed to the run() function + * defined in Jit_Tr_Loader as all of the hooks are defined + * in that particular class. + * + * The Jit_Tr_Loader will then create the relationship + * between the defined hooks and the functions defined in this + * class. + */ + + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jit-tr-admin.js', array( 'jquery' ), $this->version, false ); + + } + +} diff --git a/admin/css/jit-tr-admin.css b/admin/css/jit-tr-admin.css new file mode 100644 index 0000000..00c8c7f --- /dev/null +++ b/admin/css/jit-tr-admin.css @@ -0,0 +1,4 @@ +/** + * All of the CSS for your admin-specific functionality should be + * included in this file. + */ \ No newline at end of file diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..e71af0e --- /dev/null +++ b/admin/index.php @@ -0,0 +1 @@ + + + diff --git a/includes/class-jit-tr-activator.php b/includes/class-jit-tr-activator.php new file mode 100644 index 0000000..0c993f7 --- /dev/null +++ b/includes/class-jit-tr-activator.php @@ -0,0 +1,36 @@ + + */ +class Jit_Tr_Activator { + + /** + * Short Description. (use period) + * + * Long Description. + * + * @since 1.0.0 + */ + public static function activate() { + + } + +} diff --git a/includes/class-jit-tr-deactivator.php b/includes/class-jit-tr-deactivator.php new file mode 100644 index 0000000..296d4cb --- /dev/null +++ b/includes/class-jit-tr-deactivator.php @@ -0,0 +1,36 @@ + + */ +class Jit_Tr_Deactivator { + + /** + * Short Description. (use period) + * + * Long Description. + * + * @since 1.0.0 + */ + public static function deactivate() { + + } + +} diff --git a/includes/class-jit-tr-i18n.php b/includes/class-jit-tr-i18n.php new file mode 100644 index 0000000..8460b6e --- /dev/null +++ b/includes/class-jit-tr-i18n.php @@ -0,0 +1,47 @@ + + */ +class Jit_Tr_i18n { + + + /** + * Load the plugin text domain for translation. + * + * @since 1.0.0 + */ + public function load_plugin_textdomain() { + + load_plugin_textdomain( + 'jit-tr', + false, + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' + ); + + } + + + +} diff --git a/includes/class-jit-tr-loader.php b/includes/class-jit-tr-loader.php new file mode 100644 index 0000000..806943f --- /dev/null +++ b/includes/class-jit-tr-loader.php @@ -0,0 +1,129 @@ + + */ +class Jit_Tr_Loader { + + /** + * The array of actions registered with WordPress. + * + * @since 1.0.0 + * @access protected + * @var array $actions The actions registered with WordPress to fire when the plugin loads. + */ + protected $actions; + + /** + * The array of filters registered with WordPress. + * + * @since 1.0.0 + * @access protected + * @var array $filters The filters registered with WordPress to fire when the plugin loads. + */ + protected $filters; + + /** + * Initialize the collections used to maintain the actions and filters. + * + * @since 1.0.0 + */ + public function __construct() { + + $this->actions = array(); + $this->filters = array(); + + } + + /** + * Add a new action to the collection to be registered with WordPress. + * + * @since 1.0.0 + * @param string $hook The name of the WordPress action that is being registered. + * @param object $component A reference to the instance of the object on which the action is defined. + * @param string $callback The name of the function definition on the $component. + * @param int $priority Optional. The priority at which the function should be fired. Default is 10. + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. + */ + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { + $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); + } + + /** + * Add a new filter to the collection to be registered with WordPress. + * + * @since 1.0.0 + * @param string $hook The name of the WordPress filter that is being registered. + * @param object $component A reference to the instance of the object on which the filter is defined. + * @param string $callback The name of the function definition on the $component. + * @param int $priority Optional. The priority at which the function should be fired. Default is 10. + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 + */ + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { + $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); + } + + /** + * A utility function that is used to register the actions and hooks into a single + * collection. + * + * @since 1.0.0 + * @access private + * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). + * @param string $hook The name of the WordPress filter that is being registered. + * @param object $component A reference to the instance of the object on which the filter is defined. + * @param string $callback The name of the function definition on the $component. + * @param int $priority The priority at which the function should be fired. + * @param int $accepted_args The number of arguments that should be passed to the $callback. + * @return array The collection of actions and filters registered with WordPress. + */ + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { + + $hooks[] = array( + 'hook' => $hook, + 'component' => $component, + 'callback' => $callback, + 'priority' => $priority, + 'accepted_args' => $accepted_args + ); + + return $hooks; + + } + + /** + * Register the filters and actions with WordPress. + * + * @since 1.0.0 + */ + public function run() { + + foreach ( $this->filters as $hook ) { + add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); + } + + foreach ( $this->actions as $hook ) { + add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); + } + + } + +} diff --git a/includes/class-jit-tr.php b/includes/class-jit-tr.php new file mode 100644 index 0000000..09239ad --- /dev/null +++ b/includes/class-jit-tr.php @@ -0,0 +1,218 @@ + + */ +class Jit_Tr { + + /** + * The loader that's responsible for maintaining and registering all hooks that power + * the plugin. + * + * @since 1.0.0 + * @access protected + * @var Jit_Tr_Loader $loader Maintains and registers all hooks for the plugin. + */ + protected $loader; + + /** + * The unique identifier of this plugin. + * + * @since 1.0.0 + * @access protected + * @var string $plugin_name The string used to uniquely identify this plugin. + */ + protected $plugin_name; + + /** + * The current version of the plugin. + * + * @since 1.0.0 + * @access protected + * @var string $version The current version of the plugin. + */ + protected $version; + + /** + * Define the core functionality of the plugin. + * + * Set the plugin name and the plugin version that can be used throughout the plugin. + * Load the dependencies, define the locale, and set the hooks for the admin area and + * the public-facing side of the site. + * + * @since 1.0.0 + */ + public function __construct() { + if ( defined( 'JIT_TR_VERSION' ) ) { + $this->version = JIT_TR_VERSION; + } else { + $this->version = '1.0.0'; + } + $this->plugin_name = 'jit-tr'; + + $this->load_dependencies(); + $this->set_locale(); + $this->define_admin_hooks(); + $this->define_public_hooks(); + + } + + /** + * Load the required dependencies for this plugin. + * + * Include the following files that make up the plugin: + * + * - Jit_Tr_Loader. Orchestrates the hooks of the plugin. + * - Jit_Tr_i18n. Defines internationalization functionality. + * - Jit_Tr_Admin. Defines all hooks for the admin area. + * - Jit_Tr_Public. Defines all hooks for the public side of the site. + * + * Create an instance of the loader which will be used to register the hooks + * with WordPress. + * + * @since 1.0.0 + * @access private + */ + private function load_dependencies() { + + /** + * The class responsible for orchestrating the actions and filters of the + * core plugin. + */ + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-jit-tr-loader.php'; + + /** + * The class responsible for defining internationalization functionality + * of the plugin. + */ + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-jit-tr-i18n.php'; + + /** + * The class responsible for defining all actions that occur in the admin area. + */ + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-jit-tr-admin.php'; + + /** + * The class responsible for defining all actions that occur in the public-facing + * side of the site. + */ + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-jit-tr-public.php'; + + $this->loader = new Jit_Tr_Loader(); + + } + + /** + * Define the locale for this plugin for internationalization. + * + * Uses the Jit_Tr_i18n class in order to set the domain and to register the hook + * with WordPress. + * + * @since 1.0.0 + * @access private + */ + private function set_locale() { + + $plugin_i18n = new Jit_Tr_i18n(); + + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); + + } + + /** + * Register all of the hooks related to the admin area functionality + * of the plugin. + * + * @since 1.0.0 + * @access private + */ + private function define_admin_hooks() { + + $plugin_admin = new Jit_Tr_Admin( $this->get_plugin_name(), $this->get_version() ); + + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); + + } + + /** + * Register all of the hooks related to the public-facing functionality + * of the plugin. + * + * @since 1.0.0 + * @access private + */ + private function define_public_hooks() { + + $plugin_public = new Jit_Tr_Public( $this->get_plugin_name(), $this->get_version() ); + + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); + + } + + /** + * Run the loader to execute all of the hooks with WordPress. + * + * @since 1.0.0 + */ + public function run() { + $this->loader->run(); + } + + /** + * The name of the plugin used to uniquely identify it within the context of + * WordPress and to define internationalization functionality. + * + * @since 1.0.0 + * @return string The name of the plugin. + */ + public function get_plugin_name() { + return $this->plugin_name; + } + + /** + * The reference to the class that orchestrates the hooks with the plugin. + * + * @since 1.0.0 + * @return Jit_Tr_Loader Orchestrates the hooks of the plugin. + */ + public function get_loader() { + return $this->loader; + } + + /** + * Retrieve the version number of the plugin. + * + * @since 1.0.0 + * @return string The version number of the plugin. + */ + public function get_version() { + return $this->version; + } + +} diff --git a/includes/index.php b/includes/index.php new file mode 100644 index 0000000..e71af0e --- /dev/null +++ b/includes/index.php @@ -0,0 +1 @@ +run(); + +} +run_jit_tr(); diff --git a/languages/jit-tr.pot b/languages/jit-tr.pot new file mode 100644 index 0000000..e69de29 diff --git a/public/class-jit-tr-public.php b/public/class-jit-tr-public.php new file mode 100644 index 0000000..7c15462 --- /dev/null +++ b/public/class-jit-tr-public.php @@ -0,0 +1,103 @@ + + */ +class Jit_Tr_Public { + + /** + * The ID of this plugin. + * + * @since 1.0.0 + * @access private + * @var string $plugin_name The ID of this plugin. + */ + private $plugin_name; + + /** + * The version of this plugin. + * + * @since 1.0.0 + * @access private + * @var string $version The current version of this plugin. + */ + private $version; + + /** + * Initialize the class and set its properties. + * + * @since 1.0.0 + * @param string $plugin_name The name of the plugin. + * @param string $version The version of this plugin. + */ + public function __construct( $plugin_name, $version ) { + + $this->plugin_name = $plugin_name; + $this->version = $version; + + } + + /** + * Register the stylesheets for the public-facing side of the site. + * + * @since 1.0.0 + */ + public function enqueue_styles() { + + /** + * This function is provided for demonstration purposes only. + * + * An instance of this class should be passed to the run() function + * defined in Jit_Tr_Loader as all of the hooks are defined + * in that particular class. + * + * The Jit_Tr_Loader will then create the relationship + * between the defined hooks and the functions defined in this + * class. + */ + + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/jit-tr-public.css', array(), $this->version, 'all' ); + + } + + /** + * Register the JavaScript for the public-facing side of the site. + * + * @since 1.0.0 + */ + public function enqueue_scripts() { + + /** + * This function is provided for demonstration purposes only. + * + * An instance of this class should be passed to the run() function + * defined in Jit_Tr_Loader as all of the hooks are defined + * in that particular class. + * + * The Jit_Tr_Loader will then create the relationship + * between the defined hooks and the functions defined in this + * class. + */ + + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jit-tr-public.js', array( 'jquery' ), $this->version, false ); + + } + +} diff --git a/public/css/jit-tr-public.css b/public/css/jit-tr-public.css new file mode 100644 index 0000000..65bbf96 --- /dev/null +++ b/public/css/jit-tr-public.css @@ -0,0 +1,4 @@ +/** + * All of the CSS for your public-facing functionality should be + * included in this file. + */ \ No newline at end of file diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..e71af0e --- /dev/null +++ b/public/index.php @@ -0,0 +1 @@ + + + +
+

JIT_TR

+
diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..91c4d36 --- /dev/null +++ b/readme.txt @@ -0,0 +1,114 @@ +=== Plugin Name === +Contributors: +Donate link: https://jit-tr.com/ +Tags: comments, spam +Requires at least: 3.0.1 +Tested up to: 3.4 +Stable tag: 4.3 +License: GPLv2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + +Here is a short description of the plugin. This should be no more than 150 characters. No markup here. + +== Description == + +This is the long description. No limit, and you can use Markdown (as well as in the following sections). + +For backwards compatibility, if this section is missing, the full length of the short description will be used, and +Markdown parsed. + +A few notes about the sections above: + +* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames +* "Tags" is a comma separated list of tags that apply to the plugin +* "Requires at least" is the lowest version that the plugin will work on +* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on +higher versions... this is just the highest one you've verified. +* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for +stable. + + Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so +if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used +for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt` +is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in +your in-development version, without having that information incorrectly disclosed about the current stable version +that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag. + + If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where +you put the stable version, in order to eliminate any doubt. + +== Installation == + +This section describes how to install the plugin and get it working. + +e.g. + +1. Upload `jit-tr.php` to the `/wp-content/plugins/` directory +1. Activate the plugin through the 'Plugins' menu in WordPress +1. Place `` in your templates + +== Frequently Asked Questions == + += A question that someone might have = + +An answer to that question. + += What about foo bar? = + +Answer to foo bar dilemma. + +== Screenshots == + +1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from +the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets +directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` +(or jpg, jpeg, gif). +2. This is the second screen shot + +== Changelog == + += 1.0 = +* A change since the previous version. +* Another change. + += 0.5 = +* List versions from most recent at top to oldest at bottom. + +== Upgrade Notice == + += 1.0 = +Upgrade notices describe the reason a user should upgrade. No more than 300 characters. + += 0.5 = +This version fixes a security related bug. Upgrade immediately. + +== Arbitrary section == + +You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated +plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or +"installation." Arbitrary sections will be shown below the built-in sections outlined above. + +== A brief Markdown Example == + +Ordered list: + +1. Some feature +1. Another feature +1. Something else about the plugin + +Unordered list: + +* something +* something else +* third thing + +Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax]. +Titles are optional, naturally. + +[markdown syntax]: http://daringfireball.net/projects/markdown/syntax + "Markdown is what the parser uses to process much of the readme file" + +Markdown uses email style notation for blockquotes and I've been told: +> Asterisks for *emphasis*. Double it up for **strong**. + +`` diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000..22388b4 --- /dev/null +++ b/uninstall.php @@ -0,0 +1,31 @@ +