| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/popup-builder/com/classes/ |
Upload File : |
<?php
namespace sgpb;
/**
* Popup Builder Style
*
* @since 2.5.6
*
* detect and include popup styles to the admin pages
*
*/
class Style
{
public static function enqueueStyles($hook)
{
global $post;
global $post_type;
$pageName = $hook;
$styles = array();
$popupType = AdminHelper::getCurrentPopupType();
$currentPostType = AdminHelper::getCurrentPostType();
if($hook == SG_POPUP_POST_TYPE.'_page_'.SG_POPUP_POST_TYPE) {
$pageName = 'popupType';
}
else if (($hook == 'post-new.php' || $hook == 'post.php') && $currentPostType == SG_POPUP_POST_TYPE) {
$pageName = 'editpage';
}
else if ($hook == 'edit.php' && !empty($currentPostType) && $currentPostType == SG_POPUP_POST_TYPE) {
$pageName = 'popupspage';
}
else if ($hook == SG_POPUP_POST_TYPE.'_page_'.SG_POPUP_SUBSCRIBERS_PAGE) {
$pageName = SG_POPUP_SUBSCRIBERS_PAGE;
}
$registeredPlugins = AdminHelper::getOption('SG_POPUP_BUILDER_REGISTERED_PLUGINS');
if (!$registeredPlugins) {
return;
}
$registeredPlugins = json_decode($registeredPlugins, true);
if (empty($registeredPlugins)) {
return;
}
foreach ($registeredPlugins as $pluginName => $pluginData) {
if (!is_plugin_active($pluginName)) {
continue;
}
if (empty($pluginData['classPath']) || empty($pluginData['className'])) {
continue;
}
$classPath = $pluginData['classPath'];
if (!strpos($classPath, 'wp-content/plugins/')) {
$classPath = SG_POPUP_PLUGIN_PATH.$classPath;
}
if (!file_exists($classPath)) {
continue;
}
require_once($classPath);
if (!class_exists($pluginData['className'])) {
continue;
}
$classObj = new $pluginData['className']();
$extensionInterface = 'SgpbIPopupExtension';
if (!$classObj instanceof $extensionInterface) {
continue;
}
$args = array(
'popupType' => $popupType
);
$styleData = $classObj->getStyles($pageName , $args);
if (!empty($styleData['cssFiles'])) {
$styles[] = $styleData;
}
}
if (empty($styles)) {
return;
}
foreach ($styles as $style) {
if (empty($style['cssFiles'])) {
continue;
}
foreach ($style['cssFiles'] as $cssFile) {
if (empty($cssFile['folderUrl'])) {
ScriptsIncluder::enqueueStyle($cssFile['filename']);
continue;
}
$dirUrl = $cssFile['folderUrl'];
$dep = (!empty($cssFile['dep'])) ? $cssFile['dep'] : '';
$ver = (!empty($cssFile['ver'])) ? $cssFile['ver'] : '';
$inFooter = (!empty($cssFile['inFooter'])) ? $cssFile['inFooter'] : '';;
ScriptsIncluder::registerStyle($cssFile['filename'], array(
'dirUrl'=> $dirUrl,
'dep' => $dep,
'ver' => $ver,
'inFooter' => $inFooter
)
);
ScriptsIncluder::enqueueStyle($cssFile['filename']);
}
}
if ($hook == SG_POPUP_POST_TYPE.'_page_'.SG_POPUP_POST_TYPE) {
ScriptsIncluder::enqueueStyle('popupAdminStyles.css');
}
}
}