[ 'level' => 'warning', 'disp-in-pro' => false, 'message' => sprintf(__('Please install plugin Pjax Blog Bundle to speed up your site and unlock custom options:)', 'pjax-blog'), esc_url('https://leap-in.com/plugin-pjax-blog-bundle/'), esc_url('https://leap-in.com/documents/')) ], 'learn-more' => [ 'level' => 'info', 'disp-in-pro' => true, 'message' => sprintf(__('Learn Pjax Blog More. Website | Documents.', 'pjax-blog'), esc_url('https://leap-in.com/'), esc_url('https://leap-in.com/documents/')) ], 'upgrade' => [ 'level' => 'info', 'disp-in-pro' => false, 'message' => sprintf(__('Upgrade to Pjax Blog Pro to unlock More Features!', 'pjax-blog'), esc_url('https://leap-in.com/'), esc_url('https://demo.leap-in.com/pjax-blog-1/category/features/')) ] ]; } function leapin_add_document_url_to_admin_panel() { global $pagenow; $messages = leapin_get_admin_notices(); // Only show this message on the admin dashboard and if asked for if ('index.php' === $pagenow): foreach ($messages as $id => $message){ leapin_the_dismissable_message($id, $message); } endif; } add_action('admin_notices', 'leapin_add_document_url_to_admin_panel'); /** * Register dismissal of admin notices. * * Acts on the dismiss link in the admin nag messages. * If clicked, the admin notice disappears and will no longer be visible to this user until next login. * * @since 1.6.10 */ function leapin_dismiss_notice() { if (isset($_GET['leapin-dismiss']) && check_admin_referer('leapin-dismiss-' . get_current_user_id())) { update_user_meta(get_current_user_id(), 'leapin_dismissed_notice-' . esc_attr($_GET['leapin-dismiss']), 1); } } add_action('admin_head', 'leapin_dismiss_notice'); /** * Delete dismissable nag option when user login. * * This ensures that the user(s) is/are again reminded via nag of required * and/or recommended plugins if they re-activate the theme. * * @since 1.6.10 */ function leapin_reset_dismiss_notice() { $messages = leapin_get_admin_notices(); foreach ($messages as $id => $val){ delete_metadata('user', null, 'leapin_dismissed_notice-' . $id, null, true); } } add_action('wp_login', 'leapin_reset_dismiss_notice'); function leapin_the_dismissable_message($id, $message) { $dismiss_endpoint = esc_url(wp_nonce_url(add_query_arg('leapin-dismiss', $id), 'leapin-dismiss-' . get_current_user_id())); $ms = $message['message']; $level = $message['level']; $disp_in_pro = $message['disp-in-pro']; if(!($disp_in_pro === false && leapin_is_pro())): if(!get_user_meta(get_current_user_id(), 'leapin_dismissed_notice-' . $id, 1)): ?>

', esc_attr($id), esc_attr($class), esc_attr($name), esc_attr($value), esc_attr($palette), esc_attr($default), esc_attr($show_opacity) ); } /** * @todo implement in latter version */ //function leapin_get_tax_color($tax_id_or_slug) //{ // global $leapin_vars; // $taxonomies = $leapin_vars['taxonomies']; // if (is_numeric($tax_id_or_slug)) { // $t_id = $tax_id_or_slug; // // } else { // if (array_key_exists($tax_id_or_slug, $taxonomies)) { // $t_id = $taxonomies[$tax_id_or_slug]->ID; // } // } // // // Get the custom fields based on the $presenter term ID // $custom_fields = get_option("taxonomy_term_$t_id"); // // // Return the value for the "presenter_id" custom field // $tax_color = $custom_fields['tax_color']; // // return $tax_color ? $tax_color : false; //} //function leapin_all_tax_color() //{ // global $leapin_vars; // $taxonomies = $leapin_vars['taxonomies']; // // $tax_terms = []; // foreach ($taxonomies as $tax => $tax_value) { // $terms = get_terms(['taxonomy' => $tax, 'hide_empty' => false,]); // foreach ($terms as $term) { // $t_id = $term->term_id; // // Get the custom fields based on the $presenter term ID // $custom_fields = get_option("taxonomy_term_$t_id"); // // // Return the value for the "presenter_id" custom field // $tax_color = $custom_fields['tax_color']; // // $tax_color = $tax_color ? $tax_color : false; // if ($tax_color) { // $tax_terms[$term->term_id] = $tax_color; // } // } // } // return $tax_terms; //} ?>