Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Basic osclass development related information.
$> git clone --recursive [email protected]:mindstellar/Osclass.gitHere you will learn how to remove Market related stuff on your admin frontend.
oc-includes/osclass/classes/AdminMenu.php$this->add_menu( __('Market'), osc_admin_base_url(true) .'?page=market', 'market', 'administrator');if( !osc_is_moderator() ) { $connected = osc_check_market_connect(); if(!$connected) { $this->add_submenu( 'market', __('Connect Market'), osc_admin_base_url(true) . "?page=market&open_market_connect=true", 'market_connect', 'administrator'); }}$this->add_submenu( 'market', __('Themes'), osc_admin_base_url(true) .'?page=market&action=themes', 'market_view_themes', 'administrator');$this->add_submenu( 'market', __('Plugins'), osc_admin_base_url(true).'?page=market&action=plugins', 'market_view_plugins', 'administrator');$this->add_submenu( 'market', __('Languages'), osc_admin_base_url(true).'?page=market&action=languages', 'market_view_languages', 'administrator');$this->add_submenu( 'appearance', __('Market'), osc_admin_base_url(true).'?page=market&action=themes', 'appearance_market', 'administrator');$this->add_submenu( 'plugins', __('Market'), osc_admin_base_url(true).'?page=market&action=plugins', 'plugins_market', 'administrator');oc-includes/osclass/cron.php// osc_do_auto_upgrade();define('OSC_MEMORY_LIMIT', '128M') ; define('OSC_CACHE', 'apc'); define('OSC_CACHE', 'memcache');
$_cache_config[] = array(
'default_host' => '127.0.0.1',
'default_port' => 11211,
'default_weight' => 1
);{
dt_mod_date: "YYYY-MM-DD HH:MM:SS",
dt_pub_date: "YYYY-MM-DD HH:MM:SS",
e_type: "{TYPE}",
i_total_downloads: "XYZ",
s_banner: "banner.jpg",
s_banner_path: "http://www.domain.tld/path/to/banner/",
s_compatible: "2.3,2.4,3.0,3.1,3.1.1,3.1.2",
s_contact_name: "My name",
s_description: "My description, HTML accepted",
s_source_file: "http://www.domain.tld/path/to/my_plugin.zip",
s_title: "Title",
s_update_url: "http://www.domain.tld/path/to/update/cheker.php",
s_version: "A.B.C",
}oc-admin/themes/modern/tools/upgrade.phpfunction customHead(){ ?> <script type="text/javascript"> $(document).ready(function() { $("#steps_div").hide(); }); <?php $perms = osc_save_permissions(); $ok = osc_change_permissions(); foreach($perms as $k => $v) { @chmod($k, $v); } if( $ok ) { ?> $(function() { var steps_div = document.getElementById('steps_div'); steps_div.style.display = ''; var steps = document.getElementById('steps'); var version = <?php echo osc_version(); ?>; var fileToUnzip = ''; steps.innerHTML += '<?php echo osc_esc_js( sprintf( __('Checking for updates (Current version %s)'), osc_version() )); ?> '; $.getJSON("https://osclass.org/latest_version_v1.php?callback=?", function(data) { if(data.version <= version) { steps.innerHTML += '<?php echo osc_esc_js( __('Congratulations! Your Osclass installation is up to date!')); ?>'; } else { steps.innerHTML += '<?php echo osc_esc_js( __('New version to update:')); ?> ' + oscEscapeHTML(data.version); + "<br />"; <?php if(Params::getParam('confirm')=='true') {?> steps.innerHTML += '<img id="loading_image" src="<?php echo osc_current_admin_theme_url('images/loading.gif'); ?>" /><?php echo osc_esc_js(__('Upgrading your Osclass installation (this could take a while):')); ?>'; var tempAr = data.url.split('/'); fileToUnzip = tempAr.pop(); $.getJSON('<?php echo osc_admin_base_url(true); ?>?page=ajax&action=upgrade&<?php echo osc_csrf_token_url(); ?>' , function(data) { if(data.error==0 || data.error==6) { window.location = "<?php echo osc_admin_base_url(true); ?>?page=tools&action=version"; } var loading_image = document.getElementById('loading_image'); loading_image.style.display = "none"; steps.innerHTML += $("<div>").text(data.message).html();+"<br />"; }); <?php } else { ?> steps.innerHTML += '<input type="button" value="<?php echo osc_esc_html( __('Upgrade')); ?>" onclick="window.location.href=\'<?php echo osc_admin_base_url(true); ?>?page=tools&action=upgrade&confirm=true\';" />'; <?php } ?> } }); }); <?php } ?> </script> <?php}osc_add_hook('admin_header','customHead', 10);<?php if( $ok ) { ?> <p class="text"> <?php printf( __('Your Osclass installation can be auto-upgraded. Please, back up your database and the folder oc-content before attempting to upgrade your Osclass installation. You can also upgrade Osclass manually, more information in the %s'), '<a href="http://doc.osclass.org/">Wiki</a>'); ?> </p><?php } else { ?> <p class="text"> <?php _e("Your Osclass installation can't be auto-upgraded. Files and folders need to be writable. You can apply write permissions via SSH with the command \"chmod -R a+w *\" (without quotes) or via an FTP client, it depends on the program so we can not provide more information. You can also upgrade Osclass by downloading the upgrade package, unzipping it and replacing the files on your server with the ones in the package."); ?> </p><?php } ?>oc-admin/themes/modern/plugins/index.php<li><a href="#market" onclick="window.location = '<?php echo osc_admin_base_url(true) . '?page=market&action=plugins'; ?>'; return false; "><?php _e('Market'); ?></a></li>oc-admin/themes/modern/plugins/add.php<div class="flashmessage flashmessage-info flashmessage-inline" style="display:block;"> <p class="info"><?php printf( __('Download more plugins at %s'), '<a href="'.osc_admin_base_url(true) . '?page=market&action=plugins">Market</a>'); ?></p></div>oc-includes/osclass/classes/AdminToolbar.phposc_add_hook( 'add_admin_toolbar_menus', 'osc_admin_toolbar_market_connect' , 0 );oc-admin/themes/modern/appearance/index.php<li><a href="#market" onclick="window.location = '<?php echo osc_admin_base_url(true) . '?page=market&action=themes'; ?>'; return false; "><?php _e('Market'); ?></a></li>echo '<p>' . sprintf(__("Change your site's look and feel by activating a
theme among those available. You can download new themes from the <a href=\"%s\">market</a>. <strong>Be careful</strong>: if your theme has been customized, you'll lose all changes if you change to a new theme."), osc_admin_base_url(true) . '?page=market&action=themes') . '</p>'echo '<p
>' . __("Change your site's look and feel by activating a theme among those available. You can download new themes from the <a href=\"%s\">market</a>. <strong>Be careful</strong>: if your theme has been customized, you'll lose all changes if you change to a new theme."). '</p>';OSC_DEBUG_DB_LOG/**
* Copy this code to config.php file
*
* This will show SQL queries at the bottom of the site
*/
define('OSC_DEBUG_DB', true) ;/**
* Copy this code to config.php file
*
* This will log all sql to a file called queries.log in oc-content.
*
* If Apache doesn't have write permissions, you may need to create the file first
* and set the appropriate permissions (i.e. use 666).
*/
define('OSC_DEBUG_DB', true) ;
define('OSC_DEBUG_DB_LOG', true) ;oc-includes/osclass/utils.php$uri = osc_market_url($type, $update_uri);<p class="text"> <?php _e('Congratulations! Your Osclass installation is up to date!'); ?></p>oc-admin/themes/modern/appearance/add.php<div class="flashmessage flashmessage-info flashmessage-inline" style="display: block;"> <p class="info"><?php printf( __('Download more themes at %s'), '<a href="'.osc_admin_base_url(true) . '?page=market&action=themes">Market</a>'); ?></p></div>/**
* Copy this code to config.php file
*
* This will run a EXPLAIN sql query for each SELECT sql statement.
* The results will be logged to a file called explain_queries.log in oc-content.
*
* If Apache doesn't have write permissions, you may need to create the file first
* and set the appropriate permissions (i.e. use 666).
*/
define('OSC_DEBUG_DB_EXPLAIN', true) ;$url = osc_market_url($section, $element);$data = json_decode(osc_file_get_contents($url, array('api_key' => osc_market_api_connect())), true);$download_post_data = array('api_key' => osc_market_api_connect());$download_post_data = array();$url = osc_market_url($section, $code);$data = osc_file_get_contents($url, array('api_key' => osc_market_api_connect()));$data = json_decode(osc_file_get_contents($url, array('api_key' => osc_market_api_connect())), true);return array('error' => 2, 'message' => __('Market updating not available.'), 'data' => $data);if(osc_market_external_sources())if(osc_market_external_sources() && strpos($update_uri, 'osclass.org') === false)if(!osc_market_external_sources()if(!osc_market_external_sources() || strpos($update_uri, 'osclass.org') !== false)$data = json_decode(osc_file_get_contents(osc_market_url($section, $code), array('api_key' => osc_market_api_connect())), true);echo json_encode(array('error' => 3, 'error_msg' => __('Market updating not available.')));$data = osc_file_get_contents('https://osclass.org/latest_version_v1.php?callback=?');echo json_encode(array('error' => 1, 'msg' => __('Version could not be checked')));[mysqld]
ft_min_word_len=3[mysqld]
ft_max_word_len=10REPAIR TABLE tbl_name QUICK; AdminToolbar::newInstance()->add_menu( array(...) ); /**
* Add a node to the menu.
*
* @todo implement parent nodes
*
* @param array $args - The arguments for each node.
* - id - string - The ID of the item.
* - title - string - The title of the node.
* - href - string - The link for the item. Optional.
* - meta - array - Meta data including the following keys: html, class,
* onclick, target, title, tabindex.
*/
function add_menu( $array ) osc_add_hook( 'add_admin_toolbar_menus', 'osc_admin_toolbar_menu' , 0 ); /**
* Add webtitle with link to frontend
*/
function osc_admin_toolbar_menu()
{
AdminToolbar::newInstance()->add_menu( array(
'id' => 'home',
'title' => ''. osc_page_title() .'',
'href' => osc_base_url(),
'meta' => array('class' => 'user-profile'),
'target' => '_blank'
) );
}
<?php
?>$iThisIsAnInteger = 42;
$sSomeText = 'This is some text';
$aVariable = array(1, 2, 3, 4 , 5);
...i_integer_variable
s_some_text
dt_registration_date
pk_i_id // this is a primary key
fk_i_category_id // this is a foreign key
.../**
* Documentation Block Here
*/
class Foo
{
/**
* Documentation Block Here
*/
public function bar()
{
// all contents of function
// must be indented four spaces
}
}if ($a != 2) {
$a = 2;
} else {
$a = 7;
}
if ($a != 2) {
$a = 2;
} elseif ($a == 3) {
$a = 4;
} else {
$a = 7;
}if($a != 2)
$a = 2;switch ($numPeople) {
case 1:
break;
case 2:
break;
default:
break;
}osc_enqueue_style(
'carouselCss',
osc_base_url() . 'oc-content/plugins/carousel_for_osclass/css/slideshow.css')
); function ex_load_scripts() {
osc_register_script('jCarouselLite', osc_base_url() . 'oc-content/plugins/carousel_for_osclass/js/jCarouselLite.js', 'jquery');
osc_enqueue_script('jCarouselLite');
osc_enqueue_style('carouselCss', osc_base_url() . 'oc-content/plugins/carousel_for_osclass/css/slideshow.css');
} osc_add_hook('init', 'ex_load_scripts'); osc_add_hook('init_admin', 'ex_load_scripts');osc_register_script('jquery', osc_assets_url('js/jquery.min.js'));
osc_register_script('jquery-ui', osc_assets_url('js/jquery-ui.min.js'), 'jquery');
osc_register_script('jquery-json', osc_assets_url('js/jquery.json.js'), 'jquery');
osc_register_script('jquery-treeview', osc_assets_url('js/jquery.treeview.js'), 'jquery');
osc_register_script('jquery-nested', osc_assets_url('js/jquery.ui.nestedSortable.js'), 'jquery');
osc_register_script('jquery-validate', osc_assets_url('js/jquery.validate.min.js'), 'jquery');
osc_register_script('tabber', osc_assets_url('js/tabber-minimized.js'), 'jquery');
osc_register_script('tiny_mce', osc_assets_url('js/tiny_mce/tiny_mce.js'));
osc_register_script('colorpicker', osc_assets_url('js/colorpicker/js/colorpicker.js'));/**
* $id - Shortname of the route
* $regexp - Regular expression of the url
* $url - Required to be able to create the nice-looking url
* $file - file that will be loaded
*/
osc_add_route($id, $regexp, $url, $file)
Later we just need to get the url:/**
* $id - Shortname of the previously created route
* $args - Optional, only required if your url accept parameters
*/
//For public routes
osc_route_url($id, [$args])
//For routes in the admin panel
osc_route_admin_url($id, [$args])// Create route
osc_add_route(
'dynamic-route',
'dynamic-route/([0-9]+)/(.+)',
'dynamic-route/{my-numeric-param}/{my-own-param}',
osc_plugin_folder(__FILE__).'mydynamicroute.php'
);
// Show link to it
echo osc_route_url(
'dynamic-route',
array(
'my-numeric-param' => '12345',
'my-own-param' =>
'my-own-value'
)
); osc_add_admin_menu_page(
$menu_title,
$url,
$menu_id,
$icon_url = null,
$capability = null,
$position = null ) osc_add_admin_submenu_page(
$menu_id,
$submenu_title,
$url,
$submenu_id,
$capability = null,
$icon_url = null ) osc_remove_admin_menu_page($id_menu); osc_remove_admin_submenu_page( $menu_id, $submenu_id ) osc_admin_menu_items(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
osc_admin_menu_categories(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
osc_admin_menu_pages(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url= null)
osc_admin_menu_appearance(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
osc_admin_menu_plugins(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
osc_admin_menu_settings(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
osc_admin_menu_tools(
$submenu_title, $url, $submenu_id,$capability = null, $icon_url = null )
osc_admin_menu_users(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
osc_admin_menu_stats(
$submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_add_admin_menu_page(
__('Listing'), // menu title
osc_admin_base_url(true).'?page=items', // menu url
'items', // menu id
'moderator' // capability
) ; osc_add_admin_submenu_page(
'items', // menu id
__('Manage listings'), // submenu title
osc_admin_base_url(true).'?page=items', // submenu url
'items_manage', // submenu id
'moderator' // capability
) ;
...crontab \-e\* \* \* \* \* command paramscrontab \-e0 * * * * usr/local/php5/bin/php /home/your\_username/public\_html/index.php \-p cron \-t hourly
0 0 * * * usr/local/php5/bin/php /home/your\_username/public\_html/index.php \-p cron \-t daily
0 0 * * 0 usr/local/php5/bin/php /home/your\_username/public\_html/index.php \-p cron \-t weeklywget domain.com/index.php?page\=cron \-O /dev/nullwget domain.com/index.php?page\=cron \-O /dev/null
$aFeatured = array();
$out_featured = osc_file_get_contents(osc_market_featured_url('plugins', 3));
$array_featured_plugins = (array) json_decode($out_featured, true);
$out_featured = osc_file_get_contents(osc_market_featured_url('themes', 3));
$array_featured_themes = (array) json_decode($out_featured, true);
$this->_exportVariableToView("aFeatured",
array_merge($array_featured_plugins, $array_featured_themes));oc-admin/themes/modern/main/index.php$aFeatured = __get('aFeatured');osc_register_script('market-js',
osc_current_admin_theme_js_url('market.js'), array('jquery', 'jquery-ui'));
osc_enqueue_script('market-js');
osc_add_hook('admin_header','add_market_jsvariables');<style>
.mk-item {
width: 90%;
margin:5%;
margin-top: 3%;
}
.mk-item-plugin {
height: 225px;
}
.mk-item .mk-info {
width:auto;
}
.mk-item-plugin .banner , .mk-item-theme .banner {
width: 90%;
height: 155px;
border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
}
.mk-item-plugin .mk-info {
height: 40px;
padding: 170px 15px 15px;
}
</style><div class="grid-row grid-first-row grid-50">
<div class="row-wrapper">
<div class="widget-box widget-box-project">
<div class="widget-box-title"><h3><?php _e('Featured products'); ?></h3></div>
<div class="widget-box-content widget-box-content-no-wrapp">
<?php foreach($aFeatured['themes'] as $p) {
drawMarketItem($p);
} ?>
<?php foreach($aFeatured['plugins'] as $p) {
drawMarketItem($p);
} ?>
</div>
</div>
</div>
</div>
<div class="grid-row grid-50">
<div class="row-wrapper">
<div class="widget-box">
<div class="widget-box-title"><h3><?php _e('Market'); ?></h3></div>
<div class="widget-box-content widget-box-content-no-wrapp">
<div id="banner_market"></div>
</div>
</div>
</div>
</div><script type="text/javascript">
$(function(){
$.getJSON(
'<?php echo osc_admin_base_url(true); ?>?page=ajax&action=dashboardbox_market',
function(data){
if(data.error===0) {
$('<a href="'+oscEscapeHTML(data.url)+'" target="_blank"><div style="height: 100%; width: 100%; background: url('+oscEscapeHTML(data.banner)+') no-repeat;"></div></a>').insertAfter('#banner_market');
}else {
$('<p style="text-align:center; padding-top:15px;"><?php _e('Has been a problem loading the contents, sorry for the inconvenience'); ?></p>').insertAfter('#banner_market');
}
});
});
</script>/**
* Copy this code to config.php file
* This will disable notice and strict errors
*/
define('OSC_DEBUG', false) ;/**
* Copy this code to config.php file
* This will show all error notices and warnings on the site
*/
define('OSC_DEBUG', true) ;/**
* Copy this code to config.php file
* This will log all error notices and warnings to a file called debug.log in oc-content
*/
define('OSC_DEBUG', true) ;
define('OSC_DEBUG_LOG', true) ;


