[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Syntax error unexpected t_protected
Elena1212
Помогите исправить ошибку:unexpected. t_protected
Указывает на эту строчку :
This overwrites the parent function to get the cells in reverse order when using right_on_top collapse mode.
*
* @param $cells The cells to modify
* @param $row The row the cells belong to
*
* @return mixed
*/
protected function modify_row_cells( $cells, $row ){
if( ! empty( $row['style']['collapse_order'] ) && $row['style']['collapse_order'] == 'right-top') {
$cells = array_reverse( $cells, true );
}

return $cells;

}

public function front_css_url(){
return siteorigin_panels_url( 'css/front' . ( siteorigin_panels_setting( 'legacy-layout' ) ? '-legacy' : '' ) . '.css' );
}
}
Эли4ка
1.Ведь код класса.
2.Код оберните в теги.
3.Переводить сами текст ошибки пробовали?unexpected-это неожиданный,непредвиденный,внезапный.t_protected - Читаем
Elena1212
Что это значит ,я перевела )а вот как исправить -не очень,если можно-поподробней)Спасибо!
brevis
Проблема, скорее всего, где-то выше. Может не закрыта фигурная скобка...
Эталон.

_____________
Чатик в телеге
Эли4ка
Цитата (Elena1212 @ 14.02.2019 - 00:36)
если можно-поподробней)Спасибо!

Весь код класса нужен для этого
Elena1212

/**
*This overwrites the parent function to get the cells in reverse order when using
* right_on_top collapse mode.
*
*
@param $cells The cells to modify
*
@param $row The row the cells belong to
*
*
@return mixed
*/

protected function modify_row_cells( $cells, $row ){
if( ! empty( $row['style']['collapse_order'] ) && $row['style']['collapse_order'] == 'right-top') {
$cells = array_reverse( $cells, true );
}

return $cells;
}

public function front_css_url(){
return siteorigin_panels_url( 'css/front' . ( siteorigin_panels_setting( 'legacy-layout' ) ? '-legacy' : '' ) . '.css' );
}
}
Игорь_Vasinsky
before

This overwrites the parent function to get the cells in reverse order when using right_on_top collapse mode.


after

//This overwrites the parent function to get the cells in reverse order when using right_on_top collapse mode.


_____________
HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, (TSql, BI OLAP, MDX), Mongo, Git, SVN, CodeIgnater, Symfony, Yii 2, JiRA, Redmine, Bitbucket, Composer, Rabbit MQ, Amazon (SQS, S3, Transcribe), Docker
Elena1212
<?php

