Skip to content

Commit a397ffe

Browse files
committed
Artvelog Custom Redirect Page
Wordpress
1 parent f2b6a98 commit a397ffe

File tree

578 files changed

+80478
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

578 files changed

+80478
-0
lines changed

admin/admin.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
use Carbon_Fields\Container;
3+
use Carbon_Fields\Field;
4+
add_action( 'carbon_fields_register_fields', 'artvelog_redirectpage_options_page' );
5+
function artvelog_redirectpage_options_page() {
6+
Container::make( 'theme_options', __( 'Redirect Page Options', 'redirect-artvelog' ) )
7+
->add_fields( array(
8+
Field::make( 'select', 'custom_page_id', __( 'Custom Redirect Page', 'redirect-artvelog') )
9+
->add_options( crb_get_pages_array() )
10+
->set_help_text( 'Please select the page whose content will be displayed on the redirect page. <b>Using a custom page would be more beneficial.</b>', 'redirect-artvelog' ),
11+
12+
Field::make( 'select', 'custom_page_builder', 'Page Builder', 'redirect-artvelog' )
13+
->add_options( array(
14+
'elementor' => 'Elementor',
15+
'beaver_builder' => 'Beaver Builder',
16+
'gutenberg' => 'Gutenberg',
17+
'visual_composer' => 'Visual Composer',
18+
'siteorigin' => 'SiteOrigin',
19+
) )
20+
->set_default_value( "gutenberg" )
21+
->set_help_text( 'Select the plugin you used to create your page. <b style="color: red;">Make sure you choose the correct one. Otherwise, your page may not display correctly.</b>', 'redirect-artvelog' ),
22+
23+
24+
Field::make( 'text', 'redirect_page_title', __( 'Custom Redirect Page Title', 'redirect-artvelog' ) )
25+
->set_help_text( 'Enter the title of the redirect page.', 'redirect-artvelog' )
26+
->set_default_value( "Redirect Page" )
27+
->set_required(true),
28+
29+
Field::make( 'text', 'redirect_rewrite', __( 'Rewrite Page Slug' , 'redirect-artvelog') )
30+
->set_help_text( 'Determine the extension of the redirect page. <b>By default, "redirect" is used.</b> <b style="color: red;">After changing it, you must save the changes from the Permalinks section.</b>', 'redirect-artvelog' )
31+
->set_default_value( "yonlendirme" )
32+
->set_required(true),
33+
34+
Field::make( 'text', 'delay_time', __( 'Delay Time', 'redirect-artvelog' ) )
35+
->set_default_value( 5 )
36+
->set_required(true)
37+
->set_attribute( 'type', 'number' )
38+
->set_attribute( 'step', '0.01' )
39+
->set_help_text( 'Determine the delay time.', 'redirect-artvelog' ),
40+
41+
Field::make( 'text', 'select_link_tag', __( 'Usable Html Tag', 'redirect-artvelog' ) )
42+
->set_help_text( 'Specify the class or ID of the "a" tag to be redirected. If you want to use all links directly, just write "a". <b style="color: red;">(Internal links will not be redirected!)</b> ', 'redirect-artvelog' )
43+
->set_default_value( "a" )
44+
->set_required(true),
45+
46+
Field::make( 'text', 'redirect_ref', __( 'Reference Link or Text', 'redirect-artvelog' ) )
47+
->set_help_text( 'Enter the reference text or link. <b>You can leave it blank.</b>', 'redirect-artvelog' )
48+
->set_default_value( site_url() ),
49+
50+
Field::make( 'color', 'redirect_page_bg_color', __( 'Background Color', 'redirect-artvelog' ) )
51+
->set_alpha_enabled( true )
52+
->set_help_text( 'You can set the background color.', 'redirect-artvelog' )
53+
->set_default_value( '#fff' ),
54+
55+
Field::make( 'textarea', 'redirectpage_custom_styles', __( 'Redierect Page Custom Style', 'redirect-artvelog' ) )
56+
->set_help_text( 'You can add custom styles to the redirect page.', 'redirect-artvelog' )
57+
->set_rows( 8 )
58+
->set_attribute( 'placeholder', 'CSS Code...' ),
59+
60+
Field::make( 'html', 'credits' )
61+
->set_html(sprintf( '<h3>Redirect Page</h3> <p>© <a href="https://creative.artvelog.com">Plugin by Artvelog</a> - <a href="https://carbonfields.net/">Options Page by Carbon Fields.</a></p></br><h4><a href="https://github.com/artvelog/Custom-Redirect-Page">Github</a></h4>', __( 'https://emreertan.com or https://creative.artvelog.com' ) ) )
62+
) );
63+
64+
}
65+
function crb_get_pages_array() {
66+
$args = array(
67+
'post_type' => 'page',
68+
'post_status' => array( 'publish', 'private' ),
69+
);
70+
$pages = get_pages( $args );
71+
$pages_array = array();
72+
foreach ( $pages as $page ) {
73+
$pages_array[ $page->ID ] = $page->post_title;
74+
}
75+
return $pages_array;
76+
}

