diff --git a/fb_social.install b/fb_social.install index f833da8..29d2f39 100644 --- a/fb_social.install +++ b/fb_social.install @@ -26,7 +26,7 @@ function fb_social_uninstall() { foreach ($languages as $language) { variable_del('fb_social_language_' . $language->language); } - + } @@ -155,3 +155,10 @@ function fb_social_update_7200() { db_create_table('fb_social_preset', $fb_social_preset); } } + +/** + * Clear system registry. + */ +function fb_social_update_7201() { + cache_clear_all('*', 'cache_bootstrap', TRUE); +} diff --git a/fb_social.module b/fb_social.module index 0e5a8cc..fba8bc6 100644 --- a/fb_social.module +++ b/fb_social.module @@ -20,52 +20,64 @@ function fb_social_rdf_namespaces() { */ function fb_social_menu() { $items = array(); - + $items['fb_social/channel'] = array( - 'type' => MENU_CALLBACK, - 'description' => 'Facebook Custom Channel URL', - 'page callback' => 'fb_social_custom_channel_url', - 'access callback' => TRUE + 'type' => MENU_CALLBACK, + 'description' => 'Facebook Custom Channel URL', + 'page callback' => 'fb_social_custom_channel_url', + 'access callback' => TRUE ); - + $items['admin/structure/fbsocial'] = array( - 'title' => 'Facebook social', - 'description' => 'Settings for facebook social plugins.', - 'page callback' => 'drupal_get_form', + 'title' => 'Facebook social', + 'description' => 'Settings for facebook social plugins.', + 'page callback' => 'drupal_get_form', 'page arguments' => array( - 'fb_social_admin_settings_form' - ), - 'file' => 'fb_social.admin.inc', - 'access callback' => 'user_access', + 'fb_social_admin_settings_form' + ), + 'file' => 'fb_social.admin.inc', + 'access callback' => 'user_access', 'access arguments' => array( - 'administer site configuration' - ) + 'administer fb_social' + ) ); - + $items['admin/structure/fbsocial/settings'] = array( 'type' => MENU_DEFAULT_LOCAL_TASK, - 'title' => 'Settings', - 'description' => 'Settings for facebook social plugins.', - 'page callback' => 'drupal_get_form', + 'title' => 'Settings', + 'description' => 'Settings for facebook social plugins.', + 'page callback' => 'drupal_get_form', 'page arguments' => array( - 'fb_social_admin_settings_form' - ), - 'file' => 'fb_social.admin.inc', - 'access callback' => 'user_access', + 'fb_social_admin_settings_form' + ), + 'file' => 'fb_social.admin.inc', + 'access callback' => 'user_access', 'access arguments' => array( - 'administer site configuration' - ) + 'administer fb_social' + ) ); - + return $items; } /** + * Implements hook_permission(). + */ +function fb_social_permission() { + return array( + 'administer fb_social' => array( + 'title' => t('Administer FB Social'), + 'description' => t('Perform Facebook social plugins and settings.'), + ), + ); +} + +/** * Implements hook_block_info(). */ function fb_social_block_info() { $blocks = array(); - + // load all presets if ($presets = fb_social_get_presets()) { foreach ( $presets as $preset ) { @@ -98,13 +110,13 @@ function fb_social_theme($existing, $type, $theme, $path) { $path1 = drupal_get_path('module', 'fb_social'); return array( 'fb_social_plugin' => array( - 'template' => 'fb-social-plugin', - 'path' => "$path1/theme", + 'template' => 'fb-social-plugin', + 'path' => "$path1/theme", 'variables' => array( - 'plugin_type' => NULL, - 'options' => array() - ) - ) + 'plugin_type' => NULL, + 'options' => array() + ) + ) ); } @@ -114,27 +126,27 @@ function fb_social_theme($existing, $type, $theme, $path) { function fb_social_preprocess_fb_social_plugin(&$variables) { global $_fb_script_init; $_fb_script_init = TRUE; - + $plugin = fb_social_fb_plugin_load($variables['plugin_type']); - + // delegate to plugin's preprocess function $function = ctools_plugin_get_function($plugin, 'hook_preprocess_fb_social_plugin'); if ($function) { $function($variables); } - + // are we rendering html5 or xfbml $markup_type = variable_get('fb_social_markup_type', 'xfbml'); - + $variables['tag_name'] = ($markup_type == "xfbml") ? "fb:" . $plugin['html tag name'] : "div"; - + if ($markup_type == 'html5') { foreach ( $variables['options'] as $key => $value ) { $variables['options']["data-" . $key] = $value; unset($variables['options'][$key]); } $variables['options'] = array( - 'class' => "fb-" . $plugin['html tag name'] + 'class' => "fb-" . $plugin['html tag name'] ) + $variables['options']; } } @@ -145,16 +157,16 @@ function fb_social_preprocess_fb_social_plugin(&$variables) { function fb_social_node_view($node, $view_mode = 'full') { $links = fb_social_link('node', $node, $view_mode); $node->content['links']['fb_social'] = array( - '#theme' => 'links__node__fb_social', - '#links' => $links, + '#theme' => 'links__node__fb_social', + '#links' => $links, '#attributes' => array( 'class' => array( - 'links', - 'inline' - ) - ) + 'links', + 'inline' + ) + ) ); - + if ($presets = fb_social_get_presets()) { foreach ( $presets as $preset ) { $plugin = fb_social_fb_plugin_load($preset->plugin_type); @@ -173,7 +185,7 @@ function fb_social_node_view($node, $view_mode = 'full') { function fb_social_field_extra_fields() { $extras = array(); if ($presets = fb_social_get_presets()) { - + foreach ( $presets as $preset ) { $plugin = fb_social_fb_plugin_load($preset->plugin_type); $function = ctools_plugin_get_function($plugin, 'hook_field_extra_fields'); @@ -200,7 +212,7 @@ function fb_social_link($type, $object = NULL, $view_mode = 'full') { if ($function) { $links += $function($preset, $type, $object, $view_mode); } - + } } if (isset($links)) { @@ -210,22 +222,22 @@ function fb_social_link($type, $object = NULL, $view_mode = 'full') { // ctools hooks / api - + /** - * Implements hook_ctools_plugin_type() to inform the plugin system + * Implements hook_ctools_plugin_type() to inform the plugin system * owns 'fb_plugin' plugin types. * - * "process" tells ctools that by default each - * plugin has some default functions named consistently + * "process" tells ctools that by default each + * plugin has some default functions named consistently * after the plugin name * @see _fb_social_ctools_plugin_fb_plugin_process() */ function fb_social_ctools_plugin_type() { - + return array( 'fb_plugin' => array( - 'process' => '_fb_social_ctools_plugin_fb_plugin_process' - ) + 'process' => '_fb_social_ctools_plugin_fb_plugin_process' + ) ); } @@ -235,13 +247,13 @@ function fb_social_ctools_plugin_type() { function fb_social_ctools_plugin_api($module, $api) { if ($module == 'fb_social' && $api == 'plugins') { return array( - 'version' => 1 + 'version' => 1 ); } //boxes if ($module == 'boxes' && $api == 'plugins') { return array( - 'version' => 1 + 'version' => 1 ); } } @@ -250,13 +262,13 @@ function fb_social_ctools_plugin_api($module, $api) { * Implementation of hook_ctools_plugin_directory(). */ function fb_social_ctools_plugin_directory($module, $type) { - + return 'plugins/' . $type; } /** - * Helper function for ctools plugin 'process' + * Helper function for ctools plugin 'process' * @param $plugin * @param $info * @see fb_social_ctools_plugin_fb_plugin() @@ -281,23 +293,23 @@ function fb_social_fb_plugin_load($type = NULL) { if (isset($type)) { return $plugins[$type]; } - + return $plugins; } /** - * Return the default vaules of a certain plugin + * Return the default vaules of a certain plugin * type as defined by facebook * @param $type the plugin type/name (i.e. like). */ function fb_social_fb_plugin_defaults($type) { $plugin = fb_social_fb_plugin_load($type); - + $function = ctools_plugin_get_function($plugin, 'default values'); if ($function) { return $function(); } - + return array(); } @@ -308,26 +320,26 @@ function fb_social_fb_plugin_defaults($type) { function fb_social_fb_plugin_fb_settings_form($type, $options) { $form = array(); $plugin = fb_social_fb_plugin_load($type); - + $url = FB_REF_BASE_URL . $plugin['html tag name']; $l = l("facebook documentation page", $url, array( 'attributes' => array( - 'target' => '_blank' - ) + 'target' => '_blank' + ) )); $desc = t("For more information about this plugin and its attributes please check out the !facebookdoc", array( - '!facebookdoc' => $l + '!facebookdoc' => $l )); - + $form['help'] = array( - '#value' => "