function __construct()
 {
     $this->plugin_product_id = self::PROD_ID;
     $this->plugin_version = self::VERSION;
     $this->plugin_slug = self::PLUGIN_SLUG;
     $this->plugin_file = basename(dirname(__FILE__)) . '/' . basename(__FILE__);
     // PHP 5.2 Compatibility
     if (version_compare(phpversion(), '5.3', '<')) {
         require_once 'includes/compatibility.php';
     }
     add_action('init', array($this, 'load_translations'));
     add_filter('plugin_row_meta', array($this, 'add_plugin_row_meta'), 10, 4);
     WP_Job_Manager_Field_Editor_Assets::get_instance();
     register_activation_hook(__FILE__, array($this, 'plugin_activated'));
     if (!defined('WPJM_FIELD_EDITOR_VERSION')) {
         define('WPJM_FIELD_EDITOR_VERSION', WP_JOB_MANAGER_FIELD_EDITOR::VERSION);
     }
     if (!defined('WPJM_FIELD_EDITOR_PROD_ID')) {
         define('WPJM_FIELD_EDITOR_PROD_ID', WP_JOB_MANAGER_FIELD_EDITOR::PROD_ID);
     }
     if (!defined('WPJM_FIELD_EDITOR_PLUGIN_DIR')) {
         define('WPJM_FIELD_EDITOR_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
     }
     if (!defined('WPJM_FIELD_EDITOR_PLUGIN_URL')) {
         define('WPJM_FIELD_EDITOR_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
     }
     include 'classes/requires.php';
     include 'classes/translations.php';
     include 'classes/fields.php';
     include 'classes/shortcodes.php';
     include 'classes/widget.php';
     include 'classes/auto-output.php';
     if (is_admin()) {
         include 'classes/admin.php';
         $this->init_updates(__FILE__);
     }
     if (get_option('jmfe_enable_bug_reporter')) {
         sMyles_Bug_Report::get_instance();
     }
     // Initialize required classes
     $this->cpt();
     $this->auto_output();
     $this->field_types();
 }
Exemplo n.º 2
0
    /**
     * Output Field Editor List Table
     *
     * @since 1.0.0
     *
     * @param bool $return_body
     */
    public function do_list_table($return_body = FALSE)
    {
        global $mode;
        ob_start();
        $this->prepare_items();
        $modal_html = ob_get_clean();
        ob_start();
        ?>

		<div id="jmfe-list-wrap" class="wrap">
			<div id="icon-tools" class="icon32"></div>
			<h2>
					<?php 
        $this->the_table_title();
        ?>
				<a id="add-new-field" href="#" class="add-new-h2">Add <?php 
        $this->the_table_title(TRUE);
        ?>
</a>
				</h2>
			<?php 
        if (isset($_REQUEST['filter'])) {
            if ($_REQUEST['filter'] == 'custom') {
                ?>
					<script>setTimeout(
							function () {
								jQuery( '.jmfe-notice-info' ).fadeOut( 600 );
							}, 10000
						);</script>
					<div class="jmfe-notice-info alert alert-info"><i class="fa-lightbulb-o fa fa-lg"></i>   <?php 
                _e('Below you will find all of the fields that have been customized.  This includes newly created custom ones, as well as any default fields that have been customized.', 'wp-job-manager-field-editor');
                ?>
</div>
				<?php 
            } elseif ($_REQUEST['filter'] == 'default') {
                ?>
					<script>setTimeout(
							function () {
								jQuery( '.jmfe-notice-info' ).fadeOut( 600 );
							}, 10000
						);</script>
					<div class="jmfe-notice-info alert alert-info"><i class="fa-lightbulb-o fa fa-lg"></i>   <?php 
                _e('The default fields below WILL include any custom configuration you have made to them.', 'wp-job-manager-field-editor');
                ?>
</div>
				<?php 
            }
        }
        ?>
			<div class="jmfe-table-alert"><p class="jmfe-table-alert-content"></p></div>
			<div id="jmfe-list-spin" class="jmfe-spin-wrapper"><div class="jmfe-spinner"><i class="fa fa-circle-o-notch fa-3x fa-spin"></i></div></div>
			<?php 
        if (get_option('jmfe_enable_bug_reporter')) {
            if (!class_exists('sMyles_Bug_Report')) {
                include WPJM_FIELD_EDITOR_PLUGIN_DIR . '/includes/smyles-bug-report/smyles-bug-report.php';
            }
            $bug_reporter = sMyles_Bug_Report::get_instance();
            $bug_reporter->output_html();
        }
        $header = ob_get_clean();
        ob_start();
        ?>

			<div id="jmfe-form-wrap">
				<form class="<?php 
        $this->the_field_group_slug();
        ?>
_fields-form" id="<?php 
        $this->the_field_group_slug();
        ?>
-filter" method="get">

					<?php 
        $this->views();
        ?>

					<?php 
        // $this->search_box( __( 'Search' ) . ' ' . $this->get_table_title(), $this->get_field_group_slug() );
        ?>

					<input type="hidden" name="page" value="<?php 
        if (isset($_REQUEST['page'])) {
            echo sanitize_text_field($_REQUEST['page']);
        }
        ?>
">
					<input type="hidden" id="jmfe-listfilter" name="filter" value="<?php 
        if (isset($_REQUEST['filter'])) {
            echo sanitize_text_field($_REQUEST['filter']);
        }
        ?>
">
					<input type="hidden" id="jmfe-listtype" name="listtype" value="<?php 
        $this->the_field_group_slug();
        ?>
">
					<input type="hidden" id="jmfe-listtype-parent" name="listtype-parent" value="<?php 
        $this->the_field_group_slug_parent();
        ?>
">
					<input type="hidden" id="jmfe-table-title" name="table-title" value="<?php 
        echo $this->get_table_title(TRUE);
        ?>
">

					<?php 
        $this->display();
        ?>

				</form>
			</div>
			<?php 
        $body = ob_get_clean();
        if ($return_body) {
            return $body;
            die;
        }
        echo $modal_html;
        echo $header;
        echo $body;
        ?>
		</div>
		<?php 
        if (isset($_GET['debug'])) {
            $this->fields()->dump_array($this->items);
        }
    }
Exemplo n.º 3
0
 /**
  * Singleton Instance
  *
  * @since 1.0.0
  *
  * @return sMyles_Bug_Report
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }