test_interface('header'); // PLUGINS LIST $target_script = 'plugins.php'; if ( !$this->iscompat ) echo '

' . __('Plugins') . "

\n"; echo '
iscompat ) echo ' selected="true"'; echo ">\n"; if ( current_user_can('activate_plugins') ) { /** * @note Options cleanup and sanity check is already done by the standard * WP admin before the process and data are handed to us. The data is also * available to us in the same way, no need for double querying. */ global $current_plugins, $plugins; // from /wp-admin/plugins.php, no need for double querying $plugins_count = count($plugins); if ( isset($_GET['error']) ) { $error_plugin = ( isset($_GET['plugin']) ) ? ' (' . strip_tags($_GET['plugin']) . ')' : ''; echo '

' . __('Plugin could not be activated because it triggered a fatal error.') . $error_plugin . "

\n"; } elseif ( isset($_GET['activate']) ) { echo '

' . __('Plugin activated.') . "

\n"; } elseif ( isset($_GET['deactivate']) ) { echo '

' . __('Plugin deactivated.') . "

\n"; } // @note Not sure if we want "disable all plugins", since it also disables wphone (see other note after foreach) /* elseif (isset($_GET['deactivate-all'])) { echo '

' . __('All plugins deactivated.') . "

\n"; } */ if ( !empty($plugins) ) { $link_pattern = 'htmltarget('_blank', TRUE) . ' '; foreach($plugins as $plugin_file => $plugin_data) { if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) { $toggle_url = wp_nonce_url($target_script . "?action=deactivate&plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file); $toggle_text = __('Deactivate'); $toggled = 'true'; $plugin_data['Title'] = "{$plugin_data['Title']}"; } else { $toggle_url = wp_nonce_url($target_script . "?action=activate&plugin=$plugin_file", 'activate-plugin_' . $plugin_file); $toggle_text = __('Activate'); $toggled = 'false'; } // @note No need for as many tags allowed in mobile version $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()), 'strong' => array()); // Sanitize all displayed data $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags); $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags); $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags); $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags); if ( $this->iscompat ) { $plugin_data['Title'] = str_replace($link_pattern, $link_replace, $plugin_data['Title']); $plugin_data['Version'] = str_replace($link_pattern, $link_replace, $plugin_data['Version']); $plugin_data['Description'] = str_replace($link_pattern, $link_replace, $plugin_data['Description']); $plugin_data['Author'] = str_replace($link_pattern, $link_replace, $plugin_data['Author']); } $identifier = 'plugin-'.str_replace('.', '_', $plugin_file); if ($this->iscompat) { $onclick = "WPhone.toggleElement('$identifier-container');"; $active_button = ('true' == $toggled) ? 'grayButton' : 'whiteButton'; $this->panel_button('button', $identifier.'-toggle', strip_tags($plugin_data['Title']), $onclick, $active_button); } $active_css = ('true' == $toggled) ? 'activeplugin' : ''; echo '
'; echo '
'; echo ''; if ( FALSE == preg_match('/wphone.php$/',$plugin_file) ) { if ($this->iscompat) { echo '
ONOFF
' . "\n"; } else { echo ' [' . $toggle_text . ']'; } } echo '
'; echo '

V.' . $plugin_data['Version'] . ' - ' . $plugin_data['Author'] . ' - ' . $plugin_data['Description'] . '

'; echo "
\n"; } // @note Not sure if we want "disable all plugins", since it also disables wphone // echo 'htmltarget('_self', TRUE) . '>' . __('Deactivate All Plugins') . "\n"; } else { echo '

' . __('Couldn’t open plugins directory or there are no plugins available.') . "

\n"; } } else { echo '

' . __('Access denied.', 'wphone') . "

\n"; } echo "\n"; $this->test_interface('footer'); ?>