/** * Shows theme intagration wizard * * @param type $atts */ function theme_integration_wizard($atts) { $current_mode = get_real_integration_mode(); if (is_ic_integration_wizard_page()) { $args = shortcode_atts(array('class' => 'fixed-box'), $atts); $class = esc_attr($args['class']); $box_content = '<h4>' . __('Advanced Mode Test', 'ecommerce-product-catalog') . '</h4>'; /* $box_content .= '<script>jQuery(window).scroll( function() { if (isScrolledIntoView(".relative-box")) {jQuery(".fixed-box").hide("slow");} else {jQuery(".fixed-box").show("slow");}}); function isScrolledIntoView(elem) { var docViewTop = jQuery(window).scrollTop(); var docViewBottom = docViewTop + jQuery(window).height(); var elemTop = jQuery(elem).offset().top; var elemBottom = elemTop + jQuery(elem).height(); return ((docViewTop < elemTop) && (docViewBottom > elemBottom)); // return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); }</script>'; */ if (!isset($_GET['test_advanced'])) { $box_content .= '<p>' . __('eCommerce Product Catalog is currently running in Simple Mode.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p>' . __('In Simple Mode the product listing, product search and category pages are disabled (please read this Sample Product Page to fully understand the difference).', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p>' . __('Please use the button below to check out how the product page looks in Automatic Advanced Mode.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p class="wp-core-ui"><a href="' . esc_url(add_query_arg('test_advanced', '1')) . '" class="button-primary">' . __('Start Advanced Mode Test', 'ecommerce-product-catalog') . '</a><a href="' . esc_url(add_query_arg('test_advanced', 'simple')) . '" class="button-secondary">' . __('Use Simple Mode', 'ecommerce-product-catalog') . '</a></p>'; if ($current_mode == 'simple') { echo '<div id="integration_wizard" class="' . $class . '">' . implecode_info($box_content, 0) . '</div>'; } } else { if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 1) { $box_content .= '<style>#integration_wizard.fixed-box {opacity: 0.8;}#integration_wizard.fixed-box:hover {opacity: 1;}</style>'; $box_content .= '<p>' . __('Advanced Mode is temporary enabled for this page now.', 'ecommerce-product-catalog') . '</p>'; //$box_content .= '<p>' . __( 'Please use the buttons below to let the script know if the Automatic Advanced Integration is done right.', 'ecommerce-product-catalog' ) . '</p>'; $box_content .= '<p style="margin-bottom: 0">' . __('Make some adjustments if necessary (you can change it at any time later)', 'ecommerce-product-catalog') . ':</p>'; $box_content .= '<table class="styling-adjustments">'; $integration_settings = get_integration_settings(); $box_content .= implecode_settings_number(__('Width', 'ecommerce-product-catalog'), 'container_width', $integration_settings['container_width'], '%', 0, null, null, 0); $box_content .= implecode_settings_text_color(__('Background', 'ecommerce-product-catalog'), 'container_bg', $integration_settings['container_bg'], null, 0, null, '{change: function(event, ui){ var hexcolor = jQuery( this ).wpColorPicker( "color" ); jQuery("#container").css("background", hexcolor); jQuery("#container").css("overflow", "hidden"); jQuery("#container").css("width", jQuery("input[name=\\"container_width\\"]").val()+"%");}}'); $box_content .= implecode_settings_number(__('Padding', 'ecommerce-product-catalog'), 'container_padding', $integration_settings['container_padding'], 'px', 0, null, null, 0); if (!defined('AL_SIDEBAR_PLUGIN_BASE_PATH')) { $box_content .= implecode_settings_radio(__('Default Sidebar', 'ecommerce-product-catalog'), 'default_sidebar', $integration_settings['default_sidebar'], array('none' => __('Disabled', 'ecommerce-product-catalog'), 'left' => __('Left', 'ecommerce-product-catalog'), 'right' => __('Right', 'ecommerce-product-catalog')), 0); if ($integration_settings['default_sidebar'] == 'none') { $box_content .= '<style>#catalog_sidebar {display: none;}</style>'; } } $box_content .= implecode_settings_checkbox(__('Disable breadcrumbs', 'ecommerce-product-catalog'), 'disable_breadcrumbs', $integration_settings['disable_breadcrumbs'], 0); $box_content .= implecode_settings_checkbox(__('Disable Name', 'ecommerce-product-catalog'), 'disable_name', $integration_settings['disable_name'], 0); $box_content .= implecode_settings_checkbox(__('Disable Image', 'ecommerce-product-catalog'), 'disable_image', $integration_settings['disable_image'], 0); $box_content .= implecode_settings_checkbox(__('Disable Price', 'ecommerce-product-catalog'), 'disable_price', $integration_settings['disable_price'], 0); $box_content .= implecode_settings_checkbox(__('Disable Shipping', 'ecommerce-product-catalog'), 'disable_shipping', $integration_settings['disable_shipping'], 0); $box_content .= implecode_settings_checkbox(__('Disable Attributes', 'ecommerce-product-catalog'), 'disable_attributes', $integration_settings['disable_attributes'], 0); $box_content .= '</table>'; $box_content .= '<style>#integration_wizard .al-box table tbody, #integration_wizard .al-box table tr, #integration_wizard .al-box table td {border: 0; background: transparent;} #integration_wizard .al-box table.styling-adjustments td {vertical-align: middle;font-size: 14px; color: rgb(136, 136, 136); text-align: left;} #integration_wizard .wp-picker-container {padding-top: 5px;}html #integration_wizard.fixed-box .al-box table input.wp-picker-clear {background: #ededed; transition: none; padding: 1px 6px; border: 1px solid #000; color: #000; margin: 0; margin-left: 6px;}#integration_wizard .wp-picker-holder{position: absolute;}</style>'; $box_content .= '<script>jQuery("input[name=\\"container_width\\"]").change(function() { jQuery("#container").css("width", jQuery(this).val()+"%");jQuery("#container").css("margin", "0 auto");});'; $box_content .= 'jQuery("input[name=\\"container_padding\\"]").change(function() { jQuery("#container #content").css("padding", jQuery(this).val()+"px");jQuery("#container").css("box-sizing", "border-box");jQuery("#container #catalog_sidebar").css("padding", jQuery(this).val()+"px");});'; $box_content .= 'jQuery("input[name=\\"disable_breadcrumbs\\"]").change(function() { if (jQuery(this).is(":checked")) { jQuery("p#breadcrumbs").hide();} else {jQuery("p#breadcrumbs").show();}});'; $box_content .= 'jQuery("input[name=\\"disable_name\\"]").change(function() { if (jQuery(this).is(":checked")) { jQuery("h1.product-name").hide();} else {jQuery("h1.product-name").show();}});'; $box_content .= 'jQuery("input[name=\\"disable_image\\"]").change(function() { if (jQuery(this).is(":checked")) { jQuery("div.product-image").hide();jQuery("#product_details").addClass("no-image");} else {jQuery("div.product-image").show();jQuery("#product_details").removeClass("no-image");}});'; $box_content .= 'jQuery("input[name=\\"disable_price\\"]").change(function() { if (jQuery(this).is(":checked")) { jQuery("table.price-table").hide();} else {jQuery("table.price-table").show();}});'; $box_content .= 'jQuery("input[name=\\"disable_shipping\\"]").change(function() { if (jQuery(this).is(":checked")) { jQuery("table.shipping-table").hide();} else {jQuery("table.shipping-table").show();}});'; $box_content .= 'jQuery("input[name=\\"disable_attributes\\"]").change(function() { if (jQuery(this).is(":checked")) { jQuery("#product_features").hide();} else {jQuery("#product_features").show();}});'; $box_content .= 'jQuery("input[name=\\"default_sidebar\\"]").change(function() { if (jQuery(this).is(":checked")) { sidebar = jQuery(this).val();if (sidebar == "left") {jQuery("#catalog_sidebar").show();jQuery("#catalog_sidebar").css("float","left");jQuery(".product-catalog #content").css("width","70%");jQuery(".product-catalog #content").css("float","right");} else if (sidebar == "right") {jQuery("#catalog_sidebar").show();jQuery("#catalog_sidebar").css("float","right");jQuery(".product-catalog #content").css("width","70%");jQuery(".product-catalog #content").css("float","left");} else {jQuery("#catalog_sidebar").hide();jQuery(".product-catalog #content").css("width","100%");jQuery(".product-catalog #content").css("float","none");}}});'; $box_content .= '</script>'; //$box_content .= '<script>jQuery("input[name=\"container_bg\"]").change(function() { jQuery("#container").css("background", jQuery(this).val());});</script>'; $box_content .= '<p>' . __('Is everything looking fine now?', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<script>jQuery(document).ready(function() { jQuery("a.integration-ok").click(function(e) { clicked = jQuery(this).attr("href"); e.preventDefault(); var breadcrumbs = 0; if (jQuery("input[name=\\"disable_breadcrumbs\\"]").is(":checked")) { breadcrumbs = 1; } var name = 0; if (jQuery("input[name=\\"disable_name\\"]").is(":checked")) { name = 1; } var image = 0; if (jQuery("input[name=\\"disable_image\\"]").is(":checked")) { image = 1; } var price = 0; if (jQuery("input[name=\\"disable_price\\"]").is(":checked")) { price = 1; } var shipping = 0; if (jQuery("input[name=\\"disable_shipping\\"]").is(":checked")) { shipping = 1; } var attributes = 0; if (jQuery("input[name=\\"disable_attributes\\"]").is(":checked")) { attributes = 1; } default_sidebar = jQuery("input[name=\\"default_sidebar\\"]:checked").val(); var data = { "action": "save_wizard", "container_width": jQuery("input[name=\\"container_width\\"]").val(), "container_padding": jQuery("input[name=\\"container_padding\\"]").val(), "container_bg": jQuery("input[name=\\"container_bg\\"]").val(), "disable_breadcrumbs": breadcrumbs, "disable_name": name, "disable_image": image, "disable_price": price, "disable_shipping": shipping, "disable_attributes": attributes, "default_sidebar": default_sidebar }; jQuery.post("' . admin_url('admin-ajax.php') . '", data, function(response) { window.location.href = clicked; }); }); }); </script>'; $box_content .= '<p class="wp-core-ui"><a href="' . esc_url(add_query_arg('test_advanced', 'ok')) . '" class="button-primary integration-ok">' . __('It\'s Fine', 'ecommerce-product-catalog') . '</a><a href="' . esc_url(add_query_arg('test_advanced', 'bad')) . '" class="button-secondary">' . __('It\'s Broken', 'ecommerce-product-catalog') . '</a></p>'; echo '<div id="integration_wizard" class="' . $class . '">' . implecode_info($box_content, 0) . '</div>'; } else { if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 'bad') { $box_content .= '<p>' . __('It seems that Manual Theme Integration is needed in order to use Advanced Mode with your current theme.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<h4>' . __('You Have 3 choices', 'ecommerce-product-catalog') . ':</h4>'; $box_content .= '<ol>'; $box_content .= '<li>' . __('Get the Manual Theme Integration done.', 'ecommerce-product-catalog') . '</li>'; $box_content .= '<li>' . __('Keep using Simple Mode which is still functional.', 'ecommerce-product-catalog') . '</li>'; $box_content .= '<li>' . __('Switch the theme.', 'ecommerce-product-catalog') . '</li>'; $box_content .= '</ol>'; $box_content .= '<p>' . __('Please make your choice below or switch the theme.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p class="wp-core-ui"><a target="_blank" href="https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=simple-mode&key=integration-advanced-fail" class="button-primary">' . __('Free Theme Integration Guide', 'ecommerce-product-catalog') . '</a><a href="' . esc_url(add_query_arg('test_advanced', 'simple')) . '" class="button-secondary">' . __('Use Simple Mode', 'ecommerce-product-catalog') . '</a></p>'; enable_simple_mode(); echo '<div id="integration_wizard" class="' . $class . '">' . implecode_warning($box_content, 0) . '</div>'; } else { if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 'ok') { $box_content .= '<p>' . __('Congratulations! eCommerce Product Catalog is working on Advanced Mode now. You can go to admin and add the products to the catalog.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p>' . __('If you are a developer or would like to have full control on the product pages templates we still recommend to proceed with manual integration.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p>' . __('You can switch between modes at any time in Product Settings.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p class="wp-core-ui"><a href="' . admin_url('edit.php?post_type=al_product') . '" class="button-primary">' . __('Go to Admin', 'ecommerce-product-catalog') . '</a><a target="_blank" href="https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=advanced-mode&key=integration-advanced-success" class="button-secondary">' . __('Free Theme Integration Guide', 'ecommerce-product-catalog') . '</a></p>'; enable_advanced_mode(); echo '<div id="integration_wizard" class="' . $class . '">' . implecode_success($box_content, 0) . '</div>'; } else { if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 'simple') { $box_content .= '<p>' . __('You are using simple mode now.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p>' . __('You can switch between modes at any time in Product Settings.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p>' . __('Use the buttons below to try the advanced integration again or go to admin and start adding your products.', 'ecommerce-product-catalog') . '</p>'; $box_content .= '<p class="wp-core-ui"><a href="' . admin_url('edit.php?post_type=al_product') . '" class="button-primary">' . __('Go to Admin', 'ecommerce-product-catalog') . '</a><a href="' . esc_url(add_query_arg('test_advanced', '1')) . '" class="button-secondary">' . __('Restart Advanced Mode Test', 'ecommerce-product-catalog') . '</a></p>'; enable_simple_mode(); echo '<div id="integration_wizard" class="' . $class . '">' . implecode_success($box_content, 0) . '</div>'; } } } } } } }
/** * Adds advanced mode custom styling settings * */ function advanced_mode_styling() { $settings = get_integration_settings(); $styling = '<style>'; if ($settings['container_width'] != 100) { $styling .= '#container.product-catalog {width: ' . $settings['container_width'] . '%; margin: 0 auto; overflow: hidden; box-sizing: border-box; float: none;}'; } if ($settings['container_bg'] != '') { $styling .= '#container.product-catalog {background: ' . $settings['container_bg'] . ';}'; } if ($settings['container_padding'] != 0) { $styling .= '.content-area.product-catalog #content {padding: ' . $settings['container_padding'] . 'px; box-sizing: border-box; float: none; }'; if (is_ic_default_theme_sided_sidebar_active()) { $styling .= '.content-area.product-catalog #catalog_sidebar {padding: ' . $settings['container_padding'] . 'px; box-sizing: border-box;}'; } } if ($settings['default_sidebar'] == 'left') { $styling .= '.content-area.product-catalog #catalog_sidebar {float: left;}'; } if (is_ic_default_theme_sided_sidebar_active()) { $styling .= '.content-area.product-catalog #content {width: 70%;'; if ($settings['default_sidebar'] == 'left') { $styling .= 'float:right;'; } else { if ($settings['default_sidebar'] == 'right') { $styling .= 'float:left;'; } } $styling .= '}'; } $styling .= apply_filters('advanced_mode_styling_rules', ''); $styling .= '</style>'; if ($styling != '<style></style>') { echo $styling; } }
function usermap_perform() { global $wpuAbs, $phpEx, $phpbb_root_path, $wpSettings, $db, $template; $this->page_title = 'L_MAP_TITLE'; $this->tpl_name = 'acp_wp_united'; // set the page section to show $template->assign_block_vars('switch_usermap_perform', array()); //Get integration settings $wpSettings = get_integration_settings(); if ($wpSettings == FALSE || $wpSettings['wpPath'] == '') { $wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('WP_DBErr_Gen'), $wpuAbs->lang('L_WP_NO_SETTINGS'), __LINE__, __FILE__, $sql); } $lastAction = (int) request_var('numrows', 0); $nextStart = (int) request_var('start', 0); $numPerPage = (int) request_var('wpumapperpage', 50); $paged = (int) request_var('paged', 0); // Enter WordPress and pull user data global $wpdb, $wpUtdInt; require_once $phpbb_root_path . 'wp-united/wp-integration-class.' . $phpEx; $wpUtdInt = WPU_Integration::getInstance(); define('USE_THEMES', FALSE); if ($wpUtdInt->can_connect_to_wp()) { $wpUtdInt->enter_wp_integration(); eval($wpUtdInt->exec()); $wpUtdInt->switch_db('TO_P'); if (file_exists($wpSettings['wpPath'] . 'wp-admin/includes/user.php')) { //WP >= 2.3 require_once $wpSettings['wpPath'] . 'wp-admin/includes/user.php'; } else { require_once $wpSettings['wpPath'] . 'wp-admin/admin-db.php'; //WP < 2.3 } require_once $phpbb_root_path . 'wp-united/wpu-actions.' . $phpEx; for ($procAction = 0; $procAction <= $lastAction; $procAction++) { $status_text = ''; $actionName = request_var('actname' . $procAction, ''); if (!empty($actionName)) { $wpID = (int) request_var('wpID' . $procAction, 0); $pID = (int) request_var('pID' . $procAction, 0); $typedName = request_var('typedName' . $procAction, ''); switch ($actionName) { case 'break': if (!empty($wpID)) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_wpuint_id = NULL \n\t\t\t\t\t\t\t\t\tWHERE user_wpuint_id = {$wpID}"; if (!($pDel = $db->sql_query($sql))) { $wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('L_MAP_COULDNT_BREAK'), $wpuAbs->lang('L_DB_ERROR'), __LINE__, __FILE__, $sql); } $status_text = '<li>' . sprintf($wpuAbs->lang('L_MAP_BROKE_SUCCESS'), $wpID) . '</li>'; } else { $status_text = '<li>' . $wpuAbs->lang('L_MAP_CANNOT_BREAK') . '</li>'; } break; case 'integrate': if (!empty($wpID) && !empty($pID)) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_wpuint_id = {$wpID} \n\t\t\t\t\t\t\t\t\tWHERE user_id = {$pID}"; if (!($pInt = $db->sql_query($sql))) { $wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('L_MAP_COULDNT_INT'), $wpuAbs->lang('L_DB_ERROR'), __LINE__, __FILE__, $sql); } // Sync profiles $sql = "SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS_TABLE . " \n\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_id = {$pID}"; if (!($pUserData = $db->sql_query($sql))) { $wpuAbs->err_msg(GENERAL_ERROR, $wpuAbs->lang('L_MAP_COULDNT_INT'), $wpuAbs->lang('L_DB_ERROR'), __LINE__, __FILE__, $sql); } $data = $db->sql_fetchrow($pUserData); $db->sql_freeresult($pUserData); $wpu_newDetails = array('user_id' => $pID, 'username' => isset($data['username']) ? $data['username'] : '', 'user_email' => isset($data['user_email']) ? $data['user_email'] : '', 'user_password' => isset($data['user_password']) ? $data['user_password'] : '', 'user_aim' => isset($data['user_aim']) ? $data['user_aim'] : '', 'user_yim' => isset($data['user_yim']) ? $data['user_yim'] : '', 'user_jabber' => isset($data['user_jabber']) ? $data['user_jabber'] : '', 'user_website' => isset($data['user_website']) ? $data['user_website'] : '', 'user_avatar' => isset($data['user_avatar']) ? $data['user_avatar'] : '', 'user_avatar_type' => isset($data['user_avatar_type']) ? $data['user_avatar_type'] : '', 'user_avatar_width' => isset($data['user_avatar_width']) ? $data['user_avatar_width'] : '', 'user_avatar_height' => isset($data['user_avatar_height']) ? $data['user_avatar_height'] : ''); $wpUtdInt->switch_db('TO_W'); $wpUsrData = get_userdata($wpID); $wpUpdateData = $wpUtdInt->check_details_consistency($wpUsrData, $wpu_newDetails); $wpUtdInt->switch_db('TO_P'); $status_text = '<li>' . sprintf($wpuAbs->lang('L_MAP_INT_SUCCESS'), $wpID, $pID) . '</li>'; } else { $status_text = '<li>' . $wpuAbs->lang('L_MAP_CANNOT_INT') . '</li>'; } break; case 'delete': $wpUtdInt->switch_db('TO_W'); if (!empty($wpID)) { wp_delete_user($wpID, $reassign = '0'); $status_text = '<li>' . sprintf($wpuAbs->lang('L_MAP_WPDEL_SUCCESS'), $wpID) . '</li>'; $nextStart = $nextStart - 1; } else { $status_text = '<li>' . $wpuAbs->lang('L_MAP_CANNOT_DEL') . '</li>'; } $wpUtdInt->switch_db('TO_P'); break; case 'createP': if (!$wpID || !$typedName) { $status_text = '<li>' . $wpuAbs->lang('L_MAP_CANNOT_CREATEP_ID') . '</li>'; } else { $wpUtdInt->switch_db('TO_W'); $wpUsr = get_userdata($wpID); $wpUtdInt->switch_db('TO_P'); if ($wpuAbs->insert_user($typedName, $wpUsr->user_pass, $wpUsr->user_email, $wpID)) { $status_text = '<li>' . sprintf($wpuAbs->lang('L_MAP_CREATEP_SUCCESS'), $typedName) . '</li>'; } else { $status_text = '<li>' . $wpuAbs->lang('L_MAP_CANNOT_CREATEP_NAME') . '</li>'; } } break; default: $wpuAbs->err_msg(sprintf($wpuAbs->lang('L_MAP_INVALID_ACTION'), $procAction)); break; } } else { $wpuAbs->err_msg(sprintf($wpuAbs->lang('L_MAP_EMPTY_ACTION'), $procAction)); } $template->assign_block_vars('switch_usermap_perform.performlist_row', array('LIST_ITEM' => $status_text)); } } else { die($wpuAbs->lang('L_MAP_CANT_CONNECT')); } if (!empty($paged)) { $template->assign_block_vars('switch_usermap_perform.switch_paged', array('L_MAP_NEXTPAGE' => $wpuAbs->lang('L_MAP_NEXTPAGE'))); } else { $template->assign_block_vars('switch_usermap_perform.switch_unpaged', array('L_MAP_FINISHED' => sprintf($wpuAbs->lang('L_MAP_FINISHED'), '<a href="' . append_sid("index.{$phpEx}?i=wp_united&mode=index") . '">', '</a>', '<a href="' . append_sid("index.{$phpEx}?i=wp_united&mode=usermap") . '">', '</a>'))); } $passVars = array('L_MAP_TITLE' => $wpuAbs->lang('L_MAP_TITLE'), 'S_WPMAP_ACTION' => append_sid("index.{$phpEx}?i=wp_united"), 'L_MAP_PERFORM_INTRO' => $wpuAbs->lang('L_MAP_PERFORM_INTRO'), 'S_NEXTSTART' => $nextStart, 'S_NUMPERPAGE' => $numPerPage); $this->showPage($passVars, 0); }
function generate_viewtopic_link($bloglink_id, &$cache) { global $wpSettings, $wpuAbs, $phpbb_root_path, $phpEx; require_once $phpbb_root_path . 'wp-united/mod-settings.' . $phpEx; require_once $phpbb_root_path . 'wp-united/options.' . $phpEx; $wpSettings = empty($wpSettings) ? get_integration_settings() : $wpSettings; if ($wpSettings['installLevel'] == 10) { if (!empty($wpSettings['buttonsPost'])) { if (!isset($user_cache[$poster_id]) && !empty($bloglink_id)) { if ($poster_id == ANONYMOUS) { $cache['blog_img'] = ''; $cache['blog_link'] = ''; } else { $cache['blog_img'] = ''; //TODO: SET FOR SUBSILVER!! $cache['blog_link'] = append_sid($wpSettings['blogsUri'] . "?author=" . $bloglink_id); } } } } }
// ---------------------------------------- // require_once $phpbb_root_path . 'wp-united/wpu-helper-funcs.' . $phpEx; require_once $phpbb_root_path . 'wp-united/abstractify.' . $phpEx; $numPosts = 3; if (defined('GET_NUM_POSTS')) { $numPosts = GET_NUM_POSTS > 10 ? 10 : GET_NUM_POSTS; $numPosts = $numPosts < 1 ? 3 : $numPosts; } $server = add_http(add_trailing_slash($wpuAbs->config('server_name'))); $scriptPath = add_trailing_slash($wpuAbs->config('script_path')); $scriptPath = $scriptPath[0] == "/" ? substr($scriptPath, 1) : $scriptPath; $scriptPath = $server . $scriptPath; //in case page_header hasn't been called yet: require_once $phpbb_root_path . 'wp-united/mod-settings.' . $phpEx; $wpSettings = get_integration_settings(); $path_to_blog = $wpSettings['blogsUri'] . "?latest=1&numposts={$numPosts}"; $cWpu = curl_init(); $cTimeout = 5; curl_setopt($cWpu, CURLOPT_URL, $path_to_blog); curl_setopt($cWpu, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cWpu, CURLOPT_CONNECTTIMEOUT, $cTimeout); curl_setopt($cWpu, CURLOPT_FOLLOWLOCATION, 1); $portal_content = curl_exec($cWpu); curl_close($cWpu); if (!($portal_content == "{****NO_POSTS****}")) { $portal_posts = explode('{**|**}', $portal_content); array_pop($portal_posts); foreach ($portal_posts as $post) { $post_info = explode('{****}', $post); $template->assign_block_vars('latest_blog_posts', array('U_BLOGPOST_LINK' => $post_info[0], 'BLOGPOST_TITLE' => $post_info[1], 'BLOGPOST_TIME' => $post_info[2], 'BLOGPOST_AUTHOR' => $post_info[3], 'BLOGPOST_EXCERPT' => $post_info[4], 'BLOGPOST_CAT' => $post_info[5]));