/**
  * Returns the CSS rules.
  * 
  * @since       1.1.2.1
  * @since       1.2.0           Moved from the _StyleLoader class as it more makes sense in the Style class.
  * Made it static anc changed the scope public from protected as the ..._Style class access it. Removed the first parameter of the core object.
  * @access      public  
  */
 public static function getStyle($arrParams = array())
 {
     global $oResponsiveColumnWidgets;
     if (!isset($oResponsiveColumnWidgets)) {
         return '';
     }
     $oStyle = $oResponsiveColumnWidgets->oStyle;
     $oOption = $oResponsiveColumnWidgets->oOption;
     $arrParams = $oOption->FormatParameterArray($arrParams);
     $oWidgetBox = new ResponsiveColumnWidgets_WidgetBox($arrParams, $oOption->SetMinimiumScreenMaxWidth($oOption->FormatColumnArray($arrParams['columns'], $arrParams['default_media_only_screen_max_width'])), $oOption->formatColSpanArray($arrParams['colspans']), $oResponsiveColumnWidgets->arrClassSelectors);
     $oID = new ResponsiveColumnWidgets_IDHandler();
     return $oStyle->GetStyles($arrParams['sidebar'], $oID->GetCallID($arrParams['sidebar'], $arrParams), $arrParams['custom_style'], $oWidgetBox->GetScreenMaxWidths(), false);
 }
 public function AddStyleSheetForAutoInsert()
 {
     // since 1.1.2
     $oStyle = $this->oCore->oStyle;
     $strStyles = '';
     $this->arrClassSelectors = array('box' => $this->oOption->SanitizeAttribute($this->oOption->arrOptions['general']['general_css_class_attributes']['box']), 'column' => $this->oOption->SanitizeAttribute($this->oOption->arrOptions['general']['general_css_class_attributes']['column']), 'row' => $this->oOption->SanitizeAttribute($this->oOption->arrOptions['general']['general_css_class_attributes']['row']));
     foreach ($this->arrEnabledBoxIDs as $strSidebarID) {
         $arrParams = $this->oOption->FormatParameterArray(array('sidebar' => $strSidebarID));
         $oWidgetBox = new ResponsiveColumnWidgets_WidgetBox($arrParams, $this->oOption->SetMinimiumScreenMaxWidth($this->oOption->FormatColumnArray($arrParams['columns'], $arrParams['default_media_only_screen_max_width'])), $this->oOption->formatColSpanArray($arrParams['colspans']), $this->arrClassSelectors);
         $oID = new ResponsiveColumnWidgets_IDHandler();
         $strStyles .= $oStyle->GetStyles($strSidebarID, $oID->GetCallID($strSidebarID, $arrParams), $arrParams['custom_style'], $oWidgetBox->GetScreenMaxWidths(), false);
     }
     echo $strStyles;
 }
 /**
  * Returns the widget box output.
  * 
  */
 protected function getOutputWidgetBuffer($arrOutput, &$arrParams, $strCallID, $bIsStyleScoped)
 {
     // Check if the cache duration is set and if the cache is stored.
     $strCacheID = 'RCW_Cache_' . md5($strCallID);
     // since the passed call ID has the long prefix 'responsive_coluimn_widget', it needs to be shortened.
     $strBuffer = $arrParams['cache_duration'] > 0 ? $this->oDecode->decodeBase64(get_transient($strCacheID)) : '';
     // Instantiate the object to generate widget box outputs.
     $oWidgetBox = new ResponsiveColumnWidgets_WidgetBox($arrParams, $this->oOption->SetMinimiumScreenMaxWidth($this->oOption->FormatColumnArray($arrParams['columns'], $arrParams['default_media_only_screen_max_width'])), $this->oOption->formatColSpanArray($arrParams['colspans']), $this->arrClassSelectors);
     $strSidebarID = $this->getCorrectSidebarID($arrParams['sidebar']);
     if (empty($strBuffer)) {
         // First, retrieve the filtered output array.
         $arrOutputBuffer = (array) apply_filters('RCW_filter_widget_output_array', $arrOutput, $arrParams);
         $fIsEmpty = empty($arrOutputBuffer);
         // check if the sidebar is renderable.
         $arrSidebarsWidgets = wp_get_sidebars_widgets();
         if ($fIsEmpty) {
             // If nothing is registered in the given name of sidebar, return
             if (!is_active_sidebar($strSidebarID)) {
                 return '<p>' . $arrParams['message_no_widget'] . '</p>';
             }
             if (!$this->isRenderable($strSidebarID, $arrSidebarsWidgets)) {
                 return '<p>' . __('The responsive box is not renderable.', 'responsive-column-widgets') . '</p>';
             }
         }
         // Store the output buffers into an array.
         $arrWidgetBuffers = $fIsEmpty ? $oWidgetBox->getWidgetsBufferAsArray($strSidebarID, $arrSidebarsWidgets, $this->oOption->ConvertStringToArray($arrParams['showonly'], ','), $this->oOption->ConvertStringToArray($arrParams['omit'], ','), $arrParams['remove_id_attributes']) : $arrOutputBuffer;
         // since 1.1.3 - Get the flag array indicating whether the widgets are the plugin's widget-box widget or not.
         $arrFlagsWidgetBoxWidget = $fIsEmpty ? $oWidgetBox->GetWidgetBoxWidgetFlagArray() : array();
         // Now, $arrWidgetBuffers contains the necessary data for the output.
         // Enclose the buffer output string with the tag having the class attribute of screen max-width.
         foreach ($arrWidgetBuffers as $intIndex => $strWidgetBuffer) {
             $oWidgetBox->setColSpans($intIndex + 1);
             // the widget index is one-base while the array index is zero-base.
             $strBuffer .= '<div class="' . $oWidgetBox->GetClassAttribute() . (isset($arrFlagsWidgetBoxWidget[$intIndex]) && $arrFlagsWidgetBoxWidget[$intIndex] ? ' widget_box_widget' : '') . '">' . force_balance_tags($strWidgetBuffer) . '</div>';
             // If the allowed number of widgets reaches the limit, escape the loop.
             // For the max-rows, it depends on the screen max-widths, so it will be dealt with the style.
             if ($arrParams['maxwidgets'] != 0 && $intIndex + 1 >= $arrParams['maxwidgets']) {
                 break;
             }
             $oWidgetBox->advancePositions();
             // increments the position values stored in the object properties.
         }
         if ($arrParams['cache_duration'] > 0) {
             set_transient($strCacheID, base64_encode($strBuffer), $arrParams['cache_duration']);
         }
     }
     // the CSS rules
     $strBuffer .= $this->oStyle->GetStyles($strSidebarID, $strCallID, $arrParams['custom_style'], $oWidgetBox->GetScreenMaxWidths(), $bIsStyleScoped);
     unset($oWidgetBox);
     // for PHP below 5.3.
     return $strBuffer;
 }