| 1 |
<?php |
| 2 |
/* |
| 3 |
* License: GPLv3 |
| 4 |
* License URI: https://www.gnu.org/licenses/gpl.txt |
| 5 |
* Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/) |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
|
| 10 |
die( 'These aren\'t the droids you\'re looking for.' ); |
| 11 |
} |
| 12 |
|
| 13 |
if ( ! class_exists( 'WpssoStdAdminGeneral' ) ) { |
| 14 |
|
| 15 |
class WpssoStdAdminGeneral { |
| 16 |
|
| 17 |
private $p; // Wpsso class object. |
| 18 |
|
| 19 |
public function __construct( &$plugin ) { |
| 20 |
|
| 21 |
$this->p =& $plugin; |
| 22 |
|
| 23 |
if ( $this->p->debug->enabled ) { |
| 24 |
|
| 25 |
$this->p->debug->mark(); |
| 26 |
} |
| 27 |
|
| 28 |
$this->p->util->add_plugin_filters( $this, array( |
| 29 |
'mb_general_open_graph_videos_rows' => 2, |
| 30 |
) ); |
| 31 |
} |
| 32 |
|
| 33 |
/* |
| 34 |
* SSO > General Settings > Videos tab. |
| 35 |
*/ |
| 36 |
public function filter_mb_general_open_graph_videos_rows( $table_rows, $form ) { |
| 37 |
|
| 38 |
if ( $this->p->debug->enabled ) { |
| 39 |
|
| 40 |
$this->p->debug->mark(); |
| 41 |
} |
| 42 |
|
| 43 |
$max_media_items = $this->p->cf[ 'form' ][ 'max_media_items' ]; |
| 44 |
|
| 45 |
$table_rows[] = '<td colspan="2">' . $this->p->msgs->pro_feature_video_api() . '</td>'; |
| 46 |
|
| 47 |
$table_rows[ 'og_vid_max' ] = $form->get_tr_hide( $in_view = 'basic', 'og_vid_max' ) . |
| 48 |
$form->get_th_html( _x( 'Maximum Videos to Include', 'option label', 'wpsso' ), |
| 49 |
$css_class = '', $css_id = 'og_vid_max' ) . |
| 50 |
'<td class="blank">' . $form->get_no_select( 'og_vid_max', range( 0, $max_media_items ), |
| 51 |
$css_class = 'short', $css_id = '', $is_assoc = true ) . '</td>'; |
| 52 |
|
| 53 |
$table_rows[ 'og_vid_prev_img' ] = '' . |
| 54 |
$form->get_th_html( _x( 'Include Video Preview Images', 'option label', 'wpsso' ), |
| 55 |
$css_class = '', $css_id = 'og_vid_prev_img' ) . |
| 56 |
$form->get_no_td_checkbox( 'og_vid_prev_img', $this->p->msgs->preview_images_are_first() ); |
| 57 |
|
| 58 |
$table_rows[ 'og_vid_autoplay' ] = $form->get_tr_hide( $in_view = 'basic', 'og_vid_autoplay' ) . |
| 59 |
$form->get_th_html( _x( 'Force Autoplay when Possible', 'option label', 'wpsso' ), |
| 60 |
$css_class = '', $css_id = 'og_vid_autoplay' ) . |
| 61 |
$form->get_no_td_checkbox( 'og_vid_autoplay' ); |
| 62 |
|
| 63 |
$check_embed_html = ''; |
| 64 |
|
| 65 |
foreach ( $this->p->cf[ 'form' ][ 'embed_media' ] as $opt_key => $opt_label ) { |
| 66 |
|
| 67 |
$check_embed_html .= '<p>' . $form->get_no_checkbox_comment( $opt_key ) . ' ' . _x( $opt_label, 'option value', 'wpsso' ) . '</p>'; |
| 68 |
} |
| 69 |
|
| 70 |
$table_rows[ 'plugin_embed_media' ] = '' . |
| 71 |
$form->get_th_html( _x( 'Detect Embedded Media', 'option label', 'wpsso' ), |
| 72 |
$css_class = '', $css_id = 'plugin_embed_media' ) . |
| 73 |
'<td class="blank">' . $check_embed_html . '</td>'; |
| 74 |
|
| 75 |
return $table_rows; |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
|