• Welcome to PHPVIBE Forums. Please log in.

Recent posts

#91
S
Bug tracker / Upload dont work :(
Last post by syntax -
Hey nice Script but the Upload dont work can you help me with that ? :)

and i dont understand how can i make the user Registration without Captcha ?
#92
avatar_Marius P.
Announcements / PHPVibe 11.0.45
Last post by Marius P. -
I've wrapped recent patches to a release with number 11.0.45  https://github.com/PHPVibe/PHPVibe-CMS/releases/tag/11.0.45


You can see a changelog here https://github.com/PHPVibe/PHPVibe-CMS/commits/master/
#93
Restrict video qualities for guests and non-premium users in PHPVibe

For those of you constructing an adult tube using PHPVibe, this small modification can be beneficial if you're contemplating restricting certain video qualities for specific users, akin to the practices of sites like Redtube or Pornhub.

To implement this modification in the PHPVibe CMS, open the file app/classes/class.providers.php and locate the following section:

/* We have multiple qualities */
$real_link = (isset($qualities["hd"])) ? $qualities["hd"] : $qualities["sd"];
$extra = $qualities;
}
krsort($qualities);

Just before the last line (krsort($qualities);), insert the following code:

/* Restrict some */
$garr = array('1080', '720', 'hd'); /* Guest restrictions */
if (!is_user()) {
    foreach ($garr as $rg) {
        if (isset($qualities[$rg])) {
            unset($qualities[$rg]);
        }
    }
}

$usrr = array('1080');/* Non-premium user restrictions */
if (!has_premium()) {
    $qualities = array_diff(array_map('json_encode', $qualities), array_map('json_encode', $usrr));
    $qualities = array_map('json_decode', $qualities);
}

Adjust the $garr and $usrr arrays with the values you want to exclude. $garr pertains to guests, while $usrr relates to non-premium users or regular users. The $qualities variable is global, allowing you to access it from video.php in the theme folder. This enables you to create a message that informs users about the restricted qualities, such as "Sign in to watch this in stunning 1080p," a common feature on adult tube sites.

I hope this proves helpful! Cheers.
#94
avatar_Marius P.
How Tos / Understanding the PHPVibe rout...
Last post by Marius P. -
PHPVibe diverges from a custom PHP framework or an MVC model, opting instead for an easily navigable file system. The central controller, index.php, serves as the core orchestrator, encompassing subsequent files.

index.php initiates a route, a view, a PHP file situated in the /views folder, named views/{name}.route.php. This view, in turn, invokes a template file located at /themes/{current theme}/{name}.php as its display (template).

Why this approach?

It simplifies the system for easy editing, avoiding the use of a custom PHP framework or MVC model. Notably, no files are overwritten even if mixed within the same folder during coding. This avoids potential conflicts, such as having two files named video.php in different folders—one for components and another for theme output.

Here's a flow example for a single video page:

index.php
Utilizes load.php, which consolidates all libraries.
Invokes:
views/video.route.php
Calls:
themes/main/video.php
Serving as the final destination for theme output.




#95
avatar_Marius P.
How Tos / Remove the Youtube logo in the...
Last post by Marius P. -
The YouTube logo on the player

One of the most commonly searched queries by our users/webmasters interested in video sharing is "How to remove/get rid of the YouTube logo on YouTube embedded videos." However, achieving this task is challenging, often temporary, and comes with high risks. Not only do you risk limitations imposed by YouTube or being banned from the API, but you may also draw the ire of Google, potentially resulting in removal from its listings.

The typical approach involves creating a proxy file that captures and decodes the link to the YouTube video. However, this method requires constant updates and code changes whenever YouTube modifies its platform. This can be frustrating, and it's advisable to reconsider pursuing this idea.

YouTube advertising on the player

Whenever you embed a YouTube video using their iframe or a supported player, YouTube advertising will still appear on your website. While it may be annoying, content creators are positioned to earn substantial revenue through the Google network.

In such cases, the best choice is to accept and adapt to it.

PHPVibe exclusively employs safe players compliant with YouTube's policies to the fullest extent. Both video ads and the YouTube logo will persist and will not be removed from our CMS.

