Ignore:
Timestamp:
Dec 29, 2010, 11:45:21 PM (13 years ago)
Author:
rub
Message:

Add social plugin activity feed
Add convert function on admin page config
Add missing options on social plugins
Add activity tab sheet on admin config page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/admin.config.php

    r8375 r8386  
    5454               l10n('Advanced'),
    5555               add_url_params($base_url, array('tab' => 'advanced')));
     56$tabsheet->add('activity',
     57               l10n('Activity'),
     58               add_url_params($base_url, array('tab' => 'activity')));
    5659$tabsheet->select($page['tab']);
    5760$tabsheet->assign();
     61
     62function fbp_intval($n)
     63{
     64  return (is_numeric($n) ? $n : null);
     65}
     66
     67function fbp_checked($b)
     68{
     69  return ($b ? 'checked="checked"' : '');
     70}
    5871
    5972// Update
     
    6780    {
    6881      // Like button
    69       $conf['fbp']['social_plugin_like_button']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']) ? false : true;
     82      $conf['fbp']['social_plugin_like_button']['enabled'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']);
    7083      $conf['fbp']['social_plugin_like_button']['layout'] = $layout[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT']];
    71       $conf['fbp']['social_plugin_like_button']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES']) ? false : true;
     84      $conf['fbp']['social_plugin_like_button']['show_faces'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES']);
    7285      $conf['fbp']['social_plugin_like_button']['action'] = $action[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ACTION']];
    7386      $conf['fbp']['social_plugin_like_button']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_COLORSCHEME']];
    7487      // Facepile
    75       $conf['fbp']['social_plugin_facepile']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_ENABLED']) ? false : true;
     88      $conf['fbp']['social_plugin_facepile']['enabled'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_ENABLED']);
    7689      $conf['fbp']['social_plugin_facepile']['max_rows'] = intval($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_MAX_ROWS']);
    7790      // Comments
    78       $conf['fbp']['social_plugin_comments']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED']) ? false : true;
    79       $conf['fbp']['social_plugin_comments']['numposts'] = intval($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_NUMPOSTS']);
     91      $conf['fbp']['social_plugin_comments']['enabled'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED']);
     92      $conf['fbp']['social_plugin_comments']['numposts'] = fbp_intval($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_NUMPOSTS']);
    8093      $conf['fbp']['social_plugin_comments']['title'] = $_POST['FBP_SOCIAL_PLUGIN_COMMENTS_TITLE'];
    81       $conf['fbp']['social_plugin_comments']['simple'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_SIMPLE']) ? false : true;
    82       $conf['fbp']['social_plugin_comments']['reverse'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_REVERSE']) ? false : true;
    83       $conf['fbp']['social_plugin_comments']['publish_feed'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_PUBLISH_FEED']) ? false : true;
     94      $conf['fbp']['social_plugin_comments']['simple'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_SIMPLE']);
     95      $conf['fbp']['social_plugin_comments']['reverse'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_REVERSE']);
     96      $conf['fbp']['social_plugin_comments']['publish_feed'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_PUBLISH_FEED']);
     97      // Actvity feed
     98      $conf['fbp']['social_plugin_activity_feed']['enabled'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_ACTIVITY_FEED_ENABLED']);
     99      $conf['fbp']['social_plugin_activity_feed']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_ACTIVITY_FEED_COLORSCHEME']];
     100      $conf['fbp']['social_plugin_activity_feed']['recommendations'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_ACTIVITY_FEED_RECOMMENDATIONS']);
     101      $conf['fbp']['social_plugin_activity_feed']['header'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_ACTIVITY_FEED_HEADER']);
     102      $conf['fbp']['social_plugin_activity_feed']['height'] = fbp_intval($_POST['FBP_SOCIAL_PLUGIN_ACTIVITY_FEED_HEIGHT']);
    84103      // Like box
    85       $conf['fbp']['social_plugin_like_box']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED']) ? false : true;
     104      $conf['fbp']['social_plugin_like_box']['enabled'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED']);
    86105      $conf['fbp']['social_plugin_like_box']['url'] = $_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_URL'];
    87106      $conf['fbp']['social_plugin_like_box']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_COLORSCHEME']];
    88       $conf['fbp']['social_plugin_like_box']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_SHOW_FACES']) ? false : true;
    89       $conf['fbp']['social_plugin_like_box']['stream'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_STREAM']) ? false : true;
    90       $conf['fbp']['social_plugin_like_box']['header'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_HEADER']) ? false : true;
    91      
     107      $conf['fbp']['social_plugin_like_box']['show_faces'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_SHOW_FACES']);
     108      $conf['fbp']['social_plugin_like_box']['stream'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_STREAM']);
     109      $conf['fbp']['social_plugin_like_box']['header'] = ! empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_HEADER']);
     110      $conf['fbp']['social_plugin_like_box']['height'] = fbp_intval($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_HEIGHT']);
     111
    92112      // Check
    93113      if ($conf['fbp']['social_plugin_like_button']['enabled'] and $conf['fbp']['social_plugin_comments']['enabled'])
     
    103123    {
    104124      $conf['fbp']['facebook_app_id'] = $_POST['FBP_FACEBOOK_APP_ID'];
    105       $conf['fbp']['async_script'] = empty($_POST['FBP_ASYNC_SCRIPT']) ? false : true;
    106       $conf['fbp']['force_facebook_init'] = empty($_POST['FBP_FORCE_FACEBOOK_INIT']) ? false : true;
     125      $conf['fbp']['async_script'] = ! empty($_POST['FBP_ASYNC_SCRIPT']);
     126      $conf['fbp']['force_facebook_init'] = ! empty($_POST['FBP_FORCE_FACEBOOK_INIT']);
    107127      $conf['fbp']['picture_url_type'] = $picture_url_type[$_POST['FBP_PICTURE_URL_TYPE']];
    108       $conf['fbp']['allow_fb_access_private_page'] = empty($_POST['FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE']) ? false : true;
    109       $conf['fbp']['add_about_informations'] = empty($_POST['FBP_ADD_ABOUT_INFORMATIONS']) ? false : true;
    110       $conf['fbp']['add_group_footer'] = empty($_POST['FBP_ADD_GROUP_FOOTER']) ? false : true;
    111       $conf['fbp']['add_application_footer'] = empty($_POST['FBP_ADD_APPLICATION_FOOTER']) ? false : true;
     128      $conf['fbp']['allow_fb_access_private_page'] = ! empty($_POST['FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE']);
     129      $conf['fbp']['add_about_informations'] = ! empty($_POST['FBP_ADD_ABOUT_INFORMATIONS']);
     130      $conf['fbp']['add_group_footer'] = ! empty($_POST['FBP_ADD_GROUP_FOOTER']);
     131      $conf['fbp']['add_application_footer'] = ! empty($_POST['FBP_ADD_APPLICATION_FOOTER']);
    112132      break;
    113133    }
     
    145165          (
    146166            'FB_PAGE' => FACEBOOK_DOC_PLUGINS_URL.'/like/',
    147             'ENABLED' => ($conf['fbp']['social_plugin_like_button']['enabled'] ? 'checked="checked"' : ''),
     167            'ENABLED' => fbp_checked($conf['fbp']['social_plugin_like_button']['enabled']),
    148168            'LAYOUT_OPTIONS' => $layout_l10n,
    149169            'LAYOUT_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['layout'], $layout),
    150             'SHOW_FACES' => ($conf['fbp']['social_plugin_like_button']['show_faces'] ? 'checked="checked"' : ''),
     170            'SHOW_FACES' => fbp_checked($conf['fbp']['social_plugin_like_button']['show_faces']),
    151171            'ACTION_OPTIONS' => $action_l10n,
    152172            'ACTION_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['action'], $action),
     
    157177          (
    158178            'FB_PAGE' => FACEBOOK_DOC_PLUGINS_URL.'/facepile/',
    159             'ENABLED' => ($conf['fbp']['social_plugin_facepile']['enabled'] ? 'checked="checked"' : ''),
     179            'ENABLED' => fbp_checked($conf['fbp']['social_plugin_facepile']['enabled']),
    160180            'MAX_ROWS' => $conf['fbp']['social_plugin_facepile']['max_rows'],
    161181          ),
     
    163183          (
    164184            'FB_PAGE' => FACEBOOK_DOC_PLUGINS_URL.'/comments/',
    165             'ENABLED' => ($conf['fbp']['social_plugin_comments']['enabled'] ? 'checked="checked"' : ''),
     185            'ENABLED' => fbp_checked($conf['fbp']['social_plugin_comments']['enabled']),
    166186            'NUMPOSTS' => $conf['fbp']['social_plugin_comments']['numposts'],
    167187            'TITLE' => $conf['fbp']['social_plugin_comments']['title'],
    168             'SIMPLE' => ($conf['fbp']['social_plugin_comments']['simple'] ? 'checked="checked"' : ''),
    169             'REVERSE' => ($conf['fbp']['social_plugin_comments']['reverse'] ? 'checked="checked"' : ''),
    170             'PUBLISH_FEED' => ($conf['fbp']['social_plugin_comments']['publish_feed'] ? 'checked="checked"' : ''),
     188            'SIMPLE' => fbp_checked($conf['fbp']['social_plugin_comments']['simple']),
     189            'REVERSE' => fbp_checked($conf['fbp']['social_plugin_comments']['reverse']),
     190            'PUBLISH_FEED' => fbp_checked($conf['fbp']['social_plugin_comments']['publish_feed']),
     191          ),
     192       'activity_feed' => array
     193          (
     194            'FB_PAGE' => FACEBOOK_DOC_PLUGINS_URL.'/activity/',
     195            'ENABLED' => fbp_checked($conf['fbp']['social_plugin_activity_feed']['enabled']),
     196            'COLORSCHEME_OPTIONS' => $colorscheme_l10n,
     197            'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_activity_feed']['colorscheme'], $colorscheme),
     198            'RECOMMENDATIONS' => fbp_checked($conf['fbp']['social_plugin_activity_feed']['recommendations']),
     199            'HEADER' => fbp_checked($conf['fbp']['social_plugin_activity_feed']['header']),
     200            'HEIGHT' => $conf['fbp']['social_plugin_activity_feed']['height'],
    171201          ),
    172202       'like_box' => array
    173203          (
    174204            'FB_PAGE' => FACEBOOK_DOC_PLUGINS_URL.'/like-box/',
    175             'ENABLED' => ($conf['fbp']['social_plugin_like_box']['enabled'] ? 'checked="checked"' : ''),
     205            'ENABLED' => fbp_checked($conf['fbp']['social_plugin_like_box']['enabled']),
    176206            'URL' => $conf['fbp']['social_plugin_like_box']['url'],
    177207            'COLORSCHEME_OPTIONS' => $colorscheme_l10n,
    178208            'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_box']['colorscheme'], $colorscheme),
    179             'SHOW_FACES' => ($conf['fbp']['social_plugin_like_box']['show_faces'] ? 'checked="checked"' : ''),
    180             'STREAM' => ($conf['fbp']['social_plugin_like_box']['stream'] ? 'checked="checked"' : ''),
    181             'HEADER' => ($conf['fbp']['social_plugin_like_box']['header'] ? 'checked="checked"' : ''),
     209            'SHOW_FACES' => fbp_checked($conf['fbp']['social_plugin_like_box']['show_faces']),
     210            'STREAM' => fbp_checked($conf['fbp']['social_plugin_like_box']['stream']),
     211            'HEADER' => fbp_checked($conf['fbp']['social_plugin_like_box']['header']),
     212            'HEIGHT' => $conf['fbp']['social_plugin_like_box']['height'],
    182213          ),
    183214        ));
     
    190221      array(
    191222        'FBP_FACEBOOK_APP_ID' => $conf['fbp']['facebook_app_id'],
    192         'FBP_ASYNC_SCRIPT' => ($conf['fbp']['async_script'] ? 'checked="checked"' : ''),
    193         'FBP_FORCE_FACEBOOK_INIT' => ($conf['fbp']['force_facebook_init'] ? 'checked="checked"' : ''),
     223        'FBP_ASYNC_SCRIPT' => fbp_checked($conf['fbp']['async_script']),
     224        'FBP_FORCE_FACEBOOK_INIT' => fbp_checked($conf['fbp']['force_facebook_init']),
    194225        'FBP_PICTURE_URL_TYPE_OPTIONS' => $picture_url_type_l10n,
    195226        'FBP_PICTURE_URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['picture_url_type'], $picture_url_type),
    196         'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
    197         'FBP_ADD_ABOUT_INFORMATIONS' => ($conf['fbp']['add_about_informations'] ? 'checked="checked"' : ''),
    198         'FBP_ADD_GROUP_FOOTER' => ($conf['fbp']['add_group_footer'] ? 'checked="checked"' : ''),
    199         'FBP_ADD_APPLICATION_FOOTER' => ($conf['fbp']['add_application_footer'] ? 'checked="checked"' : ''),
     227        'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> fbp_checked($conf['fbp']['allow_fb_access_private_page']),
     228        'FBP_ADD_ABOUT_INFORMATIONS' => fbp_checked($conf['fbp']['add_about_informations']),
     229        'FBP_ADD_GROUP_FOOTER' => fbp_checked($conf['fbp']['add_group_footer']),
     230        'FBP_ADD_APPLICATION_FOOTER' => fbp_checked($conf['fbp']['add_application_footer']),
     231        ));
     232    break;
     233  }
     234  case 'activity' :
     235  {
     236    $template->assign(
     237      $page['tab'],
     238      array(
    200239        ));
    201240    break;
     
    216255$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    217256
    218 
    219257?>
Note: See TracChangeset for help on using the changeset viewer.