inc/builder_support.php

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
$page_id = carbon_get_theme_option('custom_page_id');
3+
$page_builder = carbon_get_theme_option('custom_page_builder');
4+
if ( $page_builder == 'elementor' ) {
5+
if ( class_exists( 'Elementor\Plugin' ) ) {
6+
add_action( 'wp_enqueue_scripts', function() {
7+
\Elementor\Plugin::$instance->frontend->enqueue_styles();
8+
\Elementor\Plugin::$instance->frontend->enqueue_scripts();
9+
});
10+
}
11+
} elseif ( $page_builder == 'beaver_builder' ) {
12+
ob_start();
13+
if ( class_exists( 'FLBuilder' ) ) {
14+
add_action( 'wp_enqueue_scripts', function() use ($page_id) {
15+
FLBuilder::enqueue_layout_styles_scripts($page_id);
16+
});
17+
}
18+
ob_start();
19+
$content = "";
20+
$page_template = get_page_template_slug( $page_id );
21+
$template = locate_template( $page_template );
22+
$path_in_theme_or_childtheme_or_compat = ( 0 === strpos( realpath( $template ), realpath( get_stylesheet_directory() ) ) || 0 === strpos( realpath( $template ), realpath( get_template_directory() ) ) || 0 === strpos( realpath( $template ), realpath( ABSPATH . WPINC . '/theme-compat/' ) ));
23+
if ( strlen( $template ) > 0 && $path_in_theme_or_childtheme_or_compat ) {
24+
include $template;
25+
} else {
26+
the_post();
27+
?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
28+
<?php
29+
}
30+
31+
$content = ob_get_clean();
32+
} elseif ( $page_builder == 'gutenberg' ) {
33+
if ( class_exists( 'UAGB_Post_Assets' ) ) {
34+
$post_assets_instance = new UAGB_Post_Assets( $page_id );
35+
$post_assets_instance->enqueue_scripts();
36+
}
37+
} elseif ( $page_builder == 'visual_composer' ) {
38+
if ( defined( 'VCV_VERSION' ) ) {
39+
wp_enqueue_style( 'vcv:assets:front:style' );
40+
wp_enqueue_script( 'vcv:assets:runtime:script' );
41+
wp_enqueue_script( 'vcv:assets:front:script' );
42+
43+
$bundle_url = get_post_meta( $page_id, 'vcvSourceCssFileUrl', true );
44+
if ( $bundle_url ) {
45+
$version = get_post_meta( $page_id, 'vcvSourceCssFileHash', true );
46+
if ( ! preg_match( '/^http/', $bundle_url ) ) {
47+
if ( ! preg_match( '/assets-bundles/', $bundle_url ) ) {
48+
$bundle_url = '/assets-bundles/' . $bundle_url;
49+
}
50+
}
51+
if ( preg_match( '/^http/', $bundle_url ) ) {
52+
$bundle_url = set_url_scheme( $bundle_url );
53+
} elseif ( defined( 'VCV_TF_ASSETS_IN_UPLOADS' ) && constant( 'VCV_TF_ASSETS_IN_UPLOADS' ) ) {
54+
$upload_dir = wp_upload_dir();
55+
$bundle_url = set_url_scheme( $upload_dir['baseurl'] . '/' . VCV_PLUGIN_ASSETS_DIRNAME . '/' . ltrim( $bundle_url, '/\\' ) );
56+
} elseif ( class_exists( 'VisualComposer\Helpers\AssetsEnqueue' ) ) {
57+
// These methods should work for Visual Composer 26.0.
58+
// Enqueue custom css/js stored in vcvSourceAssetsFiles postmeta.
59+
$vc = new \VisualComposer\Helpers\AssetsEnqueue;
60+
if ( method_exists( $vc, 'enqueueAssets' ) ) {
61+
$vc->enqueueAssets($page_id);
62+
}
63+
// Enqueue custom CSS stored in vcvSourceCssFileUrl postmeta.
64+
$upload_dir = wp_upload_dir();
65+
$bundle_url = set_url_scheme( $upload_dir['baseurl'] . '/' . VCV_PLUGIN_ASSETS_DIRNAME . '/' . ltrim( $bundle_url, '/\\' ) );
66+
} else {
67+
$bundle_url = content_url() . '/' . VCV_PLUGIN_ASSETS_DIRNAME . '/' . ltrim( $bundle_url, '/\\' );
68+
}
69+
wp_enqueue_style(
70+
'vcv:assets:source:main:styles:' . sanitize_title( $bundle_url ),
71+
$bundle_url,
72+
array(),
73+
VCV_VERSION . '.' . $version
74+
);
75+
}
76+
}
77+
78+
// Visual Composer custom CSS.
79+
if ( defined( 'WPB_VC_VERSION' ) ) {
80+
// Post custom CSS.
81+
$post_custom_css = get_post_meta( $page_id, '_wpb_post_custom_css', true );
82+
if ( ! empty( $post_custom_css ) ) {
83+
$post_custom_css = wp_strip_all_tags( $post_custom_css );
84+
echo '<style type="text/css" data-type="vc_custom-css">';
85+
echo $post_custom_css;
86+
echo '</style>';
87+
}
88+
// Shortcodes custom CSS.
89+
$shortcodes_custom_css = get_post_meta( $page_id, '_wpb_shortcodes_custom_css', true );
90+
if ( ! empty( $shortcodes_custom_css ) ) {
91+
$shortcodes_custom_css = wp_strip_all_tags( $shortcodes_custom_css );
92+
echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
93+
echo $shortcodes_custom_css;
94+
echo '</style>';
95+
}
96+
}
97+
98+
} elseif ( $page_builder == 'siteorigin' ) {
99+
if ( class_exists( 'SiteOrigin_Panels' ) ) {
100+
$renderer = SiteOrigin_Panels::renderer();
101+
$renderer->add_inline_css( $page_id, $renderer->generate_css( $page_id ) );
102+
}
103+
} else {
104+
105+
}