If you observe our clients attempting to remove these elements, kindly refrain from seeking assistance from us.
The CMS is open source, allowing each owner to customize it according to their needs.
#96
avatar_Marius P.
How Tos / do_action
Last post by Marius P. -
The PHPVibe do_action() hook is inspired by the hook with the same name used by WordPress.

It allows you to place actions that run on typical requests just as on WordPress.

 

Common actions in PHPVibe are:
//Common actions
function the_header(){
do_action('vibe_header');
}
function the_footer() {
do_action('vibe_footer');
}
function the_sidebar() {
if(is_admin() || (get_option('site-offline', 0) == 0 )) {
do_action('vibe_sidebar');
}
}
function right_sidebar() {
do_action('right_sidebar');
}
All are located in the file lib/functions.php

You can hook a function to an action hook using add_action().

Usage:
do_action( $tag, $arg );
Parameters
$tag
(string) (required) The name of the hook you wish to execute.
Default: None
$arg
(mixed) (optional) The list of arguments to send to this hook.
Default: Empty string
#97
avatar_Marius P.
How Tos / Filters and Hooks in PHPVibe
Last post by Marius P. -
add_filter() and apply_filter()

PHPVibe's add__filter() hooks a function to a specific filter action.

Usage:

add_filter( $tag, $function_to_add );
Example:

If you wish to dynamically inject a new title to the PHPVibe page:

function seotitle( $text ) {
return "My static title";
/* clearly you can build some php and use some globals here, not just use text ;) */}
add_filter( 'phpvibe_title', 'seotitle' );
PHPVibe's apply_filter()
Calls the functions added to a filter hook.
The callback functions attached to the filter hook $tag are invoked by calling this function. This function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter.

Usage:

apply_filters( $tag, $value, $var ... );
Example:

//SEO
function seo_title() {
return apply_filters( 'phpvibe_title', get_option('seo_title'));
}
function seo_desc() {
return apply_filters( 'phpvibe_desc', get_option('seo_desc'));
}

