Compilation failed while installing plugin in wordpress - wordpress

I could customize wordpress theme http://www.apptha.com/demo/video-stream in localhost well .
But I am tring to upload in server get the following error.
Warning: preg_replace_callback(): Compilation failed: missing opening brace after \o at offset 18 in /home/const/public_html/apptha/wp-content/plugins/contus-video-gallery/hdflvvideoshare.php on line 545
My site is http://constantin-entertainment.info/apptha/
here Wordpress video gallery plugin is used, the error pointed line is
$pageContent = preg_replace_callback( '/\[hdvideo ([^]]*)\o]/i', 'video_shortcodeplace', $pageContent );
Please help me..!

Looks like you need to escape the backslash,
$pageContent = preg_replace_callback( '/\[hdvideo ([^]]*)\\o]/i', 'video_shortcodeplace', $pageContent );

Open \wp-content\plugins\contus-video-gallery\hdflvvideoshare.php file and find add_filter('the_content', 'videogallery_pagereplace'); and replace with the following code.
add_shortcode('videohome','video_homereplace');
add_shortcode('videomore','video_morereplace');
add_shortcode('hdvideo','video_shortcodereplace');

Replace
$pageContent = preg_replace_callback('/\[hdvideo ([^]]*)\o]/i',
'video_shortcodeplace',
$pageContent
);
with
$pageContent = preg_replace_callback('/\[hdvideo\s*.*?=(\d+)\]/i',
'video_shortcodeplace',
$pageContent
);

Related

Fatal error within Woocommerce "wc-template-functions.php" file