inc/carbon-fields/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Carbon Fields WordPress Plugin
2+
3+
### About
4+
5+
This package loads Carbon Fields as a WordPress plugin.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Plugin Name: Carbon Fields
4+
* Description: WordPress developer-friendly custom fields for post types, taxonomy terms, users, comments, widgets, options, navigation menus and more.
5+
* Version: 3.5.2
6+
* Author: htmlburger
7+
* Author URI: https://htmlburger.com/
8+
* Plugin URI: http://carbonfields.net/
9+
* License: GPL2
10+
* Requires at least: 5.0
11+
* Tested up to: 6.1.1
12+
* Text Domain: carbon-fields
13+
* Domain Path: /languages
14+
*/
15+
16+
define( 'Carbon_Fields_Plugin\PLUGIN_FILE', __FILE__ );
17+
18+
define( 'Carbon_Fields_Plugin\RELATIVE_PLUGIN_FILE', basename( dirname( \Carbon_Fields_Plugin\PLUGIN_FILE ) ) . '/' . basename( \Carbon_Fields_Plugin\PLUGIN_FILE ) );
19+
20+
add_action( 'after_setup_theme', 'carbon_fields_boot_plugin' );
21+
function carbon_fields_boot_plugin() {
22+
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
23+
require( __DIR__ . '/vendor/autoload.php' );
24+
}
25+
\Carbon_Fields\Carbon_Fields::boot();
26+
27+
if ( is_admin() ) {
28+
\Carbon_Fields_Plugin\Libraries\Plugin_Update_Warning\Plugin_Update_Warning::boot();
29+
}
30+
}

inc/carbon-fields/composer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "htmlburger/carbon-fields-plugin",
3+
"description": "WordPress plugin loader for Carbon Fields.",
4+
"license": "GPL-2.0",
5+
"type": "wordpress-plugin",
6+
"homepage": "http://carbonfields.net/",
7+
"authors": [
8+
{
9+
"name": "atanas-angelov-dev",
10+
"email": "[email protected]"
11+
}
12+
],
13+
"support": {
14+
"source": "https://github.com/htmlburger/carbon-fields",
15+
"docs": "http://carbonfields.net/docs/",
16+
"issues": "https://github.com/htmlburger/carbon-fields/issues",
17+
"email": "[email protected]"
18+
},
19+
"autoload": {
20+
"psr-4": {
21+
"Carbon_Fields_Plugin\\": "core/"
22+
}
23+
},
24+
"require": {
25+
"php": ">=5.3",
26+
"composer/installers": "^1.0|^2.0",
27+
"htmlburger/carbon-fields": "3.5.2"
28+
}
29+
}

0 commit comments

Comments
 (0)