예제 #1
0
    def configure(self, config, target_dir, plugin=False):
        wp_page_slugs = [
            'general',
            'writing',
            'reading',
            'discussion',
            'media',
            'permalink',
        ]
        items = []
        for name, cnf in config.items():
            page_config = {}
            page_config.update(cnf)

            if name in wp_page_slugs:
                standalone = False
            else:
                standalone = True

            page_config.update({
                'module': {
                    'name': name,
                    'classname': plugin_classname(name),
                    'slug': slugify(name, '-'),
                    'wp_page_slug': slugify(name, '_'),
                    'standalone': standalone,
                }
            })

            items.append(page_config)

            template_vars = {}
            template_vars.update(plugin._config)
            template_vars.update(page_config)

            self.add_template(
                'include/{{plugin_namespace}}/Settings/Settings{{module.classname}}.php',
                template_vars)

            if 'css' in page_config:
                self.add_template(
                    'src/scss/admin/settings/{{module.slug}}.scss',
                    template_vars)
                plugin.add_template('src/scss/mixins/_mixins.scss')
                plugin.add_template('src/scss/variables/_colors.scss')
                plugin.add_template('src/scss/variables/_dashicons.scss')
                plugin.add_template('src/scss/variables/_variables.scss')

            if 'js' in page_config:
                self.add_template('src/js/admin/settings/{{module.slug}}.js',
                                  template_vars)

        super().configure(config, target_dir, plugin)
예제 #2
0
	def config( self, config, target_dir, plugin=False ):

		items = []
		for name, cnf in config.items():
			widget_config = {}
			widget_config.update(cnf)
			widget_config.update({
				'module' : {
					'name'			: name,
					'classname'		: plugin_classname(name),
					'slug'			: slugify( name, '-' ),
				}
			})

			items.append(widget_config)

			template_vars = {}
			template_vars.update(widget_config)
			template_vars.update(plugin._config)

			self.add_template('include/{{plugin_namespace}}/Widget/Widget{{module.classname}}.php', template_vars, False )
			if 'css' in widget_config:
				self.add_template('src/scss/widget/{{module.slug}}.scss', template_vars, False )
				plugin.add_template('src/scss/frontend.scss')
				plugin.add_template('src/scss/mixins/_mixins.scss')
				plugin.add_template('src/scss/variables/_colors.scss')
				plugin.add_template('src/scss/variables/_dashicons.scss')
				plugin.add_template('src/scss/variables/_variables.scss')

			if 'js' in widget_config:
				self.add_template('src/js/widget/{{module.slug}}.js', template_vars, False )

		super().config( config, target_dir, plugin )

		self.template_vars = {'items' : items}
예제 #3
0
	def config( self, config, target_dir, plugin=False ):
		items = []
		for name, cnf in config.items():
			tax_config = {}
			tax_config.update(cnf)
			tax_config.update({
				'module' : {
					'name'		: name,
					'classname'	: plugin_classname(name),
					'slug'		: slugify( name, '-' ),
				}
			})

			items.append(tax_config)

			template_vars = {}
			template_vars.update(tax_config)
			template_vars.update(plugin._config)

			self.add_template('include/{{plugin_namespace}}/Taxonomy/Taxonomy{{module.classname}}.php', template_vars, False )


		super().config( config, target_dir, plugin )

		self.template_vars = {'items' : items }
예제 #4
0
    def configure(self, config, target_dir, plugin=False):
        items = []
        for name, cnf in config.items():
            model_config = {}
            model_config.update(cnf)
            model_config.update({
                'module': {
                    'name': name,
                    'classname': plugin_classname(name),
                    'slug': slugify(name, '_'),
                }
            })

            items.append(model_config)
            template_vars = {}
            template_vars.update(model_config)
            template_vars.update(plugin._config)

            self.add_template(
                'include/{{plugin_namespace}}/Model/Model{{module.classname}}.php',
                template_vars, False)

        super().configure(config, target_dir, plugin)

        self.template_vars = {'items': items}
예제 #5
0
	def configure( self, config, target_dir, plugin=False ):
		items = []
		for name, cnf in config.items():
			pt_config = {}
			pt_config.update(cnf)
			pt_config.update({
				'module' : {
					'name'		: name,
					'classname'	: plugin_classname(name),
					'slug'		: slugify( name, '-' ),
					'caps'		: 'caps' in pt_config
				}
			})

			items.append(pt_config)
			template_vars = {}
			template_vars.update(pt_config)
			template_vars.update(plugin._config)


			self.add_template('include/{{plugin_namespace}}/PostType/PostType{{module.classname}}.php', template_vars, False )

		super().configure( config, target_dir, plugin )

		self.template_vars = {'items' : items }
예제 #6
0
    def configure(self, config, target_dir, plugin=False):

        items = []
        for name, cnf in config.items():
            wprest_config = {}
            wprest_config.update(cnf)
            wprest_config.update({
                'module': {
                    'name': name,
                    'classname': plugin_classname(name),
                    'slug': slugify(name, '-'),
                }
            })

            items.append(wprest_config)

            template_vars = {}
            template_vars.update(wprest_config)
            template_vars.update(plugin._config)

            self.add_template(
                'include/{{plugin_namespace}}/WPRest/WPRest{{module.classname}}.php',
                template_vars)

        super().configure(config, target_dir, plugin)
