acf-extended
Last commit date
assets
5 years ago
includes
5 years ago
acf-extended.php
5 years ago
init.php
5 years ago
readme.txt
5 years ago
init.php
89 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')) |
| 4 | exit; |
| 5 | |
| 6 | /** |
| 7 | * ACFE: Include |
| 8 | * |
| 9 | * @param string $filename |
| 10 | */ |
| 11 | function acfe_include($filename = ''){ |
| 12 | |
| 13 | $file_path = ACFE_PATH . ltrim($filename, '/'); |
| 14 | |
| 15 | if(file_exists($file_path)){ |
| 16 | |
| 17 | include_once($file_path); |
| 18 | |
| 19 | } |
| 20 | |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * ACFE: Get URL |
| 25 | * |
| 26 | * @param string $filename |
| 27 | * |
| 28 | * @return string |
| 29 | */ |
| 30 | function acfe_get_url($filename = ''){ |
| 31 | |
| 32 | if(!defined('ACFE_URL')){ |
| 33 | |
| 34 | define('ACFE_URL', acf_get_setting('acfe/url')); |
| 35 | |
| 36 | } |
| 37 | |
| 38 | return ACFE_URL . ltrim($filename, '/'); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * ACFE: ACF Pro Check |
| 43 | * |
| 44 | * @param $plugin_file |
| 45 | * @param $plugin_data |
| 46 | * @param $status |
| 47 | */ |
| 48 | add_action('after_plugin_row_' . ACFE_BASENAME, 'acfe_plugin_row', 5, 3); |
| 49 | function acfe_plugin_row($plugin_file, $plugin_data, $status){ |
| 50 | |
| 51 | if(acfe()->has_acf()) |
| 52 | return; |
| 53 | |
| 54 | $colspan = 4; |
| 55 | if(acf_version_compare($GLOBALS['wp_version'], '<', '5.5')) |
| 56 | $colspan = 3; |
| 57 | |
| 58 | ?> |
| 59 | |
| 60 | <style> |
| 61 | .plugins tr[data-plugin='<?php echo ACFE_BASENAME; ?>'] th, |
| 62 | .plugins tr[data-plugin='<?php echo ACFE_BASENAME; ?>'] td{ |
| 63 | box-shadow:none; |
| 64 | } |
| 65 | |
| 66 | <?php if(isset($plugin_data['update']) && !empty($plugin_data['update'])){ ?> |
| 67 | |
| 68 | .plugins tr.acfe-plugin-tr td{ |
| 69 | box-shadow:none !important; |
| 70 | } |
| 71 | |
| 72 | .plugins tr.acfe-plugin-tr .update-message{ |
| 73 | margin-bottom:0; |
| 74 | } |
| 75 | |
| 76 | <?php } ?> |
| 77 | </style> |
| 78 | |
| 79 | <tr class="plugin-update-tr active acfe-plugin-tr"> |
| 80 | <td colspan="<?php echo $colspan; ?>" class="plugin-update colspanchange"> |
| 81 | <div class="update-message notice inline notice-error notice-alt"> |
| 82 | <p><?php _e('ACF Extended requires <a href="https://www.advancedcustomfields.com/pro/" target="_blank">Advanced Custom Fields PRO</a> (minimum: 5.8).', 'acfe'); ?></p> |
| 83 | </div> |
| 84 | </td> |
| 85 | </tr> |
| 86 | |
| 87 | <?php |
| 88 | |
| 89 | } |