PluginProbe
Image Alt Text Manager – Bulk & Dynamic Alt Tags For image SEO Optimization + AI / trunk
Image Alt Text Manager – Bulk & Dynamic Alt Tags For image SEO Optimization + AI vtrunk
1.9.5 1.9.4 1.9.3 1.9.2 1.9.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 54 releases
alt-manager / alt-manager.php

alt-manager.php in Image Alt Text Manager – Bulk & Dynamic Alt Tags For image SEO Optimization + AI trunk, at alt-manager.php

155 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @package ALM
5 * @author WPSAAD
6 * @link https://wpsaad.com
7 * @since 1.0.0
8 */
9 /**
10 * Plugin Name: Image Alt Text Manager
11 * plugin URI: https://wpsaad.com/alt-manager-wordpress-image-alt-text-plugin/
12 * Description:Automatically bulk change images alt text to dynamic alt tags values related to content or media and also generate empty values for both alt and title tags.
13 * Version: 1.9.6
14 * Author: WPSAAD
15 * Author URI: https://wpsaad.com
16 * License: GPLv2 or later
17 * Text Domain: alt-manager
18 * Domain Path: /languages
19 */
20 defined( 'ABSPATH' ) or die;
21 if ( function_exists( 'am_fs' ) ) {
22 am_fs()->set_basename( false, __FILE__ );
23 } else {
24 if ( !function_exists( 'am_fs' ) ) {
25 // Create a helper function for easy SDK access.
26 function am_fs() {
27 global $am_fs;
28 if ( !isset( $am_fs ) ) {
29 // Include Freemius SDK.
30 require_once dirname( __FILE__ ) . '/freemius/start.php';
31 $am_fs = fs_dynamic_init( array(
32 'id' => '5548',
33 'slug' => 'alt-manager',
34 'type' => 'plugin',
35 'navigation' => 'tabs',
36 'public_key' => 'pk_07c4f76da780308f88546ce3da78a',
37 'is_premium' => false,
38 'premium_suffix' => 'premium plan',
39 'has_addons' => false,
40 'has_paid_plans' => true,
41 'menu' => array(
42 'slug' => 'alt-manager',
43 'parent' => array(
44 'slug' => 'options-general.php',
45 ),
46 ),
47 'is_live' => true,
48 'is_org_compliant' => true,
49 ) );
50 }
51 return $am_fs;
52 }
53
54 // Init Freemius.
55 am_fs();
56 // Signal that SDK was initiated.
57 do_action( 'am_fs_loaded' );
58 }
59 //check if we are on plugin page to load styles only there
60 global $plugin_page;
61 $current_page = ( isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '' );
62 if ( $plugin_page === 'alt-manager' || $current_page === 'alt-manager' ) {
63 //add style
64 add_action( 'admin_enqueue_scripts', 'alm_style' );
65 }
66 /**
67 * Enqueue admin scripts and styles
68 *
69 * @return void
70 */
71 function alm_style() {
72 wp_enqueue_script( 'switcher-script', plugins_url( '/assets/js/jquery.switcher.min.js', __FILE__ ) );
73 wp_enqueue_style( 'switcher-style', plugins_url( '/assets/css/switcher.css', __FILE__ ) );
74 wp_enqueue_script( 'select2-script', plugins_url( '/assets/js/select2.min.js', __FILE__ ) );
75 wp_enqueue_style( 'select2-style', plugins_url( '/assets/css/select2.min.css', __FILE__ ) );
76 wp_enqueue_script( 'alm-admin-script', plugins_url( '/assets/js/alm-admin.js', __FILE__ ) );
77 wp_enqueue_style( 'alm-admin-style', plugins_url( '/assets/css/alm-admin-styles.css', __FILE__ ) );
78 if ( is_rtl() ) {
79 wp_enqueue_style( 'alm-admin-style-rtl', plugins_url( '/assets/css/alm-admin-styles-rtl.css', __FILE__ ) );
80 }
81 // wp_enqueue_script('jquery-ui-sortable');
82 }
83
84 /**
85 * Get option value (multisite compatible)
86 *
87 * @param string $option Option name.
88 * @param mixed $default Default value.
89 * @return mixed Option value.
90 */
91 function alm_get_option( $option, $default = false ) {
92 if ( is_multisite() && is_network_admin() ) {
93 return get_site_option( $option, $default );
94 }
95 return get_option( $option, $default );
96 }
97
98 /**
99 * Update option value (multisite compatible)
100 *
101 * @param string $option Option name.
102 * @param mixed $value Option value.
103 * @return bool True on success, false on failure.
104 */
105 function alm_update_option( $option, $value ) {
106 if ( is_multisite() && is_network_admin() ) {
107 return update_site_option( $option, $value );
108 }
109 return update_option( $option, $value );
110 }
111
112 //load plugin required files
113 add_action( 'init', 'alm_load' );
114 /**
115 * Load plugin required files
116 *
117 * @return void
118 */
119 function alm_load() {
120 require_once plugin_dir_path( __FILE__ ) . 'inc/alm-functions.php';
121 require_once plugin_dir_path( __FILE__ ) . 'inc/alm-empty-generator.php';
122 if ( is_admin() ) {
123 // Always load settings registration in admin context so admin_init hooks run for all admin requests
124 include_once plugin_dir_path( __FILE__ ) . 'inc/alm-settings.php';
125 if ( user_can( get_current_user_id(), 'manage_options' ) ) {
126 include_once plugin_dir_path( __FILE__ ) . 'inc/alm-admin.php';
127 }
128 }
129 if ( !function_exists( 'file_get_html' ) ) {
130 require_once plugin_dir_path( __FILE__ ) . 'inc/simple_html_dom.php';
131 }
132 }
133
134 //Activation & Reset
135 //Generate activaition class
136 if ( !class_exists( 'almActivate' ) ) {
137 require_once plugin_dir_path( __FILE__ ) . 'inc/alm-activate.php';
138 }
139 //Activation Hook
140 register_activation_hook( __FILE__, array('almActivate', 'activate') );
141 add_action( 'admin_init', 'admin_page_functions' );
142 /**
143 * Handle admin page functions and actions
144 *
145 * @return void
146 */
147 function admin_page_functions() {
148 //Reset Action
149 if ( user_can( get_current_user_id(), 'manage_options' ) && isset( $_REQUEST['reset'] ) && isset( $_POST['reset_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['reset_nonce'] ) ), 'alm_reset_nonce' ) ) {
150 $activate_reset = new almActivate();
151 $activate_reset->reset();
152 }
153 }
154
155 }