| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) |
| 3 |
exit; |
| 4 |
|
| 5 |
if(!function_exists('xyz_ihs_plugin_get_version')) |
| 6 |
{ |
| 7 |
function xyz_ihs_plugin_get_version() |
| 8 |
{ |
| 9 |
if ( ! function_exists( 'get_plugins' ) ) |
| 10 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 11 |
$plugin_folder = get_plugins( '/' . plugin_basename( dirname( XYZ_INSERT_HTML_PLUGIN_FILE ) ) ); |
| 12 |
return $plugin_folder['insert-html-snippet.php']['Version']; |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
if(!function_exists('xyz_ihs_run_upgrade_routines')) |
| 17 |
{ |
| 18 |
function xyz_ihs_run_upgrade_routines() { |
| 19 |
global $wpdb; |
| 20 |
if (is_multisite()) { |
| 21 |
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
| 22 |
foreach ($blog_ids as $blog_id) { |
| 23 |
switch_to_blog($blog_id); |
| 24 |
xyz_ihs_install(); |
| 25 |
wp_cache_flush(); |
| 26 |
restore_current_blog(); |
| 27 |
} |
| 28 |
} else { |
| 29 |
xyz_ihs_install(); |
| 30 |
wp_cache_flush(); |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
if(!function_exists('xyz_trim_deep')) |
| 35 |
{ |
| 36 |
|
| 37 |
function xyz_trim_deep($value) { |
| 38 |
if ( is_array($value) ) { |
| 39 |
$value = array_map('xyz_trim_deep', $value); |
| 40 |
} elseif ( is_object($value) ) { |
| 41 |
$vars = get_object_vars( $value ); |
| 42 |
foreach ($vars as $key=>$data) { |
| 43 |
$value->{$key} = xyz_trim_deep( $data ); |
| 44 |
} |
| 45 |
} else { |
| 46 |
$value = trim($value); |
| 47 |
} |
| 48 |
|
| 49 |
return $value; |
| 50 |
} |
| 51 |
|
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
if(!function_exists('xyz_ihs_links')){ |
| 56 |
function xyz_ihs_links($links, $file) { |
| 57 |
$base = plugin_basename(XYZ_INSERT_HTML_PLUGIN_FILE); |
| 58 |
if ($file == $base) { |
| 59 |
|
| 60 |
$links[] = '<a href="https://xyzscripts.com/support/" class="xyz_ihs_support" title="Support"></a>'; |
| 61 |
$links[] = '<a href="https://twitter.com/xyzscripts" class="xyz_ihs_twitt" title="Follow us on Twitter"></a>'; |
| 62 |
$links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_ihs_fbook" title="Like us on Facebook"></a>'; |
| 63 |
$links[] = '<a href="https://www.instagram.com/xyz_scripts/" class="xyz_ihs_insta" title="Follow us on Instagram+"></a>'; |
| 64 |
$links[] = '<a href="https://www.linkedin.com/company/xyzscripts" class="xyz_ihs_linkedin" title="Follow us on LinkedIn"></a>'; |
| 65 |
} |
| 66 |
return $links; |
| 67 |
} |
| 68 |
} |
| 69 |
add_filter( 'plugin_row_meta','xyz_ihs_links',10,2); |
| 70 |
|
| 71 |
?> |