/**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.0
  */
 private function __construct()
 {
     $this->plugin_slug = PT_CV_DOMAIN;
     // Redirect to "Add View" page when click "Add new" link in "All Views" page
     add_action('admin_init', array($this, 'redirect_add_new'));
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     add_action('admin_enqueue_scripts', array($this, 'remove_unwanted_assets'), 1000);
     add_action('admin_print_footer_scripts', array($this, 'print_footer_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Ajax action
     $action = 'preview_request';
     add_action('wp_ajax_' . $action, array('PT_CV_Functions', 'ajax_callback_' . $action));
     // Output assets content at footer of page
     add_action(PT_CV_PREFIX_ . 'preview_footer', array('PT_CV_Html', 'assets_of_view_types'));
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(PT_CV_PATH . $this->plugin_slug . '.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'filter_add_action_links'));
     // Filter link of actions in All Views page
     add_filter('post_row_actions', array($this, 'filter_view_row_actions'), 10, 2);
     // Add Shortcode column
     add_filter('manage_pt_view_posts_columns', array($this, 'filter_view_custom_column_header'));
     add_action('manage_pt_view_posts_custom_column', array($this, 'action_view_custom_column_content'), 10, 2);
     // Filter link of Title in All Views page
     add_filter('get_edit_post_link', array($this, 'filter_get_edit_post_link'), 10, 3);
     // Filter Title of Edit View page
     add_filter('admin_title', array($this, 'filter_admin_title'), 10, 2);
     // Custom hooks for both preview & frontend
     PT_CV_Hooks::init();
     // Custom settings page
     PT_CV_Plugin::init();
 }
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.0
  */
 private function __construct()
 {
     /*
      * @TODO :
      *
      * - Uncomment following lines if the admin class should only be available for super admins
      */
     /* if( ! is_super_admin() ) {
     	  return;
     	  } */
     /*
      * Call $plugin_slug from public plugin class.
      */
     $plugin = PT_Content_Views::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     // Fix redirect error
     add_action('init', array($this, 'do_output_buffer'));
     // Redirect to "Add View" page when click "Add new" link in "All Views" page
     add_action('admin_init', array($this, 'redirect_add_new'));
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     add_action('admin_print_footer_scripts', array($this, 'print_footer_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Ajax action
     $action = 'preview_request';
     add_action('wp_ajax_' . $action, array('PT_CV_Functions', 'ajax_callback_' . $action));
     // Output assets content at footer of page
     add_action(PT_CV_PREFIX_ . 'preview_footer', array('PT_CV_Html', 'assets_of_view_types'));
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(plugin_dir_path(dirname(__FILE__)) . $this->plugin_slug . '.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'filter_add_action_links'));
     // Filter link of actions in All Views page
     add_filter('post_row_actions', array($this, 'filter_view_row_actions'), 10, 2);
     // Add Shortcode column
     add_filter('manage_pt_view_posts_columns', array($this, 'filter_view_custom_column_header'));
     add_action('manage_pt_view_posts_custom_column', array($this, 'action_view_custom_column_content'), 10, 2);
     // Filter link of Title in All Views page
     add_filter('get_edit_post_link', array($this, 'filter_get_edit_post_link'), 10, 3);
     // Filter Title of Edit View page
     add_filter('admin_title', array($this, 'filter_admin_title'), 10, 2);
     // Custom hooks for both preview & frontend
     PT_CV_Hooks::init();
     // Custom settings page
     PT_CV_Plugin::init();
 }
Esempio n. 3
0
        /**
         * Form in Settings page
         */
        public static function settings_page_form()
        {
            ob_start();
            self::$options = get_option(PT_CV_OPTION_NAME);
            ?>
			<form method="post" action="options.php">
				<?php 
            // This prints out all hidden setting fields
            settings_fields(PT_CV_OPTION_NAME . '_group');
            do_settings_sections(PT_CV_DOMAIN);
            submit_button();
            ?>
			</form>
			<?php 
            $text = ob_get_clean();
            echo $text;
        }
Esempio n. 4
0
		.wrap h3 {
			font-size:   16px;
			font-weight: bold;
			color:       #FF6A5A;
		}

		.wrap h6 {
			font-size:   15px;
			font-weight: bold;
		}

		.wrap img {
			max-width: 100%;
		}

		.wrap .label-for-option {
			font-weight:   normal;
			margin:        auto;
			margin-bottom: -5px;
			margin-left:   4px;
		}
	</style>

	<?php 
PT_CV_Plugin::settings_page_section_one();
// Settings form
PT_CV_Plugin::settings_page_form();
PT_CV_Plugin::settings_page_section_two();
?>
</div>