예제 #7
0
	def configure( self, config, target_dir, plugin=False ):

		super().configure( config, target_dir, plugin )

		for name, cnf in config.items():
			widget_config = {}
			widget_config.update({
				'module' : {
					'name'			: name,
					'classname'		: plugin_classname(name),
					'slug'			: slugify( name, '-' ),
				}
			})

			template_vars = {}
			template_vars.update(widget_config)
			template_vars.update(plugin._config)

			self.add_template('include/{{plugin_namespace}}/Widget/Widget{{module.classname}}.php', template_vars )
			if 'css' in widget_config:
				self.add_template('src/scss/widget/{{module.slug}}.scss', template_vars )
				plugin.add_template('src/scss/frontend.scss')
				plugin.add_template('src/scss/mixins/_mixins.scss')
				plugin.add_template('src/scss/variables/_colors.scss')
				plugin.add_template('src/scss/variables/_dashicons.scss')
				plugin.add_template('src/scss/variables/_variables.scss')

			if 'js' in widget_config:
				self.add_template('src/js/widget/{{module.slug}}/index.js', template_vars )
예제 #8
0
	def config( self, config, target_dir, plugin=False ):
		wp_page_slugs = [
			'dashboard',
			'posts',
			'media',
			'links',
			'pages',
			'comments',
			'theme',
			'plugins',
			'users',
			'management',
			'options',
		]
		items = []
		for name, cnf in config.items():
			shortcode_config = {}
			shortcode_config.update(cnf)
			shortcode_config.update({
				'module' : {
					'name'				: name,
					'classname'			: plugin_classname(name),
					'slug'				: slugify( name, '-' ),
					'slug_underscore'	: slugify( name, '_' ),
				}
			})

			items.append(shortcode_config)
			template_vars = {}
			template_vars.update(shortcode_config)
			template_vars.update(plugin._config)

			self.add_template('include/{{plugin_namespace}}/Shortcode/Shortcode{{module.classname}}.php', template_vars, False )

			if 'mce' in shortcode_config:
				plugin.add_template('include/{{plugin_namespace}}/Admin/Mce/Mce.php')
				self.add_template('include/{{plugin_namespace}}/Shortcode/Mce/Mce{{module.classname}}.php', template_vars, False )

				self.add_template('src/scss/admin/mce/{{module.slug}}-shortcode-mce-editor.scss', template_vars, False )
				self.add_template('src/scss/admin/mce/{{module.slug}}-shortcode-mce-toolbar.scss', template_vars, False )
				self.add_template('src/js/admin/mce/{{module.slug}}-shortcode.js', template_vars, False )


		super().config( config, target_dir, plugin )

		self.template_vars = {'items' : items }
예제 #9
0
    def configure(self, config, target_dir, plugin=False):
        wp_page_slugs = [
            'dashboard',
            'posts',
            'media',
            'links',
            'pages',
            'comments',
            'theme',
            'plugins',
            'users',
            'management',
            'options',
        ]
        items = []
        for name, cnf in config.items():
            page_config = {}
            page_config.update(cnf)
            if name in wp_page_slugs:
                wp_page_slug = name
            else:
                wp_page_slug = 'dashboard'

            page_config.update({
                'module': {
                    'name': name,
                    'classname': plugin_classname(name),
                    'slug': slugify(name, '-'),
                    'wp_page_slug': wp_page_slug,
                }
            })

            items.append(page_config)

            template_vars = {}
            template_vars.update(plugin._config)
            template_vars.update(page_config)

            self.add_template(
                'include/{{plugin_namespace}}/Admin/AdminPage{{module.classname}}.php',
                template_vars, False)

            if 'css' in page_config:
                self.add_template('src/scss/admin/page/{{module.slug}}.scss',
                                  template_vars, False)
                plugin.add_template('src/scss/mixins/_mixins.scss')
                plugin.add_template('src/scss/variables/_colors.scss')
                plugin.add_template('src/scss/variables/_dashicons.scss')
                plugin.add_template('src/scss/variables/_variables.scss')

            if 'js' in page_config:
                self.add_template('src/js/admin/page/{{module.slug}}.js',
                                  template_vars, False)

        super().configure(config, target_dir, plugin)

        self.template_vars = {'items': items}
예제 #10
0
    def configure(self, config, target_dir, plugin=False):

        items = []
        for name, cnf in config.items():
            shortcode_config = {}
            shortcode_config.update(cnf)
            shortcode_config.update({
                'module': {
                    'name': name,
                    'classname': plugin_classname(name),
                    'slug': slugify(name, '-'),
                    'slug_underscore': slugify(name, '_'),
                }
            })

            items.append(shortcode_config)
            template_vars = {}
            template_vars.update(shortcode_config)
            template_vars.update(plugin._config)

            self.add_template(
                'include/{{plugin_namespace}}/Shortcode/Shortcode{{module.classname}}.php',
                template_vars)

            if 'mce' in shortcode_config:
                plugin.add_template(
                    'include/{{plugin_namespace}}/Admin/Mce/Mce.php')
                self.add_template(
                    'include/{{plugin_namespace}}/Shortcode/Mce/Mce{{module.classname}}.php',
                    template_vars)

                self.add_template(
                    'src/scss/admin/mce/{{module.slug}}-shortcode-mce-editor.scss',
                    template_vars)
                self.add_template(
                    'src/scss/admin/mce/{{module.slug}}-shortcode-mce-toolbar.scss',
                    template_vars)
                self.add_template(
                    'src/js/admin/mce/{{module.slug}}-shortcode.js',
                    template_vars)

        super().configure(config, target_dir, plugin)
예제 #11
0
	def config( self, config, target_dir, plugin=False ):
		wp_page_slugs = [
			'dashboard',
			'posts',
			'media',
			'links',
			'pages',
			'comments',
			'theme',
			'plugins',
			'users',
			'management',
			'options',
		]
		items = []
		for name, cnf in config.items():
			page_config = {}
			page_config.update(cnf)
			if name in wp_page_slugs:
				wp_page_slug = name
			else:
				wp_page_slug = 'dashboard'

			page_config.update({
				'module' : {
					'name'			: name,
					'classname'		: plugin_classname(name),
					'slug'			: slugify( name, '-' ),
					'wp_page_slug'	: wp_page_slug,
				}
			})

			items.append(page_config)

			template_vars = {}
			template_vars.update(plugin._config)
			template_vars.update(page_config)

			self.add_template('include/{{plugin_namespace}}/Admin/AdminPage{{module.classname}}.php', template_vars, False )

			if 'css' in page_config:
				self.add_template('src/scss/admin/page/{{module.slug}}.scss', template_vars, False )
				plugin.add_template('src/scss/mixins/_mixins.scss')
				plugin.add_template('src/scss/variables/_colors.scss')
				plugin.add_template('src/scss/variables/_dashicons.scss')
				plugin.add_template('src/scss/variables/_variables.scss')

			if 'js' in page_config:
				self.add_template('src/js/admin/page/{{module.slug}}.js', template_vars, False )

		super().config( config, target_dir, plugin )

		self.template_vars = {'items' : items }
예제 #12
0
	def config( self, config, target_dir, plugin=False ):
		items = []
		for name, cnf in config.items():
			model_config = {}
			model_config.update(cnf)
			model_config.update({
				'module' : {
					'name'			: name,
					'classname'		: plugin_classname(name),
					'slug'			: slugify( name, '_' ),
				}
			})

			items.append(model_config)
			template_vars = {}
			template_vars.update(model_config)
			template_vars.update(plugin._config)

			self.add_template('include/{{plugin_namespace}}/WPCLI/WPCLI{{module.classname}}.php', template_vars, False )
			self.add_template('include/{{plugin_namespace}}/WPCLI/Commands/{{module.classname}}.php', template_vars, False )

		super().config( config, target_dir, plugin )

		self.template_vars = {'items' : items }
예제 #13
0

source_dir = os.path.dirname(os.path.realpath(__file__))

first, conf = parse_arg(sys.argv[1])

if first == '--force' or first in p.factory.factory.modules:
    # first arg is a module
    plugin_name = False
    module_argv = sys.argv[1:]
    plugin_dir = os.getcwd()
else:
    # first arg is a plugin name
    plugin_name = sys.argv[1]
    module_argv = sys.argv[2:]
    plugin_dir = os.getcwd() + '/' + slugify(plugin_name, '-')

module_args = parse_args(module_argv)

is_update = False

try:
    # update existing
    f = codecs.open(plugin_dir + '/' + 'wp-plugin-boilerplate.json',
                    'rb',
                    encoding='utf-8')
    config = json.loads(f.read())
    f.close()
    plugin_name = config['plugin_name']

    if module_args == None:
예제 #14
0

source_dir = os.path.dirname(os.path.realpath(__file__))

first,conf = parse_arg(sys.argv[1])

if first == '--force' or first in p.factory.factory.modules:
	# first arg is a module
	plugin_name = False
	module_argv = sys.argv[1:]
	plugin_dir = os.getcwd()
else:
	# first arg is a plugin name
	plugin_name = sys.argv[1]
	module_argv = sys.argv[2:]
	plugin_dir = os.getcwd() + '/' + slugify( plugin_name, '-' )

is_update = False
try:
	# update existing
	f = codecs.open( plugin_dir + '/' + 'wp-plugin-boilerplate.json', 'rb', encoding = 'utf-8' )
	config = json.loads(f.read())
	f.close()
	plugin_name = config['plugin_name']
	module_args = parse_args( module_argv )
	if module_args == None:
		module_args = {}

	# add module args
	for mod_key,module in config['modules'].items():
		if mod_key in module_args: