blog->settings->addNamespace('enhancePostContent'); require dirname(__FILE__) . '/_widgets.php'; # Admin menu $_menu['Blog']->addItem( __('Enhance post content'), 'plugin.php?p=enhancePostContent', 'index.php?pf=enhancePostContent/icon.png', preg_match( '/plugin.php\?p=enhancePostContent(&.*)?$/', $_SERVER['REQUEST_URI'] ), $core->auth->check('contentadmin', $core->blog->id) ); $core->addBehavior( 'adminDashboardFavorites', ['epcAdminBehaviors', 'adminDashboardFavorites'] ); $core->addBehavior( 'adminBlogPreferencesForm', ['epcAdminBehaviors', 'adminBlogPreferencesForm'] ); $core->addBehavior( 'adminBeforeBlogSettingsUpdate', ['epcAdminBehaviors', 'adminBeforeBlogSettingsUpdate'] ); $core->addBehavior( 'adminFiltersLists', ['epcAdminBehaviors', 'adminFiltersLists'] ); class epcAdminBehaviors { public static function adminDashboardFavorites($core, $favs) { $favs->register('enhancePostContent', [ 'title' => __('Enhance post content'), 'url' => 'plugin.php?p=enhancePostContent', 'small-icon' => 'index.php?pf=enhancePostContent/icon.png', 'large-icon' => 'index.php?pf=enhancePostContent/icon-big.png', 'permissions' => $core->auth->check('contentadmin', $core->blog->id), 'active_cb' => [ 'epcAdminBehaviors', 'adminDashboardFavoritesActive' ] ]); } public static function adminDashboardFavoritesActive($request, $params) { return $request == 'plugin.php' && isset($params['p']) && $params['p'] == 'enhancePostContent'; } public static function sortbyCombo() { return [ __('Date') => 'epc_upddt', __('Key') => 'epc_key', __('Value') => 'epc_value', __('ID') => 'epc_id' ]; } public static function adminBlogPreferencesForm(dcCore $core, dcSettings $blog_settings) { $active = (boolean) $blog_settings->enhancePostContent->enhancePostContent_active; $allowedtplvalues = libEPC::blogAllowedTplValues(); $allowedpubpages = libEPC::blogAllowedPubPages(); echo '
' . __('This enable public widgets and contents filter.') . '
' . '' . '' . __('This is a special feature to edit list of allowed template values and public pages where this plugin works.') . '
' . '' . form::field('epc_allowedtplvalues', 100, 0, libEPC::implode($allowedtplvalues)) . '
' . '' . __('Use "readable_name1:template_value1;readable_name2:template_value2;" like "entry content:EntryContent;entry excerpt:EntryExcerpt;".') . '
' . '' . form::field('epc_allowedpubpages', 100, 0, libEPC::implode($allowedpubpages)) . '
' . '' . __('Use "readable_name1:template_page1;readable_name2:template_page2;" like "post page:post.html;home page:home.html;".') . '
' . '