/** * Notices page to house all of the admin notices for Core * * Can be simply used be adding another line into the nf_admin_notices() function * * The class NF_Notices in notices-class.php can be extended to create more advanced notices to include triggered events * * @since 2.9 */ function nf_admin_notices($notices) { if (ninja_forms_three_calc_check() && ninja_forms_three_addons_version_check() && ninja_forms_three_addons_check()) { /* * Upgrade Now */ $upgrade_link = admin_url('admin.php?page=ninja-forms-three'); $notices['three_upgrade'] = array('title' => __('Upgrade to Ninja Forms THREE', 'ninja-forms'), 'msg' => sprintf(__('You are eligible to upgrade to the Ninja Forms THREE Release Candidate! %sUpgrade Now%s', 'ninja-forms'), '<a target="_blank" href="' . $upgrade_link . '">', '</a>'), 'link' => '', 'int' => 0, 'blacklist' => array('ninja-forms', 'ninja-forms-three')); } else { /* * THREE is Coming! */ $three_info = add_query_arg(array('nf_admin_notice_ignore' => 'three_info')); $three_link = nf_aff_link('https://ninjaforms.com/three/?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+THREE&utm_content=Learn+More'); $notices['three_info'] = array('title' => __('THREE is coming!', 'ninja-forms'), 'msg' => sprintf(__('A major update is coming to Ninja Forms. %sLearn more about new features, backwards compatibility, and more Frequently Asked Questions.%s', 'ninja-forms'), '<a target="_blank" href="' . $three_link . '">', '</a>'), 'link' => '', 'int' => 0, 'blacklist' => array('ninja-forms', 'ninja-forms-three')); } $one_week_support = add_query_arg(array('nf_admin_notice_ignore' => 'one_week_support')); $support_link = nf_aff_link('https://ninjaforms.com/contact/?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+Upsell&utm_content=Ninja+Forms+Support'); $support_docs_link = nf_aff_link('http://docs.ninjaforms.com/?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+Upsell&utm_content=Ninja+Forms+Docs'); $notices['one_week_support'] = array('title' => __('How\'s It Going?', 'ninja-forms'), 'msg' => __('Thank you for using Ninja Forms! We hope that you\'ve found everything you need, but if you have any questions:', 'ninja-forms'), 'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="' . $support_docs_link . '">' . __('Check out our documentation', 'ninja-forms') . '</a></li> <li><span class="dashicons dashicons-sos"></span><a target="_blank" href="' . $support_link . '">' . __('Get Some Help', 'ninja-forms') . '</a></li> <li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __('Dismiss', 'ninja-forms') . '</a></li>', 'int' => 7, 'blacklist' => array('ninja-forms-three')); // $two_week_review_ignore = add_query_arg( array( 'nf_admin_notice_ignore' => 'two_week_review' ) ); // $two_week_review_temp = add_query_arg( array( 'nf_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14 ) ); // $notices['two_week_review'] = array( // 'title' => __( 'Leave A Review?', 'ninja-forms' ), // 'msg' => __( 'We hope you\'ve enjoyed using Ninja Forms! Would you consider leaving us a review on WordPress.org?', 'ninja-forms' ), // 'link' => '<li> <span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __( 'I\'ve already left a review', 'ninja-forms' ) . '</a></li> // <li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __( 'Maybe Later' ,'ninja-forms' ) . '</a></li> // <li><span class="dashicons dashicons-external"></span><a href="http://wordpress.org/support/view/plugin-reviews/ninja-forms?filter=5" target="_blank">' . __( 'Sure! I\'d love to!', 'ninja-forms' ) . '</a></li>', // 'int' => 14 // ); return $notices; }
function ninja_forms_three_admin_notice() { $currentScreen = get_current_screen(); if (!in_array($currentScreen->id, array('toplevel_page_ninja-forms'))) { return; } wp_enqueue_style('nf-admin-notices', NINJA_FORMS_URL . 'assets/css/admin-notices.css?nf_ver=' . NF_PLUGIN_VERSION); include plugin_dir_path(__FILE__) . 'upgrade/tmpl-notice.html.php'; $three_link = nf_aff_link('https://ninjaforms.com/three/?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+THREE&utm_content=Learn+More'); ?> <div id="nf-admin-notice-three-is-coming" class="update-nag nf-admin-notice"> <div class="nf-notice-logo"></div> <p class="nf-notice-title">THREE is coming! </p> <p class="nf-notice-body">A major update is coming to Ninja Forms. <a target="_blank" href="<?php echo $three_link; ?> ">Learn more about new features, backwards compatibility, and more Frequently Asked Questions.</a> </p> </div> <?php }
function ninja_forms_three_admin_notice(){ $settings = Ninja_Forms()->get_plugin_settings(); if( isset( $settings[ 'disable_admin_notices' ] ) && $settings[ 'disable_admin_notices' ] ) return; $currentScreen = get_current_screen(); if( ! in_array( $currentScreen->id, array( 'toplevel_page_ninja-forms' ) ) ) return; wp_enqueue_style( 'nf-admin-notices', NINJA_FORMS_URL .'assets/css/admin-notices.css?nf_ver=' . NF_PLUGIN_VERSION ); if( ninja_forms_three_calc_check() && ninja_forms_three_addons_version_check() && ninja_forms_three_addons_check() ){ ?> <div id="nf-admin-notice-upgrade" class="update-nag nf-admin-notice"> <div class="nf-notice-logo"></div> <p class="nf-notice-title">Achievement Unlocked</p> <p class="nf-notice-body"> Cowabunga! You just unlocked the Ninja Forms THREE release candidate. </p> <ul class="nf-notice-body nf-red"> <li><span class="dashicons dashicons-awards"></span><a href="<?php echo admin_url( 'admin.php?page=ninja-forms-three' ); ?>">Upgrade to the Release Candidate</a></li> </ul> </div> <? } else { include plugin_dir_path( __FILE__ ) . 'upgrade/tmpl-notice.html.php'; $three_link = nf_aff_link( 'https://ninjaforms.com/three/?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+THREE&utm_content=Learn+More' ); ?> <div id="nf-admin-notice-three-is-coming" class="update-nag nf-admin-notice"> <div class="nf-notice-logo"></div> <p class="nf-notice-title">THREE is coming! </p> <p class="nf-notice-body">A major update is coming to Ninja Forms. <a target="_blank" href="<?php echo $three_link; ?>">Learn more about new features, backwards compatibility, and more Frequently Asked Questions.</a></p> </div> <?php } }
/** * Output our notifications admin. * * @access public * * @since 2.8 * @return void */ public function output_admin() { $action = isset($_REQUEST['notification-action']) ? esc_html($_REQUEST['notification-action']) : ''; ?> <div class="wrap"> <?php if ('' == $action) { ?> <h2><?php _e('Email & Actions', 'ninja-forms'); ?> <a href="<?php echo esc_url(add_query_arg(array('notification-action' => 'new'))); ?> " class="add-new-h2"><?php _e('Add New', 'ninja-forms'); ?> </a></h2> <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> <form id="forms-filter" method="get"> <!-- For plugins, we also need to ensure that the form posts back to our current page --> <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?> " /> <input type="hidden" name="tab" value="<?php echo esc_attr($_REQUEST['tab']); ?> " /> <input type="hidden" name="form_id" value="<?php echo esc_attr($_REQUEST['form_id']); ?> " /> <?php //Create an instance of our package class... $nf_all_forms = new NF_Notifications_List_Table(); //Fetch, prepare, sort, and filter our data... $nf_all_forms->prepare_items(); // Now we can render the completed list table $nf_all_forms->display(); ?> </form> <?php } else { $id = isset($_REQUEST['id']) ? absint($_REQUEST['id']) : ''; if ($id == '') { $id = 'new'; $this_type = 'email'; $title = __('New Action', 'ninja-forms'); } else { $this_type = Ninja_Forms()->notification($id)->type; $title = __('Edit Action', 'ninja-forms') . ' - ID ' . $id; } ?> <h2><?php echo $title; ?> <a href="<?php echo esc_url(remove_query_arg(array('notification-action', 'id', 'update_message'))); ?> " class="button-secondary"><?php _e('Back To List', 'ninja-forms'); ?> </a></h2> <input type="hidden" id="notification_id" name="notification_id" value="<?php echo $id; ?> " /> <table class="form-table"> <tbody id="notification-main"> <tr> <th scope="row"><label for="setting-name"><?php _e('Action Name', 'ninja-forms'); ?> </label></th> <td><input name="settings[name]" type="text" id="settings-name" value="<?php echo nf_get_object_meta_value($id, 'name'); ?> " class="regular-text"></td> </tr> <tr> <th scope="row"><label for="type"><?php _e('Type', 'ninja-forms'); ?> </label></th> <td> <select name="settings[type]" id="settings-type"> <?php foreach ($this->get_types() as $slug => $nicename) { ?> <option value="<?php echo $slug; ?> " <?php selected($this_type, $slug); ?> ><?php echo $nicename; ?> </option> <?php } ?> </select> <span class="nf-more-actions"><a href="<?php echo nf_aff_link('https://ninjaforms.com/extensions/?display=actions&utm_medium=plugin&utm_source=action-single&utm_campaign=Ninja+Forms+Upsell&utm_content=Ninja+Forms+Actions'); ?> " target="_blank"><?php _e('Get More Actions', 'ninja-forms'); ?> <span class="dashicons dashicons-external"></span></a></span> </td> </tr> </tbody> <?php do_action('nf_edit_notification_settings', $id); foreach ($this->get_types() as $slug => $nicename) { if ($this_type == $slug) { $display = ''; } else { $display = 'display:none;'; } ?> <tbody id="notification-<?php echo $slug; ?> " class="notification-type" style="<?php echo $display; ?> "> <?php // Call our type edit screen. Ninja_Forms()->notification_types[$slug]->edit_screen($id); ?> </tbody> <?php } ?> </table> <?php } ?> </div> <?php }
public function extra_tablenav($which) { if ($which == 'bottom') { return false; } if (isset($_REQUEST['type'])) { $type = esc_html($_REQUEST['type']); } else { $type = ''; } ?> <div class="alignleft actions"> <select name="type" id="filter-type"> <option value="" <?php selected($type, ''); ?> ><?php _e('- View All Types', 'ninja-forms'); ?> </option> <?php foreach (Ninja_Forms()->notifications->get_types() as $slug => $nicename) { ?> <option value="<?php echo $slug; ?> " <?php selected($type, $slug); ?> ><?php echo $nicename; ?> </option> <?php } ?> </select> <span class="nf-more-actions"><a href="<?php echo nf_aff_link('https://ninjaforms.com/extensions/?display=actions&utm_medium=plugin&utm_source=actions-table&utm_campaign=Ninja+Forms+Upsell&utm_content=Ninja+Forms+Actions'); ?> " target="_blank"><?php _e('Get More Types', 'ninja-forms'); ?> <span class="dashicons dashicons-external"></span></a></span> <span style="float:left;" class="spinner"></span> </div> <?php }