Recent posts

#91
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
#92
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' );
#93
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.
#94
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.

#95
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.



#96
avatar_Marius P.
How Tos / OverVideo html/js ads
Last post by Marius P. -
OverVideo html ads allow the placing of an html/js ad in the following positions: pre-roll, post-roll, and over-video (as static or annotation).


PHPVibe comes ready with over-video html spots (Available for all local players) and VAST/VPAID ads support for VideoJS.
#97
avatar_Marius P.
How Tos / Re: In video ads (VAST/VPAID)
Last post by Marius P. -
Check also : Use a VAST file to deliver in-player ads -> https://forums.phpvibe.com/how-tos/use-a-vast-file-to-deliver-in-player-ads/
#98
avatar_Marius P.
How Tos / In video ads (VAST/VPAID)
Last post by Marius P. -
Videos boot conversions and sales, also show geat ROI and build trust.
With video marketing, you can easily explain everything and engage even the laziest of buyers!
The true "in video" ads used also by YouTube are the VAST/VPAID ads.
To understand what they are please read this.

PHPVibe comes by default with VideoJs's VAST/VPAID plugin (IMA SDK Plugin for Video.js) pre-installed for the player. Adding an ad is as simple as copy/pasting the link to the ad tag in the admin panel.

See some example tags at Google.

SKIP TO VIDEO can be set from the tag.




#99
avatar_Marius P.
How Tos / Use a VAST file to deliver in-...
Last post by Marius P. -
Delivering a custom video ad to PHPVibe is simple.
You can simply build your VAST file and save it somewhere, then link to it in Settings-> Players



All the rest are set in the video file:
Impression – Where the player should send the impressions (custom tracking link?)
kipoffset="00:00:05″ – The skip value for the ad. If the ad is longer than this time the "Skip Ad" button will show up.
ClickThrough is the url you send the user once he clicks on the ads.
Video files for ads are set in the "MediaFile" tag of the vast xml.

Here is a full sample https://pastebin.com/Meh67CXr

<VAST version="2.0">
  <Ad id="static">
    <InLine>
      <AdSystem>Vibe</AdSystem>
      <AdTitle>Vibe</AdTitle>
      <Impression>https://www.domain.com/</Impression>
      <Creatives>
        <Creative>
        <Linear skipoffset="00:00:05">
            <Duration>00:00:38</Duration>
         <CustomTracking> 
	       <TrackingEvents>
			 <Tracking event="skip">
			 https://domain.com/pixel.png
			 </Tracking>
             </TrackingEvents>
             </CustomTracking> 
            <VideoClicks>
              <ClickThrough>https://www.domain.com/</ClickThrough>              
            </VideoClicks>
            <MediaFiles>			
              <MediaFile id="someid" delivery="progressive" width="1280" height="720" bitrate="2081" scalable="true" maintainAspectRatio="true">
               https://www.domain.com/preroll.webm
              </MediaFile>			 
			  <MediaFile id="someotherid" delivery="progressive" width="1920" height="1080" type="video/mp4" bitrate="4211" scalable="true" maintainAspectRatio="true">
               https://www.domain.com/vast.mp4
              </MediaFile>
            </MediaFiles>
           </Linear>
        </Creative>
      </Creatives>
    </InLine>
  </Ad>
</VAST>

#100
avatar_Marius P.
How Tos / [Installation tutorial] How to...
Last post by Marius P. -
Installing PHPVibe involves several steps.


Here's a general guide to help you with the installation process.
Keep in mind that specific steps might vary depending on the version of PHPVibe you are installing, and it's always a good idea to refer to the official documentation for the most accurate and up-to-date instructions.

You cannot view this attachment.

Requirements:
Before you begin, ensure that your server meets the minimum requirements for PHPVibe. Common requirements include:
  • Apache web server (nGinx will do too)
  • PHP version 7.3 or higher
  • MySQL/Maria database
  • FFMPEG 3.x+ (for video processing)
  • GD Library (for image processing)
  • Enable: allow_url_fopen, base64 encoding, shell_exec
Keep in mind these semi-optional ones too:
  • Off safe mode, SQL safe mode
  • Mod_security tuned to be tolerant or turned off

Step 1: Download PHPVibe
Visit the official PHPVibe website or the repository where you obtained the PHPVibe files https://github.com/PHPVibe/PHPVibe-CMS. Download the latest version of PHPVibe or choose a stable version from https://github.com/PHPVibe/PHPVibe-CMS/tags
Step 2: Extract Files
Once the download is complete, extract the PHPVibe files to your local machine.
Step 3: Create a Database
Create a new database and user for PHPVibe. Note down the database name, username, and password; you'll need these during the installation. Also, make sure you've assigned full permissions to the user on the database.

Step 4: Configuration

Locate the configuration files (named
vibe_config.php
) in the PHPVibe files you extracted.
Open the file using a text editor and fill in the necessary information, such as database connection details, and website url (with an ending slash /).
Step 5: Upload Files
Upload the PHPVibe files to your web server. You can use FTP or a file manager provided by your hosting provider.
Step 6: Set Permissions
Ensure that the appropriate file and folder permissions are set. Directories like
storage/
and its children need to have write permissions.
Step 7: Run Installation Script
Visit your website in a web browser. If everything is set up correctly, you should be redirected to the PHPVibe installation script. Follow the on-screen instructions to complete the installation.
Step 8: Finalize Installation
Once the installation is complete, you'll likely be prompted to remove the installation directory or take other finalization steps. Follow these instructions.
Step 9: Test Your Installation
Visit your PHPVibe site and ensure that it's working as expected. You may need to log in to the admin panel to configure additional settings.


Google & Facebook logins

Getting Google login credentials (check this 3rd party video from 2:16) https://www.youtube.com/watch?v=-65R420rIUA&t=136s

Redirect url in PHPVibe:
{insert your site url}/callback.php?type=google

Getting Facebook login credentials/creating app https://www.youtube.com/watch?v=C_R4WK8DDag

Redirect url in PHPVibe:
{insert your site url}/callback.php?type=facebook


Youtube API


To make Youtube link embeds work & also the Youtube importer get your Youtube API v3 server key by registering an Youtube app.
Youtube no longer allows access to their info without this step.
1. Go to https://console.developers.google.com/ and Create Project
2. Select Project Name
3. Go to menu APIs, and select YouTube Data API
4. Click Enable API
5. Go to menu Credentials and click Create New Key
6. Choose Server Key
7. Click Create
8. You got API Key, Save it.
You'll need this key to add or import videos from Youtube.
Please check this video https://www.youtube.com/watch?v=5RizOdYz-rU for a step by step overview of Google's developers console

Finally
Please go over ALL your settings in the Admin panel



Additional Tips:
  • Always refer to the official PHPVibe documentation for detailed and version-specific instructions.
  • Regularly check for updates and security patches on the PHPVibe website.
  • Back up your files and database before performing any updates.
Remember that this is a general guide, and the specifics might vary based on your hosting environment and the PHPVibe version you are using.
Always consult the official documentation for the most accurate instructions.