Useful hooks in PHPVibe
These two hooks may also help a lot (after the SEO hooks explained upper):
function extra_js() {
return apply_filter( 'filter_extrajs', false );
}
function extra_css() {
return apply_filter( 'filter_extracss', false );
}
They inject custom css and js in your template file. You can attach an add_filter() to them easily.
function more_css( $text ) {
$mycss = '';
return $text.$mycss;
}
add_filter( 'filter_extracss', 'more_css' );
#98
avatar_Marius P.
Coding/Extending / How to write a plugin
Last post by Marius P. -
The PHPVibe plugin system is fairly simple to use and code for.
It relies on the hooks and filters present in PHPVibe (very similar to WordPress's system).

The plugin needs to have its own folder name and contain the file plugin.php, it needs to be activated through the 'Plugins' menu in the administration area.

A simple plugin example adding a message at the start of your homepage.

Create /plugins/hello/plugin.php

Top of the file (plugin details, commented):

<?php
/**
 * Plugin Name: Demo source
 * Plugin URI: http://phpvibe.com/
 * Description: Adds something new to PHPVibe
 * Version: 1.0
 * Author: PHPVibe Fan 
 * Author URI: http://www.phpvibe.com
 * License: GPL
 */

Create the function returning the message.
In the simplest form ever you can use the language system to modify and translate the message.

function HelloWorld(){
echo _lang("Welcome to my great website");
}
Now we hook the function to the 'home-start' action present on top of home.php

add_action('home-start', 'HelloWorld');
Sure, you can use very complex logic and code here and on all the other actions, this is just a very simple example.
#99
PHPVibe comes with a few simple but efficient conditional functions for components restrictions (all located in lib/functions.php):

is_home() – Returns true if the current page is the homepage
is_video() – Returns true for single video & music pages
is_picture() – Returns true for single image
is_channel() – Returns true for single channel

For all the rest you could use the function is_com($com)
Example:

if(is_com('login')) {
/* You are on the login page */}
To see the components you could check the router declarations in index.php

$router->map('/api/:section', 'api', array('methods' => 'GET', 'filters' => array('section' => '(.*)')));

The structure is RewritenUrl format, Component, arrays of methods.

You could also just


echo com();
to print the current component.

#100
How to write a web source/new embed for PHPVibe

The PHPVibe cms uses a tone of web sources, through web sources people can easily generate a video autoembed by submitting just the link.

We will be using the logic of the plugin system to achieve a new source without touching the code from lib/class.providers.php

First, let's add our new source to the supported array of websites.

function newSourceName($hosts = array()){
$hosts[] = 'newsource.com';
return $hosts;
}

Now let's provide the embed logic for this new example source:

For v5, v6 versions of PHPVibe
function EmbednewSourceName($txt =''){
global $vid;
if(isset($vid)) {
if($vid->VideoProvider($vid->theLink()) == 'newsource.com' ) {
$link = $vid->theLink();
if(!nullval($link)) {
$id = $vid->getVideoId("video/", '/'); //* Id extraction logic. Let's say the url has the id after /video , example old.phpvibe.com/video/1367/ *//
if(!nullval($id)) {
$tembed = ' < iframe(? object, etc) width="' . get_option('video-width') . '" height="' . get_option('video-heigth') . '" src="http://newsource.com/player?vid='.$id.'" frameborder="0" allowfullscreen scrolling="no"> ';
$txt .= $tembed;
}
/* End link check */
}
/* End provider check */
}
/* End isset(vid) */
}
/* End function */
return $txt;
}

For PHPVibe v11+
function EmbednewSourceName($txt =''){
    global $VibeProvider, $VibeLink;
    if (isset($VibeProvider) && isset($VibeLink)) {
        if($VibeProvider == 'yournewsourceDeclaredName' ) {
//make sure you restrict the changes to this source
          
            if(not_empty($VibeLink)) {
                $id =  $VibeLink.' something to prepare it'; //* Id extraction logic. Let's say the url has the id after /video , example old.phpvibe.com/video/1367/ *//
                if(not_empty($id)) {
                    $tembed = ' < iframe(? object, etc) width="' . get_option('video-width') . '" height="' . get_option('video-heigth') . '" src="http://newsource.com/player?vid='.$id.'" frameborder="0" allowfullscreen scrolling="no"> ';
                    $txt .= $tembed;
                }
                /* End link check */
            }
            /* End provider check */
        }
        /* End isset(vid) */
    }
    /* End function */
    return $txt;
}


So now we have the function that gets the link to the external video source and turns it into an iframe embed.
Let's hook it to the PHPVibe embeds through the filter EmbedModify.

add_filter('EmbedModify', 'EmbednewSourceName');


Now we have a new source of embeds for our visitors.

If you can scrape, or the source returns details (thumbnails, duration, title, description, tags), you can hook this also:
for PHPVibe 5-6

function DetailsnewSourceName($txt = ''){
global $vid,$websLink;
if(!isset($vid) && isset($websLink)) {
$vid = new Vibe_Providers($websLink);
}
if(isset($vid)) {
$link = $vid->theLink();
if(!nullval($link)) {

//* Logic to extract info from the link goes here and it's added to $txt *//

}
/* End isset(vid) */
}
/* End function */
return $txt;
}

for PHPVibe 11+
function DetailsnewSourceName($zvideo = array())
{
    global $VibeProvider, $VibeLink;
    //expected output
    $xvideo = array();
    $xvideo['description'] = '';
    $xvideo['title'] = '';
    $xvideo['thumbnail'] = '';
    $xvideo['duration'] = '';
    $xvideo['tags'] = '';
    if ($VibeProvider == 'yournewsourceDeclaredName') {
//make sure you restrict the changes to this source

//* Logic to extract info from the link goes here and it's added to $txt *//
        $xvideo .= 'do something to extract details';
    }
    /* End function */
    return array_merge($zvideo, $xvideo);
}

The function gets hooked to the filter EmbedDetails

add_filter('EmbedDetails', 'DetailsnewSourceName');
Now you will be returning video details on the second submission page.