I have tried to edit wc-template-functions.php in my store and did something wrong.
Now I am getting Fatal Error on 281 line.
Fatal error: Uncaught Error: Class 'Constants' not found in /home/kidsandm/oliverthedog/wp-content/plugins/woocommerce/includes/wc-template-functions.php:282 Stack trace: #0 /home/kidsandm/oliverthedog/wp-includes/class-wp-hook.php(292): wc_generator_tag('<meta name="gen...', 'xhtml') #1 /home/kidsandm/oliverthedog/wp-includes/plugin.php(212): WP_Hook->apply_filters('<meta name="gen...', Array) #2 /home/kidsandm/oliverthedog/wp-includes/general-template.php(4728): apply_filters('get_the_generat...', '<meta name="gen...', 'xhtml') #3 /home/kidsandm/oliverthedog/wp-includes/general-template.php(4650): get_the_generator('xhtml') #4 /home/kidsandm/oliverthedog/wp-includes/general-template.php(4627): the_generator('xhtml') #5 /home/kidsandm/oliverthedog/wp-includes/class-wp-hook.php(292): wp_generator('') #6 /home/kidsandm/oliverthedog/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array) #7 /home/kidsandm/oliverthedog/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #8 /home/kidsandm/oliverthedog/wp-includes/gen in /home/kidsandm/oliverthedog/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282
Before that I also had warning at the top that said:
Warning: The use statement with non-compound name 'AutomatticJetpackConstants' has no effect in /home/kidsandm/hondamarine/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 11
but I have hide that line thinking it might help.
What I have change in file?
Additional information.
I was thinking it will change the name of it on front-end as well.
// Additional information tab - shows attributes.
if ( $product && ( $product->has_attributes() || apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) {
$tabs['additional_information'] = array(
'title' => __( 'Additional information', 'woocommerce' ),
'priority' => 20,
'callback' => 'woocommerce_product_additional_information_tab',
);
}
Line 1798.
I have tried to find a code only to replace it, and I found one but did not help.
Now, that code might not be original because I could not find it on GitHub.
Thanks a lot!
It just happened to me too, I tried to edit the code for the same reason, I searched a lot about this problem and I solved it when I downloaded the plugin in zip form and manually upload it and install it, now its working fine for me and all data still in place (categories, products, etc.)!
I had the following 2 errors:
Fatal Error: Uncaught error: Class 'Constants' not found in /Users/anastasiades/Local Sites/pisinaspa/app/public/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282
Error: Class 'Constants' not found in /Users/anastasiades/Local Sites/pisinaspa/app/public/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282
Steps:
1. Backup data in woocommerce
2. Download plugin here
3. On WordPress go to Plugins >> Add new >> Upload plugin
4. Choose Reinstall >> Install now
5. "Replace current with uploaded"
I recommend a good backup of the products and other data before doing this.
Peace!

how to add require_once to a wordpress template file

I am creating a wordpress template file.
I need to require_once() a file path. Where should I put the code?
<?php require_once("phpChart/conf.php");?>
It is giving me errors if I put it in my template file. It doesn't seem to work either in the header.php file.
If I include it in the template file I can a ton of errors. I think it needs to be in the header before the html.
Here are some of the errors:
Notice: Undefined offset: -1 in /xxx/wp-includes/post-template.php on line 262 Call Stack #TimeMemoryFunctionLocation 10.0003283432{main}( ).../index.php:0 20.0004287208require( '/xxx/wp-blog-header.php' ).../index.php:17 30.454546621040require_once( '/xxx/wp-includes/template-loader.php' ).../wp-blog-header.php:16 40.459646824600include( '/xxx/wp-content/themes/gazette-child/email.php' ).../template-loader.php:74 50.537247474312get_header( ).../email.php:18 60.537547477952locate_template( ).../general-template.php:45 70.537547478144load_template( ).../template.php:477 80.537747516408require_once( '/xxx/wp-content/themes/gazette-child/header.php' ).../template.php:501 90.581648215152the_excerpt( ).../header.php:56 100.581648215264get_the_excerpt( ).../post-template.php:336 110.581748215672apply_filters( ).../post-template.php:367 120.581748217056call_user_func_array:{/xxx/wp-includes/plugin.php:213} ( ).../plugin.php:213 130.581748217088wp_trim_excerpt( ).../plugin.php:213 140.581748217248get_the_content( ).../formatting.php:2609 " /> ( ! ) Notice: Undefined offset: -1 in /xxx/wp-includes/post-template.php on line 262 Call Stack #TimeMemoryFunctionLocation 10.0003283432{main}( ).../index.php:0 20.0004287208require( '/xxx/wp-blog-header.php' ).../index.php:17 30.454546621040require_once( '/xxx/wp-includes/template-loader.php' ).../wp-blog-header.php:16 40.459646824600include( '/xxx/wp-content/themes/gazette-child/email.php' ).../template-loader.php:74 50.537247474312get_header( ).../email.php:18 60.537547477952locate_template( ).../general-template.php:45 70.537547478144load_template( ).../template.php:477 80.537747516408require_once( '/xxx/wp-content/themes/gazette-child/header.php' ).../template.php:501 90.585448229760the_excerpt( ).../header.php:68 100.585448229840get_the_excerpt( ).../post-template.php:336 110.585448230048apply_filters( ).../post-template.php:367 120.585448231280call_user_func_array:{/xxx/wp-includes/plugin.php:213} ( ).../plugin.php:213 130.585448231312wp_trim_excerpt( ).../plugin.php:213 140.585448231392get_the_content( ).../formatting.php:2609 - http://xxx/email/">
Use require_once() or include() to include a file. You didn't post what error are you getting?
require('phpChart/conf.php'); in functions.php worked.

Wordpress : Genesis-Legacy Theme error

I am getting this error message on some of my pages within worrdpress dashboard.
Google Analytics Stats
Warning: array_merge(): Argument #1 is not an array in
/home/c5280den/public_html/wp-content/plugins/google-analyticator/google-api-php-client/src/Google_Client.php
on line 40
Fatal error: Class name must be a valid object or a string in
/home/c5280den/public_html/wp-content/plugins/google-analyticator/google-api-php-client/src/Google_Client.php
on line 104
Any help is most appreciated!!
Update your plugin bro.. If updated already, try this.
FILE - google-analyticator > google-api-php-client > src > Google_Client.php
OLD CODE (starting at Line 35)
require_once "config.php";
// If a local configuration file is found, merge it's values with the default configuration
if (file_exists(dirname(__FILE__) . '/local_config.php')) {
$defaultConfig = $apiConfig;
require_once (dirname(__FILE__) . '/local_config.php');
$apiConfig = array_merge($defaultConfig, $apiConfig);
NEW CODE (starting at Line 35)
require_once (dirname(__FILE__) . "/config.php");
// If a local configuration file is found, merge it's values with the default configuration
if (file_exists(dirname(__FILE__) . '/local_config.php')) {
$defaultConfig = $apiConfig;
require_once (dirname(__FILE__) . '/local_config.php');
$apiConfig = array_merge($defaultConfig, $apiConfig);
Adding to line 35...
require_once (dirname(__FILE__) . "/config.php");
in place of...
require_once "config.php";
seems to have fixed the problem.
Get it from here https://wordpress.org/support/topic/recent-update-throws-error-in-settings-page

Wordpress get current time error on functions.php

I want to get the current time of wordpress, but I got errors, how to fix it? is there another way to get the current time of the wordpress?, I want the time that wordpress using with format (+GMT) and what the user choose, not the server time.
This is my code
<?php
require_once( '/wp-includes/functions.php' );
$format = get_option('date_format') . ' ' . get_option('time_format');
print date_i18n($format, current_time('timestamp'));
?>
These are the errors
Notice: Use of undefined constant ABSPATH - assumed 'ABSPATH' in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8
Notice: Use of undefined constant WPINC - assumed 'WPINC' in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8
Warning: require(ABSPATHWPINC/option.php): failed to open stream: No such file or directory in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8
Fatal error: require(): Failed opening required 'ABSPATHWPINC/option.php' (include_path='.;C:\xampp1\php\PEAR') in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8
You don't need to include require_once( '/wp-includes/functions.php' );. Directly use the function it will return GMT time like below
<?php echo current_time( 'mysql', 1 ); ?>
For more Please refer this link http://codex.wordpress.org/Function_Reference/current_time

get the folder of the symfony installation, not from the app direction

i am using:
$script = $this->get('kernel')->getRootDir();
but with this i got the following result:
/var/www/symfony/app
Is there a way that i can get the following result?
/var/www/symfony
This doesn't works:
$script = $this->get('kernel')->getRootDir() . "../exportscript/export.php";
I have now fixed this problem with:
$script = str_replace("/app", "", $this->get('kernel')->getRootDir() . "/exportscript/export.php");
but i dont think that this is the correct way for symfony.
You can bubble up of one directory with:
dirname($this->get('kernel')->getRootDir());
This should give you
/var/www/symfony //without trailing slash
Try
$script = $this->get('kernel')->getRootDir() . "/../exportscript/export.php";
With a slash directly after $this->get('kernel')->getRootDir() since it gives you the output /var/www/symfony/app

Resources