delete_compiled_templates(); // Arguments $page['tab'] = (isset($_GET['tab']) ? $_GET['tab'] : 'social_plugin'); // Data $base_url = get_admin_plugin_menu_link(__FILE__); $picture_url_type = array('page', 'image'); $picture_url_type_l10n = array_map('l10n', $picture_url_type); $layout = array('standard', 'button_count', 'box_count'); $layout_l10n = array_map('l10n', $layout); $action = array('like', 'recommend'); $action_l10n = array_map('l10n', $action); $colorscheme = array('light', 'dark'); $colorscheme_l10n = array_map('l10n', $colorscheme); // Tabsheet $tabsheet = new tabsheet(); $tabsheet->add('social_plugin', l10n('Social plugins'), add_url_params($base_url, array('tab' => 'social_plugin'))); $tabsheet->add('advanced', l10n('Advanced'), add_url_params($base_url, array('tab' => 'advanced'))); $tabsheet->select($page['tab']); $tabsheet->assign(); // Update if (isset($_POST['submit'])) { switch ($page['tab']) { case 'social_plugin' : { // Like button $conf['fbp']['social_plugin_like_button']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']) ? false : true; $conf['fbp']['social_plugin_like_button']['layout'] = $layout[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT']]; $conf['fbp']['social_plugin_like_button']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES']) ? false : true; $conf['fbp']['social_plugin_like_button']['action'] = $action[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ACTION']]; $conf['fbp']['social_plugin_like_button']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_COLORSCHEME']]; // Facepile $conf['fbp']['social_plugin_facepile']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_ENABLED']) ? false : true; $conf['fbp']['social_plugin_facepile']['max_rows'] = intval($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_MAX_ROWS']); // Comments $conf['fbp']['social_plugin_comments']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED']) ? false : true; $conf['fbp']['social_plugin_comments']['numposts'] = intval($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_NUMPOSTS']); $conf['fbp']['social_plugin_comments']['title'] = $_POST['FBP_SOCIAL_PLUGIN_COMMENTS_TITLE']; $conf['fbp']['social_plugin_comments']['simple'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_SIMPLE']) ? false : true; $conf['fbp']['social_plugin_comments']['reverse'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_REVERSE']) ? false : true; $conf['fbp']['social_plugin_comments']['publish_feed'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_PUBLISH_FEED']) ? false : true; // Like box $conf['fbp']['social_plugin_like_box']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED']) ? false : true; $conf['fbp']['social_plugin_like_box']['url'] = $_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_URL']; $conf['fbp']['social_plugin_like_box']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_COLORSCHEME']]; $conf['fbp']['social_plugin_like_box']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_SHOW_FACES']) ? false : true; $conf['fbp']['social_plugin_like_box']['stream'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_STREAM']) ? false : true; $conf['fbp']['social_plugin_like_box']['header'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_HEADER']) ? false : true; break; } case 'advanced' : { $conf['fbp']['facebook_app_id'] = $_POST['FBP_FACEBOOK_APP_ID']; $conf['fbp']['async_script'] = empty($_POST['FBP_ASYNC_SCRIPT']) ? false : true; $conf['fbp']['picture_url_type'] = $picture_url_type[$_POST['FBP_PICTURE_URL_TYPE']]; $conf['fbp']['allow_fb_access_private_page'] = empty($_POST['FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE']) ? false : true; break; } } $query = ' update '.CONFIG_TABLE.' set value = \''.serialize($conf['fbp']).'\' where param = \'fbp\' ;'; if (pwg_query($query)) { array_push($page['infos'], l10n('Data updated with success')); } else { array_push($page['errors'], l10n('Data updated with error')); } } // Display switch ($page['tab']) { case 'social_plugin' : { $template->assign( $page['tab'], array( 'like_button' => array ( 'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/like/', 'ENABLED' => ($conf['fbp']['social_plugin_like_button']['enabled'] ? 'checked="checked"' : ''), 'LAYOUT_OPTIONS' => $layout_l10n, 'LAYOUT_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['layout'], $layout), 'SHOW_FACES' => ($conf['fbp']['social_plugin_like_button']['show_faces'] ? 'checked="checked"' : ''), 'ACTION_OPTIONS' => $action_l10n, 'ACTION_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['action'], $action), 'COLORSCHEME_OPTIONS' => $colorscheme_l10n, 'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['colorscheme'], $colorscheme), ), 'facepile' => array ( 'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/facepile/', 'ENABLED' => ($conf['fbp']['social_plugin_facepile']['enabled'] ? 'checked="checked"' : ''), 'MAX_ROWS' => $conf['fbp']['social_plugin_facepile']['max_rows'], ), 'comments' => array ( 'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/comments/', 'ENABLED' => ($conf['fbp']['social_plugin_comments']['enabled'] ? 'checked="checked"' : ''), 'NUMPOSTS' => $conf['fbp']['social_plugin_comments']['numposts'], 'TITLE' => $conf['fbp']['social_plugin_comments']['title'], 'SIMPLE' => ($conf['fbp']['social_plugin_comments']['simple'] ? 'checked="checked"' : ''), 'REVERSE' => ($conf['fbp']['social_plugin_comments']['reverse'] ? 'checked="checked"' : ''), 'PUBLISH_FEED' => ($conf['fbp']['social_plugin_comments']['publish_feed'] ? 'checked="checked"' : ''), ), 'like_box' => array ( 'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/like-box/', 'ENABLED' => ($conf['fbp']['social_plugin_like_box']['enabled'] ? 'checked="checked"' : ''), 'URL' => $conf['fbp']['social_plugin_like_box']['url'], 'COLORSCHEME_OPTIONS' => $colorscheme_l10n, 'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_box']['colorscheme'], $colorscheme), 'SHOW_FACES' => ($conf['fbp']['social_plugin_like_box']['show_faces'] ? 'checked="checked"' : ''), 'STREAM' => ($conf['fbp']['social_plugin_like_box']['stream'] ? 'checked="checked"' : ''), 'HEADER' => ($conf['fbp']['social_plugin_like_box']['header'] ? 'checked="checked"' : ''), ), )); break; } case 'advanced' : { $template->assign( $page['tab'], array( 'FBP_FACEBOOK_APP_ID' => $conf['fbp']['facebook_app_id'], 'FBP_ASYNC_SCRIPT' => ($conf['fbp']['async_script'] ? 'checked="checked"' : ''), 'FBP_PICTURE_URL_TYPE_OPTIONS' => $picture_url_type_l10n, 'FBP_PICTURE_URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['picture_url_type'], $picture_url_type), 'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''), )); break; } } /*$template->assign( array( 'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''), //~ 'FBP_DAY_NUMBER'=> $conf['fbp']['day_number'], ));*/ $template->set_filename('plugin_admin_content', FBP_DIR.'/tpl/admin.config.tpl'); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>