class.addons.php
2 weeks ago
class.functions.php
2 weeks ago
class.interface.php
2 weeks ago
class.options.php
2 weeks ago
class.terms_walker.php
2 weeks ago
class.tto.php
2 weeks ago
class.functions.php
93 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 4 | |
| 5 | class TTO_functions |
| 6 | { |
| 7 | /** |
| 8 | * Return default plugin options |
| 9 | * |
| 10 | */ |
| 11 | static public function get_settings() |
| 12 | { |
| 13 | |
| 14 | $settings = get_option('tto_options'); |
| 15 | |
| 16 | $defaults = array ( |
| 17 | 'show_reorder_interfaces' => array(), |
| 18 | 'capability' => 'manage_options', |
| 19 | 'autosort' => '1', |
| 20 | 'adminsort' => '1' |
| 21 | ); |
| 22 | $settings = wp_parse_args( $settings, $defaults ); |
| 23 | |
| 24 | return $settings; |
| 25 | |
| 26 | } |
| 27 | |
| 28 | |
| 29 | /** |
| 30 | * @desc |
| 31 | * |
| 32 | * Return UserLevel |
| 33 | * |
| 34 | */ |
| 35 | static public function userdata_get_user_level($return_as_numeric = FALSE) |
| 36 | { |
| 37 | global $userdata; |
| 38 | |
| 39 | $user_level = ''; |
| 40 | for ($i=10; $i >= 0;$i--) |
| 41 | { |
| 42 | if (current_user_can('level_' . $i) === TRUE) |
| 43 | { |
| 44 | $user_level = $i; |
| 45 | if ($return_as_numeric === FALSE) |
| 46 | $user_level = 'level_'.$i; |
| 47 | break; |
| 48 | } |
| 49 | } |
| 50 | return ($user_level); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | static public function check_table_column() |
| 55 | { |
| 56 | global $wpdb; |
| 57 | |
| 58 | //check if the menu_order column exists; |
| 59 | $query = "SHOW COLUMNS FROM $wpdb->terms |
| 60 | LIKE 'term_order'"; |
| 61 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared WordPress.DB.DirectDatabaseQuery.DirectQuery |
| 62 | $result = $wpdb->query( $query ); |
| 63 | |
| 64 | if ($result == 0) |
| 65 | { |
| 66 | $query = "ALTER TABLE $wpdb->terms ADD `term_order` INT( 4 ) NULL DEFAULT '0'"; |
| 67 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared WordPress.DB.DirectDatabaseQuery.DirectQuery |
| 68 | $result = $wpdb->query($query); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | |
| 73 | static public function info_box() |
| 74 | { |
| 75 | ?> |
| 76 | <div id="cpt_info_box"> |
| 77 | <h4><a href="https://www.nsp-code.com/premium-plugins/advanced-taxonomy-terms-order/" target="_blank"><img width="151" src="<?php echo esc_url ( TOURL . "/images/logo.png" ) ?>" class="attachment-large size-large wp-image-36927" alt=""></a><br /><?php esc_html_e( "Did you know there is an Advanced Version of this plug-in?", 'taxonomy-terms-order' ) ?> <a target="_blank" href="https://www.nsp-code.com/premium-plugins/advanced-taxonomy-terms-order/"><?php esc_html_e( "Read more", 'taxonomy-terms-order' ) ?></a></h4> |
| 78 | <p><?php esc_html_e( "Check our", 'taxonomy-terms-order' ) ?> <a target="_blank" href="https://wordpress.org/plugins/post-types-order/">Post Types Order</a> <?php esc_html_e( "plugin which allows to custom sort all posts, pages, custom post types", 'taxonomy-terms-order' ) ?> </p> |
| 79 | |
| 80 | <p><span style="color:#CC0000" class="dashicons dashicons-megaphone" alt="f488"> </span> <?php esc_html_e('Check our', 'post-types-order') ?> <a href="https://wordpress.org/plugins/wp-hide-security-enhancer/" target="_blank"><b>WP Hide & Security Enhancer</b></a> <?php esc_html_e('an extra layer of security for your site. It provides an easy way to protect your website’s code from being exploited by hiding your WordPress core files, themes, and plugins.', 'post-types-order') ?>.</p> |
| 81 | <p><span style="color:#CC0000" class="dashicons dashicons-megaphone" alt="f488"> </span> <?php esc_html_e('Check our', 'post-types-order') ?> <a href="https://wordpress.org/plugins/software-license-lite/" target="_blank"><b>Software License Lite for WooCommerce</b></a> <?php esc_html_e('A centralized licensing solution for WooCommerce that manages product licenses, delivers software updates, supports ongoing maintenance, and helps protect your code.', 'post-types-order') ?>.</p> |
| 82 | <div class="clear"></div> |
| 83 | |
| 84 | <div class="clear"></div> |
| 85 | </div> |
| 86 | |
| 87 | <?php |
| 88 | } |
| 89 | |
| 90 | } |
| 91 | |
| 92 | |
| 93 | ?> |