adadaa_core = $adadaa_core;
if (!$this->adadaa_core) {
$this->adadaa_core = new adadaa_core();
}
$this->plugin_url = $this->adadaa_core->ada_url(__FILE__);
$this->plugin_dir = $this->adadaa_core->ada_dir(__FILE__);
$this->adadaa_plugin_name = 'ada_tamil_writer';
add_action('init', array(&$this, 'adadaa_init'));
add_filter('wpabar_defaults', array(&$this, 'wpabar_defaults'));
$this->lang_key_position = 'rightleft';
if ($this->lang_key_position == 'leftright') {
add_action('admin_bar_menu', array(&$this, 'ada_tamil_typing'), 99);
} else {
add_action('admin_bar_menu', array(&$this, 'ada_tamil_typing'), 0);
}
}
function wp_admin_bar_style() {
// Only enqueue the style if the admin bar is showing
if (is_admin_bar_showing()) {
$plugin_dir = plugin_dir_url(__FILE__);
wp_enqueue_style('ada-admin-style', $this->plugin_url . 'assets/css/admin-style.css',array(),'1.0.0','all');
}
}
public function before_admin_bar_render() {
ob_start();
}
function adadaa_init() {
$plugin_dir = plugin_dir_url(__FILE__);
wp_enqueue_script('ada_script_wpabar', $this->plugin_url . '/assets/js/ada_wpabar.js', array(), '1.0.0', true );
}
function wpabar_defaults($res) {
$res['hide'] = unserialize('a:14:{s:9:"index.php";a:5:{i:0;b:1;s:9:"index.php";b:1;s:22:"popularity-contest.php";b:1;s:21:"akismet-stats-display";b:1;s:7:"myblogs";b:1;}s:3:"seo";a:14:{i:0;b:1;s:3:"seo";b:1;s:7:"su-404s";b:1;s:12:"su-canonical";b:1;s:22:"su-competition-queries";b:1;s:8:"su-files";b:1;s:23:"su-site-keyword-queries";b:1;s:10:"su-linkbox";b:1;s:7:"su-meta";b:1;s:13:"su-more-links";b:1;s:10:"su-noindex";b:1;s:8:"su-slugs";b:1;s:9:"su-titles";b:1;s:11:"su-sds-blog";b:1;}s:14:"wpmu-admin.php";a:15:{i:0;b:1;s:14:"wpmu-admin.php";b:1;s:14:"wpmu-blogs.php";b:1;s:14:"wpmu-users.php";b:1;s:15:"wpmu-themes.php";b:1;s:16:"wpmu-options.php";b:1;s:21:"wpmu-upgrade-site.php";b:1;s:34:"cets_blog_defaults_management_page";b:1;s:21:"ah-theme-stats-mu.php";b:1;s:16:"gb_templates.php";b:1;s:20:"signup_question_main";b:1;s:21:"wp_ozh_whoseesads.php";b:1;s:23:"cets_bc_management_page";b:1;s:12:"wpsupercache";b:1;s:18:"wpmu_sitewide_feed";b:1;}s:8:"edit.php";a:2:{s:31:"edit-tags.php?taxonomy=post_tag";b:1;s:14:"categories.php";b:1;}s:10:"upload.php";a:3:{i:0;b:1;s:10:"upload.php";b:1;s:13:"media-new.php";b:1;}s:16:"link-manager.php";a:4:{i:0;b:1;s:16:"link-manager.php";b:1;s:12:"link-add.php";b:1;s:24:"edit-link-categories.php";b:1;}s:14:"edit-pages.php";a:3:{i:0;b:1;s:14:"edit-pages.php";b:1;s:12:"page-new.php";b:1;}s:10:"themes.php";a:5:{i:0;b:1;s:10:"themes.php";b:1;s:11:"widgets.php";b:1;s:17:"theme-install.php";b:1;s:13:"functions.php";b:1;}s:11:"plugins.php";a:4:{i:0;b:1;s:11:"plugins.php";b:1;s:18:"plugin-install.php";b:1;s:18:"akismet-key-config";b:1;}s:9:"users.php";a:4:{i:0;b:1;s:9:"users.php";b:1;s:12:"user-new.php";b:1;s:11:"profile.php";b:1;}s:9:"tools.php";a:6:{i:0;b:1;s:9:"tools.php";b:1;s:10:"import.php";b:1;s:10:"export.php";b:1;s:20:"custom_anti_spam.php";b:1;s:28:"wordpress-admin-bar-improved";b:1;}s:19:"options-general.php";a:18:{s:19:"options-general.php";b:1;s:19:"options-writing.php";b:1;s:19:"options-reading.php";b:1;s:22:"options-discussion.php";b:1;s:17:"options-media.php";b:1;s:19:"options-privacy.php";b:1;s:21:"options-permalink.php";b:1;s:33:"mm-email2image/mm-email2image.php";b:1;s:16:"nofollowfree.php";b:1;s:12:"seo-ultimate";b:1;s:25:"bbpress-integration-admin";b:1;s:10:"publishing";b:1;s:27:"nofollow-links-in-posts.php";b:1;s:12:"wpsupercache";b:1;s:21:"auto-tag/auto-tag.php";b:1;s:22:"popularity-contest.php";b:1;s:34:"wp-postviews/postviews-options.php";b:1;s:26:"wp-print/print-options.php";b:1;}s:29:"feedwordpress/syndication.php";a:7:{i:0;b:1;s:29:"feedwordpress/syndication.php";b:1;s:28:"feedwordpress/feeds-page.php";b:1;s:28:"feedwordpress/posts-page.php";b:1;s:30:"feedwordpress/authors-page.php";b:1;s:33:"feedwordpress/categories-page.php";b:1;s:30:"feedwordpress/backend-page.php";b:1;}s:38:"wp-postratings/postratings-manager.php";a:5:{i:0;b:1;s:38:"wp-postratings/postratings-manager.php";b:1;s:38:"wp-postratings/postratings-options.php";b:1;s:40:"wp-postratings/postratings-templates.php";b:1;s:40:"wp-postratings/postratings-uninstall.php";b:1;}}');
return $res;
}
function ada_tamil_typing($wp_admin_bar) {
global $current_site;
global $user_login;
$roman_keybrd = '';
$typewriter_keybrd = '';
$tamil99_keybrd = '';
$english_keybrd = '';
$typewriter_class = '';
$tamil99_class = '';
$english_class = '';
$roman_class = '';
if (get_option('WPLANG') == 'Tamil')
$this->adadaa_defaults = array(
'adadaa_ukeybrd' => 'roman',
);
else
$this->adadaa_defaults = array(
'adadaa_ukeybrd' => 'english',
);
$username = $user_login;
if (!$username)
//$username = (function_exists('mb_strtolower')) ? mb_strtolower($_REQUEST['log']) : strtolower($_REQUEST['log']);
$adadaa_site_options = unserialize(get_site_option($this->adadaa_plugin_name . "_plugin"));
if (!empty($adadaa_site_options[$username])) {
$curkeybrd = $adadaa_site_options[$username]['adadaa_ukeybrd'];
} else {
$curkeybrd = $this->adadaa_defaults['adadaa_ukeybrd'];
}
if ('typewriter' == $curkeybrd) {
$typewriter_keybrd = "checked";
$typewriter_class = " class=\"wpabar-menuhover\"";
} else if ('tamil99' == $curkeybrd) {
$tamil99_keybrd = "checked";
$tamil99_class = " class=\"wpabar-menuhover\"";
} else if ('roman' == $curkeybrd) {
$roman_keybrd = "checked";
$roman_class = " class=\"wpabar-menuhover\"";
} else if ('english' == $curkeybrd) {
$english_keybrd = "checked";
$english_class = " class=\"wpabar-menuhover\"";
}
$this->wp_admin_bar_style();
$this->adadaa_core = new adadaa_core();
$this->adadaa_core->ada_plugin_dir = $this->plugin_dir;
$this->adadaa_core->adadaa_plugin_name = $this->adadaa_plugin_name;
$target = "_blank";
$logo_url1 = esc_url(plugin_dir_url(__FILE__) . 'assets/images/logotamil.png');
$wp_admin_bar->add_menu(array(
'id' => 'tamil_typing',
'title' => sprintf(
'%s',
esc_url($logo_url1),
esc_attr__('Ada Tamil Writer Logo', 'ada-tamil-writer'),
esc_html__('Ada Tamil Writer', 'ada-tamil-writer')
),
'href' => get_option('siteurl') . '/wp-admin/admin.php?page=Adadaa_tamil_writer',
'meta' => array(
'title' => esc_html__('Tamil Typing', 'ada-tamil-writer')
)
));
if ($this->lang_key_position == 'leftright') {
$wp_admin_bar->add_menu(array(
'id' => 'typewriter',
'title' => esc_html__('Typewriter', 'ada-tamil-writer'),
'href' => "#typewriter",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'Typewriter' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., Typewriter */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('Typewriter', 'ada-tamil-writer')
)
)
));
$wp_admin_bar->add_menu(array(
'id' => 'tamil99',
'title' => esc_html__('Tamil99', 'ada-tamil-writer'),
'href' => "#tamil99",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'Tamil99' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., Tamil99 */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('Tamil99', 'ada-tamil-writer')
)
)
));
$wp_admin_bar->add_menu(array(
'id' => 'roman',
'title' => esc_html__('Thaminglish', 'ada-tamil-writer'),
'href' => "#roman",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'Thaminglish' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., Thaminglish */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('Thaminglish', 'ada-tamil-writer')
)
)
));
$wp_admin_bar->add_menu(array(
'id' => 'english',
'title' => esc_html__('English', 'ada-tamil-writer'),
'href' => "#english",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'English' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., English */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('English', 'ada-tamil-writer')
)
)
));
} else {
// Repeat same logic for the other layout
$wp_admin_bar->add_menu(array(
'id' => 'english',
'title' => esc_html__('English', 'ada-tamil-writer'),
'href' => "#english",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'English' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., English */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('English', 'ada-tamil-writer')
)
)
));
$wp_admin_bar->add_menu(array(
'id' => 'roman',
'title' => esc_html__('Thaminglish', 'ada-tamil-writer'),
'href' => "#roman",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'Thaminglish' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., Thaminglish */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('Thaminglish', 'ada-tamil-writer')
)
)
));
$wp_admin_bar->add_menu(array(
'id' => 'tamil99',
'title' => esc_html__('Tamil99', 'ada-tamil-writer'),
'href' => "#tamil99",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'Tamil99' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., Tamil99 */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('Tamil99', 'ada-tamil-writer')
)
)
));
$wp_admin_bar->add_menu(array(
'id' => 'typewriter',
'title' => esc_html__('Typewriter', 'ada-tamil-writer'),
'href' => "#typewriter",
'meta' => array(
'onclick' => "itemSelected(this); toggleKBMode(event,this); return false;",
/* translators: %s refers to the keyboard type, which is 'Typewriter' in this case */
'title' => sprintf(
/* translators: %s is the keyboard name, e.g., Typewriter */
esc_html__('Click to select %s keyboard', 'ada-tamil-writer'),
esc_html__('Typewriter', 'ada-tamil-writer')
)
)
));
}
}
}
new Adadaa_wordpress_admin_bar_improved();
}
function adadaa_recommend_classic_editor_notice() {
// Check if the notice has already been shown
$notice_shown = get_option('adadaa_classic_editor_notice_shown');
// If the notice hasn't been shown yet, display it
if (!$notice_shown) {
$message = wp_kses(
'For optimal performance, we recommend using the Classic Editor plugin with Ada Tamil Writer.',
array(
'a' => array(
'href' => array(),
'target' => array(),
),
'strong' => array(),
)
);
echo '
';
echo '
' . esc_html($message) . '
';
echo '
';
// Set the option to indicate that the notice has been shown
update_option('adadaa_classic_editor_notice_shown', true);
}
}
// Hook to display the admin notice
add_action('admin_notices', 'adadaa_recommend_classic_editor_notice');
?>