class
SiteOrigin_Panels_Renderer_Legacy extends SiteOrigin_Panels_Renderer {

public static function single() {
static $single;
return empty( $single ) ? $single = new self() : $single;
}

/**
* Generate the CSS for the page layout.
*
*
@param $post_id
*
@param $panels_data
*
@param $layout_data
*
*
@return string
*/

public function generate_css( $post_id, $panels_data = false, $layout_data = false) {
// Exit if we don't have panels data
if ( empty( $panels_data ) ) {
$panels_data = get_post_meta( $post_id, 'panels_data', true );
if( empty( $panels_data ) ) {
return '';
}
}

if ( empty( $layout_data ) ) {
$layout_data = $this->get_panels_layout_data( $panels_data );
$layout_data = apply_filters( 'siteorigin_panels_layout_data', $layout_data, $post_id );
}

// Get some of the default settings
$settings = siteorigin_panels_setting();
$panels_tablet_width = $settings['tablet-width'];
$panels_mobile_width = $settings['mobile-width'];
$panels_margin_bottom = $settings['margin-bottom'];
$panels_margin_bottom_last_row = $settings['margin-bottom-last-row'];

$css = new SiteOrigin_Panels_Css_Builder();

$ci = 0;
foreach ( $layout_data as $ri => $row ) {
if( empty( $row['cells'] ) ) continue;

// Let other themes and plugins change the gutter.
$gutter = apply_filters( 'siteorigin_panels_css_row_gutter', $settings['margin-sides'] . 'px', $row, $ri, $panels_data );
preg_match( '/([0-9\.,]+)(.*)/', $gutter, $gutter_parts );

$cell_count = count( $row['cells'] );

// Add the cell sizing
foreach( $row['cells'] as $ci => $cell ) {
$weight = apply_filters( 'siteorigin_panels_css_cell_weight', $cell['weight'], $row, $ri, $cell, $ci - 1, $panels_data, $post_id );

// Add the width and ensure we have correct formatting for CSS.
$css->add_cell_css( $post_id, $ri, $ci, '', array(
'width' => round( $cell['weight'] * ( 100 - ( ($cell_count - 1 ) * 2.6 ) ), 3 ) . '%', // TUT Customization
) );
}

if( ! empty( $row['style']['collapse_order'] ) && $row['style']['collapse_order'] == 'right-top') {
$css->add_cell_css( $post_id, $ri, false, '', array(
'float' => 'right'
) );
}
// START - TUT Customization - Remove bottom margin
// if(
// $ri != count( $layout_data ) - 1 ||
// ! empty( $row[ 'style' ][ 'bottom_margin' ] ) ||
// ! empty( $panels_margin_bottom_last_row )
// ) {
// // Filter the bottom margin for this row with the arguments
// $css->add_row_css( $post_id, $ri, '', array(
// 'margin-bottom' => apply_filters( 'siteorigin_panels_css_row_margin_bottom', $panels_margin_bottom . 'px', $row, $ri, $panels_data, $post_id )
// ) );
// }
//
// $margin_half = ( floatval( $gutter_parts[1] ) / 2 ) . $gutter_parts[2];
// $css->add_row_css($post_id, $ri, '', array(
// 'margin-left' => '-' . $margin_half,
// 'margin-right' => '-' . $margin_half,
// ) );
// $css->add_cell_css($post_id, $ri, false, '', array(
// 'padding-left' => $margin_half,
// 'padding-right' => $margin_half,
// ) );
// }
// END - TUT Customization - Remove bottom margin

// START - TUT Customization - Remove bottom margin
// // Add the bottom margins
// $css->add_widget_css( $post_id, false, false, false, '', array(
// 'margin-bottom' => apply_filters( 'siteorigin_panels_css_cell_margin_bottom', $panels_margin_bottom . 'px', false, false, $panels_data, $post_id )
// ) );
// $css->add_widget_css( $post_id, false, false, false, ':last-child', array(
// 'margin-bottom' => apply_filters( 'siteorigin_panels_css_cell_last_margin_bottom', '0px', false, false, $panels_data, $post_id )
// ) );
// END - TUT Customization - Remove bottom margin

// START - TUT Customization - Remove bottom margin
// if ( $settings['responsive'] ) {
//
// $css->add_cell_css($post_id, false, false, '', array(
// 'float' => 'none',
// 'width' => 'auto'
// ), $panels_mobile_width);
//
// $css->add_row_css($post_id, false, '', array(
// 'margin-left' => 0,
// 'margin-right' => 0,
// ), $panels_mobile_width);
//
// $css->add_cell_css( $post_id, false, false, '', array(
// 'padding' => 0,
// ), $panels_mobile_width );
//
// // Hide empty cells on mobile
// $css->add_row_css( $post_id, false, ' .panel-grid-cell-empty', array(
// 'display' => 'none',
// ), $panels_mobile_width );
//
// // Hide empty cells on mobile
// $css->add_row_css( $post_id, false, ' .panel-grid-cell-mobile-last', array(
// 'margin-bottom' => '0px',
// ), $panels_mobile_width );
//
// foreach ( $layout_data as $ri => $row ) {
// $css->add_cell_css( $post_id, $ri, false, '', array(
// 'margin-bottom' => $panels_margin_bottom . 'px',
// ), $panels_mobile_width );
//
// $css->add_cell_css( $post_id, $ri, false, ':last-child', array(
// 'margin-bottom' => '0px',
// ), $panels_mobile_width );
// }
// }
// END - TUT Customization - Remove responsive design

foreach ( $panels_data['widgets'] as $widget_id => $widget ) {
if ( ! empty( $widget['panels_info']['style']['link_color'] ) ) {
$css->add_widget_css( $post_id, $widget['panels_info']['grid'], $widget['panels_info']['cell'], $widget['panels_info']['cell_index'], ' a', array(
'color' => $widget['panels_info']['style']['link_color']
) );

}
}


// Let other plugins and components filter the CSS object.
$css = apply_filters( 'siteorigin_panels_css_object', $css, $panels_data, $post_id, $layout_data );

return $css->get_css();
}

/**
* This overwrites the parent function to get the cells in reverse order when using right_on_top collapse mode.
*
*
@param $cells The cells to modify
*
@param $row The row the cells belong to
*
*
@return mixed
*/

protected function modify_row_cells( $cells, $row ){
if( ! empty( $row['style']['collapse_order'] ) && $row['style']['collapse_order'] == 'right-top') {
$cells = array_reverse( $cells, true );
}

return $cells;

}

public function front_css_url(){
return siteorigin_panels_url( 'css/front' . ( siteorigin_panels_setting( 'legacy-layout' ) ? '-legacy' : '' ) . '.css' );
}
}
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.