← Back
Editing: press-release-distribution.php
<?php /** * Press Release Distribution * * Plugin Name: Press Release Distribution * Plugin URI: https://wireaccess.net/contact-us * Description: Creates a new section for press releases in your wordpress dashboard right next to your post and pages section. * Version: 2.8 * Author: lightimagemedia * Author URI: https://wireaccess.net * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: press-release-distribution * Domain Path: /languages * Requires at least: 5.4 * Requires PHP: 5.2.4 * * This is free software; you can redistribute it and/or modify it under the terms of the GNU license. */ # Exit if accessed directly if (!defined("ABSPATH")) { exit; } define("PRESSRELEASEDISTRIBUTION_EXEC",true); define("PRESSRELEASEDISTRIBUTION_PATH",dirname(__FILE__)); define("PRESSRELEASEDISTRIBUTION_DIR",basename(PRESSRELEASEDISTRIBUTION_PATH)); define("PRESSRELEASEDISTRIBUTION_URL",plugins_url("/",__FILE__)); define("PRESSRELEASEDISTRIBUTION_VERSION","2.8"); /** * Debug Mode **/ define("PRESSRELEASEDISTRIBUTION_DEBUG",false); //change false for distribution /** * Base Class Plugin * @author lightimagemedia * * @access public * @version 2.8 * @package Press Release Distribution * **/ class pressreleasedistribution_PressReleaseDistribution { /** * Instance of a class * @access public * @return void **/ function __construct() { add_action("init", array($this, "pressreleasedistribution_post_type_press_release_init")); // register a press-release post type. add_filter("the_content", array($this, "pressreleasedistribution_post_type_pressreleasedistribution_the_content")); // modif page for press-release add_action("after_setup_theme", array($this, "pressreleasedistribution_image_size")); // register image size. add_filter("image_size_names_choose", array($this, "pressreleasedistribution_image_sizes_choose")); // image size choose. add_action("init", array($this, "pressreleasedistribution_register_taxonomy")); // register register_taxonomy. } /** * Register custom post types (press-release) * * @link http://codex.wordpress.org/Function_Reference/register_post_type * @access public * @return void **/ public function pressreleasedistribution_post_type_press_release_init() { $labels = array( 'name' => _x('Press Releases', 'post type general name', 'press-release-distribution'), 'singular_name' => _x('Press Release', 'post type singular name', 'press-release-distribution'), 'menu_name' => _x('Press Releases', 'admin menu', 'press-release-distribution'), 'name_admin_bar' => _x('Press Releases', 'add new on admin bar', 'press-release-distribution'), 'add_new' => _x('Add New', 'book', 'press-release-distribution'), 'add_new_item' => __('Add New Press Release', 'press-release-distribution'), 'new_item' => __('New Press Release', 'press-release-distribution'), 'edit_item' => __('Edit Press Release', 'press-release-distribution'), 'view_item' => __('View Press Release', 'press-release-distribution'), 'all_items' => __('All Press Releases ', 'press-release-distribution'), 'search_items' => __('Search Press Releases', 'press-release-distribution'), 'parent_item_colon' => __('Parent Press Releases', 'press-release-distribution'), 'not_found' => __('No Press Releases Found', 'press-release-distribution'), 'not_found_in_trash' => __('No Press Releases Found In Trash', 'press-release-distribution')); $supports = array('title','editor','author','custom-fields','trackbacks','thumbnail','comments', 'revisions','post-formats','page-attributes'); $args = array( 'labels' => $labels, 'description' => __('Displays all press releases', 'press-release-distribution'), 'public' => true, 'menu_icon' => 'dashicons-editor-table', 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => 'press-release'), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => true, 'menu_position' => null, 'taxonomies' => array(), // array('category', 'post_tag','page-category'), 'supports' => $supports); register_post_type('press_release', $args); flush_rewrite_rules(); } /** * Retrieved data custom post-types (press-release) * * @access public * @param mixed $content * @return void * @link https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content **/ public function pressreleasedistribution_post_type_pressreleasedistribution_the_content($content) { $new_content = $content ; if(is_singular("press-release")){ if(file_exists(PRESSRELEASEDISTRIBUTION_PATH . "/includes/post_type.press_release.inc.php")){ require_once(PRESSRELEASEDISTRIBUTION_PATH . "/includes/post_type.press_release.inc.php"); $press_release_content = new pressreleasedistribution_TheContent(); $new_content = $press_release_content->Markup($content); wp_reset_postdata(); } } return $new_content ; } /** * Register a new image size. * @link http://codex.wordpress.org/Function_Reference/add_image_size * @access public * @return void **/ public function pressreleasedistribution_image_size() { } /** * Choose a image size. * @access public * @param mixed $sizes * @return void **/ public function pressreleasedistribution_image_sizes_choose($sizes) { $custom_sizes = array( ); return array_merge($sizes,$custom_sizes); } /** * Register Taxonomies * @https://codex.wordpress.org/Taxonomies * @access public * @return void **/ public function pressreleasedistribution_register_taxonomy() { } } new pressreleasedistribution_PressReleaseDistribution(); class pressreleasedistribution_adminoptions { private $pressreleasedistribution_settings_options; public function __construct() { add_action( 'admin_menu', array( $this, 'pressreleasedistribution_settings_add_plugin_page' ) ); add_action( 'admin_init', array( $this, 'pressreleasedistribution_settings_page_init' ) ); } public function pressreleasedistribution_settings_add_plugin_page() { add_menu_page( 'Press Release Settings', // page_title 'Press Release Settings', // menu_title 'manage_options', // capability 'pressreleasedistribution_settings', // menu_slug array( $this, 'pressreleasedistribution_settings_create_admin_page' ), // function 'dashicons-editor-table', // icon_url 80 // position ); } public function pressreleasedistribution_settings_create_admin_page() { $this->pressreleasedistribution_settings_options = get_option( 'pressreleasedistribution_settings_option_name' ); ?> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> /* Style the tab */ .tab { overflow: hidden; border: 1px solid #ccc; background-color: #cccccc; margin-right: 30px; } /* Style the buttons inside the tab */ .tab button { background-color: inherit; float: left; border: none; outline: none; cursor: pointer; padding: 14px 16px; transition: 0.3s; font-size: 17px; } /* Change background color of buttons on hover */ .tab button:hover { background-color: #fff; } /* Create an active/current tablink class */ .tab button.active { background-color: #b6b6b6; } /* Style the tab content */ .tabcontent { display: none; padding: 6px 12px; border: 0px solid #ccc; border-top: none; } </style> </head> <body> <br><br> <h1 style="<?php echo esc_attr('color:#4d4d4d; font-size:33px; font-weight:bold;') ?>"><?php esc_html_e('Press Release Settings', 'press-release-distribution') ?></h1> <br><br> <div class="<?php echo esc_attr('tab') ?>"> <button class="<?php echo esc_attr('tablinks') ?>" onclick="openTabs(<?php echo esc_attr('event') ?>, '<?php echo esc_attr('Installation') ?>')" id="defaultOpen">Installation</button> <button class="<?php echo esc_attr('tablinks') ?>" onclick="openTabs(<?php echo esc_attr('event') ?>, '<?php echo esc_attr('About') ?>')">About Wire Access Distribution Services</button> </div> <div id="Installation" class="<?php echo esc_attr('tabcontent') ?>"> <h1 style="<?php echo esc_attr('color:#4d4d4d; font-size:33px; font-weight:bold;') ?>"><?php esc_html_e('Installation', 'press-release-distribution') ?></h1> <p style="<?php echo esc_attr('color:#4d4d4d; font-size: 17px;') ?>"><strong>Option 1.</strong> Upload, install and then activate the plugin through the wordpress dashboard <br><br> <strong>Option 2.</strong> Extract and upload the zip files contents directly to the directory /wp-content/plugins/press-release-distribution and then go to the installed plugins page in your WordPress dashboard and activate the plugin.<br><br> </p> </div> <div id="About" class="<?php echo esc_attr('tabcontent') ?>"> <h1 style="<?php echo esc_attr('color:#4d4d4d; font-size:33px; font-weight:bold;') ?>"><?php esc_html_e('About', 'press-release-distribution') ?></h1> <p style="<?php echo esc_attr('color:#4d4d4d; font-size: 17px;') ?>"> <strong>Press release distribution services</strong> <br> Find the best press release distribution services available online. Distribute your press release top news outlets. Submit a press release to AP News, Yahoo Finance, USA Today, Business Insider or Digital Journal. <br><br> <strong>Graphic design services</strong> <br> Hire a graphic designer to create an Ad graphic for your next press release. High quality banner ad design services available online. Multiple color and text variations for split testing and optimizing conversions - Ad Design Services - Conversion optimization services <br><br> <strong>Copy writing services</strong> <br> Increase views of your press release with unique and well written content. Copy Writing Services - Online press release writing services <br><br> <img width="70%" src="<?php echo esc_url(PRESSRELEASEDISTRIBUTION_URL); ?>assets/wire-access.png"> </p> </div> <script> function openTabs(evt, tabsName) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(tabsName).style.display = "block"; evt.currentTarget.className += " active"; } document.getElementById("defaultOpen").click(); var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { /* Toggle between adding and removing the "active" class, to highlight the button that controls the panel */ this.classList.toggle("active"); /* Toggle between hiding and showing the active panel */ var panel = this.nextElementSibling; if (panel.style.display === "block") { panel.style.display = "none"; } else { panel.style.display = "block"; } }); } </script> </body> </html> <?php } public function pressreleasedistribution_settings_page_init() { register_setting( 'pressreleasedistribution_settings_option_group', // option_group 'pressreleasedistribution_settings_option_name', // option_name array( $this, 'pressreleasedistribution_settings_sanitize' ) // sanitize_callback ); add_settings_section( 'pressreleasedistribution_settings_setting_section', // id 'Settings', // title array( $this, 'pressreleasedistribution_settings_section_info' ), // callback 'pressreleasedistribution_settings-admin' // page ); add_settings_field( 'textinputs_0', // id 'textinputs', // title array( $this, 'textinputs_0_callback' ), // callback 'pressreleasedistribution_settings-admin', // page 'pressreleasedistribution_settings_setting_section' // section ); } public function pressreleasedistribution_settings_sanitize($input) { $sanitary_values = array(); if ( isset( $input['textinputs_0'] ) ) { $sanitary_values['textinputs_0'] = sanitize_text_field( $input['textinputs_0'] ); } return $sanitary_values; } public function pressreleasedistribution_settings_section_info() { } public function textinputs_0_callback() { printf( '<input class="regular-text" type="text" name="pressreleasedistribution_settings_option_name[textinputs_0]" id="textinputs_0" value="%s">', isset( $this->pressreleasedistribution_settings_options['textinputs_0'] ) ? esc_attr( $this->pressreleasedistribution_settings_options['textinputs_0']) : '' ); } } if ( is_admin() ) $pressreleasedistribution_settings = new pressreleasedistribution_adminoptions(); /* * Retrieve this value with: * $pressreleasedistribution_settings_options = get_option( 'pressreleasedistribution_settings_option_name' ); // Array of All Options * $textinputs_0 = $pressreleasedistribution_settings_options['textinputs_0']; // textinputs */
Save File
Cancel