get_default_options()); } private function get_default_options() { return array( 'plugin_ver' => APFW_PLUGIN_VERSION, 'theme' => 2, 'lang' => array(1, 2, 3), 'plugin' => array(4), 'onlyOnPost' => 0, 'noAssistant' => 0, ); } /*Register our settings, using WP settings API*/ function register_plugin_settings() { register_setting(APFW_OPTION_NAME, APFW_OPTION_NAME, array($this, 'APFW_validate_options')); } function add_settings_menu() { $page_hook_suffix = add_submenu_page('options-general.php', '▲ Ank Prism For WP', 'Ank Prism For WP', 'manage_options', APFW_PLUGIN_SLUG, array($this, 'APFW_Option_Page')); /* add help drop down menu on option page wp v3.3+ */ add_action("load-$page_hook_suffix", array($this, 'add_help_menu_tab')); } function add_plugin_actions_links($links) { if (current_user_can('manage_options')) { $url = add_query_arg('page', APFW_PLUGIN_SLUG, 'options-general.php'); array_unshift( $links, sprintf('%s', esc_url($url), __('Settings')) ); } return $links; } function APFW_validate_options($in) { $out = array(); $out['plugin_ver'] = APFW_PLUGIN_VERSION; if (isset($in['theme'])) { $out['theme'] = intval($in['theme']); } else { $out['theme'] = 1; } if (isset($in['lang'])) { $out['lang'] = $in['lang']; } else { $out['lang'] = array(); add_settings_error(APFW_OPTION_NAME, 'apfw_lang', 'At-least one language must be selected to work'); } if (isset($in['plugin'])) { $out['plugin'] = $in['plugin']; } else { $out['plugin'] = array(); } $out['onlyOnPost'] = (isset($in['onlyOnPost'])) ? 1 : 0; $out['noAssistant'] = (isset($in['noAssistant'])) ? 1 : 0; //delete js and css files, will be re-created on front end $this->delete_a_file('prism-css.css'); $this->delete_a_file('prism-js.js'); return $out; } function APFW_Option_Page() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } global $Ank_Prism_For_WP_Obj; ?>

Ank Prism For WP (v)

Select a Theme

get_theme_list(); for ($i = 1; $i <= count($theme_list); $i++) { echo ''; echo '"; echo ' Preview
'; } ?>

Select Languages

get_lang_list(); for ($i = 1; $i <= count($lang_list); $i++) { echo ''; echo '"; echo ($lang_list[$i]['require'] !== '') ? ' (Requires: ' . $lang_list[$i]['require'] . ')' : ''; echo '
'; } ?>

Select Plugins

get_plugin_list(); for ($i = 1; $i <= count($plugin_list); $i++) { echo ''; echo '"; echo ' View Demo
'; } ?>

> >


Created with ♥ by Ankur Kumar | View Original Site for Demos and Instructions | Fork on GitHub

Showing Debugging Info:
'; var_dump($options); echo '


'; } ?>
add_help_tab( array( 'id' => 'apfw-overview', 'title' => 'Overview', 'content' => '

Thanks for using "Ank Prism For WP"
' . 'This plugin allows you to control and use Prism Syntax Highlighter on your website. Just configure options below and ' . 'save your settings.Then use something like this in your posts.' . '<pre><code class="language-css">p { color: red }</code></pre>' . '
You can also use in editor Prism Assistant Button.

' ) ); $curr_screen->add_help_tab( array( 'id' => 'apfw-troubleshoot', 'title' => 'Troubleshoot', 'content' => '

Things to remember' . '

' ) ); $curr_screen->add_help_tab( array( 'id' => 'apfw-more-info', 'title' => 'More', 'content' => '

Need more information ?
' . 'A brief FAQ is available here
' . 'You can also check out instructions from original developer here .
' . 'Support is only available on WordPress Forums, click here to ask anything about this plugin.
' . 'You can also report a bug at plugin's GitHub page.' . ' I will try to reply as soon as possible.

' ) ); /*help sidebar links */ $curr_screen->set_help_sidebar( '

Quick Links

' . '

Plugin FAQ

' . '

Plugin Home

' ); } public function apfw_add_editor_button() { if ($this->apfw_check_if_btn_can_be() == true) { add_filter("mce_external_plugins", array($this, "afpw_add_tinymce_plugin")); add_filter('mce_buttons', array($this, 'afpw_register_tinymce_button')); } } function afpw_register_tinymce_button($buttons) { array_push($buttons, "afpw_assist_button"); return $buttons; } function afpw_add_tinymce_plugin($plugin_array) { $plugin_array['afpw_assist_button'] = plugins_url('/apfw-editor-plugin.min.js', APFW_BASE_FILE); return $plugin_array; } function apfw_admin_inline_script($hook) { if ($this->apfw_check_if_btn_can_be() == true) { global $Ank_Prism_For_WP_Obj; $lang_list = $Ank_Prism_For_WP_Obj->get_lang_list(); echo ""; } } function apfw_admin_inline_style($hook) { if ($this->apfw_check_if_btn_can_be() == true) { ?>