/home/desid573/verdenaturopathy.com.au/wp-content/plugins/popup-builder/com/classes
Edit: /home/desid573/verdenaturopathy.com.au/wp-content/plugins/popup-builder/com/classes/MediaButton.php (2793B)
render();
}
public function __construct($hideMediaButton = true)
{
$this->hideMediaButton = $hideMediaButton;
}
public static function allowToShow()
{
global $pagenow, $typenow;
$allowToShow = false;
$pages = array(
'page.php',
'post-new.php',
'post-edit.php',
'widgets.php'
);
$checkPage = in_array(
$pagenow,
$pages
);
// for show in plugins page when package is pro
if (SGPB_POPUP_PKG !== SGPB_POPUP_PKG_FREE) {
array_push($pages, 'post.php');
}
return ($pages && $typenow != 'download');
}
private function allowToShowJsVariable()
{
return get_post_type() == SG_POPUP_POST_TYPE;
}
public function render()
{
if (!$this->hideMediaButton && $this->allowToShowJsVariable()) {
return '';
}
$output = $this->mediaButton();
$output .= $this->insertJsVariable();
return $output;
}
private function insertJsVariable()
{
if (!$this->allowToShowJsVariable()){
return '';
}
$buttonTitle = __('Insert custom JS variable', SG_POPUP_TEXT_DOMAIN);
ob_start();
@include(SG_POPUP_VIEWS_PATH.'jsVariableView.php');
$jsVariableContent = ob_get_contents();
ob_end_clean();
$img = '';
$output = '
'. $img.$buttonTitle.'';
if (!$this->hideMediaButton) {
$output = '';
}
return $output.$jsVariableContent;
}
private function mediaButton()
{
$allowToShow = MediaButton::allowToShow();
if (!$allowToShow) {
$output = '';
return $output;
}
$currentPostType = AdminHelper::getCurrentPostType();
if (!empty($currentPostType) && $currentPostType == SG_POPUP_POST_TYPE) {
add_action('admin_footer', function() {
require_once(SG_POPUP_VIEWS_PATH.'htmlCustomButtonElement.php');
});
}
ob_start();
@include(SG_POPUP_VIEWS_PATH.'mediaButton.php');
$mediaButtonContent = ob_get_contents();
ob_end_clean();
$showCurrentUser = AdminHelper::showMenuForCurrentUser();
if (!$showCurrentUser) {
return '';
}
$buttonTitle = __('Insert popup', SG_POPUP_TEXT_DOMAIN);
$img = '';
$output = '
'. $img.$buttonTitle.'';
if (!$this->hideMediaButton) {
$output = '';
}
return $output.$mediaButtonContent;
}
}