Plugin Directory

Changeset 1166881


Ignore:
Timestamp:
05/25/2015 04:45:54 AM (11 years ago)
Author:
guavaworks
Message:

v2 push

Location:
wprtc-real-time-video-for-wp/trunk
Files:
15 added
4 edited

Legend:

Unmodified
Added
Removed
  • wprtc-real-time-video-for-wp/trunk/includes/settings.php

    r937687 r1166881  
    11<?php
    2 function wprtc_menu() {
    3     add_menu_page( 'wpRTC', 'wpRTC', 'manage_options', 'wp-rtc', 'wprtc_main_options', 'dashicons-admin-generic', 81 );
    4     add_submenu_page( 'wp-rtc', 'wpRTC Settings', 'wpRTC Settings', 'manage_options', 'wp-rtc-settings', 'wprtc_settings_options' );
    5     add_submenu_page( 'wp-rtc', 'wpRTC Styling', 'wpRTC Styling', 'manage_options', 'wp-rtc-css', 'wprtc_css_options' );
    6 }
    72
    8 function wprtc_main_options() {
    9     if ( !current_user_can( 'manage_options' ) )  {
    10         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    11     }
    12     echo '<style> .feature-filter { padding: 20px; } strong { font-weight: bold; }</style>';
    13     echo '<div class="wrap feature-filter">';
    14         echo '<h1>wpRTC - Real Time Video Sharing for WordPress</h1>';
    15         echo '<table width="100%" cellpadding="5" cellspacing="5" border="0">';
    16             echo '<tr>';
    17                 echo '<td width="50%" valign="top">';
    18                     echo '<h3>Documentation</h3>';
    19                     echo '<p> In depth documentation available online <br/>';
    20                     echo '<a class="button-primary" href="http://www.roysivan.com/wp-webrtc" target="_blank">View Documentation</a></p>';
    21                     echo '<h3>Shortcode</h3>';
    22                     echo '<p>The plugin comes with a built in shortcode to help you with setting up your videos easily</p>';
    23                     echo '<pre><code>[wpRTC]</code></pre>';
    24                     // ATTS
    25                     echo '<h4>Shortcode Attributes</h4>';
    26                     // room_title
    27                     echo '<p><strong>room_title</strong> - title over your video.<br/>';
    28                     echo '<code>[wpRTC room_title="..."]</code><br/><em>leave blank to remove title</em></p>';
    29                     // room_name
    30                     echo '<p><strong>room_name</strong> - set up your room name or multiple rooms. <br/><code>[wpRTC room_name="testing"]</code> </p>';
    31                     echo '<p><code>[wpRTC room_name="testing, testingAgain, anotherRoom"]</code> - <em>This feature adds in a drop down menu under the video so users can change rooms using the same page and video code. wpRTC PRO</em></p>';
    32                     // privacy
    33                     echo '<p><strong>privacy</strong> - override default settings.<br/>';
    34                     echo '<code>[wpRTC privacy="on"]</code> - <em>wpRTC PRO</em></p>';
    35                 echo '</td>';
    36                 echo '<td valign="top">';
    37                     echo '<h3>wpRTC PRO</h3>';
    38                     echo '<p>Upgrade to wpRTC PRO to get additional features and future release functionality</p>';
    39                     echo '<h4>Additional Features in wpRTC Pro</h4>';
    40                     echo '<ul>';
    41                         echo '<li><strong><a target="_blank" href="http://roysivan.com/wp-webrtc/examples/multiple-rooms/">Multiple Rooms</a></strong> <br/> 1 shortcode, 1 video, multiple rooms</li>';
    42                         echo '<li><strong><a target="_blank" href="http://roysivan.com/wp-webrtc/examples/privacy/">Privacy Override</a></strong> <br/> Want all your video streams to be sign-in only, except a few?<br/> Override your global setting for privacy on a per video basis.</li>';
    43                     echo '</ul>';
    44                     echo '<h3><strong>wpRTC Pro</strong> - is available now starting at just $9.99</h3>';
    45                     echo '<a class="button-primary" href="http://www.roysivan.com/downloads/wprtc-pro-webrtc-wordpress/" target="_blank">Buy wpRTC Pro</a>';
    46                 echo '</td>';
    47             echo '</tr>';
    48         echo '</table>';
    49     echo '</div>';
    50 }
     3class wprtc_setting {
     4   
     5    function init() {
     6        add_action( 'admin_menu', array( $this, 'wprtc_menu' ) );
     7        add_action( 'admin_init', array( $this, 'wprtc_posthandler' ) );
     8    }
     9   
     10    function wprtc_posthandler() {
     11       
     12        if( isset( $_POST['_wprt_icecomm_save'] ) ) {
     13            update_option( 'wprtc_icecomm', $_POST['_wprtc_icecomm'] );
     14        }
     15       
     16    }
     17   
     18    function wprtc_menu() {
     19        add_menu_page( 'wpRTC', 'wpRTC', 'manage_options', 'wp-rtc', array( $this, 'wprtc_main_options' ), 'dashicons-admin-generic', 81 );
     20        add_submenu_page( 'wp-rtc', __('wpRTC Settings', 'wprtc'), __('wpRTC Settings', 'wprtc'), 'manage_options', 'wp-rtc-settings', array( $this, 'wprtc_settings_options' ) );
     21        add_submenu_page( 'wp-rtc', __('wpRTC Styling', 'wprtc'), __('wpRTC Styling', 'wprtc'), 'manage_options', 'wp-rtc-css', array( $this, 'wprtc_css_options' ) );
     22    }
     23   
     24   
     25   
     26    function wprtc_main_options() {
     27        if ( !current_user_can( 'manage_options' ) )  {
     28            wp_die( __( 'You do not have sufficient permissions to access this page.', 'wprtc' ) );
     29        }
     30       
     31        $wprtc_icecomm = get_option( 'wprtc_icecomm', '' );
     32       
     33        echo '<style> .feature-filter { padding: 20px; } strong { font-weight: bold; }</style>';
     34        echo '<div class="wrap feature-filter">';
     35            echo '<h1>' . __('wpRTC - Real Time Video Sharing for WordPress', 'wprtc') . '</h1>';
     36            echo '<table width="100%" cellpadding="5" cellspacing="5" border="0">';
     37                echo '<tr>';
     38                    echo '<td width="50%" valign="top">';
     39                        echo '<h2>' . __('ICECOMM API', 'wprct') . '</h2>';
     40                        echo '<p> wpRTC is now powered by <a target="_blank" href="http://icecomm.io">Icecomm.io</a> a cross browser WebRTC library.';
     41                        echo '<br />You will need to setup a FREE account on <a target="_blank" href="http://icecomm.io">Icecomm.io</a> to get an API key to use this plugin</p>';
     42                       
     43                        echo '<form method="post">';
     44                       
     45                            echo '<table cellpadding="5" cellspacing="0" border="0">';
     46                                echo '<tr>';
     47                                    echo '<th valign="top"><label for="_wprtc_icecomm">Icecomm.io API Key</label></th>';
     48                                    echo '<td><input id="_wprtc_icecomm" name="_wprtc_icecomm" value="' . $wprtc_icecomm . '" style="display:block;width:100%" />';
     49                                    echo '<p class="description">You can find your API key on your account page once you have registered</p>';
     50                                    echo '</td>';
     51                                echo '</tr>';
     52                            echo '</table>';
     53                            echo '<input class="button-primary" type="submit" value="Save API Key" name="_wprt_icecomm_save" />';
     54                        echo '</form>';
     55                        echo '<h3>' . __('Shortcode', 'wprtc') . '</h3>';
     56                        echo '<p>' . __('The plugin comes with a built in shortcode to help you with setting up your videos easily', 'wprtc') . '</p>';
     57                        echo '<pre><code>[wpRTC]</code></pre>';
     58                        // ATTS
     59                        echo '<h4>' . __('Shortcode Attributes', 'wprtc') . '</h4>';
     60                        // room_title
     61                        echo '<p><strong>room_title</strong> - ' .__('title over your video.', 'wprtc') . '<br/>'; // i18n: room_title is an attribute. Shouldn't be translated
     62                        echo '<code>[wpRTC room_title="..."]</code><br/><em>' .__('leave blank to remove title.', 'wprtc') . '</em></p>';
     63                        // room_name
     64                        echo '<p><strong>room_name</strong> - ' . __('set up your room name or multiple rooms.', 'wprtc');
     65                        echo '<p><code>[wpRTC room_name="testing"]</code> </p>';
     66                        echo '<p><code>[wpRTC room_name="testing, testingAgain, anotherRoom"]</code> <br/><em>' . __('This feature adds in a drop down box under the video so users can change rooms using the same page and video code. wpRTC PRO', 'wprtc') . '</em></p>';
     67                        // privacy
     68                        echo '<p><strong>privacy</strong> - ' . __('override default settings.', 'wprtc') . '<br/>';
     69                        echo '<code>[wpRTC privacy="on"]</code> - <em>' . __('wpRTC PRO', 'wprtc') . '</em></p>';
     70                    echo '</td>';
     71                    echo '<td valign="top">';
     72                        echo '<h3>' . __('Documentation', 'wprtc' ). '</h3>';
     73                        echo '<p>' . __('In depth documentation available online', 'wprtc') . '<br/>';
     74                        echo '<a class="button-primary" href="http://www.roysivan.com/wp-webrtc" target="_blank">' . __('View Documentation', 'wprtc') . '</a></p>';
     75                        echo '<h3>' . __('wpRTC PRO</h3>', 'wprtc');
     76                        echo '<p>' . __('Upgrade to wpRTC PRO to get additional features and future release functionality', 'wprtc') . '</p>';
     77                        echo '<h4>A' . __('dditional Features in wpRTC Pro', 'wprtc') . '</h4>';
     78                        echo '<ul>';
     79                            echo '<li>' . __('<strong>Multiple Rooms</strong> <br/> 1 shortcode, 1 video, multiple rooms', 'wprtc') . '</li>';
     80                            echo '<li>' . __('<strong>Privacy Override</strong> <br/> Want all your video streams to be sign-in only, except a few? The override helps you do just that.', 'wprtc') . '</li>';
     81                            echo '<li>' . __('<strong>Support</strong> <br/> Preferred support - <a target="_blank" href="http://www.roysivan.com/plugin-support">Plugin Support Page</a>', 'wprtc') . '</li>';
     82                        echo '</ul>';
     83                        echo '<h3><strong>' . __('Thank You</strong> - for purchasing wpRTC Pro</h3>', 'wprtc');
     84                    echo '</td>';
     85                echo '</tr>';
     86            echo '</table>';
     87        echo '</div>';
     88    }
     89   
     90    function wprtc_settings_options() {
     91   
     92        // Handle Saving
     93        $toSave = array('rtc_main_private', 'rtc_main_private_msg');
     94   
     95        foreach($_POST as $key => $value) {
     96            if( in_array( $key, $toSave ) ) {
     97                update_option($key, $value);
     98            }
     99        }
     100        $currentVal = array();
     101        foreach($toSave as $key) {
     102            $currentVal[$key] = get_option($key);
     103        }
     104        echo '<style> .feature-filter { padding: 20px; } label,strong { font-weight: bold; } select,textarea{ width: 400px; } textarea {height: 200px; }</style>';
     105        echo '<div class="wrap feature-filter">';
     106            echo '<h2>' . __('wpRTC - Real Time Video Sharing for WordPress', 'wprtc') . '</h2>';
     107            echo '<form name="wprtcSettings" method="post" action="">';
     108                echo '<p><label>' . __('Private Videos', 'wprtc') . '</label><br/>';
     109                echo '<select name="rtc_main_private">';
     110                    echo '<option value="1"';
     111                        if($currentVal['rtc_main_private'] == '1') echo 'selected="selected"';
     112                    echo '>' . __('On', 'wprtc') . '</option>';
     113                    echo '<option value="0"';
     114                        if($currentVal['rtc_main_private'] == '0') echo 'selected="selected"';
     115                    echo '>' . __('Off', 'wprtc') . '</option>';
     116                echo '</select><br/><em>' . __('Turn this option on if you must be logged in to see video', 'wprtc') . '</em></p>';
     117                if($currentVal['rtc_main_private'] == '1'):
     118                    echo '<p><label>Private Video Message</label><br/>';
     119                    echo '<textarea name="rtc_main_private_msg" placeholder="' . esc_attr( __('Videos are private', 'wprtc') ) . '">'.$currentVal['rtc_main_private_msg'].'</textarea>';
     120                    echo '<br/><em>' . __('Message displayed when video privacy is turned on', 'wprtc') . '</em></p>';
     121                endif;
     122            echo '<br/><input type="submit" value="' . esc_attr( __('Save Settings', 'wprtc') ) . '" class="button-primary" /></form>';
     123        echo '</div>';
     124   
     125    }
    51126
    52 function wprtc_settings_options() {
    53 
    54     // Handle Saving
    55     $toSave = array('rtc_main_private', 'rtc_main_private_msg');
    56 
    57     foreach($_POST as $key => $value) {
    58         if( in_array( $key, $toSave ) ) {
    59             update_option($key, $value);
    60         }
    61     }
    62     $currentVal = array();
    63     foreach($toSave as $key) {
    64         $currentVal[$key] = get_option($key);
    65     }
    66     echo '<style> .feature-filter { padding: 20px; } label,strong { font-weight: bold; } select,textarea{ width: 400px; } textarea {height: 200px; }</style>';
    67     echo '<div class="wrap feature-filter">';
    68         echo '<h2>wpRTC - Real Time Video Sharing for WordPress</h2>';
    69         echo '<p>You do not need to make any changes here, default styling is setup.<br/>';
    70         echo '<strong>Local Video</strong> - your video stream<br/>';
    71         echo '<strong>Remote Video</strong> - video stream of peers connected to your video room</p>';
    72         echo '<form name="wprtcSettings" method="post" action="">';
    73             echo '<p><label>Private Videos</label><br/>';
    74             echo '<select name="rtc_main_private">';
    75                 echo '<option value="1"';
    76                     if($currentVal['rtc_main_private'] == '1') echo 'selected="selected"';
    77                 echo '>On</option>';
    78                 echo '<option value="0"';
    79                     if($currentVal['rtc_main_private'] == '0') echo 'selected="selected"';
    80                 echo '>Off</option>';
    81             echo '</select><br/><em>Turn this option on if you must be logged in to see video</em></p>';
    82             if($currentVal['rtc_main_private'] == '1'):
    83                 echo '<p><label>Private Video Message</label><br/>';
    84                 echo '<textarea name="rtc_main_private_msg" placeholder="Videos are private">'.$currentVal['rtc_main_private_msg'].'</textarea>';
    85                 echo '<br/><em>Message displayed when video privacy is turned on</em></p>';
    86             endif;
    87         echo '<br/><input type="submit" value="Save Settings" class="button-primary" /></form>';
    88     echo '</div>';
     127//  function resetOptions() {
     128//      $rtcOptions = array(
     129//          'rtcBG'  => '#000',
     130//          'rtcBC'  => '#000',
     131//          'rtcBW'  => '2px',
     132//          'rtcW'   => '100%',
     133//          'rtcH'   => '500px',
     134//          'rtcRH'  => '200px',
     135//          'rtcRvW' => '100px',
     136//      );
     137//
     138//      foreach ( $rtcOptions as $key => $value ) {
     139//          update_option( $key, $value );
     140//      }
     141//  }
     142   
     143    function wprtc_css_options() {
     144        if ( !current_user_can( 'manage_options' ) )  {
     145            wp_die( __( 'You do not have sufficient permissions to access this page.', 'wprtc' ) );
     146        }
     147   
     148        // Handle Saving
     149        $toSave = array('rtcBG', 'rtcBC', 'rtcBW', 'rtcW', 'rtcH', 'rtcRH', 'rtcRvW', 'rtcClass');
     150   
     151        // Delete All
     152        if( isset($_POST['deleteAllwpRTC']) && $_POST['deleteAllwpRTC'] == '1' ) {
     153            foreach($toSave as $key) {
     154                delete_option($key);
     155            }
     156        }
     157   
     158        foreach($_POST as $key => $value) {
     159            if( in_array( $key, $toSave ) ) {
     160                update_option($key, $value);
     161            }
     162        }
     163   
     164        $currentVal = array();
     165        foreach($toSave as $key) {
     166            $currentVal[$key] = get_option($key);
     167        }
     168     
     169        echo '<table width="100%" cellpadding="5" cellspacing="0" border="0"><tbody>';
     170            echo '<tr><td  valign="top"><form name="wprtcStyles" method="post" action="">';
     171                echo '<div class="tabbedContent">';
     172                    echo '<ul>';
     173                        echo '<li><a href="#tabLocal">' . __('Local Video Styling', 'wprtc') . '</a></li>';
     174                        echo '<li><a href="#tabRemote">' . __('Remote Video Styling', 'wprtc') . '</a></li>';
     175                        echo '<li><a href="#tabAdv">' . __('Advanced Styling', 'wprtc') . '</a></li>';
     176                    echo '</ul>';
     177                    echo '<div id="tabLocal">';
     178                        echo '<h3>' . __('Background Color', 'wprtc') . '</h3>';
     179                        echo '<p><label>' . __('Background Color', 'wprtc') . '</label><br/>';
     180                        echo '<input name="rtcBG" placeholder="' . esc_attr( __('Video Background', 'wprtc') ) . '" class="color-picker" value="'.$currentVal['rtcBG'].'" /></p><hr/>';
     181                        echo '<h3>' . __('Video Size', 'wprtc') . '</h3>';
     182                        echo '<p><label>' . __('Video Width (i.e 500px)', 'wprtc') . '</label><br/>';
     183                        echo '<input name="rtcW" placeholder="' . esc_attr( __('Video Width', 'wprtc') ) . '" value="'.$currentVal['rtcW'].'" /></p><hr/>';
     184                        echo '<p><label>' . __('Video Height  (i.e 500px)', 'wprtc') . '</label><br/>';
     185                        echo '<input name="rtcH" placeholder="' . esc_attr( __('Video Height', 'wprtc') ) . '" value="'.$currentVal['rtcH'].'" /></p><hr/>';
     186                        echo '<h3>' . __('Video Border', 'wprtc') . '</h3>';
     187                        echo '<p><label>' . __('Video Border Color', 'wprtc') . '</label><br/>';
     188                        echo '<input name="rtcBC" placeholder="' . esc_attr( __('Border Color', 'wprtc') ) . '" value="'.$currentVal['rtcBC'].'" class="color-picker" /></p><hr/>';
     189                        echo '<p><label>' . __('Video Border Width (i.e 2px)', 'wprtc') . '</label><br/>';
     190                        echo '<input name="rtcBW" placeholder="' . esc_attr( __('Border Width', 'wprtc') ). '" value="'.$currentVal['rtcBW'].'" /></p><hr/>';
     191                    echo '</div>';
     192                    echo '<div id="tabRemote">';
     193                        echo '<h3>' . __('Remove Video Styling', 'wprtc') . '</h3>';
     194                        echo '<p><label>' . __('Remote Video Container Height (i.e 150px)', 'wprtc') . '</label><br/>';
     195                        echo '<input name="rtcRH" placeholder="' . esc_attr( __('Container Height', 'wprtc') ) . '" value="'.$currentVal['rtcRH'].'" /></p><hr/>';
     196                        echo '<p><label>' . __('Remote Video Width (i.e 150px)', 'wprtc') . '</label><br/>';
     197                        echo '<input name="rtcRvW" placeholder="' . esc_attr( __('Video Width', 'wprtc') ) . '" value="'.$currentVal['rtcRvW'].'" /></p><hr/>';
     198                    echo '</div>';
     199                    echo '<div id="tabAdv">';
     200                        echo '<h3>' . __('Advanced Styling', 'wprtc') . '</h3>';
     201                        echo '<p><label>' . __('CSS Class for Video Wrapper', 'wprtc') . '</label><br/>';
     202                        echo '<input name="rtcClass" placeholder="' . esc_attr( __('CSS class', 'wprtc') ) . '" value="'.$currentVal['rtcClass'].'"/><br/>';
     203                        echo '<em>' . __('This will add an additional class to the rtcVideoContainer video wrapper div', 'wprtc') . '</p><hr/>';
     204                    echo '</div>';
     205                echo '</div>';
     206            echo '<br/><input type="submit" value="' . esc_attr( __('Save All Styling', 'wprtc') ) . '" class="button-primary" /></form>';
     207            //echo '<form method="post"><input type="hidden" value="1" name="deleteAllwpRTC" /><input type="submit" class="button-primary" value="' . esc_attr( __('Reset Defaults', 'wprtc') ) . '" /></form>';
     208            echo '</td></tr>';
     209        echo '</tbody></table>';
     210    }
    89211
    90212}
    91 
    92 // function resetOptions() {
    93 //     $rtcOptions = array(
    94 //         'rtcBG' => '#000',
    95 //         'rtcBC' => '#000',
    96 //         'rtcBW' => '2px',
    97 //         'rtcW' => '100%',
    98 //         'rtcH' => '500px',
    99 //         'rtcRH' => '200px',
    100 //         'rtcRvW' => '100px',
    101 //     );
    102 
    103 //     foreach($rtcOptions as $key => $value) {
    104 //         update_option($key, $value);
    105 //     }
    106 // }
    107 
    108 function wprtc_css_options() {
    109     if ( !current_user_can( 'manage_options' ) )  {
    110         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    111     }
    112 
    113     // Handle Saving
    114     $toSave = array('rtcBG', 'rtcBC', 'rtcBW', 'rtcW', 'rtcH', 'rtcRH', 'rtcRvW', 'rtcClass');
    115 
    116     // Delete All
    117     if( isset($_POST['deleteAllwpRTC']) && $_POST['deleteAllwpRTC'] == '1' ) {
    118         foreach($toSave as $key) {
    119             delete_option($key);
    120         }
    121     }
    122 
    123     foreach($_POST as $key => $value) {
    124         if( in_array( $key, $toSave ) ) {
    125             update_option($key, $value);
    126         }
    127     }
    128 
    129     $currentVal = array();
    130     foreach($toSave as $key) {
    131         $currentVal[$key] = get_option($key);
    132     }
    133     echo '<table width="100%" cellpadding="5" cellspacing="0" border="0"><tbody>';
    134         echo '<tr><td  valign="top"><form name="wprtcStyles" method="post" action="">';
    135             echo '<div class="tabbedContent">';
    136                 echo '<ul>';
    137                     echo '<li><a href="#tabLocal">Local Video Styling</a></li>';
    138                     echo '<li><a href="#tabRemote">Remote Video Styling</a></li>';
    139                     echo '<li><a href="#tabAdv">Advanced Styling</a></li>';
    140                 echo '</ul>';
    141                 echo '<div id="tabLocal">';
    142                     echo '<h3>Background Color</h3>';
    143                     echo '<p><label>Background Color</label><br/>';
    144                     echo '<input name="rtcBG" placeholder="Video Background" class="color-picker" value="'.$currentVal['rtcBG'].'" /></p><hr/>';
    145                     echo '<h3>Video Size</h3>';
    146                     echo '<p><label>Video Width (i.e 500px)</label><br/>';
    147                     echo '<input name="rtcW" placeholder="Video Width" value="'.$currentVal['rtcW'].'" /></p><hr/>';
    148                     echo '<p><label>Video Height  (i.e 500px)</label><br/>';
    149                     echo '<input name="rtcH" placeholder="Video Height" value="'.$currentVal['rtcH'].'" /></p><hr/>';
    150                     echo '<h3>Video Border</h3>';
    151                     echo '<p><label>Video Border Color</label><br/>';
    152                     echo '<input name="rtcBC" placeholder="Border Color" value="'.$currentVal['rtcBC'].'" class="color-picker" /></p><hr/>';
    153                     echo '<p><label>Video Border Width (i.e 2px)</label><br/>';
    154                     echo '<input name="rtcBW" placeholder="Border Width" value="'.$currentVal['rtcBW'].'" /></p><hr/>';
    155                 echo '</div>';
    156                 echo '<div id="tabRemote">';
    157                     echo '<h3>Remove Video Styling</h3>';
    158                     echo '<p><label>Remote Video Container Height (i.e 150px)</label><br/>';
    159                     echo '<input name="rtcRH" placeholder="Container Height" value="'.$currentVal['rtcRH'].'" /></p><hr/>';
    160                     echo '<p><label>Remote Video Width (i.e 150px)</label><br/>';
    161                     echo '<input name="rtcRvW" placeholder="Video Width" value="'.$currentVal['rtcRvW'].'" /></p><hr/>';
    162                 echo '</div>';
    163                 echo '<div id="tabAdv">';
    164                     echo '<h3>Advanced Styling</h3>';
    165                     echo '<p><label>CSS Class for Video Wrapper</label><br/>';
    166                     echo '<input name="rtcClass" placeholder="CSS class" value="'.$currentVal['rtcClass'].'"/><br/>';
    167                     echo '<em>This will add an additional class to the rtcVideoContainer video wrapper div</p><hr/>';
    168                 echo '</div>';
    169             echo '</div>';
    170         echo '<br/><input type="submit" value="Save All Styling" class="button-primary" /></form>';
    171         //echo '<form method="post"><input type="hidden" value="1" name="deleteAllwpRTC" /><input type="submit" class="button-primary" value="Reset Defaults" /></form>';
    172         echo '</td></tr>';
    173     echo '</tbody></table>';
    174 }
    175213?>
  • wprtc-real-time-video-for-wp/trunk/includes/shortcode.php

    r955161 r1166881  
    11<?php
    22
    3 function webRTCscripts() {
    4     // Simple WebRTC Core
    5     //wp_enqueue_script('socket-io', plugin_dir_url( __FILE__ ).'js/socket.io.js', array('jquery'), null, false);
    6     wp_enqueue_script('simple-core', plugin_dir_url( __FILE__ ).'js/simplewebrtc.bundle.js', array('jquery'), null, false);
    73
    8     // Simple WebRTC functionality
    9     wp_enqueue_script('wpRTC', plugin_dir_url( __FILE__ ).'js/wpRTC.js', array('simple-core'), null, false);
     4class wprtc_shortcode {
    105   
    11     // FONT AWEOMSE
    12     wp_enqueue_style('fontAwesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', null, false);
    13    
    14 }
     6    function __construct() {
     7        add_shortcode( 'wpRTC', array( $this, 'webRTCsc' ) );
     8    }
    159
    16 function webRTCsc( $atts ){
    17    
    18     // SHORTCODE ATTS
    19     $a = shortcode_atts( array(
    20         'room_name' => '',
    21         'room_title' => '',
    22     ), $atts );
    23 
    24     // ROOM NAME
    25     $roomName = 'default_room';
    26     if(isset($a['room_name'])) { $roomName = $a['room_name']; }
    27     if(isset($_POST['roomName'])){ $roomName = $_POST['roomName']; }
    28    
    29     // PLUGIN DEFAULTS
    30     $rtcOptions = array(
    31         'rtcBG' => '#000',
    32         'rtcBC' => '#000',
    33         'rtcBW' => '2px',
    34         'rtcW' => '100%',
    35         'rtcH' => '500px',
    36         'rtcRH' => '200px',
    37         'rtcRvW' => '100px',
    38         'private_msg' => 'You must be logged in to view this video stream',
    39         'rtcClass' => ''
    40     );
    41    
    42     if(get_option('rtcBG')) { $rtcOptions['rtcBG'] = get_option('rtcBG'); }
    43     if(get_option('rtcBC')) { $rtcOptions['rtcBC'] = get_option('rtcBC'); }
    44     if(get_option('rtcBW')) { $rtcOptions['rtcBW'] = get_option('rtcBW'); }
    45     if(get_option('rtcW')) { $rtcOptions['rtcW'] = get_option('rtcW'); }
    46     if(get_option('rtcH')) { $rtcOptions['rtcH'] = get_option('rtcH'); }
    47 
    48     if(get_option('rtcRH')) { $rtcOptions['rtcRH'] = get_option('rtcRH'); }
    49     if(get_option('rtcRvW')) { $rtcOptions['rtcRvW'] = get_option('rtcRvW'); }
    50    
    51     if(get_option('rtcClass')) { $rtcOptions['rtcClass'] = get_option('rtcClass'); }
    52 
    53     if(get_option('rtc_main_private_msg')) { $rtcOptions['private_msg'] = get_option('rtc_main_private_msg'); }
    54    
    55     if(get_option('rtc_main_private') === '1' && !is_user_logged_in() ) {
    56         ob_start();
    57         echo '<p>'.$rtcOptions['private_msg'].'</p>';
    58         return ob_get_clean();
    59     } else {
    60         webRTCscripts();
     10    function webRTCscripts() {
     11        // Simple WebRTC Core
     12        wp_enqueue_script('icecomm-core', plugin_dir_url( __FILE__ ).'assets/js/min/icecomm.min.js', array('jquery'), null, false);
     13        wp_enqueue_script('wpRTC', plugin_dir_url( __FILE__ ).'assets/js/min/wpRTC.min.js', array('icecomm-core'), null, false);
     14        wp_localize_script( 'wpRTC',
     15            'wprtc_info',
     16            $wprtc = array(
     17                'wprtc_icecomm' => get_option( 'wprtc_icecomm', '' )
     18            )
     19        );
     20       
     21        // FONT AWEOMSE
     22        wp_enqueue_style('fontAwesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', null, false);
     23       
    6124    }
    6225   
    63     $inlineStyle = '<style>';
    64         $inlineStyle .= '.rtcVideoContainer { position: relative; height: auto; width: '.$rtcOptions['rtcW'].'; }';
    65         $inlineStyle .= 'video.rtcVideoPlayer{ background: '.$rtcOptions['rtcBG'].'; border: '.$rtcOptions['rtcBW'].' solid '.$rtcOptions['rtcBC'].'; height: '.$rtcOptions['rtcH'].'; width: '.$rtcOptions['rtcW'].';}';
    66         $inlineStyle .= '#remoteVideos{height: '.$rtcOptions['rtcRH'].'; width:'.$rtcOptions['rtcW'].'}';
    67         $inlineStyle .= '#remoteVideos video {float: left; height:100px; width:'.$rtcOptions['rtcRvW'].'}';
    68     $inlineStyle .= '</style>';
     26    function webRTCsc( $atts ){
     27       
     28        // SHORTCODE ATTS
     29        $a = shortcode_atts( array(
     30            'room_name'    => '',
     31            'room_title'   => '',
     32            'max_capacity' => 0
     33        ), $atts );
    6934   
    70     // ECHO
    71     ob_start();
    72     echo $inlineStyle;
    73     if($a['room_title'] !== '') { echo '<h2 class="videoTitle">'.$a['room_title'].'</h2>'; }
    74     echo '<div class="rtcVideoContainer '.$rtcOptions['rtcClass'].'">';
    75         echo '<video title="hello" data-room="'.$roomName.'" class="rtcVideoPlayer" id="localVideo" oncontextmenu="return false;"></video>';
    76         echo '<div id="localVolume" class="volumeBar"></div>';
    77         echo '<div id="remoteVideos"></div>';
    78     echo '</div>';
    79     return ob_get_clean();
     35        // ROOM NAME
     36        if( strpos( $a['room_name'], ',' ) !== false && !isset($_REQUEST['roomName']) ){
     37            $rooms = explode(',', $a['room_name']);
     38            $roomName = $rooms[0]; 
     39        } elseif( $a['room_name'] !== '' && !isset($_REQUEST['roomName']) ) {
     40            $roomName = $a['room_name'];
     41        } else {
     42            $roomName = 'default_room';
     43        }
     44   
     45        // SET ROOM BY REQUEST
     46        if(isset($_REQUEST['roomName'])){ $roomName = $_REQUEST['roomName']; }
     47   
     48       
     49        // PLUGIN DEFAULTS
     50        $rtcOptions = array(
     51            'rtcBG'       => '#000',
     52            'rtcBC'       => '#000',
     53            'rtcBW'       => '2px',
     54            'rtcW'        => '100%',
     55            'rtcH'        => '500px',
     56            'rtcRH'       => '200px',
     57            'rtcRvW'      => '100px',
     58            'private_msg' => __( 'You must be logged in to view this video stream', 'webrtc' ),
     59            'rtcClass'    => ''
     60        );
     61       
     62        if(get_option('rtcBG')) { $rtcOptions['rtcBG'] = get_option('rtcBG'); }
     63        if(get_option('rtcBC')) { $rtcOptions['rtcBC'] = get_option('rtcBC'); }
     64        if(get_option('rtcBW')) { $rtcOptions['rtcBW'] = get_option('rtcBW'); }
     65        if(get_option('rtcW')) { $rtcOptions['rtcW'] = get_option('rtcW'); }
     66        if(get_option('rtcH')) { $rtcOptions['rtcH'] = get_option('rtcH'); }
     67   
     68        if(get_option('rtcRH')) { $rtcOptions['rtcRH'] = get_option('rtcRH'); }
     69        if(get_option('rtcRvW')) { $rtcOptions['rtcRvW'] = get_option('rtcRvW'); }
     70   
     71        if(get_option('rtcClass')) { $rtcOptions['rtcClass'] = get_option('rtcClass'); }
     72       
     73        if(get_option('rtc_main_private_msg')) { $rtcOptions['private_msg'] = get_option('rtc_main_private_msg'); }
     74       
     75        if( $this->__privacy_check() ) {
     76            ob_start();
     77            echo '<p>'.$rtcOptions['private_msg'].'</p>';
     78            return ob_get_clean();
     79        } else {
     80            $this->webRTCscripts();
     81        }
     82       
     83        // MAX CAPACITY
     84        $maxCap = '';
     85        if( intval($a['max_capacity']) > 0 ) { $maxCap = 'data-capacity="'.$a['max_capacity'].'"';}
     86       
     87        // STYLING
     88        $inlineStyle = '<style>';
     89            $inlineStyle .= '.rtcVideoContainer { position: relative; height: auto; width: '.$rtcOptions['rtcW'].'; }';
     90            $inlineStyle .= 'video.rtcVideoPlayer{ background: '.$rtcOptions['rtcBG'].'; border: '.$rtcOptions['rtcBW'].' solid '.$rtcOptions['rtcBC'].'; height: '.$rtcOptions['rtcH'].'; width: '.$rtcOptions['rtcW'].';}';
     91            $inlineStyle .= '.largeVideo{ height: '.$rtcOptions['rtcH'].'; width: '.$rtcOptions['rtcW'].';}';
     92            $inlineStyle .= '#remoteVideos{ height: '.$rtcOptions['rtcRH'].'; width:'.$rtcOptions['rtcW'].'}';
     93            $inlineStyle .= '#remoteVideos video { float: left; height:100px; width:'.$rtcOptions['rtcRvW'].'}';
     94        $inlineStyle .= '</style>';
     95       
     96        // ECHO
     97        ob_start();
     98       
     99        // STYLE OVERRIDES
     100        echo $inlineStyle;
     101       
     102        // ROOM TITLE - DEFAULTS TO ROOM NAME UNLESS 'ROOM_TITLE' IS SET
     103        if($a['room_title'] !== '') { echo '<h2 class="videoTitle">'.$a['room_title'].'</h2>'; }
     104        if( $a['room_title'] == '' && isset( $select ) ) { echo '<h2 class="videoTitle">'.$roomName.'</h2>'; }     
     105       
     106        // VIDEO CONTAINER
     107        echo '<div class="rtcVideoContainer '.$rtcOptions['rtcClass'].'">';
     108            // MUTE CONTROLES
     109            echo '<div class="mute_controls">';
     110                echo '<a href="#" class="mute audio" title="mute audio"><span class="fa fa-microphone"></span></a>';
     111                echo '<a href="#" class="mute video" title="mute video"><span class="fa fa-power-off on"></span></a>';
     112            echo '</div>';
     113            // LOCAL VIDEO
     114            echo '<div class="largeVideo">';
     115                echo '<video autoplay data-room="'.$roomName.'" data-maxCap="'.$a['max_capacity'].'" class="rtcVideoPlayer localVideo" oncontextmenu="return false;" '.$maxCap.'>';
     116                echo '</video>';
     117            echo '</div>';
     118            // CHANGE ROOM SELECT
     119            if(isset($select)) { echo $select; }           
     120            // REMOTE VIDEO COLLECTION
     121            echo '<div id="remoteVideos"></div>';
     122       
     123        echo '</div>';
     124       
     125        return ob_get_clean();
     126    }
     127   
     128    function __privacy_check( $privacy = 'off' ) {
     129        if( is_user_logged_in() ) { return false; }
     130       
     131        $private = false;
     132        if( $privacy == 'on'|| $privacy == 'On' || $privacy == 'ON'  ) { $private = true; }
     133        if( get_option('rtc_main_private') === '1' && !is_user_logged_in() ) { $private = true; }
     134       
     135        return $private;
     136    }
     137
    80138}
    81139
  • wprtc-real-time-video-for-wp/trunk/plugin.php

    r955161 r1166881  
    11<?php
    22/**
    3  * Plugin Name: wpRTC - WebRTC for WordPress
    4  * Plugin URI: http://roysivan.com/wp-webrtc/
    5  * Description: This plugin will allow you to easily create peer-to-peer video using shortcode, as users enter the page they will enter the video chat
    6  * Version: 1.1
    7  * Author: Roy Sivan
    8  * Author URI: http://www.roysivan.com
    9  * License: GPL2
     3 * Plugin Name:     wpRTC - WebRTC for WordPress
     4 * Plugin URI:      https://wordpress.org/plugins/wprtc-real-time-video-for-wp/
     5 * Description:     This plugin will allow you to easily create peer-to-peer video chats
     6 * Version:         2.0.0
     7 * Author:          Roy Sivan, Michal Bluma, Michael Beil
     8 * Author URI:      http://roysivan.com
     9 * Text Domain:     wprtc
     10 * Domain Path:     /languages
     11 * License:         GPLv3
     12 * License URI:     http://www.gnu.org/licenses/gpl.html
    1013 */
    1114
     
    1417
    1518
    16 define('WordPressWebRTC', '1.1');
     19define('WordPressWebRTC', '2.0.0');
    1720
    1821class WordPressWebRTC {
     22    const text_domain = 'wprtc';
     23
    1924    function WordPressWebRTC(){
    2025        global $wpdb;
    21         add_shortcode( 'wpRTC', 'webRTCsc' );
    22         add_action( 'admin_menu', 'wprtc_menu' );
    23         add_action( 'admin_enqueue_scripts', array( $this, 'adminSettings' ) );
    24         add_action('wp_enqueue_scripts' , array( $this, 'wprtcCSS' ) );
    2526    }
    2627
    27    
     28    function __init() {
     29        new wprtc_shortcode();
     30        $wprtc_settings = new wprtc_setting();
     31        $wprtc_settings->init();
     32
     33        // Enqueue scripts and styles
     34        add_action( 'admin_enqueue_scripts', array( $this, 'adminSettings' ) );
     35        add_action( 'wp_enqueue_scripts' , array( $this, 'wprtcCSS' ) );
     36
     37        // Load Translations
     38        add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
     39    }
     40
    2841    function adminSettings( $hook_suffix ) {
    2942        wp_enqueue_style( 'wp-color-picker' );
    3043        wp_enqueue_script('jquery-ui-tabs');
    31         wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ).'includes/js/wpRTCadmin.js', array( 'wp-color-picker' ), false, true );
     44        wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ).'includes/assets/js/min/wpRTCadmin.min.js', array( 'wp-color-picker' ), false, true );
    3245
    33         wp_enqueue_style('tab-ui', plugin_dir_url( __FILE__ ).'includes/css/jquery-ui-1.10.4.custom.min.css', null, false);
    34         wp_enqueue_style('wpRTCcss', plugin_dir_url( __FILE__ ).'includes/css/wprtc.css', null, false);
     46        wp_enqueue_style('tab-ui', plugin_dir_url( __FILE__ ).'includes/assets/css/jquery-ui-1.10.4.custom.min.css', null, false);
     47        wp_enqueue_style('wpRTCcss', plugin_dir_url( __FILE__ ).'includes/assets/css/wprtc.css', null, false);
    3548    }
    36    
     49
    3750    function wprtcCSS(){
    38         wp_enqueue_style('wpRTCcss', plugin_dir_url( __FILE__ ).'includes/css/wprtc.css', null, false);
     51        wp_enqueue_style('wpRTCcss', plugin_dir_url( __FILE__ ).'includes/assets/css/wprtc.css', null, false);
     52    }
     53
     54    public function load_translation() {
     55        load_plugin_textdomain(self::text_domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages');
    3956    }
    4057}
    4158
    42 new WordPressWebRTC();
     59$wp_rtc = new WordPressWebRTC();
     60$wp_rtc->__init();
     61
    4362?>
  • wprtc-real-time-video-for-wp/trunk/readme.txt

    r1149457 r1166881  
    55Requires at least: 3.9
    66Tested up to: 4.2.1
    7 Stable tag: 1.1.1
    8 License: GPLv2 or later
    9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     7Stable tag: 2.0.0
     8License: GPLv3 or later
     9License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010
    1111WebRTC for WordPress allows you to easily create a video chat room utilizing webRTC, which is supported by most of the latest versions of modern browsers.
    1212
    1313== Description ==
    14 
    15 __v2__ is coming soon, it will include a new webRTC library powering the plugin, which should resolve many issues. However WebRTC is only supported by Chrome, and Firefox mainly, with some support for Opera.
    1614 
    1715WebRTC or Web Real Time Communication is an open project that enables browsers with RTC capabilities to connect with video, audio, and screen sharing. 
Note: See TracChangeset for help on using the changeset viewer.