File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/admin.php.tar
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-admin/admin.php 0000644 00000030417 15152735353 0020246 0 ustar 00 <?php
/**
* WordPress Administration Bootstrap
*
* @package WordPress
* @subpackage Administration
*/
/**
* In WordPress Administration Screens
*
* @since 2.3.2
*/
if ( ! defined( 'WP_ADMIN' ) ) {
define( 'WP_ADMIN', true );
}
if ( ! defined( 'WP_NETWORK_ADMIN' ) ) {
define( 'WP_NETWORK_ADMIN', false );
}
if ( ! defined( 'WP_USER_ADMIN' ) ) {
define( 'WP_USER_ADMIN', false );
}
if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) {
define( 'WP_BLOG_ADMIN', true );
}
if ( isset( $_GET['import'] ) && ! defined( 'WP_LOAD_IMPORTERS' ) ) {
define( 'WP_LOAD_IMPORTERS', true );
}
require_once dirname( __DIR__ ) . '/wp-load.php';
nocache_headers();
if ( get_option( 'db_upgraded' ) ) {
flush_rewrite_rules();
update_option( 'db_upgraded', false );
/**
* Fires on the next page load after a successful DB upgrade.
*
* @since 2.8.0
*/
do_action( 'after_db_upgrade' );
} elseif ( ! wp_doing_ajax() && empty( $_POST )
&& (int) get_option( 'db_version' ) !== $wp_db_version
) {
if ( ! is_multisite() ) {
wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
exit;
}
/**
* Filters whether to attempt to perform the multisite DB upgrade routine.
*
* In single site, the user would be redirected to wp-admin/upgrade.php.
* In multisite, the DB upgrade routine is automatically fired, but only
* when this filter returns true.
*
* If the network is 50 sites or less, it will run every time. Otherwise,
* it will throttle itself to reduce load.
*
* @since MU (3.0.0)
*
* @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
*/
if ( apply_filters( 'do_mu_upgrade', true ) ) {
$c = get_blog_count();
/*
* If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
* attempt to do no more than threshold value, with some +/- allowed.
*/
if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) === 1 ) ) {
require_once ABSPATH . WPINC . '/http.php';
$response = wp_remote_get(
admin_url( 'upgrade.php?step=1' ),
array(
'timeout' => 120,
'httpversion' => '1.1',
)
);
/** This action is documented in wp-admin/network/upgrade.php */
do_action( 'after_mu_upgrade', $response );
unset( $response );
}
unset( $c );
}
}
require_once ABSPATH . 'wp-admin/includes/admin.php';
auth_redirect();
// Schedule Trash collection.
if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'daily', 'wp_scheduled_delete' );
}
// Schedule transient cleanup.
if ( ! wp_next_scheduled( 'delete_expired_transients' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'daily', 'delete_expired_transients' );
}
set_screen_options();
$date_format = __( 'F j, Y' );
$time_format = __( 'g:i a' );
wp_enqueue_script( 'common' );
/**
* $pagenow is set in vars.php.
* $wp_importers is sometimes set in wp-admin/includes/import.php.
* The remaining variables are imported as globals elsewhere, declared as globals here.
*
* @global string $pagenow The filename of the current screen.
* @global array $wp_importers
* @global string $hook_suffix
* @global string $plugin_page
* @global string $typenow The post type of the current screen.
* @global string $taxnow The taxonomy of the current screen.
*/
global $pagenow, $wp_importers, $hook_suffix, $plugin_page, $typenow, $taxnow;
$page_hook = null;
$editing = false;
if ( isset( $_GET['page'] ) ) {
$plugin_page = wp_unslash( $_GET['page'] );
$plugin_page = plugin_basename( $plugin_page );
}
if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
$typenow = $_REQUEST['post_type'];
} else {
$typenow = '';
}
if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
$taxnow = $_REQUEST['taxonomy'];
} else {
$taxnow = '';
}
if ( WP_NETWORK_ADMIN ) {
require ABSPATH . 'wp-admin/network/menu.php';
} elseif ( WP_USER_ADMIN ) {
require ABSPATH . 'wp-admin/user/menu.php';
} else {
require ABSPATH . 'wp-admin/menu.php';
}
if ( current_user_can( 'manage_options' ) ) {
wp_raise_memory_limit( 'admin' );
}
/**
* Fires as an admin screen or script is being initialized.
*
* Note, this does not just run on user-facing admin screens.
* It runs on admin-ajax.php and admin-post.php as well.
*
* This is roughly analogous to the more general {@see 'init'} hook, which fires earlier.
*
* @since 2.5.0
*/
do_action( 'admin_init' );
if ( isset( $plugin_page ) ) {
if ( ! empty( $typenow ) ) {
$the_parent = $pagenow . '?post_type=' . $typenow;
} else {
$the_parent = $pagenow;
}
$page_hook = get_plugin_page_hook( $plugin_page, $the_parent );
if ( ! $page_hook ) {
$page_hook = get_plugin_page_hook( $plugin_page, $plugin_page );
// Back-compat for plugins using add_management_page().
if ( empty( $page_hook ) && 'edit.php' === $pagenow && get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
// There could be plugin specific params on the URL, so we need the whole query string.
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
$query_string = $_SERVER['QUERY_STRING'];
} else {
$query_string = 'page=' . $plugin_page;
}
wp_redirect( admin_url( 'tools.php?' . $query_string ) );
exit;
}
}
unset( $the_parent );
}
$hook_suffix = '';
if ( isset( $page_hook ) ) {
$hook_suffix = $page_hook;
} elseif ( isset( $plugin_page ) ) {
$hook_suffix = $plugin_page;
} elseif ( isset( $pagenow ) ) {
$hook_suffix = $pagenow;
}
set_current_screen();
// Handle plugin admin pages.
if ( isset( $plugin_page ) ) {
if ( $page_hook ) {
/**
* Fires before a particular screen is loaded.
*
* The load-* hook fires in a number of contexts. This hook is for plugin screens
* where a callback is provided when the screen is registered.
*
* The dynamic portion of the hook name, `$page_hook`, refers to a mixture of plugin
* page information including:
* 1. The page type. If the plugin page is registered as a submenu page, such as for
* Settings, the page type would be 'settings'. Otherwise the type is 'toplevel'.
* 2. A separator of '_page_'.
* 3. The plugin basename minus the file extension.
*
* Together, the three parts form the `$page_hook`. Citing the example above,
* the hook name used would be 'load-settings_page_pluginbasename'.
*
* @see get_plugin_page_hook()
*
* @since 2.1.0
*/
do_action( "load-{$page_hook}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
/**
* Used to call the registered callback for a plugin screen.
*
* This hook uses a dynamic hook name, `$page_hook`, which refers to a mixture of plugin
* page information including:
* 1. The page type. If the plugin page is registered as a submenu page, such as for
* Settings, the page type would be 'settings'. Otherwise the type is 'toplevel'.
* 2. A separator of '_page_'.
* 3. The plugin basename minus the file extension.
*
* Together, the three parts form the `$page_hook`. Citing the example above,
* the hook name used would be 'settings_page_pluginbasename'.
*
* @see get_plugin_page_hook()
*
* @since 1.5.0
*/
do_action( $page_hook );
} else {
if ( validate_file( $plugin_page ) ) {
wp_die( __( 'Invalid plugin page.' ) );
}
if ( ! ( file_exists( WP_PLUGIN_DIR . "/$plugin_page" ) && is_file( WP_PLUGIN_DIR . "/$plugin_page" ) )
&& ! ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) && is_file( WPMU_PLUGIN_DIR . "/$plugin_page" ) )
) {
/* translators: %s: Admin page generated by a plugin. */
wp_die( sprintf( __( 'Cannot load %s.' ), htmlentities( $plugin_page ) ) );
}
/**
* Fires before a particular screen is loaded.
*
* The load-* hook fires in a number of contexts. This hook is for plugin screens
* where the file to load is directly included, rather than the use of a function.
*
* The dynamic portion of the hook name, `$plugin_page`, refers to the plugin basename.
*
* @see plugin_basename()
*
* @since 1.5.0
*/
do_action( "load-{$plugin_page}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
if ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) ) {
include WPMU_PLUGIN_DIR . "/$plugin_page";
} else {
include WP_PLUGIN_DIR . "/$plugin_page";
}
}
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
} elseif ( isset( $_GET['import'] ) ) {
$importer = $_GET['import'];
if ( ! current_user_can( 'import' ) ) {
wp_die( __( 'Sorry, you are not allowed to import content into this site.' ) );
}
if ( validate_file( $importer ) ) {
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
exit;
}
if ( ! isset( $wp_importers[ $importer ] ) || ! is_callable( $wp_importers[ $importer ][2] ) ) {
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
exit;
}
/**
* Fires before an importer screen is loaded.
*
* The dynamic portion of the hook name, `$importer`, refers to the importer slug.
*
* Possible hook names include:
*
* - `load-importer-blogger`
* - `load-importer-wpcat2tag`
* - `load-importer-livejournal`
* - `load-importer-mt`
* - `load-importer-rss`
* - `load-importer-tumblr`
* - `load-importer-wordpress`
*
* @since 3.5.0
*/
do_action( "load-importer-{$importer}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
// Used in the HTML title tag.
$title = __( 'Import' );
$parent_file = 'tools.php';
$submenu_file = 'import.php';
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
}
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
define( 'WP_IMPORTING', true );
/**
* Filters whether to filter imported data through kses on import.
*
* Multisite uses this hook to filter all data through kses by default,
* as a super administrator may be assisting an untrusted user.
*
* @since 3.1.0
*
* @param bool $force Whether to force data to be filtered through kses. Default false.
*/
if ( apply_filters( 'force_filtered_html_on_import', false ) ) {
kses_init_filters(); // Always filter imported data with kses on multisite.
}
call_user_func( $wp_importers[ $importer ][2] );
require_once ABSPATH . 'wp-admin/admin-footer.php';
// Make sure rules are flushed.
flush_rewrite_rules( false );
exit;
} else {
/**
* Fires before a particular screen is loaded.
*
* The load-* hook fires in a number of contexts. This hook is for core screens.
*
* The dynamic portion of the hook name, `$pagenow`, is a global variable
* referring to the filename of the current screen, such as 'admin.php',
* 'post-new.php' etc. A complete hook for the latter would be
* 'load-post-new.php'.
*
* @since 2.1.0
*/
do_action( "load-{$pagenow}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/*
* The following hooks are fired to ensure backward compatibility.
* In all other cases, 'load-' . $pagenow should be used instead.
*/
if ( 'page' === $typenow ) {
if ( 'post-new.php' === $pagenow ) {
do_action( 'load-page-new.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
} elseif ( 'post.php' === $pagenow ) {
do_action( 'load-page.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
} elseif ( 'edit-tags.php' === $pagenow ) {
if ( 'category' === $taxnow ) {
do_action( 'load-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
} elseif ( 'link_category' === $taxnow ) {
do_action( 'load-edit-link-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
} elseif ( 'term.php' === $pagenow ) {
do_action( 'load-edit-tags.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
}
if ( ! empty( $_REQUEST['action'] ) ) {
$action = $_REQUEST['action'];
/**
* Fires when an 'action' request variable is sent.
*
* The dynamic portion of the hook name, `$action`, refers to
* the action derived from the `GET` or `POST` request.
*
* @since 2.6.0
*/
do_action( "admin_action_{$action}" );
}
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-admin/user/admin.php 0000644 00000001541 15153263651 0021216 0 ustar 00 <?php
/**
* WordPress User Administration Bootstrap
*
* @package WordPress
* @subpackage Administration
* @since 3.1.0
*/
define( 'WP_USER_ADMIN', true );
require_once dirname( __DIR__ ) . '/admin.php';
if ( ! is_multisite() ) {
wp_redirect( admin_url() );
exit;
}
$redirect_user_admin_request = ( 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ) );
/**
* Filters whether to redirect the request to the User Admin in Multisite.
*
* @since 3.2.0
*
* @param bool $redirect_user_admin_request Whether the request should be redirected.
*/
$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request );
if ( $redirect_user_admin_request ) {
wp_redirect( user_admin_url() );
exit;
}
unset( $redirect_user_admin_request );
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-admin/includes/admin.php 0000644 00000007054 15153356160 0022051 0 ustar 00 <?php
/**
* Core Administration API
*
* @package WordPress
* @subpackage Administration
* @since 2.3.0
*/
if ( ! defined( 'WP_ADMIN' ) ) {
/*
* This file is being included from a file other than wp-admin/admin.php, so
* some setup was skipped. Make sure the admin message catalog is loaded since
* load_default_textdomain() will not have done so in this context.
*/
$admin_locale = get_locale();
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . $admin_locale . '.mo', $admin_locale );
unset( $admin_locale );
}
/** WordPress Administration Hooks */
require_once ABSPATH . 'wp-admin/includes/admin-filters.php';
/** WordPress Bookmark Administration API */
require_once ABSPATH . 'wp-admin/includes/bookmark.php';
/** WordPress Comment Administration API */
require_once ABSPATH . 'wp-admin/includes/comment.php';
/** WordPress Administration File API */
require_once ABSPATH . 'wp-admin/includes/file.php';
/** WordPress Image Administration API */
require_once ABSPATH . 'wp-admin/includes/image.php';
/** WordPress Media Administration API */
require_once ABSPATH . 'wp-admin/includes/media.php';
/** WordPress Import Administration API */
require_once ABSPATH . 'wp-admin/includes/import.php';
/** WordPress Misc Administration API */
require_once ABSPATH . 'wp-admin/includes/misc.php';
/** WordPress Misc Administration API */
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php';
/** WordPress Options Administration API */
require_once ABSPATH . 'wp-admin/includes/options.php';
/** WordPress Plugin Administration API */
require_once ABSPATH . 'wp-admin/includes/plugin.php';
/** WordPress Post Administration API */
require_once ABSPATH . 'wp-admin/includes/post.php';
/** WordPress Administration Screen API */
require_once ABSPATH . 'wp-admin/includes/class-wp-screen.php';
require_once ABSPATH . 'wp-admin/includes/screen.php';
/** WordPress Taxonomy Administration API */
require_once ABSPATH . 'wp-admin/includes/taxonomy.php';
/** WordPress Template Administration API */
require_once ABSPATH . 'wp-admin/includes/template.php';
/** WordPress List Table Administration API and base class */
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table-compat.php';
require_once ABSPATH . 'wp-admin/includes/list-table.php';
/** WordPress Theme Administration API */
require_once ABSPATH . 'wp-admin/includes/theme.php';
/** WordPress Privacy Functions */
require_once ABSPATH . 'wp-admin/includes/privacy-tools.php';
/** WordPress Privacy List Table classes. */
// Previously in wp-admin/includes/user.php. Need to be loaded for backward compatibility.
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php';
/** WordPress User Administration API */
require_once ABSPATH . 'wp-admin/includes/user.php';
/** WordPress Site Icon API */
require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';
/** WordPress Update Administration API */
require_once ABSPATH . 'wp-admin/includes/update.php';
/** WordPress Deprecated Administration API */
require_once ABSPATH . 'wp-admin/includes/deprecated.php';
/** WordPress Multisite support API */
if ( is_multisite() ) {
require_once ABSPATH . 'wp-admin/includes/ms-admin-filters.php';
require_once ABSPATH . 'wp-admin/includes/ms.php';
require_once ABSPATH . 'wp-admin/includes/ms-deprecated.php';
}
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-admin/network/admin.php 0000644 00000002000 15153444420 0021713 0 ustar 00 <?php
/**
* WordPress Network Administration Bootstrap
*
* @package WordPress
* @subpackage Multisite
* @since 3.1.0
*/
define( 'WP_NETWORK_ADMIN', true );
/** Load WordPress Administration Bootstrap */
require_once dirname( __DIR__ ) . '/admin.php';
// Do not remove this check. It is required by individual network admin pages.
if ( ! is_multisite() ) {
wp_die( __( 'Multisite support is not enabled.' ) );
}
$redirect_network_admin_request = ( 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ) );
/**
* Filters whether to redirect the request to the Network Admin.
*
* @since 3.2.0
*
* @param bool $redirect_network_admin_request Whether the request should be redirected.
*/
$redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request );
if ( $redirect_network_admin_request ) {
wp_redirect( network_admin_url() );
exit;
}
unset( $redirect_network_admin_request );
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/contact-form-7/admin/admin.php 0000644 00000042717 15154030536 0026140 0 ustar 00 <?php
require_once WPCF7_PLUGIN_DIR . '/admin/includes/admin-functions.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/help-tabs.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/tag-generator.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/welcome-panel.php';
require_once WPCF7_PLUGIN_DIR . '/admin/includes/config-validator.php';
add_action(
'admin_init',
static function () {
do_action( 'wpcf7_admin_init' );
},
10, 0
);
add_action(
'admin_menu',
'wpcf7_admin_menu',
9, 0
);
function wpcf7_admin_menu() {
do_action( 'wpcf7_admin_menu' );
add_menu_page(
__( 'Contact Form 7', 'contact-form-7' ),
__( 'Contact', 'contact-form-7' )
. wpcf7_admin_menu_change_notice(),
'wpcf7_read_contact_forms',
'wpcf7',
'wpcf7_admin_management_page',
'dashicons-email',
30
);
$edit = add_submenu_page( 'wpcf7',
__( 'Edit Contact Form', 'contact-form-7' ),
__( 'Contact Forms', 'contact-form-7' )
. wpcf7_admin_menu_change_notice( 'wpcf7' ),
'wpcf7_read_contact_forms',
'wpcf7',
'wpcf7_admin_management_page'
);
add_action( 'load-' . $edit, 'wpcf7_load_contact_form_admin', 10, 0 );
$addnew = add_submenu_page( 'wpcf7',
__( 'Add New Contact Form', 'contact-form-7' ),
__( 'Add New', 'contact-form-7' )
. wpcf7_admin_menu_change_notice( 'wpcf7-new' ),
'wpcf7_edit_contact_forms',
'wpcf7-new',
'wpcf7_admin_add_new_page'
);
add_action( 'load-' . $addnew, 'wpcf7_load_contact_form_admin', 10, 0 );
$integration = WPCF7_Integration::get_instance();
if ( $integration->service_exists() ) {
$integration = add_submenu_page( 'wpcf7',
__( 'Integration with External API', 'contact-form-7' ),
__( 'Integration', 'contact-form-7' )
. wpcf7_admin_menu_change_notice( 'wpcf7-integration' ),
'wpcf7_manage_integration',
'wpcf7-integration',
'wpcf7_admin_integration_page'
);
add_action( 'load-' . $integration, 'wpcf7_load_integration_page', 10, 0 );
}
}
function wpcf7_admin_menu_change_notice( $menu_slug = '' ) {
$counts = apply_filters( 'wpcf7_admin_menu_change_notice',
array(
'wpcf7' => 0,
'wpcf7-new' => 0,
'wpcf7-integration' => 0,
)
);
if ( empty( $menu_slug ) ) {
$count = absint( array_sum( $counts ) );
} elseif ( isset( $counts[$menu_slug] ) ) {
$count = absint( $counts[$menu_slug] );
} else {
$count = 0;
}
if ( $count ) {
return sprintf(
' <span class="update-plugins %1$d"><span class="plugin-count">%2$s</span></span>',
$count,
esc_html( number_format_i18n( $count ) )
);
}
return '';
}
add_action(
'admin_enqueue_scripts',
'wpcf7_admin_enqueue_scripts',
10, 1
);
function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
if ( false === strpos( $hook_suffix, 'wpcf7' ) ) {
return;
}
wp_enqueue_style( 'contact-form-7-admin',
wpcf7_plugin_url( 'admin/css/styles.css' ),
array(), WPCF7_VERSION, 'all'
);
if ( wpcf7_is_rtl() ) {
wp_enqueue_style( 'contact-form-7-admin-rtl',
wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
array(), WPCF7_VERSION, 'all'
);
}
wp_enqueue_script( 'wpcf7-admin',
wpcf7_plugin_url( 'admin/js/scripts.js' ),
array( 'jquery', 'jquery-ui-tabs' ),
WPCF7_VERSION,
array( 'in_footer' => true )
);
$l10n = array(
'apiSettings' => array(
'root' => sanitize_url( rest_url( 'contact-form-7/v1' ) ),
'namespace' => 'contact-form-7/v1',
'nonce' => ( wp_installing() && ! is_multisite() )
? '' : wp_create_nonce( 'wp_rest' ),
),
'pluginUrl' => wpcf7_plugin_url(),
'saveAlert' => __(
"The changes you made will be lost if you navigate away from this page.",
'contact-form-7' ),
'activeTab' => (int) ( $_GET['active-tab'] ?? 0 ),
'configValidator' => array(
'errors' => array(),
'howToCorrect' => __( "How to resolve?", 'contact-form-7' ),
'oneError' => __( '1 configuration error detected', 'contact-form-7' ),
'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ),
'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
/* translators: screen reader text */
'iconAlt' => __( '(configuration error)', 'contact-form-7' ),
),
);
if ( $post = wpcf7_get_current_contact_form()
and current_user_can( 'wpcf7_edit_contact_form', $post->id() )
and wpcf7_validate_configuration() ) {
$config_validator = new WPCF7_ConfigValidator( $post );
$config_validator->restore();
$l10n['configValidator']['errors'] =
$config_validator->collect_error_messages();
}
wp_localize_script( 'wpcf7-admin', 'wpcf7', $l10n );
add_thickbox();
wp_enqueue_script( 'wpcf7-admin-taggenerator',
wpcf7_plugin_url( 'admin/js/tag-generator.js' ),
array( 'jquery', 'thickbox', 'wpcf7-admin' ),
WPCF7_VERSION,
array( 'in_footer' => true )
);
}
add_filter(
'set_screen_option_wpcf7_contact_forms_per_page',
static function ( $result, $option, $value ) {
$wpcf7_screens = array(
'wpcf7_contact_forms_per_page',
);
if ( in_array( $option, $wpcf7_screens ) ) {
$result = $value;
}
return $result;
},
10, 3
);
function wpcf7_load_contact_form_admin() {
global $plugin_page;
$action = wpcf7_current_action();
do_action( 'wpcf7_admin_load',
trim( $_GET['page'] ?? '' ),
$action
);
if ( 'save' === $action ) {
$id = $_POST['post_ID'] ?? '-1';
check_admin_referer( 'wpcf7-save-contact-form_' . $id );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
wp_die(
__( "You are not allowed to edit this item.", 'contact-form-7' )
);
}
$contact_form = wpcf7_save_contact_form(
array_merge(
$_REQUEST,
array(
'id' => $id,
'title' => $_POST['post_title'] ?? null,
'locale' => $_POST['wpcf7-locale'] ?? null,
'form' => $_POST['wpcf7-form'] ?? '',
'mail' => $_POST['wpcf7-mail'] ?? array(),
'mail_2' => $_POST['wpcf7-mail-2'] ?? array(),
'messages' => $_POST['wpcf7-messages'] ?? array(),
'additional_settings' => $_POST['wpcf7-additional-settings'] ?? '',
)
)
);
if ( $contact_form and wpcf7_validate_configuration() ) {
$config_validator = new WPCF7_ConfigValidator( $contact_form );
$config_validator->validate();
$config_validator->save();
}
$query = array(
'post' => $contact_form ? $contact_form->id() : 0,
'active-tab' => (int) ( $_POST['active-tab'] ?? 0 ),
);
if ( ! $contact_form ) {
$query['message'] = 'failed';
} elseif ( -1 == $id ) {
$query['message'] = 'created';
} else {
$query['message'] = 'saved';
}
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
exit();
}
if ( 'copy' === $action ) {
$id = absint( $_POST['post_ID'] ?? $_REQUEST['post'] ?? '' );
check_admin_referer( 'wpcf7-copy-contact-form_' . $id );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
wp_die(
__( "You are not allowed to edit this item.", 'contact-form-7' )
);
}
$query = array();
if ( $contact_form = wpcf7_contact_form( $id ) ) {
$new_contact_form = $contact_form->copy();
$new_contact_form->save();
$query['post'] = $new_contact_form->id();
$query['message'] = 'created';
}
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
exit();
}
if ( 'delete' === $action ) {
if ( ! empty( $_POST['post_ID'] ) ) {
check_admin_referer( 'wpcf7-delete-contact-form_' . $_POST['post_ID'] );
} elseif ( ! is_array( $_REQUEST['post'] ) ) {
check_admin_referer( 'wpcf7-delete-contact-form_' . $_REQUEST['post'] );
} else {
check_admin_referer( 'bulk-posts' );
}
$posts = (array) ( $_POST['post_ID'] ?? $_REQUEST['post'] ?? array() );
$deleted = 0;
foreach ( $posts as $post ) {
$post = WPCF7_ContactForm::get_instance( $post );
if ( empty( $post ) ) {
continue;
}
if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) ) {
wp_die(
__( "You are not allowed to delete this item.", 'contact-form-7' )
);
}
if ( ! $post->delete() ) {
wp_die( __( "Error in deleting.", 'contact-form-7' ) );
}
$deleted += 1;
}
$query = array();
if ( ! empty( $deleted ) ) {
$query['message'] = 'deleted';
}
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
exit();
}
$post = null;
if ( 'wpcf7-new' === $plugin_page ) {
$post = WPCF7_ContactForm::get_template( array(
'locale' => $_GET['locale'] ?? null,
) );
} elseif ( ! empty( $_GET['post'] ) ) {
$post = WPCF7_ContactForm::get_instance( $_GET['post'] );
}
$current_screen = get_current_screen();
$help_tabs = new WPCF7_Help_Tabs( $current_screen );
if ( $post
and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) {
$help_tabs->set_help_tabs( 'edit' );
} else {
$help_tabs->set_help_tabs( 'list' );
if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) ) {
require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php';
}
add_filter(
'manage_' . $current_screen->id . '_columns',
array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ),
10, 0
);
add_screen_option( 'per_page', array(
'default' => 20,
'option' => 'wpcf7_contact_forms_per_page',
) );
}
}
function wpcf7_admin_management_page() {
if ( $post = wpcf7_get_current_contact_form() ) {
$post_id = $post->initial() ? -1 : $post->id();
require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php';
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
return;
}
if ( 'validate' == wpcf7_current_action()
and wpcf7_validate_configuration()
and current_user_can( 'wpcf7_edit_contact_forms' ) ) {
wpcf7_admin_bulk_validate_page();
return;
}
$list_table = new WPCF7_Contact_Form_List_Table();
$list_table->prepare_items();
?>
<div class="wrap" id="wpcf7-contact-form-list-table">
<h1 class="wp-heading-inline"><?php
echo esc_html( __( 'Contact Forms', 'contact-form-7' ) );
?></h1>
<?php
if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) {
echo wpcf7_link(
menu_page_url( 'wpcf7-new', false ),
__( 'Add New', 'contact-form-7' ),
array( 'class' => 'page-title-action' )
);
}
if ( ! empty( $_REQUEST['s'] ) ) {
echo sprintf(
'<span class="subtitle">'
/* translators: %s: search keywords */
. __( 'Search results for “%s”', 'contact-form-7' )
. '</span>',
esc_html( $_REQUEST['s'] )
);
}
?>
<hr class="wp-header-end">
<?php
do_action( 'wpcf7_admin_warnings',
'wpcf7', wpcf7_current_action(), null
);
wpcf7_welcome_panel();
do_action( 'wpcf7_admin_notices',
'wpcf7', wpcf7_current_action(), null
);
?>
<form method="get" action="">
<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
<?php $list_table->search_box( __( 'Search Contact Forms', 'contact-form-7' ), 'wpcf7-contact' ); ?>
<?php $list_table->display(); ?>
</form>
</div>
<?php
}
function wpcf7_admin_add_new_page() {
$post = wpcf7_get_current_contact_form();
if ( ! $post ) {
$post = WPCF7_ContactForm::get_template();
}
$post_id = -1;
require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php';
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
}
function wpcf7_load_integration_page() {
do_action( 'wpcf7_admin_load',
trim( $_GET['page'] ?? '' ),
wpcf7_current_action()
);
$integration = WPCF7_Integration::get_instance();
if ( isset( $_REQUEST['service'] )
and $integration->service_exists( $_REQUEST['service'] ) ) {
$service = $integration->get_service( $_REQUEST['service'] );
$service->load( wpcf7_current_action() );
}
$help_tabs = new WPCF7_Help_Tabs( get_current_screen() );
$help_tabs->set_help_tabs( 'integration' );
}
function wpcf7_admin_integration_page() {
$integration = WPCF7_Integration::get_instance();
$service = isset( $_REQUEST['service'] )
? $integration->get_service( $_REQUEST['service'] )
: null;
?>
<div class="wrap" id="wpcf7-integration">
<h1><?php echo esc_html( __( 'Integration with External API', 'contact-form-7' ) ); ?></h1>
<p><?php
echo sprintf(
/* translators: %s: link labeled 'Integration with external APIs' */
esc_html( __( "You can expand the possibilities of your contact forms by integrating them with external services. For details, see %s.", 'contact-form-7' ) ),
wpcf7_link(
__( 'https://contactform7.com/integration-with-external-apis/', 'contact-form-7' ),
__( 'Integration with external APIs', 'contact-form-7' )
)
);
?></p>
<?php
do_action( 'wpcf7_admin_warnings',
'wpcf7-integration', wpcf7_current_action(), $service
);
do_action( 'wpcf7_admin_notices',
'wpcf7-integration', wpcf7_current_action(), $service
);
if ( $service ) {
$message = $_REQUEST['message'] ?? '';
$service->admin_notice( $message );
$integration->list_services( array(
'include' => $_REQUEST['service'],
) );
} else {
$integration->list_services();
}
?>
</div>
<?php
}
add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message', 10, 3 );
function wpcf7_admin_updated_message( $page, $action, $object ) {
if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ) ) ) {
return;
}
if ( empty( $_REQUEST['message'] ) ) {
return;
}
if ( 'created' === $_REQUEST['message'] ) {
$updated_message = __( "Contact form created.", 'contact-form-7' );
} elseif ( 'saved' === $_REQUEST['message'] ) {
$updated_message = __( "Contact form saved.", 'contact-form-7' );
} elseif ( 'deleted' === $_REQUEST['message'] ) {
$updated_message = __( "Contact form deleted.", 'contact-form-7' );
}
if ( ! empty( $updated_message ) ) {
echo sprintf(
'<div id="message" class="notice notice-success"><p>%s</p></div>',
esc_html( $updated_message )
);
return;
}
if ( 'failed' === $_REQUEST['message'] ) {
$updated_message =
__( "There was an error saving the contact form.", 'contact-form-7' );
echo sprintf(
'<div id="message" class="notice notice-error"><p>%s</p></div>',
esc_html( $updated_message )
);
return;
}
if ( 'validated' === $_REQUEST['message'] ) {
$bulk_validate = WPCF7::get_option( 'bulk_validate', array() );
$count_invalid = isset( $bulk_validate['count_invalid'] )
? absint( $bulk_validate['count_invalid'] ) : 0;
if ( $count_invalid ) {
$updated_message = sprintf(
_n(
/* translators: %s: number of contact forms */
"Configuration validation completed. %s invalid contact form was found.",
"Configuration validation completed. %s invalid contact forms were found.",
$count_invalid, 'contact-form-7'
),
number_format_i18n( $count_invalid )
);
echo sprintf(
'<div id="message" class="notice notice-warning"><p>%s</p></div>',
esc_html( $updated_message )
);
} else {
$updated_message = __( "Configuration validation completed. No invalid contact form was found.", 'contact-form-7' );
echo sprintf(
'<div id="message" class="notice notice-success"><p>%s</p></div>',
esc_html( $updated_message )
);
}
return;
}
}
add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );
function wpcf7_plugin_action_links( $links, $file ) {
if ( $file != WPCF7_PLUGIN_BASENAME ) {
return $links;
}
if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) {
return $links;
}
$settings_link = wpcf7_link(
menu_page_url( 'wpcf7', false ),
__( 'Settings', 'contact-form-7' )
);
array_unshift( $links, $settings_link );
return $links;
}
add_action( 'wpcf7_admin_warnings', 'wpcf7_old_wp_version_error', 10, 3 );
function wpcf7_old_wp_version_error( $page, $action, $object ) {
$wp_version = get_bloginfo( 'version' );
if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) {
return;
}
?>
<div class="notice notice-warning">
<p><?php
echo sprintf(
/* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */
__( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ),
WPCF7_VERSION,
WPCF7_REQUIRED_WP_VERSION,
admin_url( 'update-core.php' )
);
?></p>
</div>
<?php
}
add_action( 'wpcf7_admin_warnings', 'wpcf7_not_allowed_to_edit', 10, 3 );
function wpcf7_not_allowed_to_edit( $page, $action, $object ) {
if ( $object instanceof WPCF7_ContactForm ) {
$contact_form = $object;
} else {
return;
}
if ( current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) {
return;
}
$message = __( "You are not allowed to edit this contact form.", 'contact-form-7' );
echo sprintf(
'<div class="notice notice-warning"><p>%s</p></div>',
esc_html( $message )
);
}
add_action( 'wpcf7_admin_warnings', 'wpcf7_outdated_php_warning', 10, 3 );
function wpcf7_outdated_php_warning( $page, $action, $object ) {
if ( ! version_compare( PHP_VERSION, '7.4', '<' ) ) {
return;
}
$message = __( "The next major release of Contact Form 7 will discontinue support for outdated PHP versions. If you don't upgrade PHP, you will not be able to upgrade the plugin.", 'contact-form-7' );
echo sprintf(
'<div class="notice notice-warning"><p>%s</p></div>',
esc_html( $message )
);
}
add_action( 'wpcf7_admin_warnings', 'wpcf7_ctct_deprecated_warning', 10, 3 );
function wpcf7_ctct_deprecated_warning( $page, $action, $object ) {
$service = WPCF7_ConstantContact::get_instance();
if ( ! $service->is_active() ) {
return;
}
$message = __( "The Constant Contact integration is deprecated. It is not recommended to continue using the feature.", 'contact-form-7' );
echo sprintf(
'<div class="notice notice-warning"><p>%s</p></div>',
esc_html( $message )
);
}
var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/sayfa-olusturucu/inc/admin.php 0000644 00000160643 15154167404 0026420 0 ustar 00 <?php
/**
* Class SiteOrigin_Panels_Admin
*
* Handles all the admin and database interactions.
*/
class SiteOrigin_Panels_Admin {
/**
* @var bool Store that we're in the save post action, to prevent infinite loops
*/
private $in_save_post;
function __construct() {
add_action( 'plugin_action_links_siteorigin-panels/siteorigin-panels.php', array(
$this,
'plugin_action_links'
) );
add_action( 'plugins_loaded', array( $this, 'admin_init_widget_count' ) );
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
add_action( 'admin_init', array( $this, 'save_home_page' ) );
add_action( 'save_post', array( $this, 'save_post' ) );
add_action( 'after_switch_theme', array( $this, 'update_home_on_theme_change' ) );
// Enqueuing admin scripts
add_action( 'admin_print_scripts-post-new.php', array( $this, 'enqueue_admin_scripts' ) );
add_action( 'admin_print_scripts-post.php', array( $this, 'enqueue_admin_scripts' ) );
add_action( 'admin_print_scripts-appearance_page_so_panels_home_page', array(
$this,
'enqueue_admin_scripts'
) );
add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
add_action( 'admin_print_scripts-edit.php', array( $this, 'footer_column_css' ) );
// Enqueue the admin styles
add_action( 'admin_print_styles-post-new.php', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_print_styles-post.php', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_print_styles-appearance_page_so_panels_home_page', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_print_styles-widgets.php', array( $this, 'enqueue_admin_styles' ) );
// The help tab
add_action( 'load-page.php', array( $this, 'add_help_tab' ), 12 );
add_action( 'load-post-new.php', array( $this, 'add_help_tab' ), 12 );
add_action( 'load-appearance_page_so_panels_home_page', array( $this, 'add_help_tab' ), 12 );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'js_templates' ) );
// Register all the admin actions
add_action( 'wp_ajax_so_panels_builder_content', array( $this, 'action_builder_content' ) );
add_action( 'wp_ajax_so_panels_builder_content_json', array( $this, 'action_builder_content_json' ) );
add_action( 'wp_ajax_so_panels_widget_form', array( $this, 'action_widget_form' ) );
add_action( 'wp_ajax_so_panels_live_editor_preview', array( $this, 'action_live_editor_preview' ) );
add_action( 'wp_ajax_so_panels_layout_block_sanitize', array( $this, 'layout_block_sanitize' ) );
add_action( 'wp_ajax_so_panels_layout_block_preview', array( $this, 'layout_block_preview' ) );
// Initialize the additional admin classes.
SiteOrigin_Panels_Admin_Widget_Dialog::single();
SiteOrigin_Panels_Admin_Widgets_Bundle::single();
SiteOrigin_Panels_Admin_Layouts::single();
// Check to make sure we have all the correct markup
SiteOrigin_Panels_Admin_Dashboard::single();
$this->in_save_post = false;
// Enqueue Yoast compatibility
add_action( 'admin_print_scripts-post-new.php', array( $this, 'enqueue_seo_compat' ), 100 );
add_action( 'admin_print_scripts-post.php', array( $this, 'enqueue_seo_compat' ), 100 );
// Block editor specific actions
if ( function_exists( 'register_block_type' ) ) {
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
add_filter( 'gutenberg_can_edit_post_type', array( $this, 'show_classic_editor_for_panels' ), 10, 2 );
add_filter( 'use_block_editor_for_post_type', array( $this, 'show_classic_editor_for_panels' ), 10, 2 );
add_action( 'admin_print_scripts-edit.php', array( $this, 'add_panels_add_new_button' ) );
if( siteorigin_panels_setting( 'admin-post-state' ) ) {
add_filter( 'display_post_states', array( $this, 'add_panels_post_state' ), 10, 2 );
}
}
}
/**
* @return SiteOrigin_Panels_Admin
*/
public static function single() {
static $single;
return empty( $single ) ? $single = new self() : $single;
}
/**
* Do some general admin initialization
*/
public function admin_init_widget_count(){
if( siteorigin_panels_setting( 'admin-widget-count' ) ) {
// Add the custom columns
$post_types = siteorigin_panels_setting( 'post-types' );
if( ! empty( $post_types ) ) {
foreach( $post_types as $post_type ) {
add_filter( 'manage_' . $post_type . 's_columns' , array( $this, 'add_custom_column' ) );
add_action( 'manage_' . $post_type . 's_custom_column' , array( $this, 'display_custom_column' ), 10, 2 );
}
}
}
}
/**
* Check if this is an admin page.
*
* @return mixed|void
*/
static function is_admin() {
$screen = get_current_screen();
$is_panels_page = ( $screen->base == 'post' && in_array( $screen->id, siteorigin_panels_setting( 'post-types' ) ) ) ||
in_array( $screen->base, array( 'appearance_page_so_panels_home_page', 'widgets', 'customize' ) ) ||
self::is_block_editor();
return apply_filters( 'siteorigin_panels_is_admin_page', $is_panels_page );
}
/**
* Check if the current page is Gutenberg or the Block Ediotr
*
* @return bool
*/
static function is_block_editor() {
// This is for the Gutenberg plugin.
$is_gutenberg_page = function_exists( 'is_gutenberg_page' ) && is_gutenberg_page();
// This is for WP 5 with the integrated block editor.
$is_block_editor = false;
if ( function_exists( 'get_current_screen' ) ) {
$current_screen = get_current_screen();
if ( $current_screen && method_exists( $current_screen, 'is_block_editor' ) ) {
$is_block_editor = $current_screen->is_block_editor();
}
}
return $is_gutenberg_page || $is_block_editor;
}
/**
* Add action links to the plugin list for Page Builder.
*
* @param $links
*
* @return array
*/
function plugin_action_links( $links ) {
if( ! is_array( $links ) ) {
return $links;
}
unset( $links['edit'] );
$links[] = '<a href="https://www.temavadisi.com">' . __( 'Destek', 'siteorigin-panels' ) . '</a>';
if( SiteOrigin_Panels::display_premium_teaser() ) {
$links[] = '<a href="' . esc_url( SiteOrigin_Panels::premium_url() ) . '" style="color: #3db634" target="_blank" rel="noopener noreferrer">' . __('Addons', 'siteorigin-panels') . '</a>';
}
return $links;
}
/**
* Callback to register the Page Builder Metaboxes
*/
function add_meta_boxes() {
foreach ( siteorigin_panels_setting( 'post-types' ) as $type ) {
add_meta_box(
'so-panels-panels',
__( 'Page Builder', 'siteorigin-panels' ),
array( $this, 'render_meta_boxes' ),
( string ) $type,
'advanced',
'high',
array(
// Ideally when we have panels data for a page we would set this to false and it would cause the
// editor to fall back to classic editor, but that's not the case so we just declare it as a `__back_compat_meta_box`.
'__back_compat_meta_box' => true,
'__block_editor_compatible_meta_box' => false,
)
);
}
}
/**
* Render a panel metabox.
*
* @param $post
*/
function render_meta_boxes( $post ) {
$panels_data = $this->get_current_admin_panels_data();
$preview_url = SiteOrigin_Panels::preview_url();
$preview_content = $this->generate_panels_preview( $post->ID, $panels_data );
include plugin_dir_path( __FILE__ ) . '../tpl/metabox-panels.php';
}
/**
* Save the panels data
*
* @param $post_id
*
* @action save_post
*/
function save_post( $post_id ) {
// Check that everything is valid with this save.
if(
$this->in_save_post ||
( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ||
empty( $_POST['_sopanels_nonce'] ) ||
! wp_verify_nonce( $_POST['_sopanels_nonce'], 'save' ) ||
! current_user_can( 'edit_post', $post_id ) ||
! isset( $_POST['panels_data'] )
) {
return;
}
$this->in_save_post = true;
// Get post from db as it might have been changed and saved by other plugins.
$post = get_post( $post_id );
$old_panels_data = get_post_meta( $post_id, 'panels_data', true );
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true );
$panels_data['widgets'] = $this->process_raw_widgets(
$panels_data['widgets'],
! empty( $old_panels_data['widgets'] ) ? $old_panels_data['widgets'] : false,
false
);
if ( siteorigin_panels_setting( 'sidebars-emulator' ) ) {
$sidebars_emulator = SiteOrigin_Panels_Sidebars_Emulator::single();
$panels_data['widgets'] = $sidebars_emulator->generate_sidebar_widget_ids( $panels_data['widgets'], $post_id );
}
$panels_data = SiteOrigin_Panels_Styles_Admin::single()->sanitize_all( $panels_data );
$panels_data = apply_filters( 'siteorigin_panels_data_pre_save', $panels_data, $post, $post_id );
if ( ! empty( $panels_data['widgets'] ) || ! empty( $panels_data['grids'] ) ) {
// Use `update_metadata` instead of `update_post_meta` to prevent saving to parent post when it's a revision, e.g. preview.
update_metadata( 'post', $post_id, 'panels_data', map_deep( $panels_data, array( 'SiteOrigin_Panels_Admin', 'double_slash_string' ) ) );
if( siteorigin_panels_setting( 'copy-content' ) ) {
// Store a version of the HTML in post_content
$post_parent_id = wp_is_post_revision( $post_id );
$layout_id = ( ! empty( $post_parent_id ) ) ? $post_parent_id : $post_id;
SiteOrigin_Panels_Post_Content_Filters::add_filters();
$GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] = true;
$post_content = SiteOrigin_Panels::renderer()->render( $layout_id, false, $panels_data );
$post_css = SiteOrigin_Panels::renderer()->generate_css( $layout_id, $panels_data );
SiteOrigin_Panels_Post_Content_Filters::remove_filters();
unset( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] );
// Update the post_content
$post->post_content = $post_content;
if( siteorigin_panels_setting( 'copy-styles' ) ) {
$post->post_content .= "\n\n";
$post->post_content .= '<style type="text/css" class="panels-style" data-panels-style-for-post="' . intval( $layout_id ) . '">';
$post->post_content .= '@import url(' . SiteOrigin_Panels::front_css_url() . '); ';
$post->post_content .= $post_css;
$post->post_content .= '</style>';
}
wp_update_post( $post );
}
} else {
// There are no widgets or rows, so delete the panels data
delete_post_meta( $post_id, 'panels_data' );
}
$this->in_save_post = false;
}
/**
* Enqueue the panels admin scripts
*
* @param string $prefix
* @param bool $force Should we force the enqueues
*
* @action admin_print_scripts-post-new.php
* @action admin_print_scripts-post.php
* @action admin_print_scripts-appearance_page_so_panels_home_page
*/
function enqueue_admin_scripts( $prefix = '', $force = false ) {
$screen = get_current_screen();
if ( $force || self::is_admin() ) {
// Media is required for row styles
wp_enqueue_media();
wp_enqueue_script(
'so-panels-admin',
siteorigin_panels_url( 'js/siteorigin-panels' . SITEORIGIN_PANELS_JS_SUFFIX . '.js' ),
array(
'jquery',
'jquery-ui-resizable',
'jquery-ui-sortable',
'jquery-ui-draggable',
'wp-color-picker',
'underscore',
'backbone',
'plupload',
'plupload-all'
),
SITEORIGIN_PANELS_VERSION,
true
);
add_action( 'admin_footer', array( $this, 'js_templates' ) );
$widgets = $this->get_widgets();
$directory_enabled = get_user_meta( get_current_user_id(), 'so_panels_directory_enabled', true );
// This is the widget we'll use for default text
if( ! empty( $widgets[ 'SiteOrigin_Widget_Editor_Widget' ] ) ) $text_widget = 'SiteOrigin_Widget_Editor_Widget';
else if( ! empty( $widgets[ 'WP_Widget_Text' ] ) ) $text_widget = 'WP_Widget_Text';
else $text_widget = false;
$text_widget = apply_filters( 'siteorigin_panels_text_widget_class', $text_widget );
$user = wp_get_current_user();
$load_on_attach = siteorigin_panels_setting( 'load-on-attach' ) || isset( $_GET['siteorigin-page-builder'] );
wp_localize_script( 'so-panels-admin', 'panelsOptions', array(
'user' => ! empty( $user ) ? $user->ID : 0,
'ajaxurl' => wp_nonce_url( admin_url( 'admin-ajax.php' ), 'panels_action', '_panelsnonce' ),
'widgets' => $widgets,
'text_widget' => $text_widget,
'widget_dialog_tabs' => apply_filters( 'siteorigin_panels_widget_dialog_tabs', array(
0 => array(
'title' => __( 'All Widgets', 'siteorigin-panels' ),
'filter' => array(
'installed' => true,
'groups' => ''
)
)
) ),
'row_layouts' => apply_filters( 'siteorigin_panels_row_layouts', array() ),
'directory_enabled' => ! empty( $directory_enabled ),
'copy_content' => siteorigin_panels_setting( 'copy-content' ),
'cache' => array(),
'instant_open' => siteorigin_panels_setting( 'instant-open-widgets' ),
// Settings for the contextual menu
'contextual' => array(
// Developers can change which widgets are displayed by default using this filter
'default_widgets' => apply_filters( 'siteorigin_panels_contextual_default_widgets', array(
'SiteOrigin_Widget_Editor_Widget',
'SiteOrigin_Widget_Button_Widget',
'SiteOrigin_Widget_Image_Widget',
'SiteOrigin_Panels_Widgets_Layout',
) )
),
// General localization messages
'loc' => array(
'missing_widget' => array(
'title' => __( 'Missing Widget', 'siteorigin-panels' ),
'description' => __( "Page Builder doesn't know about this widget.", 'siteorigin-panels' ),
),
'time' => array(
// TRANSLATORS: Number of seconds since
'seconds' => __( '%d seconds', 'siteorigin-panels' ),
// TRANSLATORS: Number of minutes since
'minutes' => __( '%d minutes', 'siteorigin-panels' ),
// TRANSLATORS: Number of hours since
'hours' => __( '%d hours', 'siteorigin-panels' ),
// TRANSLATORS: A single second since
'second' => __( '%d second', 'siteorigin-panels' ),
// TRANSLATORS: A single minute since
'minute' => __( '%d minute', 'siteorigin-panels' ),
// TRANSLATORS: A single hour since
'hour' => __( '%d hour', 'siteorigin-panels' ),
// TRANSLATORS: Time ago - eg. "1 minute before".
'ago' => __( '%s before', 'siteorigin-panels' ),
'now' => __( 'Now', 'siteorigin-panels' ),
),
'history' => array(
// History messages
'current' => __( 'Current', 'siteorigin-panels' ),
'revert' => __( 'Original', 'siteorigin-panels' ),
'restore' => __( 'Version restored', 'siteorigin-panels' ),
'back_to_editor' => __( 'Converted to editor', 'siteorigin-panels' ),
// Widgets
// TRANSLATORS: Message displayed in the history when a widget is deleted
'widget_deleted' => __( 'Widget deleted', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a widget is added
'widget_added' => __( 'Widget added', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a widget is edited
'widget_edited' => __( 'Widget edited', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a widget is duplicated
'widget_duplicated' => __( 'Widget duplicated', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a widget position is changed
'widget_moved' => __( 'Widget moved', 'siteorigin-panels' ),
// Rows
// TRANSLATORS: Message displayed in the history when a row is deleted
'row_deleted' => __( 'Row deleted', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a row is added
'row_added' => __( 'Row added', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a row is edited
'row_edited' => __( 'Row edited', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a row position is changed
'row_moved' => __( 'Row moved', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a row is duplicated
'row_duplicated' => __( 'Row duplicated', 'siteorigin-panels' ),
// TRANSLATORS: Message displayed in the history when a row is pasted
'row_pasted' => __( 'Row pasted', 'siteorigin-panels' ),
// Cells
'cell_resized' => __( 'Cell resized', 'siteorigin-panels' ),
// Prebuilt
'prebuilt_loaded' => __( 'Prebuilt layout loaded', 'siteorigin-panels' ),
),
// general localization
'prebuilt_loading' => __( 'Loading prebuilt layout', 'siteorigin-panels' ),
'confirm_use_builder' => __( "Would you like to copy this editor's existing content to Page Builder?", 'siteorigin-panels' ),
'confirm_stop_builder' => __( "Would you like to clear your Page Builder content and revert to using the standard visual editor?", 'siteorigin-panels' ),
// TRANSLATORS: This is the title for a widget called "Layout Builder"
'layout_widget' => __( 'Layout Builder Widget', 'siteorigin-panels' ),
// TRANSLATORS: A standard confirmation message
'dropdown_confirm' => __( 'Are you sure?', 'siteorigin-panels' ),
// TRANSLATORS: When a layout file is ready to be inserted. %s is the filename.
'ready_to_insert' => __( '%s is ready to insert.', 'siteorigin-panels' ),
// Everything for the contextual menu
'contextual' => array(
'add_widget_below' => __( 'Add Widget Below', 'siteorigin-panels' ),
'add_widget_cell' => __( 'Add Widget to Cell', 'siteorigin-panels' ),
'search_widgets' => __( 'Search Widgets', 'siteorigin-panels' ),
'add_row' => __( 'Add Row', 'siteorigin-panels' ),
'column' => __( 'Column', 'siteorigin-panels' ),
'cell_actions' => __( 'Cell Actions', 'siteorigin-panels' ),
'cell_paste_widget' => __( 'Paste Widget', 'siteorigin-panels' ),
'widget_actions' => __( 'Widget Actions', 'siteorigin-panels' ),
'widget_edit' => __( 'Edit Widget', 'siteorigin-panels' ),
'widget_duplicate' => __( 'Duplicate Widget', 'siteorigin-panels' ),
'widget_delete' => __( 'Delete Widget', 'siteorigin-panels' ),
'widget_copy' => __( 'Copy Widget', 'siteorigin-panels' ),
'widget_paste' => __( 'Paste Widget Below', 'siteorigin-panels' ),
'row_actions' => __( 'Row Actions', 'siteorigin-panels' ),
'row_edit' => __( 'Edit Row', 'siteorigin-panels' ),
'row_duplicate' => __( 'Duplicate Row', 'siteorigin-panels' ),
'row_delete' => __( 'Delete Row', 'siteorigin-panels' ),
'row_copy' => __( 'Copy Row', 'siteorigin-panels' ),
'row_paste' => __( 'Paste Row', 'siteorigin-panels' ),
),
'draft' => __( 'Draft', 'siteorigin-panels' ),
'untitled' => __( 'Untitled', 'siteorigin-panels' ),
'row' => array(
'add' => __( 'New Row', 'siteorigin-panels' ),
'edit' => __( 'Row', 'siteorigin-panels' ),
),
'welcomeMessage' => array(
'addingDisabled' => __( 'Hmmm... Adding layout elements is not enabled. Please check if Page Builder has been configured to allow adding elements.', 'siteorigin-panels' ),
'oneEnabled' => __( 'Başlamak için {{%= items[0] %}} ekleyin.', 'siteorigin-panels' ),
'twoEnabled' => __( 'Başlamak için {{%= items[0] %}} veya {{%= items[1] %}} ekleyin.', 'siteorigin-panels' ),
'threeEnabled' => __( 'Başlamak için {{%= items[0] %}}, {{%= items[1] %}} veya {{%= items[2] %}} ekleyin.', 'siteorigin-panels' ),
'addWidgetButton' => "<a href='#' class='so-tool-button so-widget-add'>" . __( 'BileÅŸen', 'siteorigin-panels' ) . "</a>",
'addRowButton' => "<a href='#' class='so-tool-button so-row-add'>" . __( 'Satır', 'siteorigin-panels' ) . "</a>",
'addPrebuiltButton' => "<a href='#' class='so-tool-button so-prebuilt-add'>" . __( 'Hazır Şablon', 'siteorigin-panels' ) . "</a>",
'docsMessage' => sprintf(
__( 'Yardım için %s destek sistemini kullanabilirsiniz.', 'siteorigin-panels' ),
"<a href='https://www.temavadisi.com/' target='_blank' rel='noopener noreferrer'>" . __( 'temavadisi', 'siteorigin-panels' ) . "</a>"
),
),
),
'plupload' => array(
'max_file_size' => wp_max_upload_size() . 'b',
'url' => wp_nonce_url( admin_url( 'admin-ajax.php' ), 'panels_action', '_panelsnonce' ),
'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
'filter_title' => __( 'Page Builder layouts', 'siteorigin-panels' ),
'error_message' => __( 'Error uploading or importing file.', 'siteorigin-panels' ),
),
'wpColorPickerOptions' => apply_filters( 'siteorigin_panels_wpcolorpicker_options', array() ),
'prebuiltDefaultScreenshot' => siteorigin_panels_url( 'css/images/prebuilt-default.png' ),
'loadOnAttach' => $load_on_attach ,
'siteoriginWidgetRegex' => str_replace( '*+', '*', get_shortcode_regex( array( 'siteorigin_widget' ) ) ),
'forms' => array(
'loadingFailed' => __( 'Unknown error. Failed to load the form. Please check your internet connection, contact your web site administrator, or try again later.', 'siteorigin-panels' ),
)
) );
$js_widgets = array();
if ( $screen->base != 'widgets' ) {
// Render all the widget forms. A lot of widgets use this as a chance to enqueue their scripts
$original_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null; // Make sure widgets don't change the global post.
global $wp_widget_factory;
foreach ( $wp_widget_factory->widgets as $widget_obj ) {
ob_start();
$return = $widget_obj->form( array() );
// These are the new widgets in WP 4.8 which are largely JS based. They only enqueue their own
// scripts on the 'widgets' screen.
if ( $this->is_core_js_widget( $widget_obj ) && method_exists( $widget_obj, 'enqueue_admin_scripts' ) ) {
$widget_obj->enqueue_admin_scripts();
}
do_action_ref_array( 'in_widget_form', array( &$widget_obj, &$return, array() ) );
ob_end_clean();
// Need to render templates for new WP 4.8 widgets when not on the 'widgets' screen or in the customizer.
if ( $this->is_core_js_widget( $widget_obj ) ) {
$js_widgets[] = $widget_obj;
}
}
$GLOBALS['post'] = $original_post;
}
// This gives panels a chance to enqueue scripts too, without having to check the screen ID.
if ( $screen->base != 'widgets' && $screen->base != 'customize' ) {
foreach ( $js_widgets as $js_widget ) {
$js_widget->render_control_template_scripts();
}
do_action( 'siteorigin_panel_enqueue_admin_scripts' );
do_action( 'sidebar_admin_setup' );
}
}
}
public function enqueue_seo_compat(){
if ( self::is_admin() ) {
if (
defined( 'WPSEO_FILE' ) &&
(
wp_script_is( 'yoast-seo-admin-global-script' ) || // => 14.6
wp_script_is( 'yoast-seo-metabox' ) // <= 14.5
)
) {
wp_enqueue_script(
'so-panels-seo-compat',
siteorigin_panels_url( 'js/seo-compat' . SITEORIGIN_PANELS_JS_SUFFIX . '.js' ),
array( 'jquery' ),
SITEORIGIN_PANELS_VERSION,
true
);
} elseif ( defined( 'RANK_MATH_VERSION' ) && wp_script_is( 'rank-math-analyzer' ) ) {
wp_enqueue_script(
'so-panels-seo-compat',
siteorigin_panels_url( 'js/seo-compat' . SITEORIGIN_PANELS_JS_SUFFIX . '.js' ),
array('jquery', 'rank-math-analyzer' ),
SITEORIGIN_PANELS_VERSION,
true
);
}
}
}
/**
* Enqueue the admin panel styles
*
* @param string $prefix
* @param bool $force Should we force the enqueue
*
* @action admin_print_styles-post-new.php
* @action admin_print_styles-post.php
*/
function enqueue_admin_styles( $prefix = '', $force = false ) {
if ( $force || self::is_admin() ) {
wp_enqueue_style(
'so-panels-admin',
siteorigin_panels_url( 'css/admin' . SITEORIGIN_PANELS_CSS_SUFFIX . '.css' ),
array( 'wp-color-picker' ),
SITEORIGIN_PANELS_VERSION
);
do_action( 'siteorigin_panel_enqueue_admin_styles' );
}
}
/**
* Add a help tab to pages that include a Page Builder interface.
*
* @param $prefix
*/
function add_help_tab( $prefix ) {
$screen = get_current_screen();
if (
( $screen->base == 'post' && ( in_array( $screen->id, siteorigin_panels_setting( 'post-types' ) ) || $screen->id == '' ) )
|| ( $screen->id == 'appearance_page_so_panels_home_page' )
) {
$screen->add_help_tab( array(
'id' => 'panels-help-tab', //unique id for the tab
'title' => __( 'Page Builder', 'siteorigin-panels' ), //unique visible title for the tab
'callback' => array( $this, 'help_tab_content' )
) );
}
}
/**
* Display the content for the help tab.
*/
function help_tab_content() {
include plugin_dir_path( __FILE__ ) . '../tpl/help.php';
}
/**
* Get the Page Builder data for the current admin page.
*
* @return array
*/
function get_current_admin_panels_data() {
$screen = get_current_screen();
// Localize the panels with the panels data
if ( $screen->base == 'appearance_page_so_panels_home_page' ) {
$home_page_id = get_option( 'page_on_front' );
if ( empty( $home_page_id ) ) {
$home_page_id = get_option( 'siteorigin_panels_home_page_id' );
}
$panels_data = ! empty( $home_page_id ) ? get_post_meta( $home_page_id, 'panels_data', true ) : null;
if ( is_null( $panels_data ) ) {
// Load the default layout
$layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
$home_name = siteorigin_panels_setting( 'home-page-default' ) ? siteorigin_panels_setting( 'home-page-default' ) : 'home';
$panels_data = ! empty( $layouts[ $home_name ] ) ? $layouts[ $home_name ] : current( $layouts );
} elseif ( empty( $panels_data ) ) {
// The current page_on_front isn't using page builder
return false;
}
$panels_data = apply_filters( 'siteorigin_panels_data', $panels_data, 'home' );
} else {
global $post;
if ( ! empty( $post ) ) {
$panels_data = get_post_meta( $post->ID, 'panels_data', true );
$panels_data = apply_filters( 'siteorigin_panels_data', $panels_data, $post->ID );
}
}
if ( empty( $panels_data ) ) {
$panels_data = array();
}
return $panels_data;
}
/**
* Save home page
*/
function save_home_page() {
if ( ! isset( $_POST['_sopanels_home_nonce'] ) || ! wp_verify_nonce( $_POST['_sopanels_home_nonce'], 'save' ) ) {
return;
}
if ( ! current_user_can( 'edit_theme_options' ) ) {
return;
}
if ( ! isset( $_POST['panels_data'] ) ) {
return;
}
// Check that the home page ID is set and the home page exists
$page_id = get_option( 'page_on_front' );
if ( empty( $page_id ) ) {
$page_id = get_option( 'siteorigin_panels_home_page_id' );
}
$post_content = wp_unslash( $_POST['post_content'] );
if ( ! $page_id || get_post_meta( $page_id, 'panels_data', true ) == '' ) {
// Lets create a new page
$page_id = wp_insert_post( array(
// TRANSLATORS: This is the default name given to a user's home page
'post_title' => __( 'Home Page', 'siteorigin-panels' ),
'post_status' => ! empty( $_POST['siteorigin_panels_home_enabled'] ) ? 'publish' : 'draft',
'post_type' => 'page',
'post_content' => $post_content,
'comment_status' => 'closed',
) );
update_option( 'page_on_front', $page_id );
update_option( 'siteorigin_panels_home_page_id', $page_id );
// Action triggered when creating a new home page through the custom home page interface
do_action( 'siteorigin_panels_create_home_page', $page_id );
} else {
// `wp_insert_post` does it's own sanitization, but it seems `wp_update_post` doesn't.
$post_content = sanitize_post_field( 'post_content', $post_content, $page_id, 'db' );
// Update the post with changed content to save revision if necessary.
wp_update_post( array( 'ID' => $page_id, 'post_content' => $post_content ) );
}
$page = get_post( $page_id );
// Save the updated page data
$old_panels_data = get_post_meta( $page_id, 'panels_data', true );
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true );
$panels_data['widgets'] = $this->process_raw_widgets(
$panels_data['widgets'],
! empty( $old_panels_data['widgets'] ) ? $old_panels_data['widgets'] : false,
false
);
if ( siteorigin_panels_setting( 'sidebars-emulator' ) ) {
$sidebars_emulator = SiteOrigin_Panels_Sidebars_Emulator::single();
$panels_data['widgets'] = $sidebars_emulator->generate_sidebar_widget_ids( $panels_data['widgets'], $page_id );
}
$panels_data = SiteOrigin_Panels_Styles_Admin::single()->sanitize_all( $panels_data );
$panels_data = apply_filters( 'siteorigin_panels_data_pre_save', $panels_data, $page, $page_id );
update_post_meta( $page_id, 'panels_data', map_deep( $panels_data, array( 'SiteOrigin_Panels_Admin', 'double_slash_string' ) ) );
$template = get_post_meta( $page_id, '_wp_page_template', true );
$home_template = siteorigin_panels_setting( 'home-template' );
if ( ( $template == '' || $template == 'default' ) && ! empty( $home_template ) ) {
// Set the home page template
update_post_meta( $page_id, '_wp_page_template', $home_template );
}
if ( ! empty( $_POST['siteorigin_panels_home_enabled'] ) ) {
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $page_id );
update_option( 'siteorigin_panels_home_page_id', $page_id );
wp_publish_post( $page_id );
} else {
// We're disabling this home page
update_option( 'show_on_front', 'posts' );
// Change the post status to draft
$post = get_post( $page_id );
if ( $post->post_status != 'draft' ) {
global $wpdb;
$wpdb->update( $wpdb->posts, array( 'post_status' => 'draft' ), array( 'ID' => $post->ID ) );
clean_post_cache( $post->ID );
$old_status = $post->post_status;
$post->post_status = 'draft';
wp_transition_post_status( 'draft', $old_status, $post );
do_action( 'edit_post', $post->ID, $post );
do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
do_action( 'save_post', $post->ID, $post, true );
do_action( 'wp_insert_post', $post->ID, $post, true );
}
}
}
/**
* After the theme is switched, change the template on the home page if the theme supports home page functionality.
*/
function update_home_on_theme_change() {
$page_id = get_option( 'page_on_front' );
if ( empty( $page_id ) ) {
$page_id = get_option( 'siteorigin_panels_home_page_id' );
}
if ( siteorigin_panels_setting( 'home-page' ) && siteorigin_panels_setting( 'home-template' ) && $page_id && get_post_meta( $page_id, 'panels_data', true ) !== '' ) {
// Lets update the home page to use the home template that this theme supports
update_post_meta( $page_id, '_wp_page_template', siteorigin_panels_setting( 'home-template' ) );
}
}
/**
* @return array|mixed|void
*/
function get_widgets() {
global $wp_widget_factory;
$widgets = array();
foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
$class = preg_match( '/[0-9a-f]{32}/', $class ) ? get_class( $widget_obj ) : $class;
$widgets[ $class ] = array(
'class' => $class,
'title' => ! empty( $widget_obj->name ) ? $widget_obj->name : __( 'Untitled Widget', 'siteorigin-panels' ),
'description' => ! empty( $widget_obj->widget_options['description'] ) ? $widget_obj->widget_options['description'] : '',
'installed' => true,
'groups' => array(),
);
// Get Page Builder specific widget options
if ( isset( $widget_obj->widget_options['panels_title'] ) ) {
$widgets[ $class ]['panels_title'] = $widget_obj->widget_options['panels_title'];
}
if ( isset( $widget_obj->widget_options['panels_groups'] ) ) {
$widgets[ $class ]['groups'] = $widget_obj->widget_options['panels_groups'];
}
if ( isset( $widget_obj->widget_options['panels_icon'] ) ) {
$widgets[ $class ]['icon'] = $widget_obj->widget_options['panels_icon'];
}
}
// Other plugins can manipulate the list of widgets. Possibly to add recommended widgets
$widgets = apply_filters( 'siteorigin_panels_widgets', $widgets );
// Exclude these temporarily, as they won't work until we have a reliable way to enqueue their admin form scripts.
$to_exclude = array(
'Jetpack_Gallery_Widget',
'WPCOM_Widget_GooglePlus_Badge',
'Jetpack_Widget_Social_Icons',
'Jetpack_Twitter_Timeline_Widget'
);
foreach ( $to_exclude as $widget_class ) {
if ( in_array( $widget_class, $widgets ) ) {
unset( $widgets[ $widget_class ] );
}
}
// Sort the widgets alphabetically
uasort( $widgets, array( $this, 'widgets_sorter' ) );
return $widgets;
}
/**
* Sorts widgets for get_widgets function by title
*
* @param $a
* @param $b
*
* @return int
*/
function widgets_sorter( $a, $b ) {
if ( empty( $a['title'] ) ) {
return - 1;
}
if ( empty( $b['title'] ) ) {
return 1;
}
return $a['title'] > $b['title'] ? 1 : - 1;
}
/**
* Process raw widgets that have come from the Page Builder front end.
*
* @param array $widgets An array of widgets from panels_data.
* @param array $old_widgets
* @param bool $escape_classes Should the class names be escaped.
* @param bool $force
*
* @return array
*/
function process_raw_widgets( $widgets, $old_widgets = array(), $escape_classes = false, $force = false ) {
if ( empty( $widgets ) || ! is_array( $widgets ) ) {
return array();
}
$old_widgets_by_id = array();
if( ! empty( $old_widgets ) ) {
foreach( $old_widgets as $widget ) {
if( ! empty( $widget[ 'panels_info' ][ 'widget_id' ] ) ) {
$old_widgets_by_id[ $widget[ 'panels_info' ][ 'widget_id' ] ] = $widget;
unset( $old_widgets_by_id[ $widget[ 'panels_info' ][ 'widget_id' ] ][ 'panels_info' ] );
}
}
}
foreach( $widgets as $i => & $widget ) {
if ( ! is_array( $widget ) ) {
continue;
}
if ( is_array( $widget ) ) {
$info = (array) ( is_array( $widget['panels_info'] ) ? $widget['panels_info'] : $widget['info'] );
} else {
$info = array();
}
unset( $widget['info'] );
$info[ 'class' ] = apply_filters( 'siteorigin_panels_widget_class', $info[ 'class' ] );
if ( ! empty( $info['raw'] ) || $force ) {
$the_widget = SiteOrigin_Panels::get_widget_instance( $info['class'] );
if ( ! empty( $the_widget ) &&
method_exists( $the_widget, 'update' ) ) {
if(
! empty( $old_widgets_by_id ) &&
! empty( $widget[ 'panels_info' ][ 'widget_id' ] ) &&
! empty( $old_widgets_by_id[ $widget[ 'panels_info' ][ 'widget_id' ] ] )
){
$old_widget = $old_widgets_by_id[ $widget[ 'panels_info' ][ 'widget_id' ] ];
}
else {
$old_widget = $widget;
}
/** @var WP_Widget $the_widget */
$the_widget = SiteOrigin_Panels::get_widget_instance( $info['class'] );
$instance = $the_widget->update( $widget, $old_widget );
$instance = apply_filters( 'widget_update_callback', $instance, $widget, $old_widget, $the_widget );
$widget = $instance;
unset( $info['raw'] );
}
}
if( $escape_classes ) {
// Escaping for namespaced widgets
$info[ 'class' ] = preg_replace( '/\\\\+/', '\\\\\\\\', $info['class'] );
}
$widget['panels_info'] = $info;
}
return $widgets;
}
/**
* Add all the footer JS templates.
*/
function js_templates() {
include plugin_dir_path( __FILE__ ) . '../tpl/js-templates.php';
}
/**
* Render a widget form with all the Page Builder specific fields
*
* @param string $widget_class The class of the widget
* @param array $instance Widget values
* @param bool $raw
* @param string $widget_number
*
* @return mixed|string The form
*/
function render_form( $widget_class, $instance = array(), $raw = false, $widget_number = '{$id}' ) {
$the_widget = SiteOrigin_Panels::get_widget_instance( $widget_class );
// This is a chance for plugins to replace missing widgets
$the_widget = apply_filters( 'siteorigin_panels_widget_object', $the_widget, $widget_class );
if ( empty( $the_widget ) || ! is_a( $the_widget, 'WP_Widget' ) ) {
$widgets = $this->get_widgets();
if ( ! empty( $widgets[ $widget_class ] ) && ! empty( $widgets[ $widget_class ]['plugin'] ) ) {
// We know about this widget, show a form about installing it.
$install_url = siteorigin_panels_plugin_activation_install_url( $widgets[ $widget_class ]['plugin']['slug'], $widgets[ $widget_class ]['plugin']['name'] );
$form =
'<div class="panels-missing-widget-form">' .
'<p>' .
preg_replace(
array(
'/1\{ *(.*?) *\}/',
'/2\{ *(.*?) *\}/',
),
array(
'<a href="' . $install_url . '" target="_blank" rel="noopener noreferrer">$1</a>',
'<strong>$1</strong>'
),
sprintf(
__( 'You need to install 1{%1$s} to use the widget 2{%2$s}.', 'siteorigin-panels' ),
$widgets[ $widget_class ]['plugin']['name'],
$widget_class
)
) .
'</p>' .
'<p>' . __( "Save and reload this page to start using the widget after you've installed it.", 'siteorigin-panels' ) . '</p>' .
'</div>';
} else {
// This widget is missing, so show a missing widgets form.
$form =
'<div class="panels-missing-widget-form"><p>' .
preg_replace(
array(
'/1\{ *(.*?) *\}/',
'/2\{ *(.*?) *\}/',
),
array(
'<strong>$1</strong>',
'<a href="https://siteorigin.com/thread/" target="_blank" rel="noopener noreferrer">$1</a>'
),
sprintf(
__( 'The widget 1{%1$s} is not available. Please try locate and install the missing plugin. Post on the 2{support forums} if you need help.', 'siteorigin-panels' ),
esc_html( $widget_class )
)
) .
'</p></div>';
}
// Allow other themes and plugins to change the missing widget form
return apply_filters( 'siteorigin_panels_missing_widget_form', $form, $widget_class, $instance );
}
if ( $raw ) {
$instance = $the_widget->update( $instance, $instance );
}
$the_widget->id = 'temp';
$the_widget->number = $widget_number;
ob_start();
if ( $this->is_core_js_widget( $the_widget ) ) {
?><div class="widget-content"><?php
}
$return = $the_widget->form( $instance );
do_action_ref_array( 'in_widget_form', array( &$the_widget, &$return, $instance ) );
if ( $this->is_core_js_widget( $the_widget ) ) {
?>
</div>
<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $the_widget->id_base ); ?>" />
<?php
}
$form = ob_get_clean();
// Convert the widget field naming into ones that Page Builder uses
$exp = preg_quote( $the_widget->get_field_name( '____' ) );
$exp = str_replace( '____', '(.*?)', $exp );
$form = preg_replace( '/' . $exp . '/', 'widgets[' . preg_replace( '/\$(\d)/', '\\\$$1', $widget_number ) . '][$1]', $form );
$form = apply_filters( 'siteorigin_panels_widget_form', $form, $widget_class, $instance );
// Add all the information fields
return $form;
}
/**
* Checks whether a widget is considered to be a JS widget. I.e. it needs to have scripts and/or styles enqueued for
* it's admin form to work.
*
* Can remove the whitelist of core widgets when all widgets are following a similar pattern.
*
* @param $widget The widget to be tested.
*
* @return bool Whether or not the widget is considered a JS widget.
*/
function is_core_js_widget( $widget ) {
$js_widgets = apply_filters(
'siteorigin_panels_core_js_widgets',
array(
'WP_Widget_Custom_HTML',
'WP_Widget_Media_Audio',
'WP_Widget_Media_Gallery',
'WP_Widget_Media_Image',
'WP_Widget_Media_Video',
'WP_Widget_Text',
)
);
$is_js_widget = in_array( get_class( $widget ), $js_widgets ) &&
// Need to check this for `WP_Widget_Text` which was not a JS widget before 4.8
method_exists( $widget, 'render_control_template_scripts' );
return $is_js_widget;
}
function generate_panels_preview( $post_id, $panels_data ) {
$GLOBALS[ 'SITEORIGIN_PANELS_PREVIEW_RENDER' ] = true;
$return = SiteOrigin_Panels::renderer()->render( intval( $post_id ), false, $panels_data );
if ( function_exists( 'wp_targeted_link_rel' ) ) {
$return = wp_targeted_link_rel( $return );
}
unset( $GLOBALS[ 'SITEORIGIN_PANELS_PREVIEW_RENDER' ] );
return $return;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ADMIN AJAX ACTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Get builder content based on the submitted panels_data.
*/
function action_builder_content() {
header( 'content-type: text/html' );
if ( ! wp_verify_nonce( $_GET['_panelsnonce'], 'panels_action' ) ) {
wp_die();
}
if ( ! current_user_can( 'edit_post', $_POST['post_id'] ) ) {
wp_die();
}
if ( empty( $_POST['post_id'] ) || empty( $_POST['panels_data'] ) ) {
echo '';
wp_die();
}
// echo the content
$old_panels_data = get_post_meta( $_POST['post_id'], 'panels_data', true );
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true );
$panels_data['widgets'] = $this->process_raw_widgets(
$panels_data['widgets'],
! empty( $old_panels_data['widgets'] ) ? $old_panels_data['widgets'] : false,
false
);
$panels_data = SiteOrigin_Panels_Styles_Admin::single()->sanitize_all( $panels_data );
// Create a version of the builder data for post content
SiteOrigin_Panels_Post_Content_Filters::add_filters();
$GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] = true;
echo SiteOrigin_Panels::renderer()->render( intval( $_POST['post_id'] ), false, $panels_data );
SiteOrigin_Panels_Post_Content_Filters::remove_filters();
unset( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] );
wp_die();
}
/**
* Get builder content based on the submitted panels_data.
*/
function action_builder_content_json() {
header( 'content-type: application/json' );
$return = array('post_content' => '', 'preview' => '', 'sanitized_panels_data' => '');
if ( ! wp_verify_nonce( $_GET['_panelsnonce'], 'panels_action' ) ) {
wp_die();
}
if ( ! current_user_can( 'edit_post', $_POST['post_id'] ) ) {
wp_die();
}
if ( empty( $_POST['post_id'] ) || empty( $_POST['panels_data'] ) ) {
echo json_encode($return);
wp_die();
}
// echo the content
$old_panels_data = get_post_meta( $_POST['post_id'], 'panels_data', true );
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true );
$panels_data['widgets'] = $this->process_raw_widgets(
$panels_data['widgets'],
! empty( $old_panels_data['widgets'] ) ? $old_panels_data['widgets'] : false,
false
);
$panels_data = SiteOrigin_Panels_Styles_Admin::single()->sanitize_all( $panels_data );
$return['sanitized_panels_data'] = $panels_data;
// Create a version of the builder data for post content
SiteOrigin_Panels_Post_Content_Filters::add_filters();
$GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] = true;
$return['post_content'] = SiteOrigin_Panels::renderer()->render( intval( $_POST['post_id'] ), false, $panels_data );
SiteOrigin_Panels_Post_Content_Filters::remove_filters();
unset( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] );
$return['preview'] = $this->generate_panels_preview( intval( $_POST['post_id'] ), $panels_data );
echo json_encode( $return );
wp_die();
}
/**
* Display a widget form with the provided data
*/
function action_widget_form() {
if ( empty( $_REQUEST['_panelsnonce'] ) || ! wp_verify_nonce( $_REQUEST['_panelsnonce'], 'panels_action' ) ) {
wp_die(
__( 'The supplied nonce is invalid.', 'siteorigin-panels' ),
__( 'Invalid nonce.', 'siteorigin-panels' ),
403
);
}
if ( empty( $_REQUEST['widget'] ) ) {
wp_die(
__( 'Please specify the type of widget form to be rendered.', 'siteorigin-panels' ),
__( 'Missing widget type.', 'siteorigin-panels' ),
400
);
}
$request = array_map( 'stripslashes_deep', $_REQUEST );
$widget_class = $request['widget'];
$widget_class = apply_filters( 'siteorigin_panels_widget_class', $widget_class );
$instance = ! empty( $request['instance'] ) ? json_decode( $request['instance'], true ) : array();
$form = $this->render_form( $widget_class, $instance, $_REQUEST['raw'] == 'true' );
$form = apply_filters( 'siteorigin_panels_ajax_widget_form', $form, $widget_class, $instance );
echo $form;
wp_die();
}
/**
* Preview in the live editor when there is no public view of the item
*/
function action_live_editor_preview() {
if ( empty( $_REQUEST['_panelsnonce'] ) || ! wp_verify_nonce( $_REQUEST['_panelsnonce'], 'live-editor-preview' ) ) {
wp_die();
}
include plugin_dir_path( __FILE__ ) . '../tpl/live-editor-preview.php';
exit();
}
/**
* Preview in the block editor.
*/
public function layout_block_preview() {
if ( empty( $_REQUEST['_panelsnonce'] ) || ! wp_verify_nonce( $_REQUEST['_panelsnonce'], 'layout-block-preview' ) ) {
wp_die();
}
$panels_data = json_decode( wp_unslash( $_POST['panelsData'] ), true );
$builder_id = 'gbp' . uniqid();
$panels_data['widgets'] = SiteOrigin_Panels_Admin::single()->process_raw_widgets( $panels_data['widgets'], false, true, true );
$panels_data = SiteOrigin_Panels_Styles_Admin::single()->sanitize_all( $panels_data );
$sowb_active = class_exists( 'SiteOrigin_Widgets_Bundle' );
if ( $sowb_active ) {
// We need this to get our widgets bundle to add it's styles inline for previews.
add_filter( 'siteorigin_widgets_is_preview', '__return_true' );
}
$rendered_layout = SiteOrigin_Panels::renderer()->render( $builder_id, true, $panels_data, $layout_data, true );
// Need to explicitly call `siteorigin_widget_print_styles` because Gutenberg previews don't render a full version of the front end,
// so neither the `wp_head` nor the `wp_footer` actions are called, which usually trigger `siteorigin_widget_print_styles`.
if ( $sowb_active ) {
ob_start();
siteorigin_widget_print_styles();
$rendered_layout .= ob_get_clean();
}
echo $rendered_layout;
wp_die();
}
public function layout_block_sanitize() {
if ( empty( $_REQUEST['_panelsnonce'] ) || ! wp_verify_nonce( $_REQUEST['_panelsnonce'], 'layout-block-sanitize' ) ) {
wp_die();
}
$panels_data = json_decode( wp_unslash( $_POST['panelsData'] ), true );
$panels_data['widgets'] = SiteOrigin_Panels_Admin::single()->process_raw_widgets( $panels_data['widgets'], false, true, true );
$panels_data = SiteOrigin_Panels_Styles_Admin::single()->sanitize_all( $panels_data );
wp_send_json( $panels_data );
}
/**
* Add a column that indicates if a column is powered by Page Builder
*
* @param $columns
*
* @return array
*/
function add_custom_column( $columns ){
$index = array_search( 'comments', array_keys( $columns ) );
if( empty( $index ) ) {
$columns = array_merge(
$columns,
array( 'panels' => __( 'Page Builder', 'siteorigin-panels' ) )
);
}
else {
$columns = array_slice( $columns, 0, $index, true ) +
array( 'panels' => __( 'Page Builder', 'siteorigin-panels' ) ) +
array_slice( $columns, $index, count( $columns ) - 1, true );
}
return $columns;
}
function display_custom_column( $column, $post_id ){
if( $column != 'panels' ) return;
$panels_data = get_post_meta( $post_id, 'panels_data', true );
if( ! empty( $panels_data['widgets'] ) ) {
$widgets_count = count( $panels_data['widgets'] );
printf( _n( '%s Widget', '%s Widgets', $widgets_count, 'siteorigin-panels' ), $widgets_count );
}
else {
echo '—';
}
}
public function footer_column_css(){
if( siteorigin_panels_setting( 'admin-widget-count' ) ) {
$screen = get_current_screen();
$post_types = siteorigin_panels_setting( 'post-types' );
if(
$screen->base == 'edit' &&
is_array( $post_types ) &&
in_array( $screen->post_type, $post_types )
){
?><style type="text/css">.column-panels{ width: 10% }</style><?php
}
}
}
/**
* Add double slashes to strings
*
* @param $value
*
* @return string
*/
public static function double_slash_string( $value ){
return is_string( $value ) ? addcslashes( $value, '\\' ) : $value;
}
public function get_layout_directories(){
}
/**
* Display links for various SiteOrigin addons
*/
public static function display_footer_premium_link(){
$links = array(
array(
'text' => __('Get a lightbox addon for SiteOrigin widgets', 'siteorigin-panels'),
'url' => SiteOrigin_Panels::premium_url('plugin/lightbox')
),
array(
'text' => __('Get the row, cell and widget animations addon', 'siteorigin-panels'),
'url' => SiteOrigin_Panels::premium_url('plugin/lightbox')
),
array(
'text' => __('Get premium email support for SiteOrigin Page Builder', 'siteorigin-panels'),
'url' => SiteOrigin_Panels::premium_url()
),
);
$link = $links[array_rand($links)];
?>
<a href="<?php echo esc_url( $link['url'] ) ?>" target="_blank" rel='noopener noreferrer'>
<?php echo esc_html( $link['text'] ) ?>.
</a>
<?php
}
public function admin_notices() {
global $typenow, $pagenow;
$is_new = $pagenow == 'post-new.php';
$post_types = siteorigin_panels_setting( 'post-types' );
$is_panels_type = in_array( $typenow, $post_types );
$use_classic = siteorigin_panels_setting( 'use-classic' );
$show_classic_admin_notice = $is_new && $is_panels_type && $use_classic;
$show_classic_admin_notice = apply_filters( 'so_panels_show_classic_admin_notice', $show_classic_admin_notice );
if ( $show_classic_admin_notice ) {
$settings_url = self_admin_url( 'options-general.php?page=siteorigin_panels' );
$notice = sprintf(
__( 'This post type is set to use the Classic Editor by default for new posts. If you’d like to change this to the block editor, please go to <a href="%s" class="components-notice__action is-link">Page Builder Settings</a> and uncheck <strong>Use Classic Editor for new posts</strong>' ),
$settings_url
);
?>
<div id="siteorigin-panels-use-classic-notice" class="notice notice-info"><p id="use-classic-notice"><?php echo $notice ?></p></div>
<?php
}
}
/**
* Show Classic Editor for existing PB posts.
*
* @param $use_block_editor
* @param $post_type
*
* @return bool
*/
public function show_classic_editor_for_panels( $use_block_editor, $post_type ) {
// For new pages.
if ( isset( $_GET['block-editor'] ) ) {
return $use_block_editor;
} else if ( isset( $_GET['siteorigin-page-builder'] ) ) {
return false;
}
$post_types = siteorigin_panels_setting( 'post-types' );
global $pagenow;
// If the `$post_type` is set to be used by Page Builder for new posts.
$is_new_panels_type = $pagenow == 'post-new.php' && in_array( $post_type, $post_types );
$use_classic = siteorigin_panels_setting( 'use-classic' );
// For existing posts.
global $post;
if ( ! empty( $post ) ) {
// If the post has blocks just allow `$use_block_editor` to decide.
if ( ! has_blocks( $post ) ) {
$panels_data = get_post_meta( $post->ID, 'panels_data', true );
if ( ! empty( $panels_data ) || ( $use_classic && $is_new_panels_type ) ) {
$use_block_editor = false;
}
}
} else if ( $is_new_panels_type ) {
$use_block_editor = false;
}
return $use_block_editor;
}
/**
* This was copied from Gutenberg and slightly modified as a quick way to allow users to create new Page Builder pages
* in the classic editor without requiring the classic editor plugin be installed.
*/
function add_panels_add_new_button() {
global $typenow;
if ( 'wp_block' === $typenow ) {
?>
<style type="text/css">
.page-title-action {
display: none;
}
</style>
<?php
}
if ( ! $this->show_add_new_dropdown_for_type( $typenow ) ) {
return;
}
?>
<style type="text/css">
.split-page-title-action {
display: inline-block;
}
.split-page-title-action a,
.split-page-title-action a:active,
.split-page-title-action .expander:after {
padding: 6px 10px;
position: relative;
top: -3px;
text-decoration: none;
border: 1px solid #ccc;
border-radius: 2px 0px 0px 2px;
background: #f7f7f7;
text-shadow: none;
font-weight: 600;
font-size: 13px;
line-height: normal; /* IE8-IE11 need this for buttons */
color: #0073aa; /* some of these controls are button elements and don't inherit from links */
cursor: pointer;
outline: 0;
}
.split-page-title-action a:hover,
.split-page-title-action .expander:hover:after {
border-color: #008EC2;
background: #00a0d2;
color: #fff;
}
.split-page-title-action a:focus,
.split-page-title-action .expander:focus:after {
border-color: #5b9dd9;
box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
}
.split-page-title-action .expander:after {
content: "\f140";
font: 400 20px/.5 dashicons;
speak: none;
top: 0px;
position: relative;
vertical-align: top;
text-decoration: none !important;
padding: 4px 5px 5px 4px;
border-radius: 0px 2px 2px 0px;
<?php echo is_rtl() ? 'right: -1px;' : 'left: -1px;' ?>
}
.split-page-title-action .dropdown {
display: none;
}
.split-page-title-action .dropdown.visible {
display: block;
position: absolute;
margin-top: 3px;
z-index: 1;
}
.split-page-title-action .dropdown.visible a {
display: block;
top: 0;
margin: -1px 0;
<?php echo is_rtl() ? 'padding-left: 9px;' : 'padding-right: 9px;' ?>
}
.split-page-title-action .expander {
outline: none;
float: right;
margin-top: 1px;
}
</style>
<script type="text/javascript">
document.addEventListener( 'DOMContentLoaded', function() {
var buttons = document.getElementsByClassName( 'page-title-action' ),
button = buttons.item( 0 );
if ( ! button ) {
return;
}
var url = button.href;
var urlHasParams = ( -1 !== url.indexOf( '?' ) );
var panelsUrl = url + ( urlHasParams ? '&' : '?' ) + 'siteorigin-page-builder';
var blockEditorUrl = url + ( urlHasParams ? '&' : '?' ) + 'block-editor';
var newbutton = '<span id="split-page-title-action" class="split-page-title-action">';
newbutton += '<a href="' + url + '">' + button.innerText + '</a>';
newbutton += '<span class="expander" tabindex="0" role="button" aria-haspopup="true" aria-label="<?php echo esc_attr( __( 'Toggle editor selection menu', 'siteorigin-panels' ) ); ?>"></span>';
newbutton += '<span class="dropdown"><a href="' + panelsUrl + '"><?php echo esc_html( __( 'Sayfa OluÅŸturucu Kullan', 'siteorigin-panels' ) ); ?></a>';
newbutton += '<a href="' + blockEditorUrl + '"><?php echo esc_html( __( 'Varsayılan Editör', 'siteorigin-panels' ) ); ?></a></span></span><span class="page-title-action" style="display:none;"></span>';
button.insertAdjacentHTML( 'afterend', newbutton );
button.parentNode.removeChild( button );
var expander = document.getElementById( 'split-page-title-action' ).getElementsByClassName( 'expander' ).item( 0 );
var dropdown = expander.parentNode.querySelector( '.dropdown' );
function toggleDropdown() {
dropdown.classList.toggle( 'visible' );
}
expander.addEventListener( 'click', function( e ) {
e.preventDefault();
toggleDropdown();
} );
expander.addEventListener( 'keydown', function( e ) {
if ( 13 === e.which || 32 === e.which ) {
e.preventDefault();
toggleDropdown();
}
} );
} );
</script>
<?php
}
private function show_add_new_dropdown_for_type( $post_type ) {
$show = in_array( $post_type, siteorigin_panels_setting( 'post-types' ) );
// WooCommerce product type doesn't support block editor...
$show = $show && ! ( class_exists( 'WooCommerce' ) && $post_type == 'product' );
if ( class_exists( 'SiteOrigin_Premium_Plugin_Cpt_Builder' ) ) {
$show = $show && $post_type != SiteOrigin_Premium_Plugin_Cpt_Builder::POST_TYPE;
$cpt_builder = SiteOrigin_Premium_Plugin_Cpt_Builder::single();
$so_custom_types = $cpt_builder->get_post_types();
$show = $show && ! isset( $so_custom_types[ $post_type ] );
}
return apply_filters( 'so_panels_show_add_new_dropdown_for_type', $show, $post_type );
}
public function add_panels_post_state( $post_states, $post ) {
$panels_data = get_post_meta( $post->ID, 'panels_data', true );
if ( ! empty( $panels_data ) ) {
$post_states[] = __( 'SiteOrigin Page Builder', 'siteorigin-panels' );
}
return $post_states;
}
}
httpdocs/wp-content/plugins/google-analytics-for-wordpress/includes/admin/admin.php 0000644 00000133053 15154271520 0033174 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
/**
* Admin class.
*
* @since 6.0.0
*
* @package MonsterInsights
* @subpackage Admin
* @author Chris Christoff
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
/**
* Register menu items for MonsterInsights.
*
* @return void
* @since 6.0.0
* @access public
*
*/
function monsterinsights_admin_menu()
{
$hook = monsterinsights_get_menu_hook();
$menu_icon_inline = monsterinsights_get_inline_menu_icon();
$new_indicator = sprintf(
'<span class="monsterinsights-menu-new-indicator"> %s</span>',
__( 'NEW', 'google-analytics-for-wordpress' )
);
$menu_notification_indicator = MonsterInsights()->notifications->get_menu_count();
if ( MonsterInsights()->license->license_expired() ) {
$menu_notification_indicator = MonsterInsights()->notifications->get_license_expired_indicator();
}
$parent_slug = 'monsterinsights_reports';
$hide_reports_submenu = false;
$is_lite = ! monsterinsights_is_pro_version();
// If user not dismissed setup checklist.
if ( ! MonsterInsights()->setup_checklist->is_dismissed() ) {
$hide_reports_submenu = true;
}
// If user disabled report view, and it is a lite user.
if ( $hook === 'monsterinsights_settings' ) {
$hide_reports_submenu = true;
}
add_menu_page(__('MonsterInsights', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress') . $menu_notification_indicator, 'monsterinsights_view_dashboard', $parent_slug, 'monsterinsights_reports_page', $menu_icon_inline, '100.00013467543');
if ( ! MonsterInsights()->setup_checklist->is_dismissed() ) {
add_submenu_page( $hook, __( 'Setup Checklist', 'google-analytics-for-wordpress' ), __( 'Setup Checklist', 'google-analytics-for-wordpress' ) . MonsterInsights()->setup_checklist->get_menu_count(), 'monsterinsights_save_settings', 'monsterinsights_settings#/setup-checklist', 'monsterinsights_settings_page' );
}
if ( $hook === 'monsterinsights_reports' ) {
add_submenu_page( $parent_slug, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' );
}
// then settings page
add_submenu_page( $parent_slug, __( 'MonsterInsights', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' );
// Add dashboard submenu.
add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports' );
// If the setup checklist is not dismissed, remove the own submenu of `Insights` main menu that we added on line 52.
// This way the Checklist will be the first submenu which is an important thing for onboarding.
if ( $hide_reports_submenu ) {
// Check if the user has the capability to save settings and view dashboard.
// We should skip this for editors that have only view capability have only item in the submenu, removing that would break the menu.
if ( ! ( ! current_user_can( 'monsterinsights_save_settings' ) && current_user_can( 'monsterinsights_view_dashboard' ) ) ) {
// Remove own submenu of `Insights` main menu.
remove_submenu_page( 'monsterinsights_reports', 'monsterinsights_reports' );
}
}
$submenu_base = add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php'));
// Site Notes
add_submenu_page( $parent_slug, __( 'Site Notes:', 'google-analytics-for-wordpress' ), __( 'Site Notes', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/site-notes' );
// If report disabled then remove this menu.
if ( $hook === 'monsterinsights_reports' || $is_lite ) {
// AI Insights
// translators: Icon
add_submenu_page( $parent_slug, __( 'AI Insights:', 'google-analytics-for-wordpress' ), sprintf( __( '%s AI Insights', 'google-analytics-for-wordpress' ), monsterinsights_get_ai_menu_icon() ), 'monsterinsights_save_settings', 'admin.php?page=monsterinsights_reports#/ai-insights' );
}
$license_type = MonsterInsights()->license->get_license_type();
// AI Chat
if ( $is_lite || 'plus' === $license_type ) {
// translators: Placeholder adds a svg icon
add_submenu_page( $parent_slug, __( 'Conversations AI:', 'google-analytics-for-wordpress' ), sprintf( __( '%s Conversations AI', 'google-analytics-for-wordpress' ), monsterinsights_get_ai_menu_icon() ), 'monsterinsights_save_settings', 'admin.php?page=monsterinsights_reports#/ai-insights/chat' );
}
// Add Popular Posts menu item.
add_submenu_page( $parent_slug, __( 'Popular Posts:', 'google-analytics-for-wordpress' ), __( 'Popular Posts', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', $submenu_base . '#/popular-posts' );
// If report disabled then remove this menu.
if ( $hook === 'monsterinsights_reports' || $is_lite ) {
// Add submenu under `Insights` main menu for user journey report.
add_submenu_page( $parent_slug, __( 'User Journey:', 'google-analytics-for-wordpress' ), __( 'User Journey', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'admin.php?page=monsterinsights_reports#/user-journey-report' );
}
if ( function_exists( 'aioseo' ) ) {
$seo_url = monsterinsights_aioseo_dashboard_url();
} else {
$seo_url = $submenu_base . '#/seo';
}
// then SEO
add_submenu_page($parent_slug, __('SEO', 'google-analytics-for-wordpress'), __('SEO', 'google-analytics-for-wordpress'), 'manage_options', $seo_url);
// then tools
add_submenu_page($parent_slug, __('Tools:', 'google-analytics-for-wordpress'), __('Tools', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/tools');
// then addons
$network_key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_network_license_key() : '';
if (!monsterinsights_is_network_active() || (monsterinsights_is_network_active() && empty($network_key))) {
add_submenu_page($parent_slug, __('Addons:', 'google-analytics-for-wordpress'), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __('Addons', 'google-analytics-for-wordpress') . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons');
}
add_submenu_page(
$parent_slug,
__('UserFeedback:', 'google-analytics-for-wordpress'),
__('UserFeedback', 'google-analytics-for-wordpress') . $new_indicator,
'manage_options',
$submenu_base . '#/userfeedback'
);
// then About Us page.
add_submenu_page($parent_slug, __('About Us:', 'google-analytics-for-wordpress'), __('About Us', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/about');
if (!monsterinsights_is_pro_version() && !strstr(plugin_basename(__FILE__), 'dashboard-for')) {
// automated promotion
monsterinsights_automated_menu($hook);
}
add_submenu_page($parent_slug, __('Growth Tools:', 'google-analytics-for-wordpress'), __('Growth Tools', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/growth-tools');
// then Upgrade To Pro.
if (!monsterinsights_is_pro_version()) {
add_submenu_page($parent_slug, __('Upgrade to Pro:', 'google-analytics-for-wordpress'), '<span class="monsterinsights-upgrade-submenu"> ' . __('Upgrade to Pro', 'google-analytics-for-wordpress') . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link('admin-menu', 'submenu', "https://www.monsterinsights.com/lite/"));
}
}
add_action('admin_menu', 'monsterinsights_admin_menu');
function monsterinsights_automated_menu($hook){
$display = false;
$now = apply_filters('monsterinsights_automated_promotion_date', wp_date('M d, Y h:i:s a'));
$conditions = [
[
'title' => __('Earth Day', 'google-analytics-for-wordpress'),
'start_time' => wp_date('M d, Y h:i:s a', strtotime('Apr 17, 2023')),
'end_time' => wp_date('M d, Y h:i:s a', strtotime('Apr 18, 2023')),
'utm_campaign' => 'lite-promo',
'utm_source' => 'liteplugin',
'utm_medium' => 'earth-day',
],
[
'title' => __('Cinco De Mayo!', 'google-analytics-for-wordpress'),
'start_time' => wp_date('M d, Y h:i:s a', strtotime('May 01, 2023')),
'end_time' => wp_date('M d, Y h:i:s a', strtotime('May 08, 2023')),
'utm_campaign' => 'lite-promo',
'utm_source' => 'liteplugin',
'utm_medium' => 'cinco-de-mayo',
],
[
'title' => __('Upgrade to GA4', 'google-analytics-for-wordpress'),
'start_time' => wp_date('M d, Y h:i:s a', strtotime('Jun 01, 2023')),
'end_time' => wp_date('M d, Y h:i:s a', strtotime('July 01, 2023')),
'utm_campaign' => 'lite-promo',
'utm_source' => 'liteplugin',
'utm_medium' => 'goodbye-ga3',
],
[
'title' => __('Summer Sale', 'google-analytics-for-wordpress'),
'start_time' => wp_date('M d, Y h:i:s a', strtotime('Jul 29, 2023')),
'end_time' => wp_date('M d, Y h:i:s a', strtotime('Aug 05, 2023')),
'utm_campaign' => 'lite-promo',
'utm_source' => 'liteplugin',
'utm_medium' => 'dogdays',
],
[
'title' => __('Fortune Cookie Day', 'google-analytics-for-wordpress'),
'start_time' => wp_date('M d, Y h:i:s a', strtotime('Sep 12, 2023')),
'end_time' => wp_date('M d, Y h:i:s a', strtotime('Sep 13, 2023')),
'utm_campaign' => 'lite-promo',
'utm_source' => 'liteplugin',
'utm_medium' => 'fortune-cookie',
],
[
'title' => __('Halloween Sale', 'google-analytics-for-wordpress'),
'start_time' => wp_date('M d, Y h:i:s a', strtotime('Oct 26, 2023')),
'end_time' => wp_date('M d, Y h:i:s a', strtotime('Nov 04, 2023')),
'utm_campaign' => 'lite-promo',
'utm_source' => 'liteplugin',
'utm_medium' => 'halloween',
],
];
foreach($conditions as $key => $condition){
if(strtotime($now) >= strtotime($condition['start_time']) && strtotime($now) <= strtotime($condition['end_time'])){
add_submenu_page($hook, $condition['title'], '<span class="monsterinsights-automated-submenu"> ' . $condition['title'] . '</span>', 'monsterinsights_save_settings', monsterinsights_get_upgrade_link($condition['utm_medium'], $condition['utm_campaign'], "https://www.monsterinsights.com/lite-promo/"));
break;
}
}
}
/**
* Add this separately so all the Woo menu items are loaded and the position parameter works correctly.
*/
function monsterinsights_woocommerce_menu_item()
{
if (class_exists('WooCommerce')) {
// Add "Insights" sub menu item for WooCommerce Analytics menu
if (class_exists('MonsterInsights_eCommerce')) {
add_submenu_page('wc-admin&path=/analytics/overview', __('Insights', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress'), 'monsterinsights_view_dashboard', admin_url('admin.php?page=monsterinsights_reports#/ecommerce'), '', 2);
} else {
$submenu_base = add_query_arg('page', 'monsterinsights_settings', admin_url('admin.php'));
add_submenu_page('wc-admin&path=/analytics/overview', __('Insights', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/woocommerce-insights', '', 1);
}
}
}
add_action('admin_menu', 'monsterinsights_woocommerce_menu_item', 11);
function monsterinsights_get_menu_hook()
{
$dashboards_disabled = monsterinsights_get_option('dashboards_disabled', false);
if ($dashboards_disabled || (current_user_can('monsterinsights_save_settings') && !current_user_can('monsterinsights_view_dashboard'))) {
return 'monsterinsights_settings';
} else {
return 'monsterinsights_reports';
}
}
function monsterinsights_network_admin_menu()
{
// Get the base class object.
$base = MonsterInsights();
// First, let's see if this is an MS network enabled plugin. If it is, we should load the license
// menu page and the updater on the network panel
if (!function_exists('is_plugin_active_for_network')) {
require_once(ABSPATH . '/wp-admin/includes/plugin.php');
}
$plugin = plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE);
if (!is_plugin_active_for_network($plugin)) {
return;
}
$menu_notification_indicator = MonsterInsights()->notifications->get_menu_count();
if ( MonsterInsights()->license->license_expired() ) {
$menu_notification_indicator = MonsterInsights()->notifications->get_license_expired_indicator();
}
$menu_icon_inline = monsterinsights_get_inline_menu_icon();
$hook = 'monsterinsights_network';
$submenu_base = add_query_arg('page', 'monsterinsights_network', network_admin_url('admin.php'));
add_menu_page(__('Network Settings:', 'google-analytics-for-wordpress'), __('Insights', 'google-analytics-for-wordpress') . $menu_notification_indicator, 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', $menu_icon_inline, '100.00013467543');
add_submenu_page($hook, __('Network Settings:', 'google-analytics-for-wordpress'), __('Network Settings', 'google-analytics-for-wordpress'), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page');
add_submenu_page($hook, __('General Reports:', 'google-analytics-for-wordpress'), __('Reports', 'google-analytics-for-wordpress'), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page');
if (function_exists('aioseo')) {
$seo_url = monsterinsights_aioseo_dashboard_url();
} else {
$seo_url = $submenu_base . '#/seo';
}
// then seo
add_submenu_page($hook, __('SEO:', 'google-analytics-for-wordpress'), __('SEO', 'google-analytics-for-wordpress'), 'manage_options', $seo_url, 'monsterinsights_seo_page');
// then addons
add_submenu_page($hook, __('Addons:', 'google-analytics-for-wordpress'), '<span style="color:' . monsterinsights_menu_highlight_color() . '"> ' . __('Addons', 'google-analytics-for-wordpress') . '</span>', 'monsterinsights_save_settings', $submenu_base . '#/addons');
$submenu_base = add_query_arg('page', 'monsterinsights_network', network_admin_url('admin.php'));
// Add About us page.
add_submenu_page($hook, __('About Us:', 'google-analytics-for-wordpress'), __('About Us', 'google-analytics-for-wordpress'), 'manage_options', $submenu_base . '#/about');
}
add_action('network_admin_menu', 'monsterinsights_network_admin_menu', 5);
/**
* Adds one or more classes to the body tag in the dashboard.
*
* @param String $classes Current body classes.
*
* @return String Altered body classes.
*/
function monsterinsights_add_admin_body_class($classes)
{
$screen = function_exists('get_current_screen') ? get_current_screen() : false;
if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights') === false) {
return $classes;
}
return "$classes monsterinsights_page ";
}
add_filter('admin_body_class', 'monsterinsights_add_admin_body_class', 10, 1);
/**
* Adds one or more classes to the body tag in the dashboard.
*
* @param String $classes Current body classes.
*
* @return String Altered body classes.
*/
function monsterinsights_add_admin_body_class_tools_page($classes)
{
$screen = function_exists('get_current_screen') ? get_current_screen() : false;
if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_tools') === false || 'insights_page_monsterinsights_tools' === $screen->id) {
return $classes;
}
return "$classes insights_page_monsterinsights_tools ";
}
add_filter('admin_body_class', 'monsterinsights_add_admin_body_class_tools_page', 10, 1);
/**
* Adds one or more classes to the body tag in the dashboard.
*
* @param String $classes Current body classes.
*
* @return String Altered body classes.
*/
function monsterinsights_add_admin_body_class_addons_page($classes)
{
$screen = function_exists('get_current_screen') ? get_current_screen() : false;
if (empty($screen) || empty($screen->id) || strpos($screen->id, 'monsterinsights_addons') === false || 'insights_page_monsterinsights_addons' === $screen->id) {
return $classes;
}
return "$classes insights_page_monsterinsights_addons ";
}
add_filter('admin_body_class', 'monsterinsights_add_admin_body_class_addons_page', 10, 1);
/**
* Add a link to the settings page to the plugins list
*
* @param array $links array of links for the plugins, adapted when the current plugin is found.
*
* @return array $links
*/
function monsterinsights_add_action_links($links)
{
$docs = '<a title="' . esc_attr__('MonsterInsights Knowledge Base', 'google-analytics-for-wordpress') . '" href="' . monsterinsights_get_url('all-plugins', 'kb-link', "https://www.monsterinsights.com/docs/") . '">' . esc_html__('Documentation', 'google-analytics-for-wordpress') . '</a>';
array_unshift($links, $docs);
// If Lite, support goes to forum. If pro, it goes to our website
if (monsterinsights_is_pro_version()) {
$support = '<a title="MonsterInsights Pro Support" href="' . monsterinsights_get_url('all-plugins', 'pro-support-link', "https://www.monsterinsights.com/my-account/support/") . '">' . esc_html__('Support', 'google-analytics-for-wordpress') . '</a>';
array_unshift($links, $support);
} else {
$support = '<a title="MonsterInsights Lite Support" href="' . monsterinsights_get_url('all-plugins', 'lite-support-link', "https://www.monsterinsights.com/lite-support/") . '">' . esc_html__('Support', 'google-analytics-for-wordpress') . '</a>';
array_unshift($links, $support);
}
if (is_network_admin()) {
$settings_link = '<a href="' . esc_url(network_admin_url('admin.php?page=monsterinsights_network')) . '">' . esc_html__('Network Settings', 'google-analytics-for-wordpress') . '</a>';
} else {
$settings_link = '<a href="' . esc_url(admin_url('admin.php?page=monsterinsights_settings')) . '">' . esc_html__('Settings', 'google-analytics-for-wordpress') . '</a>';
}
array_unshift($links, $settings_link);
// If lite, show a link where they can get pro from
if (!monsterinsights_is_pro_version()) {
$get_pro = '<a title="' . esc_attr__('Get MonsterInsights Pro', 'google-analytics-for-wordpress') . '" target="_blank" rel="noopener" href="' . monsterinsights_get_upgrade_link('all-plugins', 'upgrade-link', "https://www.monsterinsights.com/lite/") . '" style="font-weight:700; color: #1da867;">' . esc_html__('Get MonsterInsights Pro', 'google-analytics-for-wordpress') . '</a>';
array_unshift($links, $get_pro);
}
return $links;
}
add_filter('plugin_action_links_' . plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE), 'monsterinsights_add_action_links');
add_filter('network_admin_plugin_action_links_' . plugin_basename(MONSTERINSIGHTS_PLUGIN_FILE), 'monsterinsights_add_action_links');
/**
* Loads a partial view for the Administration screen
*
* @access public
*
* @param string $template PHP file at includes/admin/partials, excluding file extension
* @param array $data Any data to pass to the view
*
* @return void
* @since 6.0.0
*
*/
function monsterinsights_load_admin_partial($template, $data = array())
{
if (monsterinsights_is_pro_version()) {
$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'pro/includes/admin/partials');
if (file_exists($dir . $template . '.php')) {
require_once($dir . $template . '.php');
return true;
}
} else {
$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'lite/includes/admin/partials');
if (file_exists($dir . $template . '.php')) {
require_once($dir . $template . '.php');
return true;
}
}
$dir = trailingslashit(plugin_dir_path(MonsterInsights()->file) . 'includes/admin/partials');
if (file_exists($dir . $template . '.php')) {
require_once($dir . $template . '.php');
return true;
}
return false;
}
/**
* When user is on a MonsterInsights related admin page, display footer text
* that graciously asks them to rate us.
*
* @param string $text
*
* @return string
* @since 6.0.0
*/
function monsterinsights_admin_footer($text)
{
global $current_screen;
if (
! empty( $current_screen->id )
&& strpos( $current_screen->id, 'monsterinsights' ) !== false
&& ! monsterinsights_is_pro_version()
) {
$url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5';
// Translators: Placeholders add a link to the wordpress.org repository.
$text = sprintf(esc_html__('Please rate %1$sMonsterInsights%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress'), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>');
}
return $text;
}
add_filter('admin_footer_text', 'monsterinsights_admin_footer', 1, 2);
function monsterinsights_admin_setup_notices()
{
// Make sure they have the permissions to do something
if (!current_user_can('monsterinsights_save_settings')) {
return;
}
// Priority:
// 0. UA sunset
// 1. Google Analytics not authenticated
// 2. License key not entered for pro
// 3. License key not valid/okay for pro
// 4. WordPress + PHP min versions
// 5. (old) Optin setting not configured
// 6. Manual UA code
// 7. Automatic updates not configured
// 8. Woo upsell
// 9. EDD upsell
// 0. UA sunset supported alert
$profile = is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile() : MonsterInsights()->auth->get_analytics_profile();
if ( !empty($profile['ua']) && empty($profile['v4']) && !monsterinsights_is_own_admin_page() ) {
$title = __('Urgent: Your Website is Not Tracking Any Google Analytics Data!', 'google-analytics-for-wordpress');
$message = __('Google Analytics 3 (UA) and support was sunset on July 1, 2023. Your website is currently NOT tracking any analytics. </br>Create or connect a new Google Analytics 4 property immediately to start tracking.', 'google-analytics-for-wordpress');
$wizard_url = admin_url('admin.php?page=monsterinsights-onboarding');
echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_ua_sunset">';
echo '<p><strong>' . esc_html($title) . '</strong></p>';
echo '<p>' . wp_kses_post($message) . '</p>';
echo '<p>';
echo '<a href="https://www.monsterinsights.com/docs/connect-google-analytics/"
target="_blank" rel="noopener noreferrer">' .
__( 'Learn How to Create a GA4 Property', 'google-analytics-for-wordpress' ) . // phpcs:ignore
'</a><br>';
echo '<a href="' . esc_url($wizard_url) . '">' .
__( 'Connect a Property', 'google-analytics-for-wordpress' ) . // phpcs:ignore
'</a><br>';
echo '</p>';
echo '</div>';
return;
}
$is_plugins_page = 'plugins' === get_current_screen()->id;
// 1. Google Analytics not authenticated
if ( ! is_network_admin() && ! monsterinsights_get_v4_id() && ! defined( 'MONSTERINSIGHTS_DISABLE_TRACKING' ) && ! monsterinsights_is_own_admin_page() ) {
$submenu_base = is_network_admin() ? add_query_arg( 'page', 'monsterinsights_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'monsterinsights_settings', admin_url( 'admin.php' ) );
$title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-for-wordpress' );
$primary = esc_html__( 'Please Connect Your Website to MonsterInsights', 'google-analytics-for-wordpress' );
$urlone = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights-onboarding' ) : admin_url( 'admin.php?page=monsterinsights-onboarding' );
$secondary = esc_html__( 'Learn More', 'google-analytics-for-wordpress' );
$urltwo = $submenu_base . '#/about/getting-started';
$message = esc_html__( 'MonsterInsights, the #1 WordPress Analytics Plugin, helps you easily connect your website to Google Analytics, so that you can see how people find and use your website. Over 3 million website owners use MonsterInsights to see the stats that matter and grow their business.', 'google-analytics-for-wordpress' );
echo '<div class="notice notice-info"><p style="font-weight:700">' . $title . '</p><p>' . $message . '</p><p><a href="' . $urlone . '" class="button-primary">' . $primary . '</a> <a href="' . $urltwo . '" class="button-secondary">' . $secondary . '</a></p></div>'; // phpcs:ignore -- All escaped above
return;
}
// 2. License key not entered for pro
$key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : '';
if (monsterinsights_is_pro_version() && empty($key)) {
$page = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings');
// Translators: Adds a link to retrieve the license.
$message = sprintf(esc_html__('Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress'), '<a href="' . esc_url($page) . '">', '</a>');
echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore
return;
}
// 3. License key not valid/okay for pro
if (monsterinsights_is_pro_version()) {
$message = '';
if (MonsterInsights()->license->get_site_license_key()) {
if (MonsterInsights()->license->site_license_expired()) {
// Translators: Adds a link to the license renewal.
$message = sprintf(esc_html__('Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress'), '<a href="' . monsterinsights_get_url('admin-notices', 'expired-license', "https://www.monsterinsights.com/login/") . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>');
} else if (MonsterInsights()->license->site_license_disabled()) {
$message = esc_html__('Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress');
} else if (MonsterInsights()->license->site_license_invalid()) {
$message = esc_html__('Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress');
}
} else if (MonsterInsights()->license->get_network_license_key()) {
if (MonsterInsights()->license->network_license_expired()) {
// Translators: Adds a link to renew license.
$message = sprintf(esc_html__('Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress'), '<a href="' . monsterinsights_get_url('admin-notices', 'expired-license', "https://www.monsterinsights.com/login/") . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>');
} else if (MonsterInsights()->license->network_license_disabled()) {
$message = esc_html__('Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress');
} else if (MonsterInsights()->license->network_license_invalid()) {
$message = esc_html__('Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress');
}
}
if (!empty($message)) {
echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore
return;
}
}
// 4. Notices for PHP/WP version deprecations
if (current_user_can('update_core')) {
global $wp_version;
$compatible_php_version = apply_filters('monsterinsights_compatible_php_version', false);
$compatible_wp_version = apply_filters('monsterinsights_compatible_wp_version', false);
$url = monsterinsights_get_url('global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/');
$message = false;
if (version_compare(phpversion(), $compatible_php_version['required'], '<')) {
// Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break.
$message = sprintf(esc_html__('Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress'), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>');
} else if (version_compare(phpversion(), $compatible_php_version['warning'], '<')) {
// Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break.
$message = sprintf(esc_html__('Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in November, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress'), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>');
} else if (version_compare(phpversion(), $compatible_php_version['recommended'], '<')) {
// Translators: Placeholders add the PHP version, a link to the MonsterInsights blog and a line break.
$message = sprintf(esc_html__('Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress is working towards discontinuing support for your PHP version.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress'), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>');
}
if ($message) {
echo '<div class="error"><p>' . wp_kses($message, [
'br' => array(),
'b' => array(),
'strong' => array(),
'i' => array(),
'a' => array(
'href' => array(),
'target' => array(),
'title' => array(),
),
]) . '</p></div>';
return;
}
// WordPress 4.9
/* else if ( version_compare( $wp_version, '5.0', '<' ) ) {
$url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' );
// Translators: Placeholders add the current WordPress version and links to the MonsterInsights blog
$message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sMonsterInsights will stop supporting WordPress versions lower than 5.0 in 2021.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-for-wordpress' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
echo '<div class="error"><p>'. $message.'</p></div>';
return;
} */
// PHP 5.4/5.5
// else if ( version_compare( phpversion(), '5.6', '<' ) ) {
// $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-php/' );
// $message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress will stop supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-for-wordpress' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
// echo '<div class="error"><p>'. $message.'</p></div>';
// return;
// }
// // WordPress 4.6 - 4.8
// else if ( version_compare( $wp_version, '4.9', '<' ) ) {
// $url = monsterinsights_get_url( 'global-notice', 'settings-page', 'https://www.monsterinsights.com/docs/update-wordpress/' );
// $message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sMonsterInsights will stop supporting WordPress versions lower than 4.9 in October, 2019.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-for-wordpress' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
// echo '<div class="error"><p>'. $message.'</p></div>';
// return;
// }
}
// 5. Optin setting not configured
// if ( ! is_network_admin() ) {
// if ( ! get_option( 'monsterinsights_tracking_notice' ) ) {
// if ( ! monsterinsights_get_option( 'anonymous_data', false ) ) {
// if ( ! monsterinsights_is_dev_url( network_site_url( '/' ) ) ) {
// if ( monsterinsights_is_pro_version() ) {
// monsterinsights_update_option( 'anonymous_data', 1 );
// return;
// }
// $optin_url = add_query_arg( 'mi_action', 'opt_into_tracking' );
// $optout_url = add_query_arg( 'mi_action', 'opt_out_of_tracking' );
// echo '<div class="updated"><p>';
// echo esc_html__( 'Allow MonsterInsights to track plugin usage? Opt-in to tracking and our newsletter to stay informed of the latest changes to MonsterInsights and help us ensure compatibility.', 'google-analytics-for-wordpress' );
// echo ' <a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'google-analytics-for-wordpress' ) . '</a>';
// echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'google-analytics-for-wordpress' ) . '</a>';
// echo '</p></div>';
// return;
// } else {
// // is testing site
// update_option( 'monsterinsights_tracking_notice', '1' );
// }
// }
// }
// }
$notices = get_option('monsterinsights_notices');
if (!is_array($notices)) {
$notices = array();
}
// 6. Authenticate, not manual
$authed = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed();
$url = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings');
$tracking_code = monsterinsights_get_v4_id_to_output();
// Translators: Placeholders add links to the settings panel.
$manual_text = sprintf(esc_html__('Important: You are currently using manual GA4 Measurement ID output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress'), '<a href="' . $url . '">', '</a>');
$migrated = monsterinsights_get_option('gadwp_migrated', 0);
if ($migrated > 0) {
$url = admin_url('admin.php?page=monsterinsights-getting-started&monsterinsights-migration=1');
// Translators: Placeholders add links to the settings panel.
$text = esc_html__('Click %1$shere%2$s to reauthenticate to be able to access reports. For more information why this is required, see our %3$sblog post%4$s.', 'google-analytics-for-wordpress');
$manual_text = sprintf($text, '<a href="' . esc_url($url) . '">', '</a>', '<a href="' . monsterinsights_get_url('notice', 'manual-ua', 'https://www.exactmetrics.com/why-did-we-implement-the-new-google-analytics-authentication-flow-challenges-explained/') . '" target="_blank">', '</a>');
}
if (empty($authed) && !isset($notices['monsterinsights_auth_not_manual']) && !empty($tracking_code)) {
echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">';
echo '<p>';
echo $manual_text; // phpcs:ignore
echo '</p>';
echo '</div>';
return;
}
// 7. Automatic updates not configured
// if ( ! is_network_admin() ) {
// $updates = monsterinsights_get_option( 'automatic_updates', false );
// $url = admin_url( 'admin.php?page=monsterinsights_settings' );
// if ( empty( $updates) && ! isset( $notices['monsterinsights_automatic_updates' ] ) ) {
// echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_automatic_updates">';
// echo '<p>';
// echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in MonsterInsights.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' );
// echo '</p>';
// echo '</div>';
// return;
// }
// }
// 8. WooUpsell
if (!monsterinsights_is_pro_version() && class_exists('WooCommerce') && $is_plugins_page) {
if (!isset($notices['monsterinsights_woocommerce_tracking_available'])) {
$woo_notice_template = '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">
%1$s
<div class="monsterinsights-wooedd-upsell-left">
<p><strong>%2$s</strong></p>
<p>%3$s</p>
<p>%4$s</p>
<p>%5$s</p>
<p>%6$s</p>
%7$s
%8$s
</div>
</div>';
$woo_notice_button = sprintf(
// Translators: Placeholders add a link to the MonsterInsights website.
esc_html__('%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress'),
'<a class="button button-primary button-hero" target="_blank" href="' . esc_url(monsterinsights_get_upgrade_link('admin-notices', 'woocommerce-upgrade')) . '">',
' »</a>'
);
$woo_notice_offer = sprintf(
'<div class="monsterinsights-wooedd-upsell-offer">%1$s</div>',
__('Save <span>50%</span> Off MonsterInsights Pro', 'google-analytics-for-wordpress')
);
$woo_notice_bg = esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/monsterinsights-woo-edd-upsell.svg';
$woo_notice_offer_icon = esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-offer-icon.svg';
$woo_notice_style = "<style>.monsterinsights-wooedd-upsell-left .button-hero,.monsterinsights-wooedd-upsell-offer{width:270px;margin-bottom:20px;text-align:center}.monsterinsights-wooedd-upsell-row{display:flex;background-image:url($woo_notice_bg);background-repeat:no-repeat;background-position:96% bottom}.monsterinsights-wooedd-upsell-left{margin-left:20px}.monsterinsights-wooedd-upsell-offer{background:#fafeb0;padding:6px 0;position:relative;font-weight:700;font-size:15px;line-height:28px}.monsterinsights-wooedd-upsell-offer span{color:#338eef}.monsterinsights-wooedd-upsell-offer:before{content:url('$woo_notice_offer_icon');position:absolute;left:-23px;bottom:-30px}@media (max-width:1300px){.monsterinsights-wooedd-upsell-row{background-size:60%}}@media (max-width:900px){.monsterinsights-wooedd-upsell-row{background-image:none}.monsterinsights-wooedd-upsell-left,.monsterinsights-wooedd-upsell-left .button-hero,.monsterinsights-wooedd-upsell-offer{width:100%}}</style>";
// phpcs:disable
echo sprintf(
$woo_notice_template,
$woo_notice_style,
__('Add eCommerce Analytics to your WooCommerce Store', 'google-analytics-for-wordpress'),
__('Unlock all of our advanced eCommerce features specifically designed to help your store make more money..', 'google-analytics-for-wordpress'),
__('MonsterInsights Pro users instantly gain access to valuable insights such as average order value, conversion rates, as well as marketing performance with UTM tracking.', 'google-analytics-for-wordpress'),
__('And by upgrading, Pro users also get enhanced tracking for Forms, User Journeys, PPC Pixels, Custom UserID tracking, SEO Reports, and much more.', 'google-analytics-for-wordpress'),
__('Start making better data-driven decisions today!', 'google-analytics-for-wordpress'),
$woo_notice_offer,
$woo_notice_button
);
return;
// phpcs:enable
}
}
// 9. EDDUpsell
if (!monsterinsights_is_pro_version() && class_exists('Easy_Digital_Downloads') && $is_plugins_page) {
if (!isset($notices['monsterinsights_edd_tracking_available'])) {
echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
echo '<div class="monsterinsights-wooedd-upsell-left">';
echo '<p><strong>';
echo esc_html('Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress');
echo '</strong></p>';
echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-edd-upsell.png">';
echo '<p>';
echo esc_html('MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress');
echo '</p>';
echo '<p>';
echo esc_html('This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress');
echo '</p>';
echo '<p>';
echo esc_html('Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress');
echo '</p>';
echo '<p>';
echo esc_html('Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress');
echo '</p>';
echo sprintf(esc_html__('%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress'), '<a class="button button-primary button-hero" target="_blank" href="' . esc_url(monsterinsights_get_upgrade_link('admin-notices', 'edd-upgrade')) . '">', ' »</a>');
echo '</p>';
echo '</div><div class="monsterinsights-wooedd-upsell-right">';
echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . esc_url(trailingslashit(MONSTERINSIGHTS_PLUGIN_URL)) . 'assets/images/upsell/woo-edd-upsell.png">';
echo '</div>';
echo '</div>';
return;
}
}
if (isset($notices['monsterinsights_cross_domains_extracted']) && false === $notices['monsterinsights_cross_domains_extracted']) {
$page = is_network_admin() ? network_admin_url('admin.php?page=monsterinsights_network') : admin_url('admin.php?page=monsterinsights_settings');
$page = $page . '#/advanced';
// Translators: Adds a link to the settings panel.
$message = sprintf(esc_html__('Warning: MonsterInsights found cross-domain settings in the custom code field and converted them to the new settings structure. %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-for-wordpress'), '<a href="' . esc_url($page) . '">', '</a>');
echo '<div class="notice notice-success is-dismissible monsterinsights-notice" data-notice="monsterinsights_cross_domains_extracted"><p>' . $message . '</p></div>'; // phpcs:ignore
return;
}
}
add_action('admin_notices', 'monsterinsights_admin_setup_notices');
add_action('network_admin_notices', 'monsterinsights_admin_setup_notices');
// AM Notices
function monsterinsights_am_notice_optout($super_admin)
{
if (monsterinsights_get_option('hide_am_notices', false) || monsterinsights_get_option('network_hide_am_notices', false)) {
return false;
}
return $super_admin;
}
add_filter("am_notifications_display", 'monsterinsights_am_notice_optout', 10, 1);
/**
* Inline critical css for the menu to prevent breaking the layout when our scripts get blocked by browsers.
*/
function monsterinsights_admin_menu_inline_styles()
{
?>
<style>
#toplevel_page_monsterinsights_reports .wp-menu-image img,
#toplevel_page_monsterinsights_settings .wp-menu-image img,
#toplevel_page_monsterinsights_network .wp-menu-image img {
width: 18px;
height: auto;
padding-top: 7px;
}
#toplevel_page_monsterinsights_reports .wp-submenu li a {
display: flex;
align-items: center;
}
#toplevel_page_monsterinsights_reports .wp-submenu .monsterinsights-sidebar-icon {
padding-right: 6px;
}
</style>
<?php
}
add_action('admin_head', 'monsterinsights_admin_menu_inline_styles', 300);
/**
* Display notice in admin when measurement protocol is left blank
*/
function monsterinsights_empty_measurement_protocol_token()
{
if (!class_exists('MonsterInsights_eCommerce') && !class_exists('MonsterInsights_Forms')) {
return;
}
$page = is_network_admin()
? network_admin_url('admin.php?page=monsterinsights_network')
: admin_url('admin.php?page=monsterinsights_settings');
$api_secret = is_network_admin()
? MonsterInsights()->auth->get_network_measurement_protocol_secret()
: MonsterInsights()->auth->get_measurement_protocol_secret();
$current_code = monsterinsights_get_v4_id_to_output();
if (empty($current_code) || !empty($api_secret)) {
return;
}
$message = sprintf(
/* translators: Placeholders add a link to an article. */
esc_html__(
'Your Measurement Protocol API Secret is currently left blank. To see more advanced analytics please enter a Measurement API Secret. %1$sLearn how to find your API Secret%2$s.',
'google-analytics-for-wordpress'
),
'<a target="_blank" href="' . monsterinsights_get_url('notice', 'empty-measurement-protocol-secret', 'https://www.monsterinsights.com/docs/how-to-create-your-measurement-protocol-api-secret-in-ga4/') . '">',
'</a>'
);
echo '<div class="error"><p>' . $message . '</p></div>'; // phpcs:ignore
}
add_action( 'admin_notices', 'monsterinsights_empty_measurement_protocol_token' );
add_action( 'network_admin_notices', 'monsterinsights_admin_setup_notices' );
/**
* Check if the plugin is MI Lite.
*
* @return bool
*/
function check_is_it_monsterinsights_lite() {
return 'googleanalytics.php' == basename( MONSTERINSIGHTS_PLUGIN_FILE );
}
/**
* Add EEA Compliance file.
*/
require_once __DIR__ . '/eea-compliance.php';
/**
* Add translations functionality.
*/
require_once __DIR__ . '/translations.php';
uyarreklam.com.tr/httpdocs/wp-content/plugins/so-widgets-bundle/base/inc/installer/tpl/admin.php 0000644 00000010652 15155666550 0032051 0 ustar 00 var/www/vhosts <div class="wrap siteorigin-installer-wrap">
<div class="siteorigin-installer-header">
<h1 class="siteorigin-logo">
<img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ) . '../img/siteorigin.svg'; ?>" />
<?php esc_html_e( 'SiteOrigin Installer', 'so-widgets-bundle' ); ?>
</h1>
<ul class="page-sections">
<li><a href="#" data-section="plugins"><?php esc_html_e( 'Plugins', 'so-widgets-bundle' ); ?></a></li>
<li><a href="#" data-section="themes"><?php esc_html_e( 'Themes', 'so-widgets-bundle' ); ?></a></li>
<li class="active-section"><a href="#" data-section="all"><?php esc_html_e( 'All', 'so-widgets-bundle' ); ?></a></li>
</ul>
</div>
<ul class="siteorigin-products">
<?php
foreach ( $products as $slug => $item ) {
$classes = array();
$classes[] = $slug == 'siteorigin-premium' || empty( $item['status'] ) ? 'active' : 'inactive';
if ( ! empty( $highlight ) && $slug == $highlight ) {
$classes[] = 'highlight-item';
}
?>
<li class="siteorigin-installer-item siteorigin-<?php echo esc_attr( $item['type'] ); ?> siteorigin-installer-item-<?php echo sanitize_html_class( implode( ' ', $classes ) ); ?>">
<div
class="siteorigin-installer-item-body"
data-slug="<?php echo esc_attr( $slug ); ?>"
data-version="<?php echo esc_attr( $item['version'] ); ?>"
>
<?php if ( ! empty( $item['screenshot'] ) ) { ?>
<img class="siteorigin-installer-item-banner" src="<?php echo esc_url( $item['screenshot'] ); ?>" />
<?php } ?>
<div class="siteorigin-product-content">
<h3>
<?php echo esc_html( $item['name'] ); ?>
</h3>
<p class="so-description">
<?php
if ( ! empty( $highlight ) && $slug == $highlight ) {
echo '<span class="siteorigin-required">';
printf(
esc_html__( 'Required %s', 'so-widgets-bundle' ),
$item['type'] == 'plugins' ? esc_html__( 'Plugin', 'so-widgets-bundle' ) : esc_html__( 'Theme', 'so-widgets-bundle' )
);
echo '</span>';
}
echo esc_html( $item['description'] );
?>
</p>
<div class="so-type-indicator">
<?php
if ( $item['type'] == 'plugins' ) {
esc_html_e( 'Plugin', 'so-widgets-bundle' );
} else {
esc_html_e( 'Theme', 'so-widgets-bundle' );
}
?>
</div>
<div class="so-buttons <?php
echo $slug != 'siteorigin-premium' && ! empty( $item['status'] ) && ! empty( $item['update'] ) ? 'so-buttons-force-wrap' : ''; ?>">
<?php
if (
$slug == 'siteorigin-premium' ||
! empty( $item['status'] ) ||
! empty( $item['update'] ) ||
$item['type'] == 'themes'
) {
if ( $slug == 'siteorigin-premium' ) {
$premium_url = 'https://siteorigin.com/downloads/premium/';
$affiliate_id = apply_filters( 'siteorigin_premium_affiliate_id', '' );
if ( $affiliate_id && is_numeric( $affiliate_id ) ) {
$premium_url = add_query_arg( 'ref', urlencode( $affiliate_id ), $premium_url );
}
?>
<a href="<?php echo esc_url( $premium_url ); ?>" target="_blank" rel="noopener noreferrer" class="button-primary">
<?php esc_html_e( 'Get SiteOrigin Premium', 'so-widgets-bundle' ); ?>
</a>
<?php
} elseif ( ! empty( $item['status'] ) || $item['type'] == 'themes' ) {
if ( $item['status'] == 'install' ) {
$text = __( 'Install', 'so-widgets-bundle' );
} else {
$text = __( 'Activate', 'so-widgets-bundle' );
}
require 'action-btn.php';
}
if ( ! empty( $item['update'] ) ) {
$text = __( 'Update', 'so-widgets-bundle' );
$item['status'] = 'update';
require 'action-btn.php';
}
}
if (
$item['type'] == 'themes' &&
! empty( $item['demo'] )
) {
?>
<a href="<?php echo esc_url( $item['demo'] ); ?>" target="_blank" rel="noopener noreferrer" class="siteorigin-demo">
<?php esc_html_e( 'Demo', 'so-widgets-bundle' ); ?>
</a>
<?php } ?>
<?php if ( ! empty( $item['documentation'] ) ) { ?>
<a href="<?php echo esc_url( $item['documentation'] ); ?>" target="_blank" rel="noopener noreferrer" class="siteorigin-docs">
<?php esc_html_e( 'Documentation', 'so-widgets-bundle' ); ?>
</a>
<?php } ?>
</div>
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
uyarreklam.com.tr/httpdocs/wp-content/plugins/so-widgets-bundle/base/inc/installer/inc/admin.php 0000644 00000023153 15155706766 0032027 0 ustar 00 var/www/vhosts <?php
if ( ! class_exists( 'SiteOrigin_Installer_Admin' ) ) {
class SiteOrigin_Installer_Admin {
public function __construct() {
add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
add_action( 'wp_ajax_so_installer_dismiss', array( $this, 'dismiss_notice' ) );
add_action( 'wp_ajax_siteorigin_installer_manage', array( $this, 'manage_product' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ), 11 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 15 );
add_action( 'activated_plugin', array( $this, 'maybe_clear_cache' ) );
add_action( 'deactivated_plugin', array( $this, 'maybe_clear_cache' ) );
}
public static function single() {
static $single;
return empty( $single ) ? $single = new self() : $single;
}
public function maybe_clear_cache( $plugin ) {
$products = apply_filters( 'siteorigin_installer_products_transient', get_transient( 'siteorigin_installer_product_data' ) );
if ( ! empty( $products ) && ! empty( $products[ basename( $plugin, '.php' ) ] ) ) {
delete_transient( 'siteorigin_installer_product_data' );
}
}
public function display_admin_notices() {
global $pagenow;
if (
! get_option( 'siteorigin_installer_admin_dismissed' ) &&
current_user_can( 'install_plugins' ) &&
(
$pagenow != 'admin.php' ||
(
! empty( $_GET['page'] ) &&
$_GET['page'] != 'so-widgets-bundle'
)
)
) {
$dismiss_url = wp_nonce_url( add_query_arg( array( 'action' => 'so_installer_dismiss' ), admin_url( 'admin-ajax.php' ) ), 'so_installer_dismiss' );
?>
<div id="siteorigin-installer-notice" class="notice notice-warning">
<p>
<?php
printf(
__( '%s to install recommended SiteOrigin plugins and a SiteOrigin theme to get your site going.', 'so-widgets-bundle' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=siteorigin-installer' ) ) . '" target="_blank" rel="noopener noreferrer" >' . __( 'Click here', 'so-widgets-bundle' ) . '</a>'
);
?>
</p>
<a href="<?php echo esc_url( $dismiss_url ); ?>" class="siteorigin-notice-dismiss"></a>
</div>
<?php
wp_enqueue_script(
'siteorigin-installer-notice',
SITEORIGIN_INSTALLER_URL . 'js/notices.js',
array( 'jquery' ),
SITEORIGIN_INSTALLER_VERSION
);
wp_enqueue_style(
'siteorigin-installer-notice',
SITEORIGIN_INSTALLER_URL . 'css/notices.css'
);
}
}
public function dismiss_notice() {
check_ajax_referer( 'so_installer_dismiss' );
update_option( 'siteorigin_installer_admin_dismissed', true );
die();
}
public function admin_menu() {
global $menu;
if (
! defined( 'SITEORIGIN_INSTALLER_THEME_MODE' ) &&
empty( $GLOBALS['admin_page_hooks']['siteorigin'] )
) {
add_menu_page(
__( 'SiteOrigin', 'so-widgets-bundle' ),
__( 'SiteOrigin', 'so-widgets-bundle' ),
false,
'admin.php?page=siteorigin-installer',
false,
SITEORIGIN_INSTALLER_URL . '/img/icon.svg',
66
);
}
add_submenu_page(
'siteorigin',
__( 'Installer', 'so-widgets-bundle' ),
__( 'Installer', 'so-widgets-bundle' ),
'manage_options',
'so-widgets-bundle',
array( $this, 'display_admin_page' )
);
}
public function enqueue_scripts( $prefix ) {
if (
$prefix !== 'admin_page_siteorigin-installer' &&
$prefix !== 'siteorigin_page_siteorigin-installer'
) {
return;
}
wp_enqueue_style(
'so-widgets-bundle',
SITEORIGIN_INSTALLER_URL . '/css/admin.css',
array(),
SITEORIGIN_INSTALLER_VERSION
);
wp_enqueue_script(
'so-widgets-bundle',
SITEORIGIN_INSTALLER_URL . '/js/script.js',
array( 'jquery' ),
SITEORIGIN_INSTALLER_VERSION
);
wp_localize_script(
'so-widgets-bundle',
'soInstallerAdmin',
array(
'manageUrl' => wp_nonce_url( admin_url( 'admin-ajax.php?action=siteorigin_installer_manage' ), 'siteorigin-installer-manage' ),
'activateText' => __( 'Activate', 'so-widgets-bundle' ),
)
);
}
public function manage_product() {
check_ajax_referer( 'siteorigin-installer-manage' );
if ( empty( $_POST['slug'] ) || empty( $_POST['task'] ) || empty( $_POST['type'] ) || empty( $_POST['version'] ) ) {
die();
}
$slug = sanitize_file_name( $_POST['slug'] );
$product_url = 'https://wordpress.org/' . urlencode( $_POST['type'] ) . '/download/' . urlencode( $slug ) . '.' . urlencode( $_POST['version'] ) . '.zip';
// check_ajax_referer( 'so_installer_manage' );
if ( ! class_exists( 'WP_Upgrader' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
}
$upgrader = new WP_Upgrader();
if ( $_POST['type'] == 'plugins' ) {
if ( $_POST['task'] == 'install' || $_POST['task'] == 'update' ) {
$upgrader->run( array(
'package' => esc_url( $product_url ),
'destination' => WP_PLUGIN_DIR,
'clear_destination' => true,
'abort_if_destination_exists' => false,
'hook_extra' => array(
'type' => 'plugin',
'action' => 'install',
),
) );
$clear = true;
} elseif (
$_POST['task'] == 'activate' &&
! is_wp_error( validate_plugin( $slug . '/' . $slug . '.php' ) )
) {
activate_plugin( $slug . '/' . $slug . '.php' );
$clear = true;
}
} elseif ( $_POST['type'] == 'themes' ) {
if ( $_POST['task'] == 'install' || $_POST['task'] == 'update' ) {
$upgrader->run( array(
'package' => esc_url( $product_url ),
'destination' => get_theme_root(),
'clear_destination' => true,
'clear_working' => true,
'abort_if_destination_exists' => false,
) );
$clear = true;
} elseif ( $_POST['task'] == 'activate' ) {
switch_theme( $slug );
$clear = true;
}
}
if ( ! empty( $clear ) ) {
delete_transient( 'siteorigin_installer_product_data' );
}
die();
}
private function update_product_data( $product = array(), $return = true ) {
$current_theme = wp_get_theme();
if ( empty( $products ) ) {
$products = apply_filters( 'siteorigin_installer_products', json_decode( file_get_contents( SITEORIGIN_INSTALLER_DIR . '/data/products.json' ), true ) );
}
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$fields = array(
'short_description' => true,
'version' => true,
);
// $product_data = get_transient( 'siteorigin_installer_product_data' );
foreach ( $products as $slug => $item ) {
$status = false;
if ( $slug != 'siteorigin-premium' ) {
if ( $item['type'] == 'themes' ) {
$api = themes_api(
'theme_information',
array(
'slug' => $slug,
'fields' => $fields,
)
);
$theme = wp_get_theme( $slug );
// Work out the status of the theme.
if ( is_object( $theme->errors() ) ) {
$status = 'install';
} else {
$products[ $slug ]['update'] = version_compare( $theme->get( 'Version' ), $api->version, '<' );
if ( $theme->get_stylesheet() != $current_theme->get_stylesheet() ) {
$status = 'activate';
}
}
// Theme descriptions are too long so we need to shorten them.
$description = explode( '.', $api->sections['description'] );
$description = $description[0] . '. ' . $description[1];
} else {
$api = plugins_api(
'plugin_information',
array(
'slug' => $slug,
'fields' => $fields,
)
);
// Work out the status of the plugin.
$plugin_file = "$slug/$slug.php";
if ( ! file_exists( WP_PLUGIN_DIR . "/$plugin_file" ) ) {
$status = 'install';
} elseif ( ! is_plugin_active( $plugin_file ) ) {
$status = 'activate';
}
if ( $status != 'install' ) {
$plugin = get_plugin_data( WP_PLUGIN_DIR . "/$plugin_file" );
$products[ $slug ]['update'] = version_compare( $plugin['Version'], $api->version, '<' );
}
if ( empty( $item['screenshot'] ) ) {
$products[ $slug ]['screenshot'] = 'https://plugins.svn.wordpress.org/' . $slug . '/assets/icon.svg';
}
}
$products[ $slug ]['status'] = $status;
$products[ $slug ]['version'] = $api->version;
if ( empty( $item['description'] ) ) {
$products[ $slug ]['description'] = $item['type'] == 'themes' ? "$description." : $api->short_description;
}
} elseif (
! apply_filters( 'siteorigin_premium_upgrade_teaser', true ) ||
defined( 'SITEORIGIN_PREMIUM_VERSION' )
) {
unset( $products['siteorigin-premium'] );
} else {
$products['siteorigin-premium']['screenshot'] = SITEORIGIN_INSTALLER_URL . 'img/premium-icon.svg';
}
}
uasort( $products, array( $this, 'sort_compare' ) );
set_transient( 'siteorigin_installer_product_data', $products, 43200 );
return $products;
}
/**
* Display the theme admin page
*/
public function display_admin_page() {
$products = apply_filters( 'siteorigin_installer_products_transient', get_transient( 'siteorigin_installer_product_data' ) );
if ( empty( $products ) ) {
$products = $this->update_product_data();
}
if ( ! empty( $_GET['highlight'] ) && isset( $products[ (string) $_GET['highlight'] ] ) ) {
$products[ (string) $_GET['highlight'] ]['weight'] = 9999;
uasort( $products, array( $this, 'sort_compare' ) );
$highlight = $_GET['highlight'];
}
include SITEORIGIN_INSTALLER_DIR . '/tpl/admin.php';
}
/**
* Comparison function for sorting
*
* @return int
*/
public function sort_compare( $a, $b ) {
if ( empty( $a['weight'] ) || empty( $b['weight'] ) ) {
return 0;
}
return $a['weight'] < $b['weight'] ? 1 : -1;
}
}
}
SiteOrigin_Installer_Admin::single();