codepress-admin-columns
Last commit date
assets
7 years ago
classes
7 years ago
external
7 years ago
languages
7 years ago
templates
7 years ago
api.php
7 years ago
bootstrap.php
7 years ago
codepress-admin-columns.php
7 years ago
readme.txt
7 years ago
api.php
103 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @since 3.0 |
| 5 | * @return AC\AdminColumns |
| 6 | */ |
| 7 | function AC() { |
| 8 | return AC\AdminColumns::instance(); |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * @return bool True when Admin Columns Pro plugin is activated. |
| 13 | */ |
| 14 | function ac_is_pro_active() { |
| 15 | return function_exists( 'ACP' ); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Get the url where the Admin Columns website is hosted |
| 20 | * |
| 21 | * @return string |
| 22 | */ |
| 23 | function ac_get_site_url( $path = '' ) { |
| 24 | $url = 'https://www.admincolumns.com'; |
| 25 | |
| 26 | if ( ! empty( $path ) ) { |
| 27 | $url .= '/' . trim( $path, '/' ) . '/'; |
| 28 | } |
| 29 | |
| 30 | return $url; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Url with utm tags |
| 35 | * |
| 36 | * @param string $path |
| 37 | * @param string $utm_medium |
| 38 | * @param string $utm_content |
| 39 | * |
| 40 | * @return string |
| 41 | */ |
| 42 | function ac_get_site_utm_url( $path, $utm_medium, $utm_content = null, $utm_campaign = false ) { |
| 43 | $url = ac_get_site_url( $path ); |
| 44 | |
| 45 | if ( ! $utm_campaign ) { |
| 46 | $utm_campaign = 'plugin-installation'; |
| 47 | } |
| 48 | |
| 49 | $args = array( |
| 50 | // Referrer: plugin |
| 51 | 'utm_source' => 'plugin-installation', |
| 52 | |
| 53 | // Specific promotions or sales |
| 54 | 'utm_campaign' => $utm_campaign, |
| 55 | |
| 56 | // Marketing medium: banner, documentation or email |
| 57 | 'utm_medium' => $utm_medium, |
| 58 | |
| 59 | // Used for differentiation of medium |
| 60 | 'utm_content' => $utm_content, |
| 61 | ); |
| 62 | |
| 63 | $args = array_map( 'sanitize_key', array_filter( $args ) ); |
| 64 | |
| 65 | return add_query_arg( $args, $url ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Admin Columns Twitter username |
| 70 | * |
| 71 | * @return string |
| 72 | */ |
| 73 | function ac_get_twitter_handle() { |
| 74 | return 'admincolumns'; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Simple helper methods for AC_Column objects |
| 79 | * |
| 80 | * @since 3.0 |
| 81 | */ |
| 82 | function ac_helper() { |
| 83 | return new AC\Helper(); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Manually set the columns for a list screen |
| 88 | * This overrides the database settings and thus renders the settings screen for this list screen useless |
| 89 | * |
| 90 | * If you like to register a column of your own please have a look at our documentation. |
| 91 | * We also have a free start-kit available, which contains all the necessary files. |
| 92 | * |
| 93 | * Documentation: https://www.admincolumns.com/documentation/developer-docs/creating-new-column-type/ |
| 94 | * Starter-kit: https://github.com/codepress/ac-column-template/ |
| 95 | * |
| 96 | * @since 2.2 |
| 97 | * |
| 98 | * @param string|array $list_screen_key List screen key or keys |
| 99 | * @param array $column_data |
| 100 | */ |
| 101 | function ac_register_columns( $list_screen_keys, $column_data ) { |
| 102 | AC()->api()->load_columndata( $list_screen_keys, $column_data ); |
| 